Fast maintenance mode, without plugin

I think it's too much to install a plugin just to put your site in maintenance mode for a few moments, let's say for a minor update or things like that, do not you think?

Also, who has not suffered a problem after an update with the maintenance plugins ?. So that …

So if you want to put your site at rest awhile you can momentarily add this code to the file functions.php ] of your active topic:

That's right, remember to remove the code once you're finished.

Publishers who can not create Administrators

I have long recommended the use of Members a fantastic plugin, to properly manage WordPress capabilities and roles, but there are times when it is not perfect, it has its nuances, I mean … [19659002] It is quite common to modify, once installed, some user profile (we are always talking about multiuser sites) so that, in turn, you can add other users. The idea is to build a collaborators structure in which someone, usually the Editor not only reviews the content created by users with profile of Contributor and Author but also can make " responsible for human resources " and add, modify and delete user profiles and their capabilities.

Well, with Members we can do all this but there is a catch and is that when we assign to a user profile the ability to create and / or modify users you can also create and / or modify users with Administrator profile, with the danger that this entails but check the table of Profiles and Capabilities of WordPress .

Fortunately, everything has a solution, so if this is your case (mine if it is, then I manage a network of blogs with multiple user profiles), you just have to acer esto:

  1. Instalas y activos Members
  2. Choose (or create) a user profile to which you will add the capabilities to create, modify, delete, change profiles and users


  3. Add this code to the file functions.php of your active topic:
     class JPB_User_Caps {
    
      // Add our filters
      function JPB_User_Caps () {
        add_filter ('editable_roles', array (& $ this, 'editable_roles'));
        add_filter ('map_meta_cap', array (& $ this, 'map_meta_cap'), 10.4);
      }
    
      // Remove 'Administrator' from the list of roles if the current user is not an admin
      function editable_roles ($ roles) {
        if (isset ($ roles ['administrator']) &&! current_user_can ('administrator')) {
          unset ($ roles ['administrator']);
        }
        return $ roles;
      }
    
      // If someone is trying to edit or delete and that user is not an admin, do not allow it
      function map_meta_cap ($ caps, $ cap, $ user_id, $ args) {
    
        switch ($ cap) {
            case 'edit_user':
            case 'remove_user':
            case 'promote_user':
                if (isset ($ args [0]) && $ args [0] == $ user_id)
                    break;
                elseif (! isset ($ args [0]))
                    $ caps [] = 'do_not_allow';
                $ other = new WP_User (absint ($ args [0]));
                if ($ other-> has_cap ('administrator')) {
                    if (! current_user_can ('administrator')) {
                        $ caps [] = 'do_not_allow';
                    }
                }
                break;
            case 'delete_user':
            case 'delete_users':
                if (! isset ($ args [0]))
                    break;
                $ other = new WP_User (absint ($ args [0]));
                if ($ other-> has_cap ('administrator')) {
                    if (! current_user_can ('administrator')) {
                        $ caps [] = 'do_not_allow';
                    }
                }
                break;
            default:
                break;
        }
        return $ caps;
      }
    
    }
    
    $ jpb_user_caps = new JPB_User_Caps (); 
  4. You save the changes and You're done! now the new user profile will be able to create and modify profiles but you will not be able to create administrators or modify their profiles to not to be, in turn, administrator

Enjoy it!

What you read is an original content of Help WordPress – Resources, themes, plugins and tutorials in Spanish and published it Fernando Tellado first here: Editors who can not create Administrators

WordPress Best Open Source Web Application 2011 in The Critters

Again WordPress has been placed above applications like Drupal or Diaspora, being chosen the best free web application in The Critters .

The entry WordPress best Open web application Source 2011 in The Critters published it first Fernando Tellado in Ayuda WordPress . Do not copy content, do not say anything good about you to your readers.

bbPress 2.0 beta 2 that arrives, that arrives! • WordPress Help

Oh, this is burning. Well it was not hours ago that he announced beta 1 of bbPress 2.0 and we already have here beta2 ?, and with many new features, namely:

If you dare to try it you can download it here . These days more than WordPress Help this seems Help bbPress, and so happy that I am.

FAQ bbPress 2.x (plugin) • WordPress Help

Still do not dare to try bbPress 2.x ?, because surely this list of questions and answers (FAQ) will help you decide. It has been created by John J. Jacoby and it is a good starting point:

