Not quite like that, but you can achieve the same result if you use a pre-defined value or argument in your shortcode to act as a “flag”:
[authoorsposts author="post"]
…then in your handler:
function wpse_209684_author( $atts ) {
if ( ! empty( $atts['author'] ) ) {
$author = $atts['author'];
if ( $author === 'post' ) // Our flag, make $author the current post author
$author = get_the_author_id();
else // Otherwise just accept a hardcoded author ID
$author = absint( $author );
}
}
Related Posts:
- Remove HTML content if attribute is not set / variable attributes
- Shortcodes and a list of IDs?
- Turning variable into a value set in shortcode
- Substite Category Slug in a Shortcode
- Check if parent page has child page of certain slug
- Variable inside shortcode or shortcode inside shortcode
- Multiple values for one variable
- Add audio file to post using custom term meta field as link [closed]
- Class variables in shortcodes
- Shortcode with multiple variables
- About redundant code when I use shortcode to output the HTML from a variable
- Shortcode outputs at the top of the_content
- Combining shortcode and get_template_part
- Escaping quotes from shortcode attributes
- How to detect if a Shortcode is being called on a page?
- How to get current page title inside a page itself in a shortcode and in page content
- Short code to display a loop
- shortcode inside another shortcode
- How can I just get content inside a shortcode or just outside
- Custom Shortcode AJAX 400 Bad Request
- WordPress core responsive video not working with shortcode
- shortcode to create dynamic dropdown box form shortcode attributes
- conditional shortcode not working
- Can’t seem to get [shortcode]s to work
- Wraping $content into link with shortcodes
- nested Shortcode doesn’t work
- Simple contact form with field validation
- getting values from a shortcode with an include
- Create a shortcode in WordPress, again
- change wordpress gallery shortcode to slider
- Change link in get_terms if there is only one post in the category
- How to get total number of shortcodes in the wordpress application?
- Allow shortcode in the author bio textarea
- How do I combine my shortcodes?
- Bulk converting shortcodes to blocks with embeds
- How to add source code into wordpress post really?
- shortcode_atts – one URL variable not working
- Caption shortcodes not including caption as attribute
- Make shortcode’s Bootstrap CSS override the theme’s CSS, how?
- Passing a nested shortcode as an argument of another shortcode?
- Change the default video shortcode
- How to use shortcode in js url
- How to add AJAX in a custom PHP function using Google sheets API
- Nested Code Snippets [closed]
- How do I display “Hello username” if logged-in on the homepage
- Shortcode to show current post category with link
- Gutenberg Block with Select from JSON-File
- How to register a user via modal after clicking a link in the shortcode?
- add widget to page content (using shortcode)
- Pagination for a page created by the shortcode “Product”
- WordPress TinyMCE : Get value of popup button
- Freeze a shortcode in place?
- Unable to the get the gallery inserted between shortcodes
- Complex Slider Shortcode Help
- Using _e() on text inside video tags prints that text, instead of only showing when html5 element is not supported
- Youtube shortcode
- Shortcode will not pass attribute through to my function [duplicate]
- Displaying audio player as preview in audio post in WP3.6
- How to edit blog page in wordpress? there is no place to put shortcode
- How to transform WordPress user role code to WP shortcode?
- Does short-code slow down my WordPress site?
- redirect if shortcode exists
- Position shortcode off [duplicate]
- How to use a nested shortcode to render the value of an attribute in parent shortcode
- ob_get_clean(); doesn’t return $value in shortcode?
- Which wordpress function is the caption shortcode linked to?
- Content between shortcodes
- Parsing a shortcode through an author meta textfield
- Adding YouTube button to TinyMCE editor
- How to find out what handler is registered to a shortcode
- Shortcode strips formatting and returns at content top
- do_shortcode within a shortcode
- tiny_mce_before_init preventing custom shortcode icon appearing
- Custom Fields – Boolean Display of True/False to Yes/No
- How to display NextGEN gallery in templates?
- Twitter bootstrap tabs
- jQuery Tabs in Shortcode API
- Echo Extra Shortcode HTML to wp_foot
- How can I use a plugin shortcode inside of a html form?
- Disable wpautop on Shortcode attributes
- remove shortcode pagination for specific url referrer
- Shortcode PHP file for two conditions passed when do shortcode
- Using within a shortcode
- update_metadata() appends shortcode data for every page refresh
- Gallery shortcode is empty but magically creates a gallery
- Display tags cloud from a specific category ID with a shortcode
- Shortcode appeared twice on page, one time before content, one time where it’s really called
- How to list child pages with excerpts, e.g. [child-pages depth=”1″ excerpt=”1″]
- Video shortcode outside WordPress not working with IE and mediaelement’s Flash fallback
- Inserting a variable into a shortcode inside php
- Shortcode for Admin Theme Option?
- Clarify: Enqueueing scripts within shortcode only loads in footer?
- What makes a placeholder resizable in Tinymce?
- Create plugin/function to catch XML-data via Shortcode
- Shortcode conversion to hrml when post is published
- Shotcode error on functions
- Shortcode for displaying the user’s first name?
- Working with Shortcode, AJAX, Elementor
- How to exclude some cats from wp_list_categories using shortcut
- How can I create a shortcode that shows a list of categories on the single product page?