Category Archives: Wordpress

WordPress How To: Easily make an admin panel for a plugin

April 19, 2007 by aaron
I find the Admin panel the most tedious part of plugin development–even the slightest changes to the plugin requires major changes to the Admin panel, and it can be hard to remember every option you have in your plugin. However by following a few simple rules, your next Admin panel will be a breeze. Once you have the basic parts down, new options are just a cut and past away. One thing to note is that his Admin panel uses a few features that are best if repeated inside your plugin itself.
Read More ⟶

A few WordPress Tricks.

April 9, 2007 by aaron
Just a few little tips for WordPress: If you don’t want the titles of posts to have the » character before them for SEO purposes just use: < ?php echo trim(wp_title('&raquo;',false), '&raquo; ');?> I was sick of my index.php being used to display pages, so I added the following to the top of my index.php to force WordPress to use single.php for all pages: < ?php if(is_page()){ include(&#039;single.php&#039;); exit; } ?> I wanted to be able to use javascript in some of my pages so I added the following to my header.php: <?php if(is_page()){ $j = get_post_meta($post->ID, &#039;header&#039;, true); if($j != &#039;&#039;){ echo $j; } } ?> Now anytime I need special style or javascript code added for a particular page I just add a custom field with the name header.
Read More ⟶

Redirecting a large number of posts to their new WordPress permalinks.

April 25, 2007 by aaron
Add this to the VERY top of your theme’s 404 page. Change http://localhost/wordpress to your default wordpress folder. This just does posts and possibly pages that end in the id (with or without the trailing url) Categories etc will have to be done elsewhere or by hand. < ?php //Kinda obvious $rf = $_SERVER[&#039;REQUEST_URI&#039;]; $rf = explode(&#039;/&#039;,$rf); $last = count($rf); //Filter out regular 404 that arn&#039;t old urls if(is_numeric($rf[$last-1])){ $post_id = $rf[$last-1]; }elseif(is_numeric($rf[$last-2])){ $post_id = $rf[$last-2]; } // No sense loading WP if there isn&#039;t an id if ( $post_id ) { // Oh fine we will load wordpress define(&#039;WP_USE_THEMES&#039;, false); require(&#039;http://localhost/wordpress/wp-blog-header.php&#039;); $post = get_post($post_id); //Well hope it is the right post.
Read More ⟶

Yay…

April 22, 2007 by aaron
WordPress version 2.1 is finally out. Now I can official stop doing my redesign on beta software, and I can now work to update the Super Categories plugin.

WordPress How To: Easily make an admin panel for a plugin

April 19, 2007 by aaron
I find the Admin panel the most tedious part of plugin development–even the slightest changes to the plugin requires major changes to the Admin panel, and it can be hard to remember every option you have in your plugin. However by following a few simple rules, your next Admin panel will be a breeze. Once you have the basic parts down, new options are just a cut and past away. One thing to note is that his Admin panel uses a few features that are best if repeated inside your plugin itself.
Read More ⟶

A few WordPress Tricks.

April 9, 2007 by aaron
Just a few little tips for WordPress: If you don’t want the titles of posts to have the » character before them for SEO purposes just use: < ?php echo trim(wp_title('&raquo;',false), '&raquo; ');?> I was sick of my index.php being used to display pages, so I added the following to the top of my index.php to force WordPress to use single.php for all pages: < ?php if(is_page()){ include(&#039;single.php&#039;); exit; } ?> I wanted to be able to use javascript in some of my pages so I added the following to my header.php: <?php if(is_page()){ $j = get_post_meta($post->ID, &#039;header&#039;, true); if($j != &#039;&#039;){ echo $j; } } ?> Now anytime I need special style or javascript code added for a particular page I just add a custom field with the name header.
Read More ⟶

Redirecting a large number of posts to their new WordPress permalinks.

April 25, 2007 by aaron
Add this to the VERY top of your theme’s 404 page. Change http://localhost/wordpress to your default wordpress folder. This just does posts and possibly pages that end in the id (with or without the trailing url) Categories etc will have to be done elsewhere or by hand. < ?php //Kinda obvious $rf = $_SERVER[&#039;REQUEST_URI&#039;]; $rf = explode(&#039;/&#039;,$rf); $last = count($rf); //Filter out regular 404 that arn&#039;t old urls if(is_numeric($rf[$last-1])){ $post_id = $rf[$last-1]; }elseif(is_numeric($rf[$last-2])){ $post_id = $rf[$last-2]; } // No sense loading WP if there isn&#039;t an id if ( $post_id ) { // Oh fine we will load wordpress define(&#039;WP_USE_THEMES&#039;, false); require(&#039;http://localhost/wordpress/wp-blog-header.php&#039;); $post = get_post($post_id); //Well hope it is the right post.
Read More ⟶

Yay…

April 22, 2007 by aaron
WordPress version 2.1 is finally out. Now I can official stop doing my redesign on beta software, and I can now work to update the Super Categories plugin.