-
AuthorPosts
-
January 2, 2024 at 6:41 pm #1429146
Hello all
We are pretty sure we are not the only onlinemagazine that has different authors and photographers in the same post. Yes, we could add both as “authors” and somehow change the authorline (no clue where) to “Bericht / Bilder: Author 1, Author 2”. But that way it looks like both people wrote the text and provided pictures.
I did not find any plugins where I could set the “jobtitel” of somebody “meaning “Author 1 (Journalist), Author 2 (Photographer)” or something like that to solve it. I found some plugins where I can add more than one author, but writing and taking pictures isn’t the same :)
I actually made an advanced custom field for the photographer, but ACF is complicated and I could not figure out, where I would have to put the code within enfold to show them within the post. The documentary on afc mentions to put some code within a html-site, but enfold/wordpress is all php, so I am at a loss. Let alone get the custom field into the “authors page” of the photographer too, so the posts will show up on his page too 8-/.
The coolest thing would be, if I could change the appearance of publishing date with author-line and afc-field. Something like “Published January 2nd 2024 | Text: Author 1 | Bilder: Author 2” (Author 2 would be the afc-field). And absolute gold would be if we could make it to look something like this: https://imgur.com/vxMeUzh
Open for any hints how to change the author line and get the afc-field into that line. And if somebody had a similar issue on how to integrate afc-fields into enfold… thanks for the links :)
January 3, 2024 at 12:27 pm #1429179Hey Michelle,
Recently another user was using the Co-Authors Plus plugin which allows multiple authors to be assigned to a post.
Then they used this snippet:add_filter( 'the_author_posts_link', function( $markup ) { if ( ! function_exists( 'coauthors_posts_links' ) ) { return $markup; } ob_start(); coauthors_posts_links(); $output = ob_get_contents(); ob_end_clean(); return $output; } );
to display the authors on the frontend:
The plugin has a Github page with code snippets that I believe you may be able to get the author image to show also, but you will need to do some testing. We are limited to the support we can provide for third party plugins, and I don’t use the ACF plugin so I can’t offer guidance with it, but I’m pretty sure that you could achieve what you want with ACF and a function snippet in your child theme functions.php
Try looking on Upwork for a ACF expert, you could probably get it done fairly cheaply.Best regards,
MikeMay 20, 2024 at 8:57 pm #1444807yeah no, that is not what I am looking for. I don’t want to have a line with multiple authors, I want to specifically show, who did what in the article. Meaning: someone wrote it (author) and someone made the pictures (photographer). The person that provides the pictures is not an author, so this is why I don’t want to add the name as a 2nd author and confuse people thinking, they both wrote on that piece.
besides… I asked ACF and they said the don’t know where to put their code, because it is your template not theirs, so I would have to ask you guys where to put it in the template. Looks like I really have to put it as a textline in every article and link to the photographers teampage (where the article won’t be listet… this is so sad tbh)
May 20, 2024 at 9:01 pm #1444813so if I would want to place this code in the functions.php of a child-theme:
$value = get_field( "photographer" ); if( $value ) { echo wp_kses_post( $value ); } else { echo 'empty'; }
where would I have to put it in functions.php to be next to the author of a post? and why in functions.php if it should show up in every post?
May 21, 2024 at 4:07 am #1444850Hi,
Thank you for the inquiry.
Which blog layout did you select? If the default blog layout is active, you can edit the enfold/includes/loop-index.php and place the suggested code around line 293.
echo apply_filters( 'avf_loop_index_blog_meta', $blog_meta_output );
You can also use the avf_loop_index_blog_meta filter in the functions.php file to insert additional info in the meta info container:
Example:
add_filter("avf_loop_index_blog_meta", function ($output) { $photographer = get_field("photographer"); if ($photographer) { $outlet_output = '<span class="photographer minor-meta">' . __('Photographer:', 'avia_framework') . ' '; $outlet_output .= wp_kses_post($photographer); $outlet_output .= '</span><span class="text-sep text-sep-cat">/</span>'; } return $outlet_output . $output; }, 10, 1);
Best regards,
IsmaelMay 22, 2024 at 1:09 pm #1445160Thanks so much, Ismael! I use the “Elegant” blog-style with rastered layout, not the standard one. But this gives me an idea where to look :) And if I have a child theme, I’d copy the according php-file into the child-folder and put the code in that copy, right? I will give this a try on the weekend!
And thanks for the 2nd idea to put it in the functions.php, either one of them will be my solution :-)
May 22, 2024 at 5:07 pm #1445192 -
AuthorPosts
- You must be logged in to reply to this topic.