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.
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
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');
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->ID, 'key');
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.
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
You just need to add following code in your wordpress theme’s functions.php file.
wp-pagenavi is most popular. wordpress pagination style without wordpress plugin, We need to install wp-pagenavi wordpress plugin for pagination styling. When we think wordpress pagination style then first thing came in mind which is. We need to install wp-pagenavi wordpress plugin for pagination styling. There are multiple pagination plugins available for pagination styling but wp-pagenavi is most popular.
wordpress pagination style without wordpress plugin
I always recommend wordpress theme developers to not to use the wordpress plugins as much possible because any wordpress plugin will install the extra unuseful code also.
Here in this article I am giving you the example about wordpress pagination without using any wordpress plugin.
Just open your functions.php file and put following code.
When you put some URL and email address you need to manually add the link URL to that text. This action always takes the some time of wordpress blogger. WordPress has facility to add the links to your URL and email address automatically.
convert plain text URI to HTML links in wordpress
This facility is available in wordpress since wordpress 2.7 version but many wordpress theme and plugin developers never used this functionality.
WordPress provides the make_clickable() function for convert plain text URI to HTML links. This function able to convert URI, www, ftp, and email addresses. Finishes by fixing links within links. You just need to pass the string parameter to this method.
More detail information you can find in following file.
wp-includes/formatting.php.
You can use this method in your functions.php file also. Use the following code.
add_filter('the_content', 'make_clickable');
By using this code you are able to covert the URI, www, ftp, and email addresses in to link.
If you are having any issues or question about make_clickable method then please write to me.
Many times you want to show the popular posts in your wordpress theme and you use popular post wordpress plugin or widget for showing the popular posts in your wordpress theme. As much possible you need to avoid the wordpress plugins for minimal code.
most popular posts wordpress without plugin
With very easy steps you can fetch the most popular posts from your wordpress. Most common trick or technique is on comments base you can fetch the popular posts.
You just need to open your functions.php file from wordpress posts and put following code in file.
// Get Most Popular Posts in theme
function popular_posts_by_comments( $posts = 5) {
$popular = new WP_Query('orderby=comment_count&posts_per_page='.$posts);
while ($popular->have_posts()) : $popular->the_post();
?>
<li>
<div>
<a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><?php the_title(); ?></a>
<span><?php comments_popup_link('0 Comment', '1 Comment', '% Comments', 'comments-link', ''); ?></span>
</div> <!--end .info-->
<div></div>
</li>
<?php endwhile;
}
This is very easy code to fetch you wordpress popular posts. Here I am fetching only 5 popular posts from wordpress. You can fetch the multiple popular posts by changing the $post variable value.
In wordpress theme sidebar or footer section if you want to show the popular post then just use following code.
When we login to wordpress admin area that time we first saw the admin dashboard. Many tabs and section are not useful in admin dashboard section for wordpress admin and sometimes we don’t know what is that sections.
Remove Unwanted Meta Boxes from wordpress dashboard through wordpress theme
We saw the right now, recent comments, quick press, stat, recent drafts, incoming links, wordpress development blog, other wordpress news, plugins and more sections in wordpress dashboard section. Most of that section are not useful to wordpress admin. So is that better to remove unwanted section from dashboard.
For disable the dashboard section we are going to use the wp_dashboard_setup method. In wordpress dashboard there are multiple meta boxes listed. some of them as follows:
For removing the widgets or meta boxes from dashboard you need to open your functions.php file from wordpress theme folder and put following code in that file.
WordPress tutorial for, In this article we will show, how to Create multiple widgets in wordpress theme. Widgets for very important in wordpress themes and plugins. First I need to tell you this widget api is located in following file.
wp-includes/widgets.php
For enable the sidebar support in wordpress theme you need to register atleast one sidebar in wordpress api. For enabling the side bar you need to just open the functions.php file and put following code in that file.
if ( function_exists('register_sidebar') )
register_sidebar();
This is enable the global sidebar for your wordpress theme.
If you want multiple sidebar in your wordpress theme then use the following code. I created two sidebars in my wordpress theme. First is normal sidebar and second is footer sidebar.
For main sidebar showing just open your sidebar.php file put following code in that file.
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Main Sidebar') ) :
endif;
For showing second widget in footer section open your footer.php file and put following code in that file.
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer Sidebar') ) :
endif;
Then go to your widget section through admin panel and select your widget which you want to show in widget sections.
If you are having any issues or question about using widget in wordpress theme then write to me.
Short code api is introduced in wordpress from 2.5 version. Since short code is very popular and used by wordpress plugin developers. Many wordpress theme and plugin developers do use the shortcode api regularly.
how to use shortcodes in wordpress posts
Using shortcode api is very easy. If you want to use the shortcode in your wordpress theme then open your functions.php file and put following code. Here is example for using shortcode.
function wordpressapi_content() {
echo "Hello World";
}
add_shortcode('wordpressapi_content', 'wordpressapi_content');
Create any page and just put following line in that post or page.
[wordpressapi_content]
If you put following code in your page or post then you can see the hello world content in your page or post.
If you want to add the google adsence using shortoce then use the following code.