Add custom post info to Enfold's masonry template
This topic contains 17 replies, has 5 voices, and was last updated by Irth Orbits 9 years, 11 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: Custom Post Types, enfold theme
-
AuthorPosts
-
November 26, 2014 at 1:28 am #22618
Looking to add some values saved in GeoDirectory to a theme’s template. Found where in the template is responsible but how to display specific data in the template via a hook?
Example of the masonry rendered template attached and test site is at http://test.locallogic.ca/directory/going-out/indoor-activities/
November 26, 2014 at 8:39 pm #22737Hi, we didn’t develop Enfold, just a compatibility plugin for it. To tell a Enfold template how to output custom post types instead of regular post, sounds like a question for the Enfold Author.
Let us know what they say, thanks.
November 26, 2014 at 9:33 pm #22767Please correct me if I’m wrong, but doesn’t your plugin register global hooks that can be used willy nilly wherever we want?
November 26, 2014 at 11:08 pm #22785It doesn’t work that way.
Hooks allow you to modify GeoDirectory templates and extend the GeoDirectory functions.
Not to extend/mix other themes and plugins.
Anyway, I’ve just checked in our Enfold demo, and the Masonry element already supports custom post types by default from the advanced layout builder.
http://dropct.com/enfold/blog/masonry-blog/
The problem is that you won’t be able to filter the listing in any way other than just displaying them all. I don’t think it will filter locations for example.
If you want to do that, you have to modify the masonry element, but I suspect it would be easier to turn the regular GD archive into a masonry element instead.
Thx
November 27, 2014 at 3:29 am #22807Thanks Paolo. I understand a little better and I don’t think the filtering is an issue at this point.
I still don’t understand how to get geoD data to display in the masonry element. For example, I’m trying to display a business address so copy the code:
function geodir_detail_page_more_info() { global $post,$preview,$post_images; ob_start() ; // Start buffering; do_action('geodir_before_detail_page_more_info') ; if($geodir_post_detail_fields = geodir_show_listing_info()){ echo $geodir_post_detail_fields; } do_action('geodir_after_detail_page_more_info') ; $content_html = ob_get_clean(); if(trim($content_html) != '') $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>' ; echo $content_html = apply_filters('geodir_detail_page_more_info_html' , $content_html) ; }
from geodirectory_hooks_actions.php and drop in the masonry_entries.php and add {$content_html} right next to {$content} in $items
I don’t know php so I’m just hacking away. Am I overthinking this? Linked is a visual of desired outcome. Thx for the assistance.
November 27, 2014 at 6:09 pm #22865Hi,
customization is not part of the support provided here. We can give you pointers, but we will not write the code for you.
A fair question though, if you don’t know PHP, why did you accept a job involving PHP customizations?
The function that you want to look at to see how the address is displayed in the sidebar would be:
function geodir_show_listing_info that can be found in custom_fields_functions.php around line 1694.
To display rating it will be another bit:
listing-listview.php around line 103.
To display a custom field you can use the regular wordpress API for it.
Let us know how you get on.
Thank you
November 28, 2014 at 6:46 am #22923Thanks haven’t quite got it yet. Trying to display the address, I’m using the following code
$this->loop[$key]['geo_loc'] = get_field( "geodir_show_listing_info" , $id );
then in the html I call
{$geo_loc}
What am I missing?
November 28, 2014 at 7:30 am #22925If it helps I found this brief but closed support topic. could you just tell me what needs to be swapped in for Geo Dir? thx
http://www.kriesi.at/support/topic/masonry_entries-php-get-custom-field-value-or-content/
November 28, 2014 at 8:42 pm #22974Hi Irth,
that can probably be used to get a regular wordpress custom field, not the address. The address and various other fields aren’t saved as regular custom fields. they are saved in a table called geodir_gd_place_detail.
get_field must be an enfold function and I don’t know what it does, but in the example he’s calling a specific custom field
get_field( "linkedin-url", $id );
.
you are trying to call a function instead
get_field( "geodir_show_listing_info" , $id );
Not knowing how that Masonry script exactly works, it is very difficult to give you a straight answer without doing it ourself, reason why we don’t provide support for customizations.
But I’ll ask to Stiofan to have a look at this and see if he can think of any easy way to do this.
Thanks
November 29, 2014 at 2:18 am #22990Thanks, I would want to use whichever wordpress call works. I also tried get_post and a few others without luck. is there a special $context that I would need to set?
November 29, 2014 at 4:42 pm #23035I am not exactly sure what you are trying to do here but maybe this functions would help?
$post_details = geodir_get_post_info($post_id);
you shoudl then be able to get all the info u need from $post_details, you can do a print_r($post_details); to print all the info contained.
Stiofan
December 2, 2014 at 5:31 am #23226Thanks for that, tho I’m still not getting anything info to display. What I’m trying to do is have the Enfold theme’s masonry display the location and rating info from geoD tables.
Here’s a link to the file in question, line ~598 is where I want to inject geoD data.. https://github.com/irthos/locallogic/blob/production/public/wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/masonry_entries.php
Appreciate the attention!
December 2, 2014 at 7:11 pm #23303Hi Irth,
it seems like you are looking for someone to write the code for you.
I’m glad to move this to the Jobs section to allow you to find a developer to help you with this.
Writing custom functions to make GD elements appear in other theme’s template goes beyond support provided here.
Thanks
December 3, 2014 at 12:24 am #23355Hi Paolo, seems like you’d rather not help with a simple request on a premium plugin.
I’m also in touch with the enfold folks but this is geoD responsibility.
Now, I enter $items .= geodir_get_post_info($entry[‘ID’]); into line 598 of the masonry_entries.php and this displays only the number ‘0’.
Why would it do this? Thanks for ongoing support.
December 3, 2014 at 1:22 am #23357Hi Irth,
you are not asking for a simple support request, but for a customization that involves writing custom code inside the template of another product.
Buying the premium plugin doesn’t include custom coding.
I reiterate my offer to help you find a PHP developer to help you with this.
Probably Jeff would be availalbe to help with this.
Thanks
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket