How passing values ​​to construct function with Actions?

<?php class someClass { public function __construct($options = null, $initialize = true, $error_messages = null, $path, $qnty) { //construct what you see fit here…. } //etc.. } // Action listener add_action( ‘action_name’, create_function(”, “new someClass(implode(‘,’,func_get_args()));”), 10, 5 // IMPORTANT, number of arguments your construct function accept ); // Call the action $options = “options”; $initialize … Read more

WordPress Plugin manipulate have_posts()

The standard query for posts uses orderby => ‘post_date’ and order => ‘DESC’. The best candidate for arbitrary sort of posts would be orderby => ‘menu_order’ and order => ‘ASC’. The menu_order is not generally used for posts but it is safe to be used. As suggested by Pieter Goosen use action hook pre_get_posts: add_action( … Read more

woocommerce with custom post type

I don’t think you’ll be able to pull this off directly. All of the admin screens, objects and hooks are tied to the “product” post type. What you should probably do is add a new product type (a sister to the simple/variable product types). This new product type could be called “Custom_Type”. You can then … Read more

How to trace SUBMIT button

Still using jQuery, you can do this: $(‘form’).submit(function() { // Use this to echo in JS console. console.log( $(this).attr(‘action’) ); // Use this to display a popup. alert( $(this).attr(‘action’) ); }); This will track every form being submitted. Place this between <script> tags or in a JS file. Like @dev said, this for debug purpose, … Read more

Delay JavaScript files from loading

I think you should use setTimeout to pause the execution of the script without blocking the UI. setTimeout(function(){ //your code to be executed after 2 seconds }, 2000); So your code will become. setTimeout(function(){ document.addEventListener(“DOMContentLoaded”, function(event) { document.getElementsByTagName(“body”)[0].setAttribute(“ng-app”, “app”); }); }, 2000); This will delay script execution for 2 seconds. You can change this value … Read more