Looper Support for Accessing GeoDirectory Custom Fields

I am using X Theme with Cornerstone and trying to dynamically display GeoDirectory custom fields using Looper, but it seems that Cornerstone cannot access these fields.

For example, GeoDirectory has:

  • A Facebook URL field with the key facebook_url.

I tried using the following Looper setup:

  1. For the Facebook URL:
    • Text Element
      {{dc:post:meta key="facebook_url"}}
      

However, this approaches did not work. It seems that Cornerstone cannot retrieve data from GeoDirectory’s custom fields.

Could you confirm whether Cornerstone supports accessing GeoDirectory fields via Looper? If not, is there a workaround to display these fields dynamically?

I would appreciate any guidance on this. I added login & urls in the secure note!

Hello @sbxstrategies,

Thanks for writing in! Yes, Cornerstone cannot retrieve data from GeoDirectory’s custom fields because they were not saved as a post meta. Please be advised that Cornerstone’s Dynamic Content will only have access to the post meta and ACF fields. You may need to contact the creators of the GeoDirectory plugin and ask them how can we display the fields in a custom places template.

Thank you for your understanding.

Hi, I just look at their documentation for grabbing the data from Post Meta. We can access the post meta by simply adding a prefix “geodir_” so I wonder if you could somehow inject the prefix to this
{{dc:post:meta key=“facebook_url”}} ?

docs: https://docs.wpgeodirectory.com/article/68-gd-post-meta

Thank you for the info.

Looks like you’re using WP Bakery Page Builder to create the content for the Places post type. Where exactly are you using the dynamic template {{dc:post:meta key="facebook_url"}} ?

Please provide a direct link to the Cornerstone single layout or page.

Hi, I did provide everything in a “secure note” section on the every first comment, it included Cornerstone single layout :slight_smile:
I am providing it again on this as well

Thank you for the update.

The Single page backend link was pointing to the WPBakery Builder, not the CS Builder. Anyway, we added this filter in the functions.php file to allow the use of the geodir_get_post_meta function in a Twig template.

add_filter('cs_twig_functions', function ($results) {
  if (function_exists('geodir_get_post_meta')) {
    $functions = [
      'geodir_get_post_meta' => [
        'callable' => 'geodir_get_post_meta',
      ]
    ];

    return array_merge($results, $functions);
  }

  return $results;
});

We also updated the single layout to give you an idea of how it can be used to retrieve the GD fields.

Let us know if you need more info.

Kind regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.