Where can I disarm it?
1. From the plugin installer of your WordPress
2. http://wordpress.org/extend/plugins/bbpress/

Where can I report errors?
1. http://bbpress.org/forums/ (use the tag 'bbpress-plugin')
2. http://bbpress.trac.wordpress.org

Where can I report a security vulnerability?
1. http://wordpress.org/about/contact/
2. jjj on #bbpress in the IRC freenode

Where can I ask support questions?
Use the official forums (in English) or those of WordPress Help

Will it be integrated with BuddyPress? ?
Not yet, but it does not conflict with your existing theme or data

You can not see the forums and threads in my theme!
Re-save your permanent links

Is there any bbPress 1.x forum importer?
You are in it, but it is still in the testing phase. Go ahead and try it and report the errors.

Where is the documentation?

In the same code of the plugin at the moment. It does not make much sense to create documentation for a version still in evidence, still subject to changes. There will soon be a codex from bbPress.

Why can not I publish videos as normal admin?
Admin accounts in WordPress have extra capabilities that allow them to publish all kinds of content, and bbPress is now part of WordPress and inherits these capabilities.

What will happen to bbPress 1.x?
For the time being it will continue to be maintained but its future development will be frozen, so do not expect new features in bbPress 1.x. [19659003] Can the bbPress 2.0 Beta plugin be installed without WordPress?
No. bbPress 2.0 is a plugin for WordPress.

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:

Finally statistics in WordPress for iOs

It had been so long since it seemed that WordPress for iOs was the poor brother who almost did not believe that the last update that has just come out, and from which I write these lines, finally incorporates some functionalities basic already available for other mobile platforms.

The most obvious new features are Quick Photo, geolocation and statistics, for which you will have to be using Jetpack or the WP stats plugin.

Customize the WordPress help

We have been working on the official WordPress translation team for a coherent Spanish version of Spain, not at everyone's taste but useful for all, improving the texts, making them more reasonable and easy to adapt to each need.

However, there are times when one wishes to adapt the WordPress desktop to specific needs, either for oneself or for oneself. for clients.

Well, that's what I mean, and the next trick is to offer a way to customize WordPress help screens texts that, in principle, try to offer a vision general what is the purpose of each element of the administration pages, but sometimes they may not be useful or we simply want to improve or expand them.

If this is your case, in the following code you will see as personal hoist the help window of the "Add new page" page, adding it to the file functions.php of your active theme:

What do you want to do the same on the page to add a new entry or another, you just have to replace the references to, in this case load-page-new.php by load-post-new.php and so on.

Enjoy it 😉

NOTICE : this post It's two or more years ago. 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 that we have not warned you.

Loading …

That may also help you:

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 "misvideojuegos.com":

  • 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:

How to change the WordPress emoticons (part 2) • WordPress Help

Yesterday I discovered that since the last update I had lost my personalized smilies, to match my theme. Searching for here only appeared this other entry so to work …

For the one that interests you that whenever WordPress is updated you do not lose your personal smilies I leave my solution

First I create a folder "smilies " in the folder wp-content because this last folder does not suffer any updates.

In the file of the theme / wp-content / themes / THEMENAME / functions.php I create a function for the entries and another one for the comments.

function mis_smilies ( $ text ) {

$ text = convert_smilies ( convert_smilies ( $ text ) ) ]

$ text = str_replace ( 'wp-includes / images / smilies / icon _' [19659026] 'wp-content / smilies / icon _' $ text ) ;

return $ text ;

}

add_filter ( 'comment_text' [19659026] 'mis_smilies' ) ;

The main function would be str_replace () which will change the original URL (wp-includes / im ages / smilies /) for the folder in my smilies (wp-content / smilies /). In the entries, he only does that. In the comments I first have to convert the smilies codes into images and that's what WordPress does with the function convert_smilies () as I failed the code 8 ) I repeat the conversion and then change the folder

With these functions we could have different smilies for each theme (editing its functions.php file) and / or be different from the entries and the comments (changing the folder).

WordPress 3.2 beta 1

Do you want to try the new version of WordPress ?. If you can not wait for the news of WordPress 3.2 you can already download the first beta and start to get the taste (I do not yet) to the new desktop and some cosillas más.

Entry WordPress 3.2 beta 1 was first published Fernando Tellado in Ayuda WordPress . Do not copy content, do not say anything good about you to your readers.