Support » Developing with WordPress » Sidebar and main content won’t load at same time (custom theme)

  • culletron

    (@culletron)


    I’m sure i’m just missing something in the code, it’s my first time trying to use a sidebar. Either the sidebar or main content load, but never at the same time (depending on how i change my code). Most of the time it’s the sidebar that doesn’t load. URL is http://match.onesquad.nl/

    index.php:

    <?php get_header(); ?>
    <?php get_sidebar(); ?>
    <?php get_template_part( 'content', get_post_format() ); ?>
    <?php get_footer(); ?>

    sidebar.php:

    <?php
    if ( ! is_active_sidebar( 'sidebar-1' ) ) {
    	return;
    }?>
    
    <div id="secondary" class="widget-area" role="complementary">
    	<?php dynamic_sidebar( 'sidebar-1' ); ?>
    </div>

    functions.php:

    <?php
    function arphabet_widgets_init() {
    	register_sidebar( array(
    		'name'          => 'sidebar-1',
    		'id'            => 'sidebar-1',
    		'before_widget' => '<div>',
    		'after_widget'  => '</div>',
    		'before_title'  => '<h2 class="rounded">',
    		'after_title'   => '</h2>',
    	) );
    }
    add_action( 'widgets_init', 'arphabet_widgets_init' );
    ?>

    Any suggestions? Many thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Rinku Y

    (@rinkuyadav999)

    This should load normally. May be, there are some large images and they are taking time to load. so you see a little difference.

    culletron

    (@culletron)

    Thanks for the suggestion, but unfortunately no, there are no images at all in the sidebar. So far it only has a background colour

    Michael

    (@alchymyth)

    Forum Moderator

    does the corresponding sidebar area show under ‘appearance – widgets’ ?
    did you add widgets to that area?

    what files do you have in your theme?

    what plugins are you using?

    • This reply was modified 7 months ago by  Michael.
    culletron

    (@culletron)

    Yes, Sidebar-1 shows up under widgets, it has a menu widget in it, though I’ve tried other widgets just to see if that helps.

    The plugins I’m using are:
    -Insert Pages
    -Page Builder by SiteOrigin
    -SiteOrigin Widgets Bundle
    -WEN’s Responsive Column Layout Shortcodes
    -What The File
    -WP News and Scrolling Widgets
    although it’s been this way since before I’d even downloaded any plugins.

    I don’t have access to the files just now (hosting login is at work) but the ones I remember are:
    -front-page.php
    -index.php
    -single.php
    -header.php
    -sidebar.php
    -footer.php
    -functions.php
    -style.css
    and some templates.

    Michael

    (@alchymyth)

    Forum Moderator

    if you have front-page.php in your theme, this file might be used to show the front page, instead of index.phphttps://developer.wordpress.org/themes/basics/template-hierarchy/

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Sidebar and main content won’t load at same time (custom theme)’ is closed to new replies.