Remove hyperlink from entry meta date on blog posts
-
Hi there,
I’m new to the WordPress forums, but I’ve been lurking for ages and got lots of help just reading other peoples’ posts.
These days I’m learning more in-depth stuff and getting stuck more often so I decided to join up. Hopefull I can help and be helped π
So…I’m customising Twenty Thirteen using a child theme.
I’ve already removed the category link from below the blog posts. Now I’d like keep the date but remove the hyperlink from it.
I know HTML/CSS pretty well but not so strong on PHP/JS.
Thanks for any help!:)
-
Hi CaroBee!
Go to your functions.php and around line 367 you’ll see the post date code that starts with <span class=”date” βremove the opening and closing tag surrounding the <time> tag. That will leave the date but remove the hyperlink from it π
Hello CD,
Thanks for helping out π
Just to confirm.. I’ll remove the a href tag as bolded out below?
title=”%2$s” rel=”bookmark”><time class=”entry-date” datetime=”%3$s”>%4$s</time>
I mean to say this is how it should look when I remove the tags?
<title=”%2$s” rel=”bookmark”><time class=”entry-date” datetime=”%3$s”>%4$s</time>
It’s my pleasure π
And yeah, you’ll just delete the
<a href="%1$s" title="%2$s" rel="bookmark">as well as the closing</a>Line 367 should then look like this:
$date = sprintf( '<span class="date"><time class="entry-date" datetime="%3$s">%4$s</time></span>',
Let me know if you have any problems!Hey CD,
I think I need to make a functions.php for my child theme first. How would I go about cutting and pasting the right function into it?
Nice catchβI forgot you mentioned that you were using a child theme π
Just copy everything from the beginning ‘if’ on line 350 to the ending ‘endif;’ on line 379 into your new functions.php (which should be in the same directory as your child theme’s style.css) Here is the codex article on child theming which goes over best practices: https://codex.ww.wp.xz.cn/Child_Themes
Brilliant – it worked perfectly!
Thanks for all your help CD π Couldn’t have done it without you!
CaroBee,
Fantastic! I’m happy I could help! That’s what the WordPress community is for π
Deep joy – I’ve been struggling with that for days π Thanks a lot CD, hope you have a great day! π
You too, CaroBee! And be sure to mark this topic as ‘Resolved’ for anyone else having a similar issue searching the forums π
Cheers!
The topic ‘Remove hyperlink from entry meta date on blog posts’ is closed to new replies.