Else and ElseIf With Advanced Page Fields
-
I have a slider that could include 3 different types of content pulled from advanced special fields. The reason I say “advanced” is because Im using the advanced custom fields plugin. That is why it used “the_field” instead of “get_post_meta”.
Here is my code that currently displays everything but I want it to only display one item based on the fact that the others would be empty.
<div id="slides"> <?php query_posts(array('post_parent' => $post->ID, 'post_type' => 'page')); while (have_posts()) { the_post(); ?> <div class="slide"> <!-- if navigation_main_image --> <a href='<?php the_permalink() ?>' rel="bookmark"><img src="<?php the_field('navigation_main_image') ?>" /></a> <!-- if page_image --> <a href='<?php the_permalink() ?>' rel="bookmark"><img src="<?php the_field('page_image') ?>" /></a> <!-- if content_image --> <div id="contentimg"><img src="<?php the_field('content_image') ?>" /></div> <div id="contenttext"> <h1 class="entry-title"><?php the_title(); ?></h1> <?php the_content(); ?> </div> <div style="clear:both"></div> </div> <?php } ?> </div>
Please any help would be awesome!! Thank You!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Else and ElseIf With Advanced Page Fields’ is closed to new replies.