List custom taxonomies by custom field - wordpress

Below I have my custom taxonomy template and its working fine until now.
<?php
/*
Template Name: Performer List Page
*/
get_header(); ?>
<?php
// if show all is set
$sortby=$_GET['sortby'];
if( isset($_GET['showall']) || isset($sortby) ):
$args = array( 'hide_empty' => 0 );
else:
// else show paged
$page = ( get_query_var('paged') ) ? get_query_var( 'paged' ) : 1;
global $framework_opt,$post; $number_of_performers = $framework_opt['performers_per_page'];
$orderby = 'date';
$order = isset( $_REQUEST['order'] ) ? trim( $_REQUEST['order'] ) : null;
if(isset($_GET['order']) && !empty($_GET['order'])) {
switch($order)
{
case 'alphabetically' : $orderby = 'title';
break;
case 'popularity' : $orderby = 'count';
break;
/*
case 'female' : $meta = 'gazi_female';
break;
case 'male' : $meta = 'gazi_male';
break;
*/
default : $orderby = 'date';
break;
}
}
// number of tags to show per-page
$per_page = $number_of_performers ;
$offset = ( $page-1 ) * $per_page;
$args = array( 'orderby' => $orderby, 'number' => $per_page, 'meta_key' => $meta, 'offset' => $offset, 'hide_empty' => 0 );
endif;
$taxonomy = 'performer';
$count_performers = wp_count_terms( $taxonomy, $offset );
$tax_terms = get_terms( $taxonomy, $args );
?>
<aside class="sidebar pull-left">
<p class="sidebar-title"><?php _e( 'SEARCH BY LETTER', 'gazi' ); ?></p>
<div class="letter-search clearfix">
<span class="letter">A</span>
<span class="letter">B</span>
<span class="letter">C</span>
<span class="letter" style="width:40%"><?php _e( 'All', 'gazi' ); ?></span>
<span class="letter" style="width:40%"><?php _e( 'Reset', 'gazi' ); ?></span>
</div>
<!--<p class="sidebar-title"><?php _e( 'QUICK SEARCH', 'gazi' ); ?></p>
<form class="frm-search-tag has-title" action="<?php echo home_url( '/' ); ?>" method="get">
<input type="text" placeholder="Search name" name="s" value="" />
<button type="submit"><span class="ico ico-search"></span>
<select class="search_tools" style="display:none;" name="taxonomy" >
<option value="performer">Videos</option>
<option value="gallery">Photos</option>
</select>
</button>
</form>-->
<div style="height: 5px;"></div>
<?php get_template_part( 'templates/sidebars/performer-sidebar', get_post_format() ); ?>
</aside>
<section class="main-section pull-left">
<div class="page-title with-sorter clearfix">
<h1><?php the_title(); ?></h1>
<div class="info hidden-mobile">
<p>
<?php echo $count_performers; ?><?php _e( 'Performers', 'gazi' ); ?> <span class="ico ico-tv"></span>
</p>
<div class="sorter">
<div class="dropdown-container">
<ul class="flyout-menu flyout-menu-right">
<li>
<button class="dropdown-toggle" type="button" data-action="dropdown-toggle" data-target="#sorter-dropdown">SORT</button>
<div class="flyout-menu-content" id="sorter-dropdown">
<ul class="flyout-menu-items">
<li>
<?php _e( 'Alphabetically', 'gazi' ); ?> </li>
<li>
<?php _e( 'Popularity', 'gazi' ); ?> </li>
</ul>
</div>
</li>
</ul>
</div></div> </div>
<div class="info visible-mobile clearfix">
<button class="btn-pd btn-pd-primary pull-left" style="margin-right: 0;" data-action="scroll-to" data-target="#letter-search">A-Z</button>
<p style="float:right">
<?php echo $wp_query->found_posts; ?> <?php _e( 'Performers', 'gazi' ); ?> <span class="ico ico-tv"></span></p>
</div></div>
<div id="performer-list" class="list-view">
<div id="performer-thumbs" class="performer-listing clearfix">
<div class="items">
<?php foreach ($tax_terms as $cat) : ?>
<?php
$flag = 0;
if( $sortby == substr( $cat->name, 0, 1 ) || $sortby=='' ) { $flag = 1;}
if ($flag=='1'){
?>
<article class="performer-item">
<a class="outline" href="<?php echo get_term_link($cat->slug, 'performer'); ?>" title="<?php echo $cat->name; ?>">
<?php $performer_image = z_taxonomy_image_url($cat->term_id); if(!empty($performer_image)) : ?>
<img src="<?php bloginfo('template_directory'); ?>/gazi/css/images/1pixel.gif" data-src="<?php echo z_taxonomy_image_url($cat->term_id,NULL, array(180, 240)); ?>" alt="<?php echo $cat->name; ?>" />
<noscript><img src="<?php echo z_taxonomy_image_url($cat->term_id,NULL, array(180, 240)); ?>" alt="<?php echo $cat->name; ?>" /></noscript>
<?php else : ?>
<img src="<?php bloginfo('template_directory'); ?>/gazi/css/images/1pixel.gif" data-src="<?php bloginfo('template_directory'); ?>/gazi/css/images/no-img-women.jpg" alt="<?php echo $cat->name; ?>" />
<noscript><img src="<?php bloginfo('template_directory'); ?>/gazi/css/images/no-img-women.jpg" alt="<?php echo $cat->name; ?>" /></noscript>
<?php endif; ?>
<span class="performer-name"><?php echo $cat->name; ?></span>
<span class="performer-videos hidden-mobile">
<span class="count"><?php echo $cat->count; ?></span>
<span class="txt"><?php _e( 'VIDEOS', 'gazi' ); ?></span>
</span>
</a>
<div class="performer-item-footer visible-mobile">
<span class="ico ico-take"></span> <?php echo $cat->count; ?> <?php _e( 'VIDEOS', 'gazi' ); ?> </div>
</article>
<?php } ?>
<?php endforeach; ?>
</div>
</div>
<?php
if( isset($_GET['showall']) || isset($sortby)):
echo '';
else:
// showall is set, show link to get back to paged mode
$total_terms = wp_count_terms( 'performer' );
$pages = ceil($total_terms/$per_page);
// if there's more than one page
if( $pages > 1 ):
echo '<div class="pager"><div class="paginator" id="performer_paginator">';
for ($pagecount=1; $pagecount <= $pages; $pagecount++):
echo '<a class="page" href="'.get_permalink().'page/'.$pagecount.'/"><span>'.$pagecount.'</span></a>';
endfor;
// link to show all
echo '<a class="page" href="'.get_permalink().'?showall=true">ALL</a>';
echo '</div>';
endif;
endif;
?>
</div>
<div id="letter-search" class="visible-mobile">
<div class="section-title with-sorter clearfix" style="margin-bottom: 4px;">
<p class="title">Letters Search</p>
<div class="info">
<button class="btn-pd btn-pd-sm btn-pd-primary pull-right" data-action="scroll-to" data-target="#performer-thumbs"><span class="ico ico-grid"></span></button>
</div>
</div>
<div class="letter-search clearfix">
<span class="letter">A</span>
<span class="letter">B</span>
<span class="letter">C</span>
</div>
</div>
<?php get_template_part( 'templates/advertisements_bottom', get_post_format() ); ?>
</section>
<?php get_footer(); ?>
If you see I added an order menu for popularity and videos count for this listing is working but under the order code you will see:
/*
case 'female' : $meta = 'gazi_female';
break;
case 'male' : $meta = 'gazi_male';
break;
*/
so I want to separate performers by male and female using the custom fields above.Any one that has any idea how to complete this template?
thanks

