• hi guys,

    things are getting really hard with full site editor.
    i set up a custom pattern in
    /wp-content/themes/my-child-theme/patterns/parallax.php
    i can access the pattern in wp FSE.
    but when i insert the block including some php like

    <?php echo "xxx" ?>

    the xxx will be statically inserted from the parallax.php
    how do i get the posts featured image inside parallax.php?

    <?php
     /**
      * Title: Parallax Beitragsbild
      * Slug: pfefferprinz-23-child/parallax-beitragsbild
      * Categories: featured
      */
    ?>
    <!-- wp:heading -->
      <h2>Hello <?php echo "xxx"; ?></h2>
    <!-- /wp:heading -->

    i also tried setting up a shortcode inside functions.php – output stays static as well.

    • This topic was modified 1 year, 10 months ago by ffwebdesigner.
Viewing 1 replies (of 1 total)
  • I think you’re making a bit of a mistake. You are not allowed to use PHP codes for this but you would have to use a block for the output of the feature image itself. This is parsed live when the content is output. The PHP code you used so far is parsed when the pattern is inserted into the content and only the output is stored in the content.

    There is already a block for the feature image, you can use it in your pattern:

    <?php
    /**
     * Title: Parallax Beitragsbild
     * Slug: pfefferprinz-23-child/parallax-beitragsbild
     * Categories: featured
     */
    ?>
    <!-- wp:heading -->
    	<h2>Hello</h2>
    <!-- /wp:heading -->
    <!-- wp:post-featured-image /-->
Viewing 1 replies (of 1 total)
  • The topic ‘featured image in custom pattern’ is closed to new replies.