Is there any reason to why, in my case a plugin, to have a do_action(); to a none existing hook/action?
Example from WooCommerce, writepanel-product-data.php:
do_action('woocommerce_product_options_sku');
If I search after woocommerce_product_options_sku I cannot find it. So it just a call for a hook that doesn't exist, but why?
I have seen this multiple times. But have no idea why one does this. Perhaps someone could enlighten me?
This way you can interact with woocommerce plugin without the need of modificate the source code of the plugin.
That is, woocommerce plugin programmers have considered that the developers may need some extra options, so you can program a plugin that uses add_action('woocommerce_product_options_sku', 'your_function'); and that will be called just at the point where do_action ('woocommerce_product_options_sku') was inserted.
If you need more information:
http://wp.smashingmagazine.com/2011/10/07/definitive-guide-wordpress-hooks/
http://wcdocs.woothemes.com/codex/extending/introduction-to-hooks-actions-and-filters/
Related
I am doing a project and I have a problem that I can not solve. I need to display an HTML code when the administrator of my WordPress site publishes a page or a post.
I have in my code used the hook edit_form_after_title to realize that but the HTML code does not appear at all. I also used the hook edit_form_after_editor to see if the problem did not come from but unfortunately without success.
PHP code is here:
add_action('edit_form_after_title', array($this, 'postEditActionExecute'));
require_once(plugin_dir_path(__FILE__).'../assets/views/socialCommentClient.php');
Unfortunately I tried to find solutions and looked at the list of available hooks but I didn't find anything.
Your help would be valuable :) Thank you!
I need your help. Its my first time when I use woocomerce in WP and I don't know how to add custom button. On public product view I must add button with link to selected wikipedia page. On private admin product view I need custom url or text field in (wp-admin->product->add product).
Okey now I create custom field and taxonomiex but I don't know what next.
I tried to find some tutorials but I did not give advice.
I also had a similar situation like this. I purchased a plugin to fix it due to tight deadline. You can do it using below methods:
1) By using ready to use plugins
https://wordpress.org/plugins/woocommerce-custom-product-data-fields/screenshots/
(Free one)
https://codecanyon.net/item/woocommerce-custom-fields-product-addons/11332742
(Paid one)
2) You can also create a plugin by yourself
Basically a plugin will allow you to modify the site as you require without modifying the wordpress core. Learn about Hooks and Filters.
I would suggest you to go with 2nd option, learn to develop plugins so that it will be helpful for you in the long run. Read the documentation https://codex.wordpress.org/Plugin_API. It will take some time but it is worth it.
I'm trying to make the Layered Navigation Block show up in non-category pages like new-products, prices-drop, best-sales.
Is this an issue that could be resolved through a hook put in these pages?
And if so, I've tried putting one of the hooks used in /modules/blocklayered/blocklayered.php -> install() method
and I can't find where to put for example productListAssign Hook.
It's a more complex issue?
altering the public function getProducts to gather data in some other way, because the pages I want it to show in are not categories.
create a new method in the blocklayered class?... That would be called only in these certain pages.
Some other solution I didn't think of.
There's a similar question put here: why doesn't prestashop layered navigation block show on the front end? ;
but there's no clear solution.
It seems that nobody active in the prestashop forum can answer this question, and I've even contacted more experienced prestashop developers, not being answered for a few days.
Please ask me for any details needed if I've skipped any.
Thanks!
I am creating a plugin for Wordpress and haven't really worked with Wordpress very long and i want to have a function run once a specific option is updated for a blog. I think that update_option_(option_name) is the hook i want but i can't understand or find how to use it and was wondering if anyone had an example or a link to show me how this hook works?
THANKS!!!!
If you run over a specific wordpress function or hook name, just go to google and enter:
codex *function or hookname*
like
codex update_option_(option_name)
for your question.
Normally the first result directs you to the wordpress documentation page (codex) that normally answers most questions. If not, there are more search results that are most often helpful.
Additionally, all hooks are documented inside the wordpress codebase. You only need to read the code where the hook get's invoked to understand what the input values (and if a filter, the output values as well) mean. In your case that hook is located here: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/functions.php#L513
Hope this helps.
Hey there. I'm currently learning how to write plugins for wordpress platform and I already know the basics. However, I need to invoke some function when a single article page (single.php) loads. Basically, I want to take that post ID and use it in my algorithm. I can't find any pre-defined action hook in wordpress framework so I thought I could write my very own one, but I don't know what's the mechanism for it. I read several guides on internet but still have no clue how it works. Can someone help me with this? Code examples are welcome.
You can start at the loop_start hook and check is_single() or whatever else you need to determine if you're being called from a singular page. I highly doubt you need to be creating new action hooks in the WordPress core for whatever you're doing.