background preloader

Wordpress - tips

Facebook Twitter

WordPress Settings API Tutorial. Originally posted here: When writing the Simple Facebook Connect plugin, I investigated how the Settings API worked.

WordPress Settings API Tutorial

It’s relatively new to WordPress (introduced in version 2.7), and many things I read said that it was much easier to use. It is much easier to use in that it makes things nice and secure almost automatically for you. No confusion about nonces or anything along those lines. However, it’s slightly more difficult to use in that there’s very little good documentation for it. So, here is my little documentation attempt. Making your own settings page First, add yourself an options page. What this does is quite simple, really: a. Oh wait, we need that function! Hang on a minute, where’s all the options? First, we call settings_fields(‘plugin_options’). Next, we call do_settings_sections(‘plugin’).

Defining the settings Here we’ve done three things. First, we register the settings. Ignoring the validation function for a moment, lets move on to the setting section. 10 Things You Need to Know About WordPress 3.4. This article will take approx 7 minutes to read.

10 Things You Need to Know About WordPress 3.4

WordPress 3.4 is around the corner. It’s currently beta4 which means a Release Candidate or three will be needed before it drops officially. If you want to test what’s out there now, the way to do that is through SVN. As usual, however, pre-release WordPress is not supported. As usual, however, I have been running trunk throughout the entire development cycle without any problems. Before I get into the guts of WordPress 3.4, I want to point you to a resource which highlights some of the thinking that is going into the development, now and in the future, of how WordPress is built. While it may be over the head of non-developer types, the gist is that now that we (used loosely) can write code smarter, we’re working our way in that direction. Without further adieu, however, let’s get into what you can expect in the new version of WordPress. Embed Tweets with oEmbed Query Efficiency Improvements This has been how the query has worked for years.

13 Useful WordPress SQL Queries You Wish You Knew Earlier. WordPress WordPress is driven by a MySQL database.

13 Useful WordPress SQL Queries You Wish You Knew Earlier

This is something active WordPress users would know. However, if you only just read about it here from us, here’s what you should know. MySQL is a free relational database management system available in most web hosting services. All of the WordPress data like the posts, comments, categories, and settings are stored within the MySQL database. For example, if you needed to change some information across the board in WordPress, going through each record is very time consuming and prone to human error.

Shown below are some SQL queries that can be of great assistance to you when using WordPress. Backup your WordPress Database Before you proceed with any changes, be sure to backup your database. You can download WP-DB-Backup or WP-DBManager plugin to backup your database through your WordPress admin panel. If you decide to backup your WordPress database manually, follow these steps: 13 SQL Queries for WordPress Change Siteurl & Homeurl Solution: Local dev tips: DB & plugins. Running a WordPress site on your local machine is a great way to do development.

local dev tips: DB & plugins

I’ve taken advantage of this to do development while on flights (and yes, I realize that in about 5 years it’s going to seem positively quaint that there used to be flights without Internet access). Today, I’d like to tackle two common issues when running a WordPress site locally: Handling differing database connection detailsHandling plugins that can’t or shouldn’t run on a localhost My assumptions: You have your site in a Git repositoryYou have a working LAMP/MAMP/WAMP/whatever setup.You already know how to do a mysqldump and import that dump to your local machine Database connection details Your database user and password are (or should) be different on your localhost than they are on your production environment.

Here’s how to do it. Ignore the WP_LOCAL_DEV define… I’ll explain that later.