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

PHP wp_trim_excerpt函数代码示例

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

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



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

示例1: ua_webtide_add_twitter_card

function ua_webtide_add_twitter_card()
{
    global $post;
    // Get our description - use Facebook OG
    $description = isset($post) && isset($post->ID) ? get_post_meta($post->ID, '_yoast_wpseo_opengraph-description', true) : NULL;
    // If no OG description, get excerpt
    if (!$description && isset($post->post_excerpt)) {
        $description = wp_trim_excerpt($post->post_excerpt);
    }
    // Get the image
    $image = isset($post) && isset($post->ID) ? get_post_meta($post->ID, '_yoast_wpseo_opengraph-image', true) : 'https://webtide.ua.edu/wp-content/uploads/wwWebTide-logo-fb-og-w-c.png';
    ?>
<meta name="twitter:card" content="summary_large_image">
	<meta name="twitter:site" content="@bamawebtide">
	<meta name="twitter:title" content="<?php 
    echo get_bloginfo('name');
    ?>
" />
	<meta name="twitter:description" content="<?php 
    echo $description;
    ?>
">
	<meta name="twitter:image:src" content="<?php 
    echo $image;
    ?>
"><?php 
}
开发者ID:bamawebtide,项目名称:webtide-plugin,代码行数:27,代码来源:social.php


示例2: test_secondary_loop_respect_nextpage

 /**
  * @ticket 25349
  */
 public function test_secondary_loop_respect_nextpage()
 {
     $post1 = self::factory()->post->create(array('post_content' => 'Post 1 Page 1<!--nextpage-->Post 1 Page 2'));
     $post2 = self::factory()->post->create(array('post_content' => 'Post 2 Page 1<!--nextpage-->Post 2 Page 2'));
     $this->go_to('/?p=' . $post1);
     setup_postdata(get_post($post1));
     $q = new WP_Query(array('post__in' => array($post2)));
     if ($q->have_posts()) {
         while ($q->have_posts()) {
             $q->the_post();
             $this->assertSame('Post 2 Page 1', wp_trim_excerpt());
         }
     }
 }
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:17,代码来源:WpTrimExcerpt.php


示例3: modify

 function modify($posts, $type)
 {
     if (count($posts) > 0) {
         foreach ($posts as $pos => $post) {
             if ($type == 'excerpt') {
                 $posts[$pos]->post_content = wp_trim_excerpt($post->post_content);
             } else {
                 if ($type == 'content') {
                     $posts[$pos]->post_excerpt = $post->post_content;
                 }
             }
         }
     }
     return $posts;
 }
开发者ID:blueblazeassociates,项目名称:headspace2,代码行数:15,代码来源:page_counts.php


示例4: fetch_exporter

 /**
  * Fetches an instance of Exporter.
  *
  * @return Exporter
  * @access public
  */
 public function fetch_exporter()
 {
     do_action('apple_news_do_fetch_exporter', $this->id);
     // Fetch WP_Post object, and all required post information to fill up the
     // Exporter_Content instance.
     $post = get_post($this->id);
     // Build the excerpt if required
     $excerpt = empty($post->post_excerpt) ? wp_trim_excerpt($post->post_content) : $post->post_excerpt;
     // Get the post thumbnail
     $post_thumb = wp_get_attachment_url(get_post_thumbnail_id($this->id)) ?: null;
     // Get the author
     $author = ucfirst(get_the_author_meta('display_name', $post->post_author));
     // Set the default date format
     $date_format = 'M j, Y | g:i A';
     // Check for a custom byline format
     $byline_format = $this->get_setting('byline_format');
     if (!empty($byline_format)) {
         // Find and replace the author format placeholder the name, if set
         $byline = str_replace('#author#', $author, $byline_format);
         // Attempt to parse the date format from the remaining string
         $matches = array();
         preg_match('/#(.*?)#/', $byline, $matches);
         if (!empty($matches[1])) {
             // Set the date using the custom format
             $byline = str_replace($matches[0], date($matches[1], strtotime($post->post_date)), $byline);
         }
     } else {
         // Use the default format
         $byline = sprintf('by %1$s | %2$s', $author, date($date_format, strtotime($post->post_date)));
     }
     // Filter each of our items before passing into the exporter class.
     $title = apply_filters('apple_news_exporter_title', $post->post_title, $post->ID);
     $excerpt = apply_filters('apple_news_exporter_excerpt', $excerpt, $post->ID);
     $post_thumb = apply_filters('apple_news_exporter_post_thumb', $post_thumb, $post->ID);
     $date = apply_filters('apple_news_exporter_date', $date, $post->ID);
     $byline = apply_filters('apple_news_exporter_byline', $byline, $post->ID);
     // The post_content is not raw HTML, as WordPress editor cleans up
     // paragraphs and new lines, so we need to transform the content to
     // HTML. We use 'the_content' filter for that.
     $content = apply_filters('apple_news_exporter_content_pre', $post->post_content, $post->ID);
     $content = apply_filters('the_content', $content);
     $content = apply_filters('apple_news_exporter_content', $content, $post->ID);
     // Now pass all the variables into the Exporter_Content array.
     $base_content = new Exporter_Content($post->ID, $title, $content, $excerpt, $post_thumb, $byline, $this->fetch_content_settings());
     return new Exporter($base_content, null, $this->settings);
 }
开发者ID:norcross,项目名称:apple-news,代码行数:52,代码来源:class-export.php


示例5: pagebuilder_tags

 public function pagebuilder_tags($tags)
 {
     // Page Builder stuff
     if (class_exists('ModularPageBuilder\\Plugin') && is_singular()) {
         $mpb = \ModularPageBuilder\Plugin::get_instance();
         $builder = $mpb->get_builder('modular-page-builder');
         $html = $builder->get_rendered_data(get_the_ID(), $builder->id . '-data');
         if (empty($tags['og:description'])) {
             $tags['og:description'] = wp_trim_excerpt(strip_tags($html));
         }
         foreach ($builder->get_raw_data(get_the_ID()) as $module_args) {
             if ($module = $mpb->init_module($module_args['name'], $module_args)) {
                 if ('image' === $module_args['name'] && !has_post_thumbnail()) {
                     $tags['og:image'] = $module->get_json()['image'][0][0];
                     break;
                 }
             }
         }
     }
     return $tags;
 }
开发者ID:tomjal,项目名称:feelingrestful-theme,代码行数:21,代码来源:class-opengraph.php


示例6: easy_t_get_single_testimonial_html

function easy_t_get_single_testimonial_html($postid, $atts, $is_single = false)
{
    //for use in the filter
    $atts['is_single'] = $is_single;
    //if this is being loaded from the single post view
    //then we already have the post data setup (we are in The Loop)
    //so skip this step
    if (!$is_single) {
        global $post;
        $post = get_post($postid, OBJECT);
        setup_postdata($post);
    }
    extract($atts);
    ob_start();
    $testimonial['date'] = get_the_date('M. j, Y');
    if ($use_excerpt) {
        $testimonial['content'] = get_the_excerpt();
    } else {
        $testimonial['content'] = get_the_content();
    }
    //load rating
    //if set, append english text to it
    $testimonial['rating'] = get_post_meta($postid, '_ikcf_rating', true);
    $testimonial['num_stars'] = '';
    //reset num stars (Thanks Steve@IntegrityConsultants!)
    if (strlen($testimonial['rating']) > 0) {
        $rating_css = easy_testimonials_build_typography_css('easy_t_rating_');
        $testimonial['num_stars'] = $testimonial['rating'];
        $testimonial['rating'] = '<p class="easy_t_ratings" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" style="' . $rating_css . '"><meta itemprop="worstRating" content = "1"/><span itemprop="ratingValue" >' . $testimonial['rating'] . '</span>/<span itemprop="bestRating">5</span> Stars.</p>';
    }
    //if nothing is set for the short content, use the long content
    if (strlen($testimonial['content']) < 2) {
        //$temp_post_content = get_post($postid);
        $testimonial['content'] = $post->post_excerpt;
        if ($use_excerpt) {
            if ($testimonial['content'] == '') {
                $testimonial['content'] = wp_trim_excerpt($post->post_content);
            }
        } else {
            $testimonial['content'] = $post->post_content;
        }
    }
    if (strlen($show_rating) > 2) {
        if ($show_rating == "before") {
            $testimonial['content'] = $testimonial['rating'] . ' ' . $testimonial['content'];
        }
        if ($show_rating == "after") {
            $testimonial['content'] = $testimonial['content'] . ' ' . $testimonial['rating'];
        }
    }
    if ($show_thumbs) {
        $testimonial['image'] = build_testimonial_image($postid);
    }
    $testimonial['client'] = get_post_meta($postid, '_ikcf_client', true);
    $testimonial['position'] = get_post_meta($postid, '_ikcf_position', true);
    $testimonial['other'] = get_post_meta($postid, '_ikcf_other', true);
    build_single_testimonial($testimonial, $show_thumbs, $show_title, $postid, $author_class, $body_class, $testimonials_link, $theme, $show_date, $show_rating, $show_other, $width, $is_single);
    wp_reset_postdata();
    $content = ob_get_contents();
    ob_end_clean();
    return apply_filters('easy_t_get_single_testimonial_html', $content, $testimonial, $atts, $postid);
}
开发者ID:phanhoanglong2610,项目名称:anc_gvn,代码行数:62,代码来源:easy-testimonials.php


