Generate featured images old posts

You can look into this post: http://ken.ph/first-image-of-wordpress-post-as-thumbnail/ Or if you’re comfortable with MySql try using this (obviously check it on local database first): INSERT into wp_postmeta (meta_value, meta_key, post_id) SELECT DISTINCT(ID), post_type , post_parent FROM wp_posts WHERE post_type=”attachment” AND post_parent !=0 AND post_status=”inherit”; UPDATE wp_postmeta set meta_key = ‘_thumbnail_id’ WHERE meta_key=’attachment’

Can’t call Javascript function – scope?

You need to put your doSomething in the correct namespace, or at least in a namespace. The simplest way would be to put it in the window namespace: jQuery(document).ready(function($) { window.doSomething = function() { alert(“Time for a coffee break!”); }; });

Make wp_link_pages() suitable for Twitter Bootstrap markup

There was a trac ticket requesting improvements to the function since it was inflexible, yet required for themes hosted in official repository. It had been resolved, adding much needed wp_link_pages and wp_link_pages_link filters, so now output can be cleanly modified without need to use custom function. I went through quite a few takes on this … Read more

Storing password (functions.php)

Here ya go: function dopasswordstuff(){ if(isset($_POST[‘homepagepassword’])) { global $wpdb; $post_password = trim($_POST[‘passwordfield’]); $post_id = $wpdb->get_var( $wpdb->prepare(“SELECT ID FROM $wpdb->posts WHERE post_password = %s”, $post_password) ); if (!empty($post_id)) { if ( empty( $wp_hasher ) ) { require_once( ABSPATH . ‘wp-includes/class-phpass.php’ ); // By default, use the portable hash from phpass $wp_hasher = new PasswordHash(8, true); } … Read more

Remove “Published On” inside wp-admin

You could hide it for non-admins with CSS: function hide_curtime_wpse_96106() { if(get_post_type() === “post”){ if(!current_user_can(‘manage_options’)){ // only for non-admins echo “<style>.misc-pub-section.curtime {display:none !important;} </style>”; } } } Before: After: