Front end user creation form! How do you keep the user on the same page in event of error?

I've recently tried to add a user registration form to the front end of my site and have used the following form code (based upon http://digwp.com/2010/12/login-register-password-code discovered in an answer by maugly in question Front-end Register Form) in a template file:

Add a child
             <form method="post" action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" class="wp-user-form">
                     <?php _e('Child Name'); ?>:                      <input type="text" name="user_login" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" id="user_login" />

                     <input type="text" name="user_email" value="<?php echo esc_attr(stripslashes($user_email)); ?>" size="25" id="user_email" />

                     <?php do_action('register_form'); ?>                     <input type="submit" name="user-submit" value="add child" class="user-submit" />                     <?php                           $register = $_GET['register'];                                if($register == true) {                               //now add it to the link database                              echo '
User Added!
';                           } ?>                          <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>?register=true" />                            <input type="hidden" name="user-cookie" value="1" />
             </form>
      The redirect_to attribute is set here to the requesting page which is all great when it works by triggering the if block to display an additional success message. The question I have is when an error is detected in wp-login.php (such as the username is already in use) how do I get the redirect to come back to this page as opposed to the wp-login generated login box/error display? I can't see any obvious hook to grab hold of (although I've never used actions yet, so could be missing something!) Help and guidance very much appreciated! Ryan


Read more on pages WordPress

I'm fairly new to WP but absolutely loving it. And here is my problem. I know that this topic it's already on the Forum but the solution simply don't work for me. I have a few pages where I would like to split content using read more. So I have done recommended hack by adding global               $more; and $more = 0; the_content();      and everything seem to look ok although every time I click on read more link nothing happens and following result appear in my browser http://www.mysite/#more-15 Could anyone help me? Many Thanks in advance dompl


Add_meta_box not appearing, but does appear in screen options

I'm adding a meta box to a wordpress admin page. It works fine on my local server but when I upload it to the live server the meta box doesn't appear. Its does, however, appear in the screen options so I know the code is working, to some degree, its just not displaying anything on the edit page. Does anyone have any ideas?               function ila_add_custom_box() {              add_meta_box(             'content-on-page',             'Content On Page',             'ila_render_meta_box',             'page',             'high'         );     }          add_action( 'add_meta_boxes', 'ila_add_custom_box' );          function ila_render_meta_box(){ echo "
Edit Page Options
"; }      Thanks Edit: I've switched all the plugins off and that didn't solve it


How do I amend form data before it is saved for a custom post type

I have a custom post type for clinics which has 3 fields; a textarea for the address of a the clinic and two textboxes for latitude and longitude. I want the user to enter the address in the textarea and then when they hit publish I need to hook in, geocode the address and populate the latitude and longitude fields to be stored in the database. If this is successful then when they come to edit the clinic the latitude and longitude fields will be populated. I have the following code but it doesn't seem to work:               function geocode_clinic()      {     if($_POST['post_type']=='clinics')      {         $address = urlencode($_POST['fields']['field_52ea48969a9f2']);              // geocode the address         $location = json_decode(file_get_contents("http://maps.google.com/maps/api/geocode/json?address=".str_replace(" ", "+", $address)."&sensor=false"));              if ($data->status=="OK") {                       $lat = $data->results[0]->geometry->location->lat;             $lng = $data->results[0]->geometry->location->lng;         } else {             $lat = $lng = '';         }              $_POST['fields']['field_52ea4b66b382f'] = $lat;         $_POST['fields']['field_52ea4bccb3830'] = $lng;     }     }     add_action('save_post', 'geocode_clinic');


I'm in the process of converting a legacy website (i.e., one that I programmed from scratch) into WordPress. The contents are mostly blog postings. I'm trying to figure out what to do with the non-blog stuff. In particular, the photo galleries. I'm using the NextGen Gallery plugin to manage my photos. Each photo gallery has several paragraphs of text. Should a photo gallery be in a post or on a page? Putting a photo gallery into a post relatively straight forward, with a general category (i.e., Picture) and a specific subcategory (i.e., 2004) for organization. For bigger photo galleries, it seems like I have to split them up over multiple posts to avoid saturating a post. Putting a photo gallery into a individual page is similar to post. The problem is creating the overview page (i.e., Pictures) that points to the subpage (i.e., 2004) that points to the individual pages. I'm not sure how to connect all these pages without being more work than necessary.


WP blog posts index URL

I want to use WP for a site that blog is just one aspect of it, and I don't want requests to `home_url` list blog posts (`post_type=post`), I want them be to fetched using another URL. This topic default-archive-url-wordpress suggest two ways:   1. `page_for_posts` option   2. `post_type=post` URL query parameter but I have questions About the first, How a `page` would be able to `loop` into the posts, and where I should update this option (which `hook`)? For the second, the guy says that using this param, make the wordpress get the archive for the specified post type, but I think posts don't have archive (according to `includes/post.php` their `has_archive` is left to default) how should I change this and also I want to use a `permalink`/pretty link for accessing posts. Thanks in advance


How to get the number of pages when paginating comments?

I want to display threaded comments via ajax using pagination. If I use this code to display comments for page 1 how can I know if there is something more to be displayed on page 2? If there is something I would display a link "get more comments" if not there will be no link.               $comments =     get_comments(array(         'post_id' => $post_id,         'status' => 'approve'      ));         wp_list_comments(array(             'page' => 1,             'per_page' => 10,             'avatar_size'   => 16,         ), $comments);


Edit permalink for old posts and not show on top of RSS feed

I have edited permalinks for old posts (slug) After changing slug the posts appear on the top in RSS feed in some services. But I don't want to get this posts on top, I want just to edit slug. It seems the reason for this is `guid` tag in RSS, which contains links I have changed:               <guid isPermaLink="false">     http://host1.com/blog1/slug-of-article     </guid>      After changing link some services consider the entry as new post, which seems correct according to the info at http://www.rssboard.org/rss-profile#element- channel-item-guid The question is how to avoid such behavior? Is it possible to configure Wordpress in some way, e.g. generate guid not related to link, using some plug-ins etc...? If such behavior not possible to avoid for old posts, it would be good to make it possible to avoid such situation for new posts keeping in mind that I may desire to change permalink in future. Thank in advance, Sergiy


Uploaded image not appearing in custom post type

I am writing a plugin which should allow users to create a custom post type called reseller and attach an image. The image is being uploaded to the uploads folder and appears in the media library with a blank thumbnail. The image is also not visible in the list of 'resellers' in the back-end i.e the admin interface for the custom post type. Can anyone see what I've missed? relevant functions start line 362 here: https://gist.github.com/codecowboy/80fd6363c58558a74c9e Relevant section:                  public function wps_reseller_cpt() {             $labels = array(                 'name'               => _x( 'WPS Resellers', 'post type general name' ),                 'singular_name'      => _x( 'WPS Reseller', 'post type singular name' ),                 'add_new'            => _x( 'Add New', 'book' ),                 'add_new_item'       => __( 'Add New Reseller' ),                 'edit_item'          => __( 'Edit Reseller' ),                 'new_item'           => __( 'New Reseller' ),                 'all_items'          => __( 'All Resellers' ),                 'view_item'          => __( 'View Reseller' ),                 'search_items'       => __( 'Search Resellers' ),                 'not_found'          => __( 'No resellers found' ),                 'not_found_in_trash' => __( 'No Reseller found in the Trash' ),                 'parent_item_colon'  => '',                 'menu_name'          => 'Resellers'             );             $args = array(                 'labels'        => $labels,                 'description'   => 'Holds our resellers and reseller specific data',                 'public'        => true,                 'menu_position' => 50,                 'supports'      => array( 'title', 'editor','image', 'thumbnail', 'custom-fields' ),                 'has_archive'   => false,             );             register_post_type( 'wps-reseller', $args );         }              public function create_reseller_profile_form(){                  require_once plugin_dir_path( __FILE__ ) . 'views/public-create_reseller_profile_form.php';              }              public function intercept_reseller_profile_form() {                  if ( !empty( $_POST['wps-reseller-user-submission'] ) ) {                 $this->wps_reseller_process_form();             } else {                 return $template;             }              }              public function wps_reseller_process_form() {             require_once(ABSPATH . "wp-admin" . '/includes/image.php');             require_once(ABSPATH . "wp-admin" . '/includes/file.php');             require_once(ABSPATH . "wp-admin" . '/includes/media.php');                       if ( wp_verify_nonce( $_POST['reseller_user_form'], 'add_reseller_form') &&                 !empty( $_POST['reseller-title'] ) &&                 !empty( $_POST['reseller-description'] ) &&                 !empty( $_FILES['reseller-image']) )             {                      //var_dump($_POST); exit;                 $file = $_FILES['reseller-image'];                 $uploads = wp_upload_dir();//var_dump($uploads); exit;                 $new_reseller_profile_data = array(                     'post_status' => 'draft',                     'post_title' => $_POST['reseller-title'],                     'post_content' => $_POST['reseller-description'],                     'post_type' => 'wps-reseller'                 );                      $file_errors = $this->wps_parse_file_errors($file);                 $upload_overrides = array( 'test_form' => FALSE );                 if($file_errors['error'] == 0) {                          if($new_reseller_id = wp_insert_post( $new_reseller_profile_data )){                              //$this->wps_process_image($file, $new_reseller_id);exit;                              $uploaded_file = wp_handle_upload( $file, $upload_overrides );                                   $wp_filetype = wp_check_filetype( basename( $uploaded_file['file'] ), null );                         $attachment = array(                             'post_mime_type' => $wp_filetype['type'],                             'post_title' => preg_replace('/\.[^.]+$/', '', basename( $uploaded_file['file'] ) ),                             'post_content' => '',                             'post_author' => '',                             'post_status' => 'inherit',                             'post_type' => 'attachment',                             'post_parent' => $new_reseller_id,                             'guid' => $uploads['baseurl'] . $uploads['subdir'] . '/' . $file['name']                         );     echo $uploads['baseurl'].'
';     echo $file['name'].'
';     var_dump($uploads); exit;                              $attachment_id = wp_insert_post( $attachment );                         $attach_data = wp_generate_attachment_metadata( $attachment_id, $uploaded_file['file'] );                              // update the attachment metadata                         wp_update_attachment_metadata( $attachment_id,  $attach_data );                         set_post_thumbnail( $new_reseller_id, $attachment_id );                          }                 }                  }                  //create a new reseller post, make it draft (ensure post type supports this)             //email an admin user              }              protected function wps_parse_file_errors($file){                  define('MAX_UPLOAD_SIZE', 200000);             define('TYPE_WHITELIST', serialize(array(                 'image/jpeg',                 'image/png',                 'image/gif'             )));                  $result = array();             $result['error'] = 0;                  if($file['error']){                      $result['error'] = "No file uploaded or there was an upload error!";                      return $result;                  }             $image_data = getimagesize($file['tmp_name']);                  if(!in_array($image_data['mime'], unserialize(TYPE_WHITELIST))){                      $result['error'] = 'Your image must be a jpeg, png or gif!';                  }elseif(($file['size'] > MAX_UPLOAD_SIZE)){                      $result['error'] = 'Your image was ' . $file['size'] . ' bytes! It must not exceed ' . MAX_UPLOAD_SIZE . ' bytes.';                  }             return $result;              }               }      Questions:   1. why is the thumbnail blank in the media library? Here's what is being loaded:   1. How do I get the image to show up in the admin interface? If I add files to the library using the media manager, the thumbnails and image appear as expected. In case it is relevant, this is a **multisite** install.


How to enable admins/editors to set a featured image for specific category?

Well , I know how to set up a featured image for a post . But I want to set up a featured image for categories . So admins/editors can choose a featured image ,like they do for posts . And one more thing , I want to show list of categories in home page instead of showing posts or something static . Thanks in advance


hook for dashboard show_user_profile

I'm looking a way to avoid regular users go to profile and dashboard page. Have this little code to work with profile page:               function lockdown_profile()     {         global $current_user;         return !current_user_can( 'manage_options' ) ? wp_redirect("/profile") : true;     }     add_action('show_user_profile', "lockdown_profile");      And works, but i need to do the same for dashboard page, any ideas?


How to display list of taxonomy terms of all posts in taxonomy archive?

I have 3 separate taxonomies, all with their own terms. When a term is clicked and the user is taken to that archive, I want to display a list of all the taxonomy terms associated with all the posts in that archive. Any help is greatly appreciated.


Implementing FancyBox

I am trying to implement fancybox into WP without using a plugin. I did some research and went over few examples but there is still an issue. Any help would be greatly appreciated. Here's the code: in functions.php:               function loadFancyBox()     {     if (is_single() && strpos($post->post_content,'class="fancy"') !== false)     {             wp_enqueue_style('fancyStyle', get_template_directory_uri() . 'fancyBox/jquery.fancybox.css');             wp_enqueue_script('fancyScript', get_template_directory_uri() . 'fancyBox/jquery.fancybox-1.3.4.js', array('jquery'), '', true );     }     }     add_action('wp_print_styles', 'loadFancyBox');      and in my header.php first I call jQuery and right after:               <script>     $(document).ready(function() {          $("a.fancy").fancybox({         'transitionIn'  :   'elastic'     });          });     </script>      and finally I add class="fancy" to any img a tag. At this point any link goes to the image but fancybox is not being loaded. Thank you


How Do Set image Folder For generated thumbnails with wp_generate_attachment?

I wrote an import app to create posts with several attached images. The files are already on the server under wp-content like so: wp-content/mygalleries/gal_a wp-content/mygalleries/gal_b wp- content/mygalleries/gal_c Just to be clear... the source images are already in gal_a, gal_b, gal_c. When I call                $metadata = wp_generate_attachment_metadata( $attach_id, $filepath );      ...it properly generates the various thumbnails HOWEVER, it puts them in gal_a, gal_b, gal_c. To avoid confusion, I want to place the wp generated thumbnails in a subfolder like so:                wp-content/mygalleries/gal_a/thumbs      wp-content/mygalleries/gal_b/thumbs      wp-content/mygalleries/gal_c/thumbs      How do I 'tell' wp_generate_attachment_metadata( $attach_id, $filepath ) to look for the source file in gal_a, but put the generated imgs in gal_a/thumbs? TIA


Put class on child elements on categories

I'm using this code to show the categories, with the href= "#cat_id" and everything is working perfectly. But i need when show subcategory display:

      Any suggestions?               <?php     $cat_name = 'onde-encontrar';     $category = get_category_by_slug( $cat_name );     $taxonomy_name = 'category';     $term_ids = get_term_children( $category->term_id, $taxonomy_name );     foreach ( $term_ids as $term_id ) {         $term = get_term_by( 'id', $term_id, $taxonomy_name );         echo "
term_id}' href='#{$term->term_id}'>{$term->name}
";     }     ?>


Order terms by term_order

**Context** _Post Type:_ Resources _Taxonomy:_ Media Type, _Term:_ Audio _Taxonomy:_ Series The following code displays a unique list of the custom taxonomy "Series" I want to order the list by term_order, but it is not working. Help please! Thanks! The site: http://eaglesonline.org/resources/audio/ _currently it's ordered by ID_                   <?php                     $post_data = array();                          $my_query = new WP_Query( array(                              'post_type' => 'resource',                             'posts_per_page' => -1,                             'media_type' => 'audio'                              )                      );                          if ( $my_query->have_posts() ) {                         while ( $my_query->have_posts() ) {                             $my_query->the_post();                             $post_data[] = get_the_ID();                         }                     }          // Start with whatever ID you want to have from Media Type                     $audio = 16;                          // Get all those post_ids for that term                     $post_ids = get_objects_in_term( $audio, 'media_type', array('post_status' => 'publish') );                          // Then get the series terms for those post ids                     $terms = wp_get_object_terms( $post_data, 'series', array('fields' => 'ids', 'orderby' => 'menu_order' ) );                     $result = array_values( array_unique($terms) );                          ?>                           <?php             $a = $result;                  foreach ($a as $v) {             $term = get_term( $v, 'series' );             $name = $term->name;             $slug = $term->slug;             echo '

'.$name.'

';                   }                   ?>


Relative or Absolute Paths for Flash Video Player Files

I have a Flash SWF file working correctly in the root of my website. It is fully embedded, with everything including the player hosted directly on the website (not a YouTube embed). This flash file plays from a page located in the root of my site. I want to show the same flash SWF in a page which is not in the root, that is, it is on a page which is in a virtual subdirectory linked from a menu item. 1) I have `www.friendlyaquaponics.com`. The home page contains the flash video (second one on the page, not first one). It plays correctly. The HTML is properly set off inside of `<code> ... </code>` tags. 2) The same swf plays correctly when the absolute URL is put directly into the browser address bar, as `www.friendlyaquaponics.com/fa-2013-03-24b.swf`. It finds all the required components including the player controls. 3) But then I have a page linked from the top menu TRAININGS -> NEW YORK. This page is in a Wordpress "virtual" subdirectory at `www.firendlyaquaponics.com/new-york/` I have put the coding for the same flash video in the "New York" page. But it wont play. I have tried many variations of specifying the path to the swf (in 3 places as required), but no variation seems to work: a) Referencing `<param name="movie" value="http://www.friendlyaquaponics.com/fa-2013-03-24b.swf" />` DOESNT WORK, even though this absolute URL works stand-alone as noted above. b) Referencing `<param name="movie" value="../fa-2013-03-24b.swf" />` This relative URL DOESNT WORK (doesn't load or show the player controls). c) Referencing `<param name="movie" value="/fa-2013-03-24b.swf" />` This "absolute relative" URL (relative to the root of the website) DOESNT WORK (doesn't load or show the player controls). What is the correct reference within the Flash embed code to make this work, in the context of a page in a "virtual subdirectory"?


