Replace post_meta() with a template_part #2

Closed
staydecent opened this Issue Oct 27, 2011 · 5 comments

Comments

Projects
None yet
2 participants
Contributor

staydecent commented Oct 27, 2011

Reusable pieces of a theme (mostly markup) should utilize http://codex.wordpress.org/Function_Reference/get_template_part

Allows for proper child theme's as well.

Owner

nathansh commented Oct 28, 2011

Are you able to put template_part files in in sub-directories? I don't see that in the documentation. get_template_part seems like it'd be a good idea, but I like separating things out and keeping my folders tidy.

Contributor

staydecent commented Oct 28, 2011

Yup, should work fine using the $slug param: get_template_part('folder/file');

See: http://core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/general-template.php#L124

Owner

nathansh commented Oct 28, 2011

Hmm, doesn't seem to work so smoothly like that. It should, but it doesn't seem to...

Owner

nathansh commented Feb 22, 2012

I'm going to move to keeping template parts in a partials subfolder under includes, but I'm going to wait to move to get_template_part() until WordPress allows you to specify a directory, which I'm sure is only a matter of time.

nathansh closed this Feb 22, 2012

Contributor

staydecent commented Feb 22, 2012

Good decision. Looks like it should be added before 3.4 comes out: https://core.trac.wordpress.org/ticket/15086

@nathansh nathansh pushed a commit that referenced this issue Apr 3, 2015

Nathan Shubert-Harbison Merged in jamie (pull request #2)
Updated readme with project setup notes.
5606c0c

@nathansh nathansh pushed a commit that referenced this issue Apr 20, 2015

Nathan Shubert-Harbison Merge pull request #2 from eriku/master
Added menu_item_parents = [] variable to sub_menu.php to stop array error
3c511f6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment