Some time you don’t want to come the some page and posts come in search. Here is very simple technique for excluding or removing the some wordpess pages or posts from wordpress search.
hide certain wordpress pages or posts from search
You just need to put following code in functions.php file. You will find this file in your wordpress theme folder. To work this idea you need to know about the page or post id which you want to exclude from search.
When you are creating the post that time you can get the wordpress post id Or while editing the post you will know the wordpress post or page id.
// search filter
function my_search_filter($query) {
// make sure we are not in the admin and that we are performing a search
if ( !$query->is_admin && $query->is_search) {
$query->set('post__not_in', array(50, 10,32,68) ); // IDs of pages or posts
}
return $query;
}
add_filter( 'pre_get_posts', 'my_search_filter' );
There is custom post type support added from wordpress 2.9 in wordpress. Many times we create the different types of post type in wordpress and show it i different way. We use the different styles for showing the content types..
Add different Editor Styles for Custom Post Types in WordPress
In wordpress we have the visual and html editor. For adding the different styles for custom post types just open your functions.php file put the following code in that file.
function my_editor_style() {
global $current_screen;
switch ($current_screen->post_type) {
case 'post':
add_editor_style('editor-style-post.css');
break;
case 'page':
add_editor_style('editor-style-page.css');
break;
case 'product':
add_editor_style('editor-style-product.css');
break;
case 'shop':
add_editor_style('editor-style-shop.css');
break;
}
}
add_action( 'admin_head', 'my_editor_style' );
If you are not wordpress developer then dont use above code. In purabtech.in site you will find many wordpress tutorials and tips and hacks and plugins. Please write to me on support@purabtech.in
You can add buttons to wordpress wysiwyg editor using following code. For changing wordpress wysiwyg editor, we need to use the quick_tags.js file using hook.
how to add buttons to wordpress wysiwyg editor
But from wordpress 3.1 version we can customize the wordpress editor by using wordpress filter.
Adding more buttons to the editor is really easy. Simply paste this snippet into your theme’s functions.php file.
For increasing traffic of website. It is good to send email to users about new post. we have script for Send email to site users about new wordpress posts.
There are many wordpress plugins available for sending email but I given small code for sending email to wordpress users without using any wordpress plugins
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. Just copy and paste the following code on your functions.php file:
function send_email_users($post_ID) {
global $wpdb;
$usersarray = $wpdb->get_results("SELECT user_email FROM $wpdb->users;");
$users = implode(",", $usersarray);
mail($users, "New Article is Published", 'A new article have been published on http://www.purabtech.in. Please visit');
return $post_ID;
}
add_action('publish_post', 'send_email_users');
You just need to change my domain name to your domain name and put that in your functions.php file. If you are having any issues then Please write to me.
This wordpress hack, tip or trick written by wordpressapi.
Here is some very useful links for wordpress.
Check Following articles for great wordpress hacks of the all the time.
I don’t recommend you to use wordpress plugin for adding the share buttons. we have simple code for add Share buttons in wordpress without wordpress plugin
Share buttons in wordpress without wordpress plugin
There are many wordpress plugins available for adding share button in wordpress or any website. I don’t recommend you to use the wordpress plugin for adding the share buttons like, facebook, twitter, linkedin, stumbleupon, delicious and Google buzz. Because when you install wordpress plugin for social buttons then that plugin will use your database and on every page view that will fire query to your database and your page view will became little bit slower. If you are having less visitors then this ok but if your site is having large visitors than you need to think about small issues also. Floating share button are very popular these days. You can easily add the sharebox which floating bar. Using following code you can add the share buttons without wordpress plugin.
I written some code for this and on my site share buttons are looking as follows:
I created file called sharebox.php and in that file just written following code.
If you need more buttons then you should prefer following article. In this article you will find the all the share button code. and you dont need to add any wordpress plugin for adding share or like buttons in wordpress site.
Please write comment for our article: Share buttons in wordpress without wordpress plugin
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
you just need add following code into your functions.php file. This file you can find in your wordpress theme folder.
wordpress tutorial for, change Visual Editor Font Size without wordpress plugin. need to open your functions.php file and put following code in that file.
change Visual Editor Font Size without wordpress plugin
You need to open your functions.php file and put following code in that file.using following code you can change the font size of editor.
Note: If you are not having knowledge of wordpress code and php then dont use the code.
Tips for Bloggers, wordpress visual editor keyboard shortcuts for bloggers, In wordpress admin panel and with new post option we can use keyboard shortcuts also.
wordpress visual editor keyboard shortcuts for bloggers
Here is list of keyboard shortcuts for wordpress editor for admin panel. wordpress shortcuts are available from wordpress 2.6 version and that is still there. But in current versions of wordpress you cannot see the hotlinks but you can use that for fast blogging.
Alt+Shift+A : Hyperlink Selected Text.
Alt+Shift+T : Add read more Tag to post.
Ctrl+[Header Number] : Used to apply header tag to current line.
Alt+Shift+L/R/C : Align Left/ Right / Center.
Alt+Shift+S : Justify Text.
Alt+Shift+D : Strike through Text.
Alt+Shift+U : Start unordered list
Alt+Shift+O : Start an ordered list.
Alt+Shift+P : Add a new page to your post.
Alt+Shift+Q : Enter a blockquote.
Alt+Shift+H : Toggle Full Screen.
The visual editor has several keyboard shortcuts, or hotkeys, built in.
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.
WordPress tutorial for, disable html code in comments wordpress. We given code sample for functions file to prevent html code in wordpress comments section.
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. Just copy and paste the following code on your functions.php file: