WordPress.org

Ready to get started?Download WordPress

Forums

WP eCommerce
[resolved] [Plugin: WP e-Commerce] display categories name (6 posts)

  1. adulbasit
    Member
    Posted 2 years ago #

    i want to display categories name with the short code is there any solution plzz ???

    http://wordpress.org/extend/plugins/wp-e-commerce/

  2. Justin Sainton
    Member
    Plugin Author

    Posted 2 years ago #

    If you're displaying a specific categorical listing on a page or post via shortcode, you can simply type the name of the category above that shortcode.

  3. adulbasit
    Member
    Posted 2 years ago #

    can you send me example of short code plz..

  4. Justin Sainton
    Member
    Plugin Author

    Posted 2 years ago #

    Give the docs a read - http://docs.getshopped.org/documentation/shortcodes-categories/

    There is more info there than I could possibly communicate here.

  5. ckheaton
    Member
    Posted 1 year ago #

    If you want to display the category NAME not the product listing... You would need to edit your template file: wpsc-category-list.php

    By default the [showcategories] shortcode shows the category image grid ( regardless of your presentation settings ) . See the original code below:

    <?php
    /**
     * wpsc-category-shortcode is the code trigered by using the [showcategories] shortcode
     * @package wp-e-commerce
     * @since 3.8
     */
    ?>
    <div class="wpsc_categories wpsc_category_grid group">
    	<?php wpsc_start_category_query(array('category_group'=> get_option('wpsc_default_category'), 'show_thumbnails'=> 1)); ?>
    		<a href="<?php wpsc_print_category_url();?>" class="wpsc_category_grid_item  <?php wpsc_print_category_classes_section(); ?>" title="<?php wpsc_print_category_name(); ?>">
    			<?php wpsc_print_category_image(get_option('category_image_width'),get_option('category_image_height')); ?>
    		</a>
    		<?php wpsc_print_subcategory("", ""); ?>
    	<?php wpsc_end_category_query(); ?>
    
    </div><!--close wpsc_categories-->
    
    <?php
    ?>

    I updated the link class to wpsc_category_link and changed the wpsc_print_category_image to wpsc_print_category_name:

    <?php
    /**
     * wpsc-category-shortcode is the code trigered by using the [showcategories] shortcode
     * @package wp-e-commerce
     * @since 3.8
     */
    ?>
    <div class="wpsc_categories wpsc_category_grid group">
    	<?php wpsc_start_category_query(array('category_group'=> get_option('wpsc_default_category'), 'show_thumbnails'=> 1)); ?>
    		<a href="<?php wpsc_print_category_url();?>" class="wpsc_category_link  <?php wpsc_print_category_classes_section(); ?>" title="<?php wpsc_print_category_name(); ?>">
    			<?php //Print Category Name
                              wpsc_print_category_name();
                              ?>
    		</a>
    		<?php wpsc_print_subcategory("", ""); ?>
    	<?php wpsc_end_category_query(); ?>
    
    </div><!--close wpsc_categories-->
    
    <?php
    ?>

    I also was able to print only the sub categories of a particular parent category in my taxonomy template files ( taxonomy-wpsc_product_category-CATEGORY SLUG.php ) by indicating the parent category ID. In this case my product category ID is 27.

    <ul class="wpsc_categories">
    <?php wpsc_start_category_query(array('parent_category_id'=> 27, 'show_thumbnails'=> 1)); ?>
        <li><a href="<?php wpsc_print_category_url();?>" class="wpsc_category_link" title="<?php wpsc_print_category_name(); ?>">
            <?php wpsc_print_category_name(); ?>
        </a></li>
    
        <?php wpsc_print_subcategory("", ""); ?>
    <?php wpsc_end_category_query(); ?>
    </ul>
  6. eddieh3
    Member
    Posted 1 year ago #

    How to I style the way the boxes appear, specifically how do I add more spacing if I do <?php wpsc_print_category_name(); ?> under the <?php wpsc_print_category_image(); ?>? Since it's an array if I put <br> tag in it just adds multiple breaks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.