WordPress.org

Ready to get started?Download WordPress

Forums

Another category button pressed by default (1 post)

  1. Chris Demetriad
    Member
    Posted 2 years ago #

    Could anyone please give me a hint of how should I do in order to have another portfolio category button pressed by default? At the moment is the "All" button pressed by default. Thank you!

    Of course, the new default pressed button will have to pull and display the relevant items aswell when I go to that particular page (portofolio).

    <?php $loop = new WP_Query(array('post_type' => 'portfolioentry', 'posts_per_page' => 99));
    $terms = get_terms('portfoliocategory', 'hide_empty=1&pad_counts=0');
    echo '<div class="portfolioheader"> <ul class="portfoliofilter"> <li class="all"><a class="portfoliobutton" href="#">All</a></li>';
    foreach ( $terms as $term ) {
    if ($term->parent === '0') {
    echo '<li class="'.$term->name.'"><a class="portfoliobutton_noselect" href="#">'.$term->name.'</a></li>'; } }

    I have been researching all day, I can't understand what part of the if I should modify; I initially tried to modify the class name (portofoliobutton instead of portofolio_noselect) but it's obviously that was a childish mistake. I am incredibly frustrated now :/.

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by Chris Demetriad
  • This topic is not resolved
  • WordPress version: 3.2.1