WordPress.org

Ready to get started?Download WordPress

Forums

Filtering text in theme support modules (6 posts)

  1. bugmagnet
    Member
    Posted 1 year ago #

    I have written a plugin which filters as follows:

    add_filter('the_content', array($this, 'number_text'));
    add_filter('the_title', array($this, 'number_text'));
    add_filter('widget_text', array($this, 'number_text'));
    add_filter('widget_title', array($this, 'number_text'));
    add_filter('bloginfo', array($this, 'number_text_in_bloginfo'), 10, 2);

    I would like also to be able to apply the filter function to text entered into 3rd party themes where they have text fields in theme support.

    For example, in the theme support for the freely available responsive theme, there are fields called headline, subheadline and content area. Is there a filter I can hook into that will apply the transformation in my filter to the text in those fields?

    Regards,
    Bruce/bugmagnet.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    I don't think you're going to find any generic filter. Every theme will be doing its own thing and there's no standard nomenclature for the fields in a theme's options.

  3. bugmagnet
    Member
    Posted 1 year ago #

    Hmmm ... so at what point in the processing of a page does the theme's options get evaluated? Does this content become part of the_content or does it fall into some other named bucket?

  4. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    at what point in the processing of a page does the theme's options get evaluated

    Again - that's going to be specific to the theme. Personally, I load all of the theme options as part of an initial setup function that is hooked into after_setup_theme but, again, there's no best practice documentation on this so individual themes may vary.

  5. bugmagnet
    Member
    Posted 1 year ago #

    Well, that's at least given me an idea of where to go with the client's theme. Thanks very much for your helpful advice.

  6. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    No problem :-)

Topic Closed

This topic has been closed to new replies.

About this Topic