
wordpress-hacks
Some best WordPress Hacks for theme developer
In 2008 and 2009 WordPress themes market has grown incredibly. Due to lot of amazing new functionality an synchronization with all social sites.
1. Create TinyURLs with your wordpress site
Open your single.php file and paste the following in the loop:
<?php
echo 'Tiny Url for this post: <a href="'.bloginfo('siteurl').'?p=.'$post->ID.'">'.bloginfo('siteurl').'?p=.'$post->ID.'</a>'
?>
2. Use The Loop To Create An “Archive” Page Template
Create the php page called archive.php and create archive page through wordpress admin and select the archive page template from sidebar option.
In archive.php file you can following code:
<pre><?php
/*
Template Name: Archives
*/
?>
<?php get_header(); ?>
<h2><?php $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
if (0 < $numposts) $numposts = number_format($numposts); ?>
<h2><?php echo $numposts.' recipes published since October 06, 2008'; ?>
</h2>
<ul id="archive-list">
<?php
$myposts = get_posts('numberposts=-1&');
foreach($myposts as $post) : ?>
<li><?php the_time('m/d/y') ?>: <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
3. Create A “Share the article with Facebook” Button
Use the following code in your loop where you want show the facebook share button.
<pre><a href="http://www.facebook.com/sharer.php?u=<?php get_permalink();?>&t=<?php the_title(); ?>" target="blank">Share on Facebook</a>
4. Use More Than One Loop On A Page, Without Printing Duplicate Posts
If you want to use two query post in page or post. you can use following code:
<pre><?php
query_posts('showposts=8');
$ids = array();
while (have_posts()) : the_post();
$ids[] = get_the_ID();
the_title();
the_content();
endwhile;
?>
<?php
query_posts(array('post__not_in' => $ids));
while (have_posts()) : the_post();
the_title();
the_content();
endwhile;
?>
5. Insert Ads After The First Post
If you want show the ad after first post then use the following code:
<pre><?php if (have_posts()) : ?> <?php $count = 0; ?> <?php while (have_posts()) : the_post(); ?> <?php $count++; ?> <?php if ($count == 2) : ?> //Paste your ad code here <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <?php the_excerpt(); ?> <?php else : ?> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <?php the_excerpt(); ?> <?php endif; ?> <?php endwhile; ?> <?php endif; ?>
There are so many wordpress tricks and hack you can found in this website. Search more.






I want to thank the blogger very much not only for this post but also for his all previous efforts. I found wordpressapi.com to be greatly interesting. I will be coming back to wordpressapi.com for more information.
Pingback: uberVU - social comments
Of course, what a great site and informative posts, I will add backlink – bookmark this site? Regards, Reader
Great read. Thanks for the info!
Awesome post. I so good to see someone taking the time to share this information
This post makes a lot of sense !
I was just having a conversation over this I am glad I came across this it cleared some of the questions I had.
I would like to say “wow” what a inspiring post. This is really great. Keep doing what you’re doing!!
Good! Thank you! I always wanted to write in my site something like that. Can I take part of your post to my blog?
Good! Thank you! I always wanted to write in my site something like that. Can I take part of your post to my blog?
This post makes a lot of sense !
Intriguing post. I have been searching for some good resources for solar panels and discovered your blog. Planning to bookmark this one!
Thanks for posting. Good to see that not everyone is using RSS feeds to build their blogs
Nice post! You truly have a wonderful way of writing which I find captivating! I will definitely be bookmarking you and returning to your blog. In fact, your post reminded me about a strange thing that happened to me the other day. I’ll tell you about that later…
Nice post! You truly have a wonderful way of writing which I find captivating! I will definitely be bookmarking you and returning to your blog. In fact, your post reminded me about a strange thing that happened to me the other day. I’ll tell you about that later…
Awesome post. I so good to see someone taking the time to share this information
I’ve just started off a blog, the knowledge you give on this site has aided me extremely. Thank you for all your time & work.
Intriguing post. I have been searching for some good resources for solar panels and discovered your blog. Planning to bookmark this one!
Great read. Thanks for the info!
I’ve been checking your blog for a while now, seems like everyday I learn something new
Thanks
I’ve just started off a blog, the knowledge you give on this site has aided me extremely. Thank you for all your time & work.