我在此代码的末尾有内容功能,必须在帖子下显示内容并显示在单个页面中(帖子详细信息页面) 但在家里根本没有显示任何东西 这是我的代码
<?php
/**
* The template for content.
*
* @package Webdoone
* @subpackage Ruby
* @since Ruby 1.1
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('wow fadeInUp'); ?>>
<?php if (has_post_format('gallery')) { ?>
<?php $images = get_post_meta($post->ID, '_format_gallery_images', true); ?>
<?php
if ($images) { ?>
<div class="post-img">
<div class="post-type-icon">
<i class="fa fa-picture-o"></i>
</div>
<div class="outter"><div class="inner">
<ul class="bxslider">
<?php
foreach ($images as $image) {
if ((get_theme_mod('ruby_webdoone_home_layout_settings') === 'home-ful' ) || (get_theme_mod('ruby_webdoone_archive_layout_settings') === 'arch-ful' ) || (get_theme_mod('ruby_webdoone_post_layout_settings') === 'post-ful' )) {
$the_image = wp_get_attachment_image_src($image, 'ruby_webdoone_custom_width');
$the_caption = get_post_field('post_excerpt', $image); ?>
<li><img src="<?php echo esc_url($the_image[0]); ?>"
<?php
if ($the_caption) {?>
title="<?php echo esc_attr($the_caption); ?>"<?php
}; ?> /></li><?php
} else {
$the_image = wp_get_attachment_image_src($image, 'ruby_webdoone_full_width');
$the_caption = get_post_field('post_excerpt', $image); ?>
<li><img src="<?php echo esc_url($the_image[0]); ?>"
<?php
if ($the_caption) { ?>
title="<?php echo esc_attr($the_caption); ?>"<?php
}; ?> /></li><?php
};
}; ?>
</ul>
</div></div>
</div><?php
}
} elseif (has_post_format('video')) { ?>
<div class="post-img video">
<div class="post-type-icon">
<i class="fa fa-video-camera"></i>
</div>
<div class="outter"><div class="inner">
<div class="fluid-width-video-wrapper" >
<?php $ruby_video = get_post_meta($post->ID, '_format_video_embed', true); ?>
<?php
echo $ruby_video;
?>
</div></div></div>
</div><?php
} elseif (has_post_format('audio')) { ?>
<div class="post-img audio">
<div class="post-type-icon">
<i class="fa fa-music"></i>
</div>
<?php $ruby_audio = get_post_meta($post->ID, '_format_audio_embed', true); ?>
<?php
if (wp_oembed_get($ruby_audio)) {
echo wp_oembed_get($ruby_audio);
} else {
echo esc_url($ruby_audio);
}; ?>
</div><?php
} else {
if (has_post_thumbnail()) { ?>
<div class="post-img">
<?php if (is_sticky()) { ?>
<div class="post-type-icon">
<i class="fa fa-thumb-tack"></i>
</div>
<?php } else { ?>
<div class="post-type-icon">
<i class="fa fa-pencil"></i>
</div>
<?php }
if (is_home()) {
if (!empty($_GET['layout'])) {
$layout = $_GET['layout'];
} else {
$layout = '';
};
if ((get_theme_mod('ruby_webdoone_home_layout_settings') === 'home-ful') || ($layout === 'home-ful')) { ?>
<div class="outter"><div class="inner">
<a href="<?php echo esc_url(get_permalink()); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><div class="grid home-full-thumb"><figure class="effect-jazz"><?php the_post_thumbnail('ruby_webdoone_full_width'); ?><figcaption></figcaption></figure></div></a> </div></div><?php
} else { ?>
<div class="outter"><div class="inner">
<a href="<?php echo esc_url(get_permalink()); ?>"><div class="grid home-post-thumb"><figure class="effect-jazz"><?php the_post_thumbnail('ruby_webdoone_content_width'); ?><figcaption></figcaption></figure></div></a>
</div></div>
<?php
};
} elseif (is_single()) {
if (!empty($_GET['layout'])) {
$layout = $_GET['layout'];
} else {
$layout = '';
};
if ((get_theme_mod('ruby_webdoone_post_layout_settings') === 'post-ful') || ($layout === 'post-ful')) {
?>
<div class="outter"><div class="inner">
<?php the_post_thumbnail('ruby_webdoone_full_width'); ?>
</div></div>
<?php
} else {
?>
<div class="outter"><div class="inner">
<?php the_post_thumbnail('ruby_webdoone_content_width');?>
</div></div>
<?php
};
} else {
if (!empty($_GET['layout'])) {
$layout = $_GET['layout'];
} else {
$layout = '';
};
if ((get_theme_mod('ruby_webdoone_archive_layout_settings') === 'arch-ful') || ($layout === 'arch-ful')) { ?>
<div class="outter"><div class="inner">
<a href="<?php echo esc_url(get_permalink()); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('ruby_webdoone_full_width'); ?></a>
</div></div>
<?php
} else { ?>
<div class="outter"><div class="inner">
<a href="<?php echo esc_url(get_permalink()); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('ruby_webdoone_content_width'); ?></a>
</div></div>
<?php
};
};?>
</div><?php
};
}; ?>
<div class="post-header">
<?php
if (is_home()) { ?>
<h3><a class="pos-header-title-link" href="<?php esc_url(the_permalink()); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3><?php
} elseif (is_single()) { ?>
<h1 class="pos-header-title-link"><?php the_title(); ?></h1><?php
} else { ?>
<h2><a class="pos-header-title-link" href="<?php esc_url(the_permalink()); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2><?php
} ?>
<div class="post-info">
<span class="author"><?php esc_html_e('Author:', 'ruby') ?> <?php the_author_posts_link(); ?> \ </span>
<span class="date"><?php the_time(get_option('date_format')); ?> \ </span><span class="cat"><?php the_category(', '); ?></span>
<span class="comments-count">\ <?php printf( _nx( '1 Comment', '%1$s Comments', get_comments_number(), 'comments number', 'ruby' ), number_format_i18n( get_comments_number() ) ); ?></span>
</div>
</div>
<div class="post-data" itemprop="articleBody"><?php
the_content();
?> </div>
</article>
<?php wp_reset_postdata();
?>
我怎样才能解决这个问题 ? 实际上内容必须显示这些图片部分下的帖子和文字等没有问题当我删除这个功能,wordpress不会显示相似和其他按钮下的帖子。
答案 0 :(得分:1)
请根据wp文档尝试这个
// Declare global $more (before the loop).
global $more;
// Set (inside the loop) to display all content, including text below more.
$more = 1;
the_content();
答案 1 :(得分:1)
the_content
在&#34; The Loop&#34;
https://wordpress.stackexchange.com/a/44153/54343
编辑:与此相似的是&#34;循环&#34;
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
the_content();
}
}
?>