Join the Soledad Facebook Users Group here
for Share, assistance, discussion, and Updates related to Soledad WordPress Theme.

If you can't create a new ticket - you can send us an email via our contact form and we will get back to you.

Okay
  Public Ticket #1556412
Customizing the Byline
Closed

Comments

  • punkrot started the conversation

    I'm building a site where text and photos are often provided by different people. I want to make it so that the post meta section says, "text by Person X | photos by Person Y."

    What's the best way to do that?

    Thanks,
    —Peter

  •  2,699
    PenciDesign replied

    Hi,

    Unfortunately, if you want to do that, you need to hire a web developer to help you. As I knew, no any wordpress theme on Envato supports this feature from itself.


    Best Regards,

    PenciDesign

  • punkrot replied

    I am a web developer, I just don't know which file to copy over into the child theme. Any tips would be greatly appreciated. I can create custom fields, but I'm not sure which theme file is outputting the metadata at the top of each post.

  •  2,699
    PenciDesign replied

    Hi,

    For single post page:

    1/ You can copy content-single.php ( style 1 ) or content-single-full.php ( for style 2 )

    2/ For posts layouts, it's based on the layout you're using. Example: If you're using layout Grid, let's check it via content-grid.php


    Best Regards,

    PenciDesign 

  • punkrot replied

    Never mind, I figured it out myself.

    For anyone else who's interested in this mod, you'll need to get freaky with the PHP in content-single-full.php — or at least that's the one that did it for me based on my theme settings. Other files you may need to putz around with include content-single.php, content-standard.php, and/or content-classic.php.

    You're looking for the <span> labeled with the class "author-post." Pulling up a custom field requires the following code:

    <?php echo get_post_meta($post->ID, 'key', true); ?>

    Where key = the name of your custom field.

    Depending on how deep you want to go with built-in WP functions and whatnot, you can create some fairly elegant solutions using this as a springboard. If I come up with something slick, I'll post it here for other folks.

    And for the record, not thrilled with the support from PenciDesign on this. "You'll need to hire a developer." Yeah, thanks.

  • punkrot replied

    This pretty much does the trick. Add a custom field named image_credit (value = the photographer's name) if you want to list an unlinked name, and image_credit_id (value = user ID) if you want to have the author's name linked to their author archive.

    *****

    <span class="image-credits">

    <?php
    $imageCredit = get_post_meta($post->ID, 'image_credit', true);
    $imageCreditId = get_post_meta($post->ID, 'image_credit_id', true);

    if ($imageCreditId) { ?>
         | images by <a class="author-url" href="<?php echo get_author_posts_url( $imageCreditId ); ?>">
        <?php echo get_the_author_meta('display_name', 1); ?>

    <?php
    } elseif ($imageCredit) { ?>
         | images by <?php echo $imageCredit; ?>
    }

    <?php } else { // do nothing; }
    ?>
    </span>

    *****

    If you want to link posts to the photographer, you'll need to use the Co-Authors Plus plugin. And actually, if you use it instead of the hocus-pocus above, you can just use this code snippet:

    <span class="author-post">
        <?php coauthors_posts_links(' and ', ' | images by ', 'written by ', '', true); ?>
    </span>

    If you go this route, just make sure that the photographer is the last person on the author's list.