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.

 

how to remove images from wordpress post content

WordPress tutorial, how to remove images from wordpress post content. Some time we want to remove the images from wordpress post. Given code here in article.

I got following code for removing the images from post. you can use following code in single.php or page.php file.

how to remove images from wordpress post content

how to remove images from wordpress post content
how to remove images from wordpress post content

<?php
ob_start();
the_content('Read the full post',true);
$postOutput = preg_replace('/<img[^>]+./','', ob_get_contents());
ob_end_clean();
echo $postOutput;
?>

wordpress comment preview for box comment without plugin

Showing wordpress comment preview for comment box is always good for attracting the visitors. I shown code here for show the comments preview.

wordpress comment preview for comment box

Many times comments preview will be useful for visitors to see how comments will be looking. Using google Jquery or wordpress jquery you can add the comment preview to your wordpress blog. Showing comment preview is always good for attracting the visitors. Many clients demands for this. I shown you the example code over here for show the comments preview.

In this tutorial I am using the wordpress inbuild jquery.  First open your header. php file from your theme folder and after head tag following code.


<?php wp_enqueue_script(</code><code>'jquery'</code><code>); ?>
<?php if (is_single()) { ?>

<script type="text/javascript">

jQuery(document).ready(function(){

	jQuery("").add("<h3 id='preview-title'>Comment Preview</h3><div id='comment-preview'></div>").appendTo(document.body);
	jQuery("#comment-preview, #preview-title").insertAfter("#comment");

	var $comment = '';
	jQuery('#comment').keyup(function() {
		$comment = jQuery(this).val();
		$comment = $comment.replace(/\n\n+/g, '<br /><br />').replace(/\n/g, "<br />");
		jQuery('#comment-preview').html( $comment );
	});

});

</script>
<?php } ?>

Then Open Your style.css file from your theme folder put the following code in that file.

#comment-preview {
	border: 1px solid #ccc;
	padding: 5px 15px 15px 15px;
	}
h3#preview-title {
	margin-bottom: 5px
	}

After that upload the modified files on server. you will see following functionality for your wordpress commnets section.

wordpress comment preview for comment box
wordpress comment preview for comment box

If you are not wordpress developer then please dont try this.

WordPress has Released with server incompatibility issues

wordpress 3.0 got huge success and after that wordpress 3.2 is downloaded millions of times. This release came after some problem on many hosting company on JavaScript Modul JSon.

WordPress has Released with server incompatibility issues

As well as a few other fixes in the new dashboard design and the Twenty Eleven theme. If you’ve already updated to 3.2, then this update will be even faster than usual, thanks to the new feature in 3.2 that only updates files that have been changed, rather than replacing all the files in your installation.

WordPress has Released with server incompatibility issues
WordPress has Released with server incompatibility issues

WordPress Trac lists all the changes in the new release. If you look at the list you will notice that most are design related. Many fix or improve the Twenty Eleven default theme that ships with WordPress, while others do the same for the new admin interface introduced in WordPress 3.2.

Still no option to change the default font for the admin interface easily, unfortunately.

Updates are makinguse of the new “fast” update mechanism which only updates files that have been changed, instead of all files of a WordPress installation. Users who update via their WordPress Dashboard should notice that the procedure is speedier than before.

Updates are available via Dashboard > Updates. WordPress administrators can download the new version of WordPress from there or update directly if their blog has been configured properly for that.

Create an Autocomplete Search Field in wordpress

WordPress tutorial for, Create an Autocomplete Search Field in wordpress. In wordpress also you can easily achieve the auto complete search form easily.

Create an Autocomplete Search Field in wordpress

Now auto complete search box is very common for every web projects. Auto complete search functionality you can see in google also. In wordpress also you can easily achieve the auto complete search form easily.

Create an Ajax-based Auto complete Search Field in wordpress
Create an Ajax-based Auto complete Search Field in wordpress

There is very nice Jquery plugin for auto complete. First download the latest version of jQuery , as well as the autocomplete plugin. Now, create a folder in your theme called “javascripts” and copy paste the two files in that folder. Open your header.php from your wordpress theme folder and put following code in that file.

<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/javascripts/jquery.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/javascripts/jquery.autocomplete.pack.js"></script>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/javascripts/jquery.autocomplete.css" media="screen" />
<script type="text/javascript">
$(document).ready(function(){
    var data = '<?php global $wpdb; $search_tags = $wpdb->get_results("SELECT name FROM $wpdb->terms"); foreach ($search_tags as $mytag){ echo $mytag->name. " "; } ?>'.split(" ");
    $("#SEARCH_INPUT_BOX").autocomplete(data);
})
</script>

Just you need change the search input box id in place of SEARCH_INPUT_BOX.
If you are wordpress developer then only use the above code in header.php file. If you are facing any issue then please write to on support@purabtech.in.

Here are some very useful articles which are related to wordpress Search functionality.

Add a search from in your navigation menu of wordpress theme

Set the style for default search widget

increase file upload size limit in wordpress

Many times people want to upload big size media files into wordpress blog for download. Some people asked me about uploading the PDF files and video files into wordpress blog. You can easily upload big size media file to wordpress.

increase file upload size limit in wordpress

When to do wordpress installation that time default upload file limit is 2mb. Best way to increase the upload limit is adding code into .htaccess file. This file you will find in wordpress installation folder. Dont look into theme folder. Check your wordpress root folder for finding the .htaccess file.

Add following code in that file.


php_value upload_max_filesize 200M
php_value post_max_size 200M
php_value max_execution_time 2000
php_value max_input_time 2000

increase file upload size limit in wordpress
increase file upload size limit in wordpress

After this you need to add the following code in to your wp-config.php file.


<tt>define('WP_MEMORY_LIMIT', '200MB');</tt>

Increase the maximum amount of a time a PHP script will run. Note: If using a shared hosting service, you may need to ask your host to increase the limit.

For you information I am giving you the information about most popular hosting providers.

Hostgator will gives the ability to increase the limit upto only 64mb.

Bluehost will gives the ability to increase the limit upto only 96mb.

Godaddy will gives the ability to increase the limit upto only 64mb.

Mostly all shared hosting providers gives you facility to upload files upto 64mb size file. If you are having any doubts then you can write to me on wordpressapi@gmail.com.

How to Display WordPress Shortlink in Your post

WordPress tutorial, How to Display WordPress Shortlink in Your post. From wordpress 3.0 version you can add the short link in your post through api.  For social networking you want to add the short links in your post.

How to Display WordPress Shortlink in Your post

Adding shortlink tag in head section is always good ieda for SEO. short link will look like as follows:

<link rel='shortlink' href='http://wp.me/p1kxw4-1uP' />

For adding short link in your single post you need to the following code in to your single.php file.

   if ( function_exists('the_shortlink') ) the_shortlink( __('Shortlink'), __('wordpress api short link'), ' · ' );

For adding the shortlink support in admin panel you need to add the following code in to functions.php file.

    add_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );

For adding the short link in head section add following code.


<link rel='shortlink' href='<?php if (function_exists('wp_get_shortlink')) { echo wp_get_shortlink(get_the_ID()); } ?>' />

For more detailed information you  can check following article.

Getting Shortlink in WordPress admin panel

How to Display WordPress Shortlink in Your post
How to Display WordPress Shortlink in Your post

Most important wordpress tags for wordpress themes

In wordpress themes some tags are very important for SEO purpose. Here are some important wordpress tags for wordpress. If some of them tags are not included then you should modify the theme or you need to choose another wordpress theme.

Most important wordpress tags for wordpress themes and template
Most important wordpress tags for wordpress themes and template

 

Most important wordpress tags for wordpress themes and template

Here I created the list of wordpress tags which must be added in the header.php file of your wordpress theme.

  1. <?php language_attributes(); ?> found in header.php if not present then put in that file.
  2. <?php bloginfo(‘html_type’); ?> found in header.php if not present then put in that file.
  3. <?php bloginfo(‘charset’); ?> found in header.php if not present then put in that file.
  4. <meta name=”description” content=”<?php the_excerpt_rss(); ?>” /> found in header.php if not present then put in that file.
  5. <link rel=”shortcut icon” href=”/favicon.ico” type=”image/x-icon” />found throughout the theme and header.php if not present then put in that file.
  6. <?php bloginfo(‘name’); ?> found throughout the theme and header.php if not present then put in that file.
  7. <?php if ( is_singular() && get_option( ‘thread_comments’ ) ) wp_enqueue_script( ‘comment-reply’ ); ?> found throughout the theme and header.php if not present then put in that file.
  8. <meta name=”generator” content=”WordPress <?php bloginfo(‘version’); ?>” /> <!– leave this for stats –> found in header.php. If you’re using a 3rd party stats program (like Google Analytics) then you’ve nothing to worry about, and if your version of WordPress is out of date, you won’t want hackers knowing that.
  9. <?php bloginfo(‘stylesheet_url’); ?> found in header.php.
  10. <?php bloginfo(‘rss2_url’); ?> founder in header.phpsidebar.php and footer.php. Be careful if you switch to FeedBurner after doing this. Make sure you remember to update the feed URL here manually (The FeedSmith plugin won’t do it anymore).
  11. <?php bloginfo(‘pingback_url’); ?> found in header.php.
  12. <?php bloginfo(‘stylesheet_directory’); ?> found throughout the theme.
  13. <?php bloginfo(‘description’); ?> found throughout the theme. Your site’s slogan
  14. <?php wp_head(); ?> found in header.php in head section
  15. <body <?php body_class(); ?>>found in header.php.

