Custom Template file for single

  1. Jam Viet


    i want to make some post cuter than it is, but WordPress doesn't support single-ID.php so if WordPress can add it to core in the near future ?

    It's can be easy for WordPress to add this support and make us more option to design template!

    Thanks !

    Posted: 5 years ago #
  2. gerald@WPcustoms


    I cannot see a situation where this is needed. If you want to style particular content you can use page-{ID}.php

    It makes more sense with single-{post_type}.php to give the whole cpt a specific design.

    I think a part of the concept of a CMS is consistent layouts for same content-types.

    on the other hand speaking of consistency: every other template does support -{ID}.php(tag, author etc) except single ?!

    Posted: 5 years ago #
  3. Jam Viet


    BUt it is so simple for wordpress to add ID to single theme, i have to design some of my single post to suit my case :D

    But thank for responing !

    Posted: 5 years ago #
  4. Mihail Semjonov

    There's a quick workaround on this.
    In your post in custom fields add a field ( for ex. ) template.
    Give it value..
    In your single.php before any code
    do something like chacking these meta and if it exists do checking if file exists in both child and parent theme.. if exists then load it.
    get_template_part('single', $meta ); exit;
    thats it.. simple workaround.

    I personaly think there's no need in single-{id}.php

    But perhaps making filter where's wp is teling wich file to load would be nice ( don't know if it exists or not already ).
    Then it would be easear to make these throught filter than editing single.php file like i was suggesting.

    Posted: 5 years ago #

RSS feed for this topic


You must log in to post.

  • Rating

    2 Votes
  • Status

    Sorry, not right now