コード例 #1
0
    /**
     * Shows the Primary Menu 
     *
     * default load in sidebar-header.php
     */
    function catchadaptive_primary_menu()
    {
        $options = catchadaptive_get_theme_options();
        ?>
	<nav class="nav-primary" role="navigation">
        <div class="wrapper">
            <div class="screen-reader-text skip-link"><a href="#content" title="<?php 
        esc_attr_e('Skip to content', 'catchadaptive');
        ?>
"><?php 
        _e('Skip to content', 'catchadaptive');
        ?>
</a></div>
            <?php 
        if (has_nav_menu('primary')) {
            $classes = "mobile-menu-anchor primary-menu";
        } else {
            $classes = "mobile-menu-anchor page-menu";
        }
        ?>
                    
                <div id="mobile-header-left-menu" class="<?php 
        echo $classes;
        ?>
">
                    <a href="#mobile-header-left-nav" id="header-left-menu" class="genericon genericon-menu">
                        <span class="mobile-menu-text"><?php 
        _e('Menu', 'catchadaptive');
        ?>
</span>
                    </a>
                </div><!-- #mobile-header-menu -->

                <?php 
        $logo_alt = '' != $options['logo_alt_text'] ? $options['logo_alt_text'] : get_bloginfo('name', 'display');
        if (isset($options['logo_icon']) && $options['logo_icon'] != '' && !empty($options['logo_icon'])) {
            echo '<div id="logo-icon"><a href="' . esc_url(home_url('/')) . '" title="' . esc_attr(get_bloginfo('name', 'display')) . '" rel="home">
                        <img src="' . esc_url($options['logo_icon']) . '" alt="' . esc_attr($logo_alt) . '">
                    </a></div>';
        }
        echo '<h1 class="assistive-text">' . __('Primary Menu', 'catchadaptive') . '</h1>';
        if (has_nav_menu('primary')) {
            $catchadaptive_primary_menu_args = array('theme_location' => 'primary', 'menu_class' => 'menu catchadaptive-nav-menu', 'container' => false);
            wp_nav_menu($catchadaptive_primary_menu_args);
        } else {
            wp_page_menu(array('menu_class' => 'menu catchadaptive-nav-menu'));
        }
        ?>
            <div id="header-toggle" class="genericon genericon-search">
                <a class="screen-reader-text" href="#header-toggle-sidebar"><?php 
        _e('Search', 'catchadaptive');
        ?>
</a>
            </div>
        </div><!-- .wrapper -->
    </nav><!-- .nav-primary -->
    <?php 
    }
コード例 #2
0
/**
 * Implements Adaptive theme options into Theme Customizer.
 *
 * @param $wp_customize Theme Customizer object
 * @return void
 *
 * @since Catch Adaptive 0.1
 */
function catchadaptive_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 = catchadaptive_get_theme_options();
    $defaults = catchadaptive_get_default_theme_options();
    //Custom Controls
    require get_template_directory() . '/inc/customizer-includes/catchadaptive-customizer-custom-controls.php';
    // Custom Logo (added to Site Title and Tagline section in Theme Customizer)
    $wp_customize->add_setting('catchadaptive_theme_options[logo]', array('capability' => 'edit_theme_options', 'default' => $defaults['logo'], 'sanitize_callback' => 'catchadaptive_sanitize_image'));
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo', array('label' => __('Logo', 'catch-adaptive'), 'priority' => 100, 'section' => 'title_tagline', 'settings' => 'catchadaptive_theme_options[logo]')));
    $wp_customize->add_setting('catchadaptive_theme_options[logo_disable]', array('capability' => 'edit_theme_options', 'default' => $defaults['logo_disable'], 'sanitize_callback' => 'catchadaptive_sanitize_checkbox'));
    $wp_customize->add_control('catchadaptive_theme_options[logo_disable]', array('label' => __('Check to disable logo', 'catch-adaptive'), 'priority' => 101, 'section' => 'title_tagline', 'settings' => 'catchadaptive_theme_options[logo_disable]', 'type' => 'checkbox'));
    $wp_customize->add_setting('catchadaptive_theme_options[logo_alt_text]', array('capability' => 'edit_theme_options', 'default' => $defaults['logo_alt_text'], 'sanitize_callback' => 'sanitize_text_field'));
    $wp_customize->add_control('catchadaptive_logo_alt_text', array('label' => __('Logo Alt Text', 'catch-adaptive'), 'priority' => 102, 'section' => 'title_tagline', 'settings' => 'catchadaptive_theme_options[logo_alt_text]', 'type' => 'text'));
    $wp_customize->add_setting('catchadaptive_theme_options[move_title_tagline]', array('capability' => 'edit_theme_options', 'default' => $defaults['move_title_tagline'], 'sanitize_callback' => 'catchadaptive_sanitize_checkbox'));
    $wp_customize->add_control('catchadaptive_theme_options[move_title_tagline]', array('label' => __('Check to move Site Title and Tagline before logo', 'catch-adaptive'), 'priority' => 103, 'section' => 'title_tagline', 'settings' => 'catchadaptive_theme_options[move_title_tagline]', 'type' => 'checkbox'));
    // Custom Logo End
    //Basic Color Options
    $wp_customize->add_setting('catchadaptive_theme_options[color_scheme]', array('capability' => 'edit_theme_options', 'default' => $defaults['color_scheme'], 'sanitize_callback' => 'catchadaptive_sanitize_select'));
    $schemes = catchadaptive_color_schemes();
    $choices = array();
    foreach ($schemes as $scheme) {
        $choices[$scheme['value']] = $scheme['label'];
    }
    $wp_customize->add_control('catchadaptive_theme_options[color_scheme]', array('choices' => $choices, 'label' => __('Color Scheme', 'catch-adaptive'), 'priority' => 5, 'section' => 'colors', 'settings' => 'catchadaptive_theme_options[color_scheme]', 'type' => 'radio'));
    //Basic Color Options
    // Header Options (added to Header section in Theme Customizer)
    require get_template_directory() . '/inc/customizer-includes/catchadaptive-customizer-header-options.php';
    //Theme Options
    require get_template_directory() . '/inc/customizer-includes/catchadaptive-customizer-theme-options.php';
    //Featured Content Setting
    require get_template_directory() . '/inc/customizer-includes/catchadaptive-customizer-featured-content-options.php';
    //Featured Slider
    require get_template_directory() . '/inc/customizer-includes/catchadaptive-customizer-featured-slider-options.php';
    //Social Links
    require get_template_directory() . '/inc/customizer-includes/catchadaptive-customizer-social-icon-options.php';
    // Reset all settings to default
    $wp_customize->add_section('catchadaptive_reset_all_settings', array('description' => __('Caution: Reset all settings to default. Refresh the page after save to view full effects.', 'catch-adaptive'), 'priority' => 700, 'title' => __('Reset all settings', 'catch-adaptive')));
    $wp_customize->add_setting('catchadaptive_theme_options[reset_all_settings]', array('capability' => 'edit_theme_options', 'default' => $defaults['reset_all_settings'], 'sanitize_callback' => 'catchadaptive_reset_all_settings', 'transport' => 'postMessage'));
    $wp_customize->add_control('catchadaptive_theme_options[reset_all_settings]', array('label' => __('Check to reset all settings to default', 'catch-adaptive'), 'section' => 'catchadaptive_reset_all_settings', 'settings' => 'catchadaptive_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-adaptive')));
    /**
     * Has dummy Sanitizaition function as it contains no value to be sanitized
     */
    $wp_customize->add_setting('important_links', array('sanitize_callback' => 'catchadaptive_sanitize_important_link'));
    $wp_customize->add_control(new Catchadaptive_Important_Links($wp_customize, 'important_links', array('label' => __('Important Links', 'catch-adaptive'), 'section' => 'important_links', 'settings' => 'important_links', 'type' => 'important_links')));
    //Important Links End
}
コード例 #3
0
 /**
  * Generate social icons.
  *
  * @since Catch Adaptive 0.1
  */
 function catchadaptive_get_social_icons()
 {
     if (!($catchadaptive_social_icons = get_transient('catchadaptive_social_icons'))) {
         $output = '';
         $options = catchadaptive_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-' . esc_attr(strtolower($key)) . '" title="' . __('Email', 'catch-adaptive') . '" href="mailto:' . sanitize_email($value) . '"><span class="screen-reader-text">' . __('Email', 'catch-adaptive') . '</span> </a>';
                 } else {
                     if ('Skype' == $key) {
                         $output .= '<a class="genericon_parent genericon genericon-' . esc_attr(strtolower($key)) . '" title="' . esc_attr($title[0]) . '" href="' . esc_attr($value) . '"><span class="screen-reader-text">' . $title[0] . '</span> </a>';
                     } else {
                         $output .= '<a class="genericon_parent genericon genericon-' . esc_attr(strtolower($key)) . '" target="_blank" title="' . esc_attr($title[0]) . '" href="' . esc_url($value) . '"><span class="screen-reader-text">' . $title[0] . '</span> </a>';
                     }
                 }
             }
         }
         $catchadaptive_social_icons = $output;
         set_transient('catchadaptive_social_icons', $catchadaptive_social_icons, 86940);
     }
     return $catchadaptive_social_icons;
 }
