Changeset 3378435
- Timestamp:
- 10/14/2025 08:56:13 PM (2 months ago)
- Location:
- blocks-randomizer
- Files:
-
- 19 added
- 9 edited
-
assets/screenshot-1.png (added)
-
assets/screenshot-2.png (added)
-
assets/screenshot-3.gif (added)
-
tags/1.2.0 (added)
-
tags/1.2.0/blocks-randomizer.php (added)
-
tags/1.2.0/build (added)
-
tags/1.2.0/build/blocks-manifest.php (added)
-
tags/1.2.0/build/blocks-randomizer (added)
-
tags/1.2.0/build/blocks-randomizer/block.json (added)
-
tags/1.2.0/build/blocks-randomizer/index-rtl.css (added)
-
tags/1.2.0/build/blocks-randomizer/index.asset.php (added)
-
tags/1.2.0/build/blocks-randomizer/index.css (added)
-
tags/1.2.0/build/blocks-randomizer/index.js (added)
-
tags/1.2.0/build/blocks-randomizer/render.php (added)
-
tags/1.2.0/build/blocks-randomizer/style-index-rtl.css (added)
-
tags/1.2.0/build/blocks-randomizer/style-index.css (added)
-
tags/1.2.0/build/blocks-randomizer/view.asset.php (added)
-
tags/1.2.0/build/blocks-randomizer/view.js (added)
-
tags/1.2.0/readme.txt (added)
-
trunk/blocks-randomizer.php (modified) (3 diffs)
-
trunk/build/blocks-manifest.php (modified) (1 diff)
-
trunk/build/blocks-randomizer/block.json (modified) (1 diff)
-
trunk/build/blocks-randomizer/index-rtl.css (modified) (1 diff)
-
trunk/build/blocks-randomizer/index.asset.php (modified) (1 diff)
-
trunk/build/blocks-randomizer/index.css (modified) (1 diff)
-
trunk/build/blocks-randomizer/index.js (modified) (1 diff)
-
trunk/build/blocks-randomizer/render.php (modified) (1 diff)
-
trunk/readme.txt (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
blocks-randomizer/trunk/blocks-randomizer.php
r3377706 r3378435 1 1 <?php 2 2 /** 3 * Plugin Name: Blocks Randomizer3 * Plugin Name: Content Randomizer - Rotate Any Block 4 4 * Plugin URI: https://github.com/slaffik/blocks-randomizer 5 * Description: Display randomly any of the top-level blocks within "Blocks Randomizer" main block.6 * Version: 1. 1.05 * Description: Display randomly any of the top-level blocks within the "Blocks Randomizer" main block. 6 * Version: 1.2.0 7 7 * Requires at least: 6.7 8 8 * Requires PHP: 7.4 … … 35 35 if ( function_exists( 'wp_register_block_types_from_metadata_collection' ) ) { 36 36 wp_register_block_types_from_metadata_collection( __DIR__ . '/build', __DIR__ . '/build/blocks-manifest.php' ); 37 37 38 return; 38 39 } … … 57 58 } 58 59 } 60 59 61 add_action( 'init', 'blocks_randomizer_block_init' ); -
blocks-randomizer/trunk/build/blocks-manifest.php
r3377706 r3378435 6 6 'apiVersion' => 3, 7 7 'name' => 'blocks-randomizer/holder', 8 'version' => '1. 1.0',8 'version' => '1.2.0', 9 9 'title' => 'Blocks Randomizer', 10 10 'category' => 'widgets', -
blocks-randomizer/trunk/build/blocks-randomizer/block.json
r3377706 r3378435 3 3 "apiVersion": 3, 4 4 "name": "blocks-randomizer/holder", 5 "version": "1. 1.0",5 "version": "1.2.0", 6 6 "title": "Blocks Randomizer", 7 7 "category": "widgets", -
blocks-randomizer/trunk/build/blocks-randomizer/index-rtl.css
r3377706 r3378435 1 .wp-block-blocks-randomizer-holder {background-color:#fff;border-radius:2px;box-shadow:inset 0 0 0 1px #1e1e1e;margin:0;outline:1px solid transparent;padding:24px;position:relative}.wp-block-blocks-randomizer-holder>:last-of-type{margin-bottom:0}.wp-block-blocks-randomizer-holder.is-selected{outline:2px solid #007cba;outline-offset:2px}1 .wp-block-blocks-randomizer-holder.has-child-selected,.wp-block-blocks-randomizer-holder.is-selected{outline:2px solid #007cba;outline-offset:2px}.wp-block-blocks-randomizer-holder-inner{background-color:#fff;border-radius:2px;box-shadow:inset 0 0 0 1px #1e1e1e;margin:0;outline:1px solid transparent;padding:24px;position:relative}.wp-block-blocks-randomizer-holder-inner>:last-of-type{margin-bottom:0}.wp-block-blocks-randomizer-holder-inner>:first-of-type{margin-top:0} -
blocks-randomizer/trunk/build/blocks-randomizer/index.asset.php
r3377706 r3378435 1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => ' 4fdc8f3d748bd649e015');1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'a9b205ac64d831a070ad'); -
blocks-randomizer/trunk/build/blocks-randomizer/index.css
r3377706 r3378435 1 .wp-block-blocks-randomizer-holder {background-color:#fff;border-radius:2px;box-shadow:inset 0 0 0 1px #1e1e1e;margin:0;outline:1px solid transparent;padding:24px;position:relative}.wp-block-blocks-randomizer-holder>:last-of-type{margin-bottom:0}.wp-block-blocks-randomizer-holder.is-selected{outline:2px solid #007cba;outline-offset:2px}1 .wp-block-blocks-randomizer-holder.has-child-selected,.wp-block-blocks-randomizer-holder.is-selected{outline:2px solid #007cba;outline-offset:2px}.wp-block-blocks-randomizer-holder-inner{background-color:#fff;border-radius:2px;box-shadow:inset 0 0 0 1px #1e1e1e;margin:0;outline:1px solid transparent;padding:24px;position:relative}.wp-block-blocks-randomizer-holder-inner>:last-of-type{margin-bottom:0}.wp-block-blocks-randomizer-holder-inner>:first-of-type{margin-top:0} -
blocks-randomizer/trunk/build/blocks-randomizer/index.js
r3377706 r3378435 1 (()=>{"use strict";var e, r={334:()=>{const e=window.wp.blocks,r=window.wp.i18n,o=window.wp.blockEditor,n=window.wp.components,t=window.wp.element,s=window.ReactJSXRuntime,l=JSON.parse('{"UU":"blocks-randomizer/holder"}');(0,e.registerBlockType)(l.UU,{keywords:[(0,r.__)("content","blocks-randomizer"),(0,r.__)("random","blocks-randomizer"),(0,r.__)("randomizer","blocks-randomizer")],example:{innerBlocks:[{name:"core/heading",attributes:{level:1,content:(0,r.__)("Randomly display custom block inside","blocks-randomizer")}},{name:"core/spacer",attributes:{height:"25px"}},{name:"core/heading",attributes:{level:2,content:(0,r.__)("it can be images ...","blocks-randomizer")}},{name:"core/heading",attributes:{level:2,content:(0,r.__)("... or any text blocks","blocks-randomizer")}}]},edit:function({attributes:e,setAttributes:l}){const{numberOfItems:a}=e,[i]=(0,t.useState)(null),c=(0,o.useBlockProps)({}),d=(0,o.useInnerBlocksProps)({allowedBlocks:i,template:[["core/paragraph",{placeholder:(0,r.__)("Start typing or add any block inside this container...","blocks-randomizer")}]],templateLock:!1,renderAppender:()=>null});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.InspectorControls,{children:(0,s.jsx)(n.PanelBody,{title:(0,r.__)("Display","blocks-randomizer"),initialOpen:!0,children:(0,s.jsx)(n.__experimentalNumberControl,{label:(0,r.__)("Number of child blocks to display","blocks-randomizer"),help:(0,r.__)("How many random blocks to show on the front-end. If you specify more than available, all blocks will be displayed.","blocks-randomizer"),value:a,onChange:e=>{const r=parseInt(e,10);(r>0||""===e)&&l({numberOfItems:r||1})},required:!0,min:1,step:1})})}),(0,s.jsx)("div",{...c,children:(0,s.jsx)("div",{...d})})]})},save:function({attributes:e,innerBlocks:r}){const n=o.useBlockProps.save({}),t=o.useInnerBlocksProps.save({...n});return(0,s.jsx)("div",{...t})}})}},o={};function n(e){var t=o[e];if(void 0!==t)return t.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,n),s.exports}n.m=r,e=[],n.O=(r,o,t,s)=>{if(!o){var l=1/0;for(d=0;d<e.length;d++){for(var[o,t,s]=e[d],a=!0,i=0;i<o.length;i++)(!1&s||l>=s)&&Object.keys(n.O).every(e=>n.O[e](o[i]))?o.splice(i--,1):(a=!1,s<l&&(l=s));if(a){e.splice(d--,1);var c=t();void 0!==c&&(r=c)}}return r}s=s||0;for(var d=e.length;d>0&&e[d-1][2]>s;d--)e[d]=e[d-1];e[d]=[o,t,s]},n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e={414:0,650:0};n.O.j=r=>0===e[r];var r=(r,o)=>{var t,s,[l,a,i]=o,c=0;if(l.some(r=>0!==e[r])){for(t in a)n.o(a,t)&&(n.m[t]=a[t]);if(i)var d=i(n)}for(r&&r(o);c<l.length;c++)s=l[c],n.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return n.O(d)},o=globalThis.webpackChunkblocks_randomizer=globalThis.webpackChunkblocks_randomizer||[];o.forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o))})();var t=n.O(void 0,[650],()=>n(334));t=n.O(t)})();1 (()=>{"use strict";var e,o={334:()=>{const e=window.wp.blocks,o=window.wp.i18n,r=window.wp.blockEditor,n=window.wp.components,t=window.wp.element,a=window.ReactJSXRuntime,l=JSON.parse('{"UU":"blocks-randomizer/holder"}');(0,e.registerBlockType)(l.UU,{keywords:[(0,o.__)("content","blocks-randomizer"),(0,o.__)("random","blocks-randomizer"),(0,o.__)("randomizer","blocks-randomizer")],example:{innerBlocks:[{name:"core/heading",attributes:{level:1,content:(0,o.__)("Randomly display custom block inside","blocks-randomizer")}},{name:"core/spacer",attributes:{height:"25px"}},{name:"core/heading",attributes:{level:2,content:(0,o.__)("it can be images ...","blocks-randomizer")}},{name:"core/heading",attributes:{level:2,content:(0,o.__)("... or any text blocks","blocks-randomizer")}}]},edit:function({attributes:l,setAttributes:s}){const{numberOfItems:i}=l,c=(0,r.useBlockProps)({}),d=(0,t.useMemo)(()=>(0,e.getBlockTypes)().map(e=>e.name).filter(e=>"blocks-randomizer/holder"!==e),[]),m=(0,r.useInnerBlocksProps)({...c,className:"wp-block-blocks-randomizer-holder-inner"},{allowedBlocks:d,orientation:"vertical",defaultBlock:{name:"core/paragraph",attributes:{placeholder:(0,o.__)("Start typing or add any block inside this container...","blocks-randomizer")}},templateLock:!1});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.InspectorControls,{children:(0,a.jsx)(n.PanelBody,{title:(0,o.__)("Display","blocks-randomizer"),initialOpen:!0,children:(0,a.jsx)(n.__experimentalNumberControl,{__next40pxDefaultSize:!0,label:(0,o.__)("Number of child blocks to display","blocks-randomizer"),help:(0,o.__)("How many random blocks to show on the front-end. If you specify more than available, all blocks will be displayed.","blocks-randomizer"),value:i,onChange:e=>{console.log("value:",e);const o=Math.max(0,parseInt(e,10));console.log("numValue:",o),s({numberOfItems:o})},required:!0,min:0,step:1})})}),(0,a.jsx)("div",{...c,children:(0,a.jsx)("div",{...m})})]})},save:function({attributes:e,innerBlocks:o}){const n=r.useBlockProps.save({}),t=r.useInnerBlocksProps.save({...n});return(0,a.jsx)("div",{...t})}})}},r={};function n(e){var t=r[e];if(void 0!==t)return t.exports;var a=r[e]={exports:{}};return o[e](a,a.exports,n),a.exports}n.m=o,e=[],n.O=(o,r,t,a)=>{if(!r){var l=1/0;for(d=0;d<e.length;d++){for(var[r,t,a]=e[d],s=!0,i=0;i<r.length;i++)(!1&a||l>=a)&&Object.keys(n.O).every(e=>n.O[e](r[i]))?r.splice(i--,1):(s=!1,a<l&&(l=a));if(s){e.splice(d--,1);var c=t();void 0!==c&&(o=c)}}return o}a=a||0;for(var d=e.length;d>0&&e[d-1][2]>a;d--)e[d]=e[d-1];e[d]=[r,t,a]},n.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={414:0,650:0};n.O.j=o=>0===e[o];var o=(o,r)=>{var t,a,[l,s,i]=r,c=0;if(l.some(o=>0!==e[o])){for(t in s)n.o(s,t)&&(n.m[t]=s[t]);if(i)var d=i(n)}for(o&&o(r);c<l.length;c++)a=l[c],n.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return n.O(d)},r=globalThis.webpackChunkblocks_randomizer=globalThis.webpackChunkblocks_randomizer||[];r.forEach(o.bind(null,0)),r.push=o.bind(null,r.push.bind(r))})();var t=n.O(void 0,[650],()=>n(334));t=n.O(t)})(); -
blocks-randomizer/trunk/build/blocks-randomizer/render.php
r3377706 r3378435 18 18 // Get the number of items to display, default to 1. 19 19 $number_of_items = isset( $attributes['numberOfItems'] ) ? absint( $attributes['numberOfItems'] ) : 1; 20 21 if ( $number_of_items === 0 ) { 22 return; 23 } 20 24 21 25 // Get all inner blocks as an array. -
blocks-randomizer/trunk/readme.txt
r3377706 r3378435 1 === Blocks Randomizer===1 === Content Randomizer - Rotate Any Block === 2 2 Contributors: slaFFik 3 Tags: content block, random, randomize3 Tags: randomizer, rotation, gutenberg, dynamic-content, testimonials 4 4 Requires at least: 6.7 5 5 Requires PHP: 7.4 6 6 Tested up to: 6.8 7 Stable tag: 1. 1.07 Stable tag: 1.2.0 8 8 License: GPL-2.0-or-later 9 9 10 Display randomly any of the top-level blocks within "Blocks Randomizer" main block.10 Rotate and display random content blocks on every page load. Perfect for testimonials, CTAs, and dynamic content. Works with any block type. 11 11 12 12 == Description == … … 16 16 Perfect for creating fresh, engaging experiences for repeat visitors without manually updating content. 17 17 18 = Key Features = 18 ### Key Features 19 19 20 20 * **Easy to Use**: Works seamlessly with the WordPress Block Editor (Gutenberg) … … 24 24 * **Performance Optimized**: Lightweight and efficient randomization 25 25 26 = Use Cases = 26 ### Use Cases 27 27 28 28 **Rotating Testimonials** … … 50 50 Showcase different team members randomly on your about page, giving everyone fair representation. 51 51 52 = How It Works = 52 ### How It Works 53 53 54 54 1. Add the "Blocks Randomizer" block to your page or post … … 58 58 5. Update anytime by adding, removing, or editing child blocks 59 59 60 = Perfect For = 60 ### Using with the Block Editor (Gutenberg) 61 62 The Blocks Randomizer is built natively for the WordPress Block Editor (Gutenberg). It works as a container block that accepts any other blocks as children: 63 64 - **Full compatibility** with all core WordPress blocks (Paragraph, Image, Heading, Gallery, Button, Quote, etc.) 65 - **Drag-and-drop interface** for easy block management within the randomizer 66 - **Live preview** in the editor showing all your blocks (actual randomization happens on the front-end) 67 - **Block toolbar** and settings work normally for blocks inside the randomizer 68 69 Simply add the Blocks Randomizer block anywhere you'd add any other block, and start building your randomized content collection. 70 71 ### Perfect For 61 72 62 73 * Marketing and landing pages … … 69 80 Whether you're looking to increase engagement, test different messaging, or simply add variety to your content, Blocks Randomizer makes it simple and intuitive. 70 81 82 ## How to Create Rotating Testimonials 83 84 Creating rotating customer testimonials is one of the most popular uses for the Blocks Randomizer. Here's a step-by-step guide: 85 86 1. **Create or edit the page** where you want testimonials to appear (typically your homepage, services page, or dedicated testimonials page) 87 2. **Add the Blocks Randomizer block** by clicking the "+" button and searching for "Blocks Randomizer" or typing `/random` 88 3. **Add your first testimonial** inside the randomizer container - you can use Quote blocks, Paragraph blocks, or custom testimonial blocks from your theme 89 4. **Format your testimonial** with the customer's quote, name, company, and optionally add their photo using an Image block 90 5. **Add more testimonials** by clicking the "+" button inside the randomizer and repeating the formatting for each customer review 91 6. **Adjust display settings** (optional) - in the block sidebar, you can set how many testimonials to show at once if you want to display multiple reviews 92 7. **Publish or update** your page - visitors will now see a different random testimonial each time they load the page 93 94 **Pro tip:** Use consistent formatting for all testimonials (same heading sizes, image dimensions, text styles) to ensure smooth visual transitions between random selections. 95 96 ## How to Set Up Random Call-to-Actions 97 98 Rotating different call-to-action messages helps you test which messaging resonates best with your audience: 99 100 1. **Open the page** where you want rotating CTAs (homepage, landing page, or product page) 101 2. **Add the Blocks Randomizer block** in the section where you want your CTA to appear 102 3. **Create your first CTA** using Button blocks, Heading + Paragraph combinations, or custom CTA blocks from your theme or page builder 103 4. **Duplicate and modify** - create variations with different: 104 - Headline text ("Start Your Free Trial" vs "Get Started Today") 105 - Button colors and styles 106 - Supporting copy and benefits messaging 107 - Urgency elements ("Limited Time Offer" vs "No Credit Card Required") 108 5. **Add each variation** as a separate block group inside the randomizer 109 6. **Set to display one CTA** at a time using the "Number of blocks" setting (set to 1) 110 7. **Monitor performance** over time to see which messages drive more conversions 111 112 **Pro tip:** Keep the overall design structure similar across variations so the page layout remains consistent, but vary the messaging and emphasis to test different value propositions. 113 114 **Pro tip 2:** You can use different UTM values (specifically, `utm_content`) for your CTA buttons inside the randomizer, this way you can even track using any analytics solution (like Google Analytics, or Fathom Analytics, or Plausible Analytics) which CTA performs better. 115 116 ## How to Display Random Products 117 118 For e-commerce sites, rotating product showcases give equal visibility to your catalog: 119 120 1. **Navigate to your homepage** or shop page in the Block Editor 121 2. **Add the Blocks Randomizer block** where you want featured products to rotate 122 3. **Insert WooCommerce or Easy Digital Downloads product blocks** inside the randomizer - you can use: 123 - Single Product blocks (for individual product showcases) 124 - Products by Category blocks (for category spotlights) 125 - Hand-picked Products blocks (for curated selections) 126 4. **Configure each product block** with your desired layout, show/hide settings for price, ratings, "add to cart" button, etc. 127 5. **Add multiple product configurations** - create different product spotlights, categories, or seasonal collections 128 6. **Adjust how many products** to display using the randomizer settings 129 7. **Publish your page** - products will rotate automatically, giving fair exposure to different items 130 131 **Pro tip:** Group related products together or create themed product blocks (e.g., "Summer Collection," "Best Sellers," "New Arrivals") for more cohesive random displays. 132 133 ## How to Rotate Banner Advertisements 134 135 If you display ads, partner logos, or promotional banners, the randomizer helps distribute visibility: 136 137 1. **Prepare your banner images** - ensure they're all the same dimensions for a consistent layout 138 2. **Add the Blocks Randomizer block** to your sidebar, header, or content area where banners should appear 139 3. **Insert Image blocks** inside the randomizer, uploading each banner or advertisement 140 4. **Add links to each image** by selecting the image and clicking the link icon - set destinations for each ad 141 5. **Include alt text** for accessibility and SEO on each image 142 6. **Add multiple banners** - upload all your advertisement images or promotional graphics 143 7. **Set display quantity** based on your layout (1 for single banner rotation, multiple for ad grids) 144 8. **Publish and monitor** - banners will rotate fairly, ensuring all advertisers or promotions get equal exposure 145 146 **Pro tip:** Use the same aspect ratio for all banners to prevent layout shifts. Consider adding a Text block below images for additional context or disclaimers if needed. 147 148 ## How to Configure Block Display Settings 149 150 Fine-tuning how many random blocks appear gives you precise control over your content: 151 152 1. **Select the Blocks Randomizer block** by clicking on it in the editor 153 2. **Open the Settings sidebar** on the right side of the screen (if not visible, click the gear icon in the top-right) 154 3. **Find the "Number of blocks" setting** in the block settings panel 155 4. **Adjust the number** using the input field or arrows: 156 - Set to **1** for single random block display (great for hero sections, testimonials) 157 - Set to **2-3** for multiple testimonials or product showcases 158 - Set to **0** to hide the entire block on the front-end (useful for temporarily disabling without deleting content) 159 5. **Preview changes** by viewing the page on the front-end or using the editor preview 160 6. **Consider your layout** - ensure multiple random blocks fit well within your design at different screen sizes 161 162 **Pro tip:** The number you set is the maximum that will display. If you have fewer blocks inside the randomizer than the number specified, all available blocks will show. 163 164 ### Using with WooCommerce or Easy Digital Downloads 165 166 Perfect for e-commerce sites looking to rotate products, promotions, and calls-to-action: 167 168 - **Product blocks** - Add Single Product, Products by Category, or Hand-picked Products blocks inside the randomizer 169 - **Product rotations** - Showcase different products on your homepage or shop sidebar 170 - **Promotional banners** - Rotate sale announcements and special offers 171 - **Category spotlights** - Give equal visibility to different product categories 172 - **Cross-sells and upsells** - Randomize product recommendations on product pages 173 174 **Example use case:** Add and configure a grid block on your homepage, then add a randomizer inside of it, then add 5-10 featured products to the randomizer, set it to display 3 at a time, and visitors will see a different product selection on each visit. 175 176 ### Using with Caching Plugins 177 178 Understanding how caching affects randomization is crucial: 179 180 **WP Rocket:** 181 - Random blocks work with WP Rocket's page caching 182 - Content randomizes when cache regenerates (based on cache lifespan) 183 - For per-visit randomization, add pages to cache exclusions 184 - Consider using shorter cache lifespans for dynamic pages 185 186 **W3 Total Cache:** 187 - Compatible with page and object caching 188 - Random selection happens during cache generation 189 - Configure cache expiration based on how often you want new random content 190 - Use fragment caching to cache everything except the randomizer 191 192 **WP Super Cache:** 193 - Works with WP Super Cache out of the box 194 - Each cache refresh will select new random blocks 195 - Set appropriate cache timeout for your content rotation needs 196 197 **LiteSpeed Cache:** 198 - Fully compatible with LiteSpeed caching 199 - Random blocks cached until cache expires 200 - Use ESI (Edge Side Includes) for more dynamic behavior if needed 201 202 **Cloudflare / CDN:** 203 - CDN caching will serve the same version to all users until cache expires 204 - Configure page rules for pages with randomized content 205 - Consider shorter TTL (Time To Live) for dynamic pages 206 207 **Key principle:** The Blocks Randomizer performs server-side randomization. Whatever is selected gets cached. New random selection happens when cache regenerates. 208 209 ### Using with SEO Plugins 210 211 The Blocks Randomizer is SEO-friendly since randomization happens server-side. 212 213 **SEO best practices:** 214 - Don't place critical, unchanging SEO content in the randomizer 215 - Use the randomizer for supplementary elements (testimonials, CTAs, featured items) 216 - All variations should be topically relevant to the page's main purpose 217 - Consider that search engines may index different random variations on different crawls 218 219 ### Using with Form Plugins 220 221 Randomize different contact forms or lead capture forms to determine which one performs better - collects more contacts or leads. 222 223 **WPForms:** 224 - Insert WPForms blocks inside the randomizer 225 - A/B test different form designs 226 - Rotate forms for different services or products 227 228 **Contact Form 7:** 229 - Add Contact Form 7 blocks to the randomizer 230 - Test different form layouts and field combinations 231 - Rotate forms for different audiences or purposes 232 233 **Gravity Forms:** 234 - Add Gravity Forms blocks to random rotation 235 - Test form conversion rates with different layouts 236 - Display appropriate forms based on random selection 237 238 **Formidable Forms:** 239 - Compatible with Formidable Forms blocks 240 - Randomize contact forms, surveys, or calculators 241 242 ### Using with Membership & LMS Plugins 243 244 Display dynamic content for members or students: 245 246 **LearnDash:** 247 - Randomize course highlights or lesson previews 248 - Rotate student testimonials 249 - Display random course modules or topics 250 251 **MemberPress:** 252 - Rotate membership benefits or pricing tables 253 - Randomize member testimonials 254 - Display different membership tier highlights 255 256 **LifterLMS:** 257 - Randomize course showcases 258 - Rotate instructor spotlights 259 - Display random learning paths 260 71 261 == Installation == 72 262 73 263 This section describes how to install the plugin and get it working. 74 264 75 1. Upload `blocks-randomizer` to the `/wp-content/plugins/` directory. 76 1. Activate the plugin through the 'Plugins' menu in WordPress. 77 1. Go to the Block Editor and add your new "Blocks Randomizer" block, which is just a container. 78 1. Any to the top level any children blocks that you want to be randomized on display on the front-end. 265 **Install through your backend**: 266 267 1. Install the plugin via Plugins -> New plugin. Search for "blocks randomizer". 268 1. Click the "Install Now" button, and then - "Activate". 269 270 **Install manually**: 271 272 1. Download and unzip the plugin. 273 1. Upload the `blocks-randomizer` directory to the `/wp-content/plugins/` directory. 274 1. Activate the plugin through the "Plugins" menu in WordPress. 275 276 **Next**: 277 278 Now you can use the plugin inside the Block Editor. 279 280 == Frequently Asked Questions == 281 282 ### How do I add the Blocks Randomizer to my page? 283 284 In the Block Editor, type the slash `/random` and select the "Blocks Randomizer" block. Then use the "+" button inside of it to add any blocks you want to be randomized on each page load. 285 286 ### Can I randomize any type of block? 287 288 Yes, any block that you see in your Block Editor can be used inside our Blocks Randomizer. 289 290 ### How many blocks can I add to the randomizer? 291 292 There are no limits on the number of inner blocks inside our Blocks or Content Randomizer plugin. 293 294 ### Will this slow down my website? 295 296 No, the logic to pick a block is blazing fast and will not affect the page speed where the block is randomly selected and displayed. 297 298 ### Does the block output anything on the front-end? 299 300 Only the randomly selected child (or inner) block inside the Block Randomizer container will be displayed on the front-end. There will be no extra <code>div</code> wrapper, no extra classes or ids. 301 302 ### Why have you created the plugin? 303 304 I wanted to diversify content on my login page and display randomly some useful tips and pieces of content for my users. 305 306 ### Does this work with custom blocks? 307 308 Absolutely! The Blocks Randomizer works with any block type - including custom blocks created by third-party plugins, theme-specific blocks, and blocks you've built yourself. As long as the block appears in your WordPress Block Editor, you can add it to the randomizer container and it will be included in the random rotation. 309 310 ### Can I display multiple random blocks at once? 311 312 Yes, you can configure how many random blocks to display simultaneously using the "Number of blocks" setting in the block's sidebar panel. For example, if you have 10 testimonial blocks inside the randomizer, you can choose to display 3 random testimonials at once. Each page load will select a different random combination from your collection. 313 314 ### Does the randomization work with caching plugins? 315 316 The Blocks Randomizer performs server-side randomization during page generation, which means it works seamlessly with most caching plugins. Each time your cache expires and the page regenerates, a new random selection will be cached. For sites with aggressive caching (where pages are cached for extended periods), you may see the same blocks until the cache refreshes. For truly dynamic randomization on every single page view, you may need to configure cache exclusions for specific pages. 317 318 ### Can I use this for A/B testing different messages? 319 320 Yes! The Blocks Randomizer is perfect for simple A/B testing scenarios. Create different versions of your content (headlines, call-to-action buttons, promotional messages) as separate blocks within the randomizer, and the plugin will rotate through them automatically. While this doesn't provide analytics tracking like dedicated A/B testing tools, it's an excellent way to give equal exposure to different messaging variations and see which resonates better with your audience over time. 321 322 ### Does this work with WooCommerce product blocks? 323 324 Yes, the Blocks Randomizer is fully compatible with WooCommerce product blocks. You can create a collection of product blocks, featured product showcases, or promotional banners and rotate them randomly on your shop pages, homepage, or anywhere else on your site. This is great for giving equal visibility to different products or testing various product presentation styles. 325 326 ### Will random blocks affect my SEO? 327 328 Search engine crawlers will see whatever content is randomly selected when they visit your page. Since the randomization happens server-side, the content is fully rendered in the HTML and is indexable by search engines. However, keep in mind that different crawl sessions may see different content blocks. For critical SEO content that must be consistently visible, we recommend not placing it inside the randomizer. Use the randomizer for supplementary content like testimonials, CTAs, or promotional elements. 329 330 ### Can I use shortcodes with the Blocks Randomizer? 331 332 The Blocks Randomizer is a native WordPress block designed for the Block Editor (Gutenberg). It doesn't provide a shortcode interface for use in classic editor widgets or sidebars. However, you can use the randomizer in any block-enabled area, including widget areas that support blocks, Full Site Editing templates, and reusable block patterns. For classic widget areas, consider enabling block-based widgets in your theme settings. You can also use the "Shortcode" block inside the "Block Randomizer" block. 79 333 80 334 == Screenshots == 81 335 82 1. Adding a "Blocks Randomizer" block. 83 2. Various blocks all within the same container, that will be picked and displayed randomly. 336 1. Adding the Random Content Block to your page using the WordPress block editor 337 1. Block settings panel showing options to control how many random blocks display at once 338 1. Front-end display of randomly selected blocks with custom styling. 84 339 85 340 == Changelog == 341 342 = 1.2.0 = 343 * Changed: You can now set the number of items inside the randomizer block to 0, effectively hiding the whole block on the front-end (and everything inside it). 344 * Changed: Do not allow putting the Randomizer block inside the Randomizer block. You don't want to go deeper. 86 345 87 346 = 1.1.0 =
Note: See TracChangeset
for help on using the changeset viewer.