simple string replace? (first plugin) (5 posts)

  1. KillerSneak
    Posted 4 years ago #

    So i'm trying to fix some minor problems with a clean 3.3 install and the TwentyEleven template (1.3)

    the first error i want to fix is the

    <a href="http://wordpress.org/" title="Semantic Personal Publishing Platform" rel="generator">Proudly powered by WordPress</a>

    and change rel="generator" to rel="author" with the code below but it's not working (note this is my first attempt at a plugin)

    function replace_content_rel_generator($content) {
    $content = str_replace("rel='generator'", "rel='author'", $content);
    return $content; }
  2. Chouby
    Posted 4 years ago #

    You have double quotes in your string "generator" and use single quotes in your str_replace 'generator'

  3. Mark / t31os

    Posted 4 years ago #

    wp_footer is not a filter, it's an action, it does not pass you any content to do string replacement on.

  4. kitchin
    Posted 4 years ago #

    That text is added by the theme. Generally themes override plugins. You could make it happen, using http://php.net/ob_start/ but there may be a better way. Or just mod the theme, footer.php.

  5. Mark / t31os

    Posted 4 years ago #

    Better yet..

    1. Create a child theme.
    2. Copy the footer.php from the TwentyEleven theme into your child theme's directory.
    3. Open the file, remove what you don't want.
    4. Save the changes.
    5. Job done.

Topic Closed

This topic has been closed to new replies.

About this Topic