• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

php script to embed only the content of my wordpress.com blog?

alley

Social Nutwork
NLC
I have a remotely hosted blog on Wordpress.com that I use to audio podcast with. I also have another website that is a social network type site. What I want to do is figure out a way to embed the audio blog posts from my Wordpress.com blog on to my social network site. I'm currently using an iframe, but it looks kind of cheesy because it loads the whole wordpress site (side modules). I was hoping there was a way to just pull the content from my Wordpress blog that has the play buttons for the audio files included. I can't use an rss reader because they just pull the text titles and not the play buttons and I want people to be able to play the audio on my site. An Mp3 player widget that played rss feeds would be awesome, but I can't find any of those at all either.
Any ideas?

Thanks
 
first, you need to make sure you have all the audio posts in a category. once you do, you can use php to grab your rss feed where the category is for the audio podcasts. then you can simply parse out the xml data however you want. pretty simple. :D
 
first, you need to make sure you have all the audio posts in a category. once you do, you can use php to grab your rss feed where the category is for the audio podcasts. then you can simply parse out the xml data however you want. pretty simple. :D

Thanks, but I'm not a coder so I better ask a mod to move this to Ads and Offers for me.
Thanks :)
 
Yeah, I can't pay anybody for this right now as I am currently unemployed but if anybody can help that would be great. If not that's ok too, I will just keep using the iframe. It's not a business site but just something I do for fun. :)
 
do the first part i mentioned about categorizing the audio podcasts that you want to pull, the rest is super simple man.

you will need this...

PHP:
/*******************************************
   RSS PARSING FUNCTION
*******************************************/

function parseRSS($url) { 
	
//PARSE RSS FEED
	$feedeed = implode('', file($url));
	$parser = xml_parser_create();
	xml_parse_into_struct($parser, $feedeed, $valueals, $index);
	xml_parser_free($parser);
	
	//CONSTRUCT ARRAY
	foreach($valueals as $keyey => $valueal){
		if($valueal['type'] != 'cdata') {
			$item[$keyey] = $valueal;
		}
	}
	
	$i = 0;
	
	foreach($item as $key => $value){
		
		if($value['type'] == 'open') {
			
			$i++;
			$itemame[$i] = $value['tag'];
			
		} elseif($value['type'] == 'close') {
			
			$feed = $values[$i];
			$item = $itemame[$i];
			$i--;
			
			if(count($values[$i])>1){
				$values[$i][strtolower($item)][] = $feed;
			} else {
				$values[$i][strtolower($item)] = $feed;
			}
			
		} else {
			$values[$i][strtolower($value['tag'])] = $value['value'];
		}
		
	}
	
	//RETURN ARRAY VALUES
	return $values[0];
	
}

then you can call it like so...

PHP:
// EXAMPLE: http://www.yourblog.com/feed/
// SPECIFIC CATEGORY EXAMPLE: http://www.yourblog.com/category/CATEGORY_NAME_HERE/feed/
$feed_page = "http://www.ibrightdev.com/category/getting-started/feed/"

//PARSE THE RSS FEED INTO ARRAY
$xml = parseRSS($feed_page);


$i=1;

// LETS LOOP THROUGH THE ARRAY AND OUTPUT THE FEED ITEMS
foreach($xml['rss']['channel']['item'] as $item) {
	
	echo	"
<h2><a class=\"title\" href=\"{$item['link']}\" class=\"indexBoxNews\">{$item['title']}</a></h2>
		<p class=\"description\">" . trunc_phrase(trim($item['description']), 40) . "<br/>
		<a class=\"read_more\" href=\"{$item['link']}\">&raquo; read more</a></p>
			";
	
	if ($i == 8)
		break;
	else
		$i++;

}

hope that helps. if you have trouble, let me know
 
OMG I am so lost .. lol
Well, for starters Wordpress.com doesn't have individual rss links for categories that I'm aware of? But that's ok, because I put all of my blogs in a main category anyways called "Voice Blogs".
You can find my rss links on the bottom of my page in the footer if you want to take a look at my Wordpress site?
http://crapvine.wordpress.com

As far as the code goes do I put both of those in th same php file? The social networking site that I want to embed the Wordpress feed in only allows me to use html code in the content blocks I think?, but I was hoping I could host the main php file somewhere else then link to it in the html code or something?
Here's the site I want to embed my Wordpress feed in:
http://crapvine.bligoo.com

Thanks
 
Alley, there are no direct rss links to a category, I just know how to get to what I want since I have felt with this a few times. So, categorize the posts and then follow instructions that I posted. As for hosting the file elsewhere, I will look at your site tomorrow, I'm on my phone right now and heading to bed.
 
ok, so, looked at your site. where are you wanting the feed? you will have to modify an actual theme file more than likely, so, let me know if you need help, and i will see what i can do. :)
 
if you can categorize your posts, im sure you can pull the feed for them. if you dont categorize them, then you can just pull the entire feed. are all the poses audio? just follow my instructions in the code sample for whole feed or category feed
 
Back
Top