How to add credits to external news contributors to wordpress

Adding credits to external news contributors in WordPress can be done in a few ways. Here are a few methods:

Method 1: Using the author meta field

You can add a custom meta field to your WordPress posts to store the contributor's name or credit information. Here's how:

  1. Install and activate the Advanced Custom Fields (ACF) plugin.
  2. Create a new field group and add a text field with the label "Contributor Credit".
  3. Add the field to your post type (e.g., "News" or "Article").
  4. When adding a new post, fill in the contributor credit information in the custom field.
  5. In your theme, you can then display the contributor credit using the get_field function, like this: <?php echo get_field('contributor_credit');?>

Method 2: Using a plugin

There are several plugins available that can help you add credits to external news contributors, such as:

  1. Contributor Credits: This plugin allows you to add credits to your posts and display them in a customizable format.
  2. Author Credits: This plugin adds a custom meta field for author credits and allows you to display them in your theme.
  3. News Credits: This plugin is specifically designed for news websites and allows you to add credits to your articles.

Method 3: Using a custom function

You can also add a custom function to your theme's functions.php file to display the contributor credit. Here's an example:

function display_contributor_credit($post_id) {
  $contributor_credit = get_post_meta($post_id, 'contributor_credit', true);
  if ($contributor_credit) {
    echo '<p>Contributor Credit: '. $contributor_credit. '</p>';
  }
}
add_action('the_content', 'display_contributor_credit');

This function retrieves the contributor credit from the post meta field and displays it at the end of the post content.

Method 4: Using a shortcode

You can also create a custom shortcode to display the contributor credit. Here's an example:

function contributor_credit_shortcode() {
  $contributor_credit = get_post_meta(get_the_ID(), 'contributor_credit', true);
  if ($contributor_credit) {
    return '<p>Contributor Credit: '. $contributor_credit. '</p>';
  }
}
add_shortcode('contributor_credit', 'contributor_credit_shortcode');

This shortcode retrieves the contributor credit from the post meta field and displays it. You can then use the shortcode in your theme files or in the post editor.

These are just a few methods to add credits to external news contributors in WordPress. You can choose the method that best fits your needs.