Posts

Build complex databases using wordpress

Custom post types and custom taxonomies empower wordpress to levels that allow complex database management. While the basic administration will not show you much, you can build your front side according to specific queries and searches, and as such administer your data from the front side.

  • How to build custom post type and custom taxonomies
    • the best way to build a custom post type is via the register_post_type function, instantiated as a new action  the init action, delcared your the theme specific functions file   :  if you don't want to code, you can still use the custom post type ui plugin, which apart from the advantage of being easy to use, will also let you build a theme independant custom post type database. The interesting feature of that plugin, for beginners, is that it lists all features of custom post type and also shows you the generated code it uses to create the custom post type via register_post_type. Another interesting plugin for dealing with cusomt posts types and taxonomies is the GD Custom Post plugin, whose interface lists all albels associated with  a custom post type or taxonomy.
      But you will not have the same flexibility and safety as if you were coding yourself . This last remark  applies to the custom taxonomy plugin Ultimate Taxonomy Manager, that does a very good job at dealing with custom taxonomies, but we've experienced trouble with the global permalink structure when doing specific jobs on permalinks. Same recommendation as custom post type,; use the specific register_taxonomy function to create your taxonomy.
  • How to perform complex queries
    • the ability to perform queires on multiple tags and taxonomies will help you filter your database records on the fly. Use the Query Multiple Taxonomy is a plugin that  will build specific taxonomy search dropdowns or filter links. One particular feature is that the dropdown is filtered by results from the main query :  I reused this  within the code that lists all tags and terms, filtered by results from the main query.
    • on the backend site, the advanced post manager plugin gives you a full search capability via drag and  drop

My wordpress plugin reference


  • Micro Kid's related post lets you select the post you want to relate, works for blogs with a lot of articles via ajax based search and displays related posts in both articles


  • how to print a query : user $wp_query->request

WordPress tabular data, slick interface

The free gantry framework is one of the many wordpress theme frameworks that come with premium themes distributed by rocketthem.com. One these themes is Omnicron, comes with a nice predesigned table layout that is a good example of clean talbe layout, often used to display various price plans for online services. RokFeatureTable is a theme specific plugin that was initially designed for joomla then adapted to wordpress, produces talbes that details fetaures in a clear  column layout


Mapress pro : use taxonomies to generate maps

Mappress pro, a plugin for wordpress, is worth its price : it can automatically create maps from custom fields adresses. I needed the possibility to create maps from a specific taxonomy, and this requires some hacking. here's the way to go for serious coders who want, like me, to spend one  intense hour . hope mappress pro incorporates that for future buyers !!

FIRST STEP : create a new configuration option for mappress to specify the custom taxonomy

  • in mappress.php
add_setting_field('customTaxonomyMap', __("Custom Taxonomy", 'mappress'), array(&this, 'setTaxonomy'), 'mappress', 'mappress_pro_settings'));
function set_custom_taxonomy_map() {
$options = Mappress_Options::get();
$pro_link = "<a href='http://wphostreviews.com/mappress/mappress-pro' title='MapPress Pro'>MapPress Pro</a>";
printf(__("This setting requires %s.  Automatically create maps from custom taxonomy.", 'mappress'), $pro_link);
}
in mappress_pro.php
  • function set_custom_taxonomy_map()
    {        $options = Mappress_Options::get();
        echo __(" Update map when terms are added to a post in the following taxonomy  ", "mappress");
            echo "<input type='text' size='30' name='mappress_options[customTaxonomyMap]' value='"  . $options->customTaxonomyMap. "'/>";}
  • and in mappress_api, don't forget to declare your new option as class variable of Mappress_Options
    $customTaxonomyMap=""

SECOND STEP : implement action hooks to create the map when the post is saved

  • in mappress_pro.php, function Mappress_Pro()
            if ($options->customTaxonomyMap) {
                    add_action('deleted_term_relationships', array(&$this, 'term_delete'), 10, 4);
                    add_action('added_term_relationship', array(&$this, 'term_added'), 10, 4);
            }
  • and
     function getTaxonomyMapKey($taxonomy)
      {
          return "tax" . $taxonomy;
      }
    function term_added($postid, $termId) // poleouest
    {
         $options = Mappress_Options::get();
        $taxonomy=$options->customTaxonomyMap;
        $mapMetaKey=$this->getTaxonomyMapKey($taxonomy);
        $pois=array();
        $this->term_delete($postid, $termId);
        $terms=get_the_terms( $postid, $taxonomy );
          foreach( $terms as $term ) {
              $city=$term->name;
            add_post_meta($postid,"hello",$city);
        if ($city!="")
        {$atts = array("address" => $city);
        $atts = $this->scrub_atts($atts);
    
       $poi = new Mappress_Poi($atts);
       $result = $poi->geocode(true);
       $pois[] = $poi;
        $map = new Mappress_Map();
    
            // Update with new POIs
            $map->update(array('pois' => $pois, 'title' => $city, 'metaKey' =>$mapMetaKey, 'center' => array('lat' => 0, 'lng' => 0)));
            $map->save($postid);
        }
          }
    }
    function term_delete($postid, $termId) // poleouest
    {
         $options = Mappress_Options::get();
        $taxonomy=$options->customTaxonomyMap;
        $mapMetaKey=$this->getTaxonomyMapKey($taxonomy);
         $map = Mappress_Map::get_post_map($postid, null, $mapMetaKey);
       if ($map)  $map->delete();
    }

Carrington for WordPress makes CMS easier

Sounds too good to be true : the Carrington wordpress theme framework, developped by Colorado based CrowdFavorite, implements what we've all been waiting  for :  AJAX/ drag & drop  wysiywg page structure management. It builds on the existing core WordPress theme structure and functionality and uses core WordPress theme functions for easy adoption by experienced theme authors.

wp super cache and WP3.0 menus

For those who are running small servers and wish to accelerate their worpdress installation, we recommend the installation of eaccelerator but also the wp-super-cache plugin. There is just a small hack for wordpress 3.0 menu users : the cache should be totally refreshed when a menu is modified, and this is performed via the wp_update_nav_menu action, instantiated in the wp-cache-phase2.php / wp_cache_phase2 function

add_action("wp_update_nav_menu" , 'wp_cache_clear_cache' );

Read more

WordPress single install / multiple blogs

Yes it is possible to host multiple sites for multiple customers with WordPress. The Multi User feature we expeted in wordpress 3.0 will satisfy bloggers only but we need something more specific. The technique I describe here is similar to the one described here in the sense that it directs the database configuration constants to specific databases instead of table prefixes as seen a lot. The advantage obviously is that you keep a single install of wordpress and only have one codebase to manage , while databases remain independant.

  • create wp-domains folder, and inside one folder for each domain, example wp-domains/mysite.com
  • add the following code to wp-config.php : this coding allows a defualt domain to remain active even when the configuration file does not exist, at the expense of a loss in performance. But It is useful to show what's missing.

$domain = strtolower( str_replace( "www.", "", $_SERVER["SERVER_NAME"] ) );
$domain = preg_replace('[^a-z0-9\.-]', '', $domain );
$domainDirectory="/wp-domains/" .$domain;
$domainConfig= dirname(__FILE__) . $domainDirectory . "/db-config.php";
if ( file_exists( $domainConfig ) ) {require_once( $domainConfig );} else {
$dbuser="defaultdomaindatabase";
$dbpwd="password";
if ($domain!="defaultdomain.com") echo "missing " .$domainConfig;}

  • replace definitions with variables in wp-config.php

define('DB_NAME', $dbuser);
define('DB_USER', $dbuser);
define('DB_PASSWORD', $dbpwd);

Once this is working with your default  domain, setup virtual hosts  in Apache and try a new domain. Remember on a new install to setup the upload folder in wordpress admin settings.

Multi site config for WordPress : Compatible plugins

I'm running the following plugins and they work perfectly

  • WP Super Cache : works fine because the cache filename coding alogrithm includes the domain name

WordPress : Upload images in post meta

verve-meta-boxes

Word press image upload is nice and perfectly integrated in the wysiwyg editor. If you need to specify clearly where the image will appear, you can use the post thumnbail feature that attaches a specific image to a post. But if you need to duisplay more than image per post, then you're better off using custom fields, and a few plugins are available to let you upload image directly to a custom field

Bonus : Custom Field Template Hack  displays full size image on custom image thumbnail in post / page edit in backend and additional function to automate image display in templates

Read more

Multilingual wordpress with wpml plugin

wpml is a wonderful plugin that has so many  it takes a while to get used to its power.

A new beta version of the multilingual plugin has been published for early adopters who have already switched to 3.0

What I've tested is interesting and allows quick setting of multilingual website

  • Flag displaying is almost instant thanks to dedicated functions or specific coding as documented here. Urls paths are well preserved and extended with the 2 letter language prefix.
  • Post translation is well implemented in the admin, each language displays a + button on the columns of the post / page
  • Posts can share common custom values or images, technique described here
  • all strings thath use the _e function in templates are translatable in the admin or in a mo file
  • as of today the wordpress 3.0 menu and custom post types do not work well with wpml but work is ongoing

wbFurnitureShop : premium wordpress cms theme

wbFurnitureShop is a wordpress template that is an extremely simplified theme for using wordpress as a cms for making a presentation site. Exazmple is provided here in the form a furniture store template designed to use standard wordpress distribution to display a product line, content pages and a jquery  slider that is configured via the standard wordpress content management  interface.
wbFurnitureShop wordpress template was specially developped for latest version of wordpress 3 , which is now available as beta on wordpress.org.
Get in touch now : for less than an hours work you get  fully configured web site with easy admin and wordpress CMS features and full 24hours support for life !


screenshot

Main home page screenshot

widgetSidebar

specific admin widget sidebar

customslide1

