Forums › Nearby Posts › Add Website/Phone/Content to Nearby Locations
- This topic has 26 replies, 2 voices, and was last updated 6 years, 3 months ago by
Eyal Fitoussi.
-
AuthorPosts
-
April 15, 2016 at 4:24 am #51682
Tyler Smith
MemberEyal,
This is William Rodriguez, I am a web developer helping Tyler with this issue.
I have disabled the Visual Composer and tested the content population, and it’s still not showing up. I think it’s safe to say that is not the issue. I plan on trying to disable the other plugins to rule those out as well. Can you show me what files I need to review within the plugin directory that relates to the content being populated in the area that it is not currently?
Any other help would be appreciated. If this doesn’t work, I am going to try and edit the code for the plugin to see if we can work around this issue.
Thanks,
WilliamApril 15, 2016 at 3:38 pm #51687Eyal Fitoussi
MemberHi William,
The file you should be looking at should be in the theme or child theme folder/geo-my-wp/nearby-locations/posts/lightcoral/content-single-item.php.In the file you have access to the $post object which should have the post content in $post->post_content which works fine on my test site.
I am not too sure why it doesn’t display the content for you. You can also try to get the content using the get_the_content() function.
I hope that helps.
April 18, 2016 at 2:52 am #51755Tyler Smith
MemberThat doesn’t seem to be the file related to the post popup on the map. Where is that file?
April 18, 2016 at 12:29 pm #51760Eyal Fitoussi
MemberThe file I mentioned above holds the content of each location in the list of results.
If you are looking to modify the map’s info-window content then there is no file for it. You will need to use the filter hook:
1apply_filters( 'gmw_nbl_'.$this->args['item_type'].'_info_window_content', $output, $item, $this->args );Which can be found in
gmw-nearby-locations/gmw-nearby-locations-class.php
near line 385.I hope that helps.
April 19, 2016 at 3:16 am #51768Tyler Smith
MemberEyal,
I actually had it pulling content into the listings below the map, but it was pulling the page content and not the post content. I tried all kinds of filtering and such, nothing worked. Do you have any idea we can work around this, or pull the correct content?
I also tried to play around with the info-window content, nothing seemed to work. Same issue, it wanted to pull the page content and not the specific post content.
Thanks,
WilliamApril 19, 2016 at 7:49 pm #51771Eyal Fitoussi
MemberHi William,
Try addingglobal $post;
at the beginning of the content-single-item.php file as well as in your custom function for the info-window hook.April 20, 2016 at 3:10 am #51775Tyler Smith
MemberIt is still not working. Any other suggestions?
Thanks,
TylerApril 21, 2016 at 6:29 am #51784Tyler Smith
MemberEyal,
I ended up adding “advanced custom fields” plugin and adding the content to the listings below the map that way.
When I try to add those areas to the map info-window the content is not added to the info-window but above the listing in the area below the map. Do you have any idea why this would happen? No matter which way I add the new custom field in the info-window, it always shows up above the listing and not within the info-window.
Any help would be appreciated!
April 21, 2016 at 9:50 pm #51795Eyal Fitoussi
MemberWhen I try to add those areas to the map info-window the content is not added to the info-window but above the listing in the area below the map. Do you have any idea why this would happen?
I believe that the function you are using is echoing the profile field value instead of “getting” it.
Can you please post the custom function you are using for the info-window?
April 26, 2016 at 2:26 am #51871Tyler Smith
MemberI was using a few different function variations, but none of them seemed to work. Nothing special when it came to the code.
How would you suggest coding the function?
April 26, 2016 at 2:55 pm #51882Eyal Fitoussi
MemberThis example should add the post content to the info window. However, it will append it below the main info-window content. You need to manipulate the $output array in order to add the additional content where ever you want.
1234567891011function gmw_nbl_modify_iw_content( $output, $item, $args ) {global $post;$content = get_post( $post->ID );$output['content'] = $content->post_content;return $output;}add_filter( 'gmw_nbl_posts_info_window_content', 'gmw_nbl_modify_iw_content', 50 , 3 );May 7, 2016 at 10:37 pm #52064Eyal Fitoussi
MemberThis topic marked “Resolved” due to inactivity. If you wish to reply to this topic please change its status to “Not resolved” before replying.
-
AuthorPosts
You must be logged in to reply to this topic.