Change some snippet depending on ID
-
Hi There
really having a hard time to figure this out.
I have a loop showing a certain category of post. Now I need a different pice of code for e certain Post and I can’t seem to get it to workhere Is my code example
<?php $new_query = new WP_Query(); ?> <?php $new_query->query('cat=23&orderby=title&order=asc'); ?> <?php while ($new_query->have_posts()) : $new_query->the_post(); ?> <h3><?php the_title(); ?></h3> <?php the_content(); ?> // How to display this code snippet only for post ID 5 <p>I am Post ID 5</p> // And this snippet for the others <p>I am not Post ID 5</p> <?php endwhile; ?>
Thanks for any input
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Change some snippet depending on ID’ is closed to new replies.