How to display links in specific page
You can either create a custom page template, or just add the code to your regular page.php: if ( is_page( ‘your-page-slug’ ) ) { echo ‘your links’; }
You can either create a custom page template, or just add the code to your regular page.php: if ( is_page( ‘your-page-slug’ ) ) { echo ‘your links’; }
Figured it out. use is_home() to detect if its the posts archive page. kind of counter-intuitive because i always thought that function was to determine if it’s the homepage, found out there’s a is_front_page() for that.
To print just the total number of comments for a given post ID, use the count argument: echo get_comments( array ( // post ID ‘post_id’ => 149, // return just the total number ‘count’ => TRUE ) ); or just use // Argument: Post ID echo get_comment_count( 149 ); To get the total number of … Read more
i had the same problem with one of my sites and i used this hack: on your themes category.php (or if your doesn’t have one then archive.php ) before the loop part witch is something like this: if ( have_posts() ) : while ( have_posts() ) : the_post(); add this code if (is_category()){ $category = … Read more
Try something like this: // First make all metaboxes have ‘normal’ context (note the absence of ‘submitdiv’) // If you know the ids of the metaboxes, you could add them here and skip the next function altogether add_filter(‘get_user_option_meta-box-order_post’, ‘one_column_for_all’, 10, 1); function one_column_for_all($option) { $result[‘normal’] = ‘postexcerpt,formatdiv,trackbacksdiv,tagsdiv-post_tag,categorydiv,postimagediv,postcustom,commentstatusdiv,slugdiv,authordiv’; $result[‘side’] = ”; $result[‘advanced’] = ”; return $result; … Read more
Pagination is result of combining two factors: page size and offset. In common case page size is constant and offset is page size times current page. Is it possible to build highly elaborate pagination you describe? Technically yes. That would be matter to adjusting page size and offset in a more elaborate fashion. However specific … Read more
Try the following… global $wpdb; $wpdb->query( ” UPDATE {$wpdb->prefix}postmeta SET post_id = {$edit_id}, meta_key = ‘{$meta_key}’, meta_value=”{$meta_value}” WHERE post_id = {$edit_id} AND meta_key = ‘{$meta_key}’ ” ); //or using prepare $wpdb->query( $wpdb->prepare( ” UPDATE {$wpdb->prefix}postmeta SET post_id = %d, meta_key = %s, meta_value = %s WHERE post_id = %d AND meta_key = %s “, $edit_id, … Read more
Do: add_action(‘save_post’, ‘my_save_function’, 10, 2); And the $post object will be passed as second argument to your function: function my_save_function($post_ID, $post) {
As you can see, I tried declaring the $post variable as global to account for failures due to being outside of the Loop. The problem is not that the post is “outside of the loop”, problem is that AJAX request is a completely separate HTTP request. When you do an AJAX request, is just like … Read more
You can use a custom loop to get all stick post and then return all normal post. You may have to modify this code a bit but here is how you can return all sticky post. You can play with the second custom loop for the individual pages and return just the one post. //is … Read more