• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP has_post_format函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: tarski_link_pages

/**
 * Passes some Tarski-specific arguments to wp_link_pages.
 *
 * @since 2.0
 *
 * @uses wp_link_pages
 */
function tarski_link_pages()
{
    $arguments = array('before' => '<p class="link-pages"><strong>' . __('Pages:', 'tarski') . '</strong>', 'after' => '</p>', 'next_or_number' => 'number', 'nextpagelink' => __('Next page', 'tarski'), 'previouspagelink' => __('Previous page', 'tarski'), 'pagelink' => '%', 'more_file' => '', 'echo' => true);
    if (!(has_post_format('aside') || in_category(get_tarski_option('asidescategory')))) {
        wp_link_pages($arguments);
    }
}
开发者ID:aleksking,项目名称:sherrill,代码行数:14,代码来源:content_helper.php


示例2: adjust_content_width

function adjust_content_width()
{
    global $content_width;
    if (has_post_format('video')) {
        $content_width = 960;
    }
}
开发者ID:Jocker666z,项目名称:hepouf,代码行数:7,代码来源:extras.php


示例3: 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


示例4: thim_post_formats_content

/**
 * Remove images in post content if it has post format 'image'
 *
 * @param string $content
 *
 * @return string
 * @since 1.0
 */
function thim_post_formats_content($content)
{
    if (has_post_format('image')) {
        $content = preg_replace('|<img[^>]*>|i', '', $content);
    }
    if (has_post_format('link')) {
        $url = thim_meta('thim_url');
        $text = thim_meta('thim_text');
        if ($url && $text) {
            $content = '<p><a class="link" href="' . esc_url($url) . '">' . esc_attr($text) . '</a></p>';
        }
    }
    if (has_post_format('quote')) {
        $quote = thim_meta('thim_quote');
        $author = thim_meta('thim_author');
        $author_url = thim_meta('thim_author_url');
        if ($author_url) {
            $author = '<a href="' . esc_url($author_url) . '">' . esc_attr($author) . '</a>';
        }
        if ($quote && $author) {
            $content = "<blockquote>{$quote}<cite>{$author}</cite></blockquote>";
        }
    }
    return $content;
}
开发者ID:vinhnq1211,项目名称:funy,代码行数:33,代码来源:post-formats.php


示例5: post_format_icon

function post_format_icon()
{
    if (has_post_format('gallery')) {
        $icon = 'stack';
    } else {
        if (has_post_format('quote')) {
            $icon = 'quotes-left';
        } else {
            if (has_post_format('video')) {
                $icon = 'play';
            } else {
                if (has_post_format('link')) {
                    $icon = 'link';
                } else {
                    if (has_post_format('audio')) {
                        $icon = 'headphones';
                    } else {
                        if (has_post_format('status')) {
                            $icon = 'twitter';
                        } else {
                            $icon = false;
                        }
                    }
                }
            }
        }
    }
    return $icon;
}
开发者ID:annegrundhoefer,项目名称:courtney,代码行数:29,代码来源:functions.php


示例6: post_format_image_featured

