• I’m currently trying to create a post-only creation pattern with the folder technique from this page (https://wpengine.com/builders/page-creation-patterns/). I was able to create the pattern, but I’m not getting the modal popping up. What am I doing wrong?

    I’m using the Kadence Child theme.

    This is what’s in the PHP tags.

    /**

    • Title: Basic Title
    • Slug: kadence-child/basic-title
    • Block Styles: core/post-content
    • Post Types: post
      */
Viewing 2 replies - 1 through 2 (of 2 total)
  • It looks like you are trying to create a block pattern in WordPress using the Kadence child theme. The block pattern you have provided does not include any code that would cause a modal to pop up.

    To create a block pattern in WordPress, you will need to use the register_pattern function and pass it the necessary arguments. Here is an example of how you could create a block pattern that displays a modal when selected:

    
    function my_custom_block_pattern() {
        $pattern = array(
            'title'      => __( 'Basic Title', 'kadence-child' ),
            'content'    => '<!-- wp:heading {"level":2} -->
                <h2>Lorem ipsum dolor sit amet</h2>
                <!-- /wp:heading -->',
            'viewportWidth' => 1000,
            'categories' => array( 'text' ),
            'modal'      => true,
        );
        register_block_pattern( 'kadence-child/basic-title', $pattern );
    }
    add_action( 'init', 'my_custom_block_pattern' );
    

    This code will create a block pattern with the title “Basic Title” and the slug “kadence-child/basic-title”, and will include a heading block with the text “Lorem ipsum dolor sit amet.” A modal will be displayed when the block pattern is selected in the block editor.

    I hope this helps! Let me know if you have any questions or need further assistance.

    Thread Starter jgprkatelyn

    (@jgprkatelyn)

    Thank you!

    I did have additional information below the end of the PHP code, but it strictly just created the pattern. Not the modal. This is what I was following: https://wpengine.com/builders/page-creation-patterns/. Will I still need to register the block pattern?

    Where will this go in the folder structure?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Page Creation Pattern with Folder’ is closed to new replies.