tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Make thePriority available for translation. * * Translations can be added to the /languages/ directory. * If you're building a theme based on thePriority, use a find and * replace to change 'thePriority' to the name of your theme in all * template files. */ load_theme_textdomain( 'thePriority', get_template_directory() . '/languages' ); // This theme styles the visual editor to resemble the theme style. add_editor_style( array( 'css/editor-style.css', thePriority_font_url(), 'genericons/genericons.css' ) ); // Add RSS feed links to for posts and comments. add_theme_support( 'automatic-feed-links' ); // This theme uses wp_nav_menu() in two locations. register_nav_menus( array( 'primary' => __( 'Top primary menu', 'thePriority' ), 'secondary' => __( 'Secondary menu in right sidebar', 'thePriority' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) ); /* * Enable support for Post Formats. * See http://codex.wordpress.org/Post_Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery', ) ); // This theme allows users to set a custom background. add_theme_support( 'custom-background', apply_filters( 'thePriority_custom_background_args', array( //'default-color' => 'f5f5f5', ) ) ); // This theme uses its own gallery styles. add_filter( 'use_default_gallery_style', '__return_false' ); } endif; // thePriority_setup add_action( 'after_setup_theme', 'thePriority_setup' ); /** * Adjust content_width value for image attachment template. * * @since thePriority 1.0 */ function thePriority_content_width() { if ( is_attachment() && wp_attachment_is_image() ) { $GLOBALS['content_width'] = 810; } } add_action( 'template_redirect', 'thePriority_content_width' ); /** * Getter function for Featured Content Plugin. * * @since thePriority 1.0 * * @return array An array of WP_Post objects. */ function thePriority_get_featured_posts() { /** * Filter the featured posts to return in thePriority. * * @since thePriority 1.0 * * @param array|bool $posts Array of featured posts, otherwise false. */ return apply_filters( 'thePriority_get_featured_posts', array() ); } /** * A helper conditional function that returns a boolean value. * * @since thePriority 1.0 * * @return bool Whether there are featured posts. */ function thePriority_has_featured_posts() { return ! is_paged() && (bool) thePriority_get_featured_posts(); } /** * Register three thePriority widget areas. * * @since thePriority 1.0 */ function thePriority_widgets_init() { require get_template_directory() . '/inc/widgets.php'; register_widget( 'thePriority_Ephemera_Widget' ); register_sidebar( array( 'name' => __( 'Content Sidebar', 'thePriority' ), 'id' => 'sidebar-2', 'description' => __( 'Additional sidebar that appears on the right.', 'thePriority' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Custom_Footer Widget Area', 'thePriority' ), 'id' => 'sidebar-5', 'description' => __( 'Appears in the footer section of the site.', 'thePriority' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'thePriority_widgets_init' ); /** * Register Lato Google font for thePriority. * * @since thePriority 1.0 * * @return string */ function thePriority_font_url() { $font_url = ''; /* * Translators: If there are characters in your language that are not supported * by Lato, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Lato font: on or off', 'thePriority' ) ) { $font_url = add_query_arg( 'family', urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ), "//fonts.googleapis.com/css" ); } return $font_url; } /** * Enqueue scripts and styles for the front end. * * @since thePriority 1.0 */ function thePriority_scripts() { // Add Lato font, used in the main stylesheet. wp_enqueue_style( 'thePriority-lato', thePriority_font_url(), array(), null ); // Add Genericons font, used in the main stylesheet. wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.0.3' ); // Load our main stylesheet. wp_enqueue_style( 'thePriority-style', get_stylesheet_uri(), array( 'genericons' ) ); // Load the Internet Explorer specific stylesheet. wp_enqueue_style( 'thePriority-ie', get_template_directory_uri() . '/css/ie.css', array( 'thePriority-style', 'genericons' ), '20131205' ); wp_style_add_data( 'thePriority-ie', 'conditional', 'lt IE 9' ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } if ( is_singular() && wp_attachment_is_image() ) { wp_enqueue_script( 'thePriority-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20130402' ); } if ( is_active_sidebar( 'sidebar-3' ) ) { wp_enqueue_script( 'jquery-masonry' ); } if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) { wp_enqueue_script( 'thePriority-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131205', true ); wp_localize_script( 'thePriority-slider', 'featuredSliderDefaults', array( 'prevText' => __( 'Previous', 'thePriority' ), 'nextText' => __( 'Next', 'thePriority' ) ) ); } wp_enqueue_script( 'thePriority-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20140616', true ); } add_action( 'wp_enqueue_scripts', 'thePriority_scripts' ); /** * Enqueue Google fonts style to admin screen for custom header display. * * @since thePriority 1.0 */ function thePriority_admin_fonts() { wp_enqueue_style( 'thePriority-lato', thePriority_font_url(), array(), null ); } add_action( 'admin_print_scripts-appearance_page_custom-header', 'thePriority_admin_fonts' ); if ( ! function_exists( 'thePriority_the_attached_image' ) ) : /** * Print the attached image with a link to the next attached image. * * @since thePriority 1.0 */ function thePriority_the_attached_image() { $post = get_post(); /** * Filter the default thePriority attachment size. * * @since thePriority 1.0 * * @param array $dimensions { * An array of height and width dimensions. * * @type int $height Height of the image in pixels. Default 810. * @type int $width Width of the image in pixels. Default 810. * } */ $attachment_size = apply_filters( 'thePriority_attachment_size', array( 810, 810 ) ); $next_attachment_url = wp_get_attachment_url(); /* * Grab the IDs of all the image attachments in a gallery so we can get the URL * of the next adjacent image in a gallery, or the first image (if we're * looking at the last image in a gallery), or, in a gallery of one, just the * link to that image file. */ $attachment_ids = get_posts( array( 'post_parent' => $post->post_parent, 'fields' => 'ids', 'numberposts' => -1, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID', ) ); // If there is more than 1 attachment in a gallery... if ( count( $attachment_ids ) > 1 ) { foreach ( $attachment_ids as $attachment_id ) { if ( $attachment_id == $post->ID ) { $next_id = current( $attachment_ids ); break; } } // get the URL of the next image attachment... if ( $next_id ) { $next_attachment_url = get_attachment_link( $next_id ); } // or get the URL of the first image attachment. else { $next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) ); } } printf( '%2$s', esc_url( $next_attachment_url ), wp_get_attachment_image( $post->ID, $attachment_size ) ); } endif; if ( ! function_exists( 'thePriority_list_authors' ) ) : /** * Print a list of all site contributors who published at least one post. * * @since thePriority 1.0 */ function thePriority_list_authors() { $contributor_ids = get_users( array( 'fields' => 'ID', 'orderby' => 'post_count', 'order' => 'DESC', 'who' => 'authors', ) ); foreach ( $contributor_ids as $contributor_id ) : $post_count = count_user_posts( $contributor_id ); // Move on if user has not published a post (yet). if ( ! $post_count ) { continue; } ?>
= 2 || $page >= 2 ) && ! is_404() ) { $title = "$title $sep " . sprintf( __( 'Page %s', 'thePriority' ), max( $paged, $page ) ); } return $title; } add_filter( 'wp_title', 'thePriority_wp_title', 10, 2 ); // Implement Custom Header features. $args = array( 'flex-width' => true, 'width' => 360, 'flex-height' => true, 'height' => 80, 'default-image' => get_template_directory_uri() . '/images/logo.gif', ); add_theme_support( 'custom-header', $args ); require get_template_directory() . '/inc/custom-header.php'; // Custom template tags for this theme. require get_template_directory() . '/inc/template-tags.php'; // Add Theme Customizer functionality. require get_template_directory() . '/inc/customizer.php'; /* * Add Featured Content functionality. * * To overwrite in a plugin, define your own Featured_Content class on or * before the 'setup_theme' hook. */ require_once ( get_stylesheet_directory() . '/theme-options.php' ); function be_exclude_post_formats_from_blog( $query ) { if( $query->is_main_query() && $query->is_home() ) { $tax_query = array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array( 'post-format-quote', 'post-format-gallery', 'post-format-aside', 'post-format-link', 'post-format-audio', 'post-format-quote', 'post-format-video' ), 'operator' => 'NOT IN', ) ); $query->set( 'tax_query', $tax_query ); } } add_action( 'pre_get_posts', 'be_exclude_post_formats_from_blog' ); add_action('after_setup_theme', 'thePriority_setup', 20); function thePriority_paging_nav() { global $wp_query; // Don't print empty markup if there's only one page. if ( $wp_query->max_num_pages < 2 ) return; ?> post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) return; ?> * @author Gary Jones * @copyright Copyright (c) 2014, Thomas Griffin * @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later * @link https://github.com/thomasgriffin/TGM-Plugin-Activation */ /** * Include the TGM_Plugin_Activation class. */ require_once dirname( __FILE__ ) . '/class-tgm-plugin-activation.php'; add_action( 'tgmpa_register', 'my_theme_register_required_plugins' ); /** * Register the required plugins for this theme. * * In this example, we register two plugins - one included with the TGMPA library * and one from the .org repo. * * The variable passed to tgmpa_register_plugins() should be an array of plugin * arrays. * * This function is hooked into tgmpa_init, which is fired within the * TGM_Plugin_Activation class constructor. */ function my_theme_register_required_plugins() { /** * Array of plugin arrays. Required keys are name and slug. * If the source is NOT from the .org repo, then source is also required. */ $plugins = array( // This is an example of how to include a plugin from a private repo in your theme. array( 'name' => 'Post Teaser', 'slug' => 'post-teaser', 'source' => 'http://www.badeyes.com/documents/post-teaser.zip', 'required' => false, // If false, the plugin is only 'recommended' instead of required. ), ); /** * Array of configuration settings. Amend each line as needed. * If you want the default strings to be available under your own theme domain, * leave the strings uncommented. * Some of the strings are added into a sprintf, so see the comments at the * end of each line for what each argument will be. */ $config = array( 'default_path' => '', // Default absolute path to pre-packaged plugins. 'menu' => 'tgmpa-install-plugins', // Menu slug. 'has_notices' => true, // Show admin notices or not. 'dismissable' => true, // If false, a user cannot dismiss the nag message. 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. 'is_automatic' => false, // Automatically activate plugins after installation or not. 'message' => '', // Message to output right before the plugins table. 'strings' => array( 'page_title' => __( 'Install Required Plugins', 'tgmpa' ), 'menu_title' => __( 'Install Plugins', 'tgmpa' ), 'installing' => __( 'Installing Plugin: %s', 'tgmpa' ), // %s = plugin name. 'oops' => __( 'Something went wrong with the plugin API.', 'tgmpa' ), 'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.' ), // %1$s = plugin name(s). 'notice_can_install_recommended' => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.' ), // %1$s = plugin name(s). 'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.' ), // %1$s = plugin name(s). 'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s). 'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s). 'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.' ), // %1$s = plugin name(s). 'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.' ), // %1$s = plugin name(s). 'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.' ), // %1$s = plugin name(s). 'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins' ), 'activate_link' => _n_noop( 'Begin activating plugin', 'Begin activating plugins' ), 'return' => __( 'Return to Required Plugins Installer', 'tgmpa' ), 'plugin_activated' => __( 'Plugin activated successfully.', 'tgmpa' ), 'complete' => __( 'All plugins installed and activated successfully. %s', 'tgmpa' ), // %s = dashboard link. 'nag_type' => 'updated' // Determines admin notice type - can only be 'updated', 'update-nag' or 'error'. ) ); tgmpa( $plugins, $config ); }