Make category as startpage?

Home Forums Using Thematic ( without a child theme ) Make category as startpage?

This topic is: not resolved

This topic contains 18 replies, has 2 voices, and was last updated by  Gene (emhr) 4 years, 8 months ago.

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #3181

    kraeftan
    Participant

    Hi!
    I want to set my category as my startpage.

    Right now it points to my “home” page but I want it to point to “/?cat=1”

    Any suggestions?

    #3184

    Gene (emhr)
    Keymaster

    Create a child theme and put this in it’s functions.php

    function childtheme_cat_limited_blog( $query ) {
        if ( $query->is_home() && $query->is_main_query() ) {
            $query->set( 'cat', '1' );
        }
    }
    add_action( 'pre_get_posts', 'childtheme_cat_limited_blog' );
    

    Note that this will respect sticky post functionality regardless of the specified category limitation.

    See: Codex entry: pre_get_posts

    #3186

    kraeftan
    Participant

    how do I create a childtheme?

    #3187

    kraeftan
    Participant

    Ok i found the childthemesasample and i moved it, renamed it and activated it. I pasted the code in its fuctions.php

    Dont se any changes :/

    #3188

    Gene (emhr)
    Keymaster

    Can you share your new functions.php file with me using http://pastebin.com ?

    #3189

    Gene (emhr)
    Keymaster

    Also what are your site’s WP-Admin Reading settings?

    #3190

    kraeftan
    Participant
    #3191

    kraeftan
    Participant

    The admin settnings in wordpress are: startpage showed as static page “Home” and default on the rest.

    #3196

    Gene (emhr)
    Keymaster

    Sorry I’m misunderstanding what you’re trying to do. The code that I shared will only work for when you have the Reading setting set to show “Your latest posts” on the Front Page.

    The Reading settings for “Front page displays” a “static page” is really geared for that exactly. To show a wp page’s content on the front and assigning the post loop to another page.

    Do you need a separate front page from the Blog (post loop page)?

    #3200

    kraeftan
    Participant

    Okey I can write exectly want I need.

    First, I have a wordpress that contains buttons as both pages and categories.
    The frotnpage that I want to show is “home” its a category.

    I also made that the “wordpress” catalog point directly to my domain adress in the Wp admin settnings.

    So what I need now is a code or something that will make my “home” category called “/?cat=1” to be the first page when you surf to my domain adress.

    #3202

    Gene (emhr)
    Keymaster

    I think I’m seeing what you want to do now. Try using my code above in a child theme *and* set your WP-Admin reading settings to “Front Page Displays” -> “Your latest posts” and save the setting.

    See if that gives you what you desire.

    #3207

    kraeftan
    Participant

    Followed your instructions and it leaves me with a blank page. You can check it out if you want http://djjokerinc.com/

     

    #3213

    Gene (emhr)
    Keymaster

    Bummer. you probably want to use wp_debug to give you more information to go on than just a white page.

     

    http://codex.wordpress.org/Debugging_in_WordPress

    #3215

    kraeftan
    Participant

    Okey I solved the problem, was some script that wasn’t correct. But the frontpage works, only one thing to go now.  The menu dosen’t show any categories buttons, only pages.  Any fix for that?

    #3217

    Gene (emhr)
    Keymaster

    Did you remove the && $query->is_main_query() part of my code? Because that is what keeps it from affecting the nav menu items as well as other things, widgets for example.

    If that part of the script was what was causing the white page then it’s because your installed version of WordPress 3.2 or earlier. If this is the case you should upgrade your WordPress to the current version (3.5.1 at the time of this post).

Viewing 15 posts - 1 through 15 (of 19 total)

The topic ‘Make category as startpage?’ is closed to new replies.