wordpress常用代替插件的代码

wordpress常用代替插件的代码

1: WordPress搭建内部链接,不需要插件,随机文章函数

<?php rand_posts = get_posts('numberposts=10\&orderby=rand');foreach(rand_posts as $post) : ?>

<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>

<?php endforeach;?>

这里的数字10是随机显示10条随机的文章

2: Wordpress面包屑导航代码

1. 在wordpress博客当前主题的php文件(没有就创建一个)中添加以下代码:

function get_breadcrumbs()
{
global wp_query; if ( !is_home() ) { // Start the UL echo '\

相关推荐
ServBay2 天前
告别面条代码,PSL 5.0 重构 PHP 性能与安全天花板
后端·php
JaguarJack4 天前
FrankenPHP 原生支持 Windows 了
后端·php·服务端
BingoGo4 天前
FrankenPHP 原生支持 Windows 了
后端·php
JaguarJack5 天前
PHP 的异步编程 该怎么选择
后端·php·服务端
BingoGo5 天前
PHP 的异步编程 该怎么选择
后端·php
JaguarJack6 天前
为什么 PHP 闭包要加 static?
后端·php·服务端
ServBay7 天前
垃圾堆里编码?真的不要怪 PHP 不行
后端·php
用户962377954487 天前
CTF 伪协议
php
BingoGo9 天前
当你的 PHP 应用的 API 没有限流时会发生什么?
后端·php
JaguarJack9 天前
当你的 PHP 应用的 API 没有限流时会发生什么?
后端·php·服务端