You want to show results based on meta field 'gazi_female' or 'gazi_male' so you should include in your meta_query arguments.
Instead of 'meta_key' => $meta use meta_query. Meta query in get_terms feature got introduced from 4.4.0 version, so make sure your version supports it with get_terms()
You should not use it in order_by parameter since order_by will sort the results and it cant filter results.
Alternatively try WP_Term_Query which is available from 4.6 versions
// WP_Term_Query arguments
$args = array (
'taxonomy' => array( 'performer' ),
'meta_key' => 'male',
'meta_value' => 'gazi_male',
);
// The Term Query
$term_query = new WP_Term_Query( $args );
// The Loop
if ( ! empty( $term_query ) && ! is_wp_error( $term_query ) ) {
// do something
} else {
// no terms found
}

Related

Wordpress - woocommerce - myaccount/orders-list.php - get products images

I have made custom order-list.php template, but i want to have here product image.
Every order has always only one product, so there is always only one thumbnail photo. How can i get url of this photo?
My code if needed:
<?php foreach ( $customer_orders->orders as $customer_order ) {
$order = wc_get_order( $customer_order ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited
$item_count = $order->get_item_count() - $order->get_item_count_refunded();
?>
<div class="product_list">
<div class="product_item">
<div class="product_home">
<div class="text-center">
<a href="<?php echo esc_url( $order->get_view_order_url() ); ?>" title="<?php echo esc_html( _x( '#', 'hash before order number', 'woocommerce' ) . $order->get_order_number() ); ?>">
//i want to place image here
</a>
</div>
<div class="content_product_home">
<h4> Zamówienie <?php echo esc_html( _x( '#', 'hash before order number', 'woocommerce' ) . $order->get_order_number() ); ?></h4>
<p><?php echo $order->get_formatted_order_total() ?><span class="per_month">including tax</span></p>
</div>
<div class="text-center">
Details
</div>
</div>
</div>
</div>
<?php } ?>
Thanks! :)
You can get image using wp_get_attachment_image_src(), just get product id first from $order->get_items() as shown next:
foreach ( $customer_orders->orders as $customer_order ) {
$order = wc_get_order($customer_order); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited
$item_count = $order->get_item_count() - $order->get_item_count_refunded();
// first get product id
foreach($order->get_items() as $order_key => $order_value) {
$product_id = $order_value->get_data()['product_id'];
}
// get image
if (isset($product_id)) {
$image = wp_get_attachment_image_src( get_post_thumbnail_id($product_id));
}
?>
<div class="product_list">
<div class="product_item">
<div class="product_home">
<div class="text-center">
<a href="<?php echo esc_url($order->get_view_order_url()); ?>" title="<?php echo esc_html(_x('#', 'hash before order number', 'woocommerce') . $order->get_order_number()); ?>">
<?php if (isset($image)) { ?>
<img src="<?php echo $image[0] ?>" />
<?php } ?>
</a>
</div>
<div class="content_product_home">
<a href="<?php echo esc_url($order->get_view_order_url()); ?>" title="<?php echo esc_html(_x('#', 'hash before order number', 'woocommerce') . $order->get_order_number()); ?>">
<h4> Zamówienie
<?php echo esc_html(_x('#', 'hash before order number', 'woocommerce') . $order->get_order_number()); ?>
</h4>
</a>
<p>
<?php echo $order->get_formatted_order_total() ?><span class="per_month">including tax</span></p>
</div>
<div class="text-center">
Details
</div>
</div>
</div>
</div>
<?php } ?>

