Video Support for Map Listings

This topic contains 17 replies, has 4 voices, and was last updated by  RTRDigital Administrator 5 years, 9 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #434118

    RTRDigital Administrator
    Free User
    Post count: 9

    I’m trying to replace the default image that is displayed in the listings below the map with a video. I am looking for anyone who can let me know how to filter the function, or add a hook, to replace the default images HTML with the video URL inserted in that same listing.

    Thanks in advance.
    Directory Newb..

    #434204

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hello,

    Do you mean in the map popup, or the listing page or the details page?
    ]Our GDv2 beta this can be done easily, in v1 it will require some code snippets.

    Stiofan

    #434301

    RTRDigital Administrator
    Free User
    Post count: 9

    First off, I didn’t know there was a GDv2 Beta, so thanks for that. Secondly, I need the video to appear in two places, the map pop-ups/markers and on the top of the individual listing pages of each business. Right now, the map markers use the featured image, and the page listings show an image carousel at the top of the page. Can you help me?

    Directory Newb…

    #434302

    Dirk
    Full Member
    Post count: 390

    This is simple:

    remove_action ( 'geodir_details_main_content', 'geodir_action_details_slider', 30 );

    will remove the existing image slider. You can add here the action with something from your own or the content of the video tab.

    Map Bubble:

    
    
    /**
     * Filter to change infowindow html
     *
     * You can use this filter to change infowindow html.
     *
     * @since 1.0.0
     * @package GeoDirectory
     * @param string $html Infowindow html.
     * @param object $postinfo_obj The Post object.
     * @param bool|string $post_preview Is this a post preview?
    */
      $html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);

    @stiofan: The filter and the action is not in the codex.

    Dirk

    #434303

    RTRDigital Administrator
    Free User
    Post count: 9

    Thanks Dirk,

    I’m a little unfamiliar with implementing filters in WordPress. I’m a completely custom developer and I’m adjusting to not being able to just rewrite the code (as it will be overwritten during updates), so do you mind if I ask you a couple more questions?

    1. Where is all of this code implemented? Is there a place in the directory theme for adding and removing actions, or is this something that WP provides?

    2. You’re clearly passing an array of variables into the remove_action function, what does the “30” represent>

    #434308

    RTRDigital Administrator
    Free User
    Post count: 9

    Okay, after some basic research, here’s what I’m thinking.

    geodirectory/geodirectory_hooks_actions.php (active) is where I need to add the hook you just listed. Is that correct?

    Won’t this be overwritten by an update?

    #434341

    Alex Rollin
    Moderator
    Post count: 27815

    Thanks @Dirk

    For code snippets, you can use the code snippets plugin to allow the theme to remain as is.

    We recommend not to edit the core plugin files.

    https://wpgeodirectory.com/docs/useful-plugins/#snippets

    #434350

    Dirk
    Full Member
    Post count: 390

    As Alex wrote you can use the code snippets plugin and you are safe with updates (of the plugins and themes).

    Your second question: The “30” in the function call is the priority or here the order. There are different actions added to the hook and they are executed in priority order. With the priority “30” it is where the image slider is located.

    I think you should get more familiar with WordPress and then the implementation is very easy.

    Install the mentioned plugin and add a snippet like:

    
    
    remove_action ( 'geodir_details_main_content', 'geodir_action_details_slider', 30 );
    add_action ('geodir_details_main_content', 'my_function', 30);
    function my_function () {
    echo '<h1>Hello World</h1>';
    }

    If you don’t like to implement yourself, there are some experts to hire (look at the sidebar here).

    @alex: Will you inform Stiofan about the missing doc?

    #434354

    RTRDigital Administrator
    Free User
    Post count: 9

    Thanks for the assistance. You’re right, I need to get more familiar with WP. I am totally comfortable with PHP, but this is the first time a client has asked me to change a backend function. The list of useful plugins is helpful, and your example is clear, but I don’t need to try to know what it does.

    You removed the function altogether, then added it back again, but this time you called a custom function. I might have one more question after I try to use implement the videos, being the call will include a variable that’s somewhere already in the plugin.

    Off the top of your head, do you know what variable the video URLs that are collected through the places form are stored in?

    Thanks in Advance
    WP & GEO Newb…

    #434393

    Dirk
    Full Member
    Post count: 390

    Also simple:

    For the map bubble you have with add_filter the $postinfo_obj. With print_r you will get what’s inside.

    This is not what you will have in case of the add_action. But at least you will have a global variable called $post (global $post) to get what you want.

    Also geodirectory has an API where you can get such kind of variables. Look into the code or into the codex:
    https://wpgeodirectory.com/codex/codex/

    BTW: WP and it’s concepts are simple and designed for customizations. GD is a plugin for WP and follows these concepts.

    Best,
    Dirk

    #435239

    RTRDigital Administrator
    Free User
    Post count: 9

    Hello again.

    I appreciate all the help I’ve been given. After taking some time to learn more about WP, I realized I only need the name of the function that generates the video on the Video tab. Can anyone tell me what it is, or tell me where to look in the documentation for it? I started going the functions, but there are a lot of them. Searching using the term “video” didn’t seem to return the right function either.

    #435244

    Alex Rollin
    Moderator
    Post count: 27815

    Is this what you are looking for?

    https://wpgeodirectory.com/codex/codex/geodirectory_functions/geodir_show_detail_page_tabs/

    Can you say more about what you are trying to achieve?

    #435265

    RTRDigital Administrator
    Free User
    Post count: 9

    @alex

    The situation is pretty simple. I’m making a change to the geodir_details_main_content tag by changing the function it calls. By default, it calls geodir_action_details_slider, creating the slider at the top of the listings details page. I want to replace the slider with the video associated with the that particular $post_id. There is a function that creates the video wrapper on the video tab, but I can’t find it the code. I’m not sure if it’s a documented function, so I’m asking if anyone can identify the function. If so, I can call it in place of geodir_action_details_slider. Thanks.

    #435266

    RTRDigital Administrator
    Free User
    Post count: 9

    If I have to write a custom function passing in the $post_id and pulling the string from the table I will, but I just don’t want to have to rewrite a function I know already exists.

    #435276

    Alex Rollin
    Moderator
    Post count: 27815

    Take a look at this thread:
    https://wpgeodirectory.com/support/topic/one-image-or-video-instead-of-slider/#post-66709

    For pulling it from another post you should connect with a GD Expert:
    https://geodirectoryexperts.com

Viewing 15 posts - 1 through 15 (of 18 total)

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

Open Support Ticket