title: Form Post results in 404 Not Found

text:
I am creating a POST-able form on the front-end of Wordpress (via a shortcode). If I submit this form without any input, the form submits fine. But as soon as I enter an data in the fields and POST the form, WordPress gives a 404 Not Found error. I'm assuming this is some measure to prevent CSRF, but I cannot find any documentation about how to override the behaviour. Here is the code dealing with the shortcode:               /**      *       * @param type $atts      */     public function shortcode_invoice_sales($atts) {         extract(shortcode_atts(array(         ), $atts));              $error = array();         $user = wp_get_current_user(); // the viewing user              if (isset($_GET["id"])) {             $id = (int)$_GET["id"];             $invoice = new Bbpp_Invoices_Invoice($id);                  if (!$invoice->numInvoices()) {                 return __("Sorry, this invoice does not exist.", "bbpp_invoices");             }                  if (!$invoice->canView($user->ID)) {                 return __("Sorry, this invoice does not exist.", "bbpp_invoices");             }         } else {             $invoice = new Bbpp_Invoices_Invoice();             $invoice->addInvoice(array(                 "user_id" => $user->ID,                 "type" => "sale",                 "invoice_date" => date("d/m/Y"),                 "name" => "",                 "invoice_number" => "",                 "method" => "",                 "pay_date" => "",                 "amount" => "",                 "cis_amount" => "",                 "cis_net" => ""             ));         }              if ($_POST) {             // save the changes to the database             $data = stripslashes_deep($_POST);                  $invoice->setInvoice($data);             $error = $invoice->save();         }              $html = "";              $html .= "";              if ($id) {             $html .= "
" . __("Edit Invoice", "bbpp_invoices") . "
";         } else {             $html .= "
" . __("New Invoice", "bbpp_invoices") . "
";         }              $html .= "<form class=\"bbpp-invoices-form\" method=\"post\">";              $html .= "
";         $html .= "" . __("Invoice Date", "bbpp_invoices") . "";         $html .= "<input type=\"text\" name=\"invoice_date\" id=\"bbpp-invoices-input-invoice-date\" value=\"" . esc_attr($invoice->getInvoiceDate()) . "\">";         $html .= "dd/mm/yyyy";         $html .= "
";              $html .= "
";         $html .= "" . __("Customer Name", "bbpp_invoices") . "";         $html .= "<input type=\"text\" name=\"name\" id=\"bbpp-invoices-input-name\" value=\"" . esc_attr($invoice->getName()) . "\">";         $html .= "" . __("e.g. John Smith", "bbpp_invoices") . "";         $html .= "
";              $html .= "
";         $html .= "" . __("Invoice Number", "bbpp_invoices") . "";         $html .= "<input type=\"text\" name=\"invoice_number\" id=\"bbpp-invoices-input-invoice-number\" value=\"" . esc_attr($invoice->getInvoiceNumber()) . "\">";         $html .= "
";              $html .= "
";         $html .= "" . __("Received Method", "bbpp_invoices") . "";         $html .= "<input type=\"text\" name=\"method\" id=\"bbpp-invoices-input-method\" value=\"" . esc_attr($invoice->getMethod()) . "\">";         $html .= "
";              $html .= "
";         $html .= "" . __("Date Received", "bbpp_invoices") . "";         $html .= "<input type=\"text\" name=\"pay_date\" id=\"bbpp-invoices-input-pay-date\" value=\"" . esc_attr($invoice->getPayDate()) . "\">";         $html .= "dd/mm/yyyy";         $html .= "
";              $html .= "
";         $html .= "" . __("Invoice Amount", "bbpp_invoices") . "";         $html .= "£";         $html .= "<input type=\"text\" name=\"amount\" id=\"bbpp-invoices-input-amount\" class=\"bbpp-invoices-currency\" value=\"" . esc_attr($invoice->getAmount()) . "\">";         $html .= "
";              $html .= "
";         $html .= "" . __("CIS Amount", "bbpp_invoices") . "";         $html .= "£";         $html .= "<input type=\"text\" name=\"cis_amount\" id=\"bbpp-invoices-input-cis-amount\" class=\"bbpp-invoices-currency\" value=\"" . esc_attr($invoice->getCisAmount()) . "\">";         $html .= "
";              $html .= "
";         $html .= "" . __("CIS Net", "bbpp_invoices") . "";         $html .= "£";         $html .= "<input type=\"text\" name=\"cis_net\" id=\"bbpp-invoices-input-cis-net\" class=\"bbpp-invoices-currency\" value=\"" . esc_attr($invoice->getCisNet()) . "\">";         $html .= "
";                    $html .= "
";         $html .= " ";         $html .= "<input type=\"submit\" value=\"" . __("Add new invoice", "bbpp_invoices") . "\">";         $html .= "
";              $html .= "</form>";              return $html;     }      Does anybody know of a solution?


title: Form submission to another page returning 404 error

text: I'm modifying a form plugin, and trying to have it submit to another page chosen by the user. Right now the page it submits to is `page_id=6`. If I navigate to this page myself, it prints `Array()`. When I submit the form, I get a 404 error although the url matches. `page_id=6` uses the shortcode `[convertable]` to include this code:               <?php      echo "<pre>";     print_r($_POST);     echo "</pre>";     ?>      I'm testing in on a WPMU install. You can see the form here Any ideas on what's going wrong?


title: Trying to fix my Contact Form

text:
I have been trying to figure out on what is missing in my codes. Basically whenever i click the submit button to send the data in the contact form, it basically returns me to the home page and displays "page not found" in the tab. Here is my code               <?php      $error=false;     $sent=false;     if(isset($_POST['submit'])) {     if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['message'])) {         $error = true;     } else {           $to = "noel@digitalspin.ph";           $name = trim($_POST['name']);      $email = trim($_POST['email']);      $message = trim($_POST['message']);                $messages ="\r\n Name: $name \r\n Email: $email \r\n Message: $message";      $headers = "From:" . $name;      $mailsent = mail($to, $message, $headers);           if($mailsent){          $sent= true;         }       }     }     ?>      Here is my Markup codes

Inquiries/Comments/Suggestions
     <form id="register-form" action="" method="post">              <?php if($error == true) { ?>
 There are some misisng fields.
         <?php } if($sent == true) { ?>
Thank you for sending your message
<?php } ?>
         <input type="text" name="name" placeholder="Name">              <input type="text" name="email" placeholder="Email">              <textarea name="message" placeholder="Message"></textarea>              Where did you learn about us?              <select>             <option>Word of Mouth</option>             <option>Billboards</option>             <option>Roadshows</option>             <option>Sales agents</option>             <option>TV ads</option>             <option>Booths/Exhibits</option>             <option>Print Ads</option>             <option>Internet</option>             <option>Direct Mail</option>             <option>Flyer</option>             <option>Referral</option>             <option>Others</option>         </select>              <input type="submit" value="send" name="submit">               </form>


title: Meta query not working with pre_get_posts

text: This works                $q->set('meta_key', 'available-date_%_from');      $q->set('meta_value', '20140701');      This doesn't                 $q->set( 'meta_query', array( array( 'key' => 'available-date_%_from',   'value' => '20140701','compare' => '=' ) ) );      Any ideas on how to get this to work?


title: Custom single page based on which custom page template is selected

text: I have two custom page templates ("template-blog-left.php" with the sidebar of the left side, and "template-blog-right.php" with the sidebar on the right side.) but I don't know if there's any way of creating a custom single post template for each of them, so that If I select the "template-blog-left.php" for my "Blog" page, then the single page should have the sidebar on the left. So, in other words, is it possible to have a custom single page being selected automatically every time I make a post, based on the custom page template that is selected for the "Blog" page.


title: How to set up a echo?

text:
My problem is that i don't know how to set up a echo I think. I need it to just wrap a if statement correctly around the code below Please Help...Thanks SO much                <?php      global $post;     if(get_post_type($post->ID) == 'videos')     {                    <video class="video"  width="<?php  echo get_field('width'); ?>" height="<?php  echo get_field('height'); ?>" controls preload>                                  <source src="<?php  echo get_field('mp4'); ?>" media="only screen and (min-device-width: 960px)"></source>                                  <source src="<?php  echo get_field('iphone'); ?>" media="only screen and (max-device-width: 960px)"></source>                                  <source src="<?php  echo get_field('ogv'); ?>"></source>                              </video>
<?php the_title(); ?>
          <?php  echo get_field('content'); ?>     }          ?>


title: Accessing array elements (get_pages)

text: I'm trying to access the page ID of the child so that I can recursively call the get_children function on that child (to get grandchildren).                   if ($CurrentPage) {             $args = array(                 'child_of' => $CurrentPage                 );             $children = get_pages( $args );                  foreach ($children as $key => $value) {                     echo $key.'=>'.$value.'<br />';             } // End foreach.         } // End IF.       I actually get an error: **Catchable fatal error: Object of class stdClass could not be converted to string**


title: Only numbers in post-title (four-figure numbers)

text: im using WP for a book-project - a table as list and posts for details, take a look: http://reclam.brandenfeld.de/. The problem: I only use numbers (part of ISBN) in post-titles, and it works from 1 to 999 and from 10.000 to x. BUT it don't work between. Try it at the very bottom number 2000: http://reclam.brandenfeld.de/universal- bibliothek-1751-bis-2000. (or try 2128, 5485, 6015, 7470, 8155, 9675). I took a look at the WP-DB, but found nothing, that could match. I think the four-figure numbers are the problem. Can anybody help? Greetings from Dresden


title: Get raw image detail from post gallery?

text:
Is it possible to get the raw info from a post gallery and display on the page, specifically for a slider? So can you create a gallery then display the gallery on a page with the full size image, as well as the image caption and alt text? So for each image...

image caption, image alt tag

      Basically strip everything out apart from the full size image, alt and caption text? Is this possible? Thank you for any help.


title: Outbound Click Tracking

text: Is there a way to track the identity of someone clicking an outbound link? A site I am referring business to does not have an affiliate program, so I'd like to track the identities of the people I send to their site, not just the number of clicks.


title: displaying child pages in columns when on a parent page

