N
N
nikfcsm2018-04-02 15:20:32
WordPress
nikfcsm, 2018-04-02 15:20:32

How to display sidebar in wordpress?

Guys, I want to display the sidebar on the category pages, I created the category.php file, displayed the header, footer, posts themselves, but I can’t do the sidebar!
The sidebar file is empty, but there are two sidebar files along the paths templates/sidebar-1.php and templates/sidebar-2.php
tried to throw the sidebar-1.php file into the theme directory and connect it with code Nothing works, I even tried to throw the contents of the file, to the file where I need to output this sidebar
<?php get_sidebar('sidebar-1'); ?>

<div id="sidebar" role="complementary" <?php Avada()->layout->add_class( 'sidebar_1_class' ); ?> <?php Avada()->layout->add_style( 'sidebar_1_style' ); ?>>
  <?php if ( ! Avada()->template->has_sidebar() || 'left' == Avada()->layout->sidebars['position'] || ( 'right' == Avada()->layout->sidebars['position'] && ! Avada()->template->double_sidebars() ) ) : ?>
    <?php echo wp_kses_post( avada_display_sidenav( Avada()->fusion_library->get_page_id() ) ); ?>
    <?php if ( class_exists( 'Tribe__Events__Main' ) && is_singular( 'tribe_events' ) ) : ?>
      <?php do_action( 'tribe_events_single_event_before_the_meta' ); ?>
      <?php tribe_get_template_part( 'modules/meta' ); ?>
    <?php endif; ?>
  <?php endif; ?>

  <?php if ( isset( Avada()->layout->sidebars['sidebar_1'] ) && Avada()->layout->sidebars['sidebar_1'] ) : ?>
    <?php generated_dynamic_sidebar( Avada()->layout->sidebars['sidebar_1'] ); ?>
  <?php endif; ?>
</div>

But it doesn't show up either.
In general, I never found the get sidebar function in the theme files. And how then is the sidebar displayed on other pages

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel, 2018-04-02
@wtrouble

<?php get_sidebar( '1' ); ?>
<?php get_sidebar( '2' ); ?>

A
Alex-1917, 2018-04-02
@alex-1917

post functions.php - there should be an answer to your question,
but in fact, with such knowledge, why did you get into a complex studio template ???
start with a simple clean template.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question