Colorful posts in
the ‘WordPress’ category

31Jan

WordPress code templates for Aptana

What’s you IDE of choice when it comes to web development? I use Aptana Studio which absolutely rocks when it comes to web development. By default, Aptana doesn’t have a PHP editor but you can install it after you install the default Aptana installation from the Aptana\My Aptana menu option. A page will open with some plugins you can add to Aptana and this is where you will find PHP support.

Aptana IDE

So, what about WordPress? does Aptana supports WordPress? well, Aptana has HTML, CSS, PHP autocompletion and it also support libraries like jQuery. To enable jQuery autocompletion open the References panel and under the Global References section check (if it’s not checked already) the jQuery 1.2 or 1.3 support; you will instantly get jQuery autocompletion. However, WordPress autocompletion is not yet supported so I’ve been writing a bunch of what Aptana calls Code Templates to assist me while coding a WordPress theme or plugin. It’s no rocket science, all you have to do is (having Aptana PHP installed of course, since WP is written on PHP) go to Window\Preferences. Then, on the tree, go to Aptana-Editors-PHP-Code Templates

Aptana Preferences

Like I said, I’ve started writing some templates, so you can download these WordPress code templates for Aptana 1.2 and import them to the Code Templates. The Code Templates are variable based so, for example, you can write (see the image above) the hook name to add an action to, and it will append the hook name to whatever function name you add (it’s the way I write action and filter functions). I’ve included the WordPress loop by Justin Tadlock, explained in great detail on its website, as an example of a large code template, and you can trigger it typing the_loop on the Aptana PHP editor. Other code templates like the ones triggered by _openfile  and _savefile (for opening and saving a file in a WordPress option page) make heavy use of variables.

I wonder why there’s still no IDE that supports WordPress syntax, given that it has become so widely spread on the last two years. We can only expect that 2009 will be the year where an IDE add WordPress syntax. Maybe Aptana is the one, it has been growing amazingly in the last year and I hope it will continue doing it.

I wonder, do you know of any IDE supporting WordPress? which is your IDE of choice? I will be adding more WordPress Code Templates for Aptana so stay tuned!

Tags: , , , ,

21Jan

WordPress plugin: ILC FLVBox. Show flv video using ThickBox

This new plugin was created not only from a necesity but as a medium of learning as well. I wanted to play video using ThickBox, and just the other day someone asked on the WordPress support forums about playing FLV using Lightbox. I already had something done so it was a fine oportunity to finish it. So here it is.
Read more

Tags: , ,

3Jan

WordPress Plugin: Enabling TinyMCE for the title

Rich editing for the title

I needed this WordPress plugin, named ILC Rich Title for a particular work I was in. I had to enable rich text editing for the title field on the edit post/page area. In fact, the customer only wanted to add some line breaks, but I added the whole TinyMCE to it. I’m not sure if this exists for the title but I researched a lot and didn’t found one.

What I did found was the TinyMCE Excerpt plugin by Simon Wheatley which enables TinyMCE for the excerpt edit field. Changing the jQuery wrap that TinyMCE Excerpt performs by targeting the appropriate title div, #title (with the help of the ever loved Firebug) I got what I wanted. After that it was a matter of triggering wpautop for both edit area and rendered content, using the edit_post_title for the former and the_title for the latter. Now, since I’m using the_title, it means that it will enclose into p all the titles so be careful when setting your css for titles.

UPDATE: 2009-1-22

ILC Rich Title is hosted on WordPress plugins repository. You can download it from there.

Tags: ,

29Dec

WordPress and Premium Themes. In support of Matt’s decision.

If you’re into WordPress, you may have heard about the close to 300 themes removed from WordPress.org repository. Matt left a comment on Inquisitr about the (non)gpl themes:

There were actually closer to 300 themes removed, and it seems like less than 2% may have been a mistake. These are themes that never complied with the guidelines in the first place, they had just gotten in due to some lax review and we were correcting that. “Link crime” themes were maybe 5 of the 300 that were removed.
What does “with the same loss of custom for theme creators” mean?
All we’re doing is choosing to host and promote things that follow the license that WordPress itself is under, namely the GPL. It is not ambiguous that the GPL gives you certain freedoms and when plugin or theme developers try to take these freedoms away from users we just don’t want to promote them on our site. They can do whatever the heck they like, but they’re not entitled to be promoted on WordPress.org. Users get confused when WP is completely open source and then they start using a theme they downloaded that requires they link to a refinancing or SEO site.

I have to say that I completely understand Matt’s position. First of all, if you want to create a premium theme, go ahead. If you want to create a FULL GPL compliant theme, go ahead. If you want to host the full GPL compliant theme in WordPress.org, go ahead. BUT. You can’t promote your non GPL premium theme business through WordPress.org, no sir. I believe that WordPress.org should always be a place for GPL only things. I believe that a premium theme market can exist. I believe in love surviving death into eternity (wait, that was a Savage Garden lyric). The issue can be solved in a simple way. If you, the author, release a full GPL compliant theme and want to upload it to WordPress.org place a link to your personal site, not your business site. You don’t have to give support. Just offer it in GPL without promoting your business site, which, at best, is a banner.

