• I’m at the end of my rope. Here is what I am trying to do:

    I’m using jQuery UI to have some tabs on my page.

    The markup for the tabs needs to be

    <ul>
      <li><a href="#tab-1">Taxonomy Term 1</a></li>
      <li><a href="#tab-2">Taxonomy Term 2</a></li>
      <li><a href="#tab-3">Taxonomy Term 3</a></li>
    </ul>
    <div id="tab-1>
      All posts that have been assigned Taxomnomy Term 1
    </div>
    <div id="tab-2>
      All posts that have been assigned Taxomnomy Term 1
    </div>
    <div id="tab-3>
      All posts that have been assigned Taxomnomy Term 1
    </div>

    The un-ordered list for the tabs is generated using this:

    <!-- !Get the tabs  -->
     <ul>
        <?php
         $args=array(
            'orderby' => 'name',
            'order' => 'ASC',
            'taxonomy' => 'team'
             );
         $categories=get_categories($args);
             foreach($categories as $category) {
             echo '<li><a href="#tab-' . $category->term_id . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> </li> ';
          }
         ?>
     </ul>

    I need to figure out how to roll out a loop that would have each div get assigned an id of the taxonomy term id and then display all the posts from that term. then repeat for all the different terms.

    Does this make any sense?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter dallasbpeters

    (@dallasbpeters)

    Update:

    I replicated the code to get those divs and now I just need to pull all the content from that taxonomy term into it. I feel I might be headed down a wrong path though. Any help would be great.

    <!-- !Get the tabs  -->
                  <ul>
                  <?php
                    $args=array(
                      'orderby' => 'name',
                      'order' => 'ASC',
                      'taxonomy' => 'team'
                      );
                    $categories=get_categories($args);
                      foreach($categories as $category) {
                        echo '<li><a href="#tab-' . $category->term_id . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> </li> ';
                        }
                  ?>
                  </ul>
    
                  <!-- and then get the posts -->
                  <?php
                    $args=array(
                      'orderby' => 'name',
                      'order' => 'ASC',
                      'taxonomy' => 'team'
                      );
                    $categories=get_categories($args);
                      foreach($categories as $category) {
                        echo '<div id="tab-' . $category->term_id . '">';
                        echo '<h2>' . sprintf( __( "%s" ), $category->name ) . '</h2>';
                        echo '<p>' . sprintf( __( "%s" ), $category->description ) . '</p>';
                        echo '</div>';
                        }
                  ?>

    Thread Starter dallasbpeters

    (@dallasbpeters)

    Well these forums are kinda useless eh?

    Unfortunaly I’ve the same trouble. I’ve some categories defined in a Custom Post Type and I need to create a select input from them.

    I can’t find solution, by now.

    I found solution. I had a trouble with category (taxonomy) name. It works good. On $args you may simply insert “taxonomy” arg with the name of categories you want to loop.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom Post Type Taxonomy as Tabs w/ following div with id of taxonomy term.’ is closed to new replies.