当前位置: 首页>>代码示例>>PHP>>正文


PHP is_sticky函数代码示例

本文整理汇总了PHP中is_sticky函数的典型用法代码示例。如果您正苦于以下问题:PHP is_sticky函数的具体用法?PHP is_sticky怎么用?PHP is_sticky使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_sticky函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ultra_posted_on

 /**
  * Prints HTML with meta information for the current post-date/time, author, comment count and categories.
  */
 function ultra_posted_on()
 {
     echo '<div class="entry-meta-inner">';
     if (is_sticky() && is_home() && !is_paged()) {
         echo '<span class="featured-post">' . __('Sticky', 'ultra') . '</span>';
     }
     if (is_home() && siteorigin_setting('blog_post_date') || is_archive() && siteorigin_setting('blog_post_date') || is_search() && siteorigin_setting('blog_post_date')) {
         echo '<span class="entry-date"><a href="' . esc_url(get_permalink()) . '" rel="bookmark"><time class="published" datetime="' . esc_attr(get_the_date('c')) . '">' . esc_html(get_the_date('j F Y')) . '</time><time class="updated" datetime="' . esc_attr(get_the_modified_date('c')) . '">' . esc_html(get_the_modified_date()) . '</time></span></a>';
     }
     if (is_single() && siteorigin_setting('blog_post_date')) {
         echo '<span class="entry-date"><time class="published" datetime="' . esc_attr(get_the_date('c')) . '">' . esc_html(get_the_date('j F Y')) . '</time><time class="updated" datetime="' . esc_attr(get_the_modified_date('c')) . '">' . esc_html(get_the_modified_date()) . '</time></span>';
     }
     if (siteorigin_setting('blog_post_author')) {
         echo '<span class="byline"><span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '" rel="author">' . esc_html(get_the_author()) . '</a></span></span>';
     }
     if (comments_open() && siteorigin_setting('blog_post_comment_count')) {
         echo '<span class="comments-link">';
         comments_popup_link(__('Leave a comment', 'ultra'), __('1 Comment', 'ultra'), __('% Comments', 'ultra'));
         echo '</span>';
     }
     echo '</div>';
     if (is_single() && siteorigin_setting('navigation_post_nav')) {
         the_post_navigation($args = array('prev_text' => '', 'next_text' => ''));
     }
 }
开发者ID:craighays,项目名称:wpcraighays,代码行数:28,代码来源:template-tags.php

示例2: great_entry_footer

    /**
     * Prints HTML with meta information for the categories, tags and comments.
     */
    function great_entry_footer()
    {
        // Featured Star
        if (is_sticky() && is_home() && !is_paged()) {
            printf('<span class="sticky-post"><i class="fa fa-star"></i> %s</span>', __('Featured', 'great'));
        }
        // Post Author
        if (get_theme_mod('display_post_author', 1)) {
            $byline = '	<span class="author vcard">
				<a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">
				' . esc_html(get_the_author()) . '</a></span>';
            echo '<span class="byline"><i class="fa fa-user"></i> ' . $byline . '</span>';
        }
        // Hide category and tag text for pages.
        if ('post' == get_post_type()) {
            /* translators: used between list items, there is a space after the comma */
            $categories_list = get_the_category_list(__(', ', 'great'));
            if ($categories_list && great_categorized_blog() && get_theme_mod('display_post_cats', 1)) {
                printf('<span class="cat-links"><i class="fa fa-folder"></i> ' . '%1$s' . '</span>', $categories_list);
            }
            /* translators: used between list items, there is a space after the comma */
            $tags_list = get_the_tag_list('', __(', ', 'great'));
            if ($tags_list and get_theme_mod('display_post_tags', 1)) {
                printf('<span class="tags-links"><i class="fa fa-tags"></i> ' . '%1$s' . '</span>', $tags_list);
            }
        }
    }
开发者ID:karthikakamalanathan,项目名称:wp-cookieLawInfo,代码行数:30,代码来源:template-tags.php

示例3: get_page_actions

 /**
  * Create a list of actions for the specified page
  *
  * @param string $page Page to get Actions for.
  *
  * @return array of actions
  */
 public function get_page_actions($page)
 {
     /**
      * Actions to be executed
      */
     $actions = array('always');
     // Singular = single item (post, attachment, page, etc).
     if (is_singular()) {
         $actions[] = 'singular';
     }
     // Paged page (pagination).
     if (is_paged()) {
         $actions[] = 'paged';
     }
     if (is_sticky()) {
         $actions[] = 'sticky';
     }
     if (is_user_logged_in()) {
         $actions[] = 'logged-in';
         $actions[] = 'loggedin';
     }
     if (in_array($page, $this->archive_pages, true) || 'home' === $page) {
         $actions[] = 'archived';
     }
     // Add page action.
     $actions[] = $page;
     // Apply filters.
     $actions = Stencil_Environment::filter('actions-' . $page, $actions);
     $actions = Stencil_Environment::filter('actions', $actions);
     return $actions;
 }
开发者ID:moorscode,项目名称:stencil,代码行数:38,代码来源:flow.php

示例4: add_meta_boxes

 /**
  * Copy post metas, menu order, comment and ping status when using "Add new" ( translation )
  * formerly used dbx_post_advanced deprecated in WP 3.7
  *
  * @since 1.2
  *
  * @param string $post_type unused
  * @param object $post      current post object
  */
 public function add_meta_boxes($post_type, $post)
 {
     if ('post-new.php' == $GLOBALS['pagenow'] && isset($_GET['from_post'], $_GET['new_lang']) && $this->model->is_translated_post_type($post->post_type)) {
         // Capability check already done in post-new.php
         $from_post_id = (int) $_GET['from_post'];
         $from_post = get_post($from_post_id);
         $lang = $this->model->get_language($_GET['new_lang']);
         if (!$from_post || !$lang) {
             return;
         }
         $this->copy_taxonomies($from_post_id, $post->ID, $lang->slug);
         $this->copy_post_metas($from_post_id, $post->ID, $lang->slug);
         foreach (array('menu_order', 'comment_status', 'ping_status') as $property) {
             $post->{$property} = $from_post->{$property};
         }
         // Copy the date only if the synchronization is activated
         if (in_array('post_date', $this->options['sync'])) {
             $post->post_date = $from_post->post_date;
             $post->post_date_gmt = $from_post->post_date_gmt;
         }
         if (is_sticky($from_post_id)) {
             stick_post($post->ID);
         }
     }
 }
开发者ID:JoryHogeveen,项目名称:polylang,代码行数:34,代码来源:admin-sync.php

示例5: pure_entry_meta

 /**
  * Prints HTML with meta information for the categories, tags.
  *
  * @since Pure 1.0
  */
 function pure_entry_meta()
 {
     if (is_sticky() && is_home() && !is_paged()) {
         printf('<span class="sticky-post">%s</span>', __('Featured', 'pure'));
     }
     if ('post' == get_post_type()) {
         printf('<span class="byline"><span class="author vcard"><i class="fa fa-user"></i><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', _x('Author', 'Used before post author name.', 'pure'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author());
     }
     if (in_array(get_post_type(), array('post', 'attachment'))) {
         $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
         /*$time_string = sprintf( $time_string,
               esc_attr( get_the_date( 'c' ) ),
               is_single() ? pure_get_time_ago( get_post_time( 'c', true ) ),
               esc_attr( get_the_modified_date( 'c' ) ),
               get_the_modified_date()
           );*/
         $time_string = sprintf($time_string, esc_attr(get_the_date('c')), get_the_date(), esc_attr(get_the_modified_date('c')), get_the_modified_date());
         printf('<span class="posted-on"><span class="screen-reader-text">%1$s </span><i class="fa fa-clock-o"></i><a href="%2$s" rel="bookmark">%3$s</a></span>', _x('Posted on', 'Used before publish date.', 'pure'), esc_url(get_permalink()), $time_string);
     }
     if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
         echo '<span class="comments-link"><i class="fa fa-comment-o"></i>';
         comments_popup_link(__('Leave a comment', 'pure'), __('1 Comment', 'pure'), __('% Comments', 'pure'));
         echo '</span>';
     }
     return;
 }
开发者ID:icodechef,项目名称:Pure,代码行数:31,代码来源:template-tags.php

示例6: wheels_entry_meta

 /**
  * Prints HTML with meta information for current post: categories, tags, permalink, author, and date.
  *
  * @return void
  */
 function wheels_entry_meta()
 {
     if (is_sticky() && is_home() && !is_paged()) {
         echo '<span class="featured-post">' . __('Sticky', 'wheels') . '</span>';
     }
     if (!has_post_format('link') && 'post' == get_post_type()) {
         wheels_entry_date();
     }
     // Translators: used between list items, there is a space after the comma.
     $categories_list = get_the_category_list(__(', ', 'wheels'));
     if ($categories_list) {
         echo '/<span class="categories-links">' . $categories_list . '</span>';
     }
     // Translators: used between list items, there is a space after the comma.
     $tag_list = get_the_tag_list('', __(', ', 'wheels'));
     if ($tag_list) {
         echo '/<span class="tags-links">' . $tag_list . '</span>';
     }
     // Post author
     if ('post' == get_post_type()) {
         printf('/<span class="author vcard">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author">%4$s</a></span>', __('by', 'wheels'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('View all posts by %s', 'wheels'), get_the_author())), get_the_author());
         $num_comments = get_comments_number();
         // get_comments_number returns only a numeric value
         if ($num_comments == 0) {
         } else {
             if ($num_comments > 1) {
                 $comments = $num_comments . __(' Comments', 'wheels');
             } else {
                 $comments = __('1 Comment', 'wheels');
             }
             echo $write_comments = '/<span class="comments-count"><a href="' . get_comments_link() . '">' . $comments . '</a></span>';
         }
     }
 }
开发者ID:selinaross,项目名称:spring-ridge,代码行数:39,代码来源:extras.php

示例7: matraman_lite_post_type

function matraman_lite_post_type()
{
    if (has_post_format('gallery')) {
        echo '<i class="icon post-type icon-photos-pictures"></i>';
    }
    if (has_post_format('audio')) {
        echo '<i class="icon post-type icon-headphone"></i>';
    }
    if (has_post_format('chat')) {
        echo '<i class="icon post-type icon-chat-talk"></i>';
    }
    if (has_post_format('image')) {
        echo '<i class="icon post-type icon-camera"></i>';
    }
    if (has_post_format('link')) {
        echo '<i class="icon post-type icon-link"></i>';
    }
    if (has_post_format('quote')) {
        echo '<i class="icon post-type icon-quote-left"></i>';
    }
    if (has_post_format('video')) {
        echo '<i class="icon post-type icon-film-maker"></i>';
    }
    if (has_post_format('status')) {
        echo '<i class="icon post-type icon-message-talk"></i>';
    }
    if (!get_post_format() && !is_sticky()) {
        echo '<i class="icon post-type icon-book"></i>';
    }
    if (is_sticky()) {
        echo '<i class="icon post-type icon-pin"></i>';
    }
}
开发者ID:ComEnYns,项目名称:Web-Projects,代码行数:33,代码来源:themeta.php

示例8: wpthemes_post_class

function wpthemes_post_class($class = '', $post_id = null)
{
    $post = get_post($post_id);
    $classes = array();
    $classes[] = $post->post_type;
    if (is_sticky($post->ID) && is_home()) {
        $classes[] = 'sticky';
    }
    $classes[] = 'hentry';
    foreach ((array) get_the_category($post->ID) as $cat) {
        if (empty($cat->slug)) {
            continue;
        }
        $classes[] = 'category-' . $cat->slug;
    }
    foreach ((array) get_the_tags($post->ID) as $tag) {
        if (empty($tag->slug)) {
            continue;
        }
        $classes[] = 'tag-' . $tag->slug;
    }
    if (!empty($class)) {
        if (!is_array($class)) {
            $class = preg_split('#\\s+#', $class);
        }
        $classes = array_merge($classes, $class);
    }
    return apply_filters('post_class', $classes, $class, $post_id);
}
开发者ID:boltogriz,项目名称:blog-cook,代码行数:29,代码来源:functions.php

示例9: wpsight_do_widget_post_meta

function wpsight_do_widget_post_meta()
{
    $post_meta = '[post_date] ' . __('in', 'wpsight') . ' [post_categories] [post_edit before="- "]';
    // Add badge for sticky posts
    $sticky = is_sticky() && (is_home() || is_page_template('page-tpl-blog.php')) ? apply_filters('wpsight_post_sticky', '<span class="label label-info">' . __('Sticky', 'wpsight') . '</span> ') : '';
    printf('<div class="post-meta">%2$s%1$s</div>', apply_filters('wpsight_do_widget_post_meta', $post_meta), $sticky);
}
开发者ID:phucanh92,项目名称:vietlong,代码行数:7,代码来源:post.php

示例10: ro_theme_author_render

    function ro_theme_author_render()
    {
        ob_start();
        ?>
		<?php 
        if (is_sticky() && is_home() && !is_paged()) {
            ?>
			<span class="featured-post"> <?php 
            _e('Sticky', 'robusta');
            ?>
</span>
		<?php 
        }
        ?>
		<div class="ro-about-author clearfix">
			<div class="ro-author-avatar"><?php 
        echo get_avatar(get_the_author_meta('ID'), 170);
        ?>
</div>
			<div class="ro-author-info">
				<h6 class="ro-name"><?php 
        the_author();
        ?>
</h6>
				<?php 
        the_author_meta('description');
        ?>
			</div>
		</div>
		<?php 
        return ob_get_clean();
    }
开发者ID:tldjssla,项目名称:jejufoodwinefestival,代码行数:32,代码来源:post-functions.php

示例11: vw_render_categories

 function vw_render_categories($classes = '')
 {
     $categories = get_the_category();
     $html = '';
     if (is_sticky()) {
         $html .= '<div class="label label-sticky ' . $classes . '" title="' . __('Sticky Post', 'envirra') . '"><i class="icon-entypo-megaphone"></i></div>';
     }
     if ('post' == get_post_type()) {
         if ('1' == get_post_meta(get_the_id(), 'vw_enable_review', true)) {
             $avg_score = get_post_meta(get_the_id(), 'vw_review_average_score', true);
             $html .= '<div class="label label-review ' . $classes . '" title="' . __('Classificação', 'envirra') . '"><i class="icon-entypo-star"></i> ' . $avg_score . '</div>';
         } else {
             // Show post format if not a review
             if ('gallery' == get_post_format()) {
                 $html .= '<div class="label label-light ' . $classes . '" title="' . __('Gallery Post', 'envirra') . '"><i class="icon-entypo-picture"></i></div>';
             } else {
                 if ('video' == get_post_format()) {
                     $html .= '<div class="label label-light ' . $classes . '" title="' . __('Video Post', 'envirra') . '"><i class="icon-entypo-play"></i></div>';
                 } else {
                     if ('audio' == get_post_format()) {
                         $html .= '<div class="label label-light ' . $classes . '" title="' . __('Audio Post', 'envirra') . '"><i class="icon-entypo-note-beamed"></i></div>';
                     }
                 }
             }
         }
     }
     if ($categories) {
         foreach ($categories as $category) {
             $html .= '<a class="label ' . $classes . '" href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("Ver Artigos na Categoria %s", 'envirra'), $category->name)) . '" rel="category">' . $category->cat_name . '</a>';
         }
     }
     echo $html;
 }
开发者ID:JJProductionsPT,项目名称:SdTVv2,代码行数:33,代码来源:template-tags.php

示例12: addStickyClass

 function addStickyClass($classes, $class, $post_id)
 {
     if (is_sticky() && is_category() && !isset($classes['sticky'])) {
         $classes[] = 'sticky';
     }
     return $classes;
 }
开发者ID:yarylo,项目名称:cerkva.pp.ua,代码行数:7,代码来源:sticky-posts-in-category.php

示例13: directory_theme_entry_meta

function directory_theme_entry_meta()
{
    if (is_sticky() && is_home() && !is_paged()) {
        printf('<span class="sticky-post">%s</span>', __('Featured', 'directory-starter'));
    }
    $format = get_post_format();
    if (current_theme_supports('post-formats', $format)) {
        printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', sprintf('<span class="screen-reader-text">%s </span>', _x('Format', 'Used before post format.', 'directory-starter')), esc_url(get_post_format_link($format)), get_post_format_string($format));
    }
    if (in_array(get_post_type(), array('post', 'attachment'))) {
        $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
        $time_string = sprintf($time_string, esc_attr(get_the_date('c')), get_the_date(), esc_attr(get_the_modified_date('c')), get_the_modified_date());
        printf('<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>', _x('Posted on', 'Used before publish date.', 'directory-starter'), esc_url(get_permalink()), $time_string);
    }
    if ('post' == get_post_type()) {
        if (is_singular() || is_multi_author()) {
            printf('<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', _x('Author', 'Used before post author name.', 'directory-starter'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author());
        }
        $categories_list = get_the_category_list(_x(', ', 'Used between list items, there is a space after the comma.', 'directory-starter'));
        if ($categories_list) {
            printf('<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Categories', 'Used before category names.', 'directory-starter'), $categories_list);
        }
        $tags_list = get_the_tag_list('', _x(', ', 'Used between list items, there is a space after the comma.', 'directory-starter'));
        if ($tags_list) {
            printf('<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Tags', 'Used before tag names.', 'directory-starter'), $tags_list);
        }
    }
    if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
        echo '<span class="comments-link">';
        comments_popup_link(__('Leave a comment', 'directory-starter'), __('1 Comment', 'directory-starter'), __('% Comments', 'directory-starter'));
        echo '</span>';
    }
}
开发者ID:mistergiri,项目名称:directory-starter,代码行数:33,代码来源:entrymeta.php

