Add Custom Content to End of RSS feed for wordpress

wordpress tutorial for, Add Custom Content to End of RSS feed for wordpress. WordPress has own wordpress api to designed many RSS feed format. code given here.

Add Custom Content to End of RSS feed for wordpress

RSS (most commonly expanded as Really Simple Syndication) is a family of web feed formats used to publish frequently updated works—such as blog entries, news headlines, audio, and video—in a standardized format.

Add Custom Content to End of RSS feed for wordpress
RSS feed are very important. WordPress has own wordpress api to designed many RSS feed format.
In this tutorial I will show you how to add the custom text in your rss feed.
You just need to open your functions.php file and put following code in that file.

function feed_the_Filter($query) {
if ($query->is_feed) {
add_filter('the_content','add_to_feed');
}
return $query;
}
add_filter('pre_get_posts','feed_the_Filter');

function add_to_feed($content) {
$content .= '<p>Follow us on Twitter &amp;lt;a href="http://twitter.com/wordpressapi"&amp;gt;Wordpress API&amp;lt;/a&amp;gt;</p>';
$content .= '<p>Join our &amp;lt;a href="http://www.facebook.com/pages/wordpressapi/280021545846"&amp;gt;Wordpress API Facebook Community Page&amp;lt;/a&amp;gt;</p>';

return $content;
}

Set multiple excerpt length for custom post type wordpress

From wordpress 3.0 version wordpress intruded the custom post type function. Many wordpress theme developers are using custom post type method for showing different sections.

Set multiple excerpt length for custom post type wordpress

Many times we need to change the excerpt text length and showing on main landing page of custom post type.

Set multiple excerpt length for custom post type wordpress
Set multiple excerpt length for custom post type wordpress

You can set the different excerpt length for each custom post type. you just need to open functions.php file and put following code in file.


function new_excerpt_length($length) {
global $post;
if ($post->post_type == 'post')
return 32;
else if ($post->post_type == 'products')
return 65;
else if ($post->post_type == 'testimonial')
return 75;
else
return 80;
}
add_filter('excerpt_length', 'new_excerpt_length');

Using above code you can set the many excerpt lengths for your custom post type.

If you are still facing issue with custom post then please do write to me.

disable image upload for wordpress users

wordpress tutorial, disable image upload for wordpress users. If you want to restrict the normal author to upload media file your wordpress blog.  So you can use the following code in your functions.php file.

disable image upload for wordpress users

disable image upload for wordpress users
disable image upload for wordpress users

Following function will remove the upload media button from wordpress dashboard.


//remove the upload buttons for auther and other wordpress user
function removemediabuttons()
{
if($user-&amp;gt;wp_user_level &amp;gt;= 1) {
remove_action( 'media_buttons', 'media_buttons' );
}

}
add_action('admin_head','removemediabuttons');

Following code will remove the media library tab from the Add new post section for all the users.
Restricts media library access (subscriber) under the “add new post”

function remove_medialibrary_tab($tabs) {
unset($tabs['library']);
return $tabs;
}
add_filter('media_upload_tabs','remove_medialibrary_tab');

This hack is very important for wordpress developers. when you are developing the multiuser wordpress site.

how to hide wordpress login page error messages

wordpress tutorial, how to hide wordpress login page error messages. Here in this article We are Hiding wordpress dashboard login error is very basic thing for keep away hackers.

how to hide wordpress login page error messages
how to hide wordpress login page error messages

Hiding wordpress dashboard login error is very basic thing for keep away hackers. Whenever you and any hackcer are trying to login using the correct username but with the wrong password, that will give you a message saying “Error: Incorrect Password.” hacker will got the clue that the username entered is in the system, and that they simply need to crack its password. Same with username also you will got following message.
“Error: Invalid username”
For avoiding this thing you just need to open your functions.php file and put the following code in that file

add_filter('login_errors', create_function('$a', "return null;"));

This hack will remove the WordPress error by displaying nothing when a login is incorrect.

 

Updating the wordpess to wordpress 3.0.4 is important

Today I got email from Matt saying wordpress 3.0.4 version is released and we must need to update the wordpress due the major security reasons. When I checked the following article I realized the how important is wordpress 3.0.4 version.

http://wordpress.org/news/2010/12/3-0-4-update/

What Matt is saying at the end of 2010

My last message to you this year is an important but unfortunate one: we’ve fixed a pretty critical vulnerability in WordPress’ core HTML sanitation library, and because this library is used lots of places it’s important that everyone update as soon as possible.

I realize an update during the holidays is no fun, but this one is worth putting down the eggnog for. In the spirit of the holidays, consider helping your friends as well.

You can update in your dashboard, on the “updates” tab, or download the latest WordPress here:

Download

wordpress 3.0.4
wordpress 3.0.4

What Major Changes wordpress did in this 3.0.4 version.

They resolved following issue:

Don’t be case sensitive to attribute names. Handle padded entities when checking for bad protocols. Normalize entities before checking for bad protocols in esc_url(). Props Mauro Gentile, duck_, miqrogroove

WordPress changes the following files.

  • wp-includes/formatting.php
  • wp-includes/kses.php

timthumb php script for image resizing with wordpress

wordpress tutorial, timthumb php script for image resizing with wordpress. We all know what is the tumthumb script. mainly the worpdress theme developers used the tumthumb php script for resizing the images.

timthumb php script for image resizing with wordpress

But now we dont need to use the tumthumb script in wordpress theme because wordpress api is supporting the similier functionality in wordpress.

Using the wordpress hook we can specify the thumbnail size.

You can set the post image thumbnail size using wordpress hook.

Just copy paste the following code in to your functions.php file


function custom_thumbnail_size() {
return 128; // or whatever you want
}
add_filter('wp_thumbnail_max_side_length','custom_thumbnail_size');

timthumb php script for image resizing with wordpress
timthumb php script for image resizing with wordpress

How to add custom text in every wordpress post

wordpress tutorial, How to add custom text in every wordpress post. There is always common content we want put in every post. using following function we can add the custom text in every wordpress post.

How to add custom text in every wordpress post

just open your functions.php file from wordpress theme folder and put the following code in that file.


function mytext($content)
{
return "The addtional content goes here: ".$content;
}
add_filter('the_content', 'mytext');

How to add custom text in every wordpress post
How to add custom text in every wordpress post

wordpress get posts with custom field value

wordpress tutorial, wordpress get posts with custom field value. Many people use the custom meta fields in wordpress posts. Here given code snippet for same.  In this article I will show you how to retrieve the custom field from wordpress post. For fetching the custom fields you just need to use the following code.

wordpress get posts with custom field value

$key_values = get_post_meta($post-&gt;ID, 'key');
custom meta tags
wordpress get posts with custom field value

If you are using normal post or custom post type above function will work. Here is another code for fetching the custom post type meta values.

$loop = new WP_Query( array( 'post_type' =&gt; 'product', 'posts_per_page' =&gt; 10 ) );
while ( $loop-&gt;have_posts() ) : $loop-&gt;the_post();
the_title();
the_content();
global $post;
$custom = get_post_custom($post-&gt;ID);
echo $thumbnail_url = $custom["thumbnail_url"][0];
echo $product_info = $custom["product_info"][0];
echo '
<div>';
the_content();
echo '</div>
';
endwhile;

How to use Short Syntax Highlighter Shortcode WordPress Plugin

WordPress API created the wordpress Plugin called Short Syntax highlighter shortcode. This plugin has features. highlight code without losing it’s formatting.

How to install Short Syntax Highlighter Shortcode?

Follow the usual routine;

  1. Open WP admin – Plugins – Add New
  2. Enter “Short Syntax Highlighter Shortcode” under search and hit Enter
  3. Plugin will show up as the first on the list, click “Install Now”

Or if needed, upload manually. Follow the steps below to install the plugin.

  1. Upload the Short Syntax Highlighter Shortcode directory to the /wp-content/plugins/directory
  2. Activate the plugin through the ‘Plugins’ menu in wp
  3. Go to “Short Syntax Highlighter Shortcode” option to configure the button

 

How to use Short Syntax Highlighter Shortcode WordPress Plugin

Today WordPress API released the wordpress Plugin called Short Syntax highlighter. This plugin has following features:

Short Syntax Highlighter allows you to easily post syntax-highlighted code to your site without losing it’s formatting or making any manual changes. Without adding any JS or css file in your wordpress website. It is very light Syntax Highlighter Shortcode WordPress Plugin.

 

How to use Short Syntax Highlighter Shortcode WordPress Plugin
How to use Short Syntax Highlighter Shortcode WordPress Plugin

I used many syntax highlighter plugin which adds many javascript files and CSS files in my wordpress blog and due to that wordpress blog or website loading became slower. To avoid this issue I created this short syntax highlighter plugin.

Which is not adding any third party js or css file in your wordpress blog. This plugin is very minimal and that will not effect to your wordpress site.

Sample of using the plugin

sample using short highlighter plugin

Note: Above sample is Image. Please do not select it. Please use above code for syntax highlighting.

Now we are providing the only PHP and CSS language support in future we are going go support other languages.

You can download Short Syntax Highlighter from following URL:

Official URL of Short Syntax Highlighter wordpress plugin:

http://wordpress.org/extend/plugins/short-syntax-highlighter/

how to make an email address clickable in wordpress

wordpress tutorial, how to make an email address linkable in wordpress. Here we given very simple and short code which you can add in theme.

When ever we insert the URL , email  in post we need to put the link manually. WordPress provided the way to automatically make the URL and Email clickable in wordpress post.

how to make an email address clickable in wordpress

how to make an email address clickable in wordpress

You just need to add following code in your wordpress theme’s functions.php file.

add_filter('the_content', 'make_clickable');

For more help you can check following URL:
http://codex.wordpress.org/Function_Reference/make_clickable