Community Forums › Forums › Design Tips and Tricks › Education theme – hide tags and categories from visitors
Tagged: hide categories, hide tags
This topic contains 5 replies, has 2 voices, and was last updated by studiopress@tibesar.com 5 months ago.
-
AuthorPosts
-
January 16, 2013 at 8:26 pm #12527
I 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 #12662Hi 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 tweet @cdils.
January 17, 2013 at 2:03 pm #12708This reply has been marked as private.
January 17, 2013 at 2:10 pm #12711Once 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 tweet @cdils.
January 17, 2013 at 2:12 pm #12713This reply has been marked as private.
January 17, 2013 at 8:11 pm #12778Good 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.