Edit custom post type listing PHP page

This topic contains 28 replies, has 5 voices, and was last updated by  Paolo 8 years, 11 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #26004

    kelsey.rahenkamp
    Expired Member
    Post count: 53

    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?

    #26027

    Guust
    Moderator
    Post count: 29970

    You 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 Description

    I 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 Description

    The template for that would be indeed listing-listview.php but let’s check with Paolo.

    #26115

    kelsey.rahenkamp
    Expired Member
    Post count: 53

    Correct, 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.

    #26124

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    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

    #26131

    kelsey.rahenkamp
    Expired Member
    Post count: 53

    Thank you! That also explains why my maps aren’t working. I’ll try it out and see if I can get it to work!

    #26132

    kelsey.rahenkamp
    Expired Member
    Post count: 53

    Guust, 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?

    #26162

    Guust
    Moderator
    Post count: 29970

    Move
    wp-content/plugins/geodirectory/geodirectory-templates/geodir-listing.php
    to
    wp-content/themes/YOUR CHILD THEME/geodirectory/geodir-listing.php
    and move

    do_action('geodir_listings_page_description'); // add description

    to where you want it.

    http://docs.wpgeodirectory.com/customizing-geodirectory-templates/

    #26268

    kelsey.rahenkamp
    Expired Member
    Post count: 53

    Guust, this works perfectly and is much easier than what I assumed I would have to do! Thank you!

    #26276

    Guust
    Moderator
    Post count: 29970

    Glad we could help, I’ll set this to resolved then.

    #38387

    kelsey.rahenkamp
    Expired Member
    Post count: 53

    Okay, 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.

    #38397

    Guust
    Moderator
    Post count: 29970

    Can you try to temporarily delete the customised template, and see whether it works with the default plugin template?
    Just back it up first somewhere.

    #38493

    kelsey.rahenkamp
    Expired Member
    Post count: 53

    Okay, 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.

    #38494

    Guust
    Moderator
    Post count: 29970

    Can 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).

    #38527

    kelsey.rahenkamp
    Expired Member
    Post count: 53
    This reply has been marked as private.
    #38531

    Guust
    Moderator
    Post count: 29970
    This reply has been marked as private.
Viewing 15 posts - 1 through 15 (of 29 total)

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

Open Support Ticket