Display images with same specific value?

There’s an infinite number of approaches to this. Here’s a couple that come to mind: 1) You could easily use something like strpos() or a regular expression to see if $image[0] contains a keyword. This approach would be a little less than ideal in my opinion. 2) Add a checkbox or ‘tag’ field to the … Read more

Pagination for custom query throws 404 errors on last pages [duplicate]

Exactly what @Pieter Goosen said. Not only are you creating havoc for WordPress, you’re adding unnecessary load on the server by introducing more queries on top of the main query: function wpse_176933_custom_authors_archive( $wp_query ) { if ( $wp_query->is_main_query() && $wp_query->is_author() ) { $wp_query->set( ‘posts_per_page’, 4 ); $wp_query->set( ‘post_type’, ‘publikasjoner’ ); $wp_query->set( ‘meta_key’, ‘rapportnummer’ ); $wp_query->set( … Read more

Custom shortcode not displaying categories and correct date

Just by looking at your code I see a few places I’d investigate. 1) I don’t see any use of the $atts that come through the shortcode. Specifically the ‘tax’ and ‘post_per_page’ attributes. So try changing this; ‘tax’ => ”, to this: ‘tax_query’ => array( array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => ‘$atts[‘tax’]’, … Read more

Custom search (wp query by custom fields)

Found the problem – i was using array, when i just needed to use such arguments: $args = array( ‘post_type’=> ‘post’, ‘paged’ => $paged, ‘posts_per_page’ => 9, ‘meta_key’ => ‘summary’, ‘meta_value’ => $thesearch, ‘meta_compare’ => ‘LIKE’ ); Thanks for help guys.

Can’t get the_content to show

You never start the main loop: <?php if (have_posts()) : ?> <h1 class=”pricing”>Prices</h1> <h2><?php the_title(); ?></h2> <?php the_content(); ?> You check if there are posts in the main query, but you never start the loop, and jump straight to showing the title and content, you need to move everything into a main post loop. Without … Read more