wordpress中的下一篇文章,带有上一个/下一个标题链接?
我最近尝试了上一篇文章和下一篇文章按钮链接。我用网站左右两侧的图片来做这件事。它工作得很完美。但我不知道怎么做 例如:wordpress中的下一篇文章,带有上一个/下一个标题链接?,wordpress,Wordpress,我最近尝试了上一篇文章和下一篇文章按钮链接。我用网站左右两侧的图片来做这件事。它工作得很完美。但我不知道怎么做 例如: <div class="alignleftfp"> <?php next_post('%', '<img class="imgalign" src="' . WP_CONTENT_URL . '/uploads/1.png" alt="Next" /> ', 'no');
<div class="alignleftfp">
<?php next_post('%', '<img class="imgalign" src="' . WP_CONTENT_URL . '/uploads/1.png" alt="Next" /> ', 'no');
?>
</div>
<div class="alignrightfp">
<?php previous_post('%', '<img class="imgalign" src="' . WP_CONTENT_URL . '/uploads/1.png" alt="Next" /> ', 'no');
?>
</div>
是否可以在文章的每个底部显示上一篇文章和下一篇文章的链接以及标题下的链接。这是截图。
我希望您在single.php中使用这段代码,从这里可以显示整个文章。要显示链接(下一个/上一个),需要检查功能
get_template_part()
in the same file (Single.php of your theme). In my case function in single.php has been passes parameters like
<?php get_template_part( 'content-single', get_post_format() ); ?>
So, you will open the "content-single.php" according to the parameters specified in the function and paste the same code
<div class="alignleftfp">
<?php next_post('%', '<img class="imgalign" src="' . get_bloginfo('template_directory') . '/images/1.png" alt="Next" /> ', 'no');
?>
</div>
get_template_part()
在同一个文件中(主题的Single.php)。在我的例子中,single.php中的函数通过了如下参数
因此,您将根据函数中指定的参数打开“content single.php”,并粘贴相同的代码
在下面
我希望这能解决您的问题。我希望您在single.php中使用这段代码,从这里可以显示整个帖子。要显示链接(下一个/上一个),需要检查功能
get_template_part()
in the same file (Single.php of your theme). In my case function in single.php has been passes parameters like
<?php get_template_part( 'content-single', get_post_format() ); ?>
So, you will open the "content-single.php" according to the parameters specified in the function and paste the same code
<div class="alignleftfp">
<?php next_post('%', '<img class="imgalign" src="' . get_bloginfo('template_directory') . '/images/1.png" alt="Next" /> ', 'no');
?>
</div>
get_template_part()
在同一个文件中(主题的Single.php)。在我的例子中,single.php中的函数通过了如下参数
因此,您将根据函数中指定的参数打开“content single.php”,并粘贴相同的代码
在下面
我希望这能解决您的问题。hi,vicky我添加了代码,仅显示下一篇上一篇文章的标题和链接,以便为下一篇上一篇文章自定义和添加图像。hi,vicky我添加了代码,仅显示下一篇上一篇文章的标题和链接,以便为下一篇上一篇文章自定义和添加图像。如果您与我之前添加的标签混淆,请原谅('Wordpress主题')很抱歉,如果您与我之前添加的标签('Wordpress主题')相混淆
<?php previous_post('%', '<img class="imgalign" src="' . get_bloginfo('template_directory') . '/images/2.png" alt="Next" /> ', 'no');
?>
</div>
below <h1 class="entry-title"><?php the_title(); ?></h1>