WordPress.org

Forums

Edit the header.php (2 posts)

  1. ibragimof
    Member
    Posted 1 year ago #

    I can not edit the file header.php in wp-content\themes\my
    my code

    $url = 'http://...........';
    $start = '<div class="marquee">';
    $finish = '<div class="row-fluid" id="content">';
    function parser($url,$start,$finish) {
        $content = file_get_contents($url);
        $position1 = strpos($content, $start);
        $position2 = strpos($content, $finish);
        $content = substr($content, $position1, $position2-$position1);
        $content = $content;
        echo ($content);
        return $content;
    }
    
    parser($url, $start, $finish);

    if i put this code to header.php, my site don't work

  2. bcworkz
    Member
    Posted 1 year ago #

    Be sure you enter this after the <body> tag of your header.php. The content echoed alone appears to be inappropriate for <head> section. I don't know what content you're getting, but I inserted your code in my header.php file with $start.$url.$finish assigned to $content instead of getting contents -- it didn't cause any problems, the "URL" string was merely inserted in my site, so there doesn't appear to be anything wrong with the code itself.

Topic Closed

This topic has been closed to new replies.

About this Topic