How to hide prices, and almost anything else, in WooCommerce • WordPress Help

Yesterday talking to a friend who has an NGO raised the issue of how ugly it is sometimes to see the prices and ranges of prices in the pages of WooCommerce so I got down to work to see how to hide them and, of course, share it with you so that you also learn to do it.

And look where It is not difficult, and we have a few possibilities.

Ready to become a WooCommerce ninja?

Hide prices only in store

If you only want to remove prices on the store page, add this code to the functions.php file of the active theme (child):

Here you have the before and after …

Hide prices everywhere except in the cart, the final purchase page and product

] For obvious reasons it does not make sense that the prices do not appear in the cart and in the page where the purchase is finalized, where it is paid, but in the rest of the pages. Simply use this other code if you want to hide the prices in the store and in the category pages:

Hide prices on the product page

But there's more, because you may not want the price list, or variations, on the same page of the products, or anywhere a simple product appears, such as linked products for example.

If this is the case, the code to be used will be this one:

And this is the difference …

Hide prices on all parts

A mix of all the above would be this code, with which we hide the prices everywhere except the cart and the payment page:

Hide more things from WooCommerce

Ah buddy, you got the bug, huh? Well you should know that you can remove practically almost anything from WooCommerce, you just have to know which ones are available and remove the hook.

A visual guide of the actions of a WooCommerce product page would be this: [19659003]

Now with the previous reference, you only have to decide which actions you are going to remove. To do this, you just have to choose what you want to hide from the following list of actions and change add_action by remove_action and add the chosen line to the file functions.php of the subject ( son ​​please ) active.

The list is this:

So if, for example, you do not want to display the list of categories and labels on the product page etas, the elements meta you would add this to your functions or file plugin functions.php :

which is not difficult?

The limit is your imagination, and the clear WooCommerce API . Maybe you'll think about " and there is not a plugin that does these things? ", and yes, there is something out there, but are sooooo limited, that you will not have all the freedom that the code gives you, so you still have to install 4 or 5 plugins to achieve what you would achieve with only 3 lines of code.

And, besides, it never hurts to dare with a little bit of code and step learn, grow do not you think?

A jugarrr and customize!

Loading …

That may also help you:

Plugins children or dependents? – The correct way to customize plugins

One of the most common development tasks for the WordPress programmer is the modification and customization of plugins to create applications adapted to the needs of the client but there are many ways to do it wrong and many to do it well .

The most usual way to do it wrong is any variation of modify the plugin " bareback " add, delete, modify the plugin code and give it to your client as is.

And yes, the beauty of open source, Open Source, and that WordPress is GPL is that you always have the code there to modify it, but the problem is that if you modify the plugin and give it tuned to a client you will deny the updates of the original plugin generating ole a security problem and another of loss of future functionalities.

It is good that you can always do your plugin maintenance, for a small fee, but even for you the updates will be hell, because you will have to do them manually, reviewing each line of code, the dependencies with your modifications, etc., etc.

Are we talking about child plugins?

 son ​​plugins and plugins father

Plugins children ?

There is the concept and development of child themes but, in principle, the same concept does not exist for plugins so there is no such thing as what we might call a child plugin or a structured and unified mode of do what. It has been proposed but has not prospered so far.

Perhaps the most promising advance came from the part of Plugin Dependencies a meta-plugin that even offers an interface from the than checking the dependencies of a child plug-in on a parent, even using this terminology. The plugin warns of the dependencies when activated and even allows to deactivate father and son in unison.

An example of use they show it in the same page of the plugin …

What does this child plugin do?

  • Prevents BuddyPress Debug from being activated if BuddyPress and Debug Bar are not active before.
  • When either BuddyPress or Debug Bar is deactivated, BuddyPress Debug will also be disabled.

The problem is that few plugins include dependency information, but the idea is good, and maybe one day it will develop.

However, it is not as simple as the son themes, because they all have a similar structure, while the plugins are each of his father and his mother.

So how do we do it? It is more can you?

Yes, and there are several ways to customize plugins let's see them …

Contact the developer

From obvious to very few people it occurs to you that there is no simpler way to customize a plugin than to contact the developer, suggest your modifications and incorporate them into a new version, even with your help.

Do a fork

Another possibility, which can, and should, previously pass through the previous method, is to make your own version of the plugin, a fork that includes those modifications that you have detected and want to add.

good thing about this method is that if you upload your fork to the official directory of plugins other users will enjoy your good ideas and work. In step you gain prestige in the community and to your present and future customers.

The bad thing about this method is that you acquire a commitment to its maintenance, something not always possible.

Create a dependent plugin with hooks

We have finally arrived at something viable and correct!

The correct way to customize a plugin is to create another plugin child dependent on parent that, using [19659037] custom hooks use the functions of the parent extending or modifying its functionalities.

And, as you already know, there are two types of hooks or hooks : action hooks and filter hooks . Are we going to it?

What are action hooks and filter hooks?

You've seen, and even used, many of them. Whenever we see a mode of customize WordPress without modifying the files core we do it using action hooks and filter hooks.

Yes, I I refer to all the modifications and customizations that we make using our utilities plugin or adding custom functions to the file functions.php of the topic .

So if the developer of the plugin already included in his code personalized hooks you are in luck. It is a good practice for good developers, although not all of them still use it.

Extending a plugin with hooks

All you need to do is create a separate plugin that runs in conjunction with the plugin you want to customize, and record the callbacks for the custom hooks offered by the original plugin .

Extending plugins with action hooks

The actions are hooks (or hooks if you prefer) that launches the WordPress kernel at specific points of its execution, or when something happens. They are PHP functions that are executed in these execution points, either in WordPress, plugins or themes, and allow you to customize their behavior.

Example:

With this we can already interact with the function and use its arguments ($ args1, $ args2) using the hook 'Name- De-tu-Action-Hook '. For example:

Extending plugins with filter hooks

Filters are hooks which launches WordPres to modify text or others elements before adding them to the database or sending them to the browser. Your plugin can specify that one or more of its PHP functions modify specific types of text.

Let's look at an example again:

And, as in the previous case , we can do things with that function, filter the $ output and use its arguments ($ args1, $ args2) using your hook 'Name-Of-Your-Filter-Hook'. So …

Registering callbacks

Surely you have noticed that in the methods seen we are registering callbacks that replace the of the original plugin and replace them with ours.

Then, in our callbacks we call the functions of the other plugin, the father, that we need to recreate the parts of its functions that we want to expand or modify, and we avoid the parts we do not need.

Conclusion

 father son

As you will see, although the concept of child plugins does not exist as such, it is totally feasible to take advantage of the functionalities of an original plugin and expand them with our own plugin that, half nte hooks, take advantage of its base functionalities and add or replace those that we want to modify.

In this way we will have our custom plugin son ​​dependent on the original plugin father which our client will be able to update normally without losing the customizations that we have added.

We just have to clearly indicate in the documentation the dependency, so that no one can think of uninstalling the plugin father as it is Logically, or will also stop working our customizations, not being an independent plugin, but dependent.

Examples?

Fortunately there are many good examples that we can learn this type of techniques, here are some dependent plugins:


References for further knowledge:

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:

What is and how the functions.php file is used • WordPress Help

 functions functions.php

It is usual to find in Help WordPress crowd of tricks to add features to the file functions.php we have even talked about if it is better to use this file or a utilities plugin which we also learned to do but what is the file functions.php and how to use ?

Let's look at some basics and how to use it, how do you like it?

What is the functions file .php?

The most basic thing is that it is a PHP file, that is, a text file full of characters and spaces that the PHP engine will run to do things on your website. These characters are called functions and are enclosed between the tags <? Php and ?> . The thing is simple: what is inside those tags is executed and what is out is not .

It comes to be the natural, and better structured replacement of the veteran file my-hacks. php disappeared in WordPress 2.8 which was where formerly extra features were included, but with the aggravating circumstance that in each WordPress update the file was crushed.

Where is the file functions .php?

Virtually all current WordPress themes have a file functions.php in the main folder, and if you do not have it, you should have it. Sometimes it contains many functions and sometimes only a few.

What does the functions.php file do?

The file functions.php contains some PHP codes called functions, a standard feature of WordPress that allows a theme to "connect" with WordPress internal features (register sidebars, add thumbnail support, etc.) or own the active theme, such as specialized short codes.

How does WordPress communicate with the file functions.php?

WordPress, by default, expects to find a file functions.php in the folder of the active theme, nothing happens if it is not found, but WordPress checks to see if it exists and interacts with it, executing the functions that it finds.

In this way, WordPress "knows" that the functions located in the file functions.php of your theme must be executed and it will use the PHP engine installed n the server and the standard functions of WordPress to interpret and execute them. It seems complicated but it is simple, it is based on the functions themselves and on other pieces of code called " hooks " (hooks) .

Do I need a functions.php file?

Essential is not, but it is highly recommended. You can include in it functions necessary for the theme to work correctly, and as it is the first WordPress review will be loaded immediately, before plugin codes, because ultimately the first thing that should be shown is the design, ie , the subject.

Tips for using the file functions.php

