Customize output of gd_single_taxonomies

This topic contains 5 replies, has 3 voices, and was last updated by  Kiran 5 years, 1 month ago.

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

Open Support Ticket
  • Author
    Posts
  • #508213

    Andy
    Expired Member
    Post count: 46

    I am using gd_single_taxonomies shortcode via a Gutenberg block to show the listing’s main category at the top of the detail page. I would like to change the output as follows:

    1. Only show categories, not tags
    2. Only show the primary category, not all categories
    3. Show the parent categories (this is a hierarchical structure)
    4. Don’t show the text “Listing Category:” (I can’t target this with CSS as it is not independently wrapped in an element)

    What is the best way to go about this?

    I might well have other design customization needs as I work through this. I am currently using a Gutenberg page to define the output, with custom HTML blocks between the GD shortcodes to create the right div nesting to target with CSS.

    I’m not sure if this approach will fall down at some point, so wondering if it’s better to start from scratch with a PHP template, or if that will create more problems than it solves.

    Thanks.

    #508214

    Andy
    Expired Member
    Post count: 46

    On further experimentation I can address #1 and #4 by using the gd_post_meta shortcode instead so that leaves me with:

    2. Only show the primary category, not all categories
    3. Show the parent categories (this is a hierarchical structure)

    #508231

    Guust
    Moderator
    Post count: 29970

    I am not sure that is possible without special customization, but I have asked the developers to have a look at your question in case there is an existing option to:
    #1. only show the default category of a listing on the detail page
    #2. Show the parent category of that default category.

    Thanks

    #508393

    Kiran
    Moderator
    Post count: 7069

    Hi Andy,

    You can use post_category post meta to show categories only.
    Or
    Use following PHP snippet to show only categories in single taxonomy widget/shortcode.

    
    
    /**
     * Don't show tags in gd_single_taxonomies widget/shortcode.
     */
    function gd_snippet_190916_details_taxonomies_output( $taxonomies, $post_type, $listing_label, $listing_name ) {
    	if ( isset( $taxonomies[ $post_type . '_tags' ] ) ) {
    		unset( $taxonomies[ $post_type . '_tags' ] ); // Hide tags.
    	}
    
    	return $taxonomies;
    }
    add_filter( 'geodir_details_taxonomies_output', 'gd_snippet_190916_details_taxonomies_output', 20, 4 );

    Regards,
    Kiran

    #508457

    Andy
    Expired Member
    Post count: 46

    Thank you Kiran.

    I looked at the other available filters in the codex (says it’s for v1 only?) and couldn’t see one that would meet the other needs unfortunately.

    #509732

    Kiran
    Moderator
    Post count: 7069
    This reply has been marked as private.
Viewing 6 posts - 1 through 6 (of 6 total)

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

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount