本文整理汇总了PHP中the_content函数的典型用法代码示例。如果您正苦于以下问题:PHP the_content函数的具体用法?PHP the_content怎么用?PHP the_content使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了the_content函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: charity_vc_our_mission
function charity_vc_our_mission($atts, $content = null)
{
extract(shortcode_atts(array('our_mission' => ''), $atts));
$page_id = get_page_by_title($our_mission);
$missionQuery = new WP_Query(array("page_id" => $page_id->ID));
if ($missionQuery->have_posts()) {
$missionQuery->the_post();
$url = wp_get_attachment_image_src(get_post_thumbnail_id($page_id->ID), array(1143, 479));
?>
<!-- Save Lives Section Start Here-->
<section class="save-lives text-center parallax" style="background-image: url('<?php
echo esc_url($url[0]);
?>
')">
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
<header class="page-header">
<h2><?php
the_title();
?>
</h2>
<?php
the_content();
?>
</header>
</div>
</div>
</div>
</section>
<!-- Save Lives Section Start Here-->
<?php
}
wp_reset_postdata();
}
示例2: block
function block($instance)
{
extract($instance);
$query_args = array('post_type' => 'testimonial', 'posts_per_page' => $pppage);
if (!($filter == 'all')) {
if (function_exists('icl_object_id')) {
$filter = (int) icl_object_id($filter, 'testimonial-category', true);
}
$query_args['tax_query'] = array(array('taxonomy' => 'testimonial-category', 'field' => 'id', 'terms' => $filter));
}
$testimonial_query = new WP_Query($query_args);
if ($testimonial_query->have_posts()) {
while ($testimonial_query->have_posts()) {
$testimonial_query->the_post();
?>
<div class="text-center services-1 col-md-3">
<div class="col-wrapper">
<?php
the_title('<h5 class="upper">', '</h5>');
the_content();
?>
</div>
</div>
<?php
}
} else {
/**
* Display no posts message if none are found.
*/
get_template_part('loop/content', 'none');
}
wp_reset_query();
}
示例3: load_5speed_archive
function load_5speed_archive()
{
echo "<h3 class=\"list-title\">My list of reasons why I drive a manual transmission car:</h3>";
echo "<div class=\"5speed\">";
while (have_posts()) {
the_post();
?>
<li>
<h3 style="margin-bottom:0px;"># <a href="<?php
the_permalink();
?>
" rel="bookmark" title="Reason <?php
the_title_attribute();
?>
"><?php
the_title();
?>
</a></h3>
<?php
the_content();
?>
</li>
<?php
}
echo "</div>";
}
示例4: widget
/**
* Display widget content.
*
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget
*/
function widget($args, $instance)
{
extract($args);
$instance = wp_parse_args((array) $instance, $this->defaults);
$featured_page = new WP_Query(array('page_id' => $instance['page_id']));
echo $before_widget . '<div class="feature-page">';
if (!empty($instance['title'])) {
echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
}
if ($featured_page->have_posts()) {
while ($featured_page->have_posts()) {
$featured_page->the_post();
echo '<div class="' . implode(' ', get_post_class()) . '">';
if (!empty($instance['show_title'])) {
printf('<h4 class="entry-title"><a href="%s" title="%s">%s</a></h4>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
}
//Show image
if (!empty($instance['show_image'])) {
printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), calibrefx_get_image(array('format' => 'html', 'size' => $instance['image_size'])));
}
if (!empty($instance['show_content'])) {
if (empty($instance['content_limit'])) {
the_content($instance['more_text']);
} else {
the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text']));
}
}
echo '</div><!--end post_class()-->' . "\n\n";
}
}
echo '</div>' . $after_widget;
wp_reset_query();
}
示例5: categori_news
function categori_news(){
query_posts('cat=9&showposts=10&posts_per_page=3');
while (have_posts()) : the_post();
/*Dima insert*/the_excerpt(); ?>
<div class="content-box">
<div class="bgr01"><div class="bgr02"><div class="bgr03">
<div <?php post_class() ?> id="post-<?php the_ID(); ?>" style=" float:none; ">
<div class="title">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="date_all">
<?php the_time('l, j ?F, Y') ?>
</div>
<div class="post">
Написал <?php the_author_link() ?> <?php the_time('g:i A') ?>
</div>
</div>
<div class="content_box">
<?php the_content('Читать всё'); ?>
</div>
<div class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?></div>
<div class="comments"><?php comments_popup_link('0 комментарии', 'комментарии', '% комментарии '); ?></div>
<div class="link-edit"><?php edit_post_link('Edit', ''); ?></div>
</div>
</div></div></div>
</div>
<?php endwhile;}
示例6: tf_buddypress
/**
* Template for BuddyPress pages
*
* @package ThemifyFlow
* @since 1.0.0
*/
function tf_buddypress()
{
while (have_posts()) {
the_post();
the_content();
}
}
示例7: widget
function widget($args, $instance)
{
extract($args);
$ci_post_id = $instance['postid'];
$post_type_name = $instance['post_type_name'];
if (empty($ci_post_id) or empty($post_type_name)) {
return;
}
$q = new WP_Query(array('post_type' => $post_type_name, 'p' => $ci_post_id));
echo $before_widget;
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
while ($q->have_posts()) {
$q->the_post();
global $post;
if (get_post_type() == 'testimonial') {
?>
<blockquote class="testimonial">
<i class="fa fa-quote-left"></i>
<?php
the_content();
?>
<cite><?php
the_title();
?>
</cite>
</blockquote>
<?php
} else {
ci_get_template_part('loop', 'item', array('title' => $title));
}
}
wp_reset_postdata();
echo $after_widget;
}
示例8: do_x_post_password_cb
function do_x_post_password_cb()
{
//snag from wp-login.php:386-393
require_once ABSPATH . 'wp-includes/class-phpass.php';
// By default, use the portable hash from phpass
$wp_hasher = new PasswordHash(8, true);
// 10 days
setcookie('wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword(stripslashes($_POST['pass'])), time() + 864000, COOKIEPATH);
//fake it so it's available in the loop below
$_COOKIE['wp-postpass_' . COOKIEHASH] = $wp_hasher->HashPassword(stripslashes($_POST['pass']));
$q = new WP_Query("p={$_POST['pid']}");
if ($q->have_posts()) {
while ($q->have_posts()) {
$q->the_post();
// verifies password hash
if (post_password_required()) {
wp_send_json_error('Invalid password');
}
// get post title
ob_start();
the_title(sprintf('<a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a>');
$title = ob_get_clean();
// get post content
ob_start();
the_content();
$content = ob_get_clean();
}
}
wp_reset_postdata();
$return = array('title' => $title, 'content' => $content);
wp_send_json_success($return);
}
示例9: bizz_post_content_query
/**
* POST CONTENT - query posts
*
* output post content for Query Posts widget, based on predefined arguments
* @since 7.0
*/
function bizz_post_content_query($args = '', $post_count = false)
{
global $wp_query, $post, $opt;
bizz_hook_before_post($post_count);
#hook
echo "<" . apply_filters('bizz_html5_section', "div") . " class=\"format_text\">\n";
$selflink = isset($args['thumb_selflink']) && $args['thumb_selflink'] == true ? true : false;
$cropp = isset($args['thumb_cropp']) && $args['thumb_cropp'] != '' ? $args['thumb_cropp'] : 'c';
if (isset($opt['bizzthemes_thumb_show']['value']) && $args['thumb_display']) {
bizz_image('width=' . $args['thumb_width'] . '&height=' . $args['thumb_height'] . '&class=thumbnail ' . $args['thumb_align'] . '&cropp=' . $cropp . '&selflink=' . $selflink . '&filter=' . $args['thumb_filter'] . '&sharpen=' . $args['thumb_sharpen'] . '');
}
if ($args['remove_posts'] == '0') {
if ($args['full_posts'] == '0' && (is_archive() || $wp_query->is_posts_page || is_search() || is_home())) {
the_excerpt();
if ($args['read_more']) {
echo apply_filters('bizz_read_more', '<span class="read-more"><a href="' . get_permalink() . '" class="url fn" rel="nofollow">' . $args['read_more_text'] . '</a></span>');
}
} else {
the_content($args['read_more_text']);
}
wp_link_pages(array('before' => '<div class="page-link">', 'after' => '</div>'));
}
echo '<div class="fix"><!----></div>';
echo "</" . apply_filters('bizz_html5_section', "div") . ">\n";
bizz_hook_after_post($post_count);
#hook
}
示例10: oe_main_slider
function oe_main_slider($numbers = -1)
{
global $post;
$query = new WP_Query(array('post_type' => 'slider', 'posts_per_page' => $numbers));
$imgArray = array();
if ($query->have_posts()) {
echo '<div id="header_slider" class="owl-carousel owl-theme">';
while ($query->have_posts()) {
$query->the_post();
$slide_color = get_post_meta($post->ID, 'oe_slider_bg', true);
?>
<div class="item slider-info" style="background-color:<?php
echo $slide_color;
?>
;">
<div class="text-slider">
<?php
the_content();
echo '<a href="#" id="scroll_to"><span class="scroll-down"><span class="img-scroll-down"></span></span>' . __('see what we can do for you.', 'oneengine') . '</a>';
?>
</div>
<?php
the_post_thumbnail('full');
?>
</div>
<?php
}
echo '</div>';
}
wp_reset_query();
}
示例11: widget
/**
* widget function.
*
* @see WP_Widget
* @access public
* @param array $args
* @param array $instance
* @return void
*/
function widget($args, $instance)
{
if ($this->get_cached_widget($args)) {
return;
}
global $job_manager;
extract($args);
if ('' == get_the_content()) {
return;
}
$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
$icon = isset($instance['icon']) ? $instance['icon'] : null;
if ($icon) {
$before_title = sprintf($before_title, 'ion-' . $icon);
}
ob_start();
echo $before_widget;
remove_filter('the_content', array($job_manager->post_types, 'job_content'));
if ($title) {
echo $before_title . $title . $after_title;
}
the_content();
echo $after_widget;
$content = ob_get_clean();
echo apply_filters($this->widget_id, $content);
$this->cache_widget($args, $content);
}
示例12: get_rendered_content
function get_rendered_content()
{
ob_start();
the_content();
$content = ob_get_clean();
return $content;
}
示例13: display_mega_menu_contents
static function display_mega_menu_contents($output, $item, $depth, $args)
{
$item = (array) $item;
$args = (array) $args;
if (empty($args['hide_mega_menu']) && $depth == 0 && $item['object'] == 'ts_mega_menu' && $args['theme_location'] == 'main_nav') {
$mega_menu_id = $item['object_id'];
//echo '<pre>'.esc_html(print_r($item, true)).'</pre>'; // debug
if (!empty($mega_menu_id) && ($mega_menu = get_post($mega_menu_id)) && !is_wp_error($mega_menu)) {
// We have a mega menu to display.
$wrapper_classes = apply_filters('ts-mega-menu-classes', array('ts-mega-menu'), $item, $depth, $args);
global $post;
$old_post = $post;
$post = $mega_menu;
setup_postdata($mega_menu);
ob_start();
the_content();
$contents = ob_get_clean();
wp_reset_postdata();
if (!empty($contents)) {
$output .= '<ul class="sub-menu ' . esc_attr(implode(' ', $wrapper_classes)) . "\">\n";
$output .= '<li class="menu-item ts-mega-menu-wrap">' . "\n";
$output .= $contents;
$output .= '</li>' . "\n";
$output .= "</ul>\n";
}
$post = $old_post;
if (!is_404()) {
setup_postdata($post);
}
}
}
return $output;
}
示例14: storefront_post_content
/**
* Display the post content with a link to the single post
* @since 1.0.0
*/
function storefront_post_content()
{
?>
<?php
if (is_search()) {
?>
<div class="entry-summary">
<h2><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h2>
<?php
the_excerpt();
?>
</div><!-- .entry-summary -->
<?php
} else {
?>
<div class="entry-content" itemprop="articleBody">
<?php
if (has_post_thumbnail()) {
the_post_thumbnail('full', array('itemprop' => 'image'));
}
the_content(sprintf(__('Continue reading %s', 'storefront'), '<span class="screen-reader-text">' . get_the_title() . '</span>'));
wp_link_pages(array('before' => '<div class="page-links">' . __('Pages:', 'storefront'), 'after' => '</div>'));
?>
</div><!-- .entry-content -->
<?php
}
}
示例15: tc_page_content
/**
* The template part for displaying page content
*
* @package Customizr
* @since Customizr 3.0
*/
function tc_page_content() {
if ( 'page' != tc__f('__post_type') || ! is_singular() || tc__f( '__is_home_empty') )
return;
ob_start();
do_action( '__before_content' );
?>
<div class="entry-content">
<?php
the_content( __( 'Continue reading <span class="meta-nav">→</span>' , 'customizr' ) );
wp_link_pages( array(
'before' => '<div class="btn-toolbar page-links"><div class="btn-group">' . __( 'Pages:' , 'customizr' ),
'after' => '</div></div>',
'link_before' => '<button class="btn btn-small">',
'link_after' => '</button>',
'separator' => '',
)
);
?>
</div>
<?php
do_action( '__after_content' );
$html = ob_get_contents();
if ($html) ob_end_clean();
echo apply_filters( 'tc_page_content', $html );
}