Why doesn't /2013/01/ properly return January's archives in archive.php?

I've figured out how to implement pagination into WordPress archives, etc.., but the content isn't being returned correctly. Instead of /2013/01/ returning January 2013's archives, it instead returns the latest posts. My code is below:
<?php echo wp_title('',TRUE,'right'); ?>

     <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>     <?php query_posts('showposts=5&paged='.$paged); ?>     <?php if(have_posts()) : while(have_posts()) : the_post(); ?>

<a rel="bookmark" href="<?php the_permalink(); ?>">                 <?php echo the_post_thumbnail('full'); ?>                 <?php the_title(); ?>
             <?php the_excerpt(); ?>

     <?php endwhile; else: ?>
Sorry, no posts matched your criteria.
     <?php endif; ?>

         <?php previous_posts_link('← Newer Entries') ?>         <?php next_posts_link('Older Entries →') ?>
      I'm sure that there is a simple solution, but I haven't had any luck on Google or in the WordPress documentation. Help would be appreciated.


Modify plugin and submit to directory

Just a quick question: Can I modify a plugin and submit the modified plugin to directory under another name?


Registering Sidebar. Additional banners got displayed

I need to register a test sidebar and have to include it on a specific page. On registering sidebar as               register_sidebar(array('name' => 'ABC'));      Additional banners get displayed on all pages. Previously there are 4 dynamic sidebars registered and **PHP Code** is related with them (banner html). Before relating any banner with the newly created sidebar, I got them displayed. Anyone have an idea from where it get wronged?


Force Load https Wordpress Plugins

Having a mixed security issue that is affecting functionality in browsers because some of my plugins are loading with http instead of https. I'm running under a multisite setup. Thanks! This is what I have in my htaccess               # BEGIN WordPress     RewriteEngine On     RewriteCond %{SERVER_PORT} !^443$     RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]          RewriteBase /     RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]     RewriteRule . index.php [L]     # END WordPress


Category Template - Show Last Entry as Featured

I am working on my category template. Here is how I want the page to display:   1. Category Name - `this is done`   2. The latest post for each category be on top `(then styled which I can do)`.    3. The Category description - `this is done`   4. List all the rest of the posts for the category under it - `I can list all the posts, but I want to skip the latest` Any help in pointing me in the right direction, I would appreciate it. Thanks


Email verification for new users

