-
Notice: Trying to get property of non-object in /var/html/www/wp/wp-content/plugins/fv-gravatar-cache/fv-gravatar-cache.php on line 244
KB
ParticipantI am having posts that are in ‘Pending’ status showing up in the footers in the ‘most commented’ section because I have a program that imports my posts and comments from Google+.
How can I filter out posts that have not been published?
Thanks.
AdvertismentNotice: Trying to get property of non-object in /var/html/www/wp/wp-content/plugins/fv-gravatar-cache/fv-gravatar-cache.php on line 244Daniel Tara
KeymasterNotice: Trying to get property of non-object in /var/html/www/wp/wp-content/plugins/fv-gravatar-cache/fv-gravatar-cache.php on line 244 Notice: A non well formed numeric value encountered in /var/html/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118 Notice: A non well formed numeric value encountered in /var/html/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119 Notice: A non well formed numeric value encountered in /var/html/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118 Notice: A non well formed numeric value encountered in /var/html/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119I have checked the theme’s function clearly selects only posts that are published, however it’s doing it in an old-fashioned way. Try opening the file functions.php and for the function
list_most_commented
change the line:1$posts = $wpdb->get_results("SELECT comment_count,ID,post_title,post_status FROM $wpdb->posts WHERE post_status='publish' ORDER BY comment_count DESC LIMIT 0 , 6");with:
1234$posts = get_posts( array('numberposts' => 6,'orderby' => 'post_date') );- This reply was modified 8 years, 9 months ago by Daniel Tara.
Notice: Trying to get property of non-object in /var/html/www/wp/wp-content/plugins/fv-gravatar-cache/fv-gravatar-cache.php on line 244KB
ParticipantTHANKS!
This worked and got rid of the pending posts… but it doesn’t seem to be counting the posts right. It shows three that have a few comments on them but the one that has the most comments isn’t in the list.
Does this take some time for it to recalibrate or should I look at something?
Notice: Trying to get property of non-object in /var/html/www/wp/wp-content/plugins/fv-gravatar-cache/fv-gravatar-cache.php on line 244Daniel Tara
KeymasterNotice: A non well formed numeric value encountered in /var/html/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118 Notice: A non well formed numeric value encountered in /var/html/www/wp/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119Sorry I made a type, here’s the correct code:
1234$posts = get_posts( array('numberposts' => 6,'orderby' => 'comment_count') );
You must be logged in to reply to this topic.