title: Multisite WordPress nginx uploaded files throw 404

text: I have a WordPress subdomain multisite install in the `/blog` subdirectory running on an nginx server. Everything works fine except files which do upload correctly but are not accessible via their url. The part of the config concerning the files is:               location ~ ^/files/(.*)$ {         try_files /blog/wp-content/blogs.dir/$blogid/$uri /blog/wp-includes/ms-files.php?file=$1 ;         access_log off; log_not_found off; expires max;     }          #avoid php readfile()     location ^~ /blogs.dir {         internal;         alias /var/www/example/public_html/blog/wp-content/blogs.dir;         access_log off; log_not_found off;      expires max;     }      and               map $http_host $blogid {         default       -999;              #blog         example.com             1;         a.example.com           2;         b.example.com           3;         c.example.com           4;     }      The WordPress sites have the following settings: Upload Path: `wp-content/blogs.dir/1/files/` Upload Url Path: `http://example.com/blog/files` Fileupload Url: `http://example.com/blog/files` The number in the Upload Path is of course different for each site. When I try to upload a file to any blogpost of any of the sites it does appear in the `/blog/wp-content/blogs.dir/#/files/` folder but if I try to access `/blog/wp-content/files/test.png` it throws 404 Any ideas? Thanks!


title: Serial Number Delivery System Using WordPress

text: I'm developing a system where user can buy scratch card number using pre-paid balance. I already created balance system using user meta. Now I need to delivery card number to users upon payment. As payment system is ready, I need an idea which will help me to deliver card number. Card numbers will be stored in database. I'll deliver them. Custom post type can be used probably but couldn't recognize how I deliver them. For instance, User want buy a card of $10. I already stored 5 cards of $10, 3 cards of $20. If user make payment, system will deliver the card number which wasn't previously sold. I need idea. Please suggest me. _Update: I got an idea. I'll create a custom post type called 'Card' with three meta key fields called 'Amount', 'Number' and 'Status'. When a specific function will run, a query will be run for searching the post type for certain amount and where Status will be "Unused". Then an email will be sent to the user with the card number and custom field 'Status' will be updated to "Used". Now I need an idea to search the post. I appreciate your help._


title: wp-e-commerce plugin - custom payment option

text: **How to add "Cash on delivery"** in payments options? Also if that option is selected, user should get "invoice" by email. I'm using wp-e-commerce plugin.


title: Drawing the line between theme & plugin on large scale bespoke projects

text: With most of my sites, sprinkling in the functionality within the theme seemed the logical way to go. For example, a site with a 'product' post type, or a few options in a meta box or setting page. On a couple of much larger projects though, it would've been crazy to keep it all in the theme, & was a lot easier to abstract the functioniality into reusable plugins. But now I'm at the stage where the requirements are so specific, I'm writing a bespoke plugin to work alongside the theme, and I'm struggling with deciding what (if anything) should remain in the theme or go in the plugin (& furthermore, to break up the plugin into several to handle each component of the site). It'd be great to hear of other similar situations, & generally how you guys approach large scale projects on WordPress.


title: Load visual editor without custom styling

text: I have a plugin that uses the `wp_editor()` function to load an instance of the TinyMCE editor. However, the editor is affected by custom styling to make it look similar to the theme through the `add_editor_style()` function. While this may be great in giving the user an idea of how the content may look on the front-end, I do not want this as the content will only ever be displayed on the back-end. Is there any way to load an instance of the WordPress editor without it being affected by custom styling?


title: Free chat plugin

text: Is there a Wordpress plugin that allows users to have private chat with an admin but that there is no need for a payment plan (like you have with support sites such as OGG or 123flashchat). I just want a simple chat box that tells users whether I'm online or not and lets them contact me through it.


title: Stop 'alt' from being added to the_post_thumbnail

text: I'm using the_post_thumbnail to display a specific thumbnail size. The function outputs an 'alt=' tag with the description of the attachment. Is it possible to clear the value in the ouput? So it'll display `alt=""`?


title: How to disable thumbnail filter for a specific template part or image size?

text: I am filtering post_thumbnail_html in my theme to modify the output of my image tags. I have one template part that I would like this filter not to apply to. It uses an image-size that is used no were else in the theme. So I am looking for a way to have this filter not apply on a specific template part or for a specific image size, either way works. Is this possible. I don't think the filter itself matters, but just in case here it is:                if (! function_exists('_sf_responsive_img') ) :      function _sf_responsive_img($html, $post_id, $post_thumbnail_id, $size, $attr) {          //make image links          $attachment_id = $post_thumbnail_id;          $default = wp_get_attachment_image_src($attachment_id);          $size = 'fd-sm';          $small = wp_get_attachment_image_src($attachment_id, $size);          $size = 'fd-med';          $med = wp_get_attachment_image_src($attachment_id, $size);          $size = 'fd-lrg';          $lrg = wp_get_attachment_image_src($attachment_id, $size);          //create image tag with queries          $html = '<img src="'.$default[0].'"';          $html .= 'data-interchange="['.$default[0].', (default)],';          $html .= '['.$small[0].', (only screen and (min-width: 320px))],';          $html .= '['.$med[0].', (only screen and (min-width: 768px))],';          $html .= '['.$lrg[0].', (only screen and (min-width: 1024px))],';          $html .='">';          return $html;      }      add_filter('post_thumbnail_html', '_sf_responsive_img', 5, 5);      endif; // ! _sf_responsive_img exists


title: How do I add a fixed value to get_post_meta();?

text: I'm using the following to display a custom field value in my posts: `<?php echo get_post_meta($post->ID, 'wikipedia', true); ?>` How do I add this value to the output, where '$tag' takes the tag of the post: `\- <a href="wikipedia.org/wiki/**$tag**">Wikipedia</a>` What I've tried, unsuccessfully: `<?php echo get_post_meta($post->ID, 'wikipedia', true . '- <a href="wikipedia.org/wiki/$tag">Wikipedia</a>'); ?>`


title: Is get_option function cached?

text: In my plugin, I use the following code to retrieve an option from the database:               $options = get_option('my_plugin_options');      If I use this 10 times in various functions of my plugin, does WordPress make 10 queries to the database, or does it only make 1 database call per HTTP request and cache the results?


title: Saving images from Gravity Forms repeatable File Upload as post attachments

