1 / 7

10 Useful WordPress Coding Techniques

In this article we will cover some useful tips, code snippets and hacks to help you to create a WordPress theme.We have published some useful WordPress tips and hacks for all the experienced WordPress website designer that will help them to create a theme that stands out from the crowd.

Download Presentation

10 Useful WordPress Coding Techniques

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 10 Useful WordPress Coding Techniques As a WordPress user, we must update ourselves with the latest core functionalities, plugin releases, useful tricks and hacks released by experienced developers and enthusiasts.The field is growing enormously especially the WordPress themes market. Therefore the topdevelopers are looking for such opportunities to get the most out of WordPress. In this article we will cover some useful tips, code snippets and hacks to help you to create a WordPress theme. 1.Style Posts Individually To give a special styling to one or more posts, you can take advantage of both the post_class() function and the post ID. To apply this trick, just open your single.php file.

  2. 2. Display Related Posts… With Thumbnails! To keep visitors interested, display a list of related posts. Many plug-ins can do that, Simply paste this code after the the_content() function in your single.php file:

  3. <?php $original_post=$post; $tags=wp_get_post_tags($post->ID); if($tags){ echo'<h2>Related Posts</h2>'; $first_tag=$tags[0]->term_id; $args=array( 'tag__in'=>array($first_tag), 'post__not_in'=>array($post->ID), 'showposts'=>4, 'caller_get_posts'=>1 ); $my_query=newWP_Query($args); if($my_query->have_posts()){ echo"<ul>"; while($my_query->have_posts()):$my_query->the_post(); ?> <li><imgsrc="<?phpbloginfo('template_directory'); ?>/timthumb/timthumb.php?src=<?phpechoget_post_meta($post->ID,"post- img",true); ?>&h=40&w=40&zc=1" alt="" /><a href="<?phpthe_permalink() ?>" rel="bookmark" title="Permanent Link to <?phpthe_title_attribute(); ?>"><?phpthe_title(); ?></a></li> <?phpendwhile; echo"</ul>"; } } $post=$original_post;

  4. wp_reset_query(); ?> 3. Antivirus for WordPress It monitors malicious injections and warns you of any possible attacks. 4. Insert anything into WordPress Blog Post – WP-Insert A famous WordPress plugin which takes care of all- ads, your feeds, your tracking codes even the way you edit your posts!

  5. 5. Improve page load time – WP Minify Once enabled, this plugin will combine and compress JS and CSS files to improve page load time. 6. Custom ‘Read More’ and Thumbnailed Recent Posts Display a customized Read More message and display related post in Thumbnails by manipulating WordPress custom fields. 7. Overwrite Post Titles Easily

  6. Simply in single.php file, find the call to the the_title() function and replace it with the following code: <?php$title=get_post_meta($post->ID,"custom-title",true); if($title!=""){ echo"<h1>".$title."</h1>"; }else{ ?> <h1><?phpthe_title(); ?></h1> <?php} ?> 8. Add Multiple Sidebars Open your single.php* file and find the call to the get_sidebar()function: <?phpget_sidebar(); ?>

  7. 9. Auto-Resize Images Using TimThumband WordPress Shortcodes First create the short code. Paste the following code in your functions.php file: functionimageresizer($atts,$content=null){ return '<img src="https://media-mediatemple.netdna-ssl.com/wp- content/uploads/2009/10//timthumb/timthumb.php?src='.$content.'&w=590" alt="" />'; }add_shortcode('img','imageresizer'); 10. WordPress Download Counter Shows the current download count and even refreshes the count every 15 seconds automatically. We have published some useful WordPress tips and hacks for all the experienced WordPress website designer that will help them to create a theme that stands out from the crowd. iMediadesigns provide cost effective web design and development solutions and offers custom web design services in Toronto

More Related