本文整理汇总了PHP中cb_byline函数的典型用法代码示例。如果您正苦于以下问题:PHP cb_byline函数的具体用法?PHP cb_byline怎么用?PHP cb_byline使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cb_byline函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cb_review_ext_box
echo cb_review_ext_box($cb_post_id, $cb_category_color);
echo $cb_post_format_icon;
?>
</div>
<div class="cb-meta">
<h2 class="h4"><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h2>
<?php
echo cb_byline();
?>
<div class="cb-excerpt"><?php
echo cb_clean_excerpt(150, false);
?>
</div>
</div>
</article>
<?php
if ($i % 2 != 0) {
echo '</div>';
}
$i++;
示例2: my_posts_screen_content
function my_posts_screen_content()
{
get_template_part('directory-to-content-file');
$theuser = bp_displayed_user_id();
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
query_posts(array('posts_per_page' => 5, 'author' => $theuser, 'cb_offset_loop' => $cb_offset_loop, 'paged' => $paged));
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<article id="post-<?php
the_ID();
?>
" class="cb-blog-style-a clearfix<?php
if (is_sticky()) {
echo ' sticky';
}
if ($cb_category_color_style != NULL) {
echo ' ' . $cb_category_color_style;
}
?>
" role="article">
<div class="cb-mask" style="background-color:<?php
echo $cb_category_color;
?>
;">
<?php
cb_thumbnail('300', '200');
echo cb_review_ext_box($cb_post_id, $cb_category_color);
echo $cb_post_format_icon;
?>
</div>
<div class="cb-meta">
<h2 class="h4"><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h2>
<?php
echo cb_byline();
?>
<div class="cb-excerpt"><?php
echo cb_clean_excerpt(210, false);
?>
</div>
</div>
</article>
<?php
}
wp_reset_query();
// resets main query
} else {
?>
<h1>Sorry...</h1>
<p><?php
_e('You have not posted any article.');
?>
</p>
<h4> <a style="color: grey" href="<?php
echo home_url();
?>
//add-new/"><?php
esc_html_e("Add an article now", 'cubell');
?>
</a></h4>
<?php
}
}
示例3: cb_review_ext_box
cb_review_ext_box($cb_post_id);
?>
</div>
<div class="cb-meta clearfix">
<h2 class="cb-post-title"><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h2>
<?php
cb_byline($cb_post_id);
?>
<div class="cb-excerpt"><?php
echo cb_clean_excerpt(160);
?>
</div>
<?php
cb_post_meta($cb_post_id);
?>
</div>
</article>
示例4: cb_thumbnail
cb_thumbnail('80', '60');
echo cb_review_ext_box($cb_post_id, $cb_category_color, true);
echo $cb_post_format_icon;
?>
</div>
<div class="cb-meta">
<h2 class="h4"><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h2>
<?php
echo cb_byline(true, $cb_post_id, true);
?>
</div>
</article>
<?php
}
}
echo '</div>';
}
// endif
wp_reset_postdata();
示例5: widget
function widget($args, $instance)
{
$cache = wp_cache_get('widget_recent_posts', 'widget');
if (!is_array($cache)) {
$cache = array();
}
if (!isset($args['widget_id'])) {
$args['widget_id'] = $this->id;
}
if (isset($cache[$args['widget_id']])) {
echo $cache[$args['widget_id']];
return;
}
ob_start();
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts', 'cubell') : $instance['title'], $instance, $this->id_base);
$category = apply_filters('widget_category', empty($instance['category']) ? '' : $instance['category'], $instance, $this->id_base);
$type = apply_filters('widget_type', empty($instance['type']) ? 'cb-small' : $instance['type'], $instance, $this->id_base);
if (empty($instance['number']) || !($number = absint($instance['number']))) {
$number = 5;
}
if ($category != 'cb-all') {
$cb_cat_qry = $category;
} else {
$cb_cat_qry = NULL;
}
$r = new WP_Query(apply_filters('widget_posts_args', array('posts_per_page' => $number, 'no_found_rows' => true, 'category_name' => $cb_cat_qry, 'post_status' => 'publish', 'ignore_sticky_posts' => true)));
if ($r->have_posts()) {
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<ul class="cb-light <?php
echo $type;
?>
">
<?php
while ($r->have_posts()) {
$r->the_post();
global $post;
$cb_custom_fields = get_post_custom();
$cb_global_color = ot_get_option('cb_base_color', '#eb9812');
$cb_meta_onoff = ot_get_option('cb_meta_onoff', 'on');
$cb_review_checkbox = get_post_meta(get_the_id(), "cb_review_checkbox");
if ($type == 'cb-small') {
$width = '80';
$height = '60';
$cb_small_box = true;
$cb_class = NULL;
}
if ($type == 'cb-big') {
$width = '360';
$height = '240';
$cb_small_box = false;
$cb_class = ' class="h2"';
}
$cb_all_categories = get_the_category();
$cb_current_cat_id = $cb_all_categories[0]->term_id;
$cb_category_color = get_tax_meta($cb_current_cat_id, 'cb_color_field_id');
if ($cb_category_color == "#" || $cb_category_color == NULL) {
$cb_parent_cat_id = $cb_all_categories[0]->parent;
if ($cb_parent_cat_id != '0') {
$cb_category_color = get_tax_meta($cb_parent_cat_id, 'cb_color_field_id');
}
if ($cb_category_color == "#" || $cb_category_color == NULL) {
$cb_category_color = $cb_global_color;
}
}
$cb_post_id = $post->ID;
$cb_post_format_icon = cb_post_format_check($cb_post_id);
?>
<li class="cb-article clearfix">
<div class="cb-mask" style="background-color:<?php
echo $cb_category_color;
?>
;">
<?php
cb_thumbnail($width, $height);
echo cb_review_ext_box($cb_post_id, $cb_category_color, $cb_small_box);
echo $cb_post_format_icon;
?>
</div>
<div class="cb-meta">
<h4<?php
echo $cb_class;
?>
><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h4>
<?php
echo cb_byline(false, $cb_post_id, true);
?>
<?php
//.........这里部分代码省略.........
示例6: the_permalink
echo '<div class="' . $cb_module_type . ' ' . $cb_module_style . ' cb-module-half clearfix">' . $cb_title_header;
}
?>
<article class="cb-article clearfix" role="article">
<div class="cb-meta">
<h2><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h2>
<?php
echo cb_byline(true);
?>
<div class="cb-excerpt"><?php
echo cb_clean_excerpt(120);
?>
</div>
</div>
</article>
<?php
$cb_count++;
}
echo '</div>';
}
示例7: cb_thumbnail
<li>
<?php
cb_thumbnail('282', '232');
?>
<div class="cb-meta">
<h2><a href="<?php
the_permalink();
?>
"><?php
echo get_the_title();
?>
</a></h2>
<?php
echo cb_byline(false, $cb_post_id, true);
?>
</div>
<?php
echo cb_review_ext_box($cb_post_id, $cb_category_color);
?>
</li>
<?php
$cb_count++;
}
echo '</ul></div></div>';
}
wp_reset_postdata();
示例8: start_el
function start_el(&$output, $object, $depth = 0, $args = array(), $id = 0)
{
parent::start_el($output, $object, $depth, $args);
$cb_base_color = ot_get_option('cb_base_color', '#eb9812');
$cb_cat_menu = $object->cbmegamenu;
if ($cb_cat_menu == NULL) {
$cb_cat_menu = '2';
}
if (function_exists('get_tax_meta')) {
$cb_color = get_tax_meta($object->object_id, 'cb_color_field_id');
} else {
$cb_color = $cb_base_color;
}
$cb_output = $cb_posts = $cb_menu_featured = $cb_has_children = $cb_slider_output = NULL;
$cb_current_type = $object->object;
$cb_current_classes = $object->classes;
if (in_array('cb-has-children', $cb_current_classes)) {
$cb_has_children = ' cb-with-sub';
}
if (($cb_cat_menu == 1 || $cb_cat_menu == 4) && $object->menu_item_parent == '0') {
$output .= '<div class="cb-big-menu">';
}
if ($cb_cat_menu == 2 && $depth == 0 && $object->menu_item_parent == '0') {
$output .= '<div class="cb-links-menu">';
}
if ($cb_cat_menu == 3 && $object->menu_item_parent == '0') {
$output .= '<div class="cb-mega-menu">';
}
if ($cb_cat_menu == 1 && $object->menu_item_parent == '0') {
$cb_cat_id = $object->object_id;
if (function_exists('get_tax_meta')) {
$cb_category_color = get_tax_meta($cb_cat_id, 'cb_color_field_id');
} else {
$cb_category_color = NULL;
}
if ($cb_category_color == NULL || $cb_category_color == '#') {
$cb_category_color = $cb_base_color;
}
$cb_args_featured = array('cat' => $cb_cat_id, 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 1, 'ignore_sticky_posts' => 1, 'meta_key' => 'cb_featured_post_menu', 'meta_value' => 'featured', 'meta_compare' => '==');
$cb_qry_featured = $cb_img = NULL;
$cb_qry_featured = new WP_Query($cb_args_featured);
$cb_featured_random_title = __('Featured', 'cubell');
if ($cb_qry_featured->post_count == 0) {
$cb_qry_featured = NULL;
$cb_args_featured = array('cat' => $cb_cat_id, 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 1, 'ignore_sticky_posts' => 1, 'orderby' => 'rand');
$cb_qry_featured = new WP_Query($cb_args_featured);
$cb_featured_random_title = __('Random', 'cubell');
}
foreach ($cb_qry_featured->posts as $cb_post) {
setup_postdata($cb_post);
$cb_post_id = $cb_post->ID;
$cb_img = cb_get_thumbnail('480', '240', $cb_post_id);
$cb_permalink = get_permalink($cb_post_id);
$cb_menu_featured .= ' <li class="cb-article clearfix">
<div class="cb-mask" style="background-color:' . $cb_category_color . ';">' . $cb_img . cb_review_ext_box($cb_post_id, $cb_category_color) . '</div>
<div class="cb-meta">
<h2 class="h4"><a href="' . $cb_permalink . '">' . $cb_post->post_title . '</a></h2>
' . cb_byline(true, $cb_post_id) . '
</div></li>';
}
wp_reset_postdata();
if ($cb_has_children == NULL) {
$cb_qry_amount = 6;
$cb_big_recent = ' cb-recent-fw';
$cb_closer = '</div>';
} else {
$cb_qry_amount = 3;
$cb_big_recent = $cb_closer = NULL;
}
$cb_args = array('cat' => $cb_cat_id, 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $cb_qry_amount, 'ignore_sticky_posts' => 1);
$cb_qry_latest = $cb_img = NULL;
$cb_qry_latest = new WP_Query($cb_args);
$i = 1;
foreach ($cb_qry_latest->posts as $cb_post) {
setup_postdata($cb_post);
$cb_post_id = $cb_post->ID;
$cb_img = cb_get_thumbnail('80', '60', $cb_post_id);
$cb_permalink = get_permalink($cb_post_id);
$cb_posts .= ' <li class="cb-article-' . $i . ' clearfix">
<div class="cb-mask" style="background-color:' . $cb_category_color . ';">' . $cb_img . cb_review_ext_box($cb_post_id, $cb_category_color, true) . '</div>
<div class="cb-meta">
<h2 class="h4"><a href="' . $cb_permalink . '">' . $cb_post->post_title . '</a></h2>
' . cb_byline(false, $cb_post_id, true) . '
</div></li>';
$i++;
}
wp_reset_postdata();
}
if ($cb_cat_menu == 4 && $object->menu_item_parent == '0') {
$cb_cat_id = $object->object_id;
if (function_exists('get_tax_meta')) {
$cb_category_color = get_tax_meta($cb_cat_id, 'cb_color_field_id');
} else {
$cb_category_color = NULL;
}
if ($cb_has_children != NULL) {
$cb_slider_type = 'flexslider-1-menu';
$cb_args_featured = array('cat' => $cb_cat_id, 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 9, 'ignore_sticky_posts' => 1);
} else {
$cb_args_featured = array('cat' => $cb_cat_id, 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 12, 'ignore_sticky_posts' => 1);
//.........这里部分代码省略.........
示例9: widget
function widget($args, $instance)
{
$cache = wp_cache_get('widget_top_reviews', 'widget');
if (!is_array($cache)) {
$cache = array();
}
if (!isset($args['widget_id'])) {
$args['widget_id'] = $this->id;
}
if (isset($cache[$args['widget_id']])) {
echo $cache[$args['widget_id']];
return;
}
ob_start();
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? __('Top Reviews', 'cubell') : $instance['title'], $instance, $this->id_base);
$cb_category = apply_filters('widget_category', empty($instance['category']) ? '' : $instance['category'], $instance, $this->id_base);
$cb_filter = apply_filters('widget_filter', empty($instance['filter']) ? '' : $instance['filter'], $instance, $this->id_base);
$cb_type = apply_filters('widget_type', empty($instance['type']) ? '' : $instance['type'], $instance, $this->id_base);
if ($cb_filter == NULL) {
$cb_filter = 'alltime';
}
if (empty($instance['number']) || !($number = absint($instance['number']))) {
$number = 5;
}
if ($cb_category != 'cb-all') {
$cb_cat_qry = $cb_category;
} else {
$cb_cat_qry = NULL;
}
if ($cb_type == 'cb-reader-score') {
$cb_type_filter = 'cb_user_score_output';
} else {
$cb_type_filter = 'cb_final_score';
}
if ($cb_filter == 'week') {
$cb_week = date('W');
$cb_year = date('Y');
$cb_qry = new WP_Query(apply_filters('widget_posts_args', array('posts_per_page' => $number, 'category_name' => $cb_cat_qry, 'year' => $cb_year, 'w' => $cb_week, 'no_found_rows' => true, 'post_status' => 'publish', 'meta_key' => $cb_type_filter, 'orderby' => 'meta_value_num', 'order' => 'DESC', 'ignore_sticky_posts' => true)));
} elseif ($cb_filter == 'alltime') {
$cb_qry = new WP_Query(apply_filters('widget_posts_args', array('posts_per_page' => $number, 'category_name' => $cb_cat_qry, 'no_found_rows' => true, 'post_status' => 'publish', 'meta_key' => $cb_type_filter, 'orderby' => 'meta_value_num', 'order' => 'DESC', 'ignore_sticky_posts' => true)));
} elseif ($cb_filter == 'month') {
$cb_month = date('m', strtotime('-30 days'));
$cb_year = date('Y', strtotime('-30 days'));
$cb_qry = new WP_Query(apply_filters('widget_posts_args', array('posts_per_page' => $number, 'category_name' => $cb_cat_qry, 'year' => $cb_year, 'monthnum' => $cb_month, 'no_found_rows' => true, 'post_status' => 'publish', 'meta_key' => $cb_type_filter, 'orderby' => 'meta_value_num', 'order' => 'DESC', 'ignore_sticky_posts' => true)));
} elseif ($cb_filter == '2011' || $cb_filter == '2012' || $cb_filter == '2013' || $cb_filter == '2014') {
$cb_qry = new WP_Query(apply_filters('widget_posts_args', array('posts_per_page' => $number, 'category_name' => $cb_cat_qry, 'year' => $cb_filter, 'no_found_rows' => true, 'post_status' => 'publish', 'meta_key' => $cb_type_filter, 'orderby' => 'meta_value_num', 'order' => 'DESC', 'ignore_sticky_posts' => true)));
}
if ($cb_qry->have_posts()) {
echo $before_widget;
if ($title != NULL) {
echo $before_title . $title . $after_title;
}
echo '<ul>';
$i = 1;
while ($cb_qry->have_posts()) {
$cb_qry->the_post();
global $post;
$cb_meta_onoff = ot_get_option('cb_meta_onoff', 'on');
$cb_global_color = ot_get_option('cb_base_color', '#eb9812');
$cb_cat_id = get_the_category();
$cb_current_cat_id = $cb_cat_id[0]->term_id;
$cb_category_color = get_tax_meta($cb_current_cat_id, 'cb_color_field_id');
if ($cb_category_color == "#" || $cb_category_color == NULL) {
$cb_parent_cat_id = $cb_cat_id[0]->parent;
if ($cb_parent_cat_id != '0') {
$cb_category_color = get_tax_meta($cb_parent_cat_id, 'cb_color_field_id');
}
if ($cb_category_color == "#" || $cb_category_color == NULL) {
$cb_category_color = $cb_global_color;
}
}
$cb_post_id = $post->ID;
?>
<li class="cb-article clearfix" style="border-top-color:<?php
echo $cb_category_color;
?>
;">
<div class="cb-mask"><?php
cb_thumbnail('430', '270');
?>
</div>
<div class="cb-meta">
<h4><a href="<?php
the_permalink();
?>
"><?php
echo get_the_title();
?>
</a></h4>
<?php
echo cb_byline(false);
?>
</div>
<div class="cb-countdown header-font"><?php
echo $i;
?>
//.........这里部分代码省略.........
示例10: cb_byline
$cb_title_header = NULL;
}
$cb_feature_width = '400';
$cb_feature_height = '250';
$cb_byline = cb_byline(true, $cb_post_id, true);
if ($cb_flipped == 'cb-flipped ') {
if ($i == 4 || $i == 5) {
$cb_byline = $cb_feature_width = '600';
$cb_feature_height = '400';
$cb_byline = cb_byline(true, $cb_post_id, false);
}
} else {
if ($i == 1 || $i == 2) {
$cb_feature_width = '600';
$cb_feature_height = '400';
$cb_byline = cb_byline(true, $cb_post_id, false);
}
}
if ($i == 1) {
echo '<div class="cb-grid-block ' . $cb_module_style . ' clearfix">' . $cb_title_header . '<div class="cb-grid-5 ' . $cb_flipped . 'clearfix">';
}
?>
<div class="cb-feature-<?php
echo $i;
?>
">
<div class="cb-grid-img">
<?php
cb_thumbnail($cb_feature_width, $cb_feature_height);
?>
示例11: start_el
//.........这里部分代码省略.........
if ($cb_cat_menu == 3 && $object->menu_item_parent == '0') {
$output .= '<div class="cb-mega-menu">';
}
if ($cb_cat_menu == 1 && $object->menu_item_parent == '0') {
$cb_cat_id = $object->object_id;
if (function_exists('get_tax_meta')) {
$cb_category_color = get_tax_meta($cb_cat_id, 'cb_color_field_id');
} else {
$cb_category_color = NULL;
}
if ($cb_category_color == NULL || $cb_category_color == '#') {
$cb_category_color = $cb_base_color;
}
$cb_cpt_output = cb_get_custom_post_types();
$cb_args_featured = array('cat' => $cb_cat_id, 'post_type' => $cb_cpt_output, 'post_status' => 'publish', 'posts_per_page' => 1, 'ignore_sticky_posts' => 1, 'meta_key' => 'cb_featured_post_menu', 'meta_value' => 'featured', 'meta_compare' => '==');
$cb_qry_featured = $cb_img = NULL;
$cb_qry_featured = new WP_Query($cb_args_featured);
$cb_featured_random_title = __('Featured', 'cubell');
if ($cb_qry_featured->post_count == 0) {
$cb_qry_featured = NULL;
$cb_args_featured = array('cat' => $cb_cat_id, 'post_type' => $cb_cpt_output, 'post_status' => 'publish', 'posts_per_page' => 1, 'ignore_sticky_posts' => 1, 'orderby' => 'rand');
$cb_qry_featured = new WP_Query($cb_args_featured);
$cb_featured_random_title = __('Random', 'cubell');
}
foreach ($cb_qry_featured->posts as $cb_post) {
setup_postdata($cb_post);
$cb_post_id = $cb_post->ID;
$cb_img = cb_get_thumbnail('480', '240', $cb_post_id);
$cb_permalink = get_permalink($cb_post_id);
$cb_menu_featured .= ' <li class="cb-article clearfix">
<div class="cb-mask" style="background-color:' . $cb_category_color . ';">' . $cb_img . cb_review_ext_box($cb_post_id, $cb_category_color) . '</div>
<div class="cb-meta">
<h2 class="h4"><a href="' . esc_url($cb_permalink) . '">' . $cb_post->post_title . '</a></h2>
' . cb_byline(true, $cb_post_id) . '
</div></li>';
}
wp_reset_postdata();
if ($cb_has_children == NULL) {
$cb_qry_amount = 6;
$cb_big_recent = ' cb-recent-fw';
$cb_closer = '</div>';
} else {
$cb_qry_amount = 3;
$cb_big_recent = $cb_closer = NULL;
}
$cb_cpt_output = cb_get_custom_post_types();
$cb_args = array('cat' => $cb_cat_id, 'post_type' => $cb_cpt_output, 'post_status' => 'publish', 'posts_per_page' => $cb_qry_amount, 'ignore_sticky_posts' => 1, 'post__not_in' => array($cb_post_id));
$cb_qry_latest = $cb_img = NULL;
$cb_qry_latest = new WP_Query($cb_args);
$i = 1;
while ($cb_qry_latest->have_posts()) {
$cb_qry_latest->the_post();
$cb_post_id = get_the_ID();
$cb_post_title = get_the_title();
$cb_img = cb_get_thumbnail('80', '60', $cb_post_id);
$cb_permalink = get_permalink($cb_post_id);
$cb_posts .= ' <li class="cb-article-' . $i . ' clearfix">
<div class="cb-mask" style="background-color:' . $cb_category_color . ';">' . $cb_img . cb_review_ext_box($cb_post_id, $cb_category_color, true) . '</div>
<div class="cb-meta">
<h2 class="h4"><a href="' . esc_url($cb_permalink) . '">' . $cb_post_title . '</a></h2>
' . cb_byline(false, $cb_post_id, true) . '
</div></li>';
$i++;
}
wp_reset_postdata();
}
示例12: cb_related_posts
function cb_related_posts()
{
if (ot_get_option('cb_related_onoff', 'on') == 'off') {
return;
}
global $post;
$cb_post_id = $post->ID;
$i = 1;
$cb_slide_el = $cb_slide_el_cl = $cb_stop_at_2 = NULL;
$cb_related_posts_show = ot_get_option('cb_related_posts_show', 'both');
$cb_related_posts_order = ot_get_option('cb_related_posts_order', 'rand');
$cb_related_posts_style = ot_get_option('cb_related_posts_style', 'cb_related_posts_slider');
if ($cb_related_posts_style == 'cb_related_posts_slider') {
$cb_related_posts_amount = 8;
$cb_slide_el = '<div id="cb-related-posts" class="cb-slider-2 cb-slider cb-meta-below">';
$cb_slide_el_cl = '</div>';
} else {
$cb_related_posts_amount = floatval(ot_get_option('cb_related_posts_amount', '1') * 2);
}
$cb_tags = wp_get_post_tags($cb_post_id);
$cb_tag_check = $cb_all_cats = $cb_related_args = $cb_related_posts = NULL;
if ($cb_related_posts_show == 'both' || $cb_related_posts_show == 'tags') {
if ($cb_tags != NULL) {
foreach ($cb_tags as $cb_tag) {
$cb_tag_check .= $cb_tag->slug . ',';
}
$cb_related_args = array('numberposts' => $cb_related_posts_amount, 'tag' => $cb_tag_check, 'exclude' => $cb_post_id, 'post_status' => 'publish', 'orderby' => $cb_related_posts_order);
$cb_related_posts = get_posts($cb_related_args);
}
}
if ($cb_related_posts_show == 'both' || $cb_related_posts_show == 'cats') {
if ($cb_related_posts == NULL) {
$cb_categories = get_the_category();
foreach ($cb_categories as $cb_category) {
$cb_all_cats .= $cb_category->term_id . ',';
}
$cb_related_args = array('numberposts' => $cb_related_posts_amount, 'category' => $cb_all_cats, 'exclude' => $cb_post_id, 'post_status' => 'publish', 'orderby' => $cb_related_posts_order);
$cb_related_posts = get_posts($cb_related_args);
}
}
if ($cb_related_posts != NULL) {
if (count($cb_related_posts) < 4) {
$cb_slide_el = $cb_slide_el_cl = NULL;
$cb_stop_at_2 = true;
}
echo '<div id="cb-related-posts-block" class="cb-post-footer-block cb-arrows-tr cb-module-block clearfix"><h3 class="cb-title cb-title-header">' . __('Related Posts', 'cubell') . '</h3>' . $cb_slide_el . '<ul class="slides clearfix">';
foreach ($cb_related_posts as $post) {
if ($i == 3) {
$i = 1;
if ($cb_stop_at_2 == true) {
break;
}
}
$cb_post_id = $post->ID;
setup_postdata($post);
?>
<li <?php
post_class('cb-style-1 clearfix cb-no-' . $i);
?>
>
<div class="cb-mask"><?php
cb_thumbnail('360', '240', $post->ID);
?>
</div>
<div class="cb-meta">
<h4 class="cb-post-title"><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h4>
<?php
cb_byline($cb_post_id);
?>
</div>
</li>
<?php
$i++;
}
echo '</ul></div>';
echo $cb_slide_el_cl;
wp_reset_postdata();
}
}
示例13: widget
function widget($args, $instance)
{
$cache = wp_cache_get('widget_recent_posts_slider', 'widget');
if (!is_array($cache)) {
$cache = array();
}
if (!isset($args['widget_id'])) {
$args['widget_id'] = $this->id;
}
if (isset($cache[$args['widget_id']])) {
echo $cache[$args['widget_id']];
return;
}
ob_start();
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? __('Latest', 'cubell') : $instance['title'], $instance, $this->id_base);
$category = apply_filters('widget_category', empty($instance['category']) ? '' : $instance['category'], $instance, $this->id_base);
if (empty($instance['number']) || !($number = absint($instance['number']))) {
$number = 6;
}
if ($category != 'cb-all') {
$cb_cat_qry = $category;
} else {
$cb_cat_qry = NULL;
}
$r = new WP_Query(apply_filters('widget_posts_args', array('posts_per_page' => $number, 'no_found_rows' => true, 'category_name' => $cb_cat_qry, 'post_status' => 'publish', 'ignore_sticky_posts' => true)));
if ($r->have_posts()) {
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<div class="flexslider-widget">
<ul class="slides">
<?php
while ($r->have_posts()) {
$r->the_post();
global $post;
$format = get_post_format();
$cb_custom_fields = get_post_custom();
$cb_meta_onoff = ot_get_option('cb_meta_onoff', 'on');
$cb_global_color = ot_get_option('cb_base_color', '#eb9812');
$cb_review_checkbox = get_post_meta(get_the_id(), "cb_review_checkbox");
$cb_cat_id = get_the_category();
$cb_current_cat_id = $cb_cat_id[0]->term_id;
$cb_category_color = get_tax_meta($cb_current_cat_id, 'cb_color_field_id');
if ($cb_category_color == "#" || $cb_category_color == NULL) {
$cb_parent_cat_id = $cb_cat_id[0]->parent;
if ($cb_parent_cat_id != '0') {
$cb_category_color = get_tax_meta($cb_parent_cat_id, 'cb_color_field_id');
}
if ($cb_category_color == "#" || $cb_category_color == NULL) {
$cb_category_color = $cb_global_color;
}
}
$cb_post_id = $post->ID;
if ($cb_review_checkbox) {
$format = 'false';
}
?>
<li class="cb-article clearfix" style="border-top-color:<?php
echo $cb_category_color;
?>
;">
<div class="cb-mask"><?php
cb_thumbnail('430', '270');
?>
</div>
<div class="cb-meta">
<h4><a href="<?php
the_permalink();
?>
"><?php
echo get_the_title();
?>
</a></h4>
<?php
echo cb_byline(false);
?>
</div>
<?php
echo cb_review_ext_box($cb_post_id, $cb_category_color);
?>
</li>
<?php
}
?>
</ul>
</div>
<?php
echo $after_widget;
?>
<?php
// Reset the global $the_post as this query will have stomped on it
wp_reset_postdata();
//.........这里部分代码省略.........
示例14: the_ID
?>
<div id="cb-content" class="wrap clearfix">
<div id="main" class="clearfix" role="main">
<article id="post-<?php
the_ID();
?>
" <?php
post_class('clearfix');
?>
role="article">
<?php
echo '<div class="cb-entry-header cb-style-off"><h1 class="cb-entry-title cb-single-title">' . get_the_title() . '</h1>';
echo cb_byline(false);
echo '</div>';
?>
<section class="entry-content clearfix" itemprop="articleBody">
<a href="<?php
echo $cb_attachment_full[0];
?>
">
<img src="<?php
echo $cb_attachment_thumb[0];
?>
" alt="">
</a>
</section> <!-- end article section -->