woocommerce products by category repeated first 10 products on each page so how to display all product?

I created custom code for woocommerce products show as per selected category, first 10 product display as per the category but on the second page of pagination same 10 products are displayed, also at all page the same product are display, when products are order by rand then result is correct but i want result by title so please give me the solution for that my code is as below.
<ul class="products">
<?php $cat_slug=get_queried_object()->slug; ?>
<?php
$args = array( 'post_type' => 'product', 'product_cat' => $cat_slug, 'orderby' => 'title' );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
<li class="product_cust ">
<div class="woo_100">
<div id="woo_c">
<a href="<?php echo get_permalink( $loop->post->ID ) ?>" title="<?php echo esc_attr($loop->post->post_title ? $loop->post->post_title : $loop->post->ID); ?>">
<?php woocommerce_show_product_sale_flash( $post, $product ); ?>
<div class="woo_thumb">
<?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" width="300px" height="300px" />'; ?>
</div>
</a>
</div>
<div id="woo_d">
<div class="woo_desc">
<div class="nil_desc">
<a href="<?php echo get_permalink( $loop1->post->ID ) ?>" title="<?php echo esc_attr($loop1->post->post_title ? $loop1->post->post_title : $loop1->post->ID); ?>">
<h3><?php the_title(); ?></h3>
</a>
<span class="price"><?php echo $product->get_price_html(); ?></span><br>
</div>
<div class="nil_cart"><?php woocommerce_template_loop_add_to_cart( $loop1->post, $product ); ?>
</div>
</div>
</div>
</div>
</li>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</ul>
You have not passed any variable to paginate it.
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array( 'post_type' => 'product', 'product_cat' => $cat_slug, 'orderby' => 'title', 'paged'=>$paged);
Also after your loop use nav.php to get pagination control links.

