It doesn’t appear that the variable $the_content
exists. I’m guessing what you want is the function the_content()
, but since that actually echoes its output, that won’t work either. You need to use the function get_the_content()
which will return the output (as opposed to echoing it).
Try this:
echo do_shortcode('[wcm_restrict plans="silver"]' . get_the_content() . '[/wcm_restrict]');
Related Posts:
- Return HTML Template Page with PHP Function
- Is there a way to parse shortcodes in PHP?
- Create dynamic content from one WP page to multiple other pages
- How does printf( __( ) ); work?
- Static Frontpage Pagination – Custom loop
- ob_get_clean returns empty string, ob_get_flush outputs string
- Export User Info to CSV from Front End
- Counting number of posts in a category and its sub categories and displaying result using shortcode
- Shortcode created to check language not works
- On this day PHP code
- How to loop over custom fields in a page template?
- Add/echo div with Analytics-Code to function in functions.php
- How do I hardcode a WordPress shortcode into my theme?
- How to return multiples lines in a shortcode?
- How can I default to all WordPress roles when parameter is not included in shortcode?
- PHP contact form returns warning in text widget [closed]
- Listing and displaying WooCommerce Shipping Zones in the frontend? [closed]
- Recent post display using shortcode
- How do I turn a shortcode into PHP code?
- Need to turn this php into WP shortcode
- Making Quote Plugin more efficient
- custom shortcode will not display the wrapped content
- How to properly insert a link to a template in WordPress?
- Custom field value not saving when it contains a URL?
- Create shortcodes within foreach loop (using array)
- Render ninja form inside markup
- Trigger popup in a php if/else statement
- Append HTML Using Shortcode
- How to output a PHP file values by shortcode?
- How can I get a single php file that is the equivalent of an existing WordPress page?
- How to display data from custom table in wordpress phpmyadmin
- Custom search results page not working with empty search
- I have a problem in the order of enqueues while enqueuing stylesheets and scripts for a specific page in my function.php
- Enable custom logo upload if logo is not in header
- How create a Shortcode with hover and complex options
- Remove from shortcode
- How can I edit the content in index.php? [duplicate]
- Get URL from shortcode tag
- PHP include is only working in certain places in my custom WP theme
- Only first shortcode gets executed
- Adding wrapper elements in the_date() like in the_title()?
- How to get all author posts outside of author templates
- echo something inside a shortcode
- Shortcode from a function not working
- Is it possible to return content, and then also continue to do other things?
- Creating WordPress Shortcode with Variable
- Catchable fatal error: Object of class stdClass could not be converted to string
- Could use some help with Shortcodes
- Shortcode for Listing Users from Meta Value?
- How to render a block from php template
- How to suppress template-parts in undescores?
- Creating custom page template from existing PHP site
- Shortcode to log user into current URL
- Shortcodes showing in excerpt despite using strip_shortcodes
- Conditional string comparison failing for basename/slug
- Calling PHP Titles inside Javascript Markup
- How to add new CSS file to new PHP file
- How to get my [shortcode] rendered on the home page, other pages are fine
- What is the difference between Null vs Empty (Zero Length) string?
- MySQL Query Returns Array () In Shortcode
- Show Featured Image Dimensions and size frontend with shortcode
- How to work Woocommerce pagination inside shortcode?
- How to get woocommerce orders with get_posts method in a shortcode
- Counting number of posts in multiple (sub)categories using shortcode
- Integrate admin plugin into template. Very interesant (live search + autocomplete with wp rest api, in vanilla js)
- Trying to create a shortcode to display categories with a specific product tag
- How to pass parameters in wordpress shortcode?
- Adding variable in WordPress shortcode
- Display a custom name when the user has no name settle in his account
- Execute Shortcode in Textfile
- Echo short code syntax
- custom taxonomies not working
- Polylang and template files
- How to return html as a string from php for WordPress
- Changing Date Format on Custom Meta Data w/shortcode call
- Add the shortcodes from the enfold theme to the other theme
- How to output values from a loop into a javascript array
- How to create dynamic templates?
- Change WooCommerce template for PDF – access to custom field
- Offset with ajax load more posts duplicates
- Short code into PHP
- How do I modify the Previous and Next Page posts on blog pages to include “previous” and “next” before the links?
- How can i iterate through this shortcode array?
- Shortcode in a $output statement
- Need help with PHP functions
- When using shortcode, content stops generating after the_content
- PHP Shortcode – 500 error
- Run PHP Results inside WP Shortcode
- Shortcode At top of Page – PHP 5.5 vs 5.4 – ob_start();
- On selecting shortcode generate selected shortcode table inside page editor worrdpress
- Problems With Query and/or Template Part and/or PHP
- Using the same shortcode to show any table from the database
- How to refresh a template page on WordPress in 3 seconds – easiest method?
- My title is showing after the shortcode
- Shortcode to include PHP file, pass various parameters to include?
- How to implement a custom sliding banner? [closed]
- Is there a better way to output HTML as a shortcode?
- Redirect loop upon installation of my plugin
- How can one use variables in a template or template part without polluting the global scope?
- Need Help With Making Full-Width Template for Blog Posts (common methods aren’t working)