inhouse
Member
Posted 2 years ago #
Hey guys, I'm trying to place code for a drop down menu and "Add to Cart" PayPal button for a very small shopping cart page within my WordPress site. The code is working perfectly when I wrote it out as a separate php page here. When I paste the code into my WordPress page in (HTML view) and publish, the form is all jumbled up and doesn't function. Is there a better way to place this code? I really don't want to have the shopping cart outside of my site. I tried adding "code" tags and "blockcode" tags but this isn't having any effect. I've never messed with a page template or anything like that so I don't know how to do that kind of thing. Can anyone help with this? Thanks in advance.
Site is currently here.
inhouse
Member
Posted 2 years ago #
Ok, for anyone interested or having similar issues:
WordPress was definitely stripping some code (or at least leaving gaps) when I pasted the script and form code in to the pae editor in HTML view so I had to create a new page template for this Shopping page and add the script and form code there. Thanks to Chad for the code example to follow. I had never done that before or really had any idea how it should be done but it's working perfectly.
heydasch
Member
Posted 1 year ago #
Hey man, were you going to paste that code in? Just asking b/c I'm encountering this same issue now. We're operating WP multi-sites w/ a custom theme so adding a new template page will be tricky.
Definitely something to try though if we get to that point. Thanks for posting back!
@heydasch, sorry, I never intended to post any code. I re-read my post and what I meant was that Chad from PayPal showed me some example code to use as a starting point for my add to cart buttons, etc.
Check out this post on the PayPal forums if you want help with that stuff. I ended up writing all the button html and script in a new page template to avoid WordPress from stripping code. You could also use a shortcode that simply calls a bunch of code. I've used Shortcoder before but there are others. I am in no way an expert so I use all the help I can get with plugins, etc. Hope I've helped! The shopping cart is still in development and is currently here if you want to use it as an example.