• Hey guys, I am in a bind at the moment, I had changed my functions.php to allow me to get rid of the “drop down box” which is for sorting prices. However the code i used was wrong so i have tried to undo it but all I get now is an error message so effectively I cant the site at all.

    Parse error: syntax error, unexpected ‘.’ in /home/content/p3pnexwpnas15_data03/99/3704199/html/wp-content/themes/storefront/functions.php on line 50

    This is all I see when ever I try to leave the page.

    Would anyone have the original format this file should be in ?

    Thanks for your help/suggestions in advance.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello @anaesassist1,

    If you want fresh functions.php file of storefront theme then you can again download this theme and replace
    functions.php file with fresh one.

    Or you can paste your code here to take a closer look.

    Regards

    Thread Starter anaesassist1

    (@anaesassist1)

    Oh I should have thought about that! Thanks @wbcomdesigns it worked like a charm.

    While I have you here, would you know how I can remove the drop down box which says “Default Sorting”. I quite like the idea of having a drop down box for all the products I have, rather than listing them under a certain header on the menu bar.

    Are you using a child theme or editing the main functions.php? You should always use a child theme for your changes because any time this theme gets an update, your changes to the main file will be lost. Please look up “WordPress Child theme” for instructions on how to do this or someone posted a generic Storefront child theme somewhere that you can upload and activate.

    You should open a new thread for your new question. Otherwise people may not see it.

    Add this code to your CHILD THEME FUNCTIONS file to remove the sorting dropdown.
    /*********************
    * remove default sorting dropdown in StoreFront Theme
    /*********************/
    add_action(‘init’,’remove_sorting’);

    function remove_sorting() {
    remove_action( ‘woocommerce_after_shop_loop’, ‘woocommerce_catalog_ordering’, 10 );
    remove_action(‘woocommerce_before_shop_loop’, ‘woocommerce_catalog_ordering’,30);
    }

    Hey,

    Try something like this;

    add_action( 'init', 'jk_remove_product_sorting' );
    function jk_remove_product_sorting() {
    remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
    }

    As Corbett said, be sure to do this in a child theme, or using a plugin like Theme Customisations.

    Cheers

    Thread Starter anaesassist1

    (@anaesassist1)

    Oh wow! Thank you everyone, I had been racking my brain on how to do it. I must admit I am quite new to coding but i fully appreciate the help you’ve given!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘function.php help with mistake i made’ is closed to new replies.