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
?>
Related Posts:
- Post source link plugin – small modification
- Modifying Footnote Plugin for Descriptive Title Attributes
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- Edit Yoast SEO breadcrumbs output [closed]
- Redirect to another page using contact form 7? [closed]
- same user role or copy the user role to be same as the other role
- implement custom roles in custom plugin
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- Adding discount functionality to the cart
- How to assign a specific service to a specific provider based on location
- Precheck fields when I add a new post
- working code, not working – Plugin Dev
- WordPress: code structure
- Best collection of code for your 'functions.php' file [closed]
- Should all plugins be encapsulated in a Class?
- How do I call wp_get_current_user() in a plugin when plugins are loaded before pluggable.php?
- if plugin is active? check if plugin is enabled or not?
- WooCommerce create new product and add to cart on form submit
- Add CSS animation as Preloader to WordPress
- Change destination author link
- Setting up widgets in wordpress with a unique ID for the after_title argument
- New Plugin: Post update pushes a copy as a revision
- Display a text message if the field is not found and not if found
- Scope for PHP Variables Assigned in functions.php or a plugin
- Override the filter from plugin in child theme
- Add a plugin before main container
- Executing my function once on a specific time
- wordpress plugin is not activating from widget
- Override Plugin Script Fucnction in WordPress
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- How to call WordPress function other files
- Conditional attributes and logic per product category
- WP Query. Is there a maximum size?
- What is @Action in WordPress?
- Inserting custom PHP script on homepage
- execute function after one completed
- wp_enqueue_scripts
- How to get specific string/value from an array? php [closed]
- How to make a dynamic css class whose name changes every visit to confuse scraper
- WordPress Stock Update Programatically
- How can I fetch data from another website to my wordpress website with mysql database
- I am trying to make a field show and save from quickedit screen
- Send email with list of active plugins upon activation/deactivation
- Using custom fields for image alt and title
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- Customize Menu | Styling LESS/SCSS code formats
- How to translate wordpress error message
- All custom widgets are not showing in widget area at the same time
- Why is it important to check for isset and is_array before checking in_array in this example?
- Comment “like” problem – “users who like this” avatar linking to current user profile instead of “liker’s” profile
- how to change wp-admin url using function file
- Calling a save function from a “submit” button
- More gentle way to hook WordPress custom url
- How to add custom function to pluggable.php
- Checkbox show / hide output result
- How to keep plugin (media-sync) running even the tab is closed?
- Custom Logo Link WordPress
- How to convert Currency from USD to other IP Based currency in Php function
- Attempting to list all product categories and the price range of all products within them
- WP Function does not trigger on Webhook API Call
- Creating an array from form inputs before it is posted to the options database
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- How to create algorithm for ordering posts in WordPress?
- Easiest way to load/fire a handful of functions, IF checkbox is checked?
- Block plugin update possibilities (but not by hiding notifications)
- post id or permalink auto-incrementing number and reset everyday
- Move plugin upload folder from mywebsite.com/wp-content/uploads/pdfuploads to mywebsite.com/pdfs?
- Is admin section completely customizable in terms of styling?
- Return function results within shortcode
- Woocommerce list variations that are added already to cart in Single Product
- How to make the first letter of a post title uppercase, in a plugin?
- Flexslider empty slide
- Soflyy WP All Import Custom File Download Issue
- Update (a function) post’s featured image as soon as $image_url changes
- Migrating custom php we wrote from functions.php into a site-specific plugin
- WordPress environment not loading properly
- Place content inside the Post Loop
- How to echo a plugin’s function into a template?
- How to replace native comment_count with Comments Evolved aggregate count
- Conditional required fields for WordPress Contact Form 7
- It possible to implement an adhoc php web application with wordpress?
- Cannot access variables within a widget
- Is there any wordpress function to update a random post every 10 minutes?
- Calling an custom field from theme option at the frontend
- WordPress function to add text
- Saving an array to get_options
- Contact Form 7: custom validation [closed]
- Doing action based on input from options menu
- Showing author box on post detail page
- How use Dynamic hyperlink on each wordpress post?
- How to prevent page load on form submission
- How to delete remain data in WP database after deleting custom post via admin interface
- is_plugin_active() not defined on active plugin, in the thumbnails.php file
- What can I do to customize a widget provided with this plugin? from where have I to start?
- Requires PHP version 5.3.0
- PHP if url extension action=discussion condition use [closed]
- Product customizing quiz – quiz adding products to the cart
- How to change all the urls of the WordPress site?
- How to make a Template page to show the information of different things Shop and Product page?
- I want to allow certain file types on dokan upload files