[Support request] PHP in page header

Home Forums Support [Support request] PHP in page header

Home Forums Support PHP in page header

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

    Hello

    I’m trying to add this php code inside a page header…

    <form role=”search” method=”get” class=”woocommerce-product-search” action=”<?php echo esc_url( home_url( ‘/’ ) ); ?>”>
    <label class=”screen-reader-text” for=”woocommerce-product-search-field-<?php echo isset( $index ) ? absint( $index ) : 0; ?>”><?php esc_html_e( ‘Search for:’, ‘woocommerce’ ); ?></label>
    <input type=”search” id=”woocommerce-product-search-field-<?php echo isset( $index ) ? absint( $index ) : 0; ?>” class=”search-field width-70 left” placeholder=”<?php echo esc_attr__( ‘Search products…’, ‘woocommerce’ ); ?>” value=”<?php echo get_search_query(); ?>” name=”s” />
    <button type=”submit” class=”width-30″ value=”<?php echo esc_attr_x( ‘Search’, ‘submit button’, ‘woocommerce’ ); ?>”><?php echo esc_html_x( ‘Search’, ‘submit button’, ‘woocommerce’ ); ?></button>
    <input type=”hidden” name=”post_type” value=”product” />
    </form>

    How can I get the php code to work inside the page header? see link below…

    http://185.20.51.60/~generalmedicalco/dental/

    Thanks
    Dave

    GeneratePress 2.1.2
    #611621
    Leo
    Staff
    Customer Support

    Hi there,

    I think you’d have to build a shortcode like this:
    https://generatepress.com/forums/topic/page-header-for-search-results/#post-403642

    Let me know if this helps.

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