Search pagination wordpress

i have a problem with search result page, the pagination doesn't works, when i want to go to next page, i'm redirected to index page, but the url is: www.mywebsite.com/page/2/?s=word..
For all pages the pagination works, only for search doesn't works.
this is the code of search.php
<?php
/**
* The template for displaying Search Results pages.
*/
get_header(); ?>
<?php
$search = isset( $_GET['s'] ) ? $_GET['s']: null;
$user_filtre = '';
$user_display = '';
if( $search ){
$user_filtre .= 's=' . $_GET['s'] . '&';
$user_display .= 's=' . $_GET['s'] . '&';
}?>
<div id="main-search" class="content-dark hidden-sm hidden-xs">
<div class="container">
<form method="get" action="<?php bloginfo('url'); ?>" accept-charset="UTF-8">
<!--input name="s" id="s" type="hidden" -->
<div id="main-search-fields">
<p class="pull-left term">Search Term:</p>
<input name="s" value="<?php the_search_query(); ?>"autocomplete="off" type="search">
</div>
<div id="main-search-btn">
<input class="button-green-download-big" type="submit" value="Search">
</div>
</form>
</div>
</div>
<div class="browse-content">
<div class="container">
<section>
<div class="row">
<ul>
<?php if(have_posts() ): ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php include '_includes/items/item_2.php';?>
<?php endwhile; ?>
<?php endif; ?>
</ul>
</div>
</section>
<?php novavideo_theme_pagination(); ?>
</div>
</div>
</div>
Anyone have an ideea?
item_2.php.
<div class="browse-movie-wrap col-xs-10 col-sm-4 col-md-5 col-lg-4">
<a href="<?php the_permalink(); ?>" class="browse-movie-link">
<figure>
<?php if($values = get_post_custom_values("poster_url")) { ?>
<img class="img-responsive" src="<?php echo $values[0]; ?>" alt="<?php the_title();?> Watch Online" width="210" height="315">
<?php } ?>
<figcaption class="hidden-xs hidden-sm">
<span class="fa fa-star icon-color"></span>
<h4 class="rating"><?php $rating = get_post_custom_values("imdbRating"); echo $rating[0]; ?> / 10</h4>
<h4>
<?php $categories = get_the_category();
if ( ! empty( $categories[0] ) ) {
echo esc_html( $categories[0]->name );
}
?>
</h4>
<h4 class="quality-button"><span class="fa fa-play-circle"></span> <?php $terms_as_text = strip_tags( get_the_term_list( $wp_query->post->ID, 'quality', '', ', ', '' ) ); echo $terms_as_text;; ?></h4>
<span class="button-green-download-big margin-button">Open Movie</span>
</figcaption>
</figure>
</a>
<div class="browse-movie-bottom">
<?php $title = get_post_custom_values("Title"); echo $title[0]; ?>
<div class="browse-movie-year"><?php $terms = wp_get_post_terms($post->ID, 'release-year', array("fields" => "all")); if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){ foreach ( $terms as $term_single ) { $term_link = get_term_link( $term_single ); echo $term_single->name; } } ?></div>
</div>
</div>
Search results are instantiated through query_posts and that controls how many results you have per page. In your code, it's probably happening via the include: /_includes/search-template.php but if not, set it up like this:
// 1- Created a paged variable that knows how many paginated pages exist (depends on your site)
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
// 2- Pass `paged` into array of arguments for query_posts
$args = array(
'posts_per_page' => 20,
'order' => 'DESC',
'paged' => $paged,
);
// 3- Submit query_posts to WordPress with arguments set
query_posts( $args );
Now you can use next_posts_link(); to show the paginated page link. Just replace the references to theme_pagination(); with next_post_link(); and it should output the right results.
If you want to abstract all this logic out of your template, check out pre_get_posts. It's a different method and you would put all this logic into functions.php but will achieve similar results.
This is my code for Search result page with pagination:
<?php get_header(); ?>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/search.css">
<?php wp_head(); ?>
<script type="text/javascript">
var window_width = window.screen.width;
var window_height = window.screen.height;
<?php $window_width = "<script>document.write(window_width)</script>";
$window_height = "<script>document.write(window_height)</script>"; ?>
</script>
<style>
.sm_bd{padding: 5px;
border: 1px solid
#ccc;}
.row {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
}
.row > [class*='col-'] {
display: flex;
flex-direction: column;
}
.previous,.next {
padding: 5px;
border: 1px solid
#ccc;
border-radius: 4px;
margin: 15px;
}
</style>
</head>
<body class="index-body">
<?php include 'menu.php';?>
<div class="col-xs-12 col-sm-12 blog-page no-marg no-padd">
<div class="col-xs-4 col-sm-3 single-sidebar no-marg no-padd">
My sidebar
</div>
<section id="primary" class="content-area col-xs-12 col-sm-12 col-lg-8 col-md-8">
<div id="content" class="site-content row" role="main">
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : '1';
$s=get_search_query();
$args = array(
's' =>$s,
'paged' => $paged,
'posts_per_page' => '12',
);
// The Query
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
_e("<h2 style='font-weight:bold;color:#000'>نتایج جستجو برای: ".get_query_var('s')."</h2>");
echo "<div class='col-lg-12 col-md-12'><hr/></div>";
while ( $the_query->have_posts() ) {
$the_query->the_post();
?>
<div class="col-xs-12 col-sm-12 col-lg-3 col-md-3 sm_bd">
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail(); ?>
</a>
<?php else : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<img class="attachment-post-thumbnail size-post-thumbnail wp-post-image lazyloaded" src="Without Image"
alt="<?php the_title_attribute(); ?>"
title="<?php the_title_attribute(); ?>" width="300" height="449">
</a>
<?php endif;?>
<?php the_title(); ?>
</div>
<?php
}
?>
<div class="pagination" id="blog-pagination">
<?php if( get_previous_posts_link('← ', $loop->max_num_pages ) ) : ?>
<span class="previous" ><?php previous_posts_link( '→ ', $loop->max_num_pages ); ?></span>
<?php endif; ?>
<?php if( get_next_posts_link('← ', $loop->max_num_pages ) ) : ?>
<span class="next"><?php next_posts_link( '←', $loop->max_num_pages ); ?></span>
<?php endif; ?>
</div>
<?php
}
else{
?>
<h2 style='font-weight:bold;color:#000'>not found title</h2>
<div class="alert alert-info">
<p>not found alert</p>
</div>
<?php }
wp_reset_postdata();?>
</div><!-- #content .site-content -->
</section><!-- #primary .content-area -->
</div>
<?php get_footer(); ?>
don't forget to write wp_reset_postdata(); after post loop.

