AI助手支持GPT4.0
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.
wp_get_archives()
弃用通知: strong>:自WordPress 4.4起,您不再需要此插件,因为 wp_get_archives() code>现在接受自定义帖子类型作为参数。See #34686.参见#34686 。 p>This plugin provides proper support for archived pages of custom post types to match the support for normal posts.此插件为自定义帖子类型的存档页面提供了适当的支持,以匹配对普通帖子的支持。 p>The problem is that the function, wp_get_archives() does not allow you to pass in a post type.问题在于 wp_get_archives() code>函数不允许您传递帖子类型。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() code>的过滤器,但这不能处理存档网址(例如http://yoursite.com/2014/)。 p>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() code>函数结合使用。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月以后的普通帖子,而不是自定义帖子类型。 p>This plugin provides a new function: wp_get_archives_cpt().此插件提供了一个新功能: wp_get_archives_cpt() code>。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() code>的常规参数。The plugin also provides automatic handling for custom post type archive URLs.该插件还提供对自定义帖子类型存档URL的自动处理。 p>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 p>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.因此,我决定共享此插件作为临时解决方案。 p>
wp_get_archives() code>现在接受自定义帖子类型作为参数。See #34686.参见#34686 。 p>This plugin provides proper support for archived pages of custom post types to match the support for normal posts.此插件为自定义帖子类型的存档页面提供了适当的支持,以匹配对普通帖子的支持。 p>The problem is that the function, wp_get_archives() does not allow you to pass in a post type.问题在于 wp_get_archives() code>函数不允许您传递帖子类型。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() code>的过滤器,但这不能处理存档网址(例如http://yoursite.com/2014/)。 p>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() code>函数结合使用。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月以后的普通帖子,而不是自定义帖子类型。 p>This plugin provides a new function: wp_get_archives_cpt().此插件提供了一个新功能: wp_get_archives_cpt() code>。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() code>的常规参数。The plugin also provides automatic handling for custom post type archive URLs.该插件还提供对自定义帖子类型存档URL的自动处理。 p>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 p>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.因此,我决定共享此插件作为临时解决方案。 p>
See #34686.
参见#34686 。 p>
This plugin provides proper support for archived pages of custom post types to match the support for normal posts.
此插件为自定义帖子类型的存档页面提供了适当的支持,以匹配对普通帖子的支持。 p>
The problem is that the function, wp_get_archives() does not allow you to pass in a post type.
问题在于 wp_get_archives() code>函数不允许您传递帖子类型。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() code>的过滤器,但这不能处理存档网址(例如http://yoursite.com/2014/)。 p>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() code>函数结合使用。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月以后的普通帖子,而不是自定义帖子类型。 p>This plugin provides a new function: wp_get_archives_cpt().此插件提供了一个新功能: wp_get_archives_cpt() code>。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() code>的常规参数。The plugin also provides automatic handling for custom post type archive URLs.该插件还提供对自定义帖子类型存档URL的自动处理。 p>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 p>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.因此,我决定共享此插件作为临时解决方案。 p>
wp_get_archives() code>函数不允许您传递帖子类型。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() code>的过滤器,但这不能处理存档网址(例如http://yoursite.com/2014/)。 p>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() code>函数结合使用。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月以后的普通帖子,而不是自定义帖子类型。 p>This plugin provides a new function: wp_get_archives_cpt().此插件提供了一个新功能: wp_get_archives_cpt() code>。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() code>的常规参数。The plugin also provides automatic handling for custom post type archive URLs.该插件还提供对自定义帖子类型存档URL的自动处理。 p>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 p>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.因此,我决定共享此插件作为临时解决方案。 p>
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()
有一个名为 getarchives_where() code>的过滤器,但这不能处理存档网址(例如http://yoursite.com/2014/)。 p>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() code>函数结合使用。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月以后的普通帖子,而不是自定义帖子类型。 p>This plugin provides a new function: wp_get_archives_cpt().此插件提供了一个新功能: wp_get_archives_cpt() code>。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() code>的常规参数。The plugin also provides automatic handling for custom post type archive URLs.该插件还提供对自定义帖子类型存档URL的自动处理。 p>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 p>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.因此,我决定共享此插件作为临时解决方案。 p>
getarchives_where() code>的过滤器,但这不能处理存档网址(例如http://yoursite.com/2014/)。 p>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() code>函数结合使用。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月以后的普通帖子,而不是自定义帖子类型。 p>This plugin provides a new function: wp_get_archives_cpt().此插件提供了一个新功能: wp_get_archives_cpt() code>。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() code>的常规参数。The plugin also provides automatic handling for custom post type archive URLs.该插件还提供对自定义帖子类型存档URL的自动处理。 p>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 p>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.因此,我决定共享此插件作为临时解决方案。 p>
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() code>函数结合使用。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月以后的普通帖子,而不是自定义帖子类型。 p>This plugin provides a new function: wp_get_archives_cpt().此插件提供了一个新功能: wp_get_archives_cpt() code>。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() code>的常规参数。The plugin also provides automatic handling for custom post type archive URLs.该插件还提供对自定义帖子类型存档URL的自动处理。 p>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 p>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.因此,我决定共享此插件作为临时解决方案。 p>
wp_get_archives() code>函数结合使用。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月以后的普通帖子,而不是自定义帖子类型。 p>This plugin provides a new function: wp_get_archives_cpt().此插件提供了一个新功能: wp_get_archives_cpt() code>。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() code>的常规参数。The plugin also provides automatic handling for custom post type archive URLs.该插件还提供对自定义帖子类型存档URL的自动处理。 p>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 p>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.因此,我决定共享此插件作为临时解决方案。 p>
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月以后的普通帖子,而不是自定义帖子类型。 p>
This plugin provides a new function: wp_get_archives_cpt().
wp_get_archives_cpt()
此插件提供了一个新功能: wp_get_archives_cpt() code>。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() code>的常规参数。The plugin also provides automatic handling for custom post type archive URLs.该插件还提供对自定义帖子类型存档URL的自动处理。 p>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 p>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.因此,我决定共享此插件作为临时解决方案。 p>
wp_get_archives_cpt() code>。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() code>的常规参数。The plugin also provides automatic handling for custom post type archive URLs.该插件还提供对自定义帖子类型存档URL的自动处理。 p>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 p>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.因此,我决定共享此插件作为临时解决方案。 p>
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() code>的常规参数。The plugin also provides automatic handling for custom post type archive URLs.该插件还提供对自定义帖子类型存档URL的自动处理。 p>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 p>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.因此,我决定共享此插件作为临时解决方案。 p>
wp_get_archives() code>的常规参数。The plugin also provides automatic handling for custom post type archive URLs.该插件还提供对自定义帖子类型存档URL的自动处理。 p>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 p>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.因此,我决定共享此插件作为临时解决方案。 p>
The plugin also provides automatic handling for custom post type archive URLs.
该插件还提供对自定义帖子类型存档URL的自动处理。 p>
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 p>
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.
因此,我决定共享此插件作为临时解决方案。 p>
archives-for-custom-post-types.php
/wp-content/plugins/
archives-for-custom-post-types.php code>上载到 / wp-content / plugins / code>目录 li>Activate the plugin through the ‘Plugins’ menu in WordPress通过WordPress中的“插件”菜单激活插件 li>Place 放置 <?php wp_get_archives_cpt('post_type = custom_post_type'); ?> in your templates?> code>在您的模板中 li>
/ wp-content / plugins / code>目录 li>Activate the plugin through the ‘Plugins’ menu in WordPress通过WordPress中的“插件”菜单激活插件 li>Place 放置 <?php wp_get_archives_cpt('post_type = custom_post_type'); ?> in your templates?> code>在您的模板中 li>
放置 <?php wp_get_archives_cpt('post_type = custom_post_type'); ?> in your templates?> code>在您的模板中 li>
<?php wp_get_archives_cpt('post_type = custom_post_type'); ?>
?>
?> code>在您的模板中 li>
ol>
原文出处:http://www.sanshu.cn/a/2731.html
群主管理都是支付大佬