{"id":10647,"date":"2025-01-20T18:52:25","date_gmt":"2025-01-20T18:52:25","guid":{"rendered":"https:\/\/www.kadencewp.com\/help-center\/?post_type=docs&#038;p=10647"},"modified":"2026-04-22T16:12:48","modified_gmt":"2026-04-22T16:12:48","password":"","slug":"add-elements-after-specified-paragraphs","status":"publish","type":"docs","link":"https:\/\/www.kadencewp.com\/help-center\/docs\/kadence-theme\/add-elements-after-specified-paragraphs\/","title":{"rendered":"Adding Elements after Specified Paragraphs"},"content":{"rendered":"\n<p>When using <strong>Kadence Elements <\/strong><em>(available in <a href=\"https:\/\/www.kadencewp.com\/kadence-theme\/premium\/\" target=\"_blank\" rel=\"noreferrer noopener\">Theme Kit Pro)<\/a><\/em>, you may have noticed the <em>&#8220;After First, Second, Third, and Fourth Paragraphs&#8221;<\/em> <strong>Element<\/strong> <strong>Placement<\/strong> options.<\/p>\n\n\n<style>.kb-image10647_3f3dfe-e2.kb-image-is-ratio-size, .kb-image10647_3f3dfe-e2 .kb-image-is-ratio-size{max-width:200px;width:100%;}.wp-block-kadence-column > .kt-inside-inner-col > .kb-image10647_3f3dfe-e2.kb-image-is-ratio-size, .wp-block-kadence-column > .kt-inside-inner-col > .kb-image10647_3f3dfe-e2 .kb-image-is-ratio-size{align-self:unset;}.kb-image10647_3f3dfe-e2 figure{max-width:200px;}.kb-image10647_3f3dfe-e2 .image-is-svg, .kb-image10647_3f3dfe-e2 .image-is-svg img{width:100%;}.kb-image10647_3f3dfe-e2 .kb-image-has-overlay:after{opacity:0.3;}<\/style>\n<div class=\"wp-block-kadence-image kb-image10647_3f3dfe-e2\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"550\" height=\"870\" src=\"https:\/\/www.kadencewp.com\/help-center\/wp-content\/uploads\/sites\/14\/2025\/01\/Element-Settings.jpg\" alt=\"Element Settings\" class=\"kb-img wp-image-10648\" srcset=\"https:\/\/www.kadencewp.com\/help-center\/wp-content\/uploads\/sites\/14\/2025\/01\/Element-Settings.jpg 550w, https:\/\/www.kadencewp.com\/help-center\/wp-content\/uploads\/sites\/14\/2025\/01\/Element-Settings-190x300.jpg 190w, https:\/\/www.kadencewp.com\/help-center\/wp-content\/uploads\/sites\/14\/2025\/01\/Element-Settings-324x512.jpg 324w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\" \/><\/figure><\/div>\n\n\n\n<p>But what if you want to add a <strong>Hooked<\/strong> <strong>Element<\/strong> to a paragraph <span style=\"text-decoration: underline\">beyond<\/span> the <em>4th<\/em> one? You can achieve this by customizing and using a <strong>Code<\/strong> <strong>Snippet<\/strong>. <br><br>Code snippets can be added to the <code>functions.php<\/code> file of a <a href=\"https:\/\/www.kadencewp.com\/blog\/child-themes\/\" target=\"_blank\" rel=\"noreferrer noopener\">child theme <\/a>or through a plugin like Code Snippets. You can read documentation on using the Code Snippets Plugin <a href=\"https:\/\/www.kadencewp.com\/help-center\/docs\/kadence-theme\/how-to-add-a-custom-filter-or-function-with-code-snippets\/\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n<style>.wp-block-kadence-advancedheading.kt-adv-heading10647_0084e2-5c, .wp-block-kadence-advancedheading.kt-adv-heading10647_0084e2-5c[data-kb-block=\"kb-adv-heading10647_0084e2-5c\"]{margin-bottom:0px;font-size:var(--global-kb-font-size-md, 1.25rem);font-style:normal;}.wp-block-kadence-advancedheading.kt-adv-heading10647_0084e2-5c mark.kt-highlight, .wp-block-kadence-advancedheading.kt-adv-heading10647_0084e2-5c[data-kb-block=\"kb-adv-heading10647_0084e2-5c\"] mark.kt-highlight{font-style:normal;color:#f76a0c;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;}.wp-block-kadence-advancedheading.kt-adv-heading10647_0084e2-5c img.kb-inline-image, .wp-block-kadence-advancedheading.kt-adv-heading10647_0084e2-5c[data-kb-block=\"kb-adv-heading10647_0084e2-5c\"] img.kb-inline-image{width:150px;vertical-align:baseline;}<\/style>\n<p class=\"kt-adv-heading10647_0084e2-5c wp-block-kadence-advancedheading\" data-kb-block=\"kb-adv-heading10647_0084e2-5c\"><strong>Code Snippet<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"margin-top:var(--wp--preset--spacing--30);margin-bottom:var(--wp--preset--spacing--30)\"><code lang=\"php\" class=\"language-php line-numbers\">add_action( 'the_content', 'myplugin_inject_content' );\nfunction myplugin_inject_content( $content ) {\n\n    $additional_content = do_shortcode('');\n\n    if ( is_single() ) {\n        $paragraph_position = 8; \/\/position start from 0; position 8 will show the element content after the 9th paragraph\n        $content = myplugin_prefix_insert_after_paragraph( $additional_content, $paragraph_position, $content );      \n    }\n\n    return $content;\n}\nfunction myplugin_prefix_insert_after_paragraph( $additional_content, $paragraph_position, $content ) {\n    $paragraphs = explode( '&lt;\/p&gt;', $content );\n    foreach ($paragraphs as $key =&gt; $paragraph) {\n        \/\/add closing p back\n        if ( trim( $paragraph ) != '' ) {\n            $paragraphs[$key] .= '&lt;\/p&gt;';\n        }\n        \/\/add additional content at the wanted position \n        if ( $paragraph_position == $key ) {\n            $paragraphs[$key] .= $additional_content;\n        }\n    }\n\n    return implode( '', $paragraphs );\n}<\/code><\/pre>\n\n\n\n<p>This code snippet requires two modifications. The first modification is on the <strong>4th<\/strong> line of code:<br><code>$additional_content = do_shortcode();<\/code> <\/p>\n\n\n\n<p><br>Inside the parentheses and quotes, you should paste your <strong>Element&#8217;s Shortcode<\/strong>.<br><br>You can find your <em>Element<\/em> <em>Shortcode<\/em> by navigating to <strong>Dashboard -&gt; Appearance -&gt; Kadence -&gt; Elements<\/strong> and checking the element details.<\/p>\n\n\n<style>.kb-image10647_e3fee9-74 .kb-image-has-overlay:after{opacity:0.3;}<\/style>\n<figure class=\"wp-block-kadence-image kb-image10647_e3fee9-74 size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"2560\" height=\"1053\" src=\"https:\/\/www.kadencewp.com\/help-center\/wp-content\/uploads\/sites\/14\/2025\/01\/ElementID-scaled.jpg\" alt=\"ElementID\" class=\"kb-img wp-image-10649\" srcset=\"https:\/\/www.kadencewp.com\/help-center\/wp-content\/uploads\/sites\/14\/2025\/01\/ElementID-scaled.jpg 2560w, https:\/\/www.kadencewp.com\/help-center\/wp-content\/uploads\/sites\/14\/2025\/01\/ElementID-300x123.jpg 300w, https:\/\/www.kadencewp.com\/help-center\/wp-content\/uploads\/sites\/14\/2025\/01\/ElementID-1024x421.jpg 1024w, https:\/\/www.kadencewp.com\/help-center\/wp-content\/uploads\/sites\/14\/2025\/01\/ElementID-768x316.jpg 768w, https:\/\/www.kadencewp.com\/help-center\/wp-content\/uploads\/sites\/14\/2025\/01\/ElementID-1536x632.jpg 1536w, https:\/\/www.kadencewp.com\/help-center\/wp-content\/uploads\/sites\/14\/2025\/01\/ElementID-2048x842.jpg 2048w, https:\/\/www.kadencewp.com\/help-center\/wp-content\/uploads\/sites\/14\/2025\/01\/ElementID-360x148.jpg 360w\" sizes=\"auto, (max-width: 2560px) 100vw, 2560px\" \/><\/figure>\n\n\n<style>.wp-block-kadence-advancedheading.kt-adv-heading10647_ec56d2-ba, .wp-block-kadence-advancedheading.kt-adv-heading10647_ec56d2-ba[data-kb-block=\"kb-adv-heading10647_ec56d2-ba\"]{margin-bottom:0px;font-style:normal;}.wp-block-kadence-advancedheading.kt-adv-heading10647_ec56d2-ba mark.kt-highlight, .wp-block-kadence-advancedheading.kt-adv-heading10647_ec56d2-ba[data-kb-block=\"kb-adv-heading10647_ec56d2-ba\"] mark.kt-highlight{font-style:normal;color:#f76a0c;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;}.wp-block-kadence-advancedheading.kt-adv-heading10647_ec56d2-ba img.kb-inline-image, .wp-block-kadence-advancedheading.kt-adv-heading10647_ec56d2-ba[data-kb-block=\"kb-adv-heading10647_ec56d2-ba\"] img.kb-inline-image{width:150px;vertical-align:baseline;}<\/style>\n<p class=\"kt-adv-heading10647_ec56d2-ba wp-block-kadence-advancedheading\" data-kb-block=\"kb-adv-heading10647_ec56d2-ba\">Once you have found the Element ShortCode, you can paste it inside of the provided <strong>Code<\/strong> <strong>Snippet<\/strong>. This should make the <strong>4th<\/strong> line of code look something like this:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><code>$additional_content = do_shortcode('[kadence_element id=\"2297\"]');<\/code> <\/p>\n\n\n\n<p>The next modification is to specify which <strong>Paragraph<\/strong> the element will display after. This is located on the <strong>7th<\/strong> line of code:<br><code>$paragraph_position = 8;<\/code><br><br>You can adjust the number <code>8<\/code> to match the specific paragraph number you want the element to display after. Keep in mind that paragraph counting in this custom code <span style=\"text-decoration: underline\">starts from<\/span> <code>0<\/code>, <strong><span style=\"text-decoration: underline\">not<\/span><\/strong> <code>1<\/code>. So, if the paragraph position is set to <code>8<\/code>, the element will display after the <strong>9th<\/strong> <span style=\"text-decoration: underline\">paragraph<\/span>.<br><br>With this snippet, you can place the <strong>Hooked<\/strong> <strong>Element<\/strong> deeper into the content than the default options allow, making Hooked Elements even more customizable.<br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When using Kadence Elements (available in Theme Kit Pro), you may have noticed the &#8220;After First, Second, Third, and Fourth Paragraphs&#8221; Element Placement options. But what if you want to add a Hooked Element to a paragraph beyond the 4th one? You can achieve this by customizing and using a Code Snippet. Code snippets can&#8230;<\/p>\n","protected":false},"author":148263,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kadence_starter_templates_imported_post":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"doc_category":[405],"doc_tag":[],"knowledge_base":[6],"class_list":["post-10647","docs","type-docs","status-publish","hentry","doc_category-theme-advanced","knowledge_base-kadence-theme"],"year_month":"2026-04","word_count":381,"total_views":"1154","reactions":{"happy":"0","normal":"0","sad":"1"},"author_info":{"display_name":"victormonk","author_link":"https:\/\/www.kadencewp.com\/help-center\/author\/victormonk\/"},"doc_category_info":[{"term_name":"Advanced","term_url":"https:\/\/www.kadencewp.com\/help-center\/knowledge-base\/kadence-theme\/theme-advanced\/"}],"doc_tag_info":[],"knowledge_base_info":[{"term_name":"Kadence Theme","term_url":"https:\/\/www.kadencewp.com\/help-center\/knowledge-base\/kadence-theme\/","term_slug":"kadence-theme"}],"knowledge_base_slug":["kadence-theme"],"taxonomy_info":{"doc_category":[{"value":405,"label":"Advanced"}],"knowledge_base":[{"value":6,"label":"Kadence Theme"}]},"featured_image_src_large":false,"comment_info":0,"_links":{"self":[{"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/docs\/10647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/users\/148263"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/comments?post=10647"}],"version-history":[{"count":17,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/docs\/10647\/revisions"}],"predecessor-version":[{"id":10905,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/docs\/10647\/revisions\/10905"}],"wp:attachment":[{"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/media?parent=10647"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/doc_category?post=10647"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/doc_tag?post=10647"},{"taxonomy":"knowledge_base","embeddable":true,"href":"https:\/\/www.kadencewp.com\/help-center\/wp-json\/wp\/v2\/knowledge_base?post=10647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}