How to hide wordpress visual editor and HTML editor

If you want to hide the wordpress editor from admin panel then you can use the following code in functions.php file. This is achieved with very simple css trick. You just need to add the following hook into your functions.php file which you can find in your wordpress theme folder.

you can do this in two ways. First with using admin panel.  First thing you need to do is login to your WordPress admin panel.

Then you would need to go to Users > Your Profile,

Just disable visual editor checkbox. That sit. But if you want to this setting to done for all wordpress users then you can use following code.

How to hide wordpress visual editor and HTML editor

How to hide wordpress visual editor and HTML editor
How to hide wordpress visual editor and HTML editor

you just need add following code into your functions.php file. This file you can find in your wordpress theme folder.

 

add_action('admin_head', 'hide_post_box');

function hide_post_box() {
?>
<%%KEEPWHITESPACE%%> <style>
<%%KEEPWHITESPACE%%> #editor-toolbar{ display:none; }
<%%KEEPWHITESPACE%%> #editorcontainer{ display:none; }
<%%KEEPWHITESPACE%%> #quicktags { display:none; }
<%%KEEPWHITESPACE%%> #post-status-info { display:none; }
<%%KEEPWHITESPACE%%> </style>
<?php
}

how to display your posts words count in wordpress

WordPress tutorial, how to display your posts words count in wordpress. Here in this article we given code for adding in your theme functions.php file.

how to display your posts words count in wordpress

 

how to display your posts words count in wordpress
how to display your posts words count in wordpress

If you want to display the words count in your post. you should use the following code in functions.php file.

If you are not wordpress developer then dont use this code in your theme files.

function wcount(){
 ob_start();
 the_content();
 $content = ob_get_clean();
 return sizeof(explode(" ", $content));
}

 

In single.php file put following code for showing the word count.


echo wcount();

 

how to show author in wordpress post

wordpress tutorial, how to show author in wordpress post. Many people want to read the author information after the article. This is good for seo also.

how to show author in wordpress post

You can show the author information in single page using following code. just open your single.php file and put following code after the  the_content() function.

<div id="author-information">
<div id="author-image">
 <a href="<?php the_author_meta('user_url'); ?>">
 <?php echo get_avatar( get_the_author_meta('user_email'), '150',
 '' ); ?></a></div>
<div id="author-bio">
<h4>Written by < ?php the_author_link(); ?></h4>

< ?php the_author_meta('description'); ?>
</div>
</div>
<!--Author information-->

Use following code in your css file

#author-information{float:left;width:auto;clear:both;}
#author-image{border:3px solid #CCC; float:left:width:160px;}
#author-bio{padding:5px;float:left;}
how to show author in wordpress post
how to show author in wordpress post

remove category word from wordpress url

For professional sites we want to remove category word from wordpress url. here we have short code which can be added in to .htaccess file. that will remove category form url slug.

remove category word from wordpress url

If you want to remove the /category/ word from your URL you need to use the following code.

If you are not wordpress developer and you are not having knowledge of apache server then dont use this code.

first take backup of your .htaccess file which you can find in your root folder of wordpress installation.

Put following code in that file.

RewriteRule ^category/(.+)$ http://www.yourblog.com/$1 [R=301,L]

After putting this code your URL will will be changed as follows:

http://yourblog.com/category/wordpressapi
to
http://yourblog.com/wordpressapi

Other Helpful link:

Remove category slug wordpress from URL

remove category word from wordpress
remove category word from wordpress

create links template page in wordpress theme

From 3rd version wordpress introduced links template. Links is same important like archive page. code snippet for create links template page in wordpress.

create links template page in wordpress

Links template page concept is new in wordpress theme. From wordpress 3 version wordpress introduced the links.php template file in wordpress themes. Adding the links page to your wordpress site or blog is very good for seo.Links page is same important like archive page.

create links template page in wordpress
create links template page in wordpress

You can add your friends and good websites in links page. You should use the links page very carefully because this page is very important for SEO. Google and other search engine is always look for links page where you can put other network or friends sites.

How to create links template page

Note: If you are wordpress developer then only use following code.

You need to create the links.php file in your wordpress theme folder. and put following code in that file.


<?php
/*
Template Name: Links
*/
?>
<?php get_header(); ?>

 <section id="primary">
 <div id="content" role="main">

<div id="archives">

<?php the_post(); ?>
 <h1><?php the_title(); ?></h1>
 <h2>Friends Network </h2>
 <ul>
<?php wp_list_bookmarks('title_li=&categorize=0'); ?>

</ul>

</div>
 </div><!-- #content -->
 </section><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

After that go to your wordpress admin panel and create the links.php with links page template.

create links template page in wordpress
create links template page in wordpress

Publish links page and add the links page in to your menu.

Here are some links which are helpful to you.

create contact us template page in wordpress

If you link this article then please add my site in your links page or blogroll. If you are having any issues or question about links template then please write to me on support@purabtech.in.

wordpress add tags to custom post type

WordPress tutorial, wordpress add tags to custom post type. we can create the custom post type. In this tutorial I will show you to add category and tags.

wordpress add tags to custom post type

wordpress add tags to custom post type
wordpress add tags to custom post type

 

You just need use the following code in your arguments.

'taxonomies' => array('category', 'post_tag') // this is IMPORTANT

Here is full code which is I used in functions.php file

add_action('init', 'wordpress_themes');
 function wordpress_themes() {
 $wp_themes_args = array(
 'label' => __('Wordpress Themes'),
 'singular_label' => __('Wordpress Themes'),
 'public' => true,
 'show_ui' => true,
 'capability_type' => 'post',
 'hierarchical' => false,         
 'rewrite' => true,
  'supports' => array('title','editor','author','thumbnail','excerpt','comments'),
           'taxonomies' => array('category', 'post_tag') // this is IMPORTANT

 );
 register_post_type('wordpress-themes',$wp_themes_args);
 }

enable comments for custom post type

In wordpress we can create the custom post types. Now everybody is using custom post types in wordpress and need comments functionality for custom post types also. Custom post types are very important feature of wordpress. For enabling the comments for custom post type just use the following line.

enable comments for custom post type

'supports' => array('title','editor','author','thumbnail','excerpt','comments')

Following line will add the title, thumbnail, excerpt and comments functionality to your custom post type.

enable comments for custom post type
enable comments for custom post type

For more information use check my following code. I used following code in my functions.php file.

add_action('init', 'wordpress_themes');
 function wordpress_themes() {
 $wp_themes_args = array(
 'label' => __('Wordpress Themes'),
 'singular_label' => __('Wordpress Themes'),
 'public' => true,
 'show_ui' => true,
 'capability_type' => 'post',
 'hierarchical' => false,
 'rewrite' => true,
  'supports' => array('title','editor','author','thumbnail','excerpt','comments'),
           'taxonomies' => array('category', 'post_tag') // this is IMPORTANT

 );
 register_post_type('wordpress-themes',$wp_themes_args);
 }

add search form to wordpress navigation menu

In many wordpress premium theme search form added in navigation menu and many clients are demanding for same So here we created tutorial for adding search form.

WordPress tutorial for, add search form to wordpress navigation menu. 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.

add search form to wordpress navigation menu

add search form to wordpress navigation menu
add search form to wordpress navigation menu

Using following code in you can add the search form in your menu bar.

function add_search_box($items, $args) {
ob_start();
get_search_form();
$searchform = ob_get_contents();
ob_end_clean();
$items .= '
<ul>

<ul>
<ul>
	<li class="search-form">' . $searchform . '</li>
</ul>
</ul>

</ul>
';
return $items;
}
add_filter('wp_nav_menu_items','add_search_box', 10, 2);

There is very nice wordpress plugin which will add search box in navigation menu.

Search box on Navigation Menu

Search box on Navigation Menu
Search box on Navigation Menu

This plugin will add the default search box on main navigation menu that will save the space and flexibly fit with the menu.

Add Twitter and Facebook buttons to wordpress posts

wordpress tutorial, how to Add Twitter and Facebook buttons to wordpress posts.  we need to install the various plugins without installing any wp plugin.

Add Twitter and Facebook buttons to wordpress posts

For showing the facebook and twitter button in wordpress post many times we need to install the various plugins but with following code you dont need to install the wordpress plugin.

Add Twitter and Facebook buttons to wordpress posts
Add Twitter and Facebook buttons to wordpress posts

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 facebook_twitter_button($content){
    if(!is_feed() && !is_home()) {
        $content .= '<div class="facebook-twitter-button">
                    <a href="http://twitter.com/share"
class="twitter-share-button"
data-count="horizontal">Tweet</a>
                    
src="http://platform.twitter.com/widgets.js">
                    <div class="facebook-share-button">
                        <iframe
src="http://www.facebook.com/plugins/like.php?href='.
urlencode(get_permalink($post->ID))
.'&amp;layout=button_count&amp;show_faces=false&amp;width=200&amp;action=like&amp;colorscheme=light&amp;height=21"
scrolling="no" frameborder="0" style="border:none;
overflow:hidden; width:200px; height:21px;"
allowTransparency="true"></iframe>
                    </div>
                </div>';
    }
    return $content;
}
add_action('the_content', 'facebook_twitter_button');

adding custom styles to search widget in wordpress

Many people having issue when creating the wordpres theme and show search widget in theme. wordpress tutorial, adding custom styles to search widget in wordpress. In this tutorial we will show you how to show search widget with our custom styling.

adding custom styles to search widget in wordpress

you can override the default wordpress search widget.

adding custom styles to search widget in wordpress
adding custom styles to search widget in wordpress

For that use the following code.


function widget_override_search(){
?>
<ul>
	<li id="linkcat-2">
<h2> WordPress Search</h2>
<form id="searchform" style="padding: 10px;" action="<?php bloginfo('home'); ?>" method="get">
<div>
<input id="s" name="s" size="50" type="text" />
<input id="searchsubmit" type="submit" value="<?php echo attribute_escape(__('Search')); ?>" />
</div>

</form>
</li>
</ul>


<!--?php
}
if ( function_exists('register_sidebar_widget') )
 register_sidebar_widget(__('Search'), 'widget_override_search');

–>