WordPress

Mostly when we change permalinks in wordpress there is no image display and in some places we give link wp-content/ and some time ..wp-content/. This cause error when we make site live. For that we use this refrence link.

<base href=”<?php echo bloginfo(‘url’); ?>/”>

And basic another css and js link.
<link rel=”stylesheet” type=”text/css” href=”<?php bloginfo(‘stylesheet_directory’); ?>/css/styles.css” />

<link rel=”shortcut icon” href=”<?php bloginfo(‘stylesheet_directory’); ?>/favicon.ico” />

<script src=”<?php bloginfo(‘stylesheet_directory’); ?>/js/jquery-latest.js” type=”text/javascript”></script>

For Image link.
<img src=”<?php echo get_template_directory_uri(); ?>/images/logo.jpg” alt=”logo” />

For home page link.

<?php echo home_url();?>

For slider with specific category.
<ul id=”slides1″>
<?php $my_query = new WP_Query(‘category_name=topstory’);
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID; ?>
<li><?php the_content(); ?></li><?php endwhile; ?>
</ul>

We create specific menu for Navigation.
<?php wp_nav_menu( array( ‘container_class’ => ‘top-navigation-mid’, ‘menu’ => ‘main’ ) ); ?>

Widget cal on header,footer and template page. Where study is widget name which we can create in function.php.
<?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘Study ‘) ) { ?>
<?php } ?>

I use this code fortwo different menu according two different languages where ’19′ is page_id of English page.No plugin and another function use for two different languages so this code is use so many time in different template pages.
<?php if (is_page(‘English’)|| $post->post_parent == ’19′ )
{wp_nav_menu( array( ‘container_class’ => ‘menu’, ‘menu’ => ‘english’ ) ); }
else       {   wp_nav_menu( array( ‘container_class’ => ‘menu’, ‘menu’ => ‘french’ ) );
}
?>

For front page and specific page.
<?php if(is_front_page() || is_page(19) ) { ?>

For single post in template pages.
<?php         $post_id = 29;
$queried_post = get_post($post_id);
echo  the_author_meta(‘display_name’, $queried_post->post_author);?>

Now,we mostly use radius in border which also in hover, we can avoid little mistake using below css.
li:first-child a
li:first-child a:hover

<!–form validation–>
<form name=”form2″ id=”form2″ method=”post” action=”career.php” onsubmit=”return validate1(this)”>

Css for even odd classes.

<script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js”></script>
<script type=”text/javascript”>
$(document).ready(function() {
$ (‘div.technical-expertise-list  li:even’).addClass(‘even’);
$ (‘div.technical-expertise-list  li:odd’).addClass(‘odd’);
});
</script>
<style>
.even{

background-image: url(“<?php bloginfo(‘template_directory’); ?>/images/bullet-5.png”);
}
.even:hover{

background-image: url(“<?php bloginfo(‘template_directory’); ?>/images/bullet-4.png”);
}

.odd{
background-image: url(“<?php bloginfo(‘template_directory’); ?>/images/bullet-4.png”);
}
.odd:hover{
background-image: url(“<?php bloginfo(‘template_directory’); ?>/images/bullet-5.png”);
}
</style>

================================================================================================

CREATE NEW FUNCTIONS FOR FOOTER

first sidebar-footer.php
Change in :
&& ! is_active_sidebar( ‘sidebar-5’  )

<?php if ( is_active_sidebar( ‘sidebar-3’ ) ) : ?>
<div id=”first” role=”complementary”>
<?php dynamic_sidebar( ‘sidebar-3’ ); ?>
</div><!– #first .widget-area –>
<?php endif; ?>

thenafter function.php
Change in :
register_sidebar( array(
‘name’ => __( ‘Main Sidebar’, ‘twentyeleven’ ),
‘id’ => ‘sidebar-1’,
‘before_widget’ => ‘<aside id=”%1$s”>’,
‘after_widget’ => “</aside>”,
‘before_title’ => ‘<h3>’,
‘after_title’ => ‘</h3>’,
) );