Skip to content

Instantly share code, notes, and snippets.

@miya0001
Created September 17, 2011 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miya0001/1223958 to your computer and use it in GitHub Desktop.
Save miya0001/1223958 to your computer and use it in GitHub Desktop.
WordPressで記事の一部に認証をかける
<?php
function login_read_more($atts, $content = null) {
if (is_user_logged_in() && !is_null( $content ) && !is_feed()) {
return $content;
} else {
return '続きを読むにはログインしてね';
}
}
add_shortcode('auth', 'login_read_more');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment