• Resolved etcoder

    (@etcoder)


    Hello,

    Can anyone help me with this problem…
    I need to filter my custom posts by custom taxonomy and category.
    Does the plugin can do this?

    Here’s my shortcode
    echo do_shortcode('[ajax_load_more post_type="mypost" category="trips" taxonomy="place" taxonomy_terms="city" posts_per_page="9" scroll="false" button_label="Load More"]');

    Thanks in advanced

    https://www.ads-software.com/plugins/ajax-load-more/

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter etcoder

    (@etcoder)

    I’m using the shortcode above but the result is showing all posts under “city” terms

    Plugin Author Darren Cooney

    (@dcooney)

    Isn’t that what you would expect? All posts with ‘city’ as the custom taxonomy value?

    Or is the category not working?

    Thread Starter etcoder

    (@etcoder)

    I have one custom post type “mypost” and one custom taxonomy “place” and terms “city”
    but I have many categories:
    -trips
    -play
    -more…

    what i want is to show all custom post filtered by “city” terms and “trips” category.
    But what i’ve got is showing all the posts under custom taxonomy.

    Thread Starter etcoder

    (@etcoder)

    taxonomy is working
    echo do_shortcode('[ajax_load_more post_type="mypost" taxonomy="place" taxonomy_terms="city"]');

    categories is also working
    echo do_shortcode('[ajax_load_more post_type="mypost" category="trips"]');

    but if i combined them error occur
    echo do_shortcode('[ajax_load_more post_type="mypost" taxonomy="place" taxonomy_terms="city" category="trips"]');

    result of combined codes:
    all city posts display on the top but in the bottom display all the trip categories

    what I want is to display all “trip” categories under the “city” taxonomy

    Plugin Author Darren Cooney

    (@dcooney)

    Hi,
    Not sure why this wouldn’t be working – I’ll try to test this out and let you know. Might be a while though because of the holidays.

    Cheers,

    Plugin Author Darren Cooney

    (@dcooney)

    I believe the issue is related to the way the plugin had been built.

    In order to query by custom taxonomy and category we need to combine the two into a single tax_query.

    Currently, the out of the box WP category and tag parameters are being queried separately from the custom taxonomy query.

    I’m not sure when I can work on a fix for this, but will post back here if I am able to solve this issue.

    Cheers,

    I’m also interested in the, I have the exact same issue with querying a custom taxonomy – just not working. THanks

    It seems it only doesnt work when you query a category, and then query a taxonomy term at the same time, if I try it without querying a category, the the taxonomy filter works fine. I do need to be able to query both.

    Hope that helps!

    Thread Starter etcoder

    (@etcoder)

    Thanks dcooney, looking someday for this to be functional.
    For now, i will try your suggestion to combine it in single tax_query

    Thanks

    I cannot get this to work within a single tax_query, are there any tips on getting it to work?

    Plugin Author Darren Cooney

    (@dcooney)

    I actually think I found the reason this query is not working.
    Under the taxonomy settings in the backend of ALM I have 'releation' => 'OR'; but I really think it should be 'relation'=>'AND';

    If you want to update this yourself the file is ajax-load-more.php line 421.

    Plugin Author Darren Cooney

    (@dcooney)

    Can either of you test this out? If it does work I will add this change and post a hotfix to the www.ads-software.com repo.

    Thread Starter etcoder

    (@etcoder)

    Hi dcooney

    I tried your solution to change the relation of taxonomy to “AND” and it works perfect.

    Thanks for your help I can proceed now to my other tasks
    Keep it up!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Filter by custom Taxonomy and Category’ is closed to new replies.