コード例 #1
0
ファイル: cmb.php プロジェクト: Art2u/Art-Store
 /**
  * Callback function that checks if we're using URLs for product purchases or HTML codes
  */
 public function are_product_urls_active()
 {
     $code_or_url = art_store_get_option('code_or_url');
     if ('url' == $code_or_url) {
         return true;
     } else {
         return false;
     }
 }
コード例 #2
0
ファイル: art-store.php プロジェクト: Art2u/Art-Store
 /**
  * Enqueue the public facing javascript for the cool slider
  */
 public function enqueue_scripts()
 {
     // load our js if we aren't in the admin
     // also check if an option for page is set for the scroller or if no page was defined
     $gallery_page = art_store_get_option('gallery_home');
     if (!is_admin() && (is_page($gallery_page) || 'none' == $gallery_page)) {
         wp_enqueue_script('jquery-ui');
         wp_enqueue_script('jquery-ui-widget');
         wp_enqueue_script('kinetic', $this->directory_url . '/assets/js/jquery.kinetic.min.js', array('jquery'), '1.8.2', true);
         wp_enqueue_script('mousewheel', $this->directory_url . '/assets/js/jquery.mousewheel.min.js', array('jquery'), '3.1.4', true);
         wp_enqueue_script('smoothdivscroll', $this->directory_url . '/assets/js/jquery.smoothdivscroll-1.3-min.js', array('jquery', 'kinetic', 'mousewheel'), '1.3', true);
     }
 }
コード例 #3
0
ファイル: widgets.php プロジェクト: Art2u/Art-Store
 /**
  * Return the widget/shortcode output
  *
  * @param  array  $atts Array of widget/shortcode attributes/args
  * @return string       Widget output
  */
 public static function get_widget($atts)
 {
     global $wp_query;
     $post = $wp_query->post;
     $widget = '';
     // Set up default values for attributes
     $atts = shortcode_atts(array('before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', 'title' => '', 'price_label' => __('Price', 'art-store'), 'shipping_label' => __('Shipping Information', 'art-store'), 'width_label' => __('Width', 'art-store'), 'height_label' => __('Height', 'art-store'), 'depth_label' => __('Depth', 'art-store'), 'notes_label' => __('Notes', 'art-store')), (array) $atts, self::$shortcode);
     // Before widget hook
     $widget .= $atts['before_widget'];
     // Title
     $widget .= $atts['title'] ? $atts['before_title'] . esc_html($atts['title']) . $atts['after_title'] : '';
     $widget .= the_art_store_product_information($post->ID, false);
     // After widget hook
     $widget .= $atts['after_widget'];
     // if we've decided to display product info in the main content or if the post type isn't art-store-work
     if ('content' == art_store_get_option('product_info') || 'art-store-work' !== $post->post_type) {
         return;
     } else {
         return $widget;
     }
 }
コード例 #4
0
ファイル: public.php プロジェクト: Art2u/Art-Store
        /**
         * Output the product information.
         *
         * @param int     $post_id 	The id of the post to display information about
         * @return string $output 	The html-formatted product information
         */
        public function product_information($post_id)
        {
            // bail if no post ID was passed
            if (0 == $post_id) {
                return;
            }
            $output = '';
            ob_start();
            ?>

			<div class="art-store-information product-information" id="art-work-<?php 
            echo $post_id;
            ?>
">

				<dl>
					<?php 
            // are we displaying the price and purchase info in the content?
            if ('content' == art_store_get_option('product_info')) {
                the_art_store_product_information($post_id);
            }
            ?>
				</dl>
			</div>
			<div class="art-store-meta  product-metainfo">
				<ul>
					<?php 
            if (get_art_store_product_terms('art-store-subject', $post_id)) {
                ?>
						<li><?php 
                the_art_store_themes();
                ?>
</li>
					<?php 
            }
            ?>
					<?php 
            if (get_art_store_product_terms('art-store-form', $post_id)) {
                ?>
						<li><?php 
                the_art_store_forms();
                ?>
</li>
					<?php 
            }
            ?>
					<?php 
            if (get_art_store_product_terms('art-store-medium', $post_id)) {
                ?>
						<li><?php 
                the_art_store_media();
                ?>
</li>
					<?php 
            }
            ?>
				</ul>
			</div>

			<?php 
            $output = ob_get_clean();
            return $output;
        }
コード例 #5
0
ファイル: template-tags.php プロジェクト: Art2u/Art-Store
/**
 * Function to either return a linked button, the button code or nothing for a product
 *
 * @param  int    $post_id 	The id of the post
 * @return string $output 	A hyperlinked image, html button code, or nothing if not for sale
 */
function art_store_display_button($post_id = 0)
{
    // bail if no id was passed
    if (0 == $post_id) {
        return;
    }
    // get the product information
    $product_information = get_art_store_info($post_id);
    // bail if the product isn't foir sale
    if (in_array($product_information['status'], array('enquire', 'sold', 'nfs'))) {
        return;
    }
    if ('code' == art_store_get_option('code_or_url') && $product_information['btn_code']) {
        return wp_kses_post($product_information['btn_code']);
    }
    if ('url' == art_store_get_option('code_or_url') && $product_information['btn_url']) {
        if (get_art_store_button_url()) {
            return sprintf('<a href="%1$s"><img src="%2$s" title="%3$s" /></a>', $product_information['btn_url'], get_art_store_button_url(), get_the_title());
        } else {
            return sprintf('<a href="%s">%2$s</a>', $product_information['btn_url'], __('Buy Now', 'art-store'));
        }
    }
    return;
}