0

Let's say I want to write an article that happens to talk about someone.

I want my readers to be able to click on the name of this person and see all the articles that had his name in.

Eventually I'd like to add the company or organization they work with so that we also have a link to the company with the articles talking about them / with them.

What will be the best way to achieve that ?

I thought about personalized fields but it's been a while since I touched Wordpress so maybe there is a simpler solution ?

2
  • Questions like this are really tough to answer because they're so open ended - how do you accept one if the answers are subjective? Anyway, the easiest way I could think of is to start adding the names as 'tags', so a post about Matt Mullenweg is tagged with his name and then when you put the name into the post you link it to the tag archive for the tag that matches his name yourdomain.com/tags/matt-mullenweg or whatever your permalink structure is like. No need to re-invent WordPress taxonomies when they were designed to do exactly what you're looking for. – Tony Djukic Nov 29 '20 at 3:34
  • That's a very great answer nevertheless, better than the author solution ! I'll try that, thank you. – Mikaleb Nov 29 '20 at 6:45
0

You can add this to your single

the_author_posts_link();

But, you can use plugin for author box if you want to do it more simple and had more options like put the social links, website links, even the gravatar.

and for the author page, it will use this template.

  1. author-{nicename}.php - If the author's nice name were rami, WordPress would look for 2. author-rami.php.
  2. author-{id}.php - If the author's ID were 6, WordPress would look for author-6.php.
  3. author.php
  4. archive.php
  5. index.php

this is the sample of author template

<?php get_header(); ?>

<div id="content" class="narrowcolumn">

<!-- This sets the $curauth variable -->

    <?php
    $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
    ?>

    <h2>About: <?php echo $curauth->nickname; ?></h2>
    <dl>
        <dt>Website</dt>
        <dd><a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></dd>
        <dt>Profile</dt>
        <dd><?php echo $curauth->user_description; ?></dd>
    </dl>

    <h2>Posts by <?php echo $curauth->nickname; ?>:</h2>

    <ul>
<!-- The Loop -->

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
        <li>
            <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
            <?php the_title(); ?></a>,
            <?php the_time('d M Y'); ?> in <?php the_category('&');?>
        </li>

    <?php endwhile; else: ?>
        <p><?php _e('No posts by this author.'); ?></p>

    <?php endif; ?>

<!-- End Loop -->

    </ul>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

source:

https://codex.wordpress.org/Author_Templates

3
  • The author ? But the author section won't just show the author of the article, not have the possibilities to create a special page for a personality? – Mikaleb Nov 28 '20 at 10:34
  • Maybe I was not clear, let's say I write an article about Pewdiepie, on the word Pewdiepie I want to add a link like"website/person/pewdiepie" with a little bio and the list of article where is in. – Mikaleb Nov 28 '20 at 10:35
  • yes, the author will be author.php it will be website/author/user check this plugin for example Simple Author Box the author.php will show the author's posts. – Tiyo Nov 28 '20 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.