{"id":13959,"date":"2011-07-10T07:51:32","date_gmt":"2011-07-10T07:51:32","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/shortcode-empty-paragraph-fix\/"},"modified":"2016-01-22T19:08:42","modified_gmt":"2016-01-22T19:08:42","slug":"shortcode-empty-paragraph-fix","status":"publish","type":"plugin","link":"https:\/\/pcd.wordpress.org\/plugins\/shortcode-empty-paragraph-fix\/","author":7741846,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"0.2","stable_tag":"trunk","tested":"4.8.28","requires":"2.5","requires_php":"","requires_plugins":"","header_name":"Shortcode Empty Paragraph Fix","header_author":"","header_description":"","assets_banners_color":"","last_updated":"2016-01-22 19:08:42","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"http:\/\/www.johannheyne.de\/wordpress\/shortcode-empty-paragraph-fix\/","header_author_uri":"http:\/\/www.johannheyne.de","rating":4.6,"author_block_rating":0,"active_installs":900,"downloads":26128,"num_ratings":20,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog","faq"],"tags":[],"upgrade_notice":[],"ratings":{"1":"2","2":0,"3":0,"4":0,"5":"19"},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[483,80],"plugin_category":[43],"plugin_contributors":[80589],"plugin_business_model":[],"class_list":["post-13959","plugin","type-plugin","status-publish","hentry","plugin_tags-fix","plugin_tags-shortcode","plugin_category-customization","plugin_contributors-jonua","plugin_committers-jonua"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/shortcode-empty-paragraph-fix.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Fix <a href=\"http:\/\/core.trac.wordpress.org\/ticket\/12061\">known issues<\/a> when shortcodes are embedded in a block of content that is filtered by wpautop.<\/p>\n\n<h4>for Theme Developers<\/h4>\n\n<p>If you are developing a theme to provide this on a marketplace, you better embed the following code in your functions.php. This code filters only the shortcodes you defined. Otherwise you risk a failed review because the code in the plugin filters content in general which may is not acceptet.<\/p>\n\n<pre><code>function shortcode_empty_paragraph_fix( $content ) {\n\n    \/\/ define your shortcodes to filter, '' filters all shortcodes\n    $shortcodes = array( 'your_shortcode_1', 'your_shortcode_2' );\n\n    foreach ( $shortcodes as $shortcode ) {\n\n        $array = array (\n            '&lt;p&gt;[' . $shortcode =&gt; '[' .$shortcode,\n            '&lt;p&gt;[\/' . $shortcode =&gt; '[\/' .$shortcode,\n            $shortcode . ']&lt;\/p&gt;' =&gt; $shortcode . ']',\n            $shortcode . ']&lt;br \/&gt;' =&gt; $shortcode . ']'\n        );\n\n        $content = strtr( $content, $array );\n    }\n\n    return $content;\n}\n\nadd_filter( 'the_content', 'shortcode_empty_paragraph_fix' );\n<\/code><\/pre>\n\n<p>Another solution that is acceptet at the envato (themeforest) marketplace comes from <a href=\"https:\/\/gist.github.com\/bitfade\/4555047\" title=\"a Gist on Github\">bitfade<\/a>.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload folder <code>shortcode-empty-paragraph-fix<\/code> to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<\/ol>\n\n<p>or<\/p>\n\n<p>If you dont want to use a whole plugin to solve that bug, you can copy the code of the plugin file shortcode-empty-paragraph-fix.php into your theme function.php<\/p>\n\n<!--section=changelog-->\n<h4>0.1<\/h4>\n\n<ul>\n<li>Initial Release<\/li>\n<\/ul>\n\n<h4>0.2<\/h4>\n\n<ul>\n<li>nicer code writing style<\/li>\n<\/ul>\n\n<!--section=faq-->\n<dl>\n<dt>Installation Instructions<\/dt>\n<dd><ol>\n<li>Upload folder <code>shortcode-empty-paragraph-fix<\/code> to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<\/ol>\n\n<p>or<\/p>\n\n<p>If you dont want to use a whole plugin to solve that bug, you can copy the code of the plugin file shortcode-empty-paragraph-fix.php into your theme function.php<\/p><\/dd>\n\n<\/dl>","raw_excerpt":"Fix known issues when shortcodes are embedded in a block of content that is filtered by wpautop.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/13959","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=13959"}],"author":[{"embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/jonua"}],"wp:attachment":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=13959"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=13959"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=13959"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=13959"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=13959"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=13959"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}