John H
asked on
Wordpress - Adding an if/else Conditional Argument in a Post Template
Hi All,
I have a Wordpress site that relies on posts having tags - its important to the categorization of the site.
I'd like to drop in a conditional argument in single.php such that if the post has no tags, that it echoes some content on the post (essentially, asking site visitors to suggest some tags in the comments section that i can later update the post with).
This code is not correct, but I hope it captures the essence of what I'm trying to do
Thanks in advance!!
I have a Wordpress site that relies on posts having tags - its important to the categorization of the site.
I'd like to drop in a conditional argument in single.php such that if the post has no tags, that it echoes some content on the post (essentially, asking site visitors to suggest some tags in the comments section that i can later update the post with).
This code is not correct, but I hope it captures the essence of what I'm trying to do
<?php if ( has_tag('none/null' ) { echo 'This page has no tags; please add tags in the comments section' ; } else { echo '' ; } ; ?>
Thanks in advance!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Quick question Dmitri - I'm editing the core files of the parent theme. Should I have used a function in the childtheme instead? Thx.
Yes, surely.
Otherwise you will lost all your changes after upgrade of your parent theme.
(And upgrades are vital as they may deal with security.)
Otherwise you will lost all your changes after upgrade of your parent theme.
(And upgrades are vital as they may deal with security.)
ASKER