wp ecommerce
-
I have been trying to find out how to make the continue shopping link go to all products page on my site with no success 🙁 can anyone help me please!
-
Is it giving you the alert? You also must have entered something wrong, I just tested the above code and it seems to be working without issue.
no
Then you’re theme probably isn’t using the wp_head hook.
ok. so what do I need to do?
Try wp_footer in place of wp_head.
If you’re getting a parse error it means you haven’t entered the code right and there is a missing ‘ ” or ; somewhere throwing an error.
ok. so put the first code on the wp-footer? what file do i look for to place this in? Thanks again Evan I know that working with a newbi can be frustrating lol
It’s ok, I’m waiting for a DNS name change so who knows how long I have to wait lol
Ok, so open up functions.php and scroll down to the bottom and place the following exactly as is :
function change_continue_shopping_link() { ?> <script> jQuery(function() { jQuery('.continue_shopping').attr( 'href' , 'http://www.google.com' ); alert('Javascript running...'); }); </script> <?php } add_action( 'wp_footer' , 'change_continue_shopping_link' );That will load the javascript into the footer of every page of your site. Refresh the page and you should get an alert. If you don’t, right click and select ‘Inspect Element’ and go over to the console tab and check for any errors.
I have the function on one of my sites so I know the code is valid and functioning.
oh i see change the wording from head to footer on the code right?
I just checked your site, and received the alert. That means the javascript is sucessfuly running.
I would double check the continue shopping link now. Maybe it will link to google, now that the js is running.
As we mentioned before I can’t access a page with that button, so you’ll have to let me know.
it does not go to google. it stays on the same page.
grrr, I really wish I could see the HTML of the button. If you right click it, and inspect the element is there an href attribute on the element?
a href=”#” onclick=”jQuery("#fancy_notification").css("display", "none"); return false;” class=”continue_shopping”>Continue Shopping
put it in back ticks, or highlight the HTML code and click the code button above to prevent it from parsing in the forum.
can you try one more thing for me?
Change the function too:
function change_continue_shopping_link() { ?> <script> jQuery(function() { jQuery('.continue_shopping').removeAttr( 'href' ).removeAttr( 'onclick' ).attr( 'href' , 'http://www.google.com' ); }); </script> <?php } add_action( 'wp_footer' , 'change_continue_shopping_link' );I guess we’ll try removing the previously set href and onclick attributes, and re-adding our own. That’s my best guess.
The topic ‘wp ecommerce’ is closed to new replies.