Blog posts repeat
Blog posts repeat
Blog posts repeat
Dave, your code seems good except a couple things in it, so please try it: function exclude_featured_post( $query ) { if ( is_front_page() && $query->is_main_query() ) { $meta_query = $query->get(‘meta_query’) ? $query->get(‘meta_query’) : array(); // append yours $meta_query[] = array( ‘key’ => ‘featured_post’, // please make sure that key is correct ‘value’ => ‘1’, ‘compare’ … Read more
More then one menu items are assigned with “current-menu-item” class
There was a plugin interfering with the code (Jetpack infinite scroll). Upon disabling it, the first page of the blog correctly displayed 10 posts.
The explanation is in the comments: <?php … if ( $query->have_posts() ) : //number of small ones needed = a third of total number of posts $numsmallneeded = round($query->post_count / 3); … while ( $query->have_posts() ) : $query->the_post(); //if no more small sizes are needed, use big if ( !$numsmallneeded ) $size = 1; //if … Read more
woocommerce get_price_html not pulling in correct price
The native WordPress way would be to register a custom post type for “Routes” and then Taxonomies for “Stops” and “Buses”. Using Custom Fields you can handle the start and end time. You can add Meta Fields to the Post Type, so you don’t have to declare the custom fields each time. Here’s a tutorial … Read more
Try this: ` $paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1; $genral_args = array( ‘posts_per_page’ => ’50’, ‘post_type’ => ‘documents’, ‘cat’ => ‘your-category-id’, ‘paged’ => $paged ); $genral_query = new WP_Query( $genral_args ); while ( $genral_query->have_posts() ) : $genral_query->the_post(); ?> <?php //If we have the posts… if (the_field (‘title’)) : … Read more
posts_per_page not working for first page of pagination
You do not need to explicitly call the post-single template, this is something wordpress is doing automagically for you based on the URL structure. For archive URLs the archive template will be “called” while for single posts the single template will be “called. There are fullbacks with the ultimate one is the index.php template. For … Read more