Banner on top

This topic contains 12 replies, has 5 voices, and was last updated by  Paolo 6 years ago.

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

Open Support Ticket
  • Author
    Posts
  • #455383

    Alexander Kamburov
    Expired Member
    Post count: 21

    Thanks for the great support so far!

    Here is something we are trying to achieve:
    – suppose there are regular “places” in the system
    – another custom post type for “banners” where the user can upload his banner together with his company info

    Both places and banners have the same categories (corresponding to each other, they are not the same as the system doesn’t allow that)

    We would like to display said banners (one on the top, rotating) for specific categories of places (i.e. if there are entries with banner for that category we will display a random one). My questions are:

    – what is the best approach to inset a banner (or anything) on the top of all possible listings (like GD Home, search results, etc) – is it by adding a shortcode defined by us (but I don’t see a page for “All Places” may be this is just an interna template?) or os there a hook that would allow us to insert HTML before every listing (home, search, locations etc)?

    – what is geodir_ function to get the current category for the search result currently displaying

    – what is geodir_ function to retrieve all entries for specific post type and for specific category?

    Thank you in advance.

    #455420

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    there is no way to do something similar without some custom code.

    I asked to the developers to have a look at your question and point you in the right direction.

    Thanks for your patience.

    #455422

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    It would definitely require some custom code.
    In GDv1 you could use hooks to insert it, in GDv2 you could use a shortcode if you make one.

    Stiofan

    #455435

    Alexander Kamburov
    Expired Member
    Post count: 21

    Thanks but can you point me to the right:
    – the hook to insert above the search results for v2
    – the two functions we need a) to retrieve all data for specific custom type and category and b) to catch the current category for the current page where the code is running. It’s kind of hard to locate these in the docs as they are pretty big (if one doesn’t know the exact function names it’s hard to guess what they should be)

    Is it OK to install v2 in a production site – is it stable enough?

    #455786

    Alexander Kamburov
    Expired Member
    Post count: 21

    Any advice on my question above?

    #455836

    Alex Rollin
    Moderator
    Post count: 27815

    We don’t do customization in the forums but your post has been flagged for the developers who will try to point you in the right direction, but at this time the focus is on making all the addons compatible for release.

    #455904

    Kiran
    Moderator
    Post count: 7069

    Hello,

    – the hook to insert above the search results for v2

    There are two hooks, that you can use to insert content before searched results.

    1)

    do_action('geodir_before_listing_listview')

    will add content before

    <ul>

    tag.

    20

    do_action( 'geodir_before_listing_post_listview' )

    will add content in

    <ul>

    tag before

    <li>

    loop.

    a) to retrieve all data for specific custom type and category

    You can get help from this on how to retrieve custom post types posts using taxonomy filter https://wordpress.stackexchange.com/questions/66219/list-all-posts-in-custom-post-type-by-taxonomy

    b) to catch the current category for the current page where the code is running.

    You can use function

    get_queried_object()

    to retrieve all the searched vars for current page.

    Kiran

    #457113

    Alexander Kamburov
    Expired Member
    Post count: 21

    Thanks geodir_before_listing_listview() may be will work with one exception – you are using it absolutely the same way in

    – geodirectory-templates/listing-listview.php
    – geodirectory-templates/widget-listing-listview.php

    which means if we add something using that action it will appear where we would like and at the sime time at the sidebar where for example “Latest Places” appear. I don’t see an easy way to distinguish the two calls so to show something only at the page body.. any ideas?

    Is there an action to add content only in the page body before the listings (preferably even BEFORE the dropdown to chose the view type – list/grid 2/grid 3 etc).

    Do you have some kind of documentation/reference for the useful actions (I saw the full list of all functions in the php files which is not very useful). Thank you in advance for you help

    #457178

    Kiran
    Moderator
    Post count: 7069

    Hello,

    I don’t see an easy way to distinguish the two calls so to show something only at the page body.. any ideas?

    Use any one of following conditions to distinguish

    
    
    if ( isset( $widget_listings ) ) {
    	// geodirectory-templates/widget-listing-listview.php
    } else {
    	// geodirectory-templates/listing-listview.php
    }

    OR

    
    
    global $geodir_is_widget_listing;
    if ( $geodir_is_widget_listing ) {
    	// geodirectory-templates/widget-listing-listview.php
    } else {
    	// geodirectory-templates/listing-listview.php
    }

    Is there an action to add content only in the page body before the listings (preferably even BEFORE the dropdown to chose the view type – list/grid 2/grid 3 etc).

    Use hook do_action( ‘geodir_before_listing’ ); and use priority 99. Ex: add_action( ‘geodir_before_listing’, ‘gd_snippet_before_list_view_select’, 99 );

    Do you have some kind of documentation/reference for the useful actions (I saw the full list of all functions in the php files which is not very useful).

    Please check this: https://wpgeodirectory.com/codex/codex/

    Thanks,
    Kiran

    #457213

    Alexander Kamburov
    Expired Member
    Post count: 21

    Thanks, but..

    I already tried to use $widget_listings but it seems it is not a global variable – when used in functions.php it is not available which means it can’t be used to distinguish the cases. Is there any way to access it trough another global variable or object?

    Thanks for the geodir_before_listing() suggestion. Which comes to the doc – I already know the provided link but this was the doc I mentioned in my previous question – havint 850 functions in a paginated format is really useless to find out something that we are looking for, unless we browse manually trough all the pages and click on every function to see what it does…..

    #457225

    Paolo
    Site Admin
    Post count: 31206

    Hi Alex,

    did you try Kiran’s second suggestion?

    
    
    global $geodir_is_widget_listing;
    if ( $geodir_is_widget_listing ) {
    	// geodirectory-templates/widget-listing-listview.php
    } else {
    	// geodirectory-templates/listing-listview.php
    }

    I’m sorry, but we don’t provide detailed documentation about actions and filters. That’s part of customizing the plugin.

    Thanks

    #457234

    Alexander Kamburov
    Expired Member
    Post count: 21

    Yes $geodir_is_widget_listing is working OK, thanks.

    One last question – while geodir_before_listing() works well and inserts before the “view type” dropdown, it works for searches, but this actions is not executed at the main page (gd_home). Is there a different action for that page or there is no action to insert before everything there? Thanks

    #457235

    Paolo
    Site Admin
    Post count: 31206

    Hi Alex,

    in geodirectory/geodirectory-templates

    you will find all templates and you just need to open them to read the code and find the actions.

    Customization is beyond support.

    Thanks

Viewing 13 posts - 1 through 13 (of 13 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