Custom Custom Fields (schema)
This topic contains 8 replies, has 4 voices, and was last updated by Paolo 8 years, 1 month ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: schema.org
-
AuthorPosts
-
September 10, 2016 at 12:56 pm #263702
3 questions – I appreciate the time needed to read and decipher these but I think there would be feature value.
Q1
I’m hoping to create a custom field where the user enters text and we can wrap text around that entry. for example to make a shortcode. [shortcode trigger=”What is Entered in Field”] – but I have a feeling shortcodes created like this won’t get triggered.Q2
I appreciate the tip for adding a Custom Field to upload logos found https://wpgeodirectory.com/docs/custom-field-examples/ but wondering what it might take to add the ‘logo’ schema.org: <img itemprop=”logo” src=” described https://schema.org/logothere would also be something related to Brand associated with the logo, but I don’t understand enough about schema.org to even ask the question for that one.
Q3
Also related to a custom field that adds schema.org would be the ability to do SameAs schema https://schema.org/sameAs to point NAP to another website.I think proper use of the itemprop schema requires them to be associated within itemscope – so not sure how logo, brand, sameAs would work with custom fields – maybe reusing the itemscope organization schema entered when creating the listing.
div itemscope itemtype=”http://schema.org/Organization”>
<b href=”http://www.example.com/”>Home
/divNot sure if Custom Fields are the appropriate place for these or editing Page Templates might be more suitable – but not sure how complicated that would get either.
September 10, 2016 at 1:10 pm #263704the sample didn’t fare too well… and now can’t edit, try again
<div itemscope itemtype="http://schema.org/Organization"> <a itemprop="url" href="http://www.example.com/">Home</a> <img itemprop="logo" src="http://www.example.com/logo.png" /> </div>
September 10, 2016 at 3:36 pm #263821Hi,
I’ve flagged this for Stiofan. He’ll let you know his thoughts asap.
Thanks
September 10, 2016 at 4:00 pm #263833thanks, look forward to hearing more about this
September 12, 2016 at 10:00 am #264639#1
This will enable shortcodes in all text fields
This will enable shortcodes in any text infput with a htmlv var name of ‘textx’
If you wanted to do the same for a textarea you would simply change the line
add_filter('geodir_custom_field_output_text','my_enable_shortcodes_in_cf',15,3);
to:
add_filter('geodir_custom_field_output_textarea','my_enable_shortcodes_in_cf',15,3);
#2 We add schemas the new way so they don’t have to be next to the field but instead are added as JSON in the head, below is an example of adding a logo
#3 We already add sameAs for the website link and the facebook/twitter links, the way to add it is almost the same as the above example except the sameAs is an array so it’s slightly different
Thanks,
Stiofan
September 12, 2016 at 10:25 am #264645thank you for the detailed reply – I’ll dig into it see what fancy stuff I can make
September 12, 2016 at 10:29 am #264646Just let us know if you run into any problems 🙂
Stiofan
September 29, 2016 at 1:02 pm #275286Hi Stiofan,
Just found this thread and was curious about the shortcode question. Is the intention to be able to use a shortcode to display the values in a custom field, or to use a shortcode to add some custom text based on what has been input in to a custom field?
To explain the reason for my query, I would like to be able to create a shortcode that could be used to display all values in a given custom field. So, for example, if I had a custom file upload field of logos I was hoping to then display all the logos on a page. So, would I be able to adapt the “my_enable_shortcodes_in_cf” function mentioned above for this purpose?
Thanks,
MarkSeptember 29, 2016 at 6:30 pm #275468hi,
this is to enable a text field (or textarea) to parse a shortcode.
If now you enter a shortcode example: [gallery xyz] in a custom field it will display it in the front end as text: [gallery xyz] instead of showing what the shortcode is supposed to output.
What you need to do is not achievable through this method. If you need a shortcode that takes the logo custom field of all listings, to show it as a list on a custom page, that would require everything to be developed from scratch.
Thanks
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket