{"id":1319,"date":"2013-12-02T20:53:32","date_gmt":"2013-12-02T20:53:32","guid":{"rendered":"http:\/\/musilda.cz\/?p=1319"},"modified":"2013-12-02T20:53:32","modified_gmt":"2013-12-02T20:53:32","slug":"jak-odstranit-prazdne-radky-z-obsahu-clanku","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/jak-odstranit-prazdne-radky-z-obsahu-clanku\/","title":{"rendered":"Jak odstranit pr\u00e1zdn\u00e9 \u0159\u00e1dky z obsahu \u010dl\u00e1nku"},"content":{"rendered":"\n

WordPress \u010dasto vkl\u00e1d\u00e1 v editoru pr\u00e1zdn\u00e9 html tagy p, nebo tak pro zalomen\u00ed \u0159\u00e1dku br. Pokud pot\u0159ebujete tagy p a br odstranit, pom\u016f\u017ee v\u00e1m n\u011bkolik n\u00e1sleduj\u00edc\u00edch tip\u016f. Jestli\u017ee \u010dasto pou\u017e\u00edv\u00e1te shortcody, jist\u011b se v\u00e1m ji\u017e stalo, \u017ee p\u0159i od\u0159\u00e1dkov\u00e1n\u00ed dal\u0161\u00edho shortcodu v editoru, je mezi n\u011b vlo\u017een pr\u00e1zdn\u00fd p tag. Pokud mezi nimi nen\u00ed mezera, zobraz\u00ed se sice spr\u00e1vn\u011b, ale v editoru se v tom nevyzn\u00e1te.<\/p>\n\n\n\n

N\u011bkolik tip\u016f pro odstran\u011bn\u00ed tag\u016f p a br:<\/p>\n\n\n\n

Odstran\u011bn\u00ed <p><\/p> pomoc\u00ed css:<\/p>\n\n\n\n

p:empty { display: none }\n<\/pre>\n\n\n\n

Odstran\u011bn\u00ed <p><\/p> pomoc\u00ed jQuery:<\/p>\n\n\n\n

$('p:empty').remove();\n<\/pre>\n\n\n\n

Odstran\u011bn\u00ed tag\u016f <p><\/p> a <br \/> pomoc\u00ed php:<\/p>\n\n\n\n

add_filter('the_content', 'remove_empty_p', 20, 1);\nfunction remove_empty_p($content){\n    $content = force_balance_tags($content);\n    return preg_replace('#<\/pre>\n\n\n\n

\\s*+(<br\\s*\/*>)?\\s*<\/p>\n\n\n\n

#i', '', $content);\n}\n<\/pre>\n\n\n\n

Odstran\u011bn\u00ed tag\u016f <p><\/p> a <br \/> pomoc\u00ed php pouze u shortcod\u016f:<\/p>\n\n\n\n

add_filter('the_content', 'clean_content');\nfunction clean_content($content){\n    $array = array (\n        '<\/pre>\n\n\n\n

[‚ => ‚[‚, ‚]<\/p>\n\n\n\n

' => ']',\n        ']
' => ']'\n );\n $content = strtr($content, $array);\n return $content;\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

WordPress \u010dasto vkl\u00e1d\u00e1 v editoru pr\u00e1zdn\u00e9 html tagy p, nebo tak pro zalomen\u00ed \u0159\u00e1dku br. Pokud pot\u0159ebujete tagy p a br odstranit, pom\u016f\u017ee v\u00e1m n\u011bkolik n\u00e1sleduj\u00edc\u00edch tip\u016f. Jestli\u017ee \u010dasto pou\u017e\u00edv\u00e1te shortcody, jist\u011b se v\u00e1m ji\u017e stalo, \u017ee p\u0159i od\u0159\u00e1dkov\u00e1n\u00ed dal\u0161\u00edho shortcodu v editoru, je mezi n\u011b vlo\u017een pr\u00e1zdn\u00fd p tag. Pokud mezi nimi nen\u00ed mezera,<\/p>\n","protected":false},"author":1,"featured_media":8624,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,19],"tags":[268],"class_list":["post-1319","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-navody","category-snippety","tag-odstraneni-html-tagu"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/1319"}],"collection":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/comments?post=1319"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/1319\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/8624"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=1319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=1319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=1319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}