Well, yea you kinda can do that. But it’s bad practice and it’s strongly discouraged. Cause when you call parent function the nested function is being called automatically. So basically the nested function is being called twice. Better and safest way to do it like-
// Include the file or write the nested function outside of the parent function
include (__DIR__.'/api/short_look_up.php');
function short_api($atts){
$api_info = get_api_info($atts);
return $api_info;
}
add_shortcode('apii', 'short_api');
Related Posts:
- Include PHP file in Content using [shortcode]
- get_template_directory_uri pointing to parent theme not child theme
- Use AJAX in shortcode
- How to add attributes to a shortcode
- How to display random users with avatars
- Can shortcodes contain conditional statements? Even without them my shortcode renders blank page
- Creating a table from shortcode avoiding wpautop for each row
- Changing a function in function.php to a shortcode – for listing categories of only a certain post type
- Stripping shortcode from custom excerpt function
- Formatting post content to exclude gallery
- Shortcode with custom content attribute?
- Shortcode to insert menu in page body?
- Passing HTML in WordPress Shortcode arguments
- What is the most efficient method for loading widgets in functions.php
- Function to show only first instance of shortcode
- Display a text message if the shortcode is found?
- Custom Shortcode, functions PHP WP_Query loop
- Super simple shortcode not working
- Display gallery on top before content
- 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?
- Shortcode pagination not advancing
- Variable if post is sticky in functions.php
- Having issues with a foreach inside of a shortcode with ACF gallery
- using `require` in my functions.php breaks the site
- Display post shortcode content in the sidebar?
- How to get the index number of the posts?
- Using shortcode content with nested shortcode
- How to filter $content in shortcode function
- Create a custom taxonomy that will be used to create and filter markers in a Google Map
- Automatically include all php files in a child theme directory
- Display gallery on bottom after content
- Excerpts are not displayed by a shortcode on category pages
- WordPress Shortcode function display outside of widget
- check if the user is owner of current page
- shortcode help require
- Help With Creating Shortcode
- Use html inside shortcode function
- Can I have an additional functions.php file in WordPress?
- Shotcode argument issues
- Exclude category from shortcode
- Visual Composer creating own shortcodes with vc_map() to return simple Image
- get_pages() Returns Only One Item
- wp_star_rating() – Adding a 5 star rating system to theme
- Function shortcode – Set Parameter
- Adding an option to a shortcode
- How to use author meta in shortcode?
- Using multiple line variable inside a function?
- Use a shortcode to display custom meta box contents
- How to echo the value of an array element using a function via a shortcode
- Wp-query Order By problem
- Woocommerce checkout field
- How to create shortcode with html and php content?
- Tracking the number of shortcodes for a list?
- Unable to point the child theme directory even using get_stylesheet_directory()
- Need a method to prevent WP from adding in between my shortcodes
- Load scripts for do_shortcode( ‘ [ my_shortcode ] ‘ )
- How to create a shortcode out of a php function
- Shortcode to get featured image of specific id post
- Modify shortcode to work with custom post types
- shorthand syntax for custom fields
- show all the posts thumbnails
- Problem with shortcode inside a shortcode
- Need help making a short code work
- Using One Function To Create Two Different Shortcodes
- Why should I use get_template_directory() when include files?
- Display a list of random terms from custom taxonomy with shortcode
- WordPress functions.php conditional include another functions file
- Load templates, pass arguments, and render output from functions.php
- page shows short code not output
- Probleme shortcode with list author
- Last updated posts shortcode in functions.php
- Shortcode to output category description by passing ID
- Help using ShortCodes to style whole chunks of the post
- How to retrieve image IDs from shortcode content?
- Display list of pages that contain a certain string within the slug
- HowTo: Add wrapper to columns shortcode?
- Including admin-options.php file in Child Themes
- How To Show Shortcodes In WordPress Custom Fields?
- Shortcode Function – Can’t get anything else to return after running shortcode within shortcode
- 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
- How to display data from custom fields in my custom shortcode?
- Modify function Shortcode_atts
- Pull random comment from specific post, display on homepage with shortcode
- Set thumbnail from URL, by grabbing image in functions.php
- restrict access to specific urls on a specific period of time
- Run function from parent on child site
- Add title & subtitle to shortcodes
- Shortcode Variations?
- shortcode inside post called by ID does not render as expected
- Custom shortcode not being included in content paragraph [duplicate]
- Shortcode to include PHP file, pass various parameters to include?
- Display function from functions.php in tag.php
- Creating mixture of shortcodes to use in the visual/text editor
- PHP error in shortcode [closed]
- multible shortcodes (for differnt values) with one function