コード例 #1
0
ファイル: content_helper.php プロジェクト: aleksking/sherrill
/**
 * 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);
    }
}
コード例 #2
0
ファイル: extras.php プロジェクト: Jocker666z/hepouf
function adjust_content_width()
{
    global $content_width;
    if (has_post_format('video')) {
        $content_width = 960;
    }
}
コード例 #3
0
ファイル: themeta.php プロジェクト: ComEnYns/Web-Projects
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>';
    }
}
コード例 #4
0
ファイル: post-formats.php プロジェクト: vinhnq1211/funy
/**
 * 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;
}
コード例 #5
0
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;
}
コード例 #6
0
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);
    }
}
コード例 #7
0
    /**
     * 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;
    }
コード例 #8
0
/**
 * 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);
}
コード例 #9
0
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;
}
コード例 #10
0
ファイル: _js_ktz.php プロジェクト: jjpango/JJTeam
/**
 * 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>';
    }
}
コード例 #11
0
ファイル: lib-content.php プロジェクト: jimdough/Roadmaster
 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());
         }
     }
 }
コード例 #12
0
ファイル: functions.php プロジェクト: arturo-mayorga/am_com
/**
 * 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;
}
コード例 #13
0
/**
 * 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;
}
コード例 #14
0
/**
   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' ?>">
    */
}
コード例 #15
0
ファイル: post-formats.php プロジェクト: GTACSolutions/Telios
/**
 * 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;
}
コード例 #16
0
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))));
}
コード例 #17
0
ファイル: quote.php プロジェクト: henlz/WCode-WebSite
/**
 * 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;
}
コード例 #18
0
ファイル: functions.php プロジェクト: frojd/frojd-segments
/**
 * 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);
}
コード例 #19
0
ファイル: _loop_ktz.php プロジェクト: jjpango/JJTeam
 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()));
     }
 }
コード例 #20
0
ファイル: link.php プロジェクト: henlz/WCode-WebSite
/**
 * 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;
}
コード例 #21
0
 function sb_body_classes($classes)
 {
     if (is_single() && !has_post_thumbnail() && !has_post_format('video') || is_page() && !has_post_thumbnail() && !is_page_template('page-instafeatured.php')) {
         $classes[] = 'no-thumb';
     }
     if (is_single() && has_post_format('video')) {
         $classes[] = 'has-video';
     }
     if (is_front_page() && is_home() && !is_paged()) {
         $classes[] = 'startpage';
     }
     return $classes;
 }
コード例 #22
0
function ods_remove_first_shortcode($content = null)
{
    global $post;
    $terms = array('audio', 'gallery', 'video', 'playlist');
    if (is_single() && is_main_query() && $post->post_type == 'post' && has_post_format($terms, $post->ID)) {
        $pattern = get_shortcode_regex();
        preg_match('/' . $pattern . '/s', $content, $matches);
        if (isset($matches[2]) && is_array($matches) && in_array($matches[2], $terms)) {
            $content = str_replace($matches['0'], '', $content);
        }
    }
    return $content;
}
コード例 #23
0
ファイル: post-meta.php プロジェクト: radscheit/unicorn
 function mr_tailor_post_header_entry_date($echo = true)
 {
     if (has_post_format(array('chat', 'status'))) {
         $format_prefix = _x('%1$s on %2$s', '1: post format name. 2: date', 'mr_tailor');
     } else {
         $format_prefix = '%2$s';
     }
     $date = sprintf('<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a>', esc_url(get_permalink()), esc_attr(sprintf(__('Permalink to %s', 'mr_tailor'), the_title_attribute('echo=0'))), esc_attr(get_the_date('c')), esc_html(sprintf($format_prefix, get_post_format_string(get_post_format()), get_the_date())));
     if ($echo) {
         echo $date;
     }
     return $date;
 }
コード例 #24
0
ファイル: extras.php プロジェクト: zakikazmi/TestGithub
function emphasize_quote_content($content)
{
    /* Check if we're displaying a 'quote' post. */
    if (has_post_format('quote')) {
        /* Match any <blockquote> elements. */
        preg_match('/<blockquote.*?>/', $content, $matches);
        /* If no <blockquote> elements were found, wrap the entire content in one. */
        if (empty($matches)) {
            $content = "<blockquote>{$content}</blockquote>";
        }
    }
    return $content;
}
コード例 #25
0
function organizedthemes_format_class($classes)
{
    global $post;
    // add format to classes
    if ((is_single() || is_page()) && (has_post_format('image') || has_post_format('video') || has_post_format('gallery'))) {
        $classes[] = get_post_format();
    } else {
        if (is_single() || is_page()) {
            $classes[] = 'standard';
        }
    }
    // return the $classes array
    return $classes;
}
コード例 #26
0
/**
 * Filter out the first URL or HTML link of the
 * content in a "Link" format post.
 *
 * @since 2.3.0
 *
 * @param string $content Content of post
 * @return string $content Filtered content of post
 */
