WordPress.org

Support

Support » Plugins and Hacks » Another category button pressed by default

Another category button pressed by default

  • 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 :/.

  • The topic ‘Another category button pressed by default’ is closed to new replies.
Skip to toolbar