Solved

WordPress: How do I bring in just the author name and not the author's name with a link to all their archived posts?

Posted on 2012-03-10
9
980 Views
Last Modified: 2012-03-18
I am trying to bring in a posts author without a link to all the authors archived posts so I can instead include a link to the author's google+ profile.

Here is the current code:
Posted in: <?php the_category(',');?> by <?php the_author_posts_link();?> &nbsp; | &nbsp; <?php comments_popup_link('0 Comment','1 Comment','% Comments');?>

Open in new window


Here is what I thought it would be, but the get_the_author call doesn't bring in anything.
Posted in: <?php the_category(',');?> by <a rel="author" href="https://profiles.google.com/mygoogleID" target="_blank" title="Visit my Google+ Profile"><?php get_the_author();?></a>  &nbsp; | &nbsp; <?php comments_popup_link('0 Comment','1 Comment','% Comments');?>

Open in new window


I'm also wondering if there is a way to bring in any of the other author's profile fields.
0
Comment
Question by:Jules Webb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
9 Comments
 
LVL 11

Assisted Solution

by:singleton
singleton earned 500 total points
ID: 37707015
If I am reading this correctly you are trying to generate

<a href="link1"><a href="link2">xxx</a></a>

And a link cannot contain another link

See http://codex.wordpress.org/Function_Reference/the_author_posts_link

the_author_posts_link() is located in wp-includes/author-template.php

You have not indicated which theme you are using
0
 
LVL 2

Accepted Solution

by:
Jules Webb earned 0 total points
ID: 37707652
I removed the_author_posts_link () because I don't want to link to archive of authors posts

I was hoping that get_the_author()  was only meant to only get the author as opposed to the_author_posts_link () which gets the author and creates a link to page with posts written by author.

browser renders:
Posted in: category 1 by fname lname   |   0 Comment

Category 1 will link to mysite.com/category/category-1
fname lname will be a link to google+ profile
comment will link to mysite.com/blog/post-name#respond

In the related articles section of the page you referenced I found Function Reference/the author: the_author()

I also found Function Reference/the author meta in the related articles section and was able to work out how to bring in the googl+ url dynamically by using the user website field to store the google+ profile link.

My final version that works and does everything I need it to do.
<?php the_category(',');?> by <a rel="author" href="<?php the_author_meta('user_url'); ?>" target="_blank" title="Follow <?php the_author_meta('user_firstname'); ?> on Google+"><?php the_author();?></a> &nbsp; | &nbsp; <?php comments_popup_link('0 Comment','1 Comment','% Comments');?>

Open in new window


I'm thinking about adding a user custom profile field as explained here: http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user-profile-fields
But that's another enough for now.

Thank you for pointing me in the right direction, I didn't see those related links before.

Cheers
Jules
0
 
LVL 2

Author Comment

by:Jules Webb
ID: 37707693
I've requested that this question be closed as follows:

Accepted answer: 0 points for JulesWebb's comment #37707652
Assisted answer: 500 points for singleton's comment #37707015

for the following reason:

singleton questions lead me to find my own answer, which I included so anyone else interested would know how I resolved the issue.
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 11

Expert Comment

by:singleton
ID: 37707694
That is what we are here for. I am going to object simply because it seems to indicate that the question will just be closed, but not PAQed (i.e. be a Previously Answered quesion for others to see), and you indicated you wanted others to see what you finally decided.
0
 
LVL 2

Author Comment

by:Jules Webb
ID: 37707726
Thanks singleton, I didn't understand about "PAQed" Can you tell me what action I'm suppose to take?
0
 
LVL 11

Expert Comment

by:singleton
ID: 37708019
no they just changed the software but a moderator should show up
0
 
LVL 11

Expert Comment

by:singleton
ID: 37717076
So the question will be PAQed?  That was all that was unclear to me
0

Featured Post

Stack Overflow Podcast - Frustrating Miracles

In this podcast, Stack Overflow interviewed Linux Academy CEO/Founder, Anthony James, and got his developer story!

"Follow your passion, be prepared to work hard and sacrifice, and, above all, don't let anyone limit your dreams."  - Donovan Bailey

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question