admin管理员组文章数量:1130349
I have a wordpress site with a bunch of posts that I need to display on a page, depending on their value in a database.
To be more specific, out of 20 posts I would only want to display the posts on the page that have been "liked" in a third-party program. This third-party program will, once a piece of content have been liked, assign a value to a post in the database. Whenever a user then loads my page, I only want the posts with this value assigned to show.
My guess is to use post categories and taxonomy, but I would like to pick your brains on how to execute it properly.
What I need to resolve:
- Do I need a 2nd database to control this? Or am I able to externally from Wordpress assign a value to a post.
- Is taxonomy the best way to go about this?
- How can I implement a solution.
Thanks!
I have a wordpress site with a bunch of posts that I need to display on a page, depending on their value in a database.
To be more specific, out of 20 posts I would only want to display the posts on the page that have been "liked" in a third-party program. This third-party program will, once a piece of content have been liked, assign a value to a post in the database. Whenever a user then loads my page, I only want the posts with this value assigned to show.
My guess is to use post categories and taxonomy, but I would like to pick your brains on how to execute it properly.
What I need to resolve:
- Do I need a 2nd database to control this? Or am I able to externally from Wordpress assign a value to a post.
- Is taxonomy the best way to go about this?
- How can I implement a solution.
Thanks!
Share Improve this question edited Oct 30, 2018 at 17:06 Hans V. asked Oct 30, 2018 at 15:25 Hans V.Hans V. 236 bronze badges1 Answer
Reset to default 0If I understand correctly what you're trying to accomplish, you'll probably want "post meta" (post meta data) to be updated in relation to the 3rd party program, then adjust the post query to look for it before outputting posts.
This objective can be accomplished in different ways, the simplest ones not necessarily requiring input from or interaction with the 3rd party program: For instance, when a particular button is clicked, the post meta could be added, with all operations taking place within your installation.
It's also very possible, however, that the implementation is already adding post meta data, in which case all you'll need do is identify it. You might try outputting the results of get_post_meta() for a particular likely post, and seeing if there are any keys that look like what you want.
Either way, you would then use a query argument looking for the post meta value (aka custom field value) to determine which posts are output using WP Query. You can find details and some simple examples in the WordPress Codex here: https://codex.wordpress/Class_Reference/WP_Query#Custom_Field_Parameters
I have a wordpress site with a bunch of posts that I need to display on a page, depending on their value in a database.
To be more specific, out of 20 posts I would only want to display the posts on the page that have been "liked" in a third-party program. This third-party program will, once a piece of content have been liked, assign a value to a post in the database. Whenever a user then loads my page, I only want the posts with this value assigned to show.
My guess is to use post categories and taxonomy, but I would like to pick your brains on how to execute it properly.
What I need to resolve:
- Do I need a 2nd database to control this? Or am I able to externally from Wordpress assign a value to a post.
- Is taxonomy the best way to go about this?
- How can I implement a solution.
Thanks!
I have a wordpress site with a bunch of posts that I need to display on a page, depending on their value in a database.
To be more specific, out of 20 posts I would only want to display the posts on the page that have been "liked" in a third-party program. This third-party program will, once a piece of content have been liked, assign a value to a post in the database. Whenever a user then loads my page, I only want the posts with this value assigned to show.
My guess is to use post categories and taxonomy, but I would like to pick your brains on how to execute it properly.
What I need to resolve:
- Do I need a 2nd database to control this? Or am I able to externally from Wordpress assign a value to a post.
- Is taxonomy the best way to go about this?
- How can I implement a solution.
Thanks!
Share Improve this question edited Oct 30, 2018 at 17:06 Hans V. asked Oct 30, 2018 at 15:25 Hans V.Hans V. 236 bronze badges1 Answer
Reset to default 0If I understand correctly what you're trying to accomplish, you'll probably want "post meta" (post meta data) to be updated in relation to the 3rd party program, then adjust the post query to look for it before outputting posts.
This objective can be accomplished in different ways, the simplest ones not necessarily requiring input from or interaction with the 3rd party program: For instance, when a particular button is clicked, the post meta could be added, with all operations taking place within your installation.
It's also very possible, however, that the implementation is already adding post meta data, in which case all you'll need do is identify it. You might try outputting the results of get_post_meta() for a particular likely post, and seeing if there are any keys that look like what you want.
Either way, you would then use a query argument looking for the post meta value (aka custom field value) to determine which posts are output using WP Query. You can find details and some simple examples in the WordPress Codex here: https://codex.wordpress/Class_Reference/WP_Query#Custom_Field_Parameters
本文标签: filtersDisplaying posts on a page that have been assigned a value in a database
版权声明:本文标题:filters - Displaying posts on a page that have been assigned a value in a database 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749218592a2334578.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论