how to pagination single post wordpress theme

If you are creating the bigger post then I recommend to in post pagination. Post pagination is supported by wordpress itself. Many people does not know about this facility of wordpress.

how to paginate the single wordpress post
how to paginate the single wordpress post

When you are writing the wordpress post just put <!–nextpage–> tag in your post. So from there next paragraph content will be show on next page but post will be same.

What is in post pagination?

WordPress tag similar to the more tag, except it can be used any number of times in a post, and each insert will “break” and paginate the post at that location. Hyperlinks to the paginated sections of the post are then generated in combination with the wp_link_pages() or link_pages() template tag.

If you are using the <!–nextpage–> tag in bigger post then wordpress post loading will more faster to your users.

Here I am going to tell you about <!–more–> tag also.  This tag is also very nice and good for showing some starting content of post.

What is more tag?

WordPress tag that breaks a post into “teaser” and content sections. Type a few paragraphs, insert this tag, then compose the rest of your post. On your blog’s home page you’ll see only those first paragraphs with a hyperlink ((more...)), which when followed displays the rest of the post’s content.

WordPress bloggers must install google gears

So many times we saw the turbo link in the upper right corner of the admin area. (Remember when computers used to have a Turbo button?) Behind it is a new feature of WordPress.com, support for Gears.

Wordpress bloggers must install google gears
WordPress bloggers must install google gears

In 2007 Google launched its new product called Google Gears. Google Gears makes it easy to browse the Internet, or sites you have already visited so you can visit them again using an amazing cache technology.

Here I will explain you what is google gears is doing. When we open our worpdpress admin, wordpress will download common images, JavaScript libraries and CSS files.

If we use the google gears then WordPress will store all these ’static’ files on your hard drive and will not download them from the web server. Means each time you are opening the WordPress admin panel that time wordpress will not download the common images and css and javascript. Thus, it should speed up things especially if you are on a slow connection.

Following article which is written by Matt (Founder of WordPress) is really helpful about knowing about wordpress and google gears.

http://en.blog.wordpress.com/2008/07/02/gears/

You can go to following URL and download google gears and install it on your local machine.

Google Gears

The Google gears is available for  Windows, Windows Mobile, Mac OS Tiger/Leopard, Mac OS Snow Leopard, Linux and Android.

So just install it your local computer.

How to Embed a YouTube Video in WordPress

If you want to add the youtube or google and any third-party video in wordpress. It is really easily achievable. How to Embed a YouTube Video in WordPress.

How to Embed a YouTube Video in WordPress

WordPress itself provides to upload and submit youtube video in wordpress post. Just open wordpress admin panel and click on Add new post button.

Select the From URL tab. Paste the YouTube video’s URL into the URL field. Then click the Insert into Post button.

You can change the height and width of video using following code

[ youtube=http://www.youtube.com/watch?v=H2Ncxw1xfck&w=320&h=240]

I suggest to use Viper’s Video Quicktags wordpress plugin. I really like this wordpress plugin for embedding the third party video in wordpress blog or post.

You can download this plugin from following URL:

http://wordpress.org/extend/plugins/vipers-video-quicktags/

This plugin give you really great control with video player and size of video player. After installing the plugin you will find the “video quicktag” option in setting tab. Screenshot as follows:

Open the add new post tab, you will find very cool options for adding the video in post.

You just need to add the video URL in the dialog box.

How to show recent posts without wordpress plugin

When we are work with wordpress theme. So many times we want to show recent posts without wordpress plugin in wordpress theme.  Many people suggest to use wordpress plugin for showing the recent post.

How to show recent posts without wordpress plugin

But I suggest not to use any wordpress plugin for showing the recent posts in wordpress theme.

In this tutorial I will tell very simple technique to show recent posts. Following code you can use in your sidebar.php or in footer.php or anywhere as per your theme requirement.

Just put following code in your theme file. You just need to change the showposts count as per choice.


<?php
 $recent_posts = new WP_Query('showposts=15');
 while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID;
?>

Your recent post will look this. You just need to customize css as per your wordpress theme.

show recent posts without wordpress plugin
show recent posts without wordpress plugin

wordpress and wordpress mu is merging in april 2010

This is really great news we got from wordpress. After wordpress 3.0 release wordpress and wordpress MU is merging.  This is really great news to multiple blogger community.

After April 2010 we can able to handle multiple blogs though only one wordpress instance. As per Automatic this is the biggest release ever of wordpress. Because more than 100 developers are working for wordpress 3.0 release. As Matt is celebrating the 6th anniversary of the open source blogging software.

People are always thinking about free wordpress plugins because there are thousands of plugin are available for singular wordpress. WordPressMu stands for his own advantages.

I am really fan of wordpressMU always because I started my carrier with wordpressMU. I written my first wordpress plugin for wordpressMU. Many big magazine and business companies always prefer to to use the WordPressMU.

wordpress 3.0

Automatic is targeting to launch the wordpress 3.0 in April. So many wordpress developers are contributing to wordpress 3.0.

wordpress 3.0

wordpress 3.0
wordpress 3.0

About wordpress 3.0, we are all very excited and want to know ab0out wordpress 3.0, what is coming in 3.0

Here is list what is coming in wordpress 3.0

  • If Pretty Permalinks on, enforce /search/ URL
  • Remove some variables unecessarily wrapped in quotes
  • Convert strpos/strtolower to stripos
  • Trashed pages can still be opened when logged in
  • Install.php confusing line
  • phpdoc and cleanup of deprecated $table globals
  • Comment Misspellings
  • Add FunnyOrDie.com oEmbed support
  • Edit media form has get variables in action
  • Better name for “themes_loaded”
  • wp_specialchars() is deprecated. use esc_html()
  • Add the Generator element in feeds through the {rss2|atom|rdf|rss}_head hook
  • redundancy in nicknames dropdown
  • XHTML well-formedness
  • Single function for intermediate image sizes
  • Ellipses for descriptions of actions in progress
  • Random order of Category List in Add/Edit Link
  • Navigation For Already Installed Page
  • Blank submenu entry created when register_taxonomy arg “label” set to false.
  • next_post_link() and previous_post_link() should be allowed in the loop, even if is_single()
  • Admin include file – post.php – doc update and cleanup
  • wp_widget_rss_output with show_summaryshows two ellipses
  • /wp-admin/categories.php needs a edit_category_form_fields hook.
  • Better handling of posts without titles in Bulk Edit
  • Remove unnecessary $posts_per_page global in admin.php
  • Use new $required_mysql_version global in wp-db.php
  • Cleanup in WP native CSS files
  • Update jQuery UI to newest version
  • Remove unused .fade class for admin message bars
  • Show action links after core update
  • Use new $required_php_version global
  • wp-settings.php is missing i18n
  • Wrong preview link for draft/preview on admin post index
  • body_class() creates an invalid class when page template contains a . [full stop]
  • in ms-edit.php, a query could be removed by using the object cache
  • define(‘WP_DEBUG’, false) generates a silent E_NOTICE
  • general-template.php echo/return fixes
  • MS-functions.php whitespaces and functions cleanup
  • Null value passed to apply_filters when get_post_class() is called without parameters.
  • Typo on wp-db.php: @war instead of @var
  • plugins_url() does not correctly detect mu-plugins on Windows
  • Hide bulk actions, item filters, and subpages when no items
  • Missing table cell close tag in ms.php
  • Top corners not rounded on Dashboard Menu
  • Should include default favicon
  • Deprecate get_alloptions()
  • Internally, pass arrays instead of query strings to functions that use wp_parse_args()
  • get_temp_dir() should be more flexible
  • Prepare queries using INSERT/UPDATE should use wpdb::insert() or wpdb::update()
  • New hook to replace the admin color scheme chooser in user-edit.php
  • Thickbox Should Not Close When Clicked Outside Of Window (while uploading)
  • Add more document file type extensions
  • _deprecated() version numbers.
  • Better location for the Categories to Tags converter
  • Support ‘atom_ns’ ‘atom_head’ & ‘atom_entry’ hooks in Atompub backend
  • wp_mkdir_p doesn’t work with safe mode enabled
  • array_merge() Error when Adding Roles via Plugins
  • Update Diff Engine
  • time() is not GMT time()
  • wp:meta_value does not escape correctly
  • Duplicate comment check is too strict
  • wp_crop_image() and image_resize() are inconsistent. Both should return WP_Error objects on error.
  • In Media Library, if file does not have an extension, try to fallback to mime type
  • create metaboxes for hierarchical taxonomies
  • Custom Taxonomy Tags not appearing in admin-new/edit-posts-screen
  • Consider using the PHP ZIP extension to extract Zip’s if available
  • wp_mail fails to send to multiple recipients
  • Fresh look for WP update notification on the top of page
  • Custom Image Size Settings
  • Undefined variable: term in wp-includes/taxonomy.php on line 188
  • wp_clear_scheduled_hook does not work when including an $args parameter
  • Allow closures as callbacks
  • PHP safe-mode prevents WordPress from creating new directories
  • load_textdomain() merges even if not needed.
  • Add get_search_link()
  • Improve do_action(): Make $wp_actions an assoc array.
  • Media library: tooltip of image menu “View” shows name of next post
  • return variable $new_array in wp-includes/wp-db.php is not initialized
  • Importing WXR breaks serialized postmeta value
  • Redirection should be disabled for HEAD requests
  • Meta_key sort for numeric values / Natural Sort Order
  • Improve get_comments()
  • Opt-out of content snuffing for admin ajax
  • QuickPress loading graphic cleanup
  • Deprecate get_profile
  • Update phpass to version 0.2 (check /dev/urandom before accessing it)
  • wp_count_terms() should call get_terms()
  • optimised unzip_file()
  • Make WP_User_Search plugin friendly
  • Standardize hooks across the transient and options APIs
  • Mark user levels as Deprecated
  • XMLRPC references level_8 capability
  • Filter for paginate_links please?
  • Add is_comment_feed()
  • Add *_user_meta() functions
  • OPML import file size limit
  • improve get_page_hierarchy
  • Add replace method to wpdb
  • filesystem’s put_content() methods have inconsistent arguments — causes .maintenance file to not be created
  • Consistent filters for single_*_title()

get recent comments without wordpress plugin

Showing the most recent comments is great for SEO purpose. Our code snippet will able to get recent comments without wordpress plugin in your wordpress site.

get recent comments without wordpress plugin

You can display the most recent comments of your entire blog without any wordpress plugin. Showing the most recent comments is great for SEO purpose. Your site will increase the visibility and people interaction. Socially you and your blog will became more famous. Using following code snippet you will be able to add the recent comments in your wordpress site.

I want to display the comments in footer area. I created following code. You can copy paste the code in your sidebar.php or footer.php file.

Using following code you are able to display recent comments with author’s gr-avatar also.


<?php
$total_comments = $wpdb->get_results("SELECT comment_date_gmt, comment_author, comment_ID, comment_post_ID, comment_author_email FROM $wpdb->comments WHERE comment_approved = '1' and comment_type != 'trackback' ORDER BY comment_date_gmt DESC LIMIT 10");
$comment_total = count($total_comments);
echo '<ul>';
for ($comments = 0; $comments < $comment_total; $comments++) {
echo "<div style='clear:both;width:355px;padding-top:3px;'><div style='float:left;width:35px;'>";
echo get_avatar($total_comments[$comments]->comment_author_email,$size='32',$default='<path_to_url>' );
echo "</div> <div style='width:320px;'>";
echo '<li>';
echo $total_comments[$comments]->comment_author . ' says ';
echo '<a href="'. get_permalink($total_comments[$comments]->comment_post_ID) . '#comment-' . $total_comments[$comments]->comment_ID . '">';
echo get_the_title($total_comments[$comments]->comment_post_ID);
echo '</a></li></div></div>';
}
echo '</ul>'
?>

My footer is looking like as follows:

get recent comments without wordpress plugin
get recent comments without wordpress plugin

how to create wordpress pages by script

For plugin or custom wordpress theme we need create wordpress pages by script. In this article we given code to how to create wordpress pages by script.

how to create wordpress pages by script

You can create the pages by using script. You can execute any script using the “$wpdb->insert” or

“$wpdb->query”.

For creating wordpress post or page you can use the wp_insert_post function. Before calling wp_insert_post() it is necessary to create an object (typically an array) to pass the necessary elements that make up a post. The wp_insert_post() will fill out a default list of these but the user is required to provide the title and content otherwise the database write will fail.

You can use following code for creating the page.  This code will execute when only you are logged in to wordpress.

// Create post object
  $my_post = array();
  $my_post['post_title'] = 'My post';
  $my_post['post_content'] = 'This is my post.';
  $my_post['post_status'] = 'publish';
  $my_post['post_author'] = 1;
  $my_post['post_type'] = 'page',
  $my_post['post_category'] = array(8,39);

// Insert the post into the database
  wp_insert_post( $my_post );

You can create wordpress plugin and use this code. Use following code for wordpress plugin. Copy the code and create the create_wordpress_pages.php file and put in plugin folder.

/*
Plugin Name: Create WordPress Pages
Plugin URI: http://images.purabtech.in/
Description: Create wordpress pages by script
Version: 1.0
Author: wordpressapi
Author URI: http://images.purabtech.in/
*/
function create_wordpress_pages(){
// Create post object
  $my_post = array();
  $my_post['post_title'] = 'My post';
  $my_post['post_content'] = 'This is my post.';
  $my_post['post_status'] = 'publish';
  $my_post['post_author'] = 1;
  $my_post['post_type'] = 'page',
  $my_post['post_category'] = array(8,39);

// Insert the post into the database
  wp_insert_post( $my_post );
}
register_activation_hook(__FILE__, 'create_wordpress_pages');
how to create wordpress pages by script
how to create wordpress pages by script

How to use pagination in wordpress post without plugin

There is difference between post pagination and in post pagination.If you want to keep pagination in wordpress post without plugin, Than use our code

When we are developing the new wordpress theme then we need to always need to think about post pagination and in post pagination. Yes, there is difference between post pagination and in post pagination.

How to use pagination in wordpress post without plugin

How to use pagination in wordpress post without plugin
How to use pagination in wordpress post without plugin

If you want to keep single post and pagination between in single post that is also possible through wordpress api. In this article I will show you hwo to use the in page or post pagination.

Open your single.php file from wordpress theme folder and put following code in that.

<?php wp_link_pages( ); ?>

We can pass the following parameter the this function.

<?php $args = array(
    'before'           => '<p>' . __('Pages:'),
    'after'            => '</p>',
    'link_before'      => ,
    'link_after'       => ,
    'next_or_number'   => 'number',
    'nextpagelink'     => __('Next page'),
    'previouspagelink' => __('Previous page'),
    'pagelink'         => '%',
    'more_file'        => ,
    'echo'             => 1 ); ?>
<?php wp_link_pages( $args ); ?>

This is the one of the sample code.

<?php wp_link_pages('before=</pre>
&after=
<pre>&next_or_number=number&pagelink=page %'); ?>

Now I will explain What wordpress doing for using this function. WordPress is using simple explode php function for using the next page tag. Like following way.

$content = get_the_content();
$pages = explode('<!--<span class="hiddenSpellError" pre="" data-mce-bogus="1">nextpage</span>-->', $content);

you can also use the above code in your loop.

how to display all months wordpress posts on homepage

In this article, we will show you how to retrieve wordpress posts within specific time frame and display all months wordpress post. code snippet with detail.

how to display all months wordpress posts on homepage

how to display all months wordpress posts on homepage
how to display all months wordpress posts on homepage

WordPress is providing as full proof wordpress api so we can achieve the this using wordpress api only.

You can use the query_posts() function for fetching the wordpress posts. Open your index.php from your wordpress template folder. Before loop just use the following code for in index.php file.


$current_date = getdate();
query_posts(monthnum=' .$current_date["mon"] );

You can pass the multiple parameters to query_posts function as per your requirement.

  • hour= – hour (from 0 to 23)
  • minute= – minute (from 0 to 60)
  • second= – second (0 to 60)
  • day= – day of the month (from 1 to 31)
  • monthnum= – month number (from 1 to 12)
  • year= – 4 digit year (e.g. 2009)
  • w= – week of the year (from 0 to 53)

Now I will show the another example. which will show only current date post on home page.


$current_date = getdate();
query_posts('year=' .$current_date["year"] .'&monthnum=' .$current_date["mon"] .'&day=' .$current_date["mday"] );

Another good example for fetching the 30 days latest post from wordpress

<!--?php
//based on Austin Matzko's code from wp-hackers email list
  function filter_where($where = '') {
    //posts in the last 30 days
    $where .= " AND post_date --> '" . date('Y-m-d', strtotime('-30 days')) . "'";
    return $where;
  }
add_filter('posts_where', 'filter_where');
query_posts($query_string);
?>

Using above code you can display all months wordpress posts.