title: How do I add new post formats to twenty fourteen theme?

text:
I haven't used WP since 3.5 so forgive my rustiness. I am trying to customize a child theme of twenty fourteen for WP 3.9.1 to make it more like a corporate site rather than a magazine site. **My goal:** For the marketing department to simply login, add a product (post) and select the matching post format. In SLT3, I did a `Find Advanced > In Parent Folder` and duplicated the image custom post format code in `taxonomy-post_format.php`, `languages/twentyfourteen.pot`, `inc/widgets.php` and added a `content- product.php` with no luck. _In addition to the default Standard, Aside, Image, Video, Audio, Quote, Link and Gallery, how do I add more custom post formats e.g. products?_ **From content-product.php:**               <?php     /**      * The template for displaying posts in the product post format      *      * @package WordPress      * @subpackage Twenty_Fourteen      * @since Twenty Fourteen 1.0      */     ?>     ...
                                      <a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'product' ) ); ?>"><?php echo get_post_format_string( 'product' ); ?>      **From widgets.php:**               public function widget( $args, $instance ) {         $format = $instance['format'];              switch ( $format ) {             case 'image':                 $format_string      = __( 'Images', 'twentyfourteen' );                 $format_string_more = __( 'More images', 'twentyfourteen' );                 break;             ...             case 'aside':             default:                 $format_string      = __( 'Asides', 'twentyfourteen' );                 $format_string_more = __( 'More asides', 'twentyfourteen' );                 break;             case 'product':             default:                 $format_string      = __( 'Products', 'twentyfourteen' );                 $format_string_more = __( 'More products', 'twentyfourteen' );                 break;         }      **From twenty fourteen.pot:**               #: inc/widgets.php:84 taxonomy-post_format.php:45     msgid "Products"     msgstr ""          #: inc/widgets.php:85     msgid "More products"     msgstr ""      **From taxonomy-post_format.php:**
                         <?php                             if ( is_tax( 'post_format', 'post-format-aside' ) ) :                                 _e( 'Asides', 'twentyfourteen' );                                  elseif ( is_tax( 'post_format', 'post-format-image' ) ) :                                 _e( 'Images', 'twentyfourteen' );                             ...     elseif ( is_tax( 'post_format', 'post-format-product' ) ) :                                 _e( 'Products', 'twentyfourteen' );                                  else :                                 _e( 'Archives', 'twentyfourteen' );                                  endif;                         ?>
                       Most closely related WPSE question here ![The default Post Formats are Standard, Aside, Image, Video, Audio, Quote, Link and Gallery](http://i.stack.imgur.com/XlY4X.png)


title: I want to edit documents on my blog without the need to download and upload files again

text: Would that be possible? Basically, I need something which will enable me to edit files directly at the server... any help would be much appreciated....


title: URL/Permalink customization for Taxonomy/Term archive & post

text: I have a CPT called "Provider", taxonomy called "State" and a term called "Alabama". Is it possible to change the following URL structure from:               1. http://localhost/state/alabama     (to view all the providers from Alabama)          2. http://localhost/providers/some-provider-in-alabama     (added a post under CPT provider and choose AL from State)      to               1. http://localhost/alabama     2. http://localhost/alabama/some-provider-in-alabama      I am using: - WP 3.9.2 - Taxonomy Template "taxonomy-state.php" - WCK - Custom Fields and Custom Post Types Creator (To create CPT and Taxonomy)


title: Theme change only in CSS and a few images

text: We created a theme that has a lot of changes in it. Now we want to enable that theme on our site in different colors, and a few images different: ![enter image description here](http://i.stack.imgur.com/N77sV.png) What we're doing is duplicating the theme, and then making a few changes in the CSS, and change a few images. But it seems an overkill - to copy the all the theme files just to make so few changes. Moreover, if we ever have to change something functional in the theme, we'll have to go through all the duplications and apply it. Is there a way to give users the option of changing colors & images, without duplicating the theme?


Is it possible to change the image in the default theme 'Twenty Eleven'? If yes, how is this done?


title: Gettext details

text: I've got a few `gettext()` questions that are not covered anywhere in WordPress Codex but I think they are important.   1. `__('string')` in THEME should be used for strings that are likely to be present also in main WordPress translation file. No textdomain necessary. Examples: one, two, submit, cancel, remove and other common words. Correct?   2. `__('string', 'textdomain')` in THEME should be used for strings that are theme-specific. Examples: 'this option enables X feature'. Correct?   3. I think it's better to make one textdomain for front-end of theme and another for back-end. Like `__('string', 'textdomain')` and `__('string', 'textdomain-admin')`. Not everyone wants to spend hours to translate 100 additional admin panel strings. Correct or it's bad practice?   4. Each PLUGIN should have its own textdomain: `__('string', 'plugin-name')`. Correct?   5. I think that setting CONTEXT for THEME string is very, very useful but nobody does this. Why? Like: `_x('add item', 'add slide text', 'textdomain')` and `_x('add item', 'shopping cart', 'textdomain')`.   6. How to translate comments, dates, currencies, hours, numbers?      1. Example: one comment, two comments, but in some languages it may be: one comment, two comments, three commentsX, four commentsXY, five commentsXYZ, six commentsABXY (a lot more different plural forms with complex patterns).     2. Example: nearly all themes use `the_time(get_option('date_format'));` - shouldn't it be `echo date_i18n(get_option('date_format'), strtotime($post->post_date));` or `echo date_i18n('F jS, Y'), strtotime($post->post_date));`?     3. Example: English uses 12,345.12, but some languages may use 12.345,12.


title: RSS Feed to contain posts from 1 category only

text: I am using a theme with many custom post types but I would like my main RSS feed `www.domain.com/feed` to show posts and custom post types from one category only. The categoy is defined within `Posts / Categories`.   1. How can I do this?    2. Is this bad for SEO?  In any case, I have noticed that my posts take a few days to be indexed by Google even if they are included in the RSS feed.


title: Conditional loading of CSS for my plugin

text: I'd like to continually load the stylesheet needed by my plugin depending on whether a particular shortcode is present on the post or page. The presence of the shortcode would indicate that the user is using the plugin on that post or page and therefore we need to load the JS and CSS. Is this possible?


title: Upload Directory question

text: Happy New year! So I am having a big of a problem, currently one of our php files that we bought points to the default uploads directory for wordpress and we would like to change this to our own uploads directory. We are still using the default uploads directory for wordpress but we want to change the directory where this custom php file uploads to. Currently the code looks like this:               $upload_dir = wp_upload_dir();     $upload_dir['basedir'].'/downloads/encrypted/'.$item.'/*'));      It currently looks like this "www.example.com/wp- content/uploads/downloads/encrypted/" We want it to point to "www.example.com/downloads/encrypted/" Have looked into the arrays for `wp_upload_dir();` but cannot seem to go a folder back. Any tips or help? Thanks


title: Adding page subdirectory dynamically, as like buddypress does

text: I have a page with slug/name **charts**. So the url looks like `http://domain.tld/charts/` for the Charts page. When i type the url to `http://domain.tld/charts/(something)` or `http://domain.tld/charts/(something)/(something)`, i got error not found, logically it should as there is no sub page with the given names. Now what is want is, when is visit to `http://domain.tld/charts/(something)` or `http://domain.tld/charts/(something)/(something)`, it should still query the Charts page, and also add the single or multiple occurred `(something)` into wp query var so that i can access it with get_query_var function. The (something) would return as an array ofcourse. The `(something)` could be any Alphanumeric characters, and not needed to be a valid one. Just need it so that WordPress Still makes query for the Chart page, and all the extra url path are added to wp_query Object. Your help is strongly needed.


title: Set a hard-coded page-template (post-type-archive) as home/front-page of my wordpress blog?

text: under Settings->Reading I can set which page should appear immediately when visiting my site as "home-page". In my case I want the archive of my custom-post-type named "events" as home/front-page of my site. So I have a hardcoded item in my navigation that says "Events" that links to /events and uses my custom-post-template to loop through my custom-post-type. How could I (and what is the best way) set this archive as the automatic home/front-page of my site? I want to avoid unnessecary routing on my page. So when calling "www.mypage.com" I want the archive to appear immedeately. Any ideas on that? Preferrably even as setting in my "Settings->Reading" section in the backend. Thank you in advance. Matt


title: Using wp_handle_upload and media_handle_sideload with ajax

text: I'm struggling to figure out how to use wp_handle_upload() with ajax when processing a form. What I'm doing here is using a form to allow users to edit posts from the front end so they can do some things like change the image for a post so we'll start there. I'm gonna leave out chunks of this function to keep it simple including the error checking.                // Process the edit form      add_action('wp_ajax_process_edit_form', 'process_edit_form');        function process_edit_form() {              require_once(ABSPATH . "wp-admin" . '/includes/image.php');         require_once(ABSPATH . "wp-admin" . '/includes/file.php');         require_once(ABSPATH . "wp-admin" . '/includes/media.php');              $image_file = $_POST['imageFile'];         $image_file_name = $_POST['imageFileName'];               $post_to_edit = get_post($_POST['postId']);              // Set Image File         if ($image_file["size"] > 0) {             $cover_art_id = media_handle_sideload( $album_cover, $pid );             wp_set_object_terms( $cover_art_id, 'cover_art', 'category');             update_post_meta($pid,'music_art',$cover_art_id);         }                 }      And a basic html form               <form enctype="multipart/form-data">       <input type="file" name="image_file" id="image_file" />       <input type="submit" value="Save Changes" tabindex="6" id="submit" name="submit" data-id="<?php echo $post->ID; ?>" />     </form>      And now some jquery. Note that the script this jquery has been localized and everything else in the form works correctly using my methods. The only thing that doesn't work is the file upload on submit.               $(document).on("click","#submit", function(e) {         e.preventDefault();         $this = $(this);         postId = $this.data("id");         imageFile = $this.closest("form").find("#image_file").val();         if (imageFile != "") {           imageFileName = $this.closest("form").find("#image_file").val().split('\\').pop();         } else {           imageFileName = "none";                        };            data = {           action: 'process_edit_form',           postId : postId,           imageFile : imageFile,           imageFileName : imageFileName        };        $.post(ajaxurl, data, function (response) {        });     });      I might have made some errors transferring this over but this is basically what I'm doing. So why does this not work? I saw this answer that says I need to use some type of ajax upload plugin but I'd like to do it without and if I don't understand how I'm using them to save the upload as an attachment. Straighten me out!


title: Custom Meta Box white screen

text:
I'm trying to create a simple Custom Meta Box for a film post. I need a text box for Title and Director and a textarea for Description. Everything seemed to working until I added the textarea, I wasn't sure how to create the html.
             Description             <textarea name="meta_box_desc" id="meta_box_desc" col="100" row="5"><?php echo $desc; ?></textarea>
      The text boxes and textarea display in WP but when I click Update I get a white screen Can anyone see what I'm doing wrong.                   <?php         add_action( 'add_meta_boxes', 'cd_meta_box_add' );         function cd_meta_box_add()         {             add_meta_box( 'my-meta-box-id', 'Film Credits', 'cd_meta_box_cb', 'post', 'normal', 'high' );         }              function cd_meta_box_cb( $post )         {             $values = get_post_custom( $post->ID );                  $title = isset( $values['meta_box_title'] ) ? esc_attr( $values['meta_box_title'][0] ) : '';             $director = isset( $values['meta_box_director'] ) ? esc_attr( $values['meta_box_director'][0] ) : '';             $desc = isset( $values['meta_box_desc'] ) ? esc_attr( $values['meta_box_desc'][0] ) : '';                  wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );                  ?>
                 Film Title                 <input type="text" name="meta_box_title" id="meta_box_title" value="<?php echo $title; ?>" />

                 Director                 <input type="text" name="meta_box_director" id="meta_box_title" value="<?php echo $director; ?>" />

                 Description                 <textarea name="meta_box_desc" id="meta_box_desc" col="100" row="5"><?php echo $desc; ?></textarea>
             <?php            }                   add_action( 'save_post', 'cd_meta_box_save' );         function cd_meta_box_save( $post_id )         {             // Bail if we're doing an auto save             if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;                  // if our nonce isn't there, or we can't verify it, bail             if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;                  // if our current user can't edit this post, bail             if( !current_user_can( 'edit_post' ) ) return;                  // now we can actually save the data             $allowed = array(                  'a' => array( // on allow a tags                     'href' => array() // and those anchords can only have href attribute                 )             );                  // Probably a good idea to make sure your data is set             if( isset( $_POST['meta_box_title'] ) )                 update_post_meta( $post_id, 'meta_box_title', wp_kses( $_POST['meta_box_title'], $allowed ) );             if( isset( $_POST['meta_box_director'] ) )                 update_post_meta( $post_id, 'meta_box_director', wp_kses( $_POST['meta_box_director'], $allowed ) );             if( isset( $_POST['meta_box_desc'] ) )                 update_post_meta( $post_id, 'meta_box_desc', wp_kses( $_POST['meta_box_desc'], $allowed ) );         }         ?>


title: javascript and css links not working on sever

text: I have some Jquery links in my header. First off I am probably not using the proper wordpress function to do this. Right now on my site the code that is below is not working. These links aren't there, but in my ftp directory they exist. I am not sure what I am doing wrong? I can link to the live site if needed.               <link type="text/css" href="http://fiftyfity.com/wp-content/themes/fiftyfityNew/jQuery-ui-1/css/pepper-grinder/jquery-ui-1.8.17.custom.css" rel=stylesheet />     <script src="http://fiftyfity.com/wp-content/themes/fiftyfityNew/jQuery-ui-1/js/jquery-1.7.1.min.js"></script>     <script src="http://fiftyfity.com/wp-content/themes/fiftyfityNew/jQuery-ui-1/js/jquery-ui-1.8.17.custom.min.js"></script>      and here is the code before output                <?php $url = content_url();?>     <link type="text/css" href="<?php echo $url; ?>/themes/fiftyfityNew/jQuery-ui-1/css/pepper-grinder/jquery-ui-1.8.17.custom.css" rel="stylesheet" />      <script src="<?php echo $url; ?>/themes/fiftyfityNew/jQuery-ui-1/js/jquery-1.7.1.min.js"></script>     <script src="<?php echo $url; ?>/themes/fiftyfityNew/jQuery-ui-1/js/jquery-ui-1.8.17.custom.min.js"></script>


title: How do I / Is it possible to execute an external PHP file / function inside Wordpress?

text: On my set-up, there is the regular website which consists of a header and content (both printed from separate PHP files located in `domain.com/includes/`) and a Wordpress blog based in a subdirectory (`domain.com/blog/`). I want to include domain.com/includes/header.php on the main Wordpress skin. I have tried `require_once`, `include`, specifying the `ABSPATH` in the `wp- config`, and various other techniques but none of them have worked for me. Printing the header.php contents to Wordpress skin is vital and there is no compromise for it in my workflow. I would greatly appreciate any advice as to how I can get this script working, whether it be through a plugin or some edit to the core files, without having to change the location of `domain.com/includes/header.php`. Thanks in advance.


title: Wordpress theme ajax have_posts()

text: My goal here is to load the blogroll into my theme via ajax. But all that I can get as response is 0 (if I omit the die() line, else I get a blank response). Here is my code: js ajax:               $.ajax({         url:"http://domain.com/wp-admin/admin-ajax.php",         type:'POST',         data:'action=load_men_blog',         //dataType:'html',         //cache: false,         success: function(html){             $("#b_contentwrapper").empty();             $("#b_contentwrapper").append(html);         }     });      PHP (functions.php) :               function implement_ajax() {         while (have_posts()):           echo "azerty";         endwhile;         die();     }     add_action('wp_ajax_load_men_blog', 'implement_ajax');     add_action('wp_ajax_nopriv_load_men_blog', 'implement_ajax');      Since I have posts in my database, I expect azerty to be returned. But yet I receive a blank response or 0 if I comment the die() line. If I place any echo outside the while loop I get the echo in the expected div, which means that the javascript is working. Anyone can point me in the right direction?


title: Password recovery URL has error - but not found in code or db

text: On a multisite/network install, all of a sudden my password recovery URL has a problem:                http//my.domain.com/wp-login.php?action=lostpassword      Note the lack of a colon following the 'http'. A grep of the database and codebase does not reveal any culprits (although it must be in there somewhere). Any idea what might cause the problem? The site domain settings all seem correct. Here's the multisite config:               /* Multisite */     define('WP_ALLOW_MULTISITE', true);     define('MULTISITE', true);     define('SUBDOMAIN_INSTALL', true);     define('DOMAIN_CURRENT_SITE', 'http://my.networkdomain.com');     define('PATH_CURRENT_SITE', '/');     define('SITE_ID_CURRENT_SITE', 1);     define('BLOG_ID_CURRENT_SITE', 1);     define( 'SUNRISE', 'on' );


title: Load wordpress content in other domain

text:
I've made some researches on google but can't get the right answer. I need to get my wordpress loops outside a domain using php file. For example: I have a website hosted with **www.mysite.com** using wordpress. And an other one is **www.secondwebsite.com** using only php. I would love to use something like the wp-load.php to use my loops in my php files. Thanks a lot, jhon * * * I can't get the server path rightly... Any ideas? Here are my different path: PHP FILE THAT NEED TO LOAD wp-load.php: `/home/faver/domains/facebook.faver.be/www/lili` Folder where the wp-load.php is: `/home/lbpl/www/` I tried this:               <?php     //Include WordPress     define('WP_USE_THEMES', false);     require('../../../../../lbpl/www/wp-load.php');               query_posts('showposts=1');     ?>          <?php while (have_posts()):           the_post(); ?>
<?php the_title(); ?>
           <?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>">Read more...
     <?php endwhile; ?>      But not working. I think I can't go to the `/home` directory cuz of the FTP rights. Thanks for the help Jhon


title: how can i integrate nexmo with my wordpress site?

text: I've been looking for something that will enable me send sms messages from my wordpress site to subscribers to my blog (it's not on wordpress.com. I got the files from wordpress.org and uploaded it to my own server). Finally I came across Nexmo.com. I've signed up but now I don't know where to begin from here. I've had a look at the documentation they provided at nexmo but I don't really understand what to do with it. Could anyone help me with how i can successfully integrate nexmo with my wordpress site? If it helps I'm using the theme graphene on my site.


title: Help! Turn php link data into url OR hide edit link in post admin OR hide drafts for all users except admin?

text: My website allows users to upload events via an upload process incorporated into a customised front end page. As an event uploader, I also want users to have access to the dashboard where they can view the events they have posted. > I ideally want to remove access to edit.php - I don't want users to be able > to edit / or reach post.php, at all through their dashboard. I only want > them to upload events through the customized front end upload. ### SOLUTION POSSIBILITY 1 I could disable edit for the contributor role completely and still have a way to show posts to the event listers from their dashboard, if I could just learn how to add this info to the menu in the admin side bar in the form of a button in the dashboard (for all users). This code came from a link I found in a widget:               <a href="<?php echo get_author_link( $echo = false, $current_user->data->ID; ?>LINKED TEXT HERE      I tried to add it using AG Custom admin add menu button funtion, but it didn't work. The above would be the ideal solution for me as there'd be no access to edit.php through url link for this role. One set back is that showing the posts in the fron end, shows an edit button when the post is still a draft. I would like to remove the EDIT button from the front end page they view, I think it only appears in draft status as this role can't edit published posts (I will have to double check that). Even if it's the users post I don't want them to be able to edit it once it has been submitted, as I only want what I originally approve to be published. I reckon I could work that out myself (In single probably?)bugt if anyone can help whilst I think of it that would be great! ### SOLUTION POSSIBILITY 2 So - if I use role manager to completely prevent editing, that removes all access to the edit.php. which is fine in the instance above (if I can add that link to show all authors posts into the admin sidebar). But I really do want event uploaders to be able to view a list of their events and view each one. Edit.php seems a good second best place for that to happen if I can't link to a list in the front end as in the exp above, as the events are already listed at edit.php, as is the view facility. I just don't want to allow a link through to edit, and there is that link in the title of the post until I have approved it!! I thought if I could disable the link through to edit a post. (through to post.php) which is incorporated into the title of each row in the table of posts (or events in my case) then that would stop people from accessing that screen. BUT I would then, though, have to solve that the screen would still be accessible if they pasted in '/edit.php' to the url. I have removed quickedit and edit, and edit from the bulk filter at the top of edit.php. ### SOLUTION POSSIILITY 3 Another possible fix takes advantage of the fact that once a post is published (approved by me) by a contributor, this link on the post title in edit.php screen actually disappears! So alternatively, if someone knew a code I could paste into functions within the theme or even the core files, (i don't mind, either way, I'm desp!) to make it possible for only admins to posts of draft status in their post list in edit.php, so once a contributor posts an event in the front end, it doesn't appear in their own post screen until it becomes published (when I have approved it), then that would also solve my problem! Thank you so much for your time! I utterly am stuck, I can't find a solution to any of these options, this as far as I can get with each! I would be so SO grateful if there was anyone out there who could help me with this challenge, I am truly stumped. I'm not a php expert, but I'm handy and have a reasonable grasp, and am good at finding solutions and amending ones from others to match my unusual needs, etc. I have spend ages on this one and just had to wave the white flag! I'll eagerly look out for any tips from our there in the big wide world ! Thanks again Kaye ....................................................................................... Other notes:   * I'm using wordpress v3.1.1   * I use manage readers own posts   * I have hidden the media library so contributors see only their own piccies.   * I use role manager to deal with role limits   * I also use rolescoper to deal with category limits   * I use adminize and global screen options to tailor screen   * I use AG custom admin to help tailor admin screen   * Along with a heap off other functions and plugins. I would very much like to allow event uploaders access to a dashboard, so I don't want to hide the whole dashboard as a solution to this problem of hiding access to editing (or POST.php) in the back end.


title: Custom post type with a forced fixed aspect ratio image crop

text: What I am looking for is similar to a couple other questions. The links are: Creating an Image-Centric Custom Post Type? Using Default WordPress Custom Header Image Crop Feature in a Post Type / MetaBox I am looking for a sort of combination of the two. I'll explain so you don't have to look up these other questions. I would like a user to be able to upload a picture into a custom post type and be prompted to crop the image with a set aspect ratio before saving. I am trying to keep users from needing to crop images outside WordPress just to make them fit into a slideshow with a set image size. The custom header functionality is pretty much what I'd like to use, but I am at a loss on how to pull that into either a plugin or a theme and have it execute in a custom post type. The fact that the user is **asked to crop the image at a set ratio** before proceeding **is key**. I am fairly comfortable with custom post types if anyone can just give me a pointer on how to get WordPress to force a custom cropping of an image before saving the custom post. Thanks in advance to whichever one of you coding geniuses knows/figures out how to do this.


title: Add custom CSS in WordPress Page

text: I am new on wordpress. I am admin in a wordpress site and I don't have access to the theme. I want to create a new blog page where I include a new css code. I tried to add on the text editor:               <style>     my css code     </style>          <div>     .....my html part...     </div>      But it didn't work. I can see the html part without the extra css. Is there any way to do it? **Edit:** I can't use inline style, since I want to include :hover in my css


title: add meta box using function.php

text:
hi does any one know how can i add other meta box and save the data in a different custom fields, using the code below.               <?php     function add_meta_boxes() {         add_meta_box(             'repeatable-fields',             'Audio Playlist',             'repeatable_meta_box_display',             'post',             'normal',             'high');     }     add_action('admin_menu', 'add_meta_boxes');               function repeatable_meta_box_display() {         global $custom_meta_fields, $post;         wp_nonce_field( 'repeatable_meta_box_nonce', 'repeatable_meta_box_nonce' );         //$repeatable_fields = get_post_meta($post->ID, $prefix, true);     ?>              <?php              $meta = get_post_meta($post->ID, 'custom_audio', true);     ?>

                 	                 Name	                 URL

         <?php                  if ( $meta ) {                      foreach ( $meta as $field ) {     ?>
             -	             <input type="text" class="widefat" name="name[]" value="<?php if($field['name'] != '') echo esc_attr( $field['name'] ); ?>" />	                  <input type="text" class="widefat" name="url[]" value="<?php if ($field['url'] != '') echo esc_attr( $field['url'] ); else echo 'http://'; ?>" />	             |||
         <?php                 }              } else {                 // show a blank one     ?>
             -	             <input type="text" class="widefat" name="name[]" />	                       <input type="text" class="widefat" name="url[]" value="http://" />	     |||
         <?php } ?>
             -	             <input type="text" class="widefat" name="name[]" />	                       <input type="text" class="widefat" name="url[]" value="http://" />	     |||

Add another         <input type="submit" class="metabox_submit" value="Save" />
         <?php          }          add_action('save_post', 'repeatable_meta_box_save');     function repeatable_meta_box_save($post_id) {         global $custom_meta_fields;         if ( ! isset( $_POST['repeatable_meta_box_nonce'] ) ||             ! wp_verify_nonce( $_POST['repeatable_meta_box_nonce'], 'repeatable_meta_box_nonce' ) )             return;              if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)             return;              if (!current_user_can('edit_post', $post_id))             return;              // loop through fields and save the data             $old = get_post_meta($post_id, 'custom_audio', true);             $new = array();                       $names = $_POST['name'];             $urls = $_POST['url'];                  $count = count( $names );                  for ( $i = 0; $i < $count; $i++ ) {                 if ( $names[$i] != '' ) :                     $new[$i]['name'] = stripslashes( strip_tags( $names[$i] ) );                           if ( $urls[$i] == 'http://' )                     $new[$i]['url'] = '';                 else                     $new[$i]['url'] = stripslashes( $urls[$i] ); // and however you want to sanitize                 endif;             }                  if ( !empty( $new ) && $new != $old )                 update_post_meta( $post_id, 'custom_audio', $new );             elseif ( empty($new) && $old )                 delete_post_meta( $post_id, 'custom_audio', $old );          } ?>


title: Save author posts as in pending review - block users updating their posts

text: How can I let the users (author, editor, contributor etc) to edit their own posts but not to update them, just keep them as in "pending for review" so I can decide if it's ok to publish or not. By default these posts submitted by users are "pending for review" but once I decide to publish the post, the author can edit the post again and publish it without been held for moderation. Is there any way to get the same post pending for review every time the author edit them ? Thanks in advance


title: Menu with parents, children and or siblings pages display

text:
Here you see the parent menu selected in the horizontal navbar. I already have that working. I need a sidebar like they have with the same parent indicated plus children when they exist . At the moment I have some great code thanks to Michael's feedback at WordPress Stack Exchange on an earlier question here. But that code does not show the parent above the children pages nor children pages above the siblings. Any ideas how can I adjust this code made by Michael:               <?php                           $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0&depth=2');                            if ($children) { ?>
                                <?php echo $children; ?>
                                <?php } //ends (if($children)//         elseif($post->post_parent) { //if no children, try to get parent page and show siblings pages including the page itself             $siblings = wp_list_pages('title_li=&child_of='.$post->post_parent.'&echo=0&depth=1');                               if ($siblings) { ?>
                                    <?php echo $siblings; ?>
          <?php } //ends if($siblings)// ?>                               <?php } else { //optional: if no children and if no parent, then show all top level pages             $pagelist = wp_list_pages('title_li=&echo=0&depth=1');                                    if ($pagelist) { ?>
                                        <?php echo $pagelist; ?>
         <?php } //ends if($pagelist)// ?>         <?php } ?>      The WordPress Codex page http://codex.wordpress.org/Function_Reference/wp_list_pages#List_current_Page_with_its_ancestors_and_children seems interesting, but I have not figured it all out just yet.. **Update:** I added children to a depth of two with the first `if` statement. That helps loading the children and siblings at a permalink level like: http://domain.com/top-level-page/. I just need to do some styling and rework the next to levels. **Update 2 CSS Solution** With some help I do have a menu that works quite well using `wep_list_pages` and some CSS. This is basically a CSS solution.

                          <?php wp_list_pages('title_li='); ?>

        and CSS:               li.current-page-ancestor a, li.current-menu-item a       {         color:#146BBB; //#0D55A8;     }          ul.children .current_page_item a:link,      ul.children .current_page_item a:visited {         background-color:#CCCCCC;         width: 250px;     }               .wplp_menu li{     list-style:none;    /*blends out list dots,can be removed if done somewhere else*/     }          ul#top-level-sidebar {         background: #5097EA;         width: 300px;         margin: 0 10px 0 50px;         float: left;     }          .wplp_menu .page_item a {     display:none;        }     .wplp_menu .current_page_ancestor a,.wplp_menu .children .current_page_item a,.wplp_menu .current_page_item li a  {     display:block;     }          .current_page_item a {    /* CSS for active item*/       font-weight:bold;     }     .current_page_item li a {     font-weight:normal;  /* Resets the above for its children */     }


title: Better in the long run to use post date or custom taxonomy to sort/separate posts by year?

text: I have custom type posts that I need to separate by year as the posts are entries in an annual contest. Would it be better in the long run for efficiency of queries, speed, etc to simply use the built in post date or set up a custom taxonomy to group these posts into years? I notice that post_date is stored in the wp_posts table, so it seems to me that this would make for speedier queries than having to reference the separate taxonomy table. Thank you!


title: Adding new pages to Menu

text: I am new to Wordpress. I am using the free Theme for my blog. I have added Menu as About Us, Contact Us, Groups etc .. I need to add Static Pages to About Us, Contact Us etc ..!! I dont know to How to create and map it to the Menu !!


title: How do I get the Social Media Plugin to show up in my Twenty Eleven child theme's header?

text: Being totally new to WordPress and (extremely) rusty with PHP, I'm having a difficult time figuring out how to add the Social Media Widget to my site's header. I'm using the Twenty Eleven theme, as I need the site to have no sidebars. Ideally, I'd like the social media icons to show up either above or below the site search box (image redacted for client's privacy): ![Widget position](http://i.stack.imgur.com/xUcZu.png) I've tried tutorials and have looked all over the web, but haven't been able to find anything that applies to my rather specific situation. Is this just too hard to do with this theme, and should I just go ahead and use icons instead of a widget? I'm pretty sure I can do this in `functions.php` and `header.php`, but how?


title: Identifying Importer Posts

text: Given a site with 100 posts, where an unspecified number of posts are manually written, and the rest are created using the WordPress importer, how would I programmatically identify the posts imported without having access to remote sites or the original import file? E.g. was this post created by the Importer tool?


title: display loop only if a post meta data exist

text: I'm looking to display the following loop, only if a custom field data exists, if not, I don't want to display anything.                <?php while (have_posts()) : the_post(); $data = get_post_meta( $post->ID, 'key', true );?>       <!-- info -->      <?php endwhile; ?>      Any guessing? Thanks in advanced.


title: How can I block with a child theme certain pages?

text: I am using the Woocommerce Wordpress plugin for an E-commerce site. I want to be able to set the site in a non-ecommerce mode, ie without the cart and checkout etc etc. I know there is a plugin you can buy that does this but I am trying to do this myself. I suppose I have to make myself a child theme and in the `function.php` remove certain pages. I do not want to just hide them because a user could still browse to them. I would like to return a 404 on any E-commercey page even though the page really exists. I could use `wp_delete_posts` but then when I go back to the Parent theme the pages are gone too. What do you advise?


title: Author Avatar as default first image

text: I need little bit help and customization on my existng script at function.php for wordpress 3.5. Here's what I have. As you can see here the default picture is none exist will be using                $first_img = $img_dir . '/images/post-default.jpg';      I would like to know if there would be possibility to just grab author's posts picture. Please find below the whole code related to this function. Thanks B4..               ////////////////////////////////////////////////////////////////////////////////     // Get Standard Post Image     ////////////////////////////////////////////////////////////////////////////////     function get_post_image() {       global $post, $posts;       $first_img = '';       ob_start();       ob_end_clean();       $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);       $first_img = $matches [1] [0];            if(empty($first_img)){ //Defines a default image         $img_dir = get_bloginfo('template_directory');         $first_img = $img_dir . '/images/post-default.jpg';       }       return $first_img;     }


title: Custom fields or something else

text: I have a problem with displaying some content on my homepage. First i'm going to explain my problem. I have a page with all my blog posts on it (use of excerpt function). When you click on a read more link on the blog posts page, you get the whole article. On my homepage I want to show the 3 latest posts. I already have the top 3 off the posts. (with the use of the excerpt function) but these **teasers** or to long. There is to much text. I don't want to make it shorter because when I do this, the page with all the blogposts is also going to change. I was thinking to use the custom fields in the blog posts. Then I can make an extra field for the teaser content on the homepage? Is this the right solution or is there something else?


title: Displaying information from custom field on custom post type

text:
I have videos set up as a custom post type and music, commercial, promo set up as categories within this post type: I have a function that displays a custom meta box on the videos post type pages in the wordpress back end. The user is able to enter the ID of a youtube video or the ID of a vimeo video - wordpress then displays the video for the ID on custom post type page. When a user adds a new post to the videos custom post type and assigns it to any of the categories I specify I want wordpress to display the different videos. The code I have at the moment is not doing what I want it to do because it is displaying the same video on each post even though an ID hasnt been specified on some of them. For example on the music post page I have assigned it the category music and put a vimeo video ID which is displayed on the front end but then the same video is displayed for promo and commercial and I dont want that to happen. The loop I have running this is (in single-videos.php):               <?php          $args = array( 'post_type' => 'videos', 'posts_per_page' => 20, 'orderby' => 'date', 'order' => 'ASC' );                         $loop = new WP_Query( $args );                         while ( $loop->have_posts() ) : $loop->the_post();     //$args = array( 'post_type' => 'videos', 'posts_per_page' => 20, 'orderby' => 'date', 'order' => 'ASC' );     $ytubeID = get_post_meta($post->ID, '_youtubeID', true);     $vimID = get_post_meta($post->ID, '_vimeoID', true);     if ($ytubeID || $vimID){     if ($ytubeID){          echo '';          echo '';     } elseif ($vimID){     echo '
';     echo '';     }//end if yutbeID or vimIDthe_excerpt(); //excerpt added for information     }          endwhile;                         wp_reset_query();          ?>      Below is the full function that creates the meta box & stores the information:               // Create the Video Information Meta Box by hooking into the admin menu for a post         add_action('admin_menu', 'video_add_box');              //Function call by the "add_action" to tell it what to add, "video_information" and where "post"         function video_add_box(){         add_meta_box('video_information', 'Video Information', 'video_information', 'videos', 'normal', 'high');         }              //function to populate the meta box added above         function video_information(){         global $post;              // Noncename needed to verify where the data originated         echo '<input type="hidden" name="video_noncename" id="video_noncename" value="' .         wp_create_nonce( plugin_basename(__FILE__) ) . '" />';              //adds the custom field _youtubeID plus some other stuff         $youtubeID = get_post_meta($post->ID, '_youtubeID', true);         if ( empty($youtubeID) ) {         $youtubeID = '';         }              //adds the custom field _vimeoID         $vimeoID = get_post_meta($post->ID, '_vimeoID', true);         if ( empty($vimeoID) ) {         $vimeoID = '';         }              //add the box         echo '
';         echo 'Youtube ID:  <input type="text" name="_youtubeID" value="' . $youtubeID  . '" size="20" maxlength="30" />';         echo '
';         echo 'Vimeo ID:  <input type="text" name="_vimeoID" value="' . $vimeoID  . '" size="20" maxlength="30" />';         echo '
';         } //end video_information function              //save_video_meta is called below with the action "save_post" and saves your IDs to the post         function save_video_meta($post_id, $post) {         // verify this came from the our screen and with proper authorization,         // because save_post can be triggered at other times              if ( !wp_verify_nonce( $_POST['video_noncename'], plugin_basename(__FILE__) )) {         return $post->ID;         }              // Is the user allowed to edit the post or page?              if ( !current_user_can( 'edit_post', $post->ID )){         return $post->ID;         }              $video_meta['_youtubeID'] = $_POST['_youtubeID'];         $video_meta['_vimeoID'] = $_POST['_vimeoID'];         foreach ($video_meta as $key => $value) { // Cycle through the $video_meta array         if( $post->post_type == 'revision' ) return; // Don't store custom data twice              $value = implode(',', (array)$value); // If $value is an array, make it a CSV              if(get_post_meta($post->ID, $key, FALSE)) { // If the custom field already has a value         update_post_meta($post->ID, $key, $value);         } else { // If the custom field doesn't have a value         add_post_meta($post->ID, $key, $value);         }         if(!$value) delete_post_meta($post->ID, $key); // Delete if blank         }//endforeach video meta              } //end save_video_meta              //save the video custom fields         add_action('save_post', 'save_video_meta', 1, 2);


title: Update post title with category name after editing a category

text: I have this relationshop between some categories and posts where the name of the category is also the name of the post. When I add a new category, a post that has the same title as the category is created. Now when I edit one of those category titles, I want the corresponding post to update its title automatically as well. Here's what I have:               function update_group($post_id) {              // get the category object         $category = get_term_by( 'id', $post_id, 'category');              // use the object to get your values         $name = $category->name;              $updates = array(             'ID' => 996,             'post_title' => $name         );              wp_update_post($updates);          }          add_filter('edit_category' , 'update_group' );      The problem with this simple code is that when I fetch the category name, the new name that I submitted has not been saved yet when edit_category runs, so the first time I edit a category, wp_update_post updates the post with the old name. That means the post will only get the new and correct name when I submit the category change again via the admin page. Is there a way around this? How do I get the sumbitted category name the first time edit_category is executed?


title: How to set up Shibboleth authentication for a MU site

text: So far I haven't found an easy set up plugin that works. "shibboleth" is over 2 years out of date. "HTTP authentication" might work, but I haven't figured out how to set it up yet. I have an IDP set up that work. I have Drupal and Moodle both using it. So I just need to be able to get Wordpress working.


title: Why does logging in to my wp-admin redirect to my homepage?

text: Whenever I login to my dashboard I will have to manually go to the dashboard because my websites goes to the homepage first. Is there a reason for this? How do I redirect to the dashboard whenever I login in wp-admin?


title: Is it possible to add categories to new blogs on Wordpress MU?

text: I have setup WP MU and I need new blogs to have two additional categories when they're created. Is there a way to do this?


title: Bug in Stackoverflow styled badge system script

text: I have modified an old Stackoverflow inspired badge system script to work with the latest Wordpress version. You can view the code here (and please feel free to use it if you wish): http://pastebin.com/zA4zGnKZ It has a condition system that detects `Post tags`, `Post count` and `Comment count`. You can create custom badges and assign conditions to them. It works perfectly besides a very random bug that I cannot fix. I setup a Wordpress test site and created 10 accounts. I played around with the users and the badges were awarded according to its conditions, so for instance, if a user posted 10 articles, they would be awarded the `Junior Publisher` badge. However, **one** user was instantly awarded **all** badges when the account was created. This user has no posts or comments. Even more strange, when I add a new badge, this user automatically gets awarded with it! There is no difference between this user and the other users. All have `Contributor` privileges. The user ID number of this user is 5. **Can you please help me detect why the script is behaving like this?** Obviously, I cannot add the script to a live site yet in scare of random users being awarded all badges like this user.


title: WordPress add post format support not working

text: I am working on a theme and for some reason, `add_theme_support( 'post- formats', ... )` is not working. In my theme's `functions.php` I have the following near the top:               function mytheme_setup() {         // ...other functions              // Add post formats support         add_theme_support( 'post-formats', array(             'aside',             'audio',             'chat',             'gallery',             'image',             'link',             'quote',             'status',             'video',         ) );              // ... more other functions     }     add_action( 'after_setup_theme', 'mytheme_setup' );          add_post_type_support( 'post', 'post-formats' );      Yet, when I go to WordPress admin -> Posts -> Edit New Post or Add New Post, I do not see a box allowing me to select a post format. I tried putting `add_post_type_support()` inside `mytheme_setup()` function, but still the same result. Am I missing something?


title: Hide mu-plugins list

text: I'm using mu-plugins, http://codex.wordpress.org/Must_Use_Plugins. These plugins are showing in plugins.php, http://d.pr/i/JIvX. Is there any way to hide it? Thanks.


title: How to pull user/author profile data in a plugin?

text: My site has a user profile page. For some reason I would like to pull user profile data in my plugin. I know I can pull logged in user profile data using `get_currentuserinfo();`. For example I would like to get displayed profile user id. Can anyone tell me how to pull it.?


title: Get posts after calculating meta key

text: I have 2 meta fields for the posts, eg. `meta_value` and `meta_count`. Both are numbers. I want to divide `meta_value` by `meta_count` and based on the results I want to fetch the top 10 posts. So for example, post 1 has the meta_value 5, and meta_count 2. by dividing the result for that post will be 2.5. And the post 2 has meta_value 1 and meta_count 2, its result will be 0.5. I know there is a way to order posts by a specific meta key:               'meta_key' => 'meta_value',     'orderby' => 'meta_value_num',      But I do not know if it is possible what I'm trying to do.


title: Are there Limitations on filter handles?

text: I was looking through a 3rd party plugin's code today and found them doing this: `add_filter('some_base_handle'.sanitize_title($string), ...)` Curious, since I was using xh_prof to look for code that was taking up too much time and was confused why there were so many calls to sanitize title. Is it safe to remove the sanitize_title or are there good reasons for it being there? Does anyone have links to Codex documentation that I might have missed about it? I looked at add_filter's page but didn't see anything. EDIT: I looked into the wp-includes/plugins.php code to see if there was anything and didn't see anything to outstanding, anyone know?               function add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 )      {         global $wp_filter, $merged_filters;              $idx = _wp_filter_build_unique_id($tag, $function_to_add, $priority);         $wp_filter[$tag][$priority][$idx] = array('function' => $function_to_add,     'accepted_args' => $accepted_args);          unset( $merged_filters[ $tag ] );         return true;     }


How can I allow moderated anonymous contributors to post to my blog?


title: only show children of a nav menu

text: I wanted to know how could i display only the children of a nav menu. ive tried a couple of things like :               if($post->post_type == "page"){                 $postid = $post->ID;                 print_r( get_pages(array("child_of" => $postid)) );             }         But all i get an empty array. so what i want is something like this: http://www.isic.org/student-card/the- isic-student-card.html


title: Loop with break in the middle

text:
I'm trying to create a gallery type page which shows one post thumbnail from each post category. The trouble is that I want to display the page title and a link to the portfolio page in the middle of a nine square grid. I was thinking the best way to go about it would be to display four thumbnails in three columns followed by the page title and then another 4 thumbnails. I've got the first four like so : **Updated code:**                <?php         $count = 0;         $taxonomy = 'category';//  e.g. post_tag, category         $param_type = 'category__in'; //  e.g. tag__in, category__in         $term_args=array(           'orderby' => 'name',           'order' => 'ASC',         );         $terms = get_terms($taxonomy,$term_args);         if ($terms) { ?>
          <?php                          foreach( $terms as $term ) {             $args=array(               "$param_type" => array($term->term_id),               'post_type' => 'post',               'post_status' => 'publish',               'posts_per_page' => 1,               'caller_get_posts'=> 1               );             $my_query = null;             $my_query = new WP_Query($args);             $post_count = $my_query->post_count;                  if( $my_query->have_posts() ) :                       $count++;                                if ($count <= 4) {                           while ($my_query->have_posts()) : $my_query->the_post();                  ?>

<?php the_category(); ?>

<?php the_title(); ?>
                                             Click for details
                                         <?php if (has_post_thumbnail()) : ?>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?>
                                         <?php endif; ?>
              <?php                  endwhile;                            }              endif;                } /* end foreach term*/           ?>

Galleries

                                         <a href="<?php echo home_url(); ?>/portfolio" class="btn btn-primary">See Full Portfolio

                  <?php              if ($count >= 4) {                 while ($my_query->have_posts()) : $my_query->the_post();                  ?>

<?php the_category(); ?>

<?php the_title(); ?>
                                             Click for details
                                         <?php if (has_post_thumbnail()) : ?>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?>
                                         <?php endif; ?>
                                                <?php endwhile;           } ?>
   <?php         } /* end if terms */                     wp_reset_query();  // Restore global post data stomped by the_post().         ?>      My problem is the second loop. I've got as far as the if statement `if ($count > $more_cats_to_show && $count <= $max_count)` but I can't seem to manage to get the next 4 thumbnails.


title: Check if page has subpages

text: I'm try to build a menu with `wp_list_pages()` that must work like this:               Main Page         -Subpage1         -Subpage2        I check if the Page has_subpage and i can see the 2 subpages when i'm in the Parent but when i'm visit one of the subpages i don't see anything. So, what i can do to check if page has subpages to get the same list of pages in the subpage(s)? How i use it: in the functions i check if the Page has_subpage,               function has_subpage (){     global $post;     $pages = get_pages("sort_column=menu_order&depth=1&child_of={$post->ID}");     if ($pages) return TRUE;     }      and in my template i call the menu (list of subpages),               <?php if (is_page() && has_subpage()) { ?>              <?php           if($post->post_parent) {           $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0$sort_column=menu_order");           $title_heading = get_the_title($post->post_parent);           }                else {           $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");           $title_heading = get_the_title($post->ID);           }           if ($children) { ?>                <?php echo $children; ?>              <?php } ?>          <?php } ?>      the problem is inside has_subpage() function, cause if i don't use it i get the pages correct, maybe i'm missing something here? thanks a lot!


title: How to fix: Clicking 'Quick Edit' link in Admin (edit.php) makes posts disappear?

text: When I'm logged in and go to the Posts management page (edit.php), **if I click the 'Quick Edit' button, the clicked post disappears from the listing!** This occurs in FF7 and Safari 5.1, running WP 3.2.1. Refreshing the page displays the post in the list again, but I can't find a way to use the Quick Edit functionality. Edit: In Post management, after clicking quick-edit, Firebug displays: `a("input[name=\"ping_status\"]", d).prop is not a function` in `/wp- admin/js/inline-edit-post.js?ver=20110609` I've tried:   * Clearing the cache in FF, restarting FF, hard refreshing several times (inspired by a post by Andrew Ozz re fixing post edit functionality   * Reinstalling WP from the Dashboard > Upgrade menu (repeat the cache clearing / refreshing)   * Deactivated the most relevant / recent plugins (meaning those that edit the admin area, non essential plugins). I still have a bunch active, but they are crucial - eg Custom Post Type plugins without which the site would break. Unfortunately, I can't say when this started happening, only that it only happens on this site. Possibly related issues:   * Clicking the 'Publish immediately' button in the Edit Post page does nothing   * Edit Post: Add a tag / Display most used tags fails   * Yoast SEO: not displayed in tabs, doesn't load the SEO title preview, etc (have switched off the plugin: doesn't resolve the other issues)   * Clicking the 'Edit image' popup button loads the semi-opaque overlay, but no thickbox   * I can no longer upload a new image, though I managed that only half an hour ago :( Upload button does nothing   * Firebug reports: `g.prop is not a function`, in file `wp-admin/js/post.js?ver=20110524` It seems that the jquery / ajaxy business in admin is failing (seeing lots of `.prop is not a function`). I previously had an issue with adding links in post content, which is why I mentioned the earlier post. Clearing the cache / refreshing worked for this issue. I'm stumped! Any suggests as to how to proceed would be appreciated, Regards, Tim Update: these links are loaded requested twice, but the top ones never resolve ?? ![Each file is loaded twice, but the top one doesn't resolve](http://i.stack.imgur.com/2injM.png)


title: Link to Author archive from Navigation Menus in dashboard?

text: I'd like to display a grid of authors on my site showing the name of the author and their avatar. The tricky part is, I'd like to be able to control this from the Menus page in the dashboard so I have control over who is displayed and in what order they are displayed. Is this doable? I don't think a custom walker would work in this situation as it wouldn't allow for arbitrary order and selection control. So my next thought is how to add another selector on the menus page for authors. Any help?


title: Where is default wp_head() implemented?

text: I'm trying to customize a theme, and I see that the header.php calls "wp_head()". I can't seem to find an implementation of this in the theme, so I presume there is a default implementation that implements, for example, the Color Options settings as specified on the admin page. So my related questions are:   * Is there somewhere I can see this default implementation?   * Can this default implementation be "turned off"?   * Can the "Color Options" option be disabled in the admin screen for the theme? Please feel free to point me to relevant documentation if that would be easier. I've looked at the reference pages for the wp_head() function and the corresponding wp_head action hook, but they don't seem to provide enough information for me to tackle the questions above. Thanks.


title: Organize uploads by year, month and day

text: As of now my uploaded files are organized by year and month. But I would like to organize them by year, month and day. I mean like this `2012/10/30/image goes here` PS: There is a plugin available to do this. But I don't want to use a plugin for this simple task. Thanks


title: Redirect from ip to domain

text: I want to prevent site to be accessible by ip. It could be accessible by only domain name, so I tried with htaccess trick.               RewriteCond %{HTTP_HOST} !^mydomain\.com [NC]     RewriteRule .? http://mydomain.com%{REQUEST_URI} [R=301,L]      It did the trick now my siteurl is changed to mydomain.com instead of my ip. But as per my knowledge its not complete solution. Whenever I change permalinks new htaccess will be generated so above condition will be removed. So I thought I have to try in index.php, tried to redirect if ip is there in url by following:               if(strpos($_SERVER['HTTP_HOST'],'111.111.111.11') !== false) {           header("Location: mydomain.com".$_SERVER['REQUEST_URI']);     }      but it did nothing still site accessed by ip. Let me know if my approach is right or not. Suggest me anything else if there.


title: Custom GET Parameters In Plugin's Admin Page

text: In my plugin's options page, I'd like to have custom GET parameters. WordPress already has a "?page=" GET parameter, so simply linking to something like "?myparameter=value" won't work. I though of reading the "page" parameter, and then linking to something like: "?page=&myparameter=value". This seems workable, but I don't know if its the best practice. The complexity of my plugin really doesn't warrant sub-pages for now. So is this the best practice or am I missing something?


title: Is there any way of only retrieving posts with one or more thumbs up (GD star rating plugin)?

text: I'm building a website that uses the GD star rating plugin. Right now, I'm using the following code to retrieve two posts of the current page (a custom post type called `bbp_topic`) and sort them by vote:               <?php query_posts('gdsr_sort=thumbs&posts_per_page=2&post_parent='.$post->ID); ?>      I would like now to only retrieve those post that have 1 or more thumbs up. Any suggestions?


title: Wordpress: Preload next post images

text: As the title says, i would like a nice bit of coding to stick in my functions that pre-loads any images that are attached to the next post. This means that whilst my users are browsing, they page will load, but it will actually be loading the next page, so when you click-through, the images should already be there and waiting! Think of it as 'buffering' for image. Couple of things to note: I use the post_thumbnail feature and have different sizes setup through functions.php. I also have a plugin that enables multiple Featured Images per post. I posed this question on stackoverflow (who pointed me here) and was given this code to be placed in the loop;                   <?php     $next_post = get_adjacent_post(false, '', false );// set last param to true if you want post that is chronologically previous     $args = array('post_type' => 'attachment', 'numberposts' => -1, 'post_parent' => $next_post->ID);     $attachments = get_posts($args);     ?>     <script type="text/javascript">         $(document).ready(function(){             var images = '';             <?php foreach($attachments as $attachment):                 $mime = $attachemnt->post_mime_type;                 if($mime == 'image/jpeg' || $mime == 'image/gif' || $mime == 'image/png'):              ?>             images += '<img src="<?php $attachment->guid ?>" style="display:none" />';             <? endif; endforeach; ?>             if(images != ''){                 $(body).append(images);             }         });     </script>      Although to looks like it could be onto a winner, it doesn't seem to be doing the job quite yet. In my page source it returns the following:               <script type="text/javascript">         jQuery(document).ready(function(){             var images = '';                     if(images != ''){                 jQuery(body).append(images);             }         });     </script>      It is possible i am doing something wrong as i am a chronic copy and paster! Anyone got any thoughts on this? Thanks guys!


title: Is there any way of changing the post order via user click?

text: Is there any way of changing the post order, posts number, etc via user click? The same way you can choose displaying questions by time and vote here at StackExchange. How to accomplish that?


title: Yearly Archive from a custom date metabox (Event Start Date)

text: I have created a custom post_type called (event) and here's the code                           // Register Custom Post Type Events             function custom_post_type_events() {                      $labels = array(                     'name'                => _x( 'Events', 'Post Type General Name', 'text_domain' ),                     'singular_name'       => _x( 'Event', 'Post Type Singular Name', 'text_domain' ),                     'menu_name'           => __( 'Events', 'text_domain' ),                     'parent_item_colon'   => __( '', 'text_domain' ),                     'all_items'           => __( 'All Events', 'text_domain' ),                     'view_item'           => __( 'View Event', 'text_domain' ),                     'add_new_item'        => __( 'Add New Event', 'text_domain' ),                     'add_new'             => __( 'New Event', 'text_domain' ),                     'edit_item'           => __( 'Edit Event', 'text_domain' ),                     'update_item'         => __( 'Update Event', 'text_domain' ),                     'search_items'        => __( 'Search events', 'text_domain' ),                     'not_found'           => __( 'No events found', 'text_domain' ),                     'not_found_in_trash'  => __( 'No events found in Trash', 'text_domain' ),                 );                 $args = array(                     'label'               => __( 'event', 'text_domain' ),                     'description'         => __( 'Events information pages', 'text_domain' ),                     'labels'              => $labels,                     'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'trackbacks', 'revisions', 'custom-fields', 'post-formats', ),                     'taxonomies'          => array( 'category', 'post_tag' ),                     'hierarchical'        => false,                     'public'              => true,                     'show_ui'             => true,                     'show_in_menu'        => true,                     'show_in_nav_menus'   => true,                     'show_in_admin_bar'   => true,                     'menu_position'       => 5,                     'menu_icon' => admin_url() . '/images/ef-events-icon.png',  // Icon Path                     'can_export'          => true,                     'has_archive'         => true,                     'exclude_from_search' => true,                     'publicly_queryable'  => true,                     'capability_type'     => 'page',                 );                 register_post_type( 'event', $args );                  }                  // Hook into the 'init' action             add_action( 'init', 'custom_post_type_events', 0 );      Then I have created a custom date meta_box for this event post_type, and here's the code                               add_filter( 'cmb_meta_boxes', 'dt_person_meta_boxes' );                 function dt_person_meta_boxes( $meta_boxes ) {                     $meta_boxes[] = array(                         'id' => 'dt_metabox',                         'title' => 'Event Date and Time',                         'pages' => array('event'),                         'context' => 'side',                         'priority' => 'high',                         'show_names' => true, // Show field names on the left                         'fields' => array(                             array(                                 'name' => 'Event Start Date',                                 'desc' => 'Pick the date of this event',                                 'id' => $prefix . 'event_starttextdate',                                 'type' => 'text_date'                             ),                             array(                                 'name' => 'Event End Date',                                 'desc' => 'Pick the date of this event',                                 'id' => $prefix . 'event_endtextdate',                                 'type' => 'text_date'                             ),                             array(                                 'name' => 'Event Time',                                 'desc' => 'Enter event time (eg. 05:00 p.m.)',                                 'id' => $prefix . 'event_time',                                 'type' => 'text',                                 'save' => true                             )                         )                     );                       return $meta_boxes;                 }      * * * My question is: How to build a custom archive page for the custom post_type (event), that will sort events by the custom meta-box (event_starttextdate) ??? Example: **2013**   * Event-1   * Event-2 **2012**   * Event-3   * Event-4 **2011**   * Event-5   * Event-6   * Event-7   * Event-8 * * * Your help is appreciated, Thank you.


title: Rewrite URL based on form input

text: I have a form:               <form action="<?php echo get_permalink(); ?>" method="get">     <select name="genres[]">     <option value="jazz"></option>     <option value="blues"></option>     <option value="rock"></option>     </select>     </form>      After submitting the form, in the URL the input becomes `example.com/?genres%5B%5D=jazz&genres%5B%5D=blues&genres%5B%5D=rock` Next to that it doesn't look very nice, I have other inputs in my form (and around 18 genres) so if a user selects a lot, the URL becomes very long. I'm not very skilled in wordpress rewrite rules. I'd like the URL to become `?genres=jazz,blues,rock` but I would also be satisfied if just the characters won't be ASCII code, so the url becomes `?genres[]=jazz&genres[]=blues&genres[]=rock`. I'm also using the array (`$genres = $_GET['genres']`) as input for a query so if I alter it, it should still be usable as an array. That's why I think just rewriting the ASCII codes to characters is the best option.


title: Show posts on a page based on a category and tag(s)

text: I have been looking all over the internet for this, and have not yet found an answer I could use.   Found out that I may can use something called query_posts or get_posts, but I have no idea how to use them. Isn't there some sort of plugin that could do this for me? Say if I made a post under the category Guides, with the tag of Computer and Internet, it should be listed under a page called Guides for Computers.   Is this possible? Thank you very much in advance.


title: What is the structure of the "Featured Image" field in the DB?

text: On a WP install with about 1400 images and the Media Tools 1.1 plugin, I ran both "Import External and Set Featured Image" and "Set Featured Image". But the **featured images functionality didnt work, because it designated (in the DB) the wrong filename for the images** : Instead of pointing to the correct file, it appended a "1" to its name, **causing, for example, a 404 for "Protest-11-620x264.jpg"** , **when it should point to "Protest-1-620x264.jpg"** **I need to do asearch & replace in the DB on *_wp_attachment_metadata* field and remove the extra "1" from the filenames**. Naturally I will use a regex, but how do I process the contents of the field? **Which one of the sections of the data has which featured image to use? In other words, what do I need look for to know the filename is the right one to search &replace?** For example (note the "Protest-11-620x264.jpg" in there)               _wp_attachment_metadata = a:5:{s:5:"width";i:800;s:6:"height";i:536;s:4:"file";s:22:"2013/11/Protest-11.jpg";s:5:"sizes";a:9:{s:9:"thumbnail";a:4:{s:4:"file";s:22:"Protest-11-150x150.jpg";s:5:"width";i:150;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:22:"Protest-11-300x201.jpg";s:5:"width";i:300;s:6:"height";i:201;s:9:"mime-type";s:10:"image/jpeg";}s:6:"slider";a:4:{s:4:"file";s:22:"Protest-11-800x400.jpg";s:5:"width";i:800;s:6:"height";i:400;s:9:"mime-type";s:10:"image/jpeg";}s:7:"content";a:4:{s:4:"file";s:22:"Protest-11-620x264.jpg";s:5:"width";i:620;s:6:"height";i:264;s:9:"mime-type";s:10:"image/jpeg";}s:9:"spotlight";a:4:{s:4:"file";s:22:"Protest-11-580x326.jpg";s:5:"width";i:580;s:6:"height";i:326;s:9:"mime-type";s:10:"image/jpeg";}s:4:"loop";a:4:{s:4:"file";s:22:"Protest-11-174x131.jpg";s:5:"width";i:174;s:6:"height";i:131;s:9:"mime-type";s:10:"image/jpeg";}s:8:"carousel";a:4:{s:4:"file";s:21:"Protest-11-174x98.jpg";s:5:"width";i:174;s:6:"height";i:98;s:9:"mime-type";s:10:"image/jpeg";}s:8:"cp_large";a:4:{s:4:"file";s:22:"Protest-11-300x225.jpg";s:5:"width";i:300;s:6:"height";i:225;s:9:"mime-type";s:10:"image/jpeg";}s:8:"cp_small";a:4:{s:4:"file";s:20:"Protest-11-70x53.jpg";s:5:"width";i:70;s:6:"height";i:53;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:10:{s:8:"aperture";d:3.5;s:6:"credit";s:0:"";s:6:"camera";s:10:"NIKON D40X";s:7:"caption";s:0:"";s:17:"created_timestamp";i:1383833520;s:9:"copyright";s:0:"";s:12:"focal_length";s:2:"18";s:3:"iso";s:3:"200";s:13:"shutter_speed";s:7:"0.00125";s:5:"title";s:0:"";}}


title: Post list based on the user that is logged in

text: I've been all over this site and google, and the WP codex looking for an answer to this one. I know it's out there, and I know it's easy. Maybe has something to do with user_nicename, but I just can't make it work. What I'm trying to do for the site I'm working on is eliminate any need and any ability for the user to see the backend of the blog. This means front-page everything: Login, Post, and if I can swing it - a dash board. I envision changing the "site admin" link on the wp login/logout code to link to a blog page called "User Dashboard" there, the user could view a list of their posts and comments. Really reaching for the stars, they should also be able to see a list of comments on their posts, and really really reaching for the stars - some kind of messaging system. I'm currently simply trying to get the post list down! I can't figure out how to return the_author post list based on a dynamic setting of where the request is coming from. IE: Only list the current logged in users posts/comments. There is a plugin called Full Author User List or something to that affect, that doesn't work anymore as it's outdated. Any help?


title: The Great WordPress Admin Menu Challenge of Jan 2011 (a.k.a. How to Resolve Some Challenges when Modifying the WordPress Admin Menu System?)

text: ## This question is a bit unique. It is in part a _"challenge"_ I'm issuing to the WordPress team _( **or anyone else** )_ related to trac tickets: #16048, #16050 and #16204. ### The Goal _The goal is to get around the three (3) issues illustrated in the screenshot_ below when trying to modify the WordPress Admin menu section:   1. Get the _"Microsite"_ submenu page to be highlighted when editing an Attorney _(for this we need to somehow be able to apply "current" to the submenu item,_ andsome hooks in the _wp_menu_output() function would provide what's needed here)_,    2. Get the Attorney Menu Page link to link to `/wp-admin/edit.php?post_type=attorney` when editing an Attorney _(and thosesame needed hooks in the _wp_menu_output() function could handle this)_, and    3. Get the _"Microsite"_ link not to trigger a _"You do not have sufficient permissions to access this page"_ error *(this is the nastiest one to resolve, and a hook on the return value of `user_can_access_admin_page()` could handle this issue nicely.) ![Screenshot for The Great WordPress Admin Menu Challenge of Jan 2011](http://mikeschinkel.com/websnaps/skitched-20110115-010057.png) ### More than just my use-case These three (3) issues are for my use-case but their are emblematic of the issues related to configure the admin menus in WordPress. Several on the WordPress team said that it's easy and thus implied I'm missing something _(which may be right)_ but I've looked at this problem for weeks and not figured out how to get around it so I created the plugin you see below ( **also downloadable from Gist**) as the simplest use-case example of the issues. The code in `admin_menu2()` is rather hackish but that's pretty much what's required to modify the Admin Menus in WordPress. Note that I did not try to use the new `remove_menu_page()` nor the new `remove_submenu_page()` functions in 3.1 because it would have taken longer to create the plugin -- I already had the code in `admin_menu2()` from an existing project -- and I don't believe they would address the problem anyway. ### What do I need? I need one of two (2) things:   1. A solution to the problems that I expose with this plugin and explain in this question and in the screenshot _(BTW, **I'll disqualify your solution** if you use PHP Output Buffering to solve any part of this)_, or   2. To have the WordPress Team recognize that there is indeed a need for these hooks and to get them to reconsider their position on the tickets. ### How do you Take the Challenge?   1. Download and install a pristine new copy of WordPress 3.1 _(any revision will probably do)_ ,   2. Download, install and activate the _"The Great WordPress Admin Menu Challenge of Jan 2011"_ plugin below _(ordownload the plugin from Gist)_, and then    3. Follow the instructions found on the plugin page for this plugin _(see the following screenshot)_ but basically load the screenshot you see above and then try to figure out the three (3) issues described: ![Screenshot of "The Great WordPress Admin Menu Challenge of Jan 2011" plugin instructions](http://mikeschinkel.com/websnaps/Plugins_%E2%80%B9_WordPress_3.1_Test_Site_%E2%80%94_WordPress-20110115-011459.png) ### One Ray of Hope Fortunately Andrew Nacin of the WordPress team offered to look at this once I'd coded it so I'm primarily posting here for him to review and comment as well as having others to comment. I know he is busy but I do hope he **(or even you)** can take the time to install this plugin on a pristine install of v3.1 and see if he can resolve the issue. ### If you Agree the Challenge is Impossible? If after trying this challenge you come to the same conclusion as me, and if you'd like to see the WordPress Admin menus be more configurable please comment on these trac tickets (#16048 - #16050 - #16204) and vote this question up to show support for it. ### I'll Gladly Admit I Missed Something, If I Did Of course it's possible I could be completely brain dead on this and someone could point out exactly how to do it. Actually, I really hope that ends up being the case; I'd rather be wrong and have this working than vice-versa. ### And Here's the Plugin You can also **downloadable if from Gist**:               <?php     /*     Plugin Name: The Great WordPress Admin Menu Challenge of Jan 2011     Description: "The Great WordPress Admin Menu Challenge of Jan 2011" was inspired by the WordPress team's apparent lack of understanding of the problems addressed by trac tickets #16048 and #16050 (See also: #16204) and suggestion that the Admin Menu Editor plugin handles the use-cases that the tickets address. Debate spilled over onto Twitter with participation from @nacin, @aaronjorbin, @petemall, @westi, @janeforshort, @PatchesWelcome; supportive comments from @ramsey, @brianlayman, @TheLeggett, a retweeting of @nacin's simple yet (AFAICT) insufficient solution by @vbakaitis, @Viper007Bond, @nickopris, @Trademark, @favstar_pop, @designsimply, @darylkoop, @iamjohnford, @markjaquith, @JohnJamesJacoby and @dd32. Also see comments on @nacin's blog post entitled "Better admin menu handling for post types in WordPress 3.1." The desired goal of the "challenge" is to simply either to find a solution that has eluded me or, to get those who are dismissing it as solvable without added hooks in WordPress to have a tangible example to explore in hopes they will recognize that there is indeed a need for at least some of the requested hooks. There are three (3) steps to the challenge: 1.) Get the "Microsite" submenu page to be highlighted when editing an Attorney, 2.) Get the Attorney Menu Page link to link here  when editing an Attorney, and 3.) Get the "Microsite" link not to trigger a "You do not have sufficient permissions to access this page" error.  Here is a screenshot that attempts to illustrate the callenge. The code can be found on gist here. Activate it as a plugin in a WordPress 3.1 install and go here to see what the screenshot illustrates. Be sure to load the screenshot in another browser tab or window first.     Author:      Mike Schinkel     Author URI:  http://about.me/mikeschinkel     Plugin URI:  https://gist.github.com/780709     */     if (!class_exists('TheGreatWordPressAdminMenuChallenge')) {       class TheGreatWordPressAdminMenuChallenge {         static function on_load() {           add_action('init',array(__CLASS__,'init'));           add_action('admin_menu',array(__CLASS__,'admin_menu1'));      // Simulates generic "Microsite" plugin           add_action('admin_menu',array(__CLASS__,'admin_menu2'),100);  // Simulates website-specific plugin           add_action('post_row_actions',array(__CLASS__,'post_row_actions'),10,2);         }         static function post_row_actions($actions,$post) {           $url = admin_url(self::this_microsite_url($post->ID));           $actions = array_merge(array('microsite'=>"Microsite"),$actions);           return $actions;         }         static function the_microsite_editor() {           echo "We are in the Microsite Editor for " . self::post_title();         }         static function admin_menu1() {           if (self::this_post_id() && in_array(self::this_post_type(),array('attorney','practice_area'))) {             add_submenu_page(               self::this_parent_slug(),               self::microsite_page_title(),               self::microsite_page_title(),               $capability = 'edit_posts',               'microsite',               array($microsite,'the_microsite_editor')             );             global $wp_post_types;             $parent_type_meta = $wp_post_types[self::this_post_type()];             global $menu;             $slug = false;             foreach($menu as $index => $menu_page)               if ($menu_page[0]===$parent_type_meta->label) {                 $slug = $menu_page[2];                 break;               }             if ($slug) {               global $pagenow;               global $submenu;               // Setting this makes gives the link to the microsite in the menu the highlight for "current" menu option               global $submenu_file;               $submenu_file = self::this_microsite_url();               $index = end(array_keys($submenu[$slug]));               $submenu[$slug][$index][12] = $submenu_file;             }           }         }         static function this_parent_slug() {           return "edit.php?post_type=" . self::this_post_type();         }         static function post_title() {           $post_id = self::this_post_id();           return ($post_id ? get_post($post_id)->post_title : false);         }         static function microsite_page_title() {           return 'Microsite for ' . self::post_title();         }         static function this_post_type($get_post=true) {           $post_type = (isset($_GET['post_type']) ? $_GET['post_type'] : false);           if (!$post_type && $get_post) {             $post_id = self::this_post_id();             $post_type = get_post($post_id)->post_type;           }           return $post_type;         }         static function this_post_id() {           $post_id = false;           $post_type = self::this_post_type(false);           if (isset($_GET[$post_type]))             $post_id = intval($_GET[$post_type]);           else if (isset($_GET['post']))             $post_id = intval($_GET['post']);           return $post_id;         }         static function this_microsite_url($post_id=false) {           $post_type = self::this_post_type();           $post_id = $post_id ? intval($post_id) : self::this_post_id();           return "edit.php?post_type={$post_type}&page=microsite&attorney={$post_id}";         }         static function admin_menu2() {           // The code required for this is super, nasty, ugly and shouldn't be, but at least it *is* doable           global $menu;           global $submenu;           global $microsite;                $parent_type = self::this_post_type();           foreach(array('attorney','practice_area') as $post_type) {             $slug = "edit.php?post_type={$post_type}";             if ($post_type==$parent_type) {  // If a microsite remove everything except the microsite editor               $microsite_url = self::this_microsite_url();               foreach($submenu[$slug] as $submenu_index => $submenu_page) {                 if ($submenu_page[2]!=$microsite_url) {                   unset($submenu[$slug][$submenu_index]);                 }               }             } else {               $submenu[$slug] = array();             }           }                 // Remove the Submenus for each menu           unset($submenu['index.php']);           unset($submenu['edit.php?post_type=article']);           unset($submenu['edit.php?post_type=event']);           unset($submenu['edit.php?post_type=case_study']);           unset($submenu['edit.php?post_type=news_item']);           unset($submenu['edit.php?post_type=transaction']);           unset($submenu['edit.php?post_type=page']);           unset($submenu['upload.php']);                unset($submenu['users.php'][13]); // Removed the "Add New"                $remove = array_flip(array(             'edit.php',             'link-manager.php',             'edit-comments.php',             'edit.php?post_type=microsite-page',           ));           if (!current_user_can('manage_tools'))             $remove['tools.php'] = count($remove);                foreach($menu as $index => $menu_page) {             if (isset($remove[$menu_page[2]])) {               unset($submenu[$menu_page[2]]);               unset($menu[$index]);             }           }                $move = array(             'edit.php?post_type=page' => array( 'move-to' => 35,  0 => 'Other Pages' ),             'separator2' => array( 'move-to' => 40 ),             'upload.php' => array( 'move-to' => 50, 0 => 'Media Library' ),           );           $add = array();           foreach($menu as $index => $menu_page) {             if (isset($move[$menu_page[2]])) {               foreach($move[$menu_page[2]] as $value_index => $value) {                 if ($value_index==='move-to') {                   $move_to = $value;                 } else {                   $menu_page[$value_index] = $value;                 }               }               $add[$move_to] = $menu_page;               unset($menu[$index]);             }           }           foreach($add as $index => $value)             $menu[$index] = $value;                add_menu_page(             'Attorney Positions',             'Attorney Positions',             'edit_posts',             'edit-tags.php?taxonomy=attorney-position&post_type=attorney',             false,             false,             55);                ksort($menu); // Need to sort or it doesn't come out right.         }         static function init() {           register_post_type('attorney',array(             'label'           => 'Attorneys',             'public'          => true,           ));           register_post_type('practice_area',array(             'label'           => 'Practice Areas',             'public'          => true,           ));           register_taxonomy('attorney-position','attorney',array(             'label'=>'Attorney Positions',           ));           register_post_type('article',array(             'label'           => 'Articles & Presentations',             'public'          => true,           ));           register_post_type('case_study',array(             'label'           => 'Case Studies',             'public'          => true,           ));           register_post_type('news_item',array(             'label'           => 'Firm News',             'public'          => true,           ));           register_post_type('event',array(             'label'           => 'Events',             'public'          => true,           ));           register_post_type('transaction',array(             'label'           => 'Transactions',             'public'          => true,           ));                // Install the test data           $post_id = 10;           $attorney = get_post($post_id);           if (!$attorney) {             global $wpdb;             $wpdb->insert($wpdb->posts,array(               'ID' => $post_id,               'post_title' => 'John Smith',               'post_type' => 'attorney',               'post_content' => 'This is a post about the Attorney John Smith.',               'post_status' => 'publish',               'post_author' => 1,             ));           }         }       }       TheGreatWordPressAdminMenuChallenge::on_load();     }      To all who read this, I'm really hoping you can help. Thanks in advance.


title: Can't post comment to blog in wp-multisite

text: I'm running a wp-multisite install with ~100 blogs. I recently discovered a blog that I can't post a comment to (though I've been able to previously). When I try to submit a comment, I get the following warning dialog: ![enter image description here](http://i.stack.imgur.com/ni5x4.png) When I press send "send" I get an the comment field looks like this: ![enter image description here](http://i.stack.imgur.com/XTGlN.png) And nothing ever happens. I'm able to post comments to other blogs on the wp- multisite without problems, and this happens even when I'm logged in as superadmin.


title: Add a YouTube or Vimeo video as a post attachment?

text: I'm developing a gallery plugin and I was wondering if I could add a YouTube and Vimeo "embed" option to the media uploader to be able to add YouTube and Vimeo videos as attachments to a post instead of uploading the video files directly to the server. I'm thinking along the lines of an option with a textarea where one could put the YouTube or Vimeo HTML embed code and this would be added to the media library with a mime type of "text/html". Any clues would be much appreciated


title: How to update Wordpress plugins to latest using SVN

text: I can get latest WP using latest.tar.gz http://wordpress.org/latest.tar.gz How to get latest plugins? I checked about svn i need to know when new version is out and in command svn sw put latest link so thats bad option. Trunk is bad couse its development so that means it can be not be stable therefore not called stable version. So for WP ill use link latest.tar.gz But what to do with plugins? They have one more problem. They dont have latest. I could use svn if there would be a way to auto get latest without checking all plugins im using do they have new version number and entering it in svn external file. So whats best solution? Is there autochecker? Autodownloader? In website i know but its slow and my server has time limits witch is too small for update to finish.


title: Caption shortcodes not including caption as attribute

text: I recently installed the bonpress theme and am having trouble with the captions showing correctly. The more I try to understand how captions are supposed to work in Wordpress, the more I suspect something is not happening right with my installation. When creating a post and inserting an image with a caption, Wordpress creates the following shortcode:               [caption id="attachment_40" align="alignleft" width="1024"] That's what I get for only spending $15 on a motorcycle cover[/caption]      As I read through several pages such as the first example here and the sample code here (used by bonpress), it appears as though the caption should be passed as an attribute, e.g.:               [caption id="attachment_40" align="alignleft" width="1024" caption="That's what I get for only spending $15 on a motorcycle cover"][/caption]      If I manually enter the shortcode with `caption` as an attribute, it renders correctly. Is something broken in my install that makes it so it doesn't build it this way? **Update:** The caption shortcode is constructed by `image_add_caption` in /wp-admin/includes/media.php (line 134 in WP 3.4.2). The shortcodes are being constructed properly according to this code, so this leaves me wondering why all the code I can find regarding the customization of `img_caption_shortcode` filter assumes the caption is an attribute?


title: How to play a video without using plugin?

text: I want to play a video inside my site itself without using any plugins. How can I do that?


title: Echo URL of large version of Featured Image

text: I use this plugin to echo the URL of a post's featured image in the header:               <?php     /** Plugin Name: Post Thumbnail FB header */     function fb_header()     {         // Not on a single page or post? Stop here.         if ( ! is_singular() )             return;              $post_ID = get_queried_object_id();              // We got no thumbnail? Stop here.         if ( ! has_post_thumbnail( $post_ID ) )             return;              // Get the Attachment ID         $att_ID = get_post_thumbnail_id( $post_ID );              // Get the Attachment         $att    = wp_get_attachment_image_src( $att_ID );              printf(              '<link rel="image_src" href="%s" />'             ,array_shift( $att )         );     }     add_action( 'wp_head', 'fb_header' );     ?>      As it stands currently, it echo's the featured image. I want it to echo the URL of the Large version of the featured image. **How can I do this?** Just to note that all my featured images have a large version...


title: How to remove admin bar logo in WordPress using plugin

text: I'm following the instructions from this page to remove the adminbar wordpress logo and cannot quite understand why this is not working in a plugin I have created.               // Hide top left WordPress logo          add_action( 'admin_bar_menu', 'remove_wp_logo', 999 );          function remove_wp_logo( $wp_admin_bar ) {         $wp_admin_bar->remove_node( 'wp-logo' );     }      Everything else in my plugin is working except this. Only difference I see in that example is that it is referring to the functions.php file? Any thoughts would be appreciated?


title: Custom Taxonomy and Tax_Query

text: I've been having a lot of trouble getting a `WP_Query` running with a `tax_query` on my custom taxonomy. I'm 99.9% sure that my `register_taxonomy` is correct, as I'm able to tag posts with the right term, see it in the database, and the correct term returns with this function: http://pastebin.com/18Aj1ysT . But when I use a `tax_query` in my `WP_Query`, I get no posts. My query is:               $nextSundayTalkArgs = array(           'post_type' => 'talk',           'posts_per_page' => 1,           'tax_query' => array(               array(                   'taxonomy' => 'talktype',                   'field' => 'slug',                   'terms' => 'sunday-talk'               )           )       );       $nextSundayTalkQuery = new WP_Query( $nextSundayTalkArgs );      It works perfectly without 'tax_query'. If I use something like 'talktype' => 'sunday-talk' instead, using query_var when I register the taxonomy, it simply ignores the line as thought it weren't there and prints any talk (instead of saying "no posts"). Inserting `<?php echo $GLOBALS['nextSundayTalkQuery']->request; ?>` gets me this:               SELECT SQL_CALC_FOUND_ROWS wp_posts.ID      FROM wp_posts WHERE 1=1     AND 0 = 1      AND wp_posts.post_type = 'talk'      AND (         wp_posts.post_status = 'publish'          OR wp_posts.post_author = 1          AND wp_posts.post_status = 'private'     )      GROUP BY wp_posts.ID      ORDER BY wp_posts.post_date DESC      LIMIT 0, 1      Using identical code to query WordPress' default "category" taxonomy works fine, so it seems to be related to my custom taxonomy or post type. To save space on this post, my custom post type code is here: http://pastebin.com/LxKt2pv5 and my custom taxonomy code is here: http://pastebin.com/NxuuxKuG I've tried including `'include_children' => false` as has been suggested, but no luck. I would appreciate any and all help, as this problem has been unsolvable for months with many people trying (and failing, unfortunately) to figure out what's wrong.


title: Portfolio & Blog cohabitation : multiple single.php files?

text: I'm currently creating a website that's going to be powered by Wordpress and have both a portfolio and a blog. How should I go about coding up the `single.php`? I understand custom post types are the way to go when it comes to a portfolio+blog setup, but when it comes to displaying the post/portfolio item in its entirety, is there such a thing as multiple `single.php` files? Thanks in advance!


title: whats the difference between term_id and term_taxonomy_id

text: the title says it all. At the moment in my custom taxonomies I'm getting the terms using the term id and taxonomy name. Thought this question would've been asked before but can't find it anywhere! So just thought I'd ask and see if anyone has any answers. cheers, daithi