Skip to content

Instantly share code, notes, and snippets.

<?php if ( is_user_logged_in() ) { ?>
<?php $user_info = get_userdata(get_current_user_id());
global $current_user;
get_currentuserinfo();
echo get_avatar( $current_user->ID, 200 );
echo '<br />';
echo '<br />';
echo 'Welcome, ' . $user_info->user_login . "!" . "\n";
echo '<br />';
echo '<br />';
/**
* Allow access to own content only
*/
function my_authored_content($query) {
//get current user info to see if they are allowed to access ANY posts and pages
$current_user = wp_get_current_user();
// set current user to $is_user
$is_user = $current_user->user_login;
function RemoveAddMediaButtonsForNonAdmins(){
if ( !current_user_can( 'manage_options' ) ) {
remove_action( 'media_buttons', 'media_buttons' );
}
}
add_action('admin_head', 'RemoveAddMediaButtonsForNonAdmins');
function hwl_home_pagesize( $query ) {
if ( is_admin() || ! $query->is_main_query() )
return;
if ( is_home() ) {
// Display only 3 posts
$query->set( 'posts_per_page', 3 );
return;
}
}
@jfcode
jfcode / Home & Category Number
Created May 20, 2014 04:22
Control number of posts on home page and category
function hwl_home_pagesize( $query ) {
if ( is_admin() || ! $query->is_main_query() )
return;
if ( is_home() ) {
// Display only 3 posts
$query->set( 'posts_per_page', 3 );
return;
}
function hwl_home_pagesize( $query ) {
if ( is_admin() || ! $query->is_main_query() )
return;
if ( is_home() ) {
// Display only 3 posts
$query->set( 'posts_per_page', 3 );
return;
}
[aa-author-bio authors='12']