Is there a different way to grab a thumbnail image than this?

I am currently upgrading my WP to 3.2.1 to 3.5.2, and for one section of my posts it seems like the featured image has disappeared. However, I just checked the the wp_posts table in the database through phpmyadmin and looked for one of my posts that had this issue. My `img` tags are being produced dynamically, but the problem is that the `src` is blank. Here's an example of one of the posts: Given this record in my wp_posts table:                   ID     post_author  post_date   post_date_gmt   post_content    post_title  post_excerpt    post_status     comment_status  ping_status     post_password   post_name   to_ping     pinged  post_modified   post_modified_gmt   post_content_filtered   post_parent     guid                                                 menu_order     post_type   post_mime_type  comment_count   cod_current_ahrf          16169  1            2011-06-17  2011-06-17                      Nick-Arias                  inherit         close           close                           Nick-Arias.jpg          0000-00-00 00:00:00     0000-00-00 00:00:00                         3728            /images/ahrf/pioneers/legends_face/Nick-Arias.jpg    0              attachment  image/jpeg      0         category-legends.php:               if(file_exists($_SERVER{'DOCUMENT_ROOT'}.substr($fivesdraft->guid_legend,20)))         {         echo $fivesdraft->ID; // returns 3728         $featured = gangmei_get_the_post_thumbnail_url( $fivesdraft->ID );                   echo '

post_name.'">name.'" />

post_name.'">'.$fivesdraft->name.'

';         }       functions.php:                   function gangmei_get_the_post_thumbnail_url($post_id = NULL) {             global $id;             $post_id = (NULL === $post_id) ? $id : $post_id;             $edmund = get_post_thumbnail_id($post_id);             echo "post_id = $post_id"; // returns 3728             echo "edmund = $edmund"; // returns 16169             $src = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'full'); //the issue arises here. this returns nothing.             $src = $src[0];             return $src;              }      This is what is produced: `<img src="" alt="Nick Arias">`. What's supposed to be produced is this: `<img alt="Nick Arias" src="/images/ahrf/pioneers/legends_face/Nick-Arias.jpg">` The thing is that under the `guid` column in the database you can see the value of that column for that record is `/images/ahrf/pioneers/legends_face/Nick-Arias.jpg`. Is it possible to just grab the `guid` instead of going through all of these functions? Like this: `$featured = $fivesdraft->guid;`?


Inserting post_id into guid before wp_insert_post

I would like to insert data into the wp_posts table with the inserted post_id in the 'guid' for a record that doesn't already exist. Below is the closest I've gotten but this doesn't work ($postarr['ID'] is equal to 0).               function filter_handler( $data , $postarr )     {     if($data['post_type']=='ai1ec_event'){         $my_post_id = $postarr['ID'];         $data['guid'] = get_option('siteurl') .'/?post_type=ai1ec_event&p='.$my_post_id.'&instance_id=';     }          return $data;     }          add_filter( 'wp_insert_post_data' , 'filter_handler' , '99', 2 );          $mypost = array(       'post_author'     => 1,      'post_content'     => 'Test',       'post_status'      => 'publish',      'post_title'       => $_GET['assignment_name'],      'post_type'        => 'ai1ec_event',      'guid'     => ''     );           $postid = wp_insert_post($mypost);


Can't get custom user meta to show in header

I have used Pie Register plugin to add a "Phone" field. I tried every method in the book (that google fetched for me, so far) to show it but it shows an empty array although the field is not empty and the wordpress backend shows it. Also, User Meta plugin is able to show the field with its data but I can't get it to show manually in my header file. Any help is appreciated, I spent hours without any luck doing this! Thanks


wp_filter_kses allow HTML5 video?

Is there a way to allow my users to add HTML5 video tag (without shortcodes) into my textfield/textarea? Allowed anchor styles and bold tags are working, but as soon I add 'video' and 'source' it doesn't work anymore:(   Any help is appreciated. Thx.               function validate_setting($plugin_options){          //This Works         $allowed_html = array(          'a' => array(         'href' => array (),         'title' => array ()),         //This works also         'b' => array(         'style'=> array(),         ),          //This is not working...         'video' = array(         'width' => true,         'height' => true          ),          //This also is not working...         'source' = array(         'src' => true,         'type' => true          ),          );               $plugin_options['text_area']= wp_kses($plugin_options['text_area'],$allowed_html);     return $plugin_options;     }


Custom header image, and content, on Posts Page in twentyeleven with Static Front Page

I'm new to Wordpress, so sorry if I've missed something obvious. I have a site using (a local child of) the twentyeleven theme. I've found that if I set Featured Images on pages and posts, then that image replaces the header image; which is great. However, if I customise the theme to display a Static Front Page, designate another page (`recent-news`, say) as my Posts page, and set a Featured Image on `recent-news`, then `recent-news` doesn't show that as the custom header image - instead it shows the twentyeleven random images. How can I fix this? Also, I don't know if it's related, but any content I have on the `recent- news` page isn't shown; its only displayed content is the summaries of the Posts.


content and excerpt not displaying

I am using `get_the_title(453)` and while the title displays, i am unable to display the content and the excerpt for the page with the id of 453. The following is my code                       get_the_title(453);          $content = get_the_content();         echo $content;         the_excerpt();      Is there is something i am missing or doing something wrong?


Help writing custom function with rewrite endpoint that generates a page from dynamic content

I'm creating a WordPress plugin that will pull content from an API and display it dynamically on a WordPress blog like it's native content. An example of this content would be **company locations**. I already have a short code that pulls the _list_ of locations into the preferred page, but we also want to dynamically generate location detail pages with data from the API. So... `/locations/` is a WordPress page with a `[locations]` short code that pulls the list of locations from the API. DONE & WORKING. We want `/locations/location-detail/123-my-location-name/` (or something really similar) to build a dynamic page using the DEFAULT page template. From the research I've done (and I'm very new to WP plugin development), we could possibly accomplish this by creating a custom endpoint that will send the endpoint "location-detail" with the value "123-my-location-name" to my plugin. I want the plugin to then generate a "fake" page with content from my API and display it to the visitor. I found this code from a blog post, but I can't seem to get it in my plugin which is class-based (OOP).               // added for rewrite URL for front end                 $endpoint = 'wizard';                 add_action('init', 'endpoint');                        add_action( 'template_redirect', 'template_redirect' );                 add_filter( 'the_posts', 'the_posts' );     // added for rewrite URL for front end           function endpoint(){                     $endpoint = 'wizard';                     add_rewrite_endpoint('wizard', EP_ROOT);  // it will create endpoint to access it from frontend     }          function the_posts( $posts ){                     $endpoint = 'wizard';                                $value = get_query_var($endpoint);                          // Check if our endpoint is being used                     if( $value ){                         // Perform the necessary actions                         remove_all_actions('the_content');                         // Create a fake page                         $post = array(                             'ID' => 1,                             'post_author' => 1,                             'post_date' => current_time('mysql'),                             'post_date_gmt' => current_time('mysql', 1),                             'post_content' => $html,                             'post_title' => 'Post Title / Plugin Title',                             'post_status' => 'static',                             'comment_status' => 'closed',                             'ping_status' => 'closed',                             'post_name' => $endpoint . '/' . $value,                             'post_parent' => 0,                             'post_type' => 'page'                         );                         $posts = array( (object) $post );                 }     }          function template_redirect(){     }      I'm hitting a brick wall here, I'm not at all familiar with WordPress plugin development and can't seem to get a proof of concept working. If anyone could get me a simple snippet of code that creates a dynamic page with content from the plugin (even dummy text) I could take it from there and get the rest of the plugin written. Any help, advice, or suggestions would be greatly appreciated!


category page for custom post type

I know this question has been asked a thousand times, but feel like I've looked at every single article on this issue, and none of them have worked for me. All I want is for there to be a category page for my custom post type, products. So that I can type www.mysite.com/products and see all the products. Or if it's easier make it work like regular posts do www.mysite.com/category/products. Either works for me. I have written the code in functions.php and also used plugins like CPT-onomy and CPT-UI to successfully make the custom post types and taxonomies. But this doesn't create the category page. How is this accomplished? Please include instructions on permalinks if that is relevant to my situation too. Here is the code I placed in functions.php. The second block that deals with taxonomies actually breaks the site. However, using the two plugins mentioned above, I've been able to successfully create taxonomies, but still can't get a category page.               add_action( 'init', 'create_post_type' );     function create_post_type() {         register_post_type( 'product',             array(                 'labels' => array(                     'name' => __( 'Products' ),                     'singular_name' => __( 'Product' )                 ),             'public' => true,             'has_archive' => true,             'exclude_from_search' => false,             'show_ui' => true,             'supports' => array('title', 'editor', 'thumbnail', 'custom-fields'),             'taxonomies' => array('category', 'post_tag')             )         );     }               function my_taxonomies_product() {         $args = array();         register_taxonomy( 'product_category', 'product' $args );     }          add_action( 'init', 'my_taxonomies_product', 0 );      updated code               function create_post_type() {         register_post_type( 'product',             array(                 'labels' => array(                     'name' => __( 'Products' ),                     'singular_name' => __( 'Product' )                 ),             'public' => true,             'has_archive' => true,             'exclude_from_search' => true,             'show_ui' => true,             'supports' => array('title', 'editor', 'thumbnail', 'custom-fields'),             )         );     }     add_action( 'init', 'create_post_type' );          function my_taxonomies_product() {         $labels = array(             'name'              => _x( 'Product Categories', 'taxonomy general name' ),             'singular_name'     => _x( 'Product Category', 'taxonomy singular name' ),             'search_items'      => __( 'Search Product Categories' ),             'all_items'         => __( 'All Product Categories' ),             'parent_item'       => __( 'Parent Product Category' ),             'parent_item_colon' => __( 'Parent Product Category:' ),             'edit_item'         => __( 'Edit Product Category' ),              'update_item'       => __( 'Update Product Category' ),             'add_new_item'      => __( 'Add New Product Category' ),             'new_item_name'     => __( 'New Product Category' ),             'menu_name'         => __( 'Product Categories' ),         );         $rewrite = array(             'slug' => 'type',             'with_front' => true,             'hierarchical' => true,         );         $args = array(             'labels' => $labels,             'hierarchical' => true,             'rewrite' => $rewrite,         );         register_taxonomy( 'product_category', 'product', $args );     }     add_action( 'init', 'my_taxonomies_product', 0 );


