コード例 #1
0
ファイル: sidebar-alt.php プロジェクト: plusplusminus/athol
<?php

/**
 * Alternate Sidebar Template
 *
 * If a `secondary` widget area is active and has widgets,
 * and the selected layout has a third column, display the sidebar.
 *
 * @package WooFramework
 * @subpackage Template
 */
global $post, $wp_query, $woo_options;
$selected_layout = 'one-col';
$layouts = array('three-col-left', 'three-col-middle', 'three-col-right');
$selected_layout = woo_get_layout();
if (in_array($selected_layout, $layouts)) {
    if (woo_active_sidebar('secondary')) {
        woo_sidebar_before();
        ?>
<aside id="sidebar-alt">
	<?php 
        woo_sidebar_inside_before();
        woo_sidebar('secondary');
        woo_sidebar_inside_after();
        ?>
</aside><!-- /#sidebar-alt -->
<?php 
        woo_sidebar_after();
    }
    // End IF Statement
}
コード例 #2
0
 function woo_portfolio_item_settings($id)
 {
     global $woo_options;
     // Sanity check.
     if (!is_numeric($id)) {
         return;
     }
     $website_layout = woo_get_layout();
     $website_width = '960px';
     if (isset($woo_options['woo_layout_width'])) {
         $website_width = $woo_options['woo_layout_width'];
     }
     $dimensions = woo_portfolio_image_dimensions($website_layout, $website_width);
     $width = $dimensions['width'];
     $height = $dimensions['height'];
     $enable_gallery = false;
     if (isset($woo_options['woo_portfolio_gallery'])) {
         $enable_gallery = $woo_options['woo_portfolio_gallery'];
     }
     $settings = array('large' => '', 'caption' => '', 'rel' => '', 'gallery' => array(), 'css_classes' => 'group post portfolio-img', 'embed' => '', 'enable_gallery' => $enable_gallery, 'testimonial' => '', 'testimonial_author' => '', 'display_url' => '', 'width' => $width, 'height' => $height);
     $meta = get_post_custom($id);
     // Check if there is a gallery in post.
     // woo_get_post_images is offset by 1 by default. Setting to offset by 0 to show all images.
     $large = '';
     if (isset($meta['portfolio-image'][0])) {
         $large = $meta['portfolio-image'][0];
     }
     $caption = '';
     $gallery = '';
     if ($settings['enable_gallery'] == 'true') {
         $gallery = woo_get_post_images('0');
         if ($gallery) {
             // Get first uploaded image in gallery
             $large = $gallery[0]['url'];
             $caption = $gallery[0]['caption'];
         }
     }
     // End IF Statement
     // If we only have one image, disable the gallery functionality.
     if (is_array($gallery) && count($gallery) <= 1) {
         $settings['enable_gallery'] = 'false';
     }
     // Check for a post thumbnail, if support for it is enabled.
     if (isset($woo_options['woo_post_image_support']) && 'true' == $woo_options['woo_post_image_support'] && current_theme_supports('post-thumbnails')) {
         $image_id = get_post_thumbnail_id($id);
         if (intval($image_id) > 0) {
             $large_data = wp_get_attachment_image_src($image_id, 'large');
             if (is_array($large_data)) {
                 $large = $large_data[0];
             }
         }
     }
     // See if lightbox-url custom field has a value
     if (isset($meta['lightbox-url']) && $meta['lightbox-url'][0] != '') {
         $large = $meta['lightbox-url'][0];
     }
     // Set rel on anchor to show lightbox
     if (is_array($gallery) && count($gallery) <= 1) {
         $rel = 'rel="lightbox"';
     } else {
         $rel = 'rel="lightbox[' . $id . ']"';
     }
     // Create CSS classes string.
     $css = '';
     $galleries = array();
     $terms = get_the_terms($id, 'portfolio-gallery');
     if (is_array($terms) && count($terms) > 0) {
         foreach ($terms as $t) {
             $galleries[] = $t->slug;
         }
     }
     $css = join(' ', $galleries);
     // If on the single item screen, check for a video.
     if (is_singular()) {
         $settings['embed'] = woo_embed('width=540');
     }
     // Add testimonial information.
     if (isset($meta['testimonial']) && $meta['testimonial'][0] != '') {
         $settings['testimonial'] = $meta['testimonial'][0];
     }
     if (isset($meta['testimonial_author']) && $meta['testimonial_author'][0] != '') {
         $settings['testimonial_author'] = $meta['testimonial_author'][0];
     }
     // Look for a custom display URL of the portfolio item (used if it's a website, for example)
     if (isset($meta['url']) && $meta['url'][0] != '') {
         $settings['display_url'] = $meta['url'][0];
     }
     // Assign the values we have to our array.
     $settings['large'] = $large;
     $settings['caption'] = $caption;
     $settings['rel'] = $rel;
     $settings['gallery'] = $gallery;
     $settings['css_classes'] .= ' ' . $css;
     // Disable "enable_gallery" option is gallery is empty.
     if (!is_array($settings['gallery']) || $settings['gallery'] == '' || count($settings['gallery']) <= 0) {
         $settings['enable_gallery'] = 'false';
     }
     // Allow child themes/plugins to filter these settings.
     $settings = apply_filters('woo_portfolio_item_settings', $settings, $id);
     return $settings;
 }
コード例 #3
0
ファイル: template.php プロジェクト: plusplusminus/athol
 function woo_custom_projects_loop_columns($columns)
 {
     global $woo_options;
     if ('one-col' == woo_get_layout()) {
         $columns = 4;
     } else {
         $columns = 2;
     }
     return $columns;
 }
コード例 #4
0
ファイル: sidebar.php プロジェクト: plusplusminus/athol
<?php

/**
 * Sidebar Template
 *
 * If a `primary` widget area is active and has widgets, display the sidebar.
 *
 * @package WooFramework
 * @subpackage Template
 */
global $post, $wp_query, $woo_options;
$settings = array('portfolio_layout' => 'one-col');
$settings = woo_get_dynamic_values($settings);
// Reset Main Query
wp_reset_query();
$layout = woo_get_layout();
// Cater for custom portfolio gallery layout option.
if (is_tax('portfolio-gallery') || is_post_type_archive('portfolio')) {
    if ('' != $settings['portfolio_layout']) {
        $layout = $settings['portfolio_layout'];
    }
}
if ('one-col' != $layout) {
    if (woo_active_sidebar('primary')) {
        woo_sidebar_before();
        ?>
<aside id="sidebar">
<?php 
        woo_sidebar_inside_before();
        woo_sidebar('primary');
        woo_sidebar_inside_after();
コード例 #5
0
ファイル: theme-actions.php プロジェクト: plusplusminus/athol
 function woo_slider_biz($args = null)
 {
     global $woo_options, $post;
     // Exit if this isn't the first page in the loop
     if (is_paged()) {
         return;
     }
     // If WooSlider is enabled, let's use it instead
     if (class_exists('WooSlider')) {
         if (version_compare(get_option('wooslider-version'), '2.0.2') >= 0) {
             echo '<div class="wooslider-slider-business">';
             woo_wooslider_business();
             echo '</div><!-- /.wooslider-slider-business -->';
             return;
         }
     }
     $options = woo_get_dynamic_values(array('slider_biz_slide_group' => '0'));
     // Default slider settings.
     $defaults = array('id' => 'loopedSlider', 'pagination' => false, 'width' => '960', 'order' => 'ASC', 'posts_per_page' => '5', 'slide_page' => $options['slider_biz_slide_group'], 'use_slide_page' => false);
     if ('0' != $defaults['slide_page']) {
         $defaults['use_slide_page'] = true;
     }
     // Setup the "Slide Group", if one is set.
     if (isset($post->ID)) {
         $slide_page = '0';
         $stored_slide_page = get_post_meta($post->ID, '_slide-page', true);
         if ($stored_slide_page != '' && '0' != $stored_slide_page) {
             $slide_page = $stored_slide_page;
             $defaults['use_slide_page'] = true;
             // Instruct the slider to apply the necessary conditional.
             $defaults['slide_page'] = $slide_page;
         }
     }
     // Setup width of slider and images.
     if (isset($woo_options['woo_slider_biz_full']) && 'true' == $woo_options['woo_slider_biz_full']) {
         $width = '1600';
     } else {
         $layout = woo_get_layout();
         $layout_width = get_option('woo_layout_width');
         $width = intval($layout_width);
     }
     // Setup the number of posts to show.
     $posts_per_page = $woo_options['woo_slider_biz_number'];
     if ($posts_per_page != '') {
         $defaults['posts_per_page'] = $posts_per_page;
     }
     // Setup the order of posts.
     $post_order = $woo_options['woo_slider_biz_order'];
     if ($post_order != '') {
         $defaults['order'] = $post_order;
     }
     if (0 < $width && !isset($args['width'])) {
         $defaults['width'] = $width;
     }
     // Merge the arguments with defaults.
     $args = wp_parse_args($args, $defaults);
     if (isset($args['width']) && ($args['width'] <= 0 || $args['width'] == '') || !isset($args['width'])) {
         $args['width'] = '100';
     }
     // Allow child themes/plugins to filter these arguments.
     $args = apply_filters('woo_biz_slider_args', $args);
     // Disable auto image functionality
     $auto_img = false;
     if (get_option('woo_auto_img') == 'true') {
         update_option('woo_auto_img', 'false');
         $auto_img = true;
     }
     // Disable placeholder image functionality
     $placeholder_img = get_option('framework_woo_default_image');
     if ($placeholder_img) {
         update_option('framework_woo_default_image', '');
     }
     // Setup the slider CSS class.
     $slider_css = '';
     if (isset($woo_options['woo_slider_pagination']) && $woo_options['woo_slider_pagination'] == 'true') {
         $slider_css = 'business-slider has-pagination woo-slideshow';
     } else {
         $slider_css = 'business-slider woo-slideshow';
     }
     // Setup the slider height.
     if (apply_filters('woo_slider_autoheight', true)) {
         $slider_height = 'height:auto';
     } else {
         $slider_height = apply_filters('woo_slider_height', 350);
     }
     // Slide Styles
     $slide_styles = 'width: ' . $args['width'] . 'px;';
     $query_args = array('posts_per_page' => $posts_per_page, 'order' => $post_order, 'use_slide_page' => $args['use_slide_page'], 'slide_page_terms' => $args['slide_page']);
     // Retrieve the slides, based on the query arguments.
     $slides = woo_slider_get_slides($query_args);
     if (false == $slides) {
         echo do_shortcode('[box type="alert"]' . __('Please add some slider posts via Slides > Add New', 'woothemes') . '[/box]');
         return;
     }
     if (count($slides) < 1) {
         echo do_shortcode('[box type="alert"]' . __('Please note that this slider requires 2 or more slides in order to function. Please add another slide.', 'woothemes') . '[/box]');
         return;
     }
     $view_args = array('id' => $args['id'], 'width' => $args['width'], 'height' => $slider_height, 'container_css' => $slider_css, 'slide_styles' => $slide_styles);
     // Allow child themes/plugins to filter these arguments.
     $view_args = apply_filters('woo_slider_biz_view_args', $view_args);
     // Display slider
     woo_slider_biz_view($view_args, $slides);
     // Enable auto img functionality
     if ($auto_img) {
         update_option('woo_auto_img', 'true');
     }
     // Enable placeholder functionality
     if ('' != $placeholder_img) {
         update_option('framework_woo_default_image', $placeholder_img);
     }
 }
コード例 #6
0
ファイル: gallery.php プロジェクト: plusplusminus/athol
// Number of maximum attachments to get
$settings['photo_size'] = 'large';
// The WP "size" to use for the large image
$settings['width'] = 520;
// Default width
$settings['height'] = 600;
// Default height
$settings['use_height'] = false;
// Use height value
$settings['post_id'] = get_the_ID();
// Post ID to get the attachments for
$settings['embed'] = '';
// Determine whether or not the post has an embedded video
$settings['use_embed'] = false;
// Determine whether to display the embed code, if one exists, in place of the post gallery/image.
$dimensions = woo_portfolio_image_dimensions(woo_get_layout(), $woo_options['woo_layout_width']);
$settings['width'] = $dimensions['width'];
$settings['height'] = $dimensions['height'];
$settings['thumb_width'] = $dimensions['thumb_width'];
$settings['thumb_height'] = $dimensions['thumb_height'];
if ($settings['height'] > 0) {
    $settings['use_height'] = true;
}
if ($post_settings['embed'] != '') {
    $settings['use_embed'] = true;
}
$embed_args = 'width=' . ($settings['width'] - 6);
// Cater for the 3px border.
// Look for a video embed code.
$embed = woo_embed($embed_args);
if ($embed != '' && $settings['use_embed'] == true) {