Custom post type for products


  • wbFurnitureShop template is a customization of wordpress 3.0  template and includes :
    • the  home page with jquery slider (uses carousel) implemented as custom posts type,
    • the page and post templates : use the page for content and posts for products
    • custom query that  displays lastests posts as products thumbnails  with link to permalink.
    • Sidebar and footer use content widgets for maximum content management.
  • General layout features
    • fixed 750 px Layout (change width in style : #wrapper)
    • cufont enabled, distributed with Champagne & Limousine
    • drop down menu enabled
  • Content display features
    • two column layout on homepage and product pages
    • single column layout on content pages
    • Lastest products remain on bottom of all pages for best user experience and internal site navigation
  • WordPress features
    • thumbnail enabled
    • menu enabled (new function wp_nav_menu)
    • custom type for slide images
    • widget ready ( sidebar  + footer) - use textwidget to display text
  • Goodies
    • is distributed in a zip that contains
      • ttf or otf  font file, cufont, jquery,
      • sample images for testing and working with the template
      • PSD for the top logo and first slide
    • included : PDF install intructions wbFurnitureShopTemplateInstallInstructions

BUY NOW on webmasterbulletin.net/shop

WordPress password protected pages / blog

as of version 3 of WordPress, posts and pages have three options for visibility  :

  • public : everyone sees the post,  in the list and directly from the permalink
  • password protected  post title is displayed only,  permalink works but content protected by password
  • private : not displayed in the list for guests (non connecte) visitors, permalink returns 404

What we're looking for today is a solution that hides the post from the list but allows certain users to see it via permalink. Of course you can give the permalink and tell the user to identify via the wp-login page, but this can be complex for beginners. Ideally you would give the permalink of a private page and if not connecetd the visitor will be presented a login prompt. Here's a review of available  solutions, tips and plugins

  • Tip : post specific template that redirects user to standard login form
    http://www.rlmseo.com/blog/require-login-for-wordpress-pages/
    found also at  : http://www.marketingtechblog.com/wordpress/login-content-wordpress-page-template/
  • a specific option allows coder to redirect user to a page after login  : http://brockangelo.com/2009/12/17/redirect-users-back-to-page-they-were-on/
  • wp private plugin displays a login form in place of the restricted part of the article
  • Member Access plugin overrides wordpress default settings in a new menu, and redirects the restricted pages to the login screen. Indeed, does the job perfectly but the fact that it doesn't use the default wordpress might compromize compatibility with future versions. For the moment  I've tested it on v3.0 beta and works fine.
  • User Access Manager plugin does the same job but I haven't tested it and seems to be inactive
  • UserBase Access Control looks like a new promising development

Other privacy options and plugins are available for WordPress. We've tested for our intranet project some pugins that restrict the whole blog to registered users.

WordPress Plugin Review : SEO all in one

The popular All-in-on SEO pack plugin for wordperss does more than just adding the essential meta fields to your articles and pages interfaces. For lazy writers, SEO pack will also create meta tags AUTOMATICALLY the content for these essential code addons that will boost your search engine positionning. A simple tag based configuration will allow you to set up categories, tag and archive pages optimisation via the TITLE tag, most important of all because it is the first thing visitors see when they look at search engines result pages.

A corporate site with WordPress

Ever thought of using WordPress as a CMS ? Today's showcase features a perfect example of wordpress implentation for corporate advertising. Served by efficient graphic design, 4 seasons entertainment implements an event page, a list of artists via wp-page-numbers plugin, and of course the usual suspect CFORMS.

Showcase your site on webmasterbulletin

If you're in the business of creating stunning websites powered by efficient opensource or commercial CMS, let the world know : submit your work for review at webmasterbulletin showcase !!

Today's showcase : 4 seasons

4 Seasons Entertainment & Events has been bringing life to many major events in Dubai, U.A.E for over a decade. 4 Seasons delivers results, time and again. We pride ourselves to be one of the few agencies that renders 360 solutions for any type of event. All our resources are in-house, giving us the flexibility to support any event from small internal meetings to large conference and awards dinners or product launches with efficiency and precision.

Link : 4 Seasons Entertainment

Blog design showcase : Foozoo

The Foozoo design studio blog does not display images on its front page : black and white is the color of sobriety. Inside pages will feature, obviously, images, plus a nice soft blue font that highlights margins and  Based on the very simple Hemingway-19 theme for wordpress, Foozoo adds a few very interesting plugins. Most interesting is the WP-cumulus plugin that transforms the original tag cloud to a real Flash based sphere with mouse 3D effect.

WordPress Plugin : blogroll pages

We provide here a modification of Mark Allen ' Blogroll page plugin, that inserts blogroll into any page of your blog . What we did here is modify his plugin to create more than just a list : we make pages out the blogroll list, one page per category. The first page lists categories with link to blogroll list for this category. Slight Modification but useful fo SEO. Future implementations should modify title page to integrate category description. Enjoy and let us know how it goes.

Drag & Drop page Order for wordpress

One feature that is not in latest wordpress is tha ability to sort content pages easily. The PageMash plugin is the best option to convert Wordperss to one of the best CMSes you'll find on PHP opensource. Imagine a 5minute installation that provides bloggin tools, including SPAM management (ASKIMET) plus Content Management with Wysiwyg and custom fields : that's wordpress with PageMash !! PageMash uses AJAX to implement a draggable hierachical page tree that allows administrator to manage the parent pages structure from administrative interface with an option to toggle the page to be hidden from output. Impressive.

WordPress parse posts for images

If it hadn't been there we'd have invented it.  Writing articles with inline images is a long job for a blogger, noone needs more time-consuming image presentation tasks. WP-Post-Banners is a standalone script / wordpress plugin that can mine your WordPress posts or any other data and look for images suiting a given dimension and generates ‘featured’ section for your site using the found items. The featured section, includes a resized image (banner) with the label, description and link of the related post or data.

Read more

Laying text over title image in wordpress

Used by many news portals, the technique above is a great example of how to optimize layout of breaking news. We have gone the simple way with the image above, using a combination of Photoshop layers over a background image. The way it is implemented for WordPress platform by Derek Punsalan illustrates the power of wordpress custom fields, and also the limits of this input system. We would like to have image custom input fields, such as file browser or color selector. The popular custom field GUI plugin handles select, checkboxes and radio buttons but would require extensions to handle more advanced input types. There is hack on WordPress forums for that plugin  that handles Wysiwyg fields, but I would not expect it to be maintained over future versions of WordPress. The "More Fields" Plugin is a bit more flexible and is worth having a look at too.

Iphone wordpress blogger application

This is hot : managing content with a mobile phone was only a distant dream for the masses until this application came live. the WordPress for Iphone application is the kind of add on that makes you buy a phone if you're a wordpress blogger, or that would make you swithc to wordpress if you were wondering which blogging platform is best. More than that, Iphone for wordpress lets you work with any self hosted wordpress (2.5.1 or higer) application, WordPress MU 1.5.1, or even wordpress.com blogging platform !! The App works with the new iPhone 3G, the first generation iPhone, and the iPod Touch. Its code has been released as opensource for developers to debug.