Category Archives: Code Snippet

Quick Fix for Working with Absolute Path on Temporary URL

Can’t think of a better title, here is the scenario: After creating a new account at hosting service provider, we are normally assigned a temporary URL before link this hosting account to domain of final production site, for example: http://hostingserver.com/~username. Sometimes, we have to work on the temporary URL through development stage before site goes live for various reasons. The temporary URL creates temporary trouble to some not well-written code in case “absolute path” is used in either themes, plugins, or existing site. The trouble can be either broken links, or missing images.

Continue Reading →

How to Make TubePress Responsive

TubePress is a well-designed plugin that brings YouTube or Vimeo video gallery into WordPress website. With easy CSS hack, we can easily fit TubePress video gallry to different theme. But out of the box, TubePress doesn’t offer responsive option.

Continue Reading →

Change Howdy User Greeting Message on WordPress Admin Bar

“Howdy, $user” is the default greeting message on the top right corner after successful user login. I didn’t give it a second thought until today. I got a request asking me to change the greeting from “Howdy” to “Hello”.

Sounds simple?

Continue Reading →

List All WordPress Posts by Category

If you are looking for a way to automatically generate a post index page, with all the post title & link in a WordPress website, the simple way is to use WP_Query, with “posts_per_page=-1” as $args.

There are ways to organize the list, for example, group the post by Category. In this case, we can add a new parameter in $args, which is “cat”, and put the query inside a category loop. Here are the code snippets.

Continue Reading →

How to get content from WordPress submenu only

wp_nav_manu() displays a navigation menu. We can call different menu by assigning a different $menu. But the is no straightforward function to get only a submenu. For example, we may want to display a submenu on the sidebar for easier navigation.

Continue Reading →

Dynamically Add Menu Items in WordPress

One customization in membership website is to add login / logout link somewhere on the web page. Most common place to add this link is navigation menu. Login / logout menu item can’t be added via Appearance / Menus in admin panel, because it changes its content based on user “logged in” status.

Continue Reading →

Hide the Admin Bar in WordPress

Once we start membership integration, adding non-admin users, the admin toolbar seating on top of the page for logged in users becomes annoying. The toolbar for regular user such as subscriber provides only links to edit profile or link to log out. A fully customized membership website should has other options to provide these links. In almost all my projects, clients want to hide it from regular users.

Continue Reading →