Changing the “Plugin Activated” Message Default

You can try this: is_admin() && add_filter( ‘gettext’, function( $translated_text, $untranslated_text, $domain ) { $old = array( “Plugin <strong>activated</strong>.”, “Selected plugins <strong>activated</strong>.” ); $new = “Captain: The Core is stable and the Plugin is <strong>activated</strong> at full Warp speed”; if ( in_array( $untranslated_text, $old, true ) ) $translated_text = $new; return $translated_text; } , 99, … Read more

Woocommerce hook after creating order? [closed]

Try woocommerce_thankyou hook. This will trigger after recieving order successfully, no matter how user made payment. $hook_to = ‘woocommerce_thankyou’; $what_to_hook = ‘wl8OrderPlacedTriggerSomething’; $prioriy = 111; $num_of_arg = 1; add_action($hook_to, $what_to_hook, $prioriy, $num_of_arg); function wl8OrderPlacedTriggerSomething($order_id){ //do something… } For more reference dig into woocommerce/templates/checkout/thankyou.php

Create tabs inside Plugins Admin Page [closed]

I advice you to read this topic: Here you can find complete guide making options page with tabbed content. Or you can just copy the html of the tabbed page that you’ve liked, and use it on your own options page. I made my options page with tabs too, but with api. Tabs and the … Read more

How to use classes declared in another plugin?

You have to check if the class exists, but before that you have to wait that all plugin are loaded: no one can assure that your plugin is loaded after WooCommerce. For run a code from plugin when all plugin are loaded hook into plugins_loaded hook. Be aware that you cannot use this hook in … Read more

Check if add_menu_page exists or not

You can use the fourth parameter of add_menu_page(), the my_unique_slug, to check if the page exists: if ( empty ( $GLOBALS[‘admin_page_hooks’][‘my_unique_slug’] ) ) add_menu_page( ‘Page Title’, ‘Top Menu Title’, ‘manage_options’, ‘my_unique_slug’, ‘my_magic_function’ ); $GLOBALS[‘admin_page_hooks’] is the list of registered pages.

What is difference between get_bloginfo(‘url’) and get_site_url()?

get_bloginfo(‘url’) calls home_url() calls get_home_url() reads option home get_bloginfo(‘wpurl’) calls site_url() calls get_site_url() reads option siteurl get_bloginfo(‘siteurl’) and get_bloginfo(‘home’) are deprecated arguments and return get_bloginfo(‘url’) (siteurl argument is documented wrong in Codex as equal to wpurl, it’s not in current code) The difference is that these two function chain to different options, which are typically … Read more

Conditionally enqueue a widget’s script/stylesheet in HEAD (only when present on page!)

WordPress as a nice function is_active_widget that you can use in your __construct and test if the widget is present in the current page and add your scripts/styles based on that ex: function __construct() { parent::__construct(__CLASS__, ‘BasicWidget’, array( ‘classname’ => __CLASS__, ‘description’ => “This is a basic widget template that outputs text to the sidebar” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)