예제 #1
0
/**
 * Implements Catchbase theme options into Theme Customizer.
 *
 * @param $wp_customize Theme Customizer object
 * @return void
 *
 * @since Catch Base 1.0
 */
function catchbase_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    /**
     * Set priority of blogname (Site Title) to 1. 
     *  Strangly, if more than two options is added, Site title is moved below Tagline. This rectifies this issue.
     */
    $wp_customize->get_control('blogname')->priority = 1;
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $options = catchbase_get_theme_options();
    $defaults = catchbase_get_default_theme_options();
    //Custom Controls
    require get_template_directory() . '/inc/customizer-includes/catchbase-customizer-custom-controls.php';
    // Custom Logo (added to Site Title and Tagline section in Theme Customizer)
    $wp_customize->add_setting('catchbase_theme_options[logo]', array('capability' => 'edit_theme_options', 'default' => $defaults['logo'], 'sanitize_callback' => 'catchbase_sanitize_image'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo', array('label' => __('Logo', 'catch-base'), 'priority' => 100, 'section' => 'title_tagline', 'settings' => 'catchbase_theme_options[logo]')));
    $wp_customize->add_setting('catchbase_theme_options[logo_disable]', array('capability' => 'edit_theme_options', 'default' => $defaults['logo_disable'], 'sanitize_callback' => 'catchbase_sanitize_checkbox'));
    $wp_customize->add_control('catchbase_theme_options[logo_disable]', array('label' => __('Check to disable logo', 'catch-base'), 'priority' => 101, 'section' => 'title_tagline', 'settings' => 'catchbase_theme_options[logo_disable]', 'type' => 'checkbox'));
    $wp_customize->add_setting('catchbase_theme_options[logo_alt_text]', array('capability' => 'edit_theme_options', 'default' => $defaults['logo_alt_text'], 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('catchbase_logo_alt_text', array('label' => __('Logo Alt Text', 'catch-base'), 'priority' => 102, 'section' => 'title_tagline', 'settings' => 'catchbase_theme_options[logo_alt_text]', 'type' => 'text'));
    $wp_customize->add_setting('catchbase_theme_options[move_title_tagline]', array('capability' => 'edit_theme_options', 'default' => $defaults['move_title_tagline'], 'sanitize_callback' => 'catchbase_sanitize_checkbox'));
    $wp_customize->add_control('catchbase_theme_options[move_title_tagline]', array('label' => __('Check to move Site Title and Tagline before logo', 'catch-base'), 'priority' => 103, 'section' => 'title_tagline', 'settings' => 'catchbase_theme_options[move_title_tagline]', 'type' => 'checkbox'));
    // Custom Logo End
    // Color Scheme
    $wp_customize->add_setting('catchbase_theme_options[color_scheme]', array('capability' => 'edit_theme_options', 'default' => $defaults['color_scheme'], 'sanitize_callback' => 'catchbase_sanitize_select', 'transport' => 'postMessage'));
    $schemes = catchbase_color_schemes();
    $choices = array();
    foreach ($schemes as $scheme) {
        $choices[$scheme['value']] = $scheme['label'];
    }
    $wp_customize->add_control('catchbase_theme_options[color_scheme]', array('choices' => $choices, 'label' => __('Color Scheme', 'catch-base'), 'priority' => 5, 'section' => 'colors', 'settings' => 'catchbase_theme_options[color_scheme]', 'type' => 'radio'));
    //End Color Scheme
    // Header Options (added to Header section in Theme Customizer)
    require get_template_directory() . '/inc/customizer-includes/catchbase-customizer-header-options.php';
    //Theme Options
    require get_template_directory() . '/inc/customizer-includes/catchbase-customizer-theme-options.php';
    //Featured Content Setting
    require get_template_directory() . '/inc/customizer-includes/catchbase-customizer-featured-content-setting.php';
    //Featured Slider
    require get_template_directory() . '/inc/customizer-includes/catchbase-customizer-featured-slider.php';
    //Social Links
    require get_template_directory() . '/inc/customizer-includes/catchbase-customizer-social-icons.php';
    // Reset all settings to default
    $wp_customize->add_section('catchbase_reset_all_settings', array('description' => __('Caution: Reset all settings to default. Refresh the page after save to view full effects.', 'catch-base'), 'priority' => 700, 'title' => __('Reset all settings', 'catch-base')));
    $wp_customize->add_setting('catchbase_theme_options[reset_all_settings]', array('capability' => 'edit_theme_options', 'default' => $defaults['reset_all_settings'], 'sanitize_callback' => 'catchbase_reset_all_settings', 'transport' => 'postMessage'));
    $wp_customize->add_control('catchbase_theme_options[reset_all_settings]', array('label' => __('Check to reset all settings to default', 'catch-base'), 'section' => 'catchbase_reset_all_settings', 'settings' => 'catchbase_theme_options[reset_all_settings]', 'type' => 'checkbox'));
    // Reset all settings to default end
    //Important Links
    $wp_customize->add_section('important_links', array('priority' => 999, 'title' => __('Important Links', 'catch-base')));
    /**
     * Has dummy Sanitizaition function as it contains no value to be sanitized
     */
    $wp_customize->add_setting('important_links', array('sanitize_callback' => 'catchbase_sanitize_important_link'));
    $wp_customize->add_control(new Catchbase_Important_Links($wp_customize, 'important_links', array('label' => __('Important Links', 'catch-base'), 'section' => 'important_links', 'settings' => 'important_links', 'type' => 'important_links')));
    //Important Links End
}
    /**
     * Add slider.
     *
     * @uses action hook catchbase_before_content.
     *
     * @since Catch Base 1.0
     */
    function catchbase_featured_slider()
    {
        global $post, $wp_query;
        //catchbase_flush_transients();
        // get data value from options
        $options = catchbase_get_theme_options();
        $enableslider = $options['featured_slider_option'];
        $sliderselect = $options['featured_slider_type'];
        $imageloader = isset($options['featured_slider_image_loader']) ? $options['featured_slider_image_loader'] : 'true';
        // Get Page ID outside Loop
        $page_id = $wp_query->get_queried_object_id();
        // Front page displays in Reading Settings
        $page_on_front = get_option('page_on_front');
        $page_for_posts = get_option('page_for_posts');
        if ($enableslider == 'entire-site' || (is_front_page() || is_home() && $page_for_posts != $page_id) && $enableslider == 'homepage') {
            if (!($catchbase_featured_slider = get_transient('catchbase_featured_slider'))) {
                echo '<!-- refreshing cache -->';
                $catchbase_featured_slider = '
				<section id="feature-slider">
					<div class="wrapper">
						<div class="cycle-slideshow" 
						    data-cycle-log="false"
						    data-cycle-pause-on-hover="true"
						    data-cycle-swipe="true"
						    data-cycle-auto-height=container
						    data-cycle-fx="' . esc_attr($options['featured_slide_transition_effect']) . '"
							data-cycle-speed="' . esc_attr($options['featured_slide_transition_length']) * 1000 . '"
							data-cycle-timeout="' . esc_attr($options['featured_slide_transition_delay']) * 1000 . '"
							data-cycle-loader="' . esc_attr($imageloader) . '"
							data-cycle-slides="> article"
							>
						    
						    <!-- prev/next links -->
						    <div class="cycle-prev"></div>
						    <div class="cycle-next"></div>

						    <!-- empty element for pager links -->
	    					<div class="cycle-pager"></div>';
                // Select Slider
                if ($sliderselect == 'demo-featured-slider' && function_exists('catchbase_demo_slider')) {
                    $catchbase_featured_slider .= catchbase_demo_slider($options);
                } elseif ($sliderselect == 'featured-page-slider' && function_exists('catchbase_page_slider')) {
                    $catchbase_featured_slider .= catchbase_page_slider($options);
                }
                $catchbase_featured_slider .= '
						</div><!-- .cycle-slideshow -->
					</div><!-- .wrapper -->
				</section><!-- #feature-slider -->';
                set_transient('catchbase_featured_slider', $catchbase_featured_slider, 86940);
            }
            echo $catchbase_featured_slider;
        }
    }
 /**
  * Generate social icons.
  *
  * @since Catch Base 1.0
  */
 function catchbase_get_social_icons()
 {
     if (!($catchbase_social_icons = get_transient('catchbase_social_icons'))) {
         $output = '';
         $options = catchbase_get_theme_options();
         // Get options
         $social_icons['Facebook-alt'] = isset($options['facebook_link']) ? $options['facebook_link'] : '';
         $social_icons['Twitter'] = isset($options['twitter_link']) ? $options['twitter_link'] : '';
         $social_icons['Googleplus-alt'] = isset($options['googleplus_link']) ? $options['googleplus_link'] : '';
         $social_icons['Mail'] = isset($options['email_link']) ? $options['email_link'] : '';
         $social_icons['Feed'] = isset($options['feed_link']) ? $options['feed_link'] : '';
         $social_icons['WordPress'] = isset($options['wordpress_link']) ? $options['wordpress_link'] : '';
         $social_icons['GitHub'] = isset($options['github_link']) ? $options['github_link'] : '';
         $social_icons['LinkedIn'] = isset($options['linkedin_link']) ? $options['linkedin_link'] : '';
         $social_icons['Pinterest'] = isset($options['pinterest_link']) ? $options['pinterest_link'] : '';
         $social_icons['Flickr'] = isset($options['flickr_link']) ? $options['flickr_link'] : '';
         $social_icons['Vimeo'] = isset($options['vimeo_link']) ? $options['vimeo_link'] : '';
         $social_icons['YouTube'] = isset($options['youtube_link']) ? $options['youtube_link'] : '';
         $social_icons['Tumblr'] = isset($options['tumblr_link']) ? $options['tumblr_link'] : '';
         $social_icons['Instagram'] = isset($options['instagram_link']) ? $options['instagram_link'] : '';
         $social_icons['CodePen'] = isset($options['codepen_link']) ? $options['codepen_link'] : '';
         $social_icons['Polldaddy'] = isset($options['polldaddy_link']) ? $options['polldaddy_link'] : '';
         $social_icons['Path'] = isset($options['path_link']) ? $options['path_link'] : '';
         $social_icons['Dribbble'] = isset($options['dribbble_link']) ? $options['dribbble_link'] : '';
         $social_icons['Skype'] = isset($options['skype_link']) ? $options['skype_link'] : '';
         $social_icons['SkypeNumber'] = isset($options['skype_number']) ? $options['skype_number'] : '';
         $social_icons['Digg'] = isset($options['digg_link']) ? $options['digg_link'] : '';
         $social_icons['Reddit'] = isset($options['reddit_link']) ? $options['reddit_link'] : '';
         $social_icons['Stumbleupon'] = isset($options['stumbleupon_link']) ? $options['stumbleupon_link'] : '';
         $social_icons['Pocket'] = isset($options['pocket_link']) ? $options['pocket_link'] : '';
         $social_icons['DropBox'] = isset($options['dropbox_link']) ? $options['dropbox_link'] : '';
         $social_icons['Foursquare'] = isset($options['foursquare_link']) ? $options['foursquare_link'] : '';
         $social_icons['Spotify'] = isset($options['spotify_link']) ? $options['spotify_link'] : '';
         $social_icons['Twitch'] = isset($options['twitch_link']) ? $options['twitch_link'] : '';
         foreach ($social_icons as $key => $value) {
             if ('' != $value) {
                 $title = explode('-', $key);
                 if ('Mail' == $key) {
                     $output .= '<a class="genericon_parent genericon genericon-' . esc_attr(strtolower($key)) . '" title="' . __('Email', 'catch-base') . '" href="mailto:' . sanitize_email($value) . '"><span class="screen-reader-text">' . __('Email', 'catch-base') . '</span> </a>';
                 } else {
                     if ('Skype' == $key) {
                         $output .= '<a class="genericon_parent genericon genericon-' . esc_attr(strtolower($key)) . '" title="' . $title[0] . '" href="' . esc_attr($value) . '"><span class="screen-reader-text">' . esc_attr($title[0]) . '</span> </a>';
                     } else {
                         $output .= '<a class="genericon_parent genericon genericon-' . esc_attr(strtolower($key)) . '" target="_blank" title="' . $title[0] . '" href="' . esc_url($value) . '"><span class="screen-reader-text">' . esc_attr($title[0]) . '</span> </a>';
                     }
                 }
             }
         }
         $catchbase_social_icons = $output;
         set_transient('catchbase_social_icons', $catchbase_social_icons, 86940);
     }
     return $catchbase_social_icons;
 }
예제 #4
0
 function catchbase_add_breadcrumb()
 {
     $options = catchbase_get_theme_options();
     // Get options
     if (isset($options['breadcumb_option']) && $options['breadcumb_option']) {
         $showOnHome = isset($options['breadcumb_onhomepage']) && $options['breadcumb_onhomepage'] ? '1' : '0';
         $delimiter = '<span class="sep">' . $options['breadcumb_seperator'] . '</span><!-- .sep -->';
         // delimiter between crumbs
         echo catchbase_custom_breadcrumbs($showOnHome, $delimiter);
     } else {
         return false;
     }
 }
예제 #5
0
				<?php 
if ('post' == get_post_type()) {
    ?>
				
					<?php 
    catchbase_entry_meta();
    ?>
				
				<?php 
}
?>
			</header><!-- .entry-header -->

			<?php 
$options = catchbase_get_theme_options();
if (is_search() || 'full-content' != $options['content_layout']) {
    // Only display Excerpts for Search and if 'full-content' is not selected
    ?>
				<div class="entry-summary">
					<?php 
    the_excerpt();
    ?>
				</div><!-- .entry-summary -->
			<?php 
} else {
    ?>
			
				<div class="entry-content">
					<?php 
    the_content();
 /**
  * Template for Featured Header Image from theme options
  *
  * To override this in a child theme
  * simply create your own catchbase_featured_pagepost_image(), and that function will be used instead.
  *
  * @since Catch Base 1.0
  */
 function catchbase_featured_overall_image()
 {
     global $post, $wp_query;
     $options = catchbase_get_theme_options();
     $defaults = catchbase_get_default_theme_options();
     $enableheaderimage = $options['enable_featured_header_image'];
     // Get Page ID outside Loop
     $page_id = $wp_query->get_queried_object_id();
     $page_for_posts = get_option('page_for_posts');
     // Check Enable/Disable header image in Page/Post Meta box
     if (is_page() || is_single()) {
         //Individual Page/Post Image Setting
         $individual_featured_image = get_post_meta($post->ID, 'catchbase-header-image', true);
         if ($individual_featured_image == 'disable' || $individual_featured_image == 'default' && $enableheaderimage == 'disable') {
             echo '<!-- Page/Post Disable Header Image -->';
             return;
         } elseif ($individual_featured_image == 'enable' && $enableheaderimage == 'disabled') {
             catchbase_featured_page_post_image();
         }
     }
     // Check Homepage
     if ($enableheaderimage == 'homepage') {
         if (is_front_page() || is_home() && $page_for_posts != $page_id) {
             catchbase_featured_image();
         }
     }
     // Check Excluding Homepage
     if ($enableheaderimage == 'exclude-home') {
         if (is_front_page() || is_home() && $page_for_posts != $page_id) {
             return false;
         } else {
             catchbase_featured_image();
         }
     } elseif ($enableheaderimage == 'exclude-home-page-post') {
         if (is_front_page() || is_home() && $page_for_posts != $page_id) {
             return false;
         } elseif (is_page() || is_single()) {
             catchbase_featured_page_post_image();
         } else {
             catchbase_featured_image();
         }
     } elseif ($enableheaderimage == 'entire-site') {
         catchbase_featured_image();
     } elseif ($enableheaderimage == 'entire-site-page-post') {
         if (is_page() || is_single()) {
             catchbase_featured_page_post_image();
         } else {
             catchbase_featured_image();
         }
     } elseif ($enableheaderimage == 'pages-posts') {
         if (is_page() || is_single()) {
             catchbase_featured_page_post_image();
         } else {
             return false;
         }
     } else {
         echo '<!-- Disable Header Image -->';
     }
 }
 /**
  * Homepage Featured Content Position
  *
  * @action catchbase_content, catchbase_after_secondary
  * 
  * @since Catch Base 1.0
  */
 function catchbase_featured_content_display_position()
 {
     // Getting data from Theme Options
     $options = catchbase_get_theme_options();
     //Check Featured Content Position
     if (isset($options['featured_content_position'])) {
         $featured_content_position = $options['featured_content_position'];
     } else {
         $featured_content_position = $options['move_posts_home'];
     }
     if ('1' != $featured_content_position) {
         add_action('catchbase_before_content', 'catchbase_featured_content_display', 40);
     } else {
         add_action('catchbase_after_content', 'catchbase_featured_content_display', 40);
     }
 }
/**
 * Sanitizes and Make options default for footer editor options
 * @param  $input entered value
 * @return sanitized output
 *
 * @since Catch Base 1.0
 */
function catchbase_sanitize_footer_content($input)
{
    if ($input == '1') {
        //Reset Footer Editor Options
        $options = catchbase_get_theme_options();
        $defaults = catchbase_get_default_theme_options();
        $options['footer_left_content'] = $defaults['footer_left_content'];
        $options['footer_right_content'] = $defaults['footer_right_content'];
        set_theme_mod('catchbase_theme_options', $options);
    }
    return '';
}
예제 #9
0
    /**
     * This function loads Mobile Menus Footer Anchor
     *
     * @get the data value from theme options
     * @uses catchbase_header action to add in the Header
     */
    function catchbase_mobile_footer_nav_anchor()
    {
        //Getting Ready to load options data
        $options = catchbase_get_theme_options();
        if ('1' == $options['responsive_select'] || '1' == $options['footer_mobile_menu_disable']) {
            return;
        }
        ?>
    
    <div id="mobile-footer-menu" class="mobile-menu-anchor footer-menu">
        <a href="#mobile-footer-nav" id="footer-menu" class="genericon genericon-menu">
            <span class="mobile-menu-text"><?php 
        _e('Menu', 'catch-base');
        ?>
</span>
        </a>
    </div><!-- #mobile-header-menu -->

    <?php 
    }
    /**
     * Generate social icons.
     *
     * @since Catch Base 1.0
     */
    function catchbase_get_social_icons()
    {
        if (!($catchbase_social_icons = get_transient('catchbase_social_icons'))) {
            $output = '';
            $options = catchbase_get_theme_options();
            // Get options
            $social_icons['Facebook-alt'] = isset($options['facebook_link']) ? $options['facebook_link'] : '';
            $social_icons['Twitter'] = isset($options['twitter_link']) ? $options['twitter_link'] : '';
            $social_icons['Googleplus-alt'] = isset($options['googleplus_link']) ? $options['googleplus_link'] : '';
            $social_icons['Mail'] = isset($options['email_link']) ? $options['email_link'] : '';
            $social_icons['Feed'] = isset($options['feed_link']) ? $options['feed_link'] : '';
            $social_icons['WordPress'] = isset($options['wordpress_link']) ? $options['wordpress_link'] : '';
            $social_icons['GitHub'] = isset($options['github_link']) ? $options['github_link'] : '';
            $social_icons['LinkedIn'] = isset($options['linkedin_link']) ? $options['linkedin_link'] : '';
            $social_icons['Pinterest'] = isset($options['pinterest_link']) ? $options['pinterest_link'] : '';
            $social_icons['Flickr'] = isset($options['flickr_link']) ? $options['flickr_link'] : '';
            $social_icons['Vimeo'] = isset($options['vimeo_link']) ? $options['vimeo_link'] : '';
            $social_icons['YouTube'] = isset($options['youtube_link']) ? $options['youtube_link'] : '';
            $social_icons['Tumblr'] = isset($options['tumblr_link']) ? $options['tumblr_link'] : '';
            $social_icons['Instagram'] = isset($options['instagram_link']) ? $options['instagram_link'] : '';
            $social_icons['CodePen'] = isset($options['codepen_link']) ? $options['codepen_link'] : '';
            $social_icons['Polldaddy'] = isset($options['polldaddy_link']) ? $options['polldaddy_link'] : '';
            $social_icons['Path'] = isset($options['path_link']) ? $options['path_link'] : '';
            $social_icons['Dribbble'] = isset($options['dribbble_link']) ? $options['dribbble_link'] : '';
            $social_icons['Skype'] = isset($options['skype_link']) ? $options['skype_link'] : '';
            $social_icons['Digg'] = isset($options['digg_link']) ? $options['digg_link'] : '';
            $social_icons['Reddit'] = isset($options['reddit_link']) ? $options['reddit_link'] : '';
            $social_icons['Stumbleupon'] = isset($options['stumbleupon_link']) ? $options['stumbleupon_link'] : '';
            $social_icons['Pocket'] = isset($options['pocket_link']) ? $options['pocket_link'] : '';
            $social_icons['DropBox'] = isset($options['dropbox_link']) ? $options['dropbox_link'] : '';
            $social_icons['Spotify'] = isset($options['spotify_link']) ? $options['spotify_link'] : '';
            $social_icons['Foursquare'] = isset($options['foursquare_link']) ? $options['foursquare_link'] : '';
            $social_icons['Spotify'] = isset($options['spotify_link']) ? $options['spotify_link'] : '';
            $social_icons['Twitch'] = isset($options['twitch_link']) ? $options['twitch_link'] : '';
            foreach ($social_icons as $key => $value) {
                if ('' != $value) {
                    $title = explode('-', $key);
                    if ('Mail' == $key) {
                        $output .= '<a class="genericon_parent genericon genericon-' . strtolower($key) . '" title="' . __('Email', 'catch-base') . '" href="mailto:' . sanitize_email($value) . '"><span class="screen-reader-text">' . __('Email', 'catch-base') . '</span> </a>';
                    } else {
                        if ('Skype' == $key) {
                            $output .= '<a class="genericon_parent genericon genericon-' . strtolower($key) . '" title="' . $title[0] . '" href="' . esc_attr($value) . '"><span class="screen-reader-text">' . $title[0] . '</span> </a>';
                        } else {
                            $output .= '<a class="genericon_parent genericon genericon-' . strtolower($key) . '" target="_blank" title="' . $title[0] . '" href="' . esc_url($value) . '"><span class="screen-reader-text">' . $title[0] . '</span> </a>';
                        }
                    }
                }
            }
            for ($i = 1; $i <= $options['custom_social_icons']; $i++) {
                $has_hover = '';
                $image_hover = '';
                if (!empty($options['custom_social_icon_image_' . $i])) {
                    $image = $options['custom_social_icon_image_' . $i];
                    if (!empty($options['custom_social_icon_image_hover_' . $i])) {
                        $image_hover = $options['custom_social_icon_image_hover_' . $i];
                        $has_hover = " has-hover";
                    }
                    //Checking Link
                    if (!empty($options['custom_social_icon_link_' . $i])) {
                        $link = $options['custom_social_icon_link_' . $i];
                    } else {
                        $link = '#';
                    }
                    //Checking Title
                    if (!empty($options['custom_social_icon_title_' . $i])) {
                        $title = $options['custom_social_icon_title_' . $i];
                    } else {
                        $title = '';
                    }
                    //Custom Social Icons
                    $output .= '<a id="custom-icon-' . $i . '" class="custom-icon' . $has_hover . '" target="_blank" title="' . esc_attr($title) . '" href="' . esc_url($link) . '">
					<img  alt="' . esc_attr($title) . '" class ="icon-static" src="' . esc_url($image) . '" />';
                    if (isset($image_hover) && '' != $image_hover) {
                        $output .= '<img  alt="' . esc_attr($title) . '" class ="icon-hover" src="' . esc_url($image_hover) . '" />';
                    }
                    $output .= '</a>';
                }
            }
            $catchbase_social_icons = $output;
            set_transient('catchbase_social_icons', $catchbase_social_icons, 86940);
        }
        return $catchbase_social_icons;
    }
예제 #11
0
 /**
  * Layout Optons Condition Check and Hook
  *
  * @since Catch Base 1.0
  */
 function catchbase_layout_condition_check()
 {
     global $post, $wp_query;
     $options = catchbase_get_theme_options();
     $themeoption_layout = $options['theme_layout'];
     // Front page displays in Reading Settings
     $page_on_front = get_option('page_on_front');
     $page_for_posts = get_option('page_for_posts');
     // Get Page ID outside Loop
     $page_id = $wp_query->get_queried_object_id();
     // Blog Page or Front Page setting in Reading Settings
     if ($page_id == $page_for_posts || $page_id == $page_on_front) {
         $layout = get_post_meta($page_id, 'catchbase-layout-option', true);
     } else {
         if (is_singular()) {
             if (is_attachment()) {
                 $parent = $post->post_parent;
                 $layout = get_post_meta($parent, 'catchbase-layout-option', true);
             } else {
                 $layout = get_post_meta($post->ID, 'catchbase-layout-option', true);
             }
         } else {
             $layout = 'default';
         }
     }
     //check empty and load default
     if (empty($layout)) {
         $layout = 'default';
     }
     if ($layout == 'three-columns' || $layout == 'default' && $themeoption_layout == 'three-columns') {
         add_action('catchbase_content', 'catchbase_content_sidebar_wrap_start', 40);
         add_action('catchbase_after_content', 'catchbase_content_sidebar_wrap_end', 10);
         add_action('catchbase_after_content', 'catchbase_sidebar_secondary', 20);
     }
 }
예제 #12
0
 function widget($args, $instance)
 {
     global $valid_id, $post;
     extract($args);
     if (!empty($instance)) {
         extract($instance);
     }
     $title = isset($instance['title']) ? $instance['title'] : '';
     $disable_featured_image = !empty($instance['disable_featured_image']) ? 'true' : 'false';
     $image_position = isset($instance['image_position']) ? $instance['image_position'] : 'above';
     $show_content = isset($instance['show_content']) ? $instance['show_content'] : 'excerpt';
     $excerpt_length = isset($instance['excerpt_length']) ? $instance['excerpt_length'] : 200;
     $options = catchbase_get_theme_options();
     $more_tag_text = $options['excerpt_more_text'];
     if (empty($instance['post_id']) || !($post_id = absint($instance['post_id']))) {
         $post_id = NULL;
     }
     // The Query
     if ($instance['valid'] == 'valid') {
         $the_query = new WP_Query('p=' . $post_id);
         // The Loop
         while ($the_query->have_posts()) {
             $the_query->the_post();
             $post_name = the_title('', '', false);
             $output = $before_widget;
             $output .= '<article class="post-' . $post_id . ' page type-post entry">';
             //Image position set below
             if ($image_position == "below") {
                 // Wiget title replace the page title is added
                 if ($title) {
                     $output .= '<header class="entry-header"><h2 class="entry-title"><a href="' . get_permalink() . '" title="' . $title . '">' . $title . '</a></h2></header>';
                 } else {
                     $output .= '<header class="entry-header"><h2 class="entry-title"><a href="' . get_permalink() . '" title="' . $post_name . '">' . $post_name . '</a></h2></header>';
                 }
             }
             if (has_post_thumbnail() && $disable_featured_image != "true") {
                 $output .= '<figure class="featured-image excerpt-landscape-featured-image"><a href="' . get_permalink() . '" title="' . $post_name . '">' . get_the_post_thumbnail($post->ID, 'catchbase-featured-landscape', array('title' => esc_attr($post_name), 'alt' => esc_attr($post_name))) . '</a></figure>';
             }
             //Image position set above
             if ($image_position == "above") {
                 // Wiget title replace the page title is added
                 if ($title) {
                     $output .= '<header class="entry-header"><h2 class="entry-title"><a href="' . get_permalink() . '" title="' . $title . '">' . $title . '</a></h2></header>';
                 } else {
                     $output .= '<header class="entry-header"><h2 class="entry-title"><a href="' . get_permalink() . '" title="' . $post_name . '">' . $post_name . '</a></h2></header>';
                 }
             }
             if ('excerpt' == $show_content) {
                 $output .= '<div class="entry-summery">';
                 $output .= catchbase_get_the_content_limit((int) $excerpt_length, esc_html($more_tag_text));
                 $output .= '</div><!-- .entry-summery -->';
             } elseif ('fullcontent' == $show_content) {
                 $content = apply_filters('the_content', get_the_content());
                 $content = str_replace(']]>', ']]&gt;', $content);
                 $output .= '<div class="entry-content">' . $content . '</div><!-- .entry-content -->';
             }
             $output .= '</article><!-- .type-post -->';
             $output .= $after_widget;
         }
         // Reset Post Data
         wp_reset_postdata();
         echo $output;
     }
 }
예제 #13
0
 /**
  * Alter the query for the main loop in homepage
  *
  * @action pre_get_posts action
  */
 function catchbase_alter_home($query)
 {
     $options = catchbase_get_theme_options();
     $cats = $options['front_page_category'];
     if (is_array($cats) && !in_array('0', $cats)) {
         if ($query->is_main_query() && $query->is_home()) {
             $query->query_vars['category__in'] = $options['front_page_category'];
         }
     }
 }
예제 #14
0
 /**
  * Header Right Sidebar
  *
  * @since Catch Base 1.0
  */
 function catchbase_header_right()
 {
     $options = catchbase_get_theme_options();
     //A sidebar in the Header Right
     if (!$options['disable_header_right_sidebar']) {
         get_sidebar('header-right');
     }
 }
 /**
  * Display Featured Header Image
  *
  * @since Catch Base 1.0
  */
 function catchbase_featured_image_display()
 {
     $options = catchbase_get_theme_options();
     if ("before-header" == $options['featured_header_image_position']) {
         add_action('catchbase_header', 'catchbase_featured_overall_image', 20);
     } elseif ("after-grid-content" == $options['featured_header_image_position']) {
         add_action('catchbase_before_content', 'catchbase_featured_overall_image', 20);
     } elseif ("after-menu" == $options['featured_header_image_position']) {
         add_action('catchbase_after_header', 'catchbase_featured_overall_image', 40);
     } elseif ("before-menu" == $options['featured_header_image_position']) {
         add_action('catchbase_after_header', 'catchbase_featured_overall_image', 10);
     }
 }
예제 #16
0
 /**
  * Displays Single post Navigation
  *
  * @uses  the_post_navigation
  *
  * @action catchbase_after_post
  * 
  * @since Catch Base 3.1
  */
 function catchbase_post_navigation()
 {
     $options = catchbase_get_theme_options();
     $disable_single_post_navigation = isset($options['disable_single_post_navigation']) ? $options['disable_single_post_navigation'] : 0;
     if (!$disable_single_post_navigation) {
         // Previous/next post navigation.
         the_post_navigation(array('next_text' => '<span class="meta-nav" aria-hidden="true">' . __('Next &rarr;', 'catch-base') . '</span> ' . '<span class="screen-reader-text">' . __('Next post:', 'catch-base') . '</span> ' . '<span class="post-title">%title</span>', 'prev_text' => '<span class="meta-nav" aria-hidden="true">' . __('&larr; Previous', 'catch-base') . '</span> ' . '<span class="screen-reader-text">' . __('Previous post:', 'catch-base') . '</span> ' . '<span class="post-title">%title</span>'));
     }
 }