WordPress.org

Ready to get started?Download WordPress

Forums

JM Twitter Cards
[resolved] Manual Authors (13 posts)

  1. xXZ3R0x
    Member
    Posted 1 year ago #

    Is it possible to add the ability to write in an authors twitter per post manually?

    http://wordpress.org/extend/plugins/jm-twitter-cards/

  2. tweetpressfr
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. xXZ3R0x
    Member
    Posted 1 year ago #

    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.

  4. tweetpressfr
    Member
    Plugin Author

    Posted 1 year ago #

    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?

  5. tweetpressfr
    Member
    Plugin Author

    Posted 1 year ago #

    sorry wrong bb codes

  6. tweetpressfr
    Member
    Plugin Author

    Posted 1 year ago #

    sorry wrong bbcode

  7. tweetpressfr
    Member
    Plugin Author

    Posted 1 year ago #

    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'] ) );
    }
  8. xXZ3R0x
    Member
    Posted 1 year ago #

    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.

  9. tweetpressfr
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  10. xXZ3R0x
    Member
    Posted 1 year ago #

    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?

  11. tweetpressfr
    Member
    Plugin Author

    Posted 1 year ago #

    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. :)

  12. xXZ3R0x
    Member
    Posted 1 year ago #

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

  13. tweetpressfr
    Member
    Plugin Author

    Posted 1 year ago #

    My pleasure :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.