OK, it’s a lot of guessing, because I can’t see the rest of your code, but something like this should work, I hope…
<?php
$value = get_post_custom_values("kpm_UploadFile");
$url = ($value[0]);
$tokens = explode("https://wordpress.stackexchange.com/", $url);
$dlvalue = $tokens[sizeof($tokens)-1];
if (current_user_can('read')) {
$found = 0;
foreach ($files_array as $key => $val) {
if ($dlvalue == $val) {
$found = 1;
echo '<a href="http://drrknowledge.net/download.php?file=".urlencode($val).""><strong>Download File</strong><br />'.$val.' has been downloaded <strong>'.(int)$file_downloads[$val].'</strong> times</a>';
}
}
if ( !$found ) {
echo 'No Download File';
}
} else { echo 'Register to download';}
?>
Related Posts:
- Add a Jquery Datepicker to custom field in post edit
- Correct Approach for Validating Custom Field Input
- Auto-add paragraphs to custom field?
- Meta Box Plugin Cloned Fields – Multiple Foreach values
- Display metabox title for custom fields with values
- simple fields plugin custom query
- How do I use foreach to get content from a custom-field in multiple posts?
- How can I hide my section title if there is no data in custom fields?
- Retrieve IDs from custom field, count and display results differently according to count
- Foreach giving one too many list items, how can I remove the last empty line?
- How to enable custom fields for pages (if not a bad practice)?
- Search that will look in custom field, post title and post content
- How can I avoid re-inventing the Custom Fields wheel in my Plugin’s Metabox?
- Custom per-page sidebar widgets .. possible?
- Does wordpress have something like content-type?
- Order Posts by Closest Numeric Values
- How to get and edit custom fields if in Quick Edit
- Guest Author – How can I use custom fields to create guest author link?
- Create additional short URL with custom field and 301 redirect
- Create custom field on post draft or publish?
- enabling custom fields in admin?
- get_post_meta fields don’t show up on posts page
- Using custom fields in a filter hook
- Add a post meta key and value only if it does not exist on the post
- Function to change meta value in database for each post
- Include woocommerce custom field value in front-end search result
- WP_Meta_Query causing long-running MySQL queries
- trim custom field text value and show (…)
- Duplicate posts being displayed when querying Custom Fields
- How to validate custom field on lost password form before the user id field?
- MySQL Query that looks for post with Custom Field, then changes Category
- Woocommerce: Custom fields and email shortcodes, ec_custom_field
- Tweak Meta for Post to work it for Pages also
- Create Pop-Up Box with Custom Field Content Inside the Loop
- Adding an editable field to template?
- Transferring author information from a custom field to a proper author
- How to select posts from multiple categories and metavalues?
- How can I add extra word in permalink when someone click download button?
- modify wordpress caption shortcode
- jQuery – Automatic event trigger does not **really** check my form
- Display URL in a Custom Field
- Linking Custom Fields to Database Records
- conditional logic for front-end custom field edits
- Which PHP page is the Default Posts Page
- Stop sending email everytime I updates my post
- Best way to store everyday post views?
- Display custom field value as a hyperlink
- Non-Closing PHP Query in WordPress Loop
- How to show/hide php table rows based on the content of custom fields
- pre_get_posts : only get posts by wp_usermeta value
- Display list of terms having the same custom field value
- How to display custom field in woocommerce email orders? [closed]
- Custom meta is not being saved
- IF Custom field value equals ZERO
- how to get serialized post meta
- Custom Field Repeating When Using foreach
- How can I activate custom fields checkbox in pages?
- Can I save post meta programatically without setting metaboxes?
- Conditional featured image with youtube thumbnail
- How to add a css class to custom field value?
- Show custom field on attachment page?
- Help setting up a sql query
- Advanced Custom fields not available yet during publish_page action
- Meta box values are displayed on Custom Fields list. Is it possible to hide them?
- Sort posts by custom field value
- WP Insert post with post_thumbnail
- if statement display content even though no data
- How to pass custom field value to shortcode?
- custom comment_form fields not displaying
- WP_Query () using taxonomy, custom post types
- Get custom post fields from multiple metaboxes
- Get author total post votes from post meta
- use custom field value as post category in loop
- Searching with Multiple (Parallel) Criteria on Custom Fields?
- Save custom field types with this function…?
- Compare ACF date field (if exists) and post date and order DESC
- Add WordPress user custom meta to chartjs vertically stacked chart in Divi theme
- get_post_meta shortcode returns empty field
- Query on a repeater date (acf)
- non-unique #_ajax_nonce id in browser console
- Delete a custom field in mysql for all posts with specific category id
- Trying to get custom field data in a simple plugin
- Sort columns in the ‘Pages’ dashboard overview
- Create Meta boxes dynamically
- Outputting custom field on home.php not outside of blog list
- I have a form with a custom button ,i want to add the field data to an database when clicking the custom button
- Add Image With Changeable Link in Custom Field [closed]
- Create download page from post option link
- Add capability for editors to modify custom fields
- Custom Field select list is truncated
- query specific posts according their custom fields, using sql SELECT
- Meta_query not filtering posts
- Select Menu for Custom post Type does not save
- list pages by custom_field?
- Get custom field from page, in a post?
- Make Custom Fields Public in JSON – API
- Advenced custom fields auto fill problem
- How to execute a shortcode within a custom field?
- Multiple permalinks for a single post from custom field
- Search for meta_query does not return any result if combined with title