Thesis Tips and Tricks
Greetings User! We have had users let us know that the single product view while using Thesis was hard to modify and style to match the rest of their site, so we did some research and came up with the following steps. These steps are what we’ve found to be the best way to use FoxyPress with Thesis. Should you have a better way, or want to contribute what you’ve done, please feel free to contact us or post a comment. We hope this helps all you FP/Thesis users out!
These steps don’t really need to happen in any particular order, as they should all be done before you refresh your single product view, but here is what I felt was the best way to approach it.
- Create a file called product_template_functions.php. This file is going to be very similar to the single FoxyPress product file you can find in our tutorial on Custom Product Templates. This file will be called when a single product is viewed. We can either use the detail shortcode in this file, or the API, more details here. I have the shortcode function commented out in this view, but you might want to use that to start. Should you choose to use the detail shortcode, simply use that method of styling found here.
<?php function custom_content() { global $post; if (have_posts()) : the_post(); /*echo(foxypress_handle_shortcode_detail(true, true, $post->ID));*/ $product = foxypress_GetProduct($post->ID); echo('<h2>' . $product['name'] . '</h2>'); endif; } remove_action('thesis_hook_after_content', 'thesis_prev_next_posts'); add_action('thesis_hook_before_content','custom_content'); thesis_html_framework(); ?> - Specify the use of the product_template_functions.php file in the wp-config.php file, much like we do for regular WordPress themes.
define('FOXYPRESS_PRODUCT_TEMPLATE_PATH', dirname(__FILE__) . '/wp-content/themes/yourthemename/single-foxypress_product.php'); - Add a new function/hook to the custom_functions.php file in your custom folder. It will tell allow us to use Thesis hooks in our product_template_functions.php file.
// Custom Page Template function custom_productpage() { include (TEMPLATEPATH . '/custom/product_template_functions.php'); } add_action('thesis_hook_custom_template', 'custom_productpage');
This should allow your thesis theme to be wrapped around the product as you would expect. Thanks for using FoxyPress!