Change entry title for category pages

This topic contains 21 replies, has 6 voices, and was last updated by  oldmankit 9 years, 1 month ago.

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

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #30176

    oldmankit
    Buyer
    Post count: 116

    At the moment my custom post type has a name, “Reiki Masters and Practitioners”. It has two categories, “In-person” and “Distance”.

    When I visit a category page, the title (css class=”entry=title”) is like this:

    All Reiki Masters and Practitioners in Thailand’s In-person

    How can I change that to:

    All Reiki Masters and Practitioners in Thailand (In-person)

    I looked in the translation file, which is where I normally go to tweak stuff like this, but couldn’t find anything.

    #30183

    Simone
    Expired Member
    Post count: 3515

    Well, this is a category name, so you should name the category to (In-person)

    #30213

    Paolo
    Site Admin
    Post count: 31206

    Using SEO plugin you should be able to wrap the title’s category tag in parenthesis.

    Not 100% sure though.

    #30255

    oldmankit
    Buyer
    Post count: 116

    Thanks guys. It’s not just the parentheses, there is also an apostrophe s (in Thailand’s) that I need to get rid of.

    I’ll try an SEO plugin next week and see how it goes.

    #31156

    oldmankit
    Buyer
    Post count: 116

    I’ve just installed Yoast. Yoast only has options to change the page title and meta descriptions. I don’t want to change those (I can already change them through Genesis framework, which I’m using).

    I want to change the actual entry title on the category page. As I said in the original post, I want to change the page element with the css class of “entry=title”. If you go to this example page on my site, you will see the text I want to change: the text that says “All Reiki Masters and Practitioners in ‘In-Person’”, which currently makes no sense.

    I have tried to solve this issue myself. First I found out what is generating the entry title on the category page. Is it Genesis or a Genesis Child Theme or GeoDirectory? I enabled the default WordPress theme, Twenty Fifteen, and nothing has changed in the entry title. So I guess it’s not Genesis, it’s GeoDirectory. I could be wrong, it could be WordPress itself.

    My guess is that it’s GeoDirectory. So how can I go about changing functions.php to change the entry title of the top-level category page like this:

    • existing: All [name of custom place type] in ‘[name of category]’
    • what I want: All [name of category] [name of custom place type]
    #31196

    Paolo
    Site Admin
    Post count: 31206

    Ok,

    this is how you should do it:

    1) remove the action that adds the title in the template:

    remove_action( 'geodir_listings_page_title', 'geodir_action_listings_title', 10 );

    2) copy the function geodir_action_listings_title from geodirectory_template_actions.php line 732 and paste in your theme functions.php

    3) edit the function as desired and make sure to rename it to something like : my_geodir_action_listings_title

    4) add a new action with your function to add your custom title back in the page.

    add_action( 'geodir_listings_page_title', 'my_geodir_action_listings_title', 10 );

    Let us know how you went.

    Thank you

    #31992

    oldmankit
    Buyer
    Post count: 116

    Paolo,

    That’s exactly the kind of help I needed. Thank you.

    So far it’s all gone well. I have successfully managed steps 2-4.

    The only thing remaining is step 1. Pasting that code into functions.php appears to have no effect on my site. Just to confirm that: I have

    remove_action( 'geodir_listings_page_title', 'geodir_action_listings_title', 10 );

    but it doesn’t seem to remove the action.

    So now I have two entry titles: the default one, which I can’t remove, and the new, customised one.

    #32002

    oldmankit
    Buyer
    Post count: 116

    I tried removing everything related to the entry header in Genesis, but still cannot get rid of it. In case it helps, here is the html:

    
    
    <div class="content-sidebar-wrap" id="geodir-wrapper">
    	<header class="entry-header">
    		<h1 class="entry-title fn">Reiki Masters and Practitioners in Thailand offering Distance Reiki</h1></header><!--Correct, my customised version -->
    	
    	<div class="term_description"><p>Reiki Masters and Practitioners offering distance Reiki Courses and Treatments</p>
    	</div>
    
    <div role="main" class="content"><main role="main" class="entry listings-page" id="geodir-main-content"><div class="clearfix">		
    		<div class="geodir-tax-sort">
    			<select onchange="javascript:window.location=this.value;" id="sort_by" name="sort_by">
    				<option selected="selected" value="/masters-practioners/distance/?sort_by">Sort By</option><option value="/masters-practioners/distance/?sort_by=post_title_asc" selected="selected">Title</option><option value="/masters-practioners/distance/?sort_by=post_title_desc" selected="selected">Title (reverse)</option>			
    			</select>
    		</div>
    
    		<header class="entry-header"><h1 class="entry-title fn">All Reiki Masters and Practitioners in Thailand’s Distance Reiki</h1></header><!-- Incorrect, I want to get rid of this -->				
    			<div class="term_description"><p>Reiki Masters and Practitioners offering distance Reiki Courses and Treatments</p>
    			</div>
    
    		</div>
    
    <!-- This is the listings content -->
    
    </div>
    #32037

    Paolo
    Site Admin
    Post count: 31206

    ok that’s my fault, the Genesis compatibility already removes and re-adds that part with a different function.

    Try this :

    Point 1 and 4 are useless, so delete them. In your functions.php keep only your customized function my_geodir_action_listings_title (or whatever you called it)

    than add this:

    
    
    remove_action( 'geodir_before_listing', 'gd_genesis_listing_page_title_bar', 10 );
    add_action( 'geodir_before_listing', 'my_gd_genesis_listing_page_title_bar', 10 );
    function my_gd_genesis_listing_page_title_bar() {
    my_geodir_action_listings_title(); //change this name in case you called the function differently
    geodir_action_listings_description();
    }
    

    The original function could be found in: geodirectorygeodirectory-functionscompatibilityGenesis.php

    Let us know if this works,

    Thx

    #32116

    oldmankit
    Buyer
    Post count: 116

    I thought it could be something to do with Genesis. I did some digging but couldn’t find what it was.

    What you suggested fixed it. Perfect—thank you so much!

    #32153

    Paolo
    Site Admin
    Post count: 31206

    Glad we solved 🙂

    #53023

    highjo
    Free User
    Post count: 30

    Hi there,

    Has this been resolved officially yet? I’d prefer not to make changes to the core code where possible, but I agree with the OP, the title’s don’t make any sense and really undermine the quality of the plugins?

    Kind regards
    K

    #53063

    oldmankit
    Buyer
    Post count: 116

    I just tested the demo site to see how the wording is there. If you visit http://wptry.it/try-geodirectory/places/united-states/attractions/ you will see “All Places in United States’ Attractions”. This wording is awkward, but it was easy enough for me to change on my site (with Paulo’s help). I wasn’t changing any core code, just adding a small custom function in functions.php.

    #53082

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    I will talk with Paolo later about how we can improve this.

    Thanks,

    Stiofan

    #53304

    oldmankit
    Buyer
    Post count: 116

    Thanks Stiofan for being responsive!

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