0

I was wanting a way to get the site header and footer and use it in the admin area.

Idea #1 An answer to another related question states to use an iframe instead I think we can use an ajax call get the header and footer from homepage and store in a function.

Idea #2 Where with jQuery we can clone() them, then store them in a function to use in the admin.

Maybe we need even both, I just think it's possible. I've seen a familiar post but still doesn't answer the question properly.

This is a close start:

add_action( 'in_admin_header', 'insert_header_wpse_51023' );
add_action( 'admin_footer', 'insert_footer_wpse_51023' );
add_filter( 'admin_print_styles', 'footer_hide_wpse_51023' );

function insert_header_wpse_51023()
{
    echo '';
}

function insert_footer_wpse_51023()
{
    echo '';
}
0

A very simple experiment...

add_action('admin_init','get_header');

add_action('admin_init','get_footer');

... will demonstrate that the get_header() and get_footer() functions work on the back end as well as the front, though you will need to adjust for numerous markup problems and other issues.

Honestly, you question seems to be "how do I get the site header and footer and use it in the admin area?" but you don't say how you want to use it, or why. Those are important considerations. As demonstrated, the "getting" is easy.

  • so do I add this code in the functions php file? – jkcoding Jun 15 '15 at 5:15
  • I added it there WordPress had connection issues. I edited your answer with different hooks, thanks – jkcoding Jun 15 '15 at 5:29

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.