Hey everyone!

With the holiday season upon us, we want to share our upcoming working hours:

After that, we’ll return to our regular schedule and assist you as quickly as possible.

In the meantime, you can explore our documentation for Amelia and wpDataTables. You'll find tons of helpful resources, including articles and handy video tutorials on YouTube (Amelia's YouTube Channel and wpDataTables' YouTube Channel), which might just have the answers you need while we’re away.

Thanks a bunch for your understanding and support!

Warm regards and happy holidays!

TMS

Okay
  Public Ticket #2861474
Return list from specific category
Closed

Comments

  • Glenn started the conversation

    Hi

    I'm trying to get a table from a specific Category in WP. i.e. if this post has this category associated with it then display the result(s). If I remove the condition, I get a full list, but as soon as I add the condition I get the error. What am I doing wrong?

  •  2,572
    Aleksandar replied

    Hello Glenn

    Thank you for your purchase.

    I cannot say without taking a look at the database and the plugin, but the issue is somewhere in the query. 

    MySQL query constructor is not an ‘ultimate generator’, it should be treated as helper for constructing a suggestion of a query, by trying to ‘guess’ what you want. We are constantly working to improve it, but SQL is such a complicated and flexible language that fully automating the process for constructing queries is hardly possible. Consequently, the more complicated your request is, the higher is the probability that it will not return exactly what you need. Play around with the resulting query to achieve better results.

    I can take a look, but I can't promise anything. 

    Please provide me a temporary WP-admin (administrator) user for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue. 

    We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course, we do not provide login data to third parties. 

    You can write credentials here just check PRIVATE Reply so nobody can see them except us.

    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

  •   Glenn replied privately
  •   Aleksandar replied privately
  • Glenn replied

    Cosmic - I was just looking at the site to see if you'd taken a look or not and there you were :-)

    Thanks for the feedback. I got to the same point the other day - I could get it to filter for the post_name but not the post_taxonomy_post_tag or post_taxonomy_category. The is where my brain fried as why would it work for post_name and not the other ones!!!

    Any thoughts?

  • Glenn replied

    Hi Aledsandar

    After several hours of failure I decided to test your sandbox'd site and ended up with even more issues - see attached.

    I've also set up a vanilla WP site for testing to eliminate any conflicts... but still haven't had a joy as of yet.

    Any feedback is greatly appreciated.

    Cheers
    Glenn

  • Glenn replied

    By total randomness I think I've got a solution. It's to do with the location for the conditions using the wizard:

    This works - 

    SELECT posts_post.post_title AS post_post_title,
           post_taxonomy_category_tbl.name AS post_taxonomy_category
    FROM _PPZ_posts AS posts_post
      INNER JOIN (SELECT name, object_id as id FROM _PPZ_terms AS post_taxonomy_category_tbl_terms INNER JOIN _PPZ_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 _PPZ_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 post_taxonomy_category_tbl.name LIKE '%zaphod%'
       AND posts_post.post_type = 'post'

    This doesn't - 

    SELECT posts_post.post_title AS post_post_title,
           post_taxonomy_category_tbl.name AS post_taxonomy_category
    FROM _PPZ_posts AS posts_post
      INNER JOIN (SELECT name, object_id as id FROM _PPZ_terms AS post_taxonomy_category_tbl_terms INNER JOIN _PPZ_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 _PPZ_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 
         AND post_taxonomy_category LIKE '%zaphod%'
    WHERE 1=1 
       AND posts_post.post_type = 'post'

    Hope this helps should you come across this problem again.

    Cheers
    Glenn

  •  2,572
    Aleksandar replied

    Thanks for your feedback, Glenn.

    Unfortunately, as mentioned before, the constructor is just a helper, and you will often need to play with the resulting query to get the data you need.

    I'm glad to hear you were able to get the desired data!

    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