title: Theme unit test data Foreign fonts come in garbled on my machine

text: Having just tried out the Theme Unit Test Data from the WordPress.org Codex, I noticed that some of the body text doesn't import properly on my set up which is a Mac running Mavericks. The effect is particularly noticeable on the Lorem ipsum page where non latin characters just arent rendering at all being replaced by nonsense characters. I was following a tutorial on how to make a theme framework on the tuts plus website. Is there an import setting that I am failing to notice or is it some other setting? My charset is defined as               <meta charset="<?php bloginfo( 'charset' ); ?>">      How ever I dont believe this is having any effect since if I copy and paste the characters into the post, they appear ok. Can anyone shed any light on this?


title: Is it safe to update from 2.6.2 to the newest version?

text: I'm using Wordpress version 2.6.2 and now it shows in the page that               Deprecated: Assigning the return value of new by reference is deprecated in /home/np14388/domains/<sitename>/public_html/wp-settings.php on line 472      etc. Is it safe to update from this version to the newest one, or should I update in certain phases (2.6.2 -> 2.6.3 etc.)? Please help.


title: How to use template field in the Event Organiser plugin widget

text: I'm using this plugin: http://wordpress.org/extend/plugins/event-organiser/ I notice a field in the widget called "Template (leave blank for default)". How would I use this field to show the standard list of events, but with only the date (not the time), and only display the year if it's not this year?


title: Which themes do you use to test compatibilities with your plugin

text: When developing a plugin, I usually test it with the following themes before public release:   * TwentyTen by Automattic   * TwentyEleven by Automattic   * Coraline by Automattic   * Duster by Automattic   * Hybrid by Justin Tadlock   * News by Justin Tadlock   * Prototype by Justin Tadlock   * Retro-fitted by Justin Tadlock   * Responsive by ThemeID   * PageLines by PageLines   * Buttercream by Caroline Moore   * Catch Box by Catch Themes Team   * Suffusion by Sayontan Sinha Are there any other recommendations out there that you should test your plugin with for checking compatibilities?


title: How to create a gallery and integrate in first page

text: I want to create a gallery that display all images in the front page, but I don't want to use any plugin. I used the following code               <?php /* The loop */             while ( have_posts() ) : the_post();             if ( get_post_gallery() ) :             echo get_post_gallery();             endif;              endwhile;      ?>      I didn't create a gallery through a post or page, so how shall I output it in the `index.php` page?


title: Multiple images per post - Show random image elsewhere

text: I'm after either a plugin suggestion or code suggestion that best handles images per post. Here's the scenario, every post could have up to 6 images, all to be assigned class names etc. All to be displayed on single.php. I'd like to be able to choose one of those 6 images that I'd like to display as a large image within the same template file. Additionally, out of these 6 images I'd like to randomly call in 1 random one on to a custom page template in another loop elsewhere on the site. To a novice like myself, this seems pretty complex and I wouldn't know where to start. How would I go about managing this? Is there a plugin that allows this functionality?


title: custom post type archive page has 404 error even though has_archive is true

text: I have an existing site that has a custom post type with no archive. It has been live for almost a year now. I am trying to change the custom post type to have an archive now. So I changed has_archive to "true," went to Settings > Permalinks and saved it to flush rewrite rules, but when I go to the archive (example.com/recipes/) it is still a 404 page. There is no caching plugin active. The Types plugin was used to create the CPT. There are also some custom rewrite rules in place for the recipes CPT, but I would think that this would only affect the single post, not the post archive:               function custom_rewrite_rules() {         add_rewrite_rule('^recipes/([^/]*)/([^/]*)/?$' ,'index.php?recipes=$matches[2]','top');     }     add_action('init', 'custom_rewrite_rules');          function custom_links($permalink, $post_id, $leavename) {         $post = get_post($post_id);         if ($post->post_type == 'recipes') {             $cats = wp_get_object_terms($post->ID, 'recipe-category');             if ($cats) {                 $tax_rec_cat = $cats[0]->slug;             } else {                 $tax_rec_cat = 'all';             }             $permalink = str_replace('%tax_rec_cat%', $tax_rec_cat, $permalink);         }         return $permalink;     }     add_action('post_type_link', 'custom_links', 10, 3);      Again, I'm not having any issues with viewing a recipes taxonomy archive (example.com/recipes/appetizers/) or the single recipe post (example.com/recipes/appetizers/hummus/), just the main post archive (example.com/recipes/). Could there be a place that disables pages or post archives that I am not looking?


title: wp login redirect loop reauth=1

text: I am new to wordpress development and am trying to write a plugin. Following the recommendations in the book Professional Wordpress Plugin Development, I created a test page and placed it in the wordpress root directory. When I include wp-admin/admin.php to test the admin functionality of this plugin, I get routed to the login page. From there, after supplying the appropriate credentials, I get redirected to the same page. If I don't require wp- admin/admin.php this doesn't happen. I don't know where to begin troubleshooting this. Here is the very basic script they recommend:   `<?php require('./wp-load.php'); require_once('./wp-admin/admin.php'); ?> <pre> <?php //code to test here var_dump(is_admin()); ?> </pre>`   Here is the redirect url that keeps appearing:      `http://mysite.com/wp- login.php?redirect_to=http%3A%2F%2Fmysite.com%2Ftest.php&reauth=1` Thanks for any help!


title: admin : search custom fields

text: One year ago @t31os answered a post with a code I can't access: http://wordpress.org/support/topic/search-custom-field-data His answer... I was feeling adventurous, so i wrote a simple plugin to do it.. http://wordpress.pastebin.ca/1736605 The post search in the admin will now also check against the meta keys and meta values when checking for matching posts... ;) Is there a way to get that code so I can use it? Thank you very much Patricia


title: Developing different website editions based on countries?

text: This is what I want to do   1. User accesses the website from US or UK OR X country.   2. User gets redirected to a particular edition of the magazine(online) depending on the country that he/she is accessing the website from.   3. The different editions are nothing but different homepages, that display the content which are more relevant to a particular user group. In a nutshell, I know I will have to redirect users based on ip addresses to particular pages. But what I am not able to do is, create different homepages within the same theme. Moreover, I can control only one home page from back end, how do I create multiple home pages that I could control separately.(By Controlling the homepage I mean, setting up the categories and Menus). The website is - www.thehardtackle.com Although I have put up the website my self, I am not a web developer. Would be helpful if someone can direct me to open source resources or plugins. Thanks


title: Moving from subdirectory and subdomain -> root

text: Background: I've only done vanilla theme and direct installs until now. The site I'm working on has an existing (ancient) Mambo install in root directory. For the new Wordpress revision, client wanted to develop the content of new site before replacing it. After reading the Codex, I decided doing a subdirectory install was the best way to go, then use the pre-existing subdirectory install routine to move it to root. But for some irrational reason, instead of just pointing to the subdirectory, I assigned the new Wordpress site to a subdomain. (I'm new at this, and now realize I made it more complicated than necessary!) To summarize current situation: www.example.com --> existing old site   www.example.com/wordpress --> WP physical install   **dev**.example.com --> Subdomain is assigned to www.example.com/wordpress; WP URLs assigned to **dev**.example.com After reading the procedure carefully, I plan to proceed this way:   0) Backup database and full install folder to local   1) Change WP assigned URLs to www.example.com   2) Remove the subdomain pointer   3) Copy index.php and .htaccess to root as normal (I will back up the old index.php and .htaccess to a subdirectory in case I have to fall back to the Mambo site).   4) Change index.php's `require('./wp-blog-header.php');` to `require('./wordpress/wp-blog-header.php');` 1, 3 and 4 are standard. I'm hoping that by removing the subdomain assignment in sequence at 2, there will be no issues with this. My question is: does that sound right? My concern is that removing the subdomain will nuke the /wordpress folder or do something else crazy. I haven't done that before, and the client's site is on 1and1, which has a very obtuse nonstandard back-end. Thanks for any advice.


How would I disable a plugin on one page? For example, I have a plugin for Social Icons that appears on all pages, but I would like it NOT to show up on one page. Thanks!


title: integrating external php library into wordpress- the right way

text: If I were to load a custom library into wordpress, what would be the best place to add it? Since there are a bunch of global vars defined at the top of the library, I would not want that to be done thru a hook where I'm forced to use a wrapper function whereby my library globals will be treated as local to that function. My library starts with               ob_start()         //  I'm not sure how this would effect WP. So I'm not too big on this.     session_start();   //  I do need this though.       This should make any wordpress page to be able to use PHP sessions, right? ( I'm assuming wordpress no internal code that kills/rejects session usage. ) If I put my library into a page such as mylibrary.php, how do I make sure that it gets included into wordpress ( all pages, cats, template files across themes ) and it will remain included even if I were to switch themes or deploy wordpress updates?


title: Can't get pretty permalinks to work without index.php

text: I've worked with WordPress for a while now and this is the first time I've had this problem, I can't get my permalinks to work without `index.php` on the URL even though `mod_rewrite` is enabled, a few things that might help figure the problem out:   * I'm using apache2 and mod_rewrite is enabled, I doubled checked by displaying the `phpinfo()`   * The `.htaccess` file gets written just fine when I update the permalink options and the contents are default WP Redirect rules but just in case here it is:              # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress        * The permalink common settings on the option page don't actually show the `/index.php/` part (sometimes when I've used IIS they show it there), if I use any of the common url structures I get a 404 page (not the `404.php` one on my theme but the browsers 404 one) but if I add `/index.php/%postname%/` for example it works just fine. Does anyone know what might be wrong? Thanks in advance!


title: How to consolidate multiple static page templates into one dynamic one?

text: I have a group of themes that a client needs consolidated into one. Everything is fairly straight forward, except each theme has theme-specific page templates. Instead of pooling all the template files together in the new master theme, how can I reduce them down to one dynamic template that displays differently depending on a chosen theme option? When searching myself I came across the template_include filter, which looks like it could be used to override the template that is used, but I'm not sure this is the right solution or how it would be implemented in this case. Another idea I have would be to just use conditional includes inside the "master" template. Any suggestions would be much appreciated.


title: Signed up with wrong email (.com instead of .ca)

