Skip to main content
1 of 2
Sally CJ
  • 39.9k
  • 2
  • 26
  • 48

You can do it like so:

global $post, $pages, $page;

$total = count( $pages );
// Show if there's only one page, or that we're on the last page.
if ( $total < 2 || $page === $total ) :
    // Show if the source link was specified.
    if ( $url = get_post_meta( $post->ID, '_source_link', true ) ) :
    ?>
        <div class="source-link">
            Source: <?php echo esc_url( $url ); ?>
        </div>
    <?php endif; // end $url
endif; // end last page check
Sally CJ
  • 39.9k
  • 2
  • 26
  • 48