Last active
May 10, 2020 06:50
-
-
Save Oscar-Abad-Folgueira/066ef4383f1db8b92d184e8eafbc850e to your computer and use it in GitHub Desktop.
WordPress Snippet: Restringir parte del contenido 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @snippet WordPress Snippet: Restringir parte del contenido 2 | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/crear-shortcode-restringir-partes-del-contenido-parte-2/ | |
*/ | |
function oaf_restrict_partial_content_shortcode( $atts, $content = null ) { | |
if ( is_user_logged_in() && !is_null( $content ) && !is_feed() ) { | |
return $content; | |
} else { | |
return __( 'Upps! Este contenido sólo está disponible para usuarios registrados.', 'oaf_rpcs' ); | |
} | |
} | |
add_shortcode ('restrict_pcs', 'oaf_restrict_partial_content_shortcode' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment