• Resolved timholz

    (@timholz)


    Good Morning

    I am sometimes using the filter that offers the options to insert css either before, after or replacing a specified html-tag. The head tag is unique, therefore the number of targets is one. But other tags have many instances. When i use the script tag and before or after, the css gets added with every occurence of the script-tag.

    Would it be possible to modify the filter that, for instance the first occurence can be determined? (Like in css nth-child(1))

    Thanks a lot for your interest.

    regards
    theo

    p.s.: do you have more examples for the usage of filters?
    Not all of them are self-explanatory, at least for non-programmers…

    https://www.ads-software.com/plugins/autoptimize/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Frank Goossens

    (@futtta)

    hi theo;
    1. the replacement function (inject_in_html() in /wp-content/plugins/autoptimize/classes/autoptimizeBase.php) indeed has a bug (str_replace has no “limit” optoin, so will probably have to switch to preg_replace). this is on my list of things to fix for AO 2.0.
    2. there is example code for most (but not all) filters in /wp-content/plugins/autoptimize/autoptimize_helper.php_example.

    hope this helps,
    frank

    Thread Starter timholz

    (@timholz)

    hi Frank

    Thanks for the info.
    Yes, it is helpful.

    All the best for you and your work
    theo

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Filter’ is closed to new replies.