wordpress hacks for theme developer

Some best WordPress Hacks for theme developer

there are many wordpress theme deverlopers who are looking for wordpress hacks for theme developer. we have best collection of wordpress hacks for theme developer. Some best WordPress Hacks for theme developer.

wordpress hacks for theme developer

 wordpress hacks for theme developer
wordpress hacks for theme developer

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:

<?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.

<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:

<?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:

<?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.

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

Leave a Reply

Your email address will not be published.