separate custom template for each Author in wordpress

WordPress tutorial, separate custom template for each Author in wordpress. You can create different template for each wordpress author. You can also create different styling for each of wordpress authors. This is very common requiement of clients that they want different designed pages for each of wordpress users. That can be easily possible.

separate custom template for each Author in wordpress

You just need create author specific page template in wordpress theme. If author name is john then create author-john.php page in wordpress theme and put following code in that file.


<?php
/*
Template Name: John Author
*/
?>
<?php get_header(); ?>

<?php
 /* Queue the first post, that way we know who
 * the author is when we try to get their name,
 * URL, description, avatar, etc.
 *
 * We reset this later so we can run the loop
 * properly with a call to rewind_posts().
 */
 if ( have_posts() )
 the_post();
?>

&nbsp;

// If a user has filled out their description, show a bio on their entries.
if ( get_the_author_meta( 'description' ) ) : ?>
 <div id="entry-author-info">
 <div id="author-avatar">
 <?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'J2010_author_bio_avatar_size', 50 ) ); ?>
 </div><!-- #author-avatar -->
 <div id="author-description">
 <h2><?php printf( __( 'About %s', 'J2010' ), get_the_author() ); ?></h2>
 <?php the_author_meta( 'description' ); ?>
 </div><!-- #author-description&nbsp;&nbsp;&nbsp; -->
 </div><!-- #entry-author-info -->
<?php endif; ?>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

Dont forget to add your different style for each of author pages. Just go to pages and create page with name with your author name and choose the page template of your author name and save the page.

separate custom template for each Author in wordpress
separate custom template for each Author in wordpress

If you are knowing the author id then you can create the author-1.php page also and add your different style for each of your wordpress authors.

Create different post styling through CSS to your each of users. If you are having doubts and issues with styling or code then please contact me on purabtech.in. In purabtech.in you will found many use ful wordpress api, tutorials and hacks and articles.

wordpress and jquery conflicts – How to solve that

Jquery is most powerful javascript framework and which is used widely. WordPress is most powerful and famous cms in the world. When you are using the jquery in wordpress that time you need to keep in mind some issues. WordPress itself uses the jquery in there framework. But when we tries to add the different versions of jquery and there plugins, there was issue or conflict with jquery. Sometimes I saw issue with some plugins due to different versions of jquery. I shown in this tutorial, how to solve the wordpress and jquery conflicts easily.

wordpress and jquery conflicts – How to solve that

wordpress and jquery conflicts
wordpress and jquery conflicts

Many people written the jquery wrapper around the jquery. They written in different style but when some jquery developers written or used same function name or same methods then jquery conflicts is happening.

WordPress itself uses the jquery for custom purpose. So you dont need to add the jquery script again in to wordpress. you just need to put following code in your wordpress theme for adding the jquery in your theme.


<!--?php wp_enqueue_script("jquery"); ?-->

Just put above lines in your header.php file for adding the jquery into your wordpress theme.

For removing the conflicts when you are using the jquery functions. just use following noconflict code in that.


 $.noConflict();
 // Code that uses other library's $ can follow here.


This technique is especially effective in conjunction with the .ready() method’s ability to alias the jQuery object, as within callback passed to .ready() we can use $ if we wish without fear of conflicts later:

<script type="text/javascript">// <![CDATA[
 $.noConflict();
 jQuery(document).ready(function($) {
 // Code that uses jQuery's $ can follow here.
 });
 // Code that uses other library's $ can follow here.
// ]]></script>

Following is the some example for remove the conflicts from jquery with wordpress.

Just use the jquery multiple times for each jqeury plugins. That is the easiest way to solve the jquery conflicts.

But if you are having some knowledge of jquery then use the following code for remove the conflict.

var j = jQuery.noConflict();
// Do something with jQuery
j("div p").hide();
// Do something with another library's $()
$("content").style.display = 'none';

For many purpose we use the jquery in wordpress. Mainly jquery is used for sliders and menu and gallery.
For menu or slideshow use jquery in following fashion.

[viral-lock message=”Solution code is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]

<script type="text/javascript">// <![CDATA[
 $.noConflict();
 jQuery(document).ready(function($) {
 // Code that uses jQuery's $ can follow here.
 });
 // Code that uses other library's $ can follow here.
// ]]></script>

[/viral-lock]

If you still facing issue with jquery then please write to me on support@purabtech.in.

Here are some useful resources and links about Jquery and wordpress.

100+ jquery and CSS techniques and Tips and tutorials
jquery tips for wordpress theme developers
Fadein and Fadeout effect through javascript
minimize, restore, maximize and hide functionality with javascript without using jquery
Complete Javascript form Validation now easy ( Checkbox, Websites, Email, Maxlength)