When i tried to create a table of wordpress posts, i was unable to get option to fetch only links.
Also i can;t find any way to retrieve post from single category only. I created 2 dummy posts and posted them in category 1 and category 2.
When i filtering on table i selected Allow filtering, and added pre defined value as 1 (putting category name 1)
but i got result "No result found"
below is the query which was showing in table page.
SELECT posts_post.ID AS post_ID, posts_post.post_title AS post_post_title, CONCAT('<a href="',posts_post.guid,'">',posts_post.post_title,'</a>') AS post_title_with_link_to_post, posts_post.post_modified AS post_post_modified, post_taxonomy_category_tbl.name AS post_taxonomy_category FROM wp_posts AS posts_post INNER JOIN (SELECT name, object_id as id FROM wp_terms AS post_taxonomy_category_tbl_terms INNER JOIN wp_term_taxonomy AS post_taxonomy_category_tbl_termtaxonomy ON post_taxonomy_category_tbl_termtaxonomy.term_id = post_taxonomy_category_tbl_terms.term_id AND post_taxonomy_category_tbl_termtaxonomy.taxonomy = 'category' INNER JOIN wp_term_relationships AS rel_post_taxonomy_category_tbl ON post_taxonomy_category_tbl_termtaxonomy.term_taxonomy_id = rel_post_taxonomy_category_tbl.term_taxonomy_id) AS post_taxonomy_category_tbl ON post_taxonomy_category_tbl.ID = posts_post.id WHERE 1=1 AND posts_post.post_type = 'post'
what i need to input to fetch posts from a specific category only.
Please note: this tool is not an ultimate query generator. It simply constructs a suggestion of a query. We are constantly working to improve it, but SQL is such a complicated and flexible language that full automation for constructing queries is next to impossible. Consequently, the more complicated the query, the higher is the probability that it will not return exactly what you need. So, you will often need to play around with the resulting query.
Creating custom SQL queries is not included in the provided support for the plugin, so we won't be able to help you out with this.
The issue with filtering is related to this query. If you have CONCATs, JOINs, UNIONs, filtering, sorting and search won't work correctly. If you can see the data you wanted to see, you would need to please prepare a MySQL view (a stored query), which will return the data that you need, call it e.g. “view1” and then build a wpDataTable based on a simple query like “SELECT * FROM view1″.
Please note some this when working with the server-side processing feature:
Please do not use “LIMIT” in the SELECT statement. wpDataTables adds it automatically and it will be overridden.
Please do not use “ORDER BY” in the SELECT statement. wpDataTables has its own sorting engine so it makes no sense to use MySQL’s sorting, since it will be overridden. Also, server-side processing feature adds this part of statement automatically when users trigger the sorting on the front-end, and having it in initial statement may cause the table to crash.
Hi, i was testing your wpdatatables plugin.
When i tried to create a table of wordpress posts, i was unable to get option to fetch only links.
Also i can;t find any way to retrieve post from single category only. I created 2 dummy posts and posted them in category 1 and category 2.
When i filtering on table i selected Allow filtering, and added pre defined value as 1 (putting category name 1)
but i got result "No result found"
below is the query which was showing in table page.
SELECT posts_post.ID AS post_ID,
posts_post.post_title AS post_post_title,
CONCAT('<a href="',posts_post.guid,'">',posts_post.post_title,'</a>') AS post_title_with_link_to_post,
posts_post.post_modified AS post_post_modified,
post_taxonomy_category_tbl.name AS post_taxonomy_category
FROM wp_posts AS posts_post
INNER JOIN (SELECT name, object_id as id FROM wp_terms AS post_taxonomy_category_tbl_terms INNER JOIN wp_term_taxonomy AS post_taxonomy_category_tbl_termtaxonomy ON post_taxonomy_category_tbl_termtaxonomy.term_id = post_taxonomy_category_tbl_terms.term_id AND post_taxonomy_category_tbl_termtaxonomy.taxonomy = 'category' INNER JOIN wp_term_relationships AS rel_post_taxonomy_category_tbl ON post_taxonomy_category_tbl_termtaxonomy.term_taxonomy_id = rel_post_taxonomy_category_tbl.term_taxonomy_id) AS post_taxonomy_category_tbl
ON post_taxonomy_category_tbl.ID = posts_post.id
WHERE 1=1
AND posts_post.post_type = 'post'
what i need to input to fetch posts from a specific category only.
what if post is posted in more than 1 category.
Hello Neal
Thank you for your interest in wpDataTables.
Please note: this tool is not an ultimate query generator. It simply constructs a suggestion of a query. We are constantly working to improve it, but SQL is such a complicated and flexible language that full automation for constructing queries is next to impossible. Consequently, the more complicated the query, the higher is the probability that it will not return exactly what you need. So, you will often need to play around with the resulting query.
Creating custom SQL queries is not included in the provided support for the plugin, so we won't be able to help you out with this.
The issue with filtering is related to this query. If you have CONCATs, JOINs, UNIONs, filtering, sorting and search won't work correctly. If you can see the data you wanted to see, you would need to please prepare a MySQL view (a stored query), which will return the data that you need, call it e.g. “view1” and then build a wpDataTable based on a simple query like “SELECT * FROM view1″.
Please note some this when working with the server-side processing feature:
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables