Category: WordPress

Quick WordPress Tips – Child theme URL and URI path

A WordPress child theme is a theme that inherits the functionality of another theme, called the parent theme, and allows you to change, or add to, the functionality of that parent theme. WordPress Child themes are a great idea to extend the theme a bit without getting your hands dirty with the big deal. For this reason, child themes are the recommended way of making modifications to a theme.
I encountered a problem with my child theme when I wanted to load some of my JavaScript files for the theme’s option which I kept with in the child theme so that the parent theme remains unchanged and all the development is also done in one directory.

When I tried loading the JavaScript using the Template path obtained by

$template_path = get_bloginfo('template_url');

I got the path to the parent theme which of course is wrong in my case as my JS file was in child theme’s folder.

Here is the solution:
Use the URI

Output the URI

With get_stylesheet_directory_uri(), I can load addition JavaScript files in my WordPress child theme

if (is_admin()){ //load scripts for admin page
	wp_enqueue_style('admin-style', get_stylesheet_directory_uri() . '/admin/option.css', false);
	wp_enqueue_script('admin-scripts', get_stylesheet_directory_uri() . '/admin/script.js', array('jquery'), '1.0', false);
	}
}

Share this article if it was of any help, that might help others as well.

Remove comment-reply.js from WordPress header

Remove comment-reply.js and .recentcomments from WordPress Header

Have you ever seen the following code inside the HEAD section of your WordPress blog source code like image above? (It’s appear in single post page only). Now let’s view the css code below, it’s appear in the HEAD section too, when the Recent Comments Widget used

.recentcomments a{display:inline !important;padding: 0 !important;margin: 0 !important;}

Ever wonder how it got there, and how to get rid of it?

Remove or Disable Recent Comments Widget CSS code

Why they did not just drop this altogether is a mystery. This leaves a bad taste in my mouth because:

  • the style is automatically forced into any page that embeds the widget
  • it uses !important to override any existing styles
  • it cannot be configured from the widget
  • this is a core WordPress widget and not some widget added by a random plugin. WordPress should not contain such bad practices.
  • It is something that should be handled via a style sheet.

Remove comment-reply.js from WordPress header
Fortunately, we can remove or disable it by adding a filter via the WordPress add_filter() method. In fact, if you look at the TwentyTen theme that comes with the later versions of WordPress 3.0 and on, you will find that theme addresses this issue with the following snippet of code in their functions.php file:

Drop this code into your functions.php file and the styling will be removed from your HEAD section.

Remove or Disable comment-reply.js code

Let’s see what is place above in header.php

<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
        <?php wp_head(); ?>
</head>

Now, we can remove or disable this script more easily by delete this direct from header.php or use wp_deregister_script() function

function clean_header(){
	wp_deregister_script( 'comment-reply' );
         }
add_action('init','clean_header');

Conclusion

Almost parts of WordPress template codes is modifiable or removable by add or remove filter methods in functions.php file. Let’s think about it before hacking to WordPress core sources or create your own WordPress child themes.

Move from Wordpress.com to your own Wordpress.org self-host

Things to do when move your website from WordPress.com to self hosted

You’ve started your first blog on WordPress.com because the service was free, you weren’t required to have any technical skills and there were plenty of widgets, themes and plug-ins to help you quickly customize the blog. However, a time comes when you might want to move to your own domain name which is a continuance of your WordPress.com blog. Moving your WordPress.com blog to a self-hosted WordPress.org is actually more simple than you might believe! Sure there’s a few steps but all good things require a bit of work, right?
Move from WordPress.com to your own WordPress.org self-host

Continue reading

Jetpack Wordpress.com Stats Configuration

How to hide The WordPress Stats Smiley Face

Automattic just released a collection of plugins as one “super-plugin” called Jetpack. As they explained it, the goal was to bring eight of the most requested features available on WordPress.com to the millions of self-hosted WordPress sites in one easy-to-install curated package. If you use JetPack Stats on your site (formerly released as a stand alone plugin called WordPress.com stats), you may be familiar with the smiley face image face :)that it adds to the bottom of every page on your site.
The smiley was added as a visual way to make sure the stats are tracking and is not something that can be removed directly from the plugin code. Like many other bloggers I do like the WordPress stats service but I’m not a huge fan of it so I looked into how you can remove it. Simplest way to remove it is to go into your themes style sheet (style.css) and put the following code snippet:

Thankfully, the recent release of JetPack addressed this issue. If you go to the configuration page for JetPack stats

