Some Subdomains on a Multisite Install Not Found
Some Subdomains on a Multisite Install Not Found
Some Subdomains on a Multisite Install Not Found
Thanks brasofilo! add_action( ‘pre_get_posts’, ‘hide_pages_to_user_except_admins’ ); function hide_pages_to_user_except_admins( $query ) { if( !is_admin() ) return $query; global $pagenow; $pages = array(‘201′,’38’,’99’); //page ids if( ‘edit.php’ == $pagenow && ( get_query_var(‘post_type’) && ‘page’ == get_query_var(‘post_type’) ) ) $query->set( ‘post__not_in’, $pages ); return $query; }
if(is_user_logged_in()) { /…/ } else { // your message or // redirect to registration form }
funtion add_profile_page(){ $title_of_page = “page name”; if( null == get_page_by_title( $title_of_page ) ) { $post_id = wp_insert_post( array( ‘comment_status’ => ‘closed’, ‘ping_status’ => ‘closed’, ‘post_author’ => ‘1’, ‘post_name’ => ‘namehere’, ‘post_title’ => $title_of_page, ‘post_status’ => ‘publish’, ‘post_type’ => ‘page’ ) ); update_post_meta($post_id, ‘_wp_page_template’, ‘mycustomprofile’); } } add_filter( ‘after_setup_theme’, ‘add_profile_page’ ); your template page /* Template … Read more
No plugin or PHP code is needed to do this. If you look at your HTML body class, you will see that WP helpfully adds the class of “logged-in” for any users who are registered and logged into the site. With this info along with the class name you give for the particular menu link … Read more
you can store user data in user meta fields which you can get and display to the user. use update_user_meta(); function to store user data and use get_user_meta(); to retrieve stored user data. // you need to get user id and replace meta_key with yours $user_data=”some user lists data”; update_user_meta($user_id, ‘meta_key’, $user_data); // now get … Read more
Allowing access to certain WordPress created pages or posts with htaccess / htpasswd
I think your idea is good: create a function that hook ‘show_user_profile’ and ‘edit_user_profile’ action. In this function use a conditional to show a textarea only for admins and the content of this textarea (saved as user meta) to the owner of the profile. Something like (very rough and untested): function custom_profile_content ( $user ) … Read more
Plugin (smart archives reloaded) crashed site / no access on admin panel
If you setting the posts to private in WordPress, you can add this to your functions.php file: function include_private_in_search( $query ) { // not an admin page and is the main query if (!is_admin() && $query->is_main_query()){ $query->set( ‘post_status’, array ( ‘publish’, ‘private’ ) ); } } add_action( ‘pre_get_posts’, ‘include_private_in_search’ ); Then you can format the … Read more