Generate WordPress code quickly

Today has come to light a project that is the golden dream of every programmer in this case specialized for WordPress developers. Because what developer has not needed to generate a code and does not want to waste time writing it from scratch?

Many times shortcuts are taken, copying code already created for other plugins or themes, but the new proposal is much more clean, and also also faster .

This is a new project by Rami Yushuvaev supported by WP Daily which he has come to call, very appropriately , Generate WP . The idea is simple … but powerful.

On the web we find, for the moment, 5 online tools each of them to provide us with the creation of the code of rapid use a know:

The operation, in addition, is very simple. In each generator we have the basic functions and, through tabs, we can add elements, classes, records, hooks, whatever we need. At the bottom, the resulting code is generated, ready for our new plugin or theme .

Tools like these make the life of the programmer much happier do not you think? . And in this particular case it's always to have it in favorites.

Tag drop-down list

I do not even remember the time that a reader, bored of the clouds of tags asked me how to make a drop-down list of labels not of categories which is what It is always more easily available. And the truth is that I wrote it down but until today I have not remembered to locate something to give it a solution.

And instead of a solution I bring two. Better right?

This nice code, which I found in WPlover will create a drop-down list of the labels, you decide where you want to show it, in the sidebar, at the end of each entry, yourself :

<li id = "categories" >

<? Php _e ( 'Entries in each tag' ) ; ?>

<form action = [19659000] " <? php bloginfo ( 'url' ) ; ?> /" method = "get" >

<? php

$ select = wp_dropdown_categories ( 'taxonomy = post_tag & show_option_none = Select tag & show_count = 1 & orderby = name & echo = 0' ) ;

$ select = preg_replace ( "# ] *)> # " "" $ select ) ;

echo $ select ;


<entry type = "submit" ] value = "View" />

The best of this code is that as it treats the tags as what they are, one more taxonomy, you can use it to do a drop down of your own taxonomies by changing taxonomy = post_tag by yours.

if you want to make it even easier you also have a plugin that comes to be the ideal substitute for the previous code. Taxonomy dropdown widget once installed and active, add a widget to configure it to your liking and, if you prefer to show the result elsewhere you can use the function taxonomy_dropdown_widget as follows:

All WordPress source code • WordPress Help

When we have seen web applications and WordPress function listings, I did not notice that there is also an official website where all the WordPress code can be displayed online, function by function.

So today we are going to add one more address to our list of sites to review and learn more about the WordPress source code: phpdoc .

Best of all, you can browse all WordPress functions, filters and hooks by version, even in what has to come. Once inside the code browser you will find an explanation of what it is for and examples of use, which is much easier to use than Codex itself.

And I do not wrap it up anymore, we simply list the resources for developers from WordPress that we have seen so far:

Advanced taxonomies in WordPress 3.1

This is another installment of the review I'm doing in my blog of the most interesting news that WordPress 3.1 gives us. This last article has arrived with a bit of delay, but hey, here it is, this time published in WordPress Help.

We are going to see a very interesting novelty that WordPress 3.1 offers us: the possibility of selecting at the same time multiple taxonomies . Imagine that we have several taxonomies, for example (assuming that the entries refer to video games): Platform, Developer, Gender, Recommended Age, etc … Until now if we wanted to obtain the results that belonged to a specific taxonomy we had no problems. But if we wanted to show the results that belonged to two taxonomies at the same time (for example those games whose platform is Playstation 3 and its recommended age 18 years) we could not do it. Until now.

But let's start from the beginning. Let's first see what is a taxonomy and where we were before WordPress 3.1

What is a Taxonomy

You know that WordPress has Categories and Tags . Well, these are in themselves taxonomies, that is, criteria to classify an entry, article, news or whatever you want to call it. The interesting thing is that in addition to the Categories and the Tags WordPress allows you to create additional taxonomies in order to achieve a better classification of your entries.

For example , if we want to classify a group of videogames we can do it in many ways: according to its platform (PC, Playstation 3, XBox 360, etc.), according to the recommended age, the type of game, the price, etc … It is more than likely that only with the Categories and the Tags you fall short and you need to create new taxonomies.

How to create a taxonomy

Let's go with a real example. Let's suppose we have this videogame for a figurative web called "":

  • Entry Title: Postal 2
  • Category: Intelligence
  • Tags: Science fiction, 3D
  • Language: Spanish
  • Platform: XBox 360
  • Manufacturer: Valve
  • Age: 12 years old

What we are going to achieve is that you can attach all this information to the video game that you are going to create in WordPress. To achieve this you will need to create (or "register" as they call it in WordPress) the new taxonomies. To do this open the functions.php file of your theme and write:

We record the file and enter the WordPress administrator. If we click on add a new entry, we will see that on the right, under labels, we have the new taxonomies:

 Taxonomies in WordPress

To create or "register "A taxonomy we use the WordPress function register_taxonomy () . In this link you can see the large number of parameters that we can use when creating our taxonomies.

In the code we can see that the second parameter is the one that indicates to which object we apply the new taxonomies . In the example we have put "post", which indicates that they will be added to any Input we create. What if we want them to appear in the Pages but not in the Entries? Then we would put 'page' . What if we have created Custom Entries that are called "video games"? (If you want to see how to create custom entries you can see it in the article New in WordPress 3.1: Custom Input Files . Then we would write 'videogames' and the taxonomies would come out only in the personalized entries that they are called 'videogames', and if we want them to come out in several places, then instead of a string we put a array :

If we have added the taxonomies to an entry custom will appear in the menu on the left under it:

 Taxonomies in personalized entries

What URLs do we get?
Now we will get new URLs in line with the new taxonomies. For example:

These URLs will use the archive.php file of our theme to show all the entries that comply with the taxonom corresponding one. But how do we show them?

Show the entries corresponding to a tag of a specific taxonomy

To show the entries that have a specific tag of one of our taxonomies we have to put this code ] before the "loop" of our theme:

All entries that belong to the "Playstation 3" tag of the "Platform" Taxonomy will then be displayed. We have also indicated that it shows 15 entries.

Note: When we say before the loop it is before:

Show all values ​​of a taxonomy

If we want show all the entries, one by one, that correspond to a specific taxonomy simply put this code:

The last three parameters tell WordPress what it is that you have to put before the links on the labels, between each link and after each link respectively.

Show a cloud of taxonomies in your WordPress theme

To show a taxonomy cloud that contains all the tags of a specific taxonomy, add this code where you want it to appear:

] Remember to change "platform" by the name of your taxonomy. You can also edit the "number" parameter that specifies how many labels will be displayed. To show them all put "0".

Advanced Taxonomy Queries in WordPress 3.1

Well, finally we are where we wanted to go: to the news that WordPress 3.1 offers us for Taxonomies . Advanced Taxonomy queries use a new parameter in query functions called "tax_query"

tax_query is an array of arrays, where each array describes what criteria you want to be fulfilled at the time of show the entries. There is not much documentation yet about tax_query, so I'm sure there will be more and better uses than what I put here.

Suppose that in our blog we have a Category called "Books" and a label that is called "Mystery" "(Remember that Categories and Labels are Taxonomies). If we want to show all the entries that have the category "Books" and the label "Mystery", we would put before "loop" :

As you can see, the entries that are going to be shown satisfy the two criteria at the same time . You can include an array of Categories and an array of Tags. More options:

If what we want is that NO leave the entries that have one or more specific categories (for example, that the entries do not come with the categories "Books" or "Disks"):

Likewise, this must be set before the loop so that only the entries that we have previously selected will appear in the loop. As you can see, unlike the previous one, there is now a new parameter called "operator" that has the value "NOT IN".

Finally, we can select the entries that are from a Category (for example "Books") or of a specific label (for example "Heavy"). As you will see below, the difference lies in the "relation" parameter.

You will notice that in these examples there is a field called "field" for which we have given the value "slug" . If instead of the "slug" we want to give the ID of the Category or Label, we would have to put "term_id". You can also put your name with "name" instead of "slug". By default it is "term_id"

That in terms of Categories and Labels, but what if I want to do it with the taxonomies that I have created? Well, for example, if I want only those games that are recommended for an age over 18 years, would put before the loop:

Those articles would appear in which in the box of the new taxonomy "Age "I have included the number 18. I could also make combinations and exclusions as we did with Categories and Labels.

But continuing with the example that we had above, in which we had a personalized entry called "Videogames" with several taxonomies if we assume that we only want to show the personalized "video game" entries whose taxonomy "Age" is 18 years, we put before the loop:

As you can see we have added "post-type" to put the name of the custom entry.

] And finally, know that We can even combine meta_query with tax_query, as in this example:

And that's it, I hope May it be useful to you!

NOTICE : This publication is from two years ago or more. If it's a code or a plugin it might not work in the latest versions of WordPress, and if it's a news story it might be obsolete. Then do not say we have not warned you.

Loading …

That may also help you:

WordPress 3.1.1

If you have already updated to WordPress 3.1 now it's time for you to do it to WordPress 3.1.1 an essential security update (and more):

  • Improves security in loading images [19659003] Improvements in performance
  • Improve the support of IIS6
  • Fix the links of taxonomies and PATHINFO (/index.php/)
  • Solve several extreme cases in which queries and taxonomies could cause compatibility problems with plugins [19659007] You know, updates .

    The entry WordPress 3.1.1 published it first Fernando Tellado in WordPress Help . Do not copy content, do not say anything good about you to your readers.

News from WordPress 3.1

If you're already biting your nails for knowing it will bring us WordPress 3.1 and you do not want to wait for to tell us Ze Fontainhas in WordCamp here you have the most important news of this version that, if the programming does not change, will be available in its final version by the end of this year or the beginning of 2011.

