• Resolved fmustang

    (@fmustang)


    Sorry if my question seems stupid but I am new to WordPress and couldn’t perform a search related with my question.
    The blog from www.ads-software.com is displaying the name of the article author with a link to their website. I have been searching my own website to do the same thing but didn’t find anything. Do I have to install a plug in or do I have to modify the theme?
    Thank you in advance.
    My website: Ford Mustang blogs

Viewing 7 replies - 1 through 7 (of 7 total)
  • MichaelH

    (@michaelh)

    The Codex article Template_Tags/the_author_url has an example of creating a link to an author’s web-site.

    Other information:
    Templates
    Category:Template_Tags
    Category:Templates

    viper007bond

    (@viper007bond)

    Modify the theme. Replace <?php the_author() ?> with this:

    <?php if (get_the_author()) { ?><a href="<?php the_author_url(); ?>"><?php the_author(); ?></a><?php } else { the_author(); } ?>

    Thread Starter fmustang

    (@fmustang)

    Thank you very much for your help. I got it working in 2mn ??

    viper007bond

    (@viper007bond)

    Er, sorry, my code should be this:

    <?php if (get_the_author_url()) { ?><a href="<?php the_author_url(); ?>"><?php the_author(); ?></a><?php } else { the_author(); } ?>

    Thread Starter fmustang

    (@fmustang)

    I replaced the code but didn’t see any diference on my pages. Can you tell me what was wrong with the first one?

    MichaelH

    (@michaelh)

    Actually, as long as you had an author name and a website (url) then you wouldn’t see a difference. But, the 2nd example is more correct as Viper007Bond is testing to see if there is a url before he actually puts it in a link otherwise it just defaults to displaying the author name without a link.

    Thread Starter fmustang

    (@fmustang)

    Thanks a lot Michael for your help.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Link displayed with author’s name’ is closed to new replies.