Posts

Showing posts from June, 2010

Display 5 latest posts in each category in WordPress

<div id="page-not-found" class="post-page"> <?php $cat_args = array( 'orderby' => 'name', 'order' => 'ASC', 'child_of' => 0 ); $categories = get_categories($cat_args); foreach($categories as $category) { echo '<dl>'; echo '<dt> <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a></dt>'; $post_args = array( 'numberposts' => 5, 'category' => $category->term_id ); $posts = get_posts($post_args); foreach($posts as $post) { ?> <dd><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></dd> } echo '<dd class="view-all"> <a href="' . g

display the_content with setup_postdata

<?php global $more; $cat= 3; $posts = get_posts ("cat=$cat&showposts=5"); if ($posts) { foreach ($posts as $post): $more = false; setup_postdata($post); ?> <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3> <p class="storycontent"><?php the_content('Read more...'); ?></p> <?php endforeach; $more = true; } ?>

Show future posts on single post

today i show how to display future posts in single.php. you just copy code below into funciton.php. add_filter('the_posts', 'show_future_posts'); function show_future_posts($posts) { global $wp_query, $wpdb; if(is_single() && $wp_query->post_count == 0) { $posts = $wpdb->get_results($wp_query->request); } return $posts; }

Displaying Future Posts in WordPress

If you do like I do and schedule posts ahead of time (especially on the podcast), there’s a way inside of WordPress to show your readers what posts are coming up next: <?php $my_query = new WP_Query('post_status=future&order=DESC&showposts=5'); if ($my_query->have_posts()) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php the_date(); ?> - <?php the_title(); ?> <?php endwhile; } ?> This will display up to 5 “scheduled” posts wherever you drop in the code. Add a headline <h2> tag if you want to give it a title (should you want to use it as a widget). Want to see this code in action? Check the WordPulse podcast page‘s sidebar to see it working!

Display a List of Upcoming Posts in WordPress

When you have completed a post in WordPress, you have the ability to save it as a draft, publish it immediately or schedule a future date when it will be published automatically. This is extremely helpful if you want to plan ahead or if you use your WP site for events. Creating a simple list of upcoming posts lets your visitors know what they can look forward to and is pretty simple to do. The following code can be placed in your sidebar on within any template. <?php $futurePosts = new WP_Query ( ) ; $futurePosts -> query ( 'showposts=5&post_status=future&order=ASC' ) ; if ( $futurePosts -> have_posts ( ) ) : while ( $futurePosts -> have_posts ( ) ) : ?> <ul> <li> <?php the_title ( ) ; ?> <br /><small> <?php the_time ( get_option ( 'date_format' ) ; ?> </small></li> </ul> <?php endwhile ; else : ?> <ul> <li>No upcoming events.</li> </ul> <?php en

unknow error occurred (0xE8008001)

today i show you how to fixed unknow error occurred (0xE8008001) when you jailbreak ipod http://thy4u.blogspot.com/2010/06/how-to-jailbreak-your-iphone-with.html

How to jailbreak your Ipod with BlackRa1n RC3

Image
Step 1: Update iTunes to the latest version available and reboot your computer. Step 2: Download BlackRa1n RC3 from our iPhone downloads page and install it, then reboot your computer. Step 3: Plug your iPhone in your computer and launch BlackRa1n RC3. Click on "make it ra1n" Step 4: Your iPhone will enter recovery mode. The regular recovery mode image on your iPhone will be replaced by a picture of GeoHot (same as image above). Step 5: BlackRa1n will run on your iPhone and then it will reboot. A pop up will show up asking you to donate. If you successfully jailbreak your iPhone, I suggest you send $5 or $10 to GeoHot. Step 6: Once your iPhone reboots, you will have a new icon on your springboard. This is BlackRa1n. Now make sure you have internet connection and launch BlackRa1n on your iPhone. Step 7: Choose what installer applications you want to install on your iPhone and then tap “Install”. I suggest only installing Cydia but you may install them all if you want to. Black

String Search & Replace (AS2 & AS3)

function strReplace($str:String, $search:String, $replace:String):String { return $str.split($search).join($replace); } var str:String = new String(); str = "we are Khmer!" trace(strReplace(str,"we","We")); The "split" function splits the string at the word ($search) you're searching for. And the "join" inserts the new word ($replace) between the elements, concatenates them, and returns the resulting string