WP - Genesis - How to get the content of a widget in php?

admin2025-06-06  7

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 6 years ago.

Improve this question

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 , are these two the same community or they do target different publics?

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749206575a317254.html

最新回复(0)