Add javascript to wp_head with call to plugin options?

Nesting functions in PHP very rarely makes sense. There are some advanced reason for doing it, but I doubt they are needed in this case. class TweetFeedIt { function tweet_feed_it() { function twitter_username_callback() { function tweet_count_callback() { […] } } } } The add_action() function can take up to 4 parameters, but those parameters are … Read more

Is it possible to add a sidebar in a woocommerce hook?

Well I actually figured it out. Leaving the code in case someones need it later: // Add sidebar for shop loop header function my_custom_before_shop_loop_sidebar() { dynamic_sidebar(‘shop-loop-header-sidebar’); } add_action( ‘woocommerce_before_shop_loop’, ‘my_custom_before_shop_loop_sidebar’, 2);

WooCommerce Checkout Error [closed]

Check your WooCommerce System Status to make sure there are no red entries, especially in the Pages section Test your checkout process with the console active Check your server error logs for any entries that relate to the pay page How to use the Google Chrome console : https://developers.google.com/chrome-developer-tools/docs/console How to use FireBug for FireFox … Read more

How can I check if on specific plugin generated page or child

If you’re trying to catch the pattern ‘/forums/user’, you could use PHP’s stringpos function. Something like this should capture what you’re looking for: $url_pattern = “/forums/user”; $requested_uri = $_SERVER[“REQUEST_URI”]; if(strpos($requested_uri, $url_pattern) == 0){ //Your code goes here } Make sure if you have “enforce trailing slashes” set that you use “/forums/user/” as your matching pattern … Read more

Checking instances of scripts in wp_head

wp_script_is() would tell you is the script is enqueued but you’d need to know the handle. If you really need to know if the script is enqueued you will probably have to crawl the $wp_scripts global for the actual file name. Try: global $wp_scripts; var_dump($wp_scripts); // after the wp_enqueue_scripts hook That will dump a huge … Read more

All Users > User List > Update User Meta Field Inline

Yes, we need jQuery for that. The first thing is to give proper classes and ID’s to the elements. In manage_users_custom_column, add a class and a data selector to the checkbox: “<input type=”checkbox” data-approval=”#approval-$user_id” class=”my-class” value=”{$column_value}” />” And in user_row_actions, an ID to the <a> tag: id=’approval-$user_id’. Now, we have all the elements properties and … Read more

how to give a user a role?

or / NOTE: Of course change 3 to the appropriate user ID $u = new WP_User( 3 ); // Remove role $u->remove_role( ‘subscriber’ ); // Add role $u->add_role( ‘editor’ ); Super Admin – somebody with access to the site network administration features and all other features. See the Create a Network article. Administrator – somebody … Read more