How to get all post titles starting with numbers and symbols?

I want to get all posts which are starting with a number (0-9) or symbols, in a list. I managed to get it work for letters, but this one is harder for me. Can someone help me out please? I tried adding this in my existing code, but it didn't work:               $this_char = strtoupper(mb_substr($post->post_title, 0, 1, 'UTF-8'));     if (strpos('0123456789',$this_char) !== false) $this_char = '0-9';     if ($this_char != $last_char) {      This is my code:               <?php                $first_char = 'A';              $postids=$wpdb->get_col($wpdb->prepare("         SELECT      ID         FROM        $wpdb->posts         WHERE       SUBSTR($wpdb->posts.post_title,1,1) = %s         ORDER BY    $wpdb->posts.post_title",$first_char));              if ($postids) {         $args=array(           'post__in' => $postids,           'post_type' => 'post',           'post_status' => 'publish',           'posts_per_page' => -1,           'caller_get_posts'=> 1,           'orderby'=> 'title',           'order' => 'ASC'         );         $my_query = null;         $my_query = new WP_Query($args);         if( $my_query->have_posts() ) {          echo 'test test '. $first_char;                while ($my_query->have_posts()): $my_query->the_post();           ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

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

      Note: I want all of these symbols and numbers on 1 page.


Trigger Submit Event when Widget is added to Sidebar

I need to trigger the submit or "Save" button for a widget when the widget is added to a specific sidebar in the backend. The reason for this is I am setting a certain taxonomy for a Dropdown Menu inside each widget. The code for setting the taxonomy works fine as long as after adding a widget you hit the "Save" button or refresh the page after the widget has been added. Here is my code inside jQuery I am using to capture the Ajax event when a widget gets added to a sidebar and to trigger the submit button to force a Save action.               $( document ).ajaxStop( function() {         var $saveBtns = $('#products_sidebar').find('input[submit]').trigger('submit');     } );       I am capturing the Ajax event correctly and able to console out the contents of the sidebar:               console.log("sidebar: " + $('#products_sidebar').html() );      However the submit action is not getting triggered. thanks


How do i add custom fields to my themes template file?

I am using 4 custom fields and display the custom fields in my theme page by               $quote_text_1 = get_post_meta($post->ID, 'quote_text_1', true);     $quote_text_1_author = get_post_meta($post->ID, 'quote_text_1_author', true);     echo '
'.$quote_text_1.'
'.$quote_text_1_author .'
';          $quote_text_2 = get_post_meta($post->ID, 'quote_text_2', true);     $quote_text_2_author = get_post_meta($post->ID, 'quote_text_2_author', true);      echo '
'.$quote_text_2.'
'.$quote_text_2_author.'
';      How can I add the custom fields to specific theme template page, so the user knows he/she can use these fields?


Simple WP Plugin with plugin settings page

I need to create a plugin with only one select on his settings page and save select value. I have a select with all register menus and I can not to save my select value. What am I doing wrong? What I have tried so far.               if(isset($_POST['av_menu_selector'])) {         $locations = $_POST['av_menu_selector'];         }          function av_register_settings() {         register_setting( 'av_theme_options', 'av_options', 'av_validate_options' );     }     add_action( 'admin_init', 'av_register_settings' );          function av_mobile_menu() {        av_mmenu();     }     add_action('wp_footer', 'av_mobile_menu');               function av_mobile_menu_plugin_settings() {     add_menu_page('AV Mobile Menu', 'AV Mobile', 'administrator', 'av_mobile_menu_settings',     'av_mobile_menu_display_settings');     }     add_action('admin_menu', 'av_mobile_menu_plugin_settings');          function av_mobile_menu_display_settings() {                  $menus = get_registered_nav_menus();              $info = '

Some info here =)

';          $html = '
<form action="options.php" method="post" name="options">'.     wp_nonce_field('update-options') .'
Select Your Menu
';             $html .= '<select name="av_menu_selector" id="av_menu_selector" >';              $locations = array();              foreach ( $menus as $location => $description ) {                         $html .= '<option value="'.$location.'">' . $description . "</option>";             array_push($locations, $location);                 }              print_r($locations);              $html .= '</select>

';             $html .= '<input type="submit" name="Submit" value="Save MENU" /></form>
';              echo $info;         echo $html;          }          function av_mmenu() {         global $location;         $menu_args = array(             'theme_location'  => $location,             'menu_id'           => 'av_mobile_menu_holder'         );              wp_nav_menu( $menu_args );     }


Contact form with dynamic recipient

I am creating profiles of people where each person is a custompost; I need my customposts have a contact form send mail to different recipient. I have already created a Metabox in which to put the email address (With MetaBox plugin):               ...          array (                 'name' => 'Email',                 'desc' => 'email address',                 'id' => 'people_email',                 'type' => 'text',             ),     ...      without problem I can get the data like this:               $emailPeople = get_post_meta($post->ID, 'people_email', true);     echo $emailPeople;      now I need to send the form to the email you enter in this field. I found this plugin: http://sevenspark.com/goods/contact-form-7-dynamic-text- extension but doesn´t work for me and i would like to know another method. Thanks!


Register_post and add_menu & add_submenu conflict?

I want use register_post to get wordpress template for create my own post.                $product_label = array(            'name' => __('Products','neocom'),       'singular_name' => __('Product','neocom'),       'add_new' => __('Ajout d\'un nouveau produit','neocom'),       'add_new_item'    => __('Ajout d\'un nouveau produit 2','neocom'),       'new_item'    => __('Ajout d\'un new produit','neocom'),       'edit_item'   => __('Edit produit','neocom'),       'view_item'   => __('View product','neocom'),       'all_items'   => __('Liste des produits','neocom'),       'not_found'   => __('Pas de produits enregistré'),       'menu_name' => __('My product name menu','neocom'),          );               register_post_type('product', array(      'labels' => $product_label,      'singular_label' => __('Product'),      'public' => true,      'show_ui' => true,      'capability_type' => 'post',      'show_menu_ui' => 'neo-product',      'hierarchical' => false,      'supports' => array('title', 'author', 'thumbnail')     ));      I want to do appear List's product and New product and my own admin menu. I have added show_menu_ui => 'neo_product'. The result , i have my product list but haven't new product. I have defined admin_menu like it :               add_action('admin_menu',array($this,'buildMenuAdmin')); // On my constructor      buildMenuAdmin function :                add_menu_page('NeoptinCom','Neo_Com',$capability,'neo-product',array(&$this,'neoproduct_all'));           // Gestion page product & hook pour le css         //Page product ( Liste )         $product_page = add_submenu_page('neo-product', __('All Product','neocom'), __('Products','neocom'),$capability,'neo-product',array(&$this,'neoproduct_all'));         add_action( 'admin_head-'.$product_page, array(&$this,'admin_header') );          // Page Creation/Modification de produit     $product_page_create = add_submenu_page('neo-product', __('Create Product','neocom'), __('Create Product','neocom'),$capability,'neo-product-create',array(&$this,'neoproduct_create'));     add_action( 'admin_head-'.$product_page_create, array(&$this,'admin_header') );     error_log('Page=> '.$product_page_create );     //Page paiement     $paiement_page = add_submenu_page('neo-product', __('Paiement','neocom'), __('Paiement','neocom'),$capability,'neo-paiement',array(&$this,'neopaiement'));     add_action( 'admin_head-'.$paiement_page, array(&$this,'admin_header') );


What is a good free subscribe list?

I tried 3 different plugins and they ALL didn't work. I would like a plugin that allows me to put a widgit into the sidebar. Configure a redirect page to say thank you and a way to get a list of the emails (preferably with signup date and name. csv is nice) Is that so much to ask for... If it can shoot everyone an email on signup that be nice too


how to activate a plugin inside a theme

Iam trying to activate a plugin which is inside my theme template directory, ie : i have a folder called plugin inside my current theme, which has some plugins how can i activate those plugins from the current plugins options.


Customised plugin failed to install and activate

I am trying to customise a plugin to add some functionality that is not part of the original. To do this I have copied all the files into a new folder, and renamed all the function prefixes, changed the header of the main php file. I have tried uploading the files straight to the server for activation but it was not picked up by WP so I zipped all the files to install them "properly" and it came up with the following output: > Unpacking the package… > > Installing the plugin… > > The package could not be installed. No valid plugins were found. > > Plugin install failed. > > _http://www.mydomain.com/wp-admin/update.php?action=upload-plugin_ Thinking that this may be a header problem I double checked my header but it all appeared to be correct, to my eyes at least.               /*     Plugin Name: MC Investment Custom     Plugin URI: http://www.spectra-info.com/wp/plugins (Original)     Description: Customised plugin based on the MC Investment Plugin.     Version: 1.0     Author: Edited by Joshua Ward Original by Spectrain     Author URI: http://www.spectra-info.com (Original)     */      But alas, no success. The .zip file has the plugin file in it's 'root' directory so I am fairly confident that is not the problem. Is there anything wrong with the plugin header that I can't see? I have tried it without the `(Original)` in the URI lines thinking that was what has mucked it but it appears not. EDIT: Please stop replacing Customise with Customize. Everybody who types English who is not American, ie me, spell it the British (read: proper) way.