http://www.yoursite.com/wp-admin/admin.php?page=jetpack&configure=stats

you will now see an option to hide the smiley image.

Jetpack WordPress.com Stats Configuration
Jetpack WordPress.com Stats Configuration

So now you know how to remove the WordPress Stats smiley face. The question is, do you really want to?!

Top 20 Most Common Wordpress Plugins for starters

Top 20+ Most Common WordPress Plugins for starters

WordPress has a lot of plugins developed by many people. A headache after you install your own WordPress blog that “What is the necessary and useful WordPress plugins need to install after I got a WordPress blog?”
Let’s take a look at the 20 most commonly used plugins on WordPress blogs across the web, including those that offer more features, to those that simply reduce the simple tasks of running a blog.

Top 20 Most Common WordPress Plugins for starters
Top 20 Most Common WordPress Plugins for starters

If you are new to WordPress, this basic list (which is technically not limited to plugins alone) should help get you started on the right foot. Whether you are running a basic brochure site, or a full featured blog, you should be sure your WordPress site includes these essentials.
Continue reading

Make your own Wordpress Drop-Down menu

Make your own WordPress Drop-Down menu with CSS and jQuery

A drop down menu is often your best means of keeping the navigation simple and uncluttered, that can offer your theme and users 2 new things. One, add a nice new type of effect to enhance your theme. Two, allow the users to find things more easily. There are a few plugins that you can use to make this, but in this post, I’ll show you how to make your own WordPress Drop-Down menu with CSS and jQuery and WordPress’s standard wp_list_pages, wp_nav_menu, wp_list_categories

Make your own WordPress Drop-Down menu
Make your own WordPress Drop-Down menu

The aim of this short tutorial is help you build a simple multi-level drop-down menu in your WordPress theme using jQuery’s JavaScript library to make sure cross-browser compatibility.

To get started with this tutorial, you’ll need to have a WordPress website up and running and a willingness to alter your theme files. Once that’s squared away you’re ready to rock!

Continue reading

Essential Wordpress Plugins to Backing Up your Database

10+ Essential WordPress Plugins to Backing Up your Database

Just imagine, then, the all-consuming sorrow of losing weeks, months or even years of blog posts or other site content. Your hosting company may provide a responsible backup service (or you may have a well-considered system in place if your site is self-hosted) but some extra insurance can be crucial if the unexpected happens (as it did for one of our client sites today).
Keeping an up-to-date blog backup copy, is one of those things that every one would like to do but are either too lazy to actually do it or have no clear idea of how it can be done. Backup is vital but it needs to be painless otherwise people just do it less often (which defeats the purpose, your backup should not really be older than a couple of days ago).

Essential WordPress Plugins to Backing Up your Database
Essential WordPress Plugins to Backing Up your Database

The ways which I’ve ever tried, an ideal backup procedure should be simple, heavily automated and give quick recovery option for almost any problem. Your backup must be up-to-date and it’s can store on your computer, another hosting server, another online storage service ….
Choosing a WordPress backup plugin that is right for you which has listed below
Continue reading

Highlighting Author Comments in Wordpress

How to Highlight Author Comments in WordPress using CSS

Many blogs highlight the author’s comment in the comments section. I’m talking about how to highlight comments posted by the author of the article. You can use many plugins to get this effect (For eg., the Highlight Author Comments Plugin) – but you don’t have to. You can get the get the same effect by adding a small bit of CSS code to your theme.

Highlighting Author Comments in WordPress
Highlighting Author Comments in WordPress

Most snippets will target and try to find author’s email or user id, but that actually slows your site down. Why not using CSS selector and find author’s comment and change the background color so it is easily pointed out. Pretty smart. After that, it was a simple matter of times to see the result.
Continue reading

Social Bookmarking Link Codes

45+ Most Popular Social Bookmarking Link Codes for WordPress

Social bookmarking is a method for Internet users to share, organize, search, and manage bookmarks of web resources. Unlike file sharing, the resources themselves aren’t shared, merely bookmarks that reference them. With Social Bookmark websites, users can save and categorize a personal collection of bookmarks and share them with others. Your visitors can now bookmark and submit your websites to all their favorite social bookmark services with the ease of a single click.
So how can we encourage more people to share our links? One of the easiest options is to include a set of links at the bottom of your posts which readers can click to automatically vote for your article.
Social Bookmarking Link Codes

In this post, I’ve written the WordPress codes for 45+ of the most popular social bookmarking and networking sites out there.
Continue reading