text:
I would like to display sub pages in columns. Some parent pages have a lot of sub pages and the scroll is very long. I am currently using the below code to display sub pages.                 if($post->post_parent)         $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");     else     $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");     if ($children)      { ?>

            <?php echo $children; ?>

      <?php      } ?>      The child pages will need to appear if you are on another page in the same section (parent page) Any help much appreciated Thanks Update: 29/08/2013 I have used the following code to generate the pages in columns. The pages now also display once on a child page:               if($post->post_parent)     $list = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); //keep 'echo=0' and 'depth=1'; add all your parameters;     else     $list = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0"); //keep 'echo=0' and 'depth=1'; add all your parameters;          if( $list ) {         $list_elements = explode('
', $list);         $num = count($list_elements)-1;              $col = 3; //set the number of columns         $num_col = ceil($num/$col);         $width = floor(100/$col)-5;         $style = 'float:left;'; ?>

         <?php          for( $i=1; $i<$col; $i++) {             $list_elements[$i*$num_col] = '

'.$list_elements[$i*$num_col];             }                  $list = implode('
', $list_elements); ?>
<?php echo $list; ?>

                  <?php } ?>


title: How to localize admin.php only once

text: I am creating a set of plugins that all use AJAX. Now localizing the admin.php in all the plugins seems to be a bit of an overkill. Is there a way to localize the script only once.\ Now I do not know which plugin would be initialized at first, so I have to place the localize function in all the plugins. The way I do it now is by the following code.                 if( ! defined( 'AJAX_LOCALIZED' ) ){         define( 'AJAX_LOCALIZED', 1 );         wp_localize_script(             'my-ajax-script',             'ajax-object',             array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) )         );       }      This works ok, but maybe there is a build in method to do this, maybe more general that compliments with other plugins.


title: Custom Post Meta on a Different Page?

text: I'm using this code to call some custom post meta named port_excerpt:               <?php     global $wp_query;     $postid = $wp_query->post->ID;     echo get_post_meta($postid, 'port_excerpt', true);     ?>      This works like a dream when used on the template it is intended for: http://themeforward.com/demo2/portfolio/new-one/. But the custom post template I am using (as in 3.0 custom post templates) is being used for a portfolio, as a result I also need to call this on my portfolio page: http://themeforward.com/demo2/portfolio/ How do I call port_excerpt, which is meta contained within a custom post, on the portfolio page above?


title: replace current_page_item class in menu

