Get Title Of Post Outside The Loop

For theme developers it is important that your theme page displays the correct page title. There can be some confusion in theme developer when they are working on a static page that is being used to display the a list of posts. By default your WordPress site will display a list of the most recent posts on the index.php page of your theme. But this will mean that it will

Read more...

Add Upload Media To Library On Widgets

The WordPress media library is one of my favourite features in using WordPress over other CMS's, when you upload a new image into WordPress it will convert it to a number of a different sizes. These sizes can be defined in the settings -> media page, it will list three different image types where you can define new sizes for these image types. These means that every image you upload

Read more...

Access Database Outside Of WordPress

Sometimes I've needed to build a new page outside of WordPress but still have the ability to access the WordPress database from this new page. This would normally use custom tables you've created. To access the WordPress database normally you would just need to use the global variable $wpdb. This object connects to your database using the credentials found in the wp-config.php in the constant variables DB_NAME, DB_HOST, DB_USER, DB_PASSWORD.

Read more...

Adaptive Backgrounds jQuery Plugin

I recently found a good resource for changing the background colour of a containing div. This is a jQuery plugin that will search for the most dominating colour in an image and will change it's containing element background to this colour. Allowing you to create some nice looking showcase pages with just a few lines of Javascript. This plugin is called the jQuery Adaptive Background Plugin. To use this jQuery

Read more...

Debug WordPress Cron Jobs

In WordPress you can setup scheduled tasks that allow you to run a certain action at a scheduled time in the day. As this runs a set action you can perform a number of tasks at the same time. To setup the scheduled tasks all you have to do is use the WordPress function of wp_schedule_event(). The schedule event function takes 4 parameters. $timestamp - This must be the timestamp

Read more...

jQuery Copy To Clipboard

In a recent project I needed to create a button that would copy some text onto the user's clipboard. As I was going to build this on the click event of a button I wanted to do this with Javascript or jQuery. After doing some research into this I found that JavaScript copy to clipboard wasn't available because of security which also meant that jQuery would not be able to

Read more...

Headroom.js

Headroom is a Javascript plugin that allows you to hide the header until the user really needs it. Many people have websites with a fixed position header bar at the top of the page, this will stay at the top of the page all the time the user is on the site. This is a nice way to make sure that the header is easily accessible all the time the

Read more...

Change Default Theme For WordPress Multisites

When you create a new site in WordPress multisite it will automatically assign a theme to the new site. It does not use the theme that you have activate on the other sites or on the network setup but will use the default theme that is setup in WordPress. Depending on the version of WordPress you are using it will use a different default theme, at the time of writing

Read more...

Remove Protected: From Post Titles

In WordPress you can easily password protect a page from the admin area. All you have to do is under the publish block edit visibility and select password protected. A textbox will appear and you can type in a password for the page. The password is not a password field so it's not hidden from view, this is so admin users can still see what the password for the page

Read more...

Add Button To Editor For All Shortcodes

WordPress shortcodes was introduced in WordPress version 2.5 and is a great way of adding full flexibility and control of certain functionality to the editor of your WordPress CMS. The best thing about shortcodes is that it allows editors to run a certain bit of code within the content area of your site. Having the ability of adding shortcodes means that the editor can also select the position to place

Read more...

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 67