WordPress.org

Support

Support » Themes and Templates » [Resolved] [Theme: Simple Catch] Posts – Limit the number of post only in home page, not in other categories.

[Resolved] [Theme: Simple Catch] Posts – Limit the number of post only in home page, not in other categories.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Theme Author Catch Themes
    Participant

    @catchthemes

    Build a child theme and add the following code in your function.php file:

    /**
     * Fixing the Number of Post
     * Used in Homepage
     */
    function simplecatch_home_custom_query( $query ) {
    
    	if (  is_home() )
    		$query->query_vars['posts_per_page'] = 3; // Change 3 to the number of posts you would like to show
    
    	return $query; // Return our modified query variables
    }
    add_filter( 'pre_get_posts', 'simplecatch_home_custom_query' ); // Hook our custom function onto the request filter

    Regards,
    Sakin

    Im really happy, it worked perfect! that’s exactly what i needed thanks Sakin!

    One more thing, please. I forgot to ask how to take the “previous link” at the bottom only in home page. To show only the 3 post and nothing else.

    Theme Author Catch Themes
    Participant

    @catchthemes

    You can hide that through custom css. This will be better. Send me your Site URL and then I will send you the CSS.

    Hi, thanks for your help, im sorry for not writting earlier.

    This is the web page: http://www.goldensunfl.com/web/

    I would like to remove, or hide the previous and next button , only in homepage. I hope you can help me, i tried with css, but couldnt make it.

    Thanks!

    Theme Author Catch Themes
    Participant

    @catchthemes

    @alejjo: You can just hide it by adding the following css in “Custom CSS” box at Appearance -> Theme Options -> Custom CSS

    .home .default-wp-page {
        display: none;
    }

    Thank you!!! 😀 It’s working perfect, just what i needed, thank you very much!!!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] [Theme: Simple Catch] Posts – Limit the number of post only in home page, not in other categories.’ is closed to new replies.