Advertisement
Guest User

Functions

a guest
Apr 23rd, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4.  
  5. function toolbox_widgets_init() {
  6. register_sidebar(array(
  7. 'name' => 'Banner Widget',
  8. 'id' => 'banner-widget',
  9. 'description' => 'Banner Widget',
  10. 'before_widget' => '<div id="homepage-banner">',
  11. 'after_widget' => '</div>',
  12. 'before_title' => '',
  13. 'after_title' => ''
  14. ));
  15.  
  16. // Area 5, located in the footer. Empty by default.
  17. register_sidebar( array(
  18. 'name' => 'Home Widget',
  19. 'id' => 'home-widget',
  20. 'description' => 'Home Widget',
  21. 'before_widget' => '<div id="home-widget-box">',
  22. 'after_widget' => '</div>',
  23. 'before_title' => '',
  24. 'after_title' => ''
  25. ) );
  26.  
  27. // Area 3, located in the footer. Empty by default.
  28. register_sidebar( array(
  29. 'name' => __( 'First Footer Widget Area', 'twentyten' ),
  30. 'id' => 'first-footer-widget-area',
  31. 'description' => __( 'The first footer widget area', 'twentyten' ),
  32. 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  33. 'after_widget' => '</li>',
  34. 'before_title' => '<h3>',
  35. 'after_title' => '</h3>',
  36. ) );
  37.  
  38. // Area 4, located in the footer. Empty by default.
  39. register_sidebar( array(
  40. 'name' => __( 'Second Footer Widget Area', 'twentyten' ),
  41. 'id' => 'second-footer-widget-area',
  42. 'description' => __( 'The second footer widget area', 'twentyten' ),
  43. 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  44. 'after_widget' => '</li>',
  45. 'before_title' => '<h3>',
  46. 'after_title' => '</h3>',
  47. ) );
  48.  
  49. // Area 5, located in the footer. Empty by default.
  50. register_sidebar( array(
  51. 'name' => __( 'Third Footer Widget Area', 'twentyten' ),
  52. 'id' => 'third-footer-widget-area',
  53. 'description' => __( 'The third footer widget area', 'twentyten' ),
  54. 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  55. 'after_widget' => '</li>',
  56. 'before_title' => '<h3>',
  57. 'after_title' => '</h3>',
  58. ) );
  59.  
  60.  
  61. }
  62. add_action( 'init', 'toolbox_widgets_init' );
  63.  
  64.  
  65. if ( function_exists( 'add_theme_support' ) ) {
  66. add_theme_support( 'post-thumbnails' );
  67. set_post_thumbnail_size( 863, 328 );
  68. }
  69.  
  70.  
  71. /**
  72. * Creates a shortcode to add a product to the cart
  73. *
  74. */
  75. function my_it_exchange_add_to_cart($atts) {
  76.  
  77.    extract(shortcode_atts(array(
  78.                         "product_id" => null
  79.    ), $atts));
  80.  
  81.    it_exchange_set_product( $product_id );
  82.  
  83.         $output = "<div class='my_it_itemdescription'>Item: " . it_exchange( 'product', 'get-description' ) . "</div>";
  84.         $output .= "<div class='my_it_price'>Price: " . it_exchange( 'product', 'get-base-price' ) . "</div>";
  85.         $output .= "<div class='my_it_buy-now'>" .it_exchange( 'product', 'get-purchase-options', array( 'add-to-cart-edit-quantity' => true, 'buy-now-edit-quantity' =>true ) ) . "</div>";
  86.  
  87.    return $output;
  88. }
  89. add_shortcode( 'add-to-cart', 'my_it_exchange_add_to_cart' );
  90.  
  91.  
  92.  
  93.  
  94. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement