Archived topic
Shortcode show updated date in Pages
6 replies · Started by Eduard on March 1, 2020
Hello,
I've created a hook (after_entry_header) to display some info below the title of a page with:
<p><em><a href="#author-id">Irene Gil Ortiz</a> • Actualizado:[modified_date] • <a class="cat-button" href=/#>CATEGORIA</a></em></p>
I've used the [modified_date] prior inserting in my child functions.php theme the code as it is said in this documentation.
The problem is that this shortcode seems not to be working in the Hook (despite I am activating the execute PHP option).
It is currently showing like this in the rendered page Image example.
ps. note that I want everything to display in plain text, that's why I opted for this shortcode solution in order to avoid links to the "author" or the "date".
Any clues on how to proceed?
Thank you so much in advance!
Any help? =)
Hi there,
I'm guessing that the get_the_modified_date() function only works in posts and not pages.
Can you test if the shortcode work in posts?
Let me know :)
Hi Leo,
it definetly works in posts. But I guess that it does in pages too (I have another website with a custome header for pages and it is working there).
I think the problem comes from using a hook and not a custom header maybe?
Is there any "easy" fix for that? I'd rather introduce the modified date by hand if not.
Thank you.
Just to make sure, you've checked Execute Shortcodes (NOT execute PHP)? option in the hook element?
:facepalm: ups. The newbie mistake.. damn it!
Thank you so much Leo for the insight, feeling kinda stupid now ^^'.
No problem :)