Home>Support>Hero widget doesn’t accept Shortcode ultimate

Hero widget doesn’t accept Shortcode ultimate

i am facing a compatibility problem with using shortcodes into the frame of Hero Widget.
I found a way to resolve by adding

$frame['content'] = apply_filters( 'widget_text', $frame['content'] );

line 237 of hero.php

This is not the best way, maybe building new widget extending yours is possible, but i think this is maybe something you might do for next release, to make it ( and maybe your others widgets ) compatible out of the box with shortcodes.

And thank you for your work :)

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 8 years, 6 months ago Alex S
    Hi, I Work Here

    Hi Pedro,

    I’m not actually able to replicate this issue with any shortcode ultimate shortcodes. Could you please be slightly more specific in what doesn’t work so I can try and replicate it?

    • 8 years, 6 months ago Pedro Ribeiro

      i am including a Hero Widget in a page using PageBuilder, in that hero widget i create a frame where i use a “Shortcode Ultimate” shortcode ( a list but this is the same with other shortcodes).
      Without the modification, the shortcode is not converted.
      I wasn’t able to found a way to make it work so i tried your others widgets and find that the editor was working and so checked why and seen that you used to apply

      $instance['text'] = apply_filters( 'widget_text', $instance['text'] );

      in editor.php

      • 8 years, 6 months ago Alex S
        Hi, I Work Here

        Hi Pedro,

        I’m still unable to replicate this as I set up the hero widget exactly the same it works as expected. Can you try disabling all non-SiteOrigin plugins and see if this fixes the issue? You’ll need to clear all your caches after disabling your plugins.

        If it does fix the issue, then try re-enabling your plugins one by one until the issue comes back. This procedure will help diagnose which plugin is causing the issue.

        Once we know that, we’ll be able to look at what might be causing the conflict and either solve the problem or help you find an alternative plugin.

        If you aren’t using a SiteOrigin theme, then you can also try temporarily switching to one of the default WordPress themes to see if the issue is theme related.

        • 8 years, 6 months ago Pedro Ribeiro

          tested to switch to another theme and you pointed the prob, my actual theme is Moesia from Athemes
          http://athemes.com/theme/moesia/
          i will keep checking if i found more information about why this theme make shortcodes stop working

          • 8 years, 6 months ago Alex S
            Hi, I Work Here

            Hi Pedro,

            Thank you for telling me the theme name. We’ll look into this too and see if it’s something on our end. In the meantime, is there anything else I can help you with?

  2. 8 years, 6 months ago Pedro Ribeiro

    This is ok Alex, i will keep the stuff working with the little hack of mine, will keep tracking a better solution ( will post here if i found a solution ) or wait for your solution ;)

    Thank you again for your kindness.

  3. 8 years, 6 months ago Pedro Ribeiro

    Hi Alex,
    got more info about the problem i am facing, the origin is a plugin of the theme i am using, this is Moesia latest news.
    When i remove it from the content the shortcodes are displayed correctly.
    here is the code

    <?php
    
    
    
    class Moesia_Latest_News extends WP_Widget {
    
    
    
    // constructor
    
        function moesia_latest_news() {
    
    		$widget_ops = array('classname' => 'moesia_latest_news_widget', 'description' => __( 'Show the latest news from your blog.', 'moesia') );
    
            parent::__construct(false, $name = __('Moesia FP: Latest News', 'moesia'), $widget_ops);
    
    		$this->alt_option_name = 'moesia_latest_news_widget';
    
        }
    
    	
    
    	// widget form creation
    
    	function form($instance) {
    
    
    
    	// Check values
    
    		$title     		= isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
    
    		$category  		= isset( $instance['category'] ) ? esc_attr( $instance['category'] ) : '';
    
    		$number    		= isset( $instance['number'] ) ? intval( $instance['number'] ) : 3;		
    
    		$see_all_text  	= isset( $instance['see_all_text'] ) ? esc_html( $instance['see_all_text'] ) : '';											
    
    		$image_uri 		= isset( $instance['image_uri'] ) ? esc_url_raw( $instance['image_uri'] ) : '';		
    
    	?>
    
    
    
    	
    
    	<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'moesia'); ?></label>
    
    	<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
    
    	
    
    
    
    
    
    	<label for="<?php echo $this->get_field_id( 'category' ); ?>"><?php _e( 'Enter the slug for your category or leave empty to show posts from all categories.', 'moesia' ); ?></label>
    
    	<input class="widefat" id="<?php echo $this->get_field_id( 'category' ); ?>" name="<?php echo $this->get_field_name( 'category' ); ?>" type="text" value="<?php echo $category; ?>" size="3" />
    
    	
    
    
    
        <label for="<?php echo $this->get_field_id('see_all_text'); ?>"><?php _e('Add the text for the button here if you want to change the default <em>See all our news</em>', 'moesia'); ?></label>
    
    	<input class="widefat custom_media_url" id="<?php echo $this->get_field_id( 'see_all_text' ); ?>" name="<?php echo $this->get_field_name( 'see_all_text' ); ?>" type="text" value="<?php echo $see_all_text; ?>" size="3" />
    
    		
    
    
    
    	<label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:', 'moesia' ); ?></label>
    
    	<input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" />
    
    
    
       
    
        <?php
    
            if ( $image_uri != '' ) :
    
               echo '<img class="custom_media_image" src="' . $image_uri . '" style="max-width:100px;" />
    
    ';
    
            endif;
    
        ?>
    
        <label for="<?php echo $this->get_field_id('image_uri'); ?>"><?php _e('[DEPRECATED - Go to Edit Row > Theme > Background image] Upload an image for the background if you want. It will get a parallax effect.', 'moesia'); ?></label>
    
     
    
        <input type="button" class="button button-primary custom_media_button" id="custom_media_button" name="<?php echo $this->get_field_name('image_uri'); ?>" value="Upload Image" style="margin-top:5px;" />
    
    
    
    	<input class="widefat custom_media_url" id="<?php echo $this->get_field_id( 'image_uri' ); ?>" name="<?php echo $this->get_field_name( 'image_uri' ); ?>" type="text" value="<?php echo $image_uri; ?>" size="3" />
    
    	
    
    	
    
    	<?php
    
    	}
    
    
    
    	// update widget
    
    	function update($new_instance, $old_instance) {
    
    		$instance = $old_instance;
    
    		$instance['title'] 			= strip_tags($new_instance['title']);
    
    		$instance['category'] 		= strip_tags($new_instance['category']);
    
    		$instance['number'] 		= strip_tags($new_instance['number']);		
    
    		$instance['see_all_text'] 	= strip_tags($new_instance['see_all_text']);						
    
    	    $instance['image_uri'] 		= esc_url_raw( $new_instance['image_uri'] );			
    
    
    
    		$alloptions = wp_cache_get( 'alloptions', 'options' );
    
    		if ( isset($alloptions['moesia_latest_news']) )
    
    			delete_option('moesia_latest_news');		  
    
    		  
    
    		return $instance;
    
    	}
    
    
    
    	// display widget
    
    	function widget($args, $instance) {
    
    		$cache = array();
    
    		if ( ! $this->is_preview() ) {
    
    			$cache = wp_cache_get( 'moesia_latest_news', 'widget' );
    
    		}
    
    
    
    		if ( ! is_array( $cache ) ) {
    
    			$cache = array();
    
    		}
    
    
    
    		if ( ! isset( $args['widget_id'] ) ) {
    
    			$args['widget_id'] = $this->id;
    
    		}
    
    
    
    		if ( isset( $cache[ $args['widget_id'] ] ) ) {
    
    			echo $cache[ $args['widget_id'] ];
    
    			return;
    
    		}
    
    
    
    		ob_start();
    
    		extract($args);
    
    
    
    		$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Latest news', 'moesia' );
    
    
    
    		/** This filter is documented in wp-includes/default-widgets.php */
    
    		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
    
    		$category = isset( $instance['category'] ) ? esc_attr($instance['category']) : '';
    
    		$see_all_text = isset( $instance['see_all_text'] ) ? esc_html($instance['see_all_text']) : __( 'See all our news', 'moesia' );
    
    		$number = ( ! empty( $instance['number'] ) ) ? intval( $instance['number'] ) : 3;
    
    		if ( ! $number )
    
    			$number = 3;		
    
    		$image_uri = isset( $instance['image_uri'] ) ? esc_url($instance['image_uri']) : '';		
    
    
    
    		/**
    
    		 * Filter the arguments for the Recent Posts widget.
    
    		 *
    
    		 * @since 3.4.0
    
    		 *
    
    		 * @see WP_Query::get_posts()
    
    		 *
    
    		 * @param array $args An array of arguments used to retrieve the recent posts.
    
    		 */
    
    		$r = new WP_Query( apply_filters( 'widget_posts_args', array(
    
    			'no_found_rows'       => true,
    
    			'post_status'         => 'publish',
    
    			'posts_per_page'	  => $number,
    
    			'category_name'		  => $category
    
    		) ) );
    
    
    
    		if ($r->have_posts()) :
    
    ?>
    
    		<section id="latest-news" class="latest-news-area">
    
    			<div class="container">
    
    				<?php if ( $title ) echo $before_title . '<span class="wow bounce">' . $title . '</span>' . $after_title; ?>
    
    				<div class="clearfix">
    
    					<?php while ( $r->have_posts() ) : $r->the_post(); ?>
    
    						<div class="blog-post col-md-4 col-sm-6 col-xs-6">
    
    							<?php if ( has_post_thumbnail() ) : ?>
    
    								<div class="entry-thumb wow fadeInDown">
    
    									<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" >
    
    										<?php the_post_thumbnail('moesia-news-thumb'); ?>
    
    									</a>			
    
    								</div>	
    
    							<?php endif; ?>						
    
    							<?php the_title( sprintf( '<h4 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h4>' ); ?>
    
    							<div class="entry-summary wow fadeInUp"><?php the_excerpt(); ?></div>
    
    						</div>
    
    					<?php endwhile; ?>
    
    				</div>
    
    				<?php $cat = get_term_by('slug', $category, 'category') ?>
    
    				<?php if ($category) : //Link to the category page instead of blog page if a category is selected ?>
    
    				<a href="<?php echo esc_url(get_category_link(get_cat_ID($cat -> name))); ?>" class="all-news">
    
    				<?php else : ?>
    
    				<a href="<?php echo get_permalink( get_option( 'page_for_posts' ) ); ?>" class="all-news">
    
    				<?php endif; ?>
    
    					<?php if (!$see_all_text) : ?>
    
    						<?php echo __( 'See all our news', 'moesia' ); ?>					
    
    					<?php else : ?>
    
    						<?php echo $see_all_text; ?>
    
    					<?php endif; ?>
    
    				</a>
    
    			</div>
    
    		<?php if ($image_uri != '') : ?>
    
    			<style type="text/css">
    
    				.latest-news-area {
    
    				    display: block;			    
    
    					background: url(<?php echo $image_uri; ?>) no-repeat;
    
    					background-position: center top;
    
    					background-attachment: fixed;
    
    					background-size: cover;
    
    					z-index: -1;
    
    				}
    
    			</style>
    
    		<?php endif; ?>				
    
    		</section>		
    
    	<?php
    
    		// Reset the global $the_post as this query will have stomped on it
    
    		wp_reset_postdata();
    
    
    
    		endif;
    
    
    
    		if ( ! $this->is_preview() ) {
    
    			$cache[ $args['widget_id'] ] = ob_get_flush();
    
    			wp_cache_set( 'moesia_latest_news', $cache, 'widget' );
    
    		} else {
    
    			ob_end_flush();
    
    		}
    
    	}
    
    	
    
    }
  4. 8 years, 6 months ago Pedro Ribeiro

    after some tests i can say that the prob comes from the_excerpt() function.

    • 8 years, 6 months ago Alex S
      Hi, I Work Here

      Hi Pedro,

      Thank you for the issue report. We recently found out about this issue and we’re looking into solutions.

      • 8 years, 6 months ago Pedro Ribeiro

        Ok Alex,
        Happy to help make it better ( and make it working for my use ;) )

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More