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?
- Add additional ‘description’ field for defined roles / role metadata?
- Can’t display errors in attachment_fields_to_save
- Change the main loop WordPress impact on the server?
- How to get categories with posts by custom field value?
- How to load an assets based on custom field value?
- displaying and sorting comments by a custom field (using PODS plugin) [closed]
- Meta Query returns wrong number of posts
- Declaring in variables [closed]
- Pass current post title to a predefined link
- auto-populating custom nav with all items from custom post type
- How to hide a custom field if there is not a value
- Adding auto-complete to custom gravity field not working
- how to display a widget only on a page where the custom field is defined?
- Show values of custom post meta on ‘Add new post’ page?
- custom-meta-box checkboxes from loop won’t save
- Custom dropdown field added to media gallery; how to get it to save properly?
- Can I create a template or doctype for my blog site?
- Sort custom post type by multiple custom fields
- Custom field, add class to anchor tag
- Custom post meta field effect on the performance on the post
- Set post to unpublished after one week depending on condition
- How to find a post using XML-RPC without knowing ID
- Insert a custom field into a shortcode and use it in post(s)
- Is it possible to create a post from an NextGen Gallery image?
- How to get latest post value if first post is empty in wordpress
- Sort alphabetically by custom field
- How to add a custom field in the advanced menu properties?
- More efficient to add content to custom fields or the content area?
- Add / Update Custom Fields After Select Pictures in Media Window
- Getting Custom Fields from WordPress JSON API [closed]
- Display URL in a Custom Field
- How do i add custom fields to my themes template file?
- Custom Field to a Role?
- Linking Custom Fields to Database Records
- conditional logic for front-end custom field edits
- Trying to sort and display categories(not posts) by custom field: ‘order’
- How to show a post if was published less than two hours ago?
- List users by sum of all their posts’ custom field values
- Custom field as Slug
- How to save the date/time of last update of an extra user profile field?
- How to populate custom field dropdown box based on prior selection?
- Custom tables or custom fields?
- Collect user custom field in product page woocommerce
- Saving Custom Field Data before Publish
- Search in Archive Pages by subcategory, tag, custom field and year
- display custom field from inner blog in the main homepage of wordpress multisite
- Post selector as Custom Field
- Custom WP_Query for WordPress Search Results with meta_query
- Change order of posts
- Trying to retrieve post meta
- Multiple URLS per post non-ascii
- Custom Metabox additional item
- Meta Query And/Or
- Migrating old posts to new wp, how to extrapolate infos from the post body to custom fields?
- $form_fields from attachment_fields_to_edit returning empty array
- How to combine custom fields to make one order-able value
- How to link keywords in custom fields?
- Updating Other User’s Metadata
- get_posts in meta box dropdown not showing latest posts
- Displaying custom field according to date
- URL Rewrite fires when retrieving a custom value?
- Trying to reorder posts by custom field
- Uploading PDF using Media Uploader
- Add first url to custom field on publish_post
- Use meta_query to get title of associated post
- Delete custom fields when deleting posts
- Limits, not all post are showen when querying for posts by view count
- Meta query with multiple custom fields for archives page ordering problem
- Why orderbyb meta_value_num won’t affect the generated SQL Query order?
- Custom fields attached to a page template only show on edit screen when page is saved
- filter custom field values $min $max
- Custom field query without duplicates results
- Automatic Shortcode Creation with Custom Fields [closed]
- I need a “Choose from existing content” popin
- Custom field values to taxonomy terms
- For homepage images (for small business website), is it better to use custom fields or post_thumbnail?
- Select multiple images from custom field
- Outputing a metabox textarea and avoid line breaks inside li tags
- Restrict WordPress Search to Custom Field
- Define a post’s title and slug from Custom Fields
- Show user info in a hovercard [closed]
- How can you include custom post meta in search without calling each key?
- Duplicate (or more) custom fields on many posts. Is there an easy way to clean them up?
- Custom wysiwyg editor doesn’t execute shortcodes?
- How would an if statement surrounding a custom field with two variables (holding values) look like?
- How can I save custom meta to one global value?
- How to add new field to the account address?
- Display Custom Field for a Specific Role, but not for Admin
- Split the_title
- Display Custom Meta Box Field Only If Value is Present