GeoDirectory SupportFunction to generate Categories – GeoDirectory Support https://wpgeodirectory.com/support/topic/function-to-generate-categories/feed Sat, 15 Mar 2025 05:56:59 +0000 http://bbpress.org/?v=2.5.14-6684 en-US https://wpgeodirectory.com/support/topic/function-to-generate-categories/#post-29474 <![CDATA[Function to generate Categories]]> https://wpgeodirectory.com/support/topic/function-to-generate-categories/#post-29474 Mon, 02 Feb 2015 12:34:51 +0000 Robert Strobel 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!

]]>
https://wpgeodirectory.com/support/topic/function-to-generate-categories/#post-29476 <![CDATA[Reply To: Function to generate Categories]]> https://wpgeodirectory.com/support/topic/function-to-generate-categories/#post-29476 Mon, 02 Feb 2015 12:36:21 +0000 Robert Strobel Also is there a function to generate the breadcrumbs?

]]>
https://wpgeodirectory.com/support/topic/function-to-generate-categories/#post-29492 <![CDATA[Reply To: Function to generate Categories]]> https://wpgeodirectory.com/support/topic/function-to-generate-categories/#post-29492 Mon, 02 Feb 2015 13:40:39 +0000 Simone 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

]]>
https://wpgeodirectory.com/support/topic/function-to-generate-categories/#post-29496 <![CDATA[Reply To: Function to generate Categories]]> https://wpgeodirectory.com/support/topic/function-to-generate-categories/#post-29496 Mon, 02 Feb 2015 14:41:42 +0000 Robert Strobel 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>';
}
]]>