WordPress templates are powerful tools. For example many themes use templates to give you the option of creating a sales page without the sidebar. But I had never seen these custom templates used for WordPress posts.
An artist needed Paypal buttons added to her WordPress site, a portfolio of paintings and prints showcased using posts. But at this point we only wanted to add Paypal buttons for the prints, which were available at a the same range of prices based on size of the print and the paper used. Since most of the posts (but not all) would have the same Paypal buttons, I wanted to find a way to avoid copying and pasting code onto each page. I also wanted to empower my client to have the choice to “turn on” or choose the paypal buttons with just a click or two. I found the answer in WordPress custom post templates.
But first a few words about Paypal. You can get pretty far with Paypal for your eCommerce needs. Not only can you configure buttons with multiple choice drop down lists for an item but you also have a lot of control over shipping rates and taxes. Both domestic and international options are available for Paypal Business Accounts.
Here are some of the options you have through Paypal Merchant Services:
What’s even nicer is that you can set up these options as a default in your “Profile” under Shipping Tools. Then when you create the buttons you can either override the settings or just let it use the settings from the profile.
Once the profile was in place, I set up two “Add to Cart” buttons, each with three options: small, medium, large. I needed the second one to offer the option of getting the print on metallic paper which was slightly more expensive. Once the code is generated you can copy and paste the code to WordPress.
Now that we have the Paypal button code, the next step is to set up a custom post template file in WordPress.
single.phpfile which is what WordPress uses to display a single post. Your new filename needs to end with the word “Posts”. In my case I called it “paypalPosts.php”.
<?php /* Template Name Posts: YOURTEMPLATENAME */ ?>
The reason I like this solution so much is that now when the artist wants to upload a new print onto her site, she can just select the the Paypal template to add the Paypal buttons to the new post without calling me.
Kathy Alice Brown is a traffic and conversion expert specializing in SEO, Copywriting and Facebook Ad Campaigns. In her spare time she loves to get outside.