WP Plugin Update: Simple Portfolio

As I’m moving to a VPS hosting, I’ve decided to remove the temporary homepage for WordPress plugin ‘Simple Portfolio’ which was located at http://projects.inlet.nl/simple-portfolio-wordpress3.  It was mainly focussed on how to use the API. In meantime the plugin has been evolved to a more mature version and the old plugin homepage doesn’t fit the requirements anymore. In fact you can expect more updates of the plugin soon and I’ll create a more decent theme (maybe based on the default twenty-eleven) which can be used as a plugin reference/wiki as soon as all new feature requests are implemented.

But for now you’ll need to stick with the existing sample theme.

Download Sample Theme

WordPress output to XML

For my current project I’m working on a Flash site which is based on a WordPress backend. There are many API’s out there for retrieving and manipulating data (for example FlashPress and SWFPress), but the problem is that most of these libraries are basically an overload for the project I’m working on right now.

I think that there is a strong need for a wordpress structured XML that gives you all the data you need:

  • Navigation Menu (see Appearance>Menu)
  • Pages
  • Posts
  • Bookmarks/Blogroll
  • Categories
  • .. and so on..

Soon I’ll write a plugin which you can install, so you can access your wp data via XML right away. For the timebeing here’s a temporary solution:

  1. Download this file
  2. Extract the file in your theme (wordpress installation/wp-content/themes/themename)
  3. When navigating to your wp site/wp-content/themes/themename/xml.php you get the data you need.

This xml.php file isn’t optimized yet and there’s space for improvement! Modify it for your project needs. Hoops this helps you out ;)

WordPress loop through Menus

Since the release of WordPress 3.0 it’s possible to create custom menus.

Theme developers can enable this menu by adding the following code to ‘functions.php’:

<?php
	add_action( 'after_setup_theme', 'theme_setup' );
 
	function theme_setup() {
		register_nav_menus( array(
			'primary' => __( 'Primary Navigation', 'theme-identifier' ),
		) );
	}
?>

After this the menus will appear in ‘Appearance’ and your ready to create some custom menus the way you like.
Implementing the menu in your theme is as easy as adding this line of code:

<?php wp_nav_menu(); ?>

This will output the menu in an unsorted list (<li>’s). Of course it’s possible to style these menus by providing an arguments array, but I rather retrieve all menus in an ordered array without directly displaying them on the page.

The solution I came up with is really simple (strange it isn’t really documented on codex):

<?php
	$menus = wp_get_nav_menus();
	$menu_items = wp_get_nav_menu_items($menus[0]);
 
	foreach ($menu_items as $menu_item):
		echo "<div>";
		echo " <a href='$menu_item->url'>$menu_item->title</a>";
		echo "</div>";
	endforeach;
?>

WordPress 3.0+ Portfolio Plugin

WordPress is by far the most popular blogging platform available. The new release version WordPress 3.0 includes some cool new features, like:

  • Custom Post Types
  • Taxonomies
  • Custom Admin Username and Password
  • Custom Headers
  • Advanced Menus
  • MultiSite
  • And lots more..

With this in mind I wrote an awesome portfolio plugin, called Simple Portfolio that makes your life easier ;-) . It enables you to have a portfolio section on your WordPress site in a proper way.

Simple Portfolio

Manage your portfolio projects easily and use them everywhere you like. This plugin is very simple to use, though it’s very powerful. It doesn’t bother you with a complex user interface. Add project specific information, for example your role and the team you’ve worked in. Add any media you like: YouTube, code snippets or any media from your wordpress built-in Media Library.

Create a project

Continue reading

DynImage: Powerful AS3 Image Util

Loading an external image in your flash/flex project isn’t that difficult, but mostly there are too many steps involved just for showing a regular image. As a flashdeveloper I need to show a bunch of external images for almost all my projects. Therefore I decided to write something that does all the loading logic and displays it in a smart way. DynImage is a very simple but powerful image util with extensible functionality. It’s very lightweight and easy to use! You can even assign a preloader and create custom animations in a single line of code. Besides, cropping and scaling an image to fulfill your needs can be done in a breeze!

So how does it works?

addChild( new Image("image.jpg") );

Is it really that easy?

Yes it’s that easy. The example above loads the image in it’s original size.
Mostly you want to constrain an image to a certain bounding box. Play with the parameters below and watch the generated AS3 code!

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

A zip file of DynImage can be downloaded at github.com. The zip file contains the source code and working examples (Flash CS4/CS5 & pure AS3).

If you have suggestions or questions please let me know! Or fork me at Github.com.

TextMate Php Command

Textmate is an editor I use a lot! Simple in use, but very powerful. Today I’ve been working on some PHP code where I needed to backslash a lot of double quotes. The solution: Use predefined commands!

Not really spectacular, but I just wanted to share this with you guys.

Screen shot 2010-07-22 at 17.15.59

Open the bundle editor in TextMate and create a command in PHP.

Screen shot 2010-07-22 at 17.17.14

Here you can define a command. Here is the command for adding slashes in your selected text:

sed 's/['"'"'"]/\\&/g'