List all pages and children in separate ul

your code is missing the = after child_of <?php $args = array( ‘sort_column’ => ‘menu_order’, ‘parent’ => 0, ); $pages = get_pages($args); foreach($pages as $page){ ?> <ul> <li> <?php echo ‘<a href=”‘ . get_permalink( $page->ID ) . ‘”>’ . $page->post_title . ‘</a>’; ?> </li> <?php wp_list_pages(‘title_li=&depth=0&child_of=”.$page->ID.”‘); ?> </ul> <?php } ?> if you want to … Read more

Getting an ordered list of tags – via wp_tag_cloud or not?

one possibility: using the ‘format=array’ and ‘echo=0’ parameters; and building a foreach loop to output each tag: <ol> <?php $wptc = wp_tag_cloud(‘smallest=12&largest=12&orderby=count&order=DESC&format=array&unit=px&number=5&echo=0’); foreach( $wptc as $wpt ) echo “<li>” . $wpt . “</li>\n”; ?> </ol>

How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?

take a look at the reference docs for the WP_Query class: http://codex.wordpress.org/Class_Reference/WP_Query something like this: $args = array( //some key/value pairs…whatever ‘meta_query => array( array( ‘key’ => somekey, ‘value’ => somevalue, ‘compare’ => some comparison operator ), array( ‘key’ => some other key, ‘value’ => some other value, ‘compare’ => some comparison operator ) ) … Read more

List latest posts in WP-Admin

All you need is a table with class=”widefat” and get_posts(). Then you run through the results (if there are any) and print the table rows. Here is a very simple example as a dashboard widget. Note the lack of I18n – it is not ready to use! <?php /** * Plugin Name: Last posts table … Read more

Only Showing Upcoming Events

Hi @Spencer B.: Funny, my client submitted a bug ticket for the events modules I wrote for this very issue the other day, and I just fixed it a few hours ago. Note that my example uses a Custom Post Type of ‘event’ which is very useful to be able to differentiate logic for Events … Read more

How to list all network sites on one page

yes, small source for an template. <ul class=”postlist no-mp”> <?php /** * Old version, change on 07/23/2013 * $blogs = $wpdb->get_results( “SELECT blog_id,path FROM {$wpdb->blogs} WHERE blog_id != {$wpdb->blogid} AND site_id = ‘{$wpdb->siteid}’ AND spam = ‘0’ AND deleted = ‘0’ AND archived = ‘0’ order by blog_id”, ARRAY_A ); */ // get all blogs … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)