Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter svenddv

    (@svenddv)

    Hi @wpniall,

    thanks for the suggestion but it doesn’t seem to work.

    this is how I’ve tried it :

    add_filter( 'template_include', 'demo_page_template');
    
    function demo_page_template($template) {
    
        if ( is_page( is_product() ) ) {
      $template = $this->plugin_path . 'templates/woocommerce/single-product.php';
    
        }
        return $template;
    }

    I’ve also tried it this way :

    add_filter( 'template_include', 'demo_page_template');
    
    function demo_page_template($template) {
    
        if ( is_product() ) {
      $template = untrailingslashit( plugin_dir_path( __FILE__ ) ) . 'templates/woocommerce/single-product.php';
    
        }
        return $template;
    }

    still not seeing any effect.

    • This reply was modified 4 years, 8 months ago by svenddv.
    • This reply was modified 4 years, 8 months ago by svenddv.
    Thread Starter svenddv

    (@svenddv)

    Hi Ian,

    Thanks for your reply! I really appreciate it.

    I’m having trouble getting the template_include hook to work even without conditions, just trying to see if my code has any impact at all but it doesn’t do anything.

    add_filter( 'template_include', 'demo_page_template');
    
    function demo_page_template($template) {
    
        if ( is_page( 'single-product.php' )  ) {
      $template = $this->plugin_path . 'templates/woocommerce/single-product.php';
    
        }
        return $template;
    }

    any ideas?

    as always, thanks!

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