Home>Support>Accordion Widget as shortcode

Accordion Widget as shortcode

I am trying to include the accordion widget in a page with a php template.
The site basically includes all widgets over the pageBuilder interface, but in one spot, I’d like to use the accordion in a php template.

For that I created the widget code in the page builder on a sample page, switched to the html editor, copied the code and inserted in in the php template surrounded by the do_shortcode() php command.
The output gives no php error, but the html neither shows the accordion itself…

Is there a way to manually use the accordion widget without using the pagebuilder? I would hate to rely on another plugin because of the unification of the layout…

PHP File is like:

echo $result="blabla".do_shortcode("[siteorigin_widget class='SiteOrigin_Widget_Accordion_Widget']<input type='hidden' value='{"instance":{"title":"title","panels":[{"title":"Panel1","content_text":"content1</p>n","content_text_selected_editor":"tinymce","initial_state":"closed","autop":false},{"title":"Title 2","content_text":"Content 2</p>n","content_text_selected_editor":"tinymce","initial_state":"closed","autop":false}],"design":{"heading":{"background_color":"#828282","background_hover_color":"#8c8c8c","title_color":"#fff","title_hover_color":false,"border_color":false,"border_hover_color":false,"border_width":false,"border_width_unit":"px","so_field_container_state":"closed"},"panels":{"background_color":"#f9f9f9","font_color":false,"border_color":false,"border_width":false,"border_width_unit":"px","margin_bottom":"10px","margin_bottom_unit":"px","so_field_container_state":"closed"},"so_field_container_state":"closed"},"_sow_form_id":"491160991632b1b9c67bd3786650903","_sow_form_timestamp":"1663769529659","so_sidebar_emulator_id":"sow-accordion-210001","option_name":"widget_sow-accordion"},"args":{"before_widget":"<div id="panel-2-1-0-0" class="so-panel widget widget_sow-accordion panel-first-child panel-last-child" data-index="1" data-style="{&quot;background_image_attachment&quot;:false,&quot;background_display&quot;:&quot;tile&quot;}" >","after_widget":"</div>","before_title":"<h3 class="widget-title">","after_title":"</h3>","widget_id":"widget-1-0-0"}}' />[/siteorigin_widget]")." blabla"

HTML Output is:

<div class="so-widget-sow-accordion so-widget-sow-accordion-default-0cbe2f692174"><div>
	<div class="sow-accordion">

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

  1. 3 days, 9 hours ago Andrew Misplon Hi, I Work Here

    Hi CD

    Thanks for getting in touch.

    Any chance the site in question is using SiteOrigin Premium? If so, you could use the Mirror Widgets Addon to add a widget using a shortcode:

    Page: Mirror Widgets

  2. 3 days, 2 hours ago CaneloDigital

    Hi Andrew,

    Thx so far for the hint.

    Unfortunately, until now, it’s just a SiteOrigin Free version on this site.
    It’s for a latinamerican small customer and they are tipically reluctant to yearly fees for their sites (apart of domain and hosting) so I am trying to find a free way to include a accordion into a php theme-template file.

  3. 3 days, 16 minutes ago Andrew Misplon Hi, I Work Here

    Hi, thanks for the update. Sure, no worries.

    Our free support scope covers basic troubleshooting and usage. We can assist with customizations in our premium support scope where we have the budget to do so. I’m sorry I don’t have better news. A few options that come to mind:

    – You could potentially create a new widget area and add your Accordion Widget to the new widget area and then output that area as required.

    – Because it’s for one widget, adding a plugin isn’t ideal, but I thought I’d mention this anyway https://wordpress.org/plugins/widgets-as-shortcodes/.

Please log in to post on our forums. Signing up is free.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More