function post_format_image_featured()
{
    if (has_post_format('image') && has_post_thumbnail() && is_singular('post')) {
        $img = genesis_get_image(array('format' => 'html', 'size' => genesis_get_option('image_size'), 'attr' => array('class' => 'post-image')));
        printf('<a href="%s" id="featured-post-image" title="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), $img);
    }
}
开发者ID:MarioGiancini,项目名称:thedbz-theme,代码行数:7,代码来源:functions.php


示例7: widget

    /**
     * Displays the widget content
     *
     * @author	Konstantin Obeland
     * @since	1.1.0 - 08.03.2012
     * @access	public
     *
     * @param	array	$args
     * @param	array	$instance
     *
     * @return	void
     */
    public function widget($args, $instance)
    {
        if (!has_post_format('gallery', $instance['post_id'])) {
            return;
        }
        $attachments = get_children(array('post_parent' => $instance['post_id'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID'));
        if (empty($attachments)) {
            return;
        }
        extract($args);
        echo str_replace('well ', '', $before_widget);
        if ($title = get_the_title($instance['post_id'])) {
            echo $before_title . '<a href="' . get_permalink($instance['post_id']) . '" title="' . sprintf(esc_attr__('Permalink to %s', 'the-bootstrap'), strip_tags($title)) . '" rel="bookmark">' . $title . '</a>' . $after_title;
        }
        ?>
		<div id="sidebar-gallery-slider" class="carousel slide">

			<!-- Carousel items -->
			<div class="carousel-inner">
				<?php 
        foreach ($attachments as $attachment) {
            ?>
				<figure class="item">
					<?php 
            echo wp_get_attachment_image($attachment->ID, array(370, 278));
            if (has_excerpt($attachment->ID)) {
                ?>
					<figcaption class="carousel-caption">
						<h4><?php 
                echo get_the_title($attachment->ID);
                ?>
</h4>
						<p><?php 
                echo apply_filters('get_the_excerpt', $attachment->post_excerpt);
                ?>
</p>
					</figcaption>
					<?php 
            }
            ?>
				</figure>
				<?php 
        }
        ?>
			</div><!-- .carousel-inner -->
		
			<!-- Carousel nav -->
			<a class="carousel-control left" href="#sidebar-gallery-slider" data-slide="prev"><?php 
        _ex('&lsaquo;', 'carousel-control', 'the-bootstrap');
        ?>
</a>
			<a class="carousel-control right" href="#sidebar-gallery-slider" data-slide="next"><?php 
        _ex('&rsaquo;', 'carousel-control', 'the-bootstrap');
        ?>
</a>
		</div><!-- #sidebar-gallery-slider .carousel .slide -->
		<?php 
        echo $after_widget;
    }
开发者ID:Covert-Inferno,项目名称:the-bootstrap,代码行数:71,代码来源:the-bootstrap-gallery-widget.php


示例8: material_design_par_amauri_chat_content

/**
 * This function filters the post content when viewing a post with the "chat" post format.  It formats the 
 * content with structured HTML markup to make it easy for theme developers to style chat posts.  The 
 * advantage of this solution is that it allows for more than two speakers (like most solutions).  You can 
 * have 100s of speakers in your chat post, each with their own, unique classes for styling.
 *
 * @author David Chandra
 * @link http://www.turtlepod.org
 * @author Justin Tadlock
 * @link http://justintadlock.com
 * @copyright Copyright (c) 2012
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * @link http://justintadlock.com/archives/2012/08/21/post-formats-chat
 *
 * @global array $_post_format_chat_ids An array of IDs for the chat rows based on the author.
 * @param string $content The content of the post.
 * @return string $chat_output The formatted content of the post.
 */
function material_design_par_amauri_chat_content($content)
{
    global $_post_format_chat_ids;
    /* If this is not a 'chat' post, return the content. */
    if (!has_post_format('chat')) {
        return $content;
    }
    /* Set the global variable of speaker IDs to a new, empty array for this chat. */
    $_post_format_chat_ids = array();
    $speaker_id_save = 0;
    $pair_save = '';
    /* Allow the separator (separator for speaker/text) to be filtered. */
    $separator = apply_filters('my_post_format_chat_separator', ':');
    /* Open the chat transcript div and give it a unique ID based on the post ID. */
    $chat_output = "\n\t\t\t" . '<div id="chat-transcript-' . esc_attr(get_the_ID()) . '" class="chat-transcript">';
    /* Split the content to get individual chat rows. */
    $chat_rows = preg_split("/(\r?\n)+|(<br\\s*\\/?>\\s*)+/", $content);
    /* Loop through each row and format the output. */
    foreach ($chat_rows as $chat_row) {
        /* If a speaker is found, create a new chat row with speaker and text. */
        if (strpos($chat_row, $separator)) {
            /* Split the chat row into author/text. */
            $chat_row_split = explode($separator, trim($chat_row), 2);
            /* Get the chat author and strip tags. */
            $chat_author = strip_tags(trim($chat_row_split[0]));
            /* Get the chat text. */
            $chat_text = trim($chat_row_split[1]);
            /* Get the chat row ID (based on chat author) to give a specific class to each row for styling. */
            $speaker_id = material_design_par_amauri_chat_row_id($chat_author);
            /* Open the chat row. */
            $pair = 'chat-right';
            if ($speaker_id % 2) {
                $pair = 'chat-left';
            }
            $chat_output .= "\n\t\t\t\t" . '<div class="' . $pair . ' chat-row ' . sanitize_html_class("chat-speak-{$speaker_id}") . '">';
            /* Add the chat row text. */
            $chat_output .= "\n\t\t\t\t\t" . '<div class="chat-text">' . str_replace(array("\r", "\n", "\t"), '', apply_filters('material_design_par_amauri_format_chat_text', $chat_text, $chat_author, $speaker_id)) . '</div>';
            /* Add the chat row author. */
            $chat_output .= '<div class="chat-author ' . sanitize_html_class(strtolower("chat-author-{$chat_author}")) . ' vcard"><cite class="fn">' . apply_filters('my_post_format_chat_author', $chat_author, $speaker_id) . '</cite></div>';
            /* Close the chat row. */
            $chat_output .= '</div><!-- .chat-row --><div class="clear"></div>';
        } else {
            /* Make sure we have text. */
            if (!empty($chat_row)) {
                /* Open the chat row. */
                $chat_output .= "\n\t\t\t\t" . '<div class="chat-row ' . sanitize_html_class("chat-speaker-{$speaker_id}") . '">';
                /* Don't add a chat row author.  The label for the previous row should suffice. */
                /* Add the chat row text. */
                $chat_output .= "\n\t\t\t\t\t" . '<div class="chat-text">' . str_replace(array("\r", "\n", "\t"), '', apply_filters('material_design_par_amauri_format_chat_text', $chat_row, $chat_author, $speaker_id)) . '</div>';
                /* Close the chat row. */
                $chat_output .= "\n\t\t\t</div><!-- .chat-row -->";
            }
        }
    }
    /* Close the chat transcript div. */
    $chat_output .= "\n\t\t\t</div><!-- .chat-transcript -->\n";
    /* Return the chat content and apply filters for developers. */
    return apply_filters('my_post_format_chat_content', $chat_output);
}
开发者ID:henlz,项目名称:WCode-WebSite,代码行数:77,代码来源:chat-transcript.php


示例9: related_posts

function related_posts($count, $type, $post_id)
{
    $out = $categories = $param = '';
    if ($type == 'category') {
        $categories = get_the_category($post_id);
        $param = 'category__in';
    } else {
        $categories = wp_get_post_tags($post_id);
        $param = 'tag__in';
    }
    if ($categories) {
        $category_ids = array();
        foreach ($categories as $individual_category) {
            $category_ids[] = $individual_category->term_id;
        }
        $args = array('post_type' => 'post', $param => $category_ids, 'post__not_in' => array($post_id), 'posts_per_page' => $count, 'ignore_sticky_posts ' => 1);
        $related = new WP_Query($args);
        if ($related->have_posts() && $related->found_posts >= 1) {
            $out .= '<div class="related-posts mts clearfix">';
            $out .= '<div class="element-title"><h3>' . __('Related Articles ', 'corporative') . '</h3></div>';
            $out .= '<ul class="row_inner">';
            $count = 1;
            while ($related->have_posts()) {
                $related->the_post();
                $gallery = $audioURL = $videoURL = $format = '';
                if (get_field('post_gallery')) {
                    $gallery = get_field('post_gallery');
                }
                if (get_field('post_video')) {
                    $videoURL = get_field('post_video');
                }
                if (get_field('post_audio')) {
                    $audioURL = get_field('post_audio');
                }
                if (has_post_format('video')) {
                    $format = 'Video';
                } elseif (has_post_format('audio')) {
                    $format = 'Audio';
                } elseif (has_post_format('gallery')) {
                    $format = 'Gallery';
                } else {
                    $format = 'Standard';
                }
                $out .= '<li class="grid_3 grid_item no_title_thumb">';
                $out .= mediaholder_caption('', $format, 243, 160, 'carousel', $videoURL, $audioURL, $gallery);
                $out .= '<h2 class="post_title"><a href="' . get_permalink() . '" title="">' . get_the_title() . '</a></h2>';
                $out .= '</li>';
                if ($count % 4 == 0) {
                    $out .= '<div class="clear"></div>';
                }
                $count++;
            }
            $out .= '</ul>';
            $out .= '</div>';
        }
    }
    wp_reset_postdata();
    return $out;
}
开发者ID:devmoonshine,项目名称:development,代码行数:59,代码来源:related-posts.php


示例10: ktz_require_videojs

/**
 * Add Js Require For VideoJS
 */
function ktz_require_videojs()
{
    if (is_single() && has_post_format('video')) {
        echo '<script type="text/javascript">';
        echo 'videojs.options.flash.swf = "' . ktz_url . 'includes/assets/video-js/video-js.swf";';
        echo '</script>';
    }
}
开发者ID:jjpango,项目名称:JJTeam,代码行数:11,代码来源:_js_ktz.php


示例11: xinwp_single_post_link

 function xinwp_single_post_link()
 {
     if (!is_single()) {
         if (has_post_format('aside') || has_post_format('quote') || '' == the_title_attribute('echo=0')) {
             printf('<a class="single-post-link" href="%1$s" title="%1$s"><i class="icon-chevron-right"></i></a>', get_permalink(), get_the_title());
         }
     }
 }
开发者ID:jimdough,项目名称:Roadmaster,代码行数:8,代码来源:lib-content.php


示例12: ascetica_disable_sidebars

/**
 * Disables sidebars if viewing a two-column - wide page, or a gallery post.
 *
 */
function ascetica_disable_sidebars($sidebars_widgets)
{
    global $wp_query;
    if (is_page_template('page-template-wide.php') || is_singular() && has_post_format('gallery', get_queried_object_id())) {
        $sidebars_widgets['secondary'] = false;
    }
    return $sidebars_widgets;
}
开发者ID:arturo-mayorga,项目名称:am_com,代码行数:12,代码来源:functions.php


示例13: twentyfourteen_mute_content_filters

/**
 * Removes sharing markup from post content if we're not in the loop and it's a
 * formatted post.
 *
 * @param bool $show Whether to show sharing options.
 * @param WP_Post $post The post to share.
 * @return bool
 */
function twentyfourteen_mute_content_filters($show, $post)
{
    $formats = get_theme_support('post-formats');
    if (!in_the_loop() && has_post_format($formats[0], $post)) {
        $show = false;
    }
    return $show;
}
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:16,代码来源:twentyfourteen.php


示例14: edin_improved_post_thumbnail

/**
   Improve post thumbnails e.g. for use on grid page, by hiding them with CSS
   to reveal an identical background image. This allows realigning of the background
   image easily with CSS property background-position. Requires user to set the
   custom field "image_focus" in each page, as required.
*/
function edin_improved_post_thumbnail()
{
    $postid = get_the_ID();
    if (post_password_required() || is_attachment() || !has_post_thumbnail() || has_post_format()) {
        return;
    }
    $ratio = get_theme_mod('edin_thumbnail_style');
    switch ($ratio) {
        case 'square':
            ?>
<a class="post-thumbnail edin-improved-post-thumbnail edin-improved-post-thumbnail-square" <?php 
            ?>
href="<?php 
            the_permalink();
            ?>
" <?php 
            break;
        default:
            ?>
<a class="post-thumbnail edin-improved-post-thumbnail edin-improved-post-thumbnail-landscape" <?php 
            ?>
href="<?php 
            the_permalink();
            ?>
" <?php 
    }
    ?>
style="background-image: url('<?php 
    $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($postid), 'edin-thumbnail-landscape');
    echo esc_url($thumbnail[0]);
    ?>
');
  background-repeat: no-repeat;
  background-size: cover;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-position: <?php 
    echo get_post_meta($postid, 'image_focus', 1);
    ?>
 ;">
  <img class="edin-improved-post-thumbnail" src="<?php 
    echo esc_url($thumbnail[0]);
    ?>
">
  <?php 
    ?>
</a><?php 
    /*
      FIXME Should detect if image_focus is not sent.
      However, CSS errors fail gracefully.
    */
    /*
      Instead of using the thumbnail image on top of the background image,
      could use a transparent PNG instead:
      <img class="edin-improved-post-thumbnail" src="<?php echo '' . get_stylesheet_directory_uri() . '/transparent.png' ?>">
    */
}
开发者ID:austinjp,项目名称:edin-child-theme,代码行数:64,代码来源:functions.php


示例15: constructent_post_formats_content

/**
 * Remove images in post content if it has post format 'image'
 *
 * @param string $content
 *
 * @return string
 * @since 1.0
 */
function constructent_post_formats_content($content)
{
    if (has_post_format('image')) {
        $content = preg_replace('|<img[^>]*>|i', '', $content);
    }
    if (has_post_format('quote') || has_post_format('link')) {
        $content = '';
    }
    return $content;
}
开发者ID:GTACSolutions,项目名称:Telios,代码行数:18,代码来源:post-formats.php


示例16: apostrophe_post_format

function apostrophe_post_format()
{
    $format = get_post_format();
    $formats = get_theme_support('post-formats');
    // If the post has no format, or if it's not a format supported by the theme, return early
    if (!$format || !has_post_format($formats[0])) {
        return;
    }
    printf('<a class="entry-format format-%1$s" href="%2$s" title="%3$s"><span class="screen-reader-text">%1$s</span></a>', esc_html(strtolower(get_post_format_string($format))), esc_url(get_post_format_link($format)), sprintf(esc_html('All %s posts', 'apostrophe'), esc_html(get_post_format_string($format))));
}
开发者ID:glugpace,项目名称:glugpace.org,代码行数:10,代码来源:template-tags.php


示例17: material_design_par_amauri_quote_content

/**
 * Add blockquote if none.
 */
function material_design_par_amauri_quote_content($content)
{
    /* If this is not a 'quote' post, return the content. */
    if (!has_post_format('quote')) {
        return $content;
    }
    if (!preg_match('#<blockquote#', $content)) {
        $content = '<blockquote>' . $content . '</blockquote>';
    }
    return $content;
}
开发者ID:henlz,项目名称:WCode-WebSite,代码行数:14,代码来源:quote.php


示例18: addMetaBoxesHook

/**
 * Uses functionality in segments plugin to create segment metaboxes
 */
function addMetaBoxesHook()
{
    $postId = get_the_ID();
    $metaboxes = array();
    /* Any conditions can be used to only add this segment metabox to specific posts */
    if (has_post_format('gallery', $postId)) {
        $metaboxes['blurbs'] = array('title' => __('Select blurbs', get_translation_domain()), 'selection' => array('post_type' => array('blurbs'), 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-gallery'), 'operator' => 'NOT IN'))), 'show_on' => array('post_types' => array('blurbs')), 'options' => array('grid' => array('label' => __('Grid', get_translation_domain()), 'type' => 'select', 'options' => array('full' => '1/1', 'half' => '1/2', 'quarter' => '1/4')), 'featured' => array('label' => __('Featured', get_translation_domain()), 'type' => 'checkbox', 'checked' => true), 'alternative_title' => array()));
    }
    // Call action with the complete metabox object to display the segment metabox on selected posts
    do_action('frojd_segments_add_metaboxes', $metaboxes);
}
开发者ID:frojd,项目名称:frojd-segments,代码行数:14,代码来源:functions.php


示例19: ktz_posted_title_a

 function ktz_posted_title_a()
 {
     global $post;
     // post format link
     $ktz_link_pf = get_post_custom_values('ktz_link_postformat', $post->ID);
     if ($ktz_link_pf && has_post_format('link')) {
         printf(__('<a href="%1$s" title="External link to %2$s" rel="nofollow" target="_blank"><span class="glyphicon glyphicon-link"></span> %3$s</a>', ktz_theme_textdomain), esc_url($ktz_link_pf[0]), esc_url($ktz_link_pf[0]), esc_attr(get_the_title()));
     } else {
         // standard post format
         printf(__('<a href="%1$s" title="Permalink to %2$s" rel="bookmark">%3$s</a>', ktz_theme_textdomain), esc_url(get_permalink()), esc_attr(get_the_title()), esc_attr(get_the_title()));
     }
 }
开发者ID:jjpango,项目名称:JJTeam,代码行数:12,代码来源:_loop_ktz.php


示例20: material_design_par_amauri_link_content

/**
 * remove the main link from content.
 */
function material_design_par_amauri_link_content($content)
{
    /* If this is not a 'link' post, return the content. */
    if (!has_post_format('link') || is_singular()) {
        return $content;
    }
    if (preg_match('|<a.*(?=href=\\"([^\\"]*)\\")[^>]*>([^<]*)</a>|i', $content)) {
        $content = preg_replace("|<a.*(?=href=\"([^\"]*)\")[^>]*>([^<]*)</a>|i", '', $content, 1);
    } else {
        $content = preg_replace("#\\bhttps?://[^\\s()<>]+(?:\\([\\w\\d]+\\)|([^[:punct:]\\s]|/))#", '', $content, 1);
    }
    return $content;
}
开发者ID:henlz,项目名称:WCode-WebSite,代码行数:16,代码来源:link.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP has_post_thumbnail函数代码示例发布时间:2022-05-15
下一篇:
PHP has_permissions函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap