Support » Theme: Customizr » Multiple Blog/Custom Post List…Template Naming Convention?

  • Resolved deputy05


    Due to recent topics related to this…they have inspired me to accomplish the same thing…my wanting a separate blog/post list page limited by author.

    At first I tried @d4z_c0nf functions.php solution at the bottom of the first page in this topic…it works BUT when I insert an author param the page renders as an author archive page.

    So next I tried @acub solution in this topic; this appears to work perfectly with my limited testing…BUT I imagine I would need a separate template for each author param…or is there a better way?

    So, with all that said, can I name them as blog1.php, blog2.php, etc., or is there a proper naming convention to accomplish this?

    The codex leads me to believe I can name the file whatever I want…and that I also need to change the template name inside the file as well.

    Thanks for your assistance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You only need to create author templates in one of these cases:

    1. You want to replace the default display of all authors pages (create a template named “author.php”).
    2. You want to replace the default display of a particular author page (create a template named “author-{nicename}.php” or author-{ID}.php).

    The template precedence for authors is:
    author-{nicename}.php > author-{ID}.php > author.php > archive.php > index.php

    This basically means that if the theme does not provide an author.php, archive.php will be used instead and if that does not exist either, index.php will handle the request.

    More on WP template hierarchy here.

    My question is: why would you need a static page with an author’s posts when you already have the default WP author pages?

    Of course is rendered as an author archive page ’cause in that case the conditional tag is_author() is true as long as is_singular() returns false. In acub’s (modified with the author query var) solution (which by the way I think is the better solution so far to have a blog page in customizr) the conditional tag is_singular() returns true and is_author() returns false, so this line in parts/class-content-headings.php

    //author's posts page
          if ( !is_singular() && is_author() ) {

    returns false and then the heading for the author is not displayed.
    This because the callback is hooked with priority 10 (by default), and added in a template, this means that TC_headings is instantiated before that adding, and then acub’s callback is queued to tc_archives_headings. So if you change the priority of “my callback” to 15, for example, you’ll have a similar result.
    Also in my code there’s an useless param for my_blog_page ($query), a typo, probably ’cause I was thinking to use another solution and when I switched to the one proposed I left it there by mistake.
    I hope this is understandable (sorry for my poor english).
    That said, I didn’t get what’s your aim 😀 , why do you want a static page to display author’s posts?
    Why don’t make authors templates?
    (didn’t see acub asked the same)

    Thanks acub…

    Please bear with me, I am still new at this. The only author pages I know of is the author archive pages. If this is not the case, it is just another hole (of many) in my knowledge.

    I would like different sidebar content per author…I originally thought about just linking the author archive pages but I could not figure out how to apply a left sidebar layout to just the author archives and not the other archives as well.

    Thanks d4z_c0nf…

    Guess I need to check into author pages/templates…

    You don’t need a template to display different content in sidebars.

    You need widget logic. It adds every single registered widget a section where you can add WP conditionals for displaying the widget.

    Assuming you have a widget that you want everywhere but author pages, you add this condtional:


    If you want a widget that should only display on pages with ids 214 and 328:


    Author with ids 5 or 8, nicename of deputy or nickname of shot the Sheriff:

    is_author(array(5,8,'deputy','shot the Sheriff'))

    And so on…

    Thanks again acub…I already have the widget logic plugin.

    Guess I am just confused on this individual author page ability…just need to check into it further…probably something really simple…I have a habit of staring at an answer yet not actually seeing it… 🙂

    Marking this topic as resolved…need to research/learn more on how to properly create an author template…if I have problems later on down the road, I will open a new topic.

    Thanks acub and d4z_c0nf for your assistance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Multiple Blog/Custom Post List…Template Naming Convention?’ is closed to new replies.