Closed. This question is off-topic. It is not currently accepting answers.admin管理员组文章数量:1130349
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 questionProvided 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?
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 questionProvided 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?
本文标签: WPGenesisHow to get the content of a widget in php
版权声明:本文标题:WP - Genesis - How to get the content of a widget in php? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749206550a2332665.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论