コード例 #4
0
 function catchadaptive_add_breadcrumb()
 {
     $options = catchadaptive_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 catchadaptive_custom_breadcrumbs($showOnHome, $delimiter);
     } else {
         return false;
     }
 }
コード例 #5
0
ファイル: sidebar.php プロジェクト: RGunning/EBItraining
 * @package Catch Themes
 * @subpackage Catch Adaptive
 * @since Catch Adaptive 0.1
 */
?>

<?php 
/** 
 * catchadaptive_before_secondary hook
 */
do_action('catchadaptive_before_secondary');
?>
	
<?php 
global $post, $wp_query;
$options = catchadaptive_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();
// Post /Page /General Layout
if ($post) {
    if (is_attachment()) {
        $parent = $post->post_parent;
        $layout = get_post_meta($parent, 'catchadaptive-layout-option', true);
        $sidebaroptions = get_post_meta($parent, 'catchadaptive-sidebar-options', true);
    } else {
        $layout = get_post_meta($post->ID, 'catchadaptive-layout-option', true);
        $sidebaroptions = get_post_meta($post->ID, 'catchadaptive-sidebar-options', true);
コード例 #6
0
 /**
  * Homepage Featured Content Position
  *
  * @action catchadaptive_content, catchadaptive_after_secondary
  * 
  * @since Catch Adaptive 0.1
  */
 function catchadaptive_featured_content_display_position()
 {
     // Getting data from Theme Options
     $options = catchadaptive_get_theme_options();
     if ('1' != $options['featured_content_position']) {
         add_action('catchadaptive_before_content', 'catchadaptive_featured_content_display', 60);
     } else {
         add_action('catchadaptive_after_content', 'catchadaptive_featured_content_display', 40);
     }
 }
コード例 #7
0
    /**
     * Add slider.
     *
     * @uses action hook catchadaptive_before_content.
     *
     * @since Catch Adaptive 0.1
     */
    function catchadaptive_featured_slider()
    {
        global $post, $wp_query;
        //catchadaptive_flush_transients();
        // get data value from options
        $options = catchadaptive_get_theme_options();
        $enableslider = $options['featured_slider_option'];
        $sliderselect = $options['featured_slider_type'];
        $imageloader = $options['featured_slider_image_loader'];
        // 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 (!($catchadaptive_featured_slider = get_transient('catchadaptive_featured_slider'))) {
                echo '<!-- refreshing cache -->';
                $catchadaptive_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('catchadaptive_demo_slider')) {
                    $catchadaptive_featured_slider .= catchadaptive_demo_slider($options);
                } else {
                    if ($sliderselect == 'featured-post-slider' && function_exists('catchadaptive_post_slider')) {
                        $catchadaptive_featured_slider .= catchadaptive_post_slider($options);
                    } elseif ($sliderselect == 'featured-page-slider' && function_exists('catchadaptive_page_slider')) {
                        $catchadaptive_featured_slider .= catchadaptive_page_slider($options);
                    } elseif ($sliderselect == 'featured-category-slider' && function_exists('catchadaptive_category_slider')) {
                        $catchadaptive_featured_slider .= catchadaptive_category_slider($options);
                    } elseif ($sliderselect == 'featured-image-slider' && function_exists('catchadaptive_image_slider')) {
                        $catchadaptive_featured_slider .= catchadaptive_image_slider($options);
                    }
                }
                $catchadaptive_featured_slider .= '
						</div><!-- .cycle-slideshow -->
					</div><!-- .wrapper -->
				</section><!-- #feature-slider -->';
                set_transient('catchadaptive_featured_slider', $catchadaptive_featured_slider, 86940);
            }
            echo $catchadaptive_featured_slider;
        }
    }
