• Hi

    I have a Woo Themes theme – Freshnews- and I recently installed Woocommerce as well.

    There were a couple of changes I wanted to make to Woocommerce so I asked Woo how to do it. Their answer –

    Hi Elizabeth

    To remove the sort can you add

    remove_action( 'woocommerce_pagination', 'woocommerce_catalog_ordering', 20 );

    to your theme functions file

    You can remove the “required” on the address fields by copying this code

    https://wcdocs.woothemes.com/snippets/tutorial-customising-checkout-fields-using-actions-and-filters/#section-5

    in your theme functions file
    ………………………………………………

    I followed the first instruction and it worked. Then I copied the code I got from the link –

    <?php
    
    add_filter( 'woocommerce_billing_fields', 'wc_npr_filter_phone', 10, 1 );
    
    function wc_npr_filter_phone( $address_fields ) {
    	$address_fields['billing_phone']['required'] = false;
    	return $address_fields;
    }
    
    ?>

    and pasted it under the first bit of code I had already pasted in my theme functions file, but this time when I pressed Update File, my whole site disappeared.
    https://www.elizabethgulliver.com
    I deleted the code I had just pasted and pressed the Update File button again thinking it would undo whatever I had just done but alas, if I move anywhere from this page it is just blank.

    I did notice when scrolling down from where I had pasted the code there is a very ominous message saying “Don’t add any code below here or the sky will fall down” But I didn’t add any code below that message, I didn’t even see that message until after the event. I only added the code below the code I had already added, which was added under the words “End WooThemes Functions – You can add custom functions below”

    I can’t even log into my admin, there is just a blank page so I am guessing which version of WordPress I am using.

    I did search the forums and Google and there were a lot of people who’s site had disappeared but I couldn’t find any with the exact problem as mine.

    Hope you can help.

    Elizabeth

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘I was adding code to my Theme Functions and my website disappeared’ is closed to new replies.