Giter VIP home page Giter VIP logo

Comments (8)

andreacreativesoft avatar andreacreativesoft commented on July 24, 2024

Hi guys, I need some help, im there but not :-)

I'm trying to do this: I need to filter posts - first if defined by Category xxx, yyy, zzz - if not defined in the shortcode then all Categories but only those that have a defined TAG -or TAGS in the shortcode. Then on filter change to category yyy - have just those that are in Category yyy and have the TAG or TAGS defined

Ex:

Categories: Boston, Texas, New York ...
Tags: News, Events, Spotlights...

Show all posts with TAG = Spotlights and in categories Texas, New York ( if no Categories defined in the shorcode take all )
then in the filter to show just those with TAG ( Tags defined ) but from selected Category

from wordpress-ajax-filter-posts.

Robbertdk avatar Robbertdk commented on July 24, 2024

@andreacreativesoft As discussed in the mail I can look next week at this.

But feel free to create a pull request or fork the project if you need that functionality this week.

The initial query and the filtered queries all pass through this function: https://github.com/Robbertdk/wordpress-ajax-filter-posts/blob/master/class-ajax-filter-posts.php#L280
You can combine the given $args with the specific arguments you want to alter the query.

See also the docs to create nested taxonomy queries: https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-parameters

from wordpress-ajax-filter-posts.

andreacreativesoft avatar andreacreativesoft commented on July 24, 2024

from wordpress-ajax-filter-posts.

Robbertdk avatar Robbertdk commented on July 24, 2024

@andreacreativesoft Can you show the code changes you've made? Then I can take a quick look at it.

from wordpress-ajax-filter-posts.

andreacreativesoft avatar andreacreativesoft commented on July 24, 2024

from wordpress-ajax-filter-posts.

Robbertdk avatar Robbertdk commented on July 24, 2024

@andreacreativesoft I've added a filter hook to allow developers to alter the query. See the example in the Readme to use that filter hook for adding a extra term to the query https://github.com/Robbertdk/wordpress-ajax-filter-posts#query-arugments

from wordpress-ajax-filter-posts.

andreacreativesoft avatar andreacreativesoft commented on July 24, 2024

from wordpress-ajax-filter-posts.

Robbertdk avatar Robbertdk commented on July 24, 2024

@andreacreativesoft I've added the option to pass an id as an attribute to your shortcode, which you can get in your filters hooks. With that you can decide how to alter your queries by the given id. See #23 for an example

from wordpress-ajax-filter-posts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.