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
- Shortcode always displaying at the top of the page
- Hide/show content starting in the middle of a paragraph
- short code output too early
- Create custom [sourcecode] shortcode, the right way?
- TED talks shortcode not working
- Organizing shortcodes. How to display all of them and their attributes?
- Set wmode attribute to transparent for the embed shortcode to make drop-down menu hover over YouTube embed in Internet Explorer
- How to create a shortcode to display a category description?
- How to prevent tinymce macro from inserting nbsp;?
- Pros and cons of actions over shortcodes
- conditional shortcode not working
- Correct way to pass information between seperate shortcode functions
- How best to apply do_shortcode in media.php for captions
- If numberposts = -1 offset won’t work
- Shortcode are not working in Option tree textarea
- Applying filters to the_content() to separate content if any `add_shortcode()` is found?
- Wp_localize_script from Shortcode [closed]
- Localization inside shortcode not working
- Font Awesome Icons Won’t Work
- Woocommerce, ordering products by default on shortcode pages
- detect when shortcode ran for the last time
- How can a shortcode can take the place of the featured image in a post?
- Shortcode for Twitter Bootstrap Collapse
- Is there any inherent difference between add_filter() and add_shortcode() for modifying [caption]?
- Different uniqid when calld in wp_localize_script and shortcode
- How do I debug a short code?
- Gravity forms customize field markup for the same form appearing in different places
- How to type shortcode-like text in WordPress TinyMCE visual editor?
- Does registering multiple shortcodes impact performance?
- Gallery shortcode – change link file image size? (not using default fullsize image)
- add action only if gallery shortcode attribute is equal to?
- Shortcode for order number [closed]
- Edit shortcode in post content programatically
- How to change to local video player on shortcode ultimate to video.js?
- Buddypress shortcode for tabs [closed]
- PHP Running On CMS Side of WordPress
- Basic do shortcodes question
- What is this format called (nested shortcodes)?
- Problem with height in video shortcode
- Shortcode not showing $content in correct place
- Best tools for preparing and styling a table [closed]
- When are Shortcode Attributes Available in Template
- How can I insert a shortcode in the title tag of another?
- Shortcode inside text widget do not call enqueue style
- How to create a dropdown of shortcodes in edit mode for posts
- How to execute a shortcode outside the post content/entry in a theme?
- Metabox Keeps Stripping Parts of Shortcode
- Form processing: How to process form before output and access data from shortcode
- How to Retrieve data of Gallery Shortcode and display it above a post
- Checking post content for a shortcode, but content is being returned as empty
- do_shortcode() won’t return PHP Array
- Shortcode and variable
- Adding my own custom woocommerce shortcode to child theme, how?
- contact form 7 :create shortcode usable in email message [closed]
- Show shortcode only in posts
- Better way to display multiple plugin output on the same page?
- get_queried_object_id / short code returning blank
- Shortcode won’t take into account custom post ID put in parameter
- How to utilise multiple values from a single shortcode attribute?
- JavaScript missing from shortcode content
- shortcode to display specific recent posts
- How to test If a post has a particular term
- wp_link_pages shortcode for ‘nextpagelink’
- Function in a wordpress shortcode
- Impossible to display modification in shortcode code?
- Use Shortcode on Custom Page
- WordPress Database Error using $wpdb->get_results()
- Shortcode or Template Page
- Ajax callback and shortcode functionality
- Duplicate short code duplicating some values only
- Shortcode for External HTML
- How to implement theme shortcodes in text outside of pages?
- Video Shortcode Only Returning a Link
- Featured image with link to post shortcode, image displaying above the post
- Manipulated shortcode output
- Where is escaped the shortcode?
- How to stop unwanted splits in excerpts when using shortcodes for sliders or players
- Changing layout of defaul gallery output to masonry
- shortcode change variable base on user
- Inserting shortcode is blanking excerpt – any ideas?
- Escaping a shortcode so it displays as-is [duplicate]
- If do_shortcode is blank, return some message
- Previous/Next with the same category
- I’ve broken the short code for Contact Form 7!
- echo a shortcode in a shortcode code?
- Applying if (get_post_meta) to new shortcode
- Nested ShortCode works inside the_content, but not outside of it
- I have the query code but not the shortcode
- wordpress how to sort posts on custom data with plug-in “Search & Filter”