Site logo

Archived topic

Author Archive Description - Author Links Missing- How to fix?

3 replies · Started by Melissa on September 29, 2021

Viewing posts 1–4 of 4

In the generatepress theme, the author description is pulled and displays on the archive pages. So when you click on the author name, their user bio is displayed.

This function is called from the following file:

inc/structure/archives.php line # 107-109:


	if ( get_the_author_meta( 'description' ) && is_author() ) {
		echo '<div class="author-info">' . get_the_author_meta( 'description' ) . '</div>';  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
	}

I want to add a line directly under the description that pulls the Author Contact Info (all the social links they've entered in their UserProfile Page).

I do not use blocks on my site, I use classic editor.

What do I add under this line to achieve this?

I have tried:

echo '<div class="author-info">' . get_the_author_meta( 'user_url' ) . '</div>';

but that's not a usable link, nor does it show the other icons for FB/Twitter/Instagram/YT etc

I have also tried adding them with a hook (generate_after_archive_title) and the icons display, but they're not pulling the author's links- the links are broken because I don't know the correct syntax to pull the information.

<a href="' . $user_facebook .'" target="_blank" rel="nofollow"><svg height="20" viewBox="0 0 48 48" width="20" fill="#4267B2" xmlns="http://www.w3.org/2000/svg"><path d="m27.3303691 44h-8.8883949v-18.8883948h-4.4419742v-7.2765674h4.4419742v-4.3686083c0-5.93374831 2.5077812-9.4664295 9.6309471-9.4664295h5.9337483v7.2787906h-3.7060916c-2.7745664 0-2.9590929 1.0182303-2.9590929 2.9146287l-.011116 3.6416185h6.7185415l-.7870164 7.2765674h-5.9315251z" fill-rule="evenodd"/></svg></a> <a href="' . $user_twitter .'" target="_blank" rel="nofollow"><svg height="24" viewBox="0 0 48 48" width="24" fill="#1DA1F2" xmlns="http://www.w3.org/2000/svg"><path d="m46 10.2625813c-1.6182207.7220984-3.358458 1.210165-5.184707 1.4321953 1.8642542-1.1261536 3.2944492-2.90639637 3.9685412-5.02868577-1.7462382 1.04214211-3.6745011 1.79824522-5.7327818 2.20430059-1.6462245-1.76624085-3.9905441-2.87039142-6.5888985-2.87039142-4.98668 0-9.027231 4.0705551-9.027231 9.0892394 0 .7140974.080011 1.4061918.234032 2.0722826-7.5010229-.3780515-14.15393012-3.996545-18.60453702-9.49529479-.77810611 1.34018275-1.22216666 2.90239579-1.22216666 4.56862299 0 3.1524299 1.59421739 5.9348093 4.01454743 7.5630313-1.48020184-.0480065-2.87039141-.4560622-4.08855753-1.1361549v.1160158c0 4.4026004 3.11042415 8.0751012 7.24298768 8.9112152-.7581034.2060281-1.55421193.3200436-2.37832431.3200436-.58207938 0-1.14815657-.0580079-1.69823158-.1660226 1.14815657 3.6104923 4.48261129 6.2388507 8.43114969 6.3128608-3.0884211 2.4383325-6.98095194 3.8905306-11.21152883 3.8905306-.72809929 0-1.44819748-.044006-2.15429377-.1260172 3.99454471 2.5783516 8.7391917 4.0825567 13.837887 4.0825567 16.6042642 0 25.6835023-13.8498886 25.6835023-25.8595263 0-.3940537-.0100014-.7841069-.0260036-1.1741601 1.7642406-1.2821749 3.2944493-2.8823931 4.5046143-4.7046416z" fill-rule="evenodd"/></svg></a> <a href="' . $user_pinterest .'" target="_blank" rel="nofollow"><svg height="24" viewBox="0 0 48 48" width="24" fill="#E60023" xmlns="http://www.w3.org/2000/svg"><path d="m21.5273456 30.4552531c-1.1118822 5.5053449-2.4682375 10.7850224-6.4855878 13.5447469-1.2411708-8.323837 1.8217943-14.5743545 3.2439692-21.2103872-2.4235741-3.8598532.2914871-11.624223 5.4042647-9.7107513 6.2904795 2.353053-5.448928 14.3439856 2.4329769 15.8437337 8.2274582 1.5632171 11.5866118-13.5000835 6.4855878-18.3989472-7.3718026-7.07326331-21.4619124-.1621984-19.7294447 9.9646272.4231264 2.4776403 3.1264341 3.2275143 1.081323 6.6454355-4.71785955-.9896456-6.12828095-4.508647-5.94492617-9.2006489.29148709-7.6773938 7.29658007-13.05345008 14.32282937-13.79862273 8.8856548-.94028093 17.2259467 3.08647217 18.3777908 10.98953343 1.295237 8.9209154-4.0102982 18.582302-13.5141877 17.8864941-2.5740191-.1904069-3.6553421-1.3963172-5.6745954-2.5552135" fill-rule="evenodd"/></svg></a> <a href="' . $user_instagram .'" target="_blank" rel="nofollow"><svg height="24" viewBox="0 0 48 48" width="24" fill="#833AB4" xmlns="http://www.w3.org/2000/svg"><path d="m31.9591786 4c6.6394276 0 12.0408214 5.26122862 12.0408214 11.7279466v16.5441068c0 6.4668388-5.4013938 11.7279466-12.0408214 11.7279466h-15.9182332c-6.63942762 0-12.0409454-5.2611078-12.0409454-11.7279466v-16.5441068c0-6.46671798 5.40151778-11.7279466 12.0409454-11.7279466zm7.6928228 28.2720534v-16.5441068c0-4.1315881-3.4509697-7.49285141-7.6928228-7.49285141h-15.9182332c-4.2418531 0-7.69282279 3.36126331-7.69282279 7.49285141v16.5441068c0 4.1315881 3.45096969 7.4928514 7.69282279 7.4928514h15.9182332c4.2418531 0 7.6928228-3.3612633 7.6928228-7.4928514zm-15.5744383-19.4380664c3.5180547.1000046 6.4521849 1.2699851 8.4849462 3.3837282 1.9316998 2.008545 2.91615 4.700696 2.847081 7.7851352-.066341 2.9544816-1.2643222 5.7223606-3.3730966 7.7937104-2.1422548 2.1043224-4.9962799 3.2633121-8.0364317 3.2633121-6.2914786 0-11.4100243-4.9854915-11.4100243-11.1135468 0-6.2362728 5.1788106-11.2920573 11.4875254-11.1123391zm6.0187987 11.0558148c.0266604-1.1878558-.1967908-2.8693329-1.4125044-4.1333998-1.043351-1.0849525-2.6897227-1.6894485-4.7612965-1.7483884-.0558008-.0015701-.1112296-.0022947-.1665344-.0022947-1.5429542 0-3.0028273.6166946-4.1109072 1.7364313-1.1224642 1.1344716-1.7407371 2.6275344-1.7407371 4.2041759 0 3.2738197 2.7344874 5.9372254 6.0956798 5.9372254 3.3430881 0 6.0210307-2.6327279 6.0962998-5.9937497zm4.6846386-12.8765373c1.3559596 0 2.4551114 1.0705799 2.4551114 2.3912919 0 1.3205912-1.0991518 2.3911711-2.4551114 2.3911711-1.3559595 0-2.4551113-1.0705799-2.4551113-2.3911711 0-1.320712 1.0991518-2.3912919 2.4551113-2.3912919z" fill-rule="evenodd"/></svg></a> <a href="' . $user_website .'" target="_blank" rel="nofollow"><svg width="24" height="24" viewBox="0 0 24 24" stroke="#212b36" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"><circle cx="12" cy="12" r="9" /><path d="M12,3 C 8,3 8,21 12,21 C 16,21 16,3 12,3"/><path d="M3,12 C 3,8 21,8 21,12 C 21,16 3,16 3,12"/></svg></a>

Any ideas would be great, this is driving me crazy.

Hi Melissa,

I think you're right in hooking the elements but you should definite the variables for $user_facebook, $user_pinterest, $user_instagram, etc.

Can you share the exact code you've hooked?

Perhaps I can help you out in correcting some things like fetching the correct values.

Or If I may suggest, consider doing a var_dump( get_the_author_meta( ) ); on an author's archive page to see the author's meta values. This way you'll know what the slugs are for fetching things. :D

Thank you, If finally figured it out & tried to update my post yesterday (but couldn't login, It kept reloading the login page in a loop), I got it by looking at fields in the php template to see what they were using, then added them to the urls with an if empty condition.

Nice one! Glad you got it sorted. :D

This archived topic is closed to new replies.