function thumbnail($sizeW = 300, $sizeH = 300, $params = array(), $postid = null, $thumbnailid = null, $echo = true) { if ($postid == null) { $postid = get_the_ID(); } $post = get_post($postid); $thumbnailid = $thumbnailid == null ? get_post_thumbnail_id($post->ID) : $thumbnailid; $datas = wp_prepare_attachment_for_js($thumbnailid); // extract intersting data $params['alt'] = isset($params['alt']) ? $params['alt'] : $datas['alt']; $image_path = the_thumbnail($sizeW, $sizeH, $postid, $thumbnailid); foreach ($params as $k => $param) { if ($param == 'ORIGINAL-SRC') { $params[$k] = $datas['url']; } if ($param == 'SRC') { $params[$k] = $image_path; } } $params['src'] = isset($params['src']) ? $params['src'] : $image_path; $s = parse_to_html($params); if ($echo == true) { echo '<img' . $s . '/>'; } else { return '<img' . $s . '/>'; } }
while (have_posts()) { the_post(); // loop start ?> <li id="post-<?php the_ID(); ?> "> <a href="<?php the_permalink(); ?> " title="Link to <?php the_title_attribute(); ?> "><?php the_thumbnail(); ?> </a> </li> <?php // end loop } ?> </ul> <div class="nav"> <div class="prev"><?php next_posts_link('« Older Entries'); ?> </div>
function process_shortcodes($atts) { if (isset($atts['options']) && $atts['options']) { $options = explode(',', $atts['options']); unset($atts['options']); } else { $options = array('title', 'thumbnail', 'excerpt', 'readmore'); } query_posts($atts); while (have_posts()) { the_post(); ?> <div> <?php foreach ($options as $option) { switch ($option) { case 'id': ?> <div class="id"><?php the_ID(); ?> </div><?php break; case 'title': ?> <div class="title"><?php the_title(); ?> </div><?php break; case 'thumbnail': ?> <div class="thumbnail"><?php the_thumbnail(); ?> </div><?php break; case 'excerpt': ?> <div class="excerpt"><?php the_excerpt(); ?> </div><?php break; case 'content': ?> <div class="content"><?php the_content(); ?> </div><?php break; case 'meta': ?> <div class="meta"><?php the_meta(); ?> </div><?php break; case 'author': ?> <div class="author"><?php the_author(); ?> </div><?php break; case 'readmore': ?> <div class="readmore"><a href="<?php the_permalink(); ?> ">read more</a></div><?php break; case 'category': ?> <div class="category"><?php the_category(); ?> </div><?php break; case 'tags': ?> <div class="tags"><?php the_tags(); ?> </div><?php break; case 'terms': ?> <div class="tags"><?php the_terms(); ?> </div><?php break; } } ?> </div> <?php } wp_reset_query(); }