Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-11-08 13:25:18

sigit
New Member
Registered: 2011-11-08
Posts: 2

Display author name on top of a page with articles by the author?

What I want to do:

Display a text that sounds something like “Articles written by (Author Name Here)” and then list the articles by that author. If possible, display a short profile of that author as well.

So far, I can display a page that lists articles by a specific author, but I can’t find a way to put the text like above. I used the following code:

<txp:if_article_list>
<txp:if_author name=“author1,author2,author3”>
<div id=“intro”> <p>Articles written by <strong><txp:author title=“1” /></strong>. </p>
</div>

</txp:if_author>
</txp:if_article_list>

That doesn’t seem to work. Also, is there any shorter way to define all authors included without actually putting their usernames one by one?

Thanks!
Sigit

Offline

#2 2011-11-08 13:44:35

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,947
Website GitHub

Re: Display author name on top of a page with articles by the author?

sigit wrote:

“Articles written by (Author Name Here)” and then list the articles by that author.

If you don’t specify name= in your <txp:if_author> tag then it’ll trigger for any author in the URL, i.e site.com/author/sigit would centre Txp around you.

Untested but how about:

<txp:if_author>
<div id="intro">
   <txp:article>
      <txp:if_different>
         <p>Articles written by <strong><txp:author title="1" /></strong>.</p>
      </txp:if_different>
      <txp:permlink><txp:title /></txp:permlink>
   </txp:article>
</div>
</txp:if_author>

I’m sure someone else can come up with something better / shorter. It’s been a while since I did this kind of thing so I’m a bit rusty.

If possible, display a short profile of that author as well.

You might want to look at the smd_bio plugin. The current beta is the best one to get as it’s stable enough for production use and is probably going to be the version that becomes the official version 0.40. There are significant changes between the 0.3x and 0.40 versions so you’ll want to start with the latest to avoid having to alter things later.

Last edited by Bloke (2011-11-08 13:45:07)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2011-11-08 23:06:37

sigit
New Member
Registered: 2011-11-08
Posts: 2

Re: Display author name on top of a page with articles by the author?

Hi Stef,

Your code works. Thanks!
I’ve yet to try the smd_bio plugin.

Thanks again,
Sigit

Offline

#4 2011-11-09 22:48:28

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 317
Website GitHub GitLab Mastodon Twitter

Re: Display author name on top of a page with articles by the author?

Are you looking for that index of author’s articles, and with this general list of authors, linked to its indexes? If so, I will put the plain TxP code, with no plugins nor PHP code. In this example, an author can present himself by an entire page (or several ones), by short summary in one paragraph only, or even without introduction.

Offline

Board footer

Powered by FluxBB