Community Forums › Forums › Archived Forums › Design Tips and Tricks › Education theme – hide tags and categories from visitors
Tagged: hide categories, hide tags
- This topic has 5 replies, 2 voices, and was last updated 12 years, 10 months ago by
Marc Tibesar.
-
AuthorPosts
-
January 16, 2013 at 8:26 pm #12527
Marc Tibesar
MemberI want to hide all tags and categories in my Posts and Excerpts from site visitors:
If logged in: display tags and categories
If logged out : do NOT display tags and categories in the Posts and ExcerptsI tried this code in the functions.php but it did not work:
if ( is_user_logged_in() ) {
$post_meta = '[post_categories] // [post_tags]';
} else {
$post_meta = 'logged out';
}
return $post_meta;I am not a php developer so I would appreciate any comments or suggestions. Thank you so much!
Theme: Education
Site: tibesar.comJanuary 17, 2013 at 12:17 pm #12662cdils
ParticipantHi there,
You'll need to use the genesis_post_meta filter. Try something like this in your functions.php. You'll notice it's basically your same code above, but it needs to be wrapped in a function and read in via a filter.
/** Customize the post meta function */
add_filter('genesis_post_meta','post_meta_filter');
functionpost_meta_filter($post_meta) {
if( is_user_logged_in() ) {
$post_meta='[post_categories] // [post_tags]';
return$post_meta;
}}
Carrie
Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. 🙂
I host a weekly WordPress-focused podcast called Office Hours. I tweet @cdils.
January 17, 2013 at 2:03 pm #12708Marc Tibesar
MemberThis reply has been marked as private.January 17, 2013 at 2:10 pm #12711cdils
ParticipantOnce you throw an error in functions.php, it's impossible to edit any further in the WP dashboard. You'll need to access the file via FTP and remove the code that way. That should reset you.
Before adding in this code, make sure you remove your previous code so it doesn't throw another error. 🙂
Not directly related, but still helpful... You might like this article (http://surefirewebservices.com/wordpress/how-to-use-remove_action-with-conditional-tags). It explains the why of using functions.
Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. 🙂
I host a weekly WordPress-focused podcast called Office Hours. I tweet @cdils.
January 17, 2013 at 2:12 pm #12713Marc Tibesar
MemberThis reply has been marked as private.January 17, 2013 at 8:11 pm #12778Marc Tibesar
MemberGood evening Carrie,
The code you provided works great.
This code should be added to the Genesis snippets library.
Hiding tags is a significant security enhancement to private Genesis websites.
Accordingly, you have enhanced the security of our archives and, we appreciate your contribution and sharing.
Cheers!
Marcus Tibesar
The Tibesar Archives
-
AuthorPosts
- The topic ‘Education theme – hide tags and categories from visitors’ is closed to new replies.