WordPress: get content of a text widget

I have a text widget in the left sidebar and I want it to be displayed somewhere else on the page and not in a sidebar. The widget’s text is some HTML:
<a href...><img ...></a>

I can’t figure out the code how to get the widget’s content – the HTML. I found out, that the name of the widget seems to be “text-5” using this code:

Read More

print(wp_get_sidebars_widgets()['travelify_left_sidebar'][0]);

Why I use a widget for this is because I want it to be easy to alter the HTML code for my client.

thx in advance,
Koem

Related posts

Leave a Reply

1 comment

  1. This template tag displays an arbitrary widget outside of a sidebar. It can be used anywhere in

    <?php the_widget( $widget, $instance, $args ); ?> 
    

    Text widget

     <?php the_widget( 'WP_Widget_Text', $instance, $args ); ?> 
    
    widget's classname: widget_text
    instance:
    title
    text
    filter
    Example
    Default usage: 
     <?php the_widget( 'WP_Widget_Text' ); ?> 
    

    You can also find whole solution about wordpress codex site

    http://codex.wordpress.org/Function_Reference/the_widget