I would like to implement a plugin that requires new users to reply to an email, to verify their email address, on registration. I am already doing extensive codex research, but I am very new and would appreciate some hints, especially regarding keeping the user inactive until they have verified their email. The rest I think I will manage on my own.


How could child theme be different than parent theme if I haven't made changes?

I made a child theme defined as so:               /*     Theme Name: GlenTheme     Description: Modified Gallery 2.3 theme     Template: gallery     */          @import url("../gallery/style.css");      The only file in the child theme is this style.css Within the menu, though, the markup is coming up differently: in the child theme the menu comes out like this (partially):

      While in the parent theme it comes out like this:

      As I understand parent-child themes they should be identical, but clearly something in the markup is getting changed, the code governing this is the menu function.. I could obviously rewrite the menu styles to make them apply properly to the different markup, but I really want to know why there's any different markup in the first place!


Is there a (offical) way for a theme to deactivate itself and show a message in admin?

I know that plugins can deactivate itself, but how about themes? I work on a parent theme (Framework) and I don't want users to be able to activate it. This is what I have so far. The problem is that there is a message coming up from wordpress that the theme is demaged when I do this this way. It shows the last theme there one time but then swiches again to the default theme because wordpress expect the theme I clicked activate for. I need to bypass this somehow. I want to show my own message instead. Any ideas? Although I don't know if its right to set all to one value, isn't template supposed to be the parent themes name when there is one? Or does WP figure this out automatically?               add_action( 'after_switch_theme', 'switch_to_last_theme' );          function switch_to_last_theme( $old_theme ){              echo "

just for testing last theme: $old_theme
";              update_option('template', $old_theme);         update_option('stylesheet', $old_theme);         update_option('current_theme', $old_theme);          }


Can I use images as anchor tags with <?php previous_post(); ?><?php next_post(); ?>

Rather than displaying the title of the next page, I would like to display a large arrow that can be clicked on. To do this I shall either be using image files, or the __tag. Can this be done?


Issues when moving from server to MAMP

I just moved a website from a hosted web server to MAMP and I am getting a strange error. When I visit the homepage I get the default "It works" apache message. the url should be `test:8888` but the homepage is being converted to just `test` To make matters worse all other pages are working `EXCEPT ONE`. This page is also being converted to `test/my-page` when it should be `test:8888/my-page`. **ALL OTHER PAGES ARE WORKING CORRECTLY** Any ideas why this could be happening? I have changed the siteurl and home options in the wp_options table to http://test:8888 and as I mentioned everything is working correctly except for these two pages. Thanks for the help.


How to add button to top of theme customizer?

I am trying to figure out how exactly I can add a button to the top of the theme customizer. The spot I am talking about is where the "close" and "save" buttons are. The ones that are above everything else and directly above the preview panel. Would this have to be done through a modification of the core WP files or can it be done through the theme and customizer API itself? If it can be done without modifying the core wordpress files then how can I access it?


Widget dynamically add new input field

I'm trying to edit widget and add new input field for facebook user ID and Location. The widget has 4 parts of code, display the widget on the screen, fetch facebook userdata and post, update widget settings and Displays the widget settings controls on the widget panel. Code for display the widget on the screen               /**      * display the widget on the screen.      */     function widget( $args, $instance ) {         extract( $args );         /* Our variables from the widget settings. */         $user_loc1 = $instance['user_loc1'];         $user_loc2 = $instance['user_loc2'];         $user_loc3 = $instance['user_loc3'];         $user_loc4 = $instance['user_loc4'];         $user_loc5 = $instance['user_loc5'];         $user1 = $instance['user1'];         $user2 = $instance['user2'];         $user3 = $instance['user3'];         $user4 = $instance['user4'];         $user5 = $instance['user5'];         $user_gen = $instance['user_gen'];         $app_id = $instance['app_id'];         $secret_code = $instance['secret_code'];         $post_count = $instance['post_count'];         if( empty($post_count) ){ $post_count = '5'; }              $location = wpgc_shortcode_city($atts, $content='');              if ($user_loc1 == $location){             $user_id = $user1;         } else if ($user_loc2 == $location){             $user_id = $user2;         } else if ($user_loc3 == $location){             $user_id = $user3;         } else if ($user_loc4 == $location){             $user_id = $user4;         } else if ($user_loc5 == $location){             $user_id = $user5;         } else {             $user_id = $user_gen;         }     }      Code for Fetch facebook userdata and post (will skip this as this will not be edited)               //fetch facebook userdata and post      Code for Update widget settings               /**      * update widget settings      */       function update( $new_instance, $old_instance ) {         $instance = $old_instance;         $instance['user_loc1'] = $new_instance['user_loc1'];         $instance['user_loc2'] = $new_instance['user_loc2'];         $instance['user_loc3'] = $new_instance['user_loc3'];         $instance['user_loc4'] = $new_instance['user_loc4'];         $instance['user_loc5'] = $new_instance['user_loc5'];         $instance['user1'] = $new_instance['user1'];         $instance['user2'] = $new_instance['user2'];         $instance['user3'] = $new_instance['user3'];         $instance['user4'] = $new_instance['user4'];         $instance['user5'] = $new_instance['user5'];         $instance['user_gen'] = $new_instance['user_gen'];         $instance['app_id'] = $new_instance['app_id'];           $instance['secret_code'] = $new_instance['secret_code'];         $instance['post_count'] = $new_instance['post_count'];         return $instance;     }      And finally Code for Displays the widget settings controls on the widget panel               /**      * Displays the widget settings controls on the widget panel.      * Make use of the get_field_id() and get_field_name() function      * when creating your form elements. This handles the confusing stuff.      */      function form( $instance ) {              /* Set up some default widget settings. */         $defaults = array(             'user_loc1' => '',             'user_loc2' => '',             'user_loc3' => '',             'user_loc4' => '',             'user_loc5' => '',             'user_gen' => '',             'user1' => '',             'user2' => '',             'user3' => '',             'user4' => '',             'user5' => '',             'app_id' => '',                      'secret_code' => '',             'post_count' => 5            );         $instance = wp_parse_args( (array) $instance, $defaults ); ?>
             <label for="<?php echo $this->get_field_id( 'user_gen' ); ?>"><?php _e('Main Facebook:', 'dfsthemes') ?>             <input class="widefat" id="<?php echo $this->get_field_id( 'user_gen' ); ?>" name="<?php echo $this->get_field_name( 'user_gen' ); ?>" value="<?php echo $instance['user_gen']; ?>" />

             <label for="<?php echo $this->get_field_id( 'user_loc1' ); ?>"><?php _e('Location 1:', 'dfsthemes') ?>             <input class="widefat" id="<?php echo $this->get_field_id( 'user_loc1' ); ?>" name="<?php echo $this->get_field_name( 'user_loc1' ); ?>" value="<?php echo $instance['user_loc1']; ?>" />

             <label for="<?php echo $this->get_field_id( 'user1' ); ?>"><?php _e('User ID 1:', 'dfsthemes') ?>             <input class="widefat" id="<?php echo $this->get_field_id( 'user1' ); ?>" name="<?php echo $this->get_field_name( 'user1' ); ?>" value="<?php echo $instance['user1']; ?>" />

             <label for="<?php echo $this->get_field_id( 'user_loc2' ); ?>"><?php _e('Location 2:', 'dfsthemes') ?>             <input class="widefat" id="<?php echo $this->get_field_id( 'user_loc2' ); ?>" name="<?php echo $this->get_field_name( 'user_loc2' ); ?>" value="<?php echo $instance['user_loc2']; ?>" />

             <label for="<?php echo $this->get_field_id( 'user2' ); ?>"><?php _e('User ID 2:', 'dfsthemes') ?>             <input class="widefat" id="<?php echo $this->get_field_id( 'user2' ); ?>" name="<?php echo $this->get_field_name( 'user2' ); ?>" value="<?php echo $instance['user2']; ?>" />

             <label for="<?php echo $this->get_field_id( 'user_loc3' ); ?>"><?php _e('Location: 3', 'dfsthemes') ?>             <input class="widefat" id="<?php echo $this->get_field_id( 'user_loc3' ); ?>" name="<?php echo $this->get_field_name( 'user_loc3' ); ?>" value="<?php echo $instance['user_loc3']; ?>" />

             <label for="<?php echo $this->get_field_id( 'user3' ); ?>"><?php _e('User ID 3:', 'dfsthemes') ?>             <input class="widefat" id="<?php echo $this->get_field_id( 'user3' ); ?>" name="<?php echo $this->get_field_name( 'user3' ); ?>" value="<?php echo $instance['user3']; ?>" />

             <label for="<?php echo $this->get_field_id( 'user_loc4' ); ?>"><?php _e('Location 4:', 'dfsthemes') ?>             <input class="widefat" id="<?php echo $this->get_field_id( 'user_loc4' ); ?>" name="<?php echo $this->get_field_name( 'user_loc4' ); ?>" value="<?php echo $instance['user_loc4']; ?>" />

             <label for="<?php echo $this->get_field_id( 'user4' ); ?>"><?php _e('User ID 4:', 'dfsthemes') ?>             <input class="widefat" id="<?php echo $this->get_field_id( 'user4' ); ?>" name="<?php echo $this->get_field_name( 'user4' ); ?>" value="<?php echo $instance['user4']; ?>" />

             <label for="<?php echo $this->get_field_id( 'user_loc5' ); ?>"><?php _e('Location 5:', 'dfsthemes') ?>             <input class="widefat" id="<?php echo $this->get_field_id( 'user_loc5' ); ?>" name="<?php echo $this->get_field_name( 'user_loc5' ); ?>" value="<?php echo $instance['user_loc5']; ?>" />

             <label for="<?php echo $this->get_field_id( 'user5' ); ?>"><?php _e('User ID 5:', 'dfsthemes') ?>             <input class="widefat" id="<?php echo $this->get_field_id( 'user5' ); ?>" name="<?php echo $this->get_field_name( 'user5' ); ?>" value="<?php echo $instance['user5']; ?>" />

             <label for="<?php echo $this->get_field_id( 'app_id' ); ?>"><?php _e('App ID:', 'dfsthemes') ?>             <input class="widefat" id="<?php echo $this->get_field_id( 'app_id' ); ?>" name="<?php echo $this->get_field_name( 'app_id' ); ?>" value="<?php echo $instance['app_id']; ?>" />

             <label for="<?php echo $this->get_field_id( 'secret_code' ); ?>"><?php _e('App Secret Code:', 'dfsthemes') ?>             <input class="widefat" id="<?php echo $this->get_field_id( 'secret_code' ); ?>" name="<?php echo $this->get_field_name( 'secret_code' ); ?>" value="<?php echo $instance['secret_code']; ?>" />

             <label for="<?php echo $this->get_field_id( 'post_count' ); ?>"><?php _e('Number of posts to display:', 'dfsthemes') ?>             <input class="widefat" id="<?php echo $this->get_field_id( 'post_count' ); ?>" name="<?php echo $this->get_field_name( 'post_count' ); ?>" value="<?php echo $instance['post_count']; ?>" />
     <?php     }      I am manually adding the user1, user2, user3 etc. and user_loc1, user_loc2, user_loc3, etc. only parts of the code. Now my question is.. What would be the approach to dynamically add new user and user_loc on the settings panel so I don't need to manually edit the file and upload it. I'm thinking of having a Add New User and Add New Location button but I'm not sure how to code it that will automatically update all user and user_loc in all part of the widget script. I've seen some code using jQuery and append the new inputs but I not sure how to make it work to update all the data with user and user_loc. Any help on this? If you can provide me with the exact code to use then that would really much be appreciated. TIA :D


