Wordpress “Categories to tags converter” not working. Pointing to import.php instead

I just imported my posts from blogger into wordpress. In doing this, the tags were converted to categories for some strange reason. I am now trying to convert them back into tag using wordpress' built in converter. However, whenever I click on the "Category to tag converter" link, it directs me to the import page "/import.php". Is there anything i can do to rectify this. Alternatively, could someone please copy the end of the URL for the converter tool's page, and paste it here so i can append it to my blog URL. Im guessing that could work meanwhile. Cheers in advance..


How to enable the content editor as a droppable target with jQuery-ui?

I'm trying to enable the WordPress content editor as a droppable using jQuery UI drag and drop. However, I can't get the drag to drop, or the drop event to fire. Is there something I'm missing?

drag one

drag two

drag three

          jQuery("#keywords").find("li").each(function(){jQuery(this).draggable(     {          helper:'clone',          start: function(event, ui){             jQuery(this).fadeTo('fast', 0.5);},              stop: function(event, ui) {                  jQuery(this).fadeTo(0, 1);                  }              });         });          jQuery('#content').droppable(     {          drop: function(event, ui)         {             alert('dropped in content'); //DOES NOT FIRE!!!             jQuery(this).dropIt(ui.draggable.html());         }      });          if(typeof tinyMCE=='object')     {          alert('tinyMCE is active'); //DOES NOT FIRE!!!         jQuery('#editorcontainer').droppable(         {              drop: function(event, ui)              {              alert('dropped in tinyMCE editor'); //DOES NOT FIRE!!!             //Dynamically add content             tinyMCE.activeEditor.execCommand('mceInsertContent', false, 'New content.');             }          });     }


Using wp_mail - verify that email was sent?

When using wp_mail, is there any way to verify that the email was sent correctly?


media page returnig to 404 in rtmedia

I am using rtmedia plugin with buddypress plugin to uploading audio, video and image uploading. I am using latest version of both the plugins. But when I browse to media page(i.e http://example.com/members/admin/media/) it returns to a 404 error, don't know what I am doing wrong. Please Help me.


Using Geo Data Store Plugin Code

I'm trying to simply use the Geo Data Store Plugin Code functions from within my theme files and have never done this. I've tested the $sc_gds to see if isset, yet not getting anything when looping the array (eventually to loop through them as map markers)               $type = "post_type";     $sc_gds = new sc_GeoDataStore();     $ids = (array) $sc_gds->getPostIDsOfInRange( $type, $radius, $lat, $lng );     foreach ($ids as $id) {     print $id;     }      Can someone explain how to use plugin file's public static functions and any information for using getPostIDsOfInRange would be appreciated greatly.


Make Permalink go to specific template

I have a single post page that contains an audio player. I need place a link on the page that will open up the player in a pop up window. Simple right? My thoughts were that I have an additional link using the_permalink open the post in a new window and just limit the loop to that new audio player. My question is how do I control what template the link (the_permalink) grabs? I'm familiar with the wordpress template hierarchy, and I don't want the permalink to grab single.php, instead i'd like it to grab pop-up-player.php template. Any idea how to do this? I've googled and searched stack exchange but can't seem to find anything related to what I'm trying to do.


Why is add_rewrite_endpoint incompatible with /%category%/%postname%/ permalink structure?

I've added a `myvar/myvalue` rewrite endpoint to `EP_ALL` which can be added to any URL of a WP installation and a WP plugin will act upon it. That part is cool but it doesn't work when the permalink structure is `/%category%/%postname%/`. It works well with all the built in, selectable structures. There could be other structures it doesn't work with. **Doesn't work = 404 error.** The path looks something like this: `/mycategory/mypost/myvar/myvalue` I got the Rewrite analyzer plugin which tells me that it's interpreted as (top 4, in order): * * * This is not it... (highlighted with yellow) `(.?.+?)/myvar(/(.*))?/?$`   pagename: mycategory/mypost   myvar: myvalue * * * Apparently this gets used but it's still cold... `.?.+?/([^/]+)/myvar(/(.*))?/?$`   attachment: mypost   myvar: /myvalue * * * Plain wrong... `(.?.+?)(/[0-9]+)?/?$`   pagename: mycategory/mypost/myvar   page: /myvalue * * * **This is it, but it fails to realize it!** `(.+?)/([^/]+)/myvar(/(.*))?/?$`   category_name: mycategory   name: mypost   myvar: myvalue * * * And I'm outputting `global $query_string;` which tells me it's   `attachment=mypost&myvar=%2Fmyvalue` (by the way it shouldn't include the %2f - slash). So can someone enlighten me if this is a bug in WP, or is there something I can do about it? My idea is roughly this   `if ( '/%category%/%postname%/' == $wp_rewrite->permalink_structure ){ ... }`   and manually telling WP the category and the name and displaying that content. But I don't know what goes as `...` and what should I hook this into.


Wordpress Custom Post Type Front End Data Inputs by User

We created a custom post type "items" and its showing at admin end, now we want a user can insert a item from front end and this will be link to a menu item called "My Account" so a user can see his all inserted item and can add new item by clicking a link "Add New Item". How can we achieve this, any help will be highly appreciated.


Foreach displays from last to first

I created the foreach loop to display post images, but It displays them from last to first, how can I make It to displays from first to last ;) ?                    <?php $args = array(          'post_type' => 'attachment',         'numberposts' => -1,           'post_status' => null,            'post_parent' => $post->ID          );               $attachments = get_posts( $args );           if ( $attachments ) {        foreach ( $attachments as $attachment ) : ?>        <p>                               <?php echo wp_get_attachment_image( $attachment->ID, 'full' ); ?>           </p>             <?php endforeach;               }        ?>


Grab next post title in archive page

I am using a custom query on a page to display single posts from a specific category, one post per page. Here is my current query:               $results = new WP_Query( array(         'post_type' => 'post',         'posts_per_page' => 1,         'paged' => get_query_var( 'paged' ),         'cat' => 6         ) );      Right now I have pagination setup that displays < Previous and Next > links. I want to replace those links with the title of the next and previous. Is this possible to do since technically this does not live under a "Single" post but rather more of an archive inside of a page? I have tried `next_post_link()`, etc. but since I am only retrieving one post per page, this doesn't work. Ideas?


'Attempt to modify property of non-object' warning

I use the bellow function to disable a plugin update. It works, because I use an old version of this plugin and it does not show me that a newer version exists, but, however, I get a warning on line 2: _Attempt to modify property of non-object_. How to fix this?               function my_filter_plugin_updates( $value ) {        unset( $value->response['duplicator/duplicator.php'] ); //Duplicator        return $value;     }          add_filter( 'site_transient_update_plugins', 'my_filter_plugin_updates' );         **UPDATE** I am not a PHP coder, so I do not know if what I did is correct, but this works - no errors, no warnings, no plugin update:               // Disable plugin update     function my_filter_plugin_updates() {        $value = new StdClass;        unset( $value->response['duplicator/duplicator.php'] ); //Duplicator        return $value;     }          add_filter( 'site_transient_update_plugins', 'my_filter_plugin_updates' );


Hierarchical Taxonomy Terms Select Menu Output with selected="selected" Set

I have been trying to wrap my head around a issue for the past 2 days but despite trying all I could, I can't seem to reach the solution. On the backend, I have a hierarchical taxonomy named "Programs" for the user object. The hierarchy is as follows:               Parent     --  Child     --- Grand Child      I have a frontend user settings form where I'm outputting the terms of this taxonomy using the following code:               $args = array('hide_empty' => false, 'hierarchical' => true, 'parent' => 0);      $terms = get_terms("program", $args);     $fieldName = "programs";          $html = '';     $html .= '<select name="' . $fieldName . '"' . 'class="programs"' . '>';     foreach ( $terms as $term ) {         $selected = $terms[0]->term_id;         $html .= "<option value='".$term->term_id."'".($selected == $term->term_id ? ' selected="selected"' : '').">" . $term->name . '</option>';              $args = array(             'hide_empty'    => false,              'hierarchical'  => true,              'parent'        => $term->term_id         );          $childterms = get_terms("program", $args);              foreach ( $childterms as $childterm ) {                 $selected = $childterms[0]->term_id;                  $html .= "<option value='".$term->term_id."'".($selected == $childterm->term_id ? ' selected="selected"' : '').">" . $term->name . ' > ' . $childterm->name . '</option>';                  $args = array('hide_empty' => false, 'hierarchical'  => true, 'parent' => $childterm->term_id);              $granchildterms = get_terms("program", $args);                  foreach ( $granchildterms as $granchild ) {                     $selected = $granchildterms[0]->term_id;                 $html .= "<option value='".$term->term_id."'".($selected == $granchild->term_id ? ' selected="selected"' : '').">" . $term->name . ' > ' . $childterm->name . ' > ' . $granchild->name . '</option>';             }         }     }     $html .=  "</select>";     echo $html;      This code outputs the following HTML and although when I submit the form, the correct taxonomy term is getting saved in the database, the frontend form always shows "Grand Child 1" as selected, even if "parent" or "child" is set in the database. I also see the first 3 options are getting set as selected while only one should be set as selected at any given time :               <select name="programs" class="programs">         <option value="6" selected="selected">Parent</option>             <option value="7" selected="selected">Parent > Child 1</option>                 <option value="8" selected="selected">Parent > Child 1 > Grand Child 1</option>              <option value="9">Child 2</option>     </select>      Here is a dump of the $terms (parent) variable:               Array     (     [0] => stdClass Object         (             [term_id] => 6             [name] => Parent             [slug] => parent             [term_group] => 0             [term_taxonomy_id] => 6             [taxonomy] => program             [description] =>              [parent] => 0             [count] => 0         )          )     1      Kindly help! Thanks a lot!


Is it possible to create nested lists in the WYSIWYG editor?

I'm looking to set up WP for a user that does not know or care about HTML, so I need everything to work in the WYSIWYG editor. She'll be working on posts that have lots of nested bullet lists, but I can't seem to figure out how to make it work. Any thoughts? Tabbing didn't work, clicking the buttons didn't work. Hitting 'indent' could be hacked into a solution, but it's certainly not ideal and I don't know how consistent it'll be. I know I can fiddle with the HTML, but like I said, I don't want to get into that. I can copy/paste from Word, but that's a terrible solution. I'm open to a plugin or alternate editor, though that's not ideal either.


Display Custom Taxonomy

I am using custom post types in a theme optimized for web radios (custom theme). I added a custom post type called "Radio Shows" and registered two custom taxonomies: one hierarchical (like default "categories", I named it GENRE) and the other is not (like "tags", I named it INSTRUMENTS). I've managed to get that custom post type's posts displayed in index.php with the rest of the default post type's posts and also created a page template that displays only the custom post type's posts (Radio Shows).   It works fine, I can see them being displayed normally, in correct order etc. What's not being displayed in both pages (index & template page dedicated to custom post type) is the custom taxonomies. In default posts, inside the loop are being displayed:   1. CATEGORIES   2. TITLE   3. THUMBNAILS   4. CONTENT   5. TAGS.  What I want to achieve is to get GENRE & INSTRUMENT custom taxonomies displayed in the place that CATEGORIES & TAGS do in default post types. Normally I should tell you what I have tried so far... well, I tried at least 20 ways I found on several tutorial websites so it's difficult to list them. None of them worked for me.


add image size still doesn't work even after regenerating thumbnails

I'm encountering this very frustrating problem where `add_image_size()` just doesn't seem to work at all (in fact, I've never seen it even work before). By not working, I mean not resizing / crop (if I take away my CSS width / height, the thumbnail will be the exact size in which I have uploaded it). I do have:   1. `add_theme_support( 'post-thumbnails' )`   2. `add_image_size( 'small-thumb', 60, 60, true )`   3. `the_post_thumbnail( 'small-thumb' )`   4. And most importantly, yes I've been regenerating my thumbnails close to 50 times now after changing the `add_image_size()` and it's not working. Now I do have a question related to this problem: Does CSS styling like `max- width`/ `max-height`/ `width` / `height` or anything effect WordPress' thumbnail functions? Anyone seem to know what else I can try to fix this? Thanks


Get post meta in enqueued js file

I am writing a plugin in which I have a js file. I enqueue it with wp_enqueue_script. In this file I have some functions. The functions are triggered by an onclick event of a button. The button is located on edit post page. Now I need those functions to get post meta of the edited post, modify and save. Does anyone have any idea how to do it?


Enforcing canonical URLs with multiple custom post types

I'm working on a project with several custom post types, where one of the post types is naturally (but not actually in the WordPress sense) the 'parent' of the others. For example, say I have a custom post type called 'book' and another one called 'character', and say I want to have the following custom URL structure:               books/[book-name]/characters/[character-name]      Thus, the canonical URL for the post about the character Thing One in the book The Cat In the Hat would be:                books/cat-in-the-hat/characters/thing-one      A character is associated with a book with a post meta row. I've created custom rewrites to make it work...               add_rewrite_rule (         '^books/([^\/]+)/characters/([^\/]+)/?$',         'index.php?book=$matches[1]&character=$matches[2]&post_type=character'     );      ...but I'd also need to make sure that the 'character post' in the URL belongs to the 'book'...               books/cat-in-the-hat/characters/thing-one     //good     books/anna-karenina/characters/count-vronsky  //good     books/anna-karenina/characters/thing-one      //bad      This can't happen automatically: I have to hook into a filter or an action to check whether the character matches the book, and if not, either redirect to the correct, canonical URL or force a 404. Where's the best place to accomplish this check? My choices (so far) are:   * The `request` filter -- i.e. checking before the main query is instantiated.   * The various WP_Query filters -- i.e. make WP_Query do the checking for me by adding a post meta constraint. I realize this is rather an open-ended question and probably a matter of taste, but any insight into the most code and database efficient way of doing things would be appreciated. Thanks.


Missing the first 6 Posts and displaying posts that are after the latest 6

Is it possible to run an array to not show the first 6 posts, but then to show posts labeled 7-15 say? So that way I can display the first 6 posts elsewhere and then the rest somewhere else? More Information: I have a site here: http://universitycompare.com/student-info and I would like the site to display the first 6 post's in images and then the rest as text below in the 'more articles' section. Any more help needed to answer just let me know, the more control over this the better, so I would like to run them separately. If you need to know my PHP that I am using see below: (I have left the HTML mark up in for the mean time so you know how i'm changing the style of it).                   <?php if (have_posts()) : while (have_posts()) : the_post(); ?>              <?php $the_query = new WP_Query( 'showposts=6' ); ?>         <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>

         <a href="<?php the_permalink() ?>">         <?php if ( has_post_thumbnail() )         the_post_thumbnail('si-images');?>

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

 Date:           <a style="color:#154157;" href="<?php the_permalink() ?>">         <?php the_time( get_option( 'date_format' ) ) ?>

         <?php endwhile;?>

                              <?php endwhile; endif; ?>


Redirect user to a particular link in 10 seconds after using wp_die

I want to use some type of functionality               if ( $some_condition == false )     {         wp_die();         // Here i want to redirect page on some URL after 10 seconds     }      I need to do it inside a plugin. Is it possible to do that?


Removing an action, or dequeueing style - Both not working

What I am wanting to achieve is to remove an action called inside of another action. The action is calling a style, and although I have tried to deregister, and dequeue the style, it is still displaying on the admin pages. Here is the code snippet (inside of WooCommerce):               function woocommerce_admin_menu() {         global $menu, $woocommerce;...              $print_css_on = apply_filters( 'woocommerce_screen_ids', array( 'toplevel_page_woocommerce', 'woocommerce_page_woocommerce_settings', 'woocommerce_page_woocommerce_reports', 'woocommerce_page_woocommerce_status', 'product_page_woocommerce_attributes', 'edit-tags.php', 'edit.php', 'index.php', 'post-new.php', 'post.php' ) );              foreach ( $print_css_on as $page )             add_action( 'admin_print_styles-'. $page, 'woocommerce_admin_css' );     }     add_action('admin_menu', 'woocommerce_admin_menu', 9);      What I've tried to do:               add_action('init', 'remove_action_123', 999);     function remove_action_123() {             $print_css_on = apply_filters( 'woocommerce_screen_ids', array( 'toplevel_page_woocommerce', 'woocommerce_page_woocommerce_settings', 'woocommerce_page_woocommerce_reports', 'woocommerce_page_woocommerce_status', 'product_page_woocommerce_attributes', 'edit-tags.php', 'edit.php', 'index.php', 'post-new.php', 'post.php' ) );add_action('init', 'remove_action', 999);                  // Remove 'woocommerce_admin_menu'         foreach ( $print_css_on as $page )         remove_action( 'admin_print_styles-'. $page, 'woocommerce_admin_css' );     }      This is how it's being enqueued:               function woocommerce_admin_css() {         global $woocommerce, $typenow, $post, $wp_scripts;...              if ( $typenow == '' || $typenow == "product" || $typenow == "shop_order" || $typenow == "shop_coupon" ) {             wp_enqueue_style( 'woocommerce_admin_styles', $woocommerce->plugin_url() . '/assets/css/admin.css' );         }              do_action('woocommerce_admin_css');     }      So I also tried:               wp_dequeue_style( 'woocommerce_admin_styles' )      But it is still not working. Any ideas on how to successfully remove this css? Thanks! Roc.


How to assign a Permalink to a Function

In Drupal, you can assign a URI to a function that gets called, like this:               function mymodule_menu() {         return array(             'custom_uri' => array(                 'page callback' => 'my_custom_function',                 [...]             );         );     }      This then tells Drupal to call the function `my_custom_function` whenever the url is `http://www.mysite.com/custom_uri`. In Wordpress I'm trying to accomplish the same idea. I want to have a custom URI that somehow calls a function to render output. From what I've found I can use WP_Rewrite to turn a permalink into a query string and then check for the query string in my plugin. Going that route, how would I display my own content in the site's theme? The other option I've seen is to do it via a shortcode, but then that means either the user generates a page or I do it programmatically (and then probably use WP_Rewrite to set up a custom permalink). This seems messy and I'd rather the user not have to worry about doing any work. Are there any more options?


Custom WP_Query with complex 'post_status' argument

I'm trying to run a `WP_Query()` with a bit of a twist. I need to include two `post_status`es and specifically exclude another. I've got `WP_Query( array( 'post_status' => array( 'publish', 'customstatus' ) ) );` which works, but it seems to also pull in `auto-draft`, which I can NOT have. Is there a way to do like `'post_status' => array( array('publish', 'customstatus'), 'not_in' => 'auto- draft' ))` where I can include two and exclude one explicitly?


Get a single post by a unique meta value

Is there a fast way to retrieve a specific post by a unique meta value? I could run a meta_query and then loop through the first value to get the post's ID, but I am wondering if there is any other that I am overlooking. Is it possible to add a column to the wp_posts table? Or is there some other way to add a second unique number to each post? To explain I need to take a WooCommerce order (which is just a post type called 'shop_order') and send it to a 3rd party and they send back a unique reference from their system, which so far I have stored as meta. Normally I would send them the post ID as the order number, because when they send their info back with the post ID as order number it is easy to then set the post meta with the additional info they send. However, there is another plugin ( called Sequential Order numbers ) which filters the post IDs to always show a sequential number. This makes great sense from a human-readable point of view. However, I can't send this sequential order number because when it comes back to me I can't use that value to `update_post_meta` since it isn't post ID in the database. If I send them the actual post ID and the two sides ever have to talk in person they won't be referencing the same order ID number which would be confusing I think (much like this question). So again to try to restate my question... is there a more efficient way to get a post by a second unique value that isn't the post ID?


Exclude featured image from gallery in wp-admin

Is there a way to prevent the featured image from even showing up in a post's gallery? e.g. when editing the gallery in the admin for a post, the featured image isn't there.


Pagination with wp_pagenavi not working on custom page

I am having trouble with `wp_pagenavi` working on the start page using a custom query. It's working well on every standard template like category.php. But not on the homepage. Here is the code:               <?php                  $args=query_posts(array(               'post__not_in'=> array(419),               'post_type' => 'post',               'posts_per_page' => 10,               'paged' => get_query_var('page'), ));                  $my_query = new WP_Query($args);             if( $my_query->have_posts() ) {                    while ($my_query->have_posts()) : $my_query->the_post(); ?>         <?php             $featuredImage = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );                  $s1=strtolower($title);                 ?>         <div id="post-<?php echo $post->ID;?>" <?php $item_format = is_video() ? 'video' : 'post'; post_class('item cf item-'.$item_format); ?>>
             <?PHP 'Id.'" title="'.esc_attr(get_the_title($post->Id)).'" href="'.get_permalink($post->Id).'">'?>                  <a class="clip-link"  title="<?php the_title();?>" href="<?php the_permalink();?>" rel="bookmark">                                              <?php echo'Id)).'" />';?>

              <?php               endwhile;          global $my_query;          $total_pages = $my_query->max_num_pages;                    if($total_pages > 1)              { ?>

                         <?php                          if(function_exists('wp_pagenavi')) {                             wp_pagenavi();                         } else {                             $label = __('« Prev', 'dp');                             if($prev = get_previous_posts_link($label))                                 echo str_replace('<a', '<a clas="prev"', $prev);                             else                                 echo ''.$label.'';                                  $label = __('Next »', 'dp');                             if($next = get_next_posts_link($label))                                 echo str_replace('<a', '<a class="next"', $next);                             else                                 echo ''.$label.'';                         } ?>

         <?php      }          }                wp_reset_query();  // Restore global post data stomped by the_post().         ?>

      The pagination shows up, but the url `/page/2/` is not working, it shows `/page/1/` result.


Styling Contact Form 7 fields

We are using wordpress plugin contact form 7 and want to specify the width of the subject field (assume answer would apply to setting width of any field) and relocate the Your Email next to the Your Name field. Result would be Email and Name on one line, Subject full width underneath, Your Message underneath Subject. Thanks


Purchased Theme to Custom Made Theme?

I bought a theme from Themeforest and now I would like to convert it to a custom made theme. I was creating the theme with the Underscores theme: http://underscores.me/ but how do I keep the same custom post types in the next theme? Is this less time consuming than recoding the purchased theme?


Admin Panel Menu Classes - Add Them To Anchor

I was wondering if there was a way to apply the classes you assign in the Admin Panel Menus to the Anchor Tags instead of The List Items. I tried to use a Walker Class to maybe get the classes out that way but it looks like by the time it gets there they're already in the `$classes` variable (if we're looking at The Walker in The Codex) and the only way I can imagine getting them out is to search the array (or string). `$classes = empty( $item->classes ) ? array() : (array) $item->classes;` Is there a specific way to get those specific classes only that you can assign in the admin panel via Walker or some kind of filter? There is a way using `preg_grep()` but if you're not using font-awesome and your classes are actually unique, this won't work. . . WordPress has to be saving this data somewhere.


Single page theme: Can I render other pages with their respective themes within another page?

I'm trying to create a one page theme. I need all the pages created by the admin to show up on one page. I used the following code I found in a similar question in here:               foreach ($pages as $page_data) {         $content = apply_filters('the_content', $page_data->post_content);         $title = $page_data->post_title;         $slug = $page_data->post_name;         echo "
";         echo "
$title
";         echo $content;         echo "
";     }      The problem with this code is that it does not render the page according to the template provided for that page. Is it possible to have each page rendered as they would if their URL was visited? Which leads to my next question; once this is done, a lot of bloat must be loaded (eg. a header, menu, footer etc. for each page). Is it possible for the page template to know if it is being rendered as the "main view" / only view, or is being rendered as part of something else? I'm quite sure this question must have been asked a million times, but I can't seem to find any answers in regard to rendering the view according to the templates, so I hope I don't baffle anyone just by asking :)


How to solve the fopen error?

I recently updated xampp to 1.8 and enabled xdebug. I'm not sure if this is the reason for this error message which I didn't see before:               Warning: fopen(http://api.wordpress.org/plugins/info/1.0/): in C:\xampp\htdocs\wodpress\wp-includes\class-http.php on line 923      Maybe I did something wrong at server configure. but there isn't really anything more than enable xdebug. Need help!


manipulate a plugins shortcode

I want to add some javascript directly below content, added by another plugin's shortcode. We are using the NextGen Gallery plugin and there are many articles containing the [nggallery] shortcode. I don't want to change all articles and I don't want to inform all authors to use another shortcode in the future. And I also don't want to modify the original plugin. Is there a way to modify a shortcode like:               function put_script_after_nggallery_shortcode( $atts ){      return "[nggallery $atts] <script>foo();</script>";     }     add_shortcode( 'nggallery', 'put_script_after_nggallery_shortcode' );      or should I hook somehow into the rendering process of the_content() to put my script directily in the_content string after [nggallery id=nnn]. Could that be done with a filter for the_content?


Permalinks, how to show them in post

So I created page               www.example.com/NEWS/       and I want all the posts from that category to show up there. It does that, but when I add a post (NEWS), the link is :               www.example.com/newpost/       I want to show it as               www.example.com/NEWS/newpost/      Thanks :)


How to log database changes during an upgrade?

I have Wordpress installed in a classical LAMP configuration. Is there any way to, in a protected environment (like staging), automatically log all database changes (i.e. drop indexes or alter tables) done by a wordpress upgrade process?


Automatic excerpts

How to display excerpts in the homepage instead of full post automatically, without the need to insert `<!--more-->` in every post ? I tried this plugin http://wordpress.org/extend/plugins/advanced-excerpt/ which or doesn't work or I can't use it. Here's how I configure it http://wordpress.org/support/topic/plugin-advanced- excerpt-doesnt-work-installed-by-instructions-url- included?replies=1#post-2810718 This is my website. **I solved the problem using Michael's answer, which made my plugin work.** http://wordpress.org/extend/plugins/advanced-excerpt/


How to copy/paste web content with photos into my blog

I use my wordpress blog for research... When I write about something, the firs thing I do is research of what's already out there on given topic. What I want to do is to be able to copy paste parts of the web pages for reference... If the page is only text... that's grand. But If the page contains pictures, I can't copy that image to my research blog easily... is there a plugin which would allow me to copy parts of webpages (with pictures) into my blog - same as I was using microsoft word for note taking. Thanks Edit: Actually I need something which will enable me to use my wordpress as evernote... I want to store content on my blog and be able to access it later... Easily


contextual_help, change the "Help" tab label

Is there any way to change the "Help" tabs label? I speak about the top right tab to toggle the contextual help. I'm looking to change "Help" label by "Documentation". I work on WordPress 3.3 and 3.4 beta Thanks for your advices


Removing widget without using unregister_widget

I want to remove some plugin widget showing from wp-admin/widgets.php but i dont want to use unregister_widget because i am using this widget automatically from php files.. Basically i dont want clients see this widget as option in wp- admin/widgets.php but i want to use this widget from php files. I thought css display:none as solution but widget div IDs are not static seems Any idea?


Get blog id of subdirectory multisite blog from name - *outside* of wordpress request processing

I have a Zend Framework 1.11.1 MVC application that has Wordpress 3.7.1 installed as a subdirectory multisite network below its "public" directory. It uses must-use plugins to ensure that only logged-in users of the MVC application can access any of the blogs. Basically, the earliest MU plugin runs the ZF application's bootstrap to get access to the ZF logged-in state, and hooks 'after-setup-theme' to a function that checks the MVC login state and permissions database and either just returns to allow access, or redirects to a page in the MVC application that explains why access to the blog was not allowed. It's actually a bit more complicated (e.g. it creates a blog on the fly for a logged-in MVC user if one doesn't already exist), but that's the gist of it. Within the plugins, I can call `get_blog_id_from_url` to get the blog id from the request, and in principle it would return 0 if there is no such blog. But if the request is for a blog that does not exist, then I get a 404 before any must use plugin runs. I can work around that by issuing the requests to the root blog, and passing the site name information as a GET parameter. But what I'd really like to do is have the MVC application code check for the existence of a particular blog, **without actually issuing a request to wordpress**. I guess I could explicitly connect to the wordpress database and query the wp_blogs table, but I wanted to avoid getting that "intimate" with the wordpress code. But figuring out the load dependencies needed in order to be able to call `get_blog_id_from_url` from MVC code was pretty tough. I wound up trying something like this:               public function get_blog_id_for_mvc_request($blogname) {         global $wpdb;         $orig_uri = $_SERVER['REQUEST_URI'];         // $_SERVER['REQUEST_URI'] = PATH_CURRENT_SITE;         // but PATH_CURRENT_SITE is not yet defined, so hardwire for now         $_SERVER['REQUEST_URI'] = '/wp/';         require_once(APPLICATION_PATH . '/../public/wp/wp-load.php');         $site_id = get_blog_id_from_url(DOMAIN_CURRENT_SITE, PATH_CURRENT_SITE . (strlen($blogname) ? "$blogname/" : ""));         $_SERVER['REQUEST_URI'] = $orig_uri;         return $site_id;     }      Modifying and restoring $_SERVER['REQUEST_URI'] made me feel pretty queasy, but looking at the wordpress code there appeared to be no other way. This function actually did work in terms of getting the correct site id and continuing on to the MVC page that used the site id. But after the page was rendered in the browser, httpd crashed (Apache 2.2.14 with PHP 5.3.1 on XP): ![enter image description here](http://i.stack.imgur.com/fbRQk.jpg) Does anyone have any suggestions, either for tracking down/fixing the server crash, or for accessing the database directly in a simple and reliable way?


What Does this Code Snippet Do?

I got this error message when I was installing a plugin: "Unable to locate WordPress Content directory (wp-content)". I found a solution here: http://wordpress.org/support/topic/cannot-find- content-directory-wp-content They suggested adding the following code to the wp-config.php file:               if(is_admin()) {         add_filter('filesystem_method', create_function('$a', 'return "direct";' ));         define( 'FS_CHMOD_DIR', 0751 );     }      This solution worked for me. My questions are: a) What does this code do? b) If I run into the same error on the production server is it safe to use this code? Thank you. -Laxmidi


Sticky Posts Not Sticking to Top of Category Archive

I'm using my index.php to display post archive pages rather than a specific archive.php file. This works fine, however sticky posts do not stick to the top of it. They do however, stick to the top of the posts page. Are sticky posts not supposed to stick to the top of archive pages? Here is the code for the loop I'm using; loop-index.php \- http://pastebin.com/NHi2tsNM Am I doing something wrong? Or is this just default functionality?


debug notice on my WordPress site

How can i see notice and warning on WordPress site. Like Notice: undefined variable on line 29. my client have point out these Notice while i am unable to see these notice any help please


Is it wrong to use the English version of WordPress to server a site in a different language?

I'm building an online store for an Indonesian market, so the front-end must be in Bahasa Indonesian. Will using the English version of WP, and a theme in English without .po files, introduce complications/errors/bad experience if the content is in Bahasa Indonesia? Ie. Incorrect language attributes. Or is it ok to use the English version of WP and fill it with content written in Bahasa Indonesia?


How to show a feed that requires user/pass within a sidebar widget?

I'm trying to do something and I don't seem to yield any successful results when searching neither at wordpress.org forums nor here. I would like to extend the standard RSS widget so that I can set an user/password for HTTP Authentication in order to fetch the feed items. If there is an existing solution that I'm missing and already provides this feature, any pointer will be much appreciated. Thanks.


Set TRUE or FALSE based on a wp_localize_script option value

I am trying to pass a variable value to my JS file using `wp_localize_script` and setting a function's one of the options to either `true` or `false`. Despite of all my efforts, its not working. Here is what I have in head.               <script type='text/javascript'>     /* <![CDATA[ */     var CUPID = {"button":"false"};     /* ]]> */     </script>      And, here is what I want to achieve,               window.onload = function(){         (function(){             button : false // Or, true based on the CUPID.button value         });     });      Here is what I am doing,               window.onload = function(){         (function(){             button : CUPID.button         });     });      That doesn't seem to work. Why? I tried to declare the value using `elseif` statement, but that didn't work either.               if ( CUPID.button == 'true' ) {         var btn == true;     } else if ( CUPID.button == 'false' ) {         var btn == false;     }         window.onload = function(){             (function(){                 button : btn             });         });      What I am doing wrong? Sorry if this is elementary, but I am still at learning phase. **EDIT:** Okay, I got it working with `button : (CUPID.button == "true")` Thanks for your time.


custom post type vs. conditionally displaying meta boxes for specific terms?

**The Problem:** My personal blog resides at `example.com`, and I want to create a bookshelf where I share all the books I read or plan to read. I could do this in two ways:   1. Create a category called "Books" to display the latest books I added (like archive). Create a custom taxonomy "Subject" to classify books. Use custom template files category-books.php and taxonomy-subject.php, and use `in_category( 'books' )` in single.php to customize the look (so that it looks more like a bookshelf). The permalink structure of my blog is already like this: `/%category%/%postname%/` and the category base is stripped. Therefore, the URLs of the Books archive and the book (post) would look like: `http://example.com/books/` and `http://example.com/books/book-name/`, respectively. Use Advanced Custom Fields plugin to display some custom meta boxes conditionally in the edit page, i.e. only when "Books" category is checked.   2. Create a custom post type called "Books" with `'rewrite' => array('slug' => 'books')`. Therefore, the URLs of the Books archive and the book (post) would look like: `http://example.com/books/` and `http://example.com/books/book-name/`, respectively. Create a custom taxonomy "Subject" to classify books. Use custom template files archive-books.php, single-books.php, and taxonomy- subject.php to customize the look (so that it looks more like a bookshelf). Use Advanced Custom Fields plugin to display some custom meta boxes in the edit page for the custom post type - "Books". Which of the two methods is the better way to accomplish what I am after? (I mean the way it's meant to be done.) I am still confused as to whether or not custom post types are meant for this purpose; even after reading these:   * Post Formats vs. Custom Post Types   * Post types and formats and taxonomies, oh my!


How to mix pages and sub-categories in a url

I have a series of products which are organized into categories like:   * Windows      * Product Lines        * Specific Window type post Initially I created a page (/windows) which links to the individual product lines. Each Product Line (category) has the name and short description. The problem I discovered is that the post category(also /windows) takes precedence over the page when you click on Windows in a menu. Taking you to the Windows category instead of the Windows page. Is it possible to create a url that consists of a mix of page, category and finally posts?               site.com/windows/serenity/casement                ^       ^         ^              Page   Category    Post      Is there a better method here? This is starting to seem sloppy to me. In the end, I'd like to keep the individual products as posts.


How can I add Details about a company in Woocommerce checkout form

How can I add details (array boxes) upon checking a checkbox if the person who is ordering is representing a company (in checkout) NAME / SURNAME ## [x] I represent a Company -COMPANY NAME -REG NUMBER -FISCAL CODE * * *


WordPress isn't setting my <title> tag

I am on this screen of WordPress: ![enter image description here](http://i.stack.imgur.com/WqYRw.png) And when I press save, the meta description tag for my home page gets set, but my `<title>` tag does not. Would anyone know why this happens? Also, for some reason the `<title>` tag doesn't have the meta keyword in there on the home page. Would anyone know why that happens?


Search multiple meta keys at once

How would I modify the following SQL Query to allow me to search multiple meta keys at once? e.g. user_business AND user_about In the end I'll be searching about 40 - 50 different meta keys; or if there's an option to search ALL of them, that'd be even better.               <?php     /**      * @package WordPress      * @subpackage themename      */          get_header(); ?>     <?php          $url = $_SERVER['REQUEST_URI'];         $tokens = explode('/', $url);         global $search;         $search = $tokens[sizeof($tokens)-1];         $searchQuery = str_replace("-", " ", $search);     ?>     <?php echo $search; ?>

                     <?php the_post(); ?>
                          <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> role="article">
Search Results for: <?php echo $searchQuery; ?>

                                  <?php                             global $wpdb;                             $usermeta = $wpdb->prefix . 'usermeta';                                  // get id of user                             $select_user = "SELECT user_id FROM $usermeta WHERE meta_key = 'user_business' AND meta_value LIKE '%$searchQuery%'";                             $user_id = $wpdb->get_var($select_user);                             echo $user_id;                             ?>

<?php if ( dynamic_sidebar('main-sidebar') ) : else : ?><?php endif; ?>

     <?php get_footer(); ?>


Importing a database from a custom built CMS to WordPress

I'm building a site for an art gallery, in the old cms has 20 years worth of exhibitions. The old system is custom built and is not based on anything readymade, so finding an importer plugin made for that is out of a question. Any idea how to proceed? Big thanks!


how to prevent words inside image tags from being update in a sql query via php

I need to update certain words inside wp_posts table (1032 posts in a specific time range) but I would like to exclude some words when they are inside tags like so:               <img class="alignleft" title="word2replace" alt="word2replace" src="http://www.mydomain.com/wp-content/uploads/2010/01/image-word2replace.jpg" width="350" height="175" />      Better explained: If the posts where published between 2010-01-29 and 2010-08-03, and the word to replace (word2replace) is inside tags I want to leave them alone and untouched and update all the others.


Host does not allow remote connection, so how do I transfer data to my WordPress site?

I spent the last week trying to get my PHP code on my website to connect to my remote "personal" computer to display some data on a webpage. I just found out today from my web host (ipage) "our platform does not allow remote database connections in either directions. I apologize for any inconvenience this may have caused." So I am wondering if there is any other method to get data from a remote database to my website. Whether it is live data or a code I have to run every day or so; I would like to display this info on my site.


WP_User_Query not searching

I currently have the following code, and a user named "Clark Farm" in the user_business table. The code below returns nothing. If I remove the search term then all of the users are listed. I'm trying to determine why the search is not working..               <?php     /**      * @package WordPress      * @subpackage themename      */          get_header(); ?>     <?php          $url = $_SERVER['REQUEST_URI'];         $tokens = explode('/', $url);         $search = $tokens[sizeof($tokens)-1];         $searchQuery = str_replace("-", " ", $search);     ?>     <?php echo $search; ?>

                     <?php the_post(); ?>
                          <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> role="article">
Search Results for: <?php echo $searchQuery; ?>

                                  <?php                                  // WP_User_Query arguments                                 $args = array (                                     'search'         => 'Clark',                                     'search_columns' => array( 'user_business' ),                                     'count_total'    => true,                                     'fields'         => 'all_with_meta',                                 );                                      // The User Query                                 $user_query = new WP_User_Query( $args );                                      // The User Loop                                 if ( ! empty( $user_query->results ) ) {                                     foreach ( $user_query->results as $user ) {                                         echo $user->user_business . '
';                                     }                                 } else {                                         echo 'NOT WORKING!';                                 }                             ?>

<?php if ( dynamic_sidebar('main-sidebar') ) : else : ?><?php endif; ?>

     <?php get_footer(); ?>


Setting a redirect cookie in wordpress

I've been searching on the net for a solution to my problem all day, but I can't make sense of anything I see, since I know absolutely NOTHING about coding. ### What I'd like to do:   1. I'd like to set a cookie when a person visits one particular page on my website, let's call it Page 1.   2. Then, when that visitor goes to another unrelated page (Page 2), he/she gets automatically redirected to Page 3 (because of the cookie that was set when they visited Page 1). Visitors without the cookie, don't ever get to see Page 3. ### What I've managed to do so far: I've managed to SET the cookie in Wordpress functions.php, by inserting the following:               function set_newuser_cookie() {         if (!isset($_COOKIE['subscriber'])) {             setcookie('subscriber', no, 0, COOKIEPATH, COOKIE_DOMAIN, false);         }     }     add_action( 'init', 'set_newuser_cookie');      I've managed to define a redirect by inserting the following in functions.php:               if (!isset ($_COOKIE['subscriber']))     header ("Location: page2");     else     header ("Location: page3");      That's as far as I've gotten. It doesn't work because neither of the above are page-specific. I only want the cookie to be set (or variable changed) when the visitor visits one specific page, and then get redirected when he visits another specific page. Is this doable? Oh, and by the way, I'm on a self-hosted Wordpress site. Thanks so much. Sammie


Creating relationships between multiple content types

I'm working on a site where there are multiple content types in addition to the built-in ones (see list below). I'd like to establish the ability to mark related content in any direction, from any content type to any other. The content types are:   * `post`   * `page`   * `topic` (from bbpress)   * `case` (custom types from here on down)   * `note`   * `question`   * `therapy_guideline` Below I have code from my `functions.php` used to set up possible connections from posts to the other content types:               p2p_register_connection_type(         array(             'name' => 'post-to-post',             'from' => 'post',             'to' => 'post'         )     );          p2p_register_connection_type(         array(             'name' => 'post-to-page',             'from' => 'post',             'to' => 'page'         )     );          p2p_register_connection_type(         array(             'name' => 'post-to-topic',             'from' => 'post',             'to' => 'topic'         )     );          p2p_register_connection_type(         array(             'name' => 'post-to-case',             'from' => 'post',             'to' => 'case'         )     );          p2p_register_connection_type(         array(             'name' => 'post-to-note',             'from' => 'post',             'to' => 'note'         )     );          p2p_register_connection_type(         array(             'name' => 'post-to-question',             'from' => 'post',             'to' => 'question'         )     );          p2p_register_connection_type(         array(             'name' => 'post-to-therapy_guideline',             'from' => 'post',             'to' => 'therapy_guideline'         )     );      That's just for establishing relationships from posts to other content types. I've repeated these incantations to establish the other various connections - 28 in total. I cringe at the repetition. This could get really awkward if more content types are added, and if they need to be able to connect to all (or most) of the other types. It's occurred to me that I could use a loop to iterate over each of these content types and generate a connection to each other type, but that doesn't feel right. I've also read about the _reciprocal_ value, but that seems to be from a content type back to the same type. Is there a way to simplify creating connections between distinct content types without having to do it for each direction (from and to)? My intent is to facilitate the selection of related content relative to the current content, via the backend when creating/editing content. Then to display a "Related Content" section following the display of said current content. These related content pieces could be across the spectrum of content types in use, but would be manually selected to ensure maximum relevance. I am using custom taxonomies across these content types, and had considered using that for finding related content, but the taxonomies would still be too broad. Manual selection seems to be the way to go.


Print output of Table Creation

I am creating a few tables and I getting the following message: > The plugin generated 440 characters of unexpected output during activation. > If you notice “headers already sent” messages, problems with syndication > feeds or other issues, try deactivating or removing this plugin. Here is the code:               global $wpdb;          require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );          $table_name = $wpdb->prefix . jp_event_table;          $sql = "CREATE TABLE IF NOT EXISTS $table_name (         id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,         event_id BIGINT(20) UNSIGNED NOT NULL,         name VARCHAR(50) NOT NULL,         description TEXT,         spaces INT,         PRIMARY KEY  (ticket_id)         ) ENGINE=InnoDB ;";          dbDelta($sql);          $sqlcomm = "CREATE TABLE IF NOT EXISTS WP_AWESOME_TABLES (         id INT UNSIGNED NOT NULL AUTO_INCREMENT,         PRIMARY KEY  (id)         ) ENGINE=InnoDB ;";          dbDelta($sqlcomm);      I have searched around but I cannot find a solution to this. I am aware that using dbDelta() has a few weirdnesses to it (like having to have exactly two spaces after PRIMARY KEY), but did I miss anything? **More importantly:** Is there some way for me to see what characters are being returned? Could it be an error message that would tell me what line of code is throwing the error? I have PHP debugging turned on but nothing is getting printed out. Any suggestions would be extremely appreciated!


How to pass data around?

I have different menu items. When the user clicks on a menu item, I want them to go to a particular destination. Each menu's destination has a different background color. I'm thinking that I can pass a variable around and based on the value, I can set the bgcolor.   This is just one example of why I want to pass data around. Does Wordpress have anything built in that allows me to do this? Should I use session variables?


Setting up WordPress with Custom Permalinks and no .htaccess File?

I have a client that strongly prefers to disable .htaccess files because they like to set the Apache configurations themselves. However, they still want SEO-friendly URLs. Is there a way to have custom permalinks with no .htaccess file? My research thus far seems to indicate this is not possible, but perhaps one of brilliant developers knows how the seemingly impossible can be possible. Thanks in advance!


WP site not showing front or backend content after adding htaccess

I have added an htaccess file to WP but have now lost all content front and backend. I added this htaccess plus a htpasswd file; `AuthType Basic AuthName "restricted area" AuthUserFile /wk- dev/schoolscapes/.htpasswd require valid-user` I have since deleted this file uploaded a fresh wp htaccess file but still can not see frontend or access the admin area. Many thanks for looking.


redirect the root of a domain, while leaving the www version unredirected

I have some bad links pointing at `abc.com`. Wordpress automatically redirects `abc.com` to `www.abc.com`. I need to redirect `abc.com` to a holding page... let's say `www.abc.com/holding.html`. What is the best way to do this? I've tried a bunch of things but none of them work :(


Easiest Way to Create a Patch for Submission to WordPress Core?

I've submitted a few patches for WordPress core on Trac (one of which has been used) but every time I think about doing it I cringe because my setup for doing so is incredibly tedious. Can someone please detail out the steps needed to submit a patch for core, and then the best way to streamline the process so it's not so tedious? I work Mac OS X and PhpStorm currently but I'm thinking a shell script might be easiest? Or maybe a PHP Script that does all the rote work? One of the issues is I don't fully understand what I need to be starting with. Do I start with trunk? Do I have to download a new copy and add to/edit that copy with my code every time I want to create a patch? Again, while I have done it working with SVN and patching is really outside my current skillset and I want to change that. Hoping you WordPress patching experts can come to my rescue. Thanks in advance. ### UPDATE: After @hakre's answer I figure I should add more to the question:   * Can I create patches from older version or must I use trunk?    * If I'm working on a project using the released version (3.0.1) can I modify it and create a patch for core or do I have to download and set up a pristine and new copy of trunk and newly make my modifications there?    * Can I do with shell scripts so I can encode the login into the script and just run the script to recreate everything I need and/or to create the patch?    * And what are the pitfalls? All of these questions seem to be assumed by those who know how WordPress's SVN works and as such are always glossed over in any discussion.


Passing parameters to a static front page

I have googled a lot, but so far haven't come close to a proper solution yet. I need help with passing parameters to the homepage of a WordPress website. Here's my setup / requirements:   1. I use a page template (say, MCTemplate) that is set as the static front page in Settings -> Reading.   2. I use 'Post name' permalink structure.   3. I need to pass a single parameter (say, mcdata) to the static homepage (i.e., MCTemplate). I have used the following code in functions.php, but when I pass the parameter to the homepage (e.g., http://www.example.com/?mcdata=helloword), it show a list of latest posts instead of static front page.               function mc_query_vars( $qvars ) {         $qvars[] = 'mcdata';         return $qvars;     }     add_filter( 'query_vars', 'mc_query_vars' );      Using front-page.php comes close to solving this, but in that case I cannot use a static front page. Are there any rewrite rules or anything that I should change to get it working with the above requirements? All help is appreciated.


Undefined index: action plugin problem

i have 4 error in the **plugin logo slider** the first error in line 89 and i fixed it and one of the other the errors in 225 > Notice: Undefined index: action in /plugins/logo-slider/logo-slider.php on > line 89 and the other 3 errors in on line 225 but there is 2 other left in 225               225    if(isset($wp_logo_slider_images['update']) == 'Added' || $wp_logo_slider_images['update'] == 'Deleted' || $wp_logo_slider_images['update'] == 'Updated') {      and when i click update it give me > Notice: clean_url is deprecated since version 3.0! Use esc_url() instead. in > /wp-includes/functions.php on line 2841 but when i one funcution.php i cant find clean_url so i could replace it


Checkboxes in registration form

I want to use checkboxes on registration form, but values are not storing in the profile page. here is the code on functions.php               <?php     add_action( 'show_user_profile', 'my_show_extra_profile_fields' );     add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );          function my_show_extra_profile_fields( $user ) { ?>
Settori di interesse

                              <input type="checkbox" name="user_silos" id="user_silos" value="true" <?php if (esc_attr( get_the_author_meta( "user_silos", $user->ID )) == "true") echo "checked"; ?> />                 Silos             	                              <input type="checkbox" name="user_biodigestori" id="user_biodigestori" value="true" <?php if (esc_attr( get_the_author_meta( "user_biodigestori", $user->ID )) == "true") echo "checked"; ?> />                 Biodigestori             	                              <input type="checkbox" name="user_unitratt" id="user_unitratt" value="true" <?php if (esc_attr( get_the_author_meta( "user_unitratt", $user->ID )) == "true") echo "checked"; ?> />                 Unità di trattamento             	                              <input type="checkbox" name="user_imt" id="user_imt" value="true" <?php if (esc_attr( get_the_author_meta( "user_imt", $user->ID )) == "true") echo "checked"; ?> />                 Impianti di media tensione             	                              <input type="checkbox" name="user_cabelet" id="user_cabelet" value="true" <?php if (esc_attr( get_the_author_meta( "user_cabelet", $user->ID )) == "true") echo "checked"; ?> />                 Cabine elettriche             	                              <input type="checkbox" name="user_zoot" id="user_zoot" value="true" <?php if (esc_attr( get_the_author_meta( "user_zoot", $user->ID )) == "true") echo "checked"; ?> />                 Zootecnica

     <?php }?>               <?php     add_action( 'personal_options_update', 'my_save_extra_profile_fields' );     add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );          function my_save_extra_profile_fields( $user_id ) {         if (!isset($_POST['user_silos'])) $_POST['user_silos'] = "false";          update_user_meta( $user_id, 'user_silos', $_POST['user_silos'] );         if (!isset($_POST['user_biodigestori'])) $_POST['user_biodigestori'] = "false";          update_user_meta( $user_id, 'user_biodigestori', $_POST['user_biodigestori'] );         if (!isset($_POST['user_unitratt'])) $_POST['user_unitratt'] = "false";          update_user_meta( $user_id, 'user_unitratt', $_POST['user_unitratt'] );         if (!isset($_POST['user_imt'])) $_POST['user_imt'] = "false";          update_user_meta( $user_id, 'user_imt', $_POST['user_imt'] );         if (!isset($_POST['user_cabelet'])) $_POST['user_cabelet'] = "false";          update_user_meta( $user_id, 'user_cabelet', $_POST['user_cabelet'] );         if (!isset($_POST['user_zoot'])) $_POST['user_zoot'] = "false";          update_user_meta( $user_id, 'user_zoot', $_POST['user_zoot'] );          }     ?>      on the registration page I have this code
                      <input type="checkbox" name="user_silos" id="user_silos" value="true" <?php if (esc_attr( get_the_author_meta( "user_silos", $user->ID )) == "true") echo "checked"; ?> />             Silos                               <input type="checkbox" name="user_biodigestori" id="user_biodigestori" value="true" <?php if (esc_attr( get_the_author_meta( "user_biodigestori", $user->ID )) == "true") echo "checked"; ?> />             Biodigestori                               <input type="checkbox" name="user_unitratt" id="user_unitratt" value="true" <?php if (esc_attr( get_the_author_meta( "user_unitratt", $user->ID )) == "true") echo "checked"; ?> />             Unità di trattamento

                      <input type="checkbox" name="user_imt" id="user_imt" value="true" <?php if (esc_attr( get_the_author_meta( "user_imt", $user->ID )) == "true") echo "checked"; ?> />             Impianti di media tensione                               <input type="checkbox" name="user_cabelet" id="user_cabelet" value="true" <?php if (esc_attr( get_the_author_meta( "user_cabelet", $user->ID )) == "true") echo "checked"; ?> />             Cabine elettriche                               <input type="checkbox" name="user_zoot" id="user_zoot" value="true" <?php if (esc_attr( get_the_author_meta( "user_zoot", $user->ID )) == "true") echo "checked"; ?> />             Zootecnia
       Does anyone know where I'm wrong? thanks for the help * * * EDIT With multiple checkboxes it doesn't work... If during the registration there aren't selections, on the profile page the checkboxes are all selected.               <?php          add_action( 'register_form', 'signup_fields_ckb' );     add_action( 'user_register', 'handle_signup_ckb', 10, 2 );     add_action( 'show_user_profile', 'user_field_ckb' );     add_action( 'edit_user_profile', 'user_field_ckb' );          function signup_fields_ckb() {     ?>
Settore di interesse

                              <input type="checkbox" name="user_silos" id="user_silos" value="true" <?php if (esc_attr( get_the_author_meta( "user_silos", $user->ID )) == "true") echo "checked"; ?> />                 Silos                                           <input type="checkbox" name="user_biodigestori" id="user_biodigestori" value="true" <?php if (esc_attr( get_the_author_meta( "user_biodigestori", $user->ID )) == "true") echo "checked"; ?> />                 Biodigestori                                           <input type="checkbox" name="user_unitratt" id="user_unitratt" value="true" <?php if (esc_attr( get_the_author_meta( "user_unitratt", $user->ID )) == "true") echo "checked"; ?> />                 Unità di trattamento

                              <input type="checkbox" name="user_imt" id="user_imt" value="true" <?php if (esc_attr( get_the_author_meta( "user_imt", $user->ID )) == "true") echo "checked"; ?> />                 Impianti di media tensione                                           <input type="checkbox" name="user_cabelet" id="user_cabelet" value="true" <?php if (esc_attr( get_the_author_meta( "user_cabelet", $user->ID )) == "true") echo "checked"; ?> />                 Cabine elettriche                                           <input type="checkbox" name="user_cooger" id="user_cooger" value="true" <?php if (esc_attr( get_the_author_meta( "user_cooger", $user->ID )) == "true") echo "checked"; ?> />                 Coogeneratori

                              <input type="checkbox" name="user_zoot" id="user_zoot" value="true" <?php if (esc_attr( get_the_author_meta( "user_zoot", $user->ID )) == "true") echo "checked"; ?> />                 Zootecnica                                           <input type="checkbox" name="user_attagri" id="user_attagri" value="true" <?php if (esc_attr( get_the_author_meta( "user_attagri", $user->ID )) == "true") echo "checked"; ?> />                 Attrezzature Agricole                                           <input type="checkbox" name="user_agriwat" id="user_agriwat" value="true" <?php if (esc_attr( get_the_author_meta( "user_agriwat", $user->ID )) == "true") echo "checked"; ?> />                 Agri Water
          <?php     }          function handle_signup_ckb( $user_id, $data = null )      {         $user_silos = $_REQUEST['user_silos'];         $user_biodigestori = $_REQUEST['user_biodigestori'];         $user_unitratt = $_REQUEST['user_unitratt'];         $user_imt = $_REQUEST['user_imt'];         $user_cabelet = $_REQUEST['user_cabelet'];         $user_cooger = $_REQUEST['user_cooger'];         $user_zoot = $_REQUEST['user_zoot'];         $user_attagri = $_REQUEST['user_attagri'];         $user_silos = $_REQUEST['user_agriwat'];              if ( isset( $user_silos ) ) { add_user_meta( $user_id, 'user_silos', $user_silos );}         if ( isset( $user_biodigestori ) ) { add_user_meta( $user_id, 'user_biodigestori', $user_biodigestori );}         if ( isset( $user_unitratt ) ) { add_user_meta( $user_id, 'user_unitratt', $user_unitratt );}         if ( isset( $user_imt ) ) { add_user_meta( $user_id, 'user_imt', $user_imt );}         if ( isset( $user_cabelet ) ) { add_user_meta( $user_id, 'user_cabelet', $user_cabelet );}         if ( isset( $user_cooger ) ) { add_user_meta( $user_id, 'user_cooger', $user_cooger );}         if ( isset( $user_zoot ) ) { add_user_meta( $user_id, 'user_zoot', $user_zoot );}         if ( isset( $user_attagri ) ) { add_user_meta( $user_id, 'user_attagri', $user_attagri );}         if ( isset( $user_agriwat ) ) { add_user_meta( $user_id, 'user_agriwat', $user_agriwat );}     }                    function user_field_ckb( $user )      {         $user_silos = get_the_author_meta( 'user_silos', $user->ID );         $user_biodigestori = get_the_author_meta( 'user_biodigestori', $user->ID );         $user_unitratt = get_the_author_meta( 'user_unitratt', $user->ID );         $user_imt = get_the_author_meta( 'user_imt', $user->ID );         $user_cabelet = get_the_author_meta( 'user_cabelet', $user->ID );         $user_cooger = get_the_author_meta( 'user_cooger', $user->ID );         $user_zoot = get_the_author_meta( 'user_zoot', $user->ID );         $user_attagri = get_the_author_meta( 'user_attagri', $user->ID );         $user_silos = get_the_author_meta( 'user_agriwat', $user->ID );     ?>

                            <?php _e('Silos'); ?>
               <?php printf('<input type="checkbox" name="user_silos" id="user_silos" %1$s />', checked( $user_silos, '', false ));?>               	               <?php _e('Biodigestori'); ?>
               <?php printf('<input type="checkbox" name="user_biodigestori" id="user_biodigestori" %1$s />', checked( $user_biodigestori, '', false ));?>               	               <?php _e('Unità di trattamento'); ?>
               <?php printf('<input type="checkbox" name="user_unitratt" id="user_unitratt" %1$s />', checked( $user_unitratt, '', false ));?>               	               <?php _e('Impianti di media tensione'); ?>
               <?php printf('<input type="checkbox" name="user_imt" id="user_imt" %1$s />', checked( $user_imt, '', false ));?>               	               <?php _e('Cabine elettriche'); ?>
               <?php printf('<input type="checkbox" name="user_cabelet" id="user_cabelet" %1$s />', checked( $user_cabelet, '', false ));?>               	               <?php _e('Coogeneratori'); ?>
               <?php printf('<input type="checkbox" name="user_cooger" id="user_cooger" %1$s />', checked( $user_cooger, '', false ));?>               	               <?php _e('Zootecnica'); ?>
               <?php printf('<input type="checkbox" name="user_zoot" id="user_zoot" %1$s />', checked( $user_zoot, '', false ));?>               	               <?php _e('Attrezzature agricole'); ?>
               <?php printf('<input type="checkbox" name="user_attagri" id="user_attagri" %1$s />', checked( $user_attagri, '', false ));?>               	               <?php _e('Agriwater'); ?>
               <?php printf('<input type="checkbox" name="user_agriwat" id="user_agriwat" %1$s />', checked( $user_agriwat, '', false ));?>

     <?php      }     ?>


Gravity Forms Custom Templates

Im trying to further customise my Gravity Forms "Address" labels. At the moment they read "Street Address", "City" and "ZIP / Postal Code". I, for example, want to change "ZIP / Postal Code" to "Post code". Does anyone know if you can use templates to override these values in your theme without messing up the core GF files? common.php seems to be the place where these values are stored:               public static function get_address_types($form_id){              $addressTypes = array(             "international" =>  array("label" => __("International", "gravityforms"),"zip_label" => apply_filters("gform_address_zip_{$form_id}",apply_filters("gform_address_zip", __("ZIP / Postal Code", "gravityforms"), $form_id), $form_id),"state_label" => apply_filters("gform_address_state_{$form_id}",apply_filters("gform_address_state",__("State / Province / Region", "gravityforms"), $form_id), $form_id)),             );              return apply_filters("gform_address_types_{$form_id}", apply_filters("gform_address_types", $addressTypes, $form_id), $form_id);     }      Any help would be appreciated. Thanks in advance.


Show posts on a Google Map

Through the custom fields, I assigned to each post its geographic coordinates (latitude/longitude). Now, I'd like to show a Google Maps with a marker for each post. Do you have any suggestions on how to do this effectively? **EDIT:** Solved following this G.M.'s answer.


Custom Post Type archive giving 404

I am using WAMP with the latest version of WordPress installed. I have a custom post type created using the following...               function register_fruit() {     register_post_type('fruit', array(     'labels' => array(     'name' => __( 'Fruit' ),     ),     'public' => true,     'has_archive' => true,     'capability_type' => 'post',     'rewrite' => array("slug" => "/fruit", "with_front" => false),     'supports' => array( 'title', 'editor', 'thumbnail'),     'taxonomies' => array('category', 'post_tag') // this is IMPORTANT     ));     }     add_action('init', 'register_fruit', 0 );      This works fine when viewing individual items for example..               www.mydomain.com/fruit/apple     www.mydomain.com/fruit/orange     www.mydomain.com/fruit/pear      But if I try and view the archive pages such as...               www.mydomain.com/fruit      I get a 404, I can't see where the problem lies, can anyone help?


How to convert a WordPress install under SVN to one that is not?

On one of my WordPress installs, I used SVN to do the initial install. I thought that this would help upgrades...and it did for awhile. I tried it with the latest release 3.0.1, and this method did not work. (I perform an svn update, run the upgrade.php script and the upgrade.php returns an error.) So now I want to convert my SVN installed Wordpress to a regular one. What is the best way to go about this? Or do I need to install 3.0.1 and then import my data over?


Adding if statement into the_content()

I've created my own page template where I have a list of posts coming in directly below the content as so:               <?php the_content(); ?>                 <?php query_posts('category_name=vacancies'); ?>
     <?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?>
     <?php endwhile; ?>
     <?php // Reset Query     wp_reset_query(); ?>      This works fine on this page, however on the main index page my template is set up so it loads in the_content() four different pages. I want to include this within one of them e.g: if query_posts() exists in page then load into the_content() on index page Bit confusing, hope I'm making sense, any ideas?


How to include child terms within parent?

I have the following for a specific term ID:               <?php if (!is_tax( 'listing_category', '542' )) { ?>     test1         <?php else: ?>      test2     <?php } else {  ?>      This works great for making test2 appear within term 542, but I want to include all of its child terms as well. How would I go about doing this?


Custom Feed URLs

I am creating a custom feed for one of my post types, and letting users set the name of that feed. http://www.mysite.com/feed/userdefinedname Now I'd like to also enable users to show not only all the posts from that CPT but also filter them by category. At the moment it works like so: http://www.mysite.com/feed/testcategory However I'd very much prefer it if I could structure it as follows: http://www.mysite.com/feed/userdefinedname/testcategory Is that possible? Here's the code that is generating these category based feeds:                /**      * Generate the feeds for categories      *      * @since 1.0      */     function rss_c_add_category_feed( $in ) {              $category = $GLOBALS['wp_rewrite']->feeds[ count( $GLOBALS['wp_rewrite']->feeds ) - 1 ];              // Prepare the post query         // Get published rss_feed posts with a rss_category slug in the taxonomy         $rss_custom_feed_query = apply_filters(                         'rss_custom_feed_query',             array(                 'post_type'   => 'rss_feed',                  'post_status' => 'publish',                 'cache_results' => false,   // disable caching                 'tax_query' => array(                     array(                         'taxonomy' => 'rss_category',                         'field'    => 'slug',                         'terms'    => array( $category ),                         'operator' => 'IN'                     )                 )             )         );              // Submit the query to get latest feed items         query_posts( $rss_custom_feed_query );              $sources = array();         while ( have_posts() ) {             the_post();             $sources[] = get_the_ID();         }                   // Create the query array         $pre_query = array(             'post_type'      => 'rss_feed_item',              'post_status'    => 'publish',             'cache_results'  => false,   // disable caching             'meta_query'     => array(                                     array(                                         'key'     => 'rss_feed_id',                                         'value'   => $sources,                                         'compare' => 'IN'                                     )             )         );              // Get options         $options = get_option( 'rss_settings_general' );         if ( $options !== FALSE ) {             // If options exist, get the limit             $limit = $options['custom_feed_limit'];             if ( $limit !== FALSE ) {                 // if limit exists, set the query limit                 $pre_query['posts_per_page'] = $limit;             }         }              // query the posts         query_posts( $pre_query );              // Send content header and start ATOM output         header('Content-Type: application/atom+xml');         // Disabling caching         header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1.         header('Pragma: no-cache'); // HTTP 1.0.         header('Expires: 0'); // Proxies.         echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';         ?>         <feed xmlns="http://www.w3.org/2005/Atom">             <title type="text">Latest imported feed items on <?php bloginfo_rss('name'); ?></title>             <?php             // Start the Loop             while ( have_posts() ) : the_post();                  ?>             <entry>                 <title><![CDATA[<?php the_title_rss(); ?>]]></title>                 <link href="<?php the_permalink_rss(); ?>" />                 <published><?php echo get_post_time( 'Y-m-d\TH:i:s\Z' ); ?></published>                 <content type="html"><![CDATA[<?php the_content(); ?>]]></content>             </entry>             <?php             // End of the Loop             endwhile;             ?>         </feed>         <?php     }


Problems loading stylesheet and permalinks after rebooting

I am using Ubuntu Server 10.04.02 LTS to host my WordPress, which version is 2.9.2. The problem is, after rebooting the server and loading my homepage of WordPress, the style of my blog was just missing, and all permalinks could not be loaded, even /wp-admin! However, after restarting apache2 with sudo service apache2 restart, they just all came back! Could someone please help me troubleshoot the problem? Your help will be greatly appreciated. ## Updated: Solution Replace `<VitualHost my.domain.com:80>` with `<VirtualHost *:80>` in `apache2/sites-available/virtualhostfile` then reload apache2. That's it :)


get_comments not working on custom post types

I am trying to get all the comments of the logged in user in the "foods" CPT but I'm still with no success. Here's my code:               <?php     $args = array(             'user_id' => $user->ID,             'post_type' => 'foods', // when I removed this, the list only showed the comments left on posts but not on Foods CPT             );              $comments = get_comments( $args );              if ( $comments )         {             $output.= '
';             foreach ( $comments as $c )             {             $output.= '
';             $output.= 'comment_ID ).'">';             $output.= get_the_title($c->comment_post_ID);             $output.= ', Posted on: '. mysql2date('m/d/Y', $c->comment_date, $translate);             $output.= "
\n";             }             $output.= '
';                            echo $output;                   } else { echo "
No comments yet.
";}     ?>      This code returns no comments despite me, the user, commenting on posts in Foods CPT. Plus, when I deleted the post_type line, instead of showing all the comments I made, it only showed the comments I left on Posts and not on Foods CPT. I created the CPT through WP Types but to ensure that it's not the plugin that's making the problem, I manually created another CPT in the functions file and commented on the post I created there. Still, my comment in this CPT did not show. What could be the problem behind this?


Gallery not displaying images when clicking on them

I've inserted a wordpress gallery in to my site (on a custom post type) using the editor. The code it's added is `[gallery link="file"]`. The gallery is displaying correctly, and when hovering over the images, I can see the correct URL for the large size image: "http://localhost:8888/mntn/wp- content/uploads/2012/07/P1000857.jpg". However, when I click on the image, the larger image doesn't display. Alls that happens is that the url changes from:               http://localhost:8888/mntn/trips/photo-gallery-test      to               http://localhost:8888/mntn/trips/photo-gallery-test#!prettyPhoto[pp_gal]/0/      The last number in that URL is incremented based on the image I click on. Any ideas as to what's wrong here?


How to display Section for certain time

i am building a News site. I want to display 1 featured post from "prime" category for only few hours. after it should be expired or disappeared from the section. please have a look here u can see the post on top.
      <?php $the_query = new WP_Query('category_name=prime&showposts=1&orderby=post_date&order=desc');          if ($the_query->have_posts()) :?>
     <?php while ($the_query->have_posts()) : $the_query->the_post(); ?>     <?php endwhile; ?>

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

<?php echo limit_words(get_the_excerpt(), '190'); ?><a href="<?php the_permalink(); ?>"><?php _e('आगे  पढे...', 'BharatNews'); ?>

<?php bharti_get_image('image',560,320,' '.$GLOBALS['align']); ?>

          <?php endif; ?>


Using Form to alter PHP variable

I'm pulling custom posts by their meta_key using this function:               <?php $args = array(         'numberposts'     => 10,         'meta_key'        => 'allvotes',         'orderby'         => 'meta_value',         'order'           => 'DESC',         'post_type'       => 'things',         'post_status'     => 'publish' );     $mystuff = get_posts( $args );     ?>       I want to involve a form which will edit my variables, but when I try my code, it doesn't return any posts...               <?php      $filter = $_POST['country'];      $submit = $_POST['submit'];      if(isset($submit)){         $args = array(         'numberposts'     => 10,         'meta_key'        => '$filter',         'orderby'         => 'meta_value',         'order'           => 'DESC',         'post_type'       => 'things',         'post_status'     => 'publish' );     $mystuff = get_posts( $args );     $name = $filter ;     }     else {         $args = array(         'numberposts'     => 10,         'meta_key'        => 'canada',         'orderby'         => 'meta_value',         'order'           => 'DESC',         'post_type'       => 'things',         'post_status'     => 'publish' );     $mystuff = get_posts( $args );     $name = 'Everywhere';     };     ?>


Is $page a global variable in wordpress?

I am having a problem with a local $page variable, especially when using it in The Loop. Is it a reserved variable of Wordpress? Also where can I find a list of all those global variables?


"tax_query" parameter not working with WP_Query

I have a custom post type called 'episode'. Attached to 'episode' I have a custom taxonomy called 'video_type' that contains two terms: "bonus-footage" and "episode"; "episode" contains two child terms "season-1" and "season-2" (other seasons will be added in the future). I want to grab only the most recent post of the 'episode' type but not include any posts from the 'bonus- footage' term. Below is the code I'm using for this:               <?php     $some_args = array(         'tax_query' => array(             'taxonomy' => 'video_type',             'terms' => 'bonus-footage',             'field' => 'slug',             'include_children' => true,             'operator' => 'NOT IN'          ),         'posts_per_page' => 1,         'post_type' => 'episode',     );          $s = new WP_Query( $some_args );          if ( $s->have_posts() ) : $s->the_post();         // Do something with this post.     endif;     ?>      The query works as expected if a post in one of the 'season' terms is the newest, but if a post in "bonus-footage" is the newest, then it's loading that one. In other words my "tax_query" parameters appear to have no affect on the query. Am I not formatting the "tax_query" properly or am I missing something else? I've also tried setting "tax_query" as below:               'tax_query' => array(             'taxonomy' => 'video_type',             'terms' => 'episode',             'field' => 'slug',         'include_children' => true,             'operator' => 'IN'     ),      but I'm still getting the same result.


Error after moving wordpress blog

i was working on a wordpress blog under a test domain (example.com/blog/) and now i want to move it under its own domain which is on the same server but different vhost. After googling a bit i found a way to do it by simply moving the files however this generated a 500 internal error. This is (almost) normal because the site reads the old site location. I had to update it with the follwing code placed inside the functions.php               <?php     update_option('siteurl','http://example.com');     update_option('home','http://example.com');     ?>      I tried with this code to reload the page cuple of times as the wordpress docs said but again nothing! I also updated the database to the example.com but still nothing. Is it possible to fix it? Also can i simply change the vhost location to the /arduino/ folder? My server config: Ubuntu 13 Nginx MariaDB Current location: /var/www/clients/client0/web3/web/arduino/ Desired location: /var/www/clients/client0/web7/web/ Any ideas on how to make it work? Im using ISPconfig to create virtual hosts


Wordpress Shortcode in Menu Item Title

I've looked and have not found anything that works. I am trying to include a shortcode in a menu item's 'Navigation Label'. Basically Iwould like to have a dynamic title displaying the user's name & avatar.               [profilepicture round] [user_name]      Right now it's just spit back out since Wordpress Menus do not parse shortcodes. I've tried:               function my_nav_menu_objects_shortcode_mangler($items) {         foreach ($items as $item) {            $item->title = do_shortcode($item->title);         }         return $items;     }      But it doesn't parse it. I also tried $item->type_label with no luck. Am I just referencing the wrong attribute of item? Also tried the following with no luck.                add_filter('wp_nav_menu_items', 'do_shortcode');      The avatar and username can both be retrieved via php if needed:               <?php echo userpro_profile_data('user_login', $user_id); ?>     <?php echo userpro_profile_data('profilepicture', $user_id); ?>


What happens to the mu-plugins folder when you upgrade to Wordpress 3?

I am about to press the "upgrade" button in my Wordpress MU 2.8 install. What is going to happen to the mu-plugins folder? And is there an equivalent way for me to automatically activate a plugin across all my sites?


Custom Post Type & Meta Box - Displaying meta box information on front end?

I've created a custom post type "projects" that has a meta box for additional information (client name, type of project, budget, etc). I'd like to be able to display this information on the front-end. The custom post type is available to be added to custom menus if desired ('show_in_nav_menus' => true), but when you view each project, all you see is the title and the description. Ideally, I'd like the meta data to show with the title and description in whatever theme that is being used for the site, but I don't know if that's possible. Is there a way to display the meta box information on the front-end without having to either (a) touch the theme files (since themes can change so I don't want to do that) or (b) calling my own function that returns my own page template for the projects (because then it won't use the theme that is active)? Thanks! ETA - This is all done within my plugin.


Inserting into data into external DB using WPDB

I'm trying to work with an external db in Wordpress for the first time and can't seem to get it to insert the data into the DB. Here's what I have:                   <?php         global $wpdb;         $url = home_url();                  require_once($url.'/viper/confff.php');  //contains variable to fill in below                 $newdb = new wpdb($username, $password, $db_name, $host);                 $newdb->show_errors();          ?>          $numrows = $newdb->get_results("SELECT * FROM chi_clients WHERE AccountNum='$acctNum'");                if($numrows!=0)           {             $row =  $newdb->get_results("SELECT * FROM chi_clients WHERE AccountNum='$acctNum'",ARRAY_A);                         $name= $row['lastName'] . ", " . $row['firstName'];             $phone= $row['phone'];             $phonearea = substr($phone,0,3);             $phonemain = substr($phone,3,10);             $phonenumber = $phonearea ."-". $phonemain;             $email= $row['email'];                  $newdb ->insert (                         chi_orders, array(                             'name' => '$name',                             'AccountNum' => '$acctNum',                             'email' => '$email',                             'OrderDesc' => '$orderDesc',                             'product' => '$service',                             'quantity' => '$quantity',                             'notes' => '$notes',                             'status' => 'Order Received',                             'dateIne' => '$todayDate',                             'dateOut' => '$newDate',                             'advert' => '$advert',                             'phone' => '$phonenumber'                         )                        );             }                       else {                echo'Incorrect Account Number!';                      }      I know the data is being posted to page as I have the variables echoed out to display on the page. However it's not connecting to the Database as I'm not getting the information from the get_results SELECT statement and it's not inserting anything into database. For my $host- I'm using 'localhost' which is what I've always used for this particular database. And I know that the username, pass, and database name are correct. any ideas? thanks.


Display Terms for all posts in Current Archive or Query

I am using the following code to create a list of linked terms belonging to a taxonomy.               <?php     $taxonomy = 'taxonomy_name';     $queried_term = get_query_var($taxonomy);     $terms = get_terms($taxonomy, 'slug='.$queried_term);     if ($terms) {       echo '
';       foreach($terms as $term) {         echo '
slug, $taxonomy).'">'.$term->name.'
';       }       echo '
';     }     ?>      Is there a way that I can modify this so that once a term is selected/clicked and the archive is shown, the term list will then only show terms that are also attached to posts in the current term archive - effectively like a filtering/drill-down system?


Replacing & in JS code on pages

I am needing to remove the `&` that seems to be replacing my `&` on my page code. My original code looked like this:               $.get("../form/master.php?called=CAP&captcha="+$("#captcha_txt").val(), {}, function(response){      and now, looking at the source code to the page that loads that within wordpress:               $.get("../form/master.php?called=CAP&captcha="+$("#captcha_txt").val(), {}, function(response){      What can i do in order for it not to replace my `&` within my JS code?


How to set a Preset category for custom post types?

For Posts you can have a preset category where all Posts fall if not specified otherwise (settings -> writing). Can this be done for custom post types that have a custom taxonomy? The `register_taxonomy` does not seem to offer parameters for that. Thanks again :)


Add Custom Script in Other Plugin's Options page

I am trying to put a custom inline JavaScript is an options page created by a plugin.   The page URL is like this `wp-admin/admin.php?page=psbg`. This is the code I am using to output my script at the head.               function add_scripts() {         $current_screen = get_current_screen();              if ( $current_screen = 'admin.php?page=psbg' ) {             // My codes here         }     }     add_action( 'admin_head', 'add_scripts' );      That's not working. But if I change the compare value of `$current_screen` to               if ( $current_screen = 'admin.php' ) {         // My codes here     }      it works, but adds the code to every page with the parent page of `admin.php`. What I am doing wrong?


Disable wpautop, keep line breaks

How can I disable automatic paragraph tags, but retain line breaks? I have used this to remove wpautop:               remove_filter( 'the_content', 'wpautop' );     remove_filter( 'the_excerpt', 'wpautop' );      But there are no more line breaks in the text.


Display a query with multiple post types and same relationship on a single page

I am creating a client portal were my clients can maintain their projects and leave feedback in Wordpress. I have two custom post types called "Clients" and "Projects" and they each pull information from one another in the backend. When I create a client it automatically generates its postID to a drop down menu on the projects post type were I can assign a client to a project. What I am trying to accomplish is by displaying all projects that are associated with the selected client on a single page on the front end. The single page will be the client portal, which is generated by the client post type. I can't seems to display the associated post. Here is my code for `single.php` which will be displaying the projects on the clients portal.                <?php          $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;           $loop = new WP_Query( array(              'post_type'      => array( 'projects'),              'posts_per_page' => -1,              'paged'          => $paged,              'meta_query' => array(                   array(                      'key'     => 'a_client', // name of custom field                      'value'   => '"' . get_the_ID() . '"',                       'compare' => 'LIKE'                  )               )                           ));       ?>       Below is the code I am using to assign a client to a projects in the admin panel of projects. This script displays any client that I created in the client page and display their names in a drop down menu.                add_action( 'add_meta_boxes', 'add_clients_custom_metabox' );         function add_clients_custom_metabox() {      add_meta_box( 'custom-metabox', __( 'Clients' ), 'clients_custom_metabox', 'projects', 'side', 'high' );      }           function clients_custom_metabox($post) {          global $post,$current_user;          //remember the current $post object             $real_post = $post;          //get curent user info (we need the ID)            get_currentuserinfo();          //create nonce            echo '<input type="hidden" name="clients_meta_box_nonce" value="',       wp_create_nonce(basename(__FILE__)), '" />';          //get saved meta            $selected = get_post_meta( $post->ID, 'a_clients', true );         //create a query for all of the user clients posts            $clients_query = new WP_Query();            $clients_query->query(array(                'post_type'      => 'client_portal',                'posts_per_page' => -1,                'author'         => $current_user->ID));         if ($clients_query->have_posts()){               echo '<select name="a_clients" id="a_clients">';           //loop over all post and add them to the select dropdown               echo '<option>Assign a client</option>';               while ($clients_query->have_posts()){          $clients_query->the_post();               echo '<option value="'.$post->ID.'" ';                     if ( $post->ID == $selected){               echo 'selected="selected"';                    }               echo '>'.$post->post_title .'</option>';                    }               echo '<select>';                    }          //reset the query and the $post to its real value             wp_reset_query();             $post = $real_post;                  }         //hook to save the post meta               add_action( 'save_post', 'save_clients_custom_metabox' );         // Process the custom metabox fields             function save_clients_custom_metabox( $post_id ) {                 global $post;        // verify nonce         if (!wp_verify_nonce($_POST['clients_meta_box_nonce'], basename(__FILE__))) {             return $post_id;        }       // check autosave          if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {          return $post_id;       }      // check permissions      if ('events' == $_POST['post_type']) {      if (!current_user_can('edit_page', $post_id)) {     return $post_id;      }     } elseif (!current_user_can('edit_post', $post_id)) {     return $post_id;      }     if( $_POST ) {      $old = get_post_meta($post_id, 'a_clients', true);      $new = $_POST['a_clients'];     if ($new && $new != $old){      update_post_meta($post_id, 'a_clients', $new);     }      }       }      Full code for single.php http://pastebin.com/na7djwsq Register Post Type I am using Project post type is called => **projects** Clients post type is called => **client_portal**


How do you add a custom option to user data?

I would like to add avatars to my users. I have a limited group on a site I'm working. Uploading isn't really a problem we can just put the images on the server and use URL's to set our avatars(Only about 5 people will actually be able to post.). That said how would I add a field to the user page they can fill out with a image URL that can then be fetched later. I know you can fetch user data via the `the_author_meta();` function but how do I add a custom user field that can them be filled out and put into the database that is the associated with the user? Or would if just be better to use something that already exist like the `aim` field for example since none of us will be filling that out.


CSS not pulling in for jQuery UI dialog

I want to add a jQuery dialog modal to a form page. When the dialog box is triggered I see the the text content but with no CSS. I'm pulling in the jquery in the functions.php for the page:               wp_enqueue_script('jquery-ui-dialog');      The jquery css (jquery-ui-dialog.css) is under my wp-includes/css directory. I tried adding               wp_enqueue_style('jquery-ui-dialog');      but it not work. Does anybody know the proper way to enable jQuery Dialog.