wordpress - Merging PHP codes -
i want combine 1 part of php code part, , can't seem figure out how it.
this code:
<?php if (is_single()) { while (have_posts()) : the_post(); // thumbnail wikiwp_get_thumbnail($post); ?> <div>this should stay here in post</div> <div>and should visible in case</div> <?php endwhile; } else { ?> <div>this should stay here in page</div> <?php } ?>
i want add first bit of php endwhile. want put bit:
<?php if (is_page()) { while (have_posts()) : the_post(); // thumbnail wikiwp_get_thumbnail($post); ?>
into part: (without breaking code)
<?php endwhile; } else { ?>
the result is: if single post show:
[thumbnail] should stay here , should visible in case
if page show:
[thumbnail] should stay here on page
how this?
<?php if (is_single() || is_page()) { while (have_posts()): the_post(); # page + post wikiwp_get_thumbnail($post); # post if (is_single()) { ?> <div>this should stay here in post</div> <div>and should visible in case</div> <?php } else if (is_page()) { ?> <div>this should stay here in page</div> <?php } endwhile; } else { ?> <div>this neither page or post!</div> <?php } ?>
Comments
Post a Comment