Remove/Hide a Widget on a Custom Template

i want to make a custom template using Genesis.. I added a custom Menu just by adding a widget on WIDGETS section and placed it on the top right side of the page. But i want it to be removed in a specific template ... How can i do that??               <?php     /*     Template Name:  No Menu - Full Page     */     ?>     <?php get_header(); ?>     <?php if ( has_post_thumbnail() ) { ?>
       <?php the_post_thumbnail(); ?>
     <?php } ?>     <?php genesis_before_content_sidebar_wrap(); ?>
       <?php genesis_before_content(); ?>
         <?php genesis_before_loop(); ?>         <?php genesis_loop(); ?>         <?php genesis_after_loop(); ?>
              <?php genesis_after_content(); ?>
          <?php genesis_after_content_sidebar_wrap(); ?>     <?php get_footer(); ?>      I guess i just dont know the code.. but i want this to be removed in my custom template `genesis_header_right` using Inspect Element, I copied the HTML version of the whole header

genesis_site_title

Title

genesis_site_description

Just another WordPress site

genesis_header_right

Home

      this is the code i want to remove

genesis_header_right

Home

      I tried adding this below the get header code `unregister_sidebar( 'header-right' );` Didnt do anything


Why does WordPress use serialize rather than json_encode for the options table?

I have a basic understanding of serialize (I come across it often when I'm migrating WordPress installs) and I just discovered json_encode. Given that serialize causes so much trouble with replacing strings in the database (eg. editing an optinos field directly), why does WordPress prefer serialize to (the seemingly similar) json_encode, which doesn't insert the string length into the stored value. My first thought was that it may provide some security or error-checking benefits - WordPress will ignore the option if the string lengths are incorrect.. but I'm interested in a qualified explanation :)


How do I apply my CSS to a theme page?

I installed the Mog theme for WordPress and I would like to position some of my pictures on a page using HTML divs and CSS. My question is, do I have to create a child theme of the Mog theme in order to do this? Or can I just add my own css to the particular page? If so, how do I incorporate my own css for this particular page? If the Mog theme is updated, how will this update affect my page contents?


Make meta box appear if the previous if not empty?

I have created a custom post type with the ability to have multiple featured images. However, it would be nice if i didn't have 10 empty boxes on the post page asking for images... I would like a featured image box to appear if the previous one has been populated.. So, if the featured image is set, then the Image #2 box will appear, and so on.. That way things will be less cluttered. I am not sure if this is possible, any help would be appreciated. I've tried:               if( $custom_meta_id['feature-image-3'] !== '') {                 new MultiPostThumbnails(array(             'label' => '4th Image',             'id' => 'feature-image-4',             'post_type' => 'listing'             )         );          }


Login/Register redirect user with message

I am working on a Wordpress website where I am trying to redirect the user after he just registered or logged in but I also want to have access to the error or success messages once on the homepage (I use session variables for that). For the log, I use the filter `authenticate` and by applying the filter `wp_authenticate_username_password` I am able to get the error messages, put them in my session variable and redirect the user. For the registration, I use the action `register_post` and by applying the filter `registration_errors` I am also able to get the error messages and redirect the user. Although, where I struggle is that I am realizing that the filter `authenticate` is also called when registering and sending an email when forgotten password. Therefore, when the registration is a success I am getting a login error instead of my success registration message. I hope my problem is clear to you. How would you do this? Which hook would you use for each? Thank you very much, regards. Here is the code (big part of it is where I am customizing the error messages):               add_filter( 'authenticate', 'redirection_login_fail', 99, 3);     add_action('register_post', 'redirect_registration_fail', 29, 3);          function redirect_registration_fail( $sanitized_user_login, $user_email, $errors ){         // Fetch error messages         $errors = apply_filters( 'registration_errors', $errors, $sanitized_user_login, $user_email );         // Create session variable thast will contain eror messages         $_SESSION['redirect_message'] = array();         if (is_wp_error($errors)) {             $new_errors = new WP_Error();             $codes = $errors->get_error_codes();             foreach ($codes as $code) {                 switch($code) {                     case 'username_exists':                         $new_errors->add('username_exists', __('Unfortunately this username is already registered. Please choose another one.'));                         break;                     case 'email_exists':                         $new_errors->add('email_exists', __('Unfortunately this email is already registered. Please choose another one.'));                         break;                     default:                         $new_errors->add('registration_failed', __('Unfortunately your registration has failed. Please try again.'));                         break;                 }             }             $_SESSION['redirect_message_type'] = 'error';             $_SESSION['redirect_message'] = $new_errors->get_error_messages();         }         else {             $_SESSION['redirect_message_type'] = 'success';             $_SESSION['redirect_message'][] = 'Registration complete. Please check your e-mail.';         }         // Redirect user         wp_redirect(home_url());     }          /*      * Redirection home on fail login      */     function redirection_login_fail( $user, $username, $password )     {             if ( is_a($user, 'WP_User') ) { return $user; }              $_SESSION['redirect_message'] = array(); // init message         $_SESSION['redirect_message_type'] = 'error';              if ( empty($username) || empty($password) )         {             $error  = new WP_Error('authentication_failed', __('You must specify a valid username and password.'));              $_SESSION['redirect_message'] = $error->get_error_messages();                 }         else {             $errors = apply_filters('wp_authenticate_username_password', $user, $username, $password);             if (is_wp_error($errors)) {                 $new_errors = new WP_Error();                 $codes = $errors->get_error_codes();                 $messages = $errors->get_error_messages();                 $errs = array();                 for ($i=0;$i<count($codes);++$i) {                     $errs[$codes[$i]] = $messages[$i];                 }                 foreach ($errs as $code => $message) {                     switch($code) {                         case 'incorrect_password':                             $matches = array();                             $pattern = "/(.*)<\/strong>/";                             preg_match($pattern, $message, $matches);                             $new_errors->add('incorrect_password', __('Unfortunately the password you entered for the username '.$matches[1].' is incorrect. Forgot your password?'));                             break;                         case 'invalid_username':                             $new_errors->add('invalid_username', __('Unfortunately this is an invalid username. Forgot your password?'));                             break;                         default:                             $new_errors->add('authentication_failed', __('Unfortunately these credentials are incorrect. Forgot your password?'));                             break;                     }                 }                 $_SESSION['redirect_message'] = $new_errors->get_error_messages();             }         }              // Redirection         wp_redirect(home_url());     }


How to add a box for list items?

I need to add a box so a client can put their own images onto a carousel type slideshow, javascript just outputs the li of each instance it finds. However I cant find a way to create a box where the user can just press enter, add an image, press enter, add an image etc. How can I achieve this? Many thanks


Custom Meta Box Causing Error: "Are you sure you want to do this? Please try again."

My custom post type have a meta box that is listing another custom post types in its meta box. And it is causing error each time I try to publish a post with that custom post type. It is always bring to a page that say "Are You Sure You Want To Do This? Please Try Again". It does not have any problem in my localhost, but does not work when I run it on my web hosting. Here is the codes:               add_action( 'add_meta_boxes', 'ind_pricing_tables_boxes' );          function ind_pricing_tables_boxes() {         $screens = array( 'indtable' );         foreach ($screens as $screen) {         add_meta_box('indtable_boxid', __( 'Pricing Table', 'pricing_table' ), 'ind_pricing_tables_boxes_form', $screen );         }     }          function ind_pricing_tables_boxes_form() {         global $post;             wp_nonce_field( 'ind_pricing_table_box_nonce' );         $ind_table_packs = get_post_meta($post->ID, "_ind_meta_table_keypacks", true);         $ind_table_packs = ($ind_table_packs == '') ? array() : json_decode($ind_table_packs);              $query = new WP_Query(array(                     'post_type' => 'indpackage',                     'post_status' => 'publish',                     'posts_per_page' => -1,                     'orderby' => 'post_date',                     'order' => 'ASC'                         )         );              $ind_form_box  = '
';         $ind_form_box  .= "
                         Select Package                   	                                            Package Names
";              while ($query->have_posts()) : $query->the_post();             $checked_whichs = (in_array($query->post->ID, $ind_table_packs)) ? "checked" : "";             $ind_form_box  .= "
                         <input type='checkbox' name='pricing_ind_table_packages[]' $checked_whichs value='" . $query->post->ID . "' />                   	" . $query->post->post_title . "
";              endwhile;              $ind_form_box  .= '
';              echo $ind_form_box ;     }      What causing the error? **Save metabox function**               function ind_save_pricing_boxtables($post_id) {              if (!wp_verify_nonce($_POST['ind_pricing_table_box_nonce'], basename(__FILE__))) {             return $post_id;         }              if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {             return $post_id;         }              if ('indtable' == $_POST['post_type'] && current_user_can('edit_post', $post_id)) {                  $pricing_ind_table_packages = (isset($_POST['pricing_ind_table_packages']) ? $_POST['pricing_ind_table_packages'] : array());             $pricing_ind_table_packages = json_encode($pricing_ind_table_packages);                  update_post_meta($post_id, "_ind_meta_table_keypacks", $pricing_ind_table_packages);         } else {             return $post_id;         }     }


Stop wptexturize from texturizing my shortcode

I have a script outside of Wordpress that generates an HTML file a few hundred times a day. I figured the best way to get the contents of this file in to a specific page would be a shortcode. I wrote one that looks something like this:               function get_special_content($atts) {         remove_filter('the_content', 'wpautop');         remove_filter('the_content', 'wptexturize');         return file_get_contents('/somewhere/somefile.html');     }     add_shortcode('SPECIAL_SHORTCODE', 'get_special_content');      It works great, however the problem is that `wptexturize` is trashing the HTML. I have a few lines that look like this:
...
      However the output that gets sent to the browser looks like this:
...
      Notice that the closing `"` is removed! I thought calling the `remove_filter()` inside the shortcode function would remove it but apparently not. I've also tried setting priorities to 1, 9, 10, 11, and 99. I've also tried this and this and nothing works. I'm running WordPress 3.4.1.


Mixing l18n string from my plugin with WordPress' translations

I recently asked a question about l18n for WordPress terms like "Taxonomy", "Plugin", "Custom Post Type", etc. I was wanting to get some input on whether to translate these terms or not. Scribu made a great point suggesting that WordPress translates them and therefore, they should be translated in plugins. Also, he made a great suggestion that I could use the WordPress translations if I do not assign these terms a new textdomain. My new question is, how would this be best implemented. For instance, imagine I had an text input and I wanted to label it with "Taxonomy Name". Would it make sense to do the following:               <label><?php echo __('Taxonomy') . ' ' . _x('Name', 'text input label', 'my_plugin_domain'); ?></label>      This looks hideous, but I would be able to take advantage of WordPress' l18n. Also, I'm uncertain of this method because it does not take advantage of argument swapping with printf. I'm not sure if you can mix the WordPress and custom l18n within argument swapping. Any advice on how to go about handle this?


Where can I sell WordPress themes and plugins?

I've been building some WordPress themes and plugins. What are the online marketplaces I can sell them?


How do I amend the fixed "author" part in the URL?

I am creating a localized instance of WordPress and one can easily configure the category and tag parts of the URL but I cannot find anything similar for authors. So for instance I get this:               http://mysite.com/author/borekb      instead of               http://mysite.com/autor/borekb      which would be appropriate in my language. How to achieve that? (And BTW, can "borekb" be replaced with something like "borek-bernard", i.e. full name slug instead of username?)


Multilanguage Post Titles not Translating with List Category Posts Plugin

For the most part the plugin List Category Posts works great. I just have one problem with it: when I try to show the title and excerpt of a post it shows all translations at the same time, rather than just the translation relative to the selected languages. I'm using qTranslate for the languages. I'm not sure how to fix that.


Two Ways Of Creating Wordpress Options Pages

I'm about to create my own options pages for my WordPress theme and I'm a bit confused. I've seen a lot of themes that used arrays to generate options pages, it looked like this:               $options = array (               array(    "name" => "Welcome Message",                    "type" => "title"),               array(    "type" => "open"),               array(    "name" => "Title",                    "desc" => "Enter a title to display for your welcome message.",                    "id" => $shortname."_welcome_title",                    "std" => "",                    "type" => "text"),     );      Plus a few other functions that generated front-end, tables, forms etc. On the other hand, there are "static" options pages from Codex ( http://codex.wordpress.org/Creating_Options_Pages ). They look like:               <form method="post" action="options.php">         <?php settings_fields( 'baw-settings-group' ); ?>         <?php do_settings( 'baw-settings-group' ); ?>

             New Option Name	             <input type="text" name="new_option_name" value="<?php echo get_option('new_option_name'); ?>" />

             Some Other Option	             <input type="text" name="some_other_option" value="<?php echo get_option('some_other_option'); ?>" />

             Options, Etc.	             <input type="text" name="option_etc" value="<?php echo get_option('option_etc'); ?>" />

         <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
          </form>      What are pros & cons of these approaches and which one should I use/is preffered?


post preview/thumbnails not displaying correctly- linking to "home" instead of post?

Live site In the lower portion of the landing page, I'd like there to be three blog post previews- just the headline and thumbnail for the three most recent posts. I'm using the following code:               <?php get_header(); ?>

Hi, I'm Dylan Elchami-
a health and fitness enthusiast with a passion for inspiring.

My interests are vast and ever changing, but my virtues remain true. I love to motivate, create, make people healthier, stronger, sexier, and flat out better all while building great, unmitigated relationships along the way. Please roam my site and enjoy all the information I post for you, and if you have a question please don't hesitate to contact me- it's your way of giving back for all the free information because helping you is what makes me feel AWESOME.

Stay in touch-

<img src="<?php echo get_template_directory_uri(); ?>/img/facebook.png" alt="Like on Facebook" />

<img src="<?php echo get_template_directory_uri(); ?>/img/twitter.png" alt="Follow on Twitter" />

<img src="<?php echo get_template_directory_uri(); ?>/img/linkedin.png" alt="Connect on LinkedIn" />

                         <a href="<?php the_permalink(); ?>"><?php the_title(); ?>

                         <?php $my_query = new WP_Query( array( 'posts_per_page' => 3, 'nopaging' => true ) ); while ( $my_query->have_posts() ) : ( $my_query->the_post() ); ?>                         <?php endwhile; ?>

          <?php get_sidebar(); ?>          <?php get_footer(); ?>      I have `add_theme_support( 'post-thumbnails' );` in functions.php As you can see on the site, the link where the previews should be says "Home" and doesn't have a thumbnail. How do I show the most recent 3 posts as previews and have them actually link to the post(not home)?


Custom registration form and custom field

I've created a custom registration form for my website with this code:               <?php         /*         Template Name: Registrazione-Custom         */         get_header(); ?>

                                      <?php get_template_part('/includes/content', 'page'); ?>
                     <?php                  $err = '';                  $success = '';                            global $wpdb, $PasswordHash, $current_user, $user_ID;                  if(isset($_POST['task']) && $_POST['task'] == 'register' ) {                      $pwd1 = $wpdb->escape(trim($_POST['pwd1']));                      $pwd2 = $wpdb->escape(trim($_POST['pwd2']));                      $first_name = $wpdb->escape(trim($_POST['first_name']));                      $last_name = $wpdb->escape(trim($_POST['last_name']));                      $email = $wpdb->escape(trim($_POST['email']));                      $username = $wpdb->escape(trim($_POST['username']));                           if( $email == "" || $pwd1 == "" || $pwd2 == "" || $username == "" || $first_name == "" || $last_name == "") {                          $err = 'Devi compilare tutti i campi obbligatori';                      } else if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {                          $err = 'Indirizzo email non valido.';                      } else if(email_exists($email) ) {                          $err = 'Indirizzo email gi&agrave registrato.';                      } else if($pwd1 <> $pwd2 ){                          $err = 'Le password non corrispondono.';                              } else {                                    $user_id = wp_insert_user( array ('first_name' => apply_filters('pre_user_first_name', $first_name), 'last_name' => apply_filters('pre_user_last_name', $last_name), 'user_pass' => apply_filters('pre_user_user_pass', $pwd1), 'user_login' => apply_filters('pre_user_user_login', $username), 'user_email' => apply_filters('pre_user_user_email', $email), 'role' => 'subscriber' ) );                          if( is_wp_error($user_id) ) {                              $err = 'Errore in fase di registrazione, nome utente gi&agrave registrato';                                    } else {                              do_action('user_register', $user_id);                                    $success = 'You\'re successfully register';                          echo '';                          // e inviamo una mail con la riuscita registazione              mail ($email, "Registrazione Mio Sito", "Complimenti registrazione effettuata con successo. Ti ricordiamo i tuoi dati per l'accesso al sito username: $username, e password: $pwd1", "From: miosito@miosito.it");                                     // e inviamo una mail ad admin di registrazione nuovo utente              mail ("miosito@miosito.it", "Registrazione Nuovo Utente Area Riservata", "Il nuovo utente $first_name $last_name con nome utente $username si è appena registrato all'area registrata del sito Alpe Adria Insurance Brokers", "From: miosito@miosito.it");                                         wp_set_current_user( $user_ID, $current_user );                               do_action('set_current_user');                               $redirect_to = site_url('www.google.it');                               var_dump($redirect_to);                                         wp_safe_redirect($redirect_to);                          }                                }                            }                  ?>
                      <?php                           if(! empty($err) ) :                              echo '
'.$err.'
';                          endif;                      ?>                                <?php                           if(! empty($success) ) :                              echo '
'.$success.'
';                          endif;                      ?>
                            <form method="post">
Registrati al Portale Mio Sito

                      Cognome*                      <input type="text" value="" name="last_name" id="last_name" style="width: 50%;" />                      Nome*                      <input type="text" value="" name="first_name" id="first_name" style="width: 50%;" />                      Email*                      <input type="text" value="" name="email" id="email" style="width: 50%;" />                      Username*                      <input type="text" value="" name="username" id="username" style="width: 50%;" />                      Password*                      <input type="password" value="" name="pwd1" id="pwd1" style="width: 50%;" />                      Reinserisci Password*                      <input type="password" value="" name="pwd2" id="pwd2" style="width: 50%;" />

<?php if($sucess != "") { echo $sucess; } ?> <?php if($err != "") { echo $err; } ?>

Compilando il seguente form di registrazione il cliente accetta quanto previsto nel disclaimer
                      <button type="submit" name="btnregister" class="button" >Registrati</button>                      <input type="hidden" name="task" value="register" />                  </form>

                                <?php get_sidebar( 'right' ); ?>                        <?php get_footer(); ?>      I want to add some custom fields on my custom registration form. If I need to add the custom field on the default registration form, I know that I must use this code in functions.php:                //Aggiunta del nuovo elemento al form di registrazione         add_action('register_form','myplugin_register_form');              function myplugin_register_form (){             $hobby = ( isset( $_POST['hobby'] ) ) ? $_POST['hobby']: ''; //salvataggio del campo hobby             ?>
                 <?php _e('Hobby principale','registrazione-utenti') ?>
                     <input type="text" name="hobby" id="hobby" class="input" value="<?php echo esc_attr(stripslashes($hobby)); ?>" size="25" />
             <?php         }              // Validazione dei dati inseriti.         add_filter('registration_errors', 'myplugin_registration_errors', 10, 3);         function myplugin_registration_errors ($errors, $sanitized_user_login, $user_email) {                  if ( empty( $_POST['hobby'] ) ) // il campo hobby è obbligatorio e non può essere vuoto                 $errors->add( 'hobby_error', __('ERROR: Devi inserire un hobby principale','registrazione-utenti') );                  return $errors;              }              // Salvataggio dei dati         add_action('user_register', 'myplugin_user_register');         function myplugin_user_register ($user_id) {             if ( isset( $_POST['hobby'] ) )                 update_user_meta($user_id, 'hobby', $_POST['hobby']);         }               /*      * Visualizzazione dei dati aggiuntivi nel back end      *       * */                add_action('show_user_profile','show_the_new_meta_values'); // hook usato quando un utente sta visualizzando il proprio profilo      add_action('edit_user_profile','show_the_new_meta_values'); // hook usato quando un utente sta visualizzando il profilo di un altro utente           function show_the_new_meta_values($user)      {              $hobby= get_user_meta($user->ID,'hobby', true);         ?>
<?php _e('Informazioni aggiuntive','registrazione-utenti')?>

                     <?php _e('Hobby principale','registrazione-utenti') ?>	                     <input type="text" name="hobby" id="hobby" value="<?php echo esc_attr($hobby); ?>" class="regular-text" />

         <?php      }                     //aggiornamento dei dati     add_action('personal_options_update', 'update_the_new_meta_values');     add_action('edit_user_profile_update', 'update_the_new_meta_values');          function update_the_new_meta_values($user_id)     {              $new_value = $_POST['hobby'];              update_user_meta($user_id,'hobby',$new_value); // dati aggiornati              if ( get_user_meta($user_id,  'hobby', true ) != $new_value ) // controlla che i dati siano stati salavati nel db         wp_die(__( 'Errore nel Database','registrazione-utenti' ) );     }      But, how do I add the custom field on my custom registration form? Thanks


How do I get the author's page url from their ID?

What is the best way to get the author's page url, so http://example.com/author/user73, from their ID number?


wp_get_archive for category returning different URLs on different but similar sites

I have this code on two different sites in the sidebar:
         <?php wp_get_archives('cat=2&show_post_count=true'); ?>
      and this code in the main content area:               <?php if ( have_posts() ) : ?>         <?php while (have_posts()) : the_post(); ?>
<?php the_title(); ?>

Posted on <?php the_time('l F j, Y'); ?>
             <?php the_content(); ?>             <?php if(($wp_query->current_post + 1) != $wp_query->post_count): // SHOW GREY BAR ONLY IF NOT ON LAST POST ?>

             <?php endif; ?>         <?php endwhile; ?>     <?php else : ?>
This site is so new that there is no archive yet!
     <?php endif; ?>      On both sites, the main content area works great, but the monthly links in the sidebar return differently. On one site (WP 3.4), each month's link has `?cat=2` at the end, while the other site (WP 3.6.1) does not. The result of this is that if I click on a month in the sidebar on the older site, it works great, but it fails on the newer site and brings up my home page but with the address for the month. And if I go add `?cat=2` to the end of the link in the address bar, it works great. As you might guess, I am using a lot of code from the old site (developed for me by someone else) in the new site that I am developing for someone else. I have similar `category-news.php` file in both site's themes. What could be causing the different outcome?


Removing "HTTP://" From the_author_meta?

By default WordPress prints http:// in front of URLS users add in their profile, which are called using the following code:               <?php the_author_meta('user_url'); ?>      Could somebody provide me the code to strip these URLS of "HTTP://" by default? (While still working as a link and not touching WP's backend... I assume this could be a function?)


Does a low traffic Wordpress site need a caching plugin and a CDN

I notice that many Wordpress tips websites recommend using wp totalchache and similar plugins. I tried it on one site that gets a relatively small amount of traffic, and hardly notice a difference in load time. Is it smart to set up as a general rule, or does it it really depend on the site traffic? Same question for Content delivery Network.


How to add a new menu/submenu page in WPMVC?

I'm completely new to WPMVC. Followed and finished their tutorial for creating plugins. Now I'm trying to add a search page to search `Venues` (that comes from their example!). This page should appear as a submenu page of the `Venues` menu. I created a file named `search.php` in the `app/views/admin/venue/search` folder. What should I do now? Googling didn't help much! Any help regarding this (and any other stuff a noob should learn to get better with WPMVC) is welcome!


Announces with different formatting dependently on a number

I am modifying the theme TwentyEleven. In index.php there is the loop which accesses content.php template:               <?php while ( have_posts() ) : the_post(); ?>            <?php get_template_part( 'content', get_post_format() ); ?>          <?php endwhile; ?> The trouble is that I need different formatting (different classes) for odd and even posts. How to do this? My only idea is to remove content.php and insert the code directly to index.php with variable $i counting the position in the loop (by ++$i). But that's bad.


How to display message (with switch_theme hook) after deactivating My theme?

I'm able to display a message by activation of my theme with the 'new' after_switch_theme hook this way:               function themeActivationFunction($oldname, $oldtheme=false) {     $msg = '

The ' . get_option( 'current_theme' ) . ' theme has been ACTIVATED.

';         add_action( 'admin_notices', $c = create_function( '', 'echo "' . addcslashes( $msg, '"' ) . '";' ) );          }     add_action("after_switch_theme", "themeActivationFunction", 10 ,  2);      But it does not work with the swith_theme hook for deactivation of my theme. I think because by switching the theme to another one to default WordPress message overwrites my message stucking in the theme that gets deactivated and the reload of the screen deletes everything.               function themeDeactivationFunction($theme) {     // Lets let the admin know whats going on.             $msg = '

Your theme has been DEACTIVATED

';         add_action( 'admin_notices', $c = create_function( '', 'echo "' . addcslashes( $msg, '"' ) . '";' ) );     }     add_action("switch_theme", "themeDeactivationFunction", 10 , 2);      I'm looking for a 'work around' to notify a user about deactivating my theme and the setup routine after it.


rewrite rules social share links

Within the Ultimatum's theme childtheme.php I've added rewrite rules to the rewrite rules and it works perfectly fine. However, it does not work if the URL is shared in Facebook or Twitter. The Facebook debugger returns "Could Not Follow Redirect Path" for any of the pages using the rewrite rule. URL to try: http://www.teamrealty.ca/listing- details/839215/res/5801-Longhearth-Wa/ debugger: https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.teamrealty.ca%2Flisting- details%2F839215%2Fres%2F5801-Longhearth-Wa%2F ### rewrite rules function               function AddRewriteRules ($ar_rules)     {         $ar_new_rules = array('listing-details/([^/]+)/([^/]+)/([^/]+)/?$' => 'index.php?pagename=listing-details&mls=$matches[1]&ret=$matches[2]');         $ar_rules = $ar_new_rules + $ar_rules;         return $ar_rules;     }     // hook add_rewrite_rules function into rewrite_rules_array     add_filter('rewrite_rules_array', 'AddRewriteRules');


building custom simple shopping cart using wordpress plugin

i want to build custom wordpress base shopping cart using plugin, i'm new to building plugin, i can build theme easily. i have custom table which i can use as custom post types too that will act as products. now i want to create a plugin that add link "add to cart" to post detail page that when clicked add entry to cart table ( custom table ) this is the only way right ? i have searched but could't find help anywhere how i can add link the way i want, can someone guide me to a tutorial or article how to do it. i don't need checkout functionality just add to cart and email to admin. i need help not down vote.


Auto play video full screen and redirect

I am having trouble locating a plugin or finding out how to create a page that auto plays youtube video and after it's finished playing, redirects it to another page. Lightbox does not work for me since I need embedded video. If there is no solution using Wordpress, I can use html/js.


wp_insert_post questions

I'm trying to add posts using `wp_insert_post`, but a few issues occur. First the code:               function importposts() {              $fh_import = @fopen( dirname( __FILE__ ) . '/importposts.txt', 'r' );              if ( $fh_import ) {             while ( ( $line = fgets( $fh_import ) ) !== false ) {                 $ids = explode( '*', $line );                 array_walk( $ids, 'trim' );           $postdate = date('2014-06-19 00:30:00');     $postdate_gmt = date('2014-06-19 04:30:00');          $post = array(       'post_content'   => $ids[2],       'post_name'      => $ids[5],       'post_title'     => $ids[0],       'post_status'    => 'draft',       'post_type'      => 'post',       'post_author'    => '5',       'ping_status'    => 'closed',       'to_ping'        => 'http://rpc.pingomatic.com/',       'post_date_gmt'  => $postdate_gmt,       'post_date'  => $postdate,       'post_category'  => array($ids[6]),     );          $post_id = wp_insert_post( $post, $wp_error );     update_field( "field_1", $ids[0], $post_id );          $myFile = "postid.txt";     $fh_export = fopen($myFile, 'w') or die("can't open file");     $stringData = $post_id.'@'.$ids[5].'\n';     fwrite($fh_export, $stringData);     fclose($fh_export);             }         }              }      And here's an example of what the `importposts.txt` file looks like:               text-text with line breaks???-text-text-text-text-11,12,13,14     text-text with line breaks???-text-text-text-text-11,12,13,14     text-text with line breaks???-text-text-text-text-11,12,13,14      **The questions:**   1. The second field in the text file is the actual body of the post - how could I insert line break symbols into it, without actually breaking the line of the text file, but I still need the post to have line breaks?   2. The last field contains all the category id's seperated by comma - I don't know how many categories each post has so I have to put them all into one single field. Is it possible to assigna a variable inside an array like this: `'post_category' => array($ids[6])` or what other alternative are there?   3. Any ideas why nothing is written to `postid.txt` and no errors given?


Auto create post title in admin

I want to be able to generate titles automatically for a certain custom post type in WP admin. Been looking for a solution but I'm not sure if I'm headed in the right direction by adding this hook -               add_filter('the_title', 'cpt_title_filter');     function cpt_title_filter($title) {         global $post;         if ($post->post_type == 'time') {             $title = 'sample headline';         }         return $title;     }      The generated title will be a date suffix, we'll leave a sample text there for now. This snippet is added just below of the "time" cpt setup in functions.php. As I have other cpts that don't require this function I also need to be able to check for a particular cpt in the function. What happens now is I get a blank field, and I assume the function is not in effect.


How to use is_single and get_post_type within a plugin?

I am trying to use the above two functions within a plugin I am trying to build and obviously they don't work because plugins are loaded before a page is ready and before a post is loaded to know what post type it is. Which that said, how can I work around that? I am just trying to do something simple like so:               if ( is_single() && get_post_type() == 'boxy' ) {     $setting = 200;     }      But this statement never becomes true per above reasons. Thanks for the help!


Syntax help needed: Taxonomy Query

I have a template called `taxonomy-book_style.php` to handle all the terms in book_style. On it I just have a simple loop `<?php if (have_posts()) : while (have_posts()) : the_post();?>` I would like to order my posts by the meta key value found in the meta_key tf_book_sort So far I've tried these but they do not work:               <?php      query_posts( $query_string . 'orderby=meta_value&meta_key=tf_book_sort&order=ASC' );?>     <?php if (have_posts()) : while (have_posts()) : the_post();?>          <?php if (have_posts()) : while (have_posts()) : the_post('meta_key=tf_book_sort&orderby=meta_value&order=ASC'); ?>          <?php      $args = array(     'tax_query' => array(array('taxonomy' => 'book_style')),     'meta_key' => 'tf_book_sort',     'orderby' => 'meta_value',     'order' => 'DESC'     );?>     <?php query_posts ($args);?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>      The nested arrays are confusing, can someone please suggest a proper synatx to accomplish sorting these posts by a meta key value? Thank You.


query_post causes the posts to be loaded twice on load more posts

I am using query_post to randomize the posts in a custom post type. However this causes the posts to be loaded reloaded when i load more posts in. Below is my code:               <?php query_posts($query_string . '&orderby=rand'); ?>             <?php if (have_posts()) : ?>
                 <?php while (have_posts()) : the_post(); ?>                     <article id="post-<?php the_ID(); ?>" class="col-lg-4 work">
                             <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">                                 <?php the_post_thumbnail('full', array('class' => 'img-responsive'));   ?>
                                 <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">                                     <?php the_title(); ?>

                      <?php endwhile; ?>
             <?php endif; wp_reset_query(); ?>      If i remove query_posts and just use the have_posts it doesn't load the posts in twice, but doesn't randomize it. * * * Update: I have tried changing it to use wp_query and I still get the same problem with it loading in duplicate posts.               <?php $loop = new WP_Query( array( orderby => 'rand', 'post_type' => 'artist' ) ); ?>                  <?php if (have_posts()) : ?>
                 <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>                     <article id="post-<?php the_ID(); ?>" class="col-lg-6 work">
                             <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">                                 <?php the_post_thumbnail('full', array('class' => 'img-responsive'));   ?>
                                 <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">                                     <?php the_title(); ?>

                      <?php endwhile; ?>
             <?php endif; wp_reset_query(); ?>


Display Taxonomy Term Children in a Drop Down without Submit Button

I have a custom Post Type "Portfolio" with Custom Taxonomy "Portfolio Categories" and Terms within that Taxonomy are "Branding", "Print", "Web" and "Multimedia". Each of these have Child Terms. I would like to display a separate drop down for each Term (Branding, Print, Web and Multimedia) that displays its Child Terms in a drop down. Once a Child Term is selected, it will immediately bring you to an archive of the Child Term without having to click a submit button. The following code works for Categories but I can't figure out how to modify for the Taxonomy Terms.

<?php _e('Posts by Category'); ?>
         <form action="<?php bloginfo('url'); ?>/" method="get">
     <?php     $select = wp_dropdown_categories('show_option_none=Select category&show_count=1&orderby=name&echo=0');     $select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);     echo $select;     ?>
<input type="submit" value="View" />

</form>
      Any help would be greatly appreciated. OK, I have the following code that displays a list of child term links but it needs to be modified into a drop down.               <?php     $term_id = TERM_ID_HERE;     $taxonomy_name = 'TAXONOMY_NAME_HERE';     $termchildren = get_term_children( $term_id, $taxonomy_name );          echo '
';     foreach ( $termchildren as $child ) {         $term = get_term_by( 'id', $child, $taxonomy_name );         echo '
' .     $term->name . '
';     }     echo '
';     ?>


child comments not displaying as nested

I'm having some trouble getting my comments to display as nested from other comments. My current max level of depth is set to 5 through the wordpress admin panel, but all my comments appear on the same level, whether they be replies of previous or new comments. I've searched for other solutions to this problem, but it seems very specific. Take a look to see an example: http://blog.diginomics.com/bitcoins-innate-regulation/ Here is my code under functions.php:                   $GLOBALS['comment'] = $comment; ?>          <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">         <div class="comment <?php if($isByAuthor){ echo 'author';}?>" id="comment-<?php comment_ID(); ?>">
                 <?php echo get_avatar( $comment->comment_author_email, 80 ); ?>
                  <?php if ($comment->comment_approved == '0') : ?>             <?php _e('Your comment is awaiting moderation.') ?>             <?php endif; ?>
                       <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>      I believe this requires me to define some sort of walker class. Here is my current walker set to null under the wp_list_comments() $args:                                   <?php $args = array(                         'walker'            => null


wp_insert_post disable HTML filter

I have input value "`<iframe>....</iframe>`" (param 'post_content'). When i execute wp_insert_post, function cut off my tag. How to disable HTML filter in **wp_insert_post** ?


Adding custom HTML to each profile group tab

Hopefully someone can help. I am looking to add a different image banner to each of the profile group tabs I have on my Buddypress site. I have identifed the profile-loop.php as the file I need to include this on but when I try the following code it breaks the profile section of my site:               <?php if ( bp_the_profile_group_name() == 'About') ) : ?>
Testing
          <?php endif; ?>      Can anyone suggest how I might target the About group on my site and insert custom HTML? Thanks


Upload image without media-upload

I've been looking a while and didnt found: How to create simple, old, good, upload via 'Browse' button and 'Dir' field that will upload and return image url. I dont want to use media-upload. Would be nice to use wordpress image functions like croping, checking size etc.


Is there a way to add a custom input field for every taxonomy term in WP post editor?

I've created a custom taxonomy for my posts, and I was wondering if there is a way to add an extra input field (a text input) for every taxonomy term inside the edit post panel. What I want is not a simple taxonomy meta field, because meta fields are always the same for each term in each post. Here's an example of what I want. Let's say I have a taxonomy called "personality", and the terms are:   \- cheerfulness   \- lazyness   \- extroversion   I want to be able to add a score to everyone of these terms, but different for every post. For example, post number one called Mark has   \- cheerfulness 10   \- lazyness 5   \- extroversion 8   Post named Mary   \- cheerfulness 2   \- lazyness 9   \- extroversion 3   etc. To achieve this I think I should have an input field next to every taxonomy term. Too complicated? I guess new database tables must be created in order to do this. Any idea? Someone ever did something like this?   Thanks!


How to use same email for multiple users?

This is a newbie follow-up question on the solution for how to use the same email address for multiple users presented here: How to use same email for multiple users My question: where do I add this code (file name and location in file)? I know this is probably extremely obvious to someone with even a little experience with Wordpress development. Any direction / help would be most appreciated. Thanks, Mike


Where do I put the code snippets I found here or somewhere else on the web?

Many posts here or somewhere else contain code, but they do not say where to put it. Example: I have found this post: How do I turn off 301 redirecting posts (not canonical)?   I'm a newbie with PHP. Where exactly should I place the code from the answer?


Some images 404

I migrated our old blog to the same server in the main root. For some reason a couple of images won't load up any more even when they are in the /uploads/ folder. When going to them as a URL I'm getting 404's but I can download them straight from my FTP (and work). Does anyone know what the problem might be? I was thinking of my .htaccess file but I'm not sure it this is the problem:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          Options +FollowSymlinks     RewriteEngine on     rewritecond %{http_host} ^dreamix-studio.com [nc]     rewriterule ^(.*)$ http://www.dreamix-studio.com/$1 [r=301,nc]     # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress


Create a page that will be used to create a custom post type

I have created an 'event' custom post type and now I want to create a page that will allow users to create a custom post type from the front-end. Is there a standard way of doing this? I could create a template and then link it to a page that I create manually in the wordpress backend, but I would rather do it programatically if possible. Any suggestions?


How can I get dynamic content on my static home page

Sorry for this but I am sure this is a duplicate question, but I have been searching, but I cannot find a suitable answer for this question. I hope you still can help. I want to create a website with a few static pages, and a blog. Now on one of the static pages, the portfolio page, I want to have all of my work in boxes in a list. Just like you would have blog posts. Now I not want to create a post for each of the work I have done, because it will mingle with the blog I guess. Is there another option on WP to have snippets of content, just as posts, which could be loaded into a page. Or should I just create the whole portfolio page just as a big static page.


Front-end ajax login form broken after WP4.0 upgrade

A site I manage has a a simple form a user can click on to login using ajax. It worked great until I upgraded to wordpress 4.0 Here is the relevant code: `Function.php`:               function planet3_0_login_init(){              wp_register_script('ajax-login-script', get_template_directory_uri() . '/js/login-script.min.js', array('jquery') );          wp_enqueue_script('ajax-login-script');              wp_localize_script( 'ajax-login-script', 'ajax_login_object', array(              'ajaxurl' => admin_url( 'admin-ajax.php' ),             'redirecturl' => 'http://' . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"],             'loadingmessage' => __('Logging in, please wait...')         ));              // Enable the user with no privileges to run ajax_login() in AJAX         add_action( 'wp_ajax_nopriv_ajaxlogin', 'planet3_0_login' );     }          // Execute the action only if the user isn't logged in     if (!is_user_logged_in()) {         add_action('init', 'planet3_0_login_init');     }          function planet3_0_login(){              // First check the nonce, if it fails the function will break         check_ajax_referer( 'ajax-login-nonce', 'security' );              // Nonce is checked, get the POST data and sign user on         $info = array();         $info['user_login'] = $_POST['username'];         $info['user_password'] = $_POST['password'];         $info['remember'] = true;              $user_signon = wp_signon( $info, false );         if ( is_wp_error($user_signon) ){             echo json_encode(array('loggedin'=>false, 'message'=>__('Wrong username or password.')));         } else {             echo json_encode(array('loggedin'=>true, 'message'=>__('Login successful, redirecting...')));         }              die();     }      `login-script.js`:               jQuery(document).ready(function($) {              // Show the login dialog box on click         $('a#show_login').on('click', function(e){             $('body').prepend('

');             $('form#login').fadeIn(500);             $('div.login_overlay, form#login a.close').on('click', function(){                 $('div.login_overlay').remove();                 $('form#login').hide();             });             e.preventDefault();         });              // Perform AJAX login on form submit         $('form#login').on('submit', function(e){             $('form#login p.status').show().text(ajax_login_object.loadingmessage);             $.ajax({                 type: 'POST',                 dataType: 'json',                 url: ajax_login_object.ajaxurl,                 data: {                      'action': 'ajaxlogin', //calls wp_ajax_nopriv_ajaxlogin                     'username': $('form#login #username').val(),                      'password': $('form#login #password').val(),                      'security': $('form#login #security').val() },                 success: function(data){                     $('form#login p.status').text(data.message);                     if (data.loggedin == true){                         document.location.href = ajax_login_object.redirecturl;                     }                 }             });             e.preventDefault();         });          });      And finally the form itself:                       <form id="login" action="login" method="post">                 [close]
Planet3.0 Login

                 Username                 <input id="username" type="text" name="username">                 Password                 <input id="password" type="password" name="password">                 <a class="lost" href="<?php echo wp_lostpassword_url(); ?>">Lost your password?                 <input class="submit_button" type="submit" value="Login" name="submit">                 <?php wp_nonce_field( 'ajax-login-nonce', 'security' ); ?>             </form>      As I said before, this code flawlessly before upgrading to 4.0, and now doesn't work. When hitting submit the form will display `Wrong username or password.` when an incorrect username is given. However when username and password are correct, or the username is correct and the password is incorrect is gets stuck displaying the message `Logging in, please wait...`. Any help, or pointers in the right direction would be greatly appreciated.


checkbox in post add/edit to add/remove the post from menu

**Introduction:** I have created several post type for my theme. To display a post from a post- type I need to go in appearance/menu and then add the post manually. **My Goal:** I want to add two radio buttons in the post add/edit page to choose whether the current post will be in menu. **Attempts:** So I have created the checkbox in post-type add/edit page. Looks like ![enter image description here](http://i.stack.imgur.com/CsHHO.png) Everything works fine, the status is saved, now I want before saving to add/remove it in the menu list as sub-menu with for parent its post-type, how could I achieve that? Here is what I have done so far:               // create post type     add_action( 'init', 'create_post_type' );     function create_post_type() {              $conf = array(             'public' => true,             'has_archive' => true,             'menu_position' => 5,             'show_in_nav_menus' => true,             'hierarchical' => true,             'has_archive' => true,             'supports' => array('title', 'editor', 'content', 'page-attributes'),             'taxonomies' => array('category', 'post_tag'),                  );              $conf['labels'] = array(             'name' => __( 'Architecte Posts' ),             'singular_name' => __( 'Architecte' )             );         $conf['rewrite'] = array('slug' => 'architect');              register_post_type( 'architect_subpage',$conf);                   $conf['labels'] = array(             'name' => __( 'Interior Posts' ),             'singular_name' => __( 'Interior' )             );         $conf['rewrite'] = array('slug' => 'interior');         register_post_type( 'interior_subpage',$conf);     }          // remove posts menu since it's not in use     function remove_menus () {         global $menu;         $restricted = array(__('Posts'));         end ($menu);         while (prev($menu)){             $value = explode(' ',$menu[key($menu)][0]);             if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}         }     }     add_action('admin_menu', 'remove_menus');                         /* Define the custom box */     add_action( 'add_meta_boxes', 'wpse_61041_add_custom_box' );          /* Do something with the data entered */     add_action( 'save_post', 'wpse_61041_save_postdata' );          /* Adds a box to the main column on the Post and Page edit screens */     function wpse_61041_add_custom_box() {         add_meta_box(             'wpse_61041_sectionid',             'Publish in Menu',             'wpse_61041_inner_custom_box',             'architect_subpage',             'side',             'high'         );     }          /* Prints the box content */     function wpse_61041_inner_custom_box($post)     {         // Use nonce for verification         wp_nonce_field( 'wpse_61041_wpse_61041_field_nonce', 'wpse_61041_noncename' );              // Get saved value, if none exists, "default" is selected         $saved = get_post_meta( $post->ID, 'in_menu', true);         if( !$saved )             $saved = 'no';              $fields = array(             'yes'       => __('Yes', 'wpse'),             'no'     => __('No', 'wpse'),         );              foreach($fields as $key => $label)         {             printf(                 '<input type="radio" name="in_menu" value="%1$s" id="in_menu[%1$s]" %3$s />'.                 ' %2$s ' .                 '
',                 esc_attr($key),                 esc_html($label),                 checked($saved, $key, false)             );         }     }          /* When the post is saved, saves our custom data */     function wpse_61041_save_postdata( $post_id )     {           // verify if this is an auto save routine.           // If it is our form has not been submitted, so we dont want to do anything           if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )               return;                // verify this came from the our screen and with proper authorization,           // because save_post can be triggered at other times           if ( !wp_verify_nonce( $_POST['wpse_61041_noncename'], 'wpse_61041_wpse_61041_field_nonce' ) )               return;                if ( isset($_POST['in_menu']) && $_POST['in_menu'] != "" ){                      update_post_meta( $post_id, 'in_menu', $_POST['in_menu'] );                }     }      https://gist.github.com/roine/4994447


Best practice way to implement custom sections into a WordPress theme

I'm having trouble figuring out the best way to implement custom sections in a WordPress theme. For example I'm making a theme that will have four featured sections on the homepage. These sections will be in there own area, separate from the page content. I know this could be done by adding four widget positions, or one widget position and making the user add four widgets. You could also add the four areas into the theme options panel, or even try and use a page builder plugin. I was wondering if anyone has any advice on which method is best and why? Or any suggestions on alternate methods? Thanks, David


meta queries do 'either/or' checks

I have a meta_query like this , but 'relation' => 'OR' NOT WORKING, Does meta_query only do 'both/and' checks and don't do 'either/or' ?               $args = array(     'post_type' => 'post',     'posts_per_page' => -1,     'meta_query' => array(     'relation' => 'OR',         array(             'key' => 'app_os',             'compare' => 'LIKE',               'value' => 'iPhone',           ),         array(             'key' => 'app_os',             'compare' => 'LIKE',               'value' => 'iPad',           )     )      ); $query = new WP_Query( $args ); Thanks in advanced.


How can I add a css rule to edit.php?

I'm using add_filter('manage_posts_columns') in my plugin.php to add a column to the Edit Posts listing which is driven by edit.php. How can I attach a css style to the edit.php? I want to be able to color the background of my column td.


Specific Loop For 2 <div> Within Each <li>

I need to create a loop that can logically be described as the following for a carousel: Requirements:   * 3 Loops   * 2 Posts Per Loop   * No Duplicates   * Order by Post Date Visual:               < Start Loop #1 >     < Post #1 >     < Post #2 >     < End Loop #1 >          < Start Loop #2 >     < Post #3 >     < Post #4 >     < End Loop #2 >          < Start Loop #3 >     < Post #5 >     < Post #6 >     < End Loop #3 >      Ideally, I would like a solution that could carry on infinite loops this way with no duplicates. I looked in the WP codex, but I could not find a specific solution that fit with my code shown here: http://pastebin.com/LitYb0wh How can I make the loop to work with this type of structure?

Post 1

Post 2

Post 3

Post 4

Post 5

Post 6


Using widget logic I want to show only a widget on the archive page if there are no posts

I have a custom post type with it's own taxonomy and I need to display a widget when on a category archive that is ONLY displayed when there are no posts. Currently I'm using this:                is_tax( 'genre' )          in the widget logic so that it only displays for that taxonomy but it is being displayed all the time. When there is a post for that category the widget should disappear. Any suggestions?


How to get links to user and tag by its name?

For example i have the name of user or the name of tag. Is it possible to get direct link to the author or tag? I need something like `get_permalink` for posts.


Make compatible custom menu widget for Twitter Bootstrap

If I configure `wp_nav_menu` function, I can put the "items_wrap" option to achieve a nice navigation given by Twitter Bootstrap, thus: `<ul class="nav nav-pills">%3$s</ul>`. But, how to configure the custom menu widget to do the same? I mean, for achieve `<ul class="nav nav-tabs nav-stacked">%3$s</ul>` in all custom menu widgets, by default. Thanks for help! Have a nice day.


Refine custom posts by author

I want to have a way of displaying a custom post archive for a particular author. I'm able to display custom posts for a category but not just the custom posts for a author. I already have a separate author page template displaying all the posts they have written divided by post type. I'm querying this using :               query_posts(        array(          'post_type' => 'custom_post_name',          'author'=>$curauth->ID        )      );      while (have_posts()) : the_post();      Essentially I want a number of author templates pages for every author.