-
AuthorPosts
-
July 26, 2017 at 5:23 pm #830266
I’m trying find a way to add the author meta to the blog grid layout so the author’s name will appear after the post date, in a child theme of Enfold.
Example: July 18, 2017 / By Author Name
I’ve searched the forum and can’t seem to find anything that is relevant, or up to date. I found one that said to find code in postslider.php and change it to the code they recommended. The problem with that was, the line of code they said to find started with $output, and the line of code in the current version of Enfold started with $meta, with the rest being identical with the exception of a bit at the end of the recommended code.
I created the folder structure in my child theme and copied postslider.php to there and made the edits but it didn’t work.
Any advice would be greatly appreciated.
July 29, 2017 at 6:06 pm #831552I would like some advice on the same issue please. I am also looking for answers on how to add postslider.php to my child theme. Putting it in the same folder structure is not working for me either, but editing it in the parent theme does work.
How do you add postslider.php to the child theme to avoid overwrites at a later date?
Thanks
July 31, 2017 at 7:19 am #831975Hi,
Thank you for using Enfold.
This is possible but you have to modify one of the parent theme files. Edit the config-templatebuilder > avia-shortcodes > postslider.php file, look for this code around line 498:
$meta .= "<time class='slide-meta-time updated' $markup>" .get_the_time(get_option('date_format'), $the_id)."</time>";
Below, add the following code.
$author = get_the_author_meta( 'display_name', $entry->post_author ); $author_link = get_author_posts_url( $entry->post_author ); if(!empty($author)) { $meta .= '<div class="slide-meta-del">/</div><span class="blog-author minor-meta">'; $meta .= '<a href="'.$author_link.'">'.$author.'</a>'; $meta .= '</span>'; }
Best regards,
IsmaelJuly 31, 2017 at 2:49 pm #832154Can config-templatebuilder > avia-shortcodes > postslider.php be copied to the child theme, before it is modified, so it isn’t possible for the code to get overwritten when the Enfold theme is updated?
July 31, 2017 at 9:06 pm #832414Ismael,
In config-templatebuilder>avia-shortcodes>postslider.php, in the main Enfold theme folder, I found the code you said to find, which was at line 418 in Enfold version 4.0.7, and inserted the code you recommend below. The code does not work. I cleared the page cache and did a Ctrl+F5 to refresh my browser and still, nothing.
Any ideas as to why this didn’t work?
Thanks…August 4, 2017 at 5:19 am #834151Hi,
I’m sorry for the late response. We modified our last response a bit. Please try it again.
Best regards,
IsmaelAugust 4, 2017 at 2:23 pm #834341Ismael,
Thank you very much. This bit of code works, however, where in the code do I add the text, “By ” so the info will be, August 4, 2017 By Author Name? I’ve tried but get errors.
Thanks…UPDATE: Thanks so much Ismael. I figured out where to insert the bit of text. Works great. I just wish it could be moved to the child theme so it won’t get overwritten on theme updates.
Calvinator
- This reply was modified 7 years, 4 months ago by calvinator.
August 4, 2017 at 4:15 pm #834376Ismael,
I stand corrected. Even though the code does put the author name on the blog grid of the main blog page, the author name is the same name for all posts on the blog grid and on every page, and not the author of each article.
It is not a clickable link either, but then I didn’t say anything about that in my original post, but it would be a good feature.
If you could help me with this I’d be eternally grateful. I know just enough about PHP to get myself in trouble.
Perhaps a feature could be added to future versions of Enfold to give the option to have the author name appear on the blog grid as a clickable link.
Thanks…
Sincerely,
Calvilnator
August 9, 2017 at 8:04 am #836217Hi,
Please post the WP and FTP details in the private field so that we can inspect it. We would like to apologize for the delay. We normally respond within 24 hours but in the wake of the latest theme update, we have received more inquiries than usual. Please be patient while we go through the rest of the queue. Thank you for your understanding.
Best regards,
IsmaelAugust 9, 2017 at 2:48 pm #836433Thanks Ismael,
The info you requested was posted in Private Content.
Thanks,
calvinator- This reply was modified 7 years, 4 months ago by calvinator.
August 10, 2017 at 9:51 am #836861Hi,
Thank you for the info.
We modified the code a bit and added a link to the users’ url. The “url” refers to the users’ “Website” field.
UPDATE: We redirected the users to the actual author url.
$author_link = get_author_posts_url( $entry->post_author );
Best regards,
IsmaelqrAugust 10, 2017 at 2:05 pm #836978Ismael,
Thank you very much. You have been a great help. This is exactly what I was trying to achieve.
Calvinator
August 11, 2017 at 7:12 am #837325Hi Calvinator,
Great, glad we could help. Please let us know if you should need any further help on the topic or if we can close it.
Best regards,
RikardFebruary 12, 2018 at 2:37 pm #911112I would love to see the meta options for the archive page be an option in Enfold Config….or at least an option to do it via function.php instead of modifying the theme files.
February 13, 2018 at 5:04 am #911503Hi,
There’s actually an option for it inside the Blog Layout panel but it’s not going to work for the grid layout. Please feel free to request – or vote if already requested – such feature on Enfold feature request form.
Best regards,
IsmaelSeptember 13, 2018 at 5:48 pm #1009557Ismael,
Is there any way you could re-post your previous code, so that the authors name links to their url in their users website field instead of the actual author url?I was hoping this would work: $author_link = get_user_url( $user );
but clearly i’ve missed something….September 14, 2018 at 2:57 am #1009754Hi,
You should be able to replace the “get_author_posts_url” with the “get_the_author_meta” function to set the user website instead of author page as link.
// https://developer.wordpress.org/reference/functions/get_the_author_meta/
$author_link = get_the_author_meta( 'user_url', $entry->post_author );
Best regards,
IsmaelSeptember 14, 2018 at 11:01 am #1009860Perfect, thanks Ismael.
September 15, 2018 at 8:19 pm #1010239Hi,
Glad we could help!
Please take a moment to review our theme and show your support https://themeforest.net/downloads
Don’t forget to bookmark Enfold Documentation for future reference.Thank you for using Enfold :)
Best regards,
Basilis -
AuthorPosts
- The topic ‘Add author to blog grid layout’ is closed to new replies.