示例14: impronta_metadata

 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function impronta_metadata()
 {
     // Hide category and tag text for pages.
     if ('post' === get_post_type()) {
         echo '<p class="metadata">';
         $byline = sprintf(esc_html_x('By %s', 'post author', 'impronta'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span> ');
         echo $byline;
         /* translators: used between list items, there is a space after the comma */
         $categories_list = get_the_category_list(esc_html__(', ', 'impronta'));
         if ($categories_list && impronta_categorized_blog()) {
             printf('<span class="cat-links">' . esc_html_x('on %1$s ', 'on categories', 'impronta') . '</span>', $categories_list);
             // WPCS: XSS OK.
         }
         /* translators: used between list items, there is a space after the comma */
         $tags_list = get_the_tag_list('', esc_html__(', ', 'impronta'));
         if ($tags_list) {
             printf(esc_html__('tagged %1$s', 'impronta'), $tags_list);
             // WPCS: XSS OK.
         }
         if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
             if (get_comments_number(get_the_id()) == 0) {
                 echo esc_html__('- ', 'impronta');
             } else {
                 echo esc_html__('with ', 'impronta');
             }
             comments_popup_link(esc_html__('Leave a comment', 'impronta'), esc_html__('1 Comment', 'impronta'), esc_html__('% Comments', 'impronta'));
         }
         if (is_sticky()) {
             echo ' - ' . '<i class="feature-star fa fa-star" data-toggle="tooltip" data-placement="right" title="' . esc_attr__('Featured Post', 'impronta') . '"></i>';
         }
         echo '</p>';
     }
 }
开发者ID:nicoandrade,项目名称:Impronta,代码行数:36,代码来源:template-tags.php

示例15: momtaz_get_post_class

/**
 * Creates a set of classes for each site entry upon display. Each entry is given the class of
 * 'hentry'. Posts are given category, tag, and author classes. Alternate post classes of odd,
 * even, and alt are added.
 *
 * @param string|array $class One or more classes to add to the class list.
 * @param int $post_id An optional post ID.
 * @return array
 * @since 1.1
 */
function momtaz_get_post_class($class = '', $post_id = 0)
{
    $classes = array();
    // Get post object
    $post = get_post($post_id);
    if (empty($post)) {
        return $classes;
    }
    // hAtom compliance.
    $classes[] = 'hentry';
    // Get post context.
    $context = momtaz_get_post_context($post_id);
    // Merge the classes array with post context.
    $classes = array_merge($classes, (array) $context);
    // Post taxonomies
    $post_taxonomies = get_post_taxonomies($post);
    if (!empty($post_taxonomies)) {
        foreach ($post_taxonomies as $taxonomy) {
            $terms = get_the_terms($post->ID, $taxonomy);
            if (!empty($terms)) {
                foreach ($terms as $term) {
                    $classes[] = 'term-' . sanitize_html_class($term->slug, $term->term_id);
                }
            }
        }
    }
    // Sticky posts.
    if (is_home() && !is_paged() && is_sticky($post->ID)) {
        $classes[] = 'sticky';
    }
    // Is this post protected by a password?
    if (post_password_required($post)) {
        $classes[] = 'post-password-required';
    }
    // Post alt class.
    if (!momtaz_is_the_single($post)) {
        static $post_alt = 0;
        $classes[] = 'set-' . ++$post_alt;
        $classes[] = $post_alt % 2 ? 'odd' : 'even';
    }
    // Has a custom excerpt?
    if (has_excerpt($post)) {
        $classes[] = 'has-excerpt';
    }
    // Custom classes.
    if (!empty($class)) {
        if (!is_array($class)) {
            $class = preg_split('#\\s+#', $class);
        }
        $classes = array_merge($classes, $class);
    }
    // Apply the WordPress filters.
    $classes = apply_filters('post_class', $classes, $class, $post->ID);
    // Apply the Momtaz FW filters.
    $classes = apply_filters('momtaz_get_post_class', $classes, $post);
    // Removes any duplicate and empty classes.
    $classes = array_unique(array_filter($classes));
    return $classes;
}
开发者ID:emados,项目名称:Momtaz-Framework,代码行数:69,代码来源:entries.php


注:本文中的is_sticky函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。