I am trying to create my first wp theme. So far it has been quite nice experience, but now i have a problem that i don’t quite understand.

The Admin bar is showing only on some of my pages, on the others it shows only white (actually transparent).
Ex: on the Home page it is transparent (like if there is the empty place for it), but if i click the link to the “About us” page then i get the admin bar on that page.
Actually it is transparent in almost ALL pages, except for the About us.

What i have checked and tried:

i have the “show toolbar when viewing the site” selected.

in header.php i do have the wp_head();

in footer.php i have the wp_footer();

i tried forcing it to show by adding to the functions.php

add_filter( 'show_admin_bar', '__return_true' );

but it doesn’t make difference.

tried also to comment out all css: no change (to the bar, of course!)

tried deleting the custom js scripts: also no change.

looked at the code but found no pieces missing (like ” or ; or >)

When i see the bar (on the About us page) and right click > Inspect Element, it all seems ok.
But on the pages where there is just the empty space and i do the same i see that there are several things missing just before the :

  • the wpadminbar

  • several scripts

Any ideas?
If you need any more information just let me know what you need.

Maybe i am missing something very simple, and hopefully someone will be able to help me. THANKS!

here is my index.php:

<?php
get_header(); ?>
<?php get_sidebar(); ?>

<div id="primary" class="content-area">
    <main id="main" class="site-main" role="main">

    <?php if ( have_posts() ) : ?>

        <?php /* Start the Loop */ ?>
        <?php while ( have_posts() ) : the_post(); ?>

            <?php
                /* Include the Post-Format-specific template for the content.
                 * If you want to override this in a child theme, then include a file
                 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
                 */
                get_template_part( 'content', get_post_format() );
            ?>

        <?php endwhile; ?>

        <?php _S_paging_nav(); ?>

    <?php else : ?>

        <?php get_template_part( 'content', 'none' ); ?>

    <?php endif; ?>

    </main><!-- #main -->
</div><!-- #primary -->

 <?php get_footer(); ?>

and my page.php

<?php
get_header(); ?>
<?php get_sidebar(); ?>

<div id="primary" class="content-area">
    <main id="main" class="site-main" role="main">

        <?php while ( have_posts() ) : the_post(); ?>

            <?php get_template_part( 'content', 'page' ); ?>

            <?php
                // If comments are open or we have at least one comment, load up the comment template
                if ( comments_open() || '0' != get_comments_number() ) :
                    comments_template();
                endif;
            ?>

        <?php endwhile; // end of the loop. ?>

    </main><!-- #main -->
</div><!-- #primary -->

 <?php get_footer(); ?>

and the footer.php

    </div><!-- #content -->

    <footer id="colophon" class="site-footer" role="contentinfo">
        <div class="site-info">
            <?php do_action( '_S_credits' ); ?>
            <a href="http://wordpress.org/" rel="generator"><?php printf( __( 'Proudly powered by %s', '_S' ), 'WordPress' ); ?></a>
            <span class="sep"> | </span>
            <?php printf( __( 'Theme: %1$s by %2$s.', '_S' ), 'SEEMPLE', '<a href="http://AuthorURIHere" rel="designer">LUISPATO</a>' ); ?>
        </div><!-- .site-info -->
    </footer><!-- #colophon -->
</div><!-- #page -->

<?php wp_footer(); ?>
</body>
</html>

2 Answers
2

First of all i would like to thank you for trying to help me!!

i found out what was causing it: it was an error on the functions.php:

it was missing:

require get_template_directory() . '/inc/template-tags.php';

i have added it back to the functions.php and now everything seems to be working fine.

Thank you!

=)

Leave a Reply

Your email address will not be published. Required fields are marked *