add_action('manage_users_columns','yoursite_manage_users_columns'); function yoursite_manage_users_columns($column_headers) { unset($column_headers['posts']); $column_headers['custom_posts'] = 'Assets'; return $column_headers; } add_action('manage_users_custom_column','yoursite_manage_users_custom_column',10,3); function yoursite_manage_users_custom_column($custom_column,$column_name,$user_id) {…
Logged In and Logged Out Shortcodes
Just encapsulate the content you want to show only to logged in users or or only to logged out users like this:
[loggedin]Visible for logged in users only[/loggedin]
[loggedout]Visible for guests only[/loggedout]
The Code for the two shortcodes
//logged in shortcode
function check_user ($params, $content = null){
//check tha the user is logged in
if ( is_user_logged_in() ){
//user is logged in so show the content
return $content;
}
else{
//user is not logged in so hide the content
return;
}
}
add_shortcode('loggedin', 'check_user' );
//logged out shortcode
function check_user_out ($params, $content = null){
//check tha the user is logged in
if ( !is_user_logged_in() ){
//user is logged in so show the content
return $content;
}
else{
//user is not logged in so hide the content
return;
}
}
add_shortcode('loggedout', 'check_user_out' );
Dieser Beitrag hat 0 Kommentare