Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //* Shorcode para aplicar estilo a la caja de post invitado
- add_filter( 'the_content', 'shortcode_unautop', 100 );
- add_shortcode( 'guest_post_box', 'guest_posts_shortcode');
- function guest_posts_shortcode( $atts, $content = null ){
- $output = '';
- if ( !is_home() ) {
- $output = '<div class="guest-posts-box">';
- $output .= do_shortcode( $content );
- $output .= '</div>';
- }
- return $output;
- }
- // Elimina las etiquetas de párrafo vacías de inicio y fin de los shortcodes
- add_filter( 'the_content', 'shortcode_empty_paragraph_fix' );
- function shortcode_empty_paragraph_fix( $content ) {
- // define your shortcodes to filter, '' filters all shortcodes
- $shortcodes = array('guest_post_box' );
- foreach ( $shortcodes as $shortcode ) {
- $array = array (
- '<p>[' . $shortcode => '[' .$shortcode,
- '<p>[/' . $shortcode => '[/' .$shortcode,
- $shortcode . ']</p>' => $shortcode . ']',
- $shortcode . ']<br />' => $shortcode . ']'
- );
- $content = strtr( $content, $array );
- }
- return $content;
- }
Add Comment
Please, Sign In to add comment