Skip to main content
added 70 characters in body
Source Link
Sally CJ
  • 39.9k
  • 2
  • 26
  • 48

You can do it like so: (use this in place of the one in the question)

<?php
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
?>

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

You can do it like so: (use this in place of the one in the question)

<?php
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
?>
Source Link
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