3373 readersThe first months of 2010 have been extremely prolific in terms of WordPress hacks. In this article, I have compiled 10 new WordPress hacks that you should definitely add to your library.Like CatsWhoCode? If yes, don't hesitate to check my other blog CatsWhoBlog: It's all about blogging!Top WordPress hacks of early 2010
3372 readersEver wanted to be able to automatically create a custom field with a value when a post (or page) is created? Then this snippet is for you.Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!How to automatically create a custom field when a post is
3722 readersDo you ever wished to be able to automatically send an email to your registered users and notify them of a new post on your WordPress blog? If yes, just read this recipe and lear how to do it easily!Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try
20607 readersIf you want to be able to keep a minimum word count for your posts, then just read this recipe. Applying it to your blog can be useful to maintain a clean layout, or ensure your guest writers will not post too short articles on your blog.Looking for WordPress hosting? Try WP Web Host. Prices
-
2417 readersJust a very quick tip but nonetheless an important one. Many of you will be using any number of plugins or the database query that's been doing the rounds recently to display your most popular posts. That code/plugin is no longer needed as WordPress' query_posts can now display your most commented posts.You really should be
4864 readersOne of the new very interesting things in WordPress 3.0 are individual post-types you can implement with little effort. Back then, you had to expand the database and write your own interface for it, now you just have to add a few lines of code - of course this is just the current state, which
5929 readers
PHP
add_action( 'admin_init', 'hide_editor' );
function hide_editor() {
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
if( !isset( $post_id ) ) return;
$template_file = get_post_meta($post_id, '_wp_page_template', true);
if($template_file == 'submit.php'){ // edit the template name
remove_post_type_support('page', 'editor');
}
}
Visit wpsnipp.com for details on how to setup this WordPress snippet. Share
8724 readers
( example screenshot )PHP
add_action("admin_init", "pdf_init");
add_action('save_post', 'save_pdf_link');
function pdf_init(){
add_meta_box("my-pdf", "PDF Document", "pdf_link", "post", "normal", "low");
}
function pdf_link(){
global $post;
$custom = get_post_custom($post->ID);
$link = $custom["link"][0];
$count = 0;
echo '';
$query_pdf_args = array(
'post_type' => 'attachment',
'post_mime_type' =>'application/pdf',
'post_status' => 'inherit',
'posts_per_page' => -1,
);
$query_pdf = new WP_Query( $query_pdf_args );
$pdf = array();
echo '';
echo 'SELECT pdf FILE';
foreach ( $query_pdf->posts as $file) {
1347 readersWordPress version 2.9 introduced the function of Post Thumbnail. We wrote about this feature in this post and here and also in many other blogs. I find it an advantage, if the overview of articles and pages also provides the associated thumbnail. Therefore, I would like to introduce a small code snippet that makes just
3977 readersRecently, a client of mine asked me to write an article importer for his WordPress powered site, which was a very interesting project for me. In this article, I'll show you how you can easily add data (posts, comments, categories, etc) to your WordPress blog, without any manual effort.Like CatsWhoCode? If yes, don't hesitate to