yeah, the question is a bit unclear. but i think you need shortcode attributes
function get_custom_field_fn( $atts) {
global $post;
extract( shortcode_atts( array(
'meta' => ''
), $atts ) );
$custom_field_value = get_post_meta($post->ID, $meta, true);
return $custom_field_value;
}
add_shortcode('cf_name', 'get_custom_field_fn');
see the codex: http://codex.wordpress.org/Shortcode_API#Attributes
Related Posts:
- Problem with extract() with custom shortcode
- Pass Shortcode Attribute to footer Script
- Wp-query Order By problem
- Shortcode to insert default text and change one word throughout it?
- How To Show Shortcodes In WordPress Custom Fields?
- Shortcode to eliminate and replace with
- restrict access to specific urls on a specific period of time
- multible shortcodes (for differnt values) with one function
- Removing Metabox for “Slug” without removing functionality
- How to display random users with avatars
- Modify search function in WordPress (TwentyTwelve)
- How to customize search result page title?
- Creating a table from shortcode avoiding wpautop for each row
- Stripping shortcode from custom excerpt function
- Removing Unnecessary Text from Admin Menu without CSS
- Shortcode with custom content attribute?
- Display WordPress Search
- Shortcode to insert menu in page body?
- How to add a rel attribute to images that contains their categories?
- Preferred Use of home_url()?
- Passing HTML in WordPress Shortcode arguments
- radio button is checked but display not check
- Custom function for user register in wp?
- Refactor create_function
- Custom Shortcode, functions PHP WP_Query loop
- Super simple shortcode not working
- Customizer field value into functions.php variable
- How to extract the variables out from “add_shortcode” function?
- How to get specified parent page title in my function
- Possible to display shortcode based on the category?
- is_customize_preview() like function to check if Customizer “Live Preview” in JavaScript
- How to customly read JWPlayer’s “Playlist” items by using its “playlistid”?
- Include default functions and methods
- Hard-coding custom menu elements for menu manager
- Display post shortcode content in the sidebar?
- Twentyten Child Theme: header images display messed up in admin panel
- How to get the index number of the posts?
- IF Statement on Button to make it complete and “uncomplete” based on user action / click
- Gravity Forms Button Text
- Find resources dynamically loading and change or add to the url
- Using shortcode content with nested shortcode
- When sale price is 0.00 show only regular price
- How to filter $content in shortcode function
- Custom Attachment Caption Fields
- Cannot save CPT meta box
- Move Custom Fields on General Settings Page to New Location
- Display gallery on bottom after content
- WordPress Shortcode function display outside of widget
- check if the user is owner of current page
- shortcode help require
- Use html inside shortcode function
- How to retrieve the current post’s generated featured image size?
- Custom Behavior when Adding New Custom Post Type in Dashboard
- Why There Is No “get content by ID” Function
- Function shortcode – Set Parameter
- How to echo the value of an array element using a function via a shortcode
- Randomizing wp_tag_cloud() in child theme
- Variables not showing in short code
- login_headertitle is deprecated since version 5.2.0
- Where do I go to edit this area? [closed]
- Replace plugin function with a custom function?
- Different favicon on different pages
- How to create shortcode with html and php content?
- Problem with images URL after filter applying
- Shortcode to get featured image of specific id post
- loginout function customization
- How would I make a function to dynamically determine if user is logged to change navigation menu text?
- Problem with shortcode inside a shortcode
- How to avoid saving empty data to sql while using add_meta_box
- Need help making a short code work
- Display a list of random terms from custom taxonomy with shortcode
- Probleme shortcode with list author
- Save_post – Warning: Cannot modify header information
- How to use WP conditional tag in a functions.php with OCEANWP Theme?
- Modifying a WordPress Plugin
- Having trouble creating two shortcodes, one for logged in user and one for visitors
- Last updated posts shortcode in functions.php
- CF7 select value get to function and reciept value from function
- Shortcode to output category description by passing ID
- Help using ShortCodes to style whole chunks of the post
- Woocommerce custom calculation function
- Remove all video attachment, both files and post/postmeta from database?
- HowTo: Add wrapper to columns shortcode?
- Replace image attributes for lazyload plugin on image elements with specific class
- Shortcode Function – Can’t get anything else to return after running shortcode within shortcode
- How to make an If Else on Excerpt Filter
- Custom shortcode with do_shortcode and substr
- Can I use a function to return HTML and the result of another function?
- Expanding a function to call a plugin or show a link
- Trying to the deduce shortcode from a function
- functions.php / replacing div’s with new ones?
- Run function from parent on child site
- Post variables not displaying correctly in custom function
- Shortcode Variations?
- Custom shortcode not being included in content paragraph [duplicate]
- Decimal stripped from metabox number
- Creating mixture of shortcodes to use in the visual/text editor
- WordPress Custom wp mail template return full template
- How to create a post without link in wordpress?
- post_row_actions filter from parent theme not executing in child theme