Change entry title for category pages
This topic contains 21 replies, has 6 voices, and was last updated by oldmankit 9 years ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: entry title
-
AuthorPosts
-
February 6, 2015 at 11:17 am #30176
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.
February 6, 2015 at 1:46 pm #30183Well, this is a category name, so you should name the category to (In-person)
February 6, 2015 at 6:34 pm #30213Using SEO plugin you should be able to wrap the title’s category tag in parenthesis.
Not 100% sure though.
February 7, 2015 at 2:09 am #30255Thanks 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.
February 17, 2015 at 10:56 am #31156I’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]
February 17, 2015 at 6:57 pm #31196Ok,
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
February 25, 2015 at 8:42 am #31992Paolo,
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.
February 25, 2015 at 10:49 am #32002I 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>
February 25, 2015 at 4:09 pm #32037ok 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
February 26, 2015 at 6:23 am #32116I 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!
February 26, 2015 at 5:40 pm #32153Glad we solved 🙂
September 13, 2015 at 3:22 pm #53023Hi 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
KSeptember 14, 2015 at 8:11 am #53063I 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.
September 14, 2015 at 10:58 am #53082I will talk with Paolo later about how we can improve this.
Thanks,
Stiofan
September 16, 2015 at 3:34 am #53304Thanks Stiofan for being responsive!
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket