How to create bootstrap grid loop?

Okay I got it! And this code works perfectly for me. 🙂 <?php $args=array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 4, ‘paged’ => $paged, ‘tax_query’ => array( array( ‘taxonomy’ => ‘post_format’, ‘field’ => ‘slug’, ‘terms’ => array(‘post-format-video’), ‘operator’ => ‘IN’) ) ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { $i = 0; … Read more

Loop inside query

This is a PHP syntax error – you can’t nest a foreach inside an array, you use it to build the array: $query = [ ‘post_type’ => $post_type, ‘posts_per_page’ => -1, ‘tax_query’ => [ ‘relation’ => ‘OR’, ], ]; foreach ( $taxonomy_arr as $t ) { $query[‘tax_query’][] = [ ‘taxonomy’ => $t[‘taxonomy’], ‘terms’ => $t[‘value’], … Read more

ACF – add a group inside a repeater [closed]

You code looks very confusing. Why are you using the ‘foreach’? If you follow the ACF documentation, you just need to use: <?php if( have_rows(‘questions’) ): while( have_rows(‘questions’) ): the_row(); // vars $repeater-item = get_sub_field(‘repeater-item’); ?> <div class=”content”> <?php the_sub_field(‘caption’); ?> </div> For the group. Source: https://www.advancedcustomfields.com/resources/group/ And you only have to use: if( have_rows(‘item’) … Read more

in Foreach Loop the Description is not showing?

Please read about the get_the_permalink and get_the_title. These functions are developed to fetch the details from global $post variable. Your local $post won’t be effective here. You should either pass local $post to these functions like get_the_permalink($post) and get_the_title($post). For get_the_content, you will need to use apply_filters(‘the_content’,$post->post_content); However, preferred way is to create an object … Read more

Conditional: IF current user has NOT commented on current post (not including post author)

[EDIT] Here is the modified code: $post_id = get_the_ID(); // ID of the current post. $user_id = get_current_user_id(); // ID of the current user. $post_author_id = get_post_field( ‘post_author’, $post_id ); $is_post_author = ( $user_id && $post_author_id == $user_id ); $can_comment = $is_post_author; /* * If $can_comment is not yet TRUE, then it’s because either: * … Read more

Get author Meta for particular user inside the loop

The function get_the_author_meta(‘ID’) will return the ID of the author for the current post. That means this line should work. get_avatar( get_the_author_meta( ‘ID’ ), 120); This will not work get_avatar( get_the_author_meta( ‘4’ ), 120); Because you are trying to get a property named ‘4’ inside the user object and that property doesn’t exist. If you … Read more

Custom loop not working

Try this: $args = array( ‘post_type’=> ‘televisie’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 5, ‘meta_key’ => ‘layout_meta_box’, ‘meta_value’ => ‘synopsis’, ); A helpful article too: https://css-tricks.com/snippets/wordpress/custom-loop-based-on-custom-fields/