ThemeShaper Forums » Thematic


How to use single.php with the template system ?

(3 posts)
  • Started 9 years ago by lstelie
  • Latest reply from lstelie
  • This topic is not resolved
  1. Hello

    I'm looking for an elegant way to link single.php with a author specific template
    The context :

    My original website (carrington based) :
    My playground to learn Thematic :
    WP 3.3b4 / Thematic latest svn

    My website (about leisure / urban cycling) has two kind of authors :
    - a generic one : me (myself and I)
    - Invited authors (grouped in the “guest stars” category)

    What I want to do :

    Having a specific presentation for some specific authors whatever the entry is : entry by author (ok) entry by category (ok) entry by post title (not ok)

    Current situation
    I have a specific presentation for categories, if i click on « Guest Stars » in my menu :
    The specific image /introduction text appear. (category-categorynickname.php ) ok so far
    If I choose a specific « guest star », same success :

    If i click on the author name ; everything is still fine (author-authornickname.php)

    But if instead, I click on the post title (single.php):

    The specific environment disappears. And that’s normal as the template system cannot determine anything based on the url

    what I’m failing to do

    I’m looking for an elegant way to link a post to an author in a way that if the author has a specific template, the post (single.php) get the same presentation.

    Carrington does that automagically, I’m not clear how to do this with Thematic.

    Thanks in advance


    Posted 9 years ago #
  2. salut luc! si j'avais su que tu étais français, il me faudrait à reconsidérer ta proposition. j'ai toujours voulu une passport european! :)

    if i understand correctly then you want to load a different single-author.php template for single posts by a specific author?

    specifically check out this section "Use a different layout for a certain post inside a certain category". you'd need to adjust for author but the concept should be the same.

    it might be better to use locate_template over "include" but i'd have to test that out more to be sure

    sidenote- what hook are you targeting for adding that image content to the different page templates? the above suggestion may not be neccessary... can you post the code you are using to try to add an image to the single post?

    Posted 9 years ago #
  3. Dear

    I had a quick look at this text band this seems the way to go

    I’m currently at my office but tonight or tomorrow I’ll try something like :

    If the call is for a single post then
    get the author nickname
          If a author template exists for this author use the template
    Use the generic single template

    Or to lower the resource consumption, as my particular authors are only in one category (“guest stars”)

    If the call is for a single post then
    Get the category name or ID
    If the category name or ID is Guest Stars’s one then 
    get the author nickname
          If a author template exists for this author use the template
    Use the generic single template

    By the way I thing we may postpone a little bit our wedding.
    Been Europeans theses days might be a.. rockn’roll situation let’s say.
    Our good ol’ Europe is collapsing, I'm not sure a European passport will be be a dream in a few months/years....

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.