This topic is: not resolved
- This topic has 22 replies, 4 voices, and was last updated 8 years, 10 months ago by .
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.
These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.
Community Forums › Forums › Archived Forums › Design Tips and Tricks › Restrict access to page template for certain types of users
ok, how is this to get you started, it will only show content to logged in users, if not logged in will show a notice.
i don't know the conditionals for users of a specific type, but this should get you on the right track.
add_action( 'genesis_meta', 'custom_page_genesis_meta' );
function custom_page_genesis_meta() {
if ( is_user_logged_in() ) {
return;
} else {
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
add_action( 'genesis_entry_content', 'show_awesome_notice' );
}
}
function show_awesome_notice() {
echo 'Sorry but this page is restricted to logged in users only. ';
}
Jamie,
That worked like a charm - just the thing I needed.
Thanks!
awesome !
© 2024 WPEngine, Inc.