Skip to content

Commit

Permalink
Fixed PHP notice "Undefined variable: image_credit" in media-credit.p…
Browse files Browse the repository at this point in the history
…hp:177; corrected some minor indentation inconsistencies; removed unused $total variable.
  • Loading branch information
sblomberg committed Apr 17, 2017
1 parent b5904ec commit 0e0de64
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions media-credit.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,12 @@ function the_media_credit( $attachment_id ) {
*/
if ( ! function_exists( 'the_plain_media_credit' ) ) {
function the_plain_media_credit( $attachment_id ) {

$image_credit = '';

if ( have_rows( 'media_credit', $attachment_id ) ) :

$image_credit = '';
$i = 1;
$total = count( get_field( 'media_credit', $attachment_id ) );

while ( have_rows( 'media_credit', $attachment_id ) ) : the_row();

Expand All @@ -166,13 +167,13 @@ function the_plain_media_credit( $attachment_id ) {
$image_credit .= '';
$i++;

endwhile;
endwhile;

$image_credit .= '</span>';
//Filter to change the output of <span><span>credit</span> | <span>credit</span></span>
$image_credit = apply_filters( 'acf_media_credit_base_output', $image_credit );
$image_credit .= '</span>';
//Filter to change the output of <span><span>credit</span> | <span>credit</span></span>
$image_credit = apply_filters( 'acf_media_credit_base_output', $image_credit );

endif;
endif;

return $image_credit;
}
Expand Down

0 comments on commit 0e0de64

Please sign in to comment.