How to add the Category name on the archive pages?

This topic contains 10 replies, has 3 voices, and was last updated by  Naveen Giri 4 years, 9 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #520425

    Manfred Van Ursel
    Expired Member
    Post count: 295

    I went to the GD Archive page to edit and add some shortcodes but could’nt find a shortcoe to show the current category when we are on a category page.

    I found category description but if it is empty nothing will show there.

    What am I missing?

    Thanks,

    #520428

    Manfred Van Ursel
    Expired Member
    Post count: 295

    Oh, I wanted to add I’m using V2 and Divi theme, and this is how I have the Archive GD page (see screenshot).

    #520435

    Alex Rollin
    Moderator
    Post count: 27815

    You can use the Title settings:

    https://wpgeodirectory.com/docs-v2/geodirectory/settings/general/#titles-and-meta

    Other than that you can use the category description widget, but as you say you will need to fill the Category Top Description to use that.

    #520521

    Manfred Van Ursel
    Expired Member
    Post count: 295

    However, how could I add a shortcode in the post content of the Title as described here?

    https://wpgeodirectory.com/docs-v2/geodirectory/settings/general/#titles-and-meta

    Thanks,

    #520656

    Alex Rollin
    Moderator
    Post count: 27815

    I will ask the developers if there is a workaround for that.

    #520772

    Naveen Giri
    Moderator
    Post count: 1559

    Hi Manfred,

    if you want to use the current category page name as shortcode in archive page. you can use below code snippet and use [cat_name] as shortcode anywhere in content box.

    
    
    
    function geodirectory_cat_name( $atts ) {
    	$queried_object = get_queried_object();
    	return $queried_object->name;
    }
    add_shortcode( 'cat_name', 'geodirectory_cat_name' );
    

    Let me know if i misunderstood you.

    Thanks

    #520856

    Manfred Van Ursel
    Expired Member
    Post count: 295

    This is exactly what I needed, THANKS!

    #520978

    Naveen Giri
    Moderator
    Post count: 1559

    Awesome, thanks for confirming.

    #521277

    Manfred Van Ursel
    Expired Member
    Post count: 295

    Hi, when we are in a custom listing page (in our case “IT Supplier”) using this method we’ll get the system name of the “category”, that is: gd_supplier.

    How can we amend that and make appear the “pretty” name “IT Supplier”?

    Thanks,

    #521278

    Manfred Van Ursel
    Expired Member
    Post count: 295
    This reply has been marked as private.
    #521329

    Naveen Giri
    Moderator
    Post count: 1559

    Done, please have a look.

Viewing 11 posts - 1 through 11 (of 11 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