How to get permalink for every post in this shortcode function

I want to get the permalink of the images that shown on the home page, so that when someone clicks on the image redirects to its full post.
add_shortcode( 'zee_recent_works', function( $atts, $content= null ){
ob_start();
$atts = shortcode_atts(array(
'slides' => 2,
'title' => '',
'description' => ''
), $atts);
extract($atts);
$item_per_slide = 4;
$args = array(
'numberposts' => $item_per_slide*$slides,
'orderby' => 'menu_order',
'order' => 'ASC',
'post_type' => 'zee_portfolio'
);
$portfolios = get_posts( $args );
$i = 1;
$j = 1;
$count = count($portfolios);
if ($count>0) {
?>
<div class="col-md-12">
<div id="scroller" class="carousel slide">
<div class="carousel-inner">
<?php
foreach( $portfolios as $key=>$value ) {
if( (($key+1)%($item_per_slide)==0) || $j== $count) {
$lastContainer= true;
} else {
$lastContainer= false;
}
if($i==1){
?>
<div class="item <?php echo ($key==0)? 'active': ''; ?>">
<div class="row">
<?php
}
?>
<div class="col-md-<?php echo round(12/$item_per_slide) ?>">
<div class="portfolio-item">
<div class="item-inner">
<?php
echo get_the_post_thumbnail( $value->ID, array(400,400), array(
'class' => "img-responsive",
'alt' => trim(strip_tags( $value->post_title )),
'title' => trim(strip_tags( $value->post_title ))
));
?>
<h5>
<?php echo $value->post_title; ?>
</h5>
<div class="overlay">
<?php
$full_img = wp_get_attachment_image_src( get_post_thumbnail_id($value->ID), 'full');
$img_src= $full_img[0];
?>
<a class="" title="<?php echo $value->post_title; ?>" href="<?php the_permalink(); ?>" rel="prettyPhoto"></a>
</div>
</div><!--.item-inner-->
</div><!--.portfolio-item-->
</div>
<?php
if(($i == $item_per_slide) || $lastContainer) {
?>
</div><!--/.row-->
</div><!--/.col-xs-->
<?php
$i=0;
}
$i++;
$j++;
}
?>
</div>
</div>
</div><!--/.col-md-12-->
<?php
}
return ob_get_clean();
});
and the link is there:
<a class="" title="<?php echo $value->post_title; ?>" href="<?php the_permalink(); ?>" rel="prettyPhoto"></a>
where the permalink should work but its not working.
Instead of the_permalink() you can try get_permalink($value->ID)
final line should be
<a class="" title="<?php echo $value->post_title; ?>" href="<?php echo get_permalink($value->ID); ?>" rel="prettyPhoto" ></a>
Hope it helps :)
Thanks.

