Accessing $post variable from template part
Here is a section of code that I have in a template file — to display sub-navigation if the page has child-pages:
Here is a section of code that I have in a template file — to display sub-navigation if the page has child-pages:
I’d like to be able to pre-populate all occurances of the get_tempate_part $args when setting up a theme.
I am attempting to call a template part via a shortcode. Ive read all about how to do this over and over on this site and yet after having tried a number of things still am unable to call a simple php echo time string. The file name is test-one.php .Here is what I’ve tried:
I have a custom post type and I’m trying to call up different variations of the navigation based on the custom taxonomy slug. I’ve done this fairly easily with normal posts, like so:
One you have called a template with get_template_part()
(or locate_template()
) is there a way to know what template you are in.
While I’ve typically used include
or require
on their own to save long term code maintenance I’ve started to use get_template_part
and locate_template
as using built in WordPress stuff is always best.
I have a custom post type paper
defined in my WordPress plugin that I show along with standard posts in the main query via:
I’m working on a child theme, I strongly prefer not to override the main template files in order to maintain simplicity of the child theme as well as minimize the amount of code and maintenance over time.
Could someone please explain to me how this function works? I know what it does but when I look at the source code in the twenty_ten template, I don’t get how all loops are being collected in one single loop.php ( I saw that file too).