Posting via email, where do I start troubleshooting?

You’re obviously posting it to a mailbox that WordPress is accessing, so check the mailbox that your friend has sent an email to, if the email is still in there then WP hasn’t taken it out and thus your email settings in WP are probably wrong. If the email isn’t in there your friend has … Read more

Stopping People Viewing Draft Posts

Yes, you (read: the logged in user) will be able to see the drafted post. But, a guest will not be able to read it. To test it, login to one browser and create a draft. See its URL in another browser where you don’t login (no cookie, etc).

Relative Time On Posts

WordPress actually has an obscure and little known function called human_time_diff() that does this. It takes two arguments; the first is the earlier timestamp, and the second is the later timestamp. Both should be Unix timestamps. The first argument is required, but the second is optional, and will use time() if left empty. So, for … Read more

Get the post children count of a post

class MyClass { … function post_count_filter($where) { global $wpdb; str_replace(“WHERE”, “WHERE “.$wpdb->posts.”.post_parent = “.$this->count_parent.” AND”, $where); return $where; } function count_children($post_id) { $this->count_parent = $post_id; add_filter(‘query’, ( &$this, ‘post_count_filter’) ); $stats = wp_count_posts(‘myposttype’); remove_filter(‘query’, ( &$this, ‘post_count_filter’) ); unset($this->count_parent); return array_sum( (array)$stats ); } // example of use function xyz() { global $post; … $child_count … Read more

Post type hierarchy

To me the most logical would be to have a “Book” custom post type, and then all the attributes of the books (Author, Collection, Genre, etc.) would be custom taxonomies. Then for your URLs you could use some custom URL rewrite method to get what you want.

Delete Post From Front-End and attachment permanently

Try: <?php if (current_user_can(‘edit_post’, $post->ID)) echo “<a href=”” . wp_nonce_url(“/wp-admin/post.php?action=delete&amp;post=$id”, “delete-post_’ . $post->ID) . “‘>Delete post</a>” ?> You can decide when to empty the WordPress trash by adding this code to the wp-config.php file in your WordPress root directory. define(‘EMPTY_TRASH_DAYS’, 1 ); The 1 in the code signifies you want to empty the trash everyday. … Read more

Featured Posts for Category Pages

assign the additional category ‘featured’ to the post in the category ‘medical’. in your category template, use a query with ‘category__and’ => array(3, 27) example (assuming ‘medical’ is cat 3, and ‘featured’ is cat 27): <?php $args = array( ‘category__and’ => array(3, 27), ‘posts_per_page’ => 1 ); $feature = new WP_Query( $args ); if( $feature->have_posts() … Read more