Archive for the ‘Wordpress’ 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.

lamp_stack

image credits to shravam15.wordPress.com

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 :

xamp-downloads

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.

xampp-dashboard

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).

serviceports

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.

 

 

Some days ago i had the need to look for WordPress plugin’s for SEO optimization i had found a plugin that worth a view and the most refreshing part of this discovery is that the developer team behind this plugin share a lot of knowledge about SEO with their clients and make also some consulting if you need.

 

wpseo

 

Here you have the official website page http://yoast.com/wordpress/seo/ and also the article to help you improve your WordPress website http://yoast.com/articles/wordpress-seo/

I Was a speaker in WordCamp Portugal sometime ago ( to know more about go to https://digitalmindignition.wordpress.com/2012/09/30/wordcamp-lx-2012-the-morning-after/), last Friday i gave a small interview to this year  WordCamp Porto, next we publish the interview if you want to go to the Portuguese organization site you can go to http://2013.porto.wordcamp.org/2013/08/16/preparem-se-bem-aconselha-alexandre-marreiros-aos-oradores-do-wordcamp-2013/

Was a pleasure to be in WordCamp some years ago and is great to view how well structured WordPress adoption had been made.

“Be really Prepared!” Advices Alexandre Marreiros to the

WordCamp 2013 speakers

Alexandre_Marreiros

“Be really prepared” with an exclamation point at the end of the sentence. Alexandre Marreiros recommends those who are interested in making presentations at WordCamp Port to do the homework. Speakers should also be ready to be “original, hardworking and incisive.”

Speaks who knows. Who took the stage at WordCamp 2012 in Lisbon to discuss the implementation of plugins.

Alexandre Marreiros a degree in Computer Engineering and Computers by ISEL. Since January 2010 shall act as the CTO Innovagency .

Alexandre acceded to our invitation to answer some questions about WordCamp, WordPress and announce that the calendar tells you to 9 and November 10 will be in a certain event in Porto.

What was the topic addressed in the presentation?

The theme of my presentation was to implement plugins for WordPress framework. The plugins are all extensibility mechanisms of WordPress that has the greatest potential, unfortunately not the whole community understands or knows how to implement. The aim of the session was precisely sensitize developers in a relaxed but incisive for the development and use of this mechanism as well as explain some of the details that occur behind the scenes at runtime WordPress.

It is a topic that still stands today?

Without a doubt. That is because in addition to knowledge of programmatic plugins allow us to understand many of the basic concepts of the runtime of WordPress allows anyone engaged in the development of solutions based on WordPress and acertivo be more “modular”. Besides being one of the plugins more powerful extensibility features of WordPress there is an entire “market” based on this type of development that has grown immensely and that is far from being exhausted.

Still retains the enthusiasm in WordPress?

Yes It’s been interesting to see the adoption of the WordPress platform to grow, as it has grown since the blogosphere to be used as core to the digital content management, which increasingly see solutions ‘not web’ to use WordPress as a backend. It is a platform where there is still much work to do and with a huge growth potential.

How did the WordPress?

I started using WordPress for a blog privately and quickly began to adopt a logic of backoffice web solutions developed under this freelancing at a stage not yet via WordPress as a CMS platform.Also used WordPress as a content provider via feeds for “3rd party aplications” in the epoch in which he spoke very adopting webservices but in the paradigm used was mainly SOA, what kind of solutions for fast and that detached intended was too heavy. Were thus the first technical contact I had with WordPress in mid 2005/2006.

Any suggestions for potential speakers next WordCamp?

Yes Prepare well! The WordCamp must normally be a very interventional and multidisciplinary audience with good skills in WordPress matter as such deserve themes that really pull the audience who watch and help to achieve a higher level. Be original, hardworking and incisors.

WordCamp will be in Porto?

Probably yes, at least it is marked on my calendar ;).

 

original news at  http://2013.porto.wordcamp.org/2013/08/16/preparem-se-bem-aconselha-alexandre-marreiros-aos-oradores-do-wordcamp-2013/ (all credits to Jose Freitas and WordCamp 2013, translation by Google Translation tool)

