Breaking down the_content();
-
Hello,
I’m currently designing a theme where different categories are to have a different look depending on the category. This also involves rearranging of the content inside the post type. This is somewhat easy to make using custom fields, but for this project that doesn’t work, as I’m to post pretty much solely from the iOS app. So what I need is to extract content from posts and place it where it needs to go from the theme side instead of assigning it during the posting process since the iOS app doesn’t allow it.
What I’m trying to do from within my theme is something like this:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php if ( in_category('Photo') ) { ?> <div class="photo"> #IMAGE(S) #TITLE #TEXT ONLY (From the_content()) <?php } ?> <?php if ( in_category('Video') ) { ?> <div class="video"> #VIDEO(S) from the auto embed #TITLE #TEXT ONLY (From the_content()) <?php } ?> <?php if ( in_category('Various') ) { ?> <div class="various"> #VIDEO(S) AND IMAGES OR SOMETHING ELSE #TITLE #TEXT ONLY (From the_content()) <?php } ?> <?php if ( in_category('Article') ) { ?> <div class="article"> #TITLE #THE CONTENT (Here the normal the_content() would work) <?php } ?> <?php if ( in_category('Quote') ) { ?> <div class="quote"> #BLOCKQUOTE #TEXT ONLY (From the_content()) <?php } ?> #And so on… <div class="entry"> <div class="meta"> <small>Tags, Date, Author etc.</small> </div> </div> </div> <!-- Close category type DIV --> <?php endwhile; else: ?> <p>Sorry, no posts matched your criteria.</p> <?php endif; ?>
Looks like the_content(); is my problem here. I need to get hold of what’s inside it so I can place it where I want it to be. But I’m can’t seem to figure out how to do that.
Any help with this is of great appreciation.
Thank you.
- The topic ‘Breaking down the_content();’ is closed to new replies.