Skip to main content

Posts

Showing posts from November, 2013

Get the latest post Title, Date and Total Comments in Wordpress

Get the latest post Title, Date and Total Comments in Wordpress <?php      /*get the latest post title, date and comments*/ $args = array( 'posts_per_page' => 1, 'offset'=> 0); $myposts = get_posts( $args ); foreach ( $myposts as $post ) : setup_postdata( $post ); ?>       <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>       <p class="info"><?php the_date() ?>, <a href="#"><?php wp_count_comments(); ?></a></p> <?php endforeach;    /*get the latest post title,date and comments*/ ?>

how to generate short urls in php

how to generate short urls without api key in php. <?php $maketiny = 'http://phponlinetutorial.blogspot.in';// function make_tiny($url) {     $ch = curl_init();     $timeout = 5;     curl_setopt($ch, CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url);     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);           curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);     $data = curl_exec($ch);     curl_close($ch);     return $data; } $tinyurl = make_tiny(''.$maketiny.'');   echo $tinyurl; ?>