1

Provided I have a widget area that I register in genesis like this:

genesis_register_sidebar( array(
    'id'        => 'my_header',
    'name'      => __( 'Image Header', 'my_header' ),
    'description'   => __( 'do it', 'my_header' ),
) );

and that I add as this

add_action( 'genesis_after_header', function() {

    genesis_widget_area ('my_header', array(
        'before' => '<div class="my_header"><div class="my_wrap">',
        'after' => '</div></div>',
    ) );

} );

Then, the user adds 3 text widgets inside the widget area, the question is how can I get the content of this widgets so that I can format them?

Something like this

add_action( 'genesis_after_header', function() {

    the_widget('WP_Widget_Custom_HTML', array(
        'content' => '
        <div>
            <div> $my_header[text_fields][0].textContent </div>
            <div> $my_header[text_fields][1].textContent</div>
            <div> $my_header[text_fields][2].textContent</div>
        </div>
        '
    ));
} );

NOTE: I've also asked this in stackoverflow https://stackoverflow.com/questions/53139436/wp-genesis-how-to-get-the-content-of-a-widget-in-php, are these two the same community or they do target different publics?

closed as off-topic by Jacob Peattie, Krzysiek Dróżdż, fuxia Nov 4 '18 at 14:50

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • You shouldn't post a question twice, stackoverflow.com is more a general topic about programming while WordPress StackExchange is specific to WordPress – Remzi Cavdar Nov 4 '18 at 10:09