Admin Toolbar Not Displaying On Custom Page Templates

Posted in: Newspaper
Post count: 38

I have created a custom page template based off the single.php template file. Everything is working perfect except that the admin toolbar does not display. when i scroll down while logged in the themes header is dropped down as if the toolbar was there, but it is not and it looks really bad. I need to use this toolbar so i need it to display. Here is the basic structure of the page.

require('wp-blog-header.php');
get_header();
show_admin_bar(true); //doesnt make the toolbar show.

#my custom content

get_footer();

https://codex.wordpress.org/Toolbar this is the toolbar that i want to display on my custom pages. Anyone know what im missing here? Any guides say that the theme im using must have wp_footer(); at the end of the </body> tag. Im assuming this is already present since the theme displays the toolbar fine on other pages.

Post count: 38

Adding the following will make a blank bar display on the page, but its a new instance of the object. Im assuming an existing object is already present in memory just not displaying.

require (‘wp-includes/class-wp-admin-bar.php’);
$adminbar = new WP_Admin_Bar;
$adminbar->initialize();
$adminbar->render();

Post count: 6600

Hi,

Please provide your admin login details via email at contact@tagdiv.com so we can have a look at this and also include a link to this discussion.

Thanks

Post count: 38

This cant be fixed via wordpress its a code problem. I have a custom file “mypage.php” Inside this file i call get_header() and get_footer() for this theme. The theme displays perfectly on my page and acts every way that i want it to, but there is a margin at the top of the page to take the admin toolbar into account, yet the admin toolbar is not present

Post count: 1291

Hi,

I suspect it’s the admin bar css, check it in style.css – http://screencast.com/t/T5u62eBqeB

Thank you!

Post count: 38

You still misunderstand. wpadminbar is not displaying on the page. It should be as the theme is expecting it to be there, but it isnt.

I have just used the following to create a new admin bar and display it. Doesnt work as good as the proper one, but its better than nothing.

$wp_admin_bar = new WP_Admin_Bar;
$wp_admin_bar->initialize();
.

.

Post count: 1291

Hi,

The issue may come from a plugin. Try to disable all plugins, enable only Visual Composer and check again.
Next i suspect some of the html used on your custom page template may be broken, this may cause the admin bar not to display. Check all code again and see if there are any errors.

Thank you!

Viewing 7 posts - 1 through 7 (of 7 total)
The forum ‘Newspaper’ is closed to new topics and replies.