Display Your Instructables on a Wordpress or PHP Based Page
by MrRedBeard in Circuits > Websites
5269 Views, 70 Favorites, 0 Comments
Display Your Instructables on a Wordpress or PHP Based Page
Ever want to have a listing of your Instrucatbles on a webpage like what is displayed on your profile? I tried several WordPress plugins but came up with nothing so I wrote/came up with a solution.
(UPDATE)
I have written a Plugin for WordPress to do this http://wordpress.org/plugins/instructables/. I have a new instructable for that located here https://www.instructables.com/id/Instructables-Wordpress-Plugin/ I would love feedback from you guys.
In this Instructable I show you how to accomplish this in WordPress and in a simple php based page. You can see a working example here http://mrb.mickred.com/redbeard-on-instructables-com/
Checklist
You will need the following:
A WordPress site with the "Exec-PHP" plugin installed, simple PHP page or other content manager that allows php code.
An Instructables profile with at least one Instructable written, note your username.
In Wordpress
Create a new Page then click "Text" as shown in the image below.
Paste in the following code then change "MrRedBeard" to your username in the $url variable.
<?php
$url = "https://www.instructables.com/member/MrRedBeard/rss.xml?show=instructable";
$feed = simplexml_load_file($url);
$feed_array = array();
foreach($feed->channel->item as $item)
{
echo "<div style='float:left; width:200px; height:300px; margin-right:15px; text-align:center;'>";
echo "<a href='" . $item->link . "' target='_blank'>";
if(strpos($item->imageThumb,"com"))
{
echo "<img src='" . $item->imageThumb . "' />";
}
else
{
echo "<img src='https://www.instructables.com" . $item->imageThumb . "' />";
}
echo "<br />" . $item->title . "</a></div>";
}
echo "<div style='clear: both;'> </div>"
?>
Page built using this Instructable <a href="https://www.instructables.com/id/Display-your-Instructables-on-a-Wordpress-or-PHP-b/" target="_blank">https://www.instructables.com/id/Display-your-Instructables-on-a-Wordpress-or-PHP-b/</a>
Simple PHP Page
<?php
$url = "https://www.instructables.com/member/MrRedBeard/rss.xml?show=instructable";
$feed = simplexml_load_file($url);
$feed_array = array();
foreach($feed->channel->item as $item)
{
echo "<div style='float:left; width:200px; height:300px; margin-right:15px; text-align:center;'>";
echo "<a href='" . $item->link . "' target='_blank'>";
if(strpos($item->imageThumb,"com"))
{
echo "<img src='" . $item->imageThumb . "' />";
}
else
{
echo "<img src='https://www.instructables.com" . $item->imageThumb . "' />";
}
echo "<br />" . $item->title . "</a></div>";
}
echo "<div style='clear: both;'> </div>"
?>
Page built using this Instructable <a href="https://www.instructables.com/id/Display-your-Instructables-on-a-Wordpress-or-PHP-b/" target="_blank">https://www.instructables.com/id/Display-your-Instructables-on-a-Wordpress-or-PHP-b/</a>
Customizations
There are also other feeds like
https://www.instructables.com/member/MrRedBeard/rss.xml?show=comments
https://www.instructables.com/member/MrRedBeard/rss.xml?show=good (favorites)
https://www.instructables.com/member/MrRedBeard/rss.xml?show=subscriptions (new instructables from your followers)
<?php
$url = "https://www.instructables.com/member/MrRedBeard/rss.xml?show=instructable";
$feed = simplexml_load_file($url);
$feed_array = array();
foreach($feed->channel->item as $item)
{
echo "<div style='float:left; width:200px; height:300px; margin-right:15px; text-align:center;'>";
echo "<a href='" . $item->link . "' target='_blank'>";
if(strpos($item->imageThumb,"com"))
{
echo "<img src='" . $item->imageThumb . "' />";
}
else
{
echo "<img src='https://www.instructables.com" . $item->imageThumb . "' />";
}
echo "<br />" . $item->title . "</a></div>";
}
echo "<div style='clear: both;'> </div>"
?>
Page built using this Instructable <a href="https://www.instructables.com/id/Display-your-Instructables-on-a-Wordpress-or-PHP-b/" target="_blank">https://www.instructables.com/id/Display-your-Instructables-on-a-Wordpress-or-PHP-b/</a>
Questions
Updates
First update. If you just published an Instructable it will not show up immediately. Not sure why this is but I will try and note the delay time once it starts to appear. (About 15 minutes after publishing I noticed it showed up)
Second update. Some image paths differ from others, I added code to check for this. I also noticed that the layout looked funny with long titles so I changed the layout a bit.