Graphic design changes on Staging before moving to Production?

I have a Development, Staging and Production workflow for my WordPress site. I am fairly strict about any structural work to be done on the site being done in Staging first, then migrated to Production. I feel some changes may be better done on Production through the admin interface, such as a simple logo change, and some may be better done on Staging then migrated up to Production, such as a theme alteration. Where do you draw the line? What changes would you allow directly on the Production site and what changes would you say have to be done on Staging before being migrated to Production, for safety's sake?


get_the_title outputs title until spacing; it does not get full length of title

If I have a post with a spacing in it (like: Hello World), than `get_the_title` shows me only "Hello" as a link and not the whole permalink. I already tried using a `substring` to get it done, but it did not work out for me. Am I missing here something? I just used `get_the_title();` and put it in a variable. Code:               <?php     $titletest = get_the_title();          echo " $titletest ";     ?>


Remove short link tag from particular page

I want to remove the short link header tag from a specific page. Please suggest me a filter guys. I want to remove the entire               <link rel='shortlink'...       section from a specific page. Adding a filter to the wp_shortlink_wp_head will work fine? I am not sure whether i can add filter to the function just like that... Thank you


Creating a Link Directory using WordPress?

I would like to create a dmoz like website, using WP. Any suggestions on plugins or site's architecture would be welcomed.


Custom image sizes

I noticed lots of articles on how to add custom sizes for images (media). But how would I be able to add a custom size such as "width:100% and height:auto" this way it will make sure the images are responsive.


JavaScript Files Registered in Parent Theme Won't Load When Calling wp_enqueue_script() in Child Theme?

I'm making a framework parent theme and in the parent `functions.php`, I want to register all the possible js files I use frequently and if I want it to load it, in the child `functions.php` I just have to use `wp_enqueue_script()`. But it doesn't work... Any clue why?


User gets access denied to css files and js files even though user is logged in

We are using wordpress as a intranet, we have the AD Integration plugin. Everything is working fine except for one user. Now there is no difference in settings on his machine or user profile or AD profile to any other user. But for some reason when he logs in he gets access denied to all the CSS files and JS files. I know he has logged in successfully because I use console.log to display the username when logged in as well as other details such as full name and job title. The details are retrieved from the wordpress function for current_user so I know he is logged in. Has anyone else had issues with style sheets etc being denied even though the user is logged in?!


WP3.5 Media Uploader - how to make it accept multiple images?

I'm wondering how to make WP3.5 media uploader return 2 or more items in `attachement`? It always runs once even if 2 items are selected. The code:               $('.button').on('click', function(){          var send_attachment_backup = wp.media.editor.send.attachment;               wp.media.editor.send.attachment = function(props, attachment){                                                    myFunction(attachment.url);               wp.media.editor.send.attachment = send_attachment_backup;          }          wp.media.editor.open();     });      EDIT: My mistake. I'm doing `wp.media.editor.send.attachment = send_attachment_backup;` and it runs once. So the new questions would be: **how to restore the original function after the latest item in the loop?**


Inbuilt style for jquery-ui-datepicker

I want to use the datepicker that gets bundled with WordPress on the front end of a website. I enqueued `jquery-ui-datepicker` but the datepicker isn't styled(no js error in console). Is there a corresponding `wp_enqueue_style` for that? I used this code in `functions.php`               function rr_scripts() {       wp_enqueue_script( 'jquery' );       wp_enqueue_script( 'jquery-ui-datepicker', array( 'jquery' ) );            wp_register_style( 'bootstrap_css', get_template_directory_uri() . '/assets/css/bootstrap.min.css' );       wp_enqueue_style( 'bootstrap_css' ); # I'm using Twitter Bootstrap as CSS(if it matters)     }     add_action( 'wp_enqueue_scripts', 'rr_scripts' );


How to resolve - IE 6 ignores img "width" properties

In this post: http://humus101.com/?p=1734 We've got 4 images set (in the img property) to a width of 246 pixel. In chrome it looks fine. In IE6 it doesn't. Any suggestions on how to solve this?


How do I make my blog iPad / iPhone / Android friendly?

How do I make sure my blog is iPad / iPhone / Android / touch-device friendly?


Permissions to get autoupdate to work

I'm at version 3.0 and want to move to 3.0.1 without having to download/unzip/delete/upload but I get this error when trying to update: Could not create directory.: /public/wp- content/upgrade/wordpress-3.tmp/wordpress Is is safe to chmod 777 the upgrade folder?


Gravity Forms not loading under https, jQuery is not defined

I am using Gravity Forms on my Wordpress site, and so far so good. The problem is I have made the page secure (https/SSL), and this is making the form not to work. It looks like the issue is how the site is trying to load jQuery. There are 23 JS errors on the page, which seem to be due to a failed jQuery load `"Uncaught ReferenceError: jQuery is not defined"`. If I go to the page where the source is trying to pull the jQuery file, you'll see the error:`https://code.jquery.com/jquery-1.7.1.min.js?ver=3.4.2` Screenshot of the error:   ![https jquery error](http://i.stack.imgur.com/IqN2A.png)   _click to enlarge_ And this screenshot is the reference in the page source: ![source page](http://i.stack.imgur.com/jHljo.png) So I have been told I'd want to look into that - that's where the ultimate issue is, but I don't really know what to do next. Is it failing because of Gravity Forms, the HTTPS plugin from Wordpress, my SSL certificate...?


Change date number to another language/script?

I previously was able to change the numbers of the date and time (into a number and date system of another language, like Khmer) for each post using a script like this in my functions.php:               function KhmerNumDate ($text) {     $text = str_replace('1', '១', $text);     $text = str_replace('2', '២', $text);     $text = str_replace('3', '៣', $text);     $text = str_replace('4', '៤', $text);     $text = str_replace('5', '៥', $text);     $text = str_replace('6', '៦', $text);     $text = str_replace('7', '៧', $text);     $text = str_replace('8', '៨', $text);     $text = str_replace('9', '៩', $text);     $text = str_replace('0', '០', $text);      return $text;     }               add_filter('date', 'KhmerNumDate');     add_filter('the_date', 'KhmerNumDate');     add_filter('the_time', 'KhmerNumDate');      But now it is not working - is my code good? Would the code differ based on which theme I am using (I am currently using a modified child theme of Twenty- Twelve)?


How can I create an affiliate program in WordPress?

Suggestions for plugins, best practices, etc. welcome.


Contact Form on WordPress Sites?

How does one go about building a page in wordpress that contains a contact form full of custom fields, boxes, inputs, etc. completely determined by the author of the site. It seems odd that wordpress currently lacks this feature, but knowing the wordpress community, it's unlikely that we must do without.


WordPress performance issue. Can I debug it?

I have a web site, that while working properly, every day, at 11:00am using a huge amounts of the server resources. The web hosting account contains only the WordPress, and I don't have any other software installed. Also, the hosting account is based on Cloud Linux, that means I can have statistics about my account resource usage. Bellow you can see what is the resource usage of my account:               Your site has been limited within the past 24 hours     CPU resources were limited for your site     You have reached processes number limit 8 times     Your site might hit resource limits soon     Your Physical Memory usage was at 999.7M out of 1000.0M     You had 4000 I/O usage out of 4000 max I/O usage allowed      What I like to ask, is for any script, wordpress plugin or anything else that can help me identify, why I have that issue every day at the same time. Note, already, I have use a plugin to get the WordPress schedule, and the schedule is ok. There is no, any action that run at 11:00 am. Also the server has no any cron job that run at the same time.


Production Website Frozen at /wp-admin/upgrade.php

My client upgraded the production Wordpress site to 3.5.2 without disabling the active plugins. He called when the site froze at upgrade.php. I opened the database and updated the wp-options table to set db_upgraded to 0. I renamed /wp-content/plugins to disable all plugins, enabled WP_ALLOW_REPAIRS and the repair page reported all OK. I closed the browser, reopened it, cleared the cache and went back to /wp-admin. Without even asking for login information, the page redirects to /wp- admin/upgrade.php. The frontend of the site remains functional. I do not know what else to do. PLEASE HELP!


Issue with sidebar widgets not showing when I do custom queries

I'm having issues with this. I have 2 while loops, each getting different custom post types. They both work fine, except, my sidebar content i.e. widgets, is not appearing. I think this is because I am not running the default query. My two queries are:               query_posts('post_type=offered');      while (have_posts()) : the_post(); ?>     ....content     endwhile;      and               $wanted_query = new WP_Query('post_type=wanted');     while ($wanted_query->have_posts()) : $wanted_query->the_post();     ....content     endwhile;      However, when I try to combine them as below, I get the sidebar content but no my posts!               global $query_string;     query_posts( $query_string . '&post_type=offered' );


How to hide plugin options for editors via functions.php

I've read the entry **_Best Collection of Code for your functions.php file_** , it really help me a lot. I only got a question, **is there a way to hide some plugins options (in their respective administrations), just like the way you hide the widgets at the dashboard?**. This because I have to let the editor manage some parts of the plugin, but not all (for example, in a slider, he/she must edit the images to display, but not the dimensions of the slider).


How to properly turn off REVISIONS and AUTOSAVE for whole site and optionally for a custom post type only

Is there a hook/function combination that can be added to my theme's `functions.php` to properly disable REVISIONS and AUTOSAVE for the entire wordpress installation? What about if just for a certain custom post type? Searching online gives various hacks from deregistering scripts to tampering with core files. What's the acceptable/correct way to do this?


WordPress installation does not get completed in WAMP server

I have installed WAMP server on Windows 8 and am trying to install WordPress on it, but while installing it, I could not complete it. It's showing me the error like               http://localhost/wordpress/wp-admin/install.php?step=2      After that, the process stops. I referred to the question _Wordpress Installation not getting completed_ , but it could not help me. How can I fix this problem?


How to get custom image field of specific post id

I have a page where I'm pulling in content from another post, outside of the loop. I've been successfull at getting the content of the specified post, but I cannot get the image from a custom field (advanced custom image field). This is working to get the content from the post who's ID is 299:               $my_id = 299;     $post_id_299 = get_post($my_id);          $content_299 = $post_id_299->post_content;     $content_299 = apply_filters('the_content', $content_299);     $content_299 = str_replace(']]>', ']]>', $content_299);     $content_299_chars = 238;      $modcontent_299 = substr($content_299, 0, $content_299_chars);      `<p><?php echo $modcontent_299; ?></p>` This is what I'm after to get the image from the post who's ID is 299 (if it exists):               $attachment_id = get_field('image', 299);     $size = 'full';     $image = wp_get_attachment_image_src( $attachment_id, $size );           if( get_field('image') ):        echo '<img src="' . $image[0] . '" alt="' . the_title() .'" width="238" height="158" />';     endif;       I'm sure I need to change some of these variables to get the image field from the specific post id, similar to how it's done to get the content, but I'm confused at this point as to how to do that for a custom field...


querying user bookmarks from a large number of bookmarks

I am trying to access the bookmarks created by a single user. The key is stored in the links table, attribute link_owner. However, get_bookmarks() seems to load the entire table and all I am left with is to parse the table and filter the rows with a matching userid. For my application I expect the number of links to be rather large (more than 10,000). Am I to old school to fear that this usage case will slow down things bigtime? What other ways are there to do this a bit more efficiently? WP_Query seems to apply only to posts. Or should I go and use SQL right away?


remove admin bar new post/link/media sub menu

I wish to remove the sub menus of post/link/media under the add new menu in the admin bar. I can remove the entire menu but I actually only want to remove the sub menu's               $wp_admin_bar->remove_menu('my-account-with-avatar');


How to Sort the Favorite Plugins Screen Alphabetically?

