Viewing 12 replies - 1 through 12 (of 12 total)
  • Anonymous User 10765487

    (@anonymized-10765487)

    Hi, there is already an option for multi-author :
    Options page > Custom Twitter Cards > Add a field Twitter to profiles > yes.

    Then every single author can add his own Twitter Account as meta creator for his article.

    Thread Starter xXZ3R0x

    (@xxz3r0x)

    I do not want the user to have to register. I want to be able to write in the author. Perhaps using a custom field.

    Anonymous User 10765487

    (@anonymized-10765487)

    OK I see you want a field in edit post. I can show you how to do that but you’ll have to add this by yourself. Can you do this?

    Anonymous User 10765487

    (@anonymized-10765487)

    sorry wrong bb codes

    Anonymous User 10765487

    (@anonymized-10765487)

    sorry wrong bbcode

    Anonymous User 10765487

    (@anonymized-10765487)

    Sorry their bbcodes are a little be tricky here !
    Open jm-twitter-cards.php, add this line 58 :

    //we add a new post meta to our post
    $creator = get_post_meta(get_the_ID(),'twitterCreator',true);

    then add this line 71:

    <?php //this is the markup for new field ?>
    <p>
    <label for="twitterCreator"><?php _e('Enter your Personal Twitter account', 'jm-tc'); ?> :</label>
    @<input id="twitterCreator" type="text" name="twitterCreator" class="regular-text" value="<?php echo esc_attr($creator); ?>" />
    </p>

    and last replace code on line 96 to 98 with this code :

    // here you update value
    if( isset( $_POST['twitterCardType'] , $_POST['twitterCreator'] ) )
    update_post_meta( $post_id, 'twitterCardType', esc_attr( $_POST['twitterCardType'] ) );
    update_post_meta( $post_id, 'twitterCreator', esc_attr( $_POST['twitterCreator'] ) );
    }

    Thread Starter xXZ3R0x

    (@xxz3r0x)

    Wow, finally a dev on here that actually responds, and with a solution too!
    But, the creator field is being over written. I can change the type but the creator is still being set to the account that is posting.

    Anonymous User 10765487

    (@anonymized-10765487)

    oO
    Hi, I’ve tested this code before. It adds a field and when input is fulfilled and post saved the meta creator is changed.

    This is what you asked me for. I don’t understand.

    Thread Starter xXZ3R0x

    (@xxz3r0x)

    I know, the form displays but the new creator is not being changed. The twitter:creator meta is still the user that is logged in, not the one i put in manually. Any idea why this happens?

    Anonymous User 10765487

    (@anonymized-10765487)

    probably because I forgot to mention line 162. You have to replace this line :

    //content from the field in user profile
    $creator   = get_the_author_meta('twitter', $post->post_author);

    with this line :

    // grab post meta from our new custom field
    $creator = get_post_meta(get_the_ID(),'twitterCreator',true);

    It should fix the problem. ??

    Thread Starter xXZ3R0x

    (@xxz3r0x)

    YES! There it is. This is awesome functionality. Thanks so much.

    Anonymous User 10765487

    (@anonymized-10765487)

    My pleasure ??

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Manual Authors’ is closed to new replies.