home.php show blog posts as grid view

It’s a little bit hard to guess, what exactly do you want to achieve (you’ve mentioned something about four posts in a row and then there is number 6 in your for loop), but… If you want to display only 4 posts in your loop, then you can use current_post field of $wp_query, so the … Read more

Generating a perfect loop

That’s because you’re looping twice due to the while. Completely unecessary. foreach ($orders_ids as $details) { $order = wc_get_order($details->order_id); $fornavn = $order->get_billing_first_name(); $etternavn = $order->get_billing_last_name(); $deltakerkategori = $order->get_meta( ‘_billing_field_447’, true ); $deltakerradio = $order->get_meta( ‘_billing_field_538′, true ); echo ”.$fornavn.’ ‘.$etternavn.’ ‘.$deltakerkategori.”https://wordpress.stackexchange.com/”.$deltakerradio.'<br>’; } Additionally, if that doesn’t fix it due to…well, magic, try this patch: foreach( … Read more

WP Query Leads to 502 Bad Gateway (Timeout Because Query Takes Too Long)

It has nothing to do with WP_Query itself. The reason for such problem is what you do with this WP_Query. There’s no the_post() in your code, so the loop is infinite. This is how to fix it: function bambam(){ $args = array( ‘category_name’ => ‘breaking-news’, ‘post_date’ => ‘DESC’, ‘posts_per_page’ => 1 ); $the_query = new … Read more

Query to get child pages of current page and display it in action hook

I was making a beginner’s mistake. I was not defining the global variable post. I publish my complete code for the community. May be useful for something like me. <?php add_action( ‘genesis_after_entry’, ‘capitulos_curso’ ); function capitulos_curso(){ global $post; $args = array( ‘post_type’ => ‘curso’, ‘posts_per_page’ => -1, ‘post_parent’ => $post->ID, ‘order’ => ‘ASC’, ‘orderby’ => … Read more