Last page or go back button - by cosmedia

This topic has 13 replies, 2 voices, and was last updated 9 years, 3 months ago ago by Robert Hall

  • Avatar: cosmedia
    cosmedia
    Participant
    August 24, 2016 at 22:24

    Dear support,

    I am using the “last page” or “go back button”, the one below the Cart in the header. See screenshot.

    https://s4.postimg.org/avvhqwlod/Schermafbeelding_2016_08_24_om_23_12_01.png

    The problem i have is that when a visitor is using google and lands on one of my pages, homepage or product page. And they click on the go back button they get send back too google. Which is causing visitors leaving the website.

    Is there a way that when they land on the website through google the button is hidden and then only shows up after they visit another page on the website?

    Or that they just get send to the homepage, only if its the first page they land on through google.

    I hope you understand my question,

    And maybe you have a better solution.

    Kind Regards,

    Johan

    12 Answers
    Avatar: Robert Hall
    Robert Hall
    Participant
    August 25, 2016 at 08:12

    Hello,

    Please try to add this function into the function.php file of the Child Theme.
    https://www.8theme.com/demo/docs/royal/index.html#!/2_child_theme

    function et_back_to_page() {
            if( class_exists('WooCommerce') && ( is_shop() && get_option( 'show_on_front' ) == 'page' && get_option( 'page_on_front' ) == get_option( 'woocommerce_shop_page_id' ) ) ){
                echo '<a class="back-history" href="#">'.__('Return to Previous Page', ETHEME_DOMAIN).'</a>';
            } else {
                echo '<a class="back-history" href="javascript: history.go(-1)">'.__('Return to Previous Page', ETHEME_DOMAIN).'</a>';
            }
    }

    Regards,
    Robert Hall

    Avatar: cosmedia
    cosmedia
    Participant
    August 26, 2016 at 02:23

    Thank you Robert, i will test asap.

    Another question, is it possible to get two catalog columns in mobile view?

    Regards

    Johan

    Avatar: cosmedia
    cosmedia
    Participant
    August 26, 2016 at 03:15

    I have tested the code and when you land on the homepage it doesn’t send you back anymore. But when you land on a product page it still sends you back to google.

    Another Q: When a product is sold out, the add to cart button on shop page gets replaced with the text “Read more”. How can i change the text?

    Thanks in advance

    Johan

    Avatar: Robert Hall
    Robert Hall
    Participant
    August 26, 2016 at 08:40

    Hello,

    Another question, is it possible to get two catalog columns in mobile view?

    Do you mean two products per row?
    Add this code in Custom CSS for mobile

    .product {
        width: 50% !important;
    }

    I have tested the code and when you land on the homepage it doesn’t send you back anymore. But when you land on a product page it still sends you back to google.

    This requires additional customization which is not for free.
    If you agree to proceed please contact us via form https://www.8theme.com/customization-services/ for further information.

    Another Q: When a product is sold out, the add to cart button on shop page gets replaced with the text “Read more”. How can i change the text?

    You can change it for simple product in the \wp-content\plugins\woocommerce\includes\class-wc-product-simple.php file on line 48 and variable in the \wp-content\plugins\woocommerce\includes\class-wc-product-variable.php file on line 43
    Regards,
    Robert Hall

    Avatar: cosmedia
    cosmedia
    Participant
    August 26, 2016 at 15:33

    Thank you for the solutions.

    About the go back button. Is it maybe possible to just replace it with a homebutton? maybe only on all pages except homepage?

    Thanks

    Johan

    Avatar: Robert Hall
    Robert Hall
    Participant
    August 27, 2016 at 08:41

    Try to use this function in the function.php file of Child Theme.

    function et_back_to_page() {
        echo '<a class="back-history" href="'.get_home_url().'">'.__('Return to Previous Page', ETHEME_DOMAIN).'</a>';
    }

    Regards,
    Robert Hall

    Avatar: cosmedia
    cosmedia
    Participant
    August 28, 2016 at 13:34

    Thank you, that will work. And how can i change the text of the button? I would like to change it to “Home

    Avatar: Robert Hall
    Robert Hall
    Participant
    August 29, 2016 at 10:33

    Hello,

    You can change the ‘Return to Previous Page’ string to ‘Home’ in the code above.

    Regards,
    Robert Hall

    Avatar: cosmedia
    cosmedia
    Participant
    August 29, 2016 at 13:04

    Alright, and can i hide the button on the homepage? So it shows on all other pages except homepage.

    Kind Regards,

    johan

    Avatar: Robert Hall
    Robert Hall
    Participant
    August 29, 2016 at 13:06

    Add this code in Global Custom CSS.

    .home .back-history {
        display: none;
    }

    Regards,
    Robert Hall

    Avatar: cosmedia
    cosmedia
    Participant
    August 29, 2016 at 13:09

    Great, that was all.

    Thank you for your support Robert!

    Have a nice day

    Avatar: Robert Hall
    Robert Hall
    Participant
    August 29, 2016 at 13:23

    You’re welcome!

    Regards,
    Robert Hall

  • Viewing 13 results - 1 through 13 (of 13 total)

The issue related to '‘Last page or go back button’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.