Media manager multiple selection

I was creating a plugin, and its part should by adding files to custom posts. I managed script to work, but after few changes, to better look and function, it allows only one file to be added, than no other is allowed. Can you help me, please?               jQuery(document).ready(function($){     var custom_uploader;     $('#songbook_addfile_button').click(function(e) {     e.preventDefault();     //If the uploader object has already been created, reopen the dialog     if (custom_uploader) {         custom_uploader.open();         return;     }     //Extend the wp.media object     custom_uploader = wp.media.frames.file_frame = wp.media({         title:"blemblem",         button: {             text:"blemblem"         },         multiple: true     });     custom_uploader.on('select', function() {             var selection = custom_uploader.state().get('selection');             selection.map( function( attachment ) {             attachment = attachment.toJSON();             extension = extension(attachment.url).replace('.','');             alert(extension);         //...one commented line, that was to add files into HTML structure - works     perfect, but only once             });         });         custom_uploader.open();         });         });      and the one fc to get extension from URL is this:               function extension(url) {     var ext=(url = url.substr(1 + url.lastIndexOf("/")).split('?')    [0]).substr(url.lastIndexOf("."));     return ext;     };      When click the open media manager button, it opens when select one and click add media, its added(or in this code alerted) when more files are selected, it takes only the first after adding first file, then it opens on click, but don't add any file when click the manager add button. Please, can you show me the right way to go? Thank you


Install WordPress with SQL database

I am very new to WordPress. I didn't even know it existed until I had to do it for my work. So I started in with a WAMP server with WordPress. That worked fine until we needed multiple sites with WordPress, so I had to move it over to IIS. That still had MySQL involved and the CTO of the company wants it to run on SQL instead. I have Installed a fresh copy to mess around with from here "wordpress.org/ wordpress-3.4-IIS.zip" then I downloaded and installed db-abstraction. That done, I extracted them to the location I wanted (wordpress/[site]).   1. Log into your current site and export your data as an xml file   2. Disable all your current plugins   3. Back up your existing `config.php` file   4. Download the plugin package.   5. Upload `wp-db-abstraction.php` and the wp-db-abstraction directory to `wp-content/mu-plugins`. This should be parallel to your regular plugins directory. If the mu-plugins directory does not exist, you must create it.   6. Put the `db.php` file from inside the `wp-db-abstraction.php` directory to `wp-content/db.php`   7. Visit `$your_wordpress_url/wp-content/mu-plugins/wp-db-abstraction/setup-config.php` to generate your `wp-config.php` file   8. Install WordPress   9. Log into the newly installed system and import your data   10. Reinstall and test your plugins Up to step 6 it works fine. Then when I try and go to the php page, 1) I can't set the database type from MySQL to SQL 2) about 50% of the time I get a 500 error. I really don't know if this makes any sense to anyone. I'm sorry if I am confusing you as it really confuses me as well. Please let me know if you need more information. Thanks.


The uploaded file exceeds!

I have configured Wordpress locally on my system(Windows 7 professional). I want to upload a theme to test it, but whenever I tried to upload the theme with more the 1MB. It shows me the error which read as: **The uploaded file exceeds the upload_max_filesize directive in php.ini.** As per stackexchange's previous question answers I made a text file renamed as php.ini with code and pasted in Wp-admin folder but still it is not working. The added code to the file is mentioned below:               memory_limit = 32M     upload_max_filesize = 32M     post_max_size = 32M     file_uploads = On      but still getting the same error. What to do?


Creating WordPress Plugin solely for Admin panel with dash menu and submenus

I am attempting to create a WordPress plugin which allows the client to use for help and other resources in a friendly interface. It would be desired if I could have guidance on creating a WordPress plugin with a main dashboard menu and submenus on it which can contain HTML content. As I am a new to WordPress Development, I found it hard to understand the WP Codex. ![snapshot](http://i.stack.imgur.com/j5LPK.png) This is the plugin code:               /** add menu. */     add_action( 'admin_menu', 'my_plugin_menu', 'my_magic_function' );     add_submenu_page( 'my_plugin_menu', 'Page title', 'Sub-menu title', 'manage_options', 'my-submenu-handle', 'my_magic_function');               function my_plugin_menu() {             add_options_page( 'My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options' );     }          function my_plugin_menu() {             add_options_page( 'Submenu', 'My Plugin', 'manage_options', 'my-submenu-handle', 'my_plugin_options' );     }          /** html. */     function my_plugin_options() {             if ( !current_user_can( 'manage_options' ) )  {                     wp_die( __( 'You do not have sufficient permissions to access this page.' ) );             }             echo '
';             echo '
Main page
';             echo '
';     }          function my_plugin_options() {             if ( !current_user_can( 'manage_options' ) )  {                     wp_die( __( 'You do not have sufficient permissions to access this page.' ) );             }             echo '
';             echo '
submenu page
';             echo '
';     }


woocommerce breadcrump missing shop link

I have a WordPress site that uses courtur theme with woocommerce I didn't install the site so i'm not sure if it was configured correctly. my URL structure for product-category page as follow: mysite/shopping/ and my product page url: Mysite/product-category/category_name/ my category page breadcrump show as follow: You are here: **Home** my category page breadcrump show as follow: You are here: **Home** I need to make it show as : You are here: Home / shop/ category_name my product page breadcrump : You are here: **Home/blog/product** where blog links to my shop page !! I need to make it show as : You are here: Home / shop/ category_name / product_name I checked permalinks options but it seems OK . I checked breadcrumb.php template file it seems that it consider that shop () page is the home page of my site. How can I fix this , should i edit breadcrumb.php or there is an error in my settings? Thanks in advance.


Using page-id-{ID} from body_class() in local dev, versus live staging

Not sure this is a question suitable for this forum, but I'll try: I think it is pretty convenient targeting elements in css/jQuery for a specific page by using the page-id-{ID} generated by body_class() in a template. But this gets problematic when developing on a local dev machine and then transfering to a staging server for your customer where the page id's is not the same. How do you handle this?


How to get login data (session) outside WordPress?

I guess WP uses a PHP session (or a cookie) to save login data, right? I have a website, which uses WP as a CMS, but display (and create) content from outside. I allow anonymous posts, by simply **not** passing `$post['post_author']` to `wp_insert_post()` However, I also want to make users (that are registered in WP) to be able to login in `mysite/wp/wp-login.php`, than redirect to `mysite/mypage.php`, and get the `user id` from session or cookie. How do I do that? ## Edit The code:               include( 'wp/wp-load.php');       global $current_user;     get_currentuserinfo();     print_r($current_user);      this prints an empty WP_User Object:               WP_User Object ( [data] => [ID] => 0 [caps] => Array ( ) [cap_key] => [roles] => Array ( ) [allcaps] => Array ( ) [filter] => )       Although I'm logged in in WP. _P.S._   Now that I saw `wp-login-form` in tags, which gave me a better idea. Can I put a login form to my page (outside wp) ? This would surely be better, since it wouldn't require the users to redirect. I want minimum (ideally zero) interaction between `mysite/wp` and visitors (including Google Bot).


conditional tags for the output of a plugin

I'm still quite a newbie developer so small problems like this bring me to a stand still from time to time. I've basically built a custom plugin to display pdf images next to a link very basic I know, but my problem is I need the $title1 text to be a different colour on certain page templates so I'm trying to alter the output code with a conditional but it doesn't seem to be parsed in the browser. the code now been parsed if the conditional only the .menu-widget div gets output on all page templates instead of .white replacing it allowing me to style it with css. the IMAGES Constant is defined within functions.php file. Here is my code                   class donor_pdf_plugin extends WP_Widget {          // Constructor     function donor_pdf_plugin() {     parent::WP_Widget(false, $name = __('Pdf footer description', 'donor_pdf_plugin'));     }          // Widget form creation     function form($instance) {          // Check values     if($instance) {     $link = esc_attr($instance['link']);     $link1 = esc_attr($instance['link1']);     $link2 = esc_attr($instance['link2']);     $link3 = esc_attr($instance['link3']);     $title = esc_attr($instance['title']);     $title1 = esc_attr($instance['title1']);     $title2 = esc_attr($instance['title2']);     $title3 = esc_attr($instance['title3']);     } else {     $link = '';     $link1 = '';     $link2 = '';     $link3 = '';     $title = '';     $title1 = '';     $title2 = '';     $title3 = '';     }     ?>
            <label for="<?php echo $this->get_field_id('link'); ?>"><?php _e('Menu link', 'wp_widget_plugin'); ?>            <input class="widefat" id="<?php echo $this->get_field_id('link'); ?>" name="<?php echo $this->get_field_name('link'); ?>" type="text" value="<?php echo $link; ?>" />

            <label for="<?php echo $this->get_field_id('link1'); ?>"><?php _e('Menu link1', 'wp_widget_plugin'); ?>            <input class="widefat" id="<?php echo $this->get_field_id('link1'); ?>" name="<?php echo $this->get_field_name('link1'); ?>" type="text" value="<?php echo $link1; ?>" />

            <label for="<?php echo $this->get_field_id('link2'); ?>"><?php _e('Menu link2', 'wp_widget_plugin'); ?>            <input class="widefat" id="<?php echo $this->get_field_id('link2'); ?>" name="<?php echo $this->get_field_name('link2'); ?>" type="text" value="<?php echo $link2; ?>" />

            <label for="<?php echo $this->get_field_id('link3'); ?>"><?php _e('Menu link3', 'wp_widget_plugin'); ?>            <input class="widefat" id="<?php echo $this->get_field_id('link3'); ?>" name="<?php echo $this->get_field_name('link3'); ?>" type="text" value="<?php echo $link3; ?>" />

            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Menu title', 'wp_widget_plugin'); ?>            <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />

            <label for="<?php echo $this->get_field_id('title1'); ?>"><?php _e('Menu title1', 'wp_widget_plugin'); ?>            <input class="widefat" id="<?php echo $this->get_field_id('title1'); ?>" name="<?php echo $this->get_field_name('title1'); ?>" type="text" value="<?php echo $title1; ?>" />

            <label for="<?php echo $this->get_field_id('title2'); ?>"><?php _e('Menu title2', 'wp_widget_plugin'); ?>            <input class="widefat" id="<?php echo $this->get_field_id('title2'); ?>" name="<?php echo $this->get_field_name('title2'); ?>" type="text" value="<?php echo $title2; ?>" />

            <label for="<?php echo $this->get_field_id('title3'); ?>"><?php _e('Menu title3', 'wp_widget_plugin'); ?>            <input class="widefat" id="<?php echo $this->get_field_id('title3'); ?>" name="<?php echo $this->get_field_name('title3'); ?>" type="text" value="<?php echo $title3; ?>" />
                                    <?php // end of widget form creation ?>      <?php     }          // Widget update     function update($new_instance, $old_instance) {     $instance = $old_instance;     // Fields     $instance['link'] = strip_tags($new_instance['link']);     $instance['link1'] = strip_tags($new_instance['link1']);     $instance['link2'] = strip_tags($new_instance['link2']);     $instance['link3'] = strip_tags($new_instance['link3']);     $instance['title'] = strip_tags($new_instance['title']);     $instance['title1'] = strip_tags($new_instance['title1']);     $instance['title2'] = strip_tags($new_instance['title2']);     $instance['title3'] = strip_tags($new_instance['title3']);          return $instance;     }          // Widget display     function widget($args, $instance) {     extract($args);     $link = $instance['link'];     $link1 = $instance['link1'];     $link2 = $instance['link2'];     $link3 = $instance['link3'];     $title = $instance['title'];     $title1 = $instance['title1'];     $title2 = $instance['title2'];     $title3 = $instance['title3'];                    if(!is_home()) {     echo "

 $title

$title1

$title2

$title3

";     } else {     echo "

 $title

$title1

$title2

$title3

";          }     }     }               // Register widget     add_action('widgets_init', create_function('', 'return register_widget("donor_pdf_plugin");'));     ?>      the code not been parsed is this bit.               } else {     echo "

 $title

$title1

$title2

$title3

";          }


automated tests as a user?

I checked out (with svn) the code for Automated Testing. However, I want to run unit tests as a specific user. Is there a way to do that? That is, is there a way to loggin with php code alone?


Remove bulk actions based on user role or capabilities

How can I remove the "bulk actions" based on user roles or capabilities. Actually I have this code to do the job, but now I need to exclude the site admin, I need to let the administrator to access the bulk menu               add_filter( 'bulk_actions-' . 'edit-post', '__return_empty_array' );     add_filter( 'bulk_actions-' . 'upload', '__return_empty_array' );      How can I exclude roles or capabilities from that filter ?


Static HTML page caching for large website

I'm creating a WooCommerce store with 3000+ products (+filters). And I'm using WP super cache plugin because I want to serve pages as fast as possible. This arises problems/questions:   * When any post is edited - WP Super Cache purges all cache and regenerates thousands of pages again. Is there any way to control which files should be regenerated on post update? (e.g. regenerate just its product page)   * Am I doing it all wrong? Maybe I shouldn't use WP Super Cache for such large website at all, do you have any recommendations? Thank you very much!


Querying Posts by Taxonomy From Alternate Network Site

I have 5 Network sites in my WordPress multisite setup. One of which is the "primary website", which the rest of the other network sites will be retrieving data from. I am currently using `WP_Query();` to retrieve posts and `switch_to_blog()` / `restore_current_blog();` before and after the call to `WP_Query();` if the current site is not the primary site. Posts fetched from the mainsite are retrieved just fine. When I go to any other site in the network which is NOT the primary site, it's supposed to switch to the primary site, retrieve posts from a custom post type AND a custom taxonomy. Once posts are found, restore the current blog. However, the sub sites are returning ZERO posts. I thought it was strange. So I dumped/compared the results from `WP_Query();` on the primary site and any of the sub sites. Specifically noting the `request` portion of the queried object. **Request when on primary website:**               [request] => SELECT SQL_CALC_FOUND_ROWS  ples_posts.ID FROM ples_posts  INNER JOIN ples_term_relationships ON (ples_posts.ID = ples_term_relationships.object_id) WHERE 1=1  AND ( ples_term_relationships.term_taxonomy_id IN (16) ) AND ples_posts.post_type = 'mbe-sales-listings' AND ((ples_posts.post_status = 'publish')) GROUP BY ples_posts.ID ORDER BY ples_posts.post_date DESC LIMIT 0, 5      **Request when on any sub site:**               [request] => SELECT SQL_CALC_FOUND_ROWS  ples_posts.ID FROM ples_posts  WHERE 1=1  AND 0 = 1 AND ples_posts.post_type = 'mbe-sales-listings' AND ((ples_posts.post_status = 'publish')) GROUP BY ples_posts.ID ORDER BY ples_posts.post_date DESC LIMIT 0, 4      The posts per page are intended to be different, so that doesn't matter. The point is, when the query is requested from any of the sub sites, it appears to be querying for the custom post type, but it's not even considering the custom taxonomy. **Note:** The custom post type, and all custom taxonomies for that custom post type are only registered on the primary site. When registering the custom post type, and all of the custom taxonomies for that custom post type on all of the sub sites as well, it then retrieves the posts as intended. I don't particularly want to register the custom post type or any of the custom taxonomies on any of the sub sites. I only want them registered on the primary site. Now that you know the elaborate story, here comes the question... **Is there any way I can only have the custom post type and all custom taxonomies registered on the primary site, and still be able to retrieve the necessary posts from any of the sub sites?** I'm assuming it is possible with a special `$wpdb;` query and NOT possible using `switch_to_blog();`, `WP_Query();`, and `restore_current_blog();`. If it's possible using a special `$wpdb;` query, I would appreciate guidance on a safe and proper SQL query in order to do so. I'm just looking to query all published posts from a specified site ID, post type, and taxonomy / term.


Trying to get more space removed from my header

The last time , you help me to remove the header from all the pages besides the Home page (thanks again by the way). The reason for me to do so , is because I don' t want my music player for example to be too below , having people to need to scroll down. I am still looking for more space , and get rid off the title for example, or make it smaller . And know that I added a follow button of Twitter , the top takes more space , and the music player is more below . Any advice would be appreciated. Thanks, Daniel


highlight "starred" comments by admin

I'm looking for a **wordpress plugin, hook function or directions** for these specific needs (I'm okay writing my own plugin):   * when moderating comments, a wordpress admin should be able to change its status (approved/pending/spam, like usual) and "star this comment" or set its status to a new status "approved and starred"   * These "starred" comments would show up **highlighted** , **sorted first** or **diplayed in a tab-like interface** on the post page Ideas?


Add text to the end of each list item in wp_list_categories

I haven't been able to find what I'm looking for and not sure how to approach it. I'm using `wp_list_categories` to obviously list terms of a taxonomy. I'd like to add some text to the end of each item. Example being: * taxonomy_term some_new_text instead of * taxonomy_term Here's the basic `wp_list_categories` that I'm using:               <?php          wp_list_categories(array(              'taxonomy' => 'locations',             'orderby' => 'name',             'style' => 'list',             'order' => 'ASC',             'title_li' => '',             'number' => 25,         ));     ?>      Thanks **Final code used to accomplish what I need**               <?php         $args = array(             'taxonomy' => 'locations',             'orderby' => 'name',             'number' => 25,         );         $categories = get_categories( $args );         foreach ( $categories as $category ) {             echo '
 slug . '">' . $category->name . ' ' . get_the_title() . ' |
';         }     ?>


tax_query not working on main query

I'm using the following code to do a tax_query and it doesn't seem to work anymore.. At some point it was working and for the life of me it wont, anymore.               <?php          global $pf_override;          class PF_override {              public $site_terms = array();              function __construct() {                  // add filters             add_filter( 'init', array( &$this, 'populates_site_terms' ) );             add_filter( 'pre_get_posts', array( &$this, 'filter_query' ) );         }              function populates_site_terms() {                  // my actual function does some processing and             // checks caches and combines IDs from multiple             // different sources here and then sets site_terms                   $this->site_terms = array( 1, 2, 3 );         }              function filter_query( $query ) {                  // not the main query?             if ( !$query->is_main_query() ) {                 return $query;             }                  // have terms to filter by?             if ( !empty( $this->site_terms ) ) {                      // construct tax_query                 $tax_query = array(                     'taxonomy'  => 'site_category',                     'field'     => 'id',                     'terms'     => $this->site_terms,                     'operator'  => 'IN'                     );                      // this needs to be an array of arrays                 $taxquery = array(                     $tax_query                 );                      // set this..                 $query->set( 'tax_query', $taxquery );             }                  // return new query object             return $query;         }     }          // not the admin? init class     if ( !is_admin() ) {         $pf_override = new PF_override();     }          ?>      Taxonomy is added like so:               function PF_register_post_type() {         $labels = array(             'name'              => _x( 'Site Category', 'taxonomy general name' ),             'singular_name'     => _x( 'Site Category', 'taxonomy singular name' ),             'search_items'      => __( 'Search Site Categories' ),             'all_items'         => __( 'All Site Categories' ),             'parent_item'       => __( 'Parent Site Category' ),             'parent_item_colon' => __( 'Parent Site Category:' ),             'edit_item'         => __( 'Edit Site Category' ),             'update_item'       => __( 'Update Site Category' ),             'add_new_item'      => __( 'Add New Site Category' ),             'new_item_name'     => __( 'New Site Category Name' ),             'menu_name'         => __( 'Site Category' ),         );              $args = array(             'hierarchical'      => true,             'labels'            => $labels,             'show_ui'           => true,             'show_admin_column' => true,             'query_var'         => true,             'rewrite'           => array( 'slug' => 'sitecat' ),         );              register_taxonomy( 'site_category', array( 'post', 'page', 'attachment', 'revision', 'nav_menu_item' ), $args );     }          add_action( 'init', 'PF_register_post_types', 1 );      In my footer.php I add this code:               $GLOBALS['wp_query']->request      I get this as a result when going to mydomain.com/testing:               SELECT wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'testing' AND wp_posts.post_type = 'post' ORDER BY wp_posts.post_date DESC      The $pf_override variable shows $pf_override->site_terms to be set as an array of               array( [0] => 1, [1] => 2, [2] => 3 )


Save modified Custom Field content into another Custom Field on article save

In my articles I allow editors to enter a date in a human readable dd.mm.yyyy format into a custom field. But I also need this date as unix timestamp in the DB. So I wrote a function which takes the human readable date from the custom field "Event-Date", converts it into a unix timestamp and then saves it into a custom field "Event-Timestamp". I trigger this function with 'add_action' 'save_post'. The script works fine, but the problem is that if I later change the dd.mm.yyyy date and then save the article, my script kicks in BEFORE the new values are registered. This results in the old date still being used for the timestamp calculation. For example: In the article the dd.mm.yyyy date is 01.01.2011. Now I change it to 02.02.2012 and save the changes, but the unix timestamp will still be for 01.01.2011! If I then change 02.02.2012 to 03.03.2013 and save the changes, the unix timestamp now becomes 02.02.2012! And so on... Here is my function:               function post_saver($postID) {         $limitPostTypes = array('post');              if (!in_array($_POST['post_type'], $limitPostTypes)) return;              $custom_field   = 'Event-Date';         $newFieldName   = 'Event-Timestamp';              foreach ($_POST['meta'] as $meta)         {             if ($meta['key'] == $custom_field)             {                 $date   = $meta['value'];                 break;             }         }              $date           = explode('.', $date);         $dateYear       = $date[2];         $dateMonth      = $date[1];         $dateDay        = $date[0];         unset($date);              $unixTimeStamp  = mktime(0, 0, 0, $dateMonth, $dateDay, $dateYear);              update_post_meta($postID, $newFieldName, $unixTimeStamp);     }     add_action( 'save_post', 'post_saver');      Any help or suggestions would be highly appreciated! Thanks in advance!


append $_GET parameters to post

I try to find a plugin that can "auto insert" to post edit/add page a parameters by fill $get paramerts: for example:post.php?title=a&tags=ss,dds,aa Ideas?


Nothing Found for Index Php Error

I moved my word press blog from Apache to IIS 7 shared hosting. my database connection is fine. I can access the admin module but I get an empty index.php with "Nothing Found for Index Php Error" in the title bar. Can someone please help.


How to pass arguments from add_settings_field() to the callback function?

I have a function like this:               add_settings_field( 'contact_phone', 'Contact Phone', 'settings_callback', 'general');      That works. It calls settings_callback. Cool. The problem I have with this is: I don't want to have to define a callback function for every setting I add, if all I'm doing is echoing out a little bit of stuff.               function settings_callback()     {         echo '<input id="contact_phone" type="text" class="regular-text" name="contact_phone" />';     }      Why on earth should I have to do that? The id, class, and name should all be params. Is there no way to pass params to the settings_callback function? I started looking at the core, got here: http://core.trac.wordpress.org/browser/tags/3.1.3/wp- admin/includes/template.php ..and ran into this $wp_settings_fields global. Where is this defined?


enqueue jQuery into the footer

I have looked but no where seems to cover how to place jQuery into the footer, at least not the way I have it in my theme, is there a way to place the following into the footer?               // Load jQuery     function my_register_jquery_function() {         wp_deregister_script('jquery');         wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"), false, '1.7.1');         wp_enqueue_script('jquery');              wp_enqueue_script(             'cookie'             , get_stylesheet_directory_uri() . '/js/jquery.cookie.js'             , array('jquery')         );         wp_enqueue_script(             'easing'             , get_stylesheet_directory_uri() . '/js/jquery.easing.1.3.js'             , array('jquery')         );         wp_enqueue_script(             'nivo'             , get_stylesheet_directory_uri() . '/js/jquery.nivo.slider.js'             , array('jquery')         );         wp_enqueue_script(             'setup'             , get_stylesheet_directory_uri() . '/js/setup.js'             , array('jquery')         );     }          add_action('wp_enqueue_scripts', 'my_register_jquery_function');


Regex to turn embedded images in to attachments

I've got a blog that has all images **embedded in each post** rather than a **thumbnail linking to an attachment page** which is what I'd like. I understand from this question that no plugin (like Regenerate Thumbnails) can help me here, I need a regex to swap out all instances in my database and replace with the WordPress default embed method (thumbnail linking to attachment page which links to the high-res version).


get rid of the arrow in previous_post_link?

How can I hide or disable this `«` sign in front of `previous_post_link`? I can't find it anywhere - it only shows up on the generated page. This is the code I am using:                   <?php             $nextPost = get_next_post();             $nextthumbnail = get_the_post_thumbnail($nextPost->ID);             next_post_link('%link',''.$nextthumbnail.'');             $next_value = get_post_meta( $nextPost->ID, 'subtext', $single = true);          ?>      Thank you!


Hide widget if user is logged in without plugin

I would like to be able to hide a widget in the front-end if the user is logged in and only display the widget when the user is not logged in. I have found a plugin that does this called Widget Logic however i don't want to install too many plugins especially for something as small as this. Your help will be much appreciated.


How Does One Change The Meta-Description Of Home-Page?

In WordPress, How Does One Change The Meta-Description Of The Home-Page? Honestly, I have searched low and high for the answer to this in WordPress. Went to every page in the back-office to no avail. In Google search results it repeats my company slogan twice and that is all. Nobody will click on this as it looks ridiculous. How and where do I change this? It is an Arras Theme, if that helps


Widget code is not working on WordPress.com Hosted Blogs

I have developed a JavaScript widget which works fine when I embed it in any of my html pages. The code is something like this               <script type="text/javascript" charset="utf-8">       var asset_host = 'http://domain.com';       var url = unescape("%3Cscript src='" + asset_host + "/javascripts/widget.js' type='text/javascript'%3E%3C/script%3E");       document.write(url);     </script>          <script type="text/javascript" charset="utf-8">       var widget_options = {};       widget_options.iframe_base_url =  asset_host + '/widget/questions/10';       var feedback_widget = new ShowWidget.widget(widget_options);     </script>      However when I embed this code in wordpress then "style" tag is being stripped off ( probably for security reasons). How should I go about generating the widget code for wordpress so that users have least amount of inconvenience.


How to use div -ids in url to jump to specific post...Is trailing slash the culprit?

Some links on my site take the user to a specific post **in context on a category page**. On non-WP sites, this is easily accomplished by including `#example-div-id` in the url like this: `http://www.example.com#example-div-id` **But in a WP environment, this url isn't working** : `http://www.example.com/?cat=15#post-170` This (incorrectly) jumps the browser window to the end of the page. **But this does work**...manually removing the trailing slash after page load and reloading the page. The browser window jumps to the appropriate div, or post. `http://www.example.com?cat=15#post-170`. Does anyone know why this is? Or how to get WP to eliminate the trailing slash? Is it safe to eliminate the trailing slash? ## Update I tried using EAMann's solution below, implementing pretty permalinks to facilitate the anchor jump. The results achieved completely break my post order and exclusion of child categories. My navigation is category based. I don't use pages, but use category names in the navigation. Each 'page' is really a category archive showing posts from the category. What I've read about permalinks starting with %category% leads me to avoiding permalinks all together. I certainly don't want to start the permalink with the year or post id either. It doesn't make sense on my site. `http://www.example.com/category/my-category` looks more professional and "normal" than `http://www.example.com/2009/my-category` when the intended illusion is that the category names are really pages on this business site. **So I'd appreciate any other explanations why the anchor jumping isn't working.** ## Update #2 (in response to EAMann's comment directly on the OP) My site is a business website that for the most part displays static content. A few areas have featured portfolio work and there is blog section. The site uses a category based navigation. All the site content is written as posts. Each post is associated with a category that determines where the post is displayed. The site navigation menu is created with `wp_list_categories()`. Clicking on a category opens a category archive that presents all the posts from the category. I'm currently using the default permalink structure.   `http://www.example.com/?cat=15` shows a category page. ## Update #3 After more investigation, it appears that the jQuery plugin "innerfade" that I'm using to display a slideshow at the top of the page is the culprit. It has nothing to do with the trailing slash. Sorry to go down the wrong path. If I comment out the php that includes the plugin js file, and the anchor jump works just fine. I would guess that some javascript manipulation of the page content is screwing up the jump. I've worked around the problem using `$(window).scrollTo();`. I appreciate everyone's time.


How to pass more information though separate post keys via AJAX

I'm on the admin side of wordpress and therefore am using ajaxurl. Is there any way I can pass information through different keys. For example, like "extra" below... **Ajax That's Sending The Data**               jQuery(document).ready(function($) {           var my_data = {                     action: 'arrow_handler',                     function to use                     move_id: user_id,                     arrow_status: 'down'          };         $.post(ajaxurl, data, function(response) {             alert('Got this from the server: ' + response);         });      * * * *I noticed that if you remove "($_POST('arrow_status') == 'up' || $_POST('arrow_status') == 'down')" from below it ignores the 'arrow_status' which hasn't seem to have been sent* **Conditional Statement That's Processing The Sent Data**               if (isset($_POST['move_id']) && !empty($_POST['move_id']) &&     ($_POST('arrow_status') == 'up' || $_POST('arrow_status') == 'down') && $checkifrows > 0) {                     $lastuser = $wpdb->get_var("SELECT MAX(ordr) AS ordr FROM $table");     //fetch the results to see what the users order is     $userorder = $wpdb->query($wpdb->prepare('SELECT ordr FROM ' . $table . ' WHERE id = %d      LIMIT 1', $_POST['move_id']));                 }                 die();     }


Automatically add a character to field in edit post page

Currently I am facing an issue involving making two plugins work well together. I am using a form plugin called formidable to create a new location custom post (custom post was made from a plugin called events manager). The events manager plugin calculates the latitude and longitude and generates a Google map when the fields: location_Address,location_town,location_postcode,location_region,location_country ... are filled in. # The Question Can anyone tell me how to make a script for the edit 'custom post' screen that moves the cursor to a specified field (after page load), automatically inserts a "space" to the field of choice, and then move the cursor to another field. So that the longitude,latitude and google map generates? # Question Back story (if needed) The events manager plugin wasnt made to have those fields filled in from an external form source, but rather its own. To make my self clearer after I create a location using the form from formidable and then go to the edit location screen, every thing looks fine. All fields are filled in (location town, postcode, custom fields etc). But after a second look at the location address details box I can see that the google map isn't loaded, it says "location not found" despite the fact that all the address fields are filled in. http://awesomescreenshot.com/0761cjewe3 (image link) I then found out that, when I add a 'space' (or any other character) to the any of the location fields, the google map loads. http://awesomescreenshot.com/0121cjf159


Comments +1 and ranking system

The site that I'm creating, is a sort of information/news one. It has been made to prompt discussion between people. What I want to add, is a system that would allow people to +1 others comments (system present on youtube, just without the -1) and somehow create a users ranking(based on the +1's) that could be displayed on the website. I'm also looking for a way to put ranks (visible in their profile) on people, based on the number of their +1's (example: user has rank x when he signs up, and if his comments get 50 +1's altogether, he is being promoted to rank y) Any help would be greatly appreciated!


Highlighting the current users comment

I don't know if this is possible, I've searched around but came up short. Basically, I need that the current user who is commenting to see his comments slightly different than the rest. I'm doing this for admins/moderators, but the thing is that all users see the highlighted comments made by admin/mod, where here I just want every user to see his comments as highlighted.


How To Add My Domain before the external image link

I want to add my domain link before the link image. For example, I'd like `<img src="http://picasa.com/example.jpg />` to be : `<img src="http://mydomain.com/http://picasa.com/example.jpg />` And I want to apply it on the post content, without going in index.


Manually set a custom admin sub-menu selected?

This question might have been asked already, and if so I apologize but none of the other answers pointed me in the right direction. I am developing my first Wordpress plugin. Lets say it contains the following admin pages:   * General Settings   * Add New Vendor   * Vendors   * Edit Vendor Now, I do not want to display the _Edit Vendor_ option in the menu, and I want to make it accessible using a link in _Vendors_ page. My menu and _Vendors_ page are: ![enter image description here](http://i.stack.imgur.com/RalOG.png) Code to generate the menu:               function nes_general_settings_view () {          require_once("views/admin/general_settings.php");     }          function nes_vendor_view () {          require_once("views/admin/vendor.php");     }          function nes_vendor_new_view () {         require_once("views/admin/vendor_new.php");     }          function nes_vendor_edit_view () {              require_once("views/admin/vendor_edit.php");     }          add_action("admin_menu", function () {         add_menu_page(             "Service",               "Service",               "manage_options",                         "nes_general_settings",                   "nes_general_settings_view",              null,                                     4                                     );              add_submenu_page( "nes_general_settings", "General Settings", "General Settings", 0, "nes_general_settings", "nes_general_settings_view");              add_submenu_page( "nes_general_settings", "Vendors", "Vendors", 0, "nes_vendor", "nes_vendor_view");         add_submenu_page( "nes_general_settings", "New Vendor", "New Vendor", 0, "nes_vendor_new", "nes_vendor_new_view");         add_submenu_page( "nes_fake_id", "Edit Vendor", "Edit Vendor", 0, "nes_vendor_edit", "nes_vendor_edit_view");          });      And Code to generate the link to _Edit Vendor_ page:               <a href="<?=admin_url("admin.php?page=nes_vendor_edit")?>">Edit      But when I am in _Edit Vendor_ page, my menu is not selected. ![enter image description here](http://i.stack.imgur.com/MXjYI.png) **Now my question is:** How do I set the _Service > Vendors_ submenu to the currently selected Admin menu, when I am on the _Edit Vendor_ Page? Please give me an example, since I am really new to WordPress.


htaccess redirect for all categories converted to tags now showing 404

I have a WordPress site which syndicates content from a number of sources and auto creates categories and tags. I have converted a large number of categories to tags which now leaves a ton of categories showing 404's. I started manually redirecting these but as expected this is a huge task. I'm trying to find a way to use htaccess redirects, which can   1. detect all category 404s   2. redirect those to their /tag/tagterm/ equavalent so all 404'ing /category/catterm to be redirected to /tag/tagterm equavalent Any ideas?


Linefeed added after include/require in PHP

I am using the following script to protect downloads from the wp-upload dir: (https://gist.github.com/hakre/1552239) It should work fine, however there is a linefeed created by the `require_once('wp-load.php');` statement. I tried to use PHP OB functions to trap and remove the linefeed but to no success. I also look at all the PHP scripts in WP and I cannot see any reason for this (and I am using the latest version of WP).


Group list of posts by taxonomy and allow for pagination

There are multiple ways of showing a list of (custom) posts by taxonomy, but none appear to allow for pagination. So, I can easily list all posts like: **Page 1**   * 1   * 2   * 3   * 4   * 5 **Page 2**   * 6   * 7   * 8   * 9   * 10 With a little effort, I can list posts grouped by taxonomy **Page 1**   * A      * 1     * 2   * B      * 3     * 4     * 5     * 6   * C      * 7     * 8   * D      * 9     * 10 But what I need help doing is mixing in pagination E.g. **Page 1**   * A      * 1     * 2   * B      * 3     * 4     * 5 **Page 2**   * B      * 6   * C      * 7     * 8   * D      * 9     * 10 Any ideas? Example code below:               <?php     // Get current Category     $get_current_cat = get_term_by('name', single_cat_title('',false), 'category');     $current_cat = $get_current_cat->term_id;               // List posts by the terms for a custom taxonomy of any post type     $post_type = 'myposttype';     $tax = 'mytaxonomy';     $tax_terms = get_terms( $tax, 'orderby=name&order=ASC');     if ($tax_terms) {         foreach ($tax_terms  as $tax_term) {             $args = array(                 'post_type'         => $post_type,                 "$tax"              => $tax_term->slug,                 'post_status'       => 'publish',                 'posts_per_page'    => -1,                 'category__in'      => $current_cat // Only posts in current category (category.php)             );                  $my_query = null;             $my_query = new WP_Query($args);                  if( $my_query->have_posts() ) : ?>
<?php echo $tax_term->name; // Group name (taxonomy) ?>
                      <?php while ( $my_query->have_posts() ) : $my_query->the_post(); ?>                     <?php $term_list = wp_get_post_terms($post->ID, 'category', array("fields" => "ids")); // Get post categories IDs?>                          <?php if (in_array($current_cat, $term_list) ): // Display only posts that have current category ID ?>
<?php the_title(); ?>
                     <?php endif; // if in_array ?>                      <?php endwhile; // end of loop ?>                  <?php endif; // if have_posts()             wp_reset_query();              } // end foreach #tax_terms     } // end if tax_terms      ?>


Wordpress plugin creating database in localhost but not on real host

So I am busy creating a plugin that creates a custom table to read in some data. The plugin works 100% on localhost but does not create the table in the db on the real host. I have debug enables and there does not seem to be a problem. I have tried query but no luck On localhost the wordpress installation is in the root file but on the server the wordpress installation is in a folder called v in the root file. (might make a difference?) The basic code is               function elite_fuel_installl() {      global $wpdb;      $table_name = $wpdb->prefix . "test";      $sql = "CREATE TABLE $table_name (      id mediumint(9) NOT NULL AUTO_INCREMENT,      timeDataCollected datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,      ULP93Inland text NOT NULL,      ULP95Inland text NOT NULL,      ULP93Coastal text NOT NULL,      ULP95Coastal text NOT NULL,      Diesel005 text NOT NULL,      Diesel0005 text NOT NULL,      UNIQUE KEY id (id)      );";                require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );      dbDelta( $sql );                $rows_affected = $wpdb->replace( $table_name, array      ( 'id' => $idd, 'timeDataCollected' => current_time('mysql'),      'ULP93Inland' => $ULP93Inland, 'ULP95Inland' => $ULP95Inland,      'ULP93Coastal' => $ULP93Coastal,'ULP95Coastal' => $ULP95Coastal,      'Diesel005' => $Diesel005,'Diesel0005' => $Diesel0005) );     }               register_activation_hook( __FILE__, 'elite_fuel_installl' );


Contact Form 7 + Configure SMTP: Sender email appearing as my own email

I have Contact Form 7 and Configure SMTP installed on my website. When a user submits a message through the form, everything comes through fine but the sender email is never displayed. Instead, it is displayed as my own email so I have no clue who sent the message. It just shows up as "To: my email, From: my email". Below are my settings for both CF7 and Configure SMTP. Are any of them wrong? Contact Form 7 ![CF7](http://i.stack.imgur.com/UmeSR.jpg) Configure SMTP ![enter image description here](http://i.stack.imgur.com/1p9r5.jpg)


Theme currently showing thumbnails, how to show full size?

My theme, Grisaille, currently shows thumbnails in the post preview on the "home" page. How do I make it so that full size images show both on the "home" page and on the individual post? functions.php:               <?php               if ( ! isset( $content_width ) )         $content_width  = '590';               /**     * Add Menu Support     **/          add_theme_support('automatic-feed-links');     register_nav_menu('main', 'Main Nav');          /**     * Add editor style - recommended according to Theme-Check     **/     add_editor_style('editor-style.css');               /**     * Add custom background with custom background colour fix      * as shown here: http://devpress.com/blog/custom-background-fix-for-theme-developers/     **/          add_custom_background( 'grisaille_custom_background_callback' );          function grisaille_custom_background_callback() {              /* Get the background image. */         $image = get_background_image();              /* If there's an image, just call the normal WordPress callback. We won't do anything here. */         if ( !empty( $image ) ) {             _custom_background_cb();             return;         }              /* Get the background color. */         $color = get_background_color();              /* If no background color, return. */         if ( empty( $color ) )             return;              /* Use 'background' instead of 'background-color'. */         $style = "background: #{$color};";          ?>          <?php          }          /**     * Add custom header     **/          define('HEADER_TEXTCOLOR', '334759');     define('HEADER_IMAGE', ''); // %s is the template dir uri     define('HEADER_IMAGE_WIDTH', 960); // use width and height appropriate for your theme     define('HEADER_IMAGE_HEIGHT', 200);          // gets included in the site header          function grisaille_header_style() {              ?>     <?php     }     // gets included in the admin header     function grisaille_admin_header_style() {         ?>             <?php     }     add_custom_image_header('grisaille_header_style', 'grisaille_admin_header_style');          /**     * Change Excerpt length     **/     function grisaille_new_excerpt_length($length) {         return 20;     }     add_filter('excerpt_length', 'grisaille_new_excerpt_length');          /**     * Change excerpt [...] to something else     **/          function grisaille_new_excerpt_more($more) {         global $post;         return ' ...
ID) . __('">keep reading', 'grisaille');     }     add_filter('excerpt_more', 'grisaille_new_excerpt_more');          /**     * Thumbnail support     **/          add_theme_support( 'post-thumbnails' );       set_post_thumbnail_size( 590, 275, true ); // 590 pixels wide by 275 pixels tall, hard crop mode     add_image_size( 'following-post-thumbnails', 590, 275, true ); // 590 pixels wide by 275 pixels tall, hard crop mode          // THIS LINKS THE THUMBNAIL TO THE POST PERMALINK     add_filter( 'post_thumbnail_html', 'grisaille_post_image_html', 10, 3 );     function grisaille_post_image_html( $html, $post_id, $post_image_id ) {              $html = '' . $html . '';              return $html;     }          /**     * Google font API - adding Ubuntu font     **/     function grisaille_enqueue_scripts_styles() {              wp_enqueue_style( 'Marvel', 'http://fonts.googleapis.com/css?family=Marvel');                                                      }          add_action('wp_enqueue_scripts', 'grisaille_enqueue_scripts_styles');           /**     * checks if the visitor is browsing either a page or a post and adds the      * JavaScript required for threaded comments if they are     **/     function grisaille_queue_js(){       if (!is_admin()){         if ( is_singular() AND comments_open() AND (get_option('thread_comments') == 1))           wp_enqueue_script( 'comment-reply' );       }     }     add_action('get_header', 'grisaille_queue_js');          /**     * register_sidebar()     **/          add_action( 'widgets_init', 'grisaille_register_sidebars' );          function grisaille_register_sidebars() {              /* Register the 'primary' sidebar. */         register_sidebar(             array(                 'id' => 'grisaillesidebar',                 'name' => __( 'Grisaille Sidebar', 'grisaille' ),                 'description' => __( 'Main right sidebar.', 'grisaille' ),                 'before_widget' => '
',                 'after_widget' => '
',                 'before_title' => '
',                 'after_title' => '
'             )         );          }             /**     * Load the Theme Options Page for social media icons     */     require_once ( get_template_directory() . '/inc/theme-options.php' );               /**     * Loads the theme's translated strings     */          add_action('after_setup_theme', 'grisaille_language_theme_setup');     function grisaille_language_theme_setup(){         load_theme_textdomain('grisaille', get_template_directory() . '/lang');     }        ?>      index.php:               <?php            get_header();            if (have_posts()): ?>
       <?php while (have_posts()) : the_post(); ?>              <li id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?>
            <?php comments_popup_link('0', '1 ', '%'); ?>

<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_time('F j, Y'); ?> <?php _e('by', 'grisaille'); ?> <?php the_author(); ?>

           <?php the_post_thumbnail('following-post-thumbnails'); ?>           <?php the_excerpt(__('keep reading', 'grisaille')); ?>
           <?php wp_link_pages(                     array(  'before'           => '
' . __('Pages:', 'grisaille'),                             'after'            => '
',                             'next_or_number'   => 'number',                             'nextpagelink'     => __('Next page', 'grisaille'),                             'previouspagelink' => __('Previous page', 'grisaille'),                             'pagelink'         => '%')); ?>
<?php _e('Category', 'grisaille'); ?> <?php the_category(', ') ?> | <?php _e('Tags', 'grisaille'); ?>: <?php the_tags(' '); ?>

              <?php comments_template(); // Get wp-comments.php template ?>              <?php endwhile; ?>
          <?php else: ?>
<?php _e('Sorry, no posts matched your criteria.', 'grisaille'); ?>
            <?php endif; ?>
<?php next_posts_link( __('« Older Entries', 'grisaille')); ?>

<?php previous_posts_link( __('Newer Entries »', 'grisaille')); ?>
                                      <?php       get_footer();     ?>


How to add a new taxonomy link to the admin menu

I am looking to add a new admin menu item from my plugin call "Tickers" under "Post", with the link similar to "Tags", but point to               /wp-admin/edit-tags.php?taxonomy=tickers      What I have so far is               add_action('admin_menu', array($this,'admin_menu'));     function admin_menu () {          add_options_page();         }      I am not sure what are the right parameters to pass to add_options_page. Any help would be much appreciated. **Edit** Answer provided below lead me to http://themergency.com/generators/wordpress- custom-taxonomy/, which can generate the custom taxonomy functions for you.


Simply poll & Events Calendar plugins clashing

I'm using two plugins that seem to clash: http://wordpress.org/extend/plugins/simply-poll/ http://wordpress.org/extend/plugins/the-events-calendar/ When both activated only the poll plugin shows in the admin menu but when it's deactivated the calendar plugin shows in it's place. Is there a way to get both plugins working together as they're exactly what I need. I'm running the latest version of WP. p.s It's more than likely that the problem lies with the poll plugin!


Converting fopen/fwrite operations to WP_filesystem

In the function below, I'm trying to convert the fopen/fwrite/fclose methods to the preferred WP_filesystem methods. Everything works as expected using the commented out script block, however, the WP_filesystem methods always return the error block. Any ideas what I'm doing wrong?               function so_doHtaccess(){     if ( !current_user_can( 'manage_options' ) ) return;              if ( file_exists( get_home_path() . ".htaccess" ) ) {             $htaccess_file = get_home_path() . ".htaccess";             $htaccessnew   = get_option('my_updated_htaccess');          /*             if ( is_writeable( $htaccess_file ) ) {                 $f = fopen( $htaccess_file, 'w+' );                 fwrite( $f, $htaccessnew );                 fclose( $f );             }     */                 WP_Filesystem();                 global $wp_filesystem;                      $f = $wp_filesystem->get_contents($htaccess_file);                      if ( ! $wp_filesystem->put_contents( $f, $htaccessnew, 0644) ) {                     echo "There was an error saving the htaccess file. As a result no changes were made";die;                 }              }          return;          }      When I var_dump($wp_filesystem) it yields:               object(WP_Filesystem_Direct)#358 (4) {      ["verbose"]=> bool(false) ["cache"]=> array(0) { }      ["method"]=> string(6) "direct"      ["errors"]=> object(WP_Error)#361 (2) {          ["errors"]=> array(0) { }          ["error_data"]=> array(0) { }      } }


How do I determine if a certain term is in an array?

I am currently running the below wordpress php and it is creating a list for me.               $term = get_term_by( 'id', $ptc, $taxonomy );     echo '
slug .'/' .  $term->slug . '">' . $term->name . '
';      However, I need it to check to see if $term is in_array $product_terms so I tried:               $term = get_term_by( 'id', $ptc, $taxonomy );                     if(in_array($term, $product_terms)){                          echo '
slug .'/' .  $term->slug . '">' . $term->name . '
';                     } else {                         echo '
slug .'/' .  $term->slug . '">' . $term->name . '
';                     }      But it still returns none with the extra class even though I know one of them is in the array... Any ideas how to make this work?


Only allow administrators and editors to access wp-admin

I am trying to restrict access to wp-admin so that only administrators and editors are allowed. At the moment I am using this function:               function restrict_admin(){         //if not administrator, kill WordPress execution and provide a message         if ( ! current_user_can( 'manage_options' ) ) {             wp_die( __('You are not allowed to access this part of the site') );         }     }     add_action( 'admin_init', 'restrict_admin', 1 );      But this does the job only for administrator; editors are not allowed to access this part of the site. What can I do?


Setting pages for posts

This is my json rest api function. When called, it returns 24 posts, but there are much more in total. How can I page the response so I can change pages with something like `?page=2` to be added to curl request route.               public function posts(){          $args = array(         'posts_per_page'   => 24,                  'offset'           => 0,         'meta_key'         => $meta_key,         'orderby'          => $orderby,         'order'            => 'DESC',                'post_type'        => 'videos',         'post_status'      => 'publish',         'suppress_filters' => true );              $posts_array = get_posts( $args );              foreach ($posts_array as $rate_posts){             $get_author_id = $rate_posts->post_author;             $author_data = get_userdata( $get_author_id );             $city = get_the_author_meta( 'city', $author_data->ID );             $phone = get_the_author_meta( 'phone', $author_data->ID );                  $data['User_id']=$get_author_id;             $data['Username']=$author_data->user_nicename;             $data['City']=$city;             $data['Phone']=$phone;             $data['Post_id'] =$rate_posts->ID;        }        return $data;


How to query WP Multisite primary site link

Currently I have created a multisite for my client. Within the network, there are a (primary)corporate site, a newsbites site and a blog site. Is there a way to query the primary site link, so that newsbites and blog site can connect back to the (primary) corporate site, without hard coding the site url?


How to set the width and height rule for featured image

I want to know how to make rules to re-size the images for `featured image`? I am uploading an image in `featured image` section but it is not cropping the images in exact width and height for all the images. I need `(width:100 X height:140)`. So how to do that? Any help and suggestions are welcome.


How to charge shipping in WP e-commerce based on a variant?

I have a client that wants to charge different shipping rates based on a size variant (small, medium, large). She does not have the weights or size in inches of each item, she only wants to assign the shipping for each item based on whether the shopper chooses small, medium, large or extra large for the size of the item. Is there a way to assign a shipping price in WP e-commerce using a variant and still have it show as the shipping cost?


custom comments form for custom post type

Hello everyone I am creating a theme dedicates to hotels display and booking in which I have created a custom post type 'Hotels' so now I want a mechanism to book the hotel rooms and a "book now" button in the hotel page to book the room which will send a request to the admin and also send an acknowledgement mail to the user for this I thought if I make some changes in comments form for post type hotel and display the comments form throw a comments_popup_link(); and add some more meta fields throw add_comments_meta(); * * * But the question is how can I display the different custom comments(book now) requests in the admin panel with all the comments meta information related to the comments. Is it possible or do I have to think of some different mechanism to do what I'm expecting.


Replace the "widgets" label in the backend

Is it possible to replace/modify the "Widgets" label in the backend by an other label ? ... and do the same thing for the "Widgets" title in the widget page. Is there a filter or another solution ?


Permalink redirection from 'Day and name' to 'Post name'

In my blog, I used the Day and name permalink structure for many days. Recently I came to know the SEO tips and made the permalink structure to Post name. So I migrated from:                 http://nishachor.com/%year%/%monthnum%/%day%/%postname%/      to:               http://nishachor.com/%postname%/      It's very simple for me. But not for the WordPress. **_I have many posts interlinked with each other, hand coded in posts._** And their paths're in archive structure. Now in post name structure they are producing 404 error. I used the redirection plugin, but doing a 301 redirection as mentioned above (from & to), is not working for me. I cleared my WP Super Cache's cached files and the browser's too. In Yoast's SEO Plugin I got another permalink redirection, but not the one I want. Please remember that, I don't have any structure like: domain.com?p=2 or something like that. I just want the archive portion in the URL (`%year%/%monthnum%/%day%`) should be removed and my posts to be loaded. To me both the structure are very simple and should redirect from one to another, as they both are in a common platform. But why the permalink structure changing won't redirect itself? Now I need to edit each and every page to edit the hand-coded links. :( The question is: **How can I solve the problem regarding permalink structure day and name to post name?**


How to create a custom template to admin dashboard

I was trying to create a template to customize my WP admin dashboard, not only a css mod but a entirely renew to my customers. I've successfully created a page template for a custom login page, and it worked fine, but now, the biggest problem is how to redirect admin pages to custom ones? And plus, how to call admin functions on this page? Any help will be appreciated, thanks


Non english charcters support for WP Customer Reviews

I've been looking all over for a fix for WP Customer Reviews. It is showing question marks on submitted reviews when entering none English characters. The translation it self is quite trivial, You can just edit the plugin. But instead of Hebrew characters I see question marks.


Define a post's title and slug from Custom Fields

This question is relate to another one on WPSE: Set post title from two meta fields I am looking for a way to define a WP custom post type's **title** and **slug** from a _custom field_ (i.e. first name and last name). Such that if I enter "John" in the fname field and "Doe" in the lname field, the title would be "John Doe" and the slug would be "john-doe". The solution offered on thread linked above works but it requires that I "save draft" first before I hit "publish". If I click on "publish" right away, the post title is nothing but a single dash/hyphen "-" and the slug is the post ID. Anyone know how to make it work without the need to "save draft" first? --- Update --- Here's the code I'm using. It's based on the linked thread above.               function my_set_empname_title( $data , $postarr ) {         if($data['post_type'] == 'employees') {             $emp_fname = get_post_meta($postarr['ID'], 'emp_first_name', true);             $emp_lname = get_post_meta($postarr['ID'], 'emp_last_name', true);             $new_title = "$emp_fname" . '-' . "$emp_lname";             $post_slug = sanitize_title_with_dashes($new_title, '', $context = 'save');             $post_slugsan = sanitize_title($post_slug);             $data['post_title'] = $new_title;             $data['post_name'] = $post_slugsan;         }         return $data;     }     add_filter( 'wp_insert_post_data' , 'my_set_empname_title' , '99', 2 );


How does the filter post_updated_messages work?

I'm following a tutorial about custom post types and I am unable to understand how some functions work. Allow me to explain a little more.               function my_updated_messages( $messages ) {     global $post, $post_ID;     $messages['product'] = array(         0 => '',          1 => sprintf( __('Product updated. View product'), esc_url( get_permalink($post_ID) ) ),         2 => __('Custom field updated.'),         3 => __('Custom field deleted.'),         4 => __('Product updated.'),         5 => isset($_GET['revision']) ? sprintf( __('Product restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,         6 => sprintf( __('Product published. View product'), esc_url( get_permalink($post_ID) ) ),         7 => __('Product saved.'),         8 => sprintf( __('Product submitted. Preview product'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),         9 => sprintf( __('Product scheduled for: %1$s. Preview product'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),         10 => sprintf( __('Product draft updated. Preview product'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),     );     return $messages;     }     add_filter( 'post_updated_messages', 'my_updated_messages' );      I have copied part of the tutorial code snippet above. In this example, I do know that $messages contains and array which has certain post types. To allow custom messages to a custom post type, a new array is made and then returned. The function my_updated_message() is then filtered (I know what add_filter does). Okay, the questions:   1. When a new function has a parameter, the parameter has to be passed when the function is called right? In the case above, how does WP know that $messages is in fact, $messages from WP?   2. Sorry for being totally unrelated to the context above, but why does var_dump($post_updated_messages); return null to me. I want to see what's inside. A detailed explanation or a link to any tutorial would be greatly appreciated.


Comment_author_url doing nothing

I have this function:               <?php     function top_comment_authors($amount = 5) {     global $wpdb;     $results = $wpdb->get_results('         SELECT         COUNT(comment_author_email) AS comments_count, comment_author_email, comment_author, comment_author_url         FROM '.$wpdb->comments.'         WHERE comment_author_email != "" AND comment_type = "" AND comment_approved = 1         GROUP BY comment_author_email         ORDER BY comments_count DESC, comment_author ASC         LIMIT '.$amount     );          foreach($results as $result) {         $output .= "
comment_author_url.">".$result->comment_author." (".$result->comments_count.")
";     }          echo $output;     }     ?>      So here, I am trying to link to the comment_author_url (the author page), but it does not do a thing. How can this be? What am I doing wrong?
comment_author_url.">


How can I access the "description" of a menu item?

Where you can add your menu in under appearance > menus, I have descriptions in. In my page, I want to be able to echo out that description. Not in the menu, but in my page. How can I access this information? EDIT: @toscho How do I edit my custom walker? Does the object $item have access to the page excerpt?               class description_walker extends Walker_Nav_Menu     {             function start_el(&$output, $item, $depth, $args)       {         global $language;            global $wp_query;          global $post;          global $polish_name;            $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';            $class_names = $value = '';                 $classes = empty( $item->classes ) ? array() : (array) $item->classes;                 $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );            $class_names = ' class="'. esc_attr( $class_names ) . '"';                 $output .= $indent . '
ID . '"' . $value . $class_names .'>';                 $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';            $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';            $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';            $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';                 $prepend = '';            $append = '';                       $item_output = $args->before;             $item_output .= '';           if($language=="polish"){                $item_output .= $args->link_before .$prepend.apply_filters( 'the_title', $item->description, $item->ID ).$append;                 }else{             $item_output .= $args->link_before .$prepend.apply_filters( 'the_title', $item->title, $item->ID ).$append;            }                       $item_output .= '';             $item_output .= $args->after;                       $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );             }     }


What is the best way to include a template file within a shortcode?

I'm writing a shortcode for a child-theme. I want to load a php template file to generate my HTML and then output this HTML in a string to return this string. But I don't know the best way to do this. The Codex mentions the `ob_start` function but it seems to me a bit dirty. Are there any template functions (like those in PHP frameworks when you load a view) to do this?


I would like to list tags with count in author profile page just like this page If the user click the tag, then I would like to list the tagged posts. Can someone help me?


get_option returns undesired blank instance of a widget

I am presently trying to call the fields of a custom widget using get_option and loop through the array created from the get_option() call. The issue is that it is outputting a blank one at the end, resulting in one extra than what I have enabled. Here is the code I have at the moment:                           $the_team = get_option('widget_jcMeetTeam');                 $the_id = 1; //used for an ID increment for the jquery this will be used for                 print_r ($the_team);         if (count($the_team) > 1) {                 foreach ($the_team as $team_member) {                         extract($team_member);                                      echo '

'.$team_member['jc_name'].'
;
Occupation: '.$team_member['jc_occupation'].'

Favorite Wine: '.$team_member['jc_favwine'].'

About: '.$team_member['jc_about'].'

 ';                         ++$the_id; //increment for next panel ID                 }         }       I am presently trying to figure out how to get the loop to stop before the last blank one gets displayed, giving an accurate listing of active widget instances.


Child Theme version is set by parent theme, that isn't correct

I'm using Genesis as my theme framework, and while Genesis is at version 2.0.1, my theme is a different version (1.0). When it adds the style.css line in the header call it is appending the wrong version... the one from the parent theme (2.0.1) instead of my theme version.               <link rel='stylesheet' id='child-theme-css'  href='http://localsite.dev/wp-content/themes/mytheme/style.css?ver=2.0.1' type='text/css' media='all' />      I've tried dequeuing the style via `wp_dequeue_style` and `wp_register_style` but nothing really seems to make the change. Any suggestions? Some clarification, in `header.php` there's the standard genesis call to `do_action( 'genesis_meta' );` In my `functions.php` I have attempted to override that with:               remove_action( 'genesis_meta', 'genesis_load_stylesheet' );     add_action( 'genesis_meta', 'my_stylesheet' );     function my_stylesheet() {         $themeDir = trailingslashit( get_stylesheet_directory_uri() );         $cachebuster = time();              // my attempt to remove genesis' child-theme call with the incorrect version         wp_dequeue_style( 'child-theme' );         wp_deregister_style( 'child-theme' );              wp_enqueue_style( 'stylesheet', $themeDir . 'style.css', false, '1.0-' . $cachebuster);     }      EDIT: Genesis style sheet code:               /**      * Enqueue main style sheet.      *      * Properly enqueue the main style sheet.      *      * @since 1.9.0      *      * @uses CHILD_THEME_NAME      * @uses CHILD_THEME_VERSION      * @uses PARENT_THEME_VERSION      */     function genesis_enqueue_main_stylesheet() {              $version = defined( 'CHILD_THEME_VERSION' ) && CHILD_THEME_VERSION ? CHILD_THEME_VERSION : PARENT_THEME_VERSION;         $handle  = defined( 'CHILD_THEME_NAME' ) && CHILD_THEME_NAME ? sanitize_title_with_dashes( CHILD_THEME_NAME ) : 'child-theme';              wp_enqueue_style( $handle, get_stylesheet_uri(), false, $version );          }


How to disable a widget when dependent plugin is inactive?

My widget has a lot of dependent plugins, and disabling one of the plugins results in erratic behavior throughout my entire WP installation. I've been trying to use the function is_plugin_active('Widget_Class_Name') with little to no luck thus far. Is there an effective way to remove the widget altogether if one of its dependent plugins are inactive?


Why is "plugins_loaded" not called/fired?

I am trying call `load_plugin_textdomain` once the plugins are loaded, however this does not happen. I do have a plugin activated, so shouldn't this fire?               add_action("plugins_loaded", "test_override");          function init_localization()     {         echo "init_localization
";         load_plugin_textdomain         (             TEXT_DOMAIN,              false,              LANGUAGE_DIR         );     }          function test_override()     {         echo "text_override
";     }      In another context, when calling `add_action("init", "init_custom_post_types")`, it works fine. It may be of interest to know that I am working on a custom theme. Thanks if you can provide any guidance, or ask if you need to know anything that could help you help me.


Adding markup to column text in "Edit Pages" admin page

I was wondering if there is a way to hook into the column titles in the "All Posts" admin page to modify them. For instance, I would like to change "Post" to "`<strong>Headline</strong>`". Are there any hooks that would let be do this without modifying the WordPress core code? I have found some information about adding columns and modifying custom post type columns, but I could not find any information on modifying the columns that are standard in the "All Posts" screen.


Opening all posts for comments

Is it possible to use the user-interface (front-end) part of Wordpress to open comments on all posts in one (or two) clicks? I have many posts with closed comments which must have happened by mistake, and I want to make them all open comments. Here's the caveat: My host provider doesn't give me `ssh` access into the database, so I can't just run a simple sql `REPLACE` command. Therefore, I need a way to do this from the Administration Panel within wordpress. Thanks!


how to remove category nav from Bueno (Wordpress Theme) header

Im helping a friend who has a woo bueno theme [free] blog and for some reason shes chosen long and numerous categories. these all appear in a nav bar at the very top of her page and it's just got to go. Id appreciate your advice in helping http://veronicapearman.com/


Pre populate WordPress wp_media modal with image selection

I'm the developer of the Advanced Custom Fields plugin and am hoping you can help me out with an issue I am facing. I have a button where you can edit an image. This button will launch a WP 3.5 media modal via the wp_media() function. The problem is that I want to pre-select an image so that it's details are loaded in the sidebar panel. Currently I am hooking into the 'open' callback and running some code which populates this selection, however, it is clunky and in efficient. This is what it looks like:               // _media is an object I am using          _media.frame = wp.media({         title       :   'title',         multiple    :   false,         button      :   { text : 'button' }     });               // open     _media.frame.on('open',function() {                   // add class         _media.frame.$el.closest('.media-modal').addClass('acf-media-modal acf-expanded');                   // set selection         var selection   =   _media.frame.state().get('selection'),             attachment  =   wp.media.attachment( id );                   attachment.fetch();         selection.add( attachment );          });               // Finally, open the modal     _media.frame.open();      This is working fine, until the user opens another modal window, selects the upload tab, then uses the edit button which I have created. Now the code fails completely becuase my code relies on the modal being in the 'browse' mode. I found some code which will swap the frame over to the browse mode, it looks like this:               _media.frame.content.mode('browse');      This works some of the time, but then the following code fails. Like it needs some time to render before the attachment can be added to the selection.... Surely there is a better way. Thanks for your help. Elliot


How to replace featured image upload option with the post media image option

I am looking for a way to insert custom URL links in featured Image as well. Currently Featured image tab is only having these basic settings - ![featured](http://i.stack.imgur.com/TBQvK.jpg) But I want to add custom URL links to my featured image as well, I checked the add media button is having this feature as shown in the screenshot - ![media](http://i.stack.imgur.com/EjRyQ.jpg) Let me know how could I add this in my featured Image tab as well. I checked this http://wp.smashingmagazine.com/2011/10/04/create-custom-post- meta-boxes-wordpress/ & http://www.wpbeginner.com/wp-tutorials/how-to-add- custom-meta-boxes-in-wordpress-posts-and-post-types/ but unable to sort, let me know how could i manage it. I am not very sure whether I can replace the whole featured image upload option with the media with the post media image options as it provides these extra facilities OR I can add an extra custom field option for my Linked URL setting,let me know the easiest option to manage it.


Order custom fields by string length

I am trying to reorder a custom field from one of my Custom Post Types. I'd like to get the custom field string which is called 'first name' and order all of the first names by their string length. Does this makes sense ? Thanks. I have managed to do this which sort the custom fields by the ABC :                   <?php     $args=array(     'post_type' => 'employees',     'posts_per_page' => 150,     'meta_key' => 'wpcf-first-name',     'orderby' => 'meta_value',     'order' => 'ASC');     $my_query = null;     $my_query = new WP_Query($args);     if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?>

<?php the_title(); ?> and what else do is in the loop...

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


Declaratively Configuring Wordpress in XML or JSON or YAML

Couldn't find this on Google... Is there any handy way of fully (or partially) configuring a Wordpress site (plugins and all) using XML/JSON/YAML/etc? In general, I'm looking for a highly-readable, declarative way of setting up Wordpress and to minimize having to deal with PHP.


Custom Twenty Thirteen fonts?

Is it possible to change the fonts? I come from twentyeleven. I am used to declare the fonts in the CSS and upload them in different formats to the sever. I need to use my own custom fonts... I found this: How do I change the fonts in the Twenty Thirteen theme? But I have no experience in PHP so it's Chinese... I did manage to de-register the fonts used by using this piece of code in my child functions.php file.               function deregister_gfonts_wpse_111190() {       wp_deregister_style('twentythirteen-fonts');     }     add_action('wp_enqueue_scripts','deregister_gfonts_wpse_111190',100);


Nivo Slider dissappeared from homepage however still active on other pages, no idea why!

I am using the theme 'Newport' from ThemeForest. Everything was all ok however I took over this site and the previous site manager made a few mistakes so I had to remove a few of his images and replace with valid code. Being not that used to Wordpress and more used to dealing with raw code, I assume I inadvertently deleted a shortcode that displays the banner on the homepage. I have tried everything to get this banner to appear back on the homepage with no luck. I even completely deleted the theme and reuploaded it however still no banner on homepage. As this banner/slider is not a plugin I am struggling to find any documentation or support and I see now that this is part of the Newport theme. In the theme settings, the 'Slider' option is set to Nivo in the 'Homepage' section so it is enabled and should be there. Can anyone help as I'm baffled as to what the problem is?


How can I stop Jetpack mobile theme from using full size featured images?

The site I'm managing is using Jetpack's mobile theme for mobile devices. This works relatively well, except for the fact that for featured images the mobile site loads the full sized image instead of the resized thumbnails used by the desktop theme. With some of the images going up to 3000px wide in their original resolutions, this means that most pages on the site is actually larger on the mobile theme than on desktop. The worst offender is the archive pages, where a large number of featured images is shown. As can be seen here, some pages are 5x as large on mobile. ![](http://i.stack.imgur.com/mb2df.png) This is unacceptable. How can I fix this, preferably without editing the Jetpack theme file itself, since those changes will be gone when I update Jetpack?


Commentform - Hightlight invalid fields instead of prompting towards error page

I have a huge problem. I used the comments.php from "EmptyCanvas". Code of it can be seen here: http://pastebin.com/YHDy2q4a However, it prompts me towards an error page when I do not fill out the fields as required when posting a comment. I'd rather like a highlighting of fields, which I use with CF7 Forms. Code of it can be seen here: http://pastebin.com/uFgf07JB I googled for it, and got redirected to another question which was not making things clear for me. Thanks for any help, Shawn


How to go about combining dropdowns / filter queries?

I'm coming up short with my googling here. (As 'filter' in wordpress always turns up more content related info). Anyway, my situation is this: I have `Categories`, `Tags`, `Authors` and `Archive` dropdowns on my blog page (using the built in wordpress dropdown functionality (http://codex.wordpress.org/Function_Reference/wp_dropdown_categories, for example). I want to be able to combine these filters; such that if you choose a category `Hats`, and then when you have your list of results if you choose `Blue` from the dropdown you would get anything that matched both `Blue` and `Hats`. (Or if you choose a month, you'd get the posts _that_ matched `Blue` and `Hat` from your chosen month.) I know there has to be a way to do this. But I'm coming up short even figuring out where to start. (I'm certain there was a plugin that did this that I wanted to look at, but I can't even find that.) So... If anyone has any ideas about how to start this that would be amazing. Or even just an example plugin I can look at to glean some info (I really want to code this myself so I understand _what_ is going on).


wp_mail - using a custom field value

Can this work? I want to send a email when a post is published to the recipient, that is called in custom field. _EDIT_ I changed the code to another example I found.               function wpr_Notification($post_id) {         $post = get_post($post_id);         $to = get_post_meta($post_id, 'recipient', true);         $headers = 'From: Disctopia Metal Webzine <admin@disctopia.de>';         $title = $post->post_title." has been published";         $message = " Hello ... and so on.... ";              wp_mail($to, $title, $message, $headers);      }      add_action('publish_post', 'wpr_Notification');      Everything works smooth except for the recipient. If I put an static email adress into this field instead of $to, it works. But if I try to get the value of the custom field, it fails. I tried to see whats the value of $to by putting it into the $message and changing the $to to my own email adress. Well, there was no value at all for the $to. What is wrong with this variable? The custom field definitely is called "recipient" and is just a text-string. :(


Have video content populate page from upload sub-directory?

My question yesterday was too broad on this subject, so I will be specific: I teach music classes and at the end of the class, we record several short (30 second-3 minute) videos for the parts people are learning. Up until now, I have directly uploaded all those videos to my network attached storage (NAS). My students have access there. That works great for me, but it is difficult for the students because they need to download each video manually and then play from their computer. Our school has a WordPress site, and I want to be able to send students to a password protected page where they log in and are presented with several folders (a folder for each song). When they open the folder, it takes them to a page that displays all the videos and the users can click on the video and play them directly from the browser. I downloaded the WordPress iPhone app and tried to:   1. create a page.    2. Pick the videos from the phone    3. Upload to the page   4. publish. This sort of works, but every other video is giving me an upload error (IE I think they are too big and time out) and it is very time consuming. Part of the issue is how WordPress handles uploaded media in the library-since there is no subfolder, I don't see how to easily batch upload to specific pages. I downloaded "Media File Manager", but that doesn't work because you have to first upload the files into the library and then move the files manually into the subfolders. So there are the details. Now my question: Is there a way to:   1. Ppload individual videos into sub-folders in the upload folder (I can create the sub-folders with my FTP) (I already know how to do this.)   2. Have individual pages that treat those subfolders as separate galleries.   3. Have the page display all items in the gallery (as playable videos).


Compile errors during translation compile

I am trying to translate a theme using Poedit, every thing is alright except two strings which give me errors like this:               Error: 'msgstr' is not a valid PHP format string, unlike 'msgid'. Reason: The character that terminates the directive number 1 is not a valid conversation specifier.      The string itself is this:               % comments      Both errors are in strings having `% comment` (not sth like `% s`). Now I have two problems: 1. How can I resolve these errors? Do I need to change theme code? 2. After getting these compile errors, I used .mo and .po files anyway but some phrases had been translated and some not! What is the reason to this? EDIT: The PHP code translation associated to is:               comments_number( __('There are no comments so far', 'hbthemes'), __('There is 1 comment so far', 'hbthemes'), __('There are % comments so far', 'hbthemes') );


adding GET variables to a header() location in a page template

header('Location: /page-name/?var1='      . $_GET['var1'] . '&var2=' . $_GET['var2'] );     exit();      The result of the above code ends up redirecting the site to:               http://www.domain.com/page-name/?var1=val1&var2=val2`      I have a feeling Wordpress is cleaning the ampersand in the URL, but I don't at what point it would do that... Edit: With Milo's direction, I modified the redirect code to look like this and it started working properly.               $url = '/page-name/';     $args =  array('var1'=>$_GET['var1'], 'var2' => $_GET['var2']);     $url = add_query_arg($args, $url);     wp_redirect($url);     exit();      I'd still like to know why the ampersand got converted to HTML in the first place.


Sorting Custom Taxonomy in ASC/DESC order?

Before anyone say that I didn't try let me say I tried a lot to achieve this. I even achieved but when I add the following code to functions.php the sorting works but the filters on left side doesn't work.               function orderby_tax_clauses( $clauses, $wp_query ) {     global $wpdb;     $taxonomies = get_taxonomies();     foreach ($taxonomies as $taxonomy) {     if ( isset( $wp_query->query['orderby'] ) && $taxonomy == $wp_query->query['orderby'] )     {     $clauses['join'] .=<<<SQL     LEFT OUTER JOIN {$wpdb->term_relationships} ON {$wpdb->posts}.ID={$wpdb-    >term_relationships}.object_id     LEFT OUTER JOIN {$wpdb->term_taxonomy} USING (term_taxonomy_id)     LEFT OUTER JOIN {$wpdb->terms} USING (term_id)     SQL;                 $clauses['where'] .= " AND (taxonomy = '{$taxonomy}' OR taxonomy IS NULL)";                 $clauses['groupby'] = "object_id";             $clauses['orderby'] = "GROUP_CONCAT({$wpdb->terms}.name ORDER BY name ASC) ";             $clauses['orderby'] .= ( 'ASC' == strtoupper( $wp_query->get('order') ) ) ? 'ASC' : 'DESC';     }     }     return $clauses;     }          add_filter('posts_clauses', 'orderby_tax_clauses', 10, 2 );      This particular code               add_filter('posts_clauses', 'orderby_tax_clauses', 10, 2 );      is creating the problem I think because when I remove this line it filters properly. I think its creating some query conflict and giving " No results found" when I use both filter and soering option. When I use only orting it works and when I use only filter it works. How to make both work together ? This is the site: http://tjdesigners.info/mooctracks/searchresults/? Please help me out! Thank you so much! Tirtha


Change / tweak existing wordpress translations

I have a WP that has a custom theme, and all the translations working fine. Now I (i.e. my client) would like to tweak some wordpress-provided translations that live in `/wp-content/languages/some_LANG.po`. Can I simply alter these files without fear of them being overwritten during an update, or should I handle this from my theme somehow? For example I'd like to change (a bit) the messages related to password protected posts in the frontend.


jQuery not working for tabs shortcode

See reference URL - http://prothemeus.com/demo/fact/shortcodes/ If you take a look at the tabs at the bottom of this page, whenever I click on each tab it doesn't show the content underneath. I've figured out it's a jQuery problem but jQuery isn't my strong suit... Any ideas?


Multisite install w/ Sub domains on a subdomain

I have a Wordpress installation which I have installed on a subdomain `login.mysite.com`. I would like to create additional sites that use the same application on `feed.mysite.com`, but technically this isn't allowed. Because the main installation happened on a subdomain, it forces me to use: `feed.login.mysite.com` Is there a way to get around this, or within my server can I point the sub- sub-domain to a sub-domain? Hope that makes sense.


How to integrate CLEditor to comment system?

I would like to improve the comment editing for user by adding a simple WYSIWYG editor, and I selected CLEditor as possible good candidate because it is light, customizable and jQuery based. I searched if it already exists a plugin that implement it but I was not able to found any. So I decided to write my own plugin. Do you have any suggestions about which Wordpress actions or filters should I look to start?


How to change the url?

How to rewrite the url in wordpress? Instead of http://yapkimyks.com/product-list/astarlar/ it should be http://yapkimyks.com/product-list/yapbond/astarlar/ where, yapbond is main category name astarlar is sub category of yapbond


how to customize rss feed tags using hooks?

My RSS feed is displaying an XML tag which I either want removed, or emptied. The tag in the XML looks like so: `<wfw:commentRss>remove/this/uri</wfw:commentRss>` I have never used hooks before but I know this can be done using them.. Any points in the right direction?


Add custom action in post type

I use the http://www.deluxeblogtips.com/meta-box Metabox plugin and I want to add a custom action in a post type like the publish button ? when admin click on this button I want to send an email to the author and delete the current post type. I have added the button in my post like this :                   // meta box         $meta_boxes[] = array(                 'title' => __('Reviewer','sparta'),                 'pages' => array( 'download'),                 'fields' => array(                     array(                 'name' => __('Reject','sparta'),                 'desc' => __('reject this                  post.','sparta'),                           'id' => $prefix . 'reject_post',                           'type' => 'button',                           'std' => ''                     )));      My question is how to execute my action from this button ? someone has an idea ? Thank you very much


Get author meta of all writers

We know from the docs that you can get an author's meta like so:               <?php get_the_author_meta( $field, $userID ); ?>       But I would like to have a custom "About us" page which displays all the information of users with a specific role (admins and writers in this case). Let's say I have a function (which uses custom fields of the profile) in `functions.php` like so:               <?php function the_author_box($userid) { ?>

<?php echo get_avatar($userid); ?>

<?php the_author_meta('display_name',$userid); ?>

<?php the_author_meta('description',$userid); ?>

           <?php if (get_the_author_meta('url',$userid)) { ?>
               <a href="<?php the_author_meta( 'url',$userid ); ?>" title="De website van <?php the_author_meta( 'display_name',$userid ); ?>">Website
           <?php if (get_the_author_meta('twitter',$userid)) { ?>
               <a href="http://twitter.com/<?php the_author_meta( 'twitter',$userid); ?>" title="Volg <?php the_author_meta( 'display_name',$userid); ?> op Twitter">Twitter

     <?php } ?>      I am guessing I can get all the user IDs with `get_users`. I do not need to get all the roles at the same time, so I can first get all the admins and then all the writers.               $admins = get_users('role=administrator&fields=ID');     $writers = get_users('role=author&fields=ID');      And then call the function:               <?php        foreach ($admins as $user) {         the_author_box($user);       }       foreach ($writers as $user) {         the_author_box($user);       }     ?>      After testing, it seems that only the author of the page is called **or** the first profile in the loop. My profile ID (alphabetically the first one, and also the author of that page) is put in the function, but the others are not.   * I only want a user to be displayed once   * Other profiles should be returned as well, but they don't seem to be put in a loop


multisite: global menu containing network site links?

Can I create one single menu that   1. appears on every page within the network and   2. contains every site and page that exists within the network? I'm talking about the following structure:   * Main Site      * Sample Page 1      * Sample Page 2     * Network Site A        * Sample Page A1        * Sample Page A2     * Network Site B        * Sample Page B1 Is it possible to create a menu that looks like this?


Any good lightbox-like option that works in WP 3.2.1?

I'm having problems finding a "plugin" that will help me display some of my images in a nice way such as prettyPhoto, Lightbox etc. As I'm already using the jQuery library, I'd prefer a plugin that works with jQuery rather than Scriptaculous. I tried to implement the newest version of prettyPhoto as well the the jQuery based Lightbox plugin (that hasn't been updated recently). Both seem to have several issues with Wordpress 3.2.1 Googling just showed me that others had similar problems, but I couldn't find a good answer or solution to this yet. I'd prefer not to use another WP plugin and rather implement it myself, but before trying out all the options out there just to see that they won't work well with the newest WP version, I thought it might be a better idea to ask here. Is here anybody using s.th. similar what I'm looking for successfully in the newest WP version? Thanks a lot in advance.


How to add class or id to shortcode HTML elements?

I have a row elements and 3 columns inside :               [row]     [one_third]1[/one_third]     [one_third]2[/one_third]     [one_third]3[/one_third]     [/row]      How can I add a custom class or id to [row] element ? I need to squeeze cols 1 and 3 closer to 2 by modifying their margins.


CMB select with data from CPT

I'm using the CMB framework for creating metaboxes (https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress) and I want to add a select box which prepopulates with titles from a custom post type. A normal select box looks like:               array(         'name' => 'Test Select',         'desc' => 'field description (optional)',         'id' => $prefix . 'test_select',         'type' => 'select',         'options' => array(             array('name' => 'Option One', 'value' => 'standard'),             array('name' => 'Option Two', 'value' => 'custom'),             array('name' => 'Option Three', 'value' => 'none')                       )     ),      I want to do something like:               array(         'name' => 'Test Select',         'desc' => 'field description (optional)',         'id' => $prefix . 'test_select',         'type' => 'select',         'options' => array(             query_posts( array( 'post_type' => 'myposttype' ) )     ),      where the select options are populated from the titles of a custom post type.. but it's not working the way I though. Any Ideas?


What problems can BuddyPress make?

I took a brief look into Buddypress yesterday and was just overwhelmed by the massive amount of template files that got added (during installation) to my theme. After looking over the template files, I couldn't get rid of the feeling that BuddyPress is - maybe only in parts? - written pretty crappy. If I'm planning on going with BuddyPress:   * What are the _minetraps_ I will be facing?   * What are the weak points?   * ( _alt._ ) Are there any alternative (messaging, grouping, friend requests) plugins?