Embedding Custom Fields Dynamically
This topic contains 20 replies, has 4 voices, and was last updated by Guust 4 years, 9 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: custom fields, Dynamic, dynamic content
-
AuthorPosts
-
February 28, 2020 at 12:08 am #532707
I’m interested in being able to create a sentence that is filled in with information from text-based custom fields. For example, I would like to be able to do something like this…
“[post-title] is near [city] in the US state of [region].”Is there a shortcode I can use to pull text from other custom fields to dynamically do this? Or, is there a plugin you would recommend?
February 28, 2020 at 3:21 am #532708You can use this, but will need to add CSS to fine-tune it:
[gd_post_meta key="post_title" show="value-strip"] is near [gd_locations what="city" show_current="1"] in the US State of [gd_locations what="region" show_current="1"]
It can only be used in the Detail and Archive Item template.
Thanks
February 28, 2020 at 4:43 pm #532803Thanks! In addition to city and region, I’d also like to add text from textarea content fields. (I’m currently working in the gd_place CPT) For example, I want to be able to do something like this…
[gd_post_meta key=”post_title” show=”value-strip”] is a [type].
(In this example, “type” is an example of a custom field.)Is there a shortcode that can accomplish this? Also, if there is any documentation that exists on this topic, feel free to point me to it so I don’t have to keep bugging you. Thanks for your help!
February 28, 2020 at 6:09 pm #532819Hi Peter,
Thanks for your reply. With GD post meta, you can call the custom field “type” directly using the shortcode below.
[gd_post_meta key="type" show="label"]
February 28, 2020 at 6:47 pm #532829I inserted the following line into a textarea custom field to test the shortcode:
This place is a [gd_post_meta key=”type” show=”value”].It was successful at inserting the type, but it puts the value on a new line rather than on the same line. The output looks like this:
This place is a
hotel
(there is a line here)
.How do I make it look like this:
This place is a hotel.If you are able to answer this question, I should be good to go. Thanks again for all of your help!
February 28, 2020 at 7:16 pm #532832Hi Peter Johnson,
Thanks for your reply. We might need to apply some custom CSS code to fix this. Do you have a test page to show me what you’ve done?
February 29, 2020 at 1:07 am #532880This reply has been marked as private.February 29, 2020 at 12:14 pm #532916Can you turn off all plugins and modifications so everything works again?
None of your pages are working at all.
Go back to basics and only activate plugins you need and then make sure they are not breaking things.February 29, 2020 at 7:15 pm #532943This reply has been marked as private.February 29, 2020 at 10:31 pm #532950This reply has been marked as private.March 1, 2020 at 8:48 pm #533007This reply has been marked as private.March 2, 2020 at 7:12 am #533024I fixed my site. My htaccess file was missing several lines. Everything works now. If you don’t mind taking a third look at my site to help with the original issue, I would be extremely grateful!
Kor suggested creating custom CSS, which could work. I’m wondering if there is a way to just create something that could be added to the shortcode that strips the embedded custom field of all CSS relationships so it can take on the CSS of the content field containing the shortcode. Anyway, just a thought. I wouldn’t be surprised if this would be useful to other people as well.
March 2, 2020 at 7:39 am #533027Hi Peter,
Thanks for your reply. I’m actually referring to this “Extra Class” option as shown in the attached screenshot. Inserting a custom CSS name should all you to apply custom CSS code to achieve what you needed there.
March 2, 2020 at 8:33 am #533031We have had several requests for this and we have a task to look into adding this, but for now it requires your own custom CSS.
Thanks
March 2, 2020 at 11:31 pm #533188I’ve read all of the documentation I can find on the Geodirectory site about the CSS Class field. Below is one of the several versions of the shortcode that I tried. It doesn’t seem to be fully changing the CSS to match the surrounding text. It still puts the word on a separate line and it still puts a line below the inserted word. Are you able to see what is wrong with the shortcode below? Is the CSS class wrong if I want it to conform to the CSS of a details/listing page? Thanks for your help.
CSS Class- Single gd place
This place is a [gd_post_meta key=”type2″ show=”value” css_class=”single-gd_place”]Sources I used to try to figure this out…
https://wpgeodirectory.com/docs-v2/faq/common-examples/#selectors
https://wpgeodirectory.com/docs-v2/places/custom/#settings -
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket