{"id":31854,"date":"2014-09-20T23:24:54","date_gmt":"2014-09-20T23:24:54","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/priority-shortcodes\/"},"modified":"2024-04-15T22:19:01","modified_gmt":"2024-04-15T22:19:01","slug":"priority-shortcodes","status":"publish","type":"plugin","link":"https:\/\/cn.wordpress.org\/plugins\/priority-shortcodes\/","author":8005907,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"2.0.2","stable_tag":"trunk","tested":"6.5.8","requires":"2.5.0","requires_php":"","requires_plugins":null,"header_name":"Priority Shortcodes","header_author":"Greg Perham","header_description":"","assets_banners_color":"","last_updated":"2024-04-15 22:19:01","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/github.com\/swinggraphics\/Priority-Shortcodes","header_author_uri":"http:\/\/www.swinggraphics.com\/","rating":0,"author_block_rating":0,"active_installs":10,"downloads":1906,"num_ratings":1,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":{"2.0":"<ul>\n<li>This update changes the syntax for specifying your priority shortcodes!! You now use <code>[!<\/code> and the start and a single <code>]<\/code> at the end of your shortcodes.<\/li>\n<li>Priority shortcodes can now be used in text widgets<\/li>\n<\/ul>","1.0":"<p>Get it while it&#039;s hot.<\/p>"},"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":2439220,"resolution":"128x128","location":"assets","locale":""},"icon-256x256.png":{"filename":"icon-256x256.png","revision":2439220,"resolution":"256x256","location":"assets","locale":""}},"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[155767,357,1719],"plugin_category":[43,46],"plugin_contributors":[144826],"plugin_business_model":[],"class_list":["post-31854","plugin","type-plugin","status-publish","hentry","plugin_tags-classic-editor","plugin_tags-shortcodes","plugin_tags-tinymce","plugin_category-customization","plugin_category-editor-and-writing","plugin_contributors-swinggraphics","plugin_committers-swinggraphics"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/priority-shortcodes\/assets\/icon-128x128.png?rev=2439220","icon_2x":"https:\/\/ps.w.org\/priority-shortcodes\/assets\/icon-256x256.png?rev=2439220","generated":false},"screenshots":[],"raw_content":"<!--section=description-->\n<p><em>Intended for use with the Classic Editor plugin.<\/em><\/p>\n\n<p>Ever get annoyed or frustrated by the way TinyMCE+wpautop+do_shortcode wreak havoc on your shortcodes, wrapping <code>&lt;p&gt;<\/code>s around <code>&lt;div&gt;<\/code>s, leaving orphan <code>&lt;\/p&gt;<\/code>s, and all sorts of craziness? This plugin allows you to specify shortcodes to be processed before those other actions, generating the clean code you expected.<\/p>\n\n<p>Priority Shortcodes works by adding an action to <code>the_content<\/code> and <code>widget_text<\/code> hooks with a higher priority than <code>wpautop<\/code> and <code>do_shortcode<\/code>. The result is that those other actions run your shortcode's final output, rather than trying to guess if it should be wrapped in <code>&lt;p&gt;<\/code> tags, etc.<\/p>\n\n<p>The <a href=\"http:\/\/codex.wordpress.org\/Shortcode_API#Output\">Codex says<\/a>:<\/p>\n\n<blockquote>\n  <p>wpautop recognizes shortcode syntax and will attempt not to wrap p or br tags around shortcodes that stand alone on a line by themselves. Shortcodes intended for use in this manner should ensure that the output is wrapped in an appropriate block tag such as <code>&lt;p&gt;<\/code> or <code>&lt;div&gt;<\/code>.<\/p>\n<\/blockquote>\n\n<p>But sometimes shortcodes stand on their own on a line, wanting desperately to be wrapped in a paragraph tag, and sometimes they don't. Like a shortcode that generates a <code>&lt;span&gt;<\/code> tag with some classes. <em>(Yeah, you might want to use <a href=\"http:\/\/codex.wordpress.org\/TinyMCE_Custom_Styles\">custom TinyMCE styles<\/a> instead for a simple span.)<\/em><\/p>\n\n<h4>Usage<\/h4>\n\n<p>Where you want to process a shortcode with priority, use \"[!\" at the start. For example: <code>[my-shortcode]<\/code> becomes <code>[!my-shortcode]<\/code> and <code>[my-shortcode]Some content.[\/my-shortcode]<\/code> becomes <code>[!my-shortcode]Some content.[\/my-shortcode]<\/code>.<\/p>\n\n<h4>Gutenberg<\/h4>\n\n<p>Users of the new WordPress editor, \"Gutenberg\", will probably not use Priority Shortcodes within the new editor, but the plugin continues to work in the Classic Editor.<\/p>\n\n<!--section=installation-->\n<p>See the standard installation instructions at <a href=\"http:\/\/codex.wordpress.org\/Managing_Plugins#Installing_Plugins\">WordPress.org<\/a> or <a href=\"http:\/\/www.wpbeginner.com\/beginners-guide\/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners\/\">WPBeginner<\/a>.<\/p>\n\n<p>I expect developers will copy the code directly into their functions.php files, possibly customizing the string to specify the priority shortcodes.<\/p>\n\n<!--section=faq-->\n<dl>\n<dt id='does%20this%20affect%20all%20shortcodes%3F'><h3>Does this affect all shortcodes?<\/h3><\/dt>\n<dd><p>No. See \"Usage\" above.<\/p><\/dd>\n<dt id='should%20i%20use%20this%20everywhere%20instead%20of%20the%20normal%20shortcodes%3F'><h3>Should I use this everywhere instead of the normal shortcodes?<\/h3><\/dt>\n<dd><p>No. Only use it on shortcodes that are being messed up.<\/p><\/dd>\n<dt id='how%20does%20it%20work%3F'><h3>How does it work?<\/h3><\/dt>\n<dd><p>The plugin adds an action hook to <code>the_content<\/code> with priority 9, before <code>wpautop<\/code> and <code>do_shortcode<\/code>, which run with normal priority 10. The function that runs in our action hook is basically a copy\/mashup of <code>do_shortcode()<\/code> and <code>do_shortcode_tag()<\/code> with a custom regular expression. That regex pulled using <code>get_shortcode_regex()<\/code>, so any updates to that expression in core will be respected by this plugin. See <a href=\"https:\/\/core.trac.wordpress.org\/browser\/tags\/4.0\/src\/wp-includes\/shortcodes.php#L0\">shortcodes.php<\/a><\/p><\/dd>\n<dt id='why%20not%20just%20change%20the%20order%20wpautop%20and%20do_shortcode%20run%20in%3F'><h3>Why not just change the order wpautop and do_shortcode run in?<\/h3><\/dt>\n<dd><p>That can mess up other shortcodes. Plus, I've tried it, and it doesn't have the result I wanted at all.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>2.0.2<\/h4>\n\n<ul>\n<li>Tested with WP 5.6<\/li>\n<li>Updated README with note about Gutenberg<\/li>\n<\/ul>\n\n<h4>2.0.1<\/h4>\n\n<ul>\n<li>Bumped \"Tested up to\" version<\/li>\n<\/ul>\n\n<h4>2.0<\/h4>\n\n<ul>\n<li>Changed to more simple <code>[!<\/code> syntax<\/li>\n<li>Added compatibility with text widgets<\/li>\n<\/ul>\n\n<h4>1.0<\/h4>\n\n<ul>\n<li>Initial release<\/li>\n<\/ul>","raw_excerpt":"Processes specific shortcodes before wpautop() and do_shortcode()","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/31854","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=31854"}],"author":[{"embeddable":true,"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/swinggraphics"}],"wp:attachment":[{"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=31854"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=31854"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=31854"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=31854"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=31854"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/cn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=31854"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}