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:
- 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
- Post source link plugin – small modification
- 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?
- Consuming an external API in WordPress?
- Shared functionality in plugins and themes
- Remote upload file to server B
- How can I import a class privately into a plugin?
- Plugin update error message
- Keep one user logged for a year?
- Customizing subject in comment notification e-mails
- if plugin is active? check if plugin is enabled or not?
- WP showing “warning: call_user_func_array()”, What to do?
- How do I extend one plugin I’m writing with another I’m writing using classes?
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- How to Loop Plugin Option Field Set?
- Can we completely remove the WordPress Sitemaps (WordPress 5.5)?
- Generate custom output for page/URL in a plugin
- WooCommerce create new product and add to cart on form submit
- Saving Plugin settings to the database
- Set a User as Author of all ‘New Posts’ posted
- Add CSS animation as Preloader to WordPress
- How to list the Hooks and order of execution in current loading page? [duplicate]
- Change destination author link
- How to turn off email you receive when registered?
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- Setting up widgets in wordpress with a unique ID for the after_title argument
- How can i change an image’s author?
- HELP: Integrating WP with raw PHP code once published button is hit
- How to redirect Old Post URL to new Post and keep Old post Comments?
- I would like to use create a function in my custom plugin to tell WP to use a different header
- New Plugin: Post update pushes a copy as a revision
- bulk change of image setting “link to” to “link to: image url “
- Display a text message if the field is not found and not if found
- Debugging Technique Question re: functions.php
- Scope for PHP Variables Assigned in functions.php or a plugin
- Override the filter from plugin in child theme
- force customers to add only single item to card per purchase EDD [closed]
- How to get post URL in the_content filter?
- Add a plugin before main container
- How to get subscription key or id using Woocommerce Subscriptions [closed]
- Missing argument 3 for wp_register_sidebar_widget()
- Auto delete WordPress users according to time
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- add_query_arg not working
- Shortcode button dosent work for all posts. Work for first post only
- Executing my function once on a specific time
- How to stop or remove an action being called inside a function of an extended class
- wordpress plugin is not activating from widget
- Theme my Login plugin, how to update fields
- Date calculations from 2 custom fields
- How would I go about creating a user ranked post popularity page?
- How to enable specific plugin only based around shop manager role?
- 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
- Adding a new field to the address field type in gravity forms
- Replacing a plugin function with a custom renamed function doesn’t work
- Nested shortcode functions accessing variable
- Calling an attribute from a plugin shortcode
- How to call WordPress function other files
- All sites themes functions.php have been changed
- Customize permalink wordpress category id
- Conditional attributes and logic per product category
- How to make the first letter of a post title uppercase, in a plugin?
- Requires PHP version 5.3.0
- PHP if url extension action=discussion condition use [closed]
- Adding a script & php to functions.php
- PHP Creating a formula from mysql db values and db stored math operator
- How to Add Extra Text In WordPress Title Before Post Publish
- How to disable plugin capability : “create new category”
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Option value not getting updated until page refresh in WordPress
- Make plugin admin page visible to other roles
- Product customizing quiz – quiz adding products to the cart
- WordPress Convert queries to slashes using function.php
- How to change all the urls of the WordPress site?
- Sort posts by Date (DESC) and by ACF: active_inactive (ASC)
- WordPress Custom Page Blog Template Pagination Problem (Pagination Not Displaying)
- 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
- stop resize button for wordpress media
- Mixed results with is_page() WordPress function, when using $this, or self
- Read page- or post-content across different builder-plugins
- Add 2 links in between the navigation using the Breadcrumb Navxt plugin hook
- CPU Overloading due to some hooks
- Woocommerce change image based on a single attribute
- Elementor: Exclude product categories when using “Source: Current Query”