I’ve created my {custom} posts. Information from the identical is displayed in as an instance single-custom-post.php.
Now to wash that file and to take away 100 strains of code, I need to make a brand new file (let’s name it custom-header.php
) after which simply echo or name that content material.
Since I’ve constructed {custom} submit as a plugin, ideally could be good to name it if plugin is lively, nevertheless I do not know end this as a result of one assertion is that if myplugin is lively however then I might someway add one other assertion – perform, and right here I’m misplaced (under).
I may name it by if perform exist, however then i’m not certain how do I create that perform.
What I did and it does work is that this:
-
inside
custom-header.php
I’ve addedif ('custom_header_display') { ?> //my code } ?>
after which in single-custom-post.php
I changed that 100 strains of code with
embrace (TEMPLATEPATH . '/inc/custom-header.php' );?>
So my downside is, I do not know is that this a great way, and if it is not, what’s it?