コード例 #1
2
 function presscore_search_title_shortcode()
 {
     $title = '';
     $wrap_class = '';
     if (is_search()) {
         $title = get_search_query();
     } else {
         if (is_archive()) {
             if (is_category()) {
                 $title = single_cat_title('', false);
             } elseif (is_tag()) {
                 $title = single_tag_title('', false);
             } elseif (is_author()) {
                 the_post();
                 $title = '<a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta("ID"))) . '" title="' . esc_attr(get_the_author()) . '" rel="me">' . get_the_author() . '</a>';
                 $wrap_class .= ' vcard';
                 rewind_posts();
             } elseif (is_day()) {
                 $title = '<span>' . get_the_date() . '</span>';
             } elseif (is_month()) {
                 $title = '<span>' . get_the_date('F Y');
             } elseif (is_year()) {
                 $title = '<span>' . get_the_date('Y');
             } elseif (is_tax('dt_portfolio_category')) {
                 $title = single_term_title('', false);
             } elseif (is_tax('dt_gallery_category')) {
                 $title = single_term_title('', false);
             }
         }
     }
     if ($title) {
         $title = '<span' . ($wrap_class ? ' class="' . esc_attr($wrap_class) . '"' : '') . '>' . $title . '</span>';
     }
     return $title;
 }
コード例 #2
1
ファイル: avatar.php プロジェクト: billyprice1/bdApi
function xfac_get_avatar($avatar = '', $id_or_email, $size = 96, $default = '', $alt = '')
{
    if (is_numeric($id_or_email)) {
        $wpUserId = (int) $id_or_email;
    } elseif (is_string($id_or_email) && ($user = get_user_by('email', $id_or_email))) {
        $wpUserId = $user->ID;
    } elseif (is_object($id_or_email) && !empty($id_or_email->user_id)) {
        $wpUserId = (int) $id_or_email->user_id;
    }
    if (empty($wpUserId)) {
        // cannot figure out the user id...
        return $avatar;
    }
    $apiRecords = xfac_user_getRecordsByUserId($wpUserId);
    if (empty($apiRecords)) {
        // no api records
        return $avatar;
    }
    $apiRecord = reset($apiRecords);
    if (empty($apiRecord->profile['links']['avatar'])) {
        // no avatar?
        return $avatar;
    }
    $avatar = $apiRecord->profile['links']['avatar'];
    $size = (int) $size;
    if (empty($alt)) {
        $alt = get_the_author_meta('display_name', $wpUserId);
    }
    $author_class = is_author($wpUserId) ? ' current-author' : '';
    $avatar = "<img alt='" . esc_attr($alt) . "' src='" . esc_url($avatar) . "' class='avatar avatar-{$size}{$author_class} photo' height='{$size}' width='{$size}' />";
    return $avatar;
}
コード例 #3
0
function widget_author_info_card($args)
{
    if (get_query_var('author_name')) {
        $curauth = get_userdatabylogin(get_query_var('author_name'));
    } else {
        $curauth = get_userdata(get_query_var('author'));
    }
    extract($args);
    echo $before_widget . $before_title;
    // If its the author page.
    if (get_option('sa_add_to_author_page') == 'yes' && is_author()) {
        $title = $curauth->display_name;
        echo $title . $after_title;
        echo sa_author_info_card($curauth);
    } else {
        $title = "List of Authors";
        echo $title . $after_title;
        ob_start();
        wp_list_authors('show_fullname=1&optioncount=1');
        $author_list = ob_get_contents();
        ob_end_clean();
        echo "<ul>{$author_list}</ul>";
    }
    echo $after_widget;
}
コード例 #4
0
ファイル: extras.php プロジェクト: jokoprastiyo/slaves-0.3
 function semifolio_filter_wp_title($old_title, $sep, $sep_location)
 {
     // add padding to the sep
     $ssep = ' ' . $sep . ' ';
     // find the type of index page this is
     if (is_category()) {
         $insert = $ssep . __('Category', 'slaves');
     } elseif (is_tag()) {
         $insert = $ssep . __('Tag', 'slaves');
     } elseif (is_author()) {
         $insert = $ssep . __('Author', 'slaves');
     } elseif (is_year() || is_month() || is_day()) {
         $insert = $ssep . __('Archives', 'slaves');
     } elseif (is_home()) {
         $insert = $ssep . bloginfo('description');
     } else {
         $insert = NULL;
     }
     // get the page number we're on (index)
     if (get_query_var('paged')) {
         $num = $ssep . __('Page ', 'slaves') . get_query_var('paged');
     } elseif (get_query_var('page')) {
         $num = $ssep . __('Page ', 'slaves') . get_query_var('page');
     } else {
         $num = NULL;
     }
     // concoct and return new title
     return bloginfo('name') . $insert . $old_title . $num;
 }
コード例 #5
0
 /**
  * Display breadcrumbs
  */
 public function display()
 {
     if (Habakiri::get('is_displaying_bread_crumb') === 'false') {
         return;
     }
     global $wp_query;
     // Set to home
     $home_label = $this->get_home_label();
     $this->set($home_label, home_url('/'));
     // Set to blog
     $post_type = $this->get_post_type();
     if (is_category() || is_tag() || is_date() || is_author() || is_single() && $post_type === 'post') {
         $show_on_front = get_option('show_on_front');
         $page_for_posts = get_option('page_for_posts');
         if ($show_on_front === 'page' && $page_for_posts) {
             $this->set(get_the_title($page_for_posts), get_permalink($page_for_posts));
         }
     }
     // Set current and ancestors
     if (is_404()) {
         $this->set_for_404();
     } elseif (is_search()) {
         $this->set_for_search();
     } elseif (is_tax()) {
         $this->set_for_tax();
     } elseif (is_attachment()) {
         $this->set_for_attachment();
     } elseif (is_page() && !is_front_page()) {
         $this->set_for_page();
     } elseif (is_post_type_archive()) {
         $this->set_for_post_type_archive();
     } elseif (is_single()) {
         $this->set_for_single();
     } elseif (is_category()) {
         $this->set_for_category();
     } elseif (is_tag()) {
         $this->set_for_tag();
     } elseif (is_author()) {
         $this->set_for_author();
     } elseif (is_day()) {
         $this->set_for_day();
     } elseif (is_month()) {
         $this->set_for_month();
     } elseif (is_year()) {
         $this->set_for_year();
     } elseif (is_home() && !is_front_page()) {
         $this->set_for_blog();
     }
     $bread_crumb = array();
     $last_item = array_pop($this->bread_crumb);
     foreach ($this->bread_crumb as $_bread_crumb) {
         if (!empty($_bread_crumb['link'])) {
             $bread_crumb[] = sprintf('<a href="%s">%s</a>', esc_url($_bread_crumb['link']), esc_html($_bread_crumb['title']));
         } else {
             $bread_crumb[] = esc_html($_bread_crumb['title']);
         }
     }
     $bread_crumb[] = sprintf('<strong>%s</strong>', $last_item['title']);
     printf('<div class="breadcrumbs">%s</div>', implode(' &gt; ', apply_filters('habakiri_bread_crumb', $bread_crumb)));
 }
コード例 #6
0
ファイル: blog.php プロジェクト: jordanmaslyn/vvv-starter
function get_index_headline()
{
    if (is_home()) {
        $index_headline = 'Blog Index';
    } else {
        if (is_category()) {
            $category = single_term_title("", false);
            $index_headline = 'Archives for the "' . $category . '" Category';
        } elseif (is_tag()) {
            $tag = single_term_title("", false);
            $index_headline = 'Archives for the "' . $tag . '" Category';
        } elseif (is_day()) {
            $index_headline = 'Archive for ' . get_the_time('F jS, Y');
        } elseif (is_month()) {
            $index_headline = 'Archive for ' . get_the_time('F Y');
        } elseif (is_year()) {
            $index_headline = 'Archive for ' . get_the_time('Y');
        } elseif (is_author()) {
            $index_headline = 'Author Archive';
        } else {
            $index_headline = 'Blog Archives';
        }
    }
    return $index_headline;
}
コード例 #7
0
function rcl_messages_scripts()
{
    global $user_ID, $rcl_options, $post, $wpdb;
    if (isset($rcl_options['notify_message']) && $rcl_options['notify_message']) {
        return false;
    }
    wp_enqueue_script('jquery');
    $glup = $rcl_options['global_update_private_message'];
    if (!$glup) {
        $new_mess = $wpdb->get_row($wpdb->prepare("SELECT ID FROM " . RCL_PREF . "private_message WHERE adressat_mess = '%d' AND status_mess = '0' OR adressat_mess = '%d' AND status_mess = '4'", $user_ID, $user_ID));
    } else {
        $new_mess = true;
    }
    if ($new_mess) {
        $scr = false;
        if ($rcl_options['view_user_lk_rcl'] == 1) {
            $get = 'user';
            if ($rcl_options['link_user_lk_rcl'] != '') {
                $get = $rcl_options['link_user_lk_rcl'];
            }
            if (isset($_GET[$get]) && $user_ID == $_GET[$get] || $rcl_options['lk_page_rcl'] != $post->ID) {
                $scr = true;
            }
        } else {
            if (!is_author() || is_author($user_ID)) {
                $scr = true;
            }
        }
        if ($scr) {
            wp_enqueue_script('newmess_recall', plugins_url('js/new_mess.js', __FILE__));
        }
    }
}
コード例 #8
0
 /**
  * Test to see if the page is a date based archive page cpt archive
  *
  * @since  1.0.0
  * @access public
  * @param
  * @return boolean
  */
 public function isCptArchive()
 {
     if (is_category() || is_author() || is_tag() || is_date() || is_front_page() || is_home()) {
         return false;
     }
     return true;
 }