示例7: bloginfo

			<td><a href="<?php 
                bloginfo('url');
                ?>
/wp-admin/admin.php?page=bblm_plugin/pages/bb.admin.manage.dyk.php&action=edit&item=dyk&id=<?php 
                print "{$d->dyk_id}";
                ?>
" title="Edit this Did You Know"><?php 
                if ("none" !== $d->dyk_title) {
                    print "{$d->dyk_title}";
                } else {
                    print "Edit";
                }
                ?>
</a></td>
			<td><?php 
                print wp_trim_excerpt("{$d->dyk_desc}");
                ?>
</td>
<?php 
                if ($d->dyk_type) {
                    print "\t\t\t<td>Trivia</td>\n";
                } else {
                    print "\t\t\t<td>Fact</td>\n";
                }
                if ($d->dyk_show) {
                    print "\t\t\t<td><a href=\"";
                    bloginfo('url');
                    print "/wp-admin/admin.php?page=bblm_plugin/pages/bb.admin.manage.dyk.php&action=edit&item=activate&id=" . $d->dyk_id . "\" title=\"Deactivate this Did You Know\">Deactivate</td>\n";
                } else {
                    print "\t\t\t<td><a href=\"";
                    bloginfo('url');
开发者ID:blacksnotling,项目名称:hdwsbbl,代码行数:31,代码来源:bb.admin.manage.dyk.php


示例8: widget

    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        $items_num = apply_filters('widget_items_num', empty($instance['items_num']) ? 3 : intval($instance['items_num']), $instance);
        if ($items_num < 1) {
            $items_num = 3;
        }
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        // end if title empty
        // query events
        $date_time_now = time();
        // to compare with
        $q_events = new WP_Query(array('post_type' => 'event', 'order' => 'ASC', 'orderby' => 'meta_value_num', 'meta_key' => '_order', 'posts_per_page' => $items_num, 'meta_query' => array(array('key' => '_finito', 'value' => $date_time_now, 'compare' => '>', 'type' => 'NUMERIC'))));
        if ($q_events->have_posts()) {
            ?>
		
		<ul class="list-unstyled">
		
		<?php 
            while ($q_events->have_posts()) {
                $q_events->the_post();
                ?>
			
            <li class="up-event-wrap">
                <h1 class="title-median">
                	<a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title_attribute(array('before' => 'Permalink to: ', 'after' => ''));
                ?>
">
                	<?php 
                the_title();
                ?>
                	</a>
                </h1>
            	<?php 
                $event_start_date = vp_metabox('event.event_from');
                $event_end_date = vp_metabox('event.event_to');
                $event_start_time = vp_metabox('event.event_time_start');
                $event_end_time = vp_metabox('event.event_time_end');
                ?>
                <div class="up-event-meta clearfix">
                <?php 
                if ($event_start_date) {
                    ?>
<div class="up-event-date"><?php 
                    echo date_i18n(get_option('date_format'), strtotime($event_start_date));
                    ?>
</div><?php 
                }
                ?>
                <?php 
                if ($event_end_date) {
                    ?>
<div class="up-event-date"><?php 
                    echo date_i18n(get_option('date_format'), strtotime($event_end_date));
                    ?>
</div><?php 
                }
                ?>
                <?php 
                if ($event_start_time) {
                    ?>
<div class="up-event-time"><?php 
                    echo $event_start_time;
                    if ($event_end_time) {
                        echo ' - ' . $event_end_time;
                    }
                    ?>
</div><?php 
                }
                ?>
                </div>
                <p><?php 
                echo wp_trim_excerpt();
                ?>
</p>
            </li>
			
        <?php 
            }
            ?>
        
        </ul>
        
        <?php 
        } else {
            echo '<p>' . __('No Upcoming Events found!', 'kazaz') . '<p>';
        }
        wp_reset_query();
        // drop current query
        echo $after_widget;
    }
开发者ID:CUPolishSociety,项目名称:campolsoc,代码行数:99,代码来源:theme_widgets.php


示例9: esc_url

        ?>
    <div class="item">
        <a href="<?php 
        echo esc_url(get_permalink());
        ?>
">
            <?php 
        if (has_post_thumbnail()) {
            echo woocommerce_get_product_thumbnail('shop_catalog');
        }
        ?>
        </a>
        <div class="carousel-caption">
            <?php 
        the_title(sprintf('<h6 class="product-title"><a href="%s">', esc_url(get_permalink())), '</a></h6>');
        ?>
            <?php 
        echo woocommerce_get_template('loop/price.php');
        ?>
            <?php 
        echo '<p>' . wp_trim_excerpt() . '</p>';
        ?>
        </div>
    </div>
<?php 
    }
    wp_reset_postdata();
}
?>
</div><!-- /.carousel -->
开发者ID:Roman921,项目名称:Step-21,代码行数:30,代码来源:image-carousel.php


示例10: tech_social_icons

/**
 * Techozoic Social Media Icons Function
 *
 * Echos the social media icon links and images as set in options.
 * 
 * 
 * @param       bool    function called from home page or single page
 *
 * @access    public
 * @since     1.8.8
 */
function tech_social_icons($home = true)
{
    global $tech, $post;
    $short_link = home_url() . "/?p=" . $post->ID;
    $home_icons = of_get_option('home_social_icons', array('delicious' => '1', 'digg' => '1', 'rss' => '1'));
    $single_icons = of_get_option('single_social_icons', array('delicious' => '1', 'digg' => '1', 'rss' => '1'));
    $image = get_template_directory_uri() . "/images/icons";
    $link = get_permalink();
    $title = $post->post_title;
    $email_title = preg_replace('/&/i', 'and', $title);
    $url_title = urlencode($post->post_title);
    $excerpt = urlencode(wp_trim_excerpt($post->post_excerpt));
    $excerpt_mail = wp_trim_excerpt($post->post_excerpt);
    $excerpt_mail = preg_replace("/&#?[a-z0-9]{2,8};/i", "", $excerpt_mail);
    $home_title = urlencode(get_bloginfo('name'));
    $social_links = array("delicious" => "<a href=\"http://delicious.com/post?url={$link}&amp;title={$url_title}\" title=\"" . __('del.icio.us this!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/delicious_16.png\" alt=\"" . __('del.icio.us this!', 'techozoic') . "\" /></a>", "digg" => "<a href=\"http://digg.com/submit?phase=2&amp;url={$link}&amp;title={$url_title} \" title=\"" . __('Digg this!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/digg_16.png\" alt=\"" . __('Digg this!', 'techozoic') . "\"/></a>", "email" => "<a href=\"mailto:?subject={$email_title}&amp;body={$excerpt_mail} {$link}\" title=\"" . __('Share this by email.', 'techozoic') . "\"><img src=\"{$image}/email_16.png\" alt=\"" . __('Share this by email.', 'techozoic') . "\"/></a>", "facebook" => "<a href=\"http://www.facebook.com/share.php?u={$link}&amp;t={$url_title}\" title=\"" . __('Share on Facebook!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/facebook_16.png\" alt=\"" . __('Share on Facebook!', 'techozoic') . "\"/></a>", "linkedin" => "<a href =\"http://www.linkedin.com/shareArticle?mini=true&amp;url={$link}&amp;title={$url_title}&amp;summary={$excerpt}&amp;source={$home_title}\" title=\"" . __('Share on LinkedIn!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/linkedin_16.png\" alt=\"" . __('Share on LinkedIn!', 'techozoic') . "\" /></a>", "myspace" => "<a href=\"http://www.myspace.com/Modules/PostTo/Pages/?u={$link}&amp;t={$url_title}\" title=\"" . __('Share on Myspace!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/myspace_16.png\" alt=\"" . __('Share on Myspace!', 'techozoic') . "\"/></a>", "newsvine" => "<a href=\"http://www.newsvine.com/_tools/seed&amp;save?u={$link}\" title=\"" . __('Share on NewsVine!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/newsvine_16.png\" alt=\"" . __('Share on NewsVine!', 'techozoic') . "\"/></a>", "stumbleupon" => "<a href=\"http://www.stumbleupon.com/submit?url={$link}&amp;title={$url_title}\" title=\"" . __('Stumble Upon this!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/stumbleupon_16.png\" alt=\"" . __('Stumble Upon this!', 'techozoic') . "\"/></a>", "twitter" => "<a href=\"http://twitter.com/home?status=Reading%20{$url_title}%20on%20{$short_link}\" title=\"" . __('Tweet this!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/twitter_16.png\" alt=\"" . __('Tweet this!', 'techozoic') . "\"/></a>", "reddit" => "<a href=\"http://reddit.com/submit?url={$link}&amp;title={$url_title}\" title=\"" . __('Share on Reddit!', 'techozoic') . "\" target=\"_blank\"><img src=\"{$image}/reddit_16.png\" alt=\"" . __('Share on Reddit!', 'techozoic') . "\" /></a>", "rss" => "<a href=\"" . get_post_comments_feed_link() . "\" title=\"" . __('Subscribe to Feed', 'techozoic') . "\"><img src=\"{$image}/rss_16.png\" alt=\"" . __('RSS 2.0', 'techozoic') . "\"/></a>", "google" => "<g:plusone size=\"small\" annotation=\"none\" expandto=\"right\" href=\"{$link}\"></g:plusone>");
    if ($home == true) {
        if (is_array($home_icons)) {
            foreach ($home_icons as $key => $value) {
                if ($value == "1") {
                    echo $social_links[$key] . "&nbsp;";
                }
            }
        }
    } else {
        if (is_array($single_icons)) {
            foreach ($single_icons as $key => $value) {
                if ($value == "1") {
                    echo $social_links[$key] . "&nbsp;";
                }
            }
        }
    }
}
开发者ID:ruby4web,项目名称:Techozoic-Fluid,代码行数:45,代码来源:functions.php


示例11: sc_upcoming_events

function sc_upcoming_events($atts, $content = NULL)
{
    extract(shortcode_atts(array('section_title' => '', 'items_number' => 3), $atts));
    $output = '';
    $ppp = 3;
    if (!empty($items_number)) {
        $ppp = intval($items_number);
    }
    if ($ppp < 1) {
        $ppp = 3;
    }
    if (!empty($section_title)) {
        $output .= '<h1 class="title-widget">' . esc_attr($section_title) . '</h1>';
    }
    // query events
    $date_time_now = time();
    // to compare with
    $q_events = new WP_Query(array('post_type' => 'event', 'order' => 'ASC', 'orderby' => 'meta_value_num', 'meta_key' => '_order', 'posts_per_page' => $ppp, 'meta_query' => array(array('key' => '_finito', 'value' => $date_time_now, 'compare' => '>', 'type' => 'NUMERIC'))));
    if (!$q_events->have_posts()) {
        $output .= '<div class="alert alert-danger">' . __('No entries found!', 'kazaz') . '</div>';
    } else {
        $output .= '<ul class="list-unstyled">';
        while ($q_events->have_posts()) {
            $q_events->the_post();
            $output .= '<li class="up-event-wrap">';
            $output .= '<h1 class="title-median">';
            $output .= '<a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '">';
            $output .= esc_attr(get_the_title());
            $output .= '</a>';
            $output .= '</h1>';
            // grab meta...
            $event_start_date = vp_metabox('event.event_from');
            $event_end_date = vp_metabox('event.event_to');
            $event_start_time = vp_metabox('event.event_time_start');
            $event_end_time = vp_metabox('event.event_time_end');
            $output .= '<div class="up-event-meta clearfix">';
            if ($event_start_date) {
                $output .= '<div class="up-event-date">' . date_i18n(get_option('date_format'), strtotime($event_start_date)) . '</div>';
            }
            if ($event_end_date) {
                $output .= '<div class="up-event-date">' . date_i18n(get_option('date_format'), strtotime($event_end_date)) . '</div>';
            }
            if ($event_start_time) {
                $output .= '<div class="up-event-time">' . $event_start_time;
                if ($event_end_time) {
                    $output .= ' - ' . $event_end_time;
                }
                $output .= '</div>';
            }
            $output .= '</div>';
            $output .= '<p>' . wp_trim_excerpt() . '</p>';
            $output .= '</li>';
        }
        $output .= '</ul>';
    }
    wp_reset_query();
    // drop current query
    return $output;
}
开发者ID:CUPolishSociety,项目名称:campolsoc,代码行数:59,代码来源:shortcodes_engine.php


示例12: _theme_action_update_seo_tags

 /**
  * Update the SEO key tags values on wordpress "wp" action,
  * such as %%title%%, %%excerpt%%, values can only be initialised after "wp" action
  * @internal
  */
 public function _theme_action_update_seo_tags($location)
 {
     if (empty($this->seo_tags)) {
         $this->get_seo_tags();
     }
     switch ($location['type']) {
         case 'search':
             $this->seo_tags['searchphrase']['value'] = get_search_query();
             $this->seo_tags['pagenumber'] = $location['paged'];
             $this->seo_tags['max_page'] = $location['max_pages'];
             break;
         case 'author_archive':
             $this->seo_tags['author_id']['value'] = get_query_var('author');
             $this->seo_tags['author_name']['value'] = get_the_author_meta('nickname', get_query_var('author'));
             $this->seo_tags['pagenumber'] = $location['paged'];
             $this->seo_tags['max_page'] = $location['max_pages'];
             break;
         case 'date_archive':
             $this->seo_tags['pagenumber'] = $location['paged'];
             $this->seo_tags['max_page'] = $location['max_pages'];
             break;
         case 'front_page':
             $this->seo_tags['pagenumber'] = $location['paged'];
             $this->seo_tags['max_page'] = $location['max_pages'];
             break;
         case 'blog_page':
             $this->seo_tags['pagenumber'] = $location['paged'];
             $this->seo_tags['max_page'] = $location['max_pages'];
             break;
         case 'singular':
             global $post;
             $this->seo_tags['date']['value'] = get_the_date();
             $this->seo_tags['title']['value'] = get_the_title();
             $this->seo_tags['excerpt']['value'] = has_excerpt() ? get_the_excerpt() : wp_trim_excerpt();
             $this->seo_tags['excerpt_only']['value'] = has_excerpt() ? get_the_excerpt() : '';
             $this->seo_tags['modified']['value'] = $post->post_modified;
             $this->seo_tags['id']['value'] = $post->ID;
             $this->seo_tags['author_id']['value'] = $post->post_author;
             $this->seo_tags['author_name']['value'] = get_the_author_meta('nickname', $post->post_author);
             if ($location['post_type'] == 'attachment') {
                 $this->seo_tags['caption']['value'] = has_excerpt() ? get_the_excerpt() : '';
             }
             $categories = wp_get_post_categories($post->ID);
             foreach ($categories as $cat_id) {
                 $category = get_category($cat_id);
                 $this->seo_tags['post_categories']['value'] .= $category->name . ', ';
             }
             $this->seo_tags['post_categories']['value'] = rtrim($this->seo_tags['post_categories']['value'], ', ');
             $tags = wp_get_post_tags($post->ID);
             foreach ($tags as $tag_id) {
                 $tag = get_tag($tag_id);
                 $this->seo_tags['post_tags']['value'] .= $tag->name . ', ';
             }
             $this->seo_tags['post_tags']['value'] = rtrim($this->seo_tags['post_tags']['value'], ', ');
             break;
         case 'tag':
             $this->seo_tags['title']['value'] = single_term_title('', false);
             $this->seo_tags['description']['value'] = term_description($location['id'], $location['taxonomy_type']);
             $this->seo_tags['pagenumber'] = $location['paged'];
             $this->seo_tags['max_page'] = $location['max_pages'];
             break;
         case 'category':
             $this->seo_tags['title']['value'] = single_term_title('', false);
             $this->seo_tags['description']['value'] = term_description($location['id'], $location['taxonomy_type']);
             $this->seo_tags['pagenumber'] = $location['paged'];
             $this->seo_tags['max_page'] = $location['max_pages'];
             break;
         case 'taxonomy':
             $this->seo_tags['title']['value'] = single_term_title('', false);
             $this->seo_tags['description']['value'] = term_description($location['id'], $location['taxonomy_type']);
             $this->seo_tags['pagenumber'] = $location['paged'];
             $this->seo_tags['max_page'] = $location['max_pages'];
             break;
     }
     $this->seo_tags = apply_filters('fw_ext_seo_update_tags', $this->seo_tags, $location);
 }
开发者ID:AdsonCicilioti,项目名称:Unyson,代码行数:81,代码来源:class-fw-extension-seo.php


示例13: get_post

 private function get_post($post, $params)
 {
     $attachments = array('images' => array(), 'videos' => array(), 'audio' => array());
     $this->attachments =& $attachments;
     $is_user_logged_in = isset($params['session_id']);
     $include_raw_post = isset($params['include_raw_post']);
     $is_reqistration_required = '1' == get_option('comment_registration');
     $remaped_post = $this->array_remap_keys($post, array('ID' => 'post_id', 'post_date_gmt' => 'published_at', 'post_title' => 'title', 'post_excerpt' => 'summary', 'post_content' => 'body', 'comment_status' => 'commentable', 'comment_count' => 'comments_count'));
     $post_categories = wp_get_post_categories($remaped_post['post_id']);
     $categories = array();
     $tags = array();
     foreach ($post_categories as $category) {
         $cat = get_category($category);
         $categories[] = array('id' => $cat->cat_ID, 'name' => $cat->name);
     }
     $remaped_post['categories'] = $categories;
     //*** ACTION  shoutem_get_post_start ***//
     //Integration with external plugins will usually hook to this action to
     //substitute shortcodes or generate appropriate attachments from the content.
     //For example: @see ShoutemNGGDao, @see ShoutemFlaGalleryDao.
     do_action('shoutem_get_post_start', array('wp_post' => $post, 'attachments_ref' => &$attachments));
     $body = apply_filters('the_content', do_shortcode($remaped_post['body']));
     if ($include_raw_post) {
         $remaped_post['raw_post'] = $body;
     }
     $striped_attachments = array();
     $remaped_post['body'] = sanitize_html($body, $striped_attachments);
     $user_data = get_userdata($post->post_author);
     $remaped_post['author'] = $user_data->display_name;
     $remaped_post['likeable'] = 0;
     $remaped_post['likes_count'] = 0;
     $remaped_post['link'] = get_permalink($remaped_post['post_id']);
     $this->include_leading_image_in_attachments($attachments, $post->ID);
     $attachments['images'] = array_merge($attachments['images'], $striped_attachments['images']);
     $attachments['videos'] = array_merge($attachments['videos'], $striped_attachments['videos']);
     $attachments['audio'] = array_merge($attachments['audio'], $striped_attachments['audio']);
     sanitize_attachments($attachments);
     $remaped_post['attachments'] = $attachments;
     $remaped_post['image_url'] = '';
     $images = $attachments['images'];
     if (count($images) > 0) {
         $remaped_post['image_url'] = $images[0]['src'];
     }
     $post_commentable = $remaped_post['commentable'] == 'open';
     if (!$this->options['enable_wp_commentable']) {
         $remaped_post['commentable'] = 'no';
     } else {
         if (array_key_exists('commentable', $params)) {
             $remaped_post['commentable'] = $params['commentable'];
         } else {
             $remaped_post['commentable'] = $this->get_commentable($post_commentable, $is_user_logged_in, $is_reqistration_required);
         }
     }
     if ($this->options['enable_fb_commentable']) {
         $remaped_post['fb_commentable'] = 'yes';
     }
     if (!$remaped_post['summary']) {
         $remaped_post['summary'] = wp_trim_excerpt(apply_filters('the_excerpt', get_the_excerpt()));
         $remaped_post['summary'] = html_to_text($remaped_post['summary']);
     }
     $remaped_post['title'] = html_to_text($remaped_post['title']);
     $remaped_posts[] = $remaped_post;
     return $remaped_post;
 }
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:64,代码来源:class-shoutem-posts-dao.php


示例14: outputTestimonialsCycle


//.........这里部分代码省略.........
        ?>
 data-cycle-paused="true" <?php 
    }
    ?>
		<?php 
    if ($prev_next) {
        ?>
 data-cycle-prev=".easy-t-cycle-prev"  data-cycle-next=".easy-t-cycle-next" <?php 
    }
    ?>
	>
	<?php 
    $counter = 0;
    //load testimonials into an array
    $loop = new WP_Query(array('post_type' => 'testimonial', 'posts_per_page' => $count, 'orderby' => $orderby, 'order' => $order, 'easy-testimonial-category' => $category));
    while ($loop->have_posts()) {
        $loop->the_post();
        if ($counter == 0) {
            $testimonial_display = '';
        } else {
            $testimonial_display = 'style="display:none;"';
        }
        if ($counter % $testimonials_per_slide == 0) {
            ?>
<div <?php 
            echo $testimonial_display;
            ?>
 class="testimonial_slide"><?php 
        }
        $counter++;
        $postid = get_the_ID();
        $testimonial['date'] = get_the_date('M. j, Y');
        //if nothing is set for the short content, use the long content
        if ($use_excerpt) {
            $testimonial['content'] = get_the_excerpt();
        } else {
            $testimonial['content'] = get_the_content();
        }
        //load rating
        //if set, append english text to it
        $testimonial['rating'] = get_post_meta($postid, '_ikcf_rating', true);
        $testimonial['num_stars'] = '';
        //reset num stars (Thanks Steve@IntegrityConsultants!)
        if (strlen($testimonial['rating']) > 0) {
            $testimonial['num_stars'] = $testimonial['rating'];
            $testimonial['rating'] = '<p class="easy_t_ratings" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"><meta itemprop="worstRating" content = "1"/><span itemprop="ratingValue">' . $testimonial['rating'] . '</span>/<span itemprop="bestRating">5</span> Stars.</p>';
            //$testimonial['rating'] = '<span class="easy_t_ratings">' . $testimonial['rating'] . '/5 Stars.</span>';
        }
        //if nothing is set for the short content, use the long content
        if (strlen($testimonial['content']) < 2) {
            $temp_post_content = get_post($postid);
            $testimonial['content'] = $temp_post_content->post_excerpt;
            if ($use_excerpt) {
                if ($testimonial['content'] == '') {
                    $testimonial['content'] = wp_trim_excerpt($temp_post_content->post_content);
                }
            } else {
                $testimonial['content'] = $temp_post_content->post_content;
            }
        }
        if (strlen($show_rating) > 2) {
            if ($show_rating == "before") {
                $testimonial['content'] = $testimonial['rating'] . ' ' . $testimonial['content'];
            }
            if ($show_rating == "after") {
                $testimonial['content'] = $testimonial['content'] . ' ' . $testimonial['rating'];
            }
        }
        if ($show_thumbs) {
            $testimonial['image'] = build_testimonial_image($postid);
        }
        $testimonial['client'] = get_post_meta($postid, '_ikcf_client', true);
        $testimonial['position'] = get_post_meta($postid, '_ikcf_position', true);
        $testimonial['other'] = get_post_meta($postid, '_ikcf_other', true);
        echo build_single_testimonial($testimonial, $show_thumbs, $show_title, $postid, $author_class, $body_class, $testimonials_link, $theme, $show_date, $show_rating, $show_other, $width);
        if ($counter % $testimonials_per_slide == 0) {
            ?>
</div><?php 
        }
    }
    wp_reset_query();
    //display pager icons
    if ($pager || $show_pager_icons) {
        ?>
<div class="cycle-pager"></div><?php 
    }
    ?>
	</div>
	<?php 
    //display previous and next buttons
    //do it after the closing div so it is outside of the slideshow container
    if ($prev_next) {
        ?>
<div class="cycle-prev easy-t-cycle-prev">&lt;&lt; Prev </div>
		<div class="cycle-next easy-t-cycle-next">Next &gt;&gt;</div><?php 
    }
    $content = ob_get_contents();
    ob_end_clean();
    return apply_filters('easy_t_testimonials_cyle_html', $content);
}
开发者ID:premsingh4github,项目名称:SAL,代码行数:101,代码来源:easy-testimonials.php


示例15: the_permalink

    the_permalink();
    ?>
" title="<?php 
    the_title_attribute();
    ?>
" >
                    <?php 
    the_post_thumbnail();
    ?>
                </a>
            </div>
        <?php 
}
?>

        <div class="entry-content-small">
            <?php 
echo wp_trim_excerpt();
#the_excerpt();
?>
            <?php 
echo get_post_custom_values('fb_link')[0];
wp_link_pages(array('before' => '<div class="page-links">' . 'Страницы:', 'after' => '</div>'));
?>
        </div><!-- .entry-content-small -->
        <?php 
edit_post_link(__('Редактировать', 'maza'), '<footer class="entry-meta container"><span class="edit-link">', '</span></footer>');
?>
    </div>
</article>
<hr class="section-divider">
开发者ID:prilipkoleg,项目名称:maza,代码行数:31,代码来源:content-list.php


示例16: easy_t_get_single_testimonial_html

function easy_t_get_single_testimonial_html($postid, $atts)
{
    global $post;
    $post = get_post($postid, OBJECT);
    setup_postdata($post);
    extract($atts);
    ob_start();
    $testimonial['date'] = get_the_date('M. j, Y');
    if ($use_excerpt) {
        $testimonial['content'] = get_the_excerpt();
    } else {
        $testimonial['content'] = get_the_content();
    }
    //load rating
    //if set, append english text to it
    $testimonial['rating'] = get_post_meta($postid, '_ikcf_rating', true);
    $testimonial['num_stars'] = '';
    //reset num stars (Thanks Steve@IntegrityConsultants!)
    if (strlen($testimonial['rating']) > 0) {
        $testimonial['num_stars'] = $testimonial['rating'];
        $testimonial['rating'] = '<p class="easy_t_ratings" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"><meta itemprop="worstRating" content = "1"/><span itemprop="ratingValue">' . $testimonial['rating'] . '</span>/<span itemprop="bestRating">5</span> Stars.</p>';
        //$testimonial['rating'] = '<span class="easy_t_ratings">' . $testimonial['rating'] . '/5 Stars.</span>';
    }
    //if nothing is set for the short content, use the long content
    if (strlen($testimonial['content']) < 2) {
        //$temp_post_content = get_post($postid);
        $testimonial['content'] = $post->post_excerpt;
        if ($use_excerpt) {
            if ($testimonial['content'] == '') {
                $testimonial['content'] = wp_trim_excerpt($post->post_content);
            }
        } else {
            $testimonial['content'] = $post->post_content;
        }
    }
    if (strlen($show_rating) > 2) {
        if ($show_rating == "before") {
            $testimonial['content'] = $testimonial['rating'] . ' ' . $testimonial['content'];
        }
        if ($show_rating == "after") {
            $testimonial['content'] = $testimonial['content'] . ' ' . $testimonial['rating'];
        }
    }
    if ($show_thumbs) {
        $testimonial['image'] = build_testimonial_image($postid);
    }
    $testimonial['client'] = get_post_meta($postid, '_ikcf_client', true);
    $testimonial['position'] = get_post_meta($postid, '_ikcf_position', true);
    $testimonial['other'] = get_post_meta($postid, '_ikcf_other', true);
    build_single_testimonial($testimonial, $show_thumbs, $show_title, $postid, $author_class, $body_class, $testimonials_link, $theme, $show_date, $show_rating, $show_other, $width);
    wp_reset_postdata();
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
开发者ID:evdant,项目名称:firstwp,代码行数:55,代码来源:easy-testimonials.php


示例17: gmedia_post_type__the_excerpt

/**
 * @param $content
 *
 * @return mixed|string
 */
function gmedia_post_type__the_excerpt($content)
{
    remove_filter('get_the_excerpt', 'gmedia_post_type__the_excerpt', 150);
    remove_filter('the_content', 'gmedia_ 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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