ThemeShaper Forums » Thematic

[closed]

Question on filters

(5 posts)
  • Started 9 years ago by bronwyn
  • Latest reply from Andrew
  • This topic is resolved

Tags:

  1. bronwyn
    Member

    When creating a filter for a child theme, does the code you write REPLACE the original function, or just ADD/SUBTRACT to/from it?

    Say the original function covers a bunch of special cases, and you want to add or edit just one condition. Do you write up just the one condition, and the rest is covered by the original function?

    I've been trying to figure this out, but none of the material I've read makes it crystal-clear which it is. It'd be good to add this information to the Thematic customization guide and the series of blog posts that covers making child themes with filters.

    Posted 9 years ago #
  2. I don't pretend to be the definitive source, but as far as I know a filter replaces the thematic function with your function.

    Posted 9 years ago #
  3. Hopefully this will clarify things a bit.

    A child theme filter function does not replace the original Thematic function that provided the filter.

    The child theme's filter function takes a variable provided by one of Thematic's functions and gives your function the opportunity to modify it and return a new value to the original function in the parent theme.

    That original function then does something with the modified value that the child theme's filter function has provided.

    -Gene

    Posted 9 years ago #
  4. bronwyn,

    Sorry, I didnt really answer your question did I.

    Yes you can use a filter function to add, subtract, or replace the data provided buy the original function. And yes in the case of your hypothetical class generating function... if it has determined the value of the filterable variable and you want to do something with it using conditional tags you can and then return a new value if your condition is true or even return the original value if your condition is false.

    -Gene

    Posted 9 years ago #
  5. Thanks for clarifying this em hr! It was a much needed, but simple explanation of what a Filter is... I had been looking for this all over. It should go right here...

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.