コード例 #9
0
function quindo_get_alm_options_front($offset)
{
    $alm_options = quindo_get_alm_options();
    if ($offset) {
        $alm_options['offset'] = $offset;
    }
    if (is_category()) {
        $alm_options['category'] = get_category(get_query_var('cat'))->slug;
    }
    if (is_year() || is_month() || is_day()) {
        $alm_options['year'] = get_the_time('Y');
    }
    if (is_month() || is_day()) {
        $alm_options['month'] = get_the_time('n');
    }
    if (is_day()) {
        $alm_options['day'] = get_the_time('j');
    }
    if (is_author()) {
        $alm_options['author'] = get_user_by('slug', get_query_var('author_name'))->ID;
    }
    if (is_search()) {
        $alm_options['search'] = get_query_var('s');
    }
    $alm_options_imploded = '';
    foreach ($alm_options as $option => $value) {
        $alm_options_imploded .= ' ' . $option . '="' . $value . '"';
    }
    return $alm_options_imploded;
}
コード例 #10
0
ファイル: showThemeFile.php プロジェクト: jtomeck/jtwebfolio
function getWpTemplate()
{
    if (defined('WP_USE_THEMES') && WP_USE_THEMES) {
        $template = false;
        if (is_404() && ($template = get_404_template())) {
        } elseif (is_search() && ($template = get_search_template())) {
        } elseif (is_tax() && ($template = get_taxonomy_template())) {
        } elseif (is_front_page() && ($template = get_front_page_template())) {
        } elseif (is_home() && ($template = get_home_template())) {
        } elseif (is_attachment() && ($template = get_attachment_template())) {
        } elseif (is_single() && ($template = get_single_template())) {
        } elseif (is_page() && ($template = get_page_template())) {
        } elseif (is_category() && ($template = get_category_template())) {
        } elseif (is_tag() && ($template = get_tag_template())) {
        } elseif (is_author() && ($template = get_author_template())) {
        } elseif (is_date() && ($template = get_date_template())) {
        } elseif (is_archive() && ($template = get_archive_template())) {
        } elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
        } elseif (is_paged() && ($template = get_paged_template())) {
        } else {
            $template = get_index_template();
        }
        return str_replace(ABSPATH, '', $template);
    } else {
        return null;
    }
}
コード例 #11
0
 function mh_page_title()
 {
     if (is_home()) {
         echo get_the_title(get_option('page_for_posts', true));
     } elseif (is_author()) {
         global $author;
         $user_info = get_userdata($author);
         echo __('Articles by ', 'mh') . esc_attr($user_info->display_name);
     } elseif (is_category() || is_tax()) {
         echo single_cat_title("", false);
     } elseif (is_tag()) {
         echo single_tag_title("", false);
     } elseif (is_search()) {
         echo __('Search Results for ', 'mh') . get_search_query();
     } elseif (is_day()) {
         echo get_the_date();
     } elseif (is_month()) {
         echo get_the_date('F Y');
     } elseif (is_year()) {
         echo get_the_date('Y');
     } elseif (is_404()) {
         echo __('Page not found (404)', 'mh');
     } else {
         echo get_the_title();
     }
 }
コード例 #12
0
function ubik_seo_meta_description($desc = '')
{
    // Generate a meta description
    if (empty($desc)) {
        // Single posts, pages, and attachments
        if (is_singular()) {
            $post = get_post();
            if (empty($post)) {
                $desc = '';
            }
            $desc = wptexturize($post->post_content);
            // Get the entire contents, not the excerpt, so as to not duplicate Ubik Excerpt
        }
        // Check to see if we have a description for this category, tag, or taxonomy
        if (is_category() || is_tag() || is_tax()) {
            $desc = term_description();
        }
        // Now match other possibilities...
        if (is_author()) {
            $desc = get_the_author_meta('description');
        }
        // Front or home page
        if (is_front_page() || is_home()) {
            $desc = get_bloginfo('description');
        }
        // No excerpt to return
        if (is_404() || is_search()) {
            $desc = '';
        }
        $desc = ubik_seo_meta_description_sanitize($desc);
    }
    return apply_filters('ubik_seo_meta_description', $desc);
}
コード例 #13
0
function teo_filter_wp_title($old_title, $sep, $sep_location)
{
    $ssep = ' ' . $sep . ' ';
    if (is_home()) {
        return get_bloginfo('name');
    } elseif (is_single() || is_page()) {
        return get_the_title();
    } elseif (is_category()) {
        $output = $ssep . 'Category';
    } elseif (is_tag()) {
        $output = $ssep . 'Tag';
    } elseif (is_author()) {
        $output = $ssep . 'Author';
    } elseif (is_year() || is_month() || is_day()) {
        $output = $ssep . 'Archives';
    } else {
        $output = NULL;
    }
    // get the page number we're on (index)
    if (get_query_var('paged')) {
        $num = $ssep . 'page ' . get_query_var('paged');
    } elseif (get_query_var('page')) {
        $num = $ssep . 'page ' . get_query_var('page');
    } else {
        $num = NULL;
    }
    // concoct and return new title
    return get_bloginfo('name') . $output . $old_title . $num;
}
コード例 #14
0
ファイル: utils.php プロジェクト: junibrosas/shoppingyourway
/**
 * Page titles
 */
