Defined in: wp-includes/post.php
Retrieves a list of pages from the site’s wp_posts table. In Wordpress posts and pages are store in the same table called wp_posts. Pages are identified by the string ‘page’ stored in the post_type field. This function will return an array list of pages depending on the $args array of options passed to the function.
The get_pages filter is applied to the resulting array list of pages before returning from the calling code. The resulting array list of pages and the list of options passed to get_pages are passed as parameters to the get_pages filter.
array get_pages( [array $args] )
Possible values for $args and their default values:
- child_of
- default is 0
- sort_order
- default is ‘ASC’
- sort_column
- default is ‘post_title’ (this can be any of the column names in wp_posts, tip: you can use ‘menu_order’ to control the order)
- hierarchichal
- default is 1
- exclude
- no default value
- include
- no default value
- meta_key
- no default value
- meta_value
- no default value
- authors
- no default value
Author:
kihbord
Tags: get_pages, wordpress api
I’ve don my share of coding in Assembly language and one of the constructs that is pretty efficient to use is lookup tables for calling subroutines or functions. One of the things I like PHP is its ability to do the same thing.
For example, if you want to perform exception/error handling based on a status code, you can use lookup tables instead of using a switch() construct. If you use a switch() construct, you’ll have something like:
switch( $status ) {
case 0: do_action_1(); break;
case 0: do_action_1(); break;
default: do_default();
}
If you use a lookup table, your source code will have something like:
$lookup = array( 'do_action_1','do_action_2');
if ( $status >= 0 && $status < count($lookup) ) {
call_user_func($lookup[$status]);
}
I’m sure there are other uses of lookup tables and the combination of using array() and call_user_func() in PHP offers a lot of flexibility in coding.
Author:
kihbord
Tags: call_user_func, lookup table
As a follow-up on my last post about “Detecting web visitors that use mobile phones“, I’ve made available a Wordpress plugin that can be used on your Wordpress site. The plugin provides an is_mobile() function that can be used in Wordpress themes to enable detection of mobile devices.
I currently use it on this site to allow me to view Code Stuff on my mobile phone. If you want to know more about the TxTu Is Mobile wordpress plugin, you can visit my site at TxTu. You can also go straight to the TxTu Is Mobile page to read and download the Wordpress plugin.
Author:
kihbord
Tags: browser detect, plugins, WordPress Development
With all the thrusts nowadays towards using mobile devices to surf the Net, it would be great if your Wordpress blog is mobile device friendly. The concept is actually simple and you can incorporate a mobile friendly version of your blog by understanding some simple things.
The main thing that you need to know is that when visitors to your Wordpress blog (actually any web site but let’s use Wordpress for this example) browses your site, you can identify the type of computer or mobile device that they are using. Once you have identified the device, it’s easy to create a separate CSS stylesheet for your mobile visitor.
Continue reading …
Author:
kihbord
Tags: browser detection, plugins, WordPress Development
I’ve now added comments. I’ve kept everything as simple as possible. Since the new Wordpress blogging software allows the use of gravatars (globally recognized avatars), I’ve added them to comments. So if you have a gravatar, it should appear on your comments.
Adding a gravatar to comments is very easy. The Wordpress blogging software development team has actually done all the programming and provided an easy to use function for including the commenter’s gravatar.
Author:
kihbord
Tags: gravatar
While creating the theme/template for Code Stuff, I began to search the Net for some HTML test data that I can use to be able to check the CSS stylesheet for the Code Stuff Wordpress theme. I wanted to make sure that the CSS file will contain the standard or at least the minimum style tags for the Wordpress theme.
A couple of Googling on the Net has brought me to the Lorelle site at wordpress.com. Seeing that this is what I needed, I decided to make a copy of the HTML code provided by the site here to be able to check any changes that I make on the Code Stuff stylesheet.
Continue reading …
Author:
kihbord
Tags: testing, WordPress Development
I’ve managed to get an initial version of the Wordpress theme for the Code Stuff site. Some form of web browser detection is now working and it should display properly on XHTML compliant mobile browsers.
Commenting is next on my list. More on this later.
Author:
kihbord
Tags: browser detection, code stuff, WordPress Development