• i have added live demo button on single product using some code from google in function.php

    but the demo link not working the demo url is like PRODUCT-TITLE.SITEURL.TLD

    i want to make it working and show demo to users….

    how it working plzz reply a best answer’s
    my site url solutiondude.in it was created using Statement Theme and Woocommerce Plugins…

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi, adwap7.

    Can you provide ‘some code from google’ here?
    What kind of url should it be?

    Thread Starter adwap7

    (@adwap7)

    the code is

    <blockquote>/**
    * add live demo button to single product page
    */
    
    function isa_before_add_to_cart_form() {
    
        global $post;
    
        $demoslug = $post->post_name;
    
       // $demourl = get_bloginfo('url').'/'.$demoslug.'/';
    /*---------------------------------*/
    // get just the domain without http
    $home_url = home_url();
    $find = array( 'http://', 'https://', 'http://www.', 'https://www.', 'www.' );
    $domain = str_replace( $find, '', $home_url );
    // put the new url together
    if (is_ssl()) {
        $protocol = 'https';
    } else {
        $protocol = 'http';
    }
    $demourl = $protocol . '://' . $demoslug . '.' . $domain;
    /*-----------------------------------*/
            $demotitle = esc_attr($post->post_title);
    
        echo '<a href="'.$demourl.'" title="'.$demotitle.'">Live Demo</a>';
    
    }
    
    </blockquote>

    click live demo to chek url solutiondude.in/product/downloading-autoindex-script/

    Thanks.

    The url in the last line is of single product page, right?
    What is the url for the demo page should be?

    Thread Starter adwap7

    (@adwap7)

    right,

    demo page url will subdomain named product name

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Issue for Live Demo in Woocommerce’ is closed to new replies.