For example, Brian Gardner still has its Revolution Code Blue theme on WordPress repository. Furthermore, he found another way to market their themes: by offering the GPL (ok, there’s no license on the downloaded zip) for free, and offering paid support. In this way, the theme is not subject to any payment. The support, which is an entirely different product, is.

Come on, I understand that premium authors are all angry. They’re losing income traffic. But, users, don’t get confused. WordPress and every Automattic release has been free. They’ve not played against their own rules. As Alister Cameron says in its post Matt Mullenweg, WordPress, GPL and why I think he really gets it:

Akismet is a service and the plugin bit is free. Gravatar is free. All their plugins are free. Heck… if Automattic had ever screwed with the GPL you’d better believe we’d be up to our necks in controversy.

Automattic has been always straight, and Matt always claimed that it will remain like that, and that’s a strong argument. Automattic could never came up and say “We’re now charging the use of WordPress”. I mean, they could, but they would lose all credibility. Automattic remains true to itself. You’ve gotta praise that.

15Dec

Running on WP 2.7

Last friday I updated the site to the 2.7 version of WordPress. Of course, I checked first on my local server that everything was working fine, so here’s a short summary of my first impressions.

First thing I noticed (but I was expecting that), was that the Lighter-Menus plugin is not longer working with this release. Lighter Menus was an excellent plugin that put the admin options into folding menus on the top of the admin page. That functionality t’s not longer needed due to the new side panel in WP 2.7 which provides a faster access to most common tasks.

The feature that fascinated me was the batch editing for posts in the (former) manage posts view. Now you can access this list from Edit Posts. By selecting a few and selecting the Edit option from the menu at top, you can add/remove tags, manage authors, enable/disable comments and much more. The Quick Edit option enabled for each post, will allow you to quickly do some common tasks like the previous bulk mode, and in this case you can assign a new date to the post as well as a password.

Finally, I like the Most Used categories block and definitely love the whole interface, it looks so clean and it’s completely customizable, for instance, with the Screen Options menu at top, or just by dragging the blocks wherever you want them.

Now, I’m using Google Chrome in this moment, and there’s an issue with the corner transparency in the login screen: it is not working properly, you can see a black bg framing the corner.

WordPress has already changed forever the web scene, and it keeps getting better and better!

11Dec

WordPress 2.7 finally available!

Yes, finally WordPress 2.7 “Coltrane” has been released publicly! You can download it right now or you can read what Matt has to said about WP 2.7 release. Matt states that this would be the last manual update of WordPress, due to the automatic (or automattic?) upgrade system and also says that the interface redesign was very neeed due to the clutter in the admin interface through the years, I must say I love the collapsable interface, is so clean and tidy now. There’s a neat video too on the official post about WP 2.7 release, hurry up and jump into WP train to the future!

15Nov

Google releases SEO Guide

Google released on Nov 12 a hands-on SEO optimization starter guide, covering areas such as meta tags, url structure (WP Permalinks), navigation, links, content and images. There’s a section about robots.txt that it’s quite interesting, as it shows how to stop giving our page reputation to inappropriate sites.

Check Google SEO Starter Guide post to download the pdf file!

BTW, I like images, and this one has a lot of images! :P

10Nov

Custom title background in WordPress using custom fields

In my last WordPress implementation I had to show different backgrounds for the page title. One title said “Who we are” with a background of several people. Another page title said “Our services” and the background image was only one man and one girl engaging in a conversation. To achieve this I used the custom fields.

Basic styling

#main-content h1 { background:url(g/htxt.jpg) no-repeat; }

This would be the common background if we don’t apply the custom fields technique.

In the Write Page area

The job in Write Page is simple, I uploaded an image using “add and image” and copied the link. I added a custom field with key “fondo” and the link as the value.

Adding code to page.php

I found this line in page.php, the template file that WordPress uses to define the layout for pages


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

after the line, I added this


<?php $estilo = get_post_meta($post->ID, 'fondo', true); ?>

There’s one variable $estilo, that is assigned the value of the custom field “fondo”, according to the post ID. Now, I could’ve go and style everything using the variable, but what happens if someone creates a new page and forgets to add a custom background? in that case we would see the image broken. We need to check whether the variable has the value we need in order to proceed. If it doesn’t, the regular background from our stylesheet will show. If it does, we will style the <h1> tag. Let’s find the title tag and wrap it with the necessary code:


<?php if ($estilo != '') { ?>
<h1 style="background:url(<?php echo $estilo; ?>) no-repeat;">
<?php }else{ ?>
<h1>
<?php } ?>
<?php the_title(); ?>
Title Text
</h1>

Since $estilo has the full path that we copied from the media manager all we have to do is a simple echo. That’s it, of course, you should set up all the background relative options since the style applied will overwrite everything leaving in a blank state before applying the background style. If you had defined a color, define it again, if the background repeats or not, position, etc.

Tags:

Page 7 of 7« First...34567