Profile tab extend- view in preview

This topic contains 4 replies, has 3 voices, and was last updated by  Alex Howes 6 years, 7 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #439613

    Alex Howes
    Expired Member
    Post count: 175

    Hello,

    I’ve been using this code from Paulo to add extra information to the profile tab https://wpgeodirectory.com/support/topic/custom-fields-3/#post-31897. It works fine, but doesn’t change the listing preview, only the published listing.

    Is there a way to modify it so that it also works on the listing preview? Perhaps an equivalent hook to geodir_detail_page_tab_list_extend that’s called for the listing preview? It’s a bit odd for the user if the preview looks different from the published listing.

    Thanks,
    Alex

    #439614

    Alex Rollin
    Moderator
    Post count: 27815

    Hi Alex,

    Please post the snippet you are using here so we can take a look at it.

    #439615

    Alex Howes
    Expired Member
    Post count: 175

    Hi Alex,

    I’m using the code written by Paulo in the link I gave. The code is:

    
    
    add_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_page_tab_list_extend_profile') ;
    
    function geodir_detail_page_tab_list_extend_profile($tab_array)
    { global $post;
    // here is where we check the tab we want has info and then assign it to a global $post value.
    // you would change the 'gd_tab_3' to your tab key.
    if(isset($tab_array['gd_tab_3']['tab_content']) && $tab_array['gd_tab_3']['tab_content']){
    $post->my_profile_extend = $tab_array['gd_tab_3']['tab_content']; // assign the content to global value
    $tab_array['gd_tab_3']['is_display']= false;// don't display the tab 
    }
    
    // here we call a function that will get the global value and echo it.
    add_action('geodir_after_description_on_listing_detail','gd_extra_profile_tab_info');
    
    return $tab_array;
    }
    
    // function that will get the global value and echo it.
    function gd_extra_profile_tab_info(){
    global $post;
    if(isset($post->my_profile_extend) && $post->my_profile_extend){echo $post->my_profile_extend;}
    }

    Alex

    #439669

    Patrik
    Moderator
    Post count: 1971

    Hi Alex,

    The same hook and filter also called on the listing preview page. So it should work same on preview page as well. Kindly provide the admin and FTP details in private reply to look more into your site and fix the issue.

    Regards,
    Patrik

    #439752

    Alex Howes
    Expired Member
    Post count: 175

    Hi Patrik,

    Sorry, this was my fault. I added an extra line in the code meaning that it was only running on detail pages. I’ve now extended this to include preview pages too.

    Thanks,
    Alex

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
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount