Thanks to the response by @bueltge :
Added extra line in the __construct() function:
public function __construct()
{
$this->var = $this->shortcode_1(); //added
add_shortcode( 'the_single', array( $this, 'shortcode_2' ));
}
Related Posts:
- Passing attributes to shortcode dynamically
- 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]
- Shortcode with multiple variables
- About redundant code when I use shortcode to output the HTML from a variable
- How do I escape a ‘]’ in a short code?
- Redirect function inside a Shortcode
- Remove wpautop from shortcode content / remove whitespace in buffering
- How to add multiple buttons to TinyMCE?
- Check if post/page has gallery?
- Shortcode in shortcode: How to append variable?
- How can i put an array as variable in shortcode_atts?
- Table of Contents with a shortcode
- Allowing shortcodes inside attributes
- How to add ‘class’ attribute into shortcode [audio]?
- Make shortcode work with nested double quotes
- Using action hooks inside of a shortcode
- Finding where a shortcode comes from
- How to check if a shortcode is being executed in a widget or post
- TinyMCE popup windows using WP functions
- Remove width and height attributes from [gallery] output
- Is it possible not to define category on function.php and add the shortcode [shortcode cat=1] to display the products?
- How to display the comment_form with a shortcode while removing it from its default position?
- Prevent add_shortcode from escaping a tag
- Shortcodes not working in an AJAX call
- Error: The Content Area Was Not Found in Your Page
- Numbering Image List in Gallery
- Enclosing Shortcode Within Another Enclosing Shortcode Breaks Output Functionality
- Register visits of my pages in wordpresss
- Is it possible to ignore the first Line Break in a preformatted Div from a shortcode?
- Video shortcode – autoplay all videos
- List monthy archives for specific year with wp_get_archives
- How can I included CSS to a page or a shortcode? [closed]
- Two Shortcodes in one page not working
- Shortcode not working on static front page
- Creating a shortcode in a plugin that includes JS
- Compatibility of MathJax extension and JetPack [closed]
- Shortcode to delete post from front end
- How to parse shortcodes within returned content
- Hook WP_Embed run_shortcode
- How to add class or id to shortcode HTML elements?
- Changing the title tag from a shortcode
- WordPress wpautop/shortcode generating invalid markup
- shortcode in snippet plugin not work
- AJAX and Shortcode with Parameters
- Detecting embeded video format
- While loop shortcode problem
- How to prevent shortcode preview from breaking in tinymce editor?
- Execute Closing Shortcode After the_content
- Forcing max-width for image captions
- Responsive Embeds using default embed shortcode
- Is it possible to modify the header with a content shortcode?
- Custom shortcode breaks my page
- Custom shortcode is causing a WSOD
- this simple shortcode doesn’t generate Collapse as supposed
- Shortcode outputting at top of content
- Get attributes of nested shortcodes
- How to create a shortcode to let the user add the ID of a YouTube video?
- How do I define and register a shortcode function in a namespaced functions.php file?
- How to add shortcode to html widget
- Implementing a URL Shortener
- Add div on EMED Tag
- Clean way of using ob_start() and ob_end_clean() in wordpress
- Theme Convert PHP code to shortcode
- find shortcode inside content of post
- WordPress Short code for List style
- Processing a login/register form before shortcodes are rendered?
- Adding a cover image to video shortcode
- Insert First Image into post (full-width)
- Show content if user left comment / non-logged visitors?
- How to insert current user ID/entry ID into a shortcode?
- How to display html element and php string in the same line?
- Using a WP shortcode in Homepage
- i want to show a modal when user lands on home page very first time
- Restricting shortcode for users
- create shortcode that changes url endpoint
- Logout user if click on a custom page link
- Shortcode Attribute not defined
- Attributes are not passed on nested shortcode
- How to make a shortcode with a line break in it parse correctly?
- Removing text + shortcode from all posts
- Is Post-Author-Id shortocde
- Load next post by ID on a single page
- Add catagory attribute to custom shortcode
- Access the resized images generated by `add_image_size()`
- the_time function inside HTML dom parser
- Code auto escaping is not working when using short codes
- Shortcodes: Return different based on atts
- wp_register_script and wp_register_style when shortcode is used
- How can I hide the ACF shortcode when empty
- How to pass text input data to shortcode
- Using variable as shortcode parameter
- How to handle Ajax Calls, when using same shortcodes (with different parameters, e.g. ‘post-type’)?
- conditional shortcodes