Tags on page (not post) returns nothing – why? Improved clarified question!
I solved it. Should be using elseif($tag->slug) instead of elseif($tag->name) or else it will never be true.
I solved it. Should be using elseif($tag->slug) instead of elseif($tag->name) or else it will never be true.
Looks like you have an extra closing div tag and section tag. Add html comments to the closing div tags to keep track of which div they belong to like this: </div> <!– /.ras-tr –> </div> <!– /.ras-tbody –> </div> <!– /.ras-table –> </div> <!– /.ras-item –> Also verify that there isn’t another template that … Read more
The main issue in your code is caused by the call to zss_social_buttons() in your filter function: // In zss_insert_share_buttons(): $social_share_buttons = zss_social_buttons(); // NULL $content .= $social_share_buttons; And the problem there is that zss_social_buttons() is echoing the sharing links/buttons instead of returning them, so they’re not actually added to the $content variable. Instead, they’re … Read more
I believe that your syntax is wrong in the variables you set up in your foreach loop. Because you’re referencing an object and not an array, you need to use this format: $author_ID = $value->ID and… $value->display_name We also discovered that the foreach loop isn’t necessary, so I’m removing it from the answer. The other … Read more
Have you tried with “post_status” instead of “status” as documentation says: https://developer.wordpress.org/reference/classes/wp_query/#status-parameters ?
In WordPress, we have what is called as “main query” which points to the global $wp_query object (which is an instance of the WP_Query class), and this main query is run on page load after WordPress parses query arguments from the current URL (or the relevant query for the matching rewrite rule for that URL). … Read more
Unfortunatelly, I didn’t understand your question right, but I see only 2 possible problems here. Here you will need to use: $blog->current_post – current post index $blog->post_count – total posts If you need to wrap each 4 posts with a div, and if there are less then 4 posts in the end, wrap them to. … Read more
SOLVED with the magic of paginate_links (after the endwhile) <?php $big = 999999999; // need an unlikely integer echo paginate_links( array( ‘base’ => str_replace( $big, ‘%#%’, esc_url( get_pagenum_link( $big ) ) ), ‘format’ => ‘?paged=%#%’, ‘current’ => max( 1, get_query_var(‘paged’) ), ‘total’ => $loop->max_num_pages ) ); ?>
delete the following line of code if ( ( $posts->current_post + 1 ) === $posts->post_count ) echo ‘</li>’; leaving only the following portion <?php $last_year = $year; endwhile; ?>
Your query args are not quite correct. When you want to order by a custom field, you need to specify a meta_key argument, and set your orderby to the kind of ordering you need. For example: $args = array( ‘tax_query’ => array( array( ‘taxonomy’ => ‘topic’, ‘field’ => ‘slug’, ‘terms’ => ‘movie’, ), ), ‘post_type’ … Read more