There are essentially to ways to host WordPress in to Windows Azure, the first is using the Windows Azure Websites feature (http://www.windowsazure.com/en-us/services/web-sites/), this is a good approach when you have simple solutions of wordpress that use plugin’s that runs equal in Windows SO as in Linux SO. The other way is mounting a server on the cloud, in some cases this can be the best option, if you want to create a dedicated server to host a few sites or if you have the need to share some content between different WordPress WebApps.

logho

 

 

In this post we will take a look in how to create the needed infrastructure to have a secure and optimized dedicated server for WordPress in the cloud. Let’s begin.

After accessing the portal create a new virtual machine

6

Select the type of virtual machine you wish from the gallery of pre-built templates that azure offers, this will help you have your job done quickly.

5

Once in the Virtual Machine pre-build templates choose to use one of the distributions of linux. I prefer Suse Enterprise Server because for me is one of the most secure and configurable distributions of linux, and when you want to expose a server on the web this can make the difference. His configuration is a little more difficult than Ubuntu distributions but what you win with this choice worth’s the work.

 

4

Provide the Machine name, administrator and password or certification chain

3

After that choose the World datacenter zone where you wish your machine will live and a storage account for your hard drive, I prefer to have a storage for each VM i create. Define also a availability set for your vm if you don’t have already one in your Infrastructure, this is particularly important to grant the high availability of your Machine.

After the machine as been created you should enable the remote desktop. To do that you have to connect yourself to the remote machine using a SSH client, since this is the only endpoint opened in your recently created machine, in our case I will use putty client  (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html). After running the *.exe file you should look in your Windows Azure Dashboard for the SSH details, copy that address:port and paste it on the putty console (on the Host Name field), and click open.

2

When you click open if the connection is succeeded your operating system will ask if you trust the server footprint, validate that footprint in to the dashboard. After this a black console will open for you to login in the server.

1

Now is time to enable VNC to allow you can use windows to access the Guid of your Linux server, for less practices Linux user’s this can be essential.

After that we will configure our FTP and Apache server Feature, in the next part of this post we will guide you in a step by step process to end our goal, for the most experience Linux administrators you can start at this point with the configuration of your server.

WordPress for beginner’s

Posted: October 11, 2012 in Development, Wordpress
Tags:

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:

Learning

http://learn.wordpress.com/

http://www.escolawp.com/

http://www.lynda.com/WordPress-training-tutorials/330-0.html

http://www.wp1o1.com/?gclid=CPKwtP-J-bICFaTKtAodMiYAuQ

Theme reseller’s and Theme inspiration

http://themeforest.net/

SDK reference

http://codex.wordpress.org/

WordPress and Portuguese WordPress community

http://wordpress.org

http://pt.wordpress.org/

The WordPress Loop

Posted: October 3, 2012 in Development, Wordpress
Tags:

Defining

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 https://codex.wordpress.org/Anatomy_of_a_Template_Tag).

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 http://www.wordpress.com/?p=1

<!–?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.net

<!–?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.

FootNote:

To my references go to http://codex.wordpress.org/The_Loop

WordCamp LX 2012 the morning after

Posted: September 30, 2012 in Wordpress

Yesterday i had the pleasure to speak in WordCamp Lisbon 2012. Was an excellent event i am sure that all the Portuguese WordPress community had go home inspired to do more and better.

In my session i had try to give to the audience the needed tools to start building their own Plugins, and a little example to demystify the complexity of plugin build.

I share with you the resources i had used to explain in my session how to build a WordPress Plugin

http://www.slideshare.net/amarreiros/wordcamp2012-build-your-plugin

Another thing i said in the Session is that sometimes one off our problems when using WordPress is time to install the WordPress, or the damage we pout on some environment. In this links you have 2 good Tools to have a ready on environment to use without the need of an installation.

www.instantwp.com/

http://wpmu.org/install-wordpress-locally-on-windows-with-xampp/

This is also a good approach when developing to grant that our development is compatible with apache no matter what Operating System we have in our development environment.

The last slide from my session that i have present gives you also some links for your next steps in the plugin build approach.

 

 

 

 

 

As you know in part time i am Technical Trainner one funny thing is that the first Course to independente professional’s i gave was about WordPress.

Another funny thing is that i had study in Instituto Superior de Engenharia de Lisboa.

But way this to isolated things look so funny and make the difference. The reason is simple becouse i will be speaing at the WordPress community development event next saturday.

So i Will be back yo my academy to talk about WordPress and his plugin architecture, and for me this is one off the most interesting fetures WordPress give us.

If You want to know more about the event go to the link http://2012.lisboa.wordcamp.org/

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',
    array(
      '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
created



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

<!--?php
/**
 * 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

I don’t know if everyone who read my blog and use WordPress already know WPMuDev. In case you don’t know them yet i strogly recommend you to take a look in what they have to offer.

 

Special for designer’s and people who are beginning with WordPress this guys can give a great help.

 

http://premium.wpmudev.org