Post Customization – Part 1

/*----------------------------------------------------------*/

<?php

echo ‘<ul>’;

echo ‘<li><h2>Heading 1</h2></li>’;

$cat = 39;

$posts=get_posts(‘width=50&showposts=3&cat=’. $cat);

if ($posts) {

$cat_post_ids = array();

foreach($posts as $post) {

$content= $post->post_content;

$cont = $content;

$content = str_replace(‘]]>’, ‘]]>’, $content);

$content = strip_tags($content, ‘<img />’);

$excerpt_length = 97;

$words = explode(‘ ‘, $content);

$newContent = ”;

for($loopCounter = 0; $loopCounter<$excerpt_length; $loopCounter++){

$newContent .= $words[$loopCounter].” “;

}

echo ‘<li>’;

echo'<div class=”proLi1″>’;

$thum = catch_that_image();

if(!$thum){

echo ‘<img src=”‘.get_template_directory_uri().’/images/image-not-available.jpg” width=”50″ height=”44″‘;

}

else{

echo ‘<img src=”‘.$thum.'” width=”50″ height=”44″ />’;

}

echo ‘</div>’;

echo ‘<div class=”proLi2″>’;

echo ‘<strong>’.get_the_title($post).'</strong><br/>’;

$key=’Client’;

$key2=’Performed’;

echo ‘<strong>Client: </strong>’.get_post_meta($post->ID, $key, true).'<br/>’;

echo ‘<strong>Performed: </strong>’.get_post_meta($post->ID, $key2, true).'<br/>’;

echo ‘</div>’;

echo ‘<div class=”proLi3″>’;

echo $newContent,'<br/><a href=”‘.get_permalink($post).'” class=”viewProject1″> View Projects > </a>’, ‘</div></li>’;

}

}

echo ‘</ul>’;

wp_reset_query();

?>

/*-----------------------------------------------------------*/
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s