function themeblvd_content_format_link($content)
{
    // Only continue if this is a "link" format post.
    if (!has_post_format('link')) {
        return $content;
    }
    // Get the URL from the content.
    $url = get_content_url($content);
    // Remove that URL from the start of content,
    // if that's where it was.
    if ($url && 0 === strpos($content, $url)) {
        $content = str_replace($url, '', $content);
    }
    return $content;
}
コード例 #27
0
ファイル: functions.php プロジェクト: davidHuanghw/david_blog
function iw_post_format_icon()
{
    if (has_post_format('quote')) {
        echo '<i class="fa fa-quote-left"></i>';
    } elseif (has_post_format('image')) {
        echo '<i class="fa fa-picture-o"></i>';
    } elseif (has_post_format('video')) {
        echo '<i class="fa fa-film"></i>';
    } elseif (has_post_format('audio')) {
        echo '<i class="fa fa-music"></i>';
    } else {
        echo '<i class="fa fa-thumb-tack"></i>';
    }
    return;
}
コード例 #28
0
ファイル: _css_ktz.php プロジェクト: jjpango/JJTeam
function ktz_enqueue_css()
{
    global $post;
    if (!is_admin()) {
        if (is_object($post)) {
            $meta_values = get_post_custom($post->ID);
        }
        wp_enqueue_style('ktz-bootstrap-min');
        if (is_single() && has_post_format('video')) {
            wp_enqueue_style('ktz-video-min');
        }
        wp_enqueue_style('ktz-main-css');
        wp_enqueue_style('ktz-default-css');
    }
}
コード例 #29
0
function tm_is_post_video($post = null)
{
    $post = get_post($post);
    if (!$post) {
        return false;
    }
    // Back compat, if the post has any video field, it also is a video.
    $video_file = get_post_meta($post->ID, 'tm_video_file', true);
    $video_url = get_post_meta($post->ID, 'tm_video_url', true);
    $video_code = get_post_meta($post->ID, 'tm_video_code', true);
    // Post meta by Automatic Youtube Video Post plugin
    if (!empty($video_code) || !empty($video_url) || !empty($video_file)) {
        return $post->ID;
    }
    return has_post_format('video', $post);
}
コード例 #30
0
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
        $gallery = empty($instance['gallery']) ? ' ' : apply_filters('widget_gallery', $instance['gallery']);
        /**
         * Output the HTML for this widget.
         */
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        echo '<div id="gallery-post-format-widget">';
        ?>

<?php 
        $custom = new WP_Query(array('order' => 'DESC', 'posts_per_page' => 1, 'no_found_rows' => true, 'post_status' => 'publish', 'post__not_in' => get_option('sticky_posts'), 'tax_query' => array(array('taxonomy' => 'post_format', 'terms' => array("post-format-gallery"), 'field' => 'slug', 'operator' => 'IN'))));
        if ($custom->have_posts()) {
            while ($custom->have_posts()) {
                $custom->the_post();
                $tmp_more = $GLOBALS['more'];
                $GLOBALS['more'] = 0;
                ?>



<?php 
                if (has_post_format('gallery')) {
                    the_content();
                }
                printf('<span class="entry-meta"><time class="entry-date" datetime="%2$s">%3$s</time></span>', esc_url(get_permalink()), esc_attr(get_the_date('c')), esc_html(get_the_date()));
                ?>


		<?php 
            }
        }
        // Reset the post globals as this query will have stomped on it.
        wp_reset_postdata();
        ?>


<?php 
        echo '<p><a href="' . get_post_format_link('gallery') . '" class="widget-format-link"><span class="screen-reader-text">' . $gallery . '</span></a></p>';
        echo '</div>';
        echo $after_widget;
    }