Support » Themes and Templates » Twenty Eleven Custom Header and Multi-Site wrong URI

  • I am using Twenty Eleven on a multi-site setup with domain mapping, and the problem I run into is that the header image referes to the network url instead of the mapped domain, potentially causing Google to label the sites as duplicate content. Apart from that, it also looks bad of course.

    I haven’t found any other discussions on this topic, so I have devised a solution of my own using a child theme with a custom header.php.

    Look for the <img> tag of the header, and use this instead for the ‘src’:

    <?php
    function strnposr($haystack, $needle, $occurrence, $pos = 0) {
        return ($occurrence<2)?strpos($haystack, $needle, $pos):strnposr($haystack,$needle,$occurrence-1,strpos($haystack, $needle, $pos) + 1);
    }
     print(substr(get_header_image(),strnposr(get_header_image(),'/',4))); ?>

    It will transform the absolute url to a relative one.

    Does anyone have a better solution that doesn’t require a child theme, or could the theme be updated?

  • The topic ‘Twenty Eleven Custom Header and Multi-Site wrong URI’ is closed to new replies.