Could somebody tell the procedure to integrate wordpress plugins with the theme. I started designing some wordpress themes. I want some functionalities of some plugins. But, I do not want to ask theme downloaders to, download and install certain plugins, for the complete functionality of theme. I want to know how could we do that
Sometimes it's possible to copy the plugin code in the functions.php file of the theme. I've seen some theme authors bundle plugins with their themes as well. This might make more sense depending on how complicated the plugin is. When integrating the plugin code in your template file, make sure to use code like this to check if the plugin is active. <?php if (function_exists('function_name')) { ...plugin code here... } ?> Code (markup): Else there will probably be an error like this that will cause your theme to break.
Basically, you rip out the function code and integrate it into the pages where it is needed. The hooks at the bottom and the comments at the top are not required. It's only practical if the plugin is very small though. Most plugins have too much code to be integrated into a theme.
I want to integrate recent comments, recent posts plugin with my wordpress theme. Are there any functions which do my requirement with out any PLUGINS Eetc
This is how magazine themes show recent comments and posts. For recent posts, they use this code: <div id="recent-posts"> <h4>Recent Posts</h4> <p></p> <?php query_posts('showposts=5'); ?> <ul> <?php while (have_posts()) : the_post(); ?> <li> <strong><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent link to'); ?> <?php the_title(); ?>"><?php the_title(); ?></a></strong><br /> <small><?php the_time('m-d-Y') ?></small> </li> <?php endwhile;?> </ul> </div> Code (markup): For recent comments, they use Simple Recent Comments with this code: <div class="recent-comments"> <?php include (TEMPLATEPATH . '/simple_recent_comments.php'); /* recent comments plugin by: www.g-loaded.eu */?> <?php if (function_exists('src_simple_recent_comments')) { src_simple_recent_comments(5, 60, '<h4>Recent Comments</h4>', ''); } ?> </div> Code (markup): I just copied them from free themes so they should work
Another easy way to have a list of recent posts (without using query_posts) would be something like the following: <h3>Recent Posts</h3> <ul> <?php wp_get_archives('type=postbypost&limit=5'); ?> </ul> Code (markup): Change the "limit" to the number of recent posts you want listed.
Thank you very much. I tried to correct both of them. I was successful in getting RECENT POSTS and RECENT COMMENTS. Once again many thank for the help
No trouble Sure, wp_get_archives is much simpler, but you don't have as much control over the list. I think I have solved your other problem too.