You can see the ‘Latest contributors’ (our term of authors) div I am trying to make dynamic here: https://verbsandpixels.com/
Thanks for your help,
]]>I’m trying to add a filter on get_the_author_link or the_author_link.
This is the function from author-template.php :
function get_the_author_link() {
if ( get_the_author_meta('url') ) {
return '<a href="' . get_the_author_meta('url') . '" title="' . esc_attr( sprintf(__("Visit %s’s website"), get_the_author()) ) . '" rel="external">' . get_the_author() . '</a>';
} else {
return get_the_author();
}
}
if get_the_author_meta(‘url’) is empty, only the author name will be returned.
I want to add a filter to add another link. Function like this :
function my_get_the_author_link() {
if ( get_the_author_meta('url') ) {
return '<a href="' . get_the_author_meta('url') . '" title="' . esc_attr( sprintf(__("Visit %s’s website"), get_the_author()) ) . '" rel="author">' . get_the_author() . '</a>';
} else {
return '<a href="' . home_url() . '/author/. get_the_author_meta('ID') . " title="' . esc_attr( sprintf(__("Visit %s’s website"), get_the_author()) ) . '" rel="author">' . get_the_author() . '</a>';
}
}
So i NEED to filter this function, because i need to modify too the “rel” microformat oncluded in the A tag.
Thank you
The obvious way to do this, I figured, would be to filter on “the_author_link,” and change the link.
However, there does not seem to be a hook for “the_author_link,” – there seems to only be a hook for “the_author.”
This works, in that I can filter on “the_author,” and wrap the author name in a link, and it links to where I want.
However, what’s really going on is this:
<a href='the original the_author_link_url'>
<a href='my new URL'>Author's Name</a>
</a>
A link inside a link is not valid markup. Thus, while my plugin will work and behave the way I want if I use this method, I cannot make it valid HTML, XHTML, or anything.
My question, then, is twofold:
1. Is there, or is there not, a hook to add_filter on ‘the_author_link’?
2. If there is no such hook, how do I go about correctly implementing a change to the behavior of the_author_link(); ?
Thank you for your time.
]]>I’m using the code inside the loop.
<?php the_author_link(); ?>
thanks.
]]>This is the code I’m using:
<?php if ( get_post_meta($post->ID, 'profile', true) ) { ?>
<div class="profile_img_home"><a href="<?php the_author_link(); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/profile/<?php echo get_post_meta($post->ID, "profile", $single = true); ?>" alt="<?php the_author(); ?>" /></a></div>
<?php } ?>
To see what happens with the link, please just look at my home page where I have it applied. To the right of the post title, I have the images I’m trying to make a link, which sends you to the website the post author has specified in their profile. For some reason, this link doesn’t wrap around the image and when you hover the link, it tells you that it will take you to: https://think-theory.com/<a href=
Not sure what’s going on here. Any help is greatly appreciated.
]]><?php if ( get_post_meta($post->ID, 'profile', true) ) { ?>
<div class="profile_img_home"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/profile/<?php echo get_post_meta($post->ID, "profile", $single = true); ?>" alt="<?php the_author(); ?>" /></div>
<?php } ?>
Basically, they go down into the custom fields section and enter in the last portion of the image location (i.e. michael.gif) and the iamge will be put in the post if they’ve entered that bit.
What I’m wondering, is how do I work this code with the_author_link? Do I put the code above in the brackets of the code following:
<?php the_author_link(); ?>
Any help is greatly appreciated.
]]>I foun something similar but they link to original site but not to original page
<p>Written by:
<?php the_author_link(); ?></p>
<p>Original Article:
<?php the_author_url(); ?></p>
Furthermore there is a problems with the url lenght.
As you can see on this page https://www.emanualmedicine.com/articles/index.php/category/products/
the link to Original Article is incomplete: https://www.amazon.com/tag/massage/products/ref=tag_rso_rs_istp_chanlink?sort=relevant&tag=emanua
https://www.amazon.com/tag/myofascial%20pain/products/ref=tag_rsn_rs_istp_chanlink?sort=recent&ta
https://www.amazon.com/tag/rehabilitation/products/ref=tag_rso_rs_istp_chanlink?sort=relevant&tag
Any help is very much appreciated
Regards
]]>