Please help [need last blog entry]

Discussion in 'Programming' started by Site Owner, Jun 29, 2007.

  1. #1
    I have a Wordpress blog and I also have a website. I want to have section/box on my website that shows the latest blog entry (not link to it - the actual entry) . How would I do this in JavaScript? Thanks.
     
    Site Owner, Jun 29, 2007 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,839
    Likes Received:
    4,542
    Best Answers:
    123
    Trophy Points:
    665
    #2
    #1 Don't do it with Javascript or you get no SEO benefit for your efforts.

    I'd recommend you download simplepie and follow their example to place a single post. Then when it gets to the loop part use this instead
    		$output = '';
    		$feeddata = $this->getFeed($url);
    		
    		if (is_array($feeddata) && isset($feeddata['items']) && count($feeddata['items']) > 0)
    		{
    			$item = $feeddata['items'][0];
    			$output = "<a href='{$item->data['link']['alternate'][0]}'>{$item->data['title']}</a>\n";
    		}
    
    PHP:
    and tweak $output to give the right info and echo it out.
     
    sarahk, Jun 29, 2007 IP
  3. Site Owner

    Site Owner Peon

    Messages:
    69
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hey that looks great, and I've just downloaded it. But which file are you referring to?
     
    Site Owner, Jun 29, 2007 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,839
    Likes Received:
    4,542
    Best Answers:
    123
    Trophy Points:
    665
    #4
    Look through the zip file, there are a few demo scripts.
     
    sarahk, Jun 29, 2007 IP
  5. Site Owner

    Site Owner Peon

    Messages:
    69
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I just noticed that RSS ignores links and formating, I need everything to be shown as it is on the blog...:( any ideas?
     
    Site Owner, Jun 29, 2007 IP