WordPress Custom Query to get Most Commented Posts in the Past 7 Days

This should do it: $querystr = “SELECT comment_count, ID, post_title FROM $wpdb->posts wposts, $wpdb->comments wcomments WHERE wposts.ID = wcomments.comment_post_ID AND wposts.post_status=”publish” AND wcomments.comment_approved=’1′ AND wcomments.comment_date > DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 YEAR) GROUP BY wposts.ID ORDER BY comment_count DESC LIMIT 0 , 10 “;

How do I use pagination in WordPress?

As in the comments, it’s not clear why you can’t use the options: dashboard -> settings -> reading -> Blog pages show at most [] posts However, if it is necessary that this be done via altering the query (say to target only specific pages, or archives) then this should really be done on pre_get_post: … Read more

meta tag placement for google verification

The meta tag Google is searching for has to be put into the head section of your HTML. You cannot change this section in a post editor. If you don’t want to edit your theme files: Install the plugin Magic Widgets and activate it (Plugins/Add new). Got to Design/Widgets and drag the Widget Unfiltered Text … Read more

Modify loop but keep the original query, what am I doing wrong?

You can’t concatenate an array onto query_string like that. See Digging Into WordPress’s post about looping for the right format. Alternately, you can use array_merge() like on the query_posts Codex page. Consider using wp_reset_query() after your loop. Sometimes you’ll also see people save the original $query_string to a new variable, modify $query_string, and then reset … Read more

Single-page wordpress theme navigation

I’ve done a few templates that essentially are on one page. I used this code as the starting block for all of them: <?php $my_wp_query = new WP_Query(); $all_wp_pages = $my_wp_query->query(array(‘post_type’ => ‘page’,’posts_per_page’ => -1)); foreach ($all_wp_pages as $value){ $post = get_page($value); $slug = $post->post_name; $title = $post->post_title; $content = apply_filters(‘the_content’, $post->post_content); }; ?> It … Read more