function ya_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            echo get_the_title(get_option('page_for_posts', true));
        } else {
            esc_html_e('Latest Posts', 'yatheme');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term) {
            echo $term->name;
        } elseif (is_post_type_archive()) {
            echo get_queried_object()->labels->name;
        } elseif (is_day()) {
            printf(__('Daily Archives: %s', 'yatheme'), get_the_date());
        } elseif (is_month()) {
            printf(__('Monthly Archives: %s', 'yatheme'), get_the_date('F Y'));
        } elseif (is_year()) {
            printf(__('Yearly Archives: %s', 'yatheme'), get_the_date('Y'));
        } elseif (is_author()) {
            printf(__('Author Archives: %s', 'yatheme'), get_the_author());
        } else {
            single_cat_title();
        }
    } elseif (is_search()) {
        printf(__('Search Results for <small>%s</small>', 'yatheme'), get_search_query());
    } elseif (is_404()) {
        esc_html_e('Not Found', 'yatheme');
    } else {
        the_title();
    }
}
コード例 #15
0
function hwseo_get_current_user()
{
    global $wp_query;
    if (is_author()) {
        return $wp_query->get_queried_object();
    }
}
コード例 #16
0
ファイル: functions.php プロジェクト: k111/wp_theme_skeleton
function mypace_custom_navi_menu($classes, $item)
{
    global $wp_query;
    $singular_slug = 'service';
    $page_for_custom_type_title = 'サービス';
    $page_for_posts = get_option('page_for_posts');
    $post_type_query = $wp_query->query_vars['post_type'];
    $del_flag = true;
    $add_flag = false;
    if (is_singular('post') || is_category() || is_tag()) {
        $del_flag = false;
    } elseif (is_author() || is_date() || is_author()) {
        if (in_array($post_type_query, array('', 'post'))) {
            $del_flag = false;
        } elseif ($post_type_query == $custom_post_type) {
            $add_flag = true;
        }
    } elseif (is_tax()) {
        $taxonomy = get_taxonomy($wp_query->query_vars['taxonomy']);
        if (count($taxonomy->object_type) == 1 && $taxonomy->object_type[0] == 'post') {
            $del_flag = false;
        } elseif (count($taxonomy->object_type) == 1 && $taxonomy->object_type[0] == $singular_slug) {
            $add_flag = true;
        }
    } elseif (is_singular($singular_slug)) {
        $add_flag = true;
    }
    if ($del_flag && is_numeric($page_for_posts) && $item->object_id == $page_for_posts && $item->object == 'page' && ($key = array_search('current_page_parent', $classes))) {
        unset($classes[$key]);
    } elseif ($add_flag && $item->title == $page_for_custom_type_title && $item->object == 'page') {
        $classes[] = 'current_page_parent';
    }
    return $classes;
}
コード例 #17
0
 /**
  * Outputs the widget based on the arguments input through the widget controls.
  *
  * @since 0.1.0
  */
 function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     /* Set up the arguments for get_users(). */
     $args = array('role' => $instance['role'], 'meta_key' => $instance['meta_key'], 'meta_value' => $instance['meta_value'], 'include' => !empty($instance['include']) ? explode(',', $instance['include']) : '', 'exclude' => !empty($instance['exclude']) ? explode(',', $instance['exclude']) : '', 'search' => $instance['search'], 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'offset' => !empty($instance['offset']) ? intval($instance['offset']) : '', 'number' => !empty($instance['number']) ? intval($instance['number']) : '');
     /* Output the theme's $before_widget wrapper. */
     echo $before_widget;
     /* If a title was input by the user, display it. */
     if (!empty($instance['title'])) {
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
     }
     /* Get users. */
     $users = get_users($args);
     /* If users were found. */
     if (!empty($users)) {
         echo '<ul class="xoxo users">';
         /* Loop through each available user, creating a list item with a link to the user's archive. */
         foreach ($users as $user) {
             $url = get_author_posts_url($user->ID, $user->user_nicename);
             $class = "user-{$user->ID}";
             if (is_author($user->ID)) {
                 $class .= ' current-user';
             }
             echo "<li class='{$class}'><a href='{$url}' title='" . esc_attr($user->display_name) . "'>{$user->display_name}</a></li>\n";
         }
         echo '</ul>';
     }
     /* Close the theme's widget wrapper. */
     echo $after_widget;
 }
コード例 #18
0
ファイル: titles.php プロジェクト: wenqingyu/timeline-post
/**
 * Page titles
 */
function dw_timeline_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
            return get_bloginfo('name');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term) {
            return apply_filters('single_term_title', $term->name);
        } elseif (is_post_type_archive()) {
            return apply_filters('the_title', get_queried_object()->labels->name);
        } elseif (is_day()) {
            return sprintf(__('Daily Archives: %s', 'dw-timeline'), get_the_date());
        } elseif (is_month()) {
            return sprintf(__('Monthly Archives: %s', 'dw-timeline'), get_the_date('F Y'));
        } elseif (is_year()) {
            return sprintf(__('Yearly Archives: %s', 'dw-timeline'), get_the_date('Y'));
        } elseif (is_author()) {
            $author = get_queried_object();
            return sprintf(__('Author Archives: %s', 'dw-timeline'), $author->display_name);
        } else {
            return single_cat_title('', false);
        }
    } elseif (is_search()) {
        return sprintf(__('Search Results for %s', 'dw-timeline'), get_search_query());
    } elseif (is_404()) {
        return __('Not Found', 'dw-timeline');
    } else {
        return get_the_title();
    }
}
コード例 #19
0
 function warrior_archive_title()
 {
     global $wp_query;
     $title = '';
     if (is_category()) {
         $title = sprintf(__('%s <span>Category Archives</span>', 'familia'), single_cat_title('', false));
     } elseif (is_tag()) {
         $title = sprintf(__('%s <span>Tag Archives</span>', 'familia'), single_tag_title('', false));
     } elseif (get_post_format()) {
         $title = sprintf(__('Post Format: %s', 'familia'), get_post_format_string(get_post_format()));
     } elseif (is_day()) {
         $title = sprintf(__('%s <span>Daily Archives</span>', 'familia'), date_i18n('d', strtotime(get_the_date('Y-m-d'), false)));
     } elseif (is_month()) {
         $title = sprintf(__('%s <span>Monthly Archives</span>', 'familia'), date_i18n('F', strtotime(get_the_date('Y-m-d'), false)));
     } elseif (is_year()) {
         $title = sprintf(__('%s <span>Yearly Archives</span>', 'familia'), date_i18n('F', strtotime(get_the_date('Y-m-d'), false)));
     } elseif (is_author()) {
         $author = get_user_by('slug', get_query_var('author_name'));
         $title = sprintf(__('%s <span>Author Archives</span>', 'familia'), get_the_author_meta('display_name', $author->ID));
     } elseif (is_search()) {
         if ($wp_query->found_posts) {
             $title = sprintf(__('Search Results for: "%s"', 'familia'), esc_attr(get_search_query()));
         } else {
             $title = sprintf(__('No Results for: "%s"', 'familia'), esc_attr(get_search_query()));
         }
     } elseif (is_404()) {
         $title = __('Not Found', 'familia');
     } elseif (is_home() || is_front_page() || is_single()) {
         $title = '';
     } else {
         $title = __('Blog', 'familia');
     }
     return $title;
 }
コード例 #20
0
ファイル: titles.php プロジェクト: BeardandFedora/StacheStack
/**
 * Page titles
 */
function stachestack_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            $title = get_the_title(get_option('page_for_posts', true));
        } else {
            $title = __('Latest Posts', 'stachestack');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term) {
            $title = apply_filters('single_term_title', $term->name);
        } elseif (is_post_type_archive()) {
            $title = apply_filters('the_title', get_queried_object()->labels->name);
        } elseif (is_day()) {
            $title = sprintf(__('Daily Archives: %s', 'stachestack'), get_the_date());
        } elseif (is_month()) {
            $title = sprintf(__('Monthly Archives: %s', 'stachestack'), get_the_date('F Y'));
        } elseif (is_year()) {
            $title = sprintf(__('Yearly Archives: %s', 'stachestack'), get_the_date('Y'));
        } elseif (is_author()) {
            $title = sprintf(__('Author Archives: %s', 'stachestack'), get_queried_object()->display_name);
        } else {
            $title = single_cat_title('', false);
        }
    } elseif (is_search()) {
        $title = sprintf(__('Search Results for %s', 'stachestack'), get_search_query());
    } elseif (is_404()) {
        $title = __('Not Found', 'stachestack');
    } else {
        $title = get_the_title();
    }
    return apply_filters('stachestack_title', $title);
}
コード例 #21
0
ファイル: page-title.php プロジェクト: booklein/wpbookle
function porto_page_title()
{
    global $porto_settings;
    $output = '';
    if (!is_front_page()) {
    } elseif (is_home()) {
        $output .= $porto_settings['blog-title'];
    }
    if (is_singular()) {
        $output .= porto_page_title_leaf();
    } else {
        if (is_post_type_archive()) {
            if (is_search()) {
                $output .= porto_page_title_leaf('search');
            } else {
                $output .= porto_page_title_archive();
            }
        } elseif (is_tax() || is_tag() || is_category()) {
            $html = porto_page_title_leaf('term');
            if (is_tag()) {
                $output .= sprintf(__('Tag - %s', 'porto'), $html);
            } elseif (is_tax('product_tag')) {
                $output .= sprintf(__('Product Tag - %s', 'porto'), $html);
            } else {
                $output .= $html;
            }
        } elseif (is_date()) {
            if (is_year()) {
                $output .= porto_page_title_leaf('year');
            } elseif (is_month()) {
                $output .= porto_page_title_leaf('month');
            } elseif (is_day()) {
                $output .= porto_page_title_leaf('day');
            }
        } elseif (is_author()) {
            $output .= porto_page_title_leaf('author');
        } elseif (is_search()) {
            $output .= porto_page_title_leaf('search');
        } elseif (is_404()) {
            $output .= porto_page_title_leaf('404');
        } elseif (class_exists('bbPress') && is_bbpress()) {
            if (bbp_is_search()) {
                $output .= porto_page_title_leaf('bbpress_search');
            } elseif (bbp_is_single_user()) {
                $output .= porto_page_title_leaf('bbpress_user');
            } else {
                $output .= porto_page_title_leaf();
            }
        } else {
            if (is_home() && !is_front_page()) {
                if (get_option('show_on_front') == 'page') {
                    $output .= get_the_title(get_option('page_for_posts', true));
                } else {
                    $output .= $porto_settings['blog-title'];
                }
            }
        }
    }
    return apply_filters('porto_page_title', $output);
}
コード例 #22
0
 /**
  * Outputs the widget based on the arguments input through the widget controls.
  *
  * @since  0.1.0
  * @access public
  * @param  array  $sidebar
  * @param  array  $instance
  * @return void
  */
 function widget($sidebar, $instance)
 {
     $instance = wp_parse_args($instance, $this->defaults);
     // Set up the arguments for get_users().
     $args = array('role' => $instance['role'], 'meta_key' => $instance['meta_key'], 'meta_value' => $instance['meta_value'], 'include' => !empty($instance['include']) ? explode(',', $instance['include']) : '', 'exclude' => !empty($instance['exclude']) ? explode(',', $instance['exclude']) : '', 'search' => $instance['search'], 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'offset' => !empty($instance['offset']) ? intval($instance['offset']) : '', 'number' => !empty($instance['number']) ? intval($instance['number']) : '');
     // Output the theme's $before_widget wrapper.
     echo $sidebar['before_widget'];
     // If a title was input by the user, display it.
     if ($instance['title']) {
         echo $sidebar['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $sidebar['after_title'];
     }
     // Get users.
     $users = get_users($args);
     // If users were found.
     if (!empty($users)) {
         echo '<ul class="xoxo users">';
         // Loop through each available user, creating a list item with a link to the user's archive.
         foreach ($users as $user) {
             $class = sanitize_html_class("user-{$user->ID}");
             if (is_author($user->ID)) {
                 $class .= ' current-user';
             }
             printf('<li class="%s"><a href="%s">%s</a>', esc_attr($class), esc_url(get_author_posts_url($user->ID, $user->user_nicename)), esc_html($user->display_name));
         }
         echo '</ul>';
     }
     // Close the theme's widget wrapper.
     echo $sidebar['after_widget'];
 }
コード例 #23
0
ファイル: functions.php プロジェクト: alastair38/begood2016
function my_get_posts($query)
{
    if (is_author() && $query->is_main_query() || is_category() && $query->is_main_query()) {
        $query->set('post_type', array('post', 'resources', 'news'));
    }
    return $query;
}
コード例 #24
0
 public function displayname($post)
 {
     global $post;
     if (isset($this->options['multiple-authors'])) {
         // If multiple authors support is enabled in plugin options, run this code
         $name = 'Multiple Authors';
     } else {
         // If multiple authors support is not enabled in plugin options, run this code
         $postmeta = get_post_meta($post->ID, '_' . self::PREFIX . 'meta', true);
         // Get the post-specific author metadata, if available
         /* If the plugin setting is enabled and there's post-specific metadata stored and a post, page, or attachment is being displayed, show the post-specific display name. Otherwise use the profile display name. */
         if ($postmeta && !is_author() && isset($this->options['perpost'])) {
             foreach ($postmeta as $authormeta) {
                 foreach ($authormeta as $key => $meta) {
                     $name = $authormeta['display_name'];
                     // Set the name to the display name stored for the post
                 }
             }
         } else {
             $author = get_userdata($post->post_author);
             // Get the profile data for the post author
             $name = $author->display_name;
             // Set the display name to the value stored in the author's profile
         }
     }
     return $name;
     // Send the name back to WordPress for displaying on the post
 }
コード例 #25
0
 /**
  * Helper function to check whether the shortcode should be rendered or not
  *
  * @return type
  */
 static function display_allowed()
 {
     global $rtmedia_query;
     $flag = !(is_home() || is_post_type_archive() || is_author()) && is_user_logged_in() && (is_rtmedia_upload_music_enabled() || is_rtmedia_upload_photo_enabled() || is_rtmedia_upload_video_enabled()) && (isset($rtmedia_query->is_upload_shortcode) && $rtmedia_query->is_upload_shortcode == true || is_rtmedia_bp_profile() && is_rtmedia_profile_media_enable() || is_rtmedia_bp_group() && is_rtmedia_group_media_enable());
     $flag = apply_filters('before_rtmedia_uploader_display', $flag);
     return $flag;
 }
コード例 #26
0
 /**
  * Shim for `sociallyviral_archive_title()`.
  *
  * Display the archive title based on the queried object.
  *
  * @todo Remove this function when WordPress 4.3 is released.
  *
  * @param string $before Optional. Content to prepend to the title. Default empty.
  * @param string $after  Optional. Content to append to the title. Default empty.
  */
 function sociallyviral_archive_title($before = '', $after = '')
 {
     if (is_category()) {
         $title = sprintf(__('Category: %s', 'sociallyviral'), single_cat_title('', false));
     } elseif (is_tag()) {
         $title = sprintf(__('Tag: %s', 'sociallyviral'), single_tag_title('', false));
     } elseif (is_author()) {
         $title = sprintf(__('Author: %s', 'sociallyviral'), '<span class="vcard">' . get_the_author() . '</span>');
     } elseif (is_year()) {
         $title = sprintf(__('Year: %s', 'sociallyviral'), get_the_date(_x('Y', 'yearly archives date format', 'sociallyviral')));
     } elseif (is_month()) {
         $title = sprintf(__('Month: %s', 'sociallyviral'), get_the_date(_x('F Y', 'monthly archives date format', 'sociallyviral')));
     } elseif (is_day()) {
         $title = sprintf(__('Day: %s', 'sociallyviral'), get_the_date(_x('F j, Y', 'daily archives date format', 'sociallyviral')));
     } elseif (is_post_type_archive()) {
         $title = sprintf(__('Archives: %s', 'sociallyviral'), post_type_archive_title('', false));
     } elseif (is_tax()) {
         $tax = get_taxonomy(get_queried_object()->taxonomy);
         /* translators: 1: Taxonomy singular name, 2: Current taxonomy term */
         $title = sprintf(__('%1$s: %2$s', 'sociallyviral'), $tax->labels->singular_name, single_term_title('', false));
     } else {
         $title = __('Archives', 'sociallyviral');
     }
     /**
      * Filter the archive title.
      *
      * @param string $title Archive title to be displayed.
      */
     $title = apply_filters('get_the_archive_title', $title);
     if (!empty($title)) {
         echo $before . $title . $after;
     }
 }
コード例 #27
0
ファイル: titles.php プロジェクト: luzmcosta/theuglyvolvo
/**
 * Page titles
 */
function roots_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
            return __('Most Recent Posts', 'roots');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term) {
            return apply_filters('single_term_title', $term->name);
        } elseif (is_post_type_archive()) {
            return apply_filters('the_title', get_queried_object()->labels->name);
        } elseif (is_day()) {
            return sprintf(__('Old Posts, Organized by Day: %s', 'roots'), get_the_date());
        } elseif (is_month()) {
            return sprintf(__('Old Posts, Organized by Month: %s', 'roots'), get_the_date('F Y'));
        } elseif (is_year()) {
            return sprintf(__('Old Posts, Organized by Year: %s', 'roots'), get_the_date('Y'));
        } elseif (is_author()) {
            $author = get_queried_object();
            return sprintf(__('Old Posts, Organized by Author: %s', 'roots'), apply_filters('the_author', is_object($author) ? $author->display_name : null));
        } else {
            return single_cat_title('', false);
        }
    } elseif (is_search()) {
        return sprintf(__('Search Results for %s', 'roots'), get_search_query());
    } elseif (is_404()) {
        return __('Not Found', 'roots');
    } else {
        return get_the_title();
    }
}
コード例 #28
0
/**
 * Page titles
 */
