admin管理员组文章数量:1391981
I have a Page like:
<?php
/*
Template Name: Agenda
*/
get_header(); ?>
<div class="wrap">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
My Hompagetext
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar('test'); ?>
</div><!-- .wrap -->
<?php get_footer();?>
I have a sidebar called: sidebar-test.php
<aside id="secondary" class="widget-area" role="complementary" aria-label="<?php esc_attr_e( 'Test Sidebar', 'rczo2' ); ?>">
this text is displayed on the bottom but I want it in the sidebar on the right side
</aside><!-- #secondary -->
I tryed reading across the WP-documentation and found how to register a widget, but not how to include a simple script like this.
I have a Page like:
<?php
/*
Template Name: Agenda
*/
get_header(); ?>
<div class="wrap">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
My Hompagetext
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar('test'); ?>
</div><!-- .wrap -->
<?php get_footer();?>
I have a sidebar called: sidebar-test.php
<aside id="secondary" class="widget-area" role="complementary" aria-label="<?php esc_attr_e( 'Test Sidebar', 'rczo2' ); ?>">
this text is displayed on the bottom but I want it in the sidebar on the right side
</aside><!-- #secondary -->
I tryed reading across the WP-documentation and found how to register a widget, but not how to include a simple script like this.
Share Improve this question asked Feb 10, 2020 at 13:19 ratmalwerratmalwer 1011 bronze badge2 Answers
Reset to default 0I believe, reading your question, you are asking how to call up a widget that you've registered? If so, in the overall sidebar template (likely, sidebar.php), at the point where you want the widget to show, if the sidebar widget is named 'sidebar-test', add:
<?php if ( is_active_sidebar( 'sidebar-test' ) ) dynamic_sidebar( 'sidebar-test' ); ?>
I had to add:
<body <?php body_class('has-sidebar'); ?>>
to the header of my Page
本文标签: sidebarHow do I set isactivesidebar
版权声明:本文标题:sidebar - How do I set is_active_sidebar? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744760157a2623706.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论