Edit custom post type listing PHP page
This topic contains 28 replies, has 5 voices, and was last updated by Paolo 9 years, 10 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
January 1, 2015 at 9:44 pm #26004
I want to edit this php page: http://bluegrassbrides.com/staging/bakeries/ and add custom text just below the last listing on the page. So when you choose “bakeries” from the navigation menu, you will scroll down through the listings and then there will be static text at the very bottom.
Which php file should I edit to do this? Would it be listing-listview.php file?
And then, what if I want to custom text to be different depending on the custom post type? Could I copy the file and then add the slug to the file for each post type?
January 2, 2015 at 3:40 am #26027You can just add a text widget to the bottom section of the GD Listing template in Appearances > widgets. That would then appear on every CPT and category page.
You can do what you want on a per category basis, but it seems you are not using categories or at least hiding them.
You can for each different category add a “Category Top Description” that can be different for each category.
WP admin > Place (CPT) categories > edit > Category Top DescriptionI guess it should be possible to add the CPT’s “Meta Description” somewhere on the page instead of on the head only.
GD > CPT > Edit > Meta DescriptionThe template for that would be indeed listing-listview.php but let’s check with Paolo.
January 2, 2015 at 6:35 pm #26115Correct, I am not using categories since my custom fields are different per post type. That would make it too complicated to use categories.
If I edited the listing-listview.php file, where would I enter my html to make the static text appear?
Then, how would I rename my file to make it appear for each custom post type slug? I tried listing-listview-bakeries.php but it didn’t work, or at least I didn’t see my custom text.
January 2, 2015 at 7:08 pm #26124Hi,
GeoDirectory will not work without categories. All maps will be broken.
To add a different message per CPT, you need a PHP conditional tag.
Something like this:
if(isset($post->post_type) && $post->post_type=='gd_place'){//text for gd_place} elseif(isset($post->post_type) && $post->post_type=='gd_event'){//text for gd_event} else {}
Thx
January 2, 2015 at 7:57 pm #26131Thank you! That also explains why my maps aren’t working. I’ll try it out and see if I can get it to work!
January 2, 2015 at 7:58 pm #26132Guust, is there a way to move the category top description to the bottom instead? What would I edit in my PHP files to do that?
January 3, 2015 at 12:01 am #26162Move
wp-content/plugins/geodirectory/geodirectory-templates/geodir-listing.php
to
wp-content/themes/YOUR CHILD THEME/geodirectory/geodir-listing.php
and movedo_action('geodir_listings_page_description'); // add description
to where you want it.
http://docs.wpgeodirectory.com/customizing-geodirectory-templates/
January 3, 2015 at 11:43 pm #26268Guust, this works perfectly and is much easier than what I assumed I would have to do! Thank you!
January 4, 2015 at 1:40 am #26276Glad we could help, I’ll set this to resolved then.
May 1, 2015 at 1:59 am #38387Okay, this worked great and then all of a sudden my category top descriptions have completely disappeared! Do you all know why they may not be showing at all?
My site is bluegrassbrides.com and the “find a vendor” link will show you the categories that each should have a top description that I had moved to the bottom. It should show a long list of companies.
May 1, 2015 at 7:20 am #38397Can you try to temporarily delete the customised template, and see whether it works with the default plugin template?
Just back it up first somewhere.May 2, 2015 at 12:58 pm #38493Okay, I tried removing the customized template and my category description still isn’t showing up. I also tried deactivating some of my newer plugins to see if that is what is causing it. However, my category descriptions still aren’t showing.
May 2, 2015 at 2:27 pm #38494Can you post admin details please, and FTP.
I tested on my test site and there should be no problem with the latest versions (or any earlier ones for that matter).May 3, 2015 at 1:38 am #38527This reply has been marked as private.May 3, 2015 at 2:41 am #38531This reply has been marked as private. -
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket