Remove do_action('geodir_detail_sidebar'); from Listing preview

This topic contains 4 replies, has 2 voices, and was last updated by  Paolo 7 years, 11 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #197251

    EH
    Expired Member
    Post count: 96

    I have ad calls in the sidebars, and I being asked to remove all ads from the parts of the site where people submit listing. I managed to get the ads off everything except the listing preview. I tried to do it from my child functions but its not working. Here is what I have:

    
    
            //Remove Sidebar on GeoDirectory Preview Page 
            function geodir_remove_sidebar (){
                if((strpos($_SERVER['REQUEST_URI'], "listing-preview") == true)) {
                    remove_action('geodir_before_main_content','geodir_detail_sidebar');
                }
            }
            add_action ('genesis_after_header','geodir_remove_sidebar');

    I be open to doing this another way too.

    #197411

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    please see: https://wpgeodirectory.com/docs/codex/geodirectory_functions/geodir_is_page/

    geodir_is_page('preview')

    Should be what you are looking for.

    Let us know,

    Thanks

    #197864

    EH
    Expired Member
    Post count: 96

    Thanks Paolo,

    I’m still having trouble removing the sidebar though. I think it has to do with the hook I’m using: remove_action(‘geodir_before_main_content’,’geodir_detail_sidebar’); If I don’t use a hook I get this error message:

    Warning: Missing argument 2 for remove_action(), called in C:WampDeveloperWebsiteslocalhostwebrootehpublic_htmlwp-contentthemeselectronichousefunctions.php on line 481 and defined in C:WampDeveloperWebsiteslocalhostwebrootehpublic_htmlwp-includesplugin.php on line 642

    #197890

    EH
    Expired Member
    Post count: 96

    Actually I think I got it. I’m using:

    
    
            //Remove Sidebar on GeoDirectory Preview Page 
            function geodir_remove_sidebar (){
                if (geodir_is_page('preview')) {
                    remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 );
                }
            }
            add_action ('genesis_after_header','geodir_remove_sidebar');

    This is correct, right? It appears to be working…

    #198014

    Paolo
    Site Admin
    Post count: 31206

    I’d have to test it to be 100% sure, but it looks correct to me. If it works on your test it should be correct.

    Thanks

Viewing 5 posts - 1 through 5 (of 5 total)

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

Open Support Ticket