How to display Post title By ID and its Thumb Contents

For Display post title inside the loop you can use following For Post title <?php the_title(); ?> For Post Short Content <?php the_excerpt(); ?> For Post Category <?php twentyten_posted_in(); ?> Or Display post title out side the loop use global variable $post <?php global $post; ?> For Post title <?php $post->post_title; ?> For Post Short … Read more

WordPress wp_editor to post and edit

I’m assuming you would have an Edit page and an Add New page, so why not just switch out the wp_insert_post function from the Add New page to wp_update_post? The first argument for wp_editor is the content you want to appear, so just use the current post that’s being edited’s content.

Trim posts from WP-Query?

I think it would be better to just do a second query if you don’t have 8 posts for that month, for example: //get current date $date = getdate(); //setup args $args = array( //basic stuff ‘posts_per_page’ => -1, ‘post_stutus’ => ‘publish’, //time parameters ‘year’ => $date[‘year’], ‘month_num’ => $date[‘mon’] ); //create WP_Query $my_query = … Read more

Custom post type slideshow background images to insert in a plugin

Try moving your foreach into the script tag, as such : In the images parameter of your javascript : //[…] images:[ <?php foreach( $slider_posts as $post ) { $thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), ‘home-slide’); echo ‘”‘ . $thumb[0] . ‘”,’; //Assuming images are separated by a comma } ?> ] You may need to alter the example … Read more

How to get post id of last approved comment?

<?php $recent_comments = get_comments( array( ‘number’ => 1, ‘status’ => ‘approve’ ) ); foreach($recent_comments as $comment) : $latest_postid_with_comment = $comment->comment_post_ID; endforeach; ?> Probably way to compress this code into something smaller. But this will work.

How to display a “NEW”-icon on posts from today

you can use the difference between the post time (get_the_time()) and the current time (date()) – for instance, this snippet added to functions.php of your theme would add a new css class to post_class() if the post is less than 24hrs old: function post_from_today_class($class) { //add .new-post-today to post_class() if newer than 24hrs global $post; … Read more

How to list post as buch of category, and all of them

here is a general structure how I would do it: $categories = array(5,2,4,3,1); //manually enter the array of the category ids in the order how you want them to appear foreach( $categories as $cat ) { $args = array( ‘category__in’ => array( $cat ), ‘posts_per_page’ => -1 ); $cat_query = new WP_Query( $args ); if( … Read more