A more recent version for ClassicPress is available at https://github.com/basic-tech/classic-shortcode-tester.
The shortcode tester is a very simple post content editor tool for displaying the HTML generated from WordPress shortcodes in a popup window. To display the shortcode tester from the post editor page click on the Shortcode Tester button in the editor’s toolbar at the top of the page. (For the “Block Editor” it should be to the immediate right of the Block Navigation button. For the “Classic Editor” it should be to the immediate right of the “Add Media” button.)
Enter the shortcode into the left pane. ([ gallery ] in this example.) Click on the Evaluate button. The HTML generated by the shortcode will be displayed in the right pane. Of course the shortcode is evaluated in the context of the post in the editor. The other buttons lets you hide one of the panes to give you a larger view of the other pane.
Differences between the “Shortcode Tester” and WordPress evaluations of the shortcode
There is a tiny possibility that the environment that the shortcode tester uses to evaluate the shortcode will differ from the environment when the post is normally rendered. The shortcode tester sends a HTTP request for the post in editor to the server. The server processes this request normally until the time to render the HTML. Then a ‘template_redirect’ action renders the HTML using a special template that only renders the shortcode instead of rendering the entire post. Since, the normal template is not used, the filters and actions in the normal template will not be done. There is a small possibility that these filters and actions could have changed the environment in a way that affects the rendering of the shortcode.
Notes on the implementation of the “Show Rendered” feature
Frequently Asked Questions
Error: Permalink not found. Please report this to the developer.
“The Shortcode Tester” uses permalinks. In particular, it will not work with posts or pages that have not been saved.
“Show Rendered” shows more than the shortcode HTML elements.
“The Shortcode Tester” tries to hide HTML elements that are not part of the shortcode. It assumes that the current theme uses the standard WordPress framework for emitting the header, the content, sidebars and the footer ( actions/filters such as ‘the_content’, ‘get_sidebar’, ‘get_footer’, … ). If the current theme deviates from this framework “The Shortcode Tester” will not be able to properly identify the header, sidebars and/or the footer.
“Show Rendered” shows less than the shortcode HTML elements.