• Hi there,

    I am trying to add photo credits to featured images. I added the Unique ID’s on plugin settings, and added the code snippet to my content-single.php file (which I renamed content-credit to test it out), but I get this error:

    Warning: Missing argument 2 for thisismyurl_has_custom_media_field(), called in /nfs/c03/h06/mnt/168254/domains/spoonuniversity.com/html/wp-content/themes/newstrick-child/content-credit.php on line 74 and defined in /nfs/c03/h06/mnt/168254/domains/spoonuniversity.com/html/wp-content/plugins/add-custom-fields-to-media/add-custom-fields-to-media.php on line 52

    The code on my content-single.php looks like this:

    <div class="meta-posted-by muted-small" style="border-top: 3px solid <?php echo $cat_color; ?>;">
    		        			<?php _e('Posted by ','color-theme-framework'); echo the_author_posts_link(); ?>
    		        			<meta itemprop="author" content="<?php echo get_the_author_meta( 'nickname' ); ?>">
    							<?php
    
    							if ( thisismyurl_has_custom_media_field() ) {
    
    							  $credit_name = thisismyurl_get_custom_media_field( get_post_thumbnail_id( $post->ID ), 'credit_name' );
    							  $credit_url = thisismyurl_get_custom_media_field( get_post_thumbnail_id( $post->ID ), 'credit_url' );
    
    							  if ( empty( $credit_name ) )
    							    $credit_name = $credit_url;
    
    							  if ( !empty( $credit_url ) )
    							    $credit_text = '' . $credit_name . '';
    							  else
    							    $credit_text = $credit_name;
    
    							  $credit_text = '
    
    							  ' . $credit_text . '
    							  ';
    
    							  echo $credit_text;
    							} ?>

    Any idea why I’m getting this error?

    Thanks so much for your help!

    http://wordpress.org/plugins/add-custom-fields-to-media/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP Error when adding credit to featured image’ is closed to new replies.