- This topic is empty.
-
AuthorPosts
-
December 21, 2013 at 5:40 am #158917
mvaneijgen
ParticipantI’m busy designing a blog and what i like to have is a custom structure for certain post categories at the ‘blog post overview page’. I’m not a WordPress developer hero, but i like to mess with the code till i can wrap my head around it, but for this i don’t know where to start.
Down here i provided a screenshot of what it could look like. If i have to explain it in text: If the post category is Portfolio show the a large featured image with the title in it and hide the rest of the content.
I know i have to a lot of this with CSS but how do i loop through all the post and get the elements i want and for other categories don’t get those elements?
I was thinking to just load every element for every post and then hide them for certain categories, but i thought that was kind of dirty.
I hope i explaind my self well and someone can point me to some good resources.
December 21, 2013 at 7:32 am #158924mvaneijgen
ParticipantThis is how far i have come
if(query_posts('cat=5')) { $count = 0; while ( have_posts() ) { the_post(); get_template_part( 'content-portfolio', get_post_format() ); } // End WHILE Loop } else { if ( have_posts() ) { $count = 0; while ( have_posts() ) { the_post(); $count++; /* Include the Post-Format-specific template for the content. * If you want to overload this in a child theme then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'content-blog', get_post_format() ); } // End WHILE Loop } else { ?> <article <?php post_class(); ?>> <p><?php _e( 'Sorry, no posts matched your criteria.', 'woothemes' ); ?></p> </article><!-- /.post --> <?php } // End IF Statement ?
-
AuthorPosts
- The forum ‘Other’ is closed to new topics and replies.