Put this in functions.php
of your theme.
add_shortcode( 'dansk_url', 'dansk_url' );
function dansk_url() {
$output="";
$the_url= get_post_meta( get_the_ID(), 'dansk_url', true );
if ( $the_url) $output .= '<a href="' . esc_url( $the_url) . '">Dansk</a>';
return $output;
}
and use shortcode [dansk_url]
in the post.
Related Posts:
- How to create a shortcode to print specific values stored in a post meta array?
- shortcode in a custom metabox
- IF Custom field value equals ZERO
- Display meta data from a custom field within plugin Category Grid View Gallery
- Can I exclude a post by meta key using pre_get_posts function?
- How to get custom post meta using REST API
- What is the index [0] for on post meta fields?
- The “_encloseme” Meta-Key Conundrum
- Using get_post_meta with new_to_publish
- So much data in postmeta
- get_post_meta() unserialize issue – returns boolean(false)
- Allow user to create instances of custom field
- Meta keywords and descriptions plugin for manually editing meta for each page/post
- Save HTML formatted data to post meta using add_post_meta()
- Up/Down voting system for WordPress
- post meta data clearing on autosave
- Display info from custom fields in all images’ HTML
- Update meta values with AJAX
- Save attachment custom fields on front end
- Transition from (classical) serialized custom meta field to (gutenberg) rest enabled meta
- Unable to show ACF’s Image Custom Field properly in Genesis Framework [closed]
- Custom field value based on other custom field values
- Which is best in the following scenario : post_meta vs custom table vs parent/child posts
- Saving custom image meta fields
- Get all meta keys assigned to a post type
- Adding custom fields (post meta) before/during wp_insert_post()
- Combine multiple custom field values into single value
- How to query posts with certain custom meta data, and output Post data
- post meta getting deleted on save
- Can’t get post ID using wp_insert_post_data
- Unique Post Meta Values
- meta_compare seems to be treating values as strings instead of integers as expected
- Add post meta fields, when creating a post using WordPress’ REST API
- Store array as single, serialized post meta field or many post meta fields?
- Custom Field Values not updating unless I click “Update” twice
- update_post_meta for repeated custom field [closed]
- Trying to update_post_meta function
- get_posts in meta box dropdown not showing latest posts
- Ordering posts by custom field named “date” in backend
- Unique meta_key with array value vs repeated meta_key with single values
- Custom Field 101
- Shortcode To Display Post Custom Field Value in Post Title, Post Content
- custom field (video/audio url) and embed functionality
- Allow only one post with specific meta value
- How to validate select field in post meta?
- How to display childrens custom fields?
- how to display custom fields of post on a web page
- How do I query the title (or handle?) of post meta fieldset (created with Simple Fields Plugin)
- How to fill custom fields with brackets in their key with add_post_meta()?
- change order of images attached to post
- how can I show name and value of Custom Fields together?
- Enable a short code in the custom meta field
- Gravity Forms Update post meta from template [closed]
- put saved metabox values back into fields and then display on the front end
- How to get custom image field of specific post id
- custom filed from post in the side bar
- wordpress multi user question
- How can I change author of posts to the value of one of the custom field of the posts?
- Adding Custom Metadata to my Archive/Posts page
- How to improve my non-unique metadata MySQL entries?
- Saving Custom Field that includes Quotation marks
- how can i show WordPress custom field data to my short code?
- Custom Fields Not Showing (ACF not installed)
- Post meta data not showing in frontend, until hitting ‘update’ button
- searching by keywords in post’s metas or pagination links problem
- Add custom field information to source meta data
- How do I update custom field post meta in frontend post template?
- How to Find List of Available Custom Fields for Theme?
- Create Shortcode shows only posts with custom_field meta
- update meta field value after
- Custom Fields Not Working In Footer
- PHP and Shortcode Combination
- ACF plugin and field update
- Delete custom meta
- Retrieving Advanced Custom Field within Shortcode Function [closed]
- Echo out custom fields in comments
- Search one custom field?
- Can’t save meta field value if the title not set
- Display Data From This Custom Media Upload Meta Box?
- Save values generated via API as custom meta fields
- Adding custom fields to images
- How to save dynamically generated value in post type?
- wordpress simple post multi rating with post_meta and user_meta
- update_post_meta not working in action hook
- how to show this part only in the single post page?
- Custom field in a shortcode?
- Insert wp gallery shortcode into custom textarea
- Parse Shortcodes in Theme’s Custom Field?
- Custom fields / meta box output
- Insert shortcode before and after a list automatically
- If post custom meta data is not set, show normal state
- How do i output images from URL’s added to the same custom field key
- Custom fields doesnt work well with any postTAB plugin
- Colecting values from custom field checkboxes and displaying them in the post
- Build Array from Input Fields question
- How to include custom field in shortcode (do_shortcode) in theme file
- custom field with links
- How can i put a custom field inside this php
- How to add new Metadata options (Date, Author, etc.) for Posts?
- Saving multiple custom meta box fields