text:
I want to replace below class with `active` class in menu:               .current-menu-item      and               .current_page_item      I am already using a menu callback which add a class `dropdown` in child menu:               class foundation_navigation extends Walker_Nav_Menu {          function start_lvl(&$output, $depth) {         $indent = str_repeat("\t", $depth);         $output .= "\n$indent
\n";     }          function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) {         $id_field = $this->db_fields['id'];         if ( !empty( $children_elements[ $element->$id_field ] ) ) {             $element->classes[] = 'has-dropdown';         }             Walker_Nav_Menu::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );         }     }


title: What should I put on my index.php?

text: I had covered basically all the pages listed in the Template Hierarchy:               404_template     archive_template     author_template     category_template     tag_template     taxonomy_template     home_template     front_page_template     page_template     search_template     single_template     attachment_template      I'm using the front-page.php for my static front page and home.php for by blog index. So, with all that covered, what should I put into my index.php? Or can I leave it empty?


title: How can I show 1 featured post in a styled element, and the next few below differently styled

text: I'm looking for some thoughts, ideas, and/or direction on what is the best way to accomplish this: Basically I want to have 1 "featured" post in a differently styled div, and then display the next 3 below it. I am using custom post types, so the built-in Sticky Posts feature won't work, and I'd rather not use a plugin... Here is a screenshot of what I'm trying to accomplish:   ![enter image description here](http://i.stack.imgur.com/sSzwo.png) I haven't done this in WordPress before so I'm not really sure where to begin. I assume I should set up a category or a tag called "featured" to trigger which posts will display at the top. But then how do I get it not to display in the regular feed?   I'm guessing I can probably disallow the "featured" tag or category, but that work-flow seems cumbersome (for the client to have to uncheck past featured posts for them to show back up in the regular feed then).


title: Showing wordpress theme demo at front end

text: i am an wordpress developer and i am currently in a project in which i have 15 wordpress responsive themes and can be downloaded by users of my site. In this , i want the feature to show the user previewing the theme. How can set this feature in front end. Any help! Thanks for advance.


title: Attach pdf file to custom post type

text:
I am trying to attach a pdf file to a custom post type.   I have found this snippet at wpsnipp.com.   The code does the trick, but only for posts.   I have a custom post type named 'events' and I can't make it work.               add_action("admin_init", "pdf_init");     add_action('save_post', 'save_pdf_link');     function pdf_init(){         add_meta_box("my-pdf", "PDF Document", "pdf_link", "post", "normal", "low");         }     function pdf_link(){         global $post;         $custom  = get_post_custom($post->ID);         $link    = $custom["link"][0];         $count   = 0;         echo '
';         $query_pdf_args = array(                 'post_type' => 'attachment',                 'post_mime_type' =>'application/pdf',                 'post_status' => 'inherit',                 'posts_per_page' => -1,                 );         $query_pdf = new WP_Query( $query_pdf_args );         $pdf = array();         echo '<select name="link">';         echo '<option class="pdf_select">SELECT pdf FILE</option>';         foreach ( $query_pdf->posts as $file) {            if($link == $pdf[]= $file->guid){               echo '<option value="'.$pdf[]= $file->guid.'" selected="true">'.$pdf[]= $file->guid.'</option>';                  }else{               echo '<option value="'.$pdf[]= $file->guid.'">'.$pdf[]= $file->guid.'</option>';                  }                 $count++;         }         echo '</select>

';         echo '
Selecting a pdf file from the above list to attach to this post.
';         echo '
Files: '.$count.'
';     }     function save_pdf_link(){         global $post;         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE){ return $post->ID; }         update_post_meta($post->ID, "link", $_POST["link"]);     }     add_action( 'admin_head', 'pdf_css' );     function pdf_css() {         echo '';     }     function pdf_file_url(){         global $wp_query;         $custom = get_post_custom($wp_query->post->ID);         echo $custom['link'][0];     }      And to display the link in the theme:               <? pdf_file_url(); ?>      I changed the post type from 'post' to 'events' and the meta box appears in the 'events' page.   So far so good.   It does save the pdf the first time around. And also it displays the correct link.   But then if I try to change the pdf it doesn't save it. It displays the first one again.


title: Issue where WP Featured Image will not display

text: The code I'm using, is outside of WordPress i.e.               define('WP_USE_THEMES', false);     require('blog/wp-blog-header.php');         global $wpdb;      The code that I'm trying to display the post thumbnail (the set featured image) is:               if(has_post_thumbnail($post->ID)){         echo "has a thumb";         get_the_post_thumbnail();         the_post_thumbnail();         the_post_thumbnail('medium');         wp_get_attachment_image_src(get_post_thumbnail_id());         wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ));     } else {         echo "no thumb";     }      Now it does does correctly display if there is a thumb or not, but doesn't return the thumb file name or anything at all. I've tried all methods I could find and nothing is returned, nor is there any errors returned. Suggestions, thoughts?


title: Disable child theme css on certain pages

text: I have activated child theme and would need to completely disable the child theme css on certain pages, leaving only the parent theme css. How can this be done?


title: Tumblr-like Post Types for WordPress

text: Is there any way to get Tumblr-like post types for WordPress? Ones where when you select a post type, it gives you different fields in the post editor for that type. For instance, if there was a link post type, I could enter the URL, the title, and an optional description of the link. Or, for a photo, I could enter a title, browse for the photo, and enter an optional description.


title: Wordpress Post via e-mail writes a random string for the post body

text: This is my first time using Post via e-mail on Wordpress. I set up the e-mail with googleapps/gmail such that the e-mail server is `ssl://pop.gmail.com:995` with the associated username and password. Wordpress successfully retrieves the e-mail but when it writes to a post, only the title of the e-mail is displayed. The body of the post includes a random string. For example, I sent an e-mail:               Subject: Test post by e-mail     Body: Sphinx of black quartz, judge my vow!      The post on my blog, however shows the following:               Title: Test post by e-mail     Body: U3BoaW54IG9mIGJsYWNrIHF1YXJ0eiwganVkZ2UgbXkgdm93IQ==      How can I fix this such that the body of the post correctly shows the body of the e-mail sent?


title: Pagination again

text: Somebody out there can tell me what's wrong with my code ?? My pagination don't work, and i dont know why...               <?php     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $queryObject = new WP_Query(array(         'post_type' => 'blog',         'posts_per_page' => 3,         'paged' => $paged         )     );              if($queryObject->have_posts()) {             while($queryObject->have_posts()) {                 $queryObject->the_post();                 if( 0 == $queryObject->current_post ) { ?>                      <!-- FIRST POST -->                 <?php } else { ?>                      <!-- OTHER POST -->                 <?php                  }             } wp_pagenavi();          }          ?>      The slug of my blog page have not the same name with my post_type by the way.


title: What hook to use to redirect based on $post

text: Trying to add an action to redirect based on if user is not logged in and is accessing certain post types. Problem is, during template_redirect, `$post` is NULL and other ones the headers seem to have already been sent so it won't redirect. What would be the appropriate action to use here?               add_action( 'template_redirect', 'mytheme_restrict_user_content' );     function mytheme_restrict_user_content(){         if (!is_user_logged_in() ) {             $restrict = false;             $restricted_post_types = array('documentlibrary', 'events');             if ( in_array( $post->post_type, $restricted_post_types ) ){                 $restrict = true;             }             if ($restrict){                 auth_redirect();             }         }     }


title: Adding custom field to post object from custom table

text: I am writing a counter plugin for WordPress, which will keep track of daily and total views. Normally you would use post meta fields for storing such information. But I cannot: I cannot use meta fields, because meta fields cannot be updated without the risk of loosing previous values (no locking). For example: The meta field "dviews" has the value of 10. Request #1 comes in, it will fetch the field and call update_meta with $oldValue + 1 (=11). This will work in a world where only one request can occur. But in real world, there are multiple concurrent requests. So when the worker from Request #1 is saving "11 dviews", other requests could have already increased the value to 17. Result: The worker from request #1 will set the stats back to 11 - I would loose 7 views. On a quiet busy site, this can be a real problem. Solution: I created another table " _views_ " with two fields: post_id and dviews. I can now run an "INSERT ... ON DUPLICATED KEY UPDATE ...*" statement. This is very powerful and I save a query. Problem: I now want to show the views in the admin dashboard (as column in the edit.php). I could join my table _views_ via hooks like *pre_get_posts*, *posts_fields* and *posts_joins*, so my fields are available in the loop. But when I want to get a post object (I am using *get_post*), my fields are missing, because the function doesn't use the posts from the loop. What can I do?   * Write my own "get_post" function?   * Is there another "get_post" function I could use?   * Is it safe to rely on the global $post variable which will show up?   * Adding my columns to WordPress' posts table? I want to avoid additional queries just for the stats. When displaying 100 postings in a dashboard table, I would get additional 100 queries just for the stats. Not good. Is there a reliable way to access the already populated posts from the loop? I really don't understand why "get_post" doesn't use this data. Maybe someone can explain? I also want to avoid manipulating the core tables. But I am not sure if there is a better way, because               function &get_post(&$post, $output = OBJECT, $filter = 'raw') {              // [...]                  if ( ! $_post = wp_cache_get($post_id, 'posts') ) {                 $_post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id));              // [...]     }     // (from wp-includes\post.php)      will ask a cache and run its own non-hookable query at least.


title: shortcode inside another shortcode

text:
I wonder if is it possible to have a shortcode inside another one? My scenario is this: I create a shortcodes to display content into columns so I can manage the layout of the page more easily. Now the problem comes, when I try to use for sample nextgen gallery into one of those shortcodes. For some reason it just generates the shortcode as plain text. Any idea why? I will show you the code I'm using for the shortcode maybe it helps:                // Column ShortCode Description     function column_scdescription($atts, $content="null") {         return '
' .$content . '
 ';     }     add_shortcode ("product-description", "column_scdescription");      Thanks in advance.


title: Meta box not displaying properly

text: I am creating a plugin that will display list of a few posts at the bottom of each post. I created a meta box which content will be displaying with the each list of posts. Problem is, if I give content in a specific post meta box, I find that metabox content is only displaying if I go that specific post, but if I go to other posts, meta box content is not displaying with the list of posts which are at the bottom. Also, as I have given content to a specific post meta box, its supposed to display with that post but the content showing with all the list of posts. Here is the codes I am using               /**      * Adds a meta box to the post editing screen     */     function prfx_custom_meta() {         add_meta_box( 'prfx_meta', __( 'Meta Box Title', 'prfx-textdomain'),'prfx_meta_callback', 'post' );     }     add_action( 'add_meta_boxes', 'prfx_custom_meta' );     /**      * Outputs the content of the meta box      */     function prfx_meta_callback( $post ) {         wp_nonce_field( basename( __FILE__ ), 'prfx_nonce' );         $prfx_stored_meta = get_post_meta( $post->ID );         ?>         <p>             <label for="meta-text" class="prfx-row-title"><?php _e( 'Example Text Input', 'prfx-textdomain' )?></label>             <input type="text" name="meta-text" id="meta-text" value="<?php if ( isset ( $prfx_stored_meta['meta-text'] ) ) echo $prfx_stored_meta['meta-text'][0]; ?>" />         </p>         <?php     }     /**      * Saves the custom meta input      */     function prfx_meta_save( $post_id ) {          $is_autosave = wp_is_post_autosave( $post_id );         $is_revision = wp_is_post_revision( $post_id );         $is_valid_nonce = ( isset( $_POST[ 'prfx_nonce' ] ) && wp_verify_nonce( $_POST[ 'prfx_nonce' ], basename( __FILE__ ) ) ) ? 'true' : 'false';              if ( $is_autosave || $is_revision || !$is_valid_nonce ) {             return;         }              if( isset( $_POST[ 'meta-text' ] ) ) {             update_post_meta( $post_id, 'meta-text', sanitize_text_field( $_POST[ 'meta-text' ] ) );         }     }     add_action( 'save_post', 'prfx_meta_save' );     /**      * Loads the image management javascript      */     function prfx_image_enqueue() {         global $typenow;         if( $typenow == 'post' ) {             wp_enqueue_media();             wp_register_script( 'meta-box-image', plugin_dir_url( __FILE__ ) . 'my-admin.js', array( 'jquery' ) );             wp_enqueue_script( 'meta-box-image' );         }     }     add_action( 'admin_enqueue_scripts', 'prfx_image_enqueue' );


title: Is there any danger in deleting all transients?

text: I have a big site for a client, and as it is a really customized wordpress installation with lots of extensions on functionality, I can't use the caching plugins. To improve the performance, I built a lot of the Site using transients (for example the navigation, the google maps with all the markers etc.), and leave the dynamic content dynamic. The problem here is if I change anything, I have to manually delete the specific transient to see the current result. The site shows different menus and googlemaps when entered from a different channel, so I have like ten transients for each area. Would you create a function where I delete those all at once (with a listing of the names of the transient), or is it okay to just delete all the transients on the site? It's not really that urgent, but for future ddevelopment I would like to know if you had any problems with stuff like that, and how you manage all your transients. Cheers, fischi


title: Suspicious URLs being loaded after hack and restore

text: I had a site that was hacked (had Arab words on the index.php), and all files deleted, but database still there. I used Fantastico to install a clean release of WP 3.1, and I still some something suspicious. In lower right side of Firefox it says "Read www.clickcoupon.me". With FireBug and PageSpeed, I can see it's opening: http://www.clickcoupon.me/plugin/sources/clickcoupon.js and http://clickcoupon.me/plugin/sources/jquery-1.3.2_nd.js which both look extremely suspicious. These are not part of the standard WordPress are they? The site is http://cpanelvideocenter.com. As of the time I'm posting this, it is a default install from Fantastico. Unless they hacked my hosting company as well, I don't see how these files could be involved.


title: How to check if I am inside the WP Theme Customizer preview?

text: I have some elements showing on the home page that I do not want to display in the Theme Customizer preview window. Is there a simple check in PHP that I can use for that ? For example:               <img class="background" src="<?php echo $background ?>" <?php if(is_wpThemeCustomizer()) echo 'style="display:none"' ?>/>      I could do it in javascript using the js file that is enqueued only in this case, but I would like to use PHP, or even better : CSS. Is it possible ?


title: How to display custom post meta in the appearance->menus page

text: I'm working on a website and added a custom meta option for all pages / posts called: "Location".               $value = get_post_meta( $post->ID, '_privacy_location', true );      I'd like to add the value on the menu item in: Appearance->Menus so my client can see what pages have which location ! Can't figure out what hook to use ! Help plz :)


title: Populating shortcode values dynamically in theme template

text:
I'm trying to use a jquery toggle shortcode in a theme template. The shortcode goes like this:               [sws_toggle3 title="Title"]You can now see the displayed text.[/sws_toggle3]      I want to pull posts from a specific category and use the toggle to display them in the page. This is what my theme template currently has:                   <?php             $wp_query->query('cat=11&paged='  . $paged);             while ($wp_query->have_posts()) : $wp_query->the_post();?>             <li id="post-<?php the_ID(); ?>">
<a class="title" href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

                 <?php the_content(); ?>

         <?php endwhile; ?>      With the output being something like:               [sws_toggle3 title="<?php the_title(); ?>"]<?php the_content(); ?>[/sws_toggle3]      Is this possible? Any help would be much appreciated. Thanks


title: How to create a page and display only the posts with a specific custom field value?

text:
I would like to create a page (let's name it "Facebook") where i will display only the posts that has the custom field: "Facebook" and specifically the custom field value: "Yes". P.S. 1. I would like to include the theme's header, slider, footer, sidebars etc. 2\. I use Advanced Custom Fields plugin               <?php get_header(); ?>

         <?php tie_breadcrumbs() ?>              <?php if ( ! have_posts() ) : ?>

<?php _e( 'Not Found', 'tie' ); ?>

<?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'tie' ); ?>
                     <?php get_search_form(); ?>

         <?php endif; ?>              <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>         <?php $get_meta = get_post_custom($post->ID);  ?>         <?php //Above Post Banner         if( empty( $get_meta["tie_hide_above"][0] ) ){             if( !empty( $get_meta["tie_banner_above"][0] ) ) echo '
' .htmlspecialchars_decode($get_meta["tie_banner_above"][0]) .'
';             else tie_banner('banner_above' , '
' , '
' );         }         ?>
             <?php tie_include( 'post-head' ); // Get Post Head template ?>

                     <?php the_content(); ?>                     <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'tie' ), 'after' => '
' ) ); ?>                          <?php edit_post_link( __( 'Edit', 'tie' ), '', '' ); ?>

         <?php endwhile; ?>              <?php //Below Post Banner         if( empty( $get_meta["tie_hide_below"][0] ) ){             if( !empty( $get_meta["tie_banner_below"][0] ) ) echo '
' .htmlspecialchars_decode($get_meta["tie_banner_below"][0]) .'
';             else tie_banner('banner_below' , '
' , '
' );         }         ?>              <?php comments_template( '', true ); ?>
          <?php get_sidebar(); ?>     <?php get_footer(); ?>


title: Display posts from different categories in two different columns

