I have been trying to get the admin bar to show up under a magento install. I have tried eveything to get it. I can get the user, get the footer but nothing happens to get the admin bar up.
from with in a 1column.phtml I called a
<?php
echo $this->getLayout()->createBlock('core/template')->setTemplate('custom/userpanel.phtml')->toHtml();
?>
and in that ‘custom/userpanel.phtml’ I added :
require_once('/var/www/html/blog/wp-load.php');
require_once('/var/www/html/blog/wp-blog-header.php');
require_once('/var/www/html/blog/wp-includes/admin-bar.php');
require_once('/var/www/html/blog/wp-config.php');
show_admin_bar(true);
wp_admin_bar_render();
with out anyluck.
I’v tried using
wp_footer();
but that doesn’t get the bar, and even calling the head function doesn’t work
wp_head();
wp_footer();
But althou i get all the head elements like the and what not which i don’t want since it’s in the , but still nothing. What is the way to set it up correctly?
————————————————————————
EDIT
————————————————————————
So I thought I’d get tricky and just grab the admin bar from WP and pull it over almost like jquery .load() but at php runtime. This is what i did, but here is the odd part, it fails cause it thinks I’m not loged in?
Again in ‘custom/userpanel.phtml’ of magento which is pull over to WP so when in WP it’s all fine but well as of yet nothing here.
<div id="wpfoot">
<?php
//wp_head();
if ($userUsername ) {
if ( strpos($_SERVER['REQUEST_URI'], '/blog/') === FALSE ){
$dom = new DOMDocument();
$dom->validateOnParse = true;
$dom->loadHtml(file_get_contents("http://domain.xxx/blog/"));
echo $dom->getElementById('wpfoot');
}else{
wp_footer();
}
}
//
?>
</div>
Have you tried possible displaying Magento in WordPress? I found an extension that allows Magento blocks within WordPress:
website
Here is the actual plugin site – MWI
Add also script and styles:
and
_wp_admin_bar_init()
You must also include the Hooks for register script and styles or include the scripts from the key ‘admin-bar’ in your head.
I think this was all for display the Admin Bar.