What's New in WordPress 3.1 • WordPress Help

The new version, WordPress 3.1 which is expected to launch in mid-December (this year) will have a few novelties, not big changes like the redefinition of " ] profiles and capabilities "of users, but some interesting advances.

In short, which is only an advance, surely from now until December we see more possible improvements. Personally I like everything proposed, even leaving in the bedroom still interesting improvements (in my view) as …

Custom post types for humans

One of the most interesting possibilities when using WordPress as CMS is the custom entry types or custom post types one of the News from WordPress 3.0 .

It's not really difficult to create this type of custom entries and define parameters for them but what would you think of having a simple administration interface to create them at once? Click [?great right? Well, you can do it.

Custom Post Type UI is a plugin that offers exactly that, creating custom entry types without the need to touch or a line of code in the file functions.php . You install it, you activate it and you create and configure your types of personalized entries, it's that simple, you just need WordPress 3.0 .

But not only that, but it also allows you to get another click of the important novelties of WordPress 3.0, the personalized taxonomies, just as easily as with the personalized entries.

This video explains how to do it, although it has no complications …

Using shortcodes everywhere • WordPress Help

 hack wordpress

We have already seen many ways to customize WordPress with shortcodes but these little wonders can used in many more sites than in the post editor, here are a few good examples …

Shorcodes in text widgets

The first thing is to add this code to the file functions.php of your active theme:

The second line is what makes the shortcodes work in the text widget. Also, keep in mind that text widgets have a box to "add paragraph breaks automatically", well, the second line disables the code autop that could, if the box is checked , put the shortcode entered in a paragraph or even break the tags.

Shortcodes in the theme

You can also use shortcodes in the theme you use. For this we use the function do_shortcode () in which the argument will be a string that will contain the shortcode.

For example, to show the shortcode [publicidad] in your theme you would put something like that where you want it to appear the expected result:

The function do_shortcode () accepts any type of text. If the string contains a shortcode it will process that code. In this way, for example, you could manually show content of your entries in this way:

Shortcodes in comments

Again we resort to the file functions.php to add this code that allows shortcodes in the comments fields:

Now, in functions.php we will add this to be able to insert shortcodes in the input extracts:

Shortcodes in the user description

To be able to put shortcodes in the user's description you have to pass the description string by function do_shortcode () . For this you will have to add this to your active topic:

You will only have to change the user ID, in this case the 3.

Shortcodes in descriptions of tags, categories and taxonomies

You can also filter these descriptions. For this we resort again to the file functions.php :

A world of possibilities more, right?

NOTICE : This publication is from two years ago or more. If it's a code or a plugin it might not work in the latest versions of WordPress, and if it's a news story it might be obsolete. Then do not say we have not warned you.

Loading …

That may also help you:

All the news of WordPress 2.9

Well, look at the list surely there is something that motivates you update to WordPress 2.9 :

  1. Undo / trash so if you delete an entry or a comment you can retrieve it ..
  2. Integrated image editor with which to crop, edit, rotate and scale images.
  3. Update in batch and compatibility check plugins, with what you can update several plugins at the same time and be able to see before updating if the plugins are compatible with your version of WordPress.
  4. Simple embedding of videos just by pasting the URL, thanks to Oembed. You can embed content from YouTube, Daily Motion,, Flickr, Hulu, Viddler, Qik, Revision3, Scribd, Google Video, Photobucket, PollDaddy, and (more soon).
  5. Support by default of ] rel = canonical to improve SEO.
  6. Automatic optimization of the database from the file wp-config.php only with add define ('WP_ALLOW_REPAIR', true) ; .
  7. Themes can have "input thumbnails" to have an image associated with the input.
  8. New table commentmeta .
  9. Custom input types, something that was scheduled for version 3.0.
  10. Folders for custom themes, very useful for those plugins that have built-in themes.
  11. TinyMCE WYSIWYG and Simplepie updated.
  12. Sidebars can now have descriptions for make it easier to identify them.
  13. Possibility of specify category templates not only by ID, as before, but by URL, which will make it easier for theme developers to customize with categories.
  14. Records and profiles are extensible, so you can collect more information (Twitter accounts, etc).
  15. The XML-RPC API has been improved to be able to change the user registration option.
  16. Creation of customized galleries, with new attributes with which to include or exclude attachments from any other entry, not only of the current one.
  17. When you are editing files with the plugins or themes editor it remembers the position and takes you to where you were when you saved.
  18. The bookmarlet Post this has been improved and is now much faster, so you can publish wherever you are browsing the web.
  19. Custom taxonomies are included in the WXR export file and are also imported correctly.
  20. Improve s filters and hooks for extracts, emoticons, HTTP requests, user profiles, author links, taxonomies, SSL support, tag clouds, query_posts and WP_Query

Well, click, update!

What you read is original content of WordPress Help – Resources, themes, plugins and tutorials in Spanish and published Fernando Tellado first here: All the news of WordPress 2.9