Add sidebar on special pages

Posted in: Newspaper
Post count: 13

Hey there,

I need your help. I have a plugin with forum, but I need to specify that there should be sidebar on single question page. According to developer, I should put code in page.php

<?php if ( is_singular('dwqa-question') ): ?>
 <?php dynamic_sidebar() ?>
<?php endif; ?>

or add in functions.php


function dwqa_theme_register_sidebar() {
 register_sidebar( array(
  'name'          => __( 'Single Question', 'twentysixteen' ),
  'id'            => 'single-question',
  'before_widget' => '<section id="%1$s" class="widget %2$s">',
  'after_widget'  => '</section>',
  'before_title'  => '<h2 class="widget-title">',
  'after_title'   => '</h2>',
 ) );
}
add_action( 'widgets_init', 'dwqa_theme_register_sidebar' );

and add
dynamic_sidebar( 'single-question' )
if I want custom sidebar.

But this approach doesn’t work for me in your theme. What should I do to fix it?

  • This topic was modified 9 years by theasder.
Post count: 22421

Hello,

Sorry but we did not test this approach so I cannot say for sure if this will work or not with our theme. Plugin implementation falls beyond what the theme support can offer you. I suggest hiring a freelnacer to help out with the implementation.

Thank you!

Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.