Conditional logic for article with thumbnail
-
So ive got an idea,
I have 2 kinds of layout for my posts one with a thumbnail and one without. I can load all my posts in my index.php but I’m stuck with the if/els condition to seperate my posts
post with thumbnail:
<article> <div class="clearfix"> <h1>Post with thumbnail in background</h1> <time>16 Januari</time> </div> <p>Post with thumbnail</p> </article>
Post without thumbnail:
<article> <h1>Normal post/h1> <time>16 Januari</time> <hr> <p> a post without thumbnail</p> </article>
I load all my content with this code:
<?php if(have_posts()) { while(have_posts()) { the_post();?> <article class="clearfix"> <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> <time><?php the_date('l j F'); ?></time> <hr> <?php the_content(); ?> </article> <?php } }else{ echo '<p>No content found</p>'; } ?>
Anyone know how I might do this?
- The topic ‘Conditional logic for article with thumbnail’ is closed to new replies.