PHP code example of dimadin / backdrop

1. Go to this page and download the library: Download dimadin/backdrop library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dimadin / backdrop example snippets


function my_awesome_function( $id ) {
	// Download initial data to my site. Might take a long time!
	$data = wp_remote_get( 'http://example.com/' . $id );

	if ( is_wp_error( $data ) ) {
		return $data;
	}

	update_option( 'initial_data', $data );
}

add_action( 'init', function () {
	if ( ! get_option( 'initial_data' ) ) {
		$task = new \dimadin\WP\Library\Backdrop\Task( 'my_awesome_function', get_current_user_id() );
		$task->schedule();
	}
} );

add_action( 'admin_init', [ '\dimadin\WP\Library\Backdrop\Main', 'init' ] );