/** * Enqueue our media manager resources, scripts, and styles. * * @uses wp_enqueue_media() * @uses wp_enqueue_style() * @uses wp_enqueue_script() * @uses plugins_url() */ public function enqueue() { $assets_uri = trailingslashit(flagship_library()->get_library_uri()) . 'assets/'; // Enqueues all needed media resources. wp_enqueue_media(); // Enqueue our control script and styles. wp_enqueue_style('site-logo-control', esc_url($assets_uri) . 'css/site-logo/control.css'); wp_enqueue_script('site-logo-control', esc_url($assets_uri) . 'js/site-logo/control.js', array('media-views', 'customize-controls', 'underscore'), '', true); }
/** * Add fields for author box settings to the user edit screen. * * @since 1.4.0 * @access public * @param $user Object WordPress user object. * @return void */ public function user_fields($user) { if (!current_user_can('edit_users', $user->ID)) { return false; } $single_box = get_the_author_meta('flagship_author_box_single', $user->ID); $archive_box = get_the_author_meta('flagship_author_box_archive', $user->ID); // Set the single author box to enabled when no author meta has been set. if ('' === $single_box) { $single_box = 1; } require_once flagship_library()->dir . 'templates/admin/settings-author-box.php'; }
/** * Allow themes and plugins to access Flagship_Footer_Widgets methods and * properties. * * Legacy function no longer in use. This will be removed on the next major * release. Recommend accessing the public variable directly. * * @deprecated 1.4.0 * @since 1.1.0 * @uses Flagship_Footer_Widgets * @return object Flagship_Footer_Widgets */ function flagship_footer_widgets() { _deprecated_function(__FUNCTION__, '1.4.0'); return flagship_library()->footer_widgets; }
/** * Display our breadcrumbs based on selections made in the WordPress customizer. * * @since 1.1.0 * @access public * @return bool true if both our template tag and theme mod return true. */ function flagship_display_breadcrumbs() { $breadcrumbs = flagship_library()->breadcrumb_display; // Return early if our theme doesn't support breadcrumbs. if (!is_object($breadcrumbs)) { return false; } // Grab our available breadcrumb display options. $options = array_keys($breadcrumbs->get_options()); // Set up an array of template tags to map to our breadcrumb display options. $tags = apply_filters('flagship_breadcrumb_tags', array(is_singular() && !is_attachment() && !is_page(), is_page(), is_home() && !is_front_page(), is_archive(), is_404(), is_attachment())); // Loop through our theme mods to see if we have a match. foreach (array_combine($options, $tags) as $mod => $tag) { // Return true if we find an enabled theme mod within the correct section. if (1 === absint(get_theme_mod($mod, 0)) && true === $tag) { return true; } } return false; }
* @return void */ private function admin_instantiate() { if (class_exists('Flagship_Author_Box_Admin', false)) { $this->author_box_admin = new Flagship_Author_Box_Admin(); $this->author_box_admin->run(); } } } } if (!function_exists('flagship_library')) { /** * Grab an instance of the main library class. If you need to reference a * method in the class for some reason, do it using this function. * * Example: * * <?php flagship_library()->is_customizer_preview(); ?> * * @since 1.2.1 * @return object Flagship_Library */ function flagship_library() { return Flagship_Library::instance(); } } // Get the library up and running. flagship_library();
/** * Displays all registered footer widget areas using a template. * * @since 1.0.0 * @uses locate_template() Load the footer widget template. * @return null Return early if there's no theme support. */ public function the_footer_widgets() { // Return early if we don't have any footer widgets to display. if (!isset($this->footer_widgets[0]) || !is_numeric($this->footer_widgets[0])) { return; } // Return early if the first widget area has no widgets. if (!is_active_sidebar('footer-1')) { return; } $counter = $this->counter; // Use the theme's footer widgets template if it exists. if ('' !== locate_template('flagship/footer-widgets.php')) { return require_once locate_template('flagship/footer-widgets.php'); } require_once flagship_library()->dir . 'templates/footer-widgets.php'; }
/** * Output an <img> tag of the site logo, at the size specified * in the theme's add_theme_support() declaration. * * @uses Flagship_Logo::logo * @uses Flagship_Logo::theme_size() * @uses Flagship_Logo::has_site_logo() * @uses Flagship_Library::is_customizer_preview() * @uses esc_url() * @uses home_url() * @uses esc_attr() * @uses wp_get_attachment_image() * @uses apply_filters() * @since 1.0.0 */ function the_site_logo() { $logo = $this->logo; $size = $this->theme_size(); // Bail if no logo is set. Leave a placeholder if we're in the Customizer, though (needed for the live preview). if (!$this->has_site_logo()) { if (flagship_library()->is_customizer_preview()) { printf('<a href="%1$s" class="site-logo-link" style="display:none;"><img class="site-logo" data-size="%2$s" /></a>', esc_url(home_url('/')), esc_attr($size)); } return; } // We have a logo. Logo is go. $html = sprintf('<a href="%1$s" class="site-logo-link" rel="home">%2$s</a>', esc_url(home_url('/')), wp_get_attachment_image($logo['id'], $size, false, array('class' => "site-logo attachment-{$size}", 'data-size' => $size))); echo apply_filters('the_site_logo', $html, $logo, $size); }
/** * Displays the archive author box using a template. * * @since 1.4.0 * @access public * @uses locate_template() Load the archive author box template. * @return void */ public function archive() { if (!is_author() || is_paged()) { return; } $display = get_the_author_meta('flagship_author_box_archive'); // Bail if display is disabled or no author meta exists. if (empty($display)) { return; } // Use the theme's archive author box template if it exists. if ('' !== locate_template('flagship/author-box-archive.php')) { return require_once locate_template('flagship/author-box-archive.php'); } require_once flagship_library()->dir . 'templates/author-box-archive.php'; }