Wordpress:根据自定义字段过滤器获取存档的URL链接

时间:2014-06-30 04:46:58

标签: php wordpress custom-fields

我正在尝试在wordpress帖子上提供一个链接,该链接将引导用户访问具有相同自定义字段的其他帖子的存档视图。

换句话说,类似于get_author_posts_url,但get_customfield_posts_url

提前致谢!

1 个答案:

答案 0 :(得分:0)

Wordpress不提供此功能,您需要对此进行编码。

/*

    This will be your home work:

    1. You need a page with a custom template
       + query var that returns the value of the custom field
       + custom loop that (you may use meta_query) finds posts
         with the same custom field value

    2. make function to convert the custom field
       to a custom permalink may be.

    http://example.tld/my_page/?custom_field=custom_field_value