Function to generate Categories

This topic contains 3 replies, has 2 voices, and was last updated by  Robert Strobel 9 years, 3 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #29474

    Robert Strobel
    Expired Member
    Post count: 54

    Hey,

    On the detail sidebar there is this:
    http://i.gyazo.com/a1e7e8574bd0a24f6eff3e2bd7115981.png

    At the top, you can see the “Category: Activities and Horseback”

    Is there a function that I can use in the php that will generate this code (“Category: Activities and Horseback”) on the detail page? I need this so I can use it in a separate place on same page

    Thanks!

    #29476

    Robert Strobel
    Expired Member
    Post count: 54

    Also is there a function to generate the breadcrumbs?

    #29492

    Simone
    Expired Member
    Post count: 3515

    Hello Robert,
    for the category, I believe there is no function, but GD is using WordPress codex using get_taxonomies etc..
    you can find the code in the geodirectory_template_actions.php file around row 746

    The breadcrumbs is using the function geodir_breadcrumb

    #29496

    Robert Strobel
    Expired Member
    Post count: 54

    Thanks

    FYI i found the following code that helped me with taxonomy usage for caegories..

    pasting for anyone else who may read with the same need..

    
    
    function geodir_taxonomy_breadcrumb() {
    	
    	$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
     	$parent = $term->parent;
    	
    	while ($parent):
    		$parents[] = $parent;
    		$new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ));
    		$parent = $new_parent->parent;
    	endwhile;
    	
    	if(!empty($parents)):
    		$parents = array_reverse($parents);
    		 
    		foreach ($parents as $parent):
    			$item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ));
    			$url = get_term_link( $item, get_query_var( 'taxonomy' ) ); 
    			echo '<li> > <a href="'.$url.'">'.$item->name.'</a></li>';
    		endforeach;
    
    	endif;
    	 
    	echo '<li> > '.$term->name.'</li>';
    }
Viewing 4 posts - 1 through 4 (of 4 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket