I've created my custom posts. Data from the same is displayed in let's say single-custom-post.php.
Now to clean that file and to remove 100 lines of code, I want to make a new file (let's call it custom-header.php
) and then just echo or call that content.
Since I've built custom post as a plugin, ideally would be nice to call it if plugin is active, however I don't know how to finish this because one statement is if myplugin is active but then I would somehow add another statement - function, and here I am lost (below).
I could call it by if function exist, but then i am not sure how do I create that function.
What I did and it does work is this:
inside
custom-header.php
I've addedif ('custom_header_display') { ?> //my code } ?>
and then in single-custom-post.php
I replaced that 100 lines of code with
include (TEMPLATEPATH . '/inc/custom-header.php' );?>
So my problem is, I don't know is this a good way, and if it's not, what is it?