Show Category in Wordpress Portfolium Theme -


i'm using portfolium-theme wordpress , need help.

i show portfolio category under title on frontpage (loop-portfolio). categories taxonomy can't figure out.

my side

the loop-portfolio.php

 <?php if ( have_posts() ) : ?>     <?php $i = 0; ?>     <?php while ( have_posts() ) : the_post(); $i++; ?>     <div class="post_home"> <div class="post_home2"></div>         <a href="<?php the_permalink() ?>" class="thumb" title="<?php the_title(); ?>">              <?php if (has_post_thumbnail()) : ?>                 <?php the_post_thumbnail(array(305,145)); ?>             <?php else : ?>                 <img src="<?php bloginfo('template_url'); ?>/i/noimage.jpg" width="305" height="145" alt=""/>             <?php endif; ?>         </a>             <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>          </div>      <?php if ($i % 6 == 0) echo '<div style="clear: both;"></div>'?>     <?php endwhile; ?> <?php endif; ?> 

and taxonomy.php

    <?php get_header(); ?>  <?php     $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));     query_posts(array('post_type' => 'portfolio', 'works' => $term->slug, 'posts_per_page' => -1)); ?>  <?php get_template_part('loop-portfolio');  // loop template portfolio (loop-portfolio.php) ?>  <?php get_footer(); ?> 

the functions.php

    <?php  /*** top navigation ***/  function register_menu() {     register_nav_menu('header', __('header')); } add_action( 'init', 'register_menu' );  if ( !is_nav_menu('header')) {     $menu_id = wp_create_nav_menu('header');     wp_update_nav_menu_item($menu_id, 1); }  class extended_walker extends walker_nav_menu{     function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) {          if ( !$element )             return;          $id_field = $this->db_fields['id'];          //display element         if ( is_array( $args[0] ) )             $args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] );          //adds 'parent' class current item if has children         if( ! empty( $children_elements[$element->$id_field] ) )             array_push($element->classes,'parent');          $cb_args = array_merge( array(&$output, $element, $depth), $args);          call_user_func_array(array(&$this, 'start_el'), $cb_args);          $id = $element->$id_field;          // descend when depth right , there childrens element         if ( ($max_depth == 0 || $max_depth > $depth+1 ) && isset( $children_elements[$id]) ) {              foreach( $children_elements[ $id ] $child ){                  if ( !isset($newlevel) ) {                     $newlevel = true;                     //start child delimiter                     $cb_args = array_merge( array(&$output, $depth), $args);                     call_user_func_array(array(&$this, 'start_lvl'), $cb_args);                 }                 $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );             }             unset( $children_elements[ $id ] );         }          if ( isset($newlevel) && $newlevel ){             //end child delimiter             $cb_args = array_merge( array(&$output, $depth), $args);             call_user_func_array(array(&$this, 'end_lvl'), $cb_args);         }          //end element         $cb_args = array_merge( array(&$output, $element, $depth), $args);         call_user_func_array(array(&$this, 'end_el'), $cb_args);     } }  /*** commentlist ***/  function commentlist($comment, $args, $depth) {     $globals['comment'] = $comment;     ?>     <li id="li-comment-<?php comment_id() ?>">         <div id="comment-<?php comment_id(); ?>" <?php comment_class('comment_item clear'); ?>>             <div class="comment_meta">posted on <?php printf( __('%1$s'), get_comment_date()); ?> <?php printf(__('<cite class="fn">%s</cite>'), get_comment_author_link()) ?></div>             <div class="comment_text"><?php comment_text() ?></div>         </div> <?php }  /*** custom posts ***/  register_taxonomy(     'works',     'portfolio',     array(         'label' => __('portfolio categories'),         'singular_label' => __('portfolio category'),         'hierarchical' => true,         'query_var' => true,         'rewrite' => true,         'show_in_nav_menus' => true,     ) );  register_post_type(     'portfolio',     array(         'label' => __('portfolio'),         'singular_label' => __('work'),         'public' => true,         'show_ui' => true,         'capability_type' => 'post',         'hierarchical' => false,         'rewrite' => true,         'query_var' => true,         'show_in_nav_menus' => true,         'menu_position' => 3,         'taxonomies' => array('portfolio'),         'supports' => array('title', 'editor', 'author', 'thumbnail', 'custom-fields'),         '_builtin' => false, // it's custom post type, not built in! ));  /*** images ***/  add_theme_support('post-thumbnails'); update_option('thumbnail_size_w', 305); update_option('thumbnail_size_h', 145); update_option('large_size_w', 785);  /*** misc ***/  function commentdata_fix($commentdata) {     if ( $commentdata['comment_author_url'] == 'www') {         $commentdata['comment_author_url'] = '';     }     if ($commentdata['comment_content'] == 'write comment') {         $commentdata['comment_content'] = '';     }     return $commentdata; } add_filter('preprocess_comment','commentdata_fix');  function gettinyurl($url) {     $tinyurl = file_get_contents("http://tinyurl.com/api-create.php?url=".$url);     return $tinyurl; }  function get_blogurl() {     if (get_option('show_on_front') == 'page' && get_option('page_for_posts') != 0) {         $blogpage = get_page(get_option('page_for_posts'));         echo $blogpage -> guid;     } else {         echo get_option('home');     } }  function catlist() { ?>     <ul class="tags jsddm">         <li>             <a href="#">blog categories</a>             <ul class="taglist">                 <?php wp_list_categories('title_li=&hierarchical=0&'); ?>             </ul>         </li>     </ul> <?php }  function n_posts_link_attributes(){     return 'class="nextpostslink"'; } function p_posts_link_attributes(){     return 'class="previouspostslink"'; } add_filter('next_posts_link_attributes', 'n_posts_link_attributes'); add_filter('previous_posts_link_attributes', 'p_posts_link_attributes');   ?> 

not sure if understood want, if want drop down menu portfolio taxonomies justuse example in wp codex get term link replace 'species' taxonomy (hope need, if not i'll try out) , thats need do

$terms = get_terms('species');     echo '<ul>'; foreach ($terms $term) {     echo '<li><a href="'.get_term_link($term->slug, 'species').'">'.$term->name.'</a> </li>'; } echo '</ul>'; 

ps: if you're not sure terms bring use print_r($var_name); helps out lot :)


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -