WordPress.org

Ready to get started?Download WordPress

Forums

my-hacks.php problem... :( (5 posts)

  1. spirit892
    Member
    Posted 10 years ago #

    I tried looking at the wiki.wordpress articles and I got no where. I am so confused. I followed the steps and everything, but when I tried to publish a test post, I got an error. I'll include the my-hacks.php file here. Can someone help? Thank you. Here is the error:
    Warning: Cannot modify header information - headers already sent by (output started at /home/spirit89/public_html/my-hacks.php:3) in /home/spirit89/public_html/wp-admin/post.php on line 158

    <?php
    function sortr_longer($first, $second) {
    return (strlen($first) < strlen($second)) ? 1 : -1;
    }
    ?>
    <?php
    function acronymit($text) {
    $acronyms = array(
    'WYSIWYG' => 'what you see is what you get',
    'XHTML' => 'eXtensible HyperText Markup Language',
    'IIRC' => 'if I remember correctly',
    'HDTV' => 'High Definition TeleVision',
    'LGPL' => 'GNU Lesser General Public License',
    'MSDN' => 'Microsoft Developer Network',
    'WCAG' => 'Web Content Accessibility Guidelines',
    'SOAP' => 'Simple Object Access Protocol',
    'OPML' => 'Outline Processor Markup Language',
    'MSIE' => 'Microsoft Internet Explorer',
    'FOAF' => 'Friend of a Friend vocabulary',
    'GFDL' => 'GNU Free Documentation License',
    'XSLT' => 'eXtensible Stylesheet Language Transformation',
    'HTML' => 'HyperText Markup Language',
    'IHOP' => 'International House of Pancakes',
    'IMAP' => 'Internet Message Access Protocol',
    'RAID' => 'Redundant Array of Independent Disks',
    'HPUG' => 'Houston Palm Users Group',
    'VNC' => 'Virtual Network Computing',
    'URL' => 'Uniform Resource Locator',
    'W3C' => 'World Wide Web Consortium',
    'MSN' => 'Microsoft Network',
    'USB' => 'Universal Serial Bus',
    'P2P' => 'Peer To Peer',
    'PBS' => 'Public Broadcasting System',
    'RSS' => 'Rich Site Summary',
    'SIG' => 'Special Interest Group',
    'RDF' => 'Resource Description Framework',
    'AOL' => 'American Online',
    'PHP' => 'PHP Hypertext Processor',
    'SSN' => 'Social Security Number',
    'JSP' => 'Java Server Pages',
    'DOM' => 'Document Object Model',
    'DTD' => 'Document Type Definition',
    'DVD' => 'Digital Video Disc',
    'DNS' => 'Domain Name System',
    'CSS' => 'Cascading Style Sheets',
    'CGI' => 'Common Gateway Interface',
    'CMS' => 'Content Management System',
    'FAQ' => 'Frequently Asked Questions',
    'FSF' => 'Free Software Foundation',
    'API' => 'Application Interface',
    'PDF' => 'Portable Document Format',
    'IIS' => 'Internet Infomation Server',
    'XML' => 'eXtensible Markup Language',
    'XSL' => 'eXtensible Stylesheet Language',
    'GPL' => 'GNU General Public License',
    'KDE' => 'K Desktop Environment',
    'IE' => 'Internet Explorer',
    'CD' => 'Compact Disk',
    'GB' => 'Gigabyte',
    'MB' => 'Megabyte',
    'KB' => 'Kilobyte'
    );
    uksort($acronyms, 'sortr_longer'); // comment out if already sorted
    foreach ($acronyms as $acronym => $definition) {
    $text = preg_replace("#$acronym(?!</(ac|sp))#", "$acronym", $text, 1);
    $text = preg_replace("#$acronym(?!</(ac|sp))#", "<span class='caps'>$acronym</span>", $text);
    }
    return $text;
    }
    add_filter('the_content', 'acronymit');
    ?>

    I hope someone can help. Thank you again.

  2. Matt Mullenweg
    Troublemaker
    Posted 10 years ago #

    Okay, there should be no whitespace or new lines outside of the PHP tags. The my-hacks page on the wiki spells this out.

  3. Mark (podz)
    Support Maven
    Posted 10 years ago #

    If the error is before the first < then you have whitespace there as allusion has mentioned.
    There should be nothing before the very first < and nothing after the last >
    What is contained actually in between those tags matters little as long as the code is correct.

  4. Anonymous
    Unregistered
    Posted 10 years ago #

    I have the same problem.
    Hack file only contains
    <?php ?>

  5. spirit892
    Member
    Posted 10 years ago #

    I figured it out. Just fiddled with the code a little and now it works. Thanks so much for your help!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.