Ejemplo n.º 1
0
/**
 * Set up theme defaults and registers support for various WordPress features.
 *
 * @since 1.0.0
 */
function huesos_setup()
{
    // Add support for translating strings in this theme.
    // @link http://codex.wordpress.org/Function_Reference/load_theme_textdomain
    load_theme_textdomain('huesos', get_template_directory() . '/languages');
    // This theme styles the visual editor to resemble the theme style.
    add_editor_style(array(is_rtl() ? 'assets/css/editor-style-rtl.css' : 'assets/css/editor-style.css', huesos_fonts_url()));
    // Add default posts and comments RSS feed links to head.
    add_theme_support('automatic-feed-links');
    // Add support for the title tag.
    // @link https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/
    add_theme_support('title-tag');
    // Add support for a logo.
    add_theme_support('site-logo', array('size' => 'full'));
    // Add support for post thumbnails.
    add_theme_support('post-thumbnails');
    set_post_thumbnail_size(640, 640, false);
    // Add HTML5 markup for the comment forms, search forms and comment lists.
    add_theme_support('html5', array('caption', 'comment-form', 'comment-list', 'gallery', 'search-form'));
    // Enable support for Post Formats.
    add_theme_support('post-formats', array('link', 'quote'));
    // Register default nav menus.
    register_nav_menus(array('primary' => __('Primary Menu', 'huesos'), 'social' => __('Social Links Menu', 'huesos'), 'footer' => __('Footer Menu', 'huesos')));
    // Register front page templates.
    huesos_theme()->front_page->add_support()->add_templates(array('templates/full-width.php', 'templates/page-no-sidebar.php'));
}
Ejemplo n.º 2
0
 /**
  * Retrieve tracks for the site-wide player.
  *
  * @since 1.0.0
  *
  * @return array Array of tracks.
  */
 protected function get_tracks()
 {
     $tracks = array();
     // Return cached tracks.
     if (!is_null($this->tracks)) {
         return $this->tracks;
     }
     // Fetch from a Cue playlist.
     if (class_exists('Cue')) {
         $tracks = huesos_theme()->template->get_tracks('huesos_player');
     }
     // Fetch tracks from the first playable record.
     if (empty($tracks) && defined('AUDIOTHEME_VERSION')) {
         $record_id = $this->get_first_playable_record_id();
         if ($record_id) {
             $tracks = $this->get_track_data($record_id);
         }
     }
     // Cache the results locally for this request.
     $this->tracks = $tracks;
     return $tracks;
 }
Ejemplo n.º 3
0
 /**
  * Retrieve terms for a given taxonomy.
  *
  * @since 1.0.0
  *
  * @param array $taxonomies Optional. List of taxonomy objects with labels.
  * @param int|WP_Post $post Optional. Post ID or object. Defaults to the current post.
  */
 function huesos_get_entry_terms($taxonomies = array(), $post = null)
 {
     $default = array('category' => __('Posted In:', 'huesos'), 'post_tag' => __('Tagged:', 'huesos'));
     // Set default taxonomies if empty or not an array.
     if (!$taxonomies || !is_array($taxonomies)) {
         $taxonomies = $default;
     }
     // Allow plugins and themes to override taxonomies and labels.
     $taxonomies = apply_filters('huesos_entry_terms_taxonomies', $taxonomies);
     // Return early if the taxonomies are empty or not an array.
     if (!$taxonomies || !is_array($taxonomies)) {
         return;
     }
     $post = get_post($post);
     $output = '';
     // Get object taxonomy list to validate taxonomy later on.
     $object_taxonomies = get_object_taxonomies(get_post_type());
     // Loop through each taxonomy and set up term list html.
     foreach ((array) $taxonomies as $taxonomy => $label) {
         // Continue if taxonomy is not in the object taxonomy list.
         if (!in_array($taxonomy, $object_taxonomies)) {
             continue;
         }
         // Get term list
         $term_list = get_the_term_list($post->ID, $taxonomy, '<li>', '</li><li>', '</li>');
         // Continue if there is not one or more terms in the taxonomy.
         if (!$term_list || !huesos_theme()->template->has_multiple_terms($taxonomy)) {
             continue;
         }
         if ($label) {
             $label = sprintf('<h3 class="term-title">%s</h3>', $label);
         }
         $term_list = sprintf('<ul class="term-list">%s</ul>', $term_list);
         // Set term list output html.
         $output .= sprintf('<div class="term-group term-group--%1$s">%2$s %3$s</div>', esc_attr($taxonomy), $label, $term_list);
     }
     // Return if no term lists were created.
     if (!$output) {
         return;
     }
     printf('<div class="entry-terms">%s</div>', $output);
 }