Viewing 19 posts - 1 through 19 (of 19 total)
  • Author
    Posts
  • #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.

    #831552

    I 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

    #831975

    Hi,

    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,
    Ismael

    #832154

    Can 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?

    #832414

    Ismael,
    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…

    #834151

    Hi,

    I’m sorry for the late response. We modified our last response a bit. Please try it again.

    Best regards,
    Ismael

    #834341

    Ismael,
    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, 3 months ago by calvinator.
    #834376

    Ismael,

    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

    #836217

    Hi,

    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,
    Ismael

    #836433

    Thanks Ismael,

    The info you requested was posted in Private Content.

    Thanks,
    calvinator

    • This reply was modified 7 years, 3 months ago by calvinator.
    #836861

    Hi,

    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,
    Ismaelqr

    #836978

    Ismael,

    Thank you very much. You have been a great help. This is exactly what I was trying to achieve.

    Calvinator

    #837325

    Hi 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,
    Rikard

    #911112

    I 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.

    #911503

    Hi,

    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,
    Ismael

    #1009557

    Ismael,
    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….

    #1009754

    Hi,

    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,
    Ismael

    #1009860

    Perfect, thanks Ismael.

    #1010239

    Hi,

    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

Viewing 19 posts - 1 through 19 (of 19 total)
  • The topic ‘Add author to blog grid layout’ is closed to new replies.