如何在wordpress博客上添加
查看区域
嗨,大家好我是WP开发新手,这是我的客户站点:bit.do/dFQtv
我需要在每个博客摘录下面添加hr
下面阅读更多部分,如何操作,如果我插入线下阅读更多按钮,显示在单博客文章页面也如何在wordpress博客上添加<hr>查看区域
这是编码:(模板零件/ content.php)
<?php
/**
* Template part for displaying posts
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
*
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php
if (is_single()) :
the_title('<h1 class="entry-title">', '</h1>');
else :
the_title('<h2 class="entry-title"><a href="' . esc_url(get_permalink()) . '" rel="bookmark" >', '</a></h2>');
endif;
if ('post' === get_post_type()) : ?>
<h4 class="meta text-muted">
<?php blog_posted_on(); ?>
</h4><!-- .entry-meta -->
<?php
endif; ?>
<!-- AddThis Button BEGIN -->
<div class="addthis_inline_share_toolbox_mzc3" style="margin-bottom:20px;" data-title="<?php the_title() ?>" data-url="<?php the_permalink(); ?>" </div>
<!-- AddThis Button END -->
</header><!-- .entry-header -->
<div class="entry-content">
<?php
the_content(sprintf (
/* translators: %s: Name of current post. */
wp_kses(__('Read more', 'blog'), array('span' => array('class' =>
array()))),
the_title('<span class="screen-reader-text">"', '"</span>', false)
));
wp_link_pages(array(
'before' => '<div class= "page-links">'. esc_html__('Pages:', 'blog'
),
'after' => '</div>',
));
?>
</div><!-- .entry-content -->
<footer class="entry-footer">
<?php blog_entry_footer(); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-## -->
(模板零件/内容page.php文件)
<?php
/**
* Template part for displaying page content in page.php
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
*
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title('<h1 class="entry-title">', '</h1>'); ?>
</header><!-- .entry-header -->
<div class="entry-content"><hr>
<?php
the_content();
wp_link_pages(array(
'before' => '<div class="page-links">' . esc_html__('Pages:','blog'),
'after' => '</div>',
));
?>
</div><!-- .entry-content -->
<?php if (get_edit_post_link()) : ?>
<footer class="entry-footer">
<?php
edit_post_link(
sprintf(
/* translators: %s: Name of current post */
esc_html__('Edit %s', 'blog'),
the_title('<span class="screen-reader-text">"', '"</span>', false)
),
'<span class="edit-link">',
'</span>'
);
?>
<hr>
</footer><!-- .entry-footer -->
<?php endif; ?>
</article><!-- #post-## -->
根据看到您的主题,您将<hr>
标记的最后一行添加到template-parts
文件夹内的content.php
。 这样的:
<footer class="entry-footer">
<?php bfablog_entry_footer(); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-<?php the_ID(); ?> --><hr>
仔细检查你编辑正确的文件。我试着和它的工作
嗨@Nawin它的工作,但它也显示在单个帖子内容页面请参阅此帖子url:bit.ly/2uHVIFN, 我只想显示在博客存档页面:bit.do/dFQtv –
谢谢@Nawin我从单个帖子的comment.php中删除了hr,现在它工作正常,我想,再次感谢bro –
关闭的商品标签后,只要添加标签的HR,也可以写CSS为它改变宽度和它的颜色。
<?php
/**
* Template part for displaying page content in page.php
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
*
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title('<h1 class="entry-title">', '</h1>'); ?>
</header><!-- .entry-header -->
<div class="entry-content"><hr>
<?php
the_content();
wp_link_pages(array(
'before' => '<div class="page-links">' . esc_html__('Pages:','bfablog'),
'after' => '</div>',
));
?>
</div><!-- .entry-content -->
<?php if (get_edit_post_link()) : ?>
<footer class="entry-footer">
<?php
edit_post_link(
sprintf(
/* translators: %s: Name of current post */
esc_html__('Edit %s', 'bfablog'),
the_title('<span class="screen-reader-text">"', '"</span>', false)
),
'<span class="edit-link">',
'</span>'
);
?>
<hr>
</footer><!-- .entry-footer -->
<?php endif; ?>
</article><!-- #post-## -->
<hr class="abc" />
你试过什么节目代码 – Nawin
@Nawin array('class'=> array()))),
–
尝试编辑您的代码到您的问题,而不是在评论中... – Nawin