Problem:
This user had allowed his authors to Create there own profile pages in another CPT but wanted to link the author name of the posts that each author created to their own respective profiles.
Solution:
This can be easily done if the Post Title of the Authors profile page was created with just there name. This will mean that the author's profile page will be generated with a link containing their name.
So lets say i'm viewing this page.
@https://someurl.nl/training/compassietraining/ <- post that the author created
When I click on the image it should link me to the profile of that trainer here :
@https://someurl.nl/trainer/Marijke-van-Duinhoven/ <- Author's profile page
So in order to achieve I created this custom shortcode to add a hypen between the trainers name and added it to the functions.php file.
// Add Shortcode function add_dash( $atts ) { // Attributes $atts = shortcode_atts( array( 'author' => '', ), $atts ); $result = str_replace(" ", "-", $atts['author']); return $result ; } add_shortcode( 'add_dash', 'add_dash' );
Next wrap your author name in a link and passed the author shortcode into my custom shortcode.
This will result in a final code added to the page like this.
[php]Please let me know if this helps.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
This topic contains 5 replies, has 2 voices.
Last updated by 6 years, 10 months ago.
Assisted by: Shane.