Advertisement
daymobrew

WordPress Block Variation - not working for core/group

Apr 23rd, 2024
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | Source Code | 0 0
  1. PHP:
  2. $variations[] = array(
  3. 'name' => 'damien-update-info',
  4. 'title' => 'Update Info',
  5. 'icon' => 'book-alt',
  6. 'attributes' => array( 'className' => 'is-style-group-info' ),
  7. 'innerBlocks' => array(
  8. array( 'core/paragraph', array( 'content' => '<strong>' . $date->format('j F Y') . '</strong>: information about the update ...', ) ),
  9. ),
  10. );
  11.  
  12. JS:
  13. wp.blocks.registerBlockVariation(
  14. 'core/group',
  15. {
  16. name: 'dcwd-group-update',
  17. title: 'Update info',
  18. attributes: {
  19. className: 'is-style-group-info',
  20. },
  21. innerBlocks: [
  22. [
  23. 'core/paragraph',
  24. {
  25. content: '<strong>' + new Date().toLocaleDateString('en-us', { year:"numeric", month:"long", day:"numeric"}) + '</strong>: Info about update...',
  26. }
  27. ],
  28. ],
  29. }
  30. );
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement