0
votes

i want to display portfolio category above the content where all portfolio is displayed. i know some of the modification is required in loop portfolio.php but how put that so that it display above the content post. i want to display in ul li format how it possible?? i m using broadscope theme

my code for loop portfolio.php is given below

<?php 
global $avia_config;
if(isset($avia_config['new_query'])) {

    query_posts($avia_config['new_query']);
 }

// check if we got a page to display:
if (have_posts()) :


    $loop_counter = 1;
    $extraClass = 'first';

    //iterate over the posts
    while (have_posts()) : the_post();  

    //get the categories for each post and create a string that serves as classes so the javascript can sort by those classes
    $sort_classes = "";
    $item_categories = get_the_terms( $id, 'portfolio_entries' );

    if(is_object($item_categories) || is_array($item_categories))
    {
        foreach ($item_categories as $cat)
        {
            $sort_classes .= $cat->slug.'_sort ';
        }
    }


?>


        <div class='post-entry one_third all_sort <?php echo $sort_classes.$extraClass; ?>'>

            <a href="<?php echo get_permalink() ?>" rel="bookmark" title="<?php _e('Permanent Link:','avia_framework')?> <?php echo avia_inc_display_featured_within_entry('portfolio', false); ?>"><?php echo avia_inc_display_featured_within_entry('portfolio', false); ?></a>

            <a href="<?php echo get_permalink() ?>" rel="bookmark" title="<?php _e('Permanent Link:','avia_framework')?> <?php the_title(); ?>"><?php the_title(); ?></a>

            <span class='date_sort hidden'><?php the_time('Y m d H i s'); ?></span>

            <div class="entry-content">

                <!--<?php the_excerpt(); ?> -->

            <!--<a class="more-link" href="<?php echo get_permalink(); ?>"><?php _e('Read more','avia_framework'); ?></a>
            -->
            </div>                          
        <!-- end post-entry-->
        </div>

<?php 

    $loop_counter++;
    $extraClass = "";
    if($loop_counter > 3)
    {
        $loop_counter = 1;
        $extraClass = 'first';
    }


    endwhile;       
    else: 
?>  

    <div class="entry">
        <h1 class='post-title'><?php _e('Nothing Found', 'avia_framework'); ?></h1>
        <p><?php _e('Sorry, no posts matched your criteria', 'avia_framework'); ?></p>
    </div>
<?php

    endif;

?>

i want to display portfolio category before

<a href="<?php echo get_permalink() ?>" rel="bookmark" title="<?php
_e('Permanent Link:','avia_framework')?> <?php echo avia_inc_display_featured_within_entry('portfolio', false); ?>">

inside

<div class='post-entry one_third all_sort <?php echo
$sort_classes.$extraClass; ?>'>

so please help me if anyone know this. hope friends you help me regarding this question

1

1 Answers

0
votes

Try to insert the following code

<?php
$post_id = get_the_ID()
$item_terms = get_the_terms( $post_id, 'portfolio_entries' );

if($item_terms !== false && count($item_terms) > 0)
{
    echo '<ul>';
    foreach ($item_terms as $term)
    {
        echo '<li>'.$term->name.'</li>';
    }
    echo '</ul>';
}
?>

just after

<div class='post-entry one_third all_sort <?php echo $sort_classes.$extraClass; ?>'>