• Resolved kbrown

    (@kbrown)


    Hello…
    We’ve created a page-template and registered a sidebar in functions.php with

    'name'          => __( 'Primary: Affiliates', 'hueman' ),
    'id'            => 'affiliate-sidebar',

    The page-template calls the sidebar normally as <?php get_sidebar(); ?>

    My question is how can I have the page-template call the sidebar above?

    Thank in advance and be safe and healthy

    Ken

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter kbrown

    (@kbrown)

    I was able to figure this out with help from https://developer.www.ads-software.com/themes/functionality/sidebars/

    I created sidebar-affiliate.php with this code from sidebar.php

    <?php $layout = hu_get_layout_class(); ?>
    <?php if ( $layout != 'col-1c'): ?>
    
    	<div class="sidebar s1 collapsed" data-position="<?php echo hu_get_sidebar_position( 's1' ); ?>" data-layout="<?php echo $layout ?>" data-sb-id="s1">
    
    		<button class="sidebar-toggle" title="<?php _e('Expand Sidebar','hueman'); ?>"><i class="fas icon-sidebar-toggle"></i></button>
    
            <div class="sidebar-content">
                <?php dynamic_sidebar( 'affiliate-sidebar' ); ?>
            </div><!--/.sidebar-content-->
    
    	</div><!--/.sidebar-->
    
    	<?php
        if ( in_array( $layout, array('col-3cm', 'col-3cl', 'col-3cr' ) ) ) {
          get_template_part('sidebar-2');
        }
    	?>
    
    <?php endif; ?>

    And added <?php dynamic_sidebar( ‘affiliate-sidebar’ ); ?>

    And in my page template I replaced <?php get_sidebar(); ?> with <?php get_sidebar( ‘affiliate’ ); ?>

Viewing 1 replies (of 1 total)
  • The topic ‘sidebar for page template’ is closed to new replies.