I am trying to:
Hi,
I’ve got the following toolset shortcode that outputs a date from a custom field added to a specific post when I use the Elementor shortcode module on a page:
[types field='this-week-start-date' style='text' format='F j, Y' post_id='1345'][/types]
I can’t edit the style of this though in the shortcode editor window or even by adding custom css (unless I’m making a basic mistake) and I don’t want a separate module to display this info, I want to insert it into existing title and text fields along with text so the shortcode results become part of the text.
So for example a title field on a page needs to show WEEK BEGINNING 18th February 2019 and I want to manually type WEEK BEGINNING then add [types field='this-week-start-date' style='text' format='F j, Y' post_id='1345'][/types] so the result would be WEEK BEGINNING 18th February 2019 whereby the shortcode puts the date in and it will be styled in the style of the title module.
Why do I want to do this? I don’t want editors to have access to edit Elementor pages so I’ve created a CPT that will only have one post. The fields of this post show 2 telephone numbers, an email address, a twitter name and two week beginning dates for a schedule page. This ‘sitewide’ info will be placed onto various pages so that when dates and phone numbers change, editors can edit the single post and the revised info will then show throughout the site on various pages by virtue of the shortcodes.
So is there a way to manually enter WEEK BEGINNING [types field='this-week-start-date' style='text' format='F j, Y' post_id='1345'][/types] but the result show as e.g. WEEK BEGINNING 18th February 2019. So far when I try this, the shortcode is displayed, and not the date.
Many thanks,
Barry.
Link to a page where the issue can be seen:
lien caché
I expected to see: in the SCHEDULE section of the page linked to above there are blue 'week beginning' titles. Underneath that, grey dates which are the shortcodes. Instead I want the shortcodes to be placed in the blue title fields so the date shows next to 'week beginning'.
Instead, I got:
I am not sure to understand, however adding ShortCodes to the Post Title is not possible, in WordPress.
Post Titles have to be "strings" so later you can display that with a Shortcode ( [wpv-post-title]) but you cannot add a shortcode to the title.
Now, if you want to add ShortCodes to Elementor's templates you will just be able to insert them anywhere you like and Elementor offers them.
But I am not sure where you added it to control if that's done correctly.
Can you link me to the Post or Page where the issue happens and where you edit it?
Then I can see what is wrong with it.
I might need to make edits, please either confirm that I am allowed to make edits on the live site or provide access to a staging server.
Thanks!
Hi Beda,
Thank you for explaining this. I understand now about the title and string. I can see that my shortcode does work in a text editor module (which I can style to look like a title anyway....) so thanks to your explanation, all is working fine now.
Many thanks,
Barry.
Great, hence we can close here.
Thanks!