sobaksobak
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Fixing WordPress
In reply to: Custom post categories listing with loop?sorry, I should have my question more clear.
http://songyknox.com/portfolio-list/
This is the page I created but using the following.<h1><?php the_title(); ?></h1> <h3>Weddings</h3> <ul> <?php global $post; $args = array( 'post_type' => 'portfolio', 'portfolio-category' => 'wedding' ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?> <li class="_archive"><a href="<?php the_permalink(); ?>" class"_archivelink"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul> <h3>Baby</h3> <ul> <?php global $post; $args = array( 'post_type' => 'portfolio', 'portfolio-category' => 'baby' ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?> <li class="_archive"><a href="<?php the_permalink(); ?>" class="_archivelink"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul> <h3>Engagement</h3> <ul> <?php global $post; $args = array( 'post_type' => 'portfolio', 'portfolio-category' => 'engagement' ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?> <li class="_archive"><a href="<?php the_permalink(); ?>" class="_archivelink"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul> <h3>Catwalk</h3> <ul> <?php global $post; $args = array( 'post_type' => 'portfolio', 'portfolio-category' => 'catwalk' ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?> <li class="_archive"><a href="<?php the_permalink(); ?>" class="_archivelink"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul> <h3>Event</h3> <ul> <?php global $post; $args = array( 'post_type' => 'portfolio', 'portfolio-category' => 'event' ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?> <li class="_archive"><a href="<?php the_permalink(); ?>" class="_archivelink"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul> <h3>Interior</h3> <ul> <?php global $post; $args = array( 'post_type' => 'portfolio', 'portfolio-category' => 'interior-photography' ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?> <li class="_archive"><a href="<?php the_permalink(); ?>" class="_archivelink"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul> <h3>Portrait</h3> <ul> <?php global $post; $args = array( 'post_type' => 'portfolio', 'portfolio-category' => 'portrait' ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?> <li class="_archive"><a href="<?php the_permalink(); ?>" class="_archivelink"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul>It’s repeating the same thing for every category. I’m sure there would be a way to make them dynamic for <h3> and the post listing for each category. I hope this makes sense.
Thank you.
Viewing 1 replies (of 1 total)