wordpress代码实现一键获取网站全部链接

图片[1]-wordpress代码实现一键获取网站全部链接-轻刻年轮
一键获取网站全部链接,可以直接获取文章页面链接 单页面链接 博客分类页,标签页等。。。。
适合网站批量提交收录吧,

效果图演示

图片[2]-wordpress代码实现一键获取网站全部链接-轻刻年轮
是不是很不错啊(我记得这个可以你如果做改版,网站链接需要更换也可以用这个哦)

代码

//记磊博客:www.ly522.com
<?php
require('./wp-blog-header.php');
header("Content-type: text/txt");
header('HTTP/1.1 200 OK');
$posts_to_show = 1000; // 获取文章数量
?>
<?php echo 'http://'.$_SERVER['HTTP_HOST']; ?><?php echo "\n"; ?>
<?php
/* 文章页面 */
header("Content-type: text/txt");
$myposts = get_posts( "numberposts=" . $posts_to_show );
foreach( $myposts as $post ) {
the_permalink();
echo "\n";
}
?>
<?php
/* 单页面 */
$mypages = get_pages();
if(count($mypages) > 0) {
foreach($mypages as $page) {
echo get_page_link($page->ID);
echo "\n";
}
}
?>
<?php
/* 博客分类 */
$terms = get_terms('category', 'orderby=name&hide_empty=0' );
$count = count($terms);
if($count > 0){
foreach ($terms as $term) {
echo get_term_link($term, $term->slug);
echo "\n";
}
}
?>
<?php
/* 标签(可选) */
$tags = get_terms("post_tag");
foreach ( $tags as $key => $tag ) {
$link = get_term_link( intval($tag->term_id), "post_tag" );
if ( is_wp_error( $link ) ) {
return false;
$tags[ $key ]->link = $link;
}
echo $link;
echo "\n";
}
?>

食用方法

创建个PHP文件,名字随意,(比如:all.php)
将以上代码复制到all.php中
上传至网站根目录,然后访问域名/all.php就可以了!

昨天群里问的,然后在夏末浅笑博客看到,现在分享出来

购买后下载不了源码或源码功能失效请联系小编,确认后可立即退款,请勿无理投诉
© 版权声明
THE END
喜欢就支持一下吧
点赞2赞赏 分享
评论 共2条

请登录后发表评论

    暂无评论内容