Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • I am trying to do something like this. Instead of returning a list of all the categories within a custom taxonomy, I only want to return the first one. I have a portfolio page with ‘media’ as my custom taxonomy. I want to show the name of each category inside ‘media’ (identity, print, web) as a link to a category archive. Underneath the link will be thumbnails of the posts in that category.

    When I use the get_term_link inside the loop, it returns the link each time it shows a post. If I use it in its own seperate loop it returns the link like I want, but it returns it multiple times depending on the number of posts.

    <?php
    $post_type = 'Portfolio';
    $tax = 'media';
    $tax_terms = get_terms($tax);
    if ($tax_terms) {
    foreach ($tax_terms as $tax_term) {
    $args=array(
    'post_type' => $post_type,
    "$tax" => $tax_term->slug,
    'post_status' => 'publish',
    'posts_per_page' => -1,
    'caller_get_posts'=> 1
    );
    
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
    
    $divName = $tax_term->name ;?>
    
    <div class="<?php echo $divName; ?>">
    
    <?php echo $tax_term->name. ' Projects ' ;

    This is what I’m using now to display the category name a single time. Is it possible to attach the link to this? Can get_term_link be used outside the loop, or modified to return only the first result?

    I figured out a pretty simple work around to this problem. In the gallery options page, show only 1 image per page. Further down check the Add hidden images box.

    Then go back to the page where you previously placed the album and replace it with each gallery listed individually. This will give you one thumbnail for each gallery that opens up thickbox (or whatever you have selected) and lets you click through all the images in the gallery.

    You can get rid of the pagination underneath each gallery, and add the name of the gallery by editing the gallery.php file

Viewing 2 replies - 1 through 2 (of 2 total)