Support » Theme: Expound » Limiting number of featured posts

  • Hi. I’ve created a section that shows posts only from one category, and managed to exclude that category from the homepage and featured posts (that’s how I did it:
    Now my problem is the excess of featured posts. I have that main big featured post, and instead of 4 secondary posts, I have 9! So I think Expound is “generating” 10 featured posts.
    I’m suspicious of this line in the functions.php file:
    $count = apply_filters( 'expound_featured_posts_count', 5 );
    Changing that “5” worked before I made that changes. Now it doesn’t change anything.
    Any advice?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I added one line to the functions.php file (it was too late to use a child theme, I’ll set up one later):

    function expound_get_featured_posts() {
    //the line I added to filter a category
    	return new WP_Query(array('category__not_in' => (8) ) );
    	global $wp_query;	
    	// Default number of featured posts
    	$count = apply_filters( 'expound_featured_posts_count', 5 );

    When I delete that line, the theme returns to normal (1+4 featured posts, but including the category “8”).

    Theme Author Konstantin Kovshenin


    The line that you have added is running and returning a new query, completely ignoring everything else in the function. Take a look at the original expound_get_featured_posts() function in the parent theme, that’s how your child theme function has to look, with the addition of category__not_in to the arguments array.

    Thank you very much, Konstantin! I added the line here:

    if ( empty( $sticky ) ) {
    		return new WP_Query( array(
    			'posts_per_page' => $count,
    			'ignore_sticky_posts' => true,
    			'category__not_in' => (8),
    		) );

    And it worked as I wanted. Thank you again!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Limiting number of featured posts’ is closed to new replies.