コード例 #8
0
 /**
  * This function loads Scroll Up Navigation
  *
  * @action catchadaptive_footer action
  * @uses set_transient and delete_transient
  */
 function catchadaptive_scrollup()
 {
     //catchadaptive_flush_transients();
     if (!($catchadaptive_scrollup = get_transient('catchadaptive_scrollup'))) {
         // get the data value from theme options
         $options = catchadaptive_get_theme_options();
         echo '<!-- refreshing cache -->';
         //site stats, analytics header code
         $catchadaptive_scrollup = '<a href="#masthead" id="scrollup" class="genericon"><span class="screen-reader-text">' . __('Scroll Up', 'catch-adaptive') . '</span></a>';
         set_transient('catchadaptive_scrollup', $catchadaptive_scrollup, 86940);
     }
     echo $catchadaptive_scrollup;
 }
コード例 #9
0
 /**
  * Template for Featured Header Image from theme options
  *
  * To override this in a child theme
  * simply create your own catchadaptive_featured_overall_image(), and that function will be used instead.
  *
  * @since Catch Adaptive 0.1
  */
 function catchadaptive_featured_overall_image()
 {
     global $post, $wp_query;
     $options = catchadaptive_get_theme_options();
     $defaults = catchadaptive_get_default_theme_options();
     $enableheaderimage = $options['enable_featured_header_image'];
     $header_image = get_header_image();
     $singlularimage = catchadaptive_featured_page_post_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, 'catchadaptive-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') {
             $catchadaptive_featured_overall_image = catchadaptive_featured_page_post_image();
         }
     }
     // Check Homepage
     if ($enableheaderimage == 'homepage') {
         if (is_front_page() || is_home() && $page_for_posts != $page_id) {
             $catchadaptive_featured_overall_image = esc_url($header_image);
         }
     }
     // Check Excluding Homepage
     if ($enableheaderimage == 'exclude-home') {
         if (is_front_page() || is_home() && $page_for_posts != $page_id) {
             return false;
         } else {
             $catchadaptive_featured_overall_image = esc_url($header_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()) {
             $catchadaptive_featured_overall_image = catchadaptive_featured_page_post_image();
         } else {
             $catchadaptive_featured_overall_image = esc_url($header_image);
         }
     } elseif ($enableheaderimage == 'entire-site') {
         $catchadaptive_featured_overall_image = esc_url($header_image);
     } elseif ($enableheaderimage == 'entire-site-page-post') {
         if (is_page() || is_single()) {
             $catchadaptive_featured_overall_image = catchadaptive_featured_page_post_image();
         } else {
             $catchadaptive_featured_overall_image = esc_url($header_image);
         }
     } elseif ($enableheaderimage == 'pages-posts') {
         if (is_page() || is_single()) {
             $catchadaptive_featured_overall_image = catchadaptive_featured_page_post_image();
         } else {
             return false;
         }
     } else {
         return false;
     }
     return $catchadaptive_featured_overall_image;
 }