Deprecated function get_user_by_email($email)
get_user_by is the replacement for get_user_by_email: $user = get_user_by( ’email’, ‘[email protected]’ );
get_user_by is the replacement for get_user_by_email: $user = get_user_by( ’email’, ‘[email protected]’ );
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’
You need wp_footer() call in your footer, before closing body tag. Theme without it is pretty much considered broken, since things like footer scripts simply can’t work without it.
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!”); }; });
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
You cannot hook in a function without a hook. If it returns a variable, you will have to use it as it is returned. And then, maybe, perform your operations on that.
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
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:
You can only return one chunk of data from a function. That is a PHP enforced rule. If you need to return multiple pieces of data you need to return an array or an object. With filters, though, you can’t just decide what to return. You have to return what the filter is meant to … Read more
is_sidebar_active() is not a WordPress function. Do not use that. This is probably a typo. The correct name is is_active_sidebar($index), and that function is not deprecated.