• Resolved carsonthetford

    (@carsonthetford)


    I’m using the Theme Customisations plugin by Woocommerce to work with one of the Woo child themes. I’m not really great at PHP yet and I think maybe what I’ve written might be the reason this is causing the error. I successfully swapped where the cart and the search bar were hooked in. It was working great until I tried to add in the bottom section with the “Added Login link to top header”. I wanted this link before the cart. Now I get errors like “Updating failed” when I try to update a page or any other content updates.

    WP version – 5.1.1
    Theme – Homestore (Storefront child) Version: 2.0.29

    /*Custom Header hook changes
     * Swapped search and cart
     * */
    add_action('storefront_before_header', 'remove_storefront_product_search');
      function remove_storefront_product_search(){
        remove_action( 'storefront_header', 'storefront_product_search', 10);
      }
    add_action( 'storefront_header', 'storefront_product_search', 30 );
    add_action('storefront_before_header', 'remove_storefront_header_cart');
      function remove_storefront_header_cart(){
        remove_action( 'storefront_header', 'storefront_header_cart', 30);
      }
    add_action( 'storefront_header', 'storefront_header_cart', 12 );
    ?>
    <!-- Added Login link to top header -->
    <?php
    add_action( 'storefront_header', 'add_login_link', 11 );
      function add_login_link() {
        echo '<div class=login-top-link>
                <a href=https://elevnn.com/my-account>Login</a>
              </div>';
      }
    ?>
    <?php
Viewing 1 replies (of 1 total)
  • Thread Starter carsonthetford

    (@carsonthetford)

    I ended up moving the `<!– Added Login link to top header –>
    <?php
    add_action( ‘storefront_header’, ‘add_login_link’, 11 );
    function add_login_link() {
    echo ‘<div class=login-top-link>
    <a href=https://elevnn.com/my-account>Login</a>
    </div>’;
    }
    ?>` up into the section above and that cleared it up. I guess adding in the extra php tag section was messing with it.

Viewing 1 replies (of 1 total)
  • The topic ‘Problem with hooks, causing content updating error’ is closed to new replies.