text: I signed up for a wordpress account but mistakenly put in yahoo.com instead of yahoo.ca. There is no version of my email address at yahoo.com and i cannot sign up for it since my username is already taken at yahoo.ca. How do I change the location my confimation email goes to? I cannot sign in to Wordpress. I cannot signup for the domain and username I have already chosen. What do I do?


title: /Page2 shows the same posts as /Page1

text: My issue is that i use this plugin http://wordpress.org/plugins/page-layout- builder/ But when i on my frontpage, press on the 'page 2' button, it then shows page 2 but with the same posts as page 1/homepage. Mydomain.com/page2 shows the same posts as Mydomain.com I have no i idea how i will get this working and i would love an guided answer! Thank you :-)


title: How to only hook on Single.php after content?

text: I am currently hooking on `the_content()` but that goes through the Wordpress loop too. How can I only hook on the Single.php page? Also, is there a way to only look on the first X posts in the Wordpress loop? By the way, I am creating a plugin


title: Can someone point me toward a plugin for this specific featured content display?

text: A client would like a featured content display that looks exactly like the one here: kroq.radio.com. It's not a slideshow - it's tabbed navigation with pictures through four featured posts. As far as I can see it's just done with CSS, not JS. (Could be wrong.) I started searching in the WP.org plugin repository but as I wasn't even sure what to call this thing, I felt like I wasn't making much headway. The closest thing I found to what I wanted was Slidedeck which I might go with, but if my client really wants it styled like the KROQ one (with the side arrows and such), I'm not sure if that'd be possible (and if it was I _am_ confident it'd be a huge PITA.) So my questions are: 1) does anybody know of a plugin that would copy or approximate this display thingy and 2) even if you don't, what the search terms would I use to search one up?


title: How do I create links at the top of WP_List_table?

text: I am trying to create links like the ones in the post tab. See Image Below. ![enter image description here](http://i.stack.imgur.com/H9fge.png) I created my WP_List_table but I am not sure how to create those links or how to get them to show a different db query. I know about the extra_tablenav function in the class but this adds things after the bulk action area, so this doesn't seem to do what I want.


title: Multiple loops on a Search result page?

text: I have a custom template that displays search results based on a plugin. The wp_query contains all the taxonomy information to show the proper posts. How can I have two loops on the same results page? The first would contain posts from the query with the taxonomy of `ptype` and the term `featured`. The second loop contains all the rest of the posts from the main query EXCEPT the ones with the taxonomy of `ptype` and the term `featured`. When the posts are queried they are queried through two other custom taxonomies.


title: WP e-Commerce: Product images are loading or not randomly

text: Well, I have no clue why product images are loading or not randomly for product categories or featured products. It looks like code for image resizing is not generating proper image and it looks like               <img src="http://www.sportsanimall.com/index.php?wpsc_action=scale_image&attachment_id=1075&width=150&height=150" alt="Boston RedSox Vintage Baseball Hat" />      An example here: http://www.sportsanimall.com/products-page/hats-2/ and featured products example (bottom of the page): http://www.sportsanimall.com/products-page/featured-football-shirts/new-york- green-football-animals-t-shirt-large-logo/ Any thoughts? Thanks


title: What is the proper use of https in a modern E-Commerce environment?

text: Traditionally https was only used when absolutely necessary to protect personal and vital information. Checkout and account registration being the most common. The major reason for a lack of broad implementation was the computational overhead that slowed down performance. With the computational overhead no longer an issue(if you don't think so please research yourself and test, test, test), what is the proper use in today's environment. As I have been working on my sites I have started to come to the conclusion there is absolutely no downside to using it on the entire site for the following summarized reasons. 1) A good EV cert enhances customer confidence (a green address bar is never a bad thing) 2) Search engines still find your products (submitted through feeds anyway) 3) Performance is not an issue any longer 4) If you pay for the cert you may as well use it and get the enhanced credibility Is my logic flawed? Greater minds than I are on this site, looking forward to feedback. MM/RC


title: Widget instance options not showing correctly

text: i have a setup like               function form($instance) {         $defaults = array(             'title' => 'Recent Products',             'number_products' => 3         );         $instance = wp_parse_args($instance, $defaults);      but my title is ok but number_products always does not show. i debuged in netbeans and found that form() is run 2 times and 1st time, variables look like               $instance = array(0)     // after wp_parse_args,      $instance = array('title' => 'Recent Products', 'number_products' => 3);      on 2nd run of `wp_parse_args`, i dont know why it runs the 2nd time,               $instance = array('title' => 'Recent Products', 'number_products' => null);     // after wp_parse_args     $instance = array('title' => 'Recent Products', 'number_products' => null);      i dont really know whats happening ... can some1 enlighten me?


title: Which Blog Client for Windows/Linux has the best support for backing/restoring your posts?

text: I started using Akeeba Remote Control for Joomla and was really impressed with it. When I went to look for something similar for Wordpress, I found these Weblog clients. Which one is the best for backing/restoring up your content? (Existing and content that you add to the blog via the Weblog client)


title: Custom post type as page template

text:
I've been building my very first WordPress theme using the Advanced Custom Fields plugin. Here are the steps I've taken so far:   1. Created custom post type via functions.php.   2. Created archive-productions.php and customised the loop.   3. Created single-productions.php and customised. Everything is working perfectly! I'd like to display archive-productions.php on the homepage, so i've created a page template. I've tried everything I can to get it working, but it's coming up blank. I've spent many hours looking for a solution, but I've really hit a dead end. I always like to find my own solution, but on this occasion I need a push in the right direction. Your tips, links to tutorials or suggestions would be greatly appreciated. Thank you! Here's the loop I've tried on the page template:                    <?php        $args = array(           'post_type' => 'productions_cpt'           )        );     ?>          <?php $counter =0; ?>          <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>          <?php       ++$counter;       if($counter == 4) {         $postclass = ' last';         $counter = 0;       } else { $postclass = ''; }     ?>          <div class="thumb<?php echo $postclass; ?>">     <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>

          <?php endwhile; else: ?>
<?php _e('Sorry, no productions matched your criteria.'); ?>
     <?php endif; ?>


title: Template hierarchy about pagination after front-page.php

text: Quick, simple. I have `front-page.php` working in Wordpress, and these loops over the main loop for my latest posts. The problem is the pagination template. When I get to `site.com/page/2`, it shows the same file template `front- page.php`, but with the second round of posts. What I want is to show other file template, like `paged.php`, but not even `archive.php` or `date.php` shows up. Is there a code for this, instead of writing `if (!is_paged())` wrapping the entire front-page.php?


title: get_terms Parent Tags

text: I'm using a function that I think it uses this code to get the tags from a taxonomy:               if($taxonomy){ $tags = get_terms( $taxonomy, 'order=ASC&hide_empty='.$show_empty.'');      As it is, is extracts all the tags(parent & child) from that taxonomy. But what I need is to extract only the parent or child tags from a specific `tag_ID(14)`. I've tried to include `child_of=14` and `parent=0` but couldn't make it. Could you give a advice?


title: Wordpress theme with multiple color schemes

text: I am building a WP theme and want to implement multiple color schemes. I looked through different free and premium themes and found out that this feature is developed different ways there and here. What is the best practice to make multiple color schemes support in a theme?


title: Always using the same ARRAY on different querys

