Small Plugins
Products
Use Cases
Pricing
Get Help
Log in
Become a Member
Home / Articles / Knowledge Base

How to insert Dynamic Connector blocks in bulk

Author:

smallplugins

Published:

March 31, 2023
November 16, 2023

This site runs ads and generates income from affiliate links. Read my disclosure policy.

We recommend inserting Dynamic Connector block(s) manually so you can tailor the placement of your content manually. However, the fastest way to get up-and-running with this plugin is to have this block inserted site-wide. There are a few ways you might go about this:

  1. Use a block/site editor theme, where you can edit your theme’s site layout to include this block at the top or bottom of all posts.
  2. Use our FREE plugin, Automatic Block Inserter! Here’s a tutorial that shares specifically how to insert a generic site-wide email subscribe form.
  3. Use a plugin, like Insert Blocks Before or After Posts Content, as a stop-gap solution to achieve the same result.
  4. Write some custom code to a reusable block (holding your Dynamic Connector block…) within your post content (using some formula, like after the first paragraph).
add_filter( 'the_content', 'sp_bulk_insert_block' );
function sp_bulk_insert_block ( $content ) {
	
	if ( is_single() ) {

		$pattern = '#(.*?<\/p>)(.*)#s'; // after first paragraph
		$replacement = '$1' . do_blocks( get_post( REUSABLE_BLOCK_ID )->post_content ); . '$2';
		$subject = $content;

		$content = preg_replace( $pattern, $replacement, $subject );
		
	}

	return $content;

}

Follow us on YouTube!

We share tutorials to help you implement our plugins and level up your site’s content on our YouTube channel.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Resources

About
Blog
Support
Roadmap
Email List
Affiliates
Membership

Products


Advanced List Extension
Automatic Block Inserter
Automatic FAQ Toggle
Category Labels Block
Clear Content Button
Device Display for Blocks
Dynamic Connector Block
Featured Comment Block
Form Tags for Recipes
Genesis Description Fallbacks
Grid Variation Options
Image Overlay Cues
Manage Available Patterns
Navigation Block Controls
Post Date Smarter Modified
Post Type Exclusives
Post Type Product Links
Query Loop Advanced Operators
Query Loop Exclude Current Post
Query Loop Post Selector
Remove Last Item from Yoast Breadcrumb

Terms & Conditions
Privacy Policy
Refund Policy
Coupon Codes

© Small Plugins