How to Include Custom Post Content From Plugin

I am currently working on a plugin that creates a custom post type. The post type has various meta fields which are used to display the content. I am struggling trying to determine how to display the meta fields inside the existing theme on the site. I know HOW to display meta fields and that's not the issue so much. Right now when you go to the post created by the custom post type it just displays the Title, but not the meta fields. How do I append my fields from within the plugin? This needs to work across all themes so I can't just create a template and then force it upon the user. This is what I currently have, but it displays the output before the content and not in the content area:               /* Filter the single_template with our custom function*/     add_filter('single_template', 'om_gallery_template');          function om_gallery_template($single) {         global $wp_query, $post;              /* Checks for single template by post type */         if ($post->post_type == "searchable-media"){            // if(file_exists(plugin_dir_path(__FILE__). '/single-searchable-media.php'))            //     return plugin_dir_path(__FILE__) . '/single-searchable-media.php';             $metas = get_post_custom($post->ID);             $media_description = isset( $metas['media_description'] ) ?  $metas['media_description'][0]  : '';             $content = get_the_content() . " $media_description. " ;             echo apply_filters('the_content',$content);         }         //return $single;      I also tried setting the apply filter line to `$single` and returning but then I get an error: > Warning: include( > > Tanner had a screaming monkey toy that would shriek when you banged it. He > was very good at mimicking it.. > > ): failed to open stream: No such file or directory in > /home/myplugin/public_html/wp-includes/template-loader.php on line 74


Create dropdown of users in admin dashboard

I'm trying to make a list of users come up in a widget in the admin dashboard. So far i've got it showing up, but I want the list to show a custom field from the user's profile instead of the normal display_name or ID. My code so far:                   function wps_userlist_dw() {          wp_dropdown_users(array('name' => 'author',              'exclude'                 => '1',              'name'                    => 'author',              'selected'                 => $user_id,              'show'                    => 'ID'         ));          }     function add_wps_userlist_dw() {            wp_add_dashboard_widget( 'wps_userlist_dw', __( 'Select a User Below' ), 'wps_userlist_dw' );     }     add_action('wp_dashboard_setup', 'add_wps_userlist_dw' );      So instead of ID, i need a custom field (made via Cimy Extra User Fields - http://wordpress.org/plugins/cimy-user-extra-fields/). Lets say the custom field's name that i want to show is 'COMPANYNAME'. Any thoughts? If i put in 'COMPANYNAME' in the 'show' value, the whole function doesn't show up. Thanks!!


Endless Redirects Suddenly Disable Site

Quite suddenly our company site began throwing a 301 redirect error. I've disabled our most recent plugin additions (old additions) and have looked for any kind of recent code adjustments in the theme that might have contributed to the problem. Nothing obvious. As a quick fix, I installed Mark Jaquith's Permalink Fix & Disable Canonical Redirects Pack. This has fixed the redirect problem but, whether because of or independent of the plugin, now all internal links fail. I've checked the root level .htaccess file to see if any changes have been made. It's just your standard rewrite rule set for a subfolder installation.               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /new/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /new/index.php [L]     # END WordPress      Is there any other place I ought to be looking for smoking guns? Anyway to scan files for redirect problems? Thanks for your help!


Use Media Library to manage galleries like Nextgen (with folders, albums, collections, tags, categories, terms...)

I'd wish to use WP 3.x standard Media Librery rather than relying on 3rd party plugins like NextGen no matter how well they're written. I just don't like duplicating functionalities. Media Librery actually can handle well images, provides thumbnails, captions... But I think lacks of organizing images in collections, folders, categories, terms. Is there a way to tweak/extend wordpress to add certain images in the media gallery to collections, categorize them and assign custom terms to each image? In this way, from the frontend, one would be able to generate page with galleries pertaining similar subjects or displaying images belonging to the same category/term... Any ideas? Everytime I google something related to gallery / image / media management for Wordpress I end up with pages suggesting to use Nextgen... but I don't see why it should be almost mandatory to use to achieve these goals.


How to get all custom fields with some prefix in key?

I have near 100 custom fields for each post with prefix "wps_" (examle, wps_imagine, wps_video, etc) and near 20 custom fields without prefix. Problem that I don't know names of custom fields with prefix, because they set by user in admin panel and can be different, user can delete some of them, create, rename, but they always have prefix "wps_". So, I need a function to get all custom fields for one post but only with key prefix "wps_" How to get all of these custom fields with prefix "wps_" and show them in post?


Directing to functions.php the correct way

Right now I'm validating a form on one page, and then sending the results to functions.php to send the form via email. Right now I'm doing the following `<?php $our_url = get_template_directory_uri();?>` ... and then calling on it later in ajax using `$.post('<?php echo $our_url . '/functions.php'; ?>', $("#myform").serialize(), function(data) {`, which works. Kind of. When I submit the form I get the error Fatal error: Call to undefined function add_action() in functions.php. What is the correct code that I should be using to call functions.php?


GET problem in WordPress

I have a strange problem. Any form using GET redirects back to the page not sending the variables. POST does work. I thought it might be an issue with the .htaccess but I deleted it and had WordPress recreate it. No success. I have turned off all plugins. No success.


Having trouble with the_post_thumbnail to display thumbnail with custom size

I have code that looks like this:               $post_thumbnail = the_post_thumbnail( array ( $w, $h ) );      I want to know what I'm doing wrong. When I pass in values for width and height, Wordpress returns an image with the correct hight but with the incorrect width. Is it possible for me to get the exact image specified?


Best Shopping Cart for WordPress

What is the most complete WordPress shopping cart at the moment? GetShopped / Cart66 / Tribulant Shopping Cart ? Or something else?


How to remove unused avatar uploads in buddypress

Im seeing in my wp-content/uploads/avatars folder that there are tons of avatars from when I created test users, but changed the avatars. So, i’m assuming that even if the user changes their avatar, the old file remains? That seems like a build up of unnecessary img files. Is there a way to discard the unused avatars, and only keep the users current full and thumb width image? Other than manually deleting them. It would be very troublesome trying to decipher which is being used in an live environment Ive googled doing a cron job, but I'm not too familiar with the way it works. Any ideas?


Get the prev / next page links only (not title, <a> etc)

I currently use the following method to get a prev / next blog page link:               <?php previous_post_link( '%link', '%title' ); ?>      However this includes the outer element, name etc, I want just the link e.g. `http://domain.com/blog/page/2` Is there a function that I'm not seeing to suit my requirements? **Clarification**   * This is for the next blog page (not blog post)   * I only want the link, not the anchor element Many thanks


Issue with saving custom post type when editor is removed

This one is doing my head in! I'm using this code as the basis for one of my custom post types. https://github.com/tammyhart/Reusable-Custom-WordPress-Meta- Boxes/blob/master/functions/real-estate.php In my case I don't need the editor - I just want the user to complete the contents within the meta box. When I adjust this line:               'supports' => array( 'title', 'editor', 'thumbnail' ),      to this instead               'supports' => array( 'title', 'thumbnail' ),      Everything works - except that for the fact that if I leave the page open and unedited for a short period of time I get the alert box prompting me that unsaved changes will not be saved. There are no changes being made to the post! Simply adding back in the 'editor' support fixes the issue but I don't want the editor. I've also tried adding                   remove_post_type_support( 'mycustompost_type', 'editor' );      Just after the register_post_type call but the same issue persists. I've read multiple threads about AUTOSAVE etc. which are all present in the generic functions file that comes with this code https://github.com/tammyhart/Reusable-Custom-WordPress-Meta- Boxes/blob/master/functions/meta_box.php Has anyone any experience with this issue and how to resolve?


Add custom taxonomy fields when creating a new taxonomy

I've been able to leverage this super tutorial by @Bainternet in order to add custom fields for taxonomies. I've tweaked the markup, and added a separate callback to add fields to the "Add New Category" admin page. My code is at the end of this question. I've run into a gotcha though; the the custom field input is showing up on the add new category page, but the field is not saved. I have noticed that the add new taxonomy page uses ajax, and that could be part of the problem. I tried disabling JS, and still run into the same issue. I've been digging around the core looking for a hook, but can't find one. There are various tutorials on the net, but they all seem to rely on the taxonomy edit screen to do their bidding. Any ideas on how to make this work?               /**      * Add extra fields to custom taxonomy edit and add form callback functions      */     // Edit taxonomy page     function extra_edit_tax_fields($tag) {         // Check for existing taxonomy meta for term ID.         $t_id = $tag->term_id;         $term_meta = get_option( "taxonomy_$t_id" ); ?>
         <?php _e( 'Category Navigation Image URL' ); ?>	                              <input type="text" name="term_meta[img]" id="term_meta[img]" value="<?php echo esc_attr( $term_meta['img'] ) ? esc_attr( $term_meta['img'] ) : ''; ?>">
<?php _e( 'Enter the full URL to the navigation image used for this category.' ); ?>

     <?php     }     add_action( 'category_edit_form_fields', 'extra_edit_tax_fields', 10, 2 );          // Add taxonomy page     function extra_add_tax_fields( $tag ) {         // Check for existing taxonomy meta for term ID.         $t_id = $tag->term_id;         $term_meta = get_option( "taxonomy_$t_id" ); ?>
             <?php _e( 'Category Navigation Image URL' ); ?>             <input type="text" name="term_meta[img]" id="term_meta[img]" value="<?php echo esc_attr( $term_meta['img'] ) ? esc_attr( $term_meta['img'] ) : ''; ?>">
<?php _e( 'Enter the full URL to the navigation image used for this category.' ); ?>

     <?php     }     add_action( 'category_add_form_fields', 'extra_add_tax_fields', 10, 2 );          // Save extra taxonomy fields callback function.     function save_extra_taxonomy_fields( $term_id ) {         if ( isset( $_POST['term_meta'] ) ) {             $t_id = $term_id;             $term_meta = get_option( "taxonomy_$t_id" );             $cat_keys = array_keys( $_POST['term_meta'] );             foreach ( $cat_keys as $key ) {                 if ( isset ( $_POST['term_meta'][$key] ) ) {                     $term_meta[$key] = $_POST['term_meta'][$key];                 }             }             // Save the option array.             update_option( "taxonomy_$t_id", $term_meta );         }     }        add_action( 'edited_category', 'save_extra_taxonomy_fields', 10, 2 );        //add_action( '...Can't find hook to enable saving custom fields when adding a new term


