Display FeedBurner Reader count in wordpress blog

Displaying the feed burner reader count is nice idea for bloggers. This way can show your blog readers to other blog viewers.
For seo purpose displaying the feed burner reader count is very nice.

Display FeedBurner Reader count in wordpress blog

You can your following code in your wordpress theme file.

<?php
$url = file_get_contents('https://feedburner.google.com/api/awareness/1.0/Get
FeedData?uri=YOUR FEED ADDRESS');
$begin = 'circulation="'; $end = '"';
$page = $url;
$parts = explode($begin,$page);
$page = $parts[1];
$parts = explode($end,$page);
$fbcount = $parts[0];
if($fbcount == '') { $fbcount = '0'; }
echo '
<div> '.$fbcount.'  Subscribers</div>';
?>
Display FeedBurner Reader count in wordpress blog
Display FeedBurner Reader count in wordpress blog

How to create wordpress widget plugin

How to create wordpress widget plugin, In this article, given full code and with explanation.  For creating wordpress widget you just need use our code. In many wordpress themes we want to create the wordpress widget. For creating the wordpress widget you just need to put following code in functions.php file.

How to create wordpress widget plugin

This functions.php file you can find in wordpress theme folder.

class My_Widget extends WP_Widget {
function My_Widget() {
parent::WP_Widget(false, 'Our Test Widget');
}
function form($instance) {
// outputs the options form on admin
}
function update($new_instance, $old_instance) {
// processes widget options to be saved
return $new_instance;
}
function widget($args, $instance) {
// outputs the content of the widget
}
}
register_widget('My_Widget');

this code

<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php
class bm_widget_popularPosts extends WP_Widget {

function bm_widget_popularPosts() {
parent::WP_Widget(false, 'Popular Posts');
}

function widget($args, $instance) {
$args['title'] = $instance['title'];
bm_popularPosts($args);
}

function update($new_instance, $old_instance) {
return $new_instance;
}

function form($instance) {
$title = esc_attr($instance['title']);
?></pre>
php echo $this->get_field_id('title'); ?>"><!--?php _e('Title:'); ?--> <input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
<pre>
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php
}
}
function bm_popularPosts($args = array(), $displayComments = TRUE, $interval = '') {

global $wpdb;

$postCount = 5;

$request = 'SELECT *
FROM ' . $wpdb->posts . '
WHERE ';

if ($interval != '') {
$request .= 'post_date>DATE_SUB(NOW(), ' . $interval . ') ';
}

$request .= 'post_status="publish"
AND comment_count > 0
ORDER BY comment_count DESC LIMIT 0, ' . $postCount;

$posts = $wpdb->get_results($request);

if (count($posts) >= 1) {

if (!isset($args['title']) {
$args['title'] = 'Popular Posts';
}

foreach ($posts as $post) {
wp_cache_add($post->ID, $post, 'posts');
$popularPosts[] = array(
'title' => stripslashes($post->post_title),
'url' => get_permalink($post->ID),
'comment_count' => $post->comment_count,
);
}

echo $args['before_widget'] . $args['before_title'] . $args['title'] . $args['after_title'];
?>

<ol>
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php
foreach ($popularPosts as $post) {
?>
<li>
php echo $post['url'];?>"><!--?php echo $post['title']; ?-->
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php
if ($displayComments) {
?>
(<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php echo $post['comment_count'] . ' ' . __('comments', BM_THEMENAME); ?>)
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php
}
?>
</li>
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php
}
?>
</ol>

<?php
echo $args['after_widget'];
}
}
?>

 

How to create wordpress widget plugin
How to create wordpress widget plugin

increase upload file size limit in wordpress

Many people want to upload big size media in wordpress. Now with current version you can upload 10 mb file in wordpress.
If you want to increase upload file size limit in wordpress then you should make some changes in your wordpress code. We briefly explained same in article.

increase upload file size limit in wordpress

First option you need to open your functions.php file and put following code in that file.
Note: Here with this code you can upload the upto 50 mb file to your wordpress website.

ini_set('upload_max_size','50M');
ini_set('post_max_size','50M');
ini_set('max_execution_time,'300');

Open your wp-settings.php file which you can find in your root directory. Put following code in that file.

if ( !defined('WP_MEMORY_LIMIT') )
 define('WP_MEMORY_LIMIT', '500M');

Add this code following code in your .htaccess file. This file you can find in your root directory.

php_value upload_max_filesize 50M
php_value post_max_size 50M
php_value max_execution_time 300
php_value max_input_time 300
increase upload file size limit in wordpress
increase upload file size limit in wordpress

Above method is used by many web developers for increasing the file upload limit on server for PHP language.

how to disable wordpress post revisions

disable wordpress post revisions and increase wordpress performance. For improving the WordPress website or blog performance you need use following method.

WordPress saves the post revisions after every 2 min. That takes so much mysql storage.
To save MySQL storage, some WordPress user will be happy using this method, this method is Disable WordPress Post Revision.

how to disable wordpress post revisions

Why we need disabled this featured?

It’ because WordPress created such as dummy data revision and this one make our table sized increased. And if you have limited space, this is bad idea, and of course disable Post Revision also made your WordPress running faster.

Open your wp-config.php file and put the following code in that file. If you are not wordpress developer then dont use following code. Please consult with any wordpress developer for this code.

/* disable post-revisioning nonsense */
define('WP_POST_REVISIONS', FALSE);

Add Text to RSS in wordpress Post Title

I faced very complex issue when my post get published. That post copied from other sites. Due to some wordpress plugin that is happening. wp-matic and wp-robots wordpress plugins are very bad which are stilling the other site blog and content.

Add Text to RSS in wordpress Post Title

Prevent the coping your content you should use my method. This method will add the additional text in your title so your wordpress posts will became more secure.
If you are wordpress developer then only use following code. Open your functions.php file from your theme and put following code in that file.

    function wordpressapi_rss_title($content) {
    global $wp_query;
    $postid = $wp_query->post->ID;
    $gpost = get_post_meta($postid, 'guest_post', true);
    $spost = get_post_meta($postid, 'sponsored_post', true);

    $content = 'Post by WordPressapi.com - '.$content;

    return $content;
    }
    add_filter('the_title_rss', 'wordpressapi_rss_title');

This code will add the custom text in your title. For more information you can search in my blog
https://purabtech.in

Modify wordpress Custom excerpt length

In wordpress api we having the the_excerpt method for showing the short description from wordpress post.
On WordPress 2.9 there are new featured that we can added on the_excerpt(), one of them is change the excerpt length.

Modify wordpress Custom excerpt length

For Modify wordpress Custom excerpt length we need use the filter for modify the wordpress excerpt length. Use our custom code and put in functions.php file

For changing the length of excerpt we need use the filter for modify the wordpress excerpt length.
We only needed to put some function on our functions.php themes file and added some hook to call this functions.

<?php
// Add custom excerpt length
function custom_excerpt_length($length) {
return 20;
}
add_filter('excerpt_length', 'custom_excerpt_length');
?>

Using above code you can control the character length in wordpress description.

how to show author information on each wordpress post

show author information on each wordpress post is really good habit in wordpress post. So reader will know information writer who is writing the article. Many people like this information and they really read the information about author.

how to show author information on each wordpress post

how to show author information on each wordpress post
how to show author information on each wordpress post

For showing the author information you need put following code in the functions.php file show after your post content the author information will displayed to reader.


function get_author_bio($content=''){
global $post;

$post_author_name=get_the_author_meta("display_name");
$post_author_description=get_the_author_meta("description");
$html="</pre>
<div id="about_author" class="clearfix">\n";
$html.="<img class="avatar" src="http://www.gravatar.com/avatar.php?gravatar_id=&quot;.md5(get_the_author_email()). &quot;&default=&quot;.urlencode($GLOBALS[" alt="PG" width="80" height="80" />\n";
$html.="
<div class="author_text">\n";
$html.="
<h4>Author: ".$post_author_name."</h4>
\n";
$html.= $post_author_description."\n";
$html.="</div>
</div>
<pre>
\n";
$html.="</pre>
<div class="clear"></div>
<pre>
\n";
$content .= $html;

return $content;
}

add_filter('the_content', 'get_author_bio');

Just put the above code in functions.php file. You dont need to do code in single.php file.

where to put google analytics code in wordpress blog

Answered wordpress question, where to put google analytics code in wordpress blog. Google analytics service is required in all the wordpress websites. For putting goolge analytics code in wordpress theme.

where to put google analytics code in wordpress blog

where to put google analytics code in wordpress blog
where to put google analytics code in wordpress blog

You can use the following code.

Open your functions.php file from wordpress theme folder and put following code in that file. You just need to put your google analytics code instead of my code.

<?php
add_action('wp_footer', 'googleanalytics');

function googleanalytics() { ?>
// Paste your Google Analytics code here
<script type="text/javascript">

 var _gaq = _gaq || [];
 _gaq.push(['_setAccount', 'UA-12453889-1']);
 _gaq.push(['_trackPageview']);

 (function() {
 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
 })();

</script>

<?php } ?>

Prevent external requests for your WordPress blog

When you run the wordpress blog there must be many external links would be created by others. which are not good for your blog. Some sites may be only using your wordpress images by your images links.

Prevent external requests for your WordPress

For Prevent external requests for your WordPress blog you need to use simple trick. WordPress api is given this facility to prevent the external request.

To do so, open your wp-config.php file and copy paste the following code:

define('WP_HTTP_BLOCK_EXTERNAL', true);

It will block external requests from that time on. Though, some plugins need the external request to work properly. If you experience problems, you can define a whitelist by pasting the code below into wp-config.php. Don’t forget to replace my url by the one needed by the plugin.

define('WP_ACCESSIBLE_HOSTS', 'purabtech.in');

if you are still having any issue then please contact to me.

how to add a favicon to your wordpress blog

We all know what is favicon logo. WordPress tutorial, how to add a favicon to your wordpress blog. In wordpress theme you can easily add the favicon logo using following code and put in functions.php file

how to add a favicon to your wordpress blog

you just need to open your functions.php file and put following code in that file.

function childtheme_favicon() { ?>
<link rel="shortcut icon" href="<?php echo bloginfo('stylesheet_directory') ?>/images/favicon.png" >
<?php }
add_action('wp_head', 'childtheme_favicon');
how to add a favicon to your wordpress blog
how to add a favicon to your wordpress blog

Note: your favicon.ico file need to placed under theme->images folder. then only this code will work