I have recently bought a theme, where I want to modify some things. The theme makes use of shortcodes. One of these shortcodes is adding the most recent posts. In these most recent posts is the date not included.

I want to add the date, but I found out that these shortcodes are in shortcodes.php, written in some kind of HTML DOM parser??? I tried to add some code, I found out how to make a div and span, but when I add the_time() in the code,it will show up outside of this div and span. I don't know how to fix it.

$html .= '<div class="infop"><span class="time">


1 Answer 1


This is because shortcodes filter the content passed to the and replace based on the shortcode tag. In your case I recommend using get_the_time instead since it provides the same functionality but returns the value instead of echoing it. For more info on date formatting and args for this tag check out get_the_time

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.