list child pages of current parent with featured image and description

Can someone show me how to list child pages of current page and include featured image and menu description? Here is what I've found so far, but I can't figure out how to get the descriptions to work.
<ul>
<?php $child_pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'page' ORDER BY menu_order", 'OBJECT'); ?>
<?php if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?>
<li>
<a href="<?php echo get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>">
<span class="thumbnail"><?php echo get_the_post_thumbnail($pageChild->ID, 'small-thumb'); ?></span>
<span class="title"><?php echo $pageChild->post_title; ?></span>
</a>
</li>
<?php endforeach; endif; ?>
</ul>
Thanks.
I ended up just using a custom field instead of the menu description. Here is the final code that worked for me.
<?php
$args = array(
'parent' => $post->ID,
'post_type' => 'page',
'post_status' => 'publish'
);
$pages = get_pages($args); ?>
<ul class="four no-bullets">
<?php foreach( $pages as $page ) { ?>
<li>
<a href="<?php echo get_permalink($page->ID); ?>" rel="bookmark" title="<?php echo $page->post_title; ?>">
<span class="thumbnail"><?php echo get_the_post_thumbnail($page->ID, 'small-thumb'); ?></span>
<span class="title"><?php echo $page->post_title; ?></span>
<span class="desc"><?php echo get_post_meta($page->ID, 'desc', true); ?></span>
</a>
</li>
<?php } ?>
</ul>
Try following code:
<?php
$args = array(
'parent' => 2,
'post_type' => 'page',
'post_status' => 'publish'
);
$pages = get_pages($args); ?>
<ul>
<?php
foreach( $pages as $page ) {
?>
<li>
<a href="<?php echo get_permalink($page->ID); ?>" rel="bookmark" title="<?php echo $page->post_title; ?>">
<span class="thumbnail"><?php echo get_the_post_thumbnail($page->ID, 'small-thumb'); ?></span>
<span class="title"><?php echo $page->post_title; ?></span>
</a><span class="desc"><?php echo $page->post_content; ?></span>
</li>
<?php
}
?>
</ul>

Resources