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