PHP code example of inc2734 / wp-awesome-widgets

1. Go to this page and download the library: Download inc2734/wp-awesome-widgets 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/ */

    

inc2734 / wp-awesome-widgets example snippets



new \Inc2734\WP_Awesome_Widgets\Bootstrap();

$ cd wp-content/your-theme
$ mkdir -p templates/widget
$ cp vendor/inc2734/wp-awesome-widgets/src/widget/slider/_widget.php templates/widget/slider.php
$ vi templates/widget/slider.php

/**
 * Customize widget options

 * @param array $widget_options
 * @param string The widget class name
 * @return array
 */
add_filter(
	'inc2734_wp_awesome_widgets_widget_options',
	function( $widget_options, $classname ) {
		return $widget_options;
	},
	10,
	2
);

/**
 * Customize recent posts widget args
 *
 * @param array $query_args
 * @return array
 */
add_filter(
	'inc2734_wp_awesome_widgets_recent_posts_widget_args',
	function( $query_args ) {
		return $query_args;
	}
);

/**
 * Customize specific recent posts widget args
 *
 * @param array $query_args
 * @return array
 */
add_filter(
	'inc2734_wp_awesome_widgets_recent_posts_widget_args_'. $widget_number,
	function( $query_args ) {
		return $query_args;
	}
);

/**
 * Customize ranking widget args
 *
 * @param array $query_args
 * @return array
 */
add_filter(
	'inc2734_wp_awesome_widgets_ranking_widget_args',
	function( $query_args ) {
		return $query_args;
	}
);

/**
 * Customize specific ranking widget args
 *
 * @param array $query_args
 * @return array
 */
add_filter(
	'inc2734_wp_awesome_widgets_ranking_widget_args_' . $widget_number,
	function( $query_args ) {
		return $query_args;
	}
);

/**
 * Customize carousel any posts widget args
 *
 * @param array $query_args
 * @return array
 */
add_filter(
	'inc2734_wp_awesome_widgets_carousel_any_posts_widget_args',
	function( $query_args ) {
		return $query_args;
	}
);

/**
 * Customize carousel image size
 *
 * @param string $image_size
 * @param boolean $is_mobile
 * @param numeric $widget_id
 * @return string
 */
add_filter(
	'inc2734_wp_awesome_widgets_carousel_image_size',
	function( $image_size, $is_mobile, $widget_id ) {
		return $image_size;
	},
	10,
	3
);

/**
 * Customize any posts widget args
 *
 * @param array $query_args
 * @return array
 */
add_filter(
	'inc2734_wp_awesome_widgets_any_posts_widget_args',
	function( $query_args ) {
		return $query_args;
	}
);

/**
 * Customize showcase widget background image size
 *
 * @param string $image_size
 * @param boolean $is_mobile
 * @param numeric $widget_id
 * @return string
 */
add_filter(
	'inc2734_wp_awesome_widgets_showcase_backgroud_image_size',
	function( $image_size, $is_mobile, $widget_id ) {
		return $image_size;
	},
	10,
	3
);

/**
 * Customize showcase widget image size
 *
 * @param string $image_size
 * @param boolean $is_mobile
 * @param numeric $widget_id
 * @return string
 */
add_filter(
	'inc2734_wp_awesome_widgets_showcase_image_size',
	function( $image_size, $is_mobile, $widget_id ) {
		return $image_size;
	},
	10,
	3
);

/**
 * Customize custom widget template slug (directory)
 *
 * @param string $slug
 * @return string
 */
add_filter(
	'inc2734_wp_awesome_widgets_widget_templates',
	function( $slug ) {
		return $slug;
	}
);

/**
 * Customzie widget html
 *
 * @param string $html
 * @param array $widget_args
 * @param array $instance
 * @return string
 */
add_filter(
	'inc2734_wp_awesome_widgets_render_widget',
	function( $html, $widget_args, $instance ) {
		return $html;
	},
	10,
	3
);

/**
 * Customzize taxonomy posts widget args
 *
 * @param array $query_args
 * @return array
 */
add_filter(
	'inc2734_wp_awesome_widgets_taxonomy_posts_widget_args',
	function( $query_args ) {
		return $query_args;
	}
);

/**
 * Customize specific taxonomy posts widget args
 *
 * @param array $query_args
 * @return array
 */
add_filter(
	'inc2734_wp_awesome_widgets_taxonomy_posts_widget_args_' . $widget_number,
	function( $query_args ) {
		return $query_args;
	}
);

/**
 * Customize pickup slider widget args
 *
 * @param array $query_args
 * @return array
 */
add_filter(
	'inc2734_wp_awesome_widgets_pickup_slider_widget_args',
	function( $query_args ) {
		return $query_args;
	}
);

/**
 * Customize specific pickup slider widget args
 *
 * @param array $query_args
 * @return array
 */
add_filter(
	'inc2734_wp_awesome_widgets_pickup_slider_widget_args_' . $widget_number,
	function( $query_args ) {
		return $query_args;
	}
);

/**
 * Customize pickup slider widget image size
 *
 * @param string $image_size
 * @param boolean $is_mobile
 * @param numeric widget_id
 * @return string
 */
add_filter(
	'inc2734_wp_awesome_widgets_pickup_slider_image_size',
	function( $image_size, $is_mobile, $widget_id ) {
		return $image_size;
	},
	10,
	3
);

/**
 * Customize child nav args
 *
 * @param array $query_args
 * @return array
 */
add_filter(
	'inc2734_wp_awesome_widgets_child_nav_args',
	function( $query_args ) {
		return $query_args;
	}
);

/**
 * Customize posts list widget (recent posts, ranking any posts) image size
 *
 * @param string $image_size
 * @param boolean $is_mobile
 * @param numeric widget_id
 * @return string
 */
add_filter(
	'inc2734_wp_awesome_widgets_posts_list_image_size',
	function( $image_size, $is_mobile, $widget_id ) {
		return $image_size;
	},
	10,
	3
);

/**
 * @param array $args
 *  @var string $slug
 *  @var string $name
 *  @var array $vars
 * @param array
 */
add_filter(
	'inc2734_wp_awesome_widgets_view_args',
	function( $args ) {
		return $args;
	}
);

/**
 * @param string $html
 * @param string $slug
 * @param string $name
 * @param array $vars
 * @return string
 */
add_filter(
	'inc2734_wp_awesome_widgets_view_render',
	function( $html, $slug, $name, $vars ) {
		return $html;
	},
	10,
	4
);

/**
 * @param array $args
 *  @var string $slug
 *  @var string $name
 *  @var array $vars
 */
add_action(
	'inc2734_wp_awesome_widgets_view_pre_render',
	function( $args ) {
	}
);

/**
 * @param array $args
 *  @var string $slug
 *  @var string $name
 *  @var array $vars
 */
add_action(
	'inc2734_wp_awesome_widgets_view_post_render',
	function( $args ) {
	}
);

/**
 * @param string $name
 * @param array $vars
 */
add_action(
	'inc2734_wp_awesome_widgets_view_<slug>',
	function( $name, $vars ) {
		

/**
 * @param array $vars
 */
add_action(
	'inc2734_wp_awesome_widgets_view_<slug>-<name>',
	function( $vars ) {