Add Scripts To Shortcode Only When Used

Since version 2.5 WordPress introduced a new way of developers to provide dynamic content for the content author of the website with the use of Shortcodes. What Is A Shortcode? A shortcode allows the user to run a PHP function at any point you want in the content. A default shortcode you get with WordPress is the gallery shortcode, to add a gallery to your website all you have to

Read more...

Flush Permalinks On Custom Post Type

WordPress has the ability to have different post types, the main post type you will use in WordPress is the post type called Post. But there are other defaults such as Pages and Attachments. All the post types in WordPress are stored in the same table wp_posts there is a column on this table which will decide the type of post, this is defined as post_type. In version 3.0 of

Read more...

Debugging In WordPress

Debugging your website is very important for any project, you will need to be able to debug your site in all the difference environments from local to live. But depending on the environment you will want to debug in different ways. For example on your local environment you may want to output all PHP errors on the screen to make it easier to fix the problems, but you will not

Read more...

How To Use WordPress Thickbox To Create A Gallery

WordPress comes with an inbuilt Javascript library which allows you to easily show pop-up dialog boxes on your WordPress site. This Javascript library is called Thickbox, which is a lightweight library used to create dialog widgets built on top of the jQuery library. The Thickbox library can be used to display an image, multiple images, inline content, iframed content and even content from an iframe. Thickbox Using the Thickbox library

Read more...

WordPress Menu Item Icons

In WordPress 3.8 the core had a change to all icons, they now use Dashicons which are fonts that mean you can display an icon by simply adding a CSS class. This can change a few things in the admin area of your application, for example when adding menus to the admin area you might need to change the icon to use a CSS class. If you have created any

Read more...

Set Default Visibility To Password Protected

In a recent project I had to make a certain post type to be password protected by default. Making posts password protected is default functionality that is built into WordPress core. To change the post to be password protected you do this in the publish settings on the edit post screen. There is a visibility setting where you can click on the edit button and the a dropdown will appear

Read more...

Create Your Own Pagination Links

When you are developing themes in WordPress you will first see that the query returns 10 posts at a time, this is because there is an in-built pagination that will tell WordPress what chuck of posts to display. If you are on page one then WordPress will display the 10 latest posts, if you are on page 2 then WordPress will show the 11 - 20 latest posts. There are

Read more...

Register Hidden Fields On Ninja Forms

When you are building a website, one of the most important areas of your site are forms, allowing you to capture data about your audience it can help you know what they want from you. There is no in built way in WordPress to create forms for your site, but there are a few really good plugins that allow you to do this. The one I've been using recently is

Read more...

Uninstall Hook For WordPress Plugin

When a user deletes your WordPress plugin it might be necessary that you do some processing for cleaning up the WordPress site. This is because a WordPress plugin can be used to create new data such as post types, options meta, post meta, custom tables etc. On the deleting event you may need to perform tasks such as removing this custom data the plugin has created. There are a couple

Read more...

Add Custom User Profile Fields In WordPress

When you are working on projects that need a lot of user management then you can get to the point where you need to add additional information to the users of your website. This is similar to creating new post meta data where you are able to create new bits of data and attach them to your posts, the users can work in exactly the same way. In the WordPress

Read more...

1 2 3 4 5 6 7 8 9 11