Super awesome code generator for WordPress Developers by Rami Yushuvaev
Month: October 2013
How to change your WordPress URL when installed in a subfolder
Oftentimes people install WordPress in a subdirectory of the main website. One-click installers like to do this. Say your domain is http://example.com, but WordPress lives in http://example.com/wordpress. By default this means that people will have to visit your website at the latter URL.
But what if you want your URL to be http://example.com, without that /wordpress at the end?
No problem I say – let me talk you through it. It may sound scary, but that’s just because we have to do some tweaks to files we don’t normally touch.
How to override a parent function from your Child Theme
When you’re writing a Child Theme you can easily add your own functions to a custom functions.php file. But sometimes you want to replace or remove a function that the original theme provides. Because the Child Theme’s functions.php file is loaded BEFORE the parent’s file, you can’t just define the same function again because it would be … Read more
How to find the directory of your WordPress Theme in PHP
To get the directory of the current theme (or child theme) you can use get_stylesheet_directory_uri(). Here’s how to use it. Let’s assume that your WordPress installation lives in http://demo.com, and that your theme is located in a folder named “my-super-theme”. We can assume then that the full URL that points at http://demo.com/wp-content/themes/my-super-theme/ The URL will … Read more
How to fix “unexpected T_FUNCTION” error in PHP
I tested one of my plugins yesterday and was shocked to see a nasty error message: What was going on? I could have sworn this worked fine last time I tried! Then I remembered that I changed my PHP Version in MAMP, from 5.5.3 back to 5.2.17. And exactly therein lies the problem, because the … Read more
How to change the admin footer bar in WordPress
The admin footer bar is the one line of text displayed at the very bottom of your admin interface. By default it reads “Thank you for creating with WordPress” on the left, and shows the current WordPress version on the right. You can however change this if you like. Perhaps you want to provide additional … Read more
How to get a link to a specific WordPress admin page
To get a reference to a specific admin page (such as Dashboard), we can use the admin_url(), network_admin_url() or get_admin_url() functions, like so: get_admin_url( ‘index.php’ ); You will need to pass the reference to the page you’d like to display. To find out how, simply click on the menu page in question, then look at … Read more
How to use custom CSS in the WordPress admin interface
A bit related to my previous post about using jQuery UI elements in the WordPress admin interface, it’s likely that at some point you want to load your own CSS styles to your plugin or theme’s admin pages. Lucky for us that’s a lot easier that loading JavaScript! Here’s how – works without adding an … Read more