text: I am trying to upload multiple images as attachments to a post using Gravity Forms and the Gravity Forms + Custom Post Types plugin. I have a repeatable File Upload field using the Gravity Forms gform_column_input_filter. See this question for how it was achieved. I then adapted this code from BandonRandon to use the repeatable File Upload field as below:                add_filter("gform_after_submission", "nifty_add_post_attachements", 10, 3);      function nifty_add_post_attachements($entry) {           //you'll need this later, TRUST ME.      if ( !function_exists('wp_generate_attachment_metadata') ) {         require_once(ABSPATH . 'wp-admin/includes/image.php');      }          //do we even have a file?      if ( isset($_FILES['input_2']) ) {          $file_urls = $entry['2']; //great but what is its url?          $file_array = unserialize($file_urls);               foreach ( $file_array as $file_url ) {                   $upload_dir = wp_upload_dir(); //where do you want to put it?              $file_data = file_get_contents($file_url); //show me what you're made of              $filename = basename($file_url); //so cute but what's its name?              if(wp_mkdir_p($upload_dir['path'])) //can we put it there?              $file = $upload_dir['path'] . '/' . $filename; //yes great              else //or no, okay fine let's try somewhere else              $file = $upload_dir['basedir'] . '/' . $filename; //get the whole location              file_put_contents($file, $file_data); // tada home at last                  $wp_filetype = wp_check_filetype($filename, array('jpeg' => 'image/jpeg','jpg' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png') ); //is it the right type of of file?              $attachment = array( //set up the attachment              'post_mime_type' => $wp_filetype['type'],              'post_title' => sanitize_file_name($filename),              'post_content' => '',              'post_status' => 'inherit'              );                  $attach_id = wp_insert_attachment( $attachment, $file, $entry['post_id'] ); //insert attachment             $attach_data = wp_generate_attachment_metadata( $attach_id, $file ); //asign the meta             wp_update_attachment_metadata( $attach_id, $attach_data ); //update the post         }         //remove the entry          //(to keep the entry comment or delete these line)          // IMPORTANT See:  http://pastebin.com/quvsvGHJ for the function          /*if(!function_exists('sedc_gform_remove_entries')){ die('next time maybe you should read the comments');}          else{ nifty_gform_remove_entries($entry, $form );}*/      }     }      I have tried dumping the $_FILES['input_2'] using the following code at the top of the nifty_add_post_attachements function but no output appears on my screen, the post is still created, and the form ajax loading spinner just hangs.               <pre>         <?php print_r($_FILES['input_2']); die();?>     </pre>      Any help or pointers in the right direction would be appreciated.


title: How we exclude current post form related posts

text: When user open any post, then on the right side they can see related `posts` to that post. But currently in related `posts` my current open post also showing, how i can `exclude` that post which is currently open.


title: add_menu_page() with variable function

text: How can I use `add_menu_page()` functions some variable function ?               add_menu_page('My page','My page','manage_options','my_page', 'func' );          $func = function() {             echo "Done !";     };      I know I can use like               function func() {                 echo "Done !";     };      But how can I use like               $func = function() {                 echo "Done !";     };      to call it ?


title: How to localized one js file for different actions?

text: I have a group of javascript functions in one js file. each function acts on a specific action and get its own ajax response. some are on different pages, some are on the same page. If I don't do the localize, I can't get response. How can I localize this file for multi actions?


title: How to enlarge thickbox media library iframe?

text: The iframe in thickbox media library is not big enough to display my custom tab. I tried to add "width=900&height=600" at the end of the link that pointing to the library, but no luck. How can I modify the inframe size?


title: Custom post type's permalink adds the name of the post type before the post name

text: So I've create a custom post type which seem to work. however the permalinks of the create posts has the name of the custom post type in-front of the post name. I am getting addresses like: `http://demoforhim2.e-ddl.com/movie_reviews/secondone/` and trying to change that to : `http://demoforhim2.e-ddl.com/secondone/` From reading some articles e.g http://wordpress.org/support/topic/custom-post- type-permalink-rewrite this is possible I've tried using rewrite with empty slug but it did not work. Here is my custom post type               add_action( 'init', 'create_movie_review' );     function create_movie_review() {     register_post_type( 'movie_reviews',         array(             'labels' => array(                 'name' => 'Movie Reviews',                 'singular_name' => 'Movie Review',                 'add_new' => 'Add New',                 'add_new_item' => 'Add New Movie Review',                 'edit' => 'Edit',                 'edit_item' => 'Edit Movie Review',                 'new_item' => 'New Movie Review',                 'view' => 'View',                 'view_item' => 'View Movie Review',                 'search_items' => 'Search Movie Reviews',                 'not_found' => 'No Movie Reviews found',                 'not_found_in_trash' => 'No Movie Reviews found in Trash',                 'parent' => 'Parent Movie Review'             ),             'public' => true,             'menu_position' => 15,             'supports' => array( 'title', 'editor', 'comments', 'thumbnail' ),             'taxonomies' => array( '' ),             'menu_icon' => plugins_url( 'images/16x16.png', __FILE__ ),             'has_archive' => true,             'rewrite' => array('slug' => '', 'with_front' => FALSE) /*doesnt seem to work*/         )     );     }      for some reason the above doesn't work properly.


title: WordPress PHP version requirements

text: PHP 5.5 has been released recently. In the same time has been announced that PHP 5.3.x branch won't be supported anymore after 5.3.27 will be released. However WordPress requires PHP version 5.2.4 and higher. I understand that WordPress guaranties that it will work on a hosting with PHP 5.4 or 5.5 installed. But in the same time it means that I can't use PHP 5.3, 5.4 or 5.5 features in my WP development as it could cause an issue on a hosting with PHP 5.2.x installed. If I use PHP 5.3 and higher features in my plugins/themes, then they are won't be 100% compatible with WordPress. Does anybody knows if WordPress is going to change it's requirements?


title: how to get the top 10 popular blogs

text: Our wordpress sites have `many many users`, each of them have an blog account, they can write posts,comments and so on. Now I want to find out `the top 10 popular blogs`, according to or order by `comments`, or `blog visite number`, or manybe `some other stands`. Yes, I can find out the most 10 comments of the posts, but can I get the blogs? A litter difficult. Anyone could you please show me some ideas, thanks in advanced.


title: get_var is neither a string, integer, or array ...?

text:
$vote_count = $wpdb->get_var($wpdb->prepare("SELECT votes FROM wp_mytable WHERE product = %s AND                                   company = %s", $product, $company));             if(is_int($vote_count)){                 $html = '                 Vote here (' . $vote_count . ' Votes for ' . $product . ' and ' . $company . ')';             }else{                 if(is_string($vote_count)){                     $html = '$vote_count is a string in the database
' . print_r($vote_count);                 }if(is_array($vote_count)){                     $html = '$vote_count is an array in the database
' . print_r($vote_count);                 }else{                     $html = '$vote_count is not a string or an integer
' . print_r($vote_count);                 }             }      And my output: > $vote_count is not a string or an integer > > 1


title: Menu not styling. New menus functionality giving me a headache

text: I can't find a good tutorial on the new menu handling functions, and the ones I found don't seem to work for me. What am I doing wrong? In my `functions.php`: (I'm using the Blank Slate theme as a framework; I'll figure out later what's noise, but it's pretty minimal -- hence the name)               function blankslate_register_menus() {         register_nav_menus( array( 'main-menu' => __( 'Main Menu', 'blankslate' )));     }      Next, on `header.php`:               <nav>         <?php wp_nav_menu( array( 'theme_location' => 'main-menu' ) ); ?>     </nav>      And finally, testing my `style.css` for every possible option:               .main-menu, .main-menu *, #main-menu *, #main-menu {         font-size: 40px;     }      Does nothing. The menu items are simply listed like a simple HTML `<ul>` would be. I've followed this tutorial: http://justintadlock.com/archives/2010/06/01/goodbye-headaches-hello-menus which is the opnly decent and recent one I found, but I don't see what I've done different. (if I try the class `.menu`, it works, so the problem is in what I'm assuming the classes are?) Also, the tutorial mentions a whole lot of parameters that cane be added to the `register_nav_menu()` function, like custom tags, and using `<div>` by default, yet no mention of how to actually set them. Any help? My theme is almost done and I've been stuck on a freaking menu function all day... I'd've made a menu old school by now :/


title: How do I add multiple post types to this query?

text:
The code i use calls for all attachments that are uploaded to be in the post. I added the Gallery custom post type but nothing shows. It shows on my "pretty-little-liars" post type though. What am I doing wrong.                  <?php          if ( 'pretty-little-liars','gallery' == get_post_type() ) { //condition to show     gallery on post type - gallery          if ( $attachments = get_children( array(         'post_type' => 'attachment',         'post_mime_type'=>'image',   //return all image attachment only         'numberposts' => -1,   //get all the attachments         'post_parent' => $post->ID     )));          foreach ($attachments as $attachment) {         // you can customize the oputput         echo '

';         echo ''.wp_get_attachment_link( $attachment->ID,'full' , false, false );         echo '
';         echo ''.$attachment->post_excerpt.'

';         echo '

'.$attachment->post_title. '
';         echo ''.$attachment->post_content.'';         echo '

';     }     }          ?>


title: Submiting custom form give error 404

text: I have custom search form on category `category.php` list template with following code:               <?php $searchresults = site_url('/?p=1365'); ?>          <form class="search-slide" id="search-slide" name="search-slide" action="<?php echo $searchresults; ?>" method="post">         <input type="text" name="s_name" id="s_name" size="30" value="" class="find s-name" placeholder="Name Lastname" tabindex="1" />         <input type="text" name="s_offer" id="" size="30" value="" class="find s-tag"  placeholder="in research offer" tabindex="2" />         <input type="text" name="s_area" id="" size="30" value="" class="find s-obsz"  placeholder="in Application area" tabindex="3" />         <input name="s_tags" id="tag-list" value="" tabindex="4" />              <input class="slideradio" type="checkbox" id="w01" name="w[]" value="w01" />             Faculty of Architecture         <input class="slideradio" type="checkbox" id="w02" name="w[]" value="w02" />             Faculty of Civil Engineering         <input class="slideradio" type="checkbox" id="w03" name="w[]" value="w03" />             Faculty of Chemistry              <input class="slideradio" type="radio" id="adefault" name="s_sort" value="" checked="checked"  tabindex="6"/>         Default         <input class="slideradio" type="radio" id="aasc" name="s_sort" value="" tabindex="7" />         Sort A-Z         <input class="slideradio" type="radio" id="adsc" name="s_sort" value="" tabindex="8" />         Sort Z-A              <button id="slide_search_btn" type="submit">Search</button>     </form>      And I'd like to send variables into another wordpress website `search- result.php` (template page is added and published in dashboard). But when I click `Search` button I get error 404 (I have red about naming `name fields` but I think mine are Ok). But when I enter page directly in browser I got page normally. Can anybody direct me how to resolv this problem?


title: why php tag is not working if i store and show it in wp_head?

text: hi i used wp_head a couple of times.I echoed some values it works like below               function test()     {     echo "hello am visible";     }     add_action('wp_head','test');      but if i store a php code in db and retrieve it to a variable and echoed it is not working, here is the sample               <?php echo "i will go to db and come again"; ?>      i stored the above value in LONGTEXT format in db as `trial` then i selected the table and assigned it to a variable like below               $output = $result->trial;      Here come the problem part               function test()         {         //after retrieve          echo $output;         }     add_action('wp_head','test');      this way it is not working.i can't able to see i will go to db and come again. What is the problem? Thanks


title: Create more than one section in Theme Customizer

text: i tried to create more than one section in Theme Customizer, but had no success with that.               /* Theme customize - Create menu bar link */     function example_customizer_menu() { add_theme_page( 'Customize', 'Customize', 'edit_theme_options', 'customize.php' ); }     add_action( 'admin_menu', 'example_customizer_menu' );      How i got it for all of new sections (tabs) in Theme Customizer i must to write code below. Is it right?               /* Create one new tab */     add_action('customize_register', 'themedemo_customize');     function themedemo_customize($wp_customize) {          $wp_customize->add_section( 'themedemo_demo_settings', array(         'title'          => 'Demonstration Stuff',         'priority'       => 35,     ) );          $wp_customize->add_setting( 'some_setting', array(         'default'        => 'default_value',     ) );          $wp_customize->add_control( 'some_setting', array(         'label'   => 'Text Setting',         'section' => 'themedemo_demo_settings',         'type'    => 'text',     ) );          $wp_customize->add_section( 'themedemo_demo_settings', array(         'title'          => 'Demonstration Stuff',         'priority'       => 40,     ) );          $wp_customize->add_setting( 'some_other_setting', array(         'default'        => '#000000',     ) );          $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'some_other_setting', array(         'label'   => 'Color Setting',         'section' => 'themedemo_demo_settings',         'settings'   => 'some_other_setting',     ) ) );          }      For what did we use "customize_register" and why there is always different words? How i got it "themedemo_customize" it is like parameter here..               add_action('customize_register', 'themedemo_customize');     function themedemo_customize($wp_customize) {      I read official documentation but did not get it.


title: WPAlchemy: How to output values?

text:
I am using http://www.farinspace.com/wpalchemy-metabox/ and have created my meta boxes and the data is being saved successfully (See below) but I don't know how to output these 'ingredients' on the front end?               Array     (         [docs] => Array         (             [0] => Array             (                [ingredient] => Cheese             )             [1] => Array             (                [ingredient] => Salt             )         )     )      **This is my single.php**               <?php     global $simple_mb;     $meta = $simple_mb->the_meta();     ?>      **This is my meta.php**
              <?php while($mb->have_fields_and_multi('docs')): ?>         <?php $mb->the_group_open(); ?>                  <?php $mb->the_field('ingredient'); ?>
                 Ingredient                 <input class="text" type="text" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>"/>                 Remove
              <?php $mb->the_group_close(); ?>         <?php endwhile; ?>
<?php echo __('Add Ingredient'); ?>

      **This is my functions.php**               // Meta WP Alchemy     include_once 'metaboxes/setup.php';          $custom_metabox = $simple_mb = new WPAlchemy_MetaBox(array     (         'id' => '_custom_meta_ingredient',         'title' => 'Recipe Ingredients',         'types' => array('recipe'),         'mode' => WPALCHEMY_MODE_EXTRACT,         'prefix' => '_ingredient_',         'autosave' => TRUE,         'template' => get_stylesheet_directory() . '/metaboxes/ingredients-meta.php',     ));


title: How do I enforce users to fill a determined custom field using WyPiekacz?

text: I have a Wordpress + Buddypress site. I've created two custom fields which **must** be filled in each post. Also, I have a form in a custom metabox to show them. I'm using WyPiekacz plugin to check for minimun words, tags, and categories. So it would be nice if I can tweak it a litle to check if these custom fields were filled or not, and set the post status to draft if the custom fields were empty. Thanks :)


title: get user list in admin area

text: how can I fetch a list of registered users and show it in the admin panel. I know theres the list inside the admin panel already but I've added a few tables and I need to show them in a new tab menu inside the admin panel.


title: Letting clients use visual builders plugins/themes on WordPress Multisite installation

text: I use WordPress Multisite to create and manage my users websites. I was wondering - Is it possible (and legal by copyright laws) to buy one of those visual builders plugins/themes and **also let my clients use them for their site?** I know it's possible to use them for building my clients site, but i'm not sure about giving **them** access to the tool.


title: How to remove certain words from url slug

text: Trying to create a SEO plugin, that will remove stop words from slugs. This is how to `explode` the `$slug` into a list, and explode the variable containing the stop words :               add_filter ('sanitize title', 'remove_false_words');     function remove_false_words($slug) {         if (!is_Admin()) return $slug;              $slug = explode ('-', $slug);              foreach ($slug as $key => $word) {             //The $slug has been exploded and retrieves its value                  $keys_false = 'a,above,the,also';             $keys = explode (',', $keys_false);                  foreach ($keys as $1 => $wordfalse) {                 if ($word == $wordfalse) {                     unset ($slug[$k]);                 }             }         }         return implode ('-', $slug);     }      Is it correct to `unset` the value here? Or should I use a different way of achieving the same result?


title: Change comment author after new comment posted

text: I'm trying to update the user_id of a comment once it has been posted. It looks to see if the comment_author_email exists as a user in the users table, and if it does, attach that user to the comment.               function set_comment_author($comment_ID){         global $wpdb;              $comment = get_comment($comment_ID, ARRAY_A);         if($comment["user_id"] == 0){             $user = get_user_by('email', $comment["comment_author_email"]);             if($user){                 $user_id = $user->ID;                 $comment["user_id"] = $user_id;                 wp_update_comment($comment); //This method doesn't work                      /*                  * This method doesn't work either                    $wpdb->update(                            $wpdb->prefix.'comments',                         array(                             'user_id' => $user_id                         ),                         array(                             'comment_ID' => $comment_id                         )                     );                 $wpdb->print_error();*/             }         }     }     add_action("comment_post", "set_comment_author", 10, 1);      I have done some debugging, and the action is being fired, the comment ID is coming through, and the user_id is being found. So the problem is updating the comment. Both wordpress function and database method don't work. Any ideas?


title: ajax_wp is returning 0 for attempt of use in frontend

text:
ajax_wp_nopriv_myaction is returning 0. I am trying to insert into a database by passing ajax data to a function. I know its using the javascript file, because it outputs an alert box of what the response is and its 0. I'm guessing it is something that has to do with how I registered the test callback function. A short code creates the form:
                 <form method='post' id='bday-form'>

                             Name:	                              <input id='name' type='text' name='name'/>

                             Birthday:	                             <input id='email_birthday' type='text' name='birthday' />

                             Email:	                             <input id='email_email' type='text' name='email'/>

                             	                             <input style='float:right;' type='button' name='submit' id='submit' value='Submit'><input style='float:right;' type='reset' value='Clear'>

                 </form>
      The same function that creates the form has this at the top:                       //enqeue scripts and callbacks              //add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );             $this->start_scripts();             add_action( 'wp_ajax_my_test', array($this,'test'));             add_action( 'wp_ajax_nopriv_test', array($this,'test'));      the start scripts function and callback function                   function start_scripts() {                wp_enqueue_script( 'script-name', plugins_url() . '/verify-me/js/example.js', array('jquery'), '1.0.0', true );           wp_localize_script( 'script-name', 'MyAjax', array(             // URL to wp-admin/admin-ajax.php to process the request             'ajaxurl' => admin_url('admin-ajax.php'),                  // generate a nonce with a unique ID "myajax-post-comment-nonce"             // so that you can check it later when an AJAX request is sent             'security' => wp_create_nonce( 'my-special-string' )           ));         }              function test() {           check_ajax_referer( 'my-special-string', 'security' );             global $wpdb;                  var_dump( isset( $wpdb ) );             //get the post vars from the form             $data = array("email_name" => "test", "email_birthday"=>"test", "email_email"=>"test");              $wpdb->insert('wp_verify_emails', $data);           die(); // this is required to return a proper result         }      I just have test data going into the database.   Finally the js page:               jQuery(document).ready(function($) {          var data = {         action: 'test',         security : MyAjax.security,         whatever: 1234,         dataType: 'json'     };          jQuery( "#submit" ).click(function( event ) {         event.preventDefault();              //grab the variables to pass         var name = jQuery("#name").val();         var bday = jQuery("#email_birthday").val();         var email = jQuery("#email_email").val();              alert(name + bday + email);         // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php         jQuery.post(MyAjax.ajaxurl, data, function(response) {             alert('Got this from the server: ' + response);         });     });     });


title: Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites

text: I've built two WordPress sites. One is public site--people go to it, view my content, etc. The other site is a private course catalog. In the course catalog I have 3 custom post types. The content of the course catalog gets shared to different places via templates that output XML, PDFs, and so on, and then the content also needs to go to my main site. The course catalog posts change from time to time, so the main site needs to update to reflect those changes. I can't figure out HOW, though. I'm hoping the community here can help me figure it out. Using WordPress Export to get the custom post types out form the course catalog and import into the main site works but for two problems: existing posts will not be updated to reflect changes and categories from the course catalog CREATE categories in the main site instead of using the already existing, identically named categories. I've looked into FeedWordPress, but it doesn't do custom post types and custom fields, even if I build an RSS template in the course catalog to show those custom fields. WP All Import says it will do everything but the categories, but I need the categories to map correctly between sites. The content is organized and filtered by category in the course catalog front end. Help? Please?


title: Can I use wp_add_inline_style() inside a function that gets called from a template file (not a hook)?

text: I'm building a theme that has a 'layout builder', and one of the layout options is a slideshow. There are customiseable style settings for each instance of a slideshow on any page, which means I need to add custom css for each slideshow. It sounds like `wp_add_inline_style()` should be my answer here, but it's just not working, and I'm assuming it's because I'm calling it too late - the slideshow gets built in a function that is run in the template file, not in a hook. I'll post code anyway, in case it does turn out to be a different problem.               function slideshow_builder( $args ) {         // Some other stuff here              // If we're art directing, get the CSS ready and add it to the page         if( $art ) {             $id = $args['id'];             $m_height = $args['mobile_slide_height'] . 'px';             $t_height = $args['tablet_slide_height'] . 'px';             $l_height = $args['laptop_slide_height'] . 'px';             $art_css = <<<END     #$id .slide-background-holder {         height: $m_height;     }     @media screen and (min-width: 768px) {         #$id .slide-background-holder {             height: $t_height;         }     }     @media screen and (min-width: 1024px) {         #$id .slide-background-holder {             height: $l_height;         }     }     END;              wp_add_inline_style( 'my-stylesheet-already-enqueued', $art_css );     }      Am I doing something wrong? Or is it just because I'm running it too late?


title: Passing array in add_option() in WordPress custom theme

text:
I have to create a option page in my custom theme wordpress. here is is a sample of code               <?php              function bguru_register_settings(){             $default_options=array(             'bguru_logo'=>'http://templategraphy.com/demo/businessguru/images/logo.png',             'bguru_vimeo'=>'',             'bguru_skype'=>'',             'bguru_dribbble'=>'',             'bguru_slide_one_image'=>'',             'bguru_slide_one_heading'=>'',             'bguru_slide_one_text'=>''              );                  add_option('bguru_options',$default_options);                  register_setting('tgbusinessguru', 'bguru_options');         }              add_action('admin_init', 'bguru_register_settings');              function bguru_register_options_page(){              add_theme_page('Business Guru Options', 'Theme Customizer', 'edit_theme_options', 'bguru-options', 'bguru_options_page');          }              add_action('admin_menu', 'bguru_register_options_page');              function bguru_options_page(){             $options=get_option('bguru_options');                  ?>
         <?php      screen_icon(); ?>
Business Guru Options
         <form method="post" action="options.php">              <?php      settings_fields('tgbusinessguru'); ?>

General

                              Logo:	                              <input type="text" id="bguru_logo" size="50" name="bguru_options[bguru_logo]" value="<?php echo $options['bguru_logo']; ?>" />

Social Links

                         Vimeo:	                         <input type="text" id="bguru_vimeo" size="50" name="bguru_options[bguru_vimeo]" value="<?php echo $options['bguru_vimeo']; ?>" />

                         Skype:	                         <input type="text" id="bguru_skype" size="50" name="bguru_options[bguru_skype]" value="<?php echo $options['bguru_skype']; ?>" />

                         Dribbble:	                         <input type="text" id="bguru_dribbble" size="50" name="bguru_options[bguru_dribbble]" value="<?php echo $options['bguru_dribbble']; ?>" />

                              Image:	                              <input type="text" id="bguru_slide_one_image" size="50" name="bguru_options[bguru_slide_one_image]" value="<?php      echo $options['bguru_slide_one_image']; ?>" />

                         Heading:	                         <input type="text" id="bguru_slide_one_heading" size="50" name="bguru_options[bguru_slide_one_heading]" value="<?php      echo $options['bguru_slide_one_heading']; ?>" />

                         Description:	                         <textarea type="text" id="bguru_slide_one_text" style="width:439px;height:100px;" name="bguru_options[bguru_slide_one_text]"><?php  echo $options['bguru_slide_one_text']; ?></textarea>

               <?php submit_button(); ?>            </form>
     <?php  } ?>      All the form details are passed by dashboard I want if admin forget to fill the logo field then by default this $default_options work so by default logo field fill up but when I try to access the array using get_option I'm not getting the results I expect.


title: WP query taxonomy input differs to output?

text: I'm trying to build a custom query and I need to include the current category ID. I previously had the WP_Query args as:               Array     (         [post_status] => publish         [posts_per_page] => -1         [post_type] => courses         [cat] => 70      When I output SQL result behind this argument query using $query->request; the taxonomies read as 95 and 203, instead of 70?               SELECT wp_posts.* FROM wp_posts                  INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)                  INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)                  INNER JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id)                  INNER JOIN wp_postmeta AS mt2 ON (wp_posts.ID = mt2.post_id)                  INNER JOIN wp_postmeta AS mt3 ON (wp_posts.ID = mt3.post_id) WHERE 1=1                  AND ( wp_term_relationships.term_taxonomy_id IN (95,203)      Can anyone tell me how/why this is happening and what I need to do to find 95,203 from this initial 70 so that I can also build this query manually? Many thanks


title: How to restrict actions and filters "properly" by conditions

text: Which one is correct when adding actions/filters/etc.... Both methods work fine and I've seen people do things both ways, but I'm assuming one is correct. My gut tells me that wrapping the if statement around the action only is better but I'm not sure... Method A: Wrapping `if` around `add_action`:               function unregister_default_wp_widgets() {         unregister_widget('WP_Widget_Pages');         unregister_widget('WP_Widget_Calendar');         unregister_widget('WP_Widget_Archives');         unregister_widget('WP_Widget_Links');         unregister_widget('WP_Widget_Meta');         unregister_widget('WP_Widget_Search');         unregister_widget('WP_Widget_Text');         unregister_widget('WP_Widget_Categories');         unregister_widget('WP_Widget_Recent_Posts');         unregister_widget('WP_Widget_Recent_Comments');         unregister_widget('WP_Widget_RSS');         unregister_widget('WP_Widget_Tag_Cloud');         unregister_widget('WP_Nav_Menu_Widget');     }          if( !current_user_can('administrator') ) {         add_action('widgets_init', 'unregister_default_wp_widgets', 1);     }      ---- OR ----- Method B: Wrapping `if` around both function definition and `add_action`:               if( !current_user_can('administrator') ) {              function unregister_default_wp_widgets() {             unregister_widget('WP_Widget_Pages');             unregister_widget('WP_Widget_Calendar');             unregister_widget('WP_Widget_Archives');             unregister_widget('WP_Widget_Links');             unregister_widget('WP_Widget_Meta');             unregister_widget('WP_Widget_Search');             unregister_widget('WP_Widget_Text');             unregister_widget('WP_Widget_Categories');             unregister_widget('WP_Widget_Recent_Posts');             unregister_widget('WP_Widget_Recent_Comments');             unregister_widget('WP_Widget_RSS');             unregister_widget('WP_Widget_Tag_Cloud');             unregister_widget('WP_Nav_Menu_Widget');         }              add_action('widgets_init', 'unregister_default_wp_widgets', 1);     }


title: Stop post submission without losing data?

text: Is it possible to stop a post from publishing/updating, and instead redirect back to the post with the same data that was being submitted? I want to do this so I can show an error message, should they enter invalid information in a metabox. Right now it just doesn't save the values of that metabox, but that isn't a very good option. I think it may be possible by abusing the auto-save system a bit, but before I go digging around I thought I'd see if anyone else has run into this issue.


title: Creating Multiple Loops in Genesis, One Post then 20, each with custom fields

text:
I need to create a custom loop for a custom post type archive template, that is as similar to this page as possible (www.manta.com/totd) using the Genesis framework. Here is a paste of what I have, which is not working. http://pastebin.com/g1EK5f6M As well as the current archive template http://pastebin.com/A6UufNMu which produces this: m.angiemeekerdesigns.com/totd Can someone help me learn why my current code isn't working? Update: After working on it some, I've come to the paste below - it's working about 80% of what I need, except that the one post from the first loop at the top (feature) is showing the content that the posts from the second loop below should be showing, and vice versa. Here's a link to page on the site now: http://m.angiemeekerdesigns.com/totd and the code as far as I've gotten.               <?php          /**      *      * Display the Tip of the Day Custom Post Type archive custom fields using      * ACF.      *      * @author Angie Meeker      * @uses   Advanced Custom Fields      */           add_action('genesis_entry_content','genesis_do_post_title', 2);           //* Removes Continue Reading from the echoed excerpt      function sbt_auto_excerpt_more( $more ) {     return 'aaa';     }     add_filter( 'excerpt_more', 'sbt_auto_excerpt_more', 20 );          function sbt_custom_excerpt_more( $output ) {return preg_replace('/]+>Continue reading.*?<\/a>/i','',$output);     }     add_filter( 'get_the_excerpt', 'sbt_custom_excerpt_more', 20 );                //* Add Tip of the Day body class to the head     add_filter( 'body_class', 'add_tiparchives_body_class' );     function add_tiparchives_body_class( $classes ) {        $classes[] = 'tiparchives-post-type-archive-{tipoftheday}';        return $classes;     }           // Return Category and Tip of the Day on Single Posts     add_action ( 'genesis_before_content', 'show_totd', 9 );     function show_totd() {         echo '
Tip of the Day
';     }        // Remove Post Author      add_filter( 'genesis_post_info', 'remove_post_author_totd_posts' );     function remove_post_author_totd_posts($post_info) {         $post_info = '[post_date]';         return $post_info;     }               /** Replace the standard loop with our custom loop */     remove_action( 'genesis_loop', 'genesis_do_loop' );     add_action( 'genesis_loop', 'manta_tips_feature' );     add_action( 'genesis_loop', 'manta_tips_teasers' );                              /** Show the first first post from the TOTD Custom Post Type */          function manta_tips_feature() {                echo '
Current Tip of the Day
';         global $paged; // current paginated page         global $query_args; // grab the current wp_query() args         $args = array(             'post_type' => 'tipoftheday',             'posts_per_page'=> '1',             'paged'  => $paged,         );              genesis_custom_loop( wp_parse_args($query_args, $args) );      // Return if CPT Tip of the Day     add_action( 'genesis_after_entry_content', 'manta_tips_pre_features' );     function manta_tips_pre_features() {                  // Store the pre tips data             $tips_data_pre = array(                     'totd_tags' => get_field( 'totd_tags' ),                     'tip_article_headline' => get_field( 'tip_article_headline' ),                     'article_author' => get_field( 'article_author' ),                     'article_author_link' => get_field( 'article_author_link' ),             );               // Only output if we have tips data                 if ($tips_data_pre['totd_tags'] != '' ||                     $tips_data_pre['tip_article_headline'] != '' ||                     $tips_data_pre['article_author'] != '' ||                     $tips_data_pre['article_author_link'] != '') {                          echo '

';                                          echo '
' , do_shortcode('[post_terms taxonomy="totd_tags" before="See More Tips For: " taxonomy="totd_tags"] '),'
' ;                                     echo '

Share This Tip:

';                               echo '

';             }     }     }          /** Show the first 10 previous posts from the TOTD Custom Post Type */          function manta_tips_teasers() {                echo '
Previous Tips
';         global $paged; // current paginated page         global $query_args; // grab the current wp_query() args         $args = array(             'post_type' => 'tipoftheday',             'posts_per_page'=> '10',             'paged'  => $paged,         );              genesis_custom_loop( wp_parse_args($query_args, $args) );                // Return if CPT Tip of the Day     add_action( 'genesis_after_entry_content', 'manta_tips_teaser_pre' );     function manta_tips_teaser_pre() {                  // Store the pre tips data             $tips_data_pre = array(                     'totd_tags' => get_field( 'totd_tags' ),             );               // Only output if we have tips data                 if ($tips_data_pre['totd_tags'] !='') {                          echo '

';                                          echo '
' , do_shortcode('[post_terms taxonomy="totd_tags" before="See More Tips For: " taxonomy="totd_tags"] '),'
' ;                          echo '

';             }     }     }               genesis();


title: Posts in loop all show the same author when there are many authors

text:
I am iterating through an array of post IDs `$ids`. All is displayed correctly except for the authors. Every post shows the same author, although the posts are by different authors. I can't seem to get this worked out...               <?php      $ids = array();     $bookid = get_post_meta(get_the_ID(), 'prefered_book', true );      $args = array(         'post_type' => 'post',         'post__not_in' => array($post->ID),         'tax_query' => array(             array(                 'taxonomy' => 'books',                 'field' => 'id',                 'terms' => "$bookid",             )         )     );     $my_query = new WP_Query($args);     if( $my_query->have_posts() ) {          while ($my_query->have_posts()) : $my_query->the_post();               $ids[]= $post->ID;           endwhile;         }     ?>          <?php     $bookdesc = get_term( $bookid , 'books');          if(count($ids)) : ?>
Post about <?php echo $bookdesc->description; ?>

          <?php foreach($ids as $id) : ?>
                  <a href="<?php echo get_permalink( $id ); ?>">
                      <?php $img = wp_get_attachment_url( get_post_thumbnail_id($id,'size-200') ); ?>                      <?php if ($img) : ?>                          <img class="smallImage" src="<?php echo $img ?>" />                      <?php endif; ?>
<?php echo get_the_title($id); ?>

By <?php the_author($id);                                   // Here it fails, incorrectly showing same author for every post                          ?>

          <?php endforeach; ?>
     <?php endif; ?>


title: wp_insert_posts Fatal error: Maximum function nesting level of '100' reached, aborting!

text: I'm having a weird problem I have written the code as below:               add_action('save_post', 'save_post_func');          function save_post_func(){         include_once(ABSPATH . WPINC . '/feed.php');              $rss = fetch_feed($url);              if (!is_wp_error($rss)) {             //ini_set('xdebug.max_nesting_level', 1000); <-- Doesn't work                  $maxitems = $rss->get_item_quantity(5);                  $rss_items = $rss->get_items(0, $maxitems);                  foreach ($rss_items as $item) { // count($rss_items) = 5 ???                 wp_insert_post(array('post_title' => 'a')); // inserts > 100 records ???             }              }          }      Displays this error: > Fatal error: Maximum function nesting level of '100' reached, aborting! Any help? Where is the problem all seems ok...


title: How to use jquery included with wordpress for jpanelmenu

text: I have successfully been using jpanelmenu in my wordpress themes for some time, loading jquery from the google api, like this:               if ( !is_admin() ) {              // jQuery         wp_deregister_script('jquery');         wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"), false);         wp_enqueue_script('jquery');              // load jPanelMenu         wp_enqueue_script('jpanelmenu', get_bloginfo('template_directory') . "/js/jquery.jpanelmenu.js");          }      I'd rather use the version of jquery that comes included with wordpress, but can't figure out how to make that happen. Can anyone advise me on how to do that, or tell me if I'm wrong in thinking that using wp's built-in jquery would be better than what I'm doing in the code above? I am instantiating jpanelmenu like this:               $(document).ready(function () {         var jPM = $.jPanelMenu({         duration: 100,         openPosition: "240px",         direction: "left",         keyboardShortcuts: false         });         jPM.on(); // turn on jPanelMenu     });      Thanks in advance! _**edited_** Based on the answers below I tried the following, but jpanelmenu would not function (clicking on the menu trigger does not reveal the off-canvas menu):               function wpa_132328_enqueue_scripts(){     if ( !is_admin() ) {                  // jQuery             wp_enqueue_script('jquery');                  // load jPanelMenu             wp_enqueue_script('jpanelmenu', get_bloginfo('template_directory') . "/js/jquery.jpanelmenu.js");              }     }     add_action( 'wp_enqueue_scripts', 'wpa_132328_enqueue_scripts' );      and               if ( !is_admin() ) {              // jQuery         wp_enqueue_script('jquery');              // load jPanelMenu         wp_enqueue_script('jpanelmenu', get_bloginfo('template_directory') . "/js/jquery.jpanelmenu.js");          }      and               wp_enqueue_script('jpanelmenu', get_bloginfo('template_directory') . "/js/jquery.jpanelmenu.js", array('jquery') );      and               if ( !is_admin() ) {              wp_enqueue_script('jpanelmenu', get_bloginfo('template_directory') . "/js/jquery.jpanelmenu.js", array('jquery') );           }


title: Related Post ignore certain tags?

text:
I'm seeking some help, I want my related pages to ignore a certain tag in my pages. How can I get it ignore tags with "sports" in it for my related posts, below is the code I use for related posts on my website:               function getRelatedPosts( $count=4) {     global $post;     $orig_post = $post;          $tags = wp_get_post_tags($post->ID);     if ($tags) {         $tag_ids = array();         foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;         $args=array(             'tag__in' => $tag_ids,             'post__not_in' => array($post->ID),             'posts_per_page'=> $count, // Number of related posts that will be shown.             'ignore_sticky_posts'=>1         );         $my_query = new WP_Query( $args );         if( $my_query->have_posts() ) { ?>

Related Posts

             <?php             while( $my_query->have_posts() ) {             $my_query->the_post(); ?>

             <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { /* if post has a thumbnail */ ?>             <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>" class="img-shadow"><?php the_post_thumbnail('small-thumb'); ?>             <?php } else { ?>             <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>" class="img-shadow"><img src="<?php echo bloginfo('template_url'); ?>/images/default145.jpg" />             <?php } ?>
         <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?>
             <?php }             echo '

';         }     }     $post = $orig_post;     wp_reset_query();      }


title: How can you use a TinyMCE 3x function in WordPress 3.9

text: I want to use tinymce 3x width function `createControl` in wordpress 3.9. How can I achieve this ?               createControl: function(n, cm){        return null;     }


title: Rewrite rule is not working

text: I want a custom rewrite rule for my plugin. But for some reason it is not working. I tried flushing url, registered query var. But still it wont work and it gives output like this:               http://domain.com/page_name/?gallery_id=6      URL without prettifying:               http://domain.com/index.php?page_id=5&gallery_id=6      I want to rewrite above url to:               http://domain.com/page_name/gallery/id      I have added custom query var `gallery` and `gallery_id`. Here is my rewrite rule:               "pagename/gallery/([^/]+)/?"          => "index.php?page_id=".$base_page_id."&gallery_id=".$wp_rewrite->preg_index(1),      Please tell me what I am doing wrong. Thanks


title: How to display counter for post in navigation?

text: I have custom post type called Booking. It have custom post status : "waiting confirmation" and "confirmed". I want to display counter in navigation menu to count total post which status is "waiting confirmation". It would look like this. ![enter image description here](http://i.stack.imgur.com/dPqfK.png) How could I do that? My source code is here: https://github.com/rahmatawaludin/morpha-event


title: I am trying to hide a custom post type category to logged in users with Pre_Get_Posts

text: I have a custom post type in my theme called portfolio. It's categories are called project-categories. I am trying to exclude a project category for logged in users. I cannot get this to work at all. I have read through the pre_get_posts codex but I am just stuck. I'm not sure if I am defining the categories for my custom post type or if it would be the same as a normal post category. When I click on the category to edit it, this is in the browser url bar `wp-admin/edit-tags.php?action=edit&taxonomy=project- type&tag_ID=94&post_type=portfolio` Here is the code I'm trying right now.               function exclude_category( $query ) {         if ( is_user_logged_in() && $query->is_main_query() ) {             $taxquery = array(             'taxonomy' => 'project-type',             'field' => 'id',             'terms' => array( 94 ),             'operator' => 'NOT IN'         );                  $query->set( 'tax_query', $taxquery);         }     }     add_action( 'pre_get_posts', 'exclude_category' );      Any ideas on what I might be doing wrong would be greatly appreciated. Thanks


title: Get all custom_post_type posts + blog posts from one category in a single query

text: Is there a way to query posts from multiple post_type's and filter the normal blog posts by a category? I am trying to display the 10 latest custom_post_type posts and blog posts on my homepage in a single query - so that I have 10 posts in total, sorted by post_date in DESC order, containing all posts from my custom_post_type and blog posts from a certain category. Let's say I have custom post type called news. I want to query both news and posts, but limit posts to category with id 3. I do NOT want to limit news to any category.               $args = array (         'cat' => 3,         'post_type' => array ( 'news', 'post' )     );      The above code seems to only work half - it only fecthes blog posts from the category 3, but no custom_post_types at all...


Why, Where, and When to use reference pointers in filters/hooks? What are the potential cons of not using them when suggested or required? Just looking for a more detailed answer than the codex provides and maybe some real world applications of this. For example: `add_filter('some_wp_filter', array(&$this, 'my_function_to_filter');`


title: Changing $latex $ equation background color globally

text: ## Background Unfortunately, when hosting your blog with WordPress.com you can't use the MathJax-LaTeX pluging, and have to use the default wordpress LaTeX. The way it works, is by rendering the LaTeX math into an image, and sticks that image into your blogpost. Since it is an image, it has a background color. The feature was designed so that it tries to figure out the proper background color for your theme to fit the LaTeX in naturally. Unfortunately for me, my background color is white, but the LaTeX is rendered with background gray. There is a way to change the color of a single equation. For instance: `$latex E = mc^2$` would produce the default background color, while `$latex E = mc^2&bg=ffffff$` would force the background to be white. This is what I want to achieve, but for every equation in my post. I don't want to have to type `&bg=ffffff` at the end of each LaTeX environment manually (it is already a big enough hassle to write `$latex` instead of just `$`!). * * * ## Question > Is there a way to change the background color of all the math equations at > once? Alternatively, if no such method exists. > From where does the `$latex $` feature guess the background color, and how > can I change what it guesses? Keep in mind that I am on WordPress.com so I can't simple switch to the MathJax-LaTeX plugin.


title: Whats the difference between blog_info('stylesheet_url') difference get_stylesheet_uri()

text: The question is in the title really. What is the difference between blog_info('stylesheet_url') difference get_stylesheet_uri(), and if it's a case that one is newer then which. The codex says: > 'stylesheet_url' - Returns the primary CSS (usually style.css) file URL of > the active theme. Consider using get_stylesheet_uri() instead.


title: Hook on trash post

text: I want to perform an action when I delete one of my custom post types, which hook should I use: wp_trash_mycpt or trash_mycpt My action should run solely when mycpt is in the 'publish', 'draft' or 'future' state and moves towards the 'trash' state. When it is removed from trash itself there is no reason to run the function again.


title: Attaching images to posts manually (i.e. with custom code, without the use of an API)

text: I am working on mobile API for a WordPress site.   The API is written in PHP and provides methods actions such as creation of a post. Now, I can create a post with one image (thumbnail) of the post. How can I create post with multiple images, what records in what WP tables must I create to connect all this data?   I mean without using WP code, with pure PHP?


title: Creating a dynamic URL structure

text: I want to create a directory structure for my WordPress links and for the final page to be based on the taxonomy of the page. So I have a business that belongs to a `city` (meta) and `country` (taxonomy). I would like the final URL to be               http://example.com/{country}/{city}/{post_title}/      Is this at all possible? I have tried `add_rewrite_rule()` but either it can't do what I want or I'm doing it wrong (I got rid of the code so I can't show it, apologies).


title: Adapting plugin for custom post type?

text:
I am trying to reformulate a function (in a plugin) so that it applies to posts in a custom post type rather than normal posts.                function saving_posts($post_id)     {         global $wpdb, $user_ID;         $this->setup_links();         if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)             return;         if('post' == $_POST['post_type'])         {             if(!current_user_can('edit_post', $post_id))                 return;         }         else             return;         $mydata = ($_POST['mf_post_to_forum'] == 'true')?true:false;         if($mydata)         {             $date = $this->wpf_current_time_fixed('mysql', 0);             $fid = (int)$_POST['mf_post_to_forum_forum'];             $_POST['mf_post_to_forum'] = 'false'; //Eternal loop if this isn't set to false             $post = get_post($post_id);             $sql_thread = "INSERT INTO {$this->t_threads} (last_post, subject, parent_id, `date`, status, starter) VALUES('{$date}', '".$this->strip_single_quote($post->post_title)."', '{$fid}', '{$date}', 'open', '{$user_ID}')";             $wpdb->query($sql_thread);             $tid = $wpdb->insert_id;             $sql_post = "INSERT INTO {$this->t_posts} (text, parent_id, `date`, author_id, subject) VALUES('".$this->input_filter($wpdb->escape($post->post_content))."', '{$tid}', '{$date}', '{$user_ID}', '".$this->strip_single_quote($post->post_title)."')";             $wpdb->query($sql_post);             $new = $post->post_content."\n".'
get_threadlink($tid).'">'.__("Join the Forum discussion on this post", "mingleforum").'
';             $post->post_content = $new;             wp_update_post($post);         }     }       I assumed I could just change `if('post' == $_POST['post_type'])` to `if('my_custom_post' == $_POST['post_type'])` and the rest would work the same. The `$mydata`value comes from here:               function send_wp_posts_to_forum()     {         add_meta_box('mf_posts_to_forum', __('Mingle Forum Post Options', 'mingleforum'), array(&$this, 'show_meta_box_options'), 'my_custom_post');     }     function show_meta_box_options()     {         $forums = $this->get_forums();         echo '<input type="checkbox" name="mf_post_to_forum" value="true" /> '.__('Add this post to', 'mingleforum');         echo ' <select name="mf_post_to_forum_forum">';         foreach($forums as $f)             echo '<option value="'.$f->id.'">'.$f->name.'</option>';         echo '</select>
'.__('Do not check this if this post has already been linked to the forum!', 'mingleforum').'';     }      which works fine as the meta box is present in the right place.


title: Redirect to a page if ancestors is empty

text: I have this script to get the ancestors ID               //Get root ID     $post_id = $post->ID;      $ancestors = get_post_ancestors($post_id);      I would like to make a redirection if it's empty to a specific page ID so no one could be on a page with no ancestors. How ?


title: Getting deleted users in database

text: I am using the database that is being used by a WordPress site. I am trying to get all the users from `wp_users` table with SQL query. But there is also previously deleted users in `wp_users` table. I searched other tables like `wp_usermeta` but I couldn't find any status or column which identifies if that user deleted or not. Are there any table or column where WordPress website stores information about deleted users?


title: Is there a good way to use CMS images with CSS

text: I am building a responsive wordpress theme that allows for a custom banner image to be uploaded to each page. However, because of the responsive nature of the theme I need to set the images as background images using css to achieve the right effect. But, I do not want to throw random css styling into my html markup. Is there any to pull the image url from within the page template and drop it into a css file dynamically? I found an example of what I am looking to do here but without the slider functionality.: http://emporiumpies.com/ It seems they are hard coding the images in the css file, but that is the visual effect I am going for. I just need to figure out how to tie this into the wordpress CMS. Any help would be greatly appreciated! Thank you!


title: Sending post information to a coldfusion site.

text: I have a requirement where I need to send the post title, excerpt and permalink to an external coldfusion site. Basically, the coldfusion site would display this information as a teaser and then allow the reader to click on the permalink to go to the wordpress post page to read more. Is there a web service available that can help with this? Thanks


title: update_post_meta after form is submited

text: I'm using the plugin "Formidable" to easily manage and create forms. I have set a custom post type, and created an extra post_meta. I can use meta('test'); within the loop to show my meta value on the posts single page. Everytime someone creates an entry by submitting the form thats on the single post page i want the value for the meta key 'test' to be subtracted by one(updated). The Formidable plugin comes with a action hook:               add_filter('frm_after_create_entry', 'after_entry_created', 30, 2);     function after_entry_created($entry_id, $form_id){         if($form_id == 7){ //change 7 to the ID of your form               //do stuff here         }     }      I have put this in my functions.php. But how do I target the right post and right meta key? Thanks


title: Echo author slug in post edit page

text: On the Post edit page in the back-end, how do I echo the author's `user_nicename`? I am referring to the author of the post, not current user.


title: Front end form submission/processing, without using a template file

text:
I'm writing a plugin which has a front end form that is generated by a shortcode. I'm struggling with processing the form submission in any way. Many tutorials describe placing form processing code at the top of a template file. But as a plugin I don't have a template file. This is what I have at the moment. The shortcode just calls this function:               function get_testimonial_submission_form () {     ?>     <form action="" id="testimonialPostForm" method="POST">              <fieldset>             <?php _e('Name:', 'rhl-testimonial') ?>             <input type="text" name="testimonialclientname" id="testimonialclientname" />         </fieldset>              <fieldset>             <input type="hidden" name="submitted" id="submitted" value="true" />             <button type="submit"><?php _e('Submit Feedback', 'rhl-testimonial') ?></button>         </fieldset>          </form>          Result is <?php echo $testResult; ?>

          <?php     }      And for form processing, I'm using this test code:               function testimonial_submission_form(){         if($_POST['testimonialclientname'] == ''){             $testResult = 'Yes';          } else {             $testResult = 'No';         }     }          add_action( 'init', 'testimonial_submission_form' );      Currently after submitting the form, $testResult is empty.


title: Run an action only when Widget actually instantiated (not just registered)

text: Suppose you have a widget that depends on a metabox being added to, say, your Posts. An easy way to do this is to simply add the `add_meta_boxes` action to your Widget's constructor and off you go. When that widget is registered with `register_widget()` function, your metaboxes are added and off you go. The _problem_ with this approach is that, well, if the user hasn't actually dragged that widget into one of his sidebars, we _still_ add the metaboxes. And, if for some reason we register two different versions of this widget (say we extend the widget), then we're uselessly running the function twice. `wp_register_sidebar_widget` is called when the widget is registered, but that means it runs regardless of whether the widget actually appears in a sidebar or not. Is there a corresponding action that is run when a widget is actually loaded into a sidebar? So in other words an action that will only run for each widget that is actually added to a sidebar? Or do we have to dig through a list of widgets gotten through `wp_get_sidebars_widgets()`?


title: Pageline V1.4.5: background color of my title

text: Wow do I change the background color of my title in Blog articles? Not the color of the page but the backgroundcolor of the blogtitle.


title: Post pagination wp-pagenavi

text: i'm having some problem with page pagination using wp-pagenavi, i'm using this query:               $myposts = query_posts( array( 'showposts' => 10, 'paged' => get_query_var('paged') ) );;      i would that had 10 posts per page, in fact, it pages, but it only pages with 5 posts per page, i have 18posts, and cant have success to paginate. At Configurations > Reading > Posts per page: 10. What can be my problem? code: http://pastebin.com/TC7eBuFh


title: Togle wordpress metaboxes

text: While some excellent posts and tutorials have been written about removing and un-setting metaboxes, what i am looking for is to be able to turn them and off through a `settings page` for my theme. I am working on a function (reproduced below) to manage the widgets on the dashboard, it retrieves a get_option array which includes only the id's (as keys) of the metaboxes i want displayed, it compares this array to an array (keys) of all metaboxes i have given the option to be removed (right now only core ones but in the future custom ones also); the arrays are merged and unique remaining id's are passed to a foreach loop where they are removed using `remove_meta_box()` method (could have used the unset here also). This all works fine but is there a simple easy way to add these metaboxes back again without having to go through all the work of redefining all the arguments of `add_meta_box()` ? I mean something similar to `wp_register_script()` and then `wp_enqueue_script()` where once wp_register_script is defined, wp_enqueue_script can be called easily with just one argument. The function i have so far is:               function manage_dashboard_widgets() {          $show_metaboxes = (array) get_option( 'dashboard_show' );          $all_metaboxes = array(         'dashboard_quick_press',        // 'QuickPress'         'dashboard_secondary',          // 'Other Wordpress News'         'dashboard_primary',            // 'Wordpress Blog'         'dashboard_incoming_links'      // 'Incoming Links'         );          $metaboxes_to_remove = array_unique( array_merge( $all_metaboxes, $show_metaboxes ) );          if( ! empty( $metaboxes_to_remove )){         foreach ($metaboxes_to_remove as $metabox_to_remove ) {             remove_meta_box( $metabox_to_remove, 'dashboard', 'side' );             remove_meta_box( $metabox_to_remove, 'dashboard', 'normal' );         }     }          // Remove the welcome panel, irrespective of user.     update_user_meta( get_current_user_id(), 'show_welcome_panel', false );          }      add_action( 'wp_dashboard_setup', 'manage_dashboard_widgets', 20, 0 );      Thank you


title: How to display list of categories when using multi category filter

text: I'm using a multiple category filter by linking to URLs such as: domain.com/category/reviews+books domain.com/category/reviews+art etc This works fine as a filter but I can't find any built in WordPress function that will display the list of categories queried on the page. On a normal category page I would use single_cat_title() but this only retrieves the first category in the URL. How do I display both, or all if there are more? Thanks


title: Specify Table Column Width on a Page

text:
I currently have the following html on my Wordpress page
         <col width="50">         <col width="100">

NLP

                 Overview	                 A natural language processing challenge.

      However the `<col width="50">` seems to be getting ignored. Is this getting overridden by something in the CSS and if so how do I fix it?


title: Can I create my own custom Attachment Display Setting?

text: I'm porting a client site over to WP from an old customized .Net CMS and something their existing system does well is the site admin interface contains a simple utility for uploading media to the server and format it automatically for the page so visitors can download the file. (Where file downloads appear in their site there's a special icon and it adds the file size after the anchor text) It would be a very successful migration for me if I could provide a similar solution in WP from within the Media Library, and extending the Attachment Display Settings with one additional custom option would seem to do it nicely.   * Is this possible? Can I add an option to the Attachment Display Setting menu?   * Can it be done so that it won't be overwritten when WP updates? I'm glad to figure things out myself although I'm not the best PHP guy. But any clues on where to start would be a tremendous help. Thanks!


title: wp_query->max_num_pages always returns 0 on custom post type

text:
Hi there I am developing a theme where I have to load some posts with ajax, in my index page everything works properly, the problem is when I need to use it on custom post type, I pass the values for a jquery file using wp_localize_script, it pass the correct value when I have regular posts, but it always pass 0 when I have a custom post type. Can you help me? Many thanks. Code to pass arguments to my jQuery script               function core_ajax_init() {              global $wp_query;              // Add code to index pages.         if( !is_admin() ) { //!is_singular()                  // Enqueue jQuery Script to Process Ajax             wp_enqueue_script(                 'core_custom',                 get_template_directory_uri(). '/core/js/ajax-load-posts.js',                 array('jquery'),                 '1.0',                 true             );                  // What page are we on? And what is the pages limit?             $max = $wp_query->max_num_pages;             $paged = ( get_query_var('paged') > 1 ) ? get_query_var('paged') : 1;             //echo $max;                  // Add some parameters for the JS.             wp_localize_script(                 'core_custom',                 'core',                 array(                     'startPage' => $paged,                     'maxPages' => $max,                     'nextLink' => next_posts($max, false)                 )             );         }      }          add_action('template_redirect', 'core_ajax_init');      The following is a template where I call to print the button to load more posts               <?php      global $wp_query;          $found_posts = $wp_query->found_posts;     $per_page = get_option('posts_per_page');     $post_count = $found_posts - $per_page;          if($found_posts > $per_page) :     ?>

                                                                    <div id="loader" data-perpage="<?php echo $per_page; ?>">

<?php _e('Click here to load more', CORE_THEME_NAME);  ?>

      <?php endif; ?>      And here I have a snippet where I make a custom query for a specific post type               global $wp_query;                                             $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;                                             $wp_query = new WP_Query(array( 'post_type' => 'course', 'order' => 'DESC', 'orderby' => 'date', 'paged' => $paged ));                                             if($wp_query->have_posts()): ?>      The problem here is it seems no matter how many pages I have wp_query var here always return 0 to my function core_ajax_init(), if I have regular posts it returns the correct number of pages but for custom post type it always returns 0. Why? Thank you for your answers.


title: Passing html tags as shortcode parameters

text: I want to let the user of my plugin define html tags to use before and after the text output by the shortcode, so I am using parameters where they can enter the tags. However the tags are being converted to html entities. I therefore resorted to using html_entity_decode(), is this good practice?                   extract( shortcode_atts( array(                              'count'         => -1,                 'category_name' => '',                 'q_before'      => '<h3>',                 'q_after'       => '</h3>',                 'orderby'       => 'date', //'none','ID','author','title','name','date','modified','parent','rand','menu_order'                 'order'         => 'ASC', //'DESC'           ), $atts, 'myfaq' ) );              $q_before   = html_entity_decode( $q_before );         $q_after    = html_entity_decode( $q_after );


title: custom field functionality

text: I have to build a custom functionality based on custom fields. I have a sidebar that displays a blockquote testimonial. At the moment this is achieved by giving a post a category of block quote. But the customer wants to make it more user friendly by adding a field for the title, the quote and an author. I can do this by adding custom meta boxes and using the post meta data. But they also want to be able to choose the page it will be displayed on. Currently the block quote is a template part, and is called via a conditional in various template files. So it is not known in advance the pages it will appear as content grows and different pages are added. I will need a select box in the post edit screen that has been auto populated with all the current pages that display a block quote. But I am at a loss how to populate this select box as its not known in advance which pages end up with a block quote on them. I was thinking about finding a way to every time a page displays the block quote this info is logged and then used to populate the select box, but I am not that great with custom php, I am a front end Dev that is learning how to build WordPress back end. I have good HTML CSS JavaScript, but my php knowledge is limited to simple conditionals and the custom functions of WordPress. I assume this will be hooking into a filter somewhere but I can't see where. Any help on this would be much appreciated.


title: modify a function filter

text: I am using the latest version of wp-ecommerce (3.89) and a new filter has been introduced to enable role based access to certain dashboard features such as the sales page or upgrade capability. However, the default role in the core file is currently set to "administrator". What I would like to do is take the original filter and modify it by placing the modified code in my functions file to over-ride that. So how to modify this: (from plugin file wp-ecommerce/wpsc-admin/admin.php               $purchase_logs_cap = apply_filters( 'wpsc_purchase_logs_cap', 'administrator' );     $page_hooks[] = $purchase_logs_page = add_submenu_page( 'index.php', __( 'Store Sales', 'wpsc' ), __( 'Store Sales', 'wpsc' ), $purchase_logs_cap, 'wpsc-purchase-logs', 'wpsc_display_purchase_logs_page' );      to something like this               remove_filter('wpsc_purchase_logs_cap', 'administrator');     function sh_wpsc_admin_pages($purchase_logs_cap) {     apply_filters( 'wpsc_purchase_logs_cap', 'editor' );          }


title: Why is the media upload button not in the main toolbar & can it be placed there instead?

text: Is there a good reason why the wp media upload button is not placed within the main edit toolbar, and can we put it there instead of floating above??


title: How do I remove a menu from a theme?

text: I have a very simple question, how do I remove a menu from a WordPress site? Is there a plugin out there that can handle this or do I have to go into my theme's code and remove something from there?


title: Does the 3.4.2 Dashboard have Chrome Frame headers?

text: A quick google search for "Wordpress Dashboard Chrome Frame" seems to indicate that 3.2 and up integrate Google Chrome Frame is included in the Dashboard, but I haven't been able to find anything official from Wordpress about it, and when I inspect the headers in Chrome, I don't see the standard Chrome Frame headers. Anyone know anything about this?


title: Why when I create a new post I found 2 record related to this post into the posts database table?

text: I am very new in WordPress development and I have a doubt about the WP database table named **posts** I have observe that when I create a new post (into the WP administration panel) are created 2 record into the **posts** table. For example, after that I have create a single post titled as **DB TEST** into the **posts** table I found these 2 records:               29  1   2014-08-14 20:36:43 2014-08-14 20:36:43 deb test    DB TEST     publish open    open        db-test         2014-08-15 20:37:34 2014-08-15 20:37:34     0   http://localhost/wordpressAsper/?p=29   0   post        0          30  1   2014-08-15 20:36:43 2014-08-15 20:36:43 deb test    DB TEST     inherit open    open        29-revision-v1          2014-08-15 20:36:43 2014-08-15 20:36:43     29  http://localhost/wordpressAsper/2014/08/15/29-revi...   0   revision        0      As you can see the 2 records contains the same informations except for the ID (that is univocal) and for the **post_type** field. In the first record this field have **post** as value while in the secondo record the valie is **inerith** So why when I create a new post I have 2 records and not a single record? Moreover I noted that, for other posts, I have more the 2 records related to the same post. What exactly means?


title: Best practices for multiple Custom Feeds functions

text: I created two new WordPress RSS feeds in my theme functions: `               // Custom Feed 1     add_action('init', 'customRSS');     function customRSS(){      add_feed('feedname', 'customRSSFunc');     }     function customRSSFunc(){     get_template_part('rss', 'feedname');     }                              // Custom Feed 2     add_action('init', 'customRSS2');     function customRSS2(){      add_feed('feedname2', 'customRSS2Func');     }     function customRSS2Func(){     get_template_part('rss', 'feedname2');     } ` It's working perfect, however based on the DRY concept I feel that may have a better approach to this code instead of adding the whole function for each new custom feed. Is that true? The tutorial I followed is this if anyone interested.


title: Custom CSS for plugin form

text: I have a short code that is adding a form to a page. How do I ensure that the CSS for the form is loaded in time with the shortcode?


title: Can I exclude a post by meta key using pre_get_posts function?

text: I see many people prefer to use `pre_get_posts` hook instead of `query_posts`. The code below works and shows all posts which have meta key "featured"               function featured_posts( $query ) {         if ( $query->is_main_query() ) {            $query->set('meta_key', 'featured';            $query->set('meta_value', 'yes';         }}     add_action( 'pre_get_posts', 'featured_posts' );      But I want the posts which have '`featured`' meta_key to be **excluded** from the main query. Is there an easy way for this?


title: How to include posts with a theme

text: I am making a theme and would like to submit the posts that i have made with the theme to the user. How can this be done?


title: Define add_editor_style to specific post types?

text: I am wondering is it posible to define add_editor_style to specific post types? Currently I am using this function..               // EDITOR STYLE     add_editor_style('editor-style.css');      But I would like have multiple editor styles for various post types. So guessing it could be like this...               if ( ... ) {          // EDITOR STYLE POSTS & PAGES     add_editor_style('editor-style.css');          } else if ( ... ) {          // EDITOR STYLE CUSTOM POST-TYPE BOOKS     add_editor_style('editor-style-books.css');          }      My post types are `page`, `post`, `book`    Any ideas would be great thanks


title: How to show custom post type in page hierarchy?

text: Is it possible to show a list of pages with a custom post type included in that list if it's parent is a page? So if I was using the query more specifically something like `get_pages()`, `wp_list_pags()`, etc... could I show a list/sitemap that was more like a sitemap that that matched your entire sites structure? So consider these are all the public facing links of a site:               example.com      example.com/about      example.com/contact-us     example.com/services     example.com/services/service-one     example.com/services/service-two     example.com/services/service-three     example.com/services/service-four     example.com/services/service-five      These links were created with "pages" built in post type:               example.com/about      example.com/contact-us     example.com/services      Assume there is a custom post type called services that has the **page** "services" as it's parent when registering the psst type. So the following links were created under the services cpt:               example.com/services/service-one     example.com/services/service-two     example.com/services/service-three     example.com/services/service-four     example.com/services/service-five      Can I use the query somehow to produce a list that includes cpt's in it?


title: scripts not enqueueing

text: I have been beating my head against this for a couple of hours now and can't seem to figure it out. I am trying to enqueue a script into my page with the following code in my functions.php.               function my_slider_scripts() {     $scriptsrc = get_stylesheet_directory_uri().'/js/jquery.nivo.slider.pack.js';     wp_register_script( 'nivo-slider-pack', $scriptsrc );              wp_enqueue_script('nivo-slider-pack');     }           add_action( 'wp-enqueue_scripts', 'my_slider_scripts' );      I have looked at the codex and every tutorial I can find and nothing seems to make this work. I should mention I am using a child theme. Any ideas would be greatly appreciated.


title: Resize Rich Post Editor in Chrome

text: For some reason, I'm not able to resize the text editing area on my site's WordPress install in Chrome or Firefox. I can resize the HTML editor, which shows a resize indicator in the white text editor area, but the rich editor will not resize even though it shows the resize indicator in the grey area - http://cl.ly/5zgH. I can resize the editor in other WordPress sites I use, but not this one. Has anyone seen this, and do you have any suggestions?


title: Modify images when inserted in to WYSWYG Editor

text: When an image get added it currently adds                     I am aware that user can directly add the link. However the editors make mistake of not doing so. Also have IIRF set up so the actual domain used for wordpress is different to the actual host So I need to change the output of the the_content to be (this is for the existing posts)                     When inserting new image whatever the option editor choose insert only the image as                     I saw this Modifying the HTML Output of Inserted Images but I am not quite sure how to actually change it to my requirements


title: Settings API - Checkboxes validation in a menu with multiple subpages

text: I'm building a theme using the settings API. I have a top level menu with multiple subpages and everything is working fine, except checkboxes. I am saving the options to a single options array. This is my sanitation function:               public function sanitize($input) {              $options = get_option(THEMEOPTIONS);         $fields = gosu_adminpanel_fields();              foreach ($fields as $key => $field) {             if($field['callback'] == 'gosu_controls_checkbox') { // if the field is a checkbox                      if(!isset($input[$key])) {                     $options[$key] = "off";                 }                  }         }              foreach($input as $key => $field) {             $options[$key] = $value;         }              return $options;          }      $fields is an array with all the field data like type, default values, etc. Since checkboxes fields are not sent in the POST array when the option is unchecked, it requires the extra validation. This would work fine if I was using a single menu page, but since I'm using more than one, when I submit one of the pages that doesn't have a checkbox, it sets the value to "off" thinking the user unchecked the box because the field does not exist. I'd like to be able to validate the checkbox only when the page it is on is submitted or have some other way to make this work without the checkboxes value being set incorrectly. I want to use only one options array for all the theme's settings; using a variable for each page is out of the question. I'm considering changing the checkboxes for yes/no dropdowns but that wouldn't really be an elegant solution.


title: $post->ID displays wrong ID

text: This one is pretty weird. This code:               $post->ID      Displays right ID every time excepting the blog page (the page set as blog on /wp-admin/options-reading.php). On that page $post->ID returns the ID of first blog post for given page. Now, the tricky part, I've tried to remove all the loops from all my pages, totally erased loop.php file, disabled all the widgets that might have been affecting $post and it still returns the wrong ID. Any hints? My index.php is pretty standard:               <?php get_header();?>               <?php get_template_part( 'loop', 'index' ); ?>          <?php get_footer(); ?>      And the loop.php is:               <?php while ( have_posts() ) : the_post(); ?>      contents     <?php endwhile; ?>      Maybe the problem is I'm trying to get the ID in header.php? And yes, `wp_reset_postdata()` doesn't seem to help as well :/


title: Need to add/remove group of options and display them as rows

text: I am creating a plugin which has 5 textbox for options. What I need to do is to treat these 5 options as 1 item, and being able to add more items. I've always worked with static hardcoded options for my wordpress plugins, so I am not sure how to do this, but I will try to do my best to explain myself. I want to have a table similar to the posts table, then I want to be able to add/remove rows. Each row will be one "item" containing the 5 options. **Does someone knows a plugin that works similar to this so I can check it out? (if it also uses ajax that would be awesome)** My main problem is I am not sure how to save/retrieve the multiple rows because I always hardcoded my option names on the code.


title: The right way to create a custom search page for complex custom post types

text: I am trying to create a custom search page to show only custom posts types that meet specific search criteria. I have a complex form that involves different selects, radio buttons and text input fields. I am comfortable using the WP_Query class to query for the posts that are identified via the search form, but I'm not sure if I should create additional templates or use the built in search page. Let me give you a for instance to help communicate my conundrum. Imagine you have the CPT "Person". For each person, you have "Birth Date", "Gender", "Height", and "Weight". You want to search for all males born after 1972, who are taller than 6 feet tall. How would you work out this search? Again, I can easily put together `$args` for the WP_Query class to get these posts. I need to know the best way to integrate this with WordPress. Ultimately, I need a solution the satisfies the following: 1) Preserves pagination on the search page 2) Only searches for the specific CPT, not other CPTs And, I have the following questions 1) Should I have a separate template for this, or can I integrate this directly with `search.php`? My current solution feels hacky and I would like to develop an alternative. I have created a new Page in the WP admin. I use this page's URL as the `action` attribute in the search form. I then use a custom template to display results of that page. This seems wrong to me. 2) If I integrate this with `search.php` how do I preserve the regular search results, in addition to having these lovely custom search results? Thank you so much for your help! EDIT: On further investigation, I'm beginning to think that `pre_get_posts` will likely be involved in a "better way" to do this.


What's the easiest way to duplicate an entire navigation menu? I don't care if it involves SQL commands or whatnot. I just have some really big menus that I'd like to duplicate. Didn't see a plugin to do this. For clarification, I wan to duplicate the menu so I can make some edits to it and use it as a secondary menu elsewhere. I'm not trying to display the menu twice. ![wordpress.jpg](http://img16.imageshack.us/img16/2006/wordpressg.jpg)


title: I need ideas for a complicated menu

text:
I have a slightly complicated menu to code from PSD document and integrate into wordpress. this is how it looks: (link in the comment bellow) The result of my work is this: http://slavisaperisic.com/FlexE/meni_setap.html Now, when I write function I get the default markup

      But the markup I created (that gives me the appropriately styled dynamic menu) looks like this:

                                     Exploring

                                     Using

                                     Downloading

      I styled it so that it follows the length of the word in the menu item. Obviously I can't use the `wp_list_pages()` function because the structure it gives me is different than the one I need. Do you have some ideas? Maybe point me to somewhere where I can learn to code it differently or explain it to me? Thanks


title: How Can I Organize the Uploads Folder by Slug (or ID, or FileType, or Author)?

text: I want to store all attachments (media) in folders named with each post title. Example: `/wp-content/uploads/my-post-about-stuff/` The folder should contain all media attached to that post. Is that possible?


title: Prevent Registration Where Role is None?

text: My blog is being hammered by sploggers. The good news is that in every case the role displays as "None" in the list of Users. Is there a way to use add_action("user register") in functions.php to prevent these registrations based on the role being empty or None? While I assume the code would look something like this:               add_action("user register","spike_registrations");          function spike_registrations($user_id){       //pull out role, evaluate role, if role = "" or None stop registration     }      What I'm unsure about is the specific code that goes into my function. What is the data set used by the registration process, for example, and how do I pull out the role from that data set? Is there any special way to evaluate the value of role? And what WP function is used to stop the registration process? Thanks for any ideas how to pull this off. It would save me an hour every few weeks spent going through 20 plus pages worth of bogus registrations.


title: Multiple Domains For WordPress MultiSite Subdirectories

text: How can I use example.com and example1.com for all WordPress multisite subdirectories? For example if a user navigated to example1.com/site/ they would see the same site as if someone navigated to example.com/site/ (or were forwarded). Currently I have my DNS for both domains pointing to my servers IP but only the domain I set in the WordPress settings (for example: example.com) is working. The second domain (example1.com) works, but it doesn't work with subdirectories (for example if I got to example1.com/site/ it just goes back to example.com). It sounds like I need to change something on my server or in the WordPress settings to allow both domains to be used, but I don't know. I purchased and tested this plugin but it just allows you to have switch between multiple domains per subsite (still only 1 domain), I need multiple domains for all subsites.


title: How do I delete all generated images from my server except those currently used in posts

text: I have a new set of image sizes for my site's in-development theme. My server is filled with old image sizes, most of which have never been used. You've heard this one before, right? **The Question**   How do I delete all WP generated thumbnails from my server _but not those thumbnails currently used in posts_? That is to say something like: `$ find . -name "*-*x*.jpg" | xargs rm -f` is too wide of a hammer because `myimage-300x250.jpg` might be used in a post. Its 6 other variations are welcome to go away though! I think I need to generate a list of used images, compare that to my directory and delete the difference (minus the originals). But how to go about that escapes me. * * * The " **why?** " sidebar:   Extra image sizes on the server is generally no big deal but we have over 2.7 gigs in their right now and it just seems a waste to leave them and back them up. Plus, we're about to start fresh - why not do the spring cleaning? As far as regenerating the thumbs, while the new design has new image specifications, none of us have the time to go and update hundreds of older posts with RTE inserted images. Let bygones be bygones, I say.


title: Fill post titles from post content?

text: I imported over 1000 posts from a Tumblr gallery. All the posts are untitled, but each has a photo and name inside of the post. How do I make take the content of each post and make it the post name?