[wordpress插件] Archives for Custom Post Types自定义帖子类型的存档

wordpress 插件 文章 2020-02-20 22:50 589 0 全屏看文

AI助手支持GPT4.0

评分
100
描述

DEPRECATION NOTICE: As of WordPress 4.4, you no longer need this plugin as wp_get_archives() now accepts custom post types as an argument.

弃用通知::自WordPress 4.4起,您不再需要此插件,因为 wp_get_archives()现在接受自定义帖子类型作为参数。

See #34686.

参见#34686

This plugin provides proper support for archived pages of custom post types to match the support for normal posts.

此插件为自定义帖子类型的存档页面提供了适当的支持,以匹配对普通帖子的支持。

The problem is that the function, wp_get_archives() does not allow you to pass in a post type.

问题在于 wp_get_archives()函数不允许您传递帖子类型。

It only works for normal posts.

它仅适用于普通帖子。

There is a filter called getarchives_where() but this doesn’t handle the archive URLs (e.g. http://yoursite.com/2014/).

有一个名为 getarchives_where()的过滤器,但这不能处理存档网址(例如http://yoursite.com/2014/)。

So while the filter will help you view the correct archives, it won’t work properly in conjunction with the wp_get_archives() function.

因此,尽管过滤器可以帮助您查看正确的档案,但不能与 wp_get_archives()函数结合使用。

For example, a link to “June 2014” emitted by wp_get_archives() will only take you to normal posts from June 2014, not custom post types.

例如,wp_get_archives()发出的指向“ 2014年6月”的链接只会带您进入2014年6月以后的普通帖子,而不是自定义帖子类型。

This plugin provides a new function: wp_get_archives_cpt().

此插件提供了一个新功能: wp_get_archives_cpt()

This function can take a post_type argument as well as the usual arguments that can be passed to wp_get_archives().

此函数可以使用post_type参数以及可以传递给 wp_get_archives()的常规参数。

The plugin also provides automatic handling for custom post type archive URLs.

该插件还提供对自定义帖子类型存档URL的自动处理。

This plugin has stemmed from a ticket that I have been working on in core: https://core.trac.wordpress.org/ticket/21596

此插件源自我一直在开发的票证:https://core.trac.wordpress.org/ticket/21596

Unfortunately a proper patch for this in core will probably have to go quite deep.

不幸的是,针对此内核的适当补丁可能必须深入。

I have therefore decided to share this plugin as a temporary solution.

因此,我决定共享此插件作为临时解决方案。

安装步骤

    1. Upload archives-for-custom-post-types.php to the /wp-content/plugins/ directory
    2. archives-for-custom-post-types.php 上载到 / wp-content / plugins / 目录

    3. Activate the plugin through the ‘Plugins’ menu in WordPress
    4. 通过WordPress中的“插件”菜单激活插件

    5. Place

    6. 放置 <?php wp_get_archives_cpt('post_type = custom_post_type');

      ?> in your templates

    7. ?> 在您的模板中

下载地址
https://downloads.wordpress.org/plugin/archives-for-custom-post-types.1.0.2.zip
-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
[wordpress插件] Download Plugins and Themes from Dashboard从仪表板下载插件和主题
[wordpress插件] Cudazi Latest TweetsCudazi最新推文
[wordpress插件] Automatic Alternative Text自动替代文字
[wordpress插件] Debug Tool调试工具
[wordpress插件] Cherry Testimonials樱桃感言
随便看看
微信支付银行卡交易的限额是多少? 2541
从技术角度优化网站加载过多从而导致网站速度打开过慢的问题 2579
阿里云com、cn域名续费优惠码(2020年2月可用) 2312
将爱某艺的qsv转成flv格式放到老人点播机里 2479
和平精英战术随机应变、城区刚枪、野点发育、找车转移 是什么意思 8491
老爷子收到了057128256416的电话号码 3113
阿里云com、cn域名续费优惠码(2020年3月可用) 2863
线上防疫题库正确答案 2932
线上防疫题库正确答案(多选题) 4825
微信设置不可以使用小程序(游戏小程序) 5635