• Imageen_fer

    (@n_feragnoli)


    Hello,

    I’m working on a block theme with this setup:
    – WP 6.7.2
    – Gutenberg Plugin 20.5.0
    – Theme clone of TwentyTwentytwo created via Create Block theme (clone, not child theme)

    I am saving new patterns in themefolder/parts/ as pattern.html as detailed here:
    https://developer.wordpress.org/themes/patterns/registering-patterns/ and
    I am including the header for the file using the code:

    <?php
    /**
     * Title: Hero
     * Slug: themeslug/hero
     * Categories: featured
     */
    ?>

    but in the Site Editor the block seems to be ignored:
    the pattern is not displayed in the Site Editor > Patterns window under the name defined in the header
    the php header is displayed in the Site Editor as Custom Html element:

    Image

    is this a known issue?
    thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Imagethreadi

    (@threadi)

    You would have to place the file in the /pattern directory as described in the instructions you linked, not in /parts. And then it should have the extension .php, not .html.

    Thread Starter Imageen_fer

    (@n_feragnoli)

    @threadi thanks!
    I really did miss that!
    yet this brings me to another point… how did I miss that..?
    while it is obvious that a love of work has gone, in the last months, towards updating/reorganizing the docs, some of the features are – here and there – not clearly communicated.

    the doc clearly says:

    Now let’s add the code that you copied from the previous section into the /patterns/hero.php file in your theme:

    but it does so only in that paragraph. Coming from classic theme development everything is .php for me. but in the guide docs covering block themes development a great deal of emphasis goes into stressing how templates and templates parts are now just .html files.

    It is perfectly obvious why pattern files should be php files but that detail is really given for granted, to an external eye.
    But I guess that goes hand-in-hand with the whole lack of clarity about the template/template-part/pattern/block architecture.
    Or, at least, the lack of clarity in the way that structure is reflected in the Site Editor (template parts show up in the Patterns page, share the same categories, are not indicated/specified on their own… ; custom blocks available in the Post Editor might not be accessible in the Site Editor…)

    Thanks again

    Moderator Imagebcworkz

    (@bcworkz)

    No one would reasonably argue that the WP docs are perfectly clear. It’s exceedingly difficult to write docs that are clearly understood by such a wide range of skill levels. And it’s virtually all accomplished by volunteers! The docs team welcomes any contribution to improve the docs. If you’re willing, look at the “Want to get involved?” section of their “Make” page. You may contribute anything from raising an issue on GitHub to getting fully onboard the docs team. Thanks.

    Thread Starter Imageen_fer

    (@n_feragnoli)

    @bcworkz yes, sorry, I apologize. I didn’t mean to nag about the docs, although I understand it might have sounded as such.

    Moderator Imagethreadi

    (@threadi)

    I’m glad I could help you with this. If the question has been clarified for you, you are welcome to set the topic to solved.

    Moderator Imagebcworkz

    (@bcworkz)

    en_fer — No need for an apology, I did not perceive it as nagging, more like constructive criticism. I often take opportunities like this to encourage greater participation in the WP community 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Pattern html file header showing in site editor as html block’ is closed to new replies.