Display different Images depending on the current day

I need to create a grid layout with images, which change daily. So i could build a pool of images in advance for a whole month and the page shows automatically the appropriate image every day. The image could be named after the date or could be connected to this information on another way. How do i achieve this in wordpress? I'd appreciate your input.


Moving Wordpress and "wp-content" Folder Name issues

I once use Better WP Security to change "/wp-content" folder name to "/media", and now I'm moving my whole site from localhost to a web server. I used WordPress Duplicator plugin. It worked fine. I can enter to Admin panel and the database is right. However, "/media" isn't recognized (no plugins, themes, languages, etc) so I've realized I had to change in my new `wp-config.php` the part where the `WP_CONTENT_URL` and `WP_CONTENT_DIR` is set, but it still isn't recognized! before:               define( 'WP_CONTENT_DIR', 'D:\wamp\www\fdp/media' );     define( 'WP_CONTENT_URL', 'http://localhost/fdp/media' );      now:               define( 'WP_CONTENT_DIR', '/home/b7000173/public_html/fdp/media' );     define( 'WP_CONTENT_URL', 'http://b7000173.ferozo.com/fdp/media' );      My root folder is /public_html (and it's a shared hosting). Wordpress is installed in /fdp folder.


Change page template programmatically inside foreach

i have been trying to attach multiple pages, eash to its page-template using a foreach loop... Manually meaning writing each page code works but inside the foreach loop it wont work. I have several of these foreach loops so i would rather not do it manually and would also like to know / understand the issuse... here is my code   * notice that just adding a custom field with a value works.. (weird)   * what am i doing wrong?  .               $start_number   = 2;     $iim_pages  = array('tools', 'clients', 'users', 'resources', 'data', 'data2', 'settings');          foreach($iim_pages as $page) {              $page_title     =   ucwords(str_replace('-', ' ', $page));         $page_filename      =   'page-'.$page.'.php';              //don't change the code bellow, unless you know what you're doing              $page_check = get_page_by_title($page_title);         $new_page = array(             'post_type'     => 'page',             'menu_order'    => $start_number,                    'post_title'    => $page_title,             'post_content'  => '',             'post_status'   => 'publish',             'post_author'   => 1,         );         if(!isset($page_check->ID)){             $new_page_id = wp_insert_post($new_page);                  // DOESENT WORK WITH ADD_POST_META or UPDATE_POST_META             add_post_meta($new_page_id, '_wp_page_template', $page_filename);                    // THIS WORKS!             add_post_meta($new_page_id, 'testmeta', $page_filename);           }              $start_number++;     }


Modify the post/entry wrapper markup in genesis childtheme

I feel like this should be an easily found answer but so far I havent found anything. So the genesis loop automatically wraps the posts in a div like so:
...
      Well I need to change that markup to add a background image to each post. Im trying to take the featured image and apply it to the div background, so I would need my posts mark
...
      I can do the logic just fine but I dont know what filter to modify the post wrapper. and I cant seem to find it.


How to hook new args into a Custom Menu Widget?

I am trying to add some code before the list items in a sidebar Custom Menu Widget. Maybe I'll add an image, maybe I'll add some text. Not sure yet. But I'm having a hard time trying to figure it out... In nav-menus.php screen, the name of the menu is "aboutus" and the id is: menu=210.               function custom_menu_widget_aboutus( $args ) {     //if( 'aboutus' == $args['menu'] ) {     if( 210 == $args['menu_id'] ) {       $args['before'] = 'DO_SOMETHING_BEFORE_LIST_ITEM';     }        return $args;     }     // wp_nav_menu_{MENUSLUG}_items     add_filter( 'wp_nav_menu_args', 'custom_menu_widget_aboutus' );      I know the hook is working becuse if I remove the IF statement, I'm getting the before args working in "aboutus" menu and in my primary menu and all the other menus I have active (footer, etc). But for some reason I cannot target the sidebar menu "aboutus" or id: "210" specifically by itself. I've included commented code to show what I've tried already.


Smaller thumbnail in the_content

My site is basically a Pinterest style product catalogue with atleast one image per post. I upload large images, thumbnails of which are automatically generated by wordpress BUT the website has been loading really slow because `the_content` tag by default uses the largest thumbnail image that I choose from the "media" tab while creating the post. Is there any way to use the smaller thumbnail but link to the larger thumbnail on click? edited to add: I use the `Pinboard` theme. I appended the following in `functions.php`:               add_theme_support('post-thumbnails');     set_post_thumbnail_size(280, 800);      and this in `loop.php`:               if ( has_post_thumbnail() ) {         the_post_thumbnail();      } else {         echo("-");     }      but it shows the else part on the website, so I assume it isn't finding the image used? Thanks!


unable to upload image locally

I followed this tutorial on setting up a local web development setup without mamp. Now my problem is when I go to upload a image in WordPress I get the following error: > “Screen Shot 2013-01-05 at 10.51.42 PM.png” has failed to upload due to an > error: Unable to create directory wp-content/uploads/2013/01. Is its parent > directory writable by the server? It seems like it might be some sort of permissions error, but I am not sure exactly what to change.


How to get WPtouch working?

I bought WPtouch Pro few days back and finished the designing and developing on localhost. Now I want to upload it on my online live hosting to get a mobile version of my website on a subdomain. I want the mobile version of website on a subdomain like `m.mywebsite.com` for the same content. Do I need to install WordPress separately on a subdomain, install WPtouch Pro there and build a separate version of my website? Should I just copy the WordPress files from my root directory on main domain and paste it to the subfolder (subdomain)? Should I just install the WPtouch Pro on my existing WordPress installation?


wp_customize set_transient except during preview

So I'm using the `$wp_customize` to change many things in a theme, and as a result I'm wanting to set a transient for the generated CSS. I'm trying to find a flow that won't cache temporary results though, which is happening when a user plays around with settings and then hits "Cancel" - those results are still caching! Right now I have a hacky method of setting the transient to live for just 1 second, but I feel there must be a better hook or something to grab onto. Here's my basic flow now:                   add_action( 'customize_register', array( $this, 'customize_register' ) );         add_action( 'wp_head', array( $this, 'display_css_output' ), 99 );         add_action( 'customize_preview_init', array( $this, 'css_cache_reset' ) );      `customize_register` takes care of all the settings.               function display_css_output( $short_life = 0 ) {         $html = get_transient( 'my_custom_styles' );         if ( empty( $html ) ) {             $html = $this->generate_css_output();             set_transient(                  'my_custom_styles',                  $html,                  ( $short_life == 0 ? DAY_IN_SECONDS * 2 : 1 )             );         }         echo $html;     }      This grabs transient if its set or otherwise goes through long process of generating the styles. Here also is my attempt at preventing the transient from persisting, `$short_life` which is included during another call to this function later.               function css_cache_reset() {         delete_transient( 'my_custom_styles' );         $this->display_css_output( $short_life = 1 );     }      There is the delete event and the call to make the transient only last 1 second. Surely there is a better way?


How to get functions.php to talk to options.php

I am using Options Framework to build a list of theme options (using code from the theme, not the plugin). I have a colour picker as an option, and I can set and call this colour okay. I'd like to convert the RGB value to HSV, and I found the code to do that here. I entered this code into my functions.php, in a function called convert_RGA_HSV (on pastebin). It accepts a RGB colour, and returns an array($H, $S, $V). Also in functions.php I have:               function set_HSV () {         $varcolour = of_get_option('custom_colour');         $varhsv = convert_RGA_HSV($varcolour);         add_option( 'hsv', $varhsv, '', 'yes' );     }          add_action( 'after_setup_theme', 'set_HSV' );         of_get_option is the function built into the Options Framework to return a value of an option. I don't know if this set_HSV function is being run, or if it is not working properly, **as no option called hsv is being inserted into theme options**.


What should I learn to develop event management in wordpress?

I have been tasked to built event management & registration page in WP like this page... http://dunamis.co.id/programs ![event list page with filtering and pagination](http://i.stack.imgur.com/hWJYG.png) As seen there, this feature should able to filter event by category, month and year. And when I visit this page, event list automatically changed to nearest event in this month. When I click "register now", it automatically forwarding me to registration page of that event. This page also has validation for field. ![enter image description here](http://i.stack.imgur.com/hdtBj.png) I'm also want administration page to add/edit/delete event and track registrant of event. What should I learn to develop this feature? Thanks.. :)


How to use a custom post type archive as front page?

I'd like to use a custom post type archive as a site's front page, so that                http://the_site.com/      is a custom post type archive displayed according to my `archive-{post- type}.php` file. Ideally I would like to alter the query using `is_front_page()` in my `functions.php` file. I tried the following, with a page called "Home" as my front page:                add_filter('pre_get_posts', 'my_get_posts');      function my_get_posts($query){          global $wp_the_query;          if(is_front_page()&&$wp_the_query===$query){             $query->set('post_type','album');             $query->set('posts_per_page',-1);          }          return $query;      }      but the front page is returning the content of "Home" and seems to be ignoring the custom query. What am I doing wrong? Is there a better way, in general, of going about this?


How to rewrite the output of wordpress nav menu?

I have been trying to figure this out for a while. I need to overwrite the default output of the wordpress nav system. Right now it is like:

Parent Menu Item

Parent Menu Item

Parent Menu Item

Parent Menu Item

Parent Menu Item

Parent Menu Item

Parent Menu Item

Parent Menu Item

Parent Menu Item

Parent Menu Item

Parent Menu Item

Parent Menu Item

      What I am looking to do is this:

Main Level Link

Main Level Link

Main Level Link

Main Level Link

Some title here

Sub level link

Sub level link

Sub level link

Sub level link

Sub level link

Sub level link

Sub level link

Sub level link

Sub level link


Rewrite on custom post type permalink not working?

My theme has a custom post type called 'portfolio'. I want the url to display 'projects' instead. I've change the rewrite on the register_post_type function to 'projects' but it doesn't change the permalinks...               'rewrite' => 'projects'      How can I fix this?


How to apply the 'current_page_item' class to an archive page in `wp_list_pages()`?

So I have the following custom `wp-query` working on my site:               function custom_front_page($wp_query){         if($wp_query->get('page_id')==get_option('page_on_front')){             $wp_query->set('post_type','album');             $wp_query->set('page_id',''); // empty             // fix conditional functions             $wp_query->is_page = false;             $wp_query->is_front_page = true;             $wp_query->is_archive = true;             $wp_query->is_post_type_archive = true;         }     }     add_action('pre_get_posts','custom_front_page');      however, altering the query in this way keeps the page link in my `wp_list_pages()` nav from receiving the `current_page_item` class (it no longer thinks it's a page at all). How can I get around this? PS I know I can make a separate link and apply the class conditionally, but is there a way to alter the function above, or the call to `wp_list_pages()`?


how to fire join query with post_meta

I have print sql query that runs within 'posts_where' filter and its like:               SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'shop_order' AND post_date >= '2013-08-26' AND post_date < '2013-10-28' AND post_date_gmt NOT LIKE '0000%'  ORDER BY wp_posts.post_date DESC       now here I want to add where condition for post_meta value, so how to do that? All data with post data and post_meta_data here:               $metadata=get_post_meta($post->ID,'order_data');     echo "<pre>";print_r($metadata);exit;          Array     (         [0] => Array             (                             [billing_first_name] => tetst                 [billing_last_name] => test                 [billing_company] =>                  [billing_address_1] => 1701,5120 25th St N                 [billing_address_2] =>                  [billing_city] => Irvington                 [billing_postcode] => 07111-4501                 [billing_country] => AF                 [billing_state] => NJ                 [billing_email] => a@a.com                 [billing_phone] => (973) 351-2932                 [shipping_first_name] => tetst                 [shipping_last_name] => test                 [shipping_company] =>                  [shipping_address_1] => 1701,5120 25th St N                 [shipping_address_2] =>                  [shipping_city] => Irvington                 [shipping_postcode] => 07111-4501                 [shipping_country] => AF                 [shipping_state] => NJ                 [shipping_method] =>                  [shipping_service] =>                  [payment_method] => paypal                 [payment_method_title] => PayPal                 [order_subtotal] => 10.00                 [order_discount_subtotal] => 40                 [order_shipping] => 30.00                 [order_discount] => 0.00                 [order_tax] =>                  [order_tax_no_shipping_tax] => 0                 [order_tax_divisor] => 100                 [order_shipping_tax] => 0.00                 [order_total] => 40.00                             [order_tax_total] => 0.00                 [assignto] => 7                 [delivery_day_time] => 2013-09-12 01:30             )          )      without passing key in get_post_meta its look like:               $metadata=get_post_meta($post->ID);     echo "<pre>";print_r($metadata);exit;          [order_data] => Array             (                 [0] => a:38:{s:22:"order_discount_coupons";a:0:{}s:18:"billing_first_name";s:5:"tetst";s:17:"billing_last_name";s:4:"test";s:15:"billing_company";s:0:"";s:17:"billing_address_1";s:19:"1701,5120 25th St N";s:17:"billing_address_2";s:0:"";s:12:"billing_city";s:9:"Irvington";s:16:"billing_postcode";s:10:"07111-4501";s:15:"billing_country";s:2:"AF";s:13:"billing_state";s:2:"NJ";s:13:"billing_email";s:7:"a@a.com";s:13:"billing_phone";s:14:"(973) 351-2932";s:19:"shipping_first_name";s:5:"tetst";s:18:"shipping_last_name";s:4:"test";s:16:"shipping_company";s:0:"";s:18:"shipping_address_1";s:19:"1701,5120 25th St N";s:18:"shipping_address_2";s:0:"";s:13:"shipping_city";s:9:"Irvington";s:17:"shipping_postcode";s:10:"07111-4501";s:16:"shipping_country";s:2:"AF";s:14:"shipping_state";s:2:"NJ";s:15:"shipping_method";s:15:"";s:16:"shipping_service";s:15:"";s:14:"payment_method";s:6:"paypal";s:20:"payment_method_title";s:6:"PayPal";s:14:"order_subtotal";s:5:"10.00";s:23:"order_discount_subtotal";d:40;s:14:"order_shipping";s:5:"30.00";s:14:"order_discount";s:4:"0.00";s:9:"order_tax";s:74:"zero_rate:amount^0,rate^0,compound^,display^Tax,^0";s:25:"order_tax_no_shipping_tax";d:0;s:17:"order_tax_divisor";i:100;s:18:"order_shipping_tax";s:4:"0.00";s:11:"order_total";s:5:"40.00";s:39:"order_total_prices_per_tax_class_ex_tax";a:1:{s:18:"";d:10;}s:15:"order_tax_total";s:4:"0.00";s:8:"assignto";s:1:"7";s:17:"delivery_day_time";s:16:"2013-09-12 01:30";}             )      now here I want to apply where condition with 'delivery_day_time' field, how to do that? **UPDATED** now am getting meta data as:               [order_assign_data] => Array             (                 [0] => 7             )              [order_assign_date] => Array             (                 [0] => 2013-09-28 02:30             )      now how to apply condition?


why is $_REQUESt['redirect_to'] empty?

wp-login.php uses $_REQUEST['redirect_to'] as a way to override redirection for lostpassword link. However, it doesn't seem to work for some reason. Maybe its my server environment, but $_REQUEST['redirect_to'] value is unset even if I explicitly pass it as a GET variable in the URI. Is this a wordpress thing or something possibly with my hosting environment or just me being a newb? I saw another post where user @rarst mentioned WP implements its own logic behavior to enforce REQUEST as a combo of GET and POST. But I don't see the code he's talking about anywhere in wp-login and not in wp-load, either. So I'm guessing that REQUEST on wp-login behaves however the php environment is configured for it to behave. Anyone have some insight on this?


How to force when adding an image to complete title/legend fields?

I have a multi-author web site and i search a way to force my author to complete title and legend fields when they add an image. Can you help me?


Display category posts grouped by taxonomy

I'm working on a project where I use the default posts as "Products", default category as "Application" and a custom taxonomy called "Groups". I want to list "Products" by "Application" (category.php) but group them together into their respective "Groups":   * **Automotive** (Application)      * _Silver_ (Group)        * Product 01       * Product 04       * Product 05     * _Flake_ (Group)        * Product 02       * Product 03       * Product 06 I’ve tried different attempts but with no successful result. Is there an easy way to go about this? Thanks!


How to develop a community feature in the dashboard for multiauthor site

I run a Wordpress site that has more than 300 authors. Is it possible to create some type of community in the backend (dashboard)? Ideally, a space where the authors can discuss with each other in a thread type of system, with admin news and so on. The closest thing I could find was the Admin Microblog but by reading the description, it appears very limited. I am quite surprised that there is not much backend community type of plugins, I would have imagined that the demand for such would be rather high. Anyone knows?


Sort by post word count in admin area

I have a custom post type called `species` which consists of a number of `meta_fields`. Ideally, what I'd like, is a word count for each `species profile` (that's just the term I use for a singular post of type `species`). So, for example, when you click the `Species` menu in the back-end, you can see a list of all the species profiles (paginated, as WordPress does) with information about how many words are in each `species profile` and to be able to sort by that `ASC`/`DESC`. If I was doing this outside of the back-end area I'd probably do the following:   * Retrieve all of the data for the specific `Post_ID`   * `strip_tags` the data (and WP's shortcode tags)   * Put it all in a big string   * Use `$array = explode( " ", $string )` to create a large array   * Get the word count from `sizeof( $array )` Question is, how can I put this into the WordPress admin area for this post type? And how do I make it sortable? Thanks in advance,


get current category ID php

I'm trying to get category ID of the current archive displayed. I tried:               // category (can be a parent category)     $current_cat_ID = get_query_var('cat');     //     print_r ($current_cat_ID);      It doesn't print anything...


Wordpress Menus - How to add inline styles to UL menus

I've just converted my HTML version of a theme over to Wordpress, and I'm currently converting the dropdown menus over. **What WordPress processes:**

Home

About

Contact

Drop-downs

Page one

Page two

Page three

Pages

      On page load, this is what my menu is showing:
      I'd like it to show:
      **What WordPress is currently doing:**   On load the dropdown menu is currently showing. Screenshot: http://d.pr/i/KMxL - I only want it to show when hovered over, but since converting it from my raw HTML/CSS it's just showing up on page load, but when I do hover over and/or hover off it works fine. **My jQuery**               $(function() {         $("ul.dropdown li").hover(function() {         $('ul:first',this).css('visibility', 'visible');         }, function() {             $(this).removeClass("hover");             $('ul:first',this).css('visibility', 'hidden');         });     });      I'm not quite sure how to get WordPress to add 'style="visibility: hidden;"' to this. Does anyone have any idea? **Note:** If I've missed anything I'll add it, sorry. Furthermore, I'm using the WordPress menus. Using: **add_theme_support('menus');**


Social Media Feather icons not displaying for each post

I'm using the following code to display the "Social Media Feather" widget for each post, but icons are only displayed for the first post and not the rest:               $paged = (get_query_var('paged' )) ? get_query_var('paged') : 1;     $args = array(              'post_type' => 'events',             'posts_per_page' => 2,             'paged' => $paged     );                   $loop = new WP_Query( $args );     if ($loop->have_posts()) : while ( $loop->have_posts() ) : $loop->the_post();            $count=0;         ?>         <div class="row event-list  my-events <?php echo $type[0]->name; ?> ">

<?php the_title( ); ?>

                             <img src="<?php echo IMAGES; ?>/share.png" class="img-responsive" alt="" />

                                                  <?php get_sidebar('share'); ?>

             <?php      endwhile; endif;


how to register a second page-template

i'm using blogolife http://wordpress.org/themes/blogolife and like to add another page-tamplate which is identical to the standart page-template but has a different sidebar. also i'd like to add a business- and a contact-template. the theme-folder structure how ever is kind of confusing to me, if someone would be so nice to load the theme and check the structure, and maybe even explain to me, i would be very pleased. also i can only select one template, even if it seems there are several sub- templates in this theme. what am i doing wrong?


using wp_remote_get instead of file_get_contents

have run my theme through the Theme checker plugin and it seems upset about use of 'file_get_contents' to get a json url. I've found posts saying i should use wp_remote_get. I'm currently decoding the url with the following:               $url = 'url' . $var;     $json =   file_get_contents($url,0,null,null);     $output = json_decode($json,true);       The message I get from the Theme Checker is: 'WARNING: file_get_contents was found in the file.php possible file operations.' Is it just saying this because there is a fucntion I could possibly use by wordpress or any other reasons? Also how would I use 'wp_remote_get'. I tried a few variations, mostly replacing file_get_contents with wp_remote_get with no luck,. Doesn't seem to decode the url at all.


wp_set_current_user (remote logging) doesnt work on server

I am figting with one interesting problem. I am logging in user with authorization on remote server. The problem is that it is working fine on a localhost but not on a server. Here is code I am using:               function userSignIn() {     $token = $_GET['key'];     $userOp = getUserFromOP($token);     if ($userOp != null && is_array($userOp)) {         $userobj = new WP_User();         $myuser = $userobj->get_data_by('email', $userOp['Email']);         $myuser = new WP_User($myuser->ID);         if ($myuser->ID == 0) {             $userdata = array(                 'user_email' => $userOp['Email'],                 'user_login' => $userOp['Email'],                 'display_name' => $userOp['Name'],                 'role' => 'contributor'             );             $new_user_id = wp_insert_user($userdata);             update_user_meta($new_user_id, 'zip_code', $userOp['ZIP']);             update_user_meta($new_user_id, 'phone', $userOp['Phone']);             update_user_meta($new_user_id, 'user_field', $userOp['Field']);             update_user_meta($new_user_id, 'user_obor_zamestnavatele', $userOp['OborZamestnavatele']);             update_user_meta($new_user_id, 'user_type', $userOp['UserType']);             $myuser = new WP_User($new_user_id);             wp_set_current_user($myuser->ID);             wp_set_auth_cookie($myuser->ID, true);         } else {             var_dump($myuser);                       //no problem with user             wp_set_current_user($myuser->ID);        //problem is here             wp_set_auth_cookie($myuser->ID, true);   //and here         }         return true;     } else {         return false;     }      } I have no problem with getting and creating user. I have a user in DB and when I dump it I can see it but I am not able to set it with those two functions. dumped object:               object(WP_User)#2048 (7) {      ["data"]=> object(stdClass)         #2047 (10) {              ["ID"]=> string(1) "7"              ["user_login"]=> string(27) "email@email.com"              ["user_pass"]=> string(34) "$P$BXIG9QYI4ij6ZmWm73T8TerQ5V2bGQ1"              ["user_nicename"]=> string(26) "emailemail-com"              ["user_email"]=> string(27) "email@email.com"              ["user_url"]=> string(0) ""              ["user_registered"]=> string(19) "2013-09-03 12:39:47"              ["user_activation_key"]=> string(0) ""              ["user_status"]=> string(1) "0"              ["display_name"]=> string(13) "name surname" }          ["ID"]=> int(7)          ["caps"]=> array(1) {              ["contributor"]=> bool(true) }          ["cap_key"]=> string(24) "wp_nadaceop_capabilities"          ["roles"]=> array(1) {                  [0]=> string(11) "contributor" }          ["allcaps"]=> array(6) {              ["edit_posts"]=> bool(true)              ["read"]=> bool(true)              ["level_1"]=> bool(true)              ["level_0"]=> bool(true)              ["delete_posts"]=> bool(true)              ["contributor"]=> bool(true) }          ["filter"]=> NULL }       Can anybody help me? Thank you really a lot. Michal Majernik.


Deleting a user in multisite

I am trying to delete a user when a payment gateway requests, I have the following code: (Edited code to show full function that communicates with the payment gateway, the echo's give the response to the payment gateway the exit's are because it's used in the payment gateways example code.)               function handle_gateway_return() {         $GWPass = get_option( $this->gateway . "_gateway_gwpass" );              if ($_GET["GWPass"] != $GWPass ) {             header("HTTP/1.0 401 Unauthorized");             echo "
Gateway 1.1

Authentication failed.
";             exit;         }              //==================================================         // Action: user.add         //==================================================              if ($_GET["Action"] == "user.add") {             // Load variables             $ZFirstName     = trim($_GET['FIRSTNAME']);             $ZLastName      = trim($_GET['LASTNAME']);             $ZFullName      = $ZFirstName." ".$ZLastName;             $ZUserName      = trim($_GET['username']);             $ZEmail         = trim($_GET['EMAIL']);             $ZPassword      = trim($_GET['password']);              $ZPassword      = md5($ZPassword); //md5              if ( username_exists( $ZUserName ) ) {             echo "OK|User Added!";             exit;                }              if ( !username_exists( $ZUserName ) ) {             wp_create_user( $ZUserName, $ZPassword, $ZEmail );             echo "OK|User Added!";             exit;             }              }              //==================================================         // Action: user.delete         //==================================================              else if ($_GET["Action"] == "user.delete") {             $ZUserName = trim($_GET['username']);              // Grab user_id         $user = get_user_by('login', $ZUserName);              if (!$user) {             echo 'USER_DOES_NOT_EXIST';             exit;             }              $url = network_site_url('/wp-admin/includes/ms.php');         if ($user) {             include($url);             wpmu_delete_user($user->ID);             echo "OK|User Deleted!";             exit;             }              } else {              echo "UNKNOWN_ACTION|UNKNOWN_ACTION";             exit;         }         } However the user does not get deleted! What am I doing wrong? Thanks in advance for your help! Edit: This is happening within a payment gateway addon file used in wpmudevs membership plugin. In the addon file I have a function that deals with the gateway return and creating the user works fine using wp_create_user and yes there was no need for an include there. I added the include here simply because I saw it mentioned somewhere and thought I would give it a go as without the include did not work either (but I didn't think it was needed).


Styles missing from TinyMCE Advanced 4.0.1 & WP3.9

I recently updated to Wordpress 3.9 and TinyMCE Advanced 4.0.1 It looks like any of the custom styles that used to be in the "styles" dropdown is no longer showing up. Things I've tried: - Deactivating all plugins - Switching to a different theme - Emptying the browser cache completely - I also clicked on the "include editor-style.css", but still nothing. Nothing seems to be working. There must be some catch and I can't be the only one with this issue. Thanks! Troy


Open posts in a sliding panel

I'm new to WordPress/coding and I was wondering if you guys could help me out a little bit. I want the posts pages to open in a horizontal slider panel... here's the perfect example of what I mean: http://www.creativejournal.com/ Does anyone have an idea on how I can achieve this? Kind regards, Lucas


Modify Twenty Fourteen Child Theme Single.php

I need to create a child theme for the default Twenty Fourteen theme. And in this child theme, I need to modify the single.php. This is the default single.php               get_header(); ?>

                 <?php                     // Start the Loop.                     while ( have_posts() ) : the_post();                              /*                          * Include the post format-specific template for the content. If you want to                          * use this in a child theme, then include a file called called content-___.php                          * (where ___ is the post format) and that will be used instead.                          */                         get_template_part( 'content', get_post_format() );                              // Previous/next post navigation.                         twentyfourteen_post_nav();                              // If comments are open or we have at least one comment, load up the comment template.                         if ( comments_open() || get_comments_number() ) {                             comments_template();                         }                     endwhile;                 ?>

          <?php     get_sidebar( 'content' );     get_sidebar();     get_footer();      I now need to do two things: First, Add some sharing buttons in my post. The codes for these buttons are

                Second, Add some variable from Advanced Custom Fields in the post. The codes are like:
<?php the_field('field_name'); ?>
      I don't know where to add these codes. I tried to insert theme between some lines, but that causes the theme to stop working. I need to know, where to add these lines of codes.


Home link is directing to a different blog.

Whenever I view my blog as a user and I click the Home button, it leads me to an old blog of mine. What I'd like it to do is go back to the base of my blog. I'll try to be clearer: I'm on example.wordpress.com/stuff and I click the home button (which is on the same bar as a lot of my categories, at the top). Instead of taking me to example.wordpress.com, it'll go to oldblog.wordpress.com. Can anyone help? Thanks in advance.


Resize the image but not Crop

I have a WooCommerce cart for WordPress and am trying to get the images I upload for the thumbnails to be the aspect ratio i set it (270px × 200px) and not crop. Here is an image showing what i’m trying to achieve. ![enter image description here](http://i.stack.imgur.com/kperG.jpg) I don't want the image to be cropped, I want it to resize at a max height (200px) if it's tall or a max width (270px) if it's wide and center itself both vertically and horizontally into the thumbnail constraints (270px x 200px). I've looked through all of the docs of both WordPress and WooCommerce and can't locate any way of achieving this natively. I’m using wordpress v3.8.1. If this is not possible through WordPress or WooCommerce, do you know of any image resizer plugin that would do this type of cropping?


Nav menu custom walker not working in child theme

I have created a parent theme with a nav menu walker that works fine. I want to create a child theme to show small variations to the client. When I put the same code in the child theme it doesn't work. The code in the header of both my parent and child theme:               $dt_menu_walker = new Dt_Main_Walker_Nav_Menu();          $navmenu_args = array(         'theme_location' => 'header-menu',         'container_class' => 'col-md-12',         'menu_class' => 'menu-clearfix',         'link_before' => '',         'link_after' => '',         'walker' => $dt_menu_walker,         'depth' => 2     );          wp_nav_menu( $navmenu_args );      With the child theme I get this repeated:               Notice: Trying to get property of non-object in S:\hdt.co.uk\public_html\wp-includes\nav-menu-template.php on line 153          Notice: Trying to get property of non-object in S:\hdt.co.uk\public_html\wp-includes\nav-menu-template.php on line 156          Notice: Trying to get property of non-object in S:\hdt.co.uk\public_html\wp-includes\nav-menu-template.php on line 156          Notice: Trying to get property of non-object in S:\hdt.co.uk\public_html\wp-includes\nav-menu-template.php on line 158      then a list of empty bullet points

...      I have checked:   * $dt_menu_walker IS being created correctly   * If I change `'walker' => $dt_menu_walker,` to `'walker' => '',` the menu is displayed   * If I define and use a new custom walker in the child theme, the same thing occurs The offending lines in nav-menu-template.php are:               $item_output = $args->before;     $item_output .= '';     /** This filter is documented in wp-includes/post-template.php */     $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;     $item_output .= '';     $item_output .= $args->after;      If I add a `var_dump($args)` before that I can see that using my parent theme $args is an object, but using my child theme $args is an array. I tried changing the lines to               $item_output = $args['before'];     $item_output .= '';     /** This filter is documented in wp-includes/post-template.php */     $item_output .= $args['link_before'] . apply_filters( 'the_title', $item->title, $item->ID ) . $args['link_after'];     $item_output .= '';     $item_output .= $args['after'];      which got rid of the error but no menu appears. So, any idea why I can't use a custom nav walker in my child theme?


Shortcode / WP_Query in post changes context

We have a shortcode that causes WP_Query to be executed, retrieving an instance of a custom post type. In our single.php this changes the context (after the call to the_content()) from the original post (with the shortcode in it) to that of the custom post retrieved. I spotted this because the comments template wasn't displaying, as the comment_status on the custom post is 'closed' - what we're interested in, however, is that the comment_status on the original post is 'open'. Is this an error in the execution of our shortcode/custom post type, is there a way of doing this that won't mess up what happens in single.php? Thanks, Toby


how to fix a broken visual editor

Our visual editor is displaying raw HTML: ![enter image description here](http://i.stack.imgur.com/qWkN8.png) If I click on Visual or Text, nothing happens at all - the click isn't registering. My profile does not have "disable visual editor" checked. The same thing happens in Chrome, Opera & Firefox. I have disabled all themes and plugins without change. I have uploaded /wp-admin & /wp-includes without change. What other things can I try to restore the visual editor?


How can I manually upgrade translations?

I've recently upgraded a Wordpress site to the latest WP version (3.9). I also upgraded the themes and plug-ins that needed it. Unfortunately, WP's automatic upgrade features are not compatible with the server this site is installed on, so I have to do it manually. What bothers me is that I still have a red "1" on the Dashboard menu, telling me there's an update available. When I consult the details, everything is empty, except for the "Translations" section, at the bottom of the page. How do I upgrade these manually? As I said, I can't just let WP do it automatically because it doesn't work. I've checked the "languages" folder in "wp-content" and made sure it only contains the files from the new WP archive. I don't know where else to look. Thanks in advance.


Ajax Auto Complete Convert All Plural Text To Singular

I am trying to create a wordpress search plugin that if you enter a text or keyword term, it would automatically convert any plural text to singular text e.g. "dogs" will become "dog" I am already able to search with autocomplete but the problem is converting the text. Any help would be appreciate


How to get theme screenshot

I would need to get list of available themes with their screenshot. I tried to use `wp_get_themes` function, but it doesn't seem to be returnig screenshot. What is the way to get screenshot for each available theme?


Grabbing image attachments for Flexslider

I'm trying create a function that will load image attachments of a post into a list for FlexSlider to use. To specify, I want an image slider that is specific to a certain post. There may be many sliders on one page depending on the post type (in this case, the image slider type) I want. I've run into an issue, however. This is in my functions.php file, a variation of Marty Spellerberg's jQuery Slideshow article (I would post a link but I can't post more than 2 links with less than 10 rep):               function flexslider($post_id) {     global $post;          $images = get_children(array('post_parent' => $post_id,         'post_status' => 'inherit',         'post_type' => 'attachment',         'post_mime_type' => 'image',         'order' => 'ASC',         'orderby' => 'menu_order ID'     ));          if ($images) :              foreach ($images as $attachment_id => $image) :                  $img_title = $image->post_title;                  $img_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);             if ($img_alt == '') : $img_alt = $img_title; endif;                  $big_array = image_downsize( $image->ID, 'large' );             $img_url = $big_array[0];                  ?>
<img src="<?php echo $img_url; ?>" alt="<?php echo $img_alt; ?>" title="<?php echo $img_title; ?>" />
              <?php endforeach; ?>          <?php endif;          }      And this is what's calling the function in index.php:

           <?php flexslider('large','$post->ID'); ?>

      The problem is, it's only showing up on the permalink page. I want it to show up wherever the post is shown. An example can be seen here: permalink and homepage.


WordPress on git - need help with configuration

I've got all my WordPress code on version control and automatically updated on the server every time I push something into an external git repo. This means that when I want to add pictures through the wordpress add media function, I can't. I've followed the instructions from here: However, every time I try to upload, I get this message: > “unicorn.jpg” has failed to upload due to an error Unable to create > directory wp-content/uploads/sites/2/2014/05. Is its parent directory > >writable by the server? My site is hosted on EC2 and need images on S3. Any suggestions?


Why is my str_replace not working on short code submitted by front-end?

I've built a front-end post submission form that allows a user to include a shortcode provided by SoundCloud. SoundCloud shortcodes generally look like this:               [soundcloud url="http://api.soundcloud.com/playlists/92355602" params="" width=" 100%" height="450" iframe="true" /]      The user pastes the shortcode into my form and my form receives the short code just fine. Before I save it as post meta on the post, I'm trying to perform a few str_replace functions on it.               if( isset( $_POST['scembed'] ) ) {         $scembed = $_POST['scembed'];         $scembed = str_replace( " 100%", "100%", $scembed );         $scembed = str_replace( "params=\"\"", "params=\"show_artwork=false\"", $scembed );         $scembed = str_replace( "height=\"450\"", "height=\"405\"", $scembed );     }      The first one works because it's just removing the erroneous space in the string. But then the next two, I actually need to include the attribute and its double quotes to accurately target the string to change. It won't work and I'm not sure why. I even tried this:               $pfind = 'params=""';     $preplace = 'params="show_artwork=false"';     $scembed = str_replace( $pfind, $preplace, $scembed );      What am I missing? Any time you include the double quotes for the attributes, the function is ignored :-/ -- For Ravs -------------------               <form name="create_post" method="post" action="" enctype="multipart/form-data">         <input type="text" name="scembed" maxlength="160" />         <input type="submit" value="Submit" name="submit" />     </form>          if( !empty( $_POST ) ) {       if( !empty( $_POST['scembed'] ) ) {           $scsource = $_POST['scembed'];         $searchReplaceArray = array(           ' 100%' => '100%',            'params=""' => 'params="show_artwork=false"',           'height="450"' => 'height="405"',         );         $scembed = str_replace( array_keys( $searchReplaceArray ), array_values( $searchReplaceArray ), $scsource );       }     }          if( $scembed )       add_post_meta( $post_id, 'scembed', $scembed, TRUE );


How to change Header image depending on language

I am using qTranslate on Genesis child theme and would like to be able to change the header image depending on the selected language. Any ideas how can I do that?


problem with ajax contact forms

I have been having trouble with contact forms. They work find in an html site but whenever I try them in WordPress, they fail. I have narrowed down the issue to the url: setting. For example                 $.ajax(         {             type: "POST",             url: "contact.php",             data: str,             success: function (msg)             {      WordPress is unable to find the contact.php file. I found that if I put in the full url to the file, then it works. Do you know how I can fix this without having to do that?


Check for duplicate custom field value before running wp_insert_post

That is, I want to prevent 'guid_review' ACF value being duplicate by checking it before creating the post.               foreach ($items as $itemKey => $item) {                           $myPost = array(                     'post_type' => 'client_review',                     'post_title' =>(string) $item->title, //the object as a string before attempting to manipulate it.                     'post_content' =>(string) $item->description                                      );                           $inserted_post_id = wp_insert_post( (array) $myPost );                                if( $inserted_post_id ){                          add_post_meta( (int) $inserted_post_id,'guid_review',(string)$item->guid);                     add_post_meta($inserted_post_id,'link_review',(string)$item->link);                     add_post_meta($inserted_post_id,'author_review',(string)$item->author);                     add_post_meta($inserted_post_id,'rating_review',(string)$item->children('d3', true)->rating);                     add_post_meta($inserted_post_id,'certified_review',(string)$item->children('d3', true)->certified);                     add_post_meta($inserted_post_id,'pub_date_review',(string)$item->pubDate);                                    }                      }


Ajaxify comments and insert new submit

I tried to ajaxify my comments system on wordpress. But I have some difficulties to understand what is the right way to insert the comment submitted. In fact, I'm asking if there is a way or a function in wordpress to automatically get the structure of one comment of my comments template page. Do I need to recreate the structure of one comment and get one by one the information about the author or can I use the function that is used to display all comments in post. Here my js:               if (typeof jQuery != 'undefined') {              jQuery('document').ready(function($){             var commentform = $('#commentform');             commentform.prepend('

');             var statusdiv = $('#comment-status');                  $(document).on('submit','#commentform', function(){                 var formdata = commentform.serialize();                 statusdiv.html('
Processing...
');                 var formurl = commentform.attr('action');                 $.ajax({                     type: 'POST',                     url: formurl,                     data: formdata,                     error: function(XMLHttpRequest, textStatus, errorThrown){                         statusdiv.html('
You might have left one of the fields blank, or be posting too quickly
');                     },                     success: function(data, textStatus){                         if(data=="success") {                             statusdiv.html('
Thanks for your comment. We appreciate your response.
');                         } else {                             statusdiv.html('
Please wait a while before posting your next comment
');                             commentform.find('textarea[name=comment]').val('');                         }                         if ($('#respond').parents('li.comment').length) {                             $('#respond').parents('li.comment').after(data);                             var respond = $('#respond').clone(true);                             $('#respond').remove();                             $('.comment-list').after(respond);                         } else {                             $('.comment-list').append(data);                         }                     }                 });                 return false;             });              });          }      and my php:               <?php          function ajax_register_script(){         wp_register_script( 'to_ajax_comment', get_template_directory_uri() . '/includes/ajax-comments/ajax-comments.js',array('jquery'));         wp_enqueue_script('to_ajax_comment');     }     add_action('init','ajax_register_script');          function ajaxComment($comment_ID, $comment_status) {         if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){             $comment = get_comment($comment_ID);             wp_notify_postauthor($comment_ID, $comment->comment_type);             echo comment_author($comment_ID);             echo comment_date('',$comment_ID);             echo comment_time('',$comment_ID);             echo comment_author_email( $comment_ID );             echo comment_text($comment_ID);             echo get_avatar( comment_author_email( $comment_ID ));             die($commentContent);         }     }     add_action('comment_post', 'ajaxComment', 20, 2);               ?>      These scripts works but my question is, what is the right way to insert the new comment submitted on ajax success. Does it exists a wordpress function/hook to get all the structure and the content of the comment id or do I need to recreate myself the new comment?


comments_number not displaying

Live site I'm using `<?php comments_number( $zero, $one, $more ); ?>` on `home.php` to display number of comments in the post-meta. Problem is, it's not showing the number despite there being one comment on that post. Any ideas what's causing the problem? Here's post-meta for `index.php`:

<?php the_date(); ?> | <?php the_tags('tags:', ', ', '
'); ?> | <?php comments_number( $zero, $one, $more ); ?> comments
                     <?php comments_template(); ?>


WP_Query is only looping home page, not pages

So I am writing a wordpress loop and I want my loop to call the latest fifteen Pages (Not using any post whats so ever and its not an option) then I am looping through the LI tag and Span tag to populate the thumbnail. If your confused check it out xxlbreakcomp.com My loop works, but its only calling my homepage info.I think I either need to write a second loop or an output but I have done both and neither works.I kinda just need a push in the right direction but I am totally lost.Plus the post__in array isn't working either.

                          <?php                      $query_args = array (                         'orderby' => 'date',                         'order' => 'DESC',                           'post_per_page' => 15,                          'post_type' => 'page',                         'post__in'=> array       (4,7,8,9,15,16,17,18,19,20,21,22,23,24,25)                     );                       $query = new WP_Query($query_args);                      if ( $query->have_posts() ) :                                 while ( $query->have_posts()) : $query->the_post();                              wp_reset_postdata ();                              ?>                           <li data-permalink="<?php the_permalink(); ?>" class="selected">                           <span style= "background: url('<?php bloginfo('template_directory'); ?>/library/images/thumb_pic.png')">                           <?php the_title(); ?>
                         <?php                     endwhile;                 endif;                      ?>                      <?php wp_reset_postdata (); // reset the query ?>


displaying recent comments outside loop without plugin

So I wanted to display the 10 most recent comments from my blog onto my homepage. Can anyone tell me how to do that? preferably without using a plugin if possible... thank you.


Problems Replacing Background Color with Static Background Image in Responsive Design

I'm new here. I've tried the WordPress forums and the actual theme forum for my theme with no luck and I heard that this is a good place to come ask questions. I'm hoping someone out there will take an interest in my dilemma. :) I decided to use a static tiled background image on my self-hosted WordPress blog and have been successful to a point. My sidebars are hidden and "float" out when you click on the icons for the menu sidebar on the left and the regular sidebar on the right. If you click on them (on something other than a mobile device), there's a white gap between the background image and the gray sidebar color. After digging around in the style.css all of yesterday and today, I am exhausted. I would love some insight from some loving soul out there. Here is my site: Dappled Things Here is the part of my style sheet that I think may be relevant:                   /*-----------------------------------------------------------------------------------*/     /*  Off Canvas Layout     /*-----------------------------------------------------------------------------------*/          .content-wrap:before,     .content-wrap:after {         content: " ";         position: absolute;         z-index: -1;         top: 0;         left: -100%;         width: 100%;         height: 100%;     }     .content-wrap:after {         left: 100%;     }     #site-header,     .sidebar-left,     .content-wrap,     .sidebar-right {         width: 100%;         display: block;         position: relative;     }     body.active-sidebar,     .sidebar-left,     .sidebar-right {         background: #f2f2f2;     }     #site-header {         overflow: hidden;         text-align: center;         z-index: 4;         background-image:url('http://dappledthings.me/wp-content/uploads/2013/07/bg4.png');             background-attachment: fixed;     }          /* JavaScript On */     .js .sidebar-left {         height: 0;         overflow: hidden;         margin-left: -100%;         margin-top: 0;         float: left;     }     .js .content-wrap {         position: relative;         margin-left: 0;         left: 0;         right: 0;         float: left;         z-index: 2;     }     .js .sidebar-right {         height: 0;         overflow: hidden;         margin-left: 100%;         margin-top: 0;         z-index: 1;         float: left;     }          /* Active Left Sidebar */     .js body.active-nav {         background: #f2f2f2;     }     .js .active-nav .off-canvas-nav {         position: fixed;         z-index: 2;         width: 100%;         overflow: hidden;         left: 81.25%;         right: auto;         top: 0;         -webkit-transition: left 0.2s ease-out;         -moz-transition: left 0.2s ease-out;         -o-transition: left 0.2s ease-out;         -ms-transition: left 0.2s ease-out;         transition: left 0.2s ease-out;     }     .active-nav .sidebar-left {         position: relative;         margin-left: 0;         width: 81.25%;         margin-top: 0;         height: auto;         float: left;     }     .js .active-nav .content-wrap {         position: fixed;         overflow: hidden;         width: 100%;         left: 81.25%;         right: auto;         top: 50px;         background: #fff         -webkit-transition: left .2s ease-out;         -moz-transition: left .2s ease-out;         -o-transition: left .2s ease-out;         -ms-transition: left .2s ease-out;         transition: left .2s ease-out;     }     .mask-left {         visibility: hidden;         position: fixed;         top: 0;         bottom: 0;         right: 0;         left: 0;         opacity: 0;         z-index: 1002;         -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";         filter: alpha(opacity=0);         -webkit-box-shadow: -4px 0 6px rgba(84, 84, 84, .1);         -moz-box-shadow: -4px 0 6px rgba(84, 84, 84, .1);         box-shadow: -4px 0 6px rgba(84, 84, 84, .1);     }     .active-nav .mask-left {         visibility: visible;         left: 81.25%;         opacity: 0.8;         background: #fff         -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";         filter: alpha(opacity=80);         -webkit-transition: .01s opacity ease 0.2s;         -moz-transition: .01s opacity ease 0.2s;         -o-transition: .01s opacity ease 0.2s;         -ms-transition: .01s opacity ease 0.2s;         transition: .01s opacity ease 0.2s;     }     .active-nav .sidebar-right {         position: absolute;         overflow: hidden;         left: 109.765625%;     }          /* Active Right Sidebar */     .js .active-sidebar .off-canvas-nav {         position: fixed;         z-index: 2;         width: 100%;         overflow: hidden;         right: 81.25%;         left: auto;         top: 0;         -webkit-transition: right 0.2s ease-out;         -moz-transition: right 0.2s ease-out;         -o-transition: right 0.2s ease-out;         -ms-transition: right 0.2s ease-out;         transition: right 0.2s ease-out;     }     .active-sidebar .sidebar-left {         position: absolute;         overflow: hidden;         right: 109.765625%;     }     .js .active-sidebar .content-wrap {         position: fixed;         overflow: hidden;         width: 100%;         right: 81.25%;         left:auto;         top: 50px;         background: #fff         -webkit-transition: .2s right ease-out;         -moz-transition: .2s right ease-out;         -o-transition: .2s right ease-out;         -ms-transition: .2s right ease-out;         transition: .2s right ease-out;     }     .mask-right {         position: fixed;         top: 0;         bottom: 0;         right: 0;         left: 0;         visibility: hidden;         z-index: 1002;         opacity: 0;         -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";         filter: alpha(opacity=0);         -webkit-box-shadow: 4px 0 6px rgba(84, 84, 84, .1);         -moz-box-shadow: 4px 0 6px rgba(84, 84, 84, .1);         box-shadow: 4px 0 6px rgba(84, 84, 84, .1);     }     .active-sidebar .mask-right {         right: 81.25%;         visibility: visible;         opacity: 0.8;         background: none;         -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";         filter: alpha(opacity=80);         -webkit-transition: .01s opacity ease 0.2s;         -moz-transition: .01s opacity ease 0.2s;         -o-transition: .01s opacity ease 0.2s;         -ms-transition: .01s opacity ease 0.2s;         transition: .01s opacity ease 0.2s;     }     .active-sidebar .sidebar-right {         position: relative;         margin-left: 18.75%;         width: 81.25%;         margin-top:0;         height:auto;         float:left;     }          /* Off Canvas Nav Buttons */     .off-canvas-nav  {         width: 100%;         overflow: hidden;         background: #fff         left: 0;         right: 0;     }     .off-canvas-nav .menu-item,     .off-canvas-nav .sidebar-item {         width: 18.75%;         display: block;         float: left;     }     .off-canvas-nav .sidebar-item {         float: right;     }     .off-canvas-nav .menu-button,     .off-canvas-nav .sidebar-button {         display: block;         width:100%;         height:50px;         text-indent: -99999px;     }     .off-canvas-nav .menu-button {         background:#f2f2f2 url(images/menu-btn.png) 50% 0 no-repeat;     }     .off-canvas-nav .sidebar-button {         background:#f2f2f2 url(images/sidebar-btn.png) 50% 0 no-repeat;     }          /* Position Fixed Iframe Bugfix */     .js .active-nav .entry-content iframe,     .js .active-sidebar .entry-content iframe {         display: none;     }     .js .active-nav .entry-content .fluid-width-video-wrapper,     .js .active-sidebar .entry-content .fluid-width-video-wrapper {         background: #fff     }          /* Equal Height Column Fix in Off-Canvas Mode */     .active-nav .column-wrap,     .active-sidebar .column-wrap {         overflow: hidden;         background: #fff     }     .active-nav #content-wrap,     .active-nav .sidebar-left,     .active-sidebar #content-wrap,     .active-sidebar .sidebar-right {         padding-bottom: 99999px !important;         margin-bottom: -99999px !important;     }     .active-nav #content-wrap,     .active-sidebar #content-wrap {         background: #fff     }      Here is a screen capture of what I'm seeing: Screen Capture Any help would be greatly appreciated! Gail


How do I sanitize a javascript text?

I have a textarea that will receive a js snippet(Google Analytics). Is there a way to sanitize that? Since I cannot use functions like wp_filter_nohtml_kse(), what should I use?


How to remove the option data of a theme when that theme is removed?

I developed a theme which stores some options to the database. I want to delete the option data from the database while the user removes the theme. But I don't know there is any action hook for doing this. Or is there any alternative method to achieve this.


Allowing post attachments without allowing to insert in text

Is there a way I can allow the user to attach images as attachments to a post without allowing him to insert them within the text itself? Ideally the Upload Media button remains the same but the image is not inserted within the text. The reason is I don't want users to start creating their own layouts and I want the template to always be consistent. (I know there is a quick hack to just strip out tags in the content pages from the theme itself but that will just confuse my users, so I need a way to just attach images).


custom header navigation has odd spacing

Live site. I'm using a custom header on my blog page which features the same coding as my regular heading for `nav`. The `nav` looks fine on all pages but the blog page- the Blog button shifts left. Any ideas why?


add jquery file if a certain page is included

I was wondering if anyone could help my by explaining if it is possible to enqueue a javascript file only if for example homepage.php is included. what i have tried to do inside homepage.php:               class homepage_js {     static $add_script;          static function init() {         add_action('init', array(__CLASS__, 'register_script'));         add_action('wp_footer', array(__CLASS__, 'print_script'));     }          static function register_script() {         wp_register_script('my-script', plugins_url('my-script.js', __FILE__), array('jquery'), '1.0', true);     }          static function print_script() {         if ( ! self::$add_script )             return;              wp_print_scripts('my-script');     }     }          homepage_js::init();      Anyone has a solution?


Filter for users on custom post type

We have "Reviewer Register page" on front-end form. There is a custom post type "Reviewers" to see reviewers lists. When you register as a reviewer, a custom post is created with the reviewer name. This works fine with front-end register form. My problem is when you add "a reviewer" on back-end users page. Add a user and give him/her a role "reviewer" But I don't know how to add a post on a custom post type (Reviewers) My front end form add a post on a custom post type (Reviewers). but Not back- end users menu Is there any filter for handling register or login functions on back-end or anything related login/register? we need to add a function when you add / change a user on back-end user page. This is how we add the user information to custom post type ("reviewer") on FRONT END.                   if($edit) $args["ID"] = $edit->ID;              $user_id = ($edit) ? wp_update_user($args) : wp_insert_user($args);                        if(!$edit && $kko_ut=='reviewer') wp_insert_post(Array(                  "post_title"=> sprintf("%s %s", $fields['first_name'], $fields['last_name'])                  , "post_content" => ""                  , "post_status" => "publish"                  , "post_author" => $user_id                  , "post_type" => "reviewer"              ));      We need that it works when you add users on users page on BACK END as well. Please help. Thanks,


Get the current page in a call back function

I would like to be able to get the URL of the page that I am crawling when the callback function is called. I tried `$_SERVER['HTTP REFERER']` but it gives me the URL of the page that the script is being called from, not the URL of the page being crawled. How can I solve this


Remote plugin activation hook

I am remote activating plugins using `update_option('active_plugins,'some_plugins');` It works fine except one thing: if some plugins have to create some tables using `register_activation_hook(__FILE__,'activate');` it won't create them. When I'm activating plugins normally in `wp-admin/plugins.php` it works fine. Any ideas how to remote execute this activation hook or maybe there is different way to better plugin activation?


Check if add_menu_page exists or not

I'm working on a plugin that I have to release in parts. The problem is, if there is a menu in the page then add the new plugin to the 2nd or next submenu else add a new menu and then add the plugin to 1st submenu. My questions:   1. How to check that there exists a menu?   2. If I'm coding a reusable function , that will go with every plugin then that causes conflict option.    3. I don't know the order of the plugin release.               add_menu_page(         'Page Title',         'Top Menu Title',         'manage_options',         'my_unique_slug',         'my_magic_function'     );     add_submenu_page(         'my_unique_slug',         'page title',         'submenu title',         'manage_options',         'my_submenu_slug',         'my_magic_function_of_submenu'     );


How to dequeue a script?

Wordpress has `wp_enqueue_script()` but not a `wp_dequeue_script()` function, so what would be the best way to dequeue a script? I'm using LAB.js to load all of my scripts rather than enqueueing them server side, so I don't want plugins running around adding jQuery 10 times when I'm already loading it. Would using `wp_deregister_script( 'jquery' )` accomplish the same purpose?


Wordpress multiple pages on one page via button switching

Does anyone know if there is a Wordpress plugin for the following: Let's say we have a page with certain information, for instance details about a product. I could make a link to another page with details about the pricing for that product, but I would like to have this accessible from the first page via a switchable button. I'd like a two part button (tabs?) on the top of the page. Clicking part/tab A would show product details, clicking part/tab B would show the pricing information. I think I have seen this implementation before, but can't find it.


Splitting an eCommerce store from the WordPress Theme

Company I work for has purchased an eCommerce solution for WordPress. The solution works as a complete WordPress Theme. My assignment is to split the store view from the original website design. To be more precise, website we are working on has a unique design, but when we install the store theme, the whole website theme changes to that of a store. Are there ways I can complete this assignment? I thought about it for a while but the solution I found is terrible. I wanted to allow access to a store only on one particular page, by checking               <?php if is_page('shop') {      include TEMPLATEPATH.'storeurl/header.php';      } else {      get_header();      } ?>      and so on, but it gets me nowhere because I need to have certain fields in admin panel for adding products. Any other ideas, please?


WordPress remove <br/> separator from last item in wp_list_categories

I'm trying to remove the last separator (normally a `<br/>` tag but I changed it to "//") from the last link from wp_list_categories. Basically I want this: Category 1 // Category 2 // Category 3 // to look like this: Category 1 // Category 2 // Category 3 Here's the current code I'm using:               <?php         $cat_array = array();         $args = array(             'author' => get_the_author_meta('id'),             'showposts' => -1,             'caller_get_posts' => 1         );         $author_posts = get_posts($args);         if ( $author_posts ) {             foreach ($author_posts as $author_post ) {                 foreach(get_the_category($author_post->ID) as $category) {                     $cat_array[$category->term_id] =  $category->term_id;                 }             }         }              $cat_ids = implode(',', $cat_array);         echo strtr(wp_list_categories('include='.$cat_ids.'&title_li=&style=none&echo=0'),array('<br />'=>' // '));     ?>


Rename Default Category (Uncategorized) Via a Function

I'm looking for a function to rename the default 'Uncategorized' category. The reason I need this is because I'm running a WordPress multi-site largely used by users with little technical knowledge and only allows the one, default category for their blog.


Get the first image URL of a post, by order (featured, first image, then default)

I want to get the first image URL of a post, in this order: first get the featured image of the post, if not, get the first image inserted on the post, if not, use the default image. At the moment I'm using this code:                   function get_first_image() {             global $post, $posts;                  //First get the featured image             if (has_post_thumbnail($post->ID)) {                 $first_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID));                 echo $first_image;             } else {                 //If not, get the first image                 $first_img = '';                 ob_start();                 ob_end_clean();                 $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);                 $first_img = $matches[1][0]; //LINE 470                      //If the variable is empty, use the default image                 if(empty($first_img)) {                     $first_img = ot_get_option('szt_featuredimage');                 }                      return $first_img;                  }      It works partially. It returns the featured image and the first image of the post, but it doesn't work perfect getting the default image: > **Notice** : Undefined offset: 0 in **/var/www/Seozeta/wp- > content/themes/seozeta/functions.php** on line **470**   >  [...] /wp-content/uploads/2014/04/default-image.png What can I do to fix this Notice? **EDIT:** Ok, I think I already fixed it. I just replaced this piece of code:                       $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);             $first_img = $matches[1][0];      for this:                           if ( $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches) ) {                     $first_img = $matches[1][0];                 }


Does query_posts have an effect on get_the_category?

I am having trouble debugging a situation, and I think some better background information on how these systems work would be very helpful. I know that the use of the function `query_posts` is strongly discouraged. But let's just assume that there is nothing I can do to remove it from the code. Specifically the query is changed to pull posts of a post_type (a `post_type` specific to the theme I am using). This is what the query looks like after it has been changed:               posts_per_page=10&paged=0&post_type=project      Then the loop begins and it can successfully grab the titles for each post. But when I call `get_the_category` it returns an empty array, even though all of the posts have categories. I verified that it was an empty array with `var_dump`. I do not have a strong understanding of how these systems work, so the emphasis on not using `query_posts` has me worried. Is there any possible interaction between `query_posts` and `get_the_category` that could cause it to not work correctly?


Having problems loading Jquery in functions.php

I'm trying to add some Jquery scripts to my Wordpress site, and unfortunately I cannot link you to the site as I'm working locally. It seems that the Jquery file is being loaded, as well as the fancyboxStyle I created, but all of the other js scripts aren't loading. **functions.php**               function my_init() {         if (!is_admin()) {             wp_deregister_script('jquery');             wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js');             wp_enqueue_script('jquery');              // load JS files from my theme              wp_enqueue_script('easing', get_bloginfo('template_url') . '/js/jquery.easing-1.3.pack.js', array('jquery'), '1.0', true, $in_footer);                wp_enqueue_script('mouseWheel', get_bloginfo('template_url') . '/js/jquery.mousewheel-3.0.4.pack.js', array('jquery'), '1.0', true, $in_footer);              wp_register_style( 'fancyboxStyle', get_bloginfo('template_url') . '/css/fancybox.css', true);              wp_enqueue_style( 'fancyboxStyle' );              wp_enqueue_script('fancybox', get_bloginfo('template_url') . '/js/jquery.fancybox-1.3.4.pack.js', array('jquery'), '1.0', true, $in_footer);              wp_enqueue_script('fancyboxControls', get_bloginfo('template_url') . '/js/fancybox/fancyboxControls.js', array('jquery'), '1.0', true, $in_footer);                   }     }     add_action('init', 'my_init');      The files are all in the correct location, but the scripts do not load within the footer (or header for that matter). Any help would be greatly appreciated. Thanks, Ashley


Different number of posts on the front page

I want 5 posts on my front page but 10 posts on subsequent pages (page 2, 3, ..). In my Settings > Reading > Blog pages show at most > I have 10. But I want to show only 5 posts on the front page, so in index.php I use this :               if ( $paged <= 1 ) $posts = query_posts($query_string.'&posts_per_page=5&paged='.$paged);      Works fine except that.. In page 2, the 6th to 10th posts don't show. As if, from page 2, WP « thought » that the front page has actually displayed the 10 first posts, not just 5. What can I do ?


Migrating wordpress multisite and domain mapping plugin

I have a WordPress Multisite installation (with sub-domains). Plus I use WordPress MU Domain Mapping to have separate domain name for each subsite. Now, I want to migrate all this to a new server (NO change in domain name). The potential problem I see is with domain mapping plugin. I cannot set the same domain name on the old server as well as new server at the same time. I think it will corrupt routing tables etc. Am I right? Do I have to use temporary domain names? If you have done something like this please do share some suggestion to do this in the best possible way.


Register a pre defined tree of taxonomies

I want to use a certain defined tree of taxonomies like this:   * news   * stories      * travel     * people     * nature   * videos but I want to have this hierarchy set in the code and not created via admin interface. The user should only be able to add new posts linking them to the correct taxonomy. I have found documentation about how to register a taxonomy which allows children, but not about how to define a full tree. Is it possible? If so, how?


Filtering out the #more anchor link that gets produced by <!--more-->

Back in my naive days of theming, I had to make it so the link inserted by `<! --more-->` wouldn't dump the viewer at the anchor it produces. I made a dinky plugin that consisted of:               function No_More_Link($buffer) {       $inHTML[0] = '/#more-\d+/';       $outHTML[0] = '';       return preg_replace($inHTML, $outHTML, $buffer);     }     ob_start("No_More_Link");      Years later, I thought I could do much better, by using a filter in the theme's `functions.php` file:               function no_more_link ( $input ) {       return preg_replace( '/#more-\d+/', '', $input );     }     add_filter( 'get_permalink', 'no_more_link' );      This doesn't work. I've tried bumping up the priority to ridiculous levels. Am I applying the filter to the wrong thing? What am I missing here?


wp_update_post() example... how to update the_content in a textarea?

I am using the below function to update the post meta from the front end. How can I add add best a textarea that updates `the_content()` using `wp_update_post()`?               if ( isset( $_POST['albums'] ) && wp_verify_nonce($_POST['albums'],'update_albums_postmeta') )          { //if nonce check succeeds.             global $post;             $postid = $post->ID;             $data = $_POST['priceone'];                   update_post_meta($postid,'_releasedate',$data);             $data = $_POST['pricetwo'];                   update_post_meta($postid,'_amazonlink',$data);         }      - **Edit:** So this snippet is posting changes to the database, however when the page refreshes on-submit the old `the_content()` is being shown. The post must manually be refreshed to see the changes. Is my snippet malformed?               if ( isset( $_POST['drw_inventory'] ) && wp_verify_nonce($_POST['drw_inventory'],'update_drw_postmeta') )          { //if nonce check succeeds.             global $post;             $data_content = $_POST['description'];                  $my_post = array();             $my_post['ID'] = $post->ID;             $my_post['post_content'] = $data_content;             wp_update_post( $my_post );         }


In the `functions.php` of my plugin I've added the following code:               function relativePathForUploads( $fileinfo )     {         global $blog_id;         $path = get_blog_option($blog_id,'siteurl');              $fileinfo['url'] = str_replace($path,'',$fileinfo['url']);              return $fileinfo;     }          add_filter('wp_handle_upload', 'relativePathForUploads');      But in the error log I get the following message:               PHP Fatal error:  Call to undefined function get_blog_option()      Do I need to include something before I'm able to call `get_blog_option`? If so, what?


Putting a Category of posts under a Page

I have a website say mysite.com and there is a blog mysite.com/blog.When i post a new post under blog category its appears like mysite.com/newpost.I want the posts under blog category to be displayed under the blog tag like mysite.com/blog/newpost How can i achieve this ?


Searching for a single custom post type, buddypress

I'm trying to show search results only for a specific custom post type, my code is simple and I already tested it successfully on some wordpress sites I made, but in this case (buddypress) looks like it is not working. Here is my form:               <form id="vendor-search" action="<?php bloginfo('siteurl'); ?>" method="get">
Search for vendors
         <input type="hidden" name="post_type" value="vendors" />         Search for:         <input type="text" id="s" size="23" name="s" value="" />         <input type="submit" value="Search" id="searchsubmit" />      So I set this hidden input:               <input type="hidden" name="post_type" value="vendors" />      and then I get a correct URL when searching, something like:               mywebsite.com/?post_type=vendors&s=Marketing      but on displayed results it is including all kind of posts and pages... Any ideas about what can this be? Thanks a lot!


Add script to footer - on post editor

How do you add a script on the footer of the post editor ? I'm adding a meta box under the post editor and I need to include a javascript before the closing body tag (on the footer) How do I achieve this ? The script is not needed on the front-end just on that meta_box (just on the post editor page)


How to add the category ID to admin page

I want to add the categories ID to admin page. I call it for my `functions.php`: `require_once('includes/categories_custom_id.php');` The part of code:               function categoriesColumnsHeader($columns) {             $columns['catID'] = __('ID');             return $columns;     }     add_filter( 'manage_categories_columns', 'categoriesColumnsHeader' );     function categoriesColumnsRow($argument, $columnName, $categoryID){             if($columnName == 'catID'){                     return $categoryID;             }     }     add_filter( 'manage_categories_custom_column', 'categoriesColumnsRow', 10, 3 );      But it doesn't work. Any idea, how to do that? Thanks in advance.


Add copies of the same text widget instance to multiple sidebars

Note: This is not the popular question about how to create multiple instances of a widget. I have a text widget that I am using to display "business hours". This text needs to go in multiple sidebars and is likely to change often enough to be a nuisance to change it in multiple places. Is there a way to use the same instance of a text widget on more than one sidebar? Any alternatives that use tokens or some other kind of pointer would also be a solution.


How to redirect image attachment to its original post

I'm making a slider that is getting images from attachments in the post. I am trying to rewrite the url for the post so that if someone pastes the direct url to the attachment, it'll go the post instead of the attachment page. I've no idea how to do that. This site has something like this. click a image on slider, copy the url and paste it and you'll see it. Thanks a lot for helping. EDIT: code for the slider:


Update Option Stored in Multi-Dimensional Array

I have data in the `wp_options` table currently stored as a multi-dimensional array (`profile_element_order`):               a:12:{s:17:"img_base64_enable";s:1:"1";s:25:"moulding_combination_page";s:0:"";s:24:"moulding_collection_page";s:0:"";s:25:"idea_gallery_thumb_height";s:3:"200";s:24:"idea_gallery_thumb_width";s:3:"200";s:23:"collection_thumb_height";s:3:"200";s:22:"collection_thumb_width";s:3:"200";s:20:"profile_item_columns";s:1:"4";s:17:"idea_item_columns";s:1:"2";s:24:"collections_item_columns";s:1:"2";s:25:"combinations_item_columns";s:1:"4";s:21:"profile_element_order";a:5:{i:0;s:8:"Option 1";i:1;s:8:"Option 2";i:2;s:8:"Option 3";i:3;s:8:"Option 4";i:4;s:8:"Option 5";}}      What I'm trying to accomplish is update the `profile_element_order` option (within those options). Here's how everything looks so far:               function psort_save_order() {              global $mouldings_options;              $list = $mouldings_options['profile_element_order'];         $new_order = $_POST['list_items'];         $new_list = array();              // update order         foreach($new_order as $v) {             if(isset($list[$v])) {                 $new_list[$v] = $list[$v];             }         }              // save the new order         update_option('profile_element_order', $new_list);              die();     }     add_action('wp_ajax_psort_update_order', 'psort_save_order');      The data is correctly posting to the DB table (as I can see some of my failed attempts as new option entries, like `mouldings_settings->profile_element_order`) -- I'm just having a hard time figuring out the `update_option()` syntax for just that specific option. I've tried things like (bearing in mind `mouldings_settings is the actual option name):               mouldings_settings['profile_element_order']     $mouldings_options['profile_element_order']     profile_element_order      but no dice at the moment. Any pointers would be greatly appreciated! Thanks! **Update** This is what I have now -- ajax action saves fine, but when I save the plugin options, it duplicates the options in the database and throws up the same error as before:               a:17:{s:17:"img_base64_enable";s:1:"1";s:25:"moulding_combination_page";s:0:"";s:24:"moulding_collection_page";s:0:"";s:25:"idea_gallery_thumb_height";s:3:"200";s:24:"idea_gallery_thumb_width";s:3:"200";s:23:"collection_thumb_height";s:3:"200";s:22:"collection_thumb_width";s:3:"200";s:20:"profile_item_columns";s:1:"4";s:17:"idea_item_columns";s:1:"2";s:24:"collections_item_columns";s:1:"2";s:25:"combinations_item_columns";s:1:"4";s:21:"profile_element_order";a:5:{i:4;s:8:"Option 5";i:0;s:8:"Option 1";i:1;s:8:"Option 2";i:3;s:8:"Option 4";i:2;s:8:"Option 3";}i:0;s:8:"Option 5";i:1;s:8:"Option 1";i:2;s:8:"Option 2";i:3;s:8:"Option 4";i:4;s:8:"Option 3";}      Function:               function psort_save_order() {              global $mouldings_options;              $list = $mouldings_options['profile_element_order'];         $new_order = $_POST['list_items'];         $new_list = array();              // update order         foreach($new_order as $v) {             if(isset($list[$v])) {                 $new_list[$v] = $list[$v];             }         }              $mouldings_options['profile_element_order'] = $new_list;         $mouldings_options = array_merge($mouldings_options,$mouldings_options['profile_element_order']);              // save the new order         update_option('mouldings_settings', $mouldings_options);              die();     }     add_action('wp_ajax_psort_update_order', 'psort_save_order');


How to get any type posts include attachments by ids?

I need to get any posts by an id list ($id_list), here is my codes               query_posts(array('posts_per_page'=>-1,                    'caller_get_posts'=>1,                    'post_type'=>'any',                    'post__in'=>$id_list)                );      i got posts and pages by this query, but attachments don't get included, i found they are filtered by 'post_type=any' which actually doesn't include attachment. How do i get them all without have to do an extra query?


Remove limit in characters of blog posts?

Im changing my blog, so its not possible to click on the post, but only see them in the preview. How and where do i remove the limit of characters on the preview page? I'm using the Mystile Woocommerce theme, if that has anything to say.. Please tell me if you need code etc. Thanks