Frequently used codes for wordpress website development.

WordPress cms uses functions created in basic php. This makes it easier and less time consuming for a developer to create a website in wordpress. Although use of plugins made wordpress very easy to use but we always need basic codes.

Here I am going to provide a list of most frequently used wordpress codes or functions. These codes are used wether you are going to develop a simple or complex website.

 

1. <?php bloginfo(‘name’); ?>

Use: This function returns title of website / blog.

Example:  Suppose we use this on my website then it will return “Make money online”.

 

2. <?php bloginfo(‘template_url’); ?>

Use: This function returns path to the active theme.

Example: Suppose your active theme is in “active-theme” folder under domain www.examplewebsite.com . Then <php bloginfo(‘template_url’); ?> returns www.examplewebsite.com/wp-content/themes/active-theme . So to represent an image path use src=”<php bloginfo(‘template_url’); ?>/images/image.jpg” where “images” is folder in current theme where required image is uploaded with name “/image”.

Note:- Click to see a list of all bloginfo function reference.

 

3. <?php the_permalink(); ?>

Use: This function returns the link to a post which when clicked takes you to single page view of a post.

Example: http://www.technoinfo.info/frequently-used-codes-for-wordpress-website-development is link to this post being shown on single page. So using <a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a> will return <a href=”http://www.technoinfo.info/frequently-used-codes-for-wordpress-website-development”>Frequently used codes for wordpress website development.</a>

4. <?php the_title(); ?>

Use: This function returns title of a post.

Example: Check point 4.

 5. <?php the_post_thumbnail( array(100,100) ); ?>

Use: This function returns image saved as Featured Image in your post/page.

Example: <?php the_post_thumbnail(array( 250,250 )); ?> will return something like <img src=”http://yourdomain.com/wp-content/uploads/01/image.png” height=”250″ width=”250″ />

 

Conclusion:

So above are the most commonly used WordPress functions for a beginner.

Mar,30,2014

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: