edit function.php
function guest_check_shortcode( $atts, $content = null ) { if ( ( !is_user_logged_in() && !is_null( $content ) ) || is_feed() ) return $content; return ''; } add_shortcode( 'guest', 'guest_check_shortcode' ); function member_check_shortcode( $atts, $content = null ) { if ( is_user_logged_in() && !is_null( $content ) && !is_feed() ) return $content; return ''; } add_shortcode( 'member', 'member_check_shortcode' );
Usage:
Curabitur risus turpis, tincidunt nec porta non; tempor vitae erat. [guest]This content is only visible to members, subscribe here to get access to all our awesome tips or log in here if you are already a member[/guest] [member]Your awesome tip and member-only content comes here[/member] Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In hac habitasse platea dictumst.
Geef een reactie