Giter VIP home page Giter VIP logo

Comments (9)

Robbertdk avatar Robbertdk commented on July 24, 2024

Hi Nick,

Thank you for using this plugin.
You're the first person that I don't know, that uses one of my small open source contributions! 🎉

I've installed the plugin on a fresh WordPress install and found a bug; probably the same bug that you encountered. Fixed the problem and pushed it to this repo: 65209ab. Can you check if that solved your problem?

from wordpress-ajax-filter-posts.

nickpish avatar nickpish commented on July 24, 2024

Hi Robbert,

On a Google search for AJAX post filter plugin, your project comes right up!

I just updated my code, and the issue still seems to be occurring. If it's helpful, I push it to a test WordPress environment I've set up so you can see what's happening?

Thanks for the prompt response! I'd love to use your plugin over a bloated alternative :)

from wordpress-ajax-filter-posts.

Robbertdk avatar Robbertdk commented on July 24, 2024

Ah, unfortunately.
Yes please, that would be helpful. Although I'll be only able to see what you sent to the server, not what the specific error is.

Some other data that would be useful to solve this:

  • Can you see a possible error in the php error log?
  • What php version do you use?

from wordpress-ajax-filter-posts.

nickpish avatar nickpish commented on July 24, 2024

Ah, I just turned debug on and I'm seeing the following PHP error:

Notice: Use of undefined constant ICL_LANGUAGE_CODE - assumed 'ICL_LANGUAGE_CODE' in C:\wamp64\www\wp-dev\wp-content\plugins\ajax-filter-posts\class-ajax-filter-posts.php on line 85

The same error is thrown for line 86. Can I somehow disable the language option?

Also, in my WAMP setup, I'm using PHP version 5.6.25

from wordpress-ajax-filter-posts.

Robbertdk avatar Robbertdk commented on July 24, 2024

Ah, the if statement around function_exists('icl_object_id') above the use of that declaration should skip that code if you don't have WPML installed. That prevented in my test case, when WPML not installed. Can you replace the function function_exists('icl_object_id') with defined('ICL_LANGUAGE_CODE') to see if that fixes it? You'll find that function, two times in the class-ajax-filter-posts.php file. On line 89 and on line 273

from wordpress-ajax-filter-posts.

Robbertdk avatar Robbertdk commented on July 24, 2024

Because your error is on the wrong line number, I think you still have the older version of the plugin, before the fix in commit 65209ab.

from wordpress-ajax-filter-posts.

nickpish avatar nickpish commented on July 24, 2024

Ah ok, I thought I had updated the plugin with that commit- I will check, thank you!

from wordpress-ajax-filter-posts.

nickpish avatar nickpish commented on July 24, 2024

Ok, I've got it working! Sorry, I realized I was in fact using the older plugin version. I have a couple modifications I'd like to add for my project, and I'm wondering how difficult they'd be to add? I'm attaching a mockup for reference- first, would it be relatively simple to add the active tags above the search results, with '[x]' buttons to allow quick toggling of the filters? Secondly, how would one go about formatting filter output markup to indent child taxonomy terms under their parent, as in the visual? Thanks for any assistance- I was contemplating using a different plugin, but I'd much rather use your approach!

wp-ajax-filter-mockup

from wordpress-ajax-filter-posts.

Robbertdk avatar Robbertdk commented on July 24, 2024

There are several ways to go:

  1. You add the files of the template folder to you your theme in the folder ajax-filter-posts. With that you can change the HTML markup of the all the created HTML of this plugin. For example you could add an extra class to the filters if they are child-categories (check if $filter->parent != 0).

You can add your own CSS in the theme and, if you make a lot of changes to the css, dequeue the CSS from the plugin to prevent loading of a lot of unneeded styles.

You can create your own JavaScript event listeners that listen on changes of the checkbox. When a checkbox is checked you can add that filter as pills above the results and remove it on uncheck. To create the remove button in the pills you can add an eventListener there that triggers an uncheck event on the corresponding filter in the sidemenu.

  1. You can create a fork of this plugin and add features of option 1 directly in the plugin.

Now the bug is solved, I'll close this thread. Good luck with your project and feel free to ask more questions!

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.