Here is list which functions and tags need to include in functions.php file.

  1. if ( ! isset( $content_width ) ) $content_width = 500; found in functions.php
  2. add_filter(‘the_content’, ‘make_clickable’); found in functions.php
  3. add_theme_support( ‘post-thumbnails’ ); found in functions.php
  4. add_theme_support( ‘automatic-feed-links’ ); found in functions.php
  5. add_shortcode(‘wp_caption’, ‘fixed_img_caption_shortcode’); found in functions.php
  6. add_shortcode(‘caption’, ‘fixed_img_caption_shortcode’); found in functions.php

Above tags are very important and you need to include the this tags in your theme files.

block spam bot wordpress sites using apache

WordPress tip for security, block spam bot wordpress sites using apache. I faced a lot of issue with spam comments in my blog. Spam-bot sites will just hit. Spam-bot sites will just hit the wp-comments-post.php file and put the comments. Due to this our lot of time get wasted.

block spam bot wordpress sites using apache

Using apache setting you can protect your blog and restrict the spam bot. You need to made changes in your Virtualhost entry or you can change the .htaccess file also.

When a spam-bot comes in, it hits the file directly and usually does not leave a referrer. This allows for some nifty detection and action direct from the server. If you are not familiar with Apache directives, then write the following in your root directory .htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.*yourdomain.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) http://%{REMOTE_ADDR}/$ [R=301,L]
block spam bot wordpress sites using apache
block spam bot wordpress sites using apache

This will:

  1. Detect when a POST is being made
  2. Check to see if the post is on wp-comments-post.php
  3. Check if the referrer is in your domain or if no referrer
  4. Send the spam-bot BACK to its originating server’s IP address.

You just need to change the youdomain.com to your domain address.

This tutorial is written by purabtech.in. If you are having any issue then please write to me on support@purabtech.in

kill spam wordpress comments by changing comment file

In Article, we tell you about how to change the filename of wp-comments-post.php file another name. and kill spam wordpress comments by changing filename.

kill spam wordpress comments by changing filename wp-comments-post.php

With WordPress blogs and sites spam comments is very big issue. That waste our lot of time. There is very nice plugin called Akismet by wordpress. Which is helpful for catching the spam comments but that is not smart enough. Some spambots simply hit the wp-comments-post.php and wp-trackback.php files directly, without scanning your site to find the real names of these scripts. You can foil such bots by renaming these files. My site is also faced the spam comments and hack issues by spmmers. So following trick is very useful.

This files will not track which comment is spam. In this tutorial I will tell you about how to change the filename of wp-comments-post.php file another name. This way you can easily protect your blog against spammer comments.

You need to just follow the steps:

  1. Back up all your files.
  2. Replace all instances of wp-comments-post.php in your theme template files with wp-comments-kill-spam.php. In most themes, this will mean editing comments.php and comments-popup.php; it’s a good idea to double-check by searching through all files in your theme directory with the “find and replace” feature of your favorite editor.
  3. Upload your edited template files.
  4. Rename your wp-comments-post.php file to wp-comments-die-spam-die.php. Be sure that wp-comments-post.php is gone when you’re done, or spammers will still be able to use it!
  5. (Optional) Create a blank file and name it wp-comments-post.php. This will prevent spambots from getting a 404 error. If your 404 page is large, this will save you some bandwidth; it might also keep the spammers from catching on to your trick.
  6. Check that everything works by posting a test comment to your blog.

You will find following code in comments.php file.


<form action="<!--?php echo get_option('siteurl'); ?-->/wp-comments-post.php" method="post" id="commentform">

just replace to that as follows:


<form action="<!--?php echo get_option('siteurl'); ?-->/<tt>wp-comments-kill-spam.php</tt>" method="post" id="commentform">

This is simple way to protect your blog without any wordpress plugin. This tip is written by purabtech.in

If you are having any issue then please write to me support@purabtech.in.

kill spam wordpress comments by changing comment file
kill spam wordpress comments by changing comment file