2

I am looking for a way to show Joomla 4 articles in a category blog filtered by one (or more) of my custom fields. - The category blog settings in the backend seems only allow to filter by category, tag and other default article parameters. - Is filtering a blog by custom fields possible, anyways?

1 Answer 1

1

You can filter on Custom Fields via multiple ways:

  • filtering via JavaScript + CSS. This will load all articles, but can CSS hide (display:none) them using some JavaScript. The articles are still there in the HTML source but just not visible.
  • filtering via PHP in Joomla's Articles Model. This will load only the articles that fit to the filter state. I used this technique for a client project: I've programmed a System Plugin that overrides Joomla's Articles Model in the populateState method. And I programmed a Module to set the Filters. This way I was able to filter the Articles based on Filter Options using some Custom Field Fields.

There are some 3rd party extensions available that add filtering functionality to Joomla's articles:

2
  • I also suggest to check one of the suggested 3rd party extensions. No need to re-invent the wheel on that.
    – Sakis
    Jul 14 at 13:36
  • @pe7er could you share your System Plugin code especially on how you overwrite Joomla's Article Model in the populateState method.
    – cappu
    Jul 23 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.