When viewing the Favorite Plugins tab, `/wp-admin/plugin- install.php?tab=favorites`, the list comes unordered, is it possible to sort it from A to Z? ![favorite plugins screen](http://i.stack.imgur.com/0DyUr.png)


Do not show a custom post if it belongs to a certain custom taxonomy

I am trying to block the visualization of a custom post, of type 'product', if it is assigned to certain values of the taxonomy 'product_cat'. Strictly speaking, I would like to block the visualization of a product if it falls under certain categories. I can not make this work, even by hardcoding a forbidden name for a product_cat ('plus' in this example).               function filter($query){        if ($query->is_single && is_main_query()) {             $tax_query = array(                 array(                     'taxonomy' => 'product_cat',                     'field' => 'name',                     'terms' => array('plus'),                     'operator' => 'NOT IN',                 )             );             $query->set( 'tax_query', $tax_query );             return;         }     }     add_filter('pre_get_posts','filter');      If I try to visualize a product falling under the 'plus' category, Wordpress shows it despite this filter. What am I missing here? Cheers! Edit: This code goes in a Wordpress plugin, I forgot to mention this. I am not allowed to touch any template..


wordpress page as website

I have a website related to information about local info / businesses in certain city and I would to offer business owners in that city a 'one page website'. Their 1 page website is basically using my wordpress page and the address should look like: mycity.com/website/business-name. Any advice on how to automate this process i.e form to get business name, address, header pictures and description. I'm thinking of something like creating facebook page. This way i dont have to deal with all of the repetitive task to create a standard looking page. Let me know also if there's a theme for this kind of function


Problem with adding a new post type

I want to add a new post type i have a php file (posttype.php) at : wordpress/wp-content/themes/ this is the code :               <?php     // Add new post type for Recipes     add_action('init', 'cooking_recipes_init');     function cooking_recipes_init()      {         $args = array(             'label' => _x('Recipes'),             'singular_label' => _x('Recipe'),             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,              'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','comments')         );          register_post_type('recipes',$args);     }     ?>      i have a problem at the top of the page (but the posttype is created suc) :               Warning: Missing argument 2 for _x(), called in D:\xampp\htdocs\wordpress\wp-content\themes\posttypes.php on line 12 and defined in D:\xampp\htdocs\wordpress\wp-includes\l10n.php on line 189          Warning: Missing argument 2 for _x(), called in D:\xampp\htdocs\wordpress\wp-content\themes\posttypes.php on line 14 and defined in D:\xampp\htdocs\wordpress\wp-includes\l10n.php on line 189      Thank you .


Recent posts script mess up blog posts

I use this script to display recent posts:
     <?php query_posts('showposts=5'); ?>          <?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?>

<?php the_content_limit(250); ?>
     <?php endwhile;?>
      I put this in the header.php. It does the job, but also all other posts and pages gets messed up. When I try to load any ordinary page (page.php) I get only content from two blog posts and similar problems. It is not the issue with the_content_limit. I also tried excerpt - and its the same. Any ideas how to avoid the problem but still have recent posts?


How to add thumbnail images? (Set Featured Image doesn't work)

How do I add thumbnail images to the list of blog posts at http://richardclunan.com/blog/ ? When I'm creating or editing a blog post, if I use the Featured Image link at the bottom right in the admin panel, no thumbnail appears by the corresponding blog post excerpt in the list of blog posts. I'm using theme twentyeleven, with some modifications in a childtheme file. ................................. Edit: Here's what I did, and the thumbnails are still not showing: I added an image to use as a thumbnail, using the Media Library. I added a 'Featured Image' in 'Edit Post', and in Edit Post, an image is showing there, so that looks like it should be working. I added the url of the thumbnail in 'Custom Fields' in Edit Post. But on the blog page, there's no thumbnail showing: http://richardclunan.com/blog/ -- the second post down 'Whodunnit...' is the post I added a thumbnail for. (I don't know if the following is relevant, but I have a childtheme of twentyeleven. If I switch back to the twentyeleven theme, the Blog page disappears from the menu on the site, but I can still navigate to http://richardclunan.com/blog/ and still no thumbnail appears on that post.) I've also tried installing the plugin 'Thumbnail for Excerpts' and thumbnails still don't show


How do you use a CPT as the default home page?

I have a client who's site will be making heavy use of custom post types to configure their site. But I'm between a rock and a hard place for their requested home page. In reality, the home page will be a stack of specific "pages" within WordPress. Basically, there will be pages for: **Intro** , **Blog** , **About Us** , **Portfolio** , and **Contact Us**. They'll all be stacked on top of one another so you can scroll from one page to another. My first instinct was to just use a page (called **Home** ) and embed a shortcode that accepts page slugs and outputs the proper order (i.e. `[pageOrder]intro, blog, about-us, portfolio, contact-us[/pageOrder]`). The page would use a custom page template to lay things out, control the loop, and add navigation to the left side of the page. But that all seems klunky. My _ideal_ solution would be to create a custom post type (called **Stack** ) that allows the end user to position the pages with drag-drop and have the CPT take care of layout and navigation and such. The problem with my ideal solution is settings. WordPress allows you to select a page for the default home page of the site. But it's tied to a post type of **page** , and I'm not sure where to hook in to modify that so that users could also select a **Stack** as the default home page. So, where do I hook in to in order to add a CPT to the dropdown of available pages for the default home page?


Allow users to exclude categories? (WP 3.1.2)

How do I let users exclude/include specific categories, so that everything (archives, search, etc) is limited to those categories? I've seen admin-side plugins that let _me_ limit what others see, but not ones that let users choose what categories to see. Ideally, this would even work for unregistered users.


How to add the same widget twice?

I noticed that if you put the same widget in two different widget slots (primary and secondary for instance) only the first one will appear on the page. The second slot will be empty. How to solve that problem and allow my widget (a custom menu) to appear twice on my page ?


How can I change the frequency of a scheduled event?

I have declared a scheduled event in a plugin like this :               function shedule_email_alerts() {         if ( !wp_next_scheduled( 'send_email_alerts_hook' ) ) {             wp_schedule_event(time(), 'hourly', 'send_email_alerts_hook');         }     }      Then i wanted to change the frequency to 'daily', by doing so, replacing the original function with :               function shedule_email_alerts() {         if ( !wp_next_scheduled( 'send_email_alerts_hook' ) ) {             wp_schedule_event(time(), 'daily', 'send_email_alerts_hook');         }     }      But it seems that my event is still fired every hour. I use the Core control plugin to monitor CRON tasks and it still shows as 'once per hour'


Clear cache when a post is submitted

I have a question. How can I clear the cache when a post is submitted ? Actually, I need to clear two speficied pages which display these articles ? By default, I have noticed the `index.php` is cleared automatically when a post is submitted. But not `Archive page` or `Category page`... Thanks in advance. EDIT : By the way, how to clear only a specific page with W3 Total Cache ? Example : Clear `/blog.php`


Flipping Book PHP Code? Any experience?

Hi there guys quick question, using FlippingBook and calling a gallery within a page or post is with something like this: `[book id='1' /]` but I want to call the gallery directly from my code, so is there any php code to achieve this? Thanks guys! Arturo http://wordpress.org/plugins/page-flip-image-gallery/


How to remove custom background?

I'm using WordPress 3.5.1 and twentyten. I want to remove the support for custom background. I found this text: http://codex.wordpress.org/Function_Reference/remove_custom_background but i'm a newbie in php, so I dont know what to do whit the information. I guess I should use this code `<?php remove_custom_background() ?>` but what to do with it? where should I put it? Thanks! /Frida


Wordpress Options Page not working

So, I need to add a custom options page, and based on as many tutorials I could find, I came up with the following code to create an officers & chairs options page for my group, mainly, so I can write more advanced stuff for my site. The code is here:               add_action('admin_menu', 'composit_settings_page');          function composit_settings_page()     {         add_options_page('Officers & Chairs', 'Officers & Chairs', 'manage_options', 'officers_chairs', 'composit_settings');     }          function composit_settings()     {         $actives = get_users('role=contributor');         $actives = array_merge($actives, get_users('role=editor'));         $actives = array_merge($actives, get_users('role=administrator'));               $positions = array(         "prytanis",         "epiprytanis",         "hypophetes",         "hegemon",         "grammateus",         "histor",         "pylortes",         "crysopholos"     );          ?>

Officers & Chairs
                  <form method="post" action="options.php">                 <?php settings_fields('officers-chairs'); ?>                 <?php foreach($positions as $position):                         register_setting('officers-chairs', $position, 'intval');                       endforeach; ?>

                         <?php foreach($positions as $position): ?>
                                                                      <label for="<?= $position ?>"><?= ucwords($position) ?>                                 	                                              <select name="<?= $position ?>" id="<?= $position ?>" class="regular-text">                                         <?php foreach($actives as $active): ?>                                             <option value="<?= $active->ID ?>" <?php if(get_option($position) == $active->ID) { ?> selected <? } ?>><?=$active->first_name . " " . $active->last_name ?></option>                                         <?php endforeach; ?>                                     </select>
                         <?php endforeach; ?>

<input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes">
             </form>
     <?     }      However, when I go to save that, I get the following error:               ERROR: options page not found.      I feel completely dumb for not being able to figure this out, but the official documentation hasn't really helped me at all.


How can I remove the "updates" menu in the Wordpress Admin panel? ![Picture 1.png](http://img546.imageshack.us/img546/5135/picture1pv.png)


moving an admin submenu item to a top-level position

I'm trying to rearrange my admin menu so I can remove the submenus. Basically I'm starting by removing all submenus that I don't want (for instance the ones under the "home" button, or the ones under the "posts" buttons), then I add new entries to the $menu array. my code looks like this (example is for the update entry but I've done so for the categories and link categories too):               function setAdminMenu (){     /* unsetting the home subemnus */     unset($submenu['index.php'];          /* adding the update link at a top-level position */     $menu[3] = array( __('Updates'), 'read', 'update-core.php', '', 'menu-top menu-top-first', 'menu-maj', 'div' );          }      It seems to work well, except that submenus are still acting as ones: when one clicks on the "updates" menu button, the button doesn't stay active but another one (the "tools" button as well as its submenus which I have kept), or when one clicks on the "categories" menu it's the "posts" entry that is shown clicked. It's odd because I think I gave the appropriate classes to the menu item but when I have a look at the source code, I see that it's the "parent" button of the buttons that gets the .current class (which manages the "clicked" appearance). How do I fix the problem? Is it possible? I think that maybe it's the way some of the admin pages work? **EDIT** Hi Wyck and thank you for your answer but actually my problem is not to add or remove some items from the menu and submenu but the way thing goes once it's done. More precisely, i've deleted all submenus, took some elements which were on those submenus and put them in the main menu. for instance I removed the "updates" link from the "dashboard" (index.php) submenu and put it as a top- level menu. And done the same with Links Categories and posts categories. Thing is it's working, I have the menu I want to have (no submenus) but when I click on the elements which were on submenus, instead of having their button act as the ones which have always been on top-level, they act as they were in submenus. To be more clear, I've defined the "clicked" (and hover etc) state of the buttons: they change color. When I click on the "updates" button in my new configuration (or on the "categories" or "link categories"), instead of taking the clicked state, the buttons take no state at all, and instead it's the button they used to be related to when they were in submenus that takes the clicked state, though it goes to the apropriate page. I saw that when you click on a button in the menu, wordpress adds a .current class to it, it works for all elements which are in the original top-level menu, but not for the ones which are normally on submenus and I don't know how to bipass that (maybe with a js?)


loading javascript after jquery is loaded

I want to load some javascript for the front page of my theme after jquery and jquery ui is loaded. what would be the hook to use? I am aware of the functions.php and I have used is_front_page(). By inserting wp_register_script in functions.php, I can queue the script after the libraries I want loaded but I also want to load it only on the frontpage. Using is_front_page() on header.php, the script gets loaded ahead of jquery. How could I load my javascript after loading the jquery and only on the front page?


display post according to the term

I want display all my taxonomy terms on the left side of my website, so that when a user clicks on one of the terms he can see the posts according to it. How can I do this?


How do I add a text field under the activity texarea?

I am working with BuddyPress 1.7. I need to add a text field under under the activity/update text area and capture that data when an update is posted. Any help to help to get me started would be much appreciated. I see the `post-form.php` file that contains the HTML form elements but how can my text box be added using a plugin through a filter?


Displaying taxonomies as category links within sidebar and creating pages for these

I've created a custom post type called 'work' for a portfolio section on the site I am working on at the moment. I have also registered the taxonomy 'workcategories' so that I can assign different pieces of work to different categories like: Artists, Charities, Independents, International, Well Known Which I have created via the WordPress Admin. My problem is that I can't figure out how to display these terms as a list of links within my sidebar under the title 'Categories' and for these terms to link to archive pages displaying the work assigned to each. At the moment I have this code in my index-work.php page to display ALL WORK:               <?php query_posts('post_type=work&posts_per_page=4'); ?>      And I think I need to adapt this for my taxonomy pages. I've created a taxonomy-workcategories.php page for this purpose, but not sure if I actually have to create a separate page for each term listed above? Or can I use the taxonomy-workcategories.php all. Any help much appreciated as I'm a bit lost. It's my first time working with taxonomies and I'm finding it all a bit confusing.


Hook different functions to the same filter conditionally OR Pass additional arguments to existing filter?

Is it possible to hook 3 different functions to the same filter conditionally, like:               <?php     if(a){         add_filter('the_content', 'fnc_1');     }     else if(b){         add_filter('the_content', 'fnc_2');     }     else{         add_filter('the_content', 'fnc_3');     }     ?>      Or if this isn't possible, then can I pass an additional argument to the same function to flag my 3 different conditions? Something like:               <?php     if(a){         add_filter('the_content', 'fnc_1', 'condition_a');     }     else if(b){         add_filter('the_content', 'fnc_1', 'condition_b');     }     else{         add_filter('the_content', 'fnc_1', 'condition_c');     }     ?>      All I could find from my reading is that it has to do something with `apply_filters`, but couldn't get around it. Please can anyone tell me how to achieve this? Thanks!


How to create a clone role in wordpress

How to create new role with same capabilities of existing role. Eg: I would like to create a new role with same capabilities of administrator or editor and so on..


Page navigation within a category

I would like to know why my page navigation within a particular category doesn't work. The code seems correct but I never see the pagination links.               <?php      $my_query = new WP_Query('cat=18&showposts=8');      while ($my_query->have_posts()) : $my_query->the_post();     ?>      <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>            <?php the_content(); ?>
          <?php endwhile; ?>          <?php if (  $wp_query->max_num_pages > 1 ) : ?>
<?php _e( 'Post navigation', 'themename' ); ?>

<?php next_posts_link( __( '← Older posts', 'themename' ) ); ?>

<?php previous_posts_link( __( 'Newer posts →', 'themename' ) ); ?>
           <?php endif; ?>


Custom field/meta populated by dropdown of existing posts?

(My first WP question ever asked! Be gentle!) I'm building a site that is mostly pages (i.e., static), using WP as CMS. At the bottom of several of the pages, there will appear 1, 2, or 3 "promo boxes" -- basically button-images that link to other parts of the site. Though only up to 3 promo boxes will appear on any given page, there will be ~30 different ones to choose from. When my client creates a new page, I'd like him to be able to choose promo boxes from something like a dropdown list of all of the possible promo boxes. Seems to me this should work like this:   * Create a custom post type called "promo-box". (Though it could just as easily be a tag for regular posts.)   * Use a tool like Custom Field Template to create a dropdown on the page editor, where the values of the dropdown options are dynamically generated from the list of all existing promo-box posts. ( **This is the part I don't know how to do.** )   * Access the resulting metadata (post number is really all I need, then I can get everything else) on the page template. Based on responses to other questions here, I have taken initial looks at WPAlchemy MetaBox, Posts-2-Posts, and SLT Custom Fields, but I confess the documentation for each of them is slightly geekier than I am, so I haven't delved too deeply. Advice? Is one of the above tools the right solution for me, and I just have to figure it out? Am I missing something here?


How to schedule future and past posts with metaWeblog.newPost

I am attempting to remotely post articles to a wordpress page and no matter what I attempt to do I cannot publish in the future and the past. I have commented out some past attempts (some found on here).                   $url = $rpcurl."/xmlrpc.php";               /*     Thanks, this is a life saver! If you need to provide tags for your post, you can pass them in array using tags_input property, like this:          $content['tags_input'] = "action, adventure, thriller";     If you need to pass in a specific time stamp, you should use the following format          D, d M Y H:i:s +0000     and pass it using the post_date or post_date_gmt property:          $content['post_date_gmt | post_date'] = date("D, d M Y H:i:s +0000", strtotime($your_specific_date_and_time));          */       error_reporting(E_ALL);     ini_set('display_errors', '1');               include("IXR_Library.inc.php"); // http://www.hurricanesoftwares.com/php_uploads/IXR_Library.txt          //$client->debug = true; //Set it to false in Production Environment I think          //$title="Blog Title5"; // $title variable will insert your blog title  or should     //$body = $content;          $title = htmlentities($title,ENT_NOQUOTES,$encoding);     $keywords = htmlentities($keywords,ENT_NOQUOTES,$encoding);     //$date = new IXR_Date( strtotime( '2015-12-25 09-20-58' ) );               //$pubdate = strtotime( '2015-04-08 13:46:43' );      //$pubdate = new IXR_Date( $pubdate );     $postdate = date('Y-m-d H:i:s', strtotime('2010-02-23 18:57:33'));     $test = new IXR_Date(time($postdate));          $content = array(         'title'=>$title,         'description'=>$body,         'post_status'=>'future',         'post_date' => $test,         'mt_allow_comments'=>0,  // 1 to allow comments         'mt_allow_pings'=>0,  // 1 to allow trackbacks         'post_type'=>'post',         'mt_keywords'=>$keywords2,         'categories'=>array($category),         //'custom_fields' =>  array($customfields)               );          // Create the client object     $client = new IXR_Client($url);               $params = array(0,$username,$password,$content,false); // Last parameter is 'true' which means post immideately, to save as draft set it as 'false'          // Run a query for PHP     if (!$client->query('metaWeblog.newPost', $params)) {     die('Something went wrong - '.$client->getErrorCode().' : '.$client->getErrorMessage());     }     else     echo "Article Posted Successfully";                    ?>     <?php     };                    //global $post;     $my_post = array(         'title'=>$title,         'description'=>$body,         'post_status'=> 'publish',         'mt_allow_comments'=>0,  // 1 to allow comments         'mt_allow_pings'=>0,  // 1 to allow trackbacks         'post_type'=>'post',         'mt_keywords'=>$keywords2,         'categories'=>array($category),     );                    /*               array();     $my_post['title']="title";     $my_post['description']="content";     //$my_post['ID'] = $ID;     $my_post['post_status'] =  'publish';     //$my_post['post_date'] =  '2015-12-25 09-20-58';      //$my_post['description'] = 'this is a test';     //$my_post['title'] = 'test 73';     //$my_post['excerpt'] = '64 ways';     //wp_update_post( $my_post );               */                   /*     if(!$client->query('metaWeblog.newPost', $spam)){         die('somethign went wrong -'.$client->getErrorCode().' : '.$client->getErrorMessage());         }         else             echo "Article Posted Successfully WOOT!";     */


How is this sliding/scrolling navigation made?

Does anyone know how the navigation on this site was made?   http://www.thinkingforaliving.org


Front end empty (i.e. nothing displays); Back end looks fine; What are possible causes?

My customer's site was working last night. Today nothing displays from the front end. Firebug gives as the contents of the home page. I logged in. The back end looks fine. The most recent post (added yesterday some time) is there. I looked (briefly) at index.php, wp-blogheader.php, wp-config.php. They all look right at first glance. No obvious problem like the file being deleted or contents munged or the like. I looked at the database with phpmyadmin. The obvious options (home, etc.) look ok. The numbers of pages and posts etc. look OK. Which is consistent with the back end looking right. Running WP 2.9.2 and Semio Reloaded 0.9.2, Version Checker 2.1.5 active. All plugins updated according to version checker. Does anybody know what might be causing this? Possible clue based on "what did you do recently?"... I deleted an old (2.8.?) WP install from a different directory/folder. The deleted install was in /news2/. The current one is served from /news/. The databases for both installs were in the same MySQL db. The old deleted one had "wp_" as the table prefix. The current one has "asepco_" as the table prefix. Again, a look at the db using phpmyadmin shows that both sets of data are there, and nothing obvious seems amiss. Any "did you look at ..." type suggestions would be welcome. I'm a bit stumped right now. -Denny


How do you customize the admin bar for buddypress?

I would like to update the coding on the wp-admin-bar. Since its positioned absolute, I would like to put a div around it that is relative and or just in a normal div. Or, I see you can hide the bar, does anyone have link structure for the admin bar? Ex:

My Account


Adding Additional Menus In Genesis Child Themes

I have a Genesis child theme that I bought, and it only supports two menus, a primary and a secondary. However, for what I would like to do with my site I need to have 6 menus all together. This is my website http://thenottypicalarmywife.com This is what I want the menus to look like http://livingwellspendingless.com with the menus across the top of the page.


WooCommerce: Translation lost on AJAX call in Checkout page

I'm using **WooCommerce** for a site that I'm currently working on. And I'm creating it for a language other than English. I do the translations by means of the `.po` file. The issue that I'm encountering is in the **Checkout page**. There is a table of **order review** which upon page loaded seems to be refreshed by means of **AJAX call**. Before the **call** the texts are all translated. But after the **call** the texts all reverted back to their original language (ie. English). **How do I retain the translation after the AJAX call?** ![enter image description here](http://i.stack.imgur.com/xLY9I.jpg)


Remove are you sure dialog from editor

I'm trying to stop the "Are you sure" dialog from appearing on a custom post type. I've tried the suggestions over on this question and this one but they are two and three years old respectively so didn't want to reply to them. Any pointers gratefully received as I can't figure it out! Ideally I want to just be able to do it on one certain button, but at the moment just a global block would be good. As it stands I have a button that allows a user to create another entry in another post type. Because it takes you away from the current page, I understand why the dialog pops up, but it isn't required as the entered data is saved. Thanks, Adam


After importing data to new DB with new name, receiving a constant MySQL warning

I've just spent several hours trying to understand why a WP install is really slow, I tracked it down to the database and realised everything in the db was just running super slow with the debug bar (very handy). I tried various things before thinking I should just reload the database into a new db and see what happens. So in wp-config.php I am using a new user name, password and different host address. And just by doing this, now the site is super quick, and everything appears to work, but I get this on every page in debug and have no idea how to resolve it: > WARNING: wp-includes/wp-db.php:1241 - mysql_fetch_object(): supplied > argument is not a valid MySQL result resource


Classes and functions involved in serialization and unserialization

I want to know all the classes and functions(individual .php files) in a wordpress installation that handle serialization and unserialization.


Creating new page/tab in groups section not working!

I'm trying to add a new tab/page in the groups page. This is the code I'm using:               <?php     /*     Plugin Name: Groups Links     Description: Add links to the groups page.     Author: Thomas Clayson     */     function add_groups_links_page(){         global $bp;              $groups_link = $bp->root_domain . '/' . $bp->groups->slug . '/' . $bp->groups->current_group->slug . '/';              bp_core_new_subnav_item( array(            'name' => 'Links',            'slug' => 'group-links',            'parent_url' => $groups_link,            'parent_slug' => $bp->groups->slug,            'screen_function' => 'group_links_function_to_show_screen',            'position' => 40 ) );     }     add_action( 'wp', 'add_groups_links_page');          function group_links_function_to_show_screen() {              add_action( 'bp_template_title', 'group_links_function_to_show_screen_title' );         add_action( 'bp_template_content', 'group_links_function_to_show_screen_content' );              $templates = array('groups/single/plugins.php','plugin-template.php');         if( strstr( locate_template($templates), 'groups/single/plugins.php' ) ) {             bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'groups/single/plugins' ) );         } else {             bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'plugin-template' ) );         }     }          function group_links_function_to_show_screen_title() {         echo 'Links';     }          function group_links_function_to_show_screen_content() {          echo "Rawr";     }               ?>      Yet when I click on "Links" on the groups page it just takes me back to the homepage! :( I have no idea why this isn't working. Here is a screenshot of the page: ![enter image description here](http://i.stack.imgur.com/za4F5.png) In the picture I've mouse-over'd the link and you can see that it points to the right place... `wordpressdomain/groups/test-group/group-links/` however clicking it takes me to the homepage! :( Any ideas? Thank you.


Why does my subcategory URL give 404 eror?

I'm using WordPress's standard theme **Twenty Fourteen**. Here is my problem Not Working: http://ispeedify.com/internet/paypal/ I've made my "PayPal" a sub category of the parent "Internet". But the above URL doesn't work. Rather, this seems to be **working** : http://ispeedify.com/paypal/ I don't see why this is happening. How do I make sure my subcategory is listed under my parent category URL? And I don't see any reason why WordPress should have such settings. Its counter intuitive. I'm using `/%category%/%postname%/` in my permalink settings. Thank you, Sai


WP HTTP Error: couldn't connect to host for RSS feeds on same domain

I'm having trouble reading RSS feeds created by WP3 on the same domain. When I do a print_r($rss); at the part of my plugin where it does the RSS parsing, I get the following output:               WP_Error Object ( [errors] => Array ( [simplepie-error] => Array ( [0] => WP HTTP Error: couldn't connect to host ) ) [error_data] => Array ( ) )      The RSS feed address being supplied validates and everything, btw. It seems to me the issue has something to do with the webserver being unable to grab its own RSS feeds. This is all very confusing. There's a blog post that seems to identify the issue at: http://www.ajaykumarsingh.com/wordpress/rss-error-wp-http-error-couldnt- resolve-host.html ...Alas, it does not contain any solutions. Any ideas for a workaround would be much appreciated.


