• Hello.

    I created a very simple RSS/XML plugin that updates images on a WordPress site.

    Here’s the code:

    <?php session_start();?>
    <?php
    
    /*
    Plugin Name: SociallyAffluent.com's Event Feed
    Plugin URI: https://www.sociallyaffluent.com
    Description: This plugin allows for the display of several current events on the SociallyAffluent site.
    Version: #1
    Author: Isaiah Banks
    Author URI: https://www.sociallyaffluent.com
    */
    
    function load_social(){
    
    $feed_url = "https://www.sociallyaffluent.com/vstat_images.xml";
    
    echo  '<div style="border-bottom:1px solid #6a6a6a; margin-top:0px; width:300px; height:25px; color:#6a6a6a; font-family:Times New Roman; font-size:22px;">ATL Events</div>';
    
    if ($xml = simplexml_load_file($feed_url)) {
    
    echo  '<div style="width:300px; height:750px; margin-top:5px;">';
    
    foreach ($xml->channel->item as $item) { 
    
    $img1 = $item->img1;
    $img2 = $item->img2;
    $img3 = $item->img3;
    $img4 = $item->img4;
    $img5 = $item->img5;
    $img6 = $item->img6;
    
    echo '<div style="margin-top:0px; margin-left:-1px;"><a href="https://www.sociallyaffluent.com" target="_blank"><img src="'.$img1.'" width="110" height="126" /></a></div>';
    echo '<div style="margin-top:-131px; margin-left:115px;"><a href="https://www.sociallyaffluent.com" target="_blank"><img src="'.$img2.'" width="110" height="126" /></a></div>';
    echo '<div style="margin-top:5px; margin-left:-1px;"><a href="https://www.sociallyaffluent.com" target="_blank"><img src="'.$img3.'" width="110" height="126" /></a></div>';
    echo '<div style="margin-top:-131px; margin-left:115px;"><a href="https://www.sociallyaffluent.com" target="_blank"><img src="'.$img4.'" width="110" height="126" /></a></div>';
    echo '<div style="margin-top:5px; margin-left:-1px;"><a href="https://www.sociallyaffluent.com" target="_blank"><img src="'.$img5.'" width="110" height="126" /></a></div>';
    echo '<div style="margin-top:-131px; margin-left:115px;"><a href="https://www.sociallyaffluent.com" target="_blank"><img src="'.$img6.'" width="110" height="126" /></a></div>';
    
    }
    
    echo '</div>';
    
    }
    
    echo '<div style="margin-left:-1px; margin-top:-340px;"><a href="https://www.sociallyaffluent.com" target="_blank"><img style="border:none;" src="https://www.sociallyaffluent.com/Images/sa_vol_logo.jpg"></a></div>';
    
    }
    
    ?>

    I followed the “Writing A Plugin” manual step by step.

    I gave it a name (sociallyaffluentfeed.php), and installed the script in the “Plugins” folder and activated it in the control panel.

    I called the custom function in a file on the WordPress site’s main page

    <?php load_social ?>

    and somehow, someway it ruined the site’s entire feed giving me this error:

    Warning: Cannot modify header information - headers already sent by (output started at /home/dvason/public_html/wp-content/plugins/sociallyaffluentfeed.php:56) in /home/dvason/public_html/wp-includes/feed-rss2.php on line 8

    What does this mean and what do I need to do?

  • The topic ‘Simple Plug-In Problem…PLEASE HELP..I'M CLOSE TO SOLVING..’ is closed to new replies.