Despite the interesting thing about having a file functions.php in the active theme, there are some tips to keep in mind:

  • Do not go crazy adding functions to file functions.php . This file is great to include in it functions related to the design, with visual elements, for the rest of things a utilities plugin is better. There are many people who use the file functions.php to put in it all the cool features found in WordPress Help or any other web, and no, it's not a mixed bag, each function that you include must have a meaning and purpose, and if you do not use it, delete it.
  • The file functions.php of a theme child does not overlap that of the parent theme unlike the rest of files that you create in the child theme . If it will be executed before the parent theme, which will be a problem if there are the same or incompatible functions, which would result in ugly PHP errors of duplicate functions or something much worse, so check what you put in the file functions.php of the son and the father theme.
  • Try not to grow too much it does not matter if you need many functions. If you see that your file functions.php begins to skim 200 lines seriously consider creating dependent files from which your file functions.php extracts the rest of the codes that you want to execute, you can easily do using PHP commands like include () or require () which will include or make the necessary connection to run everything without the need to overload your file functions. php .

As you will see, the file functions.php is of great use and used sparingly will expand and improve the functionality of your web, so learn to use it, treat it with affection and add useful functions.

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:

New actions and WordPress filters 3.8

 wordpress-filters-actions-hooks

As not everything is going to be aesthetic novelties, you should know that WordPress 3.8 has also incorporated new actions and filters of vital importance for developers, either topics or plugins.

The list of new features in this regard is as follows:

  • automatic_updates_complete: Action to be executed after each automatic update (wp-admin / includes / class-wp-upgrader.php) [19659005] automatic_updates_debug_email: Email debug filter that can be sent after a kernel update in the background (wp-admin / includes / class-wp-upgrader.php)
  • comment_notification_notify_author: Filter whether or not to notify the authors when have comments on your entries (wp-includes / pluggable.php)
  • dashboard_glance_items: Includes additional elements in the desktop widget "At a glance", formerly known as "Right now" (wp-admin / includes /dashboard.php)
  • user_{$name}_label: Filter the tag of a user's contact method (wp-admin / user-edit.php)
  • wp_prepare_themes_for_js: Filter the themes prepared for JavaScript, in themes .php. It can be useful to change the order, which by default is by name (wp-admin / includes / theme.php)

You have a more complete list, with other minor changes, in WPSeek .

] This is an original content of WordPress Help – Resources, themes, plugins and tutorials in Spanish and published Fernando Tellado first here: New actions and WordPress filters 3.8

Advantages and disadvantages of WordPress "child themes" • WordPress Help

A " child theme " or daughter template, is a way to create modifications of a main theme or " parent " to adapt it to our needs without needing to modify the main theme , as I explained a long time ago of child themes .

And, although everything seems to be advantages, like everything in this world, child themes have their pluses and minuses let's see them.

It may seem that child themes have more advantages than disadvantages, but if you want my opinion it is not so and personally I prefer not to use them, it seems simpler and controlled to make the modifications directly in the subject, documenting them well, and if there are updates, simply reapply them after the same.

But of course, this is my opinion, yours already tells us.

Tune the WordPress desktop

One of the things that I love about WordPress are the plugins. And although it usually shares functions or hooks with which to modify aspects of WordPress, when a plugin comes out that makes our life easier so that with a couple of clicks you can do virguerías I love it.

CMSfy is one of these little wonders. As a WordPress administration customization tool is priceless, and above is free, at our disposal in the plugin installer and the official repository come on, you can not ask for more.

What do you do? Well, a little bit of everything …

What you are looking for is to offer a complete customization of the WordPress administration and for that it offers a single screen, yes, with 3 different tabs and a multitude of possibilities in each one. It is what is usually called a " tweaker ".

In the first tab we can make many customizations to the visibility of the elements in the administration deciding that users will see of our WordPress and no. I will not detail them all because they are a huge amount, but you can hide the updates to those that are not administrators, choose which Desktop widgets will be displayed, which widgets will be available for the sidebars, even which columns you will see in the input windows and Pages

The second, called " Media ", offers us a couple of important questions. On the one hand we can provoke that the images that we upload automatically resize in the load, avoiding an excessive consumption of space and time in load of the server due to fawning users who upload their photos to top of quality, for example

The next thing that this tab offers us is to be able to add additional sizes that will be created when uploading an image, defining not only the size, you can do that in the standard settings page, but also the names of the different images. You do not replace the standard sizes but you can create more.

In the third and last configurations tab, called " Editor ", you can improve somewhat the ticket editor TinyMCE choosing which text style formats you want to show (which always remains), but you can also add new formats and sizes to your liking.

