-
Author
-
July 1, 2018 at 07:12 #202563stefanlimParticipant
Hi there!
I would like to check if there’s a way to display post title, author and date in a post, as text (or part of the article). Is there a shortcode on this or something?
Thanks!
July 1, 2018 at 16:40 #202575Kieran_SQModeratorHi,
I couldn’t find anything immediately through a search so I wrote this custom code for you that I will release later in a plugin. For now you can copy this code (from the ticket and not the email) and add it to your functions.php file
COPY CODEfunction piqt_replace_tags($text) { // Get post information $pi_title = get_the_title(); $pi_author = get_the_author(); $pi_date = get_the_date(); // Text to replace with post information $text = str_replace('{the_title}', $pi_title, $text); $text = str_replace('{the_author}', $pi_author, $text); $text = str_replace('{the_date}', $pi_date, $text); return $text; } // Enable within the content add_filter('the_content', 'piqt_replace_tags'); // Enable within the menu add_filter('walker_nav_menu_start_el', 'piqt_replace_tags');
You can use the following tags in your content or menus to generate the post title, author and date.
COPY CODE{the_title} {the_author} {the_date}
Thanks,
Kieran.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionIf you like the theme or the support you've received please consider leaving us a review on Themeforest!
Custom development requests can be sent to dev@seventhqueen.com, one of the development team will be happy to discuss your needs.
July 1, 2018 at 18:05 #202577stefanlimParticipantThanks a ton Kieran! This works perfectly. Appreciate it!
July 1, 2018 at 18:08 #202578Kieran_SQModeratorHi,
No worries, happy to help 🙂 I’ll mark this ticket as resolved for now. If you need help with anything else please feel free to open a new ticket any time.
If you have a spare moment please consider leaving the support you have received / KLEO a review on ThemeForest. Every review really does help me.
All the best,
Kieran
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionIf you like the theme or the support you've received please consider leaving us a review on Themeforest!
Custom development requests can be sent to dev@seventhqueen.com, one of the development team will be happy to discuss your needs.
-
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.