wp默认的置顶文章只在第一页置顶,超过第一页的话置顶文章依然还会存在他原来的位置上,要解决这种方法,让置顶文章一直都消失在第一页置顶的话,参考下面的代码进行输出: 或者直接用两个wp query分别输出 $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; // Fetch sticky posts separately $st...
Read More »Recent Posts
WP rest api 文字教程
概述 REST API 为我们提供了一种将 URI 与 WordPress 安装中的各种资源相匹配的方法。默认情况下,如果您启用了漂亮的永久链接,则 WordPress REST API “存在”于 /wp-json/。在我们的 WordPress 网站https://ourawesomesite.com`, we can access the REST API's index by making aGETrequest tohttps://ourawesomesi...
Read More »不用插件给WP图库画廊添加lightbox效果
<?php /* * */ add_action( 'wp_footer', function(){ if(!is_admin()) { ?> <style> img { display: block; max-width: 100%; } .lightbox { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 999999; background-color: rgba(0, 0, 0, 0.75); display: flex; justify-...
Read More »