Hey there, Awesome Customers!

Just a heads up: We'll be taking a breather to celebrate International Workers' Day (May 1st and 2nd - Wednesday and Thursday) and Orthodox Easter from Good Friday (May 3rd) through Easter Monday (May 6th). So, from May 1st to May 6th, our team will be off enjoying some well-deserved downtime.

During this time, our customer support will be running on a smaller crew, but don't worry! We'll still be around to help with any urgent matters, though it might take us a bit longer than usual to get back to you.

We'll be back in action at full throttle on May 7th (Tuesday), ready to tackle your questions and requests with gusto!

In the meantime, you can explore our documentation for Amelia and wpDataTables. You'll find loads of helpful resources, including articles and handy video tutorials on YouTube (Amelia's YouTube Channel and wpDataTables' YouTube Channel). These gems might just have the answers you're looking for while we're kicking back.

Thanks a bunch for your understanding and support!

Catch you on the flip side!

Warm regards,

TMS

Okay
  Public Ticket #2580922
Category specific data
Closed

Comments

  • Neal started the conversation

    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.
     

  •  2,498
    Aleksandar replied

    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:

    • 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.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia 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