Theme Development
Are you able to create your own WordPress Theme? If yes, adapting your Theme to WP.osC will take only a few minutes.
WP.osC (WP-osCommerce) themes are located in Store-root/themes/ directory. For example, a Theme named "flower" must reside in the Store-root/themes/flower/ directory.
Let’s suppose that you have installed WP.osC in a subdirectory of your Wordpress site , called “shop”. If the shop/themes/flower directory does not exist then WP.osC switch back automatically into the default Theme.
Please note : shop/themes/flower.1.3/flower/ is NOT the same thing as shop/themes/flower/. In the first case "flower" Theme will not be activated.
A default Theme is initially included in the WP.osC package. This Theme, specially adapted for use with WP.osC (Symbiosis and Standalone), is a modified version of WordPress "Default" Theme. You can use it as starting point.
A WP-osCommerce Theme consists of at least 5 files:
You can use the following functions, in the same manner you would use WordPress functions, to include or get header, footer and sidebar units where you want.
Before making any changes to your Wordpress theme please read the Function Reference [⇒].
header.php
A simple example of WP.osC header.php :
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php storeinfo('html_type'); ?>; charset=<?php storeinfo('charset'); ?>" />
<title>
@import url( <?php storeinfo('stylesheet_url'); ?> );
</style>
<?php osc_head(); ?><!-- This function is absolutely required -->
</head>
<body>
<div id="page">
<h1><a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a></h1>
<?php } else { ?>
<h1><a href="<?php storeinfo('url'); ?>"><?php storeinfo('name'); ?></a></h1>
<?php } ?>
<div id="content">
<!-- end header -->
Sidebar.php
A simple example of WP.osC sidebar.php :
<div id="menu">
<ul>
<li id="search"><?php include (TEMPLATEPATH . '/searchform.php'); ?></li>
<?php osc_shopping_cart(); ?>
<?php osc_list_user_pages(); ?>
<?php osc_list_categories(); ?>
<?php osc_list_catalog_pages(); ?>
<?php osc_list_info_pages(); ?>
</ul>
</div>
<!-- end sidebar -->
index.php
• A simple example of WP.osC index.php :
<div class="navigation"><?php the_navigation(); ?></div>
<div class="post">
<h2><?php the_title(); ?></h2>
<div class="content"><?php the_content(); ?></div>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
• Another simple example of WP.osC index.php (for WP Loop fans):
<div class="navigation"><?php the_navigation(); ?></div>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post">
<h3 class="title"><?php the_title(); ?></h3>
<div class="content"><?php the_content(); ?></div>
</div>
<?php endwhile; endif; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
footer.php
A simple example of WP.osC footer.php :
<p>
<?php storeinfo('name'); ?> is powered by <a href="http://wposc.com/">WP.osC</a>
</p>
</div>
</body>
</html>
searchform.php
A simple example of WP.osC searchform.php :
<label class="hidden" for="s">Search for:</label>
<input type="text" value="" name="keywords" id="s" /><!-- Please use "keywords" as name -->
<?php the_search_key(); ?>
<input type="submit" id="searchsubmit" value="Search" />
</form>