Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1366554

    Hi, documtentation says that php should run in code-blocl elements, but it doesnt.

    Its about this code:

    <form role=”search” method=”get” class=”search-form”
    action=”<?php echo site_url( ‘search-results/’ ); ?>”>
    <label>
    <span class=”screen-reader-text”>
    <?php echo _x( ‘Search for:’, ‘label’ ) ?>
    </span>
    <input type=”search” class=”search-field”
    name=”searchwp”
    placeholder=”<?php echo esc_attr_x( ‘Search…’, ‘placeholder’ ) ?>”
    value=”<?php echo isset( $_GET[‘searchwp’] ) ? esc_attr( $_GET[‘searchwp’] ) : ” ?>”
    title=”<?php echo esc_attr_x( ‘Search for:’, ‘label’ ) ?>” />
    </label>
    <input type=”submit” class=”search-submit”
    value=”<?php echo esc_attr_x( ‘Search’, ‘submit button’ ) ?>” />
    </form>

    You can see the result at the URL I posted in the private area.
    Why isn’t it running?

    Thanks for supporting!

    #1366683

    Hey slikslok,

    Thank you for the inquiry.

    You can only add html tags or shortcodes in the code block element, PHP codes will not run there. To add PHP snippets, you can use plugins like the ones below.

    // https://wordpress.org/plugins/insert-php-code-snippet/
    // https://wordpress.org/plugins/code-snippets/

    Or directly add them in the functions.php file.

    Best regards,
    Ismael

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.