• Resolved sebasjapes

    (@sebasjapes)


    This is so basic but I missing something.

    How do I set it up so only the posts within a certain category show up on a page?

    Also how do I exclude a category from just the blog section on my homepage?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter sebasjapes

    (@sebasjapes)

    thanks Michael
    checked out the links, working on the second one but having problems.
    Can you give more instructions for a beginner.

    I added this to the additional CSS in the theme, but no luck.

    function exclude_category( $query ) {
    if ( $query->is_home() && $query->is_main_query() ) {
    $query->set( ‘cat’, ‘nutrition&exercise’ );
    }
    }
    add_action( ‘pre_get_posts’, ‘exclude_category’ );

    Thread Starter sebasjapes

    (@sebasjapes)

    Michael,

    Forget my first reply I managed to figure out my other problem.

    could you help with excluding a category from my front page?
    I tried this code in the theme custom css but no luck.
    I’m copying and pasting with little understanding though. Could you give me a little explanation with it?

    I really appreciate the help.

    function exclude_category( $query ) {
    if ( $query->is_frontpage() && $query->is_main_query() ) {
    $query->set( ‘cat’, ‘-nutrition&exercise’ );
    }
    }
    add_action( ‘pre_get_posts’,function exclude_category( $query ) {
    if ( $query->is_frontpage() && $query->is_main_query() ) {
    $query->set( ‘cat’, ‘-nutrition&exercise’ );
    }
    }
    add_action( ‘pre_get_posts’,function exclude_category( $query ) {
    if ( $query->is_frontpage() && $query->is_main_query() ) {
    $query->set( ‘cat’, ‘-nutrition&exercise’ );
    }
    }
    add_action( ‘pre_get_posts’, ‘exclude_category’ );

    Hi there,

    Please add this code to functions.php file in theme folder: wp-content/themes/kale not the additional css field. It’s php code not css.

    Change also “nutrition&exercise” in this line:
    $query->set( ‘cat’, ‘nutrition&exercise’ );
    to your category ID. When you open “nutrition&exercise” categories in WordPress editor Posts → Categories you will see tag_ID parameter in the URL. This is your categories ID.

    I hope that helps.
    Feel free to reach out if you need anything.

    Theme Author lyrathemes

    (@lyrathemes)

    Thread Starter sebasjapes

    (@sebasjapes)

    Thanks guys, I went with the plugin and fixed it.
    One more request though. I want to change the font in the ‘caption heading’ on the ‘header image’
    I tried the code Jarektheme suggested in another post.

    .logo .header-logo-text {
    Font-family: caveat;
    Font-size: 26px;
    }

    But no luck. I think I may be changing the wrong location (‘logo’ may be wrong) and therefore wrong font.

    Hi there,

    Please try this:

    .frontpage-banner .caption h2 {
      font-family: Caveat;
      font-size: 26px;
    }

    I hope it helps.

    Best,
    Jarek
    Kale Support

    Thread Starter sebasjapes

    (@sebasjapes)

    hi Jarek,

    no luck there.
    I copied and pasted so I’m sure its written out correctly.
    I am posting in the ‘Customizing
    Additional CSS’ for Kale, but no change.

    If you check, gourmetparent.com. I want to match the ‘welcome’ on the header photo to the font used for ‘Kid approved recipes and….’

    Is there something else I’m missing?

    Theme Author lyrathemes

    (@lyrathemes)

    @sebasjapes – You’ve entered the CSS within the comment marks:

    /*
    You can add your own CSS here.
    
    .frontpage-banner .caption h2 {
      font-family: arial;
      font-size: 26px;
    }
    
    Cick the help icon above to learn more.
    */

    You need to take it out of the /* */:

    /*
    You can add your own CSS here.
    
    Cick the help icon above to learn more.
    */
    
    .frontpage-banner .caption h2 {
      font-family: 'Caveat';
      font-size: 26px;
    }
    

    You also had “arial” as the font, instead of Caveat.

    Hope that helps.

    Thread Starter sebasjapes

    (@sebasjapes)

    THANKS!
    I misunderstood, thought it was supposed to be inside comment marks

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘categories on pages’ is closed to new replies.