本文整理匯總了PHP中kama_excerpt函數的典型用法代碼示例。如果您正苦於以下問題:PHP kama_excerpt函數的具體用法?PHP kama_excerpt怎麽用?PHP kama_excerpt使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了kama_excerpt函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: widget
/**
* How to display the widget on the screen.
*/
function widget($args, $instance)
{
extract($args);
/* Our variables from the widget settings. */
$title = apply_filters('widget_title', $instance['title']);
$tags = $instance['tags'];
$number = $instance['number'];
$post_type = $instance['post_type'];
global $post;
if ($post_type == 'tags') {
$query = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'tag' => $tags);
} elseif ($post_type == 'featured') {
$query = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'meta_key' => 'is_featured', 'meta_value' => '1');
} else {
$query = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'meta_key' => 'is_featured', 'meta_value' => '1');
}
$loop = new WP_Query($query);
/* Before widget (defined by themes). */
echo $before_widget;
if ($loop->have_posts()) {
/* Display the widget title if one was input (before and after defined by themes). */
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<?php
wp_enqueue_script('flexslider');
?>
<div class="slides">
<?php
while ($loop->have_posts()) {
$loop->the_post();
?>
<div class="slide">
<div class="wrap">
<a href="<?php
the_permalink();
?>
" class="view-link">
<span class="pattern"></span>
<div class="image"><?php
wpsm_thumb('grid_news');
?>
</div>
<?php
if (vp_metabox('rehub_post.rehub_framework_post_type') == 'review') {
?>
<span class="score"><i><?php
echo rehub_get_overall_score();
?>
</i><?php
_e('SCORE', 'rehub_framework');
?>
</span><?php
}
?>
<?php
$category = get_the_category($post->ID);
$first_cat = $category[0]->term_id;
$cat_name = get_cat_name($first_cat);
?>
<span class="reviews"><?php
echo $cat_name;
?>
</span>
</a>
<h3><a class="link" href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h3>
<p><?php
kama_excerpt('maxchar=100');
?>
</p>
</div>
</div>
<?php
}
?>
</div>
<?php
wp_reset_query();
?>
<?php
} else {
_e('No posts for this criteria.', 'rehub_framework');
?>
<?php
}
?>
<?php
/* After widget (defined by themes). */
//.........這裏部分代碼省略.........
示例2: get_the_category
$category = get_the_category();
if ($category) {
$first_cat = $category[0]->term_id;
}
?>
<div class="post-meta"> <?php
if ($category) {
meta_all(true, $first_cat, true);
}
?>
</div>
<?php
rehub_format_score('small');
?>
<p><?php
kama_excerpt('maxchar=180');
?>
</p>
<?php
if (vp_metabox('rehub_post_side.disable_top_offer') != '1') {
?>
<?php
rehub_create_btn('yes');
?>
<?php
} else {
?>
<?php
if (vp_metabox('rehub_post_side.read_more_custom')) {
?>
<a href="<?php
示例3: rehub_create_column
function rehub_create_column($size = 'middle')
{
?>
<article class="rething_item small_post inf_scr_item">
<?php
if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {
?>
<figure>
<?php
rehub_formats_icons('full');
?>
<span class="pattern"></span>
<?php
echo getPostLikeLink(get_the_ID());
?>
<?php
rehub_permalink();
?>
<?php
$img = get_post_thumb();
$nothumb = get_stylesheet_directory_uri() . '/images/noim.png';
if ($size == 'middle') {
$params = array('width' => 381, 'height' => 255, 'crop' => true);
} elseif ($size == 'small') {
$params = array('width' => 280, 'height' => 186, 'crop' => true);
} elseif ($size == 'big') {
$params = array('width' => 579, 'height' => 386, 'crop' => true);
} else {
$params = array('width' => 381, 'height' => 255, 'crop' => true);
}
?>
<?php
if (!empty($img)) {
?>
<img src="<?php
echo bfi_thumb($img, $params);
?>
" alt="<?php
the_title_attribute();
?>
" />
<?php
} else {
?>
<img src="<?php
echo $nothumb;
?>
" alt="<?php
the_title_attribute();
?>
" />
<?php
}
?>
</a>
</figure>
<?php
}
?>
<div class="wrap_thing">
<div class="top">
<?php
$category = get_the_category(get_the_ID());
?>
<?php
if ($category) {
$first_cat = $category[0]->term_id;
meta_small(false, $first_cat, false, false);
}
?>
</div>
<div class="hover_anons">
<h2><?php
rehub_permalink();
the_title();
?>
</a></h2>
<div class="post-meta"> <?php
meta_small(true, false, true, false);
?>
</div>
<?php
rehub_format_score('small');
?>
<p><?php
kama_excerpt('maxchar=320');
?>
</p>
</div>
<?php
rehub_create_btn('yes');
?>
</div>
</article>
<?php
}
示例4: rehub_get_woo_list
//.........這裏部分代碼省略.........
<div class="vip_corner"><span class="vip_badge sale_badge">Sale!</span></div><?php
}
?>
<div class="block_with_coupon">
<div class="offer_thumb">
<a href="<?php
echo $woolink;
?>
" target="_blank"<?php
if ($product->product_type == 'external') {
echo ' rel="nofollow"';
}
?>
><?php
wpsm_thumb('med_thumbs');
?>
</a>
</div>
<div class="desc_col">
<div class="offer_title"><a href="<?php
echo $woolink;
?>
" target="_blank"<?php
if ($product->product_type == 'external') {
echo ' rel="nofollow"';
}
?>
><?php
the_title();
?>
</a></div>
<p>
<?php
kama_excerpt('maxchar=150');
?>
<?php
$rehub_woo_review_related = get_post_meta(get_the_ID(), "review_woo_id", true);
if (!empty($rehub_woo_review_related)) {
?>
<a href="<?php
echo get_permalink($rehub_woo_review_related);
?>
" target="_blank" class="color_link"><?php
_e("Read review", "rehub_framework");
?>
</a>
<div class="clearfix"></div>
<?php
}
?>
</p>
<p>
<?php
if (in_array('yith-woocommerce-compare/init.php', apply_filters('active_plugins', get_option('active_plugins')))) {
?>
<?php
echo do_shortcode('[yith_compare_button]');
?>
<?php
}
?>
<?php
if (in_array('yith-woocommerce-wishlist/init.php', apply_filters('active_plugins', get_option('active_plugins')))) {
?>
<?php
echo do_shortcode('[yith_wcwl_add_to_wishlist]');
示例5: rehub_formats_icons
if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {
?>
<figure>
<div class="pattern"></div>
<?php
rehub_formats_icons('full');
?>
<a href="<?php
the_permalink();
?>
"><?php
wpsm_thumb('grid_news');
?>
</a>
</figure>
<?php
}
?>
<?php
}
?>
<p><?php
kama_excerpt('maxchar=320');
?>
</p>
<?php
rehub_create_btn('yes');
?>
</article>
示例6: wpsm_thumb
"><?php
wpsm_thumb('news_big');
?>
</a>
</figure>
<div class="content_constructor">
<h2><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h2>
<div class="rehub_catalog_desc">
<?php
kama_excerpt('maxchar=' . $exerpt_count . '');
?>
</div>
<?php
if ($enable_btn) {
?>
<?php
rehub_create_btn('yes');
?>
<?php
}
?>
</div>
</article>
<?php
示例7: wpsm_thumb
" target="_blank"><?php
wpsm_thumb('med_thumbs');
?>
</a>
</div>
<div class="desc_col">
<div class="offer_title"><a href="<?php
echo $woolink;
?>
" target="_blank"><?php
the_title();
?>
</a></div>
<p>
<?php
kama_excerpt('maxchar=150');
?>
<?php
$rehub_woo_review_related = get_post_meta(get_the_ID(), "review_woo_id", true);
if (!empty($rehub_woo_review_related)) {
?>
<a href="<?php
echo get_permalink($rehub_woo_review_related);
?>
" target="_blank" class="color_link"><?php
_e("Read review", "rehub_framework");
?>
</a>
<div class="clearfix"></div>
<?php
}
示例8: wpsm_toprating_shortcode
//.........這裏部分代碼省略.........
the_title_attribute();
?>
" />
<?php
} else {
?>
<img src="<?php
echo $nothumb;
?>
" alt="<?php
the_title_attribute();
?>
" />
<?php
}
?>
</a>
</figure>
</div>
<div class="desc_col">
<h2><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h2>
<p>
<?php
if ($module_desc == 'post') {
?>
<?php
kama_excerpt('maxchar=120');
?>
<?php
} elseif ($module_desc == 'review') {
?>
<?php
echo wp_kses_post(vp_metabox('rehub_post.review_post.0.review_post_summary_text'));
?>
<?php
} elseif ($module_desc == 'field') {
?>
<?php
if (get_post_meta(get_the_ID(), $module_desc_fields, true)) {
?>
<?php
echo get_post_meta(get_the_ID(), $module_desc_fields, true);
?>
<?php
}
?>
<?php
} elseif ($module_desc == 'none') {
?>
<?php
} else {
?>
<?php
kama_excerpt('maxchar=120');
?>
<?php
}
示例9: get_post_meta
<?php
$views = get_post_meta(get_the_ID(), 'views', true);
echo empty($views) ? '0' : $views;
?>
</span>
</div>
<h2 class="post_title"><?php
echo the_title();
?>
</h2>
<a href="<?php
the_permalink();
?>
" title="" class="post-shot-content">
<?php
kama_excerpt("maxchar=80");
?>
</a>
</li>
<?php
}
wp_reset_postdata();
?>
</ul>
</div>
</div>
</div>
<div class="orgs-paginate">
<?php
global $wp_query;
$total = wp_count_posts('ads')->publish;
示例10: woo_dealslinks_rehub
//.........這裏部分代碼省略.........
the_title_attribute();
?>
" />
<?php
} else {
?>
<img src="<?php
echo get_template_directory_uri();
?>
/images/default/noimage_100_70.png" alt="<?php
the_title_attribute();
?>
" />
<?php
}
?>
</a>
</div>
<div class="product-details">
<div class="product-name">
<div class="aff_name"><a href="<?php
echo $woolink;
?>
" target="_blank"<?php
if ($product->product_type == 'external') {
echo ' rel="nofollow"';
}
?>
><?php
the_title();
?>
</a></div>
<p><?php
kama_excerpt('maxchar=150');
?>
</p>
</div>
<div class="left_data_aff">
<div class="wooprice_count">
<?php
if ($product->get_price() != '') {
?>
<?php
echo $product->get_price_html();
?>
<?php
}
?>
</div>
<div class="wooaff_tag">
<?php
if (!empty($term_brand_image['brand_image'])) {
?>
<img src="<?php
$params = array('width' => 100, 'height' => 100);
echo bfi_thumb($term_brand_image['brand_image'], $params);
?>
" alt="<?php
the_title_attribute();
?>
" />
<?php
} elseif (!empty($term_list[0])) {
?>
示例11: get_the_category
$category = get_the_category(get_the_ID());
$first_cat = $category[0]->term_id;
meta_small(false, $first_cat, false, false);
?>
</div>
</div>
<h2><?php
rehub_permalink();
the_title();
?>
</a></h2>
<div class="hero-description"><?php
if ($dis_exerpt != '1') {
?>
<p><?php
kama_excerpt('maxchar=100');
?>
</p><?php
}
?>
</div>
<?php
rehub_create_btn('yes');
?>
</div>
</div>
</li>
<?php
}
}
wp_reset_query();
示例12: the_permalink
<?php
}
?>
<h2><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h2>
<?php
if ($catalog_desc != '') {
?>
<div class="rehub_catalog_desc">
<?php
kama_excerpt('maxchar=' . $catalog_desc . '');
?>
</div>
<?php
}
?>
<?php
if ($catalog_fields[0]['catalog_fields_name'] != '') {
?>
<div class="rehub_catalog_fields">
<?php
$count = 1;
foreach ($catalog_fields as $catalog_field) {
?>
示例13: the_title_shorten
?>
</a>
</div>
<?php
}
?>
<h2><?php
the_title_shorten(50);
?>
</h2>
<a href="<?php
the_permalink();
?>
" title=""
class="post-shot-content"><?php
kama_excerpt("maxchar=200");
?>
</a>
<div class="post-time-view">
<?php
echo get_date_formatted(get_the_date('d.m.Y.H.i'), 'v');
?>
<span class="comments"><i class="comment-ico"></i>
<?php
comments_number('0', '1', '%');
?>
</span>
<span class="view"><i class="view-ico"></i>
<?php
$views = get_post_meta(get_the_ID(), 'views', true);
示例14: rehub_get_review
function rehub_get_review()
{
?>
<?php
$postAverage = get_post_meta(get_the_ID(), 'post_user_average', true);
?>
<?php
$user_rates = get_post_meta(get_the_ID(), 'post_user_raitings', true);
if (!empty($user_rates)) {
$usercriterias = $user_rates['criteria'];
}
?>
<?php
if ($postAverage != '0' && $postAverage != '') {
?>
<div class="rate_bar_wrap only_user_reviews<?php
if (rehub_option('color_type_review') == 'multicolor') {
echo ' colored_rate_bar';
}
?>
">
<meta itemprop="description" content="<?php
kama_excerpt('maxchar=200');
?>
">
<meta itemprop="url" content="<?php
the_permalink();
?>
">
<span class="user-reviews-title"><?php
the_title();
?>
</span>
<div class="total-score-users-head">
<div class="review-top" itemprop="aggregateRating" itemscope="" itemtype="http://schema.org/AggregateRating">
<div class="overall-score">
<span>
<span class="overall r_score_<?php
echo round($postAverage);
?>
" itemprop="ratingValue"><?php
echo round($postAverage, 1);
?>
</span>
<span class="overall-text"><?php
_e('Total Score', 'rehub_framework');
?>
</span>
<meta itemprop="bestRating" content="10"/>
<meta itemprop="worstRating" content="1"/>
</span>
</div>
<div class="overall-votes"><span itemprop="ratingCount"><?php
echo $user_rates['criteria'][0]['count'];
?>
</span> <?php
_e('reviews', 'rehub_framework');
?>
</div>
<a href="#respond" class="rehub_scroll add_user_review_link"><?php
_e("Add your review", "rehub_framework");
?>
</a>
</div>
</div>
<div class="review-criteria user-review-criteria">
<div class="r_criteria">
<?php
foreach ($usercriterias as $usercriteria) {
?>
<?php
$perc_criteria = $usercriteria['average'] * 10;
?>
//.........這裏部分代碼省略.........
示例15: get_more_posts
function get_more_posts()
{
$nonce = $_POST['nonce'];
$qObjId = $_POST['term'];
$tax = $_POST['tax'];
$pType = $_POST['pType'];
$offset = intval($_POST['offset']);
$limit = intval($_POST['limit']);
if (!wp_verify_nonce($nonce, 'ajax-nonce') || $offset == 0 || ($limit == 0 || $limit > 50) || is_array($offset)) {
wp_die();
}
$types = get_post_types(array('public' => true), 'names');
if (!in_array($pType, $types)) {
wp_die();
}
$params = array('post_type' => $pType, 'posts_per_page' => $limit, 'offset' => $offset);
$taxes = array('ncategory', 'ntag', 'adscategory', 'catcategory');
if (!empty($tax) && in_array($tax, $taxes)) {
if ($qObjId == 0 || is_array($qObjId)) {
wp_die();
}
$params['tax_query'][] = array('taxonomy' => $tax, 'field' => 'id', 'terms' => $qObjId);
}
$posts = get_posts($params);
$output = array();
foreach ($posts as $post) {
$row = array();
$row['title'] = htmlspecialchars($post->post_title);
$row['date'] = get_date_formatted(date_format(new DateTime($post->post_date), 'd.m.Y.H.i'));
$row['link'] = get_permalink($post->ID);
if ($post->post_type == 'news' || $post->post_type == 'ads') {
$views = get_post_meta($post->ID, 'views', true);
$row['views'] = empty($views) ? '0' : $views;
if (has_post_thumbnail($post->ID)) {
$img_url = wp_get_attachment_url(get_post_thumbnail_id($post->ID), 'full');
$sizes = $post->post_type == 'news' ? array(60, 60) : array(96, 75);
$row['src'] = aq_resize($img_url, $sizes[0], $sizes[1], true);
} else {
$row['src'] = $post->post_type == 'news' ? null : get_template_directory_uri() . '/images/blank_image.png';
}
if ($post->post_type == 'news') {
$row['comments'] = get_comments_number($post->ID);
}
if ($post->post_type == 'ads') {
$row['short'] = htmlspecialchars(kama_excerpt("maxchar=80&echo", $post));
}
}
if ($post->post_type == 'catalog' || $post->post_type == 'ads') {
$location = get_the_terms($post->ID, 'nlocation');
if ($location) {
$location = array_shift($location);
$row['location'] = $location->name;
} else {
$row['location'] = "Уральск";
}
if ($post->post_type == 'catalog') {
$contact = get_post_meta($post->ID, 'catalog_contacts', true);
preg_match('#\\d+-\\d+-\\d+|\\d+ \\d+ \\d+|\\d+#ui', $contact, $phone_arr);
$row['contact'] = count($phone_arr) > 0 ? $phone_arr[0] : ' - ';
}
}
$output[] = $row;
}
exit(json_encode($output));
}