Get URL of any PHP file in WordPress

Getting URL of current page or current PHP file is a very common task. And that is not exceptional in WordPress. For example: when you include a plugin in a theme, or using LESS PHP compiler. There're some available techniques, but I found that all of them are not good enough to work in all situation, so I hope what I write in this post is a better … Continue reading →

Google Launched Font Directory And Font API

Today, Google has launched an awesome service - Google Font Directory. The Google Font Directory provides high-quality web fonts that you can include in your pages using the Google Font API. These fonts are extremely easy to use and work in most browsers. … Continue reading →

Add more placeholder tags to WordPress SEO plugin

WordPress SEO plugin is the best SEO plugin for WordPress. It's very flexible in customizing meta title using placeholder tags like %%title%%, %%sitename%%. The problem is the list of placeholder tags are fixed and sometimes not satisfy our needs. For example, we can't show value of a custom field (post meta) in the title! In this post I'll show … Continue reading →

Autoload Must Use Plugins in Sub Folders in WordPress

In WordPress, there is a special folder in wp-content: mu-plugins which stands for Must Use Plugins. WordPress automatically loads all PHP files in this folder. This is a very cool features if you want to always turn on some plugins such as debugging plugins, SEO plugins or functionality plugin for your blog. The problem is WordPress doesn't load … Continue reading →

Get content before more tag in WordPress

Yesterday, I wrote a simple plugin for Deluxe Blog Tips to show a "giveaway" widget in the sidebar. That widget will get the content before more tag of the giveaway post and show it. The problem is that the excerpt functions, that we often use to get that content such as the_excerpt() or the_content( $more ), don't work! After digging more into … Continue reading →

Admin Body Class – Everything You Need To Know

In a recent project, I needed to add some styles for a specific admin page in WordPress. It is easy to enqueue a CSS file for a targeted admin page using the magic of current admin screen object, but it's not too easy if you want to use only 1 CSS file for all admin pages and still be able to style a particular page. Think about the style.css of a … Continue reading →

Display comments in homepage in WordPress

I had an interesting experience working with comments in WordPress. The task is display comments in homepage, like in Pinboard theme by Themify. It looked simple at first and I thought it can be done easily with wp_list_comments() but the truth is not like. In this post, I'm going to show a simple trick that solve this problem. … Continue reading →

How To Get Current Page Title In WordPress

Sometimes we want to get current page title, which is displayed in <title> tag. Here I mean the page in general meaning, not WordPress "page". We have several WordPress functions that can help such as:get_the_title(): to get current post/page/any post type title single_cat_title(): to get current category title. There're sibling functions … Continue reading →