当前位置: 代码迷 >> 综合 >> WordPress翻页链接添加title属性
  详细解决方案

WordPress翻页链接添加title属性

热度:21   发布时间:2024-02-10 13:20:33.0

wordpress文章页两侧添加分页导航箭头 只是通过Js在文章页面添加了两个分页的箭头导航,没有添加title属性,不能提示下一篇上一篇的题目,这样不方便读者了解是否他需要的信息,更不利于seo,我们可以通过下面的方法来实现!

在你的文章页面添加以下代码,替换掉?php previous_post_link()和php next_post_link()函数。

<?php$prev_post = get_previous_post();if (!empty( $prev_post )): ?><a title="<?php echo $prev_post->post_title; ?>" href="<?php echo get_permalink( $prev_post->ID ); ?>" rel="external nofollow" ><?php echo $prev_post->post_title; ?></a>
<?php endif; ?>
<?php$next_post = get_next_post();if (!empty( $next_post )): ?><a title="<?php echo $next_post->post_title; ?>" href="<?php echo get_permalink( $next_post->ID ); ?>" rel="external nofollow" ><?php echo $next_post->post_title; ?></a><?php endif; ?>

您可能感兴趣的文章:


? Bootstrap教程 分页

? wordpress优化title的seo技巧

? 自定义函数实现wordpress面包屑导航

? wordpress标题title优化代码

? 解决wordpress页面(page)分页失效

? wordpress文章页两侧添加分页导航箭头

? WordPress免插件实现面包屑导航

?  Bootstrap教程 导航

  相关解决方案