ThemeShaper Forums » Thematic

[closed]

function thematic_create_doctype()

(6 posts)
  • Started 5 years ago by joeysantiago
  • Latest reply from helgatheviking
  • This topic is not resolved
  1. joeysantiago
    Member

    hi everyone... i'm trying to filter this function in order to switch to xhtml 1.1 strict, but i haven't understood how should i write this function: should it return a string, or use an echo, or...?

    sorry i'm an absolute noob on wordpress! :)

    Posted 5 years ago #
  2. Hey,

    return the string .. take a look here:

    function my_create_doctype($content) {
        $content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
        $content .= '<html xmlns="http://www.w3.org/1999/xhtml"';
        return $content;
    }
    add_filter('thematic_create_doctype', 'my_create_doctype');

    Doesn't make sense 'cause it's still the original unchanged content. So just change $content to your needs.

    Cheers,

    Chris

    Posted 5 years ago #
  3. Thanks Chris! :)

    Posted 3 years ago #
  4. This filter is giving me an internal server error. Am I missing something?

    Posted 2 years ago #
  5. You are correct about the error. Try,

    function my_create_doctype($content) {
        $content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
        $content .= '<html xmlns="http://www.w3.org/1999/xhtml"';
        return $content;
    }
    add_filter('thematic_create_doctype', 'my_create_doctype');

    Swapped out apply_filter with add_filter

    Posted 2 years ago #
  6. good catch scott. i've edited chris' code.

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.