It is easy to limit search results for specific post types in WordPress blog. This can be done by editing your theme’s PHP function.
Continue reading Limiting Search Results For Certain Post Types In WordPress
Tag Archives: WordPress
How To Show Your BuddyPress Members With Avatars On A Google Map ?
Know how to add a Google map displaying all your members location with their avatar on your site.
Continue reading How To Show Your BuddyPress Members With Avatars On A Google Map ?
Get Extended Settings For BuddyPress. Editing BP-Avatar, Profile Links, Tabs, Thumbnail Size Etc
Get Extra configuration Settings For BuddyPress Admins, Editing BP Avatar size, Profile Links, Activity, Friends, Message, Group Including Other Tabs And Much More.
Continue reading Get Extended Settings For BuddyPress. Editing BP-Avatar, Profile Links, Tabs, Thumbnail Size Etc
How To Enable Front-end Editing In WordPress ?
P2 Theme works best with front-end editing but if you like other themes and want to enable front-end editing feature then this tutorial is for you.
Continue reading How To Enable Front-end Editing In WordPress ?
Editing WordPress Dashboard
Adding a custom dashboard logo, changing dashboard color and editing other dashboard views Like Footer, Publish Button, WP-Toolbar Menus, Etc.
Continue reading Editing WordPress Dashboard
How To Limit Access To WordPress Login Page ?
A security measure for protecting your WordPress site by limiting access for IPs to your wp-login.php file.
Continue reading How To Limit Access To WordPress Login Page ?
How To Keep Log Of WordPress PHP And Database Errors ?
Keeping Error Logs is helpful to know about invalid database queries and file requests of your website. You can easily enable error logging in WordPress either by plugin or by hack.
Continue reading How To Keep Log Of WordPress PHP And Database Errors ?
How To Integrate Twitter Login and Avatar In Your WordPress Site ?
How To Set Minimum Post Length In WordPress Posts ?
How To Set Default Minimum Comment Length For WordPress Comments ?
Splitting WordPress Posts InTo Multiple Pages
WordPress Launched Retina Support In Gravatar, For Both WordPress.Com And WordPress.Org Weblogs
WordPress Hack For Adding Signature After Posts Content
Open your theme’s function.php and add the following code. Remember changing text after equal sign with your own.
function custom_content_after_post($content){
if (is_single()) {
$content .= ‘<p>Load Your Content Here</p><img src=”‘. get_template_directory() .’/images/signature.png” alt=”Your Name” />’;
}
return $content;
}
add_filter( “the_content”, “custom_content_after_post” );
You may also use WordPress Signature Plugin for doing so. It allows WP users to put signatures below every post. After installing and activating it you can easily access it by navigating to WP-Admin Dashboard >> Tools >> WPSignature.
Become Google’s Verified Author For Your WordPress Blog
After getting Google’s verified authorship you will be seeing your blog post search results with the screen shot of your Google Plus Profile Image. As show below:
For doing this in your blog results, follow these steps
Open your theme’s header.php file and add the following given code block in head section –
<link rel=”author” href=”https://plus.google.com/107466614529996508363/posts” />
Remember:
- Change the profile URL with your Google Plus Profile URL in the above given code block.
- Head section is between <head> and </head> tag so add the given code in between these tags.
Now open your theme’s function.php file and the following action at last:
add_action(‘wp_head’, ‘add_google_rel_author’);
function add_google_rel_author() {
echo ‘<link rel=”author” href=”https://plus.google.com/107466614529996508363/posts” />’;
}
- Visit your Google+ Profile.
- Click Edit and make your +1s pubic.
- Scroll down to contributors section.
- Under the heading “Contributor to” add your blog’s address.
That’s all. Next Google’s re-crawl to your blog pages will start showing your face in Google search results. So wait for it. You can reduce this time by writing a new blog post.
Disable Comments On WordPress Media Attachments
Using WP Plugin
Download and activate Disable Comments plugin. Using this plugin admins can easily disable comments site wide or according to post type. After installation it can be accessed from settings menu of admin area dashboard.
Using WP Hack
Add this code in your theme’s function.php file:
function filter_media_comment_status( $open, $post_id ) {
$post = get_post( $post_id );
if( $post->post_type == ‘attachment’ ) {
return false;
}
return $open;
}
add_filter( ‘comments_open’, ‘filter_media_comment_status’, 10 , 2 );
How To Protect wp-config.php And .htaccess Files In WordPress ?
You can block access to your site’s wp-config file from browser by adding following code in your .htaccess file:
# Block access to wp-config
<files wp-config.php>
order allow,deny
deny from all
</files>
For blocking access to your .htaccess file add this code inside your .htaccess file:
# Block access to htaccess
<files .htaccess>
order allow,deny
deny from all
</files>
Note:.htaccess file is present in your site’s root at the same place where you find wp-config file.
Protecting Your WordPress Admin From Hacks
You may use this trick for adding an additional layer of security on your WordPress site so that your site don’t get compromised and hacked:
- Open your cPanel.
- From Security section click Password Protect Directories.
- Now on the Pop Up. Select root then from your WordPress installation select wp-admin.
- Check Password protect this directory.
- Create a user for that directory; there is an option below the check box. That’s it..
Now anytime you visit wp-admin directory you should notice an authentication box asking you for the username and password for authentication.
Sometimes it may show some errors depending on how your server is configured. Don’t worry, just ask me here about the problem(if you face one).
Monitor, Manage And Backup All Of Your WordPress Sites At Once From A Single Place
Using WP Remote you easily monitor, update and backup all of your WordPress sites at the same time from a single place. It communicates with your WordPress site using API like Akismet so there is no need of providing username and password and it is completely free to use.
Features:
Know WP Remote Latest Enhancements
- It can track all of your sites.
- No limitation to number of sites you add.
- It can update WP-Core, all plugins and themes.
- Check WP Remote Security policy here.
WP-Hack For Adding Google+ Page Badge ‘Add to Circles’ In Your WordPress Blog
Add this code in your theme’s header.php file’s head section:
<link href=”https://plus.google.com/PageID” rel=”publisher” /><script type=”text/javascript”>
(function()
{var po = document.createElement(“script”);
po.type = “text/javascript”; po.async = true;po.src = “https://apis.google.com/js/plusone.js”;
var s = document.getElementsByTagName(“script”)[0];
s.parentNode.insertBefore(po, s);
})();</script>
Replace PageID (in bold text of above code block) with your Google+ Page ID.
Now visit your blog’s wp-admin (Dashboard) >> Appearance >>Widgets and drag text widget to your sidebar.
Paste following code inside your text widget (replacing PageID) :
<g:plus href=”https://plus.google.com/PageID” size=”badge”></g:plus>
For smaller badge use:
<g:plus href=”https://plus.google.com/PageID” size=”smallbadge”></g:plus>
Note: You can get your Google Plus Page ID by visiting your page’s profile and copying the number before /posts or /about in URL.
Function For Defining Default Post Thumbnail In WordPress
Open your theme’s function.php file and add the given function editing the thumbnail image URL (given in bold text) with your own image URL.
add_action( ‘save_post’, ‘wptuts_save_thumbnail’ );
function wptuts_save_thumbnail( $post_id ) {
$post_thumbnail = get_post_meta( $post_id, $key = ‘_thumbnail_id’, $single = true );
if ( !wp_is_post_revision( $post_id ) ) {
if ( empty( $post_thumbnail ) ) {
update_post_meta( $post_id, $meta_key = ‘_thumbnail_id’, $meta_value = ‘https://sangkrit.net/thumbnail.jpg’ );
}
}
}