wp_editor not saving data, and text area showing html tags

This is my custom meta box, here text area showing html tags.i used tinymc textaea editor. and i try to use wp_editor also. but data not saving.if it saved, i don't know how to call it. please help me find solution --THANK YOU--                         <?php     add_action("admin_init", "admin_init");         add_action('save_post', 'save_points');         function admin_init(){         add_meta_box("productInfo-meta", "Product Details", "product_meta_options", "product", "normal", "low");}              function product_meta_options(){             global $post;             $custom = get_post_custom($post->ID);             $category = $custom["category"][0];             $brand = $custom["brand"][0];             $features = $custom["features"][0];             $holds = $custom["holds"][0];     ?>

             Category              <input type="text" size="100" name="category" value="<?php echo $category; ?>" />

             Brand              <input type="text" size="100" name="brand" value="<?php echo $brand; ?>" />

             Features	             <textarea rows="20" cols="100" name="features"><?php echo $features; ?>

             	                          <?php wp_editor( $content, 'test_content', $settings = array('textarea_name'=>'test_content','textarea_rows'=>20) );?>

             Holds             <textarea rows="20" cols="100" name="holds"><?php echo $holds; ?>

          <?php     }          function save_points(){         global $post;         update_post_meta($post->ID, "category", $_POST["category"]);         update_post_meta($post->ID, "brand", $_POST["brand"]);         update_post_meta($post->ID, "features", $_POST["features"]);         update_post_meta($post->ID, "holds", $_POST["holds"]);     }?>


Display latest 10 galleries

I want to create a custom page that will display let's say 20 latest galleries / page - but only the first image from the gallery, not all of them. something like this: http://www.autoblog.it/gallerie/ I've done this:               <?php     $args = array(     'post_type' => 'attachment',     'posts_per_page' => 10,     'post_parent' => $postid,     'numberposts' => 1,     'paged' => $paged,     );     $attachments = get_posts($args);     if ($attachments) {     foreach ($attachments as $attachment) {         echo the_attachment_link($attachment->ID, false, false, true )         echo get_the_title();   }     }?>      it works but what it does is to display latest 10 images, not latest 10 galleries, so first image from each gallery. Please help Thank you


count number of user comments with a specific comment meta value

I am using the code below to count the number of comments by a certain user:               global $wpdb;                  $count = $wpdb->get_var(               'SELECT COUNT( comment_id ) FROM '. $wpdb->comments .'               WHERE user_id = '.$user->ID.'               AND comment_approved = "1"               AND comment_type NOT IN ("pingback", "trackback" )'             );      I am in addition, using a comment meta field ('consider') which takes 0 or 1 as values. To get its value I use:               get_comment_meta($comment_id, 'consider',true);      How can I merge these two operations so that I get the number of comments submitted by the user and which have the meta value `'consider'` equal to `1`? I am not an SQL user and it seems that I need to use inside my SQL query the table `wp_commentmeta`? Your help is always appreciated.


Make Custom Taxonomy Category Use Parent Template

I have a Wordpress custom post type set up in my `functions.php` called "Research" I have a custom taxonomy called "Classifications" Under that taxonomy I have the terms/categories:               Old Research (parent)      --- sub cat 1      --- sub cat 2      I have created the file "taxonomy-Classifications-oldresearch.php" which successfully changes the parent layout for me. However, it does not hold the layout in the sub categories. The sub-category pages revert to another file `taxonomy-Classifications.php` I can alter it by also creating `taxonomy-Classifications- subcat1-oldresearch.php` but I will have a lot of sub categories that I want to use ONE template for - the parent cat template. This way I don't have to create a new template file for every new category.


Keep permalinks in Wordpress

Is there any way to set my permalinks to keep their exact link. If I have a post like this one http://blog.rigo.ro/?p=11, then I would like that every time I edit the post to keep this link. I have installed the Revision Control plugin and I set it to do not keep revisions. Any ideea how to do this? I want to keep this format of links. Edit: I took a look again, the permalinks keep their links, but every time I edit it adds a new version to the database and the next post will have a higher number. If I edit my current post for 3 times (blog.rigo.ro/?p=11) the next post will be blog.rigo.ro/?p=14. Now, my question is how can I keep all my post and edits clean, one post/more edits = one entry in the database, so if I have. 10 post on my site and I edit them, I would like that my permalinks to be from 1 to 10. PS: I don't want to edit my database manually, is there any plugin to do this?


APC object caching in combination Batcache/memcached page caching?

In the post WordPress Caching Comparisons Part 2 Matt Martz compares different caching setups, among them APC object caching together with Batcache page caching. In his post this combination seems to be the best tradeoff between setup complexity and efficiency. He doesn't mention memcached so I'm unsure if it's used or not. From reading Mark Jaquith's post APC Object Cache Backend for WordPress it seems to me that his plugin works as a drop-in replacement backend to be used in place of memcached which is what the Batcache installation instructions says to use. This is also how it has worked in my experiments with these plugins. I.e. either the APC or memcached backend is used, but not together and in combination. However, from watching Iliya Polihronov's High-performance WordPress video (and this is where I started when looking into caching) I got the impression that APC object cache can be used for opcode caching in combination with Batcache/memchached for full page caching, for even better results. (the batcache discussion is at the very end of the video) Is this possible and would there be of any benfit, or am I just confused? In my case I'm looking for the best solution for multiple virtual single- WordPress servers (i.e. not multisite) served by a single webserver (nginx). This runs on solid state media (Raspberry Pi/SD-card) so it would be preferable to keep cache in memory. I have full access to the system and have apc, memcache and memcached extensions installed. **edit:** From reading the Batcache source my understanding is that Batcache uses whatever is offered by `object-cache.php`, so it's either APC or memcached object cache as used exclusively by the respective backend plugins. Also, I found Matt's definition of bytecode, object and page caching at the end of his post enlightening.


Multisite/network--automatic self-registration, blog setup

I am creating a WordPress Network multisite blog in a university environment. It's set up in subdirectory mode, so that each new blog appears as a subdirectory off a common domain name. The Network authenticates against our corporate Active Directory using LDAP. Only Active Directory users may sign in. The first time a user signs in, our Active Directory plugin creates a WordPress account that corresponds to that user's Active Directory account. Each subsequent sign in, that account's properties are updated with the Active Directory account information. We expect to have hundreds, possibly thousands of blogs in the system. In the interest of reducing administrator time, I want this to be automated, either:   1. From time to time, we run a script that checks the WordPress network against our Active Directory and automatically creates or deletes blogs depending on whether the blog's name corresponds to an account in the Active Directory.   2. Users may self-register for their own blog, and the blog's URL is based off an attribute of their account that will be imported from the Active Directory. So far, my searches are not revealing canned ways of doing this. Are there existing modules that can help? Or am I looking at something custom?


Storing additional information about the user

I'm creating a recruitment website in wordpress and need a way to store details about the user such as previous experience and qualifications. I want the user to be able to edit this information as soon as they have registered an account (not on the registration page). I've looked at adding user profile fields but I want the information to be isolated from their profile information, in whatever way works. Can anyone recommend any plugins or ways for doing this. Also, when the user wants to edit this information - I do not want it to be displayed next to miscellaneous account details.


Form action doesn't work if slug isn't same as custom post title

I'm facing the following situation, i've created an event-custom-post-type and display those with a single-event.php template. I've also implemented a signup-form in that template and all worked just fine. However, I've noticed that when the title gets changed of the event (and not the slug), submitting the form will result in a 404 (or in my case a notification that blog-post isn't found). The work-around would be to change the slug accordingly to the title, but i've noticed that that aswell doesn't always work, especially when they put multiple ... in a title for example. It's driving me nuts that i can't seem to figure out where I went wrong :( How one of you can show me in the right direction to get this solved :D This is the code of my custom post type               /**      * Flushes rewrite rules on plugin activation to ensure event posts don't 404      * http://codex.wordpress.org/Function_Reference/flush_rewrite_rules      */          function ep_eventposts_activation() {         ep_eventposts();         flush_rewrite_rules();     }          register_activation_hook( __FILE__, 'ep_eventposts_activation' );          function ep_eventposts() {              /**          * Enable the event custom post type          * http://codex.wordpress.org/Function_Reference/register_post_type          */              $labels = array(             'name' => __( 'Events', 'eventposttype' ),             'singular_name' => __( 'Event', 'eventposttype' ),             'add_new' => __( 'Add New Event', 'eventposttype' ),             'add_new_item' => __( 'Add New Event', 'eventposttype' ),             'edit_item' => __( 'Edit Event', 'eventposttype' ),             'new_item' => __( 'Add New Event', 'eventposttype' ),             'view_item' => __( 'View Event', 'eventposttype' ),             'search_items' => __( 'Search Events', 'eventposttype' ),             'not_found' => __( 'No events found', 'eventposttype' ),             'not_found_in_trash' => __( 'No events found in trash', 'eventposttype' ),             'parent' => __( 'kalender' ),         );              $args = array(             'labels' => $labels,             'public' => true,             'supports' => array( 'title', 'editor', 'thumbnail', 'comments' ),             'capability_type' => 'post',             'rewrite' => array("slug" => "event"), // Permalinks format             'menu_position' => 5,             'menu_icon' => plugin_dir_url( __FILE__ ) . '/images/calendar-icon.gif',  // Icon Path             'has_archive' => true         );               register_post_type( 'event', $args );     }          add_action( 'init', 'ep_eventposts' );          /**      * Adds event post metaboxes for start time and end time      * http://codex.wordpress.org/Function_Reference/add_meta_box      *      * We want two time event metaboxes, one for the start time and one for the end time.      * Two avoid repeating code, we'll just pass the $identifier in a callback.      * If you wanted to add this to regular posts instead, just swap 'event' for 'post' in add_meta_box.      */          function ep_eventposts_metaboxes() {         add_meta_box( 'ept_event_date_start', 'Start Date and Time', 'ept_event_date', 'event', 'side', 'default', array( 'id' => '_start') );         add_meta_box( 'ept_event_date_end', 'End Date and Time', 'ept_event_date', 'event', 'side', 'default', array('id'=>'_end') );         add_meta_box( 'ept_event_location', 'Event Locatie', 'ept_event_location', 'event', 'side', 'default', array('id'=>'_location') );         add_meta_box( 'ept_event_price', 'Event Prijs', 'ept_event_price', 'event', 'side', 'default', array('id'=>'_price') );         add_meta_box( 'ept_event_page', 'Event Pagina', 'ept_event_page', 'event', 'side', 'default', array('id'=>'_page') );         add_meta_box( 'ept_event_full', 'Event Volzet', 'ept_event_full', 'event', 'side', 'default', array('id'=>'_full') );          }     add_action( 'admin_init', 'ep_eventposts_metaboxes' );          // Metabox HTML          function ept_event_date($post, $args) {         $metabox_id = $args['args']['id'];         global $post, $wp_locale;              // Use nonce for verification         wp_nonce_field( plugin_basename( __FILE__ ), 'ep_eventposts_nonce' );              $time_adj = current_time( 'timestamp' );         $month = get_post_meta( $post->ID, $metabox_id . '_month', true );              if ( empty( $month ) ) {             $month = gmdate( 'm', $time_adj );         }              $day = get_post_meta( $post->ID, $metabox_id . '_day', true );              if ( empty( $day ) ) {             $day = gmdate( 'd', $time_adj );         }              $year = get_post_meta( $post->ID, $metabox_id . '_year', true );              if ( empty( $year ) ) {             $year = gmdate( 'Y', $time_adj );         }              $hour = get_post_meta($post->ID, $metabox_id . '_hour', true);              if ( empty($hour) ) {             $hour = gmdate( 'H', $time_adj );         }              $min = get_post_meta($post->ID, $metabox_id . '_minute', true);              if ( empty($min) ) {             $min = '00';         }              $month_s = '<select name="' . $metabox_id . '_month">';         for ( $i = 1; $i < 13; $i = $i +1 ) {             $month_s .= "\t\t\t" . '<option value="' . zeroise( $i, 2 ) . '"';             if ( $i == $month )                 $month_s .= ' selected="selected"';             $month_s .= '>' . $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ) . "</option>\n";         }         $month_s .= '</select>';              echo $month_s;         echo '<input type="text" name="' . $metabox_id . '_day" value="' . $day  . '" size="2" maxlength="2" />';         echo '<input type="text" name="' . $metabox_id . '_year" value="' . $year . '" size="4" maxlength="4" /> @ ';         echo '<input type="text" name="' . $metabox_id . '_hour" value="' . $hour . '" size="2" maxlength="2"/>:';         echo '<input type="text" name="' . $metabox_id . '_minute" value="' . $min . '" size="2" maxlength="2" />';          }          function ept_event_location() {         global $post;         // Use nonce for verification         wp_nonce_field( plugin_basename( __FILE__ ), 'ep_eventposts_nonce' );         // The metabox HTML         $event_location = get_post_meta( $post->ID, '_event_location', true );         echo 'Location:';         echo '<input type="text" name="_event_location" value="' . $event_location  . '" />';     }          function ept_event_price() {         global $post;         // Use nonce for verification         wp_nonce_field( plugin_basename( __FILE__ ), 'ep_eventposts_nonce' );         // The metabox HTML         $event_price = get_post_meta( $post->ID, '_event_price', true );         echo 'Price:';         echo '<input type="text" name="_event_price" value="' . $event_price  . '" />';     }          /* Prints the box content */     function ept_event_page( $post, $args ) {         global $post;         // Use nonce for verification         wp_nonce_field( plugin_basename( __FILE__ ), 'ep_eventposts_nonce');         // The Metabox HTML         $event_page = get_post_meta( $post->ID, '_event_page', true );         $dropdown_args = array(             'post_type'        => 'page',             'depth'            => -1,             'show_option_none' => '-----',             'name'             => '_event_page',             'sort_column'      => 'menu_order, post_title',             'selected'         => $event_page,             'echo'             => 1,         );              //Dropdown of pages         wp_dropdown_pages( $dropdown_args );     }          function ept_event_full() {         global $post;         // Use nonce for verification         wp_nonce_field( plugin_basename( __FILE__ ), 'ep_eventposts_nonce' );         // The metabox HTML         $event_full = get_post_meta( $post->ID, '_event_full', true );         echo 'Volzet: ';         if( $event_full ){ $checked = "checked=\"checked\""; }else{ $checked = "";}         echo '<input type="checkbox" name="_event_full" ' . $checked . ' />';     }          // Save the Metabox Data          function ep_eventposts_save_meta( $post_id, $post ) {              if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )             return;              if ( !isset( $_POST['ep_eventposts_nonce'] ) )             return;              if ( !wp_verify_nonce( $_POST['ep_eventposts_nonce'], plugin_basename( __FILE__ ) ) )             return;              // Is the user allowed to edit the post or page?         if ( !current_user_can( 'edit_post', $post->ID ) )             return;              // OK, we're authenticated: we need to find and save the data         // We'll put it into an array to make it easier to loop though              $metabox_ids = array( '_start', '_end' );              foreach ($metabox_ids as $key ) {                  $aa = $_POST[$key . '_year'];             $mm = $_POST[$key . '_month'];             $jj = $_POST[$key . '_day'];             $hh = $_POST[$key . '_hour'];             $mn = $_POST[$key . '_minute'];                  $aa = ($aa <= 0 ) ? date('Y') : $aa;             $mm = ($mm <= 0 ) ? date('n') : $mm;             $jj = sprintf('%02d',$jj);             $jj = ($jj > 31 ) ? 31 : $jj;             $jj = ($jj <= 0 ) ? date('j') : $jj;             $hh = sprintf('%02d',$hh);             $hh = ($hh > 23 ) ? 23 : $hh;             $mn = sprintf('%02d',$mn);             $mn = ($mn > 59 ) ? 59 : $mn;                  $events_meta[$key . '_year'] = $aa;             $events_meta[$key . '_month'] = $mm;             $events_meta[$key . '_day'] = $jj;             $events_meta[$key . '_hour'] = $hh;             $events_meta[$key . '_minute'] = $mn;             $events_meta[$key . '_eventtimestamp'] = $aa . $mm . $jj . $hh . $mn;              }                  // Save Locations Meta                   $events_meta['_event_location'] = $_POST['_event_location'];                     // Save Price Meta                   $events_meta['_event_price'] = $_POST['_event_price'];                  // Save Page Meta                   $events_meta['_event_page'] = $_POST['_event_page'];                   // Save Full Meta                   $events_meta['_event_full'] = $_POST['_event_full'];                   // Add values of $events_meta as custom fields              foreach ( $events_meta as $key => $value ) { // Cycle through the $events_meta array!             if ( $post->post_type == 'revision' ) return; // Don't store custom data twice             $value = implode( ',', (array)$value ); // If $value is an array, make it a CSV (unlikely)             if ( get_post_meta( $post->ID, $key, FALSE ) ) { // If the custom field already has a value                 update_post_meta( $post->ID, $key, $value );             } else { // If the custom field doesn't have a value                 add_post_meta( $post->ID, $key, $value );             }             if ( !$value ) delete_post_meta( $post->ID, $key ); // Delete if blank         }          }          add_action( 'save_post', 'ep_eventposts_save_meta', 1, 2 );          /**      * Helpers to display the date on the front end      */          // Get the Month Abbreviation          function eventposttype_get_the_month_abbr($month) {         global $wp_locale;         for ( $i = 1; $i < 13; $i = $i +1 ) {                     if ( $i == $month )                         $monthabbr = $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) );                     }         return $monthabbr;     }          // Display the date          function eventposttype_get_the_event_date() {         global $post;         $eventdate = '';         $month = get_post_meta($post->ID, '_month', true);         $eventdate = eventposttype_get_the_month_abbr($month);         $eventdate .= ' ' . get_post_meta($post->ID, '_day', true) . ',';         $eventdate .= ' ' . get_post_meta($post->ID, '_year', true);         $eventdate .= ' at ' . get_post_meta($post->ID, '_hour', true);         $eventdate .= ':' . get_post_meta($post->ID, '_minute', true);         echo $eventdate;     }          // Add custom CSS to style the metabox     add_action('admin_print_styles-post.php', 'ep_eventposts_css');     add_action('admin_print_styles-post-new.php', 'ep_eventposts_css');          function ep_eventposts_css() {         wp_enqueue_style('your-meta-box', plugin_dir_url( __FILE__ ) . '/event-post-metabox.css');     }          /**      * Customize Event Query using Post Meta      *       * @link http://www.billerickson.net/customize-the-wordpress-query/      * @param object $query data      *      */     function ep_event_query( $query ) {              // http://codex.wordpress.org/Function_Reference/current_time         $current_time = current_time('mysql');          list( $today_year, $today_month, $today_day, $hour, $minute, $second ) = split( '([^0-9])', $current_time );         $current_timestamp = $today_year . $today_month . $today_day . $hour . $minute;              global $wp_the_query;              if ( $wp_the_query === $query && !is_admin() && is_post_type_archive( 'event' ) ) {             $meta_query = array(                 array(                     'key' => '_start_eventtimestamp',                     'value' => $current_timestamp,                     'compare' => '>'                 )             );             $query->set( 'meta_query', $meta_query );             $query->set( 'orderby', 'meta_value_num' );             $query->set( 'meta_key', '_start_eventtimestamp' );             $query->set( 'order', 'ASC' );             $query->set( 'posts_per_page', '2' );         }          }          add_action( 'pre_get_posts', 'ep_event_query' );          ?>      And this is the code that displays the event and generates the form:               <?php            //response generation function       $response = "";            //function to generate response       function my_signup_form_generate_response($type, $message){              global $response;              if($type == "success") $response = "
{$message}
";         else $response = "
{$message}
";            }            //response messages     $not_human       = "Foutieve verificatie";     $missing_content = "Gelieve alles in te vullen.";     $email_invalid   = "Email is foutief.";     $message_unsent  = "Inschrijving niet doorgestuurd. Probeer opnieuw";     $message_sent    = "Bedankt! Uw inschrijving is doorgestuurd.";          //user posted variables     $firstname = $_POST['message_firstname'];     $lastname = $_POST['message_lastname'];     $persons = $_POST['message_persons'];     $email = $_POST['message_email'];     $phone = $_POST['message_phone'];     $human = $_POST['message_human'];     $price = $_POST['price'];     $event = $_POST['event'];     $date  = $_POST['date'];          $message = "Beste " . $firstname ."\r\n\r\n";     $message .= "We hebben uw inschrijving goed ontvangen en danken u voor het vertrouwen in onze diensten.\r\n";     $message .= "U ontvangt kort vóór de activiteit nog een herinneringsbericht en meer praktische informatie.\r\n\r\n";     $message .= "Vitale groeten,\r\n";     $message .= "Barbele\r\n\r\n";     $message .= "Details van uw inschrijving:\r\n";     $message .= "Naam: " . $firstname . " " . $lastname . "\r\n";     $message .= "Telefoon: " . $phone . "\r\n";     $message .= "Aantal personen: " . $persons . "\r\n\r\n";     $message .= "Activiteit: " . $event . "\r\n";     $message .= "Datum: " . $date . "\r\n";     $message .= "Inschrijvingsgeld: " . $price . "\r\n";          //php mailer variables     $to = get_option('admin_email');     $subject = "Inschrijving voor \"". $event . "\" (" . $date . ")";     $conf_subject = "Bevestiging inschrijving \"". $event . "\" (" . $date . ")";     $headers [] = "From: " . $firstname . " " . $lastname . " <" . $email . ">";     $headers [] = "Reply-To: " . $email;     $conf_headers[] = 'From: Mens Sana Health <info@menssanahealth.be>';     $conf_headers[] = 'Reply-To: info@menssanahealth.be';          if(!$human == 0){       if($human != 2) my_signup_form_generate_response("error", $not_human); //not human!       else {          //validate email         if(!filter_var($email, FILTER_VALIDATE_EMAIL))           my_signup_form_generate_response("error", $email_invalid);         else //email is valid         {           //validate presence of name and message           if(empty($name) || empty($phone)){             my_signup_form_generate_response("error", $missing_content);           }           else //ready to go!           {             $sent = wp_mail($to, $subject, strip_tags($message), $headers);             if($sent){               $sent_conf = wp_mail($email, $conf_subject, strip_tags($message),$conf_headers);               my_signup_form_generate_response("success", $message_sent); //message sent!             }             else my_signup_form_generate_response("error", $message_unsent);           }         }       }     }     else if ($_POST['submitted']) my_signup_form_generate_response("error", $missing_content);                    ?>     <?php get_header(); ?>

Kalender

                      <?php if ( have_posts() ) : while ( have_posts() ) :               the_post(); ?>
                       <?php              // Gets the event start month from the meta field             $month = get_post_meta( $post->ID, '_start_month', true );             // Gets the event start day             $day = get_post_meta( $post->ID, '_start_day', true );             // Gets the event start year             $year = get_post_meta( $post->ID, '_start_year', true );                  $start_hour = get_post_meta($post->ID, '_start_hour', true);             $start_minute = get_post_meta($post->ID, '_start_minute', true);             $end_hour = get_post_meta($post->ID, '_end_hour', true);;             $end_minute = get_post_meta($post->ID, '_end_minute', true);;                  $location = get_post_meta($post->ID, '_event_location', true);             $price = get_post_meta($post->ID, '_event_price', true);             $event_full = get_post_meta( $post->ID, '_event_full', true );                  $event_page = get_post_meta( $post->ID, '_event_page', true );                            ?>
<img src="<?php echo get_template_directory_uri(); ?>/images/date-arrow.png"/><?php echo $day . '.' . $month . '.' . $year; ?>

<?php the_title(); ?><?php if($event_full) : ?> (volzet)<?php endif; ?>
                       <?php the_content(); ?>                       <?php if($event_page != "") : ?>                       <a href="<?php echo get_permalink( $event_page ); ?>">Meer informatie

                       <?php endif; ?>                       <?php if($location != "") : ?>                       Waar: <?php echo $location; ?>
                       <?php endif; ?>                       Wanneer: <?php echo $start_hour . ':' . $start_minute . ' - ' . $end_hour . ':' .$end_minute; ?>
                       <?php if($price != "") : ?>                       Prijs: € <?php echo $price; ?>
                       <?php endif; ?>                       <?php if(!$event_full) : ?>
                       Inschrijven
                         <?php echo $response; ?>                         <form action="<?php the_permalink(); ?>" method="post">
Voornaam: *
<input type="text" name="message_firstname" value="<?php echo esc_attr($_POST['message_firstname']); ?>">
                             Familienaam: *
<input type="text" name="message_lastname" value="<?php echo esc_attr($_POST['message_lastname']); ?>">
                          Aantal personen: *
<input type="text" name="message_persons" value="<?php echo esc_attr($_POST['message_persons']); ?>">
                           Telefoon: *
<input type="text" name="message_phone" value="<?php echo esc_attr($_POST['message_phone']); ?>">
                           Email: *
<input type="text" name="message_email" value="<?php echo esc_attr($_POST['message_email']); ?>">
                           Verificatie: *
<input type="text" style="width: 60px;" name="message_human"> + 3 = 5
                           <input type="hidden" name="submitted" value="1">                           <input type="hidden" name="event" value="<?php the_title(); ?>">                           <input type="hidden" name="price" value="<?php echo $price; ?>">                           <input type="hidden" name="date" value="<?php echo $day . '/' . $month . '/' . $year; ?>">
<input type="submit">
                         </form>

                       <?php endif; ?>                       <?php if (get_adjacent_post(true, '', true) || get_adjacent_post(true, '', false)) : // if there are older posts ?>
<?php previous_post_link('%link', '< %title', TRUE); ?> <?php next_post_link('%link', '%title >', TRUE); ?>
                       <?php endif; ?>                       <?php $quote = get_post_meta(get_the_ID(), 'quote', true); ?>
                       <?php endwhile; else: ?>
                 <?php _e('Nog niets aanwezig.'); ?>
               <?php endif; ?>

     <?php get_footer(); ?>      Also, the permalink structure in the settings is /%category%/%postname%/ don't really think this is the issues as I get the same result when I set this to default. An example can be found on http://www.menssanahealth.be/kalender/ whitch lists all events And this is one of the posts where the title has been changed: http://www.menssanahealth.be/events/workshop-relaxatie-thuis-en-in-de-klas/ Thanks in advanced for any help!


Insert Ads "into" comments section in Genesis Themework

I am trying to insert two 125x125 ads into the comment section of a Genesis Child Theme - ![Where I would love 2 ads](http://i.stack.imgur.com/ASQbz.png) The screen above shows where I would want it but I am at a total loss on where to insert this overall. I have search for a code snippet for functions.php or even trying to figure which file (comments.php etc) to insert code into to make them show up. Any help would be great appreciated.


rewrite rules add a folder in the path

I have to do some url rewritting for custom post types.   I have 2 custom post types: _portfolios_ and _locations_. What I need to change is the url like this:               current: http://example.com/portfolios/user1/     Should change to: http://example.com/production/portfolios/user1/          current: http://example.com/locations/loc1/     should change to: http://example.com/production/locations/loc1/      How can I use `add_rewrite_rules`? Would it be better to use `generate_rewrite_rules`?


Serving HTTP and HTTPS from one installation

I've got a WordPress install that is serving up content via both HTTP and HTTPS. The site URL is configured as "http://www.example.com". This works for most situations - if a person requests a page at "https://www.example.com/page" the page is served up via HTTPS. However, the challenge that I'm facing is that there are a number of WordPress template functions which pull the site URL (like get_bloginfo('stylesheet') ) and when they do that, they include "http://" in the returned results. Similarly, images that are inserted in the WYSIWYG editor have the "http://www.example.com..." path hard coded. What I'd really like to do is find a way to define the base site URL as "//www.example.com", which would hopefully make everything work correctly. However, the WordPress admin fields won't support this. Does anyone have any ideas how to do this?


How to get role of user

I need to get the role associated with a user -- not the "currently logged in user". I am using Buddypress (not that should matter to the nature of this question) and I am in the `bp_members()` loop. How can I retrieve the role of the user I am reporting on in the loop at any given time? Thanks.


How to prevent tinyMCE editor to be loaded completely in Text Editor?

I'm working on a theme. Part of which there are editing modes:   * Syntax-new mode using CodeMirror   * the two native modes (Visual and Text editor)  I have an odd scenario that tinyMCE is loaded on text editor, so that means the buttons, etc. resembles like the Visual editor. Is there a WP hooks that I can use to prevent it from loading completely in the text editor?   I only need to use the native Text area without these tinyMCE functionality.


Wordpress vs Dot Net Nuke (DNN)

I am trying to piece together justification for our internal teams to use a CMS to maintain their knowledge base. It will be largely content driven and will need to achieve the following   1. Host Text Based Content (with large amounts of screenshots and rich formatting)    2. Display videos   3. Significant amount of searching   4. Integrate with Google Analytics   5. Taxonomies and classification (basic number - no extensive hierarchies)   6. Highly scalable (accessed by over 4000 users a day) I will not require user permissions (content authoring will be managed by a small group of people), no forum type posts or commenting or elaborate front page graphics. I have a fair amount of knowledge on WP but our organisation is a Microsoft shop and requires us to justify why a similar MS product cannot be used. I really don't know Dot Net Nuke (DNN) too well so does anyone have any thoughts around why I might or might not use DNN over WordPress?


wp_mail_from is ignored

I'm setting the specific "from" address using wp_mail_from. I've verified that it's actually called and I'm passing a legit me@domain.com email address. But by the time it hits /var/log/mail.log, the from address is "localaccount@my.hosting.server.com". In the wp_mail( ) call I'm even setting the headers 'From:....'. Doesn't matter, it's still ignored. I'm not sure this is a wp thing, but I've checked all my php settings and I'm not finding anything that would indicate that it forces the "from" of every email. For now I've used a generic map in postfix to convert the local account email address to a legit "from" address. But the problem is I need some emails in wordpress to be sent from one address and other emails sent from another. I have it setup in wp_mail_from to set the correct from address, only it's ignored completely somewhere along the way, just not sure what's doing me in. Ideas?


Repeatable custom meta select boxes

I am working on meta fields for a custom post type storing match data. I have two sepearte meta boxes one which the team and the score are chosen and the values are submitted. The second takes that information and provides a series of select boxes in which players from the team in question are displayed. As there are several goals scored, several players are chosen (some more than once) I am working off a tutorial http://wp.tutsplus.com/tutorials/reusable-custom- meta-boxes-part-3-extra-fields/ and am modifying the code to use repeat select boxes. This is what I have come up with:               $goal_info_meta_fields = array(         'label' => 'Home Goals by:',         'desc' => 'List home scorers',         'id' => $prefix.'home-scorers',         'type' => 'home_player_list'     );          function show_goal_info_meta_box() {     global $goal_info_meta_fields, $post;               echo '<input type="hidden" name="goal_info_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';               echo '
';     foreach ($goal_info_meta_fields as $field) {              $meta = get_post_meta($post->ID, $field['id'], true);              echo '
             '.$field['label'].'	             ';         switch($field['type']) {                  // home_player_list         case 'home_player_list':             echo '+
';             $post_id = get_the_ID();             $team_id = get_post_meta( $post_id, 'report_home-select');                  $items = get_users( array (                     'meta_key' => 'team-meta',                     'meta_value' => $team_id                 ));             $i = 0;             if ($meta) {                 foreach($meta as $row) {                     echo '
|||';                     echo '<select name="'.$field['id'].'['.$i.']" class="chzn-select" style="width:200px;" id="report_home-scorers">                     <option value="">Select One</option>'; // Select One                     foreach($items as $item) {                         echo '<option value="'.$item->ID.'"',$meta == $item->ID ? ' selected="selected"' : '','>'.$item->display_name.'</option>';                     }                     echo '</select>-
';                          $i++;                 }             } else {                 echo '
|||';                 echo '<select name="'.$field['id'].'['.$i.']" class="chzn-select" style="width:200px;" id="'.$field['id'].'">                 <option value="">Select One</option>'; // Select One                      foreach ($items as $item) {                     echo '<option value="'.$item->ID.'"',$meta == $item->ID ? ' selected="selected"' : '','>'.$item->display_name.'</option>';                 }                      echo '</select>-
';                  }             echo '
'.$field['desc'].'';             break;                   } //end switch         echo '
';     } // end foreach     echo '
'; // end table      } It works perfectly if I use text imputs but not the select boxes and I think the problem is that `$meta == $item->ID ? ' selected="selected"' :` and currently `$meta = a:1:{i:0;s:3:"179";}` I've tried unserializing the array as well. The tutorial I've used has a github repository https://github.com/tammyhart/Reusable-Custom-WordPress-Meta-Boxes which I tried as well but I couldn't apply the repeatable example as the options are in a loop I can't use a foreach statement in an array. I would love some help with this as I've been tearing my hair out for the past two days.


Tax_Query using WP_Query not working

I cannot get this query to work properly. It just renders one post even though I have three posts that are categories in the 'Firm News' and 'Test' categories. Can anyone see a problem with my code?               <?php                 $myquery = array(                     'post_type' => 'post',                     'tax_query' => array(                         'relation' => 'OR',                              array(                             'taxonomy' => 'category',                             'field' => 'slug',                             'terms' => array('test', 'firm-news'),                           )                          ),                     'posts_per_page' => 5,                      'orderby' => 'RAND',      );                                $m = new WP_Query( $myquery );                      if ( $m->have_posts() ) : $m->the_post();?>
<li <?php post_class();?>><a href="<?php the_permalink(); ?>"><?php the_title(); ?>

                  <?php endif; wp_reset_postdata(); ?>      Thanks Matt


How to allow potential clients to preview a theme

I have several themes installed in a Wordpress network. New clients will receive a network sub-site. I'd like them to be able to preview the available themes that are installed in Wordpress. There are a handful of plugins that claim to allow this to happen, but none of them have been updated in the last couple of years. Do such plugins not work in the recent versions of Wordpress? Is it possible to create some code myself which will achieve the same effect as a plugin? Thank you.


Making a class available via actions filters

I'm creating a plugin which displays a tabbed view. The way it currently works is when the user clicks a tab `class Loader` reads the `$_GET` parameter and creates an instance of the class specific to that tabs content. Now that I have this working, I want to be able to extend the functionality of this plugin to others. ie, I want another plugin to be able to create a new tab type. Each of my tab classes are derived from an abstract base though I can work around this using `if_method_exists()`. How can I make an instance or the name of a class available from a second plugin to my plugin? What I want to achieve is for my `Loader` class to have available a list of class names from which it can first populate the tabs then create the instance when that tab is selected.


When is the 'post_content_filtered' column in database cleared by WordPress?

Some WordPress plugins (although very few) use the `post_content_filtered` column in database to save some data related to a post. For example, Markdown on Save stores the markdown version of a post separately in the `post_content_formatted` column and the parsed HTML in the `post_content` column, so that when the plugin is deactivated the posts won't spew out Markdown (because HTML is stored in `post_content`). Now, I came to realize that `post_content_filtered` is pretty much used for temporary storage i.e. the content in the column is lost (or cleared) when:   * you make changes to a post (title, tags, categories, etc.) using the 'Quick Edit' option   * a scheduled post is (automatically) published   * you do bulk edits to posts   * you switch between revisions of a post   * a post is saved from an external editor (i.e. not the WordPress post editor) **Questions:**   1. In what other situations is the data in the `post_content_filtered` column cleared?   2. Is there a way to prevent this from happening at all? (I mean, is there a way to make sure that the data is stored permanently, the way the `post_content` column is treated?)


My WP site http://kyl.fi has stopped displaying anything else than Front Page when browsing the site with IE. The problem has been confirmed by several users with several versions of IE from 9-11. When accessing Front Page (i.e. kyl.fi/), everything works fine. But when trying to access any other page (e.g. kyl.fi/english/), user receives error " **Internet Explorer cannot display the webpage** ". Btw, IE has different type of error message for 404 and 500, so this is something else. The problem occurs only with IE. When browsing with other browsers such as Chrome and Firefox, everything is working fine. The site was working earlier without any problems with IE as well and I haven't made any changes to anything since that testing, except that WordPress was updated from 3.9 to 3.9.1. I have tried the basic fixes already, but without success:   * Clearing browser caches and refreshing   * Re-installing WP 3.9.1 (not manually though)   * Disabling WP plugins   * Testing with Twentyfourteen theme   * Updating permalinks   * Verifying .htaccess file is ok Some other tests I have made:   * Tried to access resources (e.g. images) in theme's directory with direct URI - working fine   * Changed IE's user-agent to Chrome - doesn't fix the problem   * Changed Chrome's user-agent to IE - problem does not occur   * Tried to access WP admin panel with IE - working fine   * Tried to access site's pages with non-rewritten URLs (e.g. kyl.fi/?p=1891) - doesn't fix the problem I'm running out of ideas what could cause this strange behavior. Any help would be highly appreciated!


Using wp_get_image_editor in a standalone script

With WP 3.5, they updated the image resizing scripts with `wp_get_image_editor`. Currently, in this standalone script that is accessed with Ajax, I have included `wp-load.php` so I can access all of the WP functions. Particularly, `$wpdb;`. In order to use the `$wpdb` functions, I had to declare `global $wpdb;` first. I assumed I had to do the same for `wp_get_image_editor`, but there is no global variable to declare. When using:               $image = wp_get_image_editor($current);          //if (!is_wp_error($image)) {         $image->resize(100, 100, false); }      nothing happens, and if I remove the `if` statement, I get the error > PHP Fatal error: Call to undefined method WP_Error::resize() Does anyone know how I can do this? Would it be smarter to install my own image-resizing scripts?


Featured Image URL is Showing but not thumbnail

I added posts from other CMS to my new word press site. For featured images I changed, `wp_post` table as               post ID: 2300      **Attachment in "wp_post":**               ID:3400     post_type: attachment     post_mime_type: images/jpeg     post_parent: 2300     post_title: file name     post_name: fileName-in-WP-Content-upload     post_status:inherit     guid: site.com/upload/oldImages/fileName-in-WP-Content-upload.jpg      **Making Featured image in "wp_postmeta"**               post_id:2300     meta_key: _thmubnail_id     meta_value: 3400      Now I am not seeing featured image in post however I can see the image url with               echo wp_get_attachment_url( get_post_thumbnail_id(3400) );


Using `auth_redirect` : keeps asking me to login even when I'm logged in

I am trying to use `auth_redirect` to automatically redirected not logged-in visitors when then visit a specific page. Here is the code I use:               add_action('template_redirect','wpse16975_check_if_logged_in');     function wpse16975_check_if_logged_in(){         $pageid = 29;         if(is_page($pageid)) auth_redirect();     }      The redirection works (I see the login page), but when I log in, I see the login page again. There is no way to access to the protected page because the browser keeps redirecting it to the login page. I saw this question and its answer from @chrisguitarguy and modify my code to this :               add_action('template_redirect','wpse16975_check_if_logged_in');     function wpse16975_check_if_logged_in(){         $pageid = 29;         if(!is_user_logged_in() && is_page($pageid)) {         $url = add_query_arg(             'redirect_to',             get_permalink($pageid),             site_url('wp-login.php')         );         wp_redirect($url);         exit;     }      This code solved my problem : a logged in user can now access to the page. The question is : why cannot simply use `auth_redirect` ?


Pagination for single custom post type page, using Posts 2 Posts plugin

Is it possible to add pagination to the single.php for a Custom Post Type, such as single-items.php. On this single page, I am using the Posts 2 Posts plugin (http://wordpress.org/plugins/posts-to-posts/) to get all connected custom post types that are connected to the Item custom post type. I would like to paginate these connected posts on this single page. How would I go about doing this? Thank you.


Metabox date month number to word

I use custom metabox with date (day, month and year). The problem is when I try to transform date number to date word - for example 10 to be October. I use this code:               function eventposttype_get_the_month_abbr($month) {     global $wp_locale;     for ( $i = 1; $i < 13; $i = $i +1 ) {                 if ( $i == $month )                     $monthabbr = $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) );                 }     return $monthabbr;     }      But now the month is displayed only with three symbols - Oct. I like to be full month name. Is there any way to define it? Thank you in advance!


incorrect path of plugin dir on network

I am using wordpress 3.5+ and I use it as network. I read that the plugins I upload are activated for all the sites on that network. So here is the issue. I uploaded a plugin say `XYZ`. It uploaded properly except for the activation part. Whenever I activate it, it gives out this warning-               Warning: fopen(/home4/koc01002/public_html/wordpress-content-folder/plugins/home4/koc01002/public_html/wordpress-content-folder/plugins/XYZ/abc.php) [function.fopen]: failed to open stream: No such file or directory in /home4/koc01002/public_html/wp-includes/functions.php on line 3508          Warning: fread(): supplied argument is not a valid stream resource in /home4/koc01002/public_html/wp-includes/functions.php on line 3511          Warning: fclose(): supplied argument is not a valid stream resource in /home4/koc01002/public_html/wp-includes/functions.php on line 3514      The path seems to get appended to the basepath. I dont get where is issue is. Can anyone help me with this?


How to make nested page structure?

For a project at work, we're needing to make support pages that reside at http://abc.com/support, and have each one of the pages be another wordpress page. So, for instance, /support/product1/troubleshooting and /support/product1/videos would be two different wordpress pages, and the maximum depth would be two levels, like /support/product1/troubleshooting/blank-screen. I came up with the method of making each permalink for a support page be the url that we want, but with slashes replaced with underscores, like support_product1_tutorial-videos... also, all of these pages will share a special template. Now I need to hijack the WP routing system to tell each one of these pages to send requests for http://abc.com/support/product1/troubleshooting to the appropriate page. Is there an easy method of doing this? Thanks.


Easiest way to display post archives in category-then-alphabetical order?

I've got a buddy who's trying to organize his recipe blog and would love to have an archive page that displays his recipes broken up by broad subject areas (read: categories) and then have the recipes listed alphabetically under each section (similar to this). Do I need to go the custom query route, or is there a better way, or, even easier, a plugin with shortcode support? (My Google Fu is failing me, as is my WP.org Fu as well. I _swear_ I've seen something like this before but I can't seem to find anything along these lines.)


Wordpress permalink, stop redirection

I'm having some hard-time with with WordPress permalinks. WordPress 3.1 seems to force url redirection, ex: This is the correct post url:               http://www.mysite.com/test/1/mypost.html      If I go to any of the url's below WordPress is redirecting me to the url above               http://www.mysite.com/test/1/mypost-teste21.html     or     http://www.mysite.com/test/1/blabla-mypost-example99.html      Basically, what I want to achieve is that WordPress matches the post id, in this case 1, and presents the post content without redirecting users to the correct url. Any ideas on how to achieve this ? Thank you all! PS- Please don't move this question to SO WordPress because I've already tried to get an answer there for a couple of days without luck.


Add column to pages table

Hey all i am trying to find the section within the edit.php page where it populates the table with all my current pages. What i want to do is add another colum to the table in order to launch a side page for changing a picture. ![enter image description here](http://i.stack.imgur.com/YAcgz.jpg) Could anyone point me to the code that populates the table? Thanks! David


Why AJAX response 0!

It is irritating me why AJAX response is 0 !. I want to check whether the email address is valid or invalid on blur.Please suggest me here is my code This is my php code                add_action('wp_ajax_send_message_to_customer','add_send_msg');?>     <form>         <input type="text" name="email_customer"  id="email_customer"/>     </form>

     <?php     function add_send_msg(){         $email = isset($_POST['email_customer']) ? $_POST['email_customer'] : null;          if( $email ){             if(is_email($email)){             $msg = 'valid';             }         }         echo $msg;         die();     }      Adding js and localize script                   add_action( 'init', 'my_script_enqueuer' );          function my_script_enqueuer() {        wp_enqueue_script( "send_email", path_join(WP_PLUGIN_URL,basename(dirname(__FILE__)).'/send_email.js', array('jquery')));        wp_localize_script( 'send_email', 'myAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));             }      and js file send_email.js               jQuery(document).ready(function () {         jQuery("input[name='email_customer']").blur(function (){             dataString = "email_customer="+jQuery(this).attr("value")+"&action=send_message_to_customer";                       jQuery.ajax({                 type: "POST",                 data: "email_customer="+jQuery(this).attr("value")+"&action=send_message_to_customer",                 url: myAjax.ajaxurl,                 beforeSend: function(){                     jQuery("#email_info").html("Checking Email......");                 },                           success: function(data) {                     alert(data);                     if( data == 'valid'){                     jQuery("#email_info").html("Email Ok");                      }                 else{                     jQuery("#email_info").html("You have entered invalid email");                      }                  }                  });         });     });


Limit access to page depending on user level

I've been asked to build a WordPress that limits access to posts with a particular custom post type based on the logged in users level. There will be a number of pre made user roles and they would like to choose which levels can view each post when the post is written. What is the best way to do this?


Having an issue doing a WP_Query with post_content and category__and

This is the array for my arguments for the WP_Query.               Array     (         [showposts] => 4         [paged] => 1         [post_type] => post         [post_content] => tree         [category__and] => Array             (                 [0] => 6                 [1] => 15                 [2] => 28             )          )      I want to return the posts where they are in the categories 6, 15, 28 and where the post_content has the word tree. My problem is that I'm returning several duplicated results for the posts that have the word tree in it. Ideally I would like to return one. anyone have any idea how I can fix or improve this?


how i can hide some category from author admin panel?

i want author can not see some category from author admin panel but administrator can see that.how i can hide some category?my site http://techjagot.com .. here show some function.php code               <?php          // Theme Settings Page     require_once(TEMPLATEPATH . "/theme-settings.php");          // Theme Styles     require_once(TEMPLATEPATH . "/theme-styles.php");          // Theme Widgets     require_once(TEMPLATEPATH . "/theme-widgets.php");          // Load Custom Post Options for Write Post and Write Page     require_once(TEMPLATEPATH . "/theme-metaboxes.php");          // Load Theme Javascript     require_once(TEMPLATEPATH . "/theme-js.php");          // Theme Image Functions     require_once(TEMPLATEPATH . "/theme-images.php");          // Register widgetized areas     function theme_widgets_init() {         register_sidebar(array (             'name'=>'Sidebar-Wide - Top',             'id'=>'widget-1',             'before_widget' => '

',             'after_widget' => '

',             'before_title' => '
',             'after_title' => '
',             ));         register_sidebar(array (             'name'=>'Sidebar-Wide - Bottom Left',             'id'=>'widget-2',             'before_widget' => '

',             'after_widget' => '

',             'before_title' => '
',             'after_title' => '
',             ));         register_sidebar(array (             'name'=>'Sidebar-Wide - Bottom Right',             'id'=>'widget-3',             'before_widget' => '

',             'after_widget' => '

',             'before_title' => '
',             'after_title' => '
',             ));         register_sidebar(array (             'name'=>'Sidebar-Narrow',             'id'=>'widget-4',             'before_widget' => '

',             'after_widget' => '

',             'before_title' => '
',             'after_title' => '
',             ));         register_sidebar(array (             'name'=>'Footer Widget 1',             'id'=>'widget-5',             'before_widget' => '

',             'after_widget' => '

',             'before_title' => '
',             'after_title' => '
',         ));


How do I display a WP Option from an array?

I have a problem displaying the data that I am successfully saving to my database.               function create_input_twitter_option() {         $options = get_option('global_options_arraykey');         ?><input type="text" name="global_options_arraykey[twitterid]" value="<?php echo $options['twitterid']; ?>" /><?php     }      This is what I am putting in my template:
<a href="<?php echo get_option("twitterid");?>">Visit our twitter Account
      However I am not getting the href value that I see in the database.


List the categories under custom taxonomy

I have a problem here, I registered a custom post type and I named it 'recipe' then I created a custom taxonomy under the post type, I named it 'recipe category'. Now I want to display the of categories under that custom taxonomy, but unfortunately I have no luck. I tried this code               <?php          $taxonomy = 'recipecategory';     $tax_terms = get_terms($taxonomy);     ?>
     <?php     foreach ($tax_terms as $tax_term) {     echo '
' . 'name ) . '" ' . '>' . $tax_term->name.'
';     }     ?>
      but it displays nothing, what's wrong with my code? did I missed something. Almost forgot to mention, I am using the plugin Custom Post Type UI


WooCommerce checkout gateway creating redirect loop

I have set up PayPal as my payment gateway for WooCommerce, do not have an SSL certificate, and am **not** forcing SSL. Checkout and payment are set to go to the checkout page. When I try to test the checkout button, it gives me a redirect loop error. How do I fix this? Thanks in advance.


post in a lightbox?

Ive installed "lightbox plus colorbox" plugin and im trying to call the latest post from the CPT notices. the notices have post expiration so essentially im looking to display the latest alert on the homepage. What ive'e learned from google so far:               <?php         $hotfoodpresent = get_posts( array('post_type' => 'st_notice', 'posts_per_page' =>-1) );         if($hotfoodpresent) echo '

           <?php if (have_posts()): while (have_posts()):the_post();         wp_redirect(get_permalink());              endwhile;      endif; ?>

'; ?>      But I think im going about this the wrong way as I don't see anything in the pop-up. I would not like to use plugins as this wordpress installation will remain on a local network without internet access. Thankyou in advance for the help if you can! Revision 2

      <?php if (have_posts()) : while (have_posts()) : the_post(); ?>          <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
         <?php the_content(); ?>

          <?php  endwhile; ?>      <?php  endif; ?>      Revision 3

             <?php             $args = array(               'posts_per_page' => 1,               'post_type' => 'st_notice'                          );            query_posts($args);                 if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php the_title(); ?>
         <?php the_content(); ?>         <a href="<?php the_permalink(); ?>">
Please click here for further information

          <?php  endwhile; ?>      <?php  endif; ?>


Filtering 'the_title' with option to return subhead?

### Problem: The WordPress iPhone app (and other WordPress-related smartphone apps) do not allow for much other than the Title and Body fields (i.e. no access to custom fields). ### Goal: My current project requires that we give our mobile bloggers the option to include a subhead with their mobile (and desktop) posts. ### Solution: I'd like to use an optional delimiter in the title. Example: > Main headline | Secondary headline Screen shot: ![enter image description here](http://i.stack.imgur.com/OA2ja.png) Where the `|` is the delimiter that separates main title: > Main headline ... from the subheadline: > Secondary headline ### Code requirements: **All** built-in, and plugin, code that use "title"-getting WP methods should always return the half before the delimiter (using example from above): > Main headline In other words, **by default** , **no** title-getting functions will ever return: > | Secondary headline ### My code so far: The code immediately below is a simple starting point. As you can see, I'm filtering `the_title` and removing: > | Secondary headline               /**      * Head/deck handling.      *      * Unaltered title (no quotes): "Main headline | Secondary headline"      *      * @see http://stackoverflow.com/a/16279114/922323      * @see http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/post-template.php#L118      * @see http://wordpress.stackexchange.com/questions/45589/      */          function foo_the_title($title, $id) {              return trim(current(explode('|', $title))); // Returns: "Main headline".          }          add_filter('the_title', 'foo_the_title', 10, 2);      By doing the above, I avoid having to worry about any other functions spitting out the delimiter (and the stuff following it), right? I'm assuming all "title"-getting functions/methods will be affected by the filter `the_title`? Maybe I'm missing a corner case here? **UPDATE: I found a corner case:wp_title() ... Makes me wonder what else is out there?** ### Question(s): Heres where I'm stuck. How can I write a custom function (or filter/other) that will return the second half of the title? I was playing with this:               function foo_the_subheadline() {              return apply_filters('the_title', '  My Custom Title (tm)  | after the stuff    ');          }      Obviously, that's not doing anything useful (I need the ability to manipulate the code/`$title` variable in `foo_the_title()`). For example, what I'd really like to do is something like this (pseudo code follows, **do not use in real world** ):               function foo_the_title($title, $id, $part = 'current') {              return trim($part(explode('|', $title)));          }          add_filter('the_title', 'foo_the_title', 10, 3);          function foo_get_me_the_subheadline() {              foo_the_title(pass the title here, pass the id?, 'end'); // Using variable function: http://php.net/manual/en/functions.variable-functions.php          }      ### Conclusion: Well, honestly, I'm hoping ya'll can help me find a conclusion. :) * * * # UPDATE (2013/05/14): See my answer below. **Thoughts:**   * Could the fundamental logic be improved?   * Are there any alternative approaches that could work better?


navigation among single posts

In the twentyeleven theme each single post page has two navigation links which point to previous and next post, irrespective of the search made by the user. That is, the next post is the successive post in chronological order as it appear in the main blog page even if the user has opened the single post page from a category or tag page, and so such next post could be of another category and tag. Is there any theme/plugin or something else that makes the previous/next post links consistent with the page the user come from?


Wordpress Plugin Admin Tab

I'm not sure on the terminology because a Google search isn't really sending me in the right direction. I currently have a WordPress Plugin which is inside the settings tab. I would like to have my own tab which has 3 subsections underneath it. I've tried looking at these:               add_action('admin_menu', 'jobboard_admin_actions');     function jobboard_admin_actions() {     add_options_page('JobBoard', 'JobBoard', 'manage_options', __FILE__, 'JobBoard_admin');     }      But I'm still stuck. Thanks, Changes :               add_action('admin_menu', 'jobboard_admin_actions');     function jobboard_admin_actions() {     add_menu_page('JobBoard', 'JobBoard', 'manage_options', JobBoard_admin,  'JobBoard_admin', '');     add_submenu_page( 'JobBoard_admin', 'JobBoard', 'JobBoard', 'manage_options',    'JobBoard_admin', 'JobBoard_admin_delete' );           }


Insert Message before content of after title

How can I insert custom message after post title. For example               ## The Post Title                My custom message


4 posts per page from single category

I've been trying to display posts that I've categorized as "news-categories". My goal is to only display 4 posts on sidebar of "cbs-news" slug underneath "news-categories" category. By below mention code all the post underneath "cbs-news" are displaying. But i need to display only 4 latest post.
         <?php                  $args = array('tax_query' => array( array('taxonomy' => 'news-categories', 'posts_per_page' => '5', 'field' => 'slug','terms' => 'cbs-news',                 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 )                 )));                 $the_query = new WP_Query( $args );                 if($the_query->have_posts() ) :                  //have_posts("showposts=4");                 while ( $the_query->have_posts() ) : $the_query->the_post();                 ?>
                <a href="<?php echo get_permalink(); ?>"><?php the_title(); ?>
              <?php endwhile; else: ?>
Nothing Here.
              <?php endif; wp_reset_postdata(); ?>


Get single object term for custom taxonomy

I am trying to get the custom taxonomy term for a single custom post type and seem to be falling flat. I thought the most obvious answer was to use `single_term_title()` but have tried just about every term related Wordpress function I could find in the codex but most of them seem to return arrays and I only want the term title for `single-match.php` Here is what I thought would work.               <?php $matchtype = single_term_title("", false); ?>
<?php echo  $matchtype->slug . ' match' ?>


Can I install/embed Wordpress on a 'single page'?

I'm building a website from scratch (PHP, jQuery) and want to have full control over the design, implementation, etc. I want to install Wordpress so that when you go to a certain section of the site, the blog link in the menu bar, it takes you to root/blog/ but I don't want to have to use a template and design the rest of the site around it.   Obviously, I don't want the blog pages' design to be uniform with the rest of the site. Surely this is possible right? If not, then I'll settle for suggestions on a different, more appropriate technology but I think this should be possible. Edit:   Is there is a way to set it up so that the user would use the wordpress.com site for admin and I simply integrate it with a PHP API. That would be fine also


How to find out if page_for_posts is showing (in order to style menu item)

I have set a static page for posts (page id = 110). This page shold only be included in the menu when the user is logged in. The latter is achieved with the following addition to `header.php` (snippet from inside the `menu <ul>` tag).               <?php wp_list_pages('sort_column=ID&exclude=100,110,145&title_li='); ?>             <?php if ( is_user_logged_in() ) { ?>
<a href="<?php echo get_permalink(110); ?>">Title
             <?php } else { ?>                  <?php } ?>      I'm using `freshy2` and have customized the CSS so that the link for the current page in the header navigation menu has another background colour from the rest (standard procedure...). However, as page with ID 110 is the static posts page, I cannot find a solution to do the same for this page. This is because `is_page(110)` returns `false` as it recognizes the current post type to be `is_single()` and when I query for post ID, the ID for the latest post is returned. I obviously can't use the latter for querying the current display as it changes all the time. Here is what I have at the moment. This kind of works, but only halfway through as now the background colour is _always_ the special colour, even if the posts page is not the current "item" on display.               <?php if ( is_user_logged_in() ) { ?>                 <li <?php                     if (get_option('page_for_posts'))                     {                          echo " class=\"page_item page-item-110 current_page_item\"";                     }                     else                     {          global $wp_query;         $thePostID = $wp_query->post->ID;                         echo " class=\"" . $thePostID . "\"";                     }                 ?>><a href="<?php echo get_permalink(110); ?>">Title
             <?php } else { ?>                  <?php } ?>      Any ideas? Thanks a lot in advance! **EDIT:** This code, as suggested below, does the trick (I simply added the missing values from the original `wp_list_pages`):                       <?php if(!is_user_logged_in())     {     $args = array(     'exclude' => '100,110,145',     'sort column' => 'ID',     'title_li' => ''      );     }     else     {     $args = array(     'exclude' => '100,145',     'sort column' => 'ID',     'title_li' => ''      );     }          wp_list_pages( $args );     ?>


how to remove mandatory required fields in buddypress registration

i have installed buddypress 1.5.1, wp 3.2.1. the registration field shows 5 mandatory fields to be filled, i need to limit this to 3, my site needs username, email, password( just like in tumblr ), how to remove these mandatory registration fields in buddypress registration. Is their any snippet/plugin to accomplish that


Add more rows on media picker

I'm trying to add more rows in the media picker modal window. Is there any clean way to achieve doing this ? Thanks !


How to check via conditional tags for a single plugin page?

I am developing a plugin. To embed the stylesheet I used `wp_enqueue_style()`. I want the CSS file to be only implemented at the plugin's page. I have already seen solutions with conditional tags, but neither `is_page()` nor `is_admin()` are fitting my request. I am able to implement the stylesheet only in the backend, but it is possible to implement it only on the plugin's page?


Is there a limit to the number of items that can be added using the Appearance Menus Screen?

I can add up to 17 items to my Menu. As soon as I add one more item by clicking the checkbox for the page that I want to add in the Pages box in the left hand column and save the menu, the item that is last in the list drops off. The Appearance Menus Screen page in the Wordpress codex makes no mention of this limit. I am using a child theme of the Thematic theme; but I have had this problem before with other themes too. If there is a limit, is there anything that I can do to override this?


Call to require('../../../wp-blog-header.php') results in 404 error?

I've got a button in theme options that calls a file called color.php, (the contents of which are below). On certain installations of the theme, the script is generating a 404 error and failing unless I take out everything above the //do something line. Any suggestions on what might be causing it?               <?php     require('../../../wp-blog-header.php');          if (!is_user_logged_in()){         die("You Must Be Logged In to Access This");     }     if( ! current_user_can('edit_files')) {         die("Oops sorry you are not authorized to do this");     }      //do something      ?>


How to query blogs posts of WordPress sub domain?

I am using WordPress 3.2.1 multi-user. I need to show posts from a specific sub domain in my home page, for example: http://mysite.com/sub-blog. I need to show posts from sub-blog in my home page. Is their any special code to query from a specific blog?


Best way to have an per-user customized private section

A common requirement for business sites is to have a client login which allow visitors to access private content for them (ie: downloads, screenshots, documents). I did it in the past and although it worked, I think is a bit messy. Now I need the same functionality in a new site, and want to know if anyone did it and want to share a nice way to achieve this. My method was something like:   1. Create a custom post type for the private content   2. Create a custom taxonomy for Clients   3. Hook `user_register` and add a Client (taxonomy) every time a new user is created   4. Hook `template_redirect` and check if it's a single of my custom post type. If it is, check if the logged_in user is in the custom taxonomy for that post. If it is, cool. If not, `header('HTTP/1.1 401 Unauthorized');exit;` Any comments?


Is there a way to create a template that does not have the site styling associated with it?

I recently completed a WP site for a client and they would like to be able have some static pages added to the site that do not have the header, footer and navigation on it. These pages would then be brought in to various other sites using an iFrame. Being fairly new to WP, I am not exactly sure how to make this happen, but I am thinking that if I create a page template that does not include header.php and footer.php, I may be going in the right direction. Is this correct? What recommendations are there for doing something like this? Thanks.


Setting post thumbnail sizes in template file and functions.php

For my post I have a box for the post image and the size of the box is 214 x 73. I want the image to fit the width of the box and have it cropped at 73px height. This is what I have so far in my functions.php file               <?php add_theme_support( 'post-thumbnails'); set_post_thumbnail_size();                if ( function_exists( 'add_image_size' ) ) {          add_image_size( 'post-thumb', 214, 73 );         }?>      and this is what I have in my content.php file: `<?php the_post_thumbnail('post-thumb'); ?>` What am I doing right/wrong and what do I need to fix to make it work? Also is it possible to make the image centered horizontally when it crops it so that you see the middle of the image? You can check out my theme here: http://benlevywebdesign.com/wordpress/ to see the post thumbnail box


Adding more information to a Content Product Category

The template **content_product_cat** is responsible for showing the product categories images and its name. I want to display more information below the name of a category e.g a Category called 'Books', I want to show 'Find all health related book here' below that category and vice versa
"Books"

Find all health related book here
      How can i do that? There is only option for 'Short Description' for products,which can be displayed via                 `echo apply_filters( 'woocommerce_short_description', $post->post_excerpt );`      but i want to show the text for each category. There is no place to enter a description under WordPress admin for woocommerce plugin.


Calling clean_term_cache() fails when called in the same plugin that creates terms, succeeds when called separately?

My plugin code is below. In the myPlugin_cleanup() function, I'm creating some categories and assigning term id 1 as the parent. Due to the **known bug with creating categories via script** (the category_children array does not get created and results in a fatal error when pages containing category listings are accessed), I've placed the clean_term_cache() call directly below the function that creates my categories. However, its not working. The category_children option is not getting created. Interestingly, if I create a plugin whose sole function is to execute the clean_term_cache('','category') call, it fixes the problem and creates the category_children option with the correct values. I'm just not sure why its not working in the same plugin that creates the categories. What might I be missing?               function myPlugin_activate(){         if ( get_option( 'myPlugin_activated' ) !== "1"){             //comment out any function you don't want to run             myPlugin_copy('themes');             myPlugin_copy('plugins');             myPlugin_images();             myPlugin_options();             myPlugin_settings();             myPlugin_widgets();             myPlugin_links();             myPlugin_posts();             myPlugin_pages();             myPlugin_custom_menus();             myPlugin_cleanup();             clean_term_cache('','category'); //does not work here             update_option('myPlugin_activated', "1");             }         }          function myPlugin_cleanup(){                  //include dependencies             require_once(ABSPATH.'/wp-admin/includes/taxonomy.php');                      if(!get_cat_ID('nofollow')){wp_create_category('nofollow',1);}             if(!get_cat_ID('noindex')){wp_create_category('noindex',1);}                  clean_term_cache('','category'); //Does not appear to work here either.             }               register_activation_hook(__FILE__, 'myPlugin_activate');     ?>


Favorite recent post widget

Does anyone have a favorite widget for the sidebar that would show the last three posts with: Title Some of the content... read more


List WordPress Custom Menu's active parent level's children as separate menu

I have a structured Custom Menu:   * parent 1      * children1_1     * children1_2    * parent 2      * children2_1     * children2_2    * parent 3    * parent 4      * children4_1 etc. I want the following: on every page, the parent level items will be shown as main menu. If a parent level item is active, I want to show the child menu items as a separate list somewhere else in the page. Is there an "easy" way to achieve this, or do I have to list the menu every time and select the current one with PHP and have headache for this for days? :) Thanks, cadeyrn


Body text disappearing in random posts

I'm using Wordpress 3.5.1 I noticed recently on my site that the body content of some posts is disappearing. The post still exists, all the other fields are still populated, but the post_content field is empty. It seems pretty random -- different post types; sometimes it happens immediately after content is created or updated, other times after it's just been sitting there untouched for weeks or months; some with complicated content, others with plain, short text entries. I checked the database, and the post_content fields for these posts were empty. Often times, there was a separate autosave record that contained the post body, luckily. I've been using those to re-add the missing content. Any ideas what could be causing the problem?


Custom Post from Custom Query with Multiple Custom Taxonomy Terms with Pagination

I have a page template like having code, (on the link below) http://pastebin.com/mZaRLKp2 Actually it's the problem of getting custom post list having all the multiple custom taxonomy terms with pagination. This type of problem have been discussed on internet many places but I am yet to get a clear understanding of how to solve. The loop gives me list successfully on page 1 but when I go for next pages my custom query doesn't work instead default query works. I have a custom post 'volunteers'. It has custom taxonomy of 'lgroup' and there are some types of 'lgroup' like 'location', 'group_type', 'meeting_day' etc. I want to filter the list of post only having combination of particular 'location' and 'meeting_day'. I create a form choosing them and 'POST' request for the form to submit. Because when I make this 'GET' request my custom taxonomy didn't appear to work in url and redirect to home page. When I use 'POST' request to get custom terms it works for first page but lost on next page and default list of 'volunteers' type post appears. Could anyone tell how to cary forward or maintain the custom query on all pages in pagination. I am really tired to search the solution for this. It would be nice if somebody explain the solution. I desperately want to know how to maintain the custom query with pagination. One more question ? I wanted to list posts only having both terms but IN operator in 'tax_query' work like 'OR' operator it lists post belongs to any terms belongs to but I want post only when it associates to both the terms. Currently I am collecting the terms and excluding them with all the terms and used rest array for with NOT IN operator in 'tax_query'. Is there any way to list post having both the terms 'group_type' and 'location' in my code. So there is two questions? 01 >> Custom query with pagination, Pagination really sucks me yet. Please help me somebody. 02 >> having multiple custom taxonomies only and only if custom post belongs to both terms not one of them.


Can one plugin activate another plugin via script? I know its possible to deactivate known plugins via script, but can't find any examples of how to activate them.


Additional page and post status types

I have a site where pages will often move from draft to published and then to legacy. I would like to create another status type similar to draft or published titled "legacy". Wherein the page exists but is indicated as no longer active on the site. Is anyone aware of a Plugin or way to hack this feature?


Login to wordpress by clicking a link and specifying usernaname and password in url

I'm running a php application on an ubuntu server that's completely independent of my wordpress site. I'm using an iFrame of the server inside the wordpress site, but I need to login to Wordpress with it (because I need to pass `$token` and `$videoid`). On the Ubuntu server, I have a form that looks like this:               <form target="_top" action="http://website.com/login/?token=<?=$token?>&videoid=<?=$videoid?>" method="post">
     <input placeholder="Email Address..." type="text" name="email" id="email">

     <input placeholder="Password..." type="password" name="password" id="password">

          <input type="submit" value="Submit">     <input type="button" value="Cancel" onclick="document.getElementById('create').style.display='none';">     </form>      I'm successfully passing the username, password, token and videoid to a login page on the wordpress site, but the best I've been able to do on that page is create a new form with those values. Is there any way I can auto-login on that page using the credentials passed from the form on the other server?


Add new media uploader at frontend for wp 3.5+

I create a form for user to submit content from the frontend. The only problem is I don't know how to handler the image upload. So, I want to know how to use the WP media uploader in the frontend. The media uploader should be appeared like in the 'wp-admin/media-new.php'. I don't want the pop up version of the uploader, as it seen in post/page page. Because it has other feature that I don't want user to use, such as 'Media Library', 'Create gallery', 'Set Featured Image' etc. Is there any tutorial or documentation on how to do it? Thanks


BuddyPress - User Login instead of Full Name

Im trying to display user login instead of user full name below each post avatar. Im using the following hook:               function my_member_username_link() {              global $post;              if (isset($post->post_author)) {                $user_info = get_userdata($post->post_author);                return 'user_login . '/" title="' . $user_info->user_login . '">' . $user_info->user_login . '';                    }                }          add_filter('bp_core_get_userlink','my_member_username_link');      This works on each avatar close to each post, but acts weird in the right sidebar where my session is displayed. Any help is welcome. Thanks in advance.


How to insert an Audio Player in a Post or Page?

I have a blog which I sometimes use for audio clips. I want to put an Audio Player on the frontpage of my blog. How can I put the player after the title or make its code part of post excerpts?


How does one include the JQuery UI plugin to wordpress and enque it correctly in a plugin form?

I have a basic admin top-level plugin I wrote which has a submenu driving a php form with a grid table populated from wp_dbase (from a custom table 'Branches' in it). My installation is a _clean_ WP 3.3.1 on WAMPServer. Only changes are including the before the wp_head function in the , in the header file for both 2010 and 2011 themes. My attempt at using JQuery 'Document.ready' does nothing. So I assume I have a Jquery setup problem. Any pointers / help would be much appreciated. (I have tried using JQueryUI dialog - modal - form as well, but zilch, nada,... Also the 'pop-up div' shows in the page, and does not 'popup'. My form and Jquery function beneath.
     <form name="Sandwich Baron Branch Maintenance" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">          $(document).ready(function(){        alert("We're in Jquery world");             $('#form-wrap').dialog({             autoOpen: false, //FALSE if you open the dialog with, for example, a button    click                         title: 'My Form',             modal: true             });     });       and here the #form-wrap div it references

All form fields are required.
     <form>        <fieldset>         Branch Name         <input type="text" name="txtBrname" id="txtBrName" class="text ui-widget-content ui-corner-all" />         Tel         <input type="text" name="txtTel" id="txtTel" value="" class="text ui-widget-content ui-corner-all" />        </fieldset>     </form>


How to manage a standalone media folder?

Managing my Wordpress installation with Git is great. I get to deploy fixes via command line (with Capistrano), easy rollback plan, the Theme folder is a standalone project added as a submodule -- This seems like a good way to handle Wordpress' and its plugins rapid updates. However, Source Control is not right for handling the on-growing Uploads folder under `wp-content` folder. The solution, IMHO, was to create a dedicated part on my server for media, and exclude it from the project itself. This way, I can backup media in a standalone process, deploy new version without having to clone the entire 300MB folder again and again -- in short, this seems like a good solution. Wordpress doesn't do that, though. Not out of the box. Possible solutions:   * Uploads files via FTP and use the image URL in posts (doubles the posting process time)   * Use a 3rd party image hosting (Flickr, Tumblr) -- This creates a dependency I wish to avoid. I want the media on my server, under my control. Any other ideas? How can I achieve a standalone media folder to which I can upload files from WP dashboard?


value not set in contact form 7 plugin of wordpress

i'm using contact form 7 plugin in wordpress,   i have generate text field like this:                [textarea your-message 25x3 "<?php  print_r($_POST); ?>"]       i have to set value of input name which comes from another form with POST method. but it's not worked, instead of input tag, it displays `; ?>"]` there is any solution?


Blog installed in subdirectory but need to create pages in root. How to use permalinks?

Our companies blog is installed in `/blog`. Our permalink structure is `/%postname%/` so posts currently look like `https://www.domain.com/blog/post` We've been asked to publish a series of guides which must be installed in `/buying-guides/` e.g. `https://www.domain.com/buying-guides/kittens` i.e. outside of the WordPress folder. I thought the answer was to simply create a page called buying-guides and then create a page per guide as children. We then end up with URLs such as https://www.domain.com/blog/buying-guides/kittens. I then created an `.htaccess` rule in our root folder with               RewriteRule ^buying-guides/(.+)$    /blog/$1 [L,NC]      and it seems to be working beautifully! Until I realized that, there is more to it as WordPress is obviously not aware of the rewrite. For example, we use `the_permalink()` function to generate the link in our page titles and this now obviously generates the incorrect link (although it would still work, but we don't want customers too see any mention of `/blog/` when browsing the buying guides. Is there a good solution to the above issue? Perhaps a filter than automatically changes all URLs just before the page is rendered from `/blog/buying-guides/` to `/buying-guides/`? Any help would be greatly appreciated!


Limit the amount of words displayed by the Latest News plugin, or recommend an alternative

I am using the Latest News plugin (made by James Piggot, plugin website is here) and I have inserted code that displays 5 of the latest news items in the sidebar area. It's working fine, and displays all I need it to display. However, I want to be able to display the first few lines of the news article with a "Read More" link after it. There doesn't seem to be a way to do that with this plugin, and instead it displays the entire contents of the latest news item in the side bar. Does anyone have any experience using this plugin who could help guide me to restricting the amount of the post it displays? If it can't be achieved using this plugin, is there a plugin out there that I could use that would allow me to do what I need to do? Many thanks!


When at / ( or "home") my menu doesn't get a current-menu-item class

I'm a wordpress noob tweaking a theme, so I'm trying to understand how it works. I've read about 10 related posts in SE but don't get it yet. My problem is as follows: header.php seems to generate the menu with,               <?php wp_nav_menu(array('theme_location' => 'nav-menu','container'  => 'div', 'container_class' => 'menu' )); ?>       In the wp-admin, I've created a menu with "Blog | About | Contact" which point to the root and two pages: "/" | "about" | "contact" (very standard). Now, I'd like to style the menu depending on the " _active_ " page. For " _about_ " and " _contact_ " this seems very easy. The classes generated for each menu item include **current-menu-item**. However, when on the home page my "blog" menu "li" only gets the classes               menu-item menu-item-type-custom menu-item-object-custom menu-item-47      and so cannot be styled accordingly. I've read some stuff about filtering, using functions, etc ... but don't quite understand it. If I define a function in functions.php, where would I use it afterwards. Any insight and help is greatly appreciated,


Delete user after Contact Form 7 submission

I need to allow users to delete their accounts on the front end, but need to collect some information about their reason for leaving. I'm using Contact Form 7 to collect the info, and want to use a hook to delete the user. When I use the function below, I receive an email with the info from the form, but it doesn't delete the user.               function outta_here() {              global $current_user;         $delete_me = get_currentuserinfo();              wp_delete_user($delete_me->ID);     }     add_action( 'wpcf7_before_send_mail', 'outta_here' );


How to make a video play for homepage?

I would like to add a video (autoplay) before the visitor go into my wp blog (maybe just the homepage, not every post), how could this be possible? I think javascript maybe the best choose? Could you give your solution (no matter js or not) in detail? * * * EDIT: After a while, I think this should work for me, but the fact is not, why?               document.write('<style type="text/css">\n\      #wrapper, #header, #footer{ display:none;}\n\      </style>\n\      <video id="loadDiv" preload="auto" data-setup="{}" loop="loop"\      webkit-playsinline="" style="position: absolute; width: 100%" autoplay=""\       src="http://srcofvideo">\      </video>'     );          window.onload = function() {      setTimeout(function () {     document.getElementById("loadDiv").style.display = "none";       document.getElementById("wrapper").style.display = "block";          document.getElementById("header").style.display = "block";          document.getElementById("footer").style.display = "block";      },10000)}


Function filter breaking tag archive menus

Ok, I'm setting up a site with a some CPT's. When creating posts under said CPT's, we added tags. When viewing the posts results after searching, tags were displayed, but upon clicking the archive page indicted that no results were available. So, I added the code below to my functions.               function myTagFilter($query) {     $post_type = $_GET['type'];     if (is_tag()){         if (!$post_type) {             $post_type = 'any';         }         $query->set('post_type', $post_type);     }     return $query;     };     add_filter('pre_get_posts','myTagFilter');      Now, posts from the CPT's display in the tags archive, but the menu is broken. Here's a link if you want to test it out. http://mt-spacehosting.com/fisheries/?s=framework+50 So, my question is, why would the menu break because of this?


Function prints post meta data does not work

I modified this code from the Twenty Eleven theme but it doesn't work and I cant see why.               if ( ! function_exists( 'theme_post_meta_data' ) ) :     /**      * This function prints post meta data.      *      * Adopted from Twenty Eleven      */     function theme_post_meta_data() {         printf( __( '%1$sPosted on %2$s by %3$s', 'theme' ),             esc_attr( ''),             sprintf( '%4$s',                            esc_url( get_permalink() ),                 esc_attr( get_the_time() ),                 esc_attr( get_the_date( 'c' ) ),                 esc_attr( get_the_date() ),             ),             esc_attr( sprintf('%3$s' ,                 esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),                 esc_attr( sprintf( __( 'View all posts by %s', 'theme' ), get_the_author() ) ),                 get_the_author() , ),             ),         );     }     endif;      I get a HTTP Error 500. Thanks


Restrict dashboard access for specific user roles to specific actions

I have a script that enables a logged in user (role Author) to delete their own posts using `get_delete_post_link()`. However, I also want to be able to restrict the author's access to the dashboard. Any attempt to do so using a plugin (Theme my Login, for example) or a simple script like those linked below disables my ability to use `get_delete_post_link()`. Is there a way to restrict access to the dashboard for the "Author" user role while still permitting the deletion of posts via `get_delete_post_link()`? http://www.tutorialstag.com/restrict-wordpress-dashboard-access.html How to restrict dashboard access to Admins only?


How do I append multiple taxonomies to the URL?

# Multiple taxonomies in URL ### How does one append multiple taxonomies to the URL having the following: >   * Post Type: **products** >   * Taxonomy: **product_type** >   * Taxonomy: **product_brand** >    ### Adding new product and selecting type and brand for this product:   When adding a new **_product_** , there are two taxonomy boxes (product_type and product_brand). Let's call this new post **_Test Product 1_**. The first thing we want to do is tick what type of product I'm dealing with, let's say **_cell-phones_**. Next, I want to tick what brand the product belongs to, let's say **_samsung._** Now " ** _Test Product 1_** " is associated with the type **_"cell-phones"_** and the brand **_"samsung"_**.   **The desired end result is:** > **/products**   >  » View all custom posts > > **/products/cell-phones**   >  » View all custom posts with the taxonomy cell-phones > > **/product/cell-phones/samsung/**   >  » View all custom posts where the taxonomy is cell-phones **AND** samsung > > **/products/cell-phones/samsung/test-product-1**   >  » View the product (single custom post)    ### The question How would one make this possible? My initial thought was using one taxonomy, having **_"cell-phones"_** as the parent term of **_"samsung"_**. Actually appending the taxonomy and its terms was not so tough. But it led to a lot of other issues, some well known, some not so much. Anyway it doesn't work like that as it gives 404 issues and WP won't allow certain things.   WP.org » taxonomy-archive-template This lead me to having rethought the structure, having to leave taxonomies and its terms and I thought; why not create a 2nd taxonomy, and associate the post type with it and append that to the url? Good question indeed, but how?


Check if current page is the Blog Page

I'm new to _Wordpress_. I need to check in header file if current page is the **Blog Page**? I checked but I can't find the way. Help me, Pls.


how to edit wp category widget

how to edit wp category widget, so it would not show one of specified category? For example, it shows all categories in list, and I need to remove category Books, from it, how can I do it? Best regards, Y2ok


remove featured image from gallery woocommerce

I am using wooCommerce. When i set the featured image for a woocommerce product, it shows up as the first/main image in the gallery on the product details page. I need to remove the featured image from the gallery only. How to do this?


Mass Update User Profile Checkbox Options

I created a checkbox option for the user_meta (user profile). They are checkboxes assigning users to categories. The problem is that I need to do a mass update for all of my users 1500+ and going through them individually would take too long. I need to choose the intended categories for each user. There are 180 categories. This is a screen shot of the section of the user profile that I want to update: ![enter image description here](http://i.stack.imgur.com/JVFHx.jpg) I need a way of doing this. Im open to using a custom script (preferably not a plugin), csv import, or any other options. The purpose of the category selections is so that I can save their descriptions in a meta field that will then be searchable with a custom query. This won't work if the users dont have a category(ies) selected. It's a pain now because there is a large amount that I need to do at once, but ideally the categories will be selected as new users are created. Anyone with a way of achieving this please help. Please let me know if there is any additional info needed. Thanks a lot


Delete all thumbnails for a post

I have a function that sideloads a YouTube thumbnail onto a page... but I want to remove the featured thumb on the page first (and remove all the various auto-generated sizes, too). I'm assuming I want to use `delete_post_thumbnail()` followed by `wp_delete_attachment()` to un-associated the thumb from the post, and then kill the thumb file. Is that correct? And Will that also delete all the various thumb media files (the extra auto-generated sizes) from the disk?