1

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>
1

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

0

Add also script and styles:

wp_enqueue_script( 'admin-bar' );
wp_enqueue_style( 'admin-bar' );

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.

/wp-includes/js/admin-bar.js
/wp-includes/css/admin-bar.css

I think this was all for display the Admin Bar.

-2
<?php
require_once('./wp-load.php');
require_once('./wp-includes/admin-bar.php');
_wp_admin_bar_init();
wp_admin_bar_render();
get_header();
?>
  • 4
    Please add an explanation to your answer: why could that solve the problem? – fuxia Jul 2 '15 at 22:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.