Editing Loop So It Targets Specific Tags?

Use the pre_get_posts action to modify the main query. Place this in your functions.php file: function wpa71787_home_tag_query( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘tag’, ‘reviews’ ); } } add_action( ‘pre_get_posts’, ‘wpa71787_home_tag_query’ ); You can set any valid parameters of WP_Query with this method. Edit, secondary query excluding tagged posts, use … Read more

Display all categories as plain text

This is a general solution for all taxonomies. To be used inside the loop (else replace get_the_ID() with post ID ): $taxonomy = ‘category’; $terms = get_the_terms( get_the_ID(), $taxonomy ); if( $terms ){ $term_slugs = array_map(‘esc_attr’,wp_list_pluck( $terms, ‘slug’)); $class = implode(‘ ‘, $term_slugs); }else{ $class=”no-term”; }

How do i create a list-posts-page?

Assuming you’re only trying to display your blog posts index on a page other than the front page (i.e. because you’ve assigned a static page as your site front page), you shouldn’t need to do anything special. Refer to the Codex for step-by-step instructions for creating a static front page and separate page for your … Read more

Pagination for two loops

You have to pass pagination parameters to your queries as well. As it is, you are just pulling 5 posts. By default that is going to be the most recent five. Then another query pulls the next five. The fact that you are trying to paginate two loops makes this trickier than normal. However… At … Read more

Using has_tag() outside loop

The has_tag() conditional does not have to be used inside the Loop; it can be passed a $post object as a second parameter: has_tag( $tag, $post ); Since has_tag() defaults to the current post, you simply need to pass it the object for the next adjacent post. Fortunately, WordPress provides a function to retrieve adjacent … Read more

WordPress Queries Not Working?

For the sidebar bit, you should be using a new Wp_Query: if ( $query->is_category(‘movies’) ): $movies = new Wp_Query(‘tag=movie-reviews’); while ( $movies->have_posts() ) : $movies->the_post(); get_template_part( ‘sidebar-reviews’, get_post_format() ); endwhile; else: get_template_part( ‘no-results’, ‘index’ ); endif; You don’t need query filters for anything except the main loop on a page.