Saturday, March 10, 2012

Replace excerpt ellipsis with post permalink

This is very useful tricks to replace the ellipsis [...] from the excerpt with a permalink to the post in wordpress.

Just paste the code below into your functions.php file in theme folder of wordpress. After saved, this tip will be applied to the wordpress blog.



function replace_excerpt($content) {
       return str_replace('[...]',
               '... <div class="more-link"><a href="'. get_permalink() .'">Continue Reading</a></div>',
               $content
       );
}
add_filter('the_excerpt', 'replace_excerpt');

Tuesday, March 6, 2012

Embed a page into another page in Wordpress

Embed a page into another page in Wordpress

Just paste the following code within the loop and make sure that you update page ID on line 1!


<?php $recent = new WP_Query("page_id=**ID**"); while($recent->have_posts()) : $recent->the_post();?>
       <h3><?php the_title(); ?></h3>
       <?php the_content(); ?>
<?php endwhile; ?>

I just got my #domain @BigRock. Get upto 25% off with my personalized coupon link Get upto 25% off