title: Create Image Uploader for Widget

text:
I found this post// Use Media upload in custom widget on wordpress 3.5 I'm not experienced in any of this so I pretty much just copied the code he provided into my own functions.php file. I uploaded the JS and everything... I then replaced certain code that "sven" posted in his answer. The uploader works perfectly but when I view front end the image isn't even displayed... Here is the code within my functions.php// (it includes the registered sidebars and the custom widget etc)                if (function_exists('register_sidebar')) {      register_sidebar(array(       'name' => 'Left Sidebar',       'id'   => 'left-sidebar',       'description'   => 'Widget Area',       'before_widget' => '

EOTW//
',       'after_widget'  => '
',       'before_title'  => '
',       'after_title'   => '
'      ));     }               add_action('widgets_init', 'ctUp_ads_widget');     function ctUp_ads_widget() {     register_widget( 'ctUp_ads' );     }          function ctUp_wdScript(){     wp_enqueue_media();     wp_enqueue_script('adsScript', get_template_directory_uri() . '/js/ads.js');     }     add_action('admin_enqueue_scripts', 'ctUp_wdScript');          class ctUp_ads extends WP_Widget{          function ctUp_ads() {         $widget_ops = array( 'classname' => 'ctUp-ads' );         $control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => 'ctUp-ads-widget' );         $this->WP_Widget( 'ctUp-ads-widget','EOTW', $widget_ops, $control_ops );     }          public function widget($args, $instance){          extract( $args );        ?>     <img src="<?php echo esc_url($instance['image_uri']); ?>" />     <?php }          function update($new_instance, $old_instance) {         $instance = $old_instance;         $instance['text'] = strip_tags( $new_instance['text'] );         $instance['image_uri'] = strip_tags( $new_instance['image_uri'] );         return $instance;     }          public function form($instance){ ?>
       <label for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Text', 'themename'); ?>
       <input type="text" name="<?php echo $this->get_field_name('text'); ?>" id="<?php echo $this->get_field_id('text'); ?>" value="<?php echo $instance['text']; ?>" class="widefat" />

       <label for="<?php echo $this->get_field_id('image_uri'); ?>">Image
         <img class="custom_media_image" src="<?php if(!empty($instance['image_uri'])){echo $instance['image_uri'];} ?>" style="margin:0;padding:0;max-width:100px;float:left;display:inline-block" />         <input type="text" class="widefat custom_media_url" name="<?php echo $this->get_field_name('image_uri'); ?>" id="<?php echo $this->get_field_id('image_uri'); ?>" value="<?php echo $instance['image_uri']; ?>">         <input type="button" value="<?php _e( 'Upload Image', 'themename' ); ?>" class="button custom_media_upload" id="custom_image_uploader"/>
     <?php } }  ?>      Here is the JS//               jQuery(document).ready( function(){     function media_upload( button_class) {     var _custom_media = true,     _orig_send_attachment = wp.media.editor.send.attachment;     jQuery('body').on('click',button_class, function(e) {         var button_id ='#'+jQuery(this).attr('id');         /* console.log(button_id); */         var self = jQuery(button_id);         var send_attachment_bkp = wp.media.editor.send.attachment;         var button = jQuery(button_id);         var id = button.attr('id').replace('_button', '');         _custom_media = true;         wp.media.editor.send.attachment = function(props, attachment){             if ( _custom_media  ) {                jQuery('.custom_media_id').val(attachment.id);                 jQuery('.custom_media_url').val(attachment.url);                    jQuery('.custom_media_image').attr('src',attachment.url).css('display','block');                } else {                 return _orig_send_attachment.apply( button_id, [props, attachment] );             }         }         wp.media.editor.open(button);         return false;     });     }     media_upload( '.custom_media_upload');     });      Now my question is, what exactly do I have to fix in order for this image uploader to work? I figured the updates "sven" provided would help but clearly I am missing something. Please Help.


title: How to redirect all pages of a blog to a new blog

text: I have two wordpress blogs integrated with two different websites. Both websites have the following structure.               www.mysite.com     -root       -index.html       -about.html       -blog (folder which contains wordpress blog)           www.mynewsite.com         -root           -index.html           -about.html           -blog (folder which contains wordpress blog)      I have exported all the blog posts and pages from www.mysite.com to the blog of www.mynewsite.com, now I want to do 301 redirect to all the pages/post of blog of www.mysite.com to blog of www.mynewsite.com. How can I achieve this?


title: Paginated HTML Sitemap

text: I've got to the point where I needed to break down my HTML Sitemap into several pages. It contained 2000+ links. The big layout was showing all post titles under category names on one page. I decided to break it down (paginate it) by alphabetical order using WP_Query, so each page would contain about 60 post titles (links). Also on every page beside the post titles, respective category links were shown and plus one other custom taxonomy. I did it, and thought it will be OK, Google wise and Users wise. However soon after, I was bombarded with emails. Users were not liking the new paginated/alphabetical look of the HTML Sitemap. They wanted quick access to all posts from one page (or less number of pages as possible). I reverted back. I can't keep that big page, but in the same time I have to go with the Users. So, is there a way where I can split the HTML Sitemap into pages, and each page to contain posts titles (links) from several categories? I can do this by creating several templates and hard-code the pagination on every template (link them), but that is the hard way. I've looked into multiple loops, nested loops, custom queries, WP_Query, experimenting a lot but it seems I can't achieve what I want, in an elegant and clean way.


title: display recent posts with thumbnail within masonary

text:
On a page-template, I need to display recent 10 posts. So I tried to use, `wp_get_recent_posts`, found here in the codex, which I think is an appropriate hook for the purpose.The rest of the code is from my archive.php which displays the post-thumbnails in masonry just fine. I simply would like to achieve the same thing with the recent posts. This is what my code looks like :               <?php      /*      Template Name: Recent Profiles      */               get_header();      ?>
<?php the_title(); ?>

               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
      <div <?php post_class(); ?> id="featured-<?php the_ID(); ?>">                              <?php         $args = array( 'numberposts' => '10' );         $recent_posts = wp_get_recent_posts( $args );         foreach( $recent_posts as $recent ) {         if ( has_post_thumbnail($recent["ID"])) {                 echo '';             echo get_the_post_thumbnail($recent["ID"], 'archive_grid');             echo '';         }     }     ?>

          <?php endwhile; endif; ?>          <?php get_template_part('includes/index-loadmore'); ?>

                 <?php dt_pagination(); ?>

          <?php get_footer(); ?>      Issue : The issue is, the code is just displaying one recent post thumbnail instead of the expected 10. Please help me out for what I might be missing here. Perhaps something wrong with the loop. FYI `archive_grid` is the name of the custom thumbnail.


title: List all posts in a category with query_post() function

text:
I'm a `C programmer`, konw little about `PHP`. I built a Blog with wordpress. Yestoday, I try to create the page `www.abc.com/server`, this page would list all posts which belong to `server` category. I found some useful information in wordpress document and Google I created a template like this:               <?php      /*       * Template name: list_catetory       */     ?>          <?php get_header(); ?>         ...         <?php          query_posts( 'cat_name = $pagename' );         if(have_posts()) : while(have_posts()) : the_post(); ?>         <div class="post-list"  id="post-<?php the_ID(); ?>">
                  <a href="<?php the_permalink() ?>" title=""><?php the_title(); ?>                  ....

               <?php endwhile; ?>          <?php wp_reset_query(); ?>          ...     <?php get_footer(); ?>      I create a page named `server` with this template. then I open this page, I found this page list all post. Why it lists all post, not only list the posts belong to `server` category


title: WordPress plugin installation error

text: I have installed WordPress 3.8 and now I am trying to install `WooCommerce - excelling eCommerce 2.0.20` plugin but every time I am getting this error: **Note: I am trying to install plugin in local machine.**               Fatal error: Maximum execution time of 60 seconds exceeded in M:\XAMPP\htdocs\woocommerce\wp-includes\class-http.php on line 1327      I have tried with bellow code:   1. `php.ini` (in wp-admin folder) memory_limit = 32M   upload_max_filesize = 100M   upload_max_filesize = 100M   post_max_size = 32M   file_uploads = On   2. `wp-config.php` `set_time_limit(60);` but still I am facing this error. I know this very common issue but I need your help to solve this issue. I will appreciate If you help me :) Thanks


title: wp_user_roles and Advanced Manipulation

text: I removed a line from my wp_user_roles to manually remove a role I had created and now the sites administration gives me an "You do not have sufficient permissions to access this page." error. I cannot get in and don't know how to fix what was inside. I've tried pasting in the default user roles in wp_user_roles:               a:5:{     s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:54:{s:13:"switch_themes";b:1;s:11:"edit_themes";b:1;s:16:"activate_plugins";b:1;s:12:"edit_plugins";b:1;s:10:"edit_users";b:1;s:10:"edit_files";b:1;s:14:"manage_options";b:1;s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:6:"import";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:8:"level_10";b:1;s:7:"level_9";b:1;s:7:"level_8";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;s:12:"delete_users";b:1;s:12:"create_users";b:1;s:17:"unfiltered_upload";b:1;s:14:"edit_dashboard";b:1;s:14:"update_plugins";b:1;s:14:"delete_plugins";b:1;s:15:"install_plugins";b:1;s:13:"update_themes";b:1;s:14:"install_themes";b:1;}}     s:6:"editor";a:2:{s:4:"name";s:6:"Editor";s:12:"capabilities";a:34:{s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;}}     s:6:"author";a:2:{s:4:"name";s:6:"Author";s:12:"capabilities";a:10:{s:12:"upload_files";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;}}     s:11:"contributor";a:2:{s:4:"name";s:11:"Contributor";s:12:"capabilities";a:5:{s:10:"edit_posts";b:1;s:4:"read";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;}}     s:10:"subscriber";a:2:{s:4:"name";s:10:"Subscriber";s:12:"capabilities";a:2:{s:4:"read";b:1;s:7:"level_0";b:1;}}}      but still get the error for my administrator user account. Any help would be much appreciated.


title: About redundant code when I use shortcode to output the HTML from a variable

text:
I use shortcode to output the following html in a variable, but there are too many redundant code such as br and p tags, how to remove them? Thanks! HTML MAKEUP               $return_html.='
ID.'">post_title.'">
'.$post->post_title.'

'.van_truncate($post->post_content,100).'

post_title.'">ZoomInID).'" class="info">Info
     ID).'" class="item">
';      Current shortcode function               add_shortcode('portfolios', 'van_portfolios_shortcode');     function van_portfolios_shortcode( $atts, $content) {         extract(shortcode_atts(array(             'number'=>'9',             'slug'=>''         ), $atts));         $str=van_portfolios($slug,$number,false);        return $str;     }          function van_process_shortcode($content) {         global $shortcode_tags;         // Backup current registered shortcodes and clear them all out         $orig_shortcode_tags = $shortcode_tags;         $shortcode_tags = array();         add_shortcode('portfolios', 'van_portfolios_shortcode');              // Do the shortcode (only the one above is registered)         $content = do_shortcode($content);         // Put the original shortcodes back         $shortcode_tags = $orig_shortcode_tags;         return $content;     }     add_filter('the_content', 'van_process_shortcode', 7);      Correct makeup is

...

...

ZoomInInfo
                ...
      Output:

...

...

ZoomInInfo

...


title: How to limit post query to only return a total count of items with certain post statuses?

text: I have a couple functions that are creating an admin table to display on my custom dashboard page. I'm having a little trouble with the function that determines what pages to display because I'm not sure how to restrict my query to not count items that had a post status of 'auto-draft' or 'trash'. Anyone know how to do that? I'll need $totalitems to only count the ones without those post statuses. Here's my function:               /**                          * Prepare the table with different parameters, pagination, columns and table elements                          */                         function prepare_items() {                             global $wpdb, $_wp_column_headers;                             $screen = get_current_screen();                                  /* -- Preparing your query -- */                             $query = "SELECT * FROM $wpdb->posts";                                  /* -- Ordering parameters -- */                             //Parameters that are going to be used to order the result                             $orderby = !empty($_GET["orderby"]) ? mysql_real_escape_string($_GET["orderby"]) : 'ASC';                             $order = !empty($_GET["order"]) ? mysql_real_escape_string($_GET["order"]) : '';                             if(!empty($orderby) & !empty($order)){ $query.=' ORDER BY '.$orderby.' '.$order; }                                  /* -- Pagination parameters -- */                             //Number of elements in your table?                             $totalitems = $wpdb->query($query); //return the total number of affected rows                                  //How many to display per page?                             $perpage = 15;                             //Which page is this?                             $paged = !empty($_GET["paged"]) ? mysql_real_escape_string($_GET["paged"]) : '';                             //Page Number                             if(empty($paged) || !is_numeric($paged) || $paged<=0 ){ $paged=1; }                             //How many pages do we have in total?                             $totalpages = ceil($totalitems/$perpage);                             //adjust the query to take pagination into account                             if(!empty($paged) && !empty($perpage)){                                 $offset=($paged-1)*$perpage;                                 $query.=' LIMIT '.(int)$offset.','.(int)$perpage;                             }                                  /* -- Register the pagination -- */                             $this->set_pagination_args( array(                                 "total_items" => $totalitems,                                 "total_pages" => $totalpages,                                 "per_page" => $perpage,                             ) );                             //The pagination links are automatically built according to those parameters                                  /* — Register the Columns — */                             $columns = $this->get_columns();                             $hidden = array();                             $sortable = $this->get_sortable_columns();                             $this->_column_headers = array($columns, $hidden, $sortable);                                  /* -- Fetch the items -- */                             $this->items = $wpdb->get_results($query);                         }


title: "Upgrade Network" error: stuck with SSL certificate verification

text: When trying to update one Network/MU install, I got the following error. > Warning! Problem updating https://subdomain-A.example.com. Your server may > not be able to connect to sites running on it. Error message: SSL: > certificate subject name 'example.com' does not match target host name > 'subdomain-A.example.com' As I know that the certificate is valid, etc. I just need to somehow bypass the verification check from WP.


title: How do i remove the title from a specific page

text: Hi need to remove the title of a specific page, this one. I could do               add_filter( 'the_title', ai1ec_remove_title );          function ai1ec_remove_title( $title ) {         if( 'Calendar' === $title ) {             return '';         } else {             return $title;         }     }      but this would also remove the title for any Post / Custom Post, titled calendar, i want to target specifically a page, is there a better way to do this?


title: Changing "Lost Password Email Link" to custom password reset page

text: On the Wordpress site I am working on, subscribers will not be allowed to see anything in the backend at all. Because of that I am creating a custom pages for the Wordpress login page that subscribers can access. On the login form there is a "Lost Password" link. I have managed to redirect most things to my own custom pages, but when someone enters their username in the lost password field, it sends the user an email with a link in it, which redirects them to the Wordpress backend to reset their password. I want to be able to edit that link in the email and redirect them to my own password reset page, but I can't find anywhere to hook in. Can someone give me the right action for hooking into that? I don't want to change any of the Wordpress Core code. Any help would be appreciated. Thanks!


title: How to make each category a subsite?

text: I have a WP site wp.domain.com, and want to make each category a subsite. EG, foo.wp.domain.com would be a WP site that lists only posts in category 'foo', the search limits itself to category 'foo', the archives/etc are limited to 'foo'. There are no category archives unless foo has subcatgories. How do I do this?


title: How to restore deleted post related with deleted users

text: I accidentally deleted post that related to certain users in wordpress because I deleted user. How can I restore those posts? Thank you!


title: Hooking in to replace the Sidebar/Widget areas

text: The Goal: To replace the sidebar on all sites across my network with content loaded from a plugin, _across all themes._ I need a way of over-riding the sidebar/main widget area on all sites across my network. I have written a plugin which generates the sidebar with a function call, but **how can I get this content to completely replace the sidebar?** At present I can only call a hook as `get_sidebar()` happens, not replace that action.               add_action('get_sidebar', 'my_get_sidebar', 11);      Additionally, this makes my sidebar appear on all sidebars on the page, I only want it to overwrite the main one (sidebar-one?) and have the others left blank.


title: Adding An Image To A Custom Taxonomy Term

text: I would like to be able to associate an image with a custom taxonomy term. Ideally, I'd like to provide the end-user with an interface for managing the image directly on the term itself. I have worked with a plugin that provides this functionality (Ultimate Taxonomy Manager) - it may be what I stick with. I'm after the best practice, though, and would like to know if any of you have worked through this before and what solutions you recommend.


title: Does an AJAX call on the Admin Side Automatically include the User Data/Capabilities?

text: I was wondering that if you do an AJAX call on an admin page and I wanted to see if the user had the capability to edit a page, would that info be sent along the call or do I need to manually sent that data?


title: Use the plus sign "+" instead of dash "-" in URLs

text: Is it possible to use the plus sign instead of the dash as the word delimiter in the url? And if so, how exactly would that be done? e.g.: `www.example.com/some-title/` becomes `www.example.com/some+title/` Of course, ideally it would have to work with posts, pages and custom posts.


title: Get JSON from self hosted wordpress site

text: I am very new to wordpress so this may seem basic. I have a **_NON-WordPress_** website in which I would like to consume various blogs (via category/tags etc etc) from my **WordPress** site. **Currently I am using this plugin:** http://wordpress.org/plugins/feed-json/   * Although it works fine, sadly it seems to only return the latest 10 blog entries (0-9) which does not cover all the data I want to interact with.   * I have looked at the documentation for this plugin but I cannot see any way of changing how many entries to return. I have seen this plugin: http://wordpress.org/plugins/json-api/   * Would that plugin solve my problem?    * Is it likely to cause conflicts having two JSON type plugins running at the same time? Any help on this would be much appreciated.


title: Custom page template not recognized with permalinks on

text: The custom page template shows up when I choose any permalink structure with an ID > %post_id% But after I change it to any other structure which does not have **post_id** in it my page defaults to the theme given in index.php.


title: Categories Template Assistance

text:
I have found a tutorial online for creating a custom categories template for my archived posts within a particular category. This however is targetting a specific category ID (see below), is there anyway of creating a template that targets all rather than one specific ID?               <?php     /*     Template Name: Category-Tutorials      * The template for displaying Archive pages.      *      * Used to display archive-type pages if nothing more specific matches a query.      * For example, puts together date-based pages if no date.php file exists.      *      * Learn more: http://codex.wordpress.org/Template_Hierarchy      *      * @package WordPress      * @subpackage Twenty_Eleven      * @since Twenty Eleven 1.0      */          get_header(); ?>

                         <?php if ( is_day() ) : ?>                             <?php printf( __( 'Daily Archives: %s', 'twentyeleven' ), '' . get_the_date() . '' ); ?>                         <?php elseif ( is_month() ) : ?>                             <?php printf( __( 'Monthly Archives: %s', 'twentyeleven' ), '' . get_the_date( 'F Y' ) . '' ); ?>                         <?php elseif ( is_year() ) : ?>                             <?php printf( __( 'Yearly Archives: %s', 'twentyeleven' ), '' . get_the_date( 'Y' ) . '' ); ?>                         <?php else : ?>                             <?php _e( 'Tutorials', 'twentyeleven' ); ?>                         <?php endif; ?>

             <?php $archive_query = new WP_Query('cat=7&showposts=1000');             while ($archive_query->have_posts()) : $archive_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?>
             <?php endwhile; ?>

      I was thinking maybe the following could be changed:               <?php $archive_query = new WP_Query('cat=7&showposts=1000');


title: How do I create a Client Logos section in admin menu?

text: My company is hosting an event where 50 clients will be at an exhibition. I want to create an Ehibitors section with separate admin menu. I want to be able to add Exhibits with custom fields for exhibitor_id, exhibitor_logo_img, exhibitor_title and exhibitor_bio. What is the best way to do this? I dont want to end up with 50 exhibits in one post/page. Ideally, I want 50 separate and sortable pages within a admin menu section. Any ideas? Hope this makes sense, WordPress noob. Cheers,


title: Get the name of user who updated post

text: Does anyone know how to get the name of the user who last updated a post/page please? (Not the post author). I can see that it is visible in the post/page revisions but don't know how to access it. Any ideas/help greatly appreciated.


title: Group images in media library

text: I'm looking for a method to group images in the media library. I'm developing a photo portfolio site. I have uploaded all the images to the media library I need a way to group the images to make them more manageable. At the moment I just have a long list of images.


title: Auto order posts of custom post type by title

text: I have a custom post type which has more than 50 posts. I want to reorder them alphabetically so that each time I post anything the system automatically reorders. Please don't suggest post order plugin, its drag and drop type and would be very very tedious I've added the following code in the functions.php but I keep getting the following error > Parse error: syntax error, unexpected '}'                 function alpha_order_classes( $query )      {         if ( $query->is_post_type_archive('books') && $query->is_main_query() )          {             $query->set( 'orderby', 'title' );             $query->set( 'order', 'ASC' );       }       }          add_action( 'pre_get_posts', 'alpha_order_classes' );      i created the custom post types using plugin simple custom posttype


title: Plugin: Posts 2 Posts problems with private posts

text: I'm trying to connect two private posts to each other and it doesn't work! but the same code work correctly for other published posts. Even if i connect a published post to a private post, in dashboard, it's connected but when i query connections to that published post it doesn't show that connection to that private post.   * Private post <=(not work)=> Private post   * Publish post <=(not show)=> Private post   * Publish post <=(work & show)=> Publish post **i forgot to tell that i add connections programmatically.**


title: How to control the order of the combination of enqueued styles and scripts - site speed issue

text: We know, using `wp_head()` and `wp_footer()` all the scripts and styles are enqueued using `wp_enqueue_styles` and `wp_enqueue_scripts` hook. What we do is to enqueue our stylesheets and scripts using `functions.php`. And similarly WordPress plugins also enqueue their stylesheets and scripts using the same method. So, in the end there are many enqueued styles and scripts in header or footer. What Google PageSpeed recommends is: > **Optimize the order of styles and scripts** \- Google PageSpeed We know, `wp_enqueue_script()` and `wp_enqueue_style()` offer a `$deps` parameter, where we can define the depth or priority of the script or stylesheet. But that affects only within scripts and styles, not in both. So, with a combined load of scripts and stylesheets from the theme, and/or child theme, and/or plugins, and/or third party API etc. how can we let the WordPress to enqueue them all in a way so that site speed improves with a sound website's quality?   Or, are they bulletproof to echo styles first, than scripts?


title: Display a random tag but using cron to control frequency of change

text:
Background - I have created a shortcode in functions.php which adds a single random tag with it's link and description to a widget in my sidebar. This is my existing code...               function skips_get_random_tags() {         $args = array('exclude' => '');             $alltags = get_tags( $args );             shuffle($alltags);             $count=0;             if ($alltags) {                 foreach($alltags as $tag) {                     $count++;                     return '
Random App: term_id).'">'.$tag->name.'

'.$tag->description.'
';             if( $count >0 ) break;             }         }     }          add_shortcode( 'random-tag', 'skips_get_random_tags' );      It works fine except that is runs every time the page is loaded (subject to a cache period) and also generates different results on each page because of this. I would like to schedule it to run once daiy and have been reading about Cron which seems to be the solution. Having reviewed the codec, I believe I need to edit my code as follows (seems to be just adding some CRON code to trigger the function above the code and linking it to the function)...               function prefix_activation() {         wp_schedule_event( time(), 'daily', 'skips_daily_event_hook' );     }          add_action( 'skips_daily_event_hook', 'skips_get_random_tags' );     /**      * On the scheduled action hook, run the function.      */              function skips_get_random_tags() {         $args = array('exclude' => '');             $alltags = get_tags( $args );             shuffle($alltags);             $count=0;             if ($alltags) {                 foreach($alltags as $tag) {                     $count++;                     return '
Random App: term_id).'">'.$tag->name.'

'.$tag->description.'
';             if( $count >0 ) break;             }         }     }          add_shortcode( 'random-tag', 'skips_get_random_tags' );      I'm suspecting I'm going the long way round but I don't want to trigger a CRON that I can't stop - can anyone experienced with CRON comment on my approach and proposed code?


title: WP Load post with ajax and apply isotope

text: I ma using `Ajax Load More` to get my posts and show in a frontend, then I have applied isotope to the items. When I first show some items and applied isotope, it's working perfectly. But When second time I load post by ajax and try to apply the isotope, that isotope is not working and posts are overriding. Could someone help me in this regard?


title: Add custom TinyMCE 4 Button, Usable since WordPress 3.9-beta1

text: How is it possible to add a custom button to the visual editor TinyMCE, **Version 4**? Currently I found this q&a with a little bit hints to the topic, but not a solution or a how to. But I can't find a tutorial, documentation, q&a for the topic to add a custom button to the TinyMCE version 4, include in WordPress since version 3.9-beta1. ### Goal ![enter image description here](http://i.stack.imgur.com/HpS2j.png)


title: Having Trouble Running Query From Shortcode Using Tribe's Events Plugin

text:
I am not getting any results back using this code, even though I am passing in correct values. Can someone please take a look?               function webinar_list_shortcode($atts) {       global $post;      // Defaults     extract( shortcode_atts ( array (             'posts' => '5',             'status' => 'future',             'eventcat' => ''         ),         $atts     ));          $options = array(         'eventDisplay'=>$status,         'posts_per_page'=>$posts,         'tax_query'=> array(             array(                 'taxonomy' => 'tribe_events_cat',                 'tag_ID' => $eventcat             )         )     );           // query is made      $query = new WP_Query( $options );           // Reset and setup variables      $output = '';      $temp_title = '';      $temp_link = '';      $temp_ex = '';      $temp_content = '';      $temp_thumb = '';      $temp_id = '';           // the loop      if ( $query->have_posts() ) {         $temp_id = $post->ID;         $temp_title = the_title('','',false);         $temp_link = get_permalink($post->ID);         $temp_content = get_the_content($post->ID);         $temp_date = tribe_get_start_date( $post->ID, true, 'l, F j, Y' );         $temp_speaker = get_field('speaker');         //$temp_ex = get_the_excerpt();           if ( has_post_thumbnail() ) {             $temp_thumb = get_the_post_thumbnail($post->ID, array(200,200));           } else {             $temp_thumb = "";           }              // output all findings -        $output .= "

        $temp_thumb

                       $temp_date

Event: $temp_title

Speaker: $temp_speaker
                   View Event Details

";      } else {         $output .= "not found.";      }      wp_reset_query();      return $output;      }


title: Display custom post term or taxonomy

text: I have a custom post type called 'rent', inside that custom post type I've assigned some taxonomies like building1, building2 etc, inside that taxonomies I have some terms. Let's say I have a custom rent post in taxonomy building1 with term 1stfloor. I'd like to output on that post single page a term name and slug. I've could have easily done that using `get_post_terms` or something similar, but that function requires to specify taxonomy. But I would have many taxonomies for that custom post, and I don't want to make another single.php for every taxonomy. So I thought I would somehow get the taxonomy of my post (it will always be one taxonomy), assign it to variable, and put as an arg to `get_post_term`s. Well you can simply achieve taxonomy of current post using `get_post_terms` In my archive page I used `$taxname = get_query_var( 'taxonomy' );` \- which works like a charm, but it is not working on custom post single. Anyone have an idea how I can do that?


title: Infinite Scroll not working in own theme

text: I'm developing my own theme and added this in a function which is called with the hook `after_setup_theme` to support infinite scroll:               add_theme_support( 'infinite-scroll', array(         'container'  => 'content',         'footer' => false,         'wrapper' => false     ) );      I got this from http://jetpack.me/support/infinite-scroll/. `content` is the id of the container the new posts should go in. `footer` is set to false since I don't want another footer to be added. `wrapper` is set to false because I don't need a div wrapper. When I go to my webpage and scroll to the bottom, there is a loading anymation, but there are no posts loaded (there are more posts though). I see that there is a javascript error:               TypeError: infiniteScroll.scroller is undefined at infinity.js:485      I also see there is an ajax request when I scroll to the bottom, but that page returns:               {"type":"empty"}      What am I doing wrong? How can I get this working?


title: How to make pagination work not for a whole category but for a part of it? (WP_Query)

text: In my example you can see that i have to paginate posts from category 6 with `meta_value='izhs'` for `meta_key='dachaizhs'` Now it works like it paginates the whole category, and then exclude from each page non-appropriate posts for searching `meta_value`. So if i set `'posts_per_page'=9` for the query and i have 12 posts of current category, 2 of them are located on the 1st page and have `meta_value="izhs"` (which i'm querying) and on the 2nd page there are also some posts appropriate to searching meta-value (no matter how much). As a result i receive on the 1st page only these 2 posts, while there are some posts i need on the 2nd page and my pagination of 9 posts per page seems to be broken. Thanks a lot.                   $args = array(                       'post_status'=>'publish',         'post_type'=>'post',         'orderby'=>'post_date',         'order'=>'DESC' ,         'posts_per_page' => 9,         'paged' => get_query_var('paged'),         'meta_key'=>'dachaIzhs',         'meta_value'=>'izhs',         'cat'=>6             );          $query = new WP_Query ( $args );          while ( $query->have_posts() ) : $query->the_post();          // bla bla          endwhile;


title: How to get some information from the_content

text:
Hello in index loop 3 lastest post and i want to take only a bit o text and first photo or youtube - and here is the problem, because i can use the_excerpt or i can use get_post_meta to take text, to take picture i can use the_post_thumbnail but i have no idea how i can get youtube as player with the movie, it's always going as text...

     <?php echo the_excerpt(); ?>

<a href="<?php the_permalink(); ?>"><?php echo get_post_meta($post->ID, 'tytul-en', true); ?>

<?php echo get_post_meta($post->ID, 'en', true); ?>
<a href="<?php the_permalink(); ?>">read more

<a href="<?php the_permalink(); ?>"><?php echo get_post_meta($post->ID, 'tytul-pl', true); ?>

<?php echo get_post_meta($post->ID, 'pl', true); ?>
<a href="<?php the_permalink(); ?>">czytaj więcej

      any idea ?


title: Excluding private/protected posts via IP

text: I essentially want password protected/private pages/posts in WP to work as they currently do, but completely disregard the functionality for certain IP addresses. I've looked into filters/actions and don't see anything that seems promising, again I would prefer to do this without creating a specific category or anything outside of the current functionality of this in wordpress. Thanks!


title: Can't add a Page with Name 2011

text: I've no idea why i can't add a Page with Name `2011`. Wordpress changes the URL Slug to 2011-01. There is no Post with this Name in my Database. I tried zu flush my rewrite rules but nothing seems to be work. If i add a Page 2013 it works fine. But only once... If i delete this Page (from Trash) i can't add it again. Wordpress changes the slug to 2013-01. If i change the Post name directly in the database. Nothing happens... I really wonder why because there is no Post with this Name. Any suggestions?


title: How to get posts from two categories with WP_Query?

text:
I'm using WP_Query to create 'latest posts' & 'popular posts' sections on my home page. I'm trying to just pull 5 posts from 2 categories (9 & 11) but it will only show posts from cat 9. Here's the php I'm using for 'latest posts'-
             <?php                   $cat = array(9,11);             $showposts = 5;             $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;             $args=array(                 'category__in' => $cat,                  'showposts' => $showposts,                 'paged' => $paged,                 'orderby' => 'post_date',                 'order' => 'DESC',                 'post_status' => 'publish',                );                  $the_query = new WP_Query ( $args ); //the query                       $i = 0;while ($the_query->have_posts() ) : $the_query->the_post(); //start the loop             ?>                  <?php             if($i==0){ //Sets the output for the top post             ?>

<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(350,187); ?>

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

<?php the_time('F jS, Y') ?>

<?php the_excerpt(); ?>

<a class="more-link" href="<?php the_permalink(); ?>">Read More »

                       <?php                 $i++;                  } else { ?>

<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(145,93); ?>

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

<?php the_time('F jS, Y') ?>

                  <?php } endwhile; //end of the loop ?>             <?php wp_reset_postdata(); // reset the query ?>
       Any suggestions?


title: wp_get_attachment_image() not working when trying to add with and height attributes

text:
I am using `wp_get_attachment_image()` to try and output an img tag with width and height attributes. Here is my code:               $thumb_src = wp_get_attachment_image( $id, 'thumbnail', false, array('width'=> '10', 'height' => '10' ));     $thumb_output = "
".$thumb_src."
";      I was expecting this to output:

      Instead, it is outputting:

      Thanks very much for any help anyone can give. I have tried it with other attributes, like the `style` attribute, and the style tag appears as expected. I guess I could use the style tag to set the dimensions that way but I don't understand why the width/height method isn't working!


title: Any Mobile Theme Switcher - Theme not complete (Stylesheet missing)

text: I am trying to install the theme "Any Mobile Theme Switcher" on Wordpress 3.2.1, in order to give my Site a different layout, depending on where it is displayed. Installation succeeds, but in the the "Themes" view of the dashobard, I cannot select the theme, it says rather: any-mobile-theme-switcher - Stylesheet missing. What can I do? Theme: http://wordpress.org/plugins/any-mobile-theme-switcher/


title: Query posts and return XML

text: Here is the short and sweet of what I am hoping to do. I would like to have a way for external websites to query mine using a game title and they would get an XML back that contains the text of the review, the score, and some images (this XML should be customizable in order to add/remove elements from it). This seems like it should be easy enough, but my OVERLY limited knowledge of PHP and Wordpress are making this very complicated.


title: Implementing a tricky wordpress menu (nested categories + thumbnails)

text: I'm trying to make a layered wordpress menu, out of categories. Here's how it's going to look: ![enter image description here](http://i.stack.imgur.com/CScKS.png) I have no clue how to develop this, can't do it with `get_posts` (not sortable by parent/children), or `wp_list_categories` (can't pull thumbnails). Also, I have to assign thumbnails to categories somehow. Is there an easy way to implement something like this with wordpress?


title: Update Wordpress Custom Field with AJAX on cached page

text: I'm new to ajax am trying to create a simple hit counter that updates a custom field in Wordpress after the page loads. The page is cached, so any attempts to use PHP alone will not work. I'd like to simply pass the post ID through ajax to the php file, get the custom field, and update it with the new hit number. I currently have the following code, but cannot get it to update the custom field. Here's the jquery:                $(document).ready(function(         $.ajax({         url:'http://www.example.com/hits/hits.php',         cache: false,         type: 'POST',         data: {PostId: '<?php echo get_the_ID() ?>'}         });     ));      And the PHP file it calls:               <?php      /* Template Name: AJAX  */      ?>          <?php          $postid = $_POST['PostId'];  // get the hits from AJAX and save it for PHP                    $hits = (int) get_post_meta($postid, 'hit_number', true);         $newhits = $hits + 1;         update_post_meta($postid, 'hit_number', $newhits);     ?>      What am I doing wrong? Also, is there a way to include the PHP function in the same page/file to avoid bringing in an external file? I'm concerned that as traffic gets larger, the file will be requested too often. Thanks for your help!


title: Enable WP to accept standard jQuery code embeding between the <body> tags

text: I don't know what is the reason that WP is not accepting the standard embedding technique from jquery website ( http://learn.jquery.com/about- jquery/how-jquery-works/ ):               <!doctype html>                   <meta charset="utf-8" />         <title>Demo</title>                   jQuery                                  And allowing you only to wp_register_script your scripts in the functions.php or in the header. I want be able to embed the jQuery the way it is supposed to be and where I want in my template files. **So, the question is how can I enable the standard embeding recognition of jquery code in WP?** If that's not possible, is there a plugin for that or what files do I need to hack in WP core, if that's not possible to solve by some hook?


title: Unable to run jQuery script in my template file

text: I really want to run a simple code in my template file. E.g. if I put somethign like this in my page.php:               <script type="text/javascript">         jQuery(document).ready(function($) {             alert("Hello world!");         });     </script>      It's not working. But simple javascript is working:               <script type="text/javascript">             alert("Hello world!");     </script>      **Why is jQuery blocked in WP to be included in template files?** and maybe more important question > **WHERE IN THE WP SETTINGS CAN I RE-ENABLE THIS?** I know I can use wp_register_script etc. but in my scenario I need to paste simple javascript code in the template files. **How to allow load jQuery code snippets in WP template's file too?** And why is it even blocked?


title: VERY new to coding - keep breaking site trying to add to functions.php

text: I really appreciate everyone on this site who takes the time to answer questions here. I've learned a good deal already reading, but am sure I could learn even more if I could get past at least one basic question. Just like the "Best Collection of code for your functions.php file" post on this site, which has some outstanding tips, there are many great ideas for development without weighting things down with plugins. Trouble for me is, I clearly don't know enough about what I'm doing because anytime I've tried to add code to the functions.php file...I break my site. I am clearly placing it incorrectly and there is probably a step missing in the process as well. I obviously know just enough to be dangerous. I've done a lot of googling with variations on "how to properly edit functions.php" but I can't find a "101" version anywhere. Any thoughts on this would be appreciated, thanks!


title: Display text if current user has written 1 or more posts in a custom post type

text: I am trying to display different things to new users that have not created a post versus users who have created a post. I tried this, but it did not work for custom post types (only normal posts) and it does not account for drafts or pending posts:               <?php if (count_user_posts(1)>=1) { blah blah blah } else {Welcome, blah blah blah }; ?>


title: Attaching a navigation menu to the admin bar?

text: I have seen a number of solutions of how to manually attach links to the new WP admin bar, but I need to make this much easier for my site admins. It occurred to me that the easiest solution would be to create a custom navigation menu, and then have that menu 'attached' to the admin bar. This way the site admin could very easily add new links to the admin bar by simply adding pages to the custom menu. The primary idea being to place a dropdown menu displaying the menu pages directly on the right side of the admin bar.


title: Order users by 2 custom fields in wpdb query

text:
I've created a WordPress members site, each member is a user with the role of subsriber and has extra information set as custom fields - ie: address, contact details etc. I have the users output by the country custom field but now need to get the entries within each country sorted further by company name... The code I have so far is below. Any help greatly appreciated as I'm truly stumped! Thanks in advance.
     <?php include('inc/ticker-welcome.php'); ?>               <?php     function end_prev_letter() {        echo "
\n";     }     function start_new_letter($letter) {        echo "
\n";        echo "\t

\n";     }          function start_new_country($ucountry) {        echo "\t

$ucountry

\n";     }          ?>                           <?php                           if ( isset($_GET['d']) ) {                         // show out of hours                             global $wpdb; //Ignore this line if you're not within a function                             $order = $wpdb->get_results("SELECT DISTINCT user_id FROM $wpdb->usermeta WHERE meta_key='_country' ORDER BY meta_value ASC", "ARRAY_N");                             $authors = array();                     //      foreach($order as $aid)                             foreach($order as $aid){                                  $u = new WP_User($aid[0]);                                  //&& in_array('yes', $u->out_of_hours)                                 if ( in_array("subscriber", $u->roles)  )                                  $authors[] = $u;                              }                             $authors[] = new WP_User($aid[0]);                             if (!empty($authors))                             { ?>                             <?php    // loop trough each author                                 foreach ($authors as $author) {                                   $author_info = get_userdata($author->ID);                                 if ($author_info->out_of_hours === 'yes') {                                          ?>                                  <?php                                  $author_info = get_userdata($author->ID);                             $thisCountry = ($author_info->_country);                             $first_letter = strtoupper(substr($thisCountry,0,1));                                     if ($first_letter != $curr_letter) {                                   if (++$post_count > 1) {                                      end_prev_letter();                                   }                                   start_new_letter($first_letter);                                   $curr_letter = $first_letter;                                }                                if ($thisCountry === $currentCountry) {                                } else {                                   start_new_country($thisCountry);                                  $currentCountry =  $thisCountry;                                }                                 ?>                                 <?php                                      $pin = 'pin'.$author->ID;                                     $pin = trim(preg_replace('/\t+/', '', $pin));                                     echo '
';                                                          include('inc/members-entry.php');                                          echo '
';                                  ?>                                    <?php                                          } // ooo query                                     } // for each ?>                         <?php                          end_prev_letter();                         ?>                                       <?php   } else {                             //    echo 'No authors found';                             }                                             } else {                         // show all                             global $wpdb; //Ignore this line if you're not within a function                             $order = $wpdb->get_results("SELECT DISTINCT user_id FROM $wpdb->usermeta WHERE meta_key='_country' ORDER BY meta_value ASC", "ARRAY_N");                             $authors = array();                     //      foreach($order as $aid)                             foreach($order as $aid){                                  $u = new WP_User($aid[0]);                                  //&& in_array('yes', $u->out_of_hours)                                 if ( in_array("subscriber", $u->roles)  )                                  $authors[] = $u;                              }                             $authors[] = new WP_User($aid[0]);                             if (!empty($authors))                             { ?>                             <?php    // loop trough each author                                 foreach ($authors as $author) {                                   $author_info = get_userdata($author->ID);                             ?>                                  <?php                                  $author_info = get_userdata($author->ID);                             $thisCountry = ($author_info->_country);                             $first_letter = strtoupper(substr($thisCountry,0,1));                                     if ($first_letter != $curr_letter) {                                   if (++$post_count > 1) {                                      end_prev_letter();                                   }                                   start_new_letter($first_letter);                                   $curr_letter = $first_letter;                                }                                if ($thisCountry === $currentCountry) {                                } else {                                   start_new_country($thisCountry);                                  $currentCountry =  $thisCountry;                                }                                 ?>                                 <?php                                      $pin = 'pin'.$author->ID;                                     echo '
';                                                          include('inc/members-entry.php');                                          echo '
';                                  ?>                                    <?php                                      } // for each ?>                         <?php                          end_prev_letter();                         ?>                                       <?php   } else {                             //    echo 'No authors found';                             }                           } // show all                        ?>
                       ![enter image description here](http://i.stack.imgur.com/wPx0M.jpg)


title: Cleaner way to define multiple variables for is_page_template()

text: I need to so some stuff only when specific templates (homepages) are used, I couldn't think of any better solution than this since is_page_template() do not handle arrays:                       $home_1 = is_page_template('home-1.php');             $home_2 = is_page_template('home-2.php');             $home_3 = is_page_template('home-3.php');             $home_4 = is_page_template('home-4.php');             $home_5 = is_page_template('home-5.php');             $home_6 = is_page_template('home-6.php');                  if ( $home_1 || $home_2 || $home_3 || $home_4 || $home_5 || $home_6  ) {                  //Do stuff             }      Since I need this for several parts, I was wondering if there is any cleaner way to do this not to repeat the same code throughout template files? Maybe inside a function in functions.php? Thanks


title: Using transients in conjunction with memcached

text: I was hoping someone could clear the air for me when it comes to using transients with memcached. When running a plugin like w3-total-cache, are there any actual performance advantages to using transients to store large post queries? If we are running memcached, the queries will already be cached by memcached correct? What then, if any, is the advantage to using these two methods in tandem?


title: Sort posts by custom field value

text: I tried fixing this for 5 days and my head is burning now. I bought a theme from GorilaThemes and the developer doesn't get back to me on the forum either, so Im pretty much by myself now. can you guys please help? There is a page where it lists cars with with the below query               $query = new WP_Query(array(                     'post_type' => array('gtcd','user_listing'),                     'posts_per_page' => '999'                            ));                         if ( $query->have_posts() ) while ( $query->have_posts() ) : $query->the_post(); global $post,$field, $fields, $fields2, $fields3; $fields = get_post_meta($post->ID, 'mod1', true); $fields3 = get_post_meta($post->ID, 'mod3', true); $fields2 = get_post_meta($post->ID, 'mod2', true);  $symbols = get_option('gorilla_symbols'); $options = get_option('gorilla_fields');include(TEMPLATEPATH."/functions/var/default-box-one.php");include(TEMPLATEPATH."/functions/var/default-box-two.php");include(TEMPLATEPATH."/functions/var/default-box-three.php");       And below is the way they 'echo' Year, Body Style and Price.               $fields['year'], $fields['bodystyle'], $fields['price']      Now Im trying to sort the posts by its 'Year' which is '$fields['year']'. How do I do it? I tried the methods below but none of them worked. METHOD 1               $query = new WP_Query(array(                  'post_type' => array('gtcd','user_listing'),                  'posts_per_page' => '999' ,                  'orderby' => 'meta_value',                  'order' => 'ASC',                  'meta_key' => 'year'


title: Featured image for links and categories

text: Is there a ready plugin or solution for implementing Featured Image function to Categories and Links? At Pages and Posts I use the feature image as a background image, using the full size original image, and I'd like to achieve the same, meaning I'd like to have featured full size image for categories. With Links, I'd like to attach an upload image to them, probably with auto- resize ability with different size to the default media size. Are there solutions already done to achieve these? Thanks, cadeyrn


title: Get_the_terms restrict output

text:
I have a custom post type Holiday associated with a taxonomy Country. On my single-holiday.php, I use the taxonomy to display in the title. For example Holiday in Spain (Spain being the tax) Rarely, but it can happen, a holiday can be in 2 taxonomy terms. Creating a problem for my title display as I use get_the_terms. Somebody has better solution for me. My code is as follow               $taxonomy = 'country';                 $terms=get_the_terms($post->ID,$taxonomy);                           if($terms) {                         foreach( $terms as $termcountry ) {                      ?>
Holiday in <?php echo $termcountry->name;?>
}}


title: jQuery does not work

text: I am working on a project where I need jQuery for. I added this to my functions, and the scripts are loaded in my header if I watch my page source, but jQuery doesn't work. What am I doing wrong?               function stn_script_enqueuer() {              wp_register_script( 'ajax-vote', get_template_directory_uri() . '/js/ajax-vote.js', array('jquery') );                   $nonce = wp_create_nonce("vote_nonce");         $stn_vote_data = array(             'ajaxurl' => admin_url( 'admin-ajax.php'),             'nonce' => $nonce,         );         wp_localize_script( 'ajax-vote', 'stn_vote', $stn_vote_data );                   wp_enqueue_script( 'jquery' );         wp_enqueue_script( 'ajax-vote' );          }     add_action( 'init', 'stn_script_enqueuer' );


title: 403 'GET' Error on Wordpress Jquery Autocomplete

text:
**Overview:** I am trying to create a simple jquery autocomplete in a wordpress theme, on a custom template page containing a form. I wish for it to work both front-end, for logged in users, and the general public. It is part of a theme (not a plugin). I have followed along with a post here, but I am unsuccessful. **The problem:** Even though I am expecting autocomplete to occur as I type in the name field (the one with id="autocompleteID"), I don't see anything happening. Also, there is an error in my GET request, it says '403 forbidden'. (see image below) ![I get an error on the GET request](http://i.stack.imgur.com/bEMx0.jpg) ## INFO: * * * Relevant Directory Structure of the theme root: > >      . >      |--autocompleteAjax.js >      |--template-customers.php >      |--functions.php >   **autocompleteAjax.js:**               jQuery(document).ready(function($){     $("#autocompleteID").autocomplete({         source: function(request, response){             jQuery.getJson(autocompleteAjaxObject.ajaxurl + "?callback=?&action=autocompleteAjaxAction",request,function(data){                 response(jQuery.map(data, function(item){                     jQuery.each(item, function(i,val){                         val.label = val.whatever;                     });                     return item;                 }))             })         }        })       })      **template-cusotomers.php (A custom template page):**               get_header(); ?>

                                      <?php while ( have_posts() ) : the_post(); ?>                                              <?php get_template_part( 'content', 'page' ); ?>                                              <?php                                              if (is_user_logged_in()):?>                                                      <form type="post" action="" id="newCustomerForm">                                                              Name:                                                         <input id="autocompleteID" name="name" type="text" />                                                              Email:                                                         <input name="email" type="text" />                                                              Phone:                                                         <input name="phone" type="text" />                                                              Address:                                                         <input name="address" type="text" />                                                              <input type="hidden" name="action" value="addCustomer"/>                                                         <input type="submit">                                                 </form>

                                                   <?php                                                  global $wpdb;                                                 $customers = $wpdb->get_results("SELECT * FROM friends;");                                                      echo "
";                                                 foreach($customers as $customer){                                                         echo "
";                                                         echo "".$customer->name."	";                                                         echo "
";                                                 }                                                 echo "
";                                         else:                                                 echo "Sorry, only registered users can view this information";                                         endif;                                                                                ?>                                                                                <?php endwhile; // end of the loop. ?>

      **a snippet from Functions.php:**               wp_register_script('autocompleteAjaxHandle',get_stylesheet_directory() .   "/autocompleteAjax.js");     wp_enqueue_script('autocompleteAjaxHandle');     wp_localize_script('autocompleteAjaxHandle', 'autocompleteAjaxObject', array(         'ajaxurl'=>admin_url('admin-ajax.php'),         'autocompleteAjax_nonce'=>wp_create_nonce('autocompleteAjax_nonce_val'),         'action'=>'autocompleteAjaxAction'         ));          function get_autocomplete_suggestions(){         $_GET['term'];         $suggestions_array=array( 'captain crunch', 'chex', 'cheerios');              $response = $_GET["callback"]. "(" . json_encode($suggestions_array) . ")";         echo $response;         exit;     }          add_action('wp_ajax_autocompleteAjaxAction', 'get_autocomplete_suggestions');     add_action('wp_ajax_nopriv_autocompleteAjaxAction', 'get_autocomplete_suggestions');       ** ## Overview of the Question: I aspire to create a simple jquery autocomplete functionality, but I am having a difficult time understanding why the form does not behave as I would expect, and it seems to be producing a GET error. What is causing the problems, and what can I do to be more successful?


title: Post Pagination Titles

text: what I'm trying to do is set a different title for each page of the post pagination. So for example example.com/post-title/ title in the header is "Post Title" example.com/post-title/2/ title in the header is "This is another post title" I tried applying what is here post pagination names, not numbers to get to do this without luck (all I got was errors so eneded up deleting it).


title: Loop through posts of CatA and store value of CatB in separate array

text: Custom post type "Wines" has two categories: Regions & Producers. "Wines" has a value for both a Region and a Producer. I want to loop through posts in [Category => Region, Term => X] and get each post's respective term in [Category => Producer, Term => ?]. The final goal is to go through the newly created array and:   * Remove duplicate entry terms   * Sort terms by alphabetical order   * Loop through array, and list posts (wines) of each respective entry (producer term) I know you may be asking, "Why not just go to the producer's archive?"...I know. _cry_ The Region's archive needs to display a list of posts ordered by the terms in the producer category. Thanks a bunch.


title: File(X) is not within the allowed path(s):

text: I installed wordpress on a windows server with Parellels. It is a shared hosting. When i upload images it gives the following warning: > Warning: file_exists() [function.file-exists]: open_basedir restriction in > effect. File(C:\Windows\Temp\phpEEB0.tmp) is not within the allowed path(s): > (F:\Inetpub\vhosts\ozatashipyard.com\httpdocs) in > F:\Inetpub\vhosts\ozatashipyard.com\httpdocs\wp-includes\functions.php on > line 1998 849 When i check the library, i see that the file is uploaded. I tried adding the below code to `wp-config.php` but it didn't make a change.               define( 'WP_TEMP_DIR', ABSPATH.'wp-content/tmp/') ;      What may be the problem.


title: How to import XML to Wordpress as post and custom fields?

text: I need to import content (daily) from a xml file into wordpress. I am not looking for a specific answer, and I don't expect someone to write the whole code here, I just need some guidance on how to accomplish it. I plant to:   1. Write php script to load XML file with simplexml_load_file()   2. Read the file with SimpleXMLElement()   3. Put everything in a loop and use wp_insert_posts to create each post   4. I am going to use ACF for custom fields, not sure if ACF has function to do that programmatically.    5. Run everything with a cron job Does the above seems logical? Or am I going about it the hard way. I would appreciate if someone with more experience importing XML files could give me some tips, or things to consider. Thanks.


title: Deregister multiple scripts using a function?

text: I'm trying to deregsiter multiple scripts using the following function.               add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );     function my_deregister_javascript() {         if ( !is_page(array('order', 'shopping-cart', 'checkout') ) ) {         wp_deregister_script( 'tcp_scripts' );     }      How do I use this function to deregsiter multiple scripts? Thanks in advance.


title: change a post status when users update posts?

text: Is there an efficient way to change a post status from 'published' to 'draft' when a user of a certain type tries to update their posts. I tried something along these lines               function change_post_status($post_id)     {       if(current_user_can('rolename'))       {         $current_post = get_post( $post_id, 'ARRAY_A' );         $current_post['post_status'] = 'draft';         wp_update_post($current_post);       }     }          add_action('pre_post_update','change_post_status');       The code looks good to me but for some reason it doesnt work properly and I think it creates an endless loop(forcing me to restart my SQL server).


title: Assign Role and capablitis on frontend registration

text: I have created 2 custom roles "customer" & "employee" form admin "members" plugin. I am trying to assign these to user registering for site according to options (customer & employee) they selecting. I have tried with functions in functions.php               function my_new_user_registered( $user_id )      {         global $wpdb;         global $wp_roles;         if ( $_POST['member_type'] )         {                 $member_type = $_POST['member_type'];                 $company_name = $_POST['company_name'];                 $company_code = $_POST['company_code'];                 $user_id;                           //add_role($member_type);  **// here I am trying**             //set_role($member_type);              if($member_type == 'employee')             {                 $owner = 'N';                 $wpdb->query("insert into wp_comapny_user(company_id, user_id, owner) values ('$company_code', '$user_id', '$owner')");                 //$wpdb->query("insert into wp_user_meta(user_id, meta_key, meta_value) values ('$user_id', 'member_type', '$member_type')");                  }             elseif($member_type == 'customer')             {             $owner = 'Y';             $wpdb->query("insert into wp_company(company_name) values ('$company_name')");             $company_id = mysql_insert_id();                  $wpdb->query("insert into wp_comapny_user(company_id, user_id, owner) values ('$company_id', '$user_id', '$owner')");                  }              }     }      But both are not working. It's assigning default "Subscriber" in user meta "wp_capablities" option. How to solve this issue? Any help please.


title: Login form doesn't log in

text:
I have this code on my website that occasionally will log users in and occasionally just redirect to the wordpress login page. Additionally, if a field was left blank it would actually show errors on the wordpress login page, but now it just does a redirect.                           <form id="wp_login_form" action="<?php echo site_url('/wp-login.php', 'https') ?>" method="post">

Email

<input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="25" />

<?php _e('Password') ?>

<input type="password" name="pwd" id="pwd" size="25" autocomplete="off" />

<input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <?php esc_attr_e('Remember Me'); ?>

<input type="submit" name="submit" value="<?php esc_attr_e('Log In'); ?>" class="button" />
                     <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/>

<a href="<?php echo get_option('home'); ?>/wp-login.php?action=lostpassword">Forgot password?

                     </form>


title: How to batch update post content with custom post meta value

text: I have a custom meta box, using WPAlchemy, in which I am looking to get rid of. However, I would like to get all posts that have a specific custom meta value set, and insert it into the begininning of the post content, then delete the meta value. I have a feeling this post gets me close, as I have been able to successfully add content to the beginning of posts, but have been unsuccessful accessing and adding the custom meta value I'm after. I'm also a little unsure of when to hook into WordPress and perform my actions. Anyone have any suggestions on the best way to go about this? I figured I would build a simple plugin, activate it, let it do it's job, then remove it.


title: How to modify the Loop from a plugin (instead of a theme)

text: I am building a plugin which sets up a custom post type with some meta information. I'd like that information to show up in the loop (in particular the one on the main page). How can I modify the post-template without writing a theme. I was looking at home_template but it is deprecated for 3.3


title: Plugin Recommendation: Slideshow Gallery Delayed Image Loadging

text: I am wondering if there is a WordPress plugin that creates a slideshow of images where: *flash isn't used *images are not all loaded at once and instead are loaded after page load I have a requirement for numerous images to be present in a slideshow that are high res. All images need to be stored locally (e.g. no flickr). I took a cruise through one or two plugins but they include all the images at once. Which murders page load times. Any suggestions?


title: Search returns everything if search term has a space

text: When I try to search for terms with spaces, such as "lord of the rings", it returns all of my posts. However, if I just type "lord", it returns results. Any ideas what would be causing this?


title: Showing All the Posts in the Loop

text:
this code here
             <?php gab_dynamic_sidebar('Subnews1');?>                  <?php             $postnr = of_get_option('of_wn_nr8') + of_get_option('of_wn_nr8a');             if (intval($postnr) > 0 ) { ?>                 <a href="<?php echo get_category_link(of_get_option('of_wn_cat8'));?>"><?php echo get_cat_name(of_get_option('of_wn_cat8')); ?>                 <?php                 $count = 1;                 $args = array(                  'post__not_in'=>$do_not_duplicate,                   'posts_per_page' => $postnr,                   'cat' => of_get_option('of_wn_cat8', 1)                 );                 $gab_query = new WP_Query();$gab_query->query($args);                  while ($gab_query->have_posts()) : $gab_query->the_post(); if (of_get_option('of_dnd') == 1) { $do_not_duplicate[] = $post->ID; }                 ?>                 <div class="featuredpost<?php if($count == of_get_option('of_wn_nr8') or $count == $postnr) { echo ' lastpost'; } ?>">                               <?php if ($count <= of_get_option('of_wn_nr8')) { ?>
                             <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf( esc_attr__( 'Permalink to %s', 'wpnewspaper' ), the_title_attribute( 'echo=0' ) ); ?>" ><?php the_title(); ?>

                         <?php                             gab_media(array(   'imgtag' => 1,   'link' => 1,                                 'name' => 'wn-subnews',                                 'enable_video' => 0,                                 'catch_image' => of_get_option('of_catch_img', 0),                                 'enable_thumb' => 1,                                 'resize_type' => 'c',                                 'media_width' => 120,                                  'media_height' => 103,                                  'thumb_align' => 'alignleft',                                 'enable_default' => 0                             ));                         ?>

<?php echo string_limit_words(get_the_excerpt(),27); ?>…
                              <?php gab_postmeta(); ?>                     <?php } else { ?>                              <a class="listtitle" href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf( esc_attr__( 'Permalink to %s', 'wpnewspaper' ), the_title_attribute( 'echo=0' ) ); ?>" ><?php the_title(); ?>                          <?php } ?>
                 <?php $count++; endwhile; wp_reset_query(); ?>             <?php } ?>
      , is this, shown in this image here http://d.pr/i/7efk , on this site http://dev.dmichel.net/adv/ . what i need to happen is to show all 4 posts, rather than just 1. What I tried to do to show all 4 posts is this               <?php                 $count = 1;                 $args = array(                   'posts_per_page' => 4,                   'cat' => of_get_option('of_wn_cat8', 1)                 );                 $gab_query = new WP_Query();$gab_query->query($args);                  while ($gab_query->have_posts()) : $gab_query->the_post(); }                 ?>      But it doesn't seem to work. I'd like help showing all 4 posts above the titles


title: Is there any better/faster code than this ? It shows the categories that an author had ever posted in

text: I have this query that shows the categories that a user had posted in. For example if I have 3 cats, name NEWS, MEDIA, PUBLICATIONS and the author had only posted in the first two, it will show NEWS MEDIA Is there any better code than this or an improvement because my db is really huge and it gives me throttling? Thank you.               <?php     $author = get_query_var('author');     $categories = $wpdb->get_results("     SELECT DISTINCT(terms.term_id) as ID, terms.name         FROM $wpdb->posts as posts         LEFT JOIN $wpdb->term_relationships as relationships ON posts.ID = relationships.object_ID         LEFT JOIN $wpdb->term_taxonomy as tax ON relationships.term_taxonomy_id = tax.term_taxonomy_id         LEFT JOIN $wpdb->terms as terms ON tax.term_id = terms.term_id     WHERE posts.post_author = '{$post->post_author}' ");     ?>          <ul>         <?php foreach($categories as $category) : ?>     <?php if ( ($category->ID == '3')   || ($category->ID == '4')  || ($category->ID == '5')) { ?>         <li>             <a href="<?php echo get_category_link( $category->ID ); ?>/?author_name=<?php echo $curuser->user_login; ?>" title="<?php echo $category->name ?>">                 <?php echo $category->name; ?>             </a>         </li>     <?php } ?>         <?php endforeach; ?>     </ul>


title: Make the Status, Visibility, or Date fields opened by default in the Publish box

text: By default, the Status, Visibility, and Date fields in the Publish metabox are closed, and you have to click **Edit** to show them. Is there a way to make these fields visible by default? The hidden elements all have a class of `hide-if-js`.


title: 960gs different classes on teasers posts

text:
I'm having hard time trying to use teasers post in my wordpress theme (based on 960gs), as you can see here http://img17.imageshack.us/img17/794/schermata20110420a15045.png what I got till now is one "featured" post and three teasers post with thumbnails that will probably be six (so it'll have seven posts displaied in the homepage). The problem is that to do so I have to assign a class "grid_2 alpha" to the teasers post and I don't know how to assign this class to just the first teaser on the left, lefting the other ones with no alpha or omega class and putting the omega class to just the last teaser post (the seventh). If can help, here's the code I'm using for the loop:               <?php $firstClass = 'firstpost'; ?>     <?php /* Start loop */ ?>     <?php while (have_posts()) : the_post();  ?>              <?php if (function_exists('yoast_breadcrumb')) { if (is_page() && $post->post_parent) { yoast_breadcrumb('
','
'); } } ?>          <div class="post <?php echo $firstClass; ?>">     <?php $firstClass = 'grid_2 alpha'; ?>          <a href="<?php echo get_permalink(); ?>"><img src="<?php echo get_post_meta($post->ID, "Thumbnail", true);?>" width="140" height="100" style="padding-bottom:20px;" />
<a href="<?php echo get_permalink(); ?>"><?php the_title(); ?>
         <?php the_content(); ?>         <?php wp_link_pages(array('before' => '
' . __('Pages:', 'roots'), 'after' => '
' )); ?>
     <?php endwhile; // End the loop ?>      also I would like to know how I can add some text above the teaser section under the first featured post. Sorry for the too many questions and for my bad english, as you can understand I'm not a developer but I searched for one week and couldn't find anything helpful for my problems. Thanks in advance for any help, I really appreciate it. Ok so there are the other loop pages and the front-page.php **front-page.php**               <?php get_header(); ?>             <div id="content" class="<?php echo roots_container_class; ?>">                  <div id="main" class="<?php echo get_option('roots_main_class'); ?> grid_6" role="main">
                         <?php get_template_part('loop', 'page'); ?>

                 <aside id="sidebar" class="<?php echo get_option('roots_sidebar_class'); ?> grid_6" role="complementary">
                         <?php get_sidebar(); ?>

     <?php get_footer(); ?>      **loop-search.php**               <?php /* If there are no posts to display, such as an empty archive page */ ?>     <?php if (!have_posts()) : ?>

Sorry, no results were found.

         <?php get_search_form(); ?>           <?php endif; ?>          <?php /* Start loop */ ?>     <?php while (have_posts()) : the_post();  ?>                  <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                     <time pubdate datetime="<?php the_time('c'); ?>">Posted on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>.</time>                     <?php if (get_option('roots_post_author') == 'checked') { ?>
                         Written by <?php the_author(); ?>
                     <?php } ?>
         <?php if (is_archive() || is_search()) : // Only display excerpts for archives and search ?>                 <?php the_excerpt(); ?>         <?php else : ?>                 <?php the_content('Continue…'); ?>         <?php endif; ?>
                                      <?php $tag = get_the_tags(); if (!$tag) { } else { ?>
<?php the_tags(); ?>
<?php } ?>
                  <?php comments_template('', true); ?>          <?php endwhile; // End the loop ?>          <?php /* Display navigation to next/previous pages when applicable */ ?>     <?php if ($wp_query->max_num_pages > 1) : ?>
<?php next_posts_link( __( '← Older posts', 'roots' ) ); ?>

<?php previous_posts_link( __( 'Newer posts →', 'roots' ) ); ?>
              <?php endif; ?>      **loop-single.php**               <?php /* Start loop */ ?>     <?php while (have_posts()) : the_post();  ?>              <article <?php post_class() ?> id="post-<?php the_ID(); ?>">
<?php the_title(); ?>
                 <time class="updated" datetime="<?php the_time('c'); ?>" pubdate>Posted on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>.</time>                 <?php if (get_option('roots_post_author') == 'checked') { ?>
                     Written by <?php the_author(); ?>
                 <?php } ?>                 <?php if (get_option('roots_post_tweet') == 'checked') { ?>                 Tweet                 <?php } ?>
                 <?php the_content('
Read the rest of this entry »
'); ?>
                              <?php wp_link_pages(array('before' => '
' . __('Pages:', 'roots'), 'after' => '
' )); ?>
<?php the_tags(); ?>
                          <?php comments_template(); ?>
          <?php endwhile; // End the loop ?>      **loop.php**               <?php /* If there are no posts to display, such as an empty archive page */ ?>     <?php if (!have_posts()) : ?>

Sorry, no results were found.

         <?php get_search_form(); ?>           <?php endif; ?>          <?php /* Start loop */ ?>     <?php while (have_posts()) : the_post();  ?>                  <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                     <time pubdate datetime="<?php the_time('c'); ?>">Posted on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>.</time>                     <?php if (get_option('roots_post_author') == 'checked') { ?>
                         Written by <?php the_author(); ?>
                     <?php } ?>
         <?php if (is_archive() || is_search()) : // Only display excerpts for archives and search ?>                 <?php the_excerpt(); ?>         <?php else : ?>                 <?php the_content('Continue…'); ?>         <?php endif; ?>
                                      <?php $tag = get_the_tags(); if (!$tag) { } else { ?>
<?php the_tags(); ?>
<?php } ?>
                  <?php comments_template('', true); ?>          <?php endwhile; // End the loop ?>          <?php /* Display navigation to next/previous pages when applicable */ ?>     <?php if ($wp_query->max_num_pages > 1) : ?>
<?php next_posts_link( __( '← Older posts', 'roots' ) ); ?>

<?php previous_posts_link( __( 'Newer posts →', 'roots' ) ); ?>
              <?php endif; ?>      Really thanks for your help.


title: What action hook can I use to add a JavaScript to a page post using a theme template that is not including get_header() nor get_footer()?

text: So the reason why I am don't want to include `get_header()` or `get_footer()` tags is because this page will be loaded as an iframe using the thickbox modal plugin and its content will be a form and I don't want the aforementioned tags to render all the menus and banner images and menus as well as the footer content because it will make for lots of scrolling on this page. However, current I'm running something like this:               add_action('template_redirect', 'my_plugin_add_js');      However, when I take out the `get_header()` and `get_footer`() tags then the JavaScript doesn't load even though the javascripts inside the '`my_plugin_add_js`' are being added within the body HTML tags at the end and not inside the head tags, like so:               wp_register_script("validate_form", plugins_url('js/my_plugin_validate_form.js', __FILE__), array('jquery', 'validation'), '1.0', true);      So I gather that the 'template_redirect' action hook is not the right one to use.


title: How can I get the last posts by user role?

text: I have a custom post type ("News"), and a custum user role ("Friends"). How can I get the last "News" written by "Friends" ?


title: Posts being viewed

text: I am looking for a way to list posts being viewed but I can't find anything online. Is it even possible? I've seen some websites that have these loops, "What other readers are currently reading". I'm using the following loop to list random set of videos               <?php                 if ( is_home() ){           $cat = get_query_var( 'cat' );           query_posts(array('orderby' => 'rand', 'showposts' => 10, 'cat'=>$cat));           }           while (have_posts()) : the_post();       ?>      How can I show posts being viewed? anyone


title: Uploading PDF using Media Uploader

text: I have been using a custom code to upload images to Wordpress using custom metaboxes. Here is the code:               <script type="text/javascript">              jQuery(document).ready(function( $ ) {                  var formfield;                  $('.upload_button').click(function() {                 $('html').addClass('Image');                 formfield = $(this).prev('.upload_image'); // .attr('name');                 tb_show('', 'media-upload.php?type=image&TB_iframe=true');                 return false;             });                  // user inserts file into post. only run custom if user started process using the above process             // window.send_to_editor(html) is how wp would normally handle the received data                  window.original_send_to_editor = window.send_to_editor;             window.send_to_editor = function(html){                      if (formfield) {                     fileurl = jQuery('img',html).attr('src');                          $(formfield).val(fileurl);                     tb_remove();                     formfield = '';                     $('html').removeClass('Image');                      } else {                     window.original_send_to_editor(html);                 }             };              });               </script>      My actual problem is that I have to upload now a PDF. I have try to use the .urlfield input in the media uploader with keeps the URL of the uploaded file. I have changed fileurl = jQuery('img',html).attr('src'); to fileurl = jQuery('.urlfield',html).val(); but it does not work. What can I do please? An alternative tip I would like to know is how can I change the "Insert button" value text to something like "Use this file". Thanks in advance.


title: How to exclude categories from get_categories() select list inside a widget admin panel

text: I have a widget that I need to add a category select list to. The end user should be able to select a category and I need to save the category ID with the widget. I've hit a stumbling block in that I cannot get my exclude array to work. The excluded cats still show up in the dropdown. What am I doing wrong?               function form( $instance ) {         $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '', 'hide_title' => '', 'category_id' => '' ) );         $title = format_to_edit($instance['title']);         $text = format_to_edit($instance['text']);              $hide_title = $instance['hide_title'] ? ' checked="checked"' : '';         $category_id = $instance['category_id'] ? ' selected="selected"' : '';         ?>         <p>             <label for="<?php echo $this->get_field_id( 'title' ); ?>">Title:</label>             <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $title; ?>" class="widefat" />         </p>         <select id="<?php echo $this->get_field_id( 'category_id' ); ?>" name="<?php echo $this->get_field_name( 'category_id' ); ?>">           <option value=""><?php echo esc_attr(__('Select a Category')); ?></option>           <?php              $args = array('exclude' => array(get_cats()),'hide_empty' => 0 );             $categories=get_categories($args);              foreach ($categories as $category) {                 $option = '<option value="'.$category->cat_ID.'">';                 $option .= $category->cat_name;                 $option .= '</option>';                 echo $option;             }          ?>         </select>          function get_cats(){         $exclude_cats = array(             get_cat_ID('test1'),             get_cat_ID('test2'),             get_cat_ID('test3'),             );         return $exclude_cats;     }


title: Can I make a parent page of the blog and have it display a paragraph/thumbnail of certain entries?

text: WP 3.2.1 The title just about says it all. I'd like to make a parent page of the blog that will dynamically show a little teaser of certain entries (either the most recent or random, depending on what my client wants). Is something like this possible? If so, how?


title: Custom order of terms for custom taxonomy in admin and website

text: I have a custom taxonomy registered for my custom post type. I need to make it possible for a user to specify the order in which the taxonomy terms should appear (something like menu order for pages). Then when displaying the taxonomy terms on the site I will use the specified custom order to order them. What is the best way to do it? Is there any plugin for it? Many thanks, Dasha


title: Put standard wordpress options into a theme options panel?

text: I'm developing a theme for a client, and I want to allow her to change the site title, description, and her password as needed. However, I don't want to give access to all of the other options (e.g. the site URL). I have some experience creating a theme options panel (via this article on nettuts+), and was thinking it would be great if I could put those options into the panel as well. Would be great to get some direction!


title: Plugin Appends ugly url string to index

text: A custom background plugin has started to cause certain browsers (FF, IE8,9, Safari) to reveal an appended url string when viewing the index page: http://dearearth.net \- this mostly shows when not visiting the site directly, but rather when going through, for example, google. This persists in IE 9 even after refresh or page reload, but does not on the other browsers. Screenshot: http://i55.tinypic.com/2nv9fh3.jpg I have the following custom permalink structure enabled:`/%category%/%postname%/` Thanks for any input!


title: Issue to set a default language

text: I'm working on a multiple language site (Catalan and Spanish). I set by default Catalan as the main language but we found that users who navigates with spanish browsers the content appears in spanish instead of catalan. How can I fix it to always appears the text in catalan regardless of the language of the browser? Sure it's a dummy question but I can't find any workaround to solve it!. Thanks in advance


title: Why is Wordpress filtering Pastebin URL's

text: WordPress seems to be filtering Pastebin URLs. When attempting to include pastebin links into either new or pre-existing posts, the following error is returned: > “Not Found” It seems most — if not all — pastebin URLs kill my posts. If a pastebin URL is included in a new post, it is deleted altogether and even the draft is sent into the abyss. If a pastebin URL is included into a pre-existing post, new changes are deleted and the post reverts to the previous draft. I contacted my hosting company and they claimed to have no idea how or why this is occurring. Their only suggestion was that it must be WordPress. So this has me wondering; what is causing this? I can’t think of any plug-ins that would be responsible, and beyond that, I can’t think of much else without seeming paranoid. Whatever the cause, I thought it strange enough to document. If it is a restriction, it is supremely stupid. If only a bug, I’d sure like to know more about it.


title: Customising the search function?

text: I'm rebuilding this website - http://www.mediwales.com/news on the WP platform. I'm struggling with the search area in the grey box. I'm removing region and date so we don't have to worry about those but how can I setup the search by keyword AND sector? I've created a custom taxonomy called "news" which will represent the sectors. As far as I know the normal search just searches the entire site for a keyword. How can I setup the search to search for a keyword but if a sector is selected only search for the keyword within that sector? And then display the results. UPDATE:                                       <?php $args = array(         'show_option_all'    => '',         'orderby'            => 'name',         'order'              => 'ASC',         'show_last_update'   => 0,         'style'              => '',         'show_count'         => 0,         'hide_empty'         => 1,         'use_desc_for_title' => 1,         'child_of'           => 0,         'feed'               => '',         'feed_type'          => '',         'feed_image'         => '',         'exclude'            => '',         'exclude_tree'       => '',         'include'            => '',         'hierarchical'       => true,         'title_li'           => '',         'show_option_none'   => __('No categories'),         'number'             => NULL,         'echo'               => 1,         'depth'              => 0,         'current_category'   => 0,         'pad_counts'         => 0,         'taxonomy'           => 'news',         'walker'             => 'Walker_Category' );          ?>              <?php echo wp_list_categories($args); ?>               <?php     function Search_with_in_a_tax( &$query ) {         if ( is_search() && isset($_GET['sector_array'])) {             $tax_query = array(                  array(                     'taxonomy' => 'news',                     'terms' => $_GET['sector_array'],                     'field' => 'term_id',                   )              );              //turn it into a WP_Tax_Query object             $tax_query = new WP_Tax_Query($tax_query);             $query->set("tax_query", $tax_query);         }     }     add_action('pre_get_posts', 'Search_with_in_a_tax', 1);     ?>            <form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">     <div><input type="text" size="18" value="" name="s" id="s" />     <input type="submit" id="searchsubmit" value="Search" class="btn" />     </div>     </form>      This is what I have so far. It seems to be searching the keywords and picking out the news. I can't make the sectors selectable (like the link at the top) though? How could I link the two? The search would then search within that sector (taxonomy) for the keyword.


title: Additional custom header image

text: Has anyone seen a way to add a new header_image to a theme? I need to add two configurable images in a theme. It doesn't really matter if it gets added as a new "Header" admin theme menu or if it's added to the existing Apperance->Header menu. I'm a bit new to plugin development so any help in the right direction is appreciated. I can't really find any hooks or actions to attach to. Similar to this request


title: How to hook wp_mail to add a custom email as BCC for each sent email?

text: Is there a way to hook into the wp_mail function to add a custom email as hidden (BCC) copy to each email sent? If so, how? -edit- It's not like I want to send an email with BCC, I would like to make the necessary hooks to add the BCC to every sent email (many different functions in my theme make use of `wp_mail`)


title: How to make the 'request' filter work?

text: I'm trying to get a Page to display a custom query using the snippet posted here. The following is in my `functions.php`:               function alter_the_query($request) {         $dummy_query = new WP_Query();  // the query isn't run if we don't pass any query vars         $dummy_query->parse_query($request);         // this is the actual manipulation; do whatever you need here         if($dummy_query->is_page('blog')) $request['category_name'] = 'Blog';         // and then         return $request;     }     add_filter('request','alter_the_query');      The page called "Blog" has a basic loop inside- so it should be displaying whatever `WP_Query` tells it to. However, it is only displaying the Page content- which should have been ignored. I can't seem to find a reference that explains the properties of the `$request` object, so I'm not sure what I should do to make this snippet work. Any ideas?


title: WordPress Tag Page Hook?

text: Is there any hook for a tag page, so I can alter it's content before outputting?