Revision: 38041
Updated Code
at March 18, 2011 19:37 by zreedeecom
Updated Code
# !SHOPP SHORTCODES # PASTE THIS CODE IN THE functions.php FILE OF YOUR WP THEME function link_shopp_category($data) { $z = array("id" => "", "text" => ""); extract(shortcode_atts($z, $data)); if($id) : shopp('catalog','category','id='.$id.'&load=true'); if(shopp('category','id', 'return=true')) : $url = shopp('category','url','return=true'); if($text=="") $text = shopp('category','name','return=true'); shopp('catalog','category','reset=true'); return "<a href='$url' title='$text'>$text</a>"; else: return "<p>Error: Category not found."; endif; else : return "<p>There is an error with your syntax.</p>"; endif; } # end menu_link add_shortcode('categorylink', 'link_shopp_category'); function link_shopp_product($data) { $z = array("id" => "", "text" => ""); extract(shortcode_atts($z, $data)); if($id) : shopp('catalog','product','id='.$id.'&load=true'); if(shopp('product','found')) : $url = shopp('product','url','return=true'); if($text=="") $text = shopp('product','name','return=true'); shopp('catalog','product','reset=true'); return "<a href='$url' title='$text'>$text</a>"; else : return "<p>Error: Product not found</p>"; endif; else : return "<p>There is an error with your syntax.</p>"; endif; } # end link_shopp_product add_shortcode('productlink', 'link_shopp_product'); # Use shortcodes in text widgets. add_filter('widget_text', 'do_shortcode');
Revision: 38040
Updated Code
at December 27, 2010 20:27 by zreedeecom
Updated Code
# !SHOPP SHORTCODES function link_shopp_category($data) { $z = array("id" => "", "text" => ""); extract(shortcode_atts($z, $data)); if($id) : shopp('catalog','category','id='.$id.'&load=true'); if(shopp('category','id', 'return=true')) : $url = shopp('category','url','return=true'); if($text=="") $text = shopp('category','name','return=true'); shopp('catalog','category','reset=true'); return "<a href='$url' title='$text'>$text</a>"; else: return "<p>Error: Category not found."; endif; else : return "<p>There is an error with your syntax.</p>"; endif; } # end menu_link add_shortcode('categorylink', 'link_shopp_category'); function link_shopp_product($data) { $z = array("id" => "", "text" => ""); extract(shortcode_atts($z, $data)); if($id) : shopp('catalog','product','id='.$id.'&load=true'); if(shopp('product','found')) : $url = shopp('product','url','return=true'); if($text=="") $text = shopp('product','name','return=true'); shopp('catalog','product','reset=true'); return "<a href='$url' title='$text'>$text</a>"; else : return "<p>Error: Product not found</p>"; endif; else : return "<p>There is an error with your syntax.</p>"; endif; } # end link_shopp_product add_shortcode('productlink', 'link_shopp_product'); # Use shortcodes in text widgets. add_filter('widget_text', 'do_shortcode');
Revision: 38039
Updated Code
at December 23, 2010 04:08 by zreedeecom
Updated Code
# !SHOPP SHORTCODES function link_shopp_category($data) { $z = array("id" => "", "text" => ""); extract(shortcode_atts($z, $data)); if($id) : shopp('catalog','category','id='.$id.'&load=true'); if(shopp('category','id', 'return=true')) : $url = shopp('category','url','return=true'); if($text=="") $text = shopp('category','name','return=true'); return "<a href='$url' title='$text'>$text</a>"; else: return "<p>Error: Category not found."; endif; else : return "<p>There is an error with your syntax.</p>"; endif; } # end menu_link add_shortcode('categorylink', 'link_shopp_category'); function link_shopp_product($data) { $z = array("id" => "", "text" => ""); extract(shortcode_atts($z, $data)); if($id) : shopp('catalog','product','id='.$id.'&load=true'); if(shopp('product','found')) : $url = shopp('product','url','return=true'); if($text=="") $text = shopp('product','name','return=true'); return "<a href='$url' title='$text'>$text</a>"; else : return "<p>Error: Product not found</p>"; endif; else : return "<p>There is an error with your syntax.</p>"; endif; } # end link_shopp_product add_shortcode('productlink', 'link_shopp_product'); # Use shortcodes in text widgets. add_filter('widget_text', 'do_shortcode');
Revision: 38038
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 23, 2010 04:07 by zreedeecom
Initial Code
# !SHOPP SHORTCODES function link_shopp_category($data) { $z = array("id" => "", "text" => ""); extract(shortcode_atts($z, $data)); if($id) : shopp('catalog','category','id='.$id.'&load=true'); if(shopp('category','id', 'return=true')) : $url = shopp('category','url','return=true'); if($text=="") $text = shopp('category','name','return=true'); return "<a href='$url' title='$text'>$text</a>"; else: return "<p>Error: Category not found."; endif; else : return "<p>There is an error with your syntax.</p>"; endif; } # end menu_link add_shortcode('categorylink', 'link_shopp_category'); function link_shopp_product($data) { $z = array("id" => "", "text" => ""); extract(shortcode_atts($z, $data)); if($id) : shopp('catalog','product','id='.$id.'&load=true'); if(shopp('product','found')) : $url = shopp('product','url','return=true'); if($text=="") $text = shopp('product','name','return=true'); return "<a href='$url' title='$text'>$text</a>"; else : return "<p>Error: Product not found</p>"; endif; else : return "<p>There is an error with your syntax.</p>"; endif; } # end link_shopp_product add_shortcode('productlink', 'link_shopp_product'); # Use shortcodes in text widgets. add_filter('widget_text', 'do_shortcode');
Initial URL
Initial Description
Add two new shortcodes to create Shopp product/category links in an easy way. **USAGE:** The following shortcodes will now be available along your posts, pages and text widgets [productlink id='' text=''] (Text is optional, if omitted the product name will appear) [categorylink id='' text=''] (Text is optional, if omitted the category name will appear)
Initial Title
Shopp product/category link shortcodes
Initial Tags
wordpress
Initial Language
PHP