Video Support for Map Listings
This topic contains 17 replies, has 4 voices, and was last updated by RTRDigital Administrator 6 years, 4 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: directory listings, Image replacement, video
-
AuthorPosts
-
June 7, 2018 at 4:56 pm #434118
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..June 8, 2018 at 10:20 am #434204Hello,
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
June 9, 2018 at 1:00 pm #434301First 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…
June 9, 2018 at 3:26 pm #434302This 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
June 9, 2018 at 3:41 pm #434303Thanks 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>
June 9, 2018 at 3:51 pm #434308Okay, 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?
June 9, 2018 at 6:57 pm #434341Thanks @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.
June 9, 2018 at 7:47 pm #434350As 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?
June 9, 2018 at 10:03 pm #434354Thanks 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…June 10, 2018 at 8:29 am #434393Also 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,
DirkJune 16, 2018 at 11:46 pm #435239Hello 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.
June 17, 2018 at 7:06 am #435244Is 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?
June 17, 2018 at 5:20 pm #435265The 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.
June 17, 2018 at 5:22 pm #435266If 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.
June 17, 2018 at 6:32 pm #435276Take a look at this thread:
https://wpgeodirectory.com/support/topic/one-image-or-video-instead-of-slider/#post-66709For pulling it from another post you should connect with a GD Expert:
https://geodirectoryexperts.com -
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket