title: add_rewrite_rule and attachment_id

text: Im trying to add a rewrite rule to make this mysite/?attachment_id=106 view like this mysite/series/106 Ive looked evetywhere in this site and others and its very confuse because there are lots of diferent ways to do it. Ive tried is editing functions.php file in my themes folder, adding this at the begining of the file:               add_rewrite_rule('series/([^/]+)/?$', 'index.php?attachment_id=$matches[1]', 'top');      And the latest one ive tried               add_filter( 'query_vars', 'wpa56345_query_vars' );          function wpa56345_query_vars( $query_vars ){         $query_vars[] = 'attachment_id';         return $query_vars;     }          add_action( 'init', 'wpa56345_rewrites' );          function wpa56345_rewrites(){         add_rewrite_rule(             'series/(\d+)/?$',             'index.php?attachment_id=$matches[1]',             'top'         );     }      Please apologize my english (im from Argentina), and apologize if this was already answered. Thanks


title: How can a left and right margin be added to the admin bar without access to "...wp-includes/admin-bar.php"?

text: I do not have access to _"wp-includes/admin-bar.php"_ due to security restrictions placed by my host, they have advised me to use css stylesheets which I am not familiar with. I am looking to add a left and right sided margin to the links (login/register/sign out etc) in the admin bar so they align with the main content and display correctly on mobile devices. How can this be achieved?


title: including image assets in widget

text: I've written my first simple WP widget-- it all works fine, but I'd like to dress it up a bit, and add an image / logo in the widget display code. How do I package the widget (which is just a single PHP file) with the image, and where will the image be stored in the WP site (so I can create the img tag link correctly)? I know I could easily host the image externally and just "hotlink" to it from within my widget, but that seems a little hackish. Thanks


title: Archive Template being used instead of Category Template for Custom Post Type

text: I have a Custom Post Type created, that has its own Custom Taxonomy that give the Posts their own Categorys. I am currently building the Templates. The Custom Post Type has the slug `service`, and the Custom Taxonomy has the slug `service-category`. I have created the template file `archive- service.php`, and that works fine, but when I try to go into one of the Categories created (and listed) from what is there, it uses the template `archive.php`, and when I do `var_dump(get_post_type())`, I get `service`. I have the template `archive-service-category.php`, `category-service.php` and `category-service-category.php`, but I still get the same `archive.php` template being used. Can someone tell me what I am doing wrong, or what I have overlooked?


title: Display amount of pending posts in back/front end

text: I want to display the total amount of pending posts that my site has. My site is a single site, not a network. I am looking to echo that count in the back- end (a custom plugin page) and in the front-end. ![enter image description here](http://i.stack.imgur.com/k9rnD.jpg) How can I do this?


title: How can someone submit a comment when my site has no comment field?

text: I was a bit surprised when I got a message that a comment was awaiting moderation on a website where I have I have turned off `Allow people to post comments on new articles` and there are no comment fields. How can someone then submit a comment?


title: Custom Permalink Base

text: To enable all category, single and archive pages to render the url with a prefix of "news". E.g.               www.yourdomain.com/news/category/post-name      I set the permalink structure as `/news/%category%/%postname%/` and this works fine. An issue cropped up during a recent build that has prompted this question. Namely that the site required a custom author section and with the permalink structure set as above author pages were also prefixed with "news", E.g.               www.yourdomain.com/news/author/author-name      Is there any way to remove the "news" from author pages / archives only and remain on category / single etc?


title: How does WordPress search work behind the scenes?

text: I am using WordPress search to search a range of custom post types and allow the user to drill-down into each individual post type. However I'm finding that WordPress is not returning what I'd deem to be the 'best' matches first. For example, if I search for Microsoft, pages that contain the term irregularly are still returned before pages that regularly use the term. Basically I'm trying to find some information on how WordPress ranks pages and determines relevance and if I can influence this **without having to install any plugins**. Any help much appreciated.


title: Add pages content to startpage through custom menu

text: I would like to be able to add page content onto the startpage (index.php). But only the pages that i've added in custom menu, and in that order too. I've been searching for a while now, but can't find anything close. Big thanks to any one that can lead me in the right direction.


title: Getting a thumbnail for an external video as the thumbnail for a custom post type?

text: I saw some other similar threads but they were all for YouTube videos. I was wondering if the same could be done for videos hosted on other servers like blip. Here is an example of a blip video: http://blip.tv/file/4778330 This is how I currently have things set up: I have a custom post type for Videos with a meta box for the src (video_src) from the embed code so all I have to do is enter the src and it gets displayed from my `single-videos.php` template like this: `<embed src="<?=$video_src?>" type="application/x-shockwave-flash" width="400" height="200" allowscriptaccess="always" allowfullscreen="true" />` It would be awesome if somehow a frame of the video became the featured thumbnail of its post. Any idea on how something like this could be done?


title: PGP-Encrypt system-generated notifications

text: I was wondering if there is a way to get Wordpress to encrypt notification mails ("Please moderate ..." and so on) using PGP. I have found a bunch of plugins providing PGP-encrypted eMail forms, but that's not what I was looking for, as I want the system mails to be encrypted, not the user mails. Is there any plugin or modification that does this that I have not found?


title: Displaying Post Featured Images on All Pages

text:
First, let me start off by saying I'm very new to WordPress. I've only ever done basic themes before, this is my first big project. I'm working on a design that has two sidebars on every page. Each sidebar displays the most recent post from two categories. These posts have Featured Images associated with them. I want to display the posts featured images in the sidebars on every page, but I can't figure out how to do it. The Feature Image always wants to pull the image from the current page, not the posts I'm trying to display. Or it just doesn't do anything at all. Is there a way to do this, or do I have to resort to using a widget? I'd really prefer not to have to do a widget, because it'd be much easier for the client to just post something and have it appear in the sidebar. Here's the code I'm trying to use (which currently just doesn't display any featured image):               <?php query_posts('category_name=Festivals','showposts=1'); ?>     <?php while (have_posts()) : the_post(); ?>         <?php             if(has_post_thumbnail( $id )) {                 echo get_the_post_thumbnail( $id, 'full');             }                                                                                ?>
<?php the_time('M j') ?>: <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
     <?php endwhile;?>


title: Database Update Required - Update from command-line

text: I just did upgrade my wordpress subtree of my website to the 3.6 branch and now the site tells me that I need to upgrade my database as well: > Database Update Required Nothing special so far, just business as normal. It suggests me to navigate to               http://example.com/wp-admin/upgrade.php?step=1      next. As I'd like to automate the Wordpress Upgrade procedure a little from shell, I wonder how I can trigger executing the database upgrade from shell. The information online is sparse and many are pointing to WP_Cli however I'm looking forward to an isolated command-line.


title: Adding a query var to taxonomy term archive - gets redirected to the other taxonomy archive page

text: I want to pass another query var in the URL through a form while I'm on a taxonomy archive page. The URL would look like so               http://www.mydomain.com/tax_1/term_55/?&tax_1=term_1&tax_2=term2&orderby=modified        * `tax_1` is the other other taxonomy   * `tax_2` is the taxonomy I'm currently on - if the user passes this var eventually the taxonomy archive he's currently on should display results for another term If I attempt to load this URL I will be always redirected to `tax_1` taxonomy archive page for the term I passed. No matter if I set or no any var for `tax_2`. Has this something to do with template_redirect? How to adjust it? Thanks ## UPDATE Actually I realised this is pretty easy to do with post type archives and multiple taxonomies. I could create a form to redirect according to user selection to the post type archive with advanced taxonomy query vars (just use a different action and point to the post type archive). Still, I'd like to know if what I wanted to do in a taxonomy term archive is possible...


title: Taxonomy vs Post Status

text: I'm building a web app so scalability is one of my main focuses when developing. On the app I am building I have a post type called 'Projects'. A project can be either be:   * Open   * In Work   * On Hold   * Completed I don't really need any kind of UI, just the ability to query for all projects that are in one or more of those statuses. I assume since post_status is in the posts table that it's going to be quicker using this method to perform those queries rather than use a taxonomy to do so? So my question is which would be faster to query if there were 100,000 projects - Post Status or a Taxonomy? Cheers


title: Call different archive page based on post type

text: Ok, I have quite a few CPT's on my latest project. Most of the CPT's are only used to display metabox content linking to pdfs, etc. I looked around and couldn't find quite what I was looking for, but thought I could setup a function that calls the standard archive.php template if the post type is "posts" and if not it could call the archive-cpt.php file. If anyone has seen something like that, or has set something like that up and wouldn't mind sharing their code, it would be appreciated.


title: Add two images with Sweet Testimonials

text:
Ok, I've customized Sweet Testimonials to add a before and after image to a client testimonial post that is added by clients on the front end of the site I'm working on: http://pictureperfectponds.com/testimonials-submit-your- review/ The "before" image is uploading fine, but the "after" image is giving me an error. I can, however, get the "after" image to load and attach to the post via editing in the dashboard, so the metabox is working fine. Here's my code that handles the front end shortcodes, does anyone see what I'm missing?                       /* -------------------------------*/             /* Upload & attach client picture - before */             /* -------------------------------*/                  if( !isset($rc_swt_options['disable_picture']) ) {                 if( trim( $_POST['client_picture'] ) === '' ) {                          require_once(ABSPATH . 'wp-admin/includes/admin.php');                     $id = media_handle_upload( 'client_picture', $post_id );                     unset($_FILES);                     if ( is_wp_error($id) ) {                         $errors['upload_error'] = $id;                         $id = false;                     }                          if( $errors ) {                         $client_picture_error = apply_filters( 'rc_swt_error_upload', __('There was an error uploading your before picture.', 'rc_swt') );                         $hasError = true;                     } else {                         $client_picture_url = wp_get_attachment_url( $id );                         update_post_meta( $post_id, $field_prefix . 'client_picture', $client_picture_url );                     }                      }             }                  /* -------------------------------*/             /* Upload & attach client picture - after */             /* -------------------------------*/                  if( !isset($rc_swt_options['disable_picture_after']) ) {                 if( trim( $_POST['client_picture_after'] ) === '' ) {                          require_once(ABSPATH . 'wp-admin/includes/admin.php');                     $id = media_handle_upload( 'client_picture_after', $post_id );                     unset($_FILES);                     if ( is_wp_error($id) ) {                         $errors['upload_error'] = $id;                         $id = false;                     }                          if( $errors ) {                         $client_picture_after_error = apply_filters( 'rc_swt_error_upload', __('There was an error uploading your after picture.', 'rc_swt') );                         $hasError = true;                     } else {                         $client_picture_after_url = wp_get_attachment_url( $id );                         update_post_meta( $post_id, $field_prefix . 'client_picture_after', $client_picture_after_url );                     }                      }             }                  /* ----------------------------*/             /* Thank you / redirection     */             /* ----------------------------*/                  if( $post_id )             {                 echo '';                 echo apply_filters( 'rc_swt_error_', __('Thank You! We now need to review your testimonial before publishing it.', 'rc_swt') );                 echo '';             }              }     }          ob_start();     ?>                  <?php if( !isset($rc_swt_options['disable_picture']) ) { ?>                          <?php echo apply_filters( 'rc_swt_label_upload_profile', __('Upload your before picture:', 'rc_swt') ); ?>             <input type="file" name="client_picture" id="client_picture" class="rc_swt_testimonials_form_input" />                  <?php if( isset($client_picture_error) && $client_picture_error != '') { ?>                 <?php echo $client_picture_error; ?>

             <?php } ?>             <?php } ?>                  <?php if( !isset($rc_swt_options['disable_picture_after']) ) { ?>                          <?php echo apply_filters( 'rc_swt_label_upload_after', __('Upload your after picture:', 'rc_swt') ); ?>             <input type="file" name="client_picture_after" id="client_picture_after" class="rc_swt_testimonials_form_input" />                  <?php if( isset($client_picture_after_error) && $client_picture_after_error != '') { ?>                 <?php echo $client_picture_after_error; ?>                       <?php wp_nonce_field('testimonial_nonce', 'testimonial_nonce_field'); ?>                  <input type="hidden" name="submitted" id="submitted" value="true" />             <button type="submit" id="rc_swt_submit" class="rc_swt_testimonials_form_submit"><?php echo apply_filters( 'rc_swt_post_testimonial', __('Post Testimonial', 'rc_swt') ); ?></button>              </fieldset>     </form>     <?php     return ob_get_clean();     }          add_shortcode("testimonial-form", "rc_swt_testimonial_form_shortcode");      Any help is appreciated. Post edited to shorten code relevant images only, can provide full code upon request.


title: First Wordpress Plugin - Stat Issues

text: I built my first plugin and after a bumpy start got my plugin downloadable from the WordPress. On my plugin's stats page it version 1.2.0 is the only active version in the pie chart. See: http://wordpress.org/extend/plugins/content-types-wordpress-plugin/stats Why is that?


title: Sub Navigation in Sidebar

text:
Testing Site: http://www.indysouthportdental.com.php5-1.ord1-1.websitetestlink.com I only want to display the children of parent in the sidebar when viewing any pages within the parent. For example, Oral Health has 10 child pages. Some of those child (Treatment for example) pages have child pages (grandchildren of Oral Health). Even if I'm on a grandchild page, I still want to list the only the child pages of the parent. This is the code I'm using               <?php     if($post->post_parent)     $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&depth=1");     else     $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&depth=1");     if ($children) { ?>
Oral Health

     <?php echo $children; ?>
     <?php } ?>      This code diplays the related grandchild pages when on any grandchild page rather than the child pages. (hope that all makes sense...)


title: Dynamic Sidebar Conditional

text: **EDIT** Answer was found here: is_active_sidebar() Always Returns False By user: `s_ha_dum` * * * I'm dynamically creating sidebars and registering them for every top level page: Dynamically Register Sidebars For Each Top Level Page The problem is, I want to test if a sidebar doesn't exist for that page, to use default:               if(is_dynamic_sidebar(get_the_title()))                         dynamic_sidebar(get_the_title());                     else                         dynamic_sidebar('Default');      I've tried to test `if(is_dynamic_sidebar(get_the_title()) && dynamic_sidebar(get_the_title())` but this just repeats the sidebar content twice for some reason. I also tried: `if(is_dynamic_sidebar(get_the_title()) && is_active_sidebar(get_the_title())` but this just removes all my sidebars or if I change the `&&` to `||` it will display normally except never uses default. So pretty much on my subpages, it uses no sidebar. Anybody have suggestions on what I can do? Updated Code thanks to @Ravs               if(!is_active_sidebar(get_the_title()))         dynamic_sidebar(get_the_title());     else          dynamic_sidebar('Default');


title: WordPress Customer Reviews Error: Line 239?

text: I use WP Customer Reviews on my WordPress site and each time me or one of my users logs in this error message comes up: Catchable fatal error: Object of class WP_User could not be converted to string in /hermes/bosoraweb097/b2086/ipg.mysite.com1/wp-content/plugins/wp- customer-reviews/wp-customer-reviews.php on line 239 It's causing many users to turn away and not bother logging in. Line 239 of the code is the following:               $this->p->$c = trim(stripslashes($val));      I don't want to edit this code to save damaging any of the WP Customer Reviews. Anyone know how this error can be fixed.


title: Connect to remote database using Localhost install

text: I will be designing and developing a website for a client but want to allow the client to add content while I am working on the design and development of the site so that it is pretty mich done by the time I am finished. Currently, I use XAMPP on port 81 so my project URL looks something like               http://localhost:81/projectname      My wp-config file has all the settings I need to the remote DB and yet, when I run the               http://localhost:81/projectname       URL it constantly redirects me to               http://localhost/projectname.      I've removed all htaccess files thinking the problem was there but that didn't work. My ISP suggested opening port 3306 which I have done but that's not done the trick either. I don't know if it has to do with port 81 on Xampp perhaps? **EDIT:** General settings link through to the online version of the site so Site Address = http://example.com WP Address = http://example.com Many thanks


title: Satoshi WordPress Theme - Portfolio SetUp Issues

text: Hoping someone can assist but I am using the Satoshi WordPress theme (see:> http://www.vooshthemes.com/wordpress-theme/satoshi-2/ ) but I am having issues with creating a standalone page for my Portfolio page. Basically, I have created a page called “Portfolio” and changed the template type to “Portfolio” and publish. I then attempt to upload three images to this page based on the instructions (see> http://www.cedricarnold.com/blog/wp- content/themes/satoshi/instructions/instructions.html ) and am unable to do so. I can’t even get one image to display. And from what I can see also, I am unsure how to upload multiple images onto this portfolio page as it mentions that I need to set the image as a ‘featured image’, doing this for the first image is fine but does not display but when I attempt to upload a second image to the portfolio page, my original image is overridden and so, cannot see how I can upload multiple images. Can someone who has hopefully used this theme pls take me through the steps of say uploading 3 images with captions on the top onto my Portfolio page. Would really appreciate it. Thanks.


title: Select menu on browser resize

text: I have seen on some wordpress themes that if the browser width is less, the normal menu becomes a select menu. Can someone tell me how it is done? I know there is a plugin for that, but I want to know how to implement it in the theme without plugin. Thanks


title: Assign random (and unique) user meta upon registration

text: When a user registers, I need to assign a random but unique, 4-digit number as user meta data. The number will be static and not change: Not by the user himself or any user with a higher capability. This number/meta data would be needed to be displayed when a user visits a specific _page_ (post type: Page).


title: Custom Post Type with image gallery

text: I'm doing research on custom post types for a Wordpress site I'm going to be putting together for a client of mine. The basics of the Custom Post Type seem pretty straight forward. What I'm trying to determine is the best way that I could have an image gallery as part of my custom post type. For example, a custom post type would be a car. In addition to the details of the car (make, model, year, mileage, etc.) there will be 1-n images associated with it that should be part of the post (modified inside the post, removed along with the post, etc.) Ideally I'd want thumbnail images that open up to a lightbox of some sort. Hopefully this is something that can be accomplished without totally hacking up Wordpress.


title: Joining column from table to query_posts

text: This is more of a question to be sure that I am on the right track with how I want to do this. I am using a custom template that uses elements of theme to display products based on filter results. I am pulling data from another table, `_tires`, for the filtering. The data is not being sorted in the loop, but before the loop it is in the correct order. I believe this is because the data from the `_tires` is not being fed into the loop. The loop begins by `$keep = query_posts($args);` Here is my `$args` for reference:               $args=array(          'post_status'       => 'publish',         'post_type'         => 'products',         'tax_query'         => array(             array(                 'taxonomy'  => 'product_categories',                 'terms'     => explode(',', $groups_separated),                 'field'     => 'slug',             )         ),         'posts_per_page'    => 30,     );      So if I understand this correctly, the data that I want to sort in the loop needs to be passed or joined into `query_posts` so that I can setup `$args` to sort by the data in `_tires`? Or is there a way to pull the column that I need from `_tires` directly into `$args`?


title: Function won't run onclick using Ajax

text: Ok, so my code is meant to be pulled from the function using the jquery code below, but it isn't pulling the code and I can't see why not. My pages code                         <?php              echo ' ' . $twitchusername . '';     echo ' <form action="xxx" method="post" >';     echo ' <input type="button" value="Check" onclick="return click_to_choose_user()" />';     echo '</form>';     ?>      My functions code that's meant to be pulled from the functions.php               add_action( 'wp_ajax_my_twitchuser', 'twitchuser_ajax' );     add_action( 'wp_ajax_nopriv_my_twitchuser', 'twitchuser_ajax' );          function twitchuser_ajax() {     $twitchusername = 'MulloIV';     echo $twitchusername;     console.log( "it's working" );     die();     }      I feel it's a problem with the data: property, I'm not sure what data is meant to be sent to the server and what for.


title: WordPress meta_query and order by custom field

text: I have a Custom Post Type called " **Films** ", with a Repeater field called " **Showings** ", which have a field " **start_datetime** " of type DateTime... I want to perform a query to get all those Films with a Showing in the next 7 days, and I want to order them by Showing's start_datetime. I have this query:               $query = new \WP_Query( array(         'numberposts'   => -1,         'post_type'     => 'film',         'meta_key'      => 'showings_%_start_datetime',         'orderby'       => 'meta_value_num',         'order'         => 'ASC',              'meta_query'    => array(             array(                 'key'       => 'showings_%_start_datetime',                 'value'     => array( time(), strtotime( '+7 days' ) ),                 'type'      => 'NUMERIC',                 'compare'   => 'BETWEEN'             )         )     ));      This grabs all the films that have a showing in the next 7 days correctly, but then it orders the films by the start_datetime of the **_FIRST_** showing, and I need it to order them by the start_datetime of the **_FIRST FUTURE_** showing... Any help please? * * * _Example:   Film A have a showing today.   Film B have a showing tomorrow and another showing 1 year ago. My results will be ordered: Film B and then Film A (because actually Film B is the one with a showing starting eralier). But I need it to be ordered the other way around, because Film A is the film with the first future showing..._


title: Query that joins the postmeta table twice

text: I believe what I'm trying to do is too complex for the standard `meta_query` parameter in `get_posts`, so I'm trying to use a custom SQL query to do the following: I have a game custom post that has custom fields for team1 and team2 stored as postmeta. Given team XXXX, I need to pull all posts that have the postmeta value of XXXX for either postmeta key team1 or postmeta key team2. I also need to factor in the year, because 2 teams can play eachother every year. The year for the game post type is stored as postmeta year. I tried using the following (testing in phpmyadmin) and it's not working... My two variables here would be year=2014 and team=yankees:               SELECT DISTINCT (p.ID), p.post_title     FROM wp_posts p     JOIN wp_postmeta pm1 ON p.ID = pm1.post_id     JOIN wp_postmeta pm2 ON p.ID = pm2.post_id     WHERE 1 =1     AND p.post_type =  'game'     AND ((pm1.meta_key =  'year'      AND pm1.meta_value =  '2014'      AND pm2.meta_key =  'team1'      AND pm2.meta_value =  'yankees') OR     (pm1.meta_key =  'year'      AND pm1.meta_value =  '2014'      AND pm2.meta_key =  'team2'      AND pm2.meta_value =  'yankees'))


title: Does wordpress has Presentation, Data and Logic layer?

text: I am using wordpress to create websites for a long time but now I have an order that i don't know what technology to use. All the client requirements can be done using wordpress except one - the application has to have Presentation, Data and Logic layer. The question is - does wordpress has it? It looks like MVC and as far as i know wordpress isn't written using MVC. How to bite it?


title: Allow users to enter and edit data in one-to-many configuration

text: We would want a user to login and be presented with a form that they would potentially have to submit multiple times (disclosures of any industry relationships, one form per disclosure). The challenge is how do we capture and display what has been previously entered by a user when they log back in and give them a chance to delete or edit previous entries without investing in a ton of custom coding because we have a very tight deadline on this project. Has anyone seen WordPress do data collection and management in this manner on a per-user basis and if so, which plugins or other add ins were used?


title: How to Match Orders to User Sessions in WPeC

text: This is less a technical question, and more a ’how would you do it’ question that I’m hoping the more experienced users may have some advice on… (I still think its a valid question for this forum) I’m creating a Flash application which allows users to upload an image, and then add a product to the shopping basket with that image on it (WPeC plugin is my shopping basket - I'm going to need to add a product to my shopping basket from within the flash application). My problem is this… many users will upload images, but not all will actually complete the order. When a user orders a product, I need to know which image on my server is their image! I thought about naming each image uploaded with the users Session Id, then when someone orders a customised product I would _somehow_ find the session id and match them up. I ruled this out because a user might upload 3 or 4 images – each image would have the same Session Id so I wouldn’t be able to tell which image they wanted to use. Knowing what I’m trying to do, do you have any advice on how to go about this? Before I even start to work out the technical side of things I’d like to get a plan together of matching images to orders. PLEASE HELP IF YOU CAN! Thank you Dean


title: WP-e-Commerce Adding A Product via Flash Button

text: I have built a flash application where a user can customise a product. I currently have an 'add to basket' button within the flash application that doesn't do anything. I'd like it to add a product to the basket when clicked. Writing a flash function with event clicks is no problem, but I'm not sure how to connect to the shopping basket and would appreciate any advice on how to do this. It _appears_ to be done in AJAX but I'm not confident in this. Any help would be greatly appreciated. Thank you Dean EDIT AFTER MILO'S COMMENTS: Thanks Milo. Once I understand how to invoke the existing "function wpsc_add_to_cart()" I'll try to make it more efficient and implement what you have suggested, but at the moment I'm struggling to invoke the existing one from within flash. I've determined the JQuery I need to call from within Flash is the one below, but I don't know how to call it (it doesn't appear to have a function name like I'm used to seeing):               // Submit the product form using AJAX     jQuery("form.product_form").live('submit', function() {         // we cannot submit a file through AJAX, so this needs to return true to submit the form normally if a file formfield is present         file_upload_elements = jQuery.makeArray(jQuery('input[type=file]', jQuery(this)));         if(file_upload_elements.length > 0) {             return true;         } else {             form_values = jQuery(this).serialize();             // Sometimes jQuery returns an object instead of null, using length tells us how many elements are in the object, which is more reliable than comparing the object to null             if(jQuery('#fancy_notification').length == 0) {                 jQuery('div.wpsc_loading_animation',this).css('visibility', 'visible');             }             jQuery.post( 'index.php?ajax=true', form_values, function(returned_data) {                 eval(returned_data);                 jQuery('div.wpsc_loading_animation').css('visibility', 'hidden');                      if(jQuery('#fancy_notification') != null) {                     jQuery('#loading_animation').css("display", 'none');                 //jQuery('#fancy_notificationimage').css("display", 'none');                 }                  });             wpsc_fancy_notification(this);             return false;         }     });      Any ideas how to call this JQuery from within Flash? Thanks for your help so far


title: Can I run multiple blogs from my local machine

text: OK I head that WP can now host more sites using one installation. I host my blog on my own computer using MAMP and latest WP. But I can't find option to create another blog?


title: Get attached media only

text: I am using wp_query to get uploaded medias. Everything is working fine, but wp_query will return the medias with no post attached. This is not what I wanted. How can I exclude the unattached media from the wp_query? This is my query arguments look like:                $args = array(       'post_type' => 'attachment',       'post_status' => 'inherit',       'posts_per_page' => -1,       );       $attachemnt = new WP_Query($args);      Is there any argument that can use for exclude the unattached media in wp_query class? Thanks


title: Make the "Add New Post" one column for all users

text: I have looked everywhere and there's been a few attempts to do this in my themes function.php file but no luck. What I'm after is that to make it easier for my Contributors, that the add new post is in one column, easier for them to do it step by step. I know I can change it in the screen options but I would like it by default so then they have it all done for them.


title: Mapping Subdomains in Wordpress to give the appearance of a localised site, best approach?

text: I am building a classifieds website and am using Wordpress for the functionality of user accounts, Paypal integration, custom taxonomies and of course super flexible custom post types for the listings. I would like to be able to map a subdomain to a particular sub-site. For example: australia.somesite.com or brisbane.somesite.com and have it localise the site to that particular region. Is there a clean-cut way of doing this with Wordpress, possible that someone else has surely already done this.


title: WP_Query: offset ignored when posts_per_page is -1?

text: Is it only me or this is what's happening? I just want to get all posts starting from a certain offset, like 10. Instead I get all posts starting from the 0.


title: Pagination throws 404

text:
I'm experiencing some problems with my pagination when displaying custom post types. I would like to display 9 posts and then display a numeric pagination. This is working, some links are generated with (for me) correct URLs : http://mywebsite/tutorial/page/2 or http://mywebsite/tutorial/taxonomy/page/2 but it always finish on a 404 page. Any idea is welcome, the following is my code so if you see any problem :) Thanks by advance. Cyril               <?php         $args = array(             'post_type' => 'tutorial',             'paged' => ((get_query_var('paged')) ? get_query_var('paged') : 1),             'posts_per_page' => 9         );         query_posts($args);     ?>          [MAIN LOOP]          <?php numeric_pagination(); ?>      Here is the numeric_pagination() function (found on the web, working on another website...) :               function numeric_pagination($pages = '', $range = 2) {     global $paged;     $showitems = ($range * 2) + 1;     if(empty($paged)) $paged = 1;     if($pages == '') {         global $wp_query;         $pages = $wp_query->max_num_pages;             if(!$pages) {                 $pages = 1;             }     }             if(1 != $pages) {         echo '

';         if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo '«';         if($paged > 1 && $showitems < $pages) echo '‹';              for ($i=1; $i <= $pages; $i++) {             if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )) {                 echo ($paged == $i)? ''.$i.'':''.$i.'';             }         }              if ($paged < $pages && $showitems < $pages) echo '›';           if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo '»';         echo '

';     }      } There is maybe a problem with my custom post type and my taxonomies so I give also the code for that :               /* POST TYPE */          add_action('init','create_tutorials_post_type');     function create_tutorials_post_type() {         // Labels         $labels = array(             'name' => 'Tutorials',             'singular_name' => 'Tutorial',             'add_new' => 'Add new',             'add_new_item' => 'Add new tutorial',             'edit_item' => 'Edit',             'new_item' => 'New tutorial',             'view_item' => 'View tutorial',             'search_items' => 'Search tutorial',             'not_found' =>  'No tutorial found',             'not_found_in_trash' => 'No tutorial found in trash',              'parent_item_colon' => '',             'menu_name' => 'Tutorials'         );         // Arguments         $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,              'show_in_menu' => true,              'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'has_archive' => true,              'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','author','thumbnail','excerpt','comments')         );         // Register post type         register_post_type('tutorial',$args);     }          /* TAXONOMY */          add_action('init','create_tutorials_taxonomies');     function create_tutorials_taxonomies() {         // Labels         $labels = array(             'name' => 'Tutorial types',             'singular_name' => 'Tutorial type',             'search_items' => 'Search a type',             'all_items' => 'All types',             'parent_item' => 'Parent type',             'parent_item_colon' => 'Parent type:',             'edit_item' => 'Edit type',              'update_item' => 'Update type',             'add_new_item' => 'Add new type',             'new_item_name' => 'New tutorial type',             'menu_name' => 'Types'         );         // Arguments         $args =  array(             'hierarchical' => true,             'labels' => $labels,             'show_ui' => true,             'query_var' => true,             'rewrite' => array('slug' => 'tutorials', 'hierarchical' => true)         );         // Register taxonomy         register_taxonomy('tutorial_type',array('tutorial'),$args);     }


title: Handling image uploads without thickbox

text: Ideally what I'd like to do is hand a file to a function that returns the file as an attachment of the current post. Just as though it had been uploaded via the thickbox media uploader, but without the hassle of hijacking it's ugly interface. Is there a plugin/library/function I can use with my own plugins to achieve this?


I'd like a lightweight way to figure out what is invoking a certain action in an effort to provide logic for certain scenarios where I can't help to avoid a function invocation (for example, a new comment firing `edit_post`). Is there a way to figure out which action/filter invoked a function?


title: Internal Server Error 414 - Request-URI Too Large

text: I'm trying to delete around 250 posts at once, but the next page I am taken to displays the error: > **Request-URI Too Large** > > **The requested URL's length exceeds the capacity limit for this server** Does Wordpress need to use a HTTP Post action to delete posts?


title: Create a month by month archive of pages (not posts)

text: Is it possible to create a month by month archive of pages? I know it can be done with posts but I want to do it with pages. I want it to take the date the page was published so if the page was published in August then it would create a link called "August" which in turn when clicked will show all the pages within August. Is that possible? Or is there a better way I can categorise my pages to show them month by month? UPDATE: I use this plugin - wordpress.org/extend/plugins/advanced-custom- fields. Is there any way I could do it with pages? Is there any fields I could add to a page that could help me hack together an archive?


title: How to have Function of a plugin using global vars into a shortcode?

text: I am trying to convert this piece of code into a shortcode so it can be used inside my posts. Is it possible? I cant think of how to do it as I am beginner in wordpress and learning via books/youtube and wordpress documentation. The code is:                   global $userpro;     $userpro->permalink( get_the_author_meta('ID') );      The goal is to have that be executed in the post as [authorlink] If it isnt possible to do so can I add the above code inside the single post template and show it at a specific spot using if so how could this be done? Thank you all for your contributions.


title: update_user_meta doesn't work with AJAX

text: I try to keep user subscription in a metadata var. The function is called by AJAX. Ahe AJAX is called but the metadata does not seem updated on frontend. Here is the code: jQuery               <script type="text/javascript">         jQuery(document).ready(function($) {             $('#tags_list a').click(function(){                 myid = $(this).parent("li").attr('id');                 $.post(                     '<?php echo admin_url( 'admin-ajax.php' ) ?>',                      {                         'action': 'change_subscription',                         'type': 'post_tag',                         'term_id': myid                     },                      function(response){                         $('#'+myid).toggleClass('checked');                     }                 );                 return false;             });         });     </script>      AJAX               add_action('wp_ajax_change_subscription', 'change_subscription');     function change_subscription() {     if (!empty($_POST['term_id']) && !empty($_POST['type'])) {         $user = wp_get_current_user();              update_user_meta( $user->ID, 'hannit_meta', 'My Value' );         die();     } else         die($st);     }      Front-end check:               <?php                 $user = wp_get_current_user()->ID;                 $tags = get_user_meta( $user->ID, 'hannit_meta', true);                 echo "<!-- u:".$user." val ".$tags."-->";                 ?>      Result: `<!-- u:236 val-->` What am I missing here?


title: Create a new custom field for all posts based on current custom field

text: I have a custom field for a large number of posts that contains the url for a youtube video. I used to grab the ID from the video and use that to build the thumb but in a new version I'm actually using download_url() for the custom built thumb image url from youtube and downloading it to my server. So I have to do this for all posts in my database but need a way to do it other than manually with each one. So I have a custom field for each post called `video_code` which equals the url of the video. So with that I need to do something like this for all posts of a specific post_type..                       require_once(ABSPATH . "wp-admin" . '/includes/image.php');             require_once(ABSPATH . "wp-admin" . '/includes/file.php');             require_once(ABSPATH . "wp-admin" . '/includes/media.php');          $video_code = get_post_meta($post->ID,'video_code',true);     $video_id = getVideoId($video_code); // getVideoId is a custom function     if ($video_id) {          $video_image_url = 'http://img.youtube.com/vi/'.$video_id.'/hqdefault.jpg';          ut$tmp = download_url($video_image_url);          $file_array = array(                     'name' => basename( $video_image_url ),                     'tmp_name' => $tmp                   );          }     $vid_thumb = media_handle_sideload( $file_array, $post_id );     update_post_meta($post_id,'video_thumb',$vid_thumb);      Any ideas?


title: Add Custom Post Type Categories to General Categories

text: I've created three custom post types. I want them seen as general categories. I could not find a solution, can anybody help me? Thank you.


title: How to control output of custom post type without modifying theme?

text:
I have a custom post type 'properties' that I'd like to control the HTML output for. For simplicity, let's focus on the **archive** view. As a basic example, here is what a loop looks like in an `archive.php` file:               <?php while ( have_posts() ) : the_post(); ?>
<?php the_title(); ?>

<?php the_content(); ?>
     <?php endwhile; ?>      I'd like to be able to modify the output of the loop with my custom 'properties' HTML **without adding a new template or using a shortcode** - basically, without user intervention. Just to be clear, I'd like to replace the `<h2>` and `<div>` in the above example, and nothing before/after it. **Note:** The above is only an example. I would like to control the loop output _regardless of theme_. Right now I am using output buffering to capture the output from `loop_start` to `loop_end` and replacing it with my own, but this potentially can create conflicts with other plugins. Is there an accepted/better way to do this?


title: Track advertisement earnings per blog post and page in wordpress?

text: I have this unique situation (though i doubt it no one has ever asked this before!). I want to track advertisement earnings from a service like Adsense per blog post and per page or per author . Why i want to achieve this ? we are quite a few number number of authors in this new website we are launching .In order to answer any future discrepences that might occur and effective profit sharing. If its not possible with adsense is there any decent enough alternate offers this feature please suggest? Alternatively is there any tracking plugin or some service like google analytics that can be of help? if possible is there any way to export this data also?


title: Archive template for taxonomy terms

text: I have registered a custom post type [equipment] and have a taxonomy of [equipment_type] within the taxonomy I have parent and child categories. For example: Equipment (Custom post type) Equipment Types (Taxonomy) Cameras (Parent term)   * Camera A (Child term)   * Camera B  What I would like to create is effectively an archive page for the taxonomy terms. So when either 'Cameras' or 'Camera A' is selected it shows say 12 posts with title and featured image (links to single post) plus some pagination. I have tried a standard WP query and Loop and it always ends up showing all of the taxonomies posts in all terms. I currently have a `taxonomy-equipment_types.php` template set up to handle the query.


title: Set a custom post type's title and slug to match the current date

text: I have seen similar questions asked, but mine is a little different. I want to register a post type called `'minutes'` that doesn't allow you to add a `title` or a `slug`, but when you publish (or autosave) it automatically gives the post a title of today's date, and a `slug` with a canonical representation of the date. So, title would be `"December 7th, 2012"` and the slug would be `/minutes/12-7-2012`. I don't want the `title` bar or `slug` to even be present on the editor page, because I don't want people to think they can fill in their own title. However, I think disabling titles entirely when registering a custom post type means it can't even get an auto-generated one. I don't know for sure, though, so maybe you can help me understand it. Thank you.


title: add_option_page capability behaving strange

text: I am trying to build a class to make the job off adding new settings easier. The trouble I am having is that, although I have traced the variable through all of it's stages, the string 'manage_options' doesn't seem to grant admin the right to amend and option. I keep getting "You do not have sufficient permissions to access this page." when I try access the new settings page. Here is a heavily simplified version of the class, the creation function and its action hook.               class optionObject{         var $user_level = 'manage_options';              function add_page() {                  add_options_page(menu_page_title, page_title, $this->user_level, menu_slug, array(&$this, 'do_page'));              }         function do_page(){             //do stuff to display page         }     }          function test_options(){         $options = new optionObject();              add_action('admin_menu', $options->add_page());     }          add_action('admin_init', 'test_options' );      Unedited Version here


title: After installing plugins, changes don't appear

text: I installed a plugin by going to               my sites --> network admin --> plugins      and installing it from there. But the plugins don't show up. Would anyone know why they don't show up? Also, the reason I had to go through               my sites --> network admin --> plugins      was because for some reason when I moused over the plugins in the dashboard, there was no option to add a new plugin. Thanks!


title: Displaying number of search results for each post type

text: Using the code below, my search returns results from two different CPTs. How can I display the number of results for each CPT before displaying results?               function more_posts_per_search_page( $query ) {         if ( !is_admin() && $query->is_main_query() ) {             if ( $query->is_search ) {                 $query->set( array( 'posts_per_page' => 500, 'post_type' => array( 'author', 'book' ) ) );             }         }     }     add_action( 'pre_get_posts','more_posts_per_search_page' );


title: Why style.css with ?ver=3.9.2 not updating as the one without ?ver=3.9.2?

text: The problem I have is the style.css I uploaded to the host server not taking affect. I am using GoDaddy business wordpress hosting. Please note the following two having different content, only the first one applied my updates: http://auapg.com/wp-content/themes/homeland/style.css http://auapg.com/wp-content/themes/homeland/style.css?ver=3.9.2 I am not sure what magic the '?ver=3.9.2' did to the css file. Anyway I am hoping it can have the same content as the one without '?ver=3.9.2', which applied my changes. Any ideas is appreciated, thanks!


title: How to properly validate data from $_GET or $_REQUEST using WordPress functions?

text: I am working on a plugin that requires on-the-fly manipulation of content output. This is solely dependent on the current `$_GET` variable or `$_REQUEST` variable. Depending on what the variable is set to, it will call a certain class method to handle the user's request and display the proper content. I am fully aware of the Data Validation page on the WordPress Codex, however, I am unsure of what the best approach is for my scenario, or any scenario of sanitizing `$_GET` variables or `$_REQUEST` variables for that matter. How can I sanitize using WordPress functions for `$_GET` variable or `$_REQUEST` variable for a string which will be matched to call a specific class method? **Could this be exploited or fail given the following code?:**               public function display_admin_page(){         if(is_admin() && isset($_GET['page'])){             global $content;             $page = sanitize_title($_GET['page']);             $method_name = 'page_'.str_replace('-', '_', $page);             if(method_exists('content', $method_name)){                 // Display requested page from content class                 $thePage = $content->$method_name();             } else{                 $thePage = $content->error(404);                 }             echo $thePage;         }     }


title: Settings API in Multisite - Missing update message

text: When I use the settings API in a multisite installation and the options page sits at the network level, posting the options to `options.php` does not work, because the administration page sits at `wp-admin/network` and WP expects the page to be at `wp-admin`. I added a function that checks whether this WP installation is a multsite installation (via the constant) and if it is, it changes the form's action value to `../option.php`. This saves the options OK, but the default message "Settings saved." is missing (however, the query string does include `settings-updated=true`). Any thoughts on how to get the message to appear?


title: Get paged category link programmatically

text: I want to get the link to a category (specified by id) but with a paged value (e.g. page 3 of category id 4). I was looking into `get_category_link()` _Codex_, but it only returns the link to the first page of the category. Is there a build-in function that I can make use of to get the link to a category page that reflects the blogs URL-layout settings (`?paged=3`/ `/page/3`)? **Edit:** I added my solution as an answer.


title: How to set up default values for a plugin?

text: What is the best way to go about setting up default values for a plugin? Should I just insert those values into the wp_options table? AND...if that's the best way to go about it, I have another question. My options are listed as a group which currently looks like: a:4:{s:26:"nc_location_drop_down_zoom";s:2:"14";s:17:"nc_location_width";s:3:"200";s:29:"nc_location_drop_down_maptype";s:7:"roadmap";s:11:"text_string";s:0:"";} Is this a serialized array? How do I do an insert like this into the table? (I realized this is more of an sql question...)


title: a-z list,  categories and sub categories in loop

text:
I'd like to list my categories in a loop from a-z, the code i currently have just keeps repeating over and over im not sure what the problem is but the format should look something like.   * Parent Category      * Child Category      * Child Category      * Child Category      * Child Category **My code:**               <?php      $args = array( 'orderby' => 'name','order' => 'ASC' );     $categories = get_categories( $args );     foreach($categories as $category) {         echo '
term_id ).'">'.$category->category_nicename.'
';         echo '
term_id ).'">'.$category->child.'
';     }     ?>


title: How to Auto Approve Comments on a Specific Page?

text: I am using WordPress comments on a page as a Contact page and I am able to show those comments only to logged in admin. Now I would like to automatically have any comments placed on my Contact page approved. So, in the front end, I can see all comments placed on that page instead of seeing only the approved comments. I would love to have a hook in functions.php that works with twenty eleven child theme.


title: How add class youtube and type/html to oembed code?

text: How can i add :               class="youtube-player" type="text/html"      to iframe like :                function Oembed_youtube_no_title($html,$url,$args){         $url_string = parse_url($url, PHP_URL_QUERY);         parse_str($url_string, $id);         if (isset($id['v'])) {             return '<iframe class="youtube-player" type="text/html" src="https://www.youtube.com/embed/' .$id['v'].'?vq=large&autohide=1&autoplay=1&fs=1&hl=fr&rel=0&loop=1" frameborder="0" allowfullscreen></iframe>';         }         return $html;     }


title: How to use getimagesize() of image upload?

text: I need to check the resolution of an image I want to upload via media box, and then upload it into a custom directory. As a starting point I used part of the code from How Can I Organize the Uploads Folder by Slug (or ID, or FileType, or Author)? And a part of it looks like this:               function wpse_25894_custom_upload_dir($path)     {                 $use_default_dir = ( isset($_REQUEST['post_id'] ) && $_REQUEST['post_id'] == 0 ) ? true : false;          if( !empty( $path['error'] ) || $use_default_dir )             return $path; //error or uploading not from a post/page/cpt               //THIS LINE PRODUCE ERROR. HERE I NEED TO GET WIDTH AND HEIGHT OF IMAGE I WANT TO UPLOAD         list($width, $height) = getimagesize($path.'/'.$_POST['name']);          $customdir = '/'.$width.'x'.$height; //uplaod folder will be for example '640x480'              $path['path']    = str_replace($path['subdir'], '', $path['path']); //remove default subdir (year/month)         $path['url']     = str_replace($path['subdir'], '', $path['url']);               $path['subdir']  = $customdir;         $path['path']   .= $customdir;          $path['url']    .= $customdir;                return $path;     }      `$_POST['name']` contains file name of image, like 'myimage.jpg'.


title: Get Posts Link With Each Other

text: I am developing a news website and they want a (linked with other posts) at the bottom of the page. for example, while writing new post, they added a link to an old post and when reading these posts at the bottom of the page there should be a list of all other posts linked with/in this. Is there anything in WP? Thanks


title: Form fields based on custom fields

text: I need to create a contest forms where the fields are based on values in several custom fields. The form layout is to be somewhat static, except from the contest questions (labels) and the type of those fields. Here's the basic layout.               [Label - <Subject>] -based on custom field     [Input - hidden]          [Label - <Question 1>] -based on custom field values     [Input - textfield OR x3 radiobuttons] -based on custom field values          [Label - <Question 2>] -based on custom field values     [Input - textfield OR x3 radiobuttons] -based on custom field values          [Label - <Question 3>] -based on custom field values     [Input - textfield OR x3 radiobuttons] -based on custom field values          [Label - Name]     [Input - textfield]          [Label - Email]     [Input - textfield]      Tried something like this with Jetpack forms. But can't get it to work. The output is correct, but the form wont submit. Suggestions on how to solve this? I've looked at a couple of different form plugins (GF, CF7), but have not found anything that can do this.


title: Hide feature image when is not populated

text: I have a customized a comercial theme with featured images capabilities.   When I have a post with featured image everything is ok, but when the post hasn't a featured image the template charge an empty div; ![with/without featured image](http://i.stack.imgur.com/yP5kxm.png) how I can solve this issue? **My code** ![code used](http://i.stack.imgur.com/Kywia.png)


title: Add # before each tag

text: How can we add `#` before each tag with both `the_tags( )` and `wp_tag_cloud( )`?


title: remove "index.php" from permalinks

text: I have been trying to find a solution. but I can't.. my links are all domain.com/index.php/post_name/ I really want to remove "/index.php" I have searched and found some... saying I need to add these.. but it's not working ..               # 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      I am using 3.5.2 wp. please let me know if you know anything about it.


title: Programatically re-order images in the ACF gallery add-on. Orderby Title, ID, etc

text:
I have a gallery field using the advanced custom fields gallery addon. This is how I am outputting my gallery fields/images in my theme...               <?php          $images = get_field('gallery');          if( $images ): ?>
                  <?php foreach( $images as $image ): ?>                      <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />                  <?php endforeach; ?>
          <?php endif; ?>          And this is the only way in the documentation I can see how to implement it. Does anyone now who how I can order the images by title, id or anything when they are outputted in the loop?    Many Thanks


title: Show list of authors with latest post NOT older than a month

text:
I found two bits of code. One gets me posts NOT older than a month the other bit gets me a list of authors and their custom fields, names, etc. Can someone please help me integrate the two. One runs in the wordpress loop with a custom query and the other is a foreach (all stuff I don't know much of). How can I get the two to work together. Thanks for any help.               <?php             $display_admins = false;             $order_by = 'display_name';             $role = ''; // 'subscriber', 'contributor', 'editor', 'author' - leave blank for 'all'             $hide_empty = false;                  if(!empty($display_admins)) {                 $blogusers = get_users('orderby='.$order_by.'&role='.$role);             } else {                 $admins = get_users('role=administrator');                 $exclude = array();                 foreach($admins as $ad) {                     $exclude[] = $ad->ID;                 }                 $exclude = implode(',', $exclude);                 $blogusers = get_users('exclude='.$exclude.'&orderby='.$order_by.'&role='.$role);             }             $authors = array();             foreach ($blogusers as $bloguser) {                 $user = get_userdata($bloguser->ID);                 if(!empty($hide_empty)) {                     $numposts = count_user_posts($user->ID);                     if($numposts < 1) continue;                 }                 $authors[] = (array) $user;             }     <?php                 foreach($authors as $author) {                     $display_name = $author['data']->display_name;                     $main_profile = get_the_author_meta('mainProfile', $author['data']->ID);                     $hover_profile = get_the_author_meta('hoverProfile', $author['data']->ID);                     $author_profile_url = get_author_posts_url($author['ID']);             ?>

                         <img src="<?php echo $main_profile; ?>" alt="<?php echo $display_name; ?>">

                         <a href="<?php echo $author_profile_url; ?>">                             <img src="<?php echo $hover_profile; ?>">

                  <?php}?>      Loop:               <?php                 $args =  array(                     'showposts' => 1,                     'orderby' => 'date',                     'date_query' => array(                         array(                             'after' => array(                                 'year'  => date( "Y" ),                                 'month' => date( "m", strtotime( "-1 Months" ) ),                                 'day'   => date( "t", strtotime( "-1 Months" ) ),                             ),                             'inclusive' => true,                         )                     )                 );                 $query = new WP_Query( $args );                      if ( $query->have_posts() ) {                     while ( $query->have_posts() ) {                         $query->the_post();             ?>                      <a href="<?php echo the_permalink(); ?>"><?php echo get_the_title(); ?>                  <?php }} ?>


title: What filter or action to replace comments or add new comment system

text:
I am looking to make a plugin for my site, which either replaces the current comments in a post or adds an additional comment system. I am getting the comments from a custom RSS feed from my forum that is linked to posts. I have this working with the following.               function swmc_comments_callback( $comment, $args, $depth ) {     $GLOBALS['comment'] = $comment;     global $post;          include_once(ABSPATH . WPINC . '/class-simplepie.php');           //require 'includes/simplepie.inc';       $feed = new SimplePie();       $feed->set_feed_url('<feedurl>?swmc=syndicate&article='.$post->ID);      $feed->force_feed(true);     $feed->set_item_class();       $feed->enable_cache(false);       $feed->set_cache_duration(3600);       $feed->init();       $feed->handle_content_type();           if ($feed->error())     {         echo $feed->error();     }          $max = $feed->get_item_quantity();          for ($x = 0; $x < $max; $x++)   {         $item = $feed->get_item($x);                  if ($author = $item->get_author())         {             $username = $author->get_name();         }              //echo "

title: ".$item->get_title();         $dan_data = $item->get_description();              //echo "
Posted on ". $item->get_date('j F Y | g:i a');         //echo  "
username: ".$username;         ?>         <li <?php comment_class(); ?> id="li-comment-<?php $x; ?>">         <article id="comment-<?php $x; ?>" class="comment">
<?php echo $dan_data; ?>

<?php echo "Comment author: ".$username; ?>

         <?          }      } I can then use the template by using               <?php wp_list_comments( array( 'callback' => 'swmc_comments_callback' ) ); ?>      However whilst this will work. I would like this to work across all themes but I am not sure how to call this without adding it into the template as I have here. Is there a filter or a hook I should use? Cheers Dan


title: Show content based on page number

text: I have a post that I would like to split in to 5 pages and depending on which page the user is on the image at the top of the page needs to change. So page 1 of the Post displays the image in custom field image_1, then page 2 displays the image in custom field 2 and so on... I've set up my custom fields for the post but can't find reference to the function for detecting what page the user is on so I can add the function in to my template, what is the function I should be using?


title: Call specific plugin update

text: I'm looking for way to update specific plugin via xmlrpc api. There is no exposed any function for do upgrades. I've tried to visit `http://example.com/wp-admin/update.php?action=upgrade- plugin&plugin=plugin%2Fplugin.php&_wpnonce=b606ec1c5a` ("update now" url from admin panel, _wpnonce parameter created by calling `wp_nonce_url`), but it gives only "Are you sure?" message. Sending post request to `update- core.php?action=do-plugin-upgrade` gives me this same: are you sure? Maybe there are some actions or some other ways for do that remotely?


title: meta_value and meta_key filtering returning no posts

text: this might sound like a very stupid question, and I am almost ashamed to put it here... however, after using the code straight from wp codex, and trying a couple of other variations from googling around, i simply have NO IDEA why this is not working! here's what i am using for the wp query on the index.php               $args = array(         'post_type' => array('photographs', 'published_works'),         'meta_key' => 'place',         'meta_value' => 'usa',         'posts_per_page' => '-1'     );      i set up a custom taxonomy called 'place', and 'usa' is one of the terms. i can get to the archive page easily, but if i want to filter it out in the index page, it simply shows no posts at all. so, i am assuming that the mistake is probably elsewhere, since the code above is taken straight from codex. any ideas of what i might be doing wrong??? much appreciated!


title: fire action when post is being edited as well as saved?

text:
I'm trying to fire some code when a page is edited and/or saved. This code works:               add_action( 'save_post', 'add_promoted_meta_data' );     function add_promoted_meta_data( $post_id ) {        echo '
test
';     }      ...but this code does not:               add_action( 'edit_post', 'add_promoted_meta_data' );     function add_promoted_meta_data( $post_id ) {        echo '
test
';     }      What action would I use to combine the functionality? I ultimately need to fire code upon creating or editing a post? Thanks in advance!


title: Developing a wordpress.com shortcode

text: I am looking to develop a shortcode that all wordpress.com users can use. Should I proceed with developing a plugin? I know users on wordpress.org can use the plugin but I am confused on how to make wordpress.com users use the shortcode as wordpress.com does not let the users to install a plugin. Is it done in the background by wordpress.com by looking up the plugins?


title: How to run a external JavaScript file on wp-admin if admin, and other if normal user?

text: I'm new to WordPress plugins, and I'm trying to load a external JS/jQuery file with some scripts I need. It needs to run in the wp-admin page (not just once when activated). There is a JS file for a common user and another one for the admin.               function wp_ui_activation() {     }          register_activation_hook(__FILE__, 'wp_ui_activation');          function wp_ui_deactivation() {     }          register_deactivation_hook(__FILE__, 'wp_ui_deactivation');          add_action('wp_enqueue_scripts', 'wp_ui_scripts');          function wp_ui_scripts() {           wp_enqueue_script('jquery'); //add jquery              if (!is_admin()) { // it's not admin             wp_register_script('custom_script', plugins_url('assets/js/custom_script.js', __FILE__),array('jquery')); //register custom_script             wp_enqueue_script('custom_script'); //add custom_script         }              if(is_admin()){ // it's admin             wp_register_script('custom_admin_script', plugins_url('assets/js/custom_admin_script.js', __FILE__),array('jquery')); //registra custom_admin_script             wp_enqueue_script('custom_admin_script'); //add custom_admin_script         }            }      All that resides inside the JS file is a `jQuery(function() {alert("admin")});` and a `jQuery(function() {alert("no-admin")});` but none of them shows up... What am I missing?


title: get_the_title and get_permalink outside of the Loop

text:
I'm trying to list the parent to a page in the sidebar. I can get the parent- page ID. I can get it to print with a print_r function, but no matter what I try I can't get get_permalink and get_the_title to display.                 <?php         global $wp_query;            if(!$wp_query->post->post_parent){  //no parent           $children = wp_list_pages("title_li=&depth=1&child_of=".$wp_query->post->ID."&echo=0");   // will display the subpages of this top level page       }else{    // diplays only the subpages of parent level                if($wp_query->post->ancestors){               $ancestors = end($wp_query->post->ancestors);               $ancestorsID = get_post_ancestors($wp_query->post->ID);                $children = wp_list_pages("title_li=&child_of=".$ancestors."&echo=0");}       }            if ($children) {            echo '
';                if($wp_query->post->ancestors){           echo '
'; print_r($ancestorsID[0]); get_permalink($ancestorsID[0]); get_the_title($ancestorsID[0]); echo '
'; }                else {echo '
'; the_title(); echo '
';}           echo $children;           echo '
';       } ?>


title: PHP Puzzle: Unique Styles with PHP loop

text:
**The Puzzle:** I am currently working on a music blog that has various venues and numerous locations that are laid out at the top of each post as follows: **USA.California.Los Angeles.** Hollywood Bowl _Note: Everything except the venue name (Hollywood Bowl) is bold._ In order to limit the number of calls to the server I have clumped all the title information into a single array (as seen below). ![enter image description here](http://i.stack.imgur.com/0CY9X.jpg) ![enter image description here](http://i.stack.imgur.com/QYAz8.jpg) As of now I am simply calling everything in the array consecutively:               <?php $custom_fields = get_post_custom($post->ID);          for ($i = 1; $i <= 4; $i++)  {             if(isset($custom_fields["rw_location_$i"])){ ?>
<?php echo get_post_meta ($post->ID,"rw_location_$i", true ); ?>
                 <?php } ?>                 <?php } ?>      **The Question:** How do I still make a "single call" but create a unique class (h1,h2,h3) for different `$i`? For example have the `$i = 1` be a `<h1></h1>` tag and `$i = 2,3,4` be `<h2></h2>` tags. I hope my question is clear enough, if not I'd be happy to elaborate further. (P.S. I know the numbering is off, but I'm sure we can all overlook that)


title: Creating the wp-config.php file manually

text: Setting up WordPress, I'm getting the following message: "Sorry, but I can't write the wp-config.php file. "You can create the wp- config.php manually and paste the following text into it."   1. Do I copy-paste the text into a file and upload that to the server?   2. If yes to question 1, to create the file, is Text Wrangler an appropriate program to use? (I use a Mac)   3. If Text Wrangler is an appropriate program, in saving the file, would I choose "Line breaks: Unix (LF)" and "Encoding: Unicode (UTF-8)" and would I manually add ".php" to the file name when I save it?   4. The text that WordPress is giving me to paste into wp-config.php includes comments such as: > * * This file is used by the wp-config.php creation script during the * > installation. You don't have to use the web site, you can just copy this > file * to "wp-config.php" and fill in the values." and: > /**#@+ * Authentication Unique Keys and Salts. * * Change these to different > unique phrases! * You can generate these using the {@link > https://api.wordpress.org/secret-key/1.1>/salt/ WordPress.org secret-key > service} * You can change these at any point in time to invalidate all > existing cookies. This >will force all users to have to log in again. ...do I just copy all this into the file wp-config.php and upload it to the server? Thanks, Richard


title: Simple Fields plugin -- where is it?

text: I am using WP 3.2.1 and I'm trying to use the Simple Fields (0.3.9) plugin. Going off of this tutorial, it looks like there should be a "Simple Fields admin" page somewhere in the dashboard, but I cannot find this.


title: Recommend a guide to catching plugin errors, please?

text: I'm working on a small plugin and on some WP installations it throws up the white screen of death. I'm new to this, and would like to know if there is a decent guide out to there (so far my googling over the white screen of death hasn't turned up anything for developers), or some best practices I should be following to make sure I catch errors or avoid anything foolish. Any and all links or tips would be massively appreciated.


title: Problem saving wordpress settings with current version. Is it a bug?

text: **With the current version of wordpress 3.2.1 I am having this kinds of problem. I install wordpress frequently and I did not notice it before 3.2.1** **Problem:** Not being able to save settings under settings tab. The file names are `options-general.php`, `options-writing.php`, `options-reading.php`, `options-discussion .php`,`options-privacy.php`. Only settings that seems to be working is `options-permalink.php`. When I press the save settings button its just keep going and after couple of minutes its says "connection was reset" and some time with a "500 internal server error". However `options.php` page is also okey infact i am currently using it to same those information. **Observations:**   1. **Hosting:** Tested in different hosting "inmotion", "hostgator" "godaddy".   2. **Technical info:** All of those wordpress runs on Linux and apache.   3. **Browser:** I know its not a browser issue but still i tested it with different browsers Firefox and Chrome.   4. **Theme installed:** Some of those sites are using default 2011 theme and some custom theme. So, I don't think its a problem with theme.   5. **Plugins:** Tested with fresh wordpress install with no plugin/with plugin. **UPDATE:** Just downloaded the wordpress 3.2.1 zip file from wordpress.org and installed it to my localhost. Its seems fine in my local computer. But still having problem with wordpress in server.


title: Does Feedburner send notifications about WordPress pages?

text: Does Feedburner send out notices about PAGES that are created or updated in WordPress, or just POSTS? My client doesn't want emails going out about his PAGE content, but I can't find anything at Feedburner that states that it deals with POSTS only, not pages. Thank you!


title: Importing posts only - consequences?

text: One of my client holds a slow Internet connection. So he wants to do all his web updates locally (by any means - he doesn't understand codes) and then he wants to update the website by any _easy and quick means_. Now I's thinking to make him a `localhost` setup in his PC, and setting up everything like his web servers. Then I'll let him to do all his updates in localhost, and then `Tools > Export > All Posts` (posts only). With this `.xml` file then he will import the file into the web server simply by `Tools > Import`. :) But is it Ok from all aspects - I think, I'm probably missing some bad consequences-   * What about the uploaded image files, will they be uploaded into the `../uploads/..` folder?   * What about the maximum execution time exceeds ERROR - and some missing `posts/media`?   * What about duplicate posts, media entry etc. _(is it really possible? - I don't think so, but...)_?   * etc. I've bad experiences regarding such import <> export things - it duplicated my custom menus and even duplicated the WordPress's default post ( _Hello World!_ ) and Page ( _Single Page_ ). So, under this circumstances, **am I thinking in the right way?**


I want empty search returns to home page in my wordpress . how i can do this . im trying to using javascript and html tags , but te are not too fast . if no result user returns to home page not to nothing found page.


title: post-per-page and offset not working

text:
This is my code, why cant i get post per page and offset result ?.               <?php          $myquery['tax_query'] = array(             'relation' => 'OR',             'posts_per_page' => 3,             'offset' => 3,         array(             'taxonomy' => 'brands',             'terms' => array('iHOME'),             'field' => 'slug',             ));         query_posts($myquery);?>     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <?php the_post_thumbnail();?>     <?php the_title();?>
<?php echo excerpt(25); ?>
     <?php echo esc_html( get_post_meta( get_the_ID(), 'category', true ) ); ?>          <?php endwhile; else: ?>     <?php endif; ?>


title: WordPress plugin for Limited days user

text: I have free demo use of my application for 10 days then use automatically disable. Not delete. After he pay us for using that application for 1 year we can extend that time duration. If there is no any plugin, any snippet suggestion ?


title: Multiple post type queries (with specific arguments for each)

text: So i know how to combine post types into 1 loop and out put the loop. Below is what i have:                       <?php                  $args = array(                 'post_type' => array('post','movie','actor'),                 'posts_per_page' => '20',             );                  query_posts( $args );             while ( have_posts() ) : the_post();                       the_title();                  endwhile;                   ?>       This works as expected, however is it possible to specify different arguments for each post type, while keeping them within the same original loop. So for example i need to add a `meta_key=value` argument to the `movie` & `actor` post types. Is this possible?


title: Is it bad practice to create own table for a plugin?

text: If I want to save settings for my plugin then it is pretty easy and straight forward. Now I would like to save to the database a bit more. A file name, and 3 other values that only apply to that file. And there are many files with those values. Is it possible to save kind of subarrays using built in database methods? How can I delete and sort them etc?


title: How can I hide the IP of registered commentators?

text: There is already a related question at How do I turn off wordpress comments ability to capture a users ip address? But is there a solution to do it for users/mods/admins only? So that normal anonymous visitors will have their IPs stored but registered users not.


title: Trying to include files in plugin isn't working

text: I've created a simple site specific functions plugin but I'm having some trouble including additional files to it. Basically I'm trying to keep things separated so I've got one php file for general functions (The default plugin file) and another for custom post types and taxonomies. Here's a sample of my current code, does anyone know where I'm going wrong?;               <?php     /*     Plugin Name: Functions Plugin     Description: Site specific functions     */          include( plugin_dir_path( __FILE__ ) . 'types.php');          /* General Functions Here */          ?>


title: Add Extra Category Field to CPT Categories

text:
So I'm able to add an extra field to my categories (A Color picker actually, to color code categories - pretty cool stuff if anybody is interested) but the extra field ONLY shows up under Posts. I have a CPT with its own category page and it doesn't show up there. Is there a way to only have the extra field show up under my CPT categories page? Do I need to hook into something different? Here's what I'm doing now:               /** Add New Field To Category **/     function extra_category_fields( $tag ) {         $t_id = $tag->term_id;         $cat_meta = get_option( "category_$t_id" );     ?>
         <?php _e('Category Name Background Color'); ?>
                 <input type="text" name="cat_meta[catBG]" class="colorpicker" size="3" style="width:20%;" value="<?php echo (isset($cat_meta['catBG'])) ? $cat_meta['catBG'] : '#fff'; ?>" />

             <?php _e(''); ?>

     <?php     }     add_action ( 'category_add_form_fields', 'extra_category_fields');     add_action('category_edit_form_fields','extra_category_fields');


title: Change URLs depending on alias

text: I have two domain names: themaindomain.com and thealias.com. Wordpress is located under themaindomain.com. I was wondering if it is possible to change the urls to posts and pages when there is a request from thealias.com To make clear: When there is a request from themaindomain.com, the server returns a page with some links like themaindomain.com/post1, themaindomain.com/page1. When there is a request from thealias.com, the server should return a page with some other links like thealias.com/post1, thealias.com/page1. So the two domains point to the same blog, but depending on the request url it changes the links. Is this possible and if it is, how? Thanks a lot...


What is the difference between $post_id and get_the_ID()? I could not find any documentation on $post_id.


title: theme upgrade failing

text: The twenty eleven theme fails to update. The error message is : failing to delete old theme. For security reasons i dont want to give rights to every folders of the project. What are the folder to give rights to for that action?


title: How to order posts by parents?

text: I wanted to order my post type archive by its parents (like page list in wp- admin). This is what i have tried, but no luck so far.               add_action( 'pre_get_posts', 'budget_archive_data' );          function budget_archive_data($query){         $main_budget = array(3,4);              if ( (is_post_type_archive('account') || is_post_type_archive('budget')) && $query->is_main_query() ) {                       $query->set( 'orderby', 'parent' );             $query->set( 'order', 'DESC' );             $query->set( 'posts_per_page', -1 );             $query->set( 'post__not_in', $main_budget );              }     }      The result was:   * Post 2 whose post_parent is 0   * Post 3 whose post_parent is 0   * Post 6 whose parent is 0   * Post 4 whose parent is 2   * Post 5 whose parent is 3 Anyone can help? Thanks before.


title: Thumbnails not showing in blog

text:
I am trying to add thumbnails to a wordpress blog (that was created by someone else). As a newcomer to Wordpress I understand I need to add "the_post_thumbnail();" inside "the loop" but looking at the index.php file I dont see that there is a loop. If you look at the code you can see i have tried to insert the the_post_thumbnail(); but looking at the front end http://www.chcdev.co.uk/blog/ there are still no thumbnails. (Yes I added a featured image to the posts aswell). Can any of you clever people shed any light on this?
               <?php          // Settings     $blog_ids    = array(5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,28);     $news_limit  = 15;     $excerptsize = 250;     $pipes_url   = 'http://pipes.yahoo.com/pipes/pipe.run?   _id=ffc88cc14e18d87eb77c214c27f84e02&_render=json';          // Fetch recent posts for each blog and add them to an array indexed by date     foreach ($blog_ids as $b) {     switch_to_blog($b);     $posts = get_posts('&numberposts='.$news_limit.'&order=DESC&orderby=post_date');     foreach ($posts as $p) {         $news_tmp[strtotime($p->post_date_gmt)]['permalink'] = get_permalink($p->ID);         $news_tmp[strtotime($p->post_date_gmt)]['date']      = date("j", strtotime($p->post_date_gmt));         $news_tmp[strtotime($p->post_date_gmt)]['month']     = date("M", strtotime($p->post_date_gmt));         $author_arr  = get_userdata($p->post_author);         $news_tmp[strtotime($p->post_date_gmt)]['author']    = $author_arr->display_name;         $news_tmp[strtotime($p->post_date_gmt)]['title']     = $p->post_title;         $news_tmp[strtotime($p->post_date_gmt)]['content']   = preg_replace('|\[(.+?)\](.+?\[/\\1\])?|s', '', strip_tags($p->post_content, '
'));         $news_tmp[strtotime($p->post_date_gmt)]['excerpt']   = '
' . substr( $news_tmp[strtotime($p->post_date_gmt)]['content'], 0, strrpos( substr( $news_tmp[strtotime($p->post_date_gmt)]['content'], 0, $excerptsize), ' ' ) ) . '...
';     }     }          // Fetch Yahoo pipes data and add them to an array indexed by date     $ch = curl_init();     curl_setopt($ch, CURLOPT_URL, $pipes_url);     curl_setopt($ch, CURLOPT_HEADER, 0);     curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);     $data  = curl_exec($ch);     curl_close($ch);     $pipes = json_decode($data, true);     $c=1;     foreach ($pipes['value']['items'] as $pipe) {     $d_parts = explode(' ', $pipe['pubDate']);     $t_parts = explode(':', $d_parts[4]);     $d = $d_parts[1]." ".$d_parts[2]." ".$d_parts[3]." ".$d_parts[4];     $news_tmp[strtotime($d)]['permalink'] = $pipe['link'];     $news_tmp[strtotime($d)]['date']      = ltrim($d_parts[1], '0');     $news_tmp[strtotime($d)]['month']     = $d_parts[2];     $news_tmp[strtotime($d)]['author']    = 'Yahoo!';     $news_tmp[strtotime($d)]['title']     = $pipe['title'];     $c++;     if ($c == $news_limit) {break;}     }          // Sort by the index (date)     ksort($news_tmp);          // Trim array to requested number of posts     $news = array_slice(array_reverse($news_tmp), 0, $news_limit);          // Display          foreach ($news as $n) {          echo "
\n";     echo "
".$n['title']."
\n";          echo "
\n";          the_post_thumbnail();      echo "
\n";          if( $n['author'] != 'Yahoo!') {         echo "              Written by: ".$n['author']." on " . $n['month'] . " " . $n['date'] . "\n";     }     else{         echo "              Generated by Yahoo!     Pipes. Written on " . $n['month'] . " " . $n['date'] . "\n";     }     echo "

\n";     echo "              " . $n['excerpt'] . "\n";     echo "
\n";     echo "          \n";               }          switch_to_blog(19);     ?>


title: Passing boolean values with wp_localize_script

text: I am using wp_localize_script to pass a couple of values from my theme options to a javascript file. First I got the values from my theme options:               $options = get_option('theme');       $flex_auto = $options["slide-auto"];     $flex_animation = $options["slide-animation"];     $flex_direction = $options["slide-direction"];      Then I used `wp_localize_script` to create my array of values.               wp_enqueue_script('flexslider');     wp_localize_script('flexslider', 'flex_vars', array(         'flex_auto' => $flex_auto,         'flex_animation' => $flex_animation,             'flex_direction' => $flex_direction         )     );      In my javascript file I did this:               var $anim = flex_vars.flex_animation;     var $auto = flex_vars.flex_auto;     var $dire = flex_vars.flex_direction;          jQuery('.flexslider').flexslider({         animation: $anim,         slideshow: $auto,         controlNav: 'thumbnails',         directionNav: $dire,          slideshowSpeed: 7000,         animationSpeed: 1000,         touch: true,     });      My theme options include some values that are made with checkboxes which work with 0/1 booleans while the jQuery plugin I'm using works with true/false. I tried saving the boolean value as strings by using a drop-down menu with two options, either true or false, but that doesn't seem to work. How can I pass the boolean values from the theme options to the javascript file? Any suggestions and hints very welcome :)


title: Integrate WordPress in Yii

text: I'm developing a web application in Yii, now the client wants to integrate WordPress in it so he can manage contents on his own. So how can I integrate WordPress in Yii?


title: hypher.js doesn't work to IE and Chrome

text: `functions.php1`               wp_register_script( 'en-us', get_template_directory_uri() .'/js/en-us.js');     wp_enqueue_script( 'en-us');      `header.php`               <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>     <script type="text/javascript" src="https://raw.github.com/bramstein/hypher/master/dist/jquery.hypher.js"></script>          <script type="text/javascript">            jQuery(document).ready(function($)     {           $(function() {           $('p').hyphenate('en-us');             });         });     </script>      `.p{color:#fff; text-align: justify;}` This only works for Firefox, but not for IE and Chrome. The strange is that when i create simple `index.html` works. What i am doing wrong? Thanks in advanced.


title: don't publish custom post type post if a meta data field isn't valid

text: I have a custom post type (CPT) called `event`. I have a meta box for the type with several fields. I would like to validate some fields before publishing an event. For example, if an event's date is not specified I would like to display an informative error message, save the event for future editing, but prevent that event from being published. Is 'pending' status for an CPT post without all necessary info the right way to treat it? What's the best practice to do CPT fields validation and prevent a post from being published, but save it for future editing. Many thanks, Dasha


title: Setting Required Fields When Writing a Post

text: > **Possible Duplicate:**   >  don't publish custom post type post if a meta data field isn't valid I originally asked this Q over at theme hybrid, Justin suggested I ask in here, he suggested javascript may be my best option, has anyone had any success in implementing the following? if I were to have a community based site with multiple authors, is it possible to make all the fields inside the post area a required element before the post can be published? for example, the author must add at least one tag, include the title, description and keywords in the meta, and choose the category. Most of these requests would be fairly easy to explain, that the author needs to fill in these details but I am sure, and I know this from experience, many people will just not bother with filling in some of the necessary elements for publishing a post. If I could set up a required field function that would force the user to fill in these details before the post will be published it would certainly save quite a few headaches. Cheers.


title: Search box as a menu item in the nav menu output by wp_nav_menu?

text:
I am using the Twenty Twelve theme, and the following is the code it uses to register and display the menu. **In functions.php:**               function twentytwelve_setup() {              ...              // This theme uses wp_nav_menu() in one location.         register_nav_menu( 'primary', __( 'Primary Menu', 'twentytwelve' ) );              ...          }     add_action( 'after_setup_theme', 'twentytwelve_setup' );      **In header.php:**                        <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>           And the output code looks similar to this:

                     Home

                     About

           But I would like to modify the output so that a search box can be integrated into the navigation menu as a menu item like so:

                     Home

                     About

                                               <form method="get" id="searchform" action="/">                         Search                         <input type="text" class="field" name="s" id="s" placeholder="Search" />                         <input type="submit" class="submit" name="submit" id="searchsubmit" value="Search" />                     </form>

           How do I go about doing this? I need a code-backed pointer or two. Spoon- feeding is welcome too. :P


title: How to side load an image from a service

text: I am currently working on a WordPress plugin that creates dummy content. I'd like to also have the plugin create random images using a service like http://lorempixel.com. The problem however is that when accessing the service that an actual file name isn't generated. You generate a random image like this: http://lorempixel.com/1200/700/ How can I use the `media_handle_sideload()` function to accomplish this?


title: Adding pagination to sub-wp_query within a singular post page

text: So my custom wordpress theme/site has a number of venues, e.g. "foo" which has a number of events and reviews. So a venue ends up with a URL like,               http://www.example.local/places/my-place-name/      But in addition to rendering the venue's content (the_content()... etc) I'm rendering the events and reviews at that venue (the venue is a 'parent' as the event and review post types have the venue as it's 'parent') So for this I'm running a custom wp_query for these two post types. I'm running into trouble as I can't paginate the results from my custom wp_query. Even if I want to roll my own pagination routine by getting the page number off the URL and then setting the 'offset' on the wp_query, wordpress doesn't like the additional parameters on the end of the URL. For example if I go to:               http://www.example.local/places/my-place-name/mypage/2/      Simply renders a 404 not found. I'd like to avoid using a query string style URL such as               http://www.example.local/places/my-place-name/?mypage=2      As this looks a bit of a mess. Any guidance on how to make pagination work for the custom wp_query within the post's page (or even how to get wordpress to allow me to add additional pagination parameters to my URL) would be great.


title: Create API for single sign-on with 3rd party site

text: My site needs to integrate with a 3rd party software, which will live on its own sub-domain, hosted by the software company. I need to provide the 3rd party developers with an endpoint that they can use to make API calls (to my wordpress site) in order to allow my site's users to access the sub-domain. The other site needs to authenticate users from my site through some sort of API. I'm not sure where to start, but my sense is that this has been figured out by people smarter than me. Thanks in advance!


title: Customise search form in the Widget

text: I would like to customise the Search Form that you drag and drop from the widgets panel. The customisation will be more than just css changes. I would like to add and custom classes. Is this possible? Is there a hook to customise the Search Field? The only option I can think of is to create a custom search widget.


title: Different banner for different section

text: I have different section like about us, portfolio, gallery. Client want to upload different banner for different section that I have given on every page custom field. But problem is I want same banner image for About us section ( all inner pages). I search in many forum but I think no one have done this before.


title: like to keep reading plugin

text: I am using the _like to keep reading_ plugin. I have created some code in _index.html_ file. I use this code               [like_to_read] some code here [/like_to_read]      That is not working.   But if I use in this in a post it will work like a charm.   I, however, want to use in _index.html_. How can I achieve that?