$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>WP - Genesis - How to get the content of a widget in php?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

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

matteradmin10PV0评论
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?

Post a comment

comment list (0)

  1. No comments so far