text: I have a three columns wordpress blog using Techzoid Fluid (http://wordpress.org/themes/techozoic-fluid) theme. What I want to do is to display posts from three different categories, as different users will create posts (main post, post of the day, special post). The main post will be displayed in the center column while the other two posts will be displayed in the right column, leaving the left column free for other use (archive, some images etc). Is there any way to do this with this theme? Thank you for your time


title: Changing position of cancel_comment_reply_link and other elements of comment form

text: How would I move elements of the WordPress comment form, which is called in comments.php with the following:               <?php comment_form(); ?>      For instance, I'd like to wrap `cancel_comment_reply_link` in h4 tags and place it below `get_post_reply_link`. But I don't see any way to do it. Formerly, all the code for the comment form was there in `comments.php`. You could easily move the elements around and place them where you wanted. Now, all of those elements are buried as functions in `comments-template.php`. Has someone created a function and callback, similar to the one that exists for `wp_list_comments`, that provides access to the elements of the comment form? If so, we might more easily edit the code to move links, labels and fields.


title: wp_set_object_terms timing out?

text: I have a list of 350 or so terms that I am trying to set to a post. Here's my code:               add_action('init', 'add_cities_to_story');     function add_cities_to_story() {          $cities_list = get_term_children('115', 'location'); // MA         wp_set_object_terms('632', $cities_list, 'location');      }      The trouble is that it appears to timeout about 3/4 of the way through the list. Also, any ideas how to bulk _remove_ the tags from a post? :)


title: How can I display links to several PDFs in a grid view?

text: I'm very new to Wordpress, sorry I can't provide more helpful context. I want a page that looks like this: http://imgur.com/3yjEmmK, where each element of the grid is an image that (ideally) links directly to a PDF file. This example page is currently on my website, but it is only able to display a grid view of "Services", not "posts" or "files" - I'm not sure if this is an issue with Wordpress itself, or with whatever themes/plugins I am using. I can provide more information as necessary. edit1: I am currently trying to use this plugin: http://wordpress.org/plugins/category-grid-view-gallery/, it seems promising, but it definitely isn't working how I need it to out-of-the-box. I'd love to know if there is a more appropriate plugin or method. edit2: This needs to work for probably no more than 20-30 files at once (currently just 5), but I would like it to automatically add new files once they are posted. I have created "Posts" for each file, each with a link to the PDF, a short description, and a "Featured Image". edit3: The question is about how to create a "Page" that includes a grid display of links to files (or, failing that, "Posts"). It is not necessary for the PDFs to be associated with "Posts" or for the display to be associated with a "Page", but that seems to me to be the best match to the Wordpress framework.


title: Filtering out specific post formats from certain pages

text: I'd like to filter out certain post formats from certain page templates. Specifically, I'd like to exclude link post types from the front page, so I can put them in a side bar, but still keep them in archive pages. I'd also like to exclude them from a variant of an RSS feed (but not all RSS feeds). I know I can do this by editing the templates, but is there a way to do this via a plugin alone?


title: Customizing Comments on Posts

text:
I have implemented custom code for generating comments on post page using callback function in `functions.php`.               function MYTHEME_comment($comment, $args, $depth) {        $GLOBALS['comment'] = $comment; ?>          <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
          <?php echo get_avatar($comment,$size='48' ); ?>
<a href="<?php the_author_meta( 'user_url'); ?>"><?php printf(__('%s'), get_comment_author_link()) ?>

               <?php if ($comment->comment_approved == '0') : ?>            <?php _e('Your comment is awaiting moderation.') ?>
          <?php endif; ?>
               <?php comment_text() ?>

           <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>             <?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?><?php edit_comment_link(__('(Edit)'),'  ','') ?>
      Here is a pastebin of the same code http://pastebin.com/nUjvsFua It generates basic code to show all the comments on that post. I want the first five comments to be shown and then a "View more" button to show remaining comments. Any guide on how can I achieve this?


title: limit number of images shown from gallery

text: I'm not sure if I'm doing this the right way.. I want to display 4 random images as part of the header of a page. I created a post called Header Images and inside it is a gallery with a bunch of images. Then inside my header.php I have               $args = array(         'name'=>'header-images',         'numberposts' => 4,           'orderby' => 'rand'     );     query_posts($args);     if (have_posts()) :          while (have_posts()) : the_post();?>             <div id="headerImages">                 <?php the_content(); ?>             </div>         <?php endwhile;     endif;     wp_reset_query();      which does randomize the order and display the images but it doesn't limit them to 4 like I want. Can anyone explain to me what I need to do? Thanks!


title: Passing input value into name of input

text:
I'm trying to get the value from two input fields and pass them as the name in a form. In my code, I am hardcoding the value of the price range in for testing purposes.                           echo 'PRICE RANGE:';                 echo 'Low: <input type="text" name="t[pr_100000]" value="" maxlength="25" /> High: <input type="text" name="t[ph_10000000]" value="" maxlength="25" />';                      echo 'STATUS:';                $termsStatus = get_terms( 'Status', array(                       'hide_empty' => 0                       ) );                 echo '
';                     foreach ($termsStatus as $term_st) {                         $termsStatus = $term_st->name . 'PropertyFilter';                         echo '
<input type="checkbox" name="t[st_' . $term_st->name . ']"  value="st_">' .$term_st->name. '
';                     }                 echo '
';      Any suggetions? Thanks in advance!


title: Facebook posts on wordpress blog

text: Is there any way that i can get the facebook latest posts on to my wordpress. For example if a user types some text can clicks on the post button, then that text has to come my site... Thanks in advance.


title: two meta tags with all in one seo

text: I use womanish theme   and I install the all in one seo pack , but I see two meta tags for keyword and description in source code,I can't find the related code in header.php or top.php, How can I fix that? I can not resovle my problem, Is it will be a bad impact in seo?


title: How to limit the number of posts a user can publish based on user type

text: I am creating a member only wordpress site that will restrict the number of custom posts a user can publish (Custom post type = contacts) based on their role. I will have 4 roles: Role 1 = 25 posts; Role 2 = 150 posts; Role 3 = 300 posts; Role 4 = unlimited posts Is this possible to do with WP hooks?


title: Host wp-content on other domain, much like a CDN

text: Would it be possible to host wp-content on another domain, so that all the uploads and images would go and load from there? If so, how would I go about configuring wordpress to do this, preferably without using a third-party plugin?


title: Which page is for showing all the posts

text: I want to make a page. On this page I want to dispay all my posts (4 or 5 posts per page). This page must be the default archive of all my posts. Which file should I create?


title: ACF: Display category name using taxonomy field

text: I'm currently using the taxonomy field in ACF, with the aim of printing the category name in the front end. Using it like so:               <?php $term = get_sub_field('category_selector'); if( $term ): ?>     <?php echo $term->name; ?>     <?php endif; ?>      Which is currently displaying nothing, I've debugged the `$term` which doesn't display the category ID of `3`, but for some reason I can't get hold of the category name from this? Any suggestions would be greatly appreciated!


title: Redirect extra url to Multisite in folder

text: I have a multisite that uses subfolders (for instance domainname.com/mysite). I would like to have this site also available through for instance domainname.com/mysite2. Is there a way to do this through .htaccess?


title: Plugin to hide admin menu (vertical menu bar)

text: I am learning to write WordPress plugin and testing out a simple case: hide the admin bar base on user role. So far I have the following in my plugin file:               $hidemenu= new HideMenu();     class HideMenu     {         function hideMenu() {             add_filter( 'show_admin_bar' , array($this, 'hideAdminBar'));         }              function hideAdminBar() {                 if (!(current_user_can("administrator"))                                  return false;         }     }      This is base on the example given in WordPress reference. Any idea why this is not working?


title: How to set up pagination

text: This sounds simple enough but I'm finding it impossible to implement. This is my website, you can see that on the homepage there are post excerpts but I am only showing 15 posts out of about 25 by using the "get posts" plugin with the code below. I want to show the rest on a different page using pagination. Any ideas?               [tpg_get_posts category_name="archives" numberposts="15" shorten_content="w790" ]


title: Plugin to require Twitter or Facebook login before posting a comment

text: There are similar questions to this one (e.g. A plugin where users can comment with Facebook or Twitter or OpenID or Twitter/Facebook login for comments) but none of it fully addresses my scenario so let me ask a specific question. I want to have "social commenting" on my blog and these are the requirements (ideally all should be fulfilled):   1. It should be **built-in comments, not a 3rd party service** like Disqus or IntenseDebate (I don't want to go into details, have my reasons)   2. **Comment form should be visible straight away** , i.e. no "you must be logged in to post comments" and then going through the main login screen etc.   3. However, I actually want **commenters to be authenticated** when they post comments, using either Twitter, Facebook or Wordpress (site's) login. Something like small icons below the text area as on Wordpress.com would be perfect.   4. Submitting a comment should **create a Wordpress user** so that from administration, I can see what they commented on, how many comments they have etc. Couple of notes from my research so far:   * There are many plugins for social login, for instance OA Social Login. I have not tried them all but for instance this plugin cannot do 2+3 as far as I know.   * Theoretically the social login for comments should be part of the Jetpack plugin but I don't see it there. Is my goal achievable in WP 3.3.1 and some mix of plugins?


title: How do I permanently Disable Attachment Post URL

text: How can I get rid of the attachment URLs completely? I don't want users to have the ability to link an image to the Attachment URL when inserting an image, ever. I've done things in the past like redirect back to the attachment's parent ID and could even alter it to redirect to the full size file URL but I'd rather get rid of having a permalink for attachments all together. Does anyone know of a way to disable this via the functions.php file?


title: Make a paginated article (for easier reading on mobile)

text: I'm looking for some plugin, or perhaps more likely some Javascript package that will make me do something like mobil.idg.se on a phone (select a story, then swipe sideways to read the next part of the story or the next article). That is, I want a user to compose an article like those paginated reviews you see. (1-intro, 2-specifications, 3-performance, 4-verdict). That is, when I swipe (or second prize, touch some always-accessible arrow icon), it should trigger some "navigate.Forward()" that Wordpress understands as the next part of the article, and scroll up to the top of that page. One of the parts of this question is also how a normal Editor user would insert a 'page break' without entering HTML.


title: How to filter a meta key with the meta values?

text: I have a custom post type wich I'd like to filter on a meta value. I already can sort the meta values from a meta key with the following code:               // Register the column     function status_column_register( $columns ) {         $columns['status'] = __( 'status', 'b_score' );              return $columns;     }     add_filter( 'manage_edit-b_score_columns', 'status_column_register' );          // Display the column content     function status_column_display( $column_name, $post_id ) {         if ( 'status' != $column_name )             return;              $status = get_post_meta($post_id, 'status', true);         if ( !$status )             $status = '<em>' . __( 'undefined', 'b_score' ) . '</em>';              echo $status;     }     add_action( 'manage_posts_custom_column', 'status_column_display', 10, 2 );          // Register the column as sortable     function status_column_register_sortable( $columns ) {         $columns['status'] = 'status';              return $columns;     }     add_filter( 'manage_edit-b_score_sortable_columns',     'status_column_register_sortable' );          // Order the column     function status_column_orderby( $vars ) {         if ( isset( $vars['orderby'] ) && 'status' == $vars['orderby'] ) {             $vars = array_merge( $vars, array(                 'meta_key' => 'status',                 'orderby' => 'meta_value'             ) );         }              return $vars;     }     add_filter( 'request', 'status_column_orderby' );      How is it possible to also filter the meta key with the meta values?


title: Wordpress: Getting a "Warning: call_user_func_array()" error whenever I install/update a plugin

text: This started happening after I moved my wordpress installation from the shared hosting to a vps. The full error is this: > Warning: call_user_func_array() expects parameter 1 to be a valid callback, > array must have exactly two members in /home/pcsteps/public_html/wp- > includes/plugin.php on line 199 I get it only when I intall or update a plugin. It doesn't seem to affect the plugin's function in any way. The line mentioned on plugin.php is the following:               195     do {     196     foreach( (array) current($wp_filter[$tag]) as $the_ )     197         if ( !is_null($the_['function']) ){     198             $args[1] = $value;     199             $value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args']));     200         }     201     202 } while ( next($wp_filter[$tag]) !== false );      I 've looked far and wide on the internet, but couldn't find a solution. Any help is welcome :)


title: Show parent categories of the current category

text: this code returns the parent categories of the current category with links separated by '»': ` echo get_category_parents( $cat, true, ' » ' ); ` will output: Internet » Blogging » WordPress » But is it possible not showing the last separated char? Like this: Internet » Blogging » WordPress Thanks in advance! ;) Source: Function Reference/get category parents


title: Selectively update themes in WordPress multisite

text: I have been running a WordPress multisite installation for a few years, and every time WordPress releases an update (from _x.y.z_ to _x.y_ or _x.y.z_ to _x.y.z_ ) there is always a chance that one of the themes used on one of the sites break. This is due to the fact that each theme can be custom-made, from a major theme site, or a default theme; but any of them could at any time been slightly modified, have used a function that became deprecated on the update, or just not be well-made. Granted that this is not an uncommon problem, at least not if your themes come from varied sources, I am considering a possible solution to ease the workload of updating the WordPress core without breaking one or more sites in the process. Consider the following:   * Three WordPress installations are run in partial parallel:      * Site one is **partially publicly visible** , containing the current version of all themes and site, on the not-updated version of WordPress.        * We’ll call this **“live site, pre-update”**.     * Site two is **partially publicly visible** , and contains the updated version of each theme and site, running the most updated version of WordPress (not beta or RC).        * We’ll call this site **“live site, post-update”**.     * Site three is not **publicly visible** , and contains a duplicate of each theme and site, running the most updated version of WordPress (not beta or RC), used for error-testing and optimizing.        * We’ll call this site **“testing ground”**.   * Whenever a major ( _x.y.z_ to _x.y_ ) or minor ( _x.y.z_ to _x.y.z_ ) update is released, the mirrored version of the site (the “testing ground” initially uses an exact duplicate of the theme the “live site, pre-update” uses) is tested for problems.      * If there is a deprecated function, a change in appearance, or grounds for optimization, this is done in a controlled manner on the testing ground.   * When a site on the “testing ground” is considered ready, “live site, post-update” updates the site there based on the content from “live site, pre-update” and the theme from “testing ground” and set as the current publicly available version of the site. A hypothetical example:   * On “live site, pre-update” I have a site called _KittensWhoPurr_ with the theme _KittenMania_.   * I update the “testing ground” and notice that some functions used in _KittenMania_ are deprecated, and go through the process of optimizing the theme for the new version of WordPress.   * On “live site, post-update”, I update the _KittenMania_ theme from the version in “testing ground” with content from “live site, pre-update” and make this the currently publicly visible version of _KittensWhoPurr_. This requires some streamlining of the process going between the three installations, most importantly the ability to disable a site on “live site, pre-update” in favour of the updated version of it on “live site, post-update” without disrupting normal functions such as user-accounts, plugin functionality etc. I imagine the same process would be suitable for error- testing plugins between versions, probably a bigger problem than themes for most in this situation. I know there are some paid solutions to this around the web, but I categorically avoid them as I think there should be a free alternative. The biggest problem really is avoiding breaking statistics and functionality from the old live site when porting to the new one, but I think they can be overcome with some ingenuity. Any suggestions for accomplishing this would be very much suggested.


title: mysql update user's password and activation key

text: Instead of using the Default WP reset password form, I'm creating my own and I'm stumped on this prepared statement. I'm trying to update the user's password by checking their user_login and user_activation_key. When I run this query and echo the result, I'm getting a return of int(0). It seems like it's not returning any row of the user. I also echo each POST variables to make sure it's the values are correct and it is so I'm not sure where the problem lies.               $newpassword = $_POST['newpass'];     $wp_hasher = new PasswordHash(16, FALSE);     $hashedPwd = wp_hash_password($newpassword);          $useremail = $_POST['useremail'];     $key = $_POST['key'];          $resetQuery = $wpdb -> query($wpdb -> prepare("UPDATE wp_users SET user_pass = %s, user_activation_key = '' WHERE user_login = %s AND user_activation_key = %s",                                                      $hashedPwd, $useremail, $key));      If anyone can please help me, that would be great! Thanks.


title: Creating a new blog using PHP

text: I have a Multisite where I'm creating a user from a PHP file, using the code below:               define('WP_USE_THEMES', false);      require_once (dirname (dirname (__FILE__)) . '/mygroup/wp-blog-header.php');      require_once (dirname (dirname (__FILE__)) . '/mygroup/wp-includes');          $org_username=$_SESSION['user_name'];      $org_password=$_SESSION['org_password'];      $org_email=$_SESSION['org_email'];      $user_id = wp_create_user($org_username, $org_password, $org_email);      Now, how would I create a blog for the same user?


title: Blog keeps redirecting to the contact page

text: I just added a new contact page on my blog, and I use the Contact Form 7 plugin. For some reason, when I go to my blog now, it constantly redirects to the new contact page! I looked at .htaccess files - nothing seem to have been changes. Anybody has any idea why this is happening? Even when I remove the contact page, my blog still redirects to /blog/contact. **Edit:** I managed to find the cause of the problem, and I posted a solution below.


title: echo a specific meta_key queried through a custom post

text:
I'm new to coding but love tinkering around (on Virtual Server) with bits to upgrade my current website when I have the time. What would be really useful to me would be to post an individual attribute of a custom post but most of the support seems to be for showing the whole post. I have a table of members in an area of my site only available to admin and I would like to post a publish date of their subscription **(custom post type 'subscription')** in the table. I already have the **$UserID** \- which should match up to the **meta_key 'member'** in the Custom Post... How do I go about echo-ing a publish date in the table when the **meta_key 'member' = the userID?** I can post the necessary code I have so far if anyone thinks it helpful... I've been tearing my hair out over this for the last few days as all the code I've tried posts inaccurate dates - either the date of the page or a seemingly random spread that doesn't seem to have any relevance to the individual users. The table is in a foreach construction. EDIT: Added Code. GETING THE USERS FIRST PUBLISHED SUBSCRIPTION?? Is the annotated bit I'm having trouble with. I can explain any of the functions if you like too               <?php if (current_user_can('manage_options')) { ?>

Event Administration for event <?php echo get_the_ID(); ?>
         <?php           $tickets = getTicketsForEvent(get_the_ID()); //EventID through ai1ec-plugin

                 User (Full Name)	                 Email Address	                 Phone	                 Subscription
Expiry/Renewal	                 Subscriber
 Since	                 Photo

               <?php foreach($tickets as $ticket) { ?>
                   <?php echo $ticket['name']; ?>
(                     <?php $useremail = $ticket['email'];                         $user = get_user_by( 'email', $useremail );                         $IDuser = $user->ID;                         echo bp_get_profile_field_data( array( 'field'=>'Full (Legal) Name - Not Displayed*','user_id'=>$IDuser));     //this is to get the required field out of BuddyPress profile information filled out                         ?>)                     	                   <?php echo $ticket['email']; ?>	                     <?php $useremail = $ticket['email'];                         $user = get_user_by( 'email', $useremail );                         $IDuser = $user->ID;                         $telno = bp_get_profile_field_data( array( 'field'=>'Mobile phone number - Not Displayed*','user_id'=>$IDuser));     //this is to get the required field out of BuddyPress profile information filled out                         {?><a href="tel:<?php echo $telno;?>"><?php echo $telno; }?>                     	                     <?php $useremail = $ticket['email'];                         $user = get_user_by( 'email', $useremail );                         $IDuser = $user->ID;                         echo getSubscriberType($IDuser);                         $subscriptions = getUserSubscriptions($IDuser);?>
 <?php echo date('d/m/Y',strtotime($subscriptions[0]['expiry'])); ?>                     	     // this bit uses some code in function.php just to display the type of subscription. (can also post if required)               <?php     $useremail = $ticket['email'];     $user = get_user_by( 'email', $useremail );     $IDuser = $user->ID;     global $wpdb;          $post_ids = $wpdb->get_results( "SELECT ID FROM $wpdb->subscriptions WHERE member ='$IDuser'" );          foreach($post_ids as $id){              $postdate = get_the_date("Y-m-d",$id );         echo $postdate;     ?>     	                               <?php $useremail = $ticket['email'];                         $user = get_user_by( 'email', $useremail );                         $IDuser = $user->ID;                         echo get_avatar( $IDuser, 60); ?>
               <?php } ?>

      Apologies if it's a bit of a mess - I'm no more than an amateur coder....


title: Wordpress with user login and file manager support

text: This may be a RTFM kind of thing, so I'll apologize up front. I've been asked by a friend I used to freelance for if there's a solution in Wordpress where users an login, then they can upload their own files in a "my docs" kind of thing. I've never used WP, so before I dig into their info I thought I'd see if anyone here can confirm or maybe point me to a resource. It's one of those "I'll look up at lunch and get back to you" things, which is why I'm bugging you all before reading the docs. Thanks


title: Wordpress Plugin for pastimes/participation in contest

text: I've been searching around for a Form plugin that would allow me built a participation for in my blog so users can win some stuff. **My needs are:** \- From with custom fields each give away; \- A user can only participate once... \- Option to export the data to excel, csv or something (optional). I've tried Form Maker it's almost perfect but it allows the user to participate multiple times. Can someone suggest a plugin to do it? Thank you!


title: Sorting the Loop by Taxonomy Value

text: This is a similar question to Sorting for each custom taxonomy, but I don't feel like it was clearly asked or responded to. I have a custom post type "player" and a custom taxonomy "player_details". The player details consists of things like Height, Weight, Country, Jersey #, etc. I want to add a custom filter / sorting mechanism to my player archives so that you could sort by height, weight, etc. The built-in query_posts function allows you to sort by date, title, etc, but I don't see how to sort by taxonomy. I realize that if the taxonomy details, were in custom fields, I could sort it that way, but that defeats the purpose of storing it in a custom taxonomy, which is where it should be stored. Is there a way to do this that I'm not aware of, or is it going to require some deep hacking into Custom Queries? http://codex.wordpress.org/Custom_Queries


title: widgets in footer?

text: Can i use **dynamic_sidebar('first-footer-widget-area');** directly in _footer.php_?Any change to made in _functions.php_ page? I am using twenty ten theme.


title: How to turn off redirection from 'domain.com/login' to 'domain.com/wp-login.php'

text: I want to install something different than wordpress under 'mydomain.com/login', but WordPress automatically redirecting this link '/login' to '/wp-login.php'. Where can I turn off this redirection?


title: Saving into post_excerpt or post_content

text: When importing a feed into a custom post type does it make any difference if I store the feed description in the post_excerpt field versus the post_content field? Is there some processing that gets applied via WordPress when I save content to any of those two fields?


title: Disabling shopping basket in WooCommerce

text: I'm currently creating a shop, and using WooCommerce. The shop doesn't need the shopping basket element. Users should only be able to buy one product at a time, instead of adding stuff to the basket they go straight to the payment process. Wondering what the best way to do this is? I have come across snippets that let you turn the add to cart button link go straight to the checkout:               add_filter ('add_to_cart_redirect', 'redirect_to_checkout');          function redirect_to_checkout() {         global $woocommerce;         $checkout_url = $woocommerce->cart->get_checkout_url();         return $checkout_url;     }      but this isn't foolproof in disabling the shopping cart. Does anyone know a better solution?


title: Plugin Architecture/Design Pattern - is better to use a private Observer/Mediator Pattern for plugin subclasses or WP add_action?

text: I'm coding a very complex plugin which it's organized as a parent "container" class and several subclasses, where each subclass is an optional/mandatory element which usually (but not always) maps to his own add_submenu_page. Basically, it's a plugin with his private set of let's call them "subplugins". Every subclass/subplugin has its own (big) set of add_action and add_filter. So, technically speaking, my plugin's subplugin is a valid WP plugin, simply it's not called directly by WP itself. Since i planned...actually tons of add_action...I'm wondering if i should refactor my plugin using a 'private' Observer/Mediator pattern ie. collect all relevant add_actions to my parent class only and baking up a pattern to notify/forward subclasses of events, reducing the impact of my plugin to WP event ques. Is it a good idea or it's absolutely not necesssary? Can u help me with some code for the class refactoring? tnx in advance for help, gabriele


title: How to redirect specific post type with user role

text: I have created custom post type `Books` in my `functions.php`. Now I want to redirect every user (assigned with `editor` role). When they click to Dashboard it goes to this page:               http://www.localhost/wordpress/wp-admin/edit.php?post_type=product      What I want: ![enter image description here](http://i.stack.imgur.com/uquyy.png)


title: Extended registration form in WP

text: I've been trying to find a solution to add extra fields (not only text, but radio-buttons as well) to the registration form, without any luck. I can't believe there's no plug-in currently out there that does this. Or is there ? What's the best way to do this ? I've tried 'cimy extra user fields' and 'wp user manager', but none of them did the job.


title: add_meta_box issues

text:
I have the following code in functions.php:               add_action( 'add_meta_boxes', 'create_meta' );     function create_meta(){         add_meta_box( 'Session details', 'Details', 'create_details', 'portfolio', 'advanced');     }          function create_details(){         wp_nonce_field( basename( __FILE__ ), 'ggg' );         $id_meta = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'];     ?>
             <?php _e( 'Location', 'ggg' )?>
             <input type="text" name="meta-location" id="meta-location" value="<?php if ( isset ( $id_meta['meta-location'] ) ) echo $id_meta['meta-location'][0]; ?>" />

             <?php _e( 'Client', 'ggg' )?>
         <input type="text" name="meta-client" id="meta-client" value="<?php if ( isset ( $id_meta['meta-client'] ) ) echo $id_meta['meta-client'][0]; ?>" />
     <?php     }          add_action('save_post', 'save_details');     function save_details(){         update_post_meta($id_meta, 'meta-location', $_POST['meta-location']);         update_post_meta($id_meta, 'meta-client', $_POST['meta-client']);     }      It should add 2 new inputs in a zone called "Details".   Somehow the inputs had recorded a value, but now they wont update the stored value.   Also the meta fields values, wont display in this zone, instead they appear in the "Custom fields" area.      My question is: why they wont update the new values, and why they wont appear in the "details" area instead of "custom fields"?      Hope my question is clear enough, and thanks in advance!


title: Short URL in content

text: One of our clients is looking to use shortURL's in their content posts. Does anyone know if it's possible to setup shortURL's in the content of posts? I know bit.ly offers a shortURL for the post url but I don't know if they accept it as well for the content of a post.


title: Format numeric symbols in titles

text: When I add title post as: `this - is - post` I view code source : `this – is – post` How to format code source as: `this - is - post` Error: I'm user jQuery UI autocomplete code source [`"this – is – post"`,`"this – is – post"`, ] and views html autocomplete input is `this – is – post` How to fix in jQuery or change echo code source?


title: How to add multiple image sizes of the same size with add_image_size

text: I'm using a grayscale filter on all uploaded images in my WordPress installation. However I want both the gray scaled image and the colored image in my website (colored on hover). The way I tried to do this was to create a bunch of add_image_size()'s like so:               add_image_size( 'gho-small', 100, 0, true ); // Used for small images     add_image_size( 'gho-small-grayscale', 100, 0, true ); // Used for small grayscaled images     add_image_size( 'gho-medium', 200, 0, true ); // Used for medium images     add_image_size( 'gho-medium-grayscale', 200, 0, true ); // Used for medium grayscaled images     add_image_size( 'gho-large', 400, 0, true ); // Used for large images     add_image_size( 'gho-large-grayscale', 400, 0, true ); // Used for large grayscaled images      And then I'd do a filter on the images and only take the *-grayscale ID's and save them:               add_filter('wp_generate_attachment_metadata','gholumns_grayscale_filter');     function gholumns_grayscale_filter($meta)     {         $dir = wp_upload_dir();         $file = trailingslashit($dir['path']).$meta['sizes']['gho-large-grayscale']['file'];         do_grayscale_filter($file);         return $meta;     }      It would work fine, but apparently add_image_size() looks at the width and height arguments and when a size is already defined with that combination, the size is not added. I can understand that, since the function is to add new sizes, and if the size is a duplicate it normally is better not to add it again to save processing time. But now I want two images with the same size, but one with a filter applied to it and the other the original. How can I achieve this? I have tried to add another size which is just one pixel wider, like:               add_image_size( 'gho-small-grayscale', 101, 0, true ); // Used for small grayscaled images      And then resizing the image later on after the filter back to `100/200/400` whatever. But it does not feel right, and it also mess up `get_the_post_thumbnail()` calls as that one still thinks the image dimension is `101x$height`. It also is not as simple as resizing the image back by one pixel horizontally and vertically as ratios could cause that the height is `> 1px` taller when you have a width + 1px.


title: Get fatal error when using wpdb in jQuery.post target URL

text:
Why am I getting a Fatal error whenever I use wpdb in the target URL of my jQuery.post? Here is my code so far. My process.php is this:               <?php         $to      = 'myemail@gmail.com';         $subject = 'Join '.$_POST['title'].' Event';         $message = '                                                                     Name: '.$_POST['participant'].'
                 Email Address: '.$_POST['email'].'
                 Message: '.$_POST['message'].'                                       ';         $headers  = 'MIME-Version: 1.0' . "\r\n";         $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";         $headers .= 'From: '.$_POST['email']. '\r\n';              mail($to, $subject, $message, $headers);              echo "You have successfully signup up for this event";     ?>      I tried adding this:               global $wpdb;     $table = 'wp_mytable';     $name = $_POST['participant'];     $email = $_POST['email'];     $event = $_POST['title'];          $wpdb->insert(         $table,         array(             'id' => '',             'name' => $name,             'email' => $email,             'event' => $event,         ),         array(             '%d',             '%s',             '%s',             '%s',         )     );      **But I get a fatal error.** I also tried adding `require_once(../wp- load.php)` But still no good. Thanks in advance!


title: Unable to login to my wordpress site. reauth=1 redirection loop. Any ideas on how to fix this?

text: I am having some difficulty logging into my wordpress site. When I attempt to visit mysite.com/wp-admin, I see a blank page and the url bar changes to: http://mysite.com/wp-login.php?redirect_to=http%3A%2F%2Fmysite.com%2Fwp- admin%2F&reauth=1 If I visit mysite.com/wp-login.php, I only see a blank white page without any change to the URL. I have confirmed this is not a problem with anything on my local machine as the behavior persists across multiple browsers and devices. I have found numerous forum posts about the issue but none offer a satisfactory solution. Please help as I urgently need to update content on the site. Update: I turned WP debugging on and see the following error Fatal error: Cannot redeclare check_password_reset_key() (previously declared in /home/wordpress/public_html/wp-login.php:281) in /home/wordpress/public_html/wp-includes/user.php on line 1637 Any tips on how to fix this would be greatly appreciated


title: Plugin or advice on how to parse XML in real-time?

text: I am working on a project for my university basketball team. During each game their statistics software will create an XML file and update it mid-game with player statistics, shots, etc. What I would like to do is to display this content in a post during the games so that media members could have access to it. I'd like to be able to link to the XML file and then have the post update when changes are made or the other option is to update it on a frequent basis to make sure the statistics are up to date. How can I do this? I've tried the plugin _WP All Import_ but it requires a paid version to do chron updates.


title: Showing errors from processing function on form

text: I use a function from my functions.php to process a front end post form. I store the errors in the variable `$output` but need a way to show it on the post form after submit. How can I do that?


title: Relative v.s. absolute URLs: which ones should I use for cross-domain portability?

text: My question is related to but different from this one I need to make sure that my URLs work across domains like `staging.domain.com`, `localhost:8000` and `www.domain.com`. I have local, staging and production environments. I thought relative URLs would be the solution to my problem since I will be using WP Migrate Pro to move data from local to staging to production. But after reading this article by Yoast, I am kind of worried. He speaks about SEO problems. So what type of permalinks should I use? Absolute or Relative? _Or_ should I use relative URLs with canonical meta tags on my page templates?


title: How to make a custom Archive Page

text: For News Portals, we are using WordPress successfully. But the clients are not satisfied with the WordPress default archive. They want something different like the regular index page. So, how the Custom Archive Page can be:   ![Custom Archive Page Design](http://i.stack.imgur.com/xgNHQ.png) I think the image I attached is saying everything. The shame part is that, I, actually din't try anything with this idea. Actually I want some idea, or links, or logic, with that I can proceed with this sort of modifications. What I initially can say:   We can do some `WP_Query()` for each of the blocks, but how can we grab the date from the URL (where the URL can use any permalink) into the Query? There would be no further pagination in the archive page, the "Load More" button will load more news of the certain category (Similar to Facebook Comment). The Lead Posts are typically echoed (in our design) using Meta Key "Featured". So, in the lead query we can query for the "featured" meta key and grab them filtering by the date of the Archive. Then Ok, how can we proceed with this sort of idea?   **Please note that,** I'm a WordPress enthusiast, and is not posing my task on other's head. I'm actually trying to formulate a new idea, and seeking the path of how to proceed to be success with this sort of idea. Actually I'm NOT looking for a concrete block of code. :)


title: When/why does '$query->get( 'tax_query' );' return empty?

text: First the code:               function itsme_better_editions( $query ) {         if ( $query->is_category() && $query->is_main_query() ) {             $query->set( 'post_type', array( 'post' ) );                  // Get current tax query             $tax_query = $query->get( 'tax_query' );                  $tax_query['relation'] = 'OR';                  $tax_query[] = array(                 'taxonomy' => 'category',                 'field' => 'slug',                 'terms' => 'intl',                 'operator' => 'IN'             );                  $query->set( 'tax_query', $tax_query );         }         return $query;     }     add_filter( 'pre_get_posts', 'itsme_better_editions' );      It all seems right to me, except `$query->get( 'tax_query' );` seems to return empty or not an array, i.e. the following condition is returning `true`:               if( !empty($tax_query) || is_array($tax_query) ) {        // whatever     }      This is breaking stuff, I later realized. The right posts are being shown in the archive i.e. posts that belong to either the current category OR 'International (intl)' category are listed. Which is what I want. But the term object is pointed to 'intl' category (the same happens in tag archives as well; instead of term object pointing to the current tag, it points to 'intl' category). For example, if I visit the 'UK (uk)' category archive, the displays 'International' instead of 'UK'. This is just one of the problems I've noticed so far; I don't know what else is broken. What's wrong with the function? * * * **PS:** And because `$query->get( 'tax_query' );` was returning empty or not an array, I had to manually fill it up like so:               /*      * Show posts assigned to 'International (intl)' Edition      * in all editions.      */     function itsme_better_editions( $query ) {         if( $query->is_category() && $query->is_main_query() ) {                  $query->set( 'post_type', array( 'post' ) );                  // NOT WORKING!!!             //$tax_query = $query->get( 'tax_query' );                  // Equivalent of original `$tax_query` START.             $get_original_category = get_query_var( 'category_name' );             $original_category = get_term_by( 'slug', $get_original_category, 'category' );             if( $original_category && !is_wp_error( $original_category ) ) {                 $itsme_original_category = $get_original_category;             }                  $tax_query[] = array(                 'taxonomy' => 'category',                 'field' => 'slug',                 'terms' => $original_category,                 'operator' => 'IN'             );             // Equivalent of original `$tax_query` END.                  $tax_query['relation'] = 'OR';                  $tax_query[] = array(                 'taxonomy' => 'category',                 'field' => 'slug',                 'terms' => 'intl',                 'operator' => 'IN'             );                  $query->set( 'tax_query', $tax_query );         }         return $query;     }     add_filter( 'pre_get_posts', 'itsme_better_editions' );      OR simply replace the query like so:               /*      * Show posts assigned to 'International (intl)' Edition      * in all editions.      */     function itsme_better_editions( $query ) {         if( $query->is_category() && $query->is_main_query() ) {                  // Get original/actual category of the category archive             $get_original_category = get_query_var( 'category_name' );             $original_category = get_term_by( 'slug', $get_original_category, 'category' );             if( $original_category && !is_wp_error( $original_category ) ) {                 $itsme_original_category = $get_original_category;             }                  if( isset($itsme_original_category) ) {                      $query->set( 'post_type', array( 'post' ) );                      $query->set( "category_name", "{$itsme_original_category}, intl" );                  }              }     }     add_action( 'pre_get_posts', 'itsme_better_editions' );      This works, but why should I do it this way? Isn't `$tax_query = $query->get( 'tax_query' );` supposed to return the original `tax_query`? * * * ## How to reproduce the problem 1\. Create two categories: UK (uk) and International (intl). Create 2 posts and assign them to 'UK' only; 1 under 'International' only. Now, `example.com/category/uk/` shows 2 posts; and `example.com/category/intl/` shows 1. 2\. Now add the first function (first code block) in your theme's functions.php, and visit `example.com/category/uk/`. You'll see that the category name of the page (`<?php single_cat_title(); ?>`) is shown as 'International'. **Why?** If I am not wrong, because $query->get( 'tax_query' ); seems to return empty, not an array. 3\. Replace the function in functions.php with the second or third functions above. Now everything should work as it's supposed to. **PS:** Yes, I did this test myself with the default theme (Twenty Thirteen) and it persists. So you'd be able to reproduce the problem just fine.


title: How to select from a WP table every 10s in a class (OOP)?

text: I'm trying to select records every ten 10 seconds from **columns** _message_ and _messagetwo_ from my WordPress table `wp_userlogin`, but the code is not being executed. I'm calling `wp_schedule_event` when my plugin is activated and I clear all schedules when the plugin is deactivated. I'm using a register activation/deactivation hook for my table too but I think that it should execute else block `echo "wrong columns are empty";` when columns are empty. I call a new object of class after class user. I have been trying to use insert instead of select but the function `refreshDatabase` isn't being executed.               // class is located in main file        class   user{       public function __construct() {        add_filter( 'cron_schedules', array( $this, 'setTimeForSchedule_event' ) );     // here Im calling my function refreshDatabase       add_action( 'my_schedule_action', array( $this, 'refreshDatabase' ) );     // register hook is succesful       register_activation_hook( __FILE__, array( $this, 'getRefresh' ) );       register_deactivation_hook( __FILE__, array( $this, 'deactivation_schedules' ) );     }     }           public function getRefresh() {             if ( !wp_next_scheduled( 'my_schedule_action' ) ) {                 wp_schedule_event( time(), 'tensec', 'my_schedule_action');             } else {                 echo "wrong";             }             $sched = wp_get_schedule( 'my_schedule_action' );             if ( !$sched ) {                echo "wrong wp_get_schedule";              }         }           function deactivation_schedules() {             wp_clear_scheduled_hook( 'my_schedule_action' );         }           function refreshDatabase() {         global $wpdb;         $user_info = get_userdata( 1 );         $this->user_email = $user_info->user_email;              $getmessage = $wpdb->get_results(                 "SELECT message,messagetwo from wp_userlogin WHERE                   user_email='$this->user_email'" );              if ( $getmessage ) {             foreach ( $getmessage as $mess ) {                 echo $mess->message;                 echo $mess->messagetwo;             }         } else {     // when columns are empty -> this echo is written on the options page                 echo "wrong columns are empty";             }          }          public function setTimeForSchedule_event( $schedules ) {          $schedules[ 'tensec' ] = array(             'interval' => 10,             'display' => __( 'Each TenSec' )         );         return $schedules;     }     }           $user = new user();


title: Multisite Conditional (if blog_id?) in a page template?

text: I have a WordPress network with multiple sites using the same theme. Now I need to edit part of a certain `PageTemplate.php` to display different things based on the `blog id`. Example: _If blog ID 1, run this:_               <a href="<?php if(get_post_meta($post->ID, 'videoembed_videopopup', true)): ?><?php echo get_post_meta($post->ID, 'videoembed_videopopup', true) ?>     <?php else: ?>     <?php if(get_post_meta($post->ID, 'links_link_custom', true)): ?><?php echo get_post_meta($post->ID, 'links_link_custom', true) ?>     <?php else: ?>     <?php the_permalink(); ?>     <?php endif; ?><?php endif; ?>" class="hover-gradient <?php if(get_post_meta($post->ID, 'videoembed_videopopup', true)): ?>video-pop-up<?php endif; ?>" target="_blank" <?php if(get_post_meta($post->ID, 'videoembed_videopopup', true)): ?>rel="prettyPhoto[gallery]"<?php endif; ?>><?php the_post_thumbnail('progression-thumb-retina'); ?><?php endif; ?>      _else, run this:_               <?php if(get_post_meta($post->ID, 'links_link_custom', true)): ?>     <a href="<?php echo get_post_meta($post->ID, 'links_link_custom', true) ?>" class="hover-gradient <?php if(get_post_meta($post->ID, 'videoembed_videopopup', true)): ?>video-pop-up<?php endif; ?>">     <?php else: ?>     <?php if(get_post_meta($post->ID, 'videoembed_videopopup', true)): ?>     <a href="<?php echo get_post_meta($post->ID, 'videoembed_videopopup', true) ?>" class="hover-gradient <?php if(get_post_meta($post->ID, 'videoembed_videopopup', true)): ?>video-pop-up<?php endif; ?>">     <?php else: ?>     <?php endif; ?><?php endif; ?>     <?php the_post_thumbnail('progression-thumb-retina'); ?>     <?php endif; ?>      I found this conditional which I believe is the way to accomplish my objective:               <?php     global $blog_id;          if ($blog_id == 1) {     code here;     }           else {     code here;     }     ?>      How can I put the two blocks of codes inside the blog id conditional, is it possible? If not, is there another way to do this?


title: Creating multiple category drop down

text:
I'm trying to figure out on how to create a multiple category drop down to filter different types of post Here is an image of my work in progress http://i255.photobucket.com/albums/hh140/testament1234/multiple_category_zpsa93a6f33.png The category highlighted in a red box shape doesn't seem to be working. I'm not sure if it is because it has a conflict. I checked for any errors using firebug but nothing is displayed. I do not like to rely on plugins at the moment **Here is my HTML code**
projects

             <?php wp_dropdown_categories( $args ); ?>

             <?php wp_dropdown_categories( $args ); ?>
      **CSS:**               #cat{     background-image: url("images/form_arrow.png");     background-repeat: no-repeat;     background-position: 80% center;     border: 0px none;     float: right;     font-family:'Sintony', sans-serif;     margin-right: -25px;     overflow: hidden;     padding: 5px;     width: 200px;          }          .filter_container{     border: 2px solid #8e8fbb;     float: right;     height: 30px;     overflow: hidden;     position: relative;     }      **JS:**                          **Functions.php(Specify what categories to display)**               $args = array(     'show_option_all'    => '',     'show_option_none'   => '',     'orderby'            => 'ID',      'order'              => 'ASC',     'show_count'         => 0,     'hide_empty'         => 1,      'child_of'           => 0,     'exclude'            => '1,2,3',     'echo'               => 1,     'selected'           => 0,     'hierarchical'       => 0,      'name'               => 'cat',     'id'                 => '',     'class'              => 'postform',     'depth'              => 0,     'tab_index'          => 0,     'taxonomy'           => 'category',     'hide_if_empty'      => false,     'walker'             => ''     );      \-----UPDATED JS-----


title: Add tags to pages

text: I'd like to be able to add tags to my pages just like I can with posts. What would I need to do to enable the tag editor/entry for the page editor?


title: Why does my WordPress front-end categories plugin gives me a database error with my SQL syntax?

text: A few years back I created a plugin based off of an answer here: How do I create a way for users to assign categories to a post from the frontend? Here's a pastebin of the modified plugin: http://pastebin.com/g8sBJ3KT With an upgrade to 3.8, the plugin no longer works because of this SQL error error below, but I can't find the queries in my plugin that specifically correspond to the error. Here is the error log message:               WordPress database error You have an error in your SQL syntax;     check the manual that corresponds to your MySQL server version for     the right syntax to use near '' at line 1 for query SELECT     SQL_CALC_FOUND_ROWS  wp_4_posts.ID FROM wp_4_posts  INNER JOIN      wp_4_term_relationships ON (wp_4_posts.ID = wp_4_term_relationships.object_id)      WHERE 1=1  AND ( wp_4_term_relationships.term_taxonomy_id = 1925     /* From [myblogdomain.com/subdomain/category/category-slug/] in      [/nas/wp/www/cluster-1270/blog/index.php:17] */     made by require('wp-blog-header.php'), wp, WP->main, WP->query_posts,      WP_Query->query, WP_Query->get_posts, referer: http://myblogdomain.com/subdomain/      None of the category archive pages are loading, and each time I try to load one, I get a 404 on the front end and this error on the back end. When I load the wp-admin, I can see categories assigned to posts from the categories column in the "All Posts" view, but filtering by category in the wp-admin shows zero posts and also gives me this error in the logs:               WordPress database error You have an error in your SQL syntax; check the     manual that corresponds to your MySQL server version for the right syntax to     use near '' at line 1 for query SELECT SQL_CALC_FOUND_ROWS  wp_4_posts.ID FROM     wp_4_posts  INNER JOIN wp_4_term_relationships ON (wp_4_posts.ID =      wp_4_term_relationships.object_id) WHERE 1=1  AND (     wp_4_term_relationships.term_taxonomy_id = 1925 /* From      [blogdomain.com/site/wp-admin/edit.php?category_name=category-slug] in [N/A]     */ made by WP_Posts_List_Table->prepare_items, wp_edit_posts_query,     wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, referer:      http://blogname.com/site/wp-admin/edit.php


title: Insert image in custom row using woo-commerce plugin function

text: I am using the woo commerce plugin in bellow function ,I am trying insert one image which is stored in one session variable into the custom row woocommerce_order_items table File Name-> woocommerce-core-functions.php               function woocommerce_add_order_item( $order_id, $item) {              //added by sanjay              //added by sanjay         global $wpdb;              $order_id = absint( $order_id );              if ( ! $order_id )             return false;              $defaults = array(             'order_item_name'       => '',             'order_item_type'       => 'line_item',                 //Here i have added this BgImageName                   'BgImageName'                  => ''              );                $item = wp_parse_args( $item, $defaults );              $wpdb->insert(             $wpdb->prefix . "woocommerce_order_items",             array(                 'order_item_name'       => $item['order_item_name'],                 'order_item_type'       => $item['order_item_type'],                 'order_id'              => $order_id,                        //Here i have added this BgImageName and passed session variable                 'BgImageName'                   => $_SESSION['finalorederimage1']                  ),             array(                 '%s', '%s', '%d', '%s'             )         );              $item_id = absint( $wpdb->insert_id );              do_action( 'woocommerce_new_order_item', $item_id, $item, $order_id );              return $item_id;     }      Here is my functions.php Here I am retrieving the one image from different table name user_templates which is stored in session variable that image I have to insert into the custom row BgImageName in woocommerce-core- functions.php using this function woocommerce_add_order_item( $order_id, $item)               function insertimage() {              echo $item_id;       echo "hi";       global $wpdb;       $result = $wpdb->get_results ( "SELECT * FROM user_templates  where id= ".$_SESSION['user_te']);       foreach ( $result as $print )         $finalorederimage=$print->BgImageName;       $_SESSION['finalorederimage1']=$finalorederimage;       }


title: WordPress is giving errors after activating WP_DEBUG

text: In the root directory, I looked for `wp-config.php` and in that file I set `WP_DEBUG` to `true` and then got the following errors: > 1) Deprecated: Assigning the return value of new by reference is deprecated > in /home2/root/public_html/website/wp-content/plugins/exec-php/exec-php.php > on line 22 Here is the line: `$GLOBALS['g_execphp_manager'] =& new ExecPhp_Manager();` > 2) Notice: add_custom_background is deprecated since version 3.4! Use > add_theme_support( 'custom-background', $args ) instead. in > /home2/root/public_html/website/wp-includes/functions.php on line 2900 Here is the line: `trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );`. How to fix this problems?


title: Plugins enqueuing jquery in head

text: I am trying to optimise my site for mobile and enqueued my scripts to be placed in the footer so as to eliminate render-blocking javascript in above the fold content. Unfortunately some of the plugins the site uses do not do so. Is there a way to have some control over where their scripts are placed without hacking the plugin? Here is how the scripts I added are enqueued:               function test() {          wp_enqueue_script( 'hostel_mama-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );          if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {         wp_enqueue_script( 'comment-reply');     }          if ( is_singular() && wp_attachment_is_image() ) {         wp_enqueue_script( 'hostel_mama-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202', true );     }     }     add_action( 'wp_enqueue_scripts', 'test' );           if ( ! function_exists( 'frontend_assets' ) ) :           function frontend_assets() {          if (!is_admin()) {         wp_enqueue_style( 'hostel_mama-style', get_stylesheet_uri() );              wp_enqueue_script( 'foundation', get_template_directory_uri() . '/js/foundation.min.js', null, '4.0', true );         wp_enqueue_script( 'modernizr', get_template_directory_uri().'/js/vendor/custom.modernizr.js', null, '2.1.0');              wp_enqueue_script( 'hostel_mama-custom', get_template_directory_uri() . '/js/scripts.js', array('jquery','jquery-ui-datepicker'), '1.0', true );              wp_enqueue_script('google-maps', '//maps.google.com/maps/api/js?key=AIzaSyCSAVx-HQFqCCFvzQ_WIJCDLZL2uiOIvSA&sensor=true', array(), '3', true);              wp_enqueue_style( 'google-fonts', 'http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,300italic,400italic|Bitter|Squada+One' );       }     }     add_action( 'wp_enqueue_scripts', 'frontend_assets' );          endif;      Here is a link to the site : http://plug-inn.kirstencassidy.com/ Here is the plugin code that adds the scripts:               // register acf scripts         $scripts = array();         $scripts[] = array(             'handle' => 'acf-field-group',             'src' => $this->settings['dir'] . 'js/field-group.min.js',             'deps' => array('jquery')         );         $scripts[] = array(             'handle' => 'acf-input',             'src' => $this->settings['dir'] . 'js/input.min.js',             'deps' => array('jquery')         );         $scripts[] = array(             'handle' => 'acf-datepicker',             'src' => $this->settings['dir'] . 'core/fields/date_picker/jquery.ui.datepicker.js',             'deps' => array('jquery', 'acf-input')         );                   foreach( $scripts as $script )         {             wp_register_script( $script['handle'], $script['src'], $script['deps'], $this->settings['version'] );         }      This in turn is called by:               function field_group_admin_enqueue_scripts()     {         wp_register_script( 'acf-field-group-repeater', $this->settings['dir'] . 'js/field-group.js', array('acf-field-group'), $this->settings['version']);              // scripts         wp_enqueue_script(array(             'acf-field-group-repeater',          ));     }      The only add_action that applies is :               add_action('init', array($this, 'init'), 1);


title: how to get day month and year from wp_post_object?

text: i am trying get day month and year of a post from WP post object. what i did is:                      <?php             $cpost=get_post($_GET['p_id']);             echo $cpost->post_date;echo "<br>";           ?>      Outputs:                   2013-12-26 13:25:18      what i need is, day month and year as:                  26 Dec 2013


title: How can I place the "Add New Post" contents on a custom page?

text: I created an alternative to the default WordPress Admin panel for my writers to use as I wanted more flexibility (in design) and a simpler interface. I've been successful thus far but I can't seem to figure out how to take the "Add New Post" page from the default wp-admin to my custom page. What I mean is, I would like to take all of this ![enter image description here](http://i.stack.imgur.com/HiVh4.png) and put it on my own page. I've looked over the post-new.php and edit.php scripts but have had no luck. Is this even possible? I have just discovered the wp_editor function...but is it possible to add all the other things from the "Add New Post" page as well (such as the featured image, tags, categories sections, etc...)?