Skip to Content
WordPress® All-in-One For Dummies®
book

WordPress® All-in-One For Dummies®

by Lisa Sabin-Wilson, Cory Miller, Kevin Palmer, Andrea Rennick, Michael Torbert
April 2011
Beginner to intermediate content levelBeginner to intermediate
908 pages
22h 37m
English
For Dummies
Content preview from WordPress® All-in-One For Dummies®

Adding Functionality to Profile Filters

WordPress provides four contact methods by default: AIM, Yahoo! IM, and Jabber/Google Talk. These are, of course, extensible, meaning that you can easily add new contact methods through the use of filters. It's painless to add more, and you can even add on a little extra functionality while you're at it.

Users fill out their profile data in the WordPress Dashboard by going to UsersimageYour Profile (see Book III, Chapter 1). User profile fields are stored in the WordPress database in the user_metadata table and you can easily fetch them by using get_the_author_meta(‘aim’) and print them with the_author_meta(‘aim’). If you add a Twitter Contact Info field, it appears in profiles, and you can use the_author_meta(‘twitter’) template tags in your theme to print the account name.

Figure 7-9 shows the Twitter Contact Info field in a profile within the WordPress Dashboard.

Figure 7-9: Custom Twitter profile field, as shown in the Dashboard.

image

the_author_meta() template tag has a hook called the_author_{$field}, where the PHP variable ‘$field’ is the requested meta field assigned to each contact type in the user profile files, such as ‘aim’ in the above example. These dynamic hooks are powerful because they allow you to narrow your target.

In this example, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

WordPress® 24-Hour Trainer

WordPress® 24-Hour Trainer

George Plumley
Gaming Hacks

Gaming Hacks

Simon Carless

Publisher Resources

ISBN: 9780470877012Purchase book