Search Documentation

Positioning within the Products Page and Product template

Custom Fields supports template hooks to display the Custom Field element(s) on the Products Page and Product detail page.

Here is what you put into your Products Page, and Single Product page. Take the snippet below and replace YOUR_SLUG_GOES_HERE with whatever you typed as your slug on the Attributes page (WordPress Administration > Products > Attributes).

< ?php wpsc_the_custom_fields( 'slug=YOUR_SLUG_GOES_HERE' ); ?>

By the way, the two places to put the above snippet into the product description:

  • Line 109 of wpsc-products_page.php (approximate, line numbers change with each release)
  • Line 46 of wpsc-single_product.php (approximate, line numbers change with each release)

You will find the above two files in your theme folder if you followed the installation instructions and let the plugin copy some files to your theme folder (WP Admin > Settings > Store > General tab) when you first installed the store plugin.

As an example, I first added a custom product attribute (see previous post) called ‘Disk Length’ which has a slug of ‘disk-length’. I then went into the product pages and filled in the field with some info. Finally, I put the slug ‘disk-length’ inside the above two PHP files within the product description div container as shown below.

<div class="product_description">
< ?php echo wpsc_the_product_description(); ?>
<p><strong>Disk Length:</strong>< ?php wpsc_the_custom_fields( &#039;slug=disk-length&#039; ); ?></p>
< !-– .product_description -->

– Contributed by: Full Motion Group