text: I have a function that returns an array os posts ids. At the moment, everytime i have a query i have to to this: $ids = agendados();   query_posts(array('post__not_in' => $ids ); Is there a way to maintain the array by calling that on header.php and use this array everytime a do a query_posts? I think that doing on my way its a overload of querys.. Thanks m8s Sorry about my poor english www.zarpa.eu


title: Find Memory Usage of Admin

text: I have seen tips which show you how to display the memory usage of your website. This usually involves adding php code to your website theme's function.php file. However, I am looking to display the memory usage in the admin, not on the front-end website. How can I display the memory usage of the wordpress admin from within the admin?


title: Add a script as a dependency to a registered script

text: `wp_register_script()` (see codex) allows you to specify dependencies: scripts that must be loaded before the one being registered is loaded (if it is loaded). But suppose the script is a third-party one (WordPress or another plug-in) so that you are not the one calling `wp_register_script()`. How can you inject a script as a dependency for a pre-registered script? **Remarks:** In my particular use-case the dependency is not strict - the registered script does not _require_ this second script, but the latter alters the original script. A similar question could be asked for styles, but I suspect the answers would be nearly identical.


title: can database and media folder be moved to a different drive?

text: I have to move my site from Drive `C:\` to Drive `E:\`. Is there a better way to do this than uninstalling the following:   * Wordpress   * PHP   * MySQL   * Apache and re-installing on Drive `E:\`? For example, how can I move just the database files and media folder to Drive `E:\`?


title: Enable / Add Custom Keyboard Shortcuts To Work With WordPress' HTML Editor

text: I use Markdown in my posts, and the plugin I use for that purpose requires the Visual editor be disabled. The HTML editor is pretty much just a text box. To make writing easier, I would like to enable some custom keyboard shortcuts that allow me to format text in markdown when a key combination is pressed (like `Ctrl` \+ `B`). How do I do this? Basically, I just want some of the keyboard shortcuts that work in Wordpress.StackExchange.com's post editor. And they are...   * `Ctrl` \+ `B` → **Bold Text**   * `Ctrl` \+ `I` → _Italic Text_   * `Ctrl` \+ `Q` → > Block Quote     * The above should work even if there are multiple lines of quoted text)   * `Ctrl` \+ `K` →     * wrap inline-text with `     * indent each line by four spaces if there are multiple lines **PS:** I don't know JavaScript or PHP, so please try to be as much clear as possible. Thanks.


title: Text Domains Across Multiple Plugins & Themes

text: A common situation: a developer builds an entire site, based on WordPress, of course, for a client. This site includes many custom plugins as well as a custom theme -- maybe another theme or a child theme or two for good measure. Doesn't make a lot of sense for all those custom plugins and such to have their own text domain. A single translator will probably doing all the work. It's also probably much easier to maintain a single set of translations. So, **how does one use a single text domain across multiple plugins and/or themes?** _Just so we're clear, I want the equivalent of`load_plugin_textdomain` and `load_theme_textdomain` that I can use for multiple plugins/themes._


title: Add Download Button in prettyPhoto Plugin

text: I would like to add a download button link for the full-sized image on the prettyPhoto lightbox when a user views a photo on my site. Currently I use the prettyPhoto Media plugin on my site, and I have also used this code (taken from this post) in order to allow prettyPhoto to view a smaller image than the full sized image in galleries so the loading time will be better:               function oikos_get_attachment_link_filter( $content, $post_id, $size, $permalink ) {              // Only do this if we're getting the file URL         if (! $permalink) {             // This returns an array of (url, width, height)             $image = wp_get_attachment_image_src( $post_id, 'large_image_size' );             $new_content = preg_replace('/href=\'(.*?)\'/', 'href=\'' . $image[0] . '\'', $content );             return $new_content;         }     }          add_filter('wp_get_attachment_link', 'oikos_get_attachment_link_filter', 10, 4);      But, since prettyPhoto now is only viewing a thumbnail size of the image, viewers cannot get the full-sized images (around 2000px wide), hence the desire to add a download button, so they can download the full image to use. Thanks!


title: Moving a test WP site to live

text: I am new to WP and want to check something before I start down a patch that might not work. Using WordPress can I easily change the site URL? For example, I have an existing website visible at www.mysite.com. I want to build a replacement site in WordPress, and while its being built I want it to appear at test.mysite.com. Once I've got everything set as I want and confirmed working I'd like to then have the same site replace the content of www.mysite.com. Is that easily doable? I've read a few articles about changing the site url but it seems to be rather complex involving database updates and whatnot. I'd imagine this is a fairly common request.


title: is it possible to get complete wordpress blog post in a rss feed?

text: I want to include images, time and date stamp? I'm using the google feed-control Api to load rss feeds but only get the title and body text from it. I would like to render the entire post blog post using rss feed, also if there is a better way to parse a feed other than the google feed control API http://code.google.com/apis/ajax/playground/#feed_control Thanks


title: insert post & Upload post thumbnail from the front end using ajax

text:
_**i have searched & searched for an explenation and have found some answers that seem to be working for other people on this topics but i havent been able to get working._** **This is my "form"**

<?php _e('Your Info', 'sagive'); ?>
         <input type="text" name="senderName" id="senderName" placeholder="Your Name" />         <input type="text" name="senderEmail" id="senderEmail" placeholder="Your Email" />         <input type="text" name="senderWebsite" id="senderWebsite" placeholder="Your Website" />         <input type="text" name="senderCountry" id="senderCountry" placeholder="Your Country" />

<?php _e('Pattern Info', 'sagive'); ?>
         <input type="text" name="patternName" id="patternName" placeholder="Pattern Name" />         <input type="file" name="patternImage" id="patternImage" size="14" placeholder="Upload Pattern" style="margin-bottom: 8px" />         <textarea name="patternDesc" id="patternDesc" class="patternDesc" placeholder="Short Description"></textarea>

<?php _e('Pattern Usage', 'sagive'); ?>
         <input type="checkbox" name="personalProjects" id="personalProjects" checked disabled />Free in personal projects
         <input type="checkbox" name="commercialProjects" id="commercialProjects" checked />Free in commercial projects
         <input type="checkbox" name="templatesYouSell" id="templatesYouSell" checked />Free in templates you sell

<?php _e('Upload Pattern', 'sagive'); ?>
              <input type="hidden" id="returnedId" value="" />

      .   **This is My javascript file**               jQuery(function($){           // CALL FOR NEXT 3 FEATURED BUSINESS     $('div#submitPattern').click(function() {             $.post(ajax_object.ajaxurl, {                 action: 'action_upload_pattern',                 sender_name: $('div#uploadPatternForm').find('input#senderName').attr('value'),                 sender_email: $('div#uploadPatternForm').find('input#senderEmail').attr('value'),                 sender_website: $('div#uploadPatternForm').find('input#senderWebsite').attr('value'),                 sender_country: $('div#uploadPatternForm').find('input#senderCountry').attr('value'),                 pattern_name: $('div#uploadPatternForm').find('input#patternName').attr('value'),                 pattern_image: $('div#uploadPatternForm').find('input#patternImage').attr('value'),                 pattern_desc: $('div#uploadPatternForm').find('#patternDesc').attr('value'),                 pattern_terms_personal: $('div#uploadPatternForm').find('#personalProjects').attr('value'),                 pattern_terms_commercial: $('div#uploadPatternForm').find('#commercialProjects').attr('value'),                 pattern_terms_templates: $('div#uploadPatternForm').find('#templatesYouSell').attr('value')             }, function(data) {                 var $response=$(data);                 var postid      = $response.filter('#postid').html();                 var success     = $response.filter('#success').html();                 var error       = $response.filter('#error').html();                           if(success) {                     // APPEND NRE ITEMS AND FADE IN SLOW                         $('input#returnedId').val(postid);                          // APPEND NRE ITEMS AND FADE IN SLOW                                     setTimeout(function(){                         $('div#pu_message').fadeOut('fast');                         $('div#pu_message').empty();                         $('div#pu_message').append(success);                                             $('div#pu_message').fadeIn('slow');                     }, 500);                 }                  });          });      }); .   **This is my ajax php listener**                   wp_enqueue_script( 'ajax-upload-pattern', get_stylesheet_directory_uri().'/ajaxLoops/ajax-upload_pattern.js', array('jquery'), 1.0 ); // jQuery will be included automatically     wp_localize_script( 'ajax-upload-pattern', 'ajax_object', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) ); // setting ajaxurl          add_action( 'wp_ajax_action_upload_pattern', 'ajax_action_upload_pattern' ); // ajax for logged in users     //add_action( 'wp_ajax_nopriv_upload_pattern', 'ajax_action_upload_pattern' ); // ajax for unlogged in users          function ajax_action_upload_pattern() {          $sender_name                =   $_POST['sender_name'];     $sender_email               =   $_POST['sender_email'];     $sender_website             =   $_POST['sender_website'];     $sender_country             =   $_POST['sender_country'];     $pattern_name               =   $_POST['pattern_name'];     $pattern_image              =   $_POST['pattern_image'];     $pattern_desc               =   $_POST['pattern_desc'];     $pattern_terms_personal     =   $_POST['pattern_terms_personal'];     $pattern_terms_commercial   =   $_POST['pattern_terms_commercial'];     $pattern_terms_templates    =   $_POST['pattern_terms_templates'];          /*** TESTING **     echo '

sender_name: '.$sender_name.'

sender_email: '.$sender_email.'

sender_website: '.$sender_website.'

sender_country: '.$sender_country.'

pattern_name: '.$pattern_name.'

pattern_image: '.$pattern_image.'

pattern_desc: '.$pattern_desc.'

pattern_terms_personal: '.$pattern_terms_personal.'

pattern_terms_commercial: '.$pattern_terms_commercial.'

pattern_terms_templates: '.$pattern_terms_templates.'

         ';     */               /****************************************     ** INSER NEW POST     ****************************************/     $title          =   $pattern_name;     $description    =   $pattern_desc;          $post = array(         'post_title'    => $title,         'post_content'  => stripslashes($description),         'post_status'   => 'pending',         'post_type'     => 'post',         'post_category' => array( 3 )     );          $postid     =   wp_insert_post($post, 10, 1);     do_action('wp_insert_post', 'wp_insert_post', 10, 1);                /****************************************     ** UPDATE POST META FIELDS     ****************************************/             // SENDER DATA META FIELDS     update_metadata('post', $postid, '_cmb_pattern_author_name', $sender_name);          if($sender_website) {         $noLinkAuthor = 'false';          update_metadata('post', $postid, '_cmb_no_link_author', $sender_website);     }             if($sender_website) {         $noLinkAuthor = 'false';          update_metadata('post', $postid, '_cmb_pattern_author_url', $sender_website);     }          // TERMS OF USE     update_metadata('post', $postid, '_cmb_terms_personal_projects', 'on');     if($pattern_terms_commercial == 'on') {update_metadata('post', $postid, '_cmb_terms_commercial_projects', 'on');}     if($pattern_terms_templates == 'on') {update_metadata('post', $postid, '_cmb_terms_resell_intemplates', 'on');}                       if (!function_exists('wp_generate_attachment_metadata')){                 require_once(ABSPATH . "wp-admin" . '/includes/image.php');                 require_once(ABSPATH . "wp-admin" . '/includes/file.php');                 require_once(ABSPATH . "wp-admin" . '/includes/media.php');             }              if ($pattern_image) {                     $attach_id = media_handle_upload( $pattern_image, $postid );             }             if ($attach_id > 0){                 //and if you want to set that image as Post  then use:                 update_post_meta($postid,'_thumbnail_id',$attach_id);             }                  echo '
'.__('Pattern Uploaded!', 'sagive').'
';     echo '
'.$postid.'
';          die(); // stop executing script     }      .   I am trying to grab all the data... create a new post and then upload & attach the image uploaded as the post thumbnail.


title: Add post_type to index.php

text: I search for an hour now without result. Does anyone can explain me how to show my custom post_type (dictionnaire) in the homepage (index.php). I use 'Easy post type' to add custom post types and I checked the "Query Var" checkbox. Please help... The only posts that appears in my homepage are the regular one.


title: Display posts and thumbnails with certain tags

text:
I want to display specific posts from an array with specific tags i.e. "Bolivia" and "Brazil" and then show the post thumbnail and permalink. This is the code I am using so far but as you can see I am not calling the tags. Thanks.               <?php query_posts(array('category__in' => array(4), 'posts_per_page' => 4)); ?>                  <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                        <?php $currentid = get_the_id(); ?>
                          <a href="<?php the_permalink(); ?>"><?php echo get_the_post_thumbnail($currentid, array(120, 100)); ?>

<?php the_title(); ?>

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


title: Importing custom post types using WordPress Importer, how to check for meta field values

text: I have a custom post type that takes only the title field. Associated with it I have a custom meta field that takes a URL. I am using the WordPress Importer plugin (http://wordpress.org/plugins/wordpress-importer/) to import posts from another site into this one, and by default WP checks whether there is the same post type and whether there are any same titles, in which case it skips over that record. Now I not only want to check for title but also for that URL meta field, because in this case it is more of a unique identifier, how can I do that?


title: Gallery plugin forces itself above text

text:
I am using the 'gamma-gallery' plugin. A little modified, that is. The gallery is forcing itself above any text that was in the post. Any idea why that is? Here is the plugins code, if needed:               <?php     /*     Plugin Name:Gamma Gallery     Plugin URI: http://wordpress.org/extend/plugins/gamma-gallery/     Description: A responsive wordpress gallery with montage image arrangement.     Author: ezhil     Version: 1.8     Author URI: http://profiles.wordpress.org/ezhil/     License: GPLv2 or later     */               define( 'GG_PATH', content_url().'/plugins/gamma-gallery' );           remove_shortcode('gallery', 'gallery_shortcode'); // removes the original shortcode        add_shortcode('gallery', 'gamma_gallery'); // add your own shortcode             // loads jquery     function jq_gg_load()     {     wp_enqueue_script('jquery');     }     add_action('wp_enqueue_scripts','jq_gg_load');         function gamma_gallery($attr) {         $post = get_post();     //    echo $post;     //        examine($post);              static $instance = 0;         $instance++;              if ( ! empty( $attr['ids'] ) ) {             // 'ids' is explicitly ordered, unless you specify otherwise.             if ( empty( $attr['orderby'] ) )                 $attr['orderby'] = 'post__in';             $attr['include'] = $attr['ids'];         }              // Allow plugins/themes to override the default gallery template.         $output = apply_filters('post_gallery', '', $attr);         if ( $output != '' )             return $output;              // We're trusting author input, so let's at least make sure it looks like a valid orderby statement         if ( isset( $attr['orderby'] ) ) {             $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );             if ( !$attr['orderby'] )                 unset( $attr['orderby'] );         }              extract(shortcode_atts(array(             'order'      => 'ASC',             'orderby'    => 'menu_order ID',             'id'         => $post->ID,             'include'    => '',             'exclude'    => ''         ), $attr));              $id = intval($id);         if ( 'RAND' == $order )             $orderby = 'none';          //    the_content();     //  echo $text;          ?>     <link rel="stylesheet" type="text/css" href="<?php echo GG_PATH;?>/css/style.css"/>                          <link rel="stylesheet" type="text/css" href="<?php echo GG_PATH;?>/css/noJS.css"/>

                         <?php                  $photos = lc_grab_ids_from_gallery($post);                    if ($photos) {$ct=0;             foreach ($photos as $photo) {$ct++;                 $imgdata = get_post($photo);     //            examine($imgdata);         // data-attachment_url="<?php //echo $imgdata; >"                 $url = get_attachment_link( $imgdata->ID );     ?>     <li data-attachment_url="<?php echo $url; ?>">         <?php //examine($photo); ?>         <div data-alt="img<?php echo $ct;?>" data-description="
<?php          $imgdata = get_post($photo);         if($imgdata->post_excerpt != '')             echo $imgdata->post_excerpt;         else             echo $imgdata->post_title;     ?>
" data-max-width="3000" data-max-height="2200">                                     <div data-src="<?php $image_attributes = wp_get_attachment_image_src( $photo, 'xxlarge');echo $image_attributes[0]; ?>" data-min-width="2000">
                                     <div data-src="<?php $image_attributes = wp_get_attachment_image_src( $photo, 'xlarge');echo $image_attributes[0]; ?>" data-min-width="1300">
                                     <div data-src="<?php $image_attributes = wp_get_attachment_image_src( $photo, 'xlarge');echo $image_attributes[0]; ?>" data-min-width="1000">
                                     <div data-src="<?php $image_attributes = wp_get_attachment_image_src( $photo, 'large');echo $image_attributes[0]; ?>" data-min-width="700">
                                     <div data-src="<?php $image_attributes = wp_get_attachment_image_src( $photo, 'large');echo $image_attributes[0]; ?>" data-min-width="300">
                                     <div data-src="<?php $image_attributes = wp_get_attachment_image_src( $photo, 'medium');echo $image_attributes[0]; ?>" data-min-width="200">
                                     <div data-src="<?php $image_attributes = wp_get_attachment_image_src( $photo, 'medium');echo $image_attributes[0]; ?>" data-min-width="140">
                                     <div data-src="<?php $image_attributes = wp_get_attachment_image_src( $photo, 'medium');echo $image_attributes[0]; ?>">
                                                                              <img src="<?php $image_attributes = wp_get_attachment_image_src( $photo, 'medium');echo $image_attributes[0]; ?>" alt="img<?php echo $ct;?>"/>

     <?php              }            } ?>

     <?php          gg_load_scripts();     }     ?>


title: Tags, use both union and intersection at the same time

text: I have tags on posts and I want a display based on the following logic: If it has the "biology" tag AND it has either the "female" or "male" tag. biology AND (female OR male) Here's what I attempted but it didn't work: http://www.example.org/tag/biology+female,male Obviously the above is ambiguous, is there a way to do what I'm needing?


title: Filter Custom Post Type in Admin

text: I have a custom post type that has custom meta that I want to be able to filter on the Admin page. Much like the "All | Published | Drafts | and Trash" links located above the post list. I can't seem to find a hook to hook into. Does one exist? This question isn't exactly what I am asking. I would prefer not to have the filter dropdown, but instead a link like …               All | Published | Drafts | Trash      … across the top of the editor.


title: WP_query paged pagination with excluded category still counts it

text:
So im making a custom WP_query loop with paged navigation. I want to show 4 posts per page in a specific category. This is working fine, except the next_post_link() seems to still count the excluded catoegories when determining to show the link or not. How do i make sure that the post count is excluding the others categories, so that the next link only shows up if there is more then the 4 shown posts in that specific category?. my code:
             <?php                       $args = array ('post_type' => 'post','category__in' => array( 1 ), 'posts_per_page'=> 4, 'paged' => get_query_var('paged'),);                 $posts_query = new WP_query( $args );             ?>                       <?php //Starts the news loop ?>             <?php if ( $posts_query->have_posts() ) : while ( $posts_query->have_posts() ) : $posts_query->the_post(); ?>
                     <?php //get the posts featured image in the right size = "featured-image" ?>                     <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'newsbox-image'); ?>                     <img src="<?php echo $image[0]; ?>" alt="Post image" width="700" height="400" />

<?php the_title(); ?>

<?php the_time('j F, Y'); ?>

                          <a class="read-more" href="<?php the_permalink() ?>">
             <?php endwhile; else: endif;?>
                           <?php previous_posts_link('Nyere'); ?><?php next_posts_link('Ældre'); ?>                       <?php wp_reset_postdata(); ?>      Any help in understanding this is much appreciated


title: Sub category text in the URL of wordpress site

text: I am launching a site about mobile and it is in **wordpress**. URL structure is as follow example.com/unlock/company/model example.com/how-to/company/model **Unlock** and **how to** are **parent category** and **company** is **subcategory** of both. Now I have to create the company subcategory twice for both the parent category. In that case slug will be different. for eg. example.com/unlock/apple/something example.com/how-to/apple_/something Apple is present in both the unlock and how to category. Same slug cannot be used, so I am using **apple** for unlock and **apple_** for how to, as same **slug** cannot be used. I am try to get a user friendly URL. But does it effect the SEO negatively?


title: global function to apply filter to custom field

text:
I have an action hook which works perfectly for the_content. I would like to apply the same hook anytime a handful of custom_fields are requested. The custom fields are 1) myfieldone 2) myfieldart 3) myfieldestion So lets just take one of those - "myfieldone" Is there a way - where anytime "myfieldone" custom field is requested, that I could filter the value (the_content) of THAT custom field? I would assume it would be as simple as               add_filter('myfieldone', 'my_add_a_class_function', 10,8);     //or      add_action('myfieldone', 'my_add_a_class_function');      However neither of those have any effect. I've also tried to globally apply it to all get_meta, get_meta_key               add_filter('get_meta', 'my_add_a_class_function', 10,8);     add_filter('get_meta_key', 'my_add_a_class_function', 10,8);     //no such luck. What am I missing?      So I basically want to do               $which_meta_key = 'myfieldone';     add_action($which_meta_key, 'my_add_a_class_function');      Here's how I'm doing it with the_content.               add_action('the_content', 'my_add_a_class_function');     function my_add_a_class_function($content){              $sample_html = $content;              // grab all the matches for img tags and exit if there aren't any     if(!preg_match_all('//i', $sample_html, $matches))       exit("Found no img tags that need fixing\n");          // check out all the image tags we found (stored in index 0)     //print_r($matches);          // iterate through the results and run replaces where needed     foreach($matches[0] as $string){         // keep this for later so that we can replace the original with the fixed one         $original_string = $string;              // preg_replace only replaces stuff when it matches a pattern so it's safe to         // just run even if it wont do anything.              $classes = 'TEST'; // separated by spaces, e.g. 'img image-link'         // check if there are already classes assigned to the anchor         if ( preg_match('//', $string) ) {           $string = preg_replace('/()/', '$1 ' . $classes . '$2', $string);         } else {           $string = preg_replace('/(/', '$1 class="' . $classes . '" >', $string);         }              // now replace the original occurence in the html with the fix         $sample_html = str_replace($original_string, $string, $sample_html);            }           return $sample_html;         }      **UPDATE:** The below custom meta key call appears to work well. However - I am getting the "found no img tags that need fixing" {if /EXIT} message               ... // pass the custom_meta content to my filter.      $sample_content = $content     print_r($sample_content);          //YIELDS
     Peter, My brother-in-law informed me that he has a new job at IBM.
      However before I apply the filter - I check to see that there are images to filter. and exist if not. Apparently, no images are being found - although by the print_r - - an image tag clearly exists.               if(!preg_match_all('//i', $sample_html, $matches))       exit("Found no img tags that need fixing\n");          // YIELDS:     Found no img tags that need fixing          //however it does echo out my custom field html code, the image and paragraph text display - - because thats part of the get_meta_data - where I initially request the custom field.      **SO - QUESTION** \- is this a simple regex issue? Do I have mal-formed regex for my               preg_match_all ('//i'...      **OR** \- do I need to apply a "to_string" filter to the content so it finds an image as an image rather than just text


title: Automatically populate a hierarchical taxonomy from a custom field

text: I've got a vexing how-to that I've not found any help on. I have a custom post type that has a custom field with a date in it (format: yyyy-mm-dd-t). When a post is published or edited, I would like to have a function that automatically populates a hierarchical taxonomy with the year and date. So for example, if I entered "2003-03-15-1" into the custom date field, I would like it to include the custom taxonomy "2003" and its child taxonomy "03". But while I've seen code that will populate the parent taxonomy, I've not found anything that tells me how to populate the parent and the child. Surely such a thing is possible, right?


title: Using shortcodes to parse POST request (containing the data from a front-end form)

text: I would like to allow my subscribers to post classifieds, which are nothing but a custom post type with a few metas for the price, etc. (The existing classifieds plugins I have tried are way too complex for my needs.) I would like to know if the following makes sense.   * I define a [classifieds-form] shortcode displaying the form and I create a page (ie., a "page" post in the admin section) calling it.    * The content of the form is POST'ed to another page which calls the [handle-classified] shortcode, which checks if the user is logged in, parses the $_POST data, and inserts the custom post (with a 'pending' status, until an admin validates it). Does this sound reasonable to you? Or would you recommend a more "standard" way of doing this? Thanks a lot!


title: Disable plugin visibility at the plugin directory

text: Hello I have recently pushed my plugin's files to WordPress SVN trunk. Unfortunately, it's not a ready to use release. I don't want anybody accidentally download this half-baked 'release'. Can I disable the plugin at the WP plugin directory for some time?


title: sprintf bloginfo odditie

text:
Why the _disco funk_ this is happening I can't quite put my finger on - but I guarantee you it's because I'm probably missing some simple PHP best-practice:               <?php echo '
' . sprintf(__('Welcome to %s', 'roots'), bloginfo('name')) . '
'; ?>      For some reason outputs:               Site Name
Welcome to
      Any light nudges in the right direction would be really appreciated - and maybe a slap on the head once I figure out what's going on ;) Thanks!


title: How to get values from network settings panel?

text: I'm using wordpress 3.3. I've created a plugin My plugin details: My plugin creates a sub menu under Network settings and create two form fields to define adsense code (200 x 200 ad, 300 x 250 ad). Here is the screenshot. ![enter image description here](http://i.stack.imgur.com/qi4i8.png) This is my plugin code for network super admin. http://pastebin.com/88gLTK2a I'm using this code to print the code in my theme (sidebar).               <?php ads1(); ?>      and               <?php ads2(); ?>      But its not working.. When i use the plugin for **normal admins its working perfectly**. This is the plugin code for normal admins http://pastebin.com/8KxPDJKA This is the difference between both versions http://pastebin.com/diff.php?i=8KxPDJKA I have no idea why the normal admin version working and super admin version not working. I tried to print the function plugin itself, its working in network admin. But its not working when i call it outside the network admin. Can anyone tell me whats wrong in my code? Is there any special hook available to retrieve the value outside the network. **Update:** functions `ads1(); and ads2();` working. But they are working only within the plugin. I . They actually working. But when i use the same functions in my wordpress theme(sidebar.php) it doesn't output anything.


title: Option does not save or update upon page refresh

text:
So I managed to get the issue of headers working properly in my theme, but I have a new issue with options though. I have the three following pieces of code that work in the order I paste them: **Peice 1** All we do is capture that you hit the reset button, call the reset function, when we come back if the option aisis_reset is set to 'true' we then render a message and then update the option to false. pretty simple.                       $theme = AisisCore_Factory_Pattern::create('AisisCore_Template_Builder');                  if(isset($_POST['aisis_reset'])){                 $theme->reset_theme_options();             }                  $options = get_option('aisis_reset');             if($options == 'true'){                 echo '
SUCCESS!!!! All Options have been reset! You can start again!
';                 update_option('aisis_reset', 'false');             }      **piece 2** All we do here is say, do we have multiple options, if so delete each one, update the option to 'true' and redirect, else if we only have one, delete it, update the option and redirect. redirecting is done by getting the current url for your page and essentially redirecting to it. (IMO better then JS redirect.)               public function reset_theme_options(){         if(isset($this->_theme_option['admin_options'])){             foreach($this->_theme_option['admin_options'] as $option_name=>$value){                 if($value != false){                     delete_option($option_name);                 }             }                  $this->_update_option();             $http = new AisisCore_Http_Http();             wp_safe_redirect($http->get_current_url());              }else{             delete_option($this->_options['admin_options']);             $this->_update_option();             $http = new AisisCore_Http_Http();             wp_safe_redirect($http->get_current_url());         }          }      **piece 3 (final)** For now I have hard coded an option in for testing. all we do is say does this option exist? no, create it and set it to true, else set it to true.               protected function _update_option(){         if(get_option('aisis_reset')){             $option = get_option('aisis_reset');             update_option('aisis_reset', 'true');         }else{             add_option('aisis_reset', 'true');         }     }      So with that in hand:   1. Why Dose, upon a "redirect" the option, aisis_reset, never == 'true'? it's always false. Is it because I am redirecting? I assumed that if I save the option BEFORE I redirect then everything is fine.


title: How do I query the title (or handle?) of post meta fieldset (created with Simple Fields Plugin)

text: I am having a heck of a time trying to retrieve the title (or handle?) of my custom post meta fields. I am using the slmple fields plugin. http://wordpress.org/extend/plugins/simple-fields/ (as I understand it, this just makes use of 'normal' post-meta stuff. I have tried the `simple_fields_get_post_group_values()` function provided by plugin, as well as the following code I found in the WP codex, to no avail:               <?php $checkit = get_post_custom( 22 );      print_r($checkit);?>       I have also tried searching the database for the phrases themselves within phpMyAdmin, and they don't appear to be there, which is perplexing. I'm pretty new to all this stuff, so I am sure I am missing something obvious ;-) I would be extremely grateful for any advice or help anyone could offer. * * * I've circled (badly) the info I am trying to query. ![enter image description here](http://i.stack.imgur.com/kfqNy.png)


title: How To Capitalize Entries In the Taxonomy Box?

text: Users can enter term entries in a a taxonomy box (hierarchical) and I want to force that the entries be capitalized (first letter each word). I tried adding `text-transform:uppercase` css to the entry box and although it capitalizes the words "during-typing", it still doesn't register it as capitalized when the term is added to the entry. Meaning if the user doesn't press Shift to capitalize the words, it will show capitalized on the entry box (because of the css), but it will not show capitalized inside the taxonomy box. Reasons why this is needed: 1) In the front-end when displaying artists names, example like Michael jAckson, or bruce Springsteen, it wouldn't look good in the front end. 2) Another reason is in the taxonomy box, it doesn't look good when the artists' names are not capitalized. So any answers to the main issue? _Edit:_ I think an alternative I thought of is to put like a form validation, so when the user clicks "Add New" a popup box will appear saying that he must capitalize the words correctly. The problem is, I'm not very good at javascript, so I don't know what the code is. Can anyone provide the code to validate the entry in the taxonomy box if its capitalized correctly when the user clicks the 'Add New' button?


title: Add metabox without the container

text:
I want to add a second input identical in design/functionality to the Title text input, directly beneath it. I can use               add_meta_box('catchy_title', 'Short Title', array('catchyTitle', 'metaBoxShow'), 'post', 'normal', 'high');      And the content
          Enter shorter title here          <input type="text" autocomplete="off" id="catchy_title" value="'.$meta.'" size="20" name="catchy_title">
      However this puts a grey metabox around it. Should I even be using a metabox? I basically want to duplicate this field: ![title](http://i.stack.imgur.com/m78w6.png) but I end up with ![wrong](http://i.stack.imgur.com/rftad.png) and it's under the rich text editor too. Here is the full code if it helps: http://pastebin.com/NiFHAUmq


title: Anyone know of a plugin for WordPress that uses osCommerce?

text: I have be using osCommerce for years, for many sites, for our eCommerce clients and they love it. We build all our regular sites with WordPress, those clients love that to. I now want to do my eCommerce sites in WordPress but still wish to use osCommerce. Is there a plugin for this? Thanks for your help. G


title: Text in permalink

text: I've this kind of permalink for `post` type : `/widgets/%category%/%postname%/` And the problem is that when going to `/widgets` url (`http://mysite.com/widgets`) a not found page error (404) is displayed. What is the default template ? I've `index.php`, `archive.php`, `category.php`, `single.php` with some custom templates. And another thing that i think i should say is by creating a page with the slug of `widgets` and assigning it to a template, that error gone away and the content of that template comes up.


title: search through post-type attachments titles

text: I have a page where I show all the attachments of a page in a table which has `id=10`. I have hundreds of attachments and I would like to implement an AJAX search form that uses the title of attachment as key for search. Actually the problem is not in implementing the AJAX call, but the query that returns the attachments list.


title: WP Cron doesn't execute when time elapses

text: ## The goal I want to use `wp_schedule_single_event( )` to execute a single event that sends me an e-mail 8 minutes after the user submits a form. ## The issue The following code is in my `functions.php`:               function nkapi_send_to_system( $args ) {       wp_mail( 'xxx', 'xxx', $args );     }          add_action( 'nkapi_send', 'nkapi_send_to_system' );          function schedule_event( $id ) {       wp_schedule_single_event( current_time( 'timestamp' ) + 480, 'nkapi_send', array( $id ) );     }      And the following code is used to call `schedule-event`:               schedule_event( $_SESSION['insert_id'] ); // the $_SESSION var contains an INT      After waiting some more than 8 minutes there wasn't an e-mail in my inbox. ## What I tried With the plugin Core Control it's possible to see wich cron jobs are scheduled. ![Core Control screen](http://i.stack.imgur.com/dYCDN.png) After a couple of changes I managed to get them quite correct, and better, when I hit "Run Now", I actually get an e-mail in my inbox. But why the cron's don't execute when I visit my site after 8 minutes. What possibly is wrong with this code? I have to say that this is my first time using WP Cron. **I tried more** After the comment of **vancoder** id decided to test if the code works if I put the following code directly in the `functions.php`:               function schedule_event( $id ) {       wp_schedule_single_event( time(), 'nkapi_send', array( $id ) );     }          if ( isset( $_SESSION['insert_id'] ) ) {       if ( ! array_key_exists( 'insert_scheduled', $_SESSION ) || $_SESSION['insert_scheduled'] != $_SESSION['insert_id'] ) {         schedule_event( $_SESSION['insert_id'] );         $_SESSION['insert_scheduled'] = $_SESSION['insert_id'];       }     }      The downside of this code is, the user has to go to another page before this code is executed. But on the other side, this doesn't work either so that wouldn't be my first issue...


title: Can i have a single wordpress site to have two themes ( one for pc other for mobiles)

text: I have a wordpress site say at www.demo.com, now I have two themes one which I want to use this user is acessing the site from "PC" (computer) and a another theme, which is a full fledged mobile theme to be used only when the user is accessing from a mobile device ( such as an android phone, iphone, ipad or tablet). I did some googling and found that one of the solution is to have two websites like www.demo.com : this will have a theme for users accessing from computers www.m.demo.com : this will have a theme for mobile users But firstly is it possible to do what I am thinking that have a single site and the theme should change automatically after detecting the user's device. Please help me out on this, any help/ideas/suggestion/criticism/ any thing will be appreciated. Thanks


title: Replace link with form to pass variables to javascript / ajax

text:
I'm sending a single variable to javascript/ajax via a link, but want to send via a form so I can pass user input as well. (It's for a plugin that interfaces with an Echonest Remix python script to create audio edits). The short question is how can I receive this in a WP ajax javascript:               <form id="receive_me" method="POST">     Username: <input type="text" name="user_variable">     <input type="hidden" name="generated_var" value="'.$arguments.'">     <input type="submit" value="Submit">     </form>      The JS:               function glitch_player_display(generated_var) {           jQuery.ajax({             type: 'POST',             url: ajaxglitch_playerajax.ajaxurl,             data: {               action: 'ajaxglitch_player_ajaxhandler',               mix_name: mix_name             },             success: function(data, textStatus, XMLHttpRequest) {               var showglitchplayer = '#showglitchplayer';               jQuery(showglitchplayer).html('');               jQuery(showglitchplayer).append(data);             },             error: function(MLHttpRequest, textStatus, errorThrown) {               alert(errorThrown);             }           });         }      This is the PHP current:               function glitch_player_show_make_mix(){         $result = "";         $generated_var = wp_create_nonce("ajaxloadpost_nonce");         $arguments = "'".$nonce."'";         $link = '
'. "Link Title" .'
';         $result .= '
' . $link . '
';         $result .=  '
';         $result .= '
';         $result .= '
First Mix
';         return $result;     }               add_action( 'wp_ajax_nopriv_ajaxglitch_player_ajaxhandler', 'ajaxglitch_player_ajaxhandler' );     add_action( 'wp_ajax_ajaxglitch_player_ajaxhandler', 'ajaxglitch_player_ajaxhandler' );          function ajaxglitch_player_ajaxhandler(){         $generated_var = isset( $_POST['generated_var'] )? $_POST['generated_var'] : false;         error_log( "The generated_var is $generated_var" ); // write it to the error_log too.)      But I'm not sure how to receive the POST to javascript. Something along these lines?               $('#inputForm').submit(function glitch_player_display(mix_name)      I don't need a second php script do I? I'll be grateful for a point further (or at all) in the right direction. Thanks and stay well. ANSWER: Based on input below, here ONE OF THE WAYS to send the variable via form:               <form id="form_id" name="form" method="post">     Field Title: <input type="text" id="user_input" size = 2>     <input type="hidden" id="mix_name" value="'.$arguments.'">     <input id="btn-submit" type="submit" onclick="glitch_player_display()" value="Submit">     </form>      And here's the JS/jQuery               function glitch_player_display() {             user_input = document.getElementById("user_input").value ? document.getElementById("user_input").value : 2;             generated_var = document.getElementById("generated_var").value ? document.getElementById("generated_var").value : "Default_Var";             $(document).on('submit', '#form_id', function(event){                 event.preventDefault();             });             jQuery.ajax({                  beforeSend: function() {                     alert(generated_var + " in ajax user_input: " + user_input);                 },                 type: 'POST',                 url: ajaxglitch_playerajax.ajaxurl,                 data: {                     action: 'ajaxglitch_player_ajaxhandler',                     generated_var: generated_var,                     user_input: user_input                 },                 success: function(data, textStatus, XMLHttpRequest) {play_button                     var showglitchplayer = '#showglitchplayer';                     jQuery(showglitchplayer).html('');                     jQuery(showglitchplayer).append(data);                 },                 error: function(MLHttpRequest, textStatus, errorThrown) {                     alert(errorThrown);                 }             });         }      Note that we are not sending the variables to the js function `glitch_player_display()` as we were in the first case. We are picking it up within the JS function via `document.getElementById("user_input").value`. Also               beforeSend: function() {                     alert(generated_var + " in ajax user_input: " + user_input);                 },      Is just a way to test and see what the `jQuery.ajax` function is actually receiving. And since we're not actually calling another script via the submit button, it is necessary to invoke               $(document).on('submit', '#form_id', function(event){                 event.preventDefault();             });      So jQuery (or JS?) doesn't think it should be finding another script and generate an error, which in this case replaced user_variable with [object Object]. The object could be viewed by using `console_log()` and I think it was a huge error object.


title: add current-cat class to single post page

text: i know if you are on a category page..wp automatically ads `current-cat` class to the child of the parent category you are on. like               `<li class="cat-item cat-item-701 current-cat"><a href="http://goog.com/cat/subcat">Free Stuff</a>     </li>`      how can i do this for a singlepost page. I have `the_category();` in the single.php file and it shows both parent and child category. I want to add a `current-cat` class to the child cat when i am on the single post page. thanks in advance hopefully i did not confuse you.


title: How do I make just one of my pages a Blog Page?

text: I'm a newbie, so please excuse me. Notice the "static" nature of my site http://grandeduny.org/. The pages of this site are "wordpress static" by design, but I would like to have one Blog page, how is this done? I seem to be having a hard time with the concept of making pages unique, for example; how do you have widgets/sidebars on one page but not another? It's not readily apparent from the dashboard. Thanks in advance.


title: How to move a post to different post type with all meta data?

text: I'm trying to move a post from a custom post type called 'new cars' to 'sold cars' using the Post Type Switcher plugin, and the plugin works well, but the all meta data associated with this post still belonging to 'new cars' post type... So, the problem appears when I list categories from 'new cars' post type and that 'sold car' make, model, colour and other metas still there... Someone have an advice ?


title: Alternative tags for Highrise HQ integration with WordPress

text: I have a few forms on my website which is integrated to Highrise HQ. Once the user submits the form, the values are sent to Highrise. I want to assign a Highrise tag (along with 2 other tags) to every submission. So that makes a total of three tags being assigned to contact. I collect the tag as follows.               <input type="hidden" name="highrise_tag[]" value="tag 1" />     <input type="hidden" name="highrise_tag[]" value="tag 2" />      The third tag i want to collect is not static. It needs to be changed for every single page view. Hopefully for non logged in users I can use WP Session Manager plugin to assign session to visitors. I have the following array.               $tagArray = array("tag a","tag b");      I want to pick **tag a** or **tag b** from the array, and submit it to Highrise. How can I select a tag from the array which is alternative to every single visit the page receives. So it'll be like if I load the page now and **tag a** is assigned, the next time when the page loads, it should be **tag b**. Any thoughts?


title: Gallery Pagination by Row

text: I created a picture gallery at: http://ellenandjosh.com/?page_id=5. Currently, I have a loop that displays pagination after a certain number of images : http://pastebin.com/N6nRRUei. Normally this works fine...but normally I don't have images that are different widths. WordPress crops the image by height, the width is variable. What I'd like to do is after three rows of images, then add pagination buttons...instead of displaying the pagination buttons after a certain number of images...is this possible? Page 1 is ok, although some more images could go in the bottom row - page 2 only has two rows, and page 3 has a single image in row three - even though there are more images...it just functions so weird. Any suggestions are appreciated. Thanks, Josh


title: Simultaneously post in both WordPress.com and self hosted WordPress blog

text: I have a friend that wants to move her WordPress.com blog to self hosted. That part is done, except she would like to keep the WordPress.com blog going along the new self hosted. Is there a way to post simultaneously to both? I thought of making a plugin to post to Wordpress.com when she publishes on her self hosted blog. Is that possible? Ideally, she would post in her self hosted, and it would automatically post to WordPress.com.


title: Paginate result set from $wpdb->get_results()

text:
Is there an easy way to paginate the result set coming from $wpdb->get_results()? I want to get a paginated list of a user's comments on the author_archive page - some of the users of the community have > 500 comments, so pagination is important. Is there an in-built way of doing this with WordPress, or do I need to build it myself? [Updated to add code]                    <?php      $querystr = "         SELECT comment_ID, comment_post_ID, post_title, LEFT(comment_content,100) as comment_content, comment_date_gmt         FROM $wpdb->comments, $wpdb->posts         WHERE user_id = $thisauthor->ID         AND comment_post_id = ID         AND comment_approved = 1         ORDER BY comment_ID DESC         LIMIT 100      ";               $comments_array = $wpdb->get_results($querystr, OBJECT);          if ($comments_array): ?>

Recent Comments

                 <?                      $odd_even = "odd";                     foreach ($comments_array as $comment):                         echo "
comment_post_ID."/#comment-". $comment->comment_ID ."'>". $comment->post_title ." : ".mysql2date('l jS F, Y, g:ia',$comment->comment_date_gmt);                         echo "
".$comment->comment_content."
";                         $odd_even = ($odd_even == "odd" ? "even" : "odd");                    endforeach; ?>

      <? endif; ?>


title: jShowOff not showing numeric links, shows 'undefined' instead

text:
I made a content rotator with jShowOff in a wordpress site, and wanted to have numeric links to each slide, that normaly comes by default but somehow shows 'undefined', the only thing i found on the internet was that it has problems with jQuery under 1.6, and i believe wordpress has way above that.... tried a workaround by making a counter and giving each slide that title, but then it pops the number as a title, not just looking ugly but also like a bug...any help? Here's the code for the example:
                     <?php $my_query = new WP_Query('category_name=oficiais&posts_per_page=7');                         while ($my_query->have_posts()) : $my_query->the_post();                         $do_not_duplicate[] = $post->ID; ?>

                         <?php the_post_thumbnail('recent-thumbnail',array('title' => "")); ?>                         <?php the_title(); ?>

<?php $myExcerpt = get_the_excerpt();                         $tags = array("
", "
");                         $myExcerpt = str_replace($tags, "", $myExcerpt);                         $myExcerpt = str_replace("
", " ", $myExcerpt);                         echo $myExcerpt;                         ?>
<a href="<?php the_permalink(); ?>">Ver artigo

                     <?php endwhile; ?>


title: List authors with the last post title and order by last post date

text:
I want to list authors with last post data and order them by last post date. Now i have this codes but i don`t know how to edit them.               // Selects from tables wp_users and wp_posts, selecting published posts and ordering by its post_date, limited to 10             $querystr = "SELECT * from wp_users, wp_posts WHERE wp_users.ID = wp_posts.post_author AND wp_posts.post_type = 'post' AND wp_posts.post_status = 'publish' ORDER BY wp_posts.post_date DESC LIMIT 10";                    $news=$wpdb->get_results($querystr, OBJECT);                    foreach($news as $np)               {                 $authorID = $np->authorID;                 $author_nickname = $np->user_login;                 $author_displayName = $np->display_name;                 $author_niceName = $np->user_nicename;                 $post_id= $np->postID;                 $post_title= $np->post_title;                 $post_date= $np->post_date;      or this :               <?php     //displays all users with their avatar and their posts (titles)     $blogusers = get_users_of_blog();     if ($blogusers) {     foreach ($blogusers as $bloguser) {     $user = get_userdata($bloguser->user_id);     echo '
User ID ' . $user->ID . ' ' . $user->user_firstname . ' ' .      $user->user_lastname . '
';       echo get_avatar( $user->ID, 46 );       $args=array(       'author' => $user->ID,       'post_type' => 'post',       'post_status' => 'publish',       'posts_per_page' => -1,       'caller_get_posts'=> 1     );     $my_query = null;     $my_query = new WP_Query($args);     if( $my_query->have_posts() ) {       //echo 'List of Posts for ' . user->user_firstname . ' ' . $user->user_lastname;       while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to    <?php the_title_attribute(); ?>"><?php the_title(); ?>
         <?php       endwhile;     }       wp_reset_query();  // Restore global post data stomped by the_post().     }     }     ?>


title: Add placeholder attribute to comment form fields

text: I have been trying to add to the default WordPress comment form. I need to add placeholder="" to each field. I can't figure out the filter. I don't get any errors but I don't see the placeholder either. After searching the posts here for an hour, I came up with this so far               function my_fields($args){             $commenter = wp_get_current_commenter();             $user = wp_get_current_user();             $user_identity = $user->exists() ? $user->display_name : '';                  $req = get_option( 'require_name_email' );             $aria_req = ( $req ? " aria-required='true'" : '' );         $fields['author'] = '<input id="author" placeholder="name" name="author" type="text" value="'          . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>';              return $args;     }          add_filter('comment_form', 'my_fields');      I have tried many different variations and tried returning many different things but am having no luck.


title: Merging separate works in wordpress

text: I am caught up in some scenario. Actually my team is working on developing a site using wordpress. They will be working on their machines(localhost) and preparing the pages that come under their share of work. Finally I have to merge those pages into a single site. How can i do that. Thanks in advance Pranay Lasod


title: Adding rel="nofollow" to external links in posts?

text: I've tried three plugins to do this, non of them worked (I'm using WP 3.01):   * http://wordpress.org/extend/plugins/sem-external-links/   * http://wordpress.org/extend/plugins/external-nofollow/   * http://wordpress.org/extend/plugins/nofollow-external-links/


title: What should I do to make generated avatars different for anonymous comments?

text: All the comments on my website are anonymous and without registration. To post a comment you have to fill the fields name (not obligatorily) and the text of your comment (obligatorily). I have the problem with the avatars. All of them are generated the same. What should I do to make them different?


title: open cform in a modal windows

text: I want to add a custom button in my theme, On clicking this button I want to open a modal window with cform II. How to do that? I tried to do that with from lightbox plugin, but it does not work... Any help greatly appreciated.


title: wp_pagenavi on WP_Query using customfields

text:
I have been searching this subject for some time now, not finding a solution. First of all, sorry for my bad spelling. Im quit new to PHP, so please be gental. Im using this to list some customfields:               <?php     $my_query = new WP_Query(array(         'post_type'=>'post',         'posts_per_page'=>'1'     ));               while ($my_query->have_posts())     {         $my_query->the_post();              $emne = get_field( "emne" );         $titel = get_field( "titel" );         $forfatter = get_field( "forfatter" );         $billede = get_field( "billede" );         $land = get_field( "om_foredragsholder" );              { ?>                        <a href="<?php the_permalink(); ?>" style="cursor:pointer;">

<?php echo $emne ?>

"<?php echo $titel ?>"

<?php echo $forfatter ?>

Mere info

                         <img src="<?php echo $billede ?>" />

                         <img src="<?php bloginfo('template_directory'); ?>/images/booknu.jpg" />

                       <?php         }     }      ?> Please, can some one help me getting working? I have installed the plugin WP- PageNavi. Thank you so much.


title: How to associate two different post types (think Book and Chapter)

text: I just recently started learning Custom Post Types, but haven't been able to find any documentation that would allow me (at least in the admin) to nest them. My requirements are, a book post type with cover image (feature image) and description/summary (editor), and a chapter post type with chapter image (featured image), editor, excerpt Both of these are easy, and really quick to accomplish, only hard part is I need them nested, so when you click into a book in the admin, you can see/edit the details, and add a chapter from there.


title: MySQL select query with ajax

text:
I am passing variable with ajax to list.php in my twentytwelve template. In list.php I am executing mysql select query but when I see in console I am getting this error:
     Fatal error:  Call to a member function get_results() on a non-object in D:\xampp\htdocs\wordpress\wp-content\themes\twentytwelve\list.php on line 4
         **My Code:**   search.php                 <?php     /*     Template Name: Search     */     get_header();?>                         <select id="parent_category" name="parent_category">         <option value="" selected="selected">-- Select blood group --</option>         <option value="A1 positive">A1 positive</option>         <option value="A1 negative">A1 negative</option>         <option value="A2 positive">A2 positive</option>         <option value="A2 negative">A2 negative</option>         <option value="B positive">B positive</option>         <option value="B negative">B negative</option>         <option value="A1B positive">A1B positive</option>         <option value="A1B negative">A1B negative</option>         <option value="A2B positive">A2B positive</option>         <option value="A2B negative">A2B negative</option>         <option value="AB positive">AB positive</option>         <option value="AB negative">AB negative</option>         <option value="O positive">O positive</option>         <option value="O negative">O negative</option>         <option value="A positive">A positive</option>         <option value="A negative">A negative</option>     </select>          <select id="child_category" name="child_category">       <option value="">-- No location selected --</option>     </select>          <?php get_footer(); ?>         list.php                 <?php     if(isset($_POST['parent_category']) && $_POST['parent_category'] != '')     {            $result = $wpdb->get_results( "SELECT home_location FROM wp_places WHERE blood_group LIKE '".$getGroupType."%'" );         print_r($result);        }     ?>         Any ideas or suggestions? Thanks.


title: How to show a custom meta box on the "Quick Edit" screen?

text: I've used add_meta_box() to add a custom meta box to the WordPress edit window on both pages and posts. How can I make this meta box also show on the "Quick Edit" screen? Ideally, I'd like it to appear just to the right of the Categories selector.


title: have_posts() execution failure

text:
I wanted to create a loop which displays search results in _search.php_ file. I followed all of the instructions in the WordPress Codex tutorial located in here: https://codex.wordpress.org/The_Loop I have implemented the suggested code on my page like this:               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
     <?php endif; ?>      The problem is that the `else` condition fires (displaying _'Sorry, no posts matched your criteria.'_ ) suggesting that the `have_posts()` function failed or returned no posts, but I am sure that what I am typing into the search box should return a lot of results. **IMPORTANT:** I know that a lot of people in that situation suggest to use the `WP_Query` instance to get search results, and that does work, but the problem is I can't implement this suggestion. That's because I am also using a search enhancing plugin. It enhances relevance of search results and requires that **no** custom (`WP_Query`) calls are made, it allows only standard The Loop calls. That is why I need to fix the problem with `have_posts()`. **Could anybody suggest me what might be the cause of`have_posts()` execution failiure?** The full page code is below:               <?php          get_header();          the_post();      ?>          <?php define('WP_USE_THEMES', false); get_header(); ?>

                             <form action="<?php bloginfo( 'url' ); ?>" method="get">
                                      <input type="text" name="s" value="<?php echo get_search_query()?>"  placeholder="Search..."/>                                 <input type="submit" name="searchsubmit" value="" class="submit"/>
                             </form>

     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
     <?php endif; ?>

                                     <?php wpbeginner_numeric_posts_nav(); ?>

          <?php get_footer(); ?>


title: Filter pre_get_posts does not modify Mine/All/Pending

text: Maybe I need to use a different filter, but I am using the pre_get_posts filter to filter out posts on a custom post list view. It works for the main table, but the quicklinks to (All) (Published) (Pending) etc still show the full counts, not the modified query counts. Any thoghts on how to change that?


title: WordPress showing strange characters - UTF8

text: I've just changed webserver but are having some problems with the encoding of the new site. I have exported part of my WordPress site from my old webhost and imported into my new WordPress multsite setup. Everything looks fine from the database, but when viewing the site within WordPress it's all messed up with strange characters. The content is in Norwegian, and contains characters like `æ, ø, å` but instead of these I now get ` Ã¦ Ã¸ Ã¥ ` The database is set to use *utf8_general_ci* WordPress config file is set to: `define('DB_CHARSET', 'utf8');` `define('DB_COLLATE', 'utf8_general_ci');` I'm having a hard time figuring out why this doesn't show correctly when the encoding seem right as well as the database content. Only from the WordPress side the content is messed up. I'm using HeidiSQL to import the data from the old server. Any ideas of what wrong here? * * * **UPDATE!** By removing the utf8 from the wp-config file like showed below, the strange characters goes away... `define('DB_CHARSET', '');` `define('DB_COLLATE', '');` **BUT, is this a safe way to go?**


title: How to hook into action/filter call

text: I'm about to create a very simple logging plugin. Every time an action or filter is fired I need to log it to the file. The idea is that we will be able to see exactly which actions and filters are executed (and functions they run) for every page load. This includes the order that they run in.


title: mystile fatal error call to a member function is_visible() on a non-object

text: Wordpress version: 3.5.2 Woocommerce version: 2.0.13 Following is the code that is giving the error. The code is of product search. Although the function reads search by tag it doesn't. It searches based on other criterias taken from the checkboxes and drop down menus. In the code below, I've mentioned the line because of which the error started, by commenting besides it.               add_filter('the_posts', 'search_by_product_tag');          function search_by_product_tag($posts, $query = false)     {     //var_dump($_GET);     //$new_posts = array();     if($_GET['sh']=='search')     {     $search_tags = array(         'destination' => $_GET['destination'],          'days' => $_GET['days'],         'budget' => $_GET['budget']     );     //var_dump($search_tags);die();     $ignoreIds = array(0);     foreach($posts as $post)     {         $ignoreIds[] = $post->ID;     }     $matchedTags = get_post_by_tag($search_tags, $ignoreIds);     //var_dump($matchedTags);     if ($matchedTags)      {         foreach($matchedTags as $product_id)         {                $posts[] = get_posts($product_id->object_id);         }     }     return $posts;       }     if($_GET['f']=='filter')     {     //$filter_tags = array(         if(isset($_GET['price'])){             $price_range = $_GET['price'];               $price = $price_range;         }         else{             $price = "";         }              if(isset($_GET['holiday'])){             $holiday_type = $_GET['holiday'];                $holiday = implode("','", $holiday_type);         }         else{             $holiday = "";         }              if(isset($_GET['tour'])){             $tour_category = $_GET['tour'];              $tour = implode("','", $tour_category);         }         else{             $tour = "";         }       /*$ignoreIds = array(0);       foreach($posts as $post)       {          $ignoreIds[] = $post->ID;       }*/       $new_post = array();       //$matchedTags = get_post_by_filter_tag($price_range,$holiday_type,$tour_category, $ignoreIds);      $matchedTags = get_post_by_filter_tag($price,$holiday,$tour, $ignoreIds);      //var_dump($matchedTags);die();      if ($matchedTags)       {         foreach($matchedTags as $product_id)         {                $new_post[] = get_posts($product_id->ID); //Error was given after I added this line instead of the default given below             //$posts[] = get_post($product_id->id);         }     }     return $new_post;     die();     }          return $posts;     }     function get_post_by_tag($tags, $ignoreIds)      {     //Check for      global $wpdb, $wp_query;      $ignoreIdsForMySql = implode(",", $ignoreIds);     //var_dump($ignoreIdsForMySql);          //dynamic query     $query = "select distinct tr.object_id from $wpdb->terms t         inner join $wpdb->term_taxonomy tt on t.term_id = tt.term_id         inner join $wpdb->term_relationships tr on tt.term_taxonomy_id = tr.term_taxonomy_id         inner join $wpdb->posts p on p.ID = tr.object_id         inner join $wpdb->postmeta pm on p.ID = pm.post_id         and t.name IN ('".$tags['destination']."','".$tags['days']."')         where pm.meta_key = '_price' and pm.meta_value = '".$tags['budget']."'         and p.post_status = 'publish'         and p.post_type = 'product'         and (p.post_parent = 0 or p.post_parent is null);";          //var_dump($query);     //Search for the sku of a variation and return the parent.      $matchedProducts = $wpdb->get_results($query) ;          //var_dump($matchedProducts);     if(is_array($matchedProducts) && !empty($matchedProducts))     {     //var_dump($matchedProducts);     $wp_query->found_posts += sizeof($matchedProducts);     //var_dump($wp_query->found_posts, sizeof($matchedProducts));     return $matchedProducts;          }           //return get_post($product_id);          return null;     }          //function get_post_by_filter_tag($price_range,$holiday_type,$tour_category,$ignoreIds)       {     function get_post_by_filter_tag($price,$holiday,$tour,$ignoreIds)     {     //Check for      global $wpdb, $wp_query;     //$ignoreIdsForMySql = implode(",", $ignoreIds);     /*$price = $price_range;     $holiday = implode("','", $holiday_type);     $tour = implode("','", $tour_category);*/     //var_dump($ignoreIdsForMySql);          //dynamic query     $query = "select distinct p.ID from $wpdb->terms t          inner join $wpdb->term_taxonomy tt on t.term_id = tt.term_id         inner join $wpdb->term_relationships tr on tt.term_taxonomy_id = tr.term_taxonomy_id         inner join $wpdb->posts p on p.ID = tr.object_id         inner join $wpdb->postmeta visibility on p.ID = visibility.post_id             and visibility.meta_key = '_visibility'         and (visibility.meta_value = 'visible' or visibility.meta_value ='search')         inner join $wpdb->postmeta pm on p.ID = pm.post_id         and t.name IN ('".$holiday."','".$tour."')         where pm.meta_key = '_price' and pm.meta_value <= $price         and p.post_status = 'publish'         and p.post_type = 'product'         and (p.post_parent = 0 or p.post_parent is null);";             //Search for the sku of a variation and return the parent.      $matchedProducts = $wpdb->get_results($query) ;           var_dump($matchedProducts);//die();     if(is_array($matchedProducts) && !empty($matchedProducts))     {       //var_dump($matchedProducts);     $wp_query->found_posts += sizeof($matchedProducts);     //var_dump($wp_query->found_posts, sizeof($matchedProducts));     //var_dump($wp_query);     return $matchedProducts;          }          //return get_post($product_id);          return null;     }


title: Custom image size not regenerating when image editted

text: I have a custom image size at 200x150 that works fine in a plugin I'm working on. Uploading new files is no problem but when I edit an image, the default image sizes get regenerated but my custom size does not. Is there a way to force the regeneration programatically in a filter or something?


title: Order posts with a custom field but also without

text: I am querying and ordering posts with this code but my theme adds the custom field (cb_vote_nb_vote) only if someone clicks the "vote" button, since I am doing a listing, posts created without that custom field under a specific category must also be displayed. How do I achieve that?               global $wp_query;     $paged = $wp_query->get('paged') ? : 1;     $posts_per_page = 10; // feel free to change this     $args = array(     'cat'            => 47,     'meta_key'       => 'cb_vote_nb_vote',     'orderby'        => 'meta_value',     'order'          => 'DESC',     'paged'          => $paged,     'posts_per_page' => $posts_per_page     );     $query = new WP_Query( $args );     if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();          $current_order = ( $query->current_post + 1 ) + ( $posts_per_page * ( $paged - 1) );     echo 'Current post order is :' . $current_order;          endwhile; endif;     wp_reset_postdata();


title: How Do I Use The Wordpress Plugin Posts 2 Posts by Scribu?

text:
I have a Wordpress site that relies on relationships quite heavily. It's a record label website where artists can be related to tours, reviews, album releases and store items throughout the site. I found the plugin Posts to Posts by Scribu which seems to do what I want, but I don't understand how to use it properly. Scribu has posted example code, but for some reason I just cannot understand it. Here is an example of what I want to do with the site I am working on. **Tours Page.** A tour item has a title and a custom meta field called 'tickets_link' Upon loading the tours page, all tours will be shown with their assigned artist and if it has a tickets link, then show that as well. If someone here can understand the code posted on Scribu's site for the plugin and then explain it to me, I would gratefully appreciate it. * * * **Here is my code from the functions.php file registering the connections:**                   function my_connection_types() {         if ( !function_exists('p2p_register_connection_type') )             return;              p2p_register_connection_type( 'tours', 'artists' );         p2p_register_connection_type( 'homepage_carousel', 'artists' );         p2p_register_connection_type( 'duka', 'artists' );         p2p_register_connection_type( 'products_carousel', 'artists' );     }       add_action('init', 'my_connection_types', 100);      * * * **Pseudo code to show what I want to do in my code:**   * Fetch all tours in my tours custom post archive using a loop that gets all tours added to the site.   * Each tour is related to an artist, so display all tours for a particular artist.   * Items are in the form of a heading (artist name) and each item is a tour that has been related to a particular artist in the backend using the metabox that shows as a result from registering a connection. * * * **Further update along with code I am using and print_r values.** I have the related artists showing up in my print_r contents of my query where before I didn't. When I do a print_r I get the following that shows up, but no way of accessing the data.               [connected_connected] => Array ( [0] => stdClass Object ( [ID] => 245 [post_author] => 1 [post_date] => 2011-03-10 13:55:23 [post_date_gmt] => 2011-03-10 13:55:23 [post_content] => [post_title] => 1200 Techniques [post_excerpt] => [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => 1200-techniques [to_ping] => [pinged] => [post_modified] => 2011-03-10 13:55:23 [post_modified_gmt] => 2011-03-10 13:55:23 [post_content_filtered] => [post_parent] => 0 [guid] => http://localhost/testdev/?post_type=artists&p=245 [menu_order] => 0 [post_type] => artists [post_mime_type] => [comment_count] => 0 [p2p_id] => 2 [p2p_from] => 215 [p2p_to] => 245      **The code I am using to relate artists with tours is the following:**               $connected = new WP_Query(array(         'post_type' => 'tours',         'nopaging' => true,         'each_connected' => array(             'post_type' => 'artists',             'nopaging'  => true,         ),         'suppress_filters' => false     ));          while( $connected->have_posts() ): $connected->the_post();         the_title();         echo "
";     endwhile;             print_r($connected); // Print_r for showing contents of post object.      * * * **Update for Scribu:**               $args = array     (         'post_type'        => 'tours',         'nopaging'         => true,         'suppress_filters' => false     );          $connected = new WP_Query($args);          while($connected->have_posts()): $connected->the_post();              the_title();         echo "
";              foreach ($connected->connected AS $tour_item)         {             echo get_the_title($tour_item->ID);             echo "
";         }          endwhile;