How to add custom fields to my custom registration form

There’s wp_login_form() for such cases. It offers tons of hooks to extend it. // In your template wp_login_form( array( /* Args: refer to Codex page */ ) ); A more in-depth look at the filters, can be found here @GitHub WP Core source. ‘login_form_top’ – above login-username ‘login_form_middle’ – above login-submit ‘login_form_bottom’ – below login-submit … Read more

Getting first Image from post

Chris’s article looks for the img tag on your post. Since you are using WordPress, and I’m assuming the WordPress uploads feature, here is how you can get the first uploaded image on your post. Paste the following code in your theme’s functions.php file. //function to call first uploaded image in functions file function main_image() … Read more

when I fetch data from remote mysql database in wordpress built in wordpress function is not working?

The WordPress APIs rely on the global $wpdb object, you can define any arbitrary object of type wpdb but that doesn’t mean WordPress will use it. Instead, something akin to the following might be better: global $wpdb; $tempDB = $wpdb; $wpdb = new wpdb(DB_USER2, DB_PASSWORD2, DB_NAME2, DB_HOST2); // do your remote SQL stuff // perhaps … Read more

Stop turning small dashes into longer ones

- is a hyphen or minus, not a dash. Converting it to an en dash is actually the correct thing to do from a typographical standpoint. http://en.wikipedia.org/wiki/Hyphen-minus Typography is one of those deep-read kind of ideas, but the bottom line is that you think the hyphen minus is the correct character to use because of … Read more

list tags with count in author profile page

Here you go: function get_author_post_tags_wpa78489($author_id,$taxonomy = ‘post_tag’){ //get author’s posts $posts = get_posts(array( ‘author’ => $author_id, ‘posts_per_page’ => -1, ‘fields’ => ‘ids’ ) ); $ts = array(); //loop over the post and count the tags foreach ((array)$posts as $p_id) { $tags = wp_get_post_terms( $p_id, $taxonomy); foreach ((array)$tags as $tag) { if (isset($tags[$tag->term_id])){ //if its already … Read more

How to hide a plugin metabox for non admins when a user adds a new post

You can try to add this line to your code example for the admin_menu filter: remove_meta_box(‘awd_fcbk_awd_mini_form_metabox’, ‘post’, ‘side’); where awd_fcbk is the plugin slug. Edit: This is the metabox that I’m targeting from the plugin source code: //Like button manager on post page type add_meta_box($this->plugin_slug . “_awd_mini_form_metabox”, __(‘Facebook AWD Manager’, $this->ptd) . ‘ <img style=”vertical-align:middle;” … Read more