• I’ve been frustrated trying to persuade the default twentysixteen theme to display the single post meta data in the way I would prefer.

    It seems everything is based on the “template-tags” file, but I’m finding it much easier to use discreet methods found in the Codex such as get the post category and get the date and get the title etc. and adding these directly to the single.php template.

    Guess my question is why does twentysixteen use the template-tags file for the metadata, and what is the advantage of doing things this way, instead of simply editing the single.php directly??

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    As I understand it (from using underscores), the idea is that the content-single.php sort of usage is designed to allow you to create files that might be shared among templates instead of duplicating code inline in templates. That flows down through the development philosphy of underscores based themes.

    I can argue it both ways. ??

    Sometimes, I use the get_template_part() function and sometimes I just say “the heck with it” and code inline.

    However, I see the value of the shared template part methods. See https://developer.www.ads-software.com/reference/functions/get_template_part/ for a short explanation.

    Anyhow, that’s the “why” as I understand it.

    Thread Starter speedyp20

    (@speedyp20)

    Cool – thanks for the info sterndata ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Twentysixteen – Why Template-tags file?’ is closed to new replies.