Home>Support>version 2.29.15 to 2.29.16: different output and args won’t work

version 2.29.15 to 2.29.16: different output and args won’t work

By Rico, 2 months ago. Last reply by Rico, 2 months ago.

Hi Team,

i have a widget like in https://siteorigin.com/docs/widgets-bundle/getting-started/creating-a-widget/

In your plugin version 2.29.16 i have two problems:

1. the siteorigin_widget_post_selector_process_query like in https://siteorigin.com/docs/widgets-bundle/form-building/post-selector/ handels my args wrong:

With

$processed_query = siteorigin_widget_post_selector_process_query( $query, true );
parse_str($loop_query, $output);

the $output becomes [amp;posts_per_page] => 6 insteadt of [posts_per_page] => 6 for example. In 2.29.15 it’s correct.

2. The do_shortcode function can’t handle the code like

echo do_shortcode('[siteorigin_widget class="my_Hero_SOWidget"] <input type="hidden" value="' . $args . '" /> [/siteorigin_widget]');

and it returns nothing.
In 2.29.15 i get the correct content.

I know this is hard to say, but if you have an idea where I can start looking for a solution I would be grateful.

Best wishes
Rico

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

  1. 2 months, 4 days ago Alex S
    Hi, I Work Here

    Hi Rico,

    Thanks for reaching out.

    1. Can you please provide me with an example of what your query looks like? I’ve run a few tests and I can’t seem to replicate the described issue.

    2. Unfortunately, the siteorigin_widget shortcode no longer supports HTML due to potential security concerns. I recommend creating a custom shortcode or directly rendering the widget using the_widget.

    Kind regards,
    Alex

  2. 2 months, 3 days ago Rico

    Hi Alex,

    thank you.

    1.: i have an example today with the following code in my page

    			$args = [
    				'instance' => [
    					'loop_headline' => __('News', 'mysite') ,
    					'loop_query' => 'post_type=post&posts_per_page=3&ignore_sticky_posts=1&meta_key=ref_post_id&meta_value=' . $post->ID,
    					'args' => [
    						'widget_id' => 'post-' . $post->ID,
    					],
    				]
    			];
    			echo do_shortcode('[siteorigin_widget class="Efna_Loop_SOWidget"] <input type="hidden" value="' . esc_attr(json_encode($args)) . '" /> [/siteorigin_widget]');
    			

    and in my widget tpl/

    $processed_query = siteorigin_widget_post_selector_process_query( $loop_query );

    In 2.29.16 now i have to set

    $processed_query = siteorigin_widget_post_selector_process_query( $loop_query );
    $loop_query = is_array($loop_query) ? array_map('htmlspecialchars_decode', $loop_query) : htmlspecialchars_decode($loop_query);

    2.: good to know.

    In my $args i have now comment out the parameters with html content like

    $args = [
    			'instance' => [
    				'loop_headline' => __('News', 'mysite') ,
    					'loop_query' => 'post_type=post&posts_per_page=3&ignore_sticky_posts=1&meta_key=ref_post_id&meta_value=' . $post->ID,
    					'args' => [
    						// 'before_widget' => '<div id="panel-' . $post->ID. '" class="so-panel widget widget_efna-loop-sowidget mb-4" data-index="" data-style="" >',
    						// 'after_widget' => '</div>',
    						// 'before_title' => '<h2 class="widget-title">',
    						// 'after_title' => '</h2>',
    						'widget_id' => 'post-' . $post->ID,
    				],
    			]
    		];

    What is the best solution if i need indidividuell html tag there?

  3. 2 months, 3 days ago Rico

    Wrong code block: the third code is

    $loop_query = is_array($loop_query) ? array_map('htmlspecialchars_decode', $loop_query) : htmlspecialchars_decode($loop_query);
    $processed_query = siteorigin_widget_post_selector_process_query( $loop_query );
Please log in to post on our forums. Signing up is free.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More