Jump to content

News posts by author linked from news index


SamC
 Share

Recommended Posts

I'm thinking of extending my news section which I've posted here previously which includes the following (put over a few lines to make it easier to read):

// news-index.inc

//LOOP

<?php
    $publish_date = date('d/m/y', $entry->created);
    $created_by = $entry->createdUser->displayName; // I added displayName field so to not show the actual login usernames on the site
?>

<div class='entry-info'>
    <span class='fa fa-calendar' aria-hidden='true'></span>
    Posted by <span class='entry-highlight'><?php echo $created_by; ?></span>
    on
    <span class='entry-highlight'><?php echo $publish_date; ?></span>
</div>

//END LOOP

Now I was thinking to link the '$created_by' output to a page which lists the news items written by that user. For example, say 'Sam' is the author, how does this work in PW?

site.com/news
site.com/news/sam/ << something like this?

Not sure how to go about this. Could I use the same news-index.inc template to output this because the markup will be the same? Any hints are appreciated, thanks.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...