Lost gd-post-pkg-x

This topic contains 19 replies, has 3 voices, and was last updated by  Alex Rollin 7 years ago.

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

Open Support Ticket
  • Author
    Posts
  • #417484

    Mitch Canton
    Expired Member
    Post count: 167

    I’ve looked everywhere, (custom WPGD plugin, child-theme functions, etc…) but I can’t figure out why I’ve lost the “gd-post-pkg-x” from the <li class=”clearfix geodir-gridview gridview_onefourth gd-post-pkg-1 gd-post-gd_place” data-post-id=”131927″>.

    I have the production site and the staging site. It IS showing on the production site, but NOT on the staging site. They have the same WPGD settings, the same packages, the same WPGD plugins, the same WPGD custom plugin file, same plugins active on those pages… I ran all the checks in Tools. I even went through every page tab in WPGD settings to see if there was something out of place there.

    The only difference is that the production site has Kleo, and the staging site has Avada. But I have another test site where I reactivated the Kleo child theme, and it is also missing that code.

    Any guidance?

    Thanks.

    #417532

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    you might check to see if you got your snippets moved over, too. Is this the snippet you used?

    https://wpgeodirectory.com/docs/common-code-snippets/#package

    Let us know how it goes

    #417585

    Mitch Canton
    Expired Member
    Post count: 167

    Hey Alex,

    Yeah, I checked, and that code IS still in the WPGD custom plugin.

    I also *added* it to the theme functions.php file directly. Now here’s something interesting. I left it active in the custom plugin as well, and it crashed the site (as expected *if* two of the same code is active). So the site IS seeing it.

    I then removed it from the custom plugin, just leaving it in the theme directly, and the site came back (as expected) BUT the code was still not applying.

    It’s strange. What should I try next?

    Thanks.

    #417650

    Alex Rollin
    Moderator
    Post count: 27815

    We can take a look if you like, just send over the URL and WP Admin.

    Yes, good not to run it twice. The snippet doesn’t seem like it would react with Avada. I will flag your question as maybe the developers have an idea

    #417654

    Mitch Canton
    Expired Member
    Post count: 167
    This reply has been marked as private.
    #417739

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    i guess the $post value is being reset at some point, you might need to get the package value independently like:

    $package_id = geodir_get_post_meta($post->ID, 'package_id', true);

    Stiofan

    #417795

    Mitch Canton
    Expired Member
    Post count: 167
    This reply has been marked as private.
    #417801

    Stiofan O’Connor
    Site Admin
    Post count: 22956
    
    
    add_filter( 'body_class', 'my_add_package_class',10,1 );
    function my_add_package_class($class){
        global $post;
    $package_id = isset($post->package_id) ? $post->package_id :geodir_get_post_meta($post->ID, 'package_id', true);
        if (geodir_is_page('detail') && isset($package_id)) {
            $class[] = "gd-package-id-".$package_id;
        }
        return $class;
    }

    Stiofan 🙂

    #417803

    Mitch Canton
    Expired Member
    Post count: 167

    Thank you very much for the code mods. I hate to say it, but it did not resolve the issue.

    In working on it more, I do see something that might be related. Last year, I was given some code to add a grouping of “Featured” listings above the main listings. It looks as though the Featured grouping DOES have the pkg-id, but the main listings do NOT. Here is the code for that and the new:

    
    
    add_action('geodir_before_listing','_my_listings_top');
    function _my_listings_top(){
    
    	global $wp_query;
    	$current_term = $wp_query->get_queried_object();
    	$cat_id = isset($current_term->term_id) ? $current_term->term_id :'';
    	$post_type = geodir_get_current_posttype() ? geodir_get_current_posttype() : 'gd_place';
    
        $output = do_shortcode('[gd_listings post_type="'.$post_type.'" layout="4" character_count="140" category="'.$cat_id.'" post_number="10" list_sort="az" show_featured_only="1"]');
    
    	if (strpos($output, 'no-listing') === false) {
    		echo "<h3>Featured GoLocal Listings</h3>";
    		echo $output;
    		echo "<hr /><h3>More GoLocal Listings</h3><br />";
    	}
    
    }
    
    // add the package id to the body
    add_filter( 'body_class', 'my_add_package_class',10,1 );
    function my_add_package_class($class){
        global $post;
    $package_id = isset($post->package_id) ? $post->package_id :geodir_get_post_meta($post->ID, 'package_id', true);
        if (geodir_is_page('detail') && isset($package_id)) {
            $class[] = "gd-package-id-".$package_id;
        }
        return $class;
    }

    Is it possible the ‘Featured’ code I was given now conflicts with the ability to pull package id in the rest of the listings?

    Thanks.

    #417900

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    No it does not look like it would affect it.

    I do see that it is set to only run on the details page which i assume is wrong, i think u want it on the listings page

    geodir_is_page('detail')

    should be

    geodir_is_page('listing')

    Stiofan

    #417951

    Mitch Canton
    Expired Member
    Post count: 167

    Still at this. I’ve tried a dozen different variations of theme functions and file tweaks, but I still have it only partially working. Have same themes now and same plugin stack. Plus I have exactly replicated code in the WPGD custom plugin of the two sites. Have got it to *partially* work. Here’s where I’m at:

    The site that is working (showing the pkg-id) has the ‘sort’ and ‘view’ boxes separate; where the site that is not working has them together (but on the lower portion).
    (see screencaps)

    Also in looking at dev tools, both sites have the pkg-id working on the top (Featured) but the broken site has some ‘geo-tax-sort’ class and then the listings below that do not work (for pkg-id).
    (see screencaps).

    The WPGD Place Settings are the same (for sort, etc).

    Maybe the screencaps will have something jump out.

    Thanks for any direction to resolve.

    #418217

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Where is your code snippet? Can u link direct to it?

    Stiofan

    #418264

    Mitch Canton
    Expired Member
    Post count: 167

    The code snippet is part of a custom plugin where I compile all my WPGD related custom code. It is simply another plugin on the site: “GeoDirectory custom CCL.” You can see it in the admin > plugins.

    The interesting part is that I have the exact code in the WPGD custom plugin on both sites.

    I will also drop FTP creds in the next message so you can see it there.

    Thanks.

    #418267

    Mitch Canton
    Expired Member
    Post count: 167
    This reply has been marked as private.
    #418271

    Mitch Canton
    Expired Member
    Post count: 167
    This reply has been marked as private.
Viewing 15 posts - 1 through 15 (of 20 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