wordpress pagination with query posts

wordpress pagination with query posts, Mostly people use query_posts function for fetching posts. But most of all people face issue with pagination.

wordpress pagination with query posts

Just use following code for pagination. It is simple and easy.

<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts( 'post_type=documents&paged='.$paged );
query_posts( 'post_type=post&paged='.$paged );
if (have_posts()) : while (have_posts()) : the_post(); ?>

<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
<?php the_excerpt();  ?>

 <?php endwhile; ?>
<div id="nav-below" class="navigation">
                                        <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
                                        <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
                                </div><!-- #nav-below -->
                                  <?php endif; wp_reset_query(); ?>

wordpress pagination with query_posts
wordpress pagination with query_posts

How to How to remove first image from post wordpress

wordpress tutorial, remove first image from post wordpress. In many wordpress old site they used the first image as post or featured image. Here solution. while showing the single post they not want to show the first image which is uploaded.

How to remove first image from post wordpress

How to remove first image from post wordpress
How to remove first image from post wordpress

Using following code you can remove the first image from wordpress post. Please put following code in to functions.php file (you will find this file in your theme folder)


function remove_first_image ($content) {
if (!is_page() && !is_feed() && !is_feed() && !is_home()) {
$content = preg_replace("/<img[^>]+\>/i", "", $content, 1);
} return $content;
}
add_filter('the_content', 'remove_first_image');

when you see the single page of blog then you will not see the first image from blog post.

 

add ajax pagination in wordpress blog

For without refresh the data from home page if you want to show the pages and pagination in wordpress blog than you can use the following code for add ajax pagination in wordpress blog.

add ajax pagination in wordpress blog

With the help of jquery you can easily add the pagination wordpress blog site. You just need to add the following code into header.php file.

[viral-lock message=”Source code is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]


<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php wp_enqueue_script('jquery'); ?>
<script>
jQuery(document).ready(function(){
 // ajax pagination
 jQuery('#wp_pagination a').live('click', function(){ // if not using wp_pagination, change this to correct ID
 var link = jQuery(this).attr('href');
 // #main is the ID of the outer div wrapping your posts
 jQuery('#main-container').html('<div><h2>Loading...</h2></div>');
 // #entries is the ID of the inner div wrapping your posts
 jQuery('#main-container').load(link+' #entries')
 });
}); // end ready function
</script>

[/viral-lock]

just put above code in header.php file in head section. Just make sure that you are putting above code after wp_head function.

add ajax pagination in wordpress blog
add ajax pagination in wordpress blog

If you are not wordpress developer then dont use following code and If you are facing any issue then write to me on support@purabtech.in

how to install wordpress on linux web server

WordPress tutorial, how to install wordpress on linux web server. Through Cpanal or downloading the zip from wordpress site and doing normal installation. But some times If you have VPS or your own linux server then you want to know about how to do the wordpress installation easily on Linux box.

how to install wordpress on linux web server

 

how to install wordpress on linux web server
how to install wordpress on linux web server

Just follow My steps:

If you have shell access to your web server, and are comfortable using console-based tools, you may wish to download WordPress directly to your web server using wget (or lynx or another console-based web browser) if you want to avoid FTPing:

  • wget http://wordpress.org/latest.tar.gz
  • Then unzip the package using:
    tar -xzvf latest.tar.gz

The WordPress package will extract into a folder called wordpress in the same directory that you downloaded latest.tar.gz.

Then Use the following Command.

#mv WORDPRESS YOURDOMAIN NAME

Than Open your apache configuration file and put following code in that file


<VirtualHost&nbsp; *:80>

ServerAdmin support@purabtech.in

DocumentRoot /var/www/html/YOURDOMAIN NAME

ServerName example.com

ServerAlias www.example.com

ErrorLog logs/YOURDOMAIN-error_log

CustomLog logs/YOURDOMAIN-access_log custom

</VirtualHost>

Than restart the apache server.

#/etc/init.d/httpd restart

Open your site in browser and do the installtion. But dont forget to create mysql database put correct information in wp-config.php file about database and username and password.

You are ready to go with your wordpress instillation with linux command prompt. This way you can do the local installation of wordpress on linux box.

How to add content after wordpress post editor

WordPress tutorial, How to add content after wordpress post. For unique identity of your blog you need to the some common words in every posts. If you want add some default text in wordpress editor.

How to add content after wordpress post editor

you can add following code in functions.php file.


add_filter( 'default_content', 'add_subscribe_in_editor_content' );

function add_subscribe_in_editor_content( $content ) {
 $content = "If you enjoyed this post, make sure to subscribe to <a href='http://feeds2.feedburner.com/wordpressapi' target='_blank'>my rss feed</a>.";
 return $content;
}

using above code subscribe code will be added in wordpress editor.

How to add content after wordpress post editor
How to add content after wordpress post editor

Here is some very useful articles which is useful for modify the wordpress editor.

Add Buttons to WordPress wysiwyg editor

How to hide the wordpress visual editor and HTML editor

How to change the Visual Editor Font Size wordpress without plugin

add different background image to each wordpress posts

WordPress tutorial, add different background image to each wordpress posts. You can change the background images for each wordpress post or change color.  you can change the background color also. Some times this can be doable through CSS also. But here I am going to give you very simple technique.