Get all categories of custom post even not assigned

I know how to get all categories with `get_categories` and name custom taxonomy name, but wordpress only shows those categories those are assigned to a post. Those which are created, but not assigned, will not show up with any of these methods. So is there any function that shows all categories that created + assigned and not assigned. I am working in a admin panel to show all categories in a drop down list in a custom post type.


Remotely search WordPress sites using xml-rpc

This is the scenario: There are say 3 sites - A, B and C. Sites A and B have several custom posts. Now, from site C, I'd like to make a search for the posts in sites A and B. After reading up through online resources, I realized that xml-rpc can be used to achieve this. I read about adding custom functions, but I didn't understand where exactly the add_filter method is to be put (along with the custom method definition). Can someone guide me along?


Why There Is No "get content by ID" Function

When i need to get content of a post with ID, I'm always using this function :               function getContentByID($id)     {     //http://wordpress.stackexchange.com/questions/9667/get-wordpress-post-content-by-post-id     $content_post = get_post($id);     $content = $content_post->post_content;     $content = apply_filters('the_content', $content);     $content = str_replace(']]>', ']]>', $content);     return $content;     }      Can you tell me, why there isn't any core function for this ? There are functions like get_the_title($id), get_the_category($id) ...


Contact Form 7 submission does not complete

I have a Content Form 7 Version 3.8.1 form which seems to function perfectly in that the validation events all work and when submit is clicked the console shows no error, a 200 response comes back from the post but no success message displays and the ajax-loader continues to display indefinitely. No email is received either. The form can be seen at http://peteshighway.com/public-meeting-comment-form/ Here are the network and console tabs after submission: ![network tab](http://i.stack.imgur.com/6pYp3.png) ![console](http://i.stack.imgur.com/UoMqA.png)


Wordpress posts pagination with rand and meta_value

I have posts that have a meta_key (is_premium) that owns "Yes" or "No" values. I want to show pagination with random post but premium first. It's from several days i'm looking around and read really a lot of posts without success. Here is my code in the page where i have to show posts:               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $gallery_order = get_theme_option(tk_theme_name.'_gallery_gallery_order');     $args=array('post_type' => 'team-members', 'post_status' => 'publish', 'ignore_sticky_posts'=> 1, 'posts_per_page' => 4, 'paged' => $paged,  'orderby' => 'rand meta_value', 'meta_key' => $prefix . 'is_premium');          //The Query     query_posts($args);          //The Loop     if ( have_posts() ) : while ( have_posts() ) : the_post();      I read online to add this filter in functions.php               session_start();          add_filter('posts_orderby', 'edit_posts_orderby');          function edit_posts_orderby($orderby_statement) {         $seed = $_SESSION['seed'];         if (empty($seed)) {             $seed = rand();             $_SESSION['seed'] = $seed;         }              $orderby_statement = 'RAND($seed)';         return $orderby_statement;     }      Now the random and pagination work but i cannot see the premium first and than others but the posts are all random. This is the query belonging to the query_posts:               SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON     (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND wp_posts.post_type = 'team-members' AND     (wp_posts.post_status = 'publish') AND (wp_postmeta.meta_key = 'tk_is_premium' ) GROUP BY     wp_posts.ID ORDER BY RAND(58371773) LIMIT 0, 4       but i expected something like **ORDER BY wp_postmeta.meta_value, RAND(58371773)** I don't know how to go forward, should i use taxonomy or something else? Regards, V.


Headers for Contact Form are wrong

I am using a simple contact form I created myself that consists of just a script (php) and a WordPress shortcode. It works fine except the headers are saying something like foo@somewebhosting.server54 instead of displaying my admin email (or my correct email). Can someone see where my mistake is? Thank you. The two codes are here: Pastebin


Server-side processing of AJAX login

I'm using AJAX to login users on my website to avoid the need for a page refresh when they get their username or password wrong. Everything is done over SSL. My server-side processing:               function ajax_login() {              check_ajax_referer( 'my_nonce', 'secure' );              $response = array();              // get form data         $data = array();         $data['user_login'] = sanitize_user( $_POST['u_login'] );         $data['user_password'] = sanitize_text_field( $_POST['u_password'] );         $data['rememberme'] = false;         $user_login = wp_signon( $data, true );              if ( is_wp_error( $user_login ) ) {             $response['status'] = 'error';         } else {             $response['status'] = 'success';         }              echo json_encode( $response );              die();     }     add_action( 'wp_ajax_nopriv_ajax_login', 'ajax_login' );      As you can see, I'm just verifying the nonce, using `wp_signon()` and then sending a response to my JS script. Everything works fine but my question is: is verifying the nonce and using `wp_signon()` enough? Or is there something else important I should be doing when signing in a user?


Is it possible to set up multistore in Woocommerce?

Is it possible to have multistore in WooCommerce? I want to divide my WooCommerce store into 3 distinct stores with the toys showing up in 3 different collection names called:                   remote cars, robots and funny.      Is it possible to setup up 3 different stores or collections using woo commerce? How to do that? need guidance. Is it possible using WordPress WooCommerce plugin or do i need to go for Magento.?


What conditional to use for dynamic sidebar check?