And if you're left wanting more in the last tab you have a series of recommended plugins for to improve the experience and control of your WordPress CMS . ] Well, no?

I think, however, that you can still improve the plugin, because for example it does not allow you to define what user profile you will see depending on what things, for example. In the current version if inactive, for example, the Quick Press widget will not be available to the administrator. With that it would be perfect at all. But come on, that's great, and more so for a version as early as 0.5.

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:

More than 10 WordPress news 3.3

Well, since we already know that WordPress 3.3 will be for November 15 I think it's time to start glimpse the novelties that await us which will be very interesting.

There is still a long way to go in the development, which today is at 30% but we can see interesting improvements, I'm sure you'll like it.

Let's see them …

1. Improvements in the multimedia loader

Finally, it seems that after many requests (and almost crying for me) in WordPress 3.3 there will be a major remodeling of the media loader adopting Plupload [19659010]a system developed by the people of TinyMCE that will involve huge advances, many already using HTML5 in the loader . Advances such as "drag and drop", automatic resizing, filtering by file type and much more.

I look forward to it.

2. First Steps Guide

This is going to be very useful for beginners, as soon as you install WordPress you will be shown a guide in which you will be encouraged to make the first important configurations.

Of course, you will always have WordPress Help but surely the new ones in WordPress will be helped by an introductory text that, in addition to welcoming them, tells them the first steps in their newly installed CMS.

3. Adaptive Desktop

If you use an iPad, you'll know what this means. And the WordPress administration area is great, but it is not adapted to all kinds of screen configurations, let alone tactile interface devices. Someone will tell me that the mobile version of WordPress already exists, but you will be with me that it leaves a lot to be desired and, at least from an iPad, despite its shortcomings, it is more effective to use the normal administration interface.

adaptive desktop version the administration area will recognize the screen and device configuration and will offer a version that adapts to it, not only in appearance, but also in functionalities and modes of use.

4. Improvements in the admin bar

To what you have already noticed that from WordPress 3.2 the admin bar introduced in version 3.1 does not adapt as it should ?. In fact, by default it is not active in the administration area and the reality is that it requires the same for such basic things as writing a new entry. In fact, from WordPress 3.2 the ideal is to activate the bar also for the admin area always.

Well, WordPress 3.3 is going to solve this and some other detail, because it is no longer understood the administration area without the admin bar, and the changes will go in this direction.

5. Performance improvements

Come on, this is not a novelty but something mandatory, and demanded by everyone in each update, and that is not always true although the truth is that it is being met reasonably except on rare occasions.

Currently there are some internal aspects that do not contribute to the best possible performance in WordPress, such as the fact that "pretty permalinks" require several redirections something really meaningless. And things like this and some more will be modified to improve internal performance and reduce consumption and requests to the database.

6. Language packs

If there is still something manual still in WordPress, one of these things is change the language of the same WordPress even plugins and themes. This seems to be solved by integrating a language installer. I think it's a great idea, and it's easy to apply.

7. Child themes in the repository

As with frameworks, from WordPress 3.3 you can install child themes something that is now even complicated to load into the official WordPress.org repository.

8. Permanent widgets

You have already suffered more than once that bitch that means that when you change the subject you disappear the widgets that you had well organized in the previous topic. Well, this is also going to be fixed in WordPress 3.3 and now your widgets will still be there in the sidebar of the new theme when you change it.

9. Remove administration notices

The truth is that there are many ways to avoid the appearance of updates notifications and other administration messages, through plugins and hooks, but from the new version you will be able to decide natively not to appear this type of messages .

10. Improvements in the settings and the Meta API

I do not know what changes there will be in this respect but we are also working on it. I'll go on discussing the advances.

11. Background updates

I already talked about WordPress updating in the background like Chrome or Mac OSX. This will be a great advantage especially for webmasters who carry many client sites.

Well, it seems to be good WordPress 3.3 do not you think ?. Personally, the most anticipated change is that of the media loader. Which one do you think best of these 10?

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:

WPDocs, the whole WordPress API • WordPress Help

WPDocs is an impressively good and useful site, you have a predictive search engine that shows results as you type, and it includes all WordPress functions and hook documentation . As you can guess, a great resource for developers and advanced users.

Save it in favorites, it's great, in each found function it shows you examples and a link to the complete documentation in Codex .

Changed the link. Thanks Alberto!

All WordPress filters and action hooks

If you are a developer you can not miss the database of hooks and filters that Adam Brown has developed, essential.

The entry All filters and action hooks of WordPress ] published it first Fernando Tellado in Ayuda WordPress . Do not copy content, do not say anything good about you to your readers.