Hook activation problems - php

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!

Related

Wordpress - Woocommerce issue with custom code

I have had alot of help before from Rohil_PHPBeginner and the code he helped me with worked really well.
Today i have had someone on the site they removed a category that the code used needed to print the information i needed on screen.
The original code that solved my issues is found here:
Wordpress Woocommerce Advice with PHP code
Unfortunately the code is stopping my product page from displaying the product information. If i remove the code then it works fine but the functionality the code added really made the product page so much better.
I've checked and the category that was deleted was get_term_child, so i made sure to change this number on the product title.php
However nothing has worked and i get this error message (seen on this page)
https://www.artgiftedbygod.co.uk/online-art-shop/musical-paintings/marely/
Could anyone help me?
I've tried to fix the issue but i dont think it is related to this category being deleted as i have recreated it and changed the title.php to the correct number.
Thanks
Adam

Executing a none existing hook in Wordpress?

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/

Zencart how to insert an image in my layout

I really just want to add a fixed image to my zencart shopping cart without going to the admin panel. I have tried normal with no luck. I have also tried with the same issue.
I suspect there is a php function which gives me the correct page to my template folder, so if anyone knows how to do it please help
I created a function to build it for me. Did not find one directly to use.

Understanding "update_option_(option_name)" Wordpress hook

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.

Wordpress not registering custom options from options.php page

Frustrated SO regular here:
I'm creating a theme-options.php page for a child theme in Wordpress. Here's the code. The page renders correctly, including: Adding the page link to the correct admin menu, creating and displaying the options page. When I click save, however, it takes me to a 500 (internal server error page).
Using the 'adminer' plugin (phpmyadmin) I have looked at the wp_options table, and there are none of the custome settings/fields that I have specified. My best guess at the problem is that the settings aren't registering properly so when I post the form to options.php it responds with an error because it doesn't expect those form fields.
I've been wracking my brain around this code for a few days now, and am wondering if someone else can take a look at it for me? I would really appreciate a few extra eyes...
Some resources I have tried:
http://ottopress.com/2009/wordpress-settings-api-tutorial/
http://themeshaper.com/2010/06/03/sample-theme-options/
http://codex.wordpress.org/Function_Reference/add_settings_section
My settings are not saving in wordpress theme options page (his settings appear empty in db. mine don't appear at all)
Oh crud,
It dawned on me after I spent an hour figuring it out that Richard M had given you the answer.
I created a new paste of your code, cleaned up some: http://pastebin.com/enUa3xme
I fixed the issue and also added the function add_my_options() and removed the is_admin() wrapper around your admin action hooks since they will only be triggered in the admin area, so they are unnecessary.
I needed to learn this since I use a half-way-done implementation of this, so even if it isn't helpful to you, it was worth learning...

Categories