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
- Remote upload file to server B
- Keep one user logged for a year?
- Customizing subject in comment notification e-mails
- 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
- Generate custom output for page/URL in a plugin
- Saving Plugin settings to the database
- How to list the Hooks and order of execution in current loading page? [duplicate]
- How to turn off email you receive when registered?
- How can i change an image’s author?
- How to redirect Old Post URL to new Post and keep Old post Comments?
- Debugging Technique Question re: functions.php
- force customers to add only single item to card per purchase EDD [closed]
- How to get post URL in the_content filter?
- 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
- Theme my Login plugin, how to update fields
- How would I go about creating a user ranked post popularity page?
- All sites themes functions.php have been changed
- Customize permalink wordpress category id
- WordPress get_avatar function not correct working
- Load Javascript from Plugin in One Page Only?
- Check if variable is set in filter
- JQuery prepend a function
- Why can’t I call a (member) function from within a foreach?
- Are there action hooks for comments?
- Help with WP Business Directory Manager Plugin?
- Return multiple values in a shortcode attribute
- get specific value of a array | PHP
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Plugin onclick button activate other plugin
- Loop in elementor custom widget not working
- 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
- .php file for woocommerce edit category? [closed]
- Add the_post_thumbnail_url to a shortcode in function.php
- Different registration form for different roles
- Adding a Tag Parameter / Filter to My Shortcode
- Call javascript functions from each page
- Can you echo PHP code from a variable?
- woocommerce remove coupon link does not work
- add_rewrite_rule to load different page, without changing URL in browser
- WordPress Custom Hook with Class method
- Allow a particular user to access a particular plugin?
- WP Function does not trigger on Webhook API Call
- Cookie value changes back to previous value after changing
- How to create algorithm for ordering posts in WordPress?
- Submitting form to PHP
- Get Shortcode output to database for static post_content
- Block plugin update possibilities (but not by hiding notifications)
- Change custom rewrite rule when permalink is updated/changed
- Move plugin upload folder from mywebsite.com/wp-content/uploads/pdfuploads to mywebsite.com/pdfs?
- Return function results within shortcode
- Woocommerce list variations that are added already to cart in Single Product
- Flexslider empty slide
- Soflyy WP All Import Custom File Download Issue
- Update (a function) post’s featured image as soon as $image_url changes
- Custom SportsPress list
- Populate select option with JSON file
- How to echo a plugin’s function into a template?
- Find all strings between an enclosing shortcode
- It possible to implement an adhoc php web application with wordpress?
- Contact Form 7: custom validation [closed]
- date function not correctly returning date
- How to fix vanilla comments extra iframe space
- I want to remove the register/login WordPress top bar from my website
- How to disable register and reset the password from WordPress admin panel?
- How use Dynamic hyperlink on each wordpress post?
- How to prevent page load on form submission
- What can I do to customize a widget provided with this plugin? from where have I to start?
- 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 disable plugin capability : “create new category”
- Option value not getting updated until page refresh in WordPress
- Make plugin admin page visible to other roles
- Sort posts by Date (DESC) and by ACF: active_inactive (ASC)
- WordPress Custom Page Blog Template Pagination Problem (Pagination Not Displaying)
- 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