Remove header and footer but KEEP all css and js etc for a custom post template?

On my site have a custom post type with this info. I stored the file in single-{customposttype}.php.

<?php
get_header();
?>
<div style="width:500px;">
<?php
$id = get_the_id();
echo do_shortcode( '[skwidget id="' .  $id . '"]' );
?>
</div>
<?php get_footer(); ?>  

The skwidget plugin is called correctly and everything seems to work fine.

But here’s the issue: Everything gets included but I ONLY want the css for the theme, css for the plugin and all relevant css/js for the plugin but I don’t want header and footer-menu(s) to be shown. How do I achieve that?

If just remove get_header() and get_footer() then the plugin won’t work because it needs js/css etc.

I GUESS I could create header html and footer manually but that doesn’t seem like a good idea…

1 Answer
1

If someone needs something similar, I actually found an answer to my issue and it is to pass arguments to get_header() and get_footer().

<?php
get_header('customposttype);
?>
<div style="width:500px;">
<?php
$id = get_the_id();
echo do_shortcode( '[skwidget id="' .  $id . '"]' );
?>
</div>
<?php get_footer('customposttype'); ?>  

and copy header.php to header-{customposttype}.php and footer.php to footer-{customposttype}.php

And after that custom modifiy the

header-{customposttype}.php
footer-{customposttype}.php

after your needs!

Leave a Comment