I have looked here on WA and also on the codex but there is no definitive source that I could find. Which is the proper/best way to check to see if a dynamic_sidebar is active and contains a widget? I see these 3 solutions at large but not sure what the proper way is:                1. if(is_active_sidebar('foo')){ //check if the sidebar is active             dynamic_sidebar('foo');      }      2. dynamic_sidebar('foo'); //basically just call it      3. if(dynamic_sidebar('foo')) //also have seen the inverse if(!dynamic_sidebar('foo') check the return of the function      If they are all valid then why not just choose option 2?


attachment.php code or tutorial

I am confused about the exact purpose attachment.php ( and image.php) . I notice many themes dont have them. If single.php displays the image the way I want then is it OK to leave it out. On the other hand could i just make a copy of single.php for attachment.php and leave out the sidebar. The other thing that confuses me is that when I add a gallery to a post I get the option to open images in an attachment page but when I add a single image to a post it only gives me the option to open the image as an image file (outside of the theme - ie without menus etc). I cant understand the point of this. What is the point in having an attachment.php file for images (or an image.php file) if it isn't going to get invoked when someone clicks on an image. Ideally what i need is a good tutorial on attachments but I cant find any and i can find very little info in the codex.


Custom Post Type - Taxonomy Dropdown Menu?

I have created a custom post type and added various meta boxes/fields to this custom post type. All is working excellent except for one element... Instead of utilizing the default interface for selecting a taxonomy I would like to just have a drop down menu for the user to select from. The idea here is to enable the admins to add taxonomy elements which can be managed centrally however for a specific post to only be associated with one taxonomy. Further more, I would prefer to just add this drop down into one of my existing meta boxes. Does anyone happen to have any sample code which would enable me to complete this task?


Custom query, static page pagination and canonical

We have a custom query used in a template file, which is a page builder, with pagination that query latest posts. The problem is with Yoast SEO plugin and it's canonical URLs. When we navigate to any page using the pagination, the canonical always show the front page/homepage URL without the next/prev URLs. The plugin just not recognize that the homepage is being paginated. We tried different pagination approaches and plugins, the result is always the same. So the problem is with the query it self or with the plugin. Here is the query from the template:                 if ( get_query_var('paged') ) $paged = get_query_var('paged');       if ( get_query_var('page') ) $paged = get_query_var('page');            $args = array(         'post_type' => 'post',         'posts_per_page' => 10,         'paged' => $paged       );            $wp_query = new WP_Query( $args );            if ( $wp_query->have_posts() ) :          while ( $wp_query->have_posts() ) : $wp_query->the_post();                  // Post               endwhile;                  // Pagination            else:                  // No Posts            endif;


How can i specify the size of the image rendered by the_content();?

I can do it manually like this:               echo get_the_post_thumbnail($post->ID, 'large');      But how can i set the size of the image rendered by `the_content();` to Large too ?


How to load parent theme style.css?

My WordPress site uses a theme that is a child of a parent theme. As required, both themes have style.css files. However, as far as I can tell WordPress only provides the mechanism to load the child theme style.css file. How do the parent theme styles get loaded? Is it necessary to manually import the parent theme's style.css file into the child style.css file?


Related posts for a post

For a post we need to maintain a list of "related posts" (links to other posts), and this list should be visible to a user. What is the easiest way to do this?


Open Wordpress 'Add New Post' admin page with parameters set via $_GET

I want to launch my web browser from an automation tool I use and open Wordpress "Add Nwe Post" page in the admin area with specific title and content (it varies everytime, I generate it dynamically on my local machine). I know that I can use http://blog.mysite.com/wp-admin/post- new.php?post_title=sometitle This is fine. However, if I try to set the content of the post, using "content" url parameter, it can be only plain text. If I set HTML, it is escaped automatically. Is there a way to set the HTML content of the post? Also, I don't know how I can set page categories via url parameters too? P.S.: I don't want to create programatically a new post, but just to have the Add Post page open with prefilled fields.


Increase search results for Admin -> Appearance -> Menus -> Search (default is 10)

I have over 800 pages in WordPress which becomes a challenge trying to find a specific page to add it to the menu. View all works if you have only a few pages so the best option would be to search for the page to add it to the menu. The problem is that the search result only brings up 10 pages, I need it to return more results (say 30) so I can find the page that I am looking for, the page that I am looking for might be result number 22 but I can't find it because it is not displayed, hope this makes sense. Just a reminder that I want to increase the search results for "Admin -> Appearance -> Menus -> Search" and not "Admin -> Pages -> Search" Any body can help me with what code to add to the functions.php file to increase the search results? Thank you in advance Tony


Change behavior of "Insert into Post" based on attachment metadata

For a custom plugin I'm working on, I have added a checkbox element to the attachments editor in a manner like the answer provided here: How to add a checkbox element to attachments editor with example What I would like to do is, based on the value of that checkbox, alter the behavior of the "Insert into Post" button. Eg., if the checkbox is not checked, "Insert into Post" does the default WordPress action for the file type. If the box is checked, insert my plugin shortcode instead. I've tried the following (based on the answer here):               function my_media_insert($html, $id, $caption, $title, $align, $url, $size, $alt) {         $orig_html = $html;              $attachment = get_post($id);         $my_meta = get_post_meta($post->ID, '_myMeta', true); // try to get checkbox value              $mime_type = $attachment->post_mime_type;         if (($mime_type == "application/pdf") && ($my_meta == "1")) {             $src = wp_get_attachment_url( $id );             $html = '[shortcode url="'.$src.'"]';           } else {             $html = $orig_html;         }         return $html;     }     add_filter('media_send_to_editor', 'my_media_insert', 20, 3);      ...but get_post_meta() never seems to return any value to work with. (If I change the value of $html to $my_meta for testing purposes, the insertion is "blank".) The short version: Is there a way for me to set metadata on an attachment with a checkbox, and alter the value of $html sent to the editor in response? UPDATE: I found an example that accomplishes basically what I want to do (changes the behavior of the button) but I would like to adapt this to add a checkbox on the attachment metadata that would do this versus doing this for every file all the time. That way the behavior can be overridden when needed and I can apply it only to specific file types. http://justingable.com/2008/10/03/modifying-wordpress-default-method-for- inserting-media/


Why are <a> Tags "Slipping" in TinyMCE / Page Builder editor?

I'm trying to figure out why this might possibly be happening: Basically I have a section of code with an tag, like so:               Word here      After entering that into the TinyMCE editor (I'm using the Page Builder plugin by SiteOrigin as well, so I'm using the BlackStudio Tiny MCE editor) and updating the page, then opening that section to make further edits, I'm getting this:               Word here.      So in essence the tag has "slipped", with the word / element that it should be wrapping getting bumped outside of it. Any guesses as to why this might be? I've tried disabling / re-enabling plugins but nothing doing so far.


Adding Theme File for Non-Wordpress Content

I have a third party events plugin that uses custom tables in the database. I have created a theme file (event.php) that pulls the data in based on a slug that is ideally given in the URL. I want to create a custom URL rewrite rule for this template, so a URL like this: /event/my-slug Will call the event.php file, grabbing the specific event they have requested (the slug). The class I am including in the functions.php to accomplish this is:               <?php      $EventpageCode = new Eventpage();     register_activation_hook( __file__, array($EventpageCode, 'activate') );          add_filter('rewrite_rules_array', array($EventpageCode, 'create_rewrite_rules'));     add_filter('query_vars',array($EventpageCode, 'add_query_vars'));          add_filter('admin_init', array($EventpageCode, 'flush_rewrite_rules'));     add_action('template_include', array($EventpageCode, 'template_redirect_intercept'));          class Eventpage {              function activate() {             global $wp_rewrite;             $this->flush_rewrite_rules();         }              function create_rewrite_rules($rules) {             global $wp_rewrite;             $newRule = array('event/(.+)' => 'index.php?pagename=event&eventid='.$wp_rewrite->preg_index(1));             $newRules = $newRule + $rules;             return $newRules;         }              function add_query_vars($qvars) {             $qvars[] = 'eventid';             return $qvars;         }              function flush_rewrite_rules() {             global $wp_rewrite;             $wp_rewrite->flush_rules();         }              function template_redirect_intercept($template) {             global $wp_query;             if ($wp_query->get('eventid')) {                 $template = locate_template( array( 'event.php' ) );             }             return $template;         }              function pushoutput($message) {             $this->output($message);         }              function output( $output ) {             header( 'Cache-Control: no-cache, must-revalidate' );             header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' );                  echo json_encode( $output );         }     }     ?>      This works great for displaying the content, except that the page throws a 404 error (but still displays the content). Any suggestions on how to avoid having the 404 error returned?


is_dynamic_sidebar always returns true while using Jetpack visibility

If I have any widgets in the sidebar, even if the jetpack visibility is set to not show on that page, is_dynamic_sidebar return true. Here's the code in my theme functions file:               add_action( 'init', 'iartz_add_sidebar_class' );          function iartz_add_sidebar_class() {         add_filter('body_class','check_has_sidebar');         function check_has_sidebar($classes) {             if ( is_dynamic_sidebar() ) {                 $classes[] = 'has-sidebar';             } else {                 $classes[] = 'no-sidebar';             }             return $classes;         }     }      (I tried using several different hooks thinking that the sidebar would have to unregister or something, but it doesn't seem to matter) Is there a different way to check for sidebars that would take jetpack visibility into account, or another plugin that would have the same functionality, but also work with is_dynamic_sidebar?


More than one WordPress site using the same database - how to disable plugin for one site?

I am going to have two WordPress websites running off the same database, so that they both have the same products set (each post is a product) but they have different homepages, about us pages, etc. thanks to the themes of each site. (Note: NOT using MU). But there is once concern: `<title>` and `<meta>` tags on the site. I want the mini-site to have completely separate tags, as it has a different identity. So I will use custom fields in the posts to set the tags for each domain but herein lies the problem: I already have an SEO plugin installed and loads of custom tags, so how do I disable that plugin for the new site _only_? I assume that if I just omit the files for that plugin on one of the installs then WordPress will detect that it is not there, and disable it in the DB, so it will disable for both sites. Does anyone know the answer?


Staging setup for multisite installation

I'd like to setup a staging instance of my multisite network and I'm not sure how best to do it. I'm will be using version control to deploy to staging and production environments and I'd like the staging to be a full mirror of the production multisite network. How feasible is it to set this up on a subdomain ? staging.mydomain.com Has anyone done this before ? Any advice is appreciated. Cheers


How do i get a specific user metadata using custom metavalue outside of wordpress?

I need help. I need to get a user ID or email (email is can do but ID is better) based on their phone number, outside of WordPress. I already have their phone number in a variable and billing_phone is custom metadata in the wp_users table. This is what I am using to load wp               `$parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] ); require_once( $parse_uri[0] . 'wp-load.php' );`          and how I am fetching the email.                   `$email = $wpdb->get_var("SELECT user_email FROM wp_users WHERE billing_phone = $phone_number ");`      Thank you all in advance. Any help is appreciated.


Links to my uploads went crazy

First things firs.... up until now (before I experimented with some plugins - many) my blog was behaving properly.... 1. I write the post 2. Import the media from my computer 3. Insert the media into my post 4. When I click on media link ... it fires up the pdf file (for example) Now when I do everything same from 1 to 3 and when I try to open up the pdf file, my blog leads me from post url (/?p=1491 in the url) first to attachemtn URL (/?attachment_id=1927) which is WRONG. On that page there is a link to the pdf file. How can I bypas this extra step and go directly to pdf? |help|please|


Loading internal page

How can I load another page in wordpress? For example, I created a post called "Services" and want it to be associated with a page-services page. My index is thus:               <?php     if (have_posts()) : while (have_posts()) : the_post();             ?>             <?php get_template_part('content', get_post_format()); ?>             <?php             break;         endwhile;     else:         ?>         Nenhum post encontrado     <?php endif; ?>          <?php get_footer(); ?>


Upload an image at frontend > Create direction and/or rename filename possible?

I have a form for a non-profit-club, that publish posts + up to 20 images. The image-path will be writen in a custom-field. Images are uploaded. Ok, now i want to rename the pictures or (much better) create a folder. But there is a special: the form uploads 2 styles of images. There are up to 15 images for a wanted person (g) and up to 5 images for the person, who is missing this person (s). So i have to seperate the images at the server. The images are given from several input-fields. I named the input-fields for "g" like:               <input type="file" name="image_1_gesucht" id="image_1_gesucht">     <input type="file" name="image_2_gesucht" id="image_2_gesucht">     ...     <input type="file" name="image_15_gesucht" id="image_15_gesucht">      The field for "s" named like:               <input type="file" name="image_1_suchend" id="image_1_suchend">     <input type="file" name="image_2_suchend" id="image_2_suchend">     ...     <input type="file" name="image_5_suchend" id="image_5_suchend">      If i can rename the pictures: I could do that with a prefix like g- or s- and a unique number. For the unique number i can use the post-id. If i create a folder: Then i need a folder named like the post-id. If i can rename the pictures with the prefix, this one folder with the the post-id is ok. If i can't rename the pictures, i need 2 more subfolders - one for "g" and one for "s". My existing script looks like the following example. I post this, that u can imagine the existing work. Can anybody tell me how to rename the pictures or to create folders? Sorry, i'm silly enough, that i don't can realise/understand, what the wordpress-codex want to tell me. There are two a little bit simiolar articles at stackexchange too ( Rename image uploads with width in filename and Issues renaming images during upload ), but also here: sorry, can't realise/understand. I relly hope, anybody can help me               if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_post") {         $file=$_FILES;         // Funktion zum Image-Upload, falls sie noch nicht existiert         if ( ! function_exists( 'wp_handle_upload' )) {              require_once(ABSPATH . "wp-admin" . '/includes/image.php');             require_once(ABSPATH . "wp-admin" . '/includes/file.php');             require_once(ABSPATH . "wp-admin" . '/includes/media.php');         }              // Variablen für die Bilder         $overrides = array( 'test_form' => false);         $image_1_gesucht = wp_handle_upload( $file['image_1_gesucht'], $overrides );         $image_2_gesucht = wp_handle_upload( $file['image_2_gesucht'], $overrides );              // Benutzerdefinierfte Felder für die Bilder         add_post_meta($pid,'image_1_gesucht',$image_1_gesucht['url']);         add_post_meta($pid,'image_2_gesucht',$image_2_gesucht['url']);     }          <form id="new_post" name="new_post" method="post" action="" enctype="multipart/form-data">
             <fieldset class="images">                 Bild 1:                 <input type="file" name="image_1_gesucht" id="image_1_gesucht">             </fieldset>

             <fieldset class="images">                 Bild 2:                 <input type="file" name="image_2_gesucht" id="image_2_gesucht">             </fieldset>
     </form>