Exemplo n.º 1
0
/**
 * Activate the local Infinite Scroll module if the Jetpack module is not activated.
 *
 * @since  1.1.6.
 *
 * @return void
 */
function oxford_maybe_activate_infinity()
{
    global $pagenow;
    $wpcom = oxford_is_wpcom();
    $plugin_activation = 'plugins.php' === $pagenow && (isset($_REQUEST['action']) && 'activate' === $_REQUEST['action']) && isset($_REQUEST['plugin']);
    $module_activation = 'admin.php' === $pagenow && (isset($_REQUEST['page']) && 'jetpack' === $_REQUEST['page']) && (isset($_REQUEST['action']) && 'activate' === $_REQUEST['action']) && (isset($_REQUEST['module']) && 'infinite-scroll' === $_REQUEST['module']);
    $infinity_class = class_exists('The_Neverending_Home_Page');
    if (!$wpcom && !$plugin_activation && !$module_activation && !$infinity_class) {
        $file = trailingslashit(get_template_directory()) . 'inc/infinite-scroll/lib/infinity.php';
        if (file_exists($file)) {
            // Load the file
            require_once $file;
            // Filter the URL for the CSS file
            add_filter('plugins_url', 'oxford_plugins_url_infinity', 10, 3);
            // Maybe enqueue spin.js
            add_action('wp_enqueue_scripts', 'oxford_maybe_enqueue_spin');
        }
    }
}
Exemplo n.º 2
0
 /**
  * Sets up theme defaults and registers support for various WordPress features.
  *
  * Note that this function is hooked into the after_setup_theme hook, which
  * runs before the init hook. The init hook is too late for some features, such
  * as indicating support for post thumbnails.
  */
 function oxford_setup()
 {
     /*
      * Make theme available for translation.
      * Translations can be filed in the /languages/ directory.
      */
     load_theme_textdomain('oxford', get_stylesheet_directory() . '/languages');
     // Add default posts and comments RSS feed links to head.
     add_theme_support('automatic-feed-links');
     // Enable support for Post Thumbnails.
     add_theme_support('post-thumbnails');
     // Add secondary featured image
     oxford_add_featured_image('secondary-image', array('post', 'page'), array('title' => 'Secondary Image', 'set_link' => 'Set secondary image', 'remove_link' => 'Remove secondary image'));
     // This theme uses wp_nav_menu() in one location.
     register_nav_menus(array('primary' => __('Primary Menu', 'oxford')));
     // HTML5 forms
     add_theme_support('html5');
     // Add support for the WP.com site logo functionality
     if (oxford_is_wpcom()) {
         add_theme_support('site-logo', array('size' => 'oxford_large'));
     }
     // Editor styles
     add_editor_style('css/editor-style.css');
 }
Exemplo n.º 3
0
 /**
  * Add theme options for the footer via the WordPress Customizer.
  *
  * @since  1.0.
  *
  * @param  object $wp_customize    The main customizer object.
  * @param  string $section         The section ID to assign controls to.
  * @return void
  */
 function oxford_customize_footer($wp_customize, $section)
 {
     $priority = 80;
     // Only show the Footer Widgets options if not on wpcom
     if (!oxford_is_wpcom()) {
         // Footer Widgets heading
         $wp_customize->add_control(new Oxford_Customize_Misc_Control($wp_customize, 'oxford_footer-widgets-heading', array('section' => $section, 'label' => __('Footer Widgets', 'oxford'), 'type' => 'heading', 'priority' => $priority)));
         $priority += 2;
         // Hide footer widgets on pages
         $wp_customize->add_setting('footer-widgets-hide-on-pages', array('default' => 0, 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
         $wp_customize->add_control('oxford_footer-widgets-hide-on-pages', array('settings' => 'footer-widgets-hide-on-pages', 'section' => $section, 'label' => __('Hide on pages', 'oxford'), 'type' => 'checkbox', 'priority' => $priority));
         $priority += 2;
         // Hide footer widgets on posts
         $wp_customize->add_setting('footer-widgets-hide-on-posts', array('default' => 0, 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
         $wp_customize->add_control('oxford_footer-widgets-hide-on-posts', array('settings' => 'footer-widgets-hide-on-posts', 'section' => $section, 'label' => __('Hide on posts', 'oxford'), 'type' => 'checkbox', 'priority' => $priority));
         $priority += 2;
         // Hide footer widgets on archives
         $wp_customize->add_setting('footer-widgets-hide-on-archives', array('default' => 0, 'type' => 'theme_mod', 'sanitize_callback' => 'absint'));
         $wp_customize->add_control('oxford_footer-widgets-hide-on-archives', array('settings' => 'footer-widgets-hide-on-archives', 'section' => $section, 'label' => __('Hide on archives', 'oxford'), 'type' => 'checkbox', 'priority' => $priority));
         $priority += 2;
     }
     // Footer text
     $wp_customize->add_setting('footer-text', array('default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'oxford_allowed_tags', 'transport' => 'postMessage'));
     $wp_customize->add_control('oxford_footer-text', array('settings' => 'footer-text', 'section' => $section, 'label' => __('Footer Text', 'oxford'), 'type' => 'text', 'priority' => $priority));
     $priority += 2;
     // Twitter
     $wp_customize->add_setting('twitter', array('default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control('oxford_twitter', array('settings' => 'twitter', 'section' => $section, 'label' => __('Twitter URL', 'oxford'), 'type' => 'text', 'priority' => $priority));
     $priority += 2;
     // Facebook
     $wp_customize->add_setting('facebook', array('default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control('oxford_facebook', array('settings' => 'facebook', 'section' => $section, 'label' => __('Facebook URL', 'oxford'), 'type' => 'text', 'priority' => $priority));
     $priority += 2;
     // Google
     $wp_customize->add_setting('google', array('default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control('oxford_google', array('settings' => 'google', 'section' => $section, 'label' => __('Google+ URL', 'oxford'), 'type' => 'text', 'priority' => $priority));
     $priority += 2;
     // Flickr
     $wp_customize->add_setting('flickr', array('default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control('oxford_flickr', array('settings' => 'flickr', 'section' => $section, 'label' => __('Flickr URL', 'oxford'), 'type' => 'text', 'priority' => $priority));
     $priority += 2;
     // Pinterest
     $wp_customize->add_setting('pinterest', array('default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control('oxford_pinterest', array('settings' => 'pinterest', 'section' => $section, 'label' => __('Pinterest URL', 'oxford'), 'type' => 'text', 'priority' => $priority));
     $priority += 2;
     // Instagram
     $wp_customize->add_setting('instagram', array('default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control('oxford_instagram', array('settings' => 'instagram', 'section' => $section, 'label' => __('Instagram URL', 'oxford'), 'type' => 'text', 'priority' => $priority));
     $priority += 2;
     // Linked In
     $wp_customize->add_setting('linkedin', array('default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control('oxford_linked-in', array('settings' => 'linkedin', 'section' => $section, 'label' => __('LinkedIn URL', 'oxford'), 'type' => 'text', 'priority' => $priority));
     $priority += 2;
     // RSS
     $wp_customize->add_setting('rss', array('default' => '', 'type' => 'theme_mod', 'sanitize_callback' => 'esc_url_raw'));
     $wp_customize->add_control('oxford_rss', array('settings' => 'rss', 'section' => $section, 'label' => __('RSS URL', 'oxford'), 'type' => 'text', 'priority' => $priority));
     $priority += 2;
 }
Exemplo n.º 4
0
 /**
  * Render the archive view HTML markup for the first suitable featured image in the given post.
  *
  * @since 1.0.
  *
  * @param  int    $post_id  The id of the post to get the featured image from.
  * @param  string $size     The defined image size to use for the featured image.
  * @return string           The HTML markup.
  */
 function oxford_get_the_archive_featured_image($post_id = 0, $size = 'oxford_medium')
 {
     $html = '';
     // Sanitize and validate the post id
     if (0 === absint($post_id)) {
         $post_id = get_the_ID();
     }
     // Get the selected image ids
     $image_ids = oxford_get_featured_image_ids($post_id);
     if (!empty($image_ids)) {
         $html .= '<div class="selected-images">';
         // Count array items before array_shift
         $image_count = count($image_ids);
         $image_id = absint(array_shift($image_ids));
         $image_html = wp_get_attachment_image($image_id, $size, false, array('class' => 'selected-images-only'));
         if ('' !== $image_html) {
             $html .= '<a href="' . esc_url(get_permalink($post_id)) . '">' . $image_html . '</a>';
         } else {
             if (current_user_can('edit_posts')) {
                 // Image is not wide enough
                 $error_link = oxford_is_wpcom() ? 'http://theme.wordpress.com/themedoc/oxford/' : get_edit_post_link() . '#featured-images-help';
                 $error_message = sprintf(_n('<strong>Admin:</strong> The featured image for this post is not wide enough. %s', '<strong>Admin:</strong> Neither of the featured images for this post is wide enough. %s', $image_count, 'oxford'), sprintf('<br /><a href="%s">%s</a>', esc_url($error_link), __('Learn more.', 'oxford')));
                 $html .= '<div class="selected-images-none">';
                 $html .= $error_message;
                 $html .= '</div>';
             }
         }
         $html .= '</div>';
         return $html;
     }
     return $html;
 }
Exemplo n.º 5
0
?>
		<?php 
if (!empty($footer_text)) {
    ?>
			<p class="footer-text">
				<?php 
    echo oxford_allowed_tags($footer_text);
    ?>
			</p>
		<?php 
}
?>

		<div class="site-info">
			<?php 
if (oxford_is_wpcom()) {
    ?>
				<a href="http://wordpress.com/"><?php 
    printf(__('Proudly powered by %s', 'oxford'), 'WordPress');
    ?>
</a><br />
				<?php 
    printf(__('Theme: %1$s by %2$s.', 'oxford'), 'Oxford', '<a href="https://thethemefoundry.com/">The Theme Foundry</a>');
    ?>
			<?php 
} else {
    ?>
				<a title="<?php 
    esc_attr_e('Theme info', 'oxford');
    ?>
" href="https://thethemefoundry.com/wordpress-themes/oxford/"><?php 
Exemplo n.º 6
0
 /**
  * Determine if a custom logo should be displayed.
  *
  * @since  1.0.
  *
  * @return bool    True if a logo should be displayed. False if a logo shouldn't be displayed.
  */
 function has_logo()
 {
     if (oxford_is_wpcom()) {
         return has_site_logo();
     } else {
         return $this->has_logo_by_type('regular-logo') || $this->has_logo_by_type('retina-logo');
     }
 }
Exemplo n.º 7
0
?>
			</h1>
			<?php 
if (oxford_is_wpcom() && oxford_get_logo()->has_logo() && 0 === $hide_site_title && !is_single()) {
    ?>
				<h1><?php 
    bloginfo('name');
    ?>
</h1>
			<?php 
}
?>
		</div>

		<?php 
if (oxford_is_wpcom() && oxford_get_logo()->has_logo() && 0 === $hide_site_title && is_single()) {
    ?>
			<h1 class="site-description"><?php 
    bloginfo('name');
    ?>
</h1>
		<?php 
}
?>
		<?php 
if (get_bloginfo('description')) {
    ?>
			<h2 class="site-description"><?php 
    bloginfo('description');
    ?>
</h2>
Exemplo n.º 8
0
 /**
  * Review relevant theme options before showing the footer widgets
  *
  * @since 1.0.
  *
  */
 function oxford_maybe_show_footer_widgets()
 {
     // Pages
     if (!oxford_is_wpcom() && get_theme_mod('footer-widgets-hide-on-pages') && is_page()) {
         return;
     }
     // Posts
     if (!oxford_is_wpcom() && get_theme_mod('footer-widgets-hide-on-posts') && is_single()) {
         return;
     }
     // Blog/Archives
     if (!oxford_is_wpcom() && get_theme_mod('footer-widgets-hide-on-archives') && (is_home() || is_archive() || is_search())) {
         return;
     }
     // All sidebars are empty
     if (!oxford_has_footer_widgets()) {
         return;
     }
     // Still here? Show the footer widgets
     get_sidebar('footer-1');
     get_sidebar('footer-2');
     get_sidebar('footer-3');
 }