Created by Daniele Scasciafratte / Mte90Net
$args = array(
// hourly,daily,twicedaily,weekly,monthly or timestamp for single event
'recurrence' => 'hourly',
// schedule (specific interval) or single (at the time specified)
'schedule' => 'schedule',
// Name of the Cron job used internally
'name' => 'cronplusexample',
// Callback to execute when the cron job is launched
'cb' => 'cronplus_example',
// Args passed to the hook executed during the cron
'args' => array( get_the_ID() )
);
function cronplus_example( $id ) {
echo $id;
}
$cronplus = new CronPlus( $args );
// Schedule the event
$cronplus->schedule_event();
// Remove the event by the schedule
$cronplus->clear_schedule();
// Jump the scheduled event
$cronplus->unschedule_event();
A class that extends the built-in WP_Widget class to provide an easier/faster way to create Widgets for WordPress.
new Fake_Page(
array(
'slug' => 'fake_slug',
'post_title' => 'Fake Page Title',
'post_content' => 'This is the fake page content'
)
);.
// This is like the woocommerce function
function load_content_demo( $original_template ) {
if ( is_singular( 'demo' ) && in_the_loop() ) {
return wpbp_get_template_part( 'plugin-name-folder', 'content',
'demo', false );
} else {
return $original_template;
}
}
add_filter( 'template_include', 'load_content_demo' );
// This is an extended version that search for folder with names based on locales like it_IT
$get_template_email = wpbp_get_template_part( 'plugin-name-folder' , 'header', 'prefix' );
$debug = new WPBP_Debug();
$debug->log( __( 'Plugin Loaded', 'your-textdomain' ) );
$debug->qm_log(
__( 'Error inside the log panel of Query Monitor', 'your-textdomain' )
, 'error' );
$debug->qm_timer( 'profile_that_callback', function () {
echo 'I need to be profiled!'; }
);
$post_columns = new CPT_columns( 'demo' );
$post_columns->add_column( 'cmb2_field', array(
'label' => __( 'CMB2 Field' ),
'type' => 'post_meta', //text, thumbnail, post_meta, author, custom_tax, custom_value
'meta_key' => '_demo_meta_text',
'orderby' => 'meta_value', // For WP-Query
'sortable' => true,
'prefix' => '',
'suffix' => '',
'def' => 'Not defined', // Default value in case post meta not found
'order' => '-1' // This is the last column
)
);
Wrap specific methods to get string or register it or get the language for Ceceppa Multilingua, Polylang and WPML plugins.
wp_localize_script
for passing PHP variables to JavaScript on the frontendengine
includes the basic classes or initialize the plugin itself
assets
includes coffee/sass and js/css files
backend
includes the features for the dashboard, like import/export settings
ajax/rest
includes the basic code for ajax(logged/non)/rest integrations
cli
includes the basic code for cli integrations
public
includes the code for the frontend
tests
includes the Codeception tests
templates
includes the files for templating that can be copied in theme folders
internals
includes the code shared between all the various folders or the website
integrations
includes the integration with libraries
languages
includes the mo/po file for the localization