So, you can get the category name with get_queried_object()->name
:
if ( is_category() ) {
echo do_shortcode( '[x_recent_posts type="post" count="2" offset="" category="' . get_queried_object()->name . '" orientation="vertical" no_sticky="true" no_image="false" fade="false"]' );
}
Related Posts:
- How get a shortcode working in category description
- How to create a shortcode to display a category description?
- Shortcode – Getting Categories appears on top of website
- Custom shortcode being executed when saving page in wp-admin
- Change appearance of shortcode text inside editor
- Shortcode outputs at the top of the_content
- Shortcode output always showing at top of page
- Short code to display a loop
- How can I just get content inside a shortcode or just outside
- WordPress core responsive video not working with shortcode
- WordPress gallery ‘post_gallery’ filter doesn’t work with feeds?
- Ajax not returning anything on form submit
- How do I add my own custom shortcodes?
- Simple contact form with field validation
- Slow page loading when using a simple shortcode on the same page multiple times
- Remove and restore one shortcode
- What is a short code?
- Using do_shortcode with variables?
- Using ACF field in do_shortcode()
- Display content from another site page using a shortcode
- Remove hyperlink on gallery shortcode
- Instagram URL is converted into oEmbed
- Shortcode with no attribute but has value
- Remove wpautop from specific shortcodes only
- Combining similar shortcode functions?
- Shortcodes and a list of IDs?
- Shortcode adding plugin output before post, instead of inline [duplicate]
- How to build a shortcode which can insert a query string into a DB table
- What is the Correct way to pass parameters in function
- Visual Composer integration [closed]
- How to Modify WordPress Default Image Gallery Shortcode
- Passing html tags as shortcode parameters
- no content after shortcode
- Button Shortcode
- Trouble with editing template for “List category posts” plugin
- Shortcodes in excerpts returning empty string
- Scripts for shortcode: concatenate or load separately? [closed]
- Wrap Shortcodes and wpautop
- Placing tags on wordpress visual editor using shortcodes
- Favorite websites with shortened hyperlinks
- Best way to find all shortcodes that come with WordPress
- How to retrieve category of a post in have_post loop?
- Shortcode interpreted as text
- Using Variables in Shortcodes
- Default Attributes in Shortcode Not Working
- Replacement for gallery_shortcode function not taking all attributes
- Shortcode syntax errors
- Passing variable in nested shortcodes
- Shortcode Always Displays Default Attribute Value
- I want to show category name when using [category] shortcode
- how can i pass this attribute in this shortcode?
- How to add a same div on every page
- Display a form partially with a shortcode
- How do I fit a function inside an opening and closing do_shortcode
- How to choose the content from a post which is in the right category?
- Modifying the wordpress login page and then referencing it with a shortcode problem
- How to make shortcode which returns HTML?
- Render shortcodes with get_post_custom
- How to create a custom shortcode for custom login form?
- Pass a comma separated shortcode attribute to a function
- Enclosing Shortcode not working in a Template
- how to write short code in word press
- Set redirect for need login
- make user_id in a shortcode dynamic based on who’s logged in
- pass complex json as shortcode parameter
- Image Caption Shortcode Broken upon update
- Shortcode not working in CPT taxonomy
- wp_enqueue_scripts does not work on admin page
- shortcode containing other shortcodes not returning content
- How to embeded shortcode for another website
- To know whether insert shortcode in custom meta box
- Shortcodes not working in custom page
- Get label in user meta query
- Shortcode not being executed
- Displaying a Category on a WordPress Page
- Load gravity form via ajax using do_shortcode
- Video Short Code and Media Fragments URI
- create a shortcode for embedding google map in a page
- How to process a single attribute in a SQL request twice times?
- Customise standard lists within my shortcode
- How to fix transparency in product sliders / featured products on home page?
- Woocommerce products shortcode specific order
- Modify Blog Module layout in Child theme
- Video shortcode outside WordPress not working with IE and mediaelement’s Flash fallback
- Display title of child pages in shortcode
- Output html source tags inside shortcode
- How can I define the output of shortcode attribute value?
- Using shortcodes that wrap around code
- What is the best way to include a template file within a shortcode?
- Shortcode templates
- Create plugin/function to catch XML-data via Shortcode
- Why My slider shortcode display above header
- Does anyone recognize shortcode ig_special_heading?
- How to scroll to a shortcode-generated anchor
- add post type pram to wp shortcode
- Shortcode conversion to hrml when post is published
- Shotcode error on functions
- Shortcode for displaying the user’s first name?
- Can I prevent wordpress adding and tags to autoembeds
- Shortcode – Display inline icon before text [closed]