Tuesday, 23 July 2013

How to call our custom sidebar on the required position?


Go to 
<a> wp-admin folder.
<b> themes.
<c> select your current theme.
<d> Open required file such as 'header.php', 'footer.php', index.php',
           'page.php' or any custom page template and paste the following code
in the required container such as <div>, <span> etc. and pase the following code.
<e> Here 'copy_right' is the id of the custom sidebar.

<?php dynamic_sidebar('copy_right'); ?>

How to create our custom sidebar?


Go to 
<a> Wordpress admin panel.
<b> Appearance.
<c> Editor.
<d> Open config.php file from 'Themes Functions' section.
<e> Append the following code in 'functions.php' file...
<f> Here sidebar 'id'='copy_right' which is used to call it on the required
                                position and 'name' => __( 'Footer Copy Right', 'twentyeleven' ) 
                                which is display in admin panel widget area.

function twentyeleven_widgets_init() 
{
register_sidebar( array(
'name' => __( 'Footer Copy Right', 'twentyeleven' ),
'id' => 'copy_right',
'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'twentyeleven_widgets_init' );

How to add custom CSS classes in wordpress last and first menu items?


Go to 
<a> Wordpress admin panel.
<b> Appearance.
<c> Editor.
<d> Open config.php file from 'Themes Functions' section.
<e> Append the following code in 'functions.php' file...
<f> Here last menu item class is 'last' and first menu item class is 'first'.

function wpb_first_and_last_menu_class($items) 
{
$items[1]->classes[] = 'first';
$items[count($items)]->classes[] = 'last';
return $items;
}
add_filter('wp_nav_menu_objects', 'wpb_first_and_last_menu_class');

How to create a custom post type in wordpress?


Go to 
<a> Wordpress admin panel.
<b> Appearance.
<c> Editor.
<d> Open config.php file from 'Themes Functions' section.
<e> Append the following code in 'functions.php' file...
<f> Here post type name is 'Programs'.
   <g> You may call anything instead of 'Programs'.
add_action( 'init', 'prowp_register_my_post_types' );
function prowp_register_my_post_types() 
{
register_post_type( 'programs',
array(
'labels' => array(
'name' => 'Programs',
'singular_name' => 'Programs',
'add_new' => 'Add New Programs',
'add_new_item' => 'Add New Programs',
'edit_item' => 'Edit Programs',
'new_item' => 'New Programs',
'all_items' => 'All Programs',
'view_item' => 'View Programs',
'search_items' => 'Search Programs',
'not_found' => 'No programs found',
'not_found_in_trash' => 'No Programs found in Trash',
'parent_item_colon' => '',
'menu_name' => 'Programs'
),
'public' => true,
'public' => true,
'has_archive' => true,
'taxonomies' => array( 'category' ),
'rewrite' => array( 'slug' => 'product' ),
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'comments' )
)
);
}

How calulation total value for HTML input text?

<script> $j(document).ready(function(){ $j(":text").keyup(function(){ if (isNaN($j(this).val())) { alert(...