add different background image to each wordpress posts

Following code you just need to place in your single.php file.

 


if(is_single('17')){
// When Post 17 (ID) is being displayed.

echo "<style>
body{
background: #000 url(images/bgbody.jpg) top center no-repeat;
}</style>";
}

This way you can add the different background image to each wordperss post.

add different background image to each wordpress posts
add different background image to each wordpress posts

 

how to add top button in wordpress website

Adding top button link is always good for users of blog. This is good for SEO also and your blog became more seo friendly this way.

how to add top button in wordpress

You just need to add the following CSS code into style.css file.


#topbutton{display: block;border: 0;position: fixed;  bottom: 20px; right:0;

After this open your header.php file from your wordpress theme folder and after body just add following link code in that file.


<a name="top"></a>

After this open your footer.php file and at the end of body tag add following code in that file.


<a href="#top"><div id="topbutton">
bloginfo('template_directory'); ?>/images/top-button-wordpress.png" />
</a>

put following image in your wordpress theme’s images folder. Just right click and save the image and put that in your images folder.

You can change css as per your requirement. This article is written by purabtech.in. If you are having any dobuts then please write to me.

Your button link will look like as follows:

add top button in wordpress
add top button in wordpress

where to submit free wordpress themes

When I started developing the wordpress theme I was worried about where to submit the wordpress theme. I already developed many wordpress plugins but that plugins I submitted to wordpress plugin site. If you are wp theme developer and you want to publish your theme on multiple sites them here is list of URLs where you can submit free wordpress themes.

submit free wordpress themes
submit free wordpress themes

After doing googling I found some site where I can submit my wordpress theme and then I can get more traffic for my wordpress themes.

You can submit your wordpress theme to our site. Please send email to our team with theme screenshots and description. You need to send demo URL and download link for your wordpress theme. We will publish your wordpress theme on our showcase page.

You just need send email to our team on wordpressapi@gmail.com

You can check our wordpress theme showcase page:

Our Showcase for Free wordpress themes

Here I created the list websites where you need to submit your wordpress theme:

[viral-lock message=”Lists are Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]

[/viral-lock]

Useful mysql queries for wordpress migration

For developers wordpress moving site to new server is daily job. wp migration is easy with mysql query. Here is useful mysql queries for wordpress migration. This mysql query are very useful for moving wordpress data to new server.

Note: before executing following queries, first take backup of wordpress database first. it is very important for safety and backup purpose. I recommend, always take database backup while doing any database operation. Taking database backup is good practice.

When you want to change your domain name for wordpress site. You need to first take backup of your file system and mysql database. Make sure that backup is completely taken. Verify with any wordpress developer. Then only you start the migration. For wordpress domain migration following mysql queries are required.

mysql queries for wordpress migration

I already written detail article for this. You should read following article.

https://purabtech.in/wordpress-migration-hosting-service-domain/

Here is list of mysql queries which are very important when you are doing the wordpress site migration.

UPDATE wp_options SET option_value = REPLACE(option_value, 'oldsite.com', 'newsite.com');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'oldsite.com', 'newsite.com');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'oldsite.com', 'newsite.com');
UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, 'oldsite.com', 'newsite.com');
UPDATE wp_posts SET guid = REPLACE(guid, 'oldsite.com', 'newsite.com');
mysql queries for wordpress migration
mysql queries for wordpress migration

show pdf in wordpress blog or website

Many people want to show there pdf files in wordpress blog. PDF is really popular format for showing the document with graphics and text and design and graphs. Without loosing the quality of text and graphics if we need to show the content then PDF is really nice format.

pdf in wordpress

pdf in wordpress
pdf in wordpress

In business world for presentation purpose all people mostly use the PDF document. Some wp developers asked about showing the pdf in wordpress.

For without any issue if you want to show the PDF document then you need to just open functions.php file and put following code in that file.
Following code I written for creating the shortcode in wordpress

function pdflink($attr, $content) {
return '<a href="http://docs.google.com/viewer?url=' . $attr['href'] . '">'.$content.'</a>';
}
add_shortcode('pdf', 'pdflink');

For showing link of PDF file in article or post you need add the following lines in the article.

[pdf href=”http://yoursite.com/linktoyour/file.pdf”]View PDF[/pdf]

Note: Upload the PDF file to your wordpress and then get the path of PDF file and then put above lines in article.
Change the path as you required.
Above code will create pdf link for your pdf document in your site.

If you does not want to create PDF link in your site and you want to show the pdf doc in your site then use following code.

function pdfshow($attr, $content) {
return '<iframe src="http://docs.google.com/gview?url='.$attr['href'] .'&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>';
}
add_shortcode('pdfshow', 'pdfshow');

For showing the PDF file in article or post you need add the following lines in the article.

[pdfshow href=”http://yoursite.com/linktoyour/file.pdf”]View PDF[/pdf]

We are looking for pdf in wordpress post, wordpress pdf tutorial,  wordpress tutorial, wordpress documentation pdf, wordpress ebook pdf, wordpress book, wordpress ppt, wordpress tutorial for beginners this for wordpress. Here we can add the pdf support using my code in your wordpress sites.