我有这样的一页:
<?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();?>我有一个名为:侧栏-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 -->我试着阅读WP文档,找到了如何注册一个小部件,但没有找到如何包含这样一个简单的脚本。
发布于 2020-02-10 22:08:59
我不得不补充:
<body <?php body_class('has-sidebar'); ?>>到我页面的标题
发布于 2020-02-10 17:56:25
我相信,读到你的问题,你是在问如何调用你注册的一个小部件?如果是这样的话,在整个侧栏模板(可能是sidebar.php)中,如果您希望小部件显示,如果侧边栏小部件名为“侧栏-测试”,则添加:
<?php if ( is_active_sidebar( 'sidebar-test' ) ) dynamic_sidebar( 'sidebar-test' ); ?>https://wordpress.stackexchange.com/questions/358285
复制相似问题