Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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>
share|improve this question

2 Answers 2

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

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.

share|improve this answer
    
I had to comment in the form of an answer. thanks for the help –  jeremy.bass Dec 28 '12 at 16:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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