The next_posts_link() works only with original $wp_query

next_posts_link and previous_posts_link use the global $wp_query. function get_next_posts_link( $label = null, $max_page = 0 ) { global $paged, $wp_query; http://core.trac.wordpress.org/browser/tags/3.5/wp-includes/link-template.php#L1523 That means you need to do something like this to get those to work correctly. $orig_query = $wp_query; $wp_query = new WP_Query($args); // the rest of your code $wp_query = $orig_query; If you are … Read more

Output posts with same name as tags?

You can use the get_page_by_title function as described by the codex here http://codex.wordpress.org/Function_Reference/get_page_by_title. Here is an example of getting the title of a post. By default, it’s looking for a post type of ‘page’: $current_post = get_page_by_title(“certain title”, OBJECT, “post”); echo “<a href=”” . $current_post->guid . “”>{$current_post->post_title}</a>”;

How to get alphabetic listing x other posts, based on first letter post?

For the solution you can use if statement as below put it in your sidebar, it will highlight the current post title. <ul> <?php $IDOutsideLoop = $post->ID; $args = array( ‘posts_per_page’ => -1, ‘orderby’=> ‘title’, ‘order’ => ‘ASC’ ); $myposts = get_posts( $args ); foreach($myposts as $post) : ?> <li <?php if(is_single() && $IDOutsideLoop == … Read more

Only display price when value exist

Assuming this produces the first price currently: echo ‘<th>’ . wpforest_currency_simb() . get_post_meta( $post_id->ID, ‘WpForest_price’, true ) . ‘ ‘ . get_option( ‘wpf_paypal_cur’ ) . ‘</th>’;z And assuming I understand the question, this should test for the first price: $price = get_post_meta( $post_id->ID, ‘WpForest_price’, true ); if ( $price ) echo ‘<th>’ . wpforest_currency_simb() . … Read more

Delete old post with new post

If i understand the question correctly, you want that whenever a user adds a new post, all his/her previous posts should be deleted. I wonder why would you do that!! 🙂 But anyway, you can use this code. add_action(‘save_post’, ‘delete_prev_posts_by_user’, 10, 2 ); function delete_prev_posts_by_user( $post_id, $post ){ if( ‘publish’ == $post->post_status ){ $the_special_category_id = … Read more

Rearrange the title, the thumbnail, and the content in a theme template

This seems too simple. I am afraid that I have badly misunderstood something. Apologies if that is the case. Alter single-page-news.php to be… <div class=”thirteen columns”><?php the_post_thumbnail(); ?> <div class=”title-single”> <h2><?php the_title(); ?></h2> </div><?php the_content(); ?> </div>

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)