This workshop conducted by the team member of Inspire Chittagong (Mizanur Rahaman Mizan and Saad Amin). Workshop was in East Delta Univeristy. There was a session relating to the infos and also another one fully focusing on the practical theme development
4. Enqueue style
<?php
wp_enqueue_style( $handle, $src, $deps, $ver, $media );
?>
$handle = Name used as a handle for the stylesheet.
$src = URL to the stylesheet
$deps (array) (optional) = Dependency
$ver (string|boolean) (optional) = Version
$media (string|boolean) (optional) = String specifying the media for
which this stylesheet has been defined. Examples: 'all', 'screen',
'handheld', 'print'. See this list for the full range of valid CSS-media-
types.Default: 'all'
6. <?php
wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer );
?>
$handle(string) (required) Name used as a handle for the script
$src (string) (optional) URL to the script,
$deps (array) (optional) = Dependency
$ver (string|boolean) (optional) = Version
$in_footer (boolean) (optional) Normally, scripts are placed
in <head> of the HTML document. If this parameter is true,
the script is placed before the </body> end tag. This
requires the theme to have the wp_footer() template tag in
the appropriate place.
Default: false
Enqueue script
7. /** * Proper way to enqueue scripts and styles */
function theme_name_scripts() {
wp_enqueue_style( 'style-name', get_stylesheet_uri() );
wp_enqueue_script( 'script-name',
get_template_directory_uri() . '/js/example.js', array(), '1.0.0',
true );
}
add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
Note : Tip: print_r( $wp_styles );
Usage
8. <?php
function my_scripts_method() {
wp_enqueue_script( 'scriptaculous' );
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script(' jquery-effects-core ');
}
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
// wp_enqueue_scripts action hook to link only on the front-
end , For admin panel use admin_enqueue_scripts
?>
Enqeue Jquery
14. // widget registration/ register sidebar
function edu_widget(){
register_sidebar( array(
'name' => __( 'HomePage Welcome',
'smebiztcrews' ),
'id' => 'welcome_text',
'description' => 'This is the widget to put text
in the homepage as welcome text alongside a video or something
else',
'class' => '',
'before_widget' => '<article class="col-sm-
7">',
'after_widget' => '</article>',
'before_title' => '<h4 class="text-title">',
'after_title' => '</h4>'));
}
add_action('widgets_init','edu_widget');