• How can I check if a post exists, outside the Loop?

    I’m trying to conditionally display a post using the Get A Post plugin. If the post doesn’t exist, I don’t want the DIV to display:

    <?php $announcement = get_post(27);
             if ($announcement) { ?>
                <div id="announcements">
    			<?php get_a_post(27);
                                  the_content(); ?>
    		</div>
    	<?php } ?>

    This returns “Fatal error: Cannot pass parameter 1 by reference”

    Searched everywhere in here but didn’t find a solution. Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Check If Posts Exists?’ is closed to new replies.