How do I use (or mimic) document.getElementById() on a page loaded from WordPress database?

WordPress uses wp_enqueue_script() to register and enqueue javascript contained in a separate file. The default behavior is for wp_enqueue_script() is to load the script before the </body> tag, and apparently WordPress pages require the script to be loaded in the footer. As pointed out in the comments, the clue to this problem with the loading … Read more

Woocommerce: block user removing cart item

Maybe there is a way of doing this, but briefly scanning through the relevant functions suggests that I basically have no control over the item being removed, or the call to wc_add_notice to mark is as removed. As such I ended up with the following fairly simple, but slightly ugly method: add_action(‘woocommerce_cart_item_removed’, function($key, $cart){ // … Read more

How to design WooCommerce-like admin tabs for plugin settings page?

I’ve figured it out how to do it on my custom admin page. You can use default wordpress classes and get variable trickery like so: <?php if( isset( $_GET[ ‘tab’ ] ) ) { $active_tab = $_GET[ ‘tab’ ]; } // end if ?> <h2 class=”nav-tab-wrapper”> <a href=”https://wordpress.stackexchange.com/questions/350785/?page=sandbox_theme_options&tab=display_options” class=”nav-tab <?php echo $active_tab == ‘display_options’ ? … Read more

How to delete all the options in an option group

Usually, the Codex is a good resource for doing research on things like this … and there are functions related to register_setting() listed directly on it’s page in the Codex. The function you’re looking for is unregister_setting(). From it’s Codex page: Description Allows clean de-registration of registered settings. Should be used mostly in deactivation hooks. … Read more

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