function pinnacle_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
            return __('Latest Posts', 'pinnacle');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term) {
            return $term->name;
        } elseif (is_post_type_archive()) {
            return get_queried_object()->labels->name;
        } elseif (is_day()) {
            return sprintf(__('Daily Archives: %s', 'pinnacle'), get_the_date());
        } elseif (is_month()) {
            return sprintf(__('Monthly Archives: %s', 'pinnacle'), get_the_date('F Y'));
        } elseif (is_year()) {
            return sprintf(__('Yearly Archives: %s', 'pinnacle'), get_the_date('Y'));
        } elseif (is_author()) {
            return sprintf(__('Author Archives: %s', 'pinnacle'), get_the_author());
        } else {
            return single_cat_title("", false);
        }
    } elseif (is_search()) {
        return sprintf(__('Search Results for %s', 'pinnacle'), get_search_query());
    } elseif (is_404()) {
        return __('Not Found', 'pinnacle');
    } else {
        return get_the_title();
    }
}
コード例 #29
0
ファイル: functions.php プロジェクト: doobas/kazinopaslaptys
/**
 * Title filter 
 */
function mediamaven_filter_wp_title($old_title, $sep, $sep_location)
{
    $site_name = get_bloginfo('name');
    $site_description = get_bloginfo('description');
    // add padding to the sep
    $ssep = ' ' . $sep . ' ';
    if ($site_description && (is_home() || is_front_page())) {
        return $site_name . ' | ' . $site_description;
    } else {
        // find the type of index page this is
        if (is_category()) {
            $insert = $ssep . __('Kategorija', 'media-maven');
        } elseif (is_tag()) {
            $insert = $ssep . __('Žymos', 'media-maven');
        } elseif (is_author()) {
            $insert = $ssep . __('Autorius', 'media-maven');
        } elseif (is_year() || is_month() || is_day()) {
            $insert = $ssep . __('Archyvai', 'media-maven');
        } else {
            $insert = NULL;
        }
        // get the page number we're on (index)
        if (get_query_var('paged')) {
            $num = $ssep . __('Page ', 'media-maven') . get_query_var('paged');
        } elseif (get_query_var('page')) {
            $num = $ssep . __('Page ', 'media-maven') . get_query_var('page');
        } else {
            $num = NULL;
        }
        // concoct and return new title
        return $site_name . $insert . $old_title . $num;
    }
}
function meanthemes_load_js()
{
    wp_register_style('meanmenu', get_template_directory_uri() . '/assets/js/plugins/meanmenu.min.css', array(), '1.0.7', 'screen', 'meanmenu');
    wp_register_script('meanmenu', get_template_directory_uri() . '/assets/js/plugins/jquery.meanmenu.min.js', array('jquery'), '2.0.8', true);
    wp_register_script('jplayer', get_template_directory_uri() . '/assets/js/plugins/jquery.jplayer.min.js', array('jquery'), '1.0.0', true);
    wp_register_script('flexslider', get_template_directory_uri() . '/assets/js/plugins/jquery.flexslider-min.js', array('jquery'), '1.0.0', true);
    wp_register_script('slabtext', get_template_directory_uri() . '/assets/js/plugins/jquery.slabtext.min.js', array('jquery'), '2.3', true);
    wp_register_script('global', get_template_directory_uri() . '/assets/js/plugins/global-plugins.min.js', array('jquery'), MEANTHEMES_THEME_VER, false);
    wp_register_script('mt-scripts', get_template_directory_uri() . '/assets/js/scripts.min.js', array('jquery', 'global'), MEANTHEMES_THEME_VER, true);
    if (is_single() || is_archive() || is_search() || is_author() || is_front_page() || is_page_template('t-index.php')) {
        wp_enqueue_script('jplayer');
        wp_enqueue_script('flexslider');
    }
    if (is_home() || is_404()) {
        wp_enqueue_script('slabtext');
    }
    if (!is_home() || !is_404()) {
        wp_enqueue_style('webfonts');
    }
    // Check theme options for using a standard menu
    if (get_theme_mod('use_standard_menu', '0') == '1') {
        wp_enqueue_style('meanmenu');
        wp_enqueue_script('meanmenu');
    }
    // load on all pages
    wp_enqueue_script('global');
    wp_enqueue_script('mt-scripts');
}