WordPress.org

Ready to get started?Download WordPress

Forums

How to pull in both published and future posts in custom query (1 post)

  1. huckmag
    Member
    Posted 1 year ago #

    Hi,

    I have a piece of code that is checking if there is a tag equal to the slug of the current post and whether that tag has at least two instances.

    This is a way of me connecting content of certain posts to a live blog.

    The code below works perfectly but does not work for posts scheduled.

    Does anyone know how I can query both published and future posts in the code below?

    I've been racking my brains but nothing seems to work. Any help would be hugely appreciated!

    <?php
    				if ($all_the_tags);
    				$slug = basename(get_permalink());
    				$all_the_tags = get_the_tags();
    				foreach($all_the_tags as $this_tag) {
    				if (($this_tag->slug == $slug ) && ($this_tag->count >= '2' )) {
    				?>
    
    				<a href="#modal" class="second button">View the live updates</a>
    
    				<?
    
    				}
    				}
    				?>

Topic Closed

This topic has been closed to new replies.

About this Topic