Archive for the ‘Development’ Category

Today i had to run again on my local machine some WordPress instances to find a bug and preview an integration with some services.


image credits to

Since the motivation is to have a quick development enviroment and at the time i had no access to the cloud VM’s and since creating WordPress solotions over IIS dangerous and tricky.
I had gone to one off my favourite tools for quick Lamp enviroments on a Windows Operating System :


By default Xampp uses siome ports and is always a fight to remember where we have to change things, that’s the reason for this digital note.

First we have to change the default ports used by the diferent tools that Xampp had embebed.


For demonstration i will show how to change the Apache ports, since for cross platform and technologies developer’s like me may have as major issue (granting that IIS, Visual studio
and Apache both run on the same machine) In case off apache you should change the configurations on appache Conf file.

Go to the Xampp installation directory (in my case d:\Xampp) and find the apache path \apache\conf here choose the file httpd.conf and edit the following key values:

Key File Line Number Description
Listen 58 port where Apache is listening Web Requests
ServerName 221 in the case you din’t have a DNS you define how Apache can be found

This solve the problem off Apache.

To grant that also the XAMPP Control Panel Admin button is loking also to the right port We need to interact with the configurtion file off Xamp interface. This is done on the xampp-control.ini File on the section [ServicePorts] (in our case we are changing the port to 8080).


Now we can have Xampp running Apache in a different port, the changes need to made to change MySQL and other services port is similar. I hope this post can be off any help if you fall in some stuck conner with Xampp configuration feel free to contact me maybe we can help you with our previous experience.



WordPress for beginner’s

Posted: October 11, 2012 in Development, Wordpress

Today i had been asked by a friend for what would be good references to start to develop in WordPress. I have compiled some usefull links and i decided to share them right now here, so here you have:


Theme reseller’s and Theme inspiration

SDK reference

WordPress and Portuguese WordPress community

The WordPress Loop

Posted: October 3, 2012 in Development, Wordpress


If I’ had to rate the most important Knowledge a WordPress developer should have, I’ would select the WordPress Loop, in this post and answering some request I will dive in to the WordPress Loop. Describing what’s the Loop is all about and how we should use this in our WordPress development.

This post is a first part post of two.

Defining the WordPress Loop

If we want a short description of this feature we may say “that the WordPress Loop  is just a PHP query that allow us to control and talk to the WordPress Content requests, basically is the hearth of WordPress”.

To help us understanding the loop let’s look at a basic usage of the WordPress Loop

A loop is a routine that reference typically not to single Field’s of data but to a collection of data typically post’s, so passing the Pipeline image to the code you find in the WordPress you would have:

<!--?php if (have_posts()) : ?>
<!--?php while (have_posts()) : the_post(); ?>


The rendering of the Posts data

<!--?php endwhile;?>


Actions you want to happen after the ending of the Loop


<!--?php else : ?>


When there is no data associated with the Loop sentence


<!--?php endif; ?>

We have describe the Basic Loop. The Basic Loop checks whether there are any posts to render, the number of element’s shown by the loop is controlled in the global blog settings.

When exists post’s to render the While Loop is started, and as long the number of post’s rendered is less or equal then the number defined in the settings the different post’s are iterated.

Best Practice note

In the beginning of WordPress and even today many Themes authors define the Loop of their Themes as part of the Index.PHP template file, and in the other Template files that have the need to show some Post contents. I personal recommend you to isolate the loop logic from the Theme presentation creating a separated  file where you will define the Loop template. To include the loop in to the Template file use the code i.e

<!–?php get_template_part (‘loop’,’index’); ?>

What will happen is that when processing the Index.php template the runtime will look for the Loop definition in to the loop-index.php.

The main propouse of defining a Template Loop is to control the loop in a specific case. If you don’t want to control that, the WordPress will only revert for the WordPress base loop that lives in to the loop.php file.

Using the Loop

Before we start to talk about the Loop control usage and the different way we can explore this, we need to take a look in to the “kernel” of the Loop WP_Query.

WP_Query is explained in the codex and is the class responsible for querying for post’s or some post’s information.

When in the above example we had use the instruction have_posts() what in reality we have done was $wp_queryàhave_posts(). Why this is important? Because knowing this means that you can have different Loop’s in the same template file and that you can also have multiple Loops running at the same time i.e

<!–?php $news_query = new WP_Query() ?> using now the news_query we can trigger a new Loop.

If you wish to use the Loop as a way to choose part’s of your posts to display or to define the way the post’s should behave, after knowing what’s the loop and that you can use the WP_Query as a way to define “subLoops”, the next set of tools you need to know are named as template tags. And what Template Tags can be used control the post output.

Template Tags  are defined by the Codex as WordPress instructions that allow us to do or get something (to know more about template tags worth to go to

The most common Template tags when you want to control a post rendering in the loop are:

<!–?php the_permalink() ?> – This will echo the permalink of the post, i.e

<!–?php the_title(); ?> – This echos the post title, i.e. Hello World!

<!–?php the_time(‘F jS, Y’) ?> – This will echo the datethe list of ways to format the date can be found on

<!–?php the_author() ?> – This will display the author’s name

<!–?php the_tags(‘Tags: ‘, ‘, ‘, ‘
’); ?> – This will display the tags assigned to the post, separated by commas, and followed by a line break

<!–?php the_category(‘, ‘) ?> – This will display the categories

<!–?php edit_post_link(‘Edit’, ”, ‘ | ‘); ?> – The edit post link will be visible only to those with permission.

<!–?php the_content_link(); ?> – Shows the content of the post.

Image now that you wish to override the Loop in order to get the following effect

Then your code would be similar with

<!--?php if (have_posts()) : ?>
<!--?php while (have_posts()) : the_post(); ?>

      <a href=”<?php the_permalink();?>” title=”<?php the_title()?>”/>

<!--?php endwhile;?>


<!--?php endif; ?>

In next part of this post we will look to other types of post, and how we can build multiple Loops and what are the cases in. We will also continuing to look to the Loop backstage magic and see the alternative to the loop usage.


To my references go to

One of the most versatile features of WordPress is Custom Post Types. There are great benefits of using more than the five native ContentTypes (Post, Pages, images, attachments and so on ), when using WordPress as a CMS. Custom Post Types enable us to create new types of Post or Page like contents, this kind of types are treated as equal citizens to Posts and Pages having their own dedicated Menu Item.

In this Post I will use the canonical example of Event to show you step by step how you can use this great WordPress Feature. For the development examples we will use the Default WordPress Theme, since all we want is to present the technic.

If we remember the basics of the development methodology, typical we use Posts generally for content that are updated frequently and pages are generally used for static content or list’s and container’s of other contents. After the 3.0 version of  WordPress we can now use the concept of Custom

Post Types that allow us to have more specific Types.

Now that you already know the main advantages of using Custom Post’s let’s start by creating a Custom Post to Model an Event.

First let’s open the file functions.php of our theme and start coding our new type.

add_action( 'init', 'create_events' );

this function will add create_events as a function to be called by WordPress
when WordPress Initiates (because we are passing init as the event to hook).

The create_events function will tell to WordPress how to display messages about our custom post type (using the Label attribute), in the
supports array we define what our new type will support. finally with the register_post_type we make the register of the new Type.

function create_events() {
  $labels = array(
    'name' => _x('Events', 'post type general name'),
    'singular_name' => _x('Event', 'post type singular name'),
    'add_new' => _x('Add New', 'Event'),
    'add_new_item' => __('Add New Event'),
    'edit_item' => __('Edit Event'),
    'new_item' => __('New Event'),
    'view_item' => __('View Event'),
    'search_items' => __('Search Events'),
    'not_found' =>  __('No Events found'),
    'not_found_in_trash' => __('No Events found in Trash'),
    'parent_item_colon' => ''
  $supports = array('title', 'editor', 'custom-fields', 'revisions');

  register_post_type( 'event',
      'labels' => $labels,
      'public' => true,
      'supports' => $supports

After entering the code and restarting the WordPress DashBoard we have already the options to create new posts of the Type we have

At this time we are able to create new post’s of the type we have created. At this time maybe you are saying “Ok so i am able to
create my own types but can i define their layout in a different manner than the native WordPress post’s?” And the answer is yes.

On WordPress themes a single post is displayed using the single.php theme file, from the WordPress version 3.0 you are allowed
to add a single-[your_post_type_name].php file to override how a custom post type are presented
. In our case we will not
redefine the way our Custom Post is presented but if we want to do that as you had seen would be very easy.

What would be not so straightforward is how to list our Custom Post’s, is to display a list of custom post types thought the use
of a Custom Page
Template. This is done by copying the contents of page.php to a new file called page-[your_post_type_naem].php.
In the loop of the Page Template you should put the following code

<?php query_posts(array('post_type'=>'event')); ?>

This way you will get all the Event Post’s you have at your Site.

To enable the content manager to choose this Page you should put the following code as an identifier of your page template ate
the top of the file

 * Template Name: Events Template
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0

get_header(); ?>

To use the page you have built you should log back in to the WordPress Dashboard, create a new page with the title of Events,
and then select the “Events Template” for the Template page attribute.

And that’s all, i hope this post has a help for you to learn one-off the most interesting extension features of WordPress.

Foot Note: This Feature is only available in version 3.0 or superior

If you are developing with WordPress it worths to tae sometime to look to the suggestions for audio and video of the expert group:Video & audio HTML 5 players for WordPress

Using WordPress as a CMS

Posted: September 8, 2012 in Development, Wordpress

Any developer using WordPress nowadays and a great part of the Web community knows that WordPress is useful for much more than blogging.

One of the places where i had use WordPress more in the last 4 years is in CMS scenarios, not only in my private projects but also in the company where i Work.

Knowing many CMS’s and being Technology agnostic make the decision of what is the right technology for a CMS scenario a technological rational decision, in this post i will try to explain the rational i use when i am deciding to use or not WordPress as the CMS platform of a project.

WordPress as a great advantage the fact that offers a simple and User Friendly way to manage and write contents, along with Images or media files.

Almost all the scenarios out there that you have for the web could be build using WordPress. But let’s not forget the importance of choosing the right weapon for your war in technology there’s no panaceas as we well know, so let’s take a look in what makes WordPress special for a case.

When our need is

– No licence need;

– Fast and easy to use and learn as a content manager or administrator;

– Easily extendable ( via widget or plugin);

– High customizable from a design point of view;

– Search Engine friendly;

– Good enough to edit  and treat images;

– usability is a priority;

– Full editorial site scenarios;

As you can see WordPress have a dreat potential for the almost all cases in the web today, but…There are other scenarios where we should think in another alternatives, like in the cases where:

– You need to consider Workflows;

– Scenarios where you have a lot of integration;

– When you have a very deep content tree;

– A lot of cases to consider as  templates;

– A strongly need of using Taxonomy hierarchies;

– A need of Modular solutions;

– The need of product support ;

– sophisticated Site Search needs;

– Intranet and extranet scenarios;

There are also other things to consider like the amount of private contents per example. Basically  WordPress is a great solution for CMS scenarios but sometimes we much consider other options. It’s clear that the advantage of quick development and big design capabilities are important but we should not be blind we have to consider that if we have a complex problem the solution should pass for more structured and modular CMS’s like Drupal, Sharepoint, Kentico , Umbraco and other’s.

Basically for today web quest’s WordPress is a big player and i believe that it will continue to grow using their extensible mechanisms like widget’s and plugin’s to be usefull in other scenarios.

WordPress is one of the hottest topics in web development today, and web mobile stills on the topic of the agenda. Can this to hot technologies live and help each other?! This is one of the questions i ear more in my WordPress and Web Trends conversation.

And the answer is yes let’s take a look in a way to do this.

To use WordPress development as an enabler of Web Mobile you can consider 3 different approaches.

1. Use responsive design in your Theme development

Responsive Design is a method that is ideal when you wish to adapt the user experience of your desktop version but mantaining almost all the content you have in the desktop version.

What you need to do to transform your Theme in to a responsive theme? You need to study what’s the user expectation when interacting from mobile devices with you WebSite and understand what wouldn’t have sex appeal in diferent screen sizes. Focus on the user expectation. You need also to work on your images and fonts in a way they adapt to the diferent resolutions and needs. You will also use CSS Media Queries to easily enable or adapt your Theme.

2. Create a Mobile Theme

Many times the UX that the user expects in your case and the need off your business can force us to think that only one site will not answer our prays in that cases maybe you should consider diferente Layout and functional aproaches depending the devices in this case you would have a diferente theme for your mobile devices. To do this you will need to use a “mobile Switsh” this can be made by a redirection in your code or using some plugin’s that make that switch for you consider looking to WordPress Mobile Pack or to WPtap Mobile Detector.


3. Use the community work and work with plugins that help you to easly enable Mobile development using WordPress

This is what i consider the quicker road and i think that every WordPress nowadays that doesn’t have a specific Mobile Target should implemente, just in case. This aproach is the most appropriated in the cases that you have a WebSite that is more about content then the rest. In this case you should consider plugins.

The ones i normal use are

WordPress Mobile Pack can be used as a mobile switcher has a mobile interface for editing posts.

WPtouch, displays your content is a mobile friendly way when the mobile switch is done.

I hope this helps to understand how to position your wordpress in to the mobile world, soon i will post some exemples of the first and second aproach that i had explain in this post.