WordPress.org

Support

Support » Themes and Templates » [Resolved] Post Format, and Code

[Resolved] Post Format, and Code

  • I’m having a bit of a problem adding the if, else statement to my loop so that I can display differently based on the post format. Can anyone see the error in my code?

    <?php if (have_posts()) : ?>
                <?php while (have_posts()) : the_post(); ?>
                    if ( has_post_format( 'status' )) {
                        <h3><a href="<?php echo get_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
                        <span class="postmeta">Published on <?php the_time('F jS, Y') ?> in <?php the_category(', ') ?></span>
    	                <?php the_content(); ?>
    	            }
                    else {
                        <h3><a href="<?php echo get_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
                        <span class="postmeta">Published on <?php the_time('F jS, Y') ?> in <?php the_category(', ') ?></span>
                        <?php the_excerpt(); ?>
                        <p><a href="<?php echo get_permalink(); ?>" title="Continue reading">Continue reading</a></p>
                    }
                <?php endwhile; ?>
                <?php else : ?>
                    Nothing Found Stuff goes here
                <?php endif; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Post Format, and Code’ is closed to new replies.
Skip to toolbar