title: List all custom post type posts from a given category?

text: I have a custom post type `myposttype` and it's taxonomy is called `myposttype_categories`. `myposttype_categories` have multiple terms inside, such as `foo` and `bar`. The tricky question is - how do I list all myposttype posts that belong to `foo` (or `bar`)? I thought this should work, but it does not:               $args = array(             'post_type' => 'myposttype',             'myposttype_categories'=> 'foo');     $loop = new WP_Query( $args );      And the loop is always empty. I've tried possibly every Taxonomy paramter for WP_Query() also checked Category parameters. There are very old posts addressing the issue issue, but it seems it still doesn't work after 3 years...? Or am I missing something? http://wordpress.org/support/topic/wp_query-and-custom-taxonomies http://core.trac.wordpress.org/ticket/13582 [edit] That's how I register my post type:               add_action('init', 'myposttype_register');            function myposttype_register() {              $labels = array(             'name' => _x('Myposttype', 'post type general name'),             'singular_name' => _x('Myposttype item', 'myposttype item'),             'add_new' => _x('Add Myposttype', 'myposttype item'),             'add_new_item' => __('Add New Item'),             'edit_item' => __('Edit Item'),             'new_item' => __('New Item'),             'view_item' => __('View Item'),             'search_items' => __('Search Items'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );              $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','thumbnail','page-attributes','comments','trackbacks'),             'show_in_nav_menus' => true,           );               register_post_type( 'myposttype' , $args );          }        And taxonomy:               register_taxonomy("myposttype_categories", array("myposttype"), array("hierarchical" => true, "label" => "Categories", "singular_label" => "Type", "rewrite" => true));


title: $form_fields from attachment_fields_to_edit returning empty array

text: I'm trying to remove the caption field from non-images attachments' edit page, which should be a simple matter of `unset($post['post_excerpt'])`, but I can't unset a non-existent value... Looking at the core, this Array being empty should mean that no fields exist on the attachment page, but all the expected fields are there (plus custom ones I've added). I'm completely and utterly baffled. I've tried extremely high & extremely low priority values in applying the filter, neither of which makes a difference. Below is a test case showing the empty Array before and the Array with just my custom field after.               function attachment_fields_edit( $form_fields, $post ) {         print_r( $form_fields ); // Array ( )              $form_fields['author'] = array(         'label' => __('Author'),         'input' => 'text',         'value' => get_post_meta( $post->ID, "author", true ) );              print_r( $form_fields );         /* OUTPUT:         Array         (             [author] => Array                 (                     [label] => Author                     [input] => text                     [value] => Author Name                 )         )         */     }     add_filter( 'attachment_fields_to_edit', 'attachment_fields_edit', null, 2 );`      I don't know what to do about this. It makes no sense based on the code I'm looking at. Any help would be appreciated! PS: Given recent changes to the Media Manager, my working theory is that this may be related in some way to this change...


title: Creating fields in the database

text: I am newbie to wordpress plugin and this is my first plugin which I am doing now. I want that when the plugin will be activate it will make some predefined fields in the database and also the same fields in the form page. So how to do that. Any help will be highly appriciable.


title: How Do I Figure Out What File(s) to Edit from Looking at the Source Code

text: I just started working at a company and they have a website that was partially completed by another designer and have hired me to complete and make changes to it. It seems that most of the website was created in WordPress, but some of it seems to be done by hand-coding in HTML & CSS. The website is at http://www.executivetravellink.com/ I do have access to their FTP, so I can transfer the files locally and are able to see them, but my issue is that I can't tell in what files changes were made. For example, if you see the navigator bar at the top with the "Flights," "Cruises," etc, you can see that the previous designer added small icons next to the links. I know that if you go into Appearance--->Menus that you can add/edit the links on the menu and the images can be inserted from using the style.css file in Wordpress. However, I am not sure in what file he was storing those actual images, so I can add new ones. Also, I'm having this issue on many pages, but for example on http://www.executivetravellink.com/brands/hotel-brands/, when you go to the hotel-brands page in Wordpress, I can see the first paragraph about Club Med, but I'm assuming the remaining paragraphs are not there and must be in a separate file linked to it. I tried to insert a banner above the first paragraph and it would not show up. From looking at the source code, would someone be able to know the answer to that? I’m still very new to Wordpress and can’t say I’m an expert at HTML & CSS either at this point. Any information that someone could give me would be certainly much appreciated. Thank You!


title: How to List Thumbnails based on Custom Categories

text: I need to list(display) all thumbnails from my Custom Post Types in a page template based on product categories. For Example I have a Custom Category called "Art" and some images(Custom Post Type) products enabled by "Feature Image" associated with "Art" Category.Now I would like to list ONLY all thumbnails of Art category product on my Custom Page Template. Can you please let me know how to do this? I find this method which works only for one page without ability to select from pages!               <?php the_post_thumbnail(); ?>


title: How to prevent empty category to list content of sub categories?

text: I have a category structure like following:               A     ->B       ->C     D      (B is sub category of A and C is sub category of B) I have content only for category "C" and if I open Category "B" the content of category "C" is displayed. How can I prevent this? I want to display "No Posts" if I open Category "B".


title: Can I have a different menu for each parent page?

text: I have 4 different menus on my website. Right now I'm using the solution to a problem I posted here in order for the menu to display using the CSS framework I'm making use of. Each of these menus has a number of child pages, and on these child pages I'd like to display the corresponding menu. For example, the About Us children would only show the about us menu, the contact children would only show the contact us menu. My functions.php showing the menus is:               <?php      function register_my_menus() {      register_nav_menus(      array(        'about-menu' => __( 'About Us Menu' ),        'how-menu' => __( 'How Do I Menu' ),        'services-menu' => __( 'Our Services Menu' ),        'online-menu' => __( 'Do It Online Menu' )        )      );     }     add_action( 'init', 'register_my_menus' );     ?>      In my mind I imagine it to be a script in the header.php that would just have a series of if statements. I appreciate your help. * * * EDIT: I've actually solved this by using a series of if statements and using a php include within the pages. For anyone interested, I've used the solution posted above, with the following code:               <?php        if ( $post->post_parent == '1' || is_page(1) ) {          $menu_name = 'about-menu';          // and so on..       }        elseif ( $post->post_parent == '2' || is_page(2) ) {         $menu_name = 'contact-menu';         // and so on..       }     ?>      Granted it may not be the best way of doing it, what with having a great deal of repeated code, but it works for me, and I hope it can benefit others in the future.


title: Display Total Number of Social Shares

text: I have to display the total number of social shares, like mashable does in it´s website. ![](http://i.stack.imgur.com/KSPja.jpg) It´s not a problem, I found a php code that does the job.               function getTotalShares($atts) {     extract(shortcode_atts(array(         'cache' => '3600',         'url' => 0,         'f' => 0,         'bgcolor' => '#ffffff',         'bordercolor' => '#ffffff',         'borderwidth' => '0',         'bordertype' => 'solid',         'fontcolor' => '#7fc04c',         'fontsize' => '55',         'fontweight' => 'normal',         'padding' => '1'       ), $atts));           $shareHash = "$cache.$url.$f.$bgcolor.$bordercolor.$borderwidth.$bordertype.$fontcolor.$fontsize.$fontweight.$padding";      $totalShareRecord = 'totalshares_' . $shareHash;      $cachedposts = get_transient($totalShareRecord);      if ($cachedposts !== false) {      return $cachedposts;           } else {             if (!$url) $url = get_permalink($post->ID);             $json = file_get_contents("http://api.sharedcount.com/?url=" . rawurlencode($url));         $counts = json_decode($json, true);         $return = $counts['Twitter'] + $counts['Facebook']['total_count'] + $counts['GooglePlusOne'];         if ($f) $return = '          ' . $return . '          ';         set_transient($totalShareRecord, $return, $cache);         return $return;      }     }     add_shortcode('totalshares','getTotalShares'); Now the problematic! The code above get the numbers of shares based on the permalink, which is pulled by `get_permalink($post->ID);`. My website works as a content aggregator, so I want to pull the number of shares of the original post url, which in my website is filled in the post meta `links_link_custom`. My question is: Is this possible? I hope this text is not confusing, please comment if more information is needed.


title: Masonry Append WordPress posts with singleMode

text: I'm using Masonry on a Wordpress site, to display posts from a custom post type (training_videos). As all the columns are the same width im using the singleMode = true option. The site is a responsive site using Skeleton, hence why they need to be the same width for uniform display purposes. I can get the pots to display fine, and the Masonry aspect is all good, but... ...As the training_videos post type has "more than a few" posts in it, I want to be able to only display 6 at a time, with an append button that adds 6 more underneath and so on, until there are no more to add. This is where I get stuck. I can't work out how to get it to work! Here is the JS Masonry call I'm using so far:               <script>     jQuery(document).ready(function($) {         $('#masonry').masonry({singleMode: true});     });     </script>      '#masonry' being the container the posts sit in After following the actualy masonry tutorial site, I'm completely stumped! Thanks


title: Multiple Meta Boxes in separate files

text: So here's the problem, I want to have a few different meta boxes on my sites, but I'd like to be able to store each of them in separate files and included them into functions, so I can just copy specific ones to new installs and included them on a case by case basis. From what I can gather though, it seems like I need to put them all into one array?


title: Capcha not getting displayed

text: I am using the theme Feed Engine for a question and answers site. I am having a problem that it is not displaying the captha(see here). I would be very thankful if someone could help me out. Thanks in advance. **EDIT:** Here is the file `CaptchaSecurityImages.php` which gives error on line `34`               <?php     session_start();     class CaptchaSecurityImages {        function generateCode($characters) {           /* list all possible characters, similar looking characters and vowels have been removed */           $possible = '23456789bcdfghjkmnpqrstvwxyz';           $code = '';           $i = 0;           while ($i < $characters) {               $code .= substr($possible, mt_rand(0, strlen($possible)-1), 1);              $i++;           }           return $code;        }        function CaptchaSecurityImages($width='120',$height='40',$characters='6') {           $font = "monofont.ttf";           $code = $this->generateCode($characters);           /* font size will be 75% of the image height */           $font_size = $height * 0.75;           $image = imagecreate($width, $height) or die('Cannot initialize new GD image stream');           /* set the colours */           $background_color = imagecolorallocate($image, 255, 255, 255);           $text_color = imagecolorallocate($image, 20, 40, 100);           $noise_color = imagecolorallocate($image, 100, 120, 180);           /* generate random dots in background */           for( $i=0; $i<($width*$height)/3; $i++ ) {              imagefilledellipse($image, mt_rand(0,$width), mt_rand(0,$height), 1, 1, $noise_color);           }           /* generate random lines in background */           for( $i=0; $i<($width*$height)/150; $i++ ) {              imageline($image, mt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $noise_color);           }           /* create textbox and add text */           $textbox = imagettfbbox($font_size, 0, $font, $code) or die('Error in imagettfbbox function');           $x = ($width - $textbox[4])/2;           $y = ($height - $textbox[5])/2;           imagettftext($image, $font_size, 0, $x, $y, $text_color, $font , $code) or die('Error in imagettftext function');           /* output captcha image to browser */           header('Content-Type: image/jpeg');           imagejpeg($image);           imagedestroy($image);           $_SESSION['security_code'] = $code;        }     }     $width = isset($_GET['width']) && $_GET['width'] < 600 ? $_GET['width'] : '120';     $height = isset($_GET['height']) && $_GET['height'] < 200 ? $_GET['height'] : '40';     $characters = isset($_GET['characters']) && $_GET['characters'] > 2 ? $_GET['characters'] : '6';      $captcha = new CaptchaSecurityImages($width,$height,$characters);     ?>


title: Wordpress plug-in for dynamic download link?

text: I am using Wordpress and I like to serve a page with a link to download. That link points to a new file EACH DAY. Is there a plugin that can do this?   * Store a list of filename per day   * Rotate each day using the right filename If not, I can work around by using some kind of hashkey + yyyymmdd in the filename too. But don't know how. Any help? Thanks.


title: how can I add an icon/image for a child theme?

text: I have set up a child theme of the twentyten theme. In the themes section that under the appearance, I can only see the child theme's title, author name, and a grey box above it. How can I add an icon/image to be displayed in the grey box?


title: Search URL redirect problem

text: I'm having a strange problem with my search results page when i search i get this in the URL http://f.cl.ly/items/2Z1c1b2G1n0B3r3W063B/Screen%20Shot%202011-09-29%20at%201.21.19%20PM.png "see the X & Y" ? i don't know where do they came from & i can't seem to figure how to fix it & it breaks my pagination, so how can i fix this ? Thanks


title: Wordpress Won't Send Email When a User Register

text: When a user registers on my wordpress site, it does not send them an email containing the password. I do notice that an email was sent when a users email is `@mydomain.com`, but for others let say gmail.com or yahoo.com, it does not send an email. How do I fix it?


title: cannot upload anything into wordpress

text: I have worpdress 3.8.1. sometimes when i try to upload image, pdf using worpdress functions it gets stuck at 100% and nothing gets logged in the log files so i d onot know what the problem is. however I have seen the following which appear randomly, picture attached![enter image description here](http://i.stack.imgur.com/NOvzm.png)


title: register_sidebar 'after_widget' on custom-built widgets not implementing, caused nested widgets

text:
In registering my sidebar I want each widget wrapped in `<aside>`. This works fine when using the inbuilt widgets like _Calendar_ or _search_ , however, when I add widgets I have created myself, the closing `<aside>` is not getting output. Therefore I'm getting a structure similar to:               <widgets-area>         <custom-widget>             <custom-widget>             </custom-widget>         </custom-widget>     </widgets-area>      When it should be looking like:               <widgets-area>         <custom-widget>         </custom-widget>         <custom-widget>         </custom-widget>     </widgets-area>      **register_sidebar**               register_sidebar( array(         'name'          => __( 'Sidebar', 'mysite' ),         'id'            => 'sidebar-1',         'before_widget' => '',         'after_widget'  => '',         'before_title'  => '
',         'after_title'   => '
',     ) );      The code for my custom widgets include both `echo $args['before_widget']` and `echo $args['after_widget']` which I presume is used to echo out the 'before_widget' and 'after_widget' code declared in `register_sidebar()`. Why are my custom widgets not closing properly, but the built-in ones are? What am I missing? Other than the structure, the custom widgets are functioning correctly.


title: esc_attr not working in shortcode

text: I have a shortcode that outputs a block of html. One element in the block is an anchor tag with an image caption in the title attribute. Some of the captions I am using have double quotes in them, so I am wrapping them in esc_attr(), but none of the quotes are being encoded. If I put an echo statement in the shortcode with esc_attr() around the caption, it outputs an encoded string, but it doesn't seem to work when I return the html as you are supposed to do in a shortcode. Is this the nature of esc_attr()? If so, how can I encode a string to be returned from a shortcode?


title: Saving return value from the_author_posts_link()

text: As you know, in the loop, `the_title()` function displays (echos) the post title to the screen, and `get_the_title()` returns it (so it can be saved in a variable). The same is true for the pair `get_the_post_thumbnail()` and `the_post_thumbnail()`. Now, what is equivallent to `the_author_posts_link()`? I need to save that information rather than displaying it.


title: Sub-Sub-Blogs -- creating and importing content into a custom sub-type

text: **Description:** The university radio station I volunteer at uses WordPress 3's Network Mode for the entirety of its web content. It uses the format:   * **Top-Level`(.com/*)`** \-- Basic station information, links to feeds, etc. The main site.   * **Subdomains`(*.domain.com)`** \-- Station departments (I.e., "music", "spoken word", etc.)   * **Program Top-Level Sub-Directory`(.com/program/*)`** \-- Custom post type ("Program") for individual shows airing on the station. Locally-written proprietary code. Most producers have existing social media property (Facebook/Twitter/MySpace/Soundcloud/Tumblr, to name but a few), and we're wanting to encourage producers who don't currently use social media to start using it. To this end, I need two facilities -- a blog system and a RSS importer. **Questions:**   1. Blog system -- Users should be able to post directly to the WP system, but be restricted to individual program categories. I can probably figure out the first part with roles, but is there any way to restrict _where_ a particular user is able to post? I've also thought about doing this as another custom content type so as to keep it separate from the main station posts system, but it might be difficult to get an RSS importer plugin (See below.) to work with this.   2. RSS importer -- I don't want to force users to use the station's WP system if they're already using other social media tools. Because most social media tools worth their salt produce RSS feeds, I figure the easiest way to accomplish this is via a RSS importer. I've used feedwordpress in the past, but I worry it'll be both too confusing and too powerful for the users I want to access it. Think this is simple enough I could code it from scratch, or is there a particular plugin I should use? Thank you!


title: Redirect User on Login based on role WP 3 - Multi-Site

text: I need to have users land on a specific admin page based on user role in WP 3.0 multi-site enabled. I found this               function fb_redirect_2() {              if ( preg_match('#wp-admin/?(index.php)?$#', $_SERVER['REQUEST_URI']) ) {             if ( function_exists('admin_url') ) {                 wp_redirect( admin_url('edit-comments.php') );             } else {                 wp_redirect( get_option('siteurl') . '/wp-admin/' . 'edit-comments.php' );             }         }     }     if ( is_admin() )         add_action( 'admin_menu', 'fb_redirect_2' );      And changed               if ( is admin() )       to               if ( current_user_can('edit_posts') )      but this isn't working... Any Suggestions?


title: Limit User Iinterface for Admin?

text: Is there a plugin or a way where I can restrict or limit the buttons on the admin interface for a certain user? For example:   * for the user who has a role of a writer, he/she can only post content,   the other buttons are deactivated.   * for the designer he/she can only change the "Appearance Tab",   all the others are deactivated. Is there a solution for that?


title: Set media upload attachment link to none and hide it in WP v3.5

text: In the Media upload popup page, how do I set the attachment link to none and hide it in Wordpress version 3.5? The following filter worked fine in earlier versions of WP:               function my_attachment_fields_edit($form_fields,$post){          // Set attachment link to none and hide it.         $html = "<input type='hidden' name='attachments[".$post->ID."][url]' value=''/>";              $form_fields['url']['html'] = $html; //Replace html         $form_fields['url']['label'] = ''; //Remove label         $form_fields['url']['helps'] ='';//Remove help text              return $form_fields;     }     add_filter('attachment_fields_to_edit', 'my_attachment_fields_edit', 10, 2);      This was actually an excellent filter posted by someone here I believe. Do anyone know how to accomplish this in WP 3.5?


title: Help Creating a Slideshow Custom Post Type with Custom Meta Boxes?

text: I need to create a custom post meta box(es) for my custom post type "Slideshow" (this post type is already created). Each metabox will hold the content in each slide slide and save it to corresponding custom fields. Each metabox should contain the following fields:   * Title (Text Field)   * Image (Either a Text Field for the img URL or ideally a Dropdown List showing thumbnails of the images attached attached to the post)   * Embed Code (Text Area)   * Description (wysiwyg)   * Hide the Slide (Checkbox to use to temporarily hide a slide without deleting it)   * Delete Slide (button that deletes the contents of the post meta fields that were filled in by this slide) I would also like a button somewhere that allows me to "Add a slide" so when it is clicked, it adds another "Slide" Custom Meta Box which is a duplicate of the first but adds an incremental number to each custom post meta field. I currently just have 15 metaboxes and the Slideshow template is set up in a way that if only 5 of the metaboxes are filled in then only 5 slides display. Finally, I'd like to be able to re-order the slides, whether by "Drag and Drop" or by another Text Field that I can type the order number in. I have gotten it almost where I need it with the "More Fields" plugin and some code help from Rarst. With the "More Fields" plugin I have the following fields in each metabox:   * Title (Text Field)   * Image (A dropdown list of the images attached to the post)   * Embed Code (Text Area)   * Description (wysiwyg)   * Hide the Slide (Checkbox to use to temporarily hide a slide without deleting it) Here is a screenshot of how I have it setup through the "More Fields" plugin: ![alt text](http://i.stack.imgur.com/7kjHX.jpg) The problem with this is that there is no way to delete a slide once it is made because "More Fields" doesn't use `<?php delete_post_meta($post_id, $key, $value); ?>` anywhere. The other problem with the plugin is that it is too unreliable and breaks frequently with updates. I have been able to implement a similar solution with my own custom metaboxes that includes:   * Title (Text Field)   * Image (Text Field for the img URL)   * Embed Code (Text Area)   * Description (Text Area)   * Hide the Slide (Checkbox to use to temporarily hide a slide without deleting it) With this implementation I can't seem to get the multiple TinyMCE fields to work or the image dropdown box. The TinyMCE code seems to work until I add the code that create incremental copies of the first metabox at which point I get this error right above the field where the TinyMCE buttons should be: `Warning: array_push() [function.array-push]: First argument should be an array...`. Also, right now I am relying on my writers to know to put in EITHER a video or an image for each slide and that's ok but it may be better to have a radio button that lets them choose which one the slide is (probably default to image) which is tied to a conditional display statement in the slideshow template. I am handling image uploads via the built-in "Featured Image" box in the sidebar although I wouldn't mind a custom metabox that simply said "Upload Images" at the top of the write panel. Ultimately I am looking for a slideshow similar to this: http://www.nytimes.com/slideshow/2010/08/10/science/20100810angier-1.html. I want mine to also be able to have a video as the content in the slide instead of a picture. I need an intuative and easy to use Admin panel for my writers (they are not very tech savvy and not reliable using html and/or shortcodes). Just in case it's not clear from the example, every slide should generate a new pageview. The Drag'n'Drop reordering isn't a high priority but it would be cool. I found a plugin that handles this really well: SlideDeck. Unfortunately the plugin doesn't suit my needs but the way they handle ordering of the slides is pretty slick. It's a seperate metabox in the sidebar that lets you drag the slides around into the order you like. This is also how you add slides, by clicking on an "Add Slide" button which adds another Slide Metabox to the write panel. Here is a screenshot: ![alt text](http://i.stack.imgur.com/HLfvH.jpg) You can also see more screenshots of it in action in the wordpress repository. **Here is all my code:** The functions setting up my Slideshow Post Type and Slideshow Pagination: http://loak.pastebin.com/g63Gf186 The original code from DeluxeBloggingTips.com (DBT) that I based my Metaboxes off of: http://loak.pastebin.com/u9YTQrxf The version of the DBT code that I modified to give me incremental versions of the same metabox: http://loak.pastebin.com/WtxGdPrN A modified version of the DBT code that Chris Burbridge created to allow for multiple instances of TinyMCE: http://loak.pastebin.com/Mqb3pKhx _With this code the TinyMCEs do work._ My modification of Burbridge's code that tries to incorporate my incrementation and a field that lets you choose the image from a dropdown list of all the images attached to the post: http://loak.pastebin.com/xSuenJTK _In this attempt, the TinyMCE is broken and the dropdown doesn't work._ This probably doesn't matter but just in case you are wondering, here is the code I use to pull the embed code from the custom post meta, resize it, and insert it in the post: http://loak.pastebin.com/n7pAzEAw **This is an edited version of the original question to reflect the current status of the project and answers the questions posted in the comments. Thanks toChris_O for putting the bounty on this. Also, thanks to Rarst and Justin for helping me out with a lot of this in the ThemeHybrid.com forum. I have spent hours and hours on this and am stuck (I spent a couple hours alone on this Question). Any help would be greatly appreciated.**


title: Get only one of the current categories

text:
On post pages Im using the below code to display links to other posts from the current category. My problem is when the current post is in more than 1 category it will display posts from the first category only. I want to control which current categories it shows posts from by excluding certain categories Ids (e.g. 29, 35) Any ideas would be greatly appreciated.               <?php     global $post;     $category = get_the_category($post->ID);     $category = $category[0]->cat_ID;     $myposts = get_posts(array('numberposts' => 5, 'offset' => 0, 'category__in' => array($category),  'post_status'=>'publish', 'order'=>'ASC' ));     foreach($myposts as $post) :     setup_postdata($post);     ?>
     <a href="<?php the_permalink(); ?>">     <?php echo get_post_meta($post->ID, "rw_post_type", true); ?>
     <?php endforeach; ?>     <?php wp_reset_query();           ?>
     <?php


title: Remove "Insert from URL" link in Media upload - WP 3.5

text: How do I remove the `Insert from URL` link in the new Wordpress 3.5 Add Media popup page? In earlier versions of Wordpress, this worked fine:               // removes URL tab in image upload for post     function remove_media_library_tab($tabs) {          if (isset($_REQUEST['post_id'])) {             $post_type = get_post_type($_REQUEST['post_id']);             if ('premium' == $post_type)                 unset($tabs['library']);                 unset($tabs['type_url']);         }         return $tabs;     }     add_filter('media_upload_tabs', 'remove_media_library_tab');      Who knows?


title: Remove subfolders from URL

text: I am having a tough time removing the subfolders from the URL in my WordPress site. Currently, the URL format is: `www.mysite.com/subfolder/index.php/category/postname` I would like to remove both the subfolder AND index.php from the URL. The site must stay in a subfolder of root on my server. My current `htaccess` file is:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /subfolder/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /subfolder/index.php [L]     </IfModule>      I've tried to add the following, although it did not work.               Options +FollowSymlinks     RewriteEngine on     RewriteRule ^subfolder/(.*)$ http://www.mysite.com/$1 [R=301,L]     RewriteRule .* index.php/$0 [PT,L]


title: Wordpress 3.5 attachment_fields_to_edit and media_send_to_editor

text: In previous version i set a new check field into the media window with a simple code                function ab_prettyphoto_attachment_fields_to_edit( $form_fields, $post ) {              $my_form_fields = array(          'ab_prettyphoto' => array(             'label'     => __('Automatic Zoom on click', 'ab_prettyphoto'),             'input'     => 'html',             'html'      => "             <input type='checkbox' name='ab_prettyphoto-{$post->ID}' id='ab_prettyphoto-{$post->ID}' value='1' />             ID}'>" . __('Enable zoom', 'ab_prettyphoto') . "" )     );     if( $post->post_mime_type == 'image/jpeg' OR  $post->post_mime_type == 'image/gif' OR $post->post_mime_type == 'image/png' OR $post->post_mime_type == 'image/tiff')       return array_merge( $form_fields, $my_form_fields );     else       return $form_fields;     }     add_filter( 'attachment_fields_to_edit', 'ab_prettyphoto_attachment_fields_to_edit', 100, 2 );      And i send to the editor the value of the check with               function ab_prettyphoto_send_to_editor( $html, $send_id, $attachment ) {      if( isset($_POST["ab_prettyphoto-$send_id"]) )      $title=($_POST['attachments'][$send_id]['post_title']);       return str_replace('<a', '<a rel="prettyPhoto-img" title="'.$title.'"', $html);     }      else       return $html;      }           add_filter( 'media_send_to_editor', 'ab_prettyphoto_send_to_editor', 66, 3 );      In the new WP35 the attachment_fields_to_edit work, but the media_send_to_editor not: into the $_POST array the key "ab_prettyphoto-$send_id" not exists and i have see with Firebug a wp-ajax.php call when i click on the checkbox. The values of $_SPOST array into the ab_prettyphoto_send_to_editor function (launched by media_send_editor) are (the value as for example)                    Array          (           [nonce] => 125ece740a           [attachment] => Array           (            [id] => 4            [post_content] =>             [post_excerpt] =>             [url] => http://localhost:8888/wpn/wp-content/uploads/2012/12/fotohome.jpg            [align] => left            [image-size] => thumbnail            [image_alt] => fotohome           )                [html] =>            [post_id] => 1           [action] => send-attachment-to-editor       )      The $_POST[ab_pretthyphoto....] is not send I have found some docs into the web about the problem but i have not f


title: Is it better practice to use query_posts, WP_Query, or get_posts to create various custom loops within a Page?

text:
Right now, I'm using `get_posts` to retrieve cusstom posts types with a custom taxonomy assigned to it in order to generate static content like this:               <?php     /**      * Template Name: Front Page      * @package WordPress      * @subpackage Prominent      * @since Prominent 1.0      */     get_header(); ?>

                 <?php // Create custom loop ?>                 <?php $custom_posts = get_posts('post_type=page_content&page_sections=Slider (Front Page)'); ?>                 <?php foreach( $custom_posts as $post ) : setup_postdata( $post ); ?>
<?php the_content(); ?>
                 <?php endforeach; ?>                 <?php wp_reset_query(); ?>

             <?php             $page_id = $post->ID; // 123 should be replaced with a specific Page's id from your site, which you can find by mousing over the link to edit that Page on the Manage Pages admin page. The id will be embedded in the query string of the URL, e.g. page.php?action=edit&post=123.             $page_data = get_page( $page_id ); // You must pass in a variable to the get_page function. If you pass in a value (e.g. get_page ( 123 ); ), Wordpress will generate an error.                  $content = apply_filters('the_content', $page_data->post_content); // Get Content and retain Wordpress filters such as paragraph tags. Origin from: http://wordpress.org/support/topic/get_pagepost-and-no-paragraphs-problem             $title = $page_data->post_title; // Get title             ?>

<?php echo $content; // Output Content ?>

                 <?php // Create custom loop                 $custom_posts = get_posts('post_type=page_content&page_sections=Content (Front Page)'); ?>                 <?php foreach( $custom_posts as $post ) : setup_postdata( $post ); ?>

<?php the_title(); ?>

<?php the_content(); ?>

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

     <?php get_footer(); ?>      What is better practice in this case? To use query_posts, WP_Query, or get_posts? ![enter image description here](http://i.stack.imgur.com/HVCoj.png)


What would cause this error: Fatal error: Class 'ZipArchive' not found in /home/test/dummyurl.com/wp- content/themes/mytheme/upload-zip.php on line 14 PHP Version is 5.3.1 Does WP have a built in function I should use instead? Like perhaps the "unzip_file" function line 525 of ./wp-admin/includes/file.php"?               function openZip($file_to_open) {          global $target;           $zip = new ZipArchive();  //This is line 14         $x = $zip->open($file_to_open);           if($x === true) {               $zip->extractTo($target);               $zip->close();                             unlink($file_to_open);           } else {               die("There was a problem. Please try again!");           }       }


title: wordpress wp_list_categories

text:
i'm using wp_list_categories like so:               <?php                  //list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin)                      $taxonomy     = 'news_cat';                 $orderby      = 'name';                  $show_count   = 0;      // 1 for yes, 0 for no                 $pad_counts   = 0;      // 1 for yes, 0 for no                 $hierarchical = 1;      // 1 for yes, 0 for no                 $title        = '';                      $args = array(                   'taxonomy'     => $taxonomy,                   'orderby'      => $orderby,                   'show_count'   => $show_count,                   'pad_counts'   => $pad_counts,                   'hierarchical' => $hierarchical,                   'title_li'     => $title                 );                 ?>
                 <?php wp_list_categories( $args ); ?>
      which works great. it outputs as follows:

         cat 1

         cat 2

         cat 3

         cat 4

      problem is i don't want an absolute path, just a relative one... i need the href to read as `/news_cat/cat-1` thanks in advance.


title: Add new post redirection

text: I don't know whats wrong going on with my website, this is the second redirection problem going on, Whenever I add a new post, After adding title, When I try to add the content, My own websites home-page appears next to the content box, in a red bordered box, and a page tries to load, this page keeps on loading, nothing comes, the url of loading page is "http://mywebsite.com/wp-admin/post-new.php" ![enter image description here](http://i.stack.imgur.com/KP9hf.jpg)


title: How do you add a custom excerpt length in twenty eleven child theme?

text:
I have a problem displaying custom excerpt length. I've searched for a solution on wordpress stackexchange and found this:                   remove_filter( 'excerpt_length', 'twentyeleven_excerpt_length' );      add_filter('excerpt_length', 'new_excerpt_length');     function new_excerpt_length($length) {       return 50;     }      When adding this to **functions.php** I still get the same 3 line excerpt as before. If I change the return statement to something else like, return 8 or return 17, I still get the same excerpt as before. The excerpt function is inserted into **content.php** like this:
                 <?php the_excerpt(); ?>                 <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'twentyeleven' ) . '', 'after' => '
' ) ); ?>
             <?php endif; ?>      What am I doing wrong here?


title: Download/View Schema (or DTD) for XML Import

text: Where can I download the schema (or DTD) for the layout of the WordPress import/export file format?


title: use wp_get_attachment_image() to show attachments

text:
I really hope this is a facepalm moment, b/c i'm getting frustrated with this. Making a quick loop to show certain attachment images. lifted it almost straight from the codex but wp_get_attachment_image() isn't behaving like I'd expect. isn't the ID part of the wp_get_attachment_image the ID of the attachment? is that not the same as the post id of the attachment?               $args = array(             'post_type' => 'attachment',             'post_mime_type' => array('image','image/jpeg','image/png','image/gif'),             'numberposts' => 5,             'order' => 'ASC',             'orderby' => 'post_title'         );               $attachments = get_posts( $args );          if ( $attachments ) {             foreach ( $attachments as $attachment ) {                echo wp_get_attachment_image( $attachment->ID, 'full' , true);                echo '
' . $attachment->post_title . '
';               }          }      prints out the post titles but no images. **EDIT 1:** yes I am definitely getting posts with my get_posts some more debugging:               $attachments = get_posts( $args );          if ( $attachments ) {             foreach ( $attachments as $attachment ) {                $image= wp_get_attachment_image( $attachment->ID, 'thumbnail' , false, array( 'id' => $attachment->ID ));                echo $image;                print_r(wp_get_attachment_image_src( $attachment->ID, 'thumbnail' , false, array( 'id' => $attachment->ID )));                echo var_export($image);                echo '
' . $attachment->post_title . '
';               }          }     }      returns this:               Array ( [0] => http://localhost/multi/wp-content/uploads/2011/11/FabricColllFabrics-150x150.jpg [1] => 100 [2] => 100 [3] => 1 )      false     FabricColllFabrics      for the first image... so wp_get_attachment_image_src is correctly finding the source, but wp_get_attachment_image is apparently returning false? **edit 2:** and there's the face palm i was waiting on at some point i must've been debugging something and for who knows what reason i put a               function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon = false) {       return false;      right at the beginning of wp_get_attachment_image this is all localhost stuff, and i don't usually hack at core, but i guess at some point i was in there probably trying to backtrace something and forgot to clean up after myself. epic fail.


title: How to apply next/previous classes to LIs for pagination links?

text: I am using the WP-Paginate plug-in and need to apply a class to the containing LIs for the next/previous links. Can someone tell me how to do this? If there's a better/easier way to do this other than using WP-Paginate, then I'm open to suggestions. Thanks!


title: Free Wordpress theme for an intranet tutorial site

text: I work for a research oriented company and hence a lot of new facts and ways of going about work are found everyday. We want to consolidate all our understandings and categorize them as tutorials on our company intranet which some writers (who are authorized to do so) can update. I need a comprehensive theme that is elegant, creative and simple to manage which a customizable menu and is apt for a multi-discipline tutorial intranet site. Also one that comes pre-customized for a tutorial oriented site so that i don't have to find too many plug-ins to make it useful. some theme like this site, though more spacious for text


title: Return User Meta text as links to post edit inside the user columns

text: I use this function to get some information to the user columns,               function column_company( $defaults ) {         $defaults['usercolumn-company'] = __('Company', 'user-column');         $defaults['usercolumn-myoffers'] = __('Applied Offers', 'user-column');         $defaults['usercolumn-totaloffers'] = __('Total Offers', 'user-column');         return $defaults;     }          function custom_column_company($value, $column_name, $id) {         if( $column_name == 'usercolumn-company' ) {             return get_the_author_meta( 'company', $id );         }         elseif( $column_name == 'usercolumn-myoffers' ) {             return get_the_author_meta( 'offersiget', $id );         }         elseif( $column_name == 'usercolumn-totaloffers' ) {             return get_the_author_meta( 'totaloffers', $id );         }     }          add_action('manage_users_custom_column', 'custom_column_company', 15, 3);     add_filter('manage_users_columns', 'column_company', 15, 1);      i return the get_the_author_meta( 'offersiget', $id ); and here i get from the db some post id's as text, like: 8,12,51 is it possible to return this, not as a text but as a link to the edit post   (/wp-admin/post.php?post=(8)&action=edit)? I try this by @hakre               return sprintf(''.get_the_author_meta( 'offersiget', $id ).'');      and it works but it return one link with all the post id's inside, is it possible to split them? any help? Thanks,   Philip


title: add_rewrite_endpoint() not working for custom post type archives

text:
i'm working on somekind of wiki/encyclopedia system based on wordpress. there are two custom post types. i'll show my configuration for one of them:               $labels = array(         'name' => _x('Objects', 'post type general name'),         'singular_name' => _x('Object', 'post type singular name'),         'add_new' => _x('Add New', 'object'),         'add_new_item' => __('Add New Object'),         'edit_item' => __('Edit Object'),         'new_item' => __('New Object'),         'view_item' => __('View Object'),         'search_items' => __('Search Objects'),         'not_found' =>  __('Nothing found'),         'not_found_in_trash' => __('Nothing found in Trash'),         'parent_item_colon' => ''     );          $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'query_var' => true,         'has_archive' => 'objects', // this is the archive-slug (could be "objects/index"!!)         'rewrite' => array( 'slug' => 'objects' ), // this is the prepended slug (like "objects/my-object")         'capability_type' => 'post',         'hierarchical' => false,         'menu_position' => null,         'supports' => array('title','thumbnail')       );           register_post_type( 'dr_object' , $args );      everything is working as expected: mysite.de/objects gives me an overview (archive-dr_object.php template), mysite.de/objects/my-object shows the object details. to have some nice urls for the frontend editing functions, i added rewrite endpoints.               add_rewrite_endpoint('do', EP_PERMALINK | EP_PAGES ); // for do/edit, do/remove, etc      this works great for urls like mysite.de/objects/my-object/do/edit **here comes my problem:** the archives should have some editing capabilities, too. but mysite.de/objects/do/edit gives me a 404: "Page not found". i print_r'ed $wp_query and it looks like wp queries an attachment named "edit" hope somebody can help me – by now i'll stick with ugly ?do=edit urls for the archives. thanks in advance, hans //update 09/03/2012 stripped code of **my-plugin.php**               add_action('init', 'object_register');          function object_register() {          $labels = array(         'name' => _x('Objects', 'post type general name'),         'singular_name' => _x('Object', 'post type singular name'),         'add_new' => _x('Add New', 'object'),         'add_new_item' => __('Add New Object'),         'edit_item' => __('Edit Object'),         'new_item' => __('New Object'),         'view_item' => __('View Object'),         'search_items' => __('Search Objects'),         'not_found' =>  __('Nothing found'),         'not_found_in_trash' => __('Nothing found in Trash'),         'parent_item_colon' => ''     );          $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'query_var' => true,         'has_archive' => 'objects', // this is the archive-slug (could be "objects/index"!!)         'rewrite' => array( 'slug' => 'objects' ), // this is the prepended slug (like "objects/my-object")         'capability_type' => 'post',         'hierarchical' => false,         'menu_position' => null,         'supports' => array('title','thumbnail')       );           register_post_type( 'dr_object' , $args );     }          add_action('init', 'cluster_register');          function cluster_register() {          $labels = array(         'name' => _x('Cluster', 'post type general name'),         'singular_name' => _x('Cluster', 'post type singular name'),         'add_new' => _x('Add New', 'cluster'),         'add_new_item' => __('Add New Cluster'),         'edit_item' => __('Edit Cluster'),         'new_item' => __('New Cluster'),         'view_item' => __('View Cluster'),         'search_items' => __('Search Cluster'),         'not_found' =>  __('Nothing found'),         'not_found_in_trash' => __('Nothing found in Trash'),         'parent_item_colon' => ''     );          $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'query_var' => true,         'has_archive' => true,         'rewrite' => array( 'slug' => 'cluster' ),         'capability_type' => 'post',         'hierarchical' => false,         'menu_position' => null,         'supports' => array('title')       );           register_post_type( 'dr_cluster' , $args );     }     add_action( 'init', 'build_taxonomies', 0 );            function build_taxonomies() {           register_taxonomy( 'dr_designers', array("dr_object"), array("hierarchical" => false, "label" => "Designers", "singular_label" => "Designer", "rewrite" => array('slug' => 'designer')));      register_taxonomy( 'dr_tags', array("dr_object", "dr_cluster"), array("hierarchical" => false, "label" => "Tags", "singular_label" => "Tag", "rewrite" => array('slug' => 'tags')));       register_taxonomy( 'dr_manufactors', array("dr_object"), array("hierarchical" => false, "label" => "Manufactors", "singular_label" => "Manufactor", "rewrite" => array('slug' => 'manufactors')));            }          function dr_rewrite_settings(){     // this enables to get action form objects, cluster etc by adding sth like "objects/my-object/do/edit" -- YEAH!     add_rewrite_endpoint('do', EP_PERMALINK | EP_PAGES );          // ATTENTION: This is *only* done during plugin activation hook in this example!     // You should *NEVER EVER* do this on every page load!!     flush_rewrite_rules();     }     //register_activation_hook( __FILE__, 'dr_rewrite_settings' ); this should happen     add_action('init', dr_rewrite_settings);      as you can see – i had problem flushing the rewrite in a proper way (register_activation_hook). apart form that i should mention that i'm using another plugin to create a fakepage: mysite.de/objects/new and it goes like this:               <?php     /**      * Plugin Name: Fake Page Plugin 2      * Plugin URI: http://scott.sherrillmix.com/blog/blogger/creating-a-better-fake-post-with-a-wordpress-plugin/      * Description: Creates a fake page without a 404 error (based on Sean Hickey's Fake Plugin Page)      * Author: Scott Sherrill-Mix      * Author URI: http://scott.sherrillmix.com/blog/      * Version: 1.1      */          class FakePage     {         /**          * The slug for the fake post.  This is the URL for your plugin, like:          * http://site.com/about-me or http://site.com/?page_id=about-me          * @var string          */         var $page_slug = 'objects/new';              /**          * The title for your fake post.          * @var string          */         var $page_title = 'New Object';              /**          * Allow pings?          * @var string          */         var $ping_status = 'open';              /**          * Class constructor          */         function FakePage()         {             /**              * We'll wait til WordPress has looked for posts, and then              * check to see if the requested url matches our target.              */             add_filter('the_posts',array(&$this,'detectPost'));         }                   /**          * Called by the 'detectPost' action          */         function createPost()         {                  /**              * What we are going to do here, is create a fake post.  A post              * that doesn't actually exist. We're gonna fill it up with              * whatever values you want.  The content of the post will be              * the output from your plugin.              */                        /**              * Create a fake post.              */             $post = new stdClass;                  /**              * The author ID for the post.  Usually 1 is the sys admin.  Your              * plugin can find out the real author ID without any trouble.              */             $post->post_author = 1;                  /**              * The safe name for the post.  This is the post slug.              */             $post->post_name = $this->page_slug;                  /**              * Not sure if this is even important.  But gonna fill it up anyway.              */             $post->guid = get_bloginfo('wpurl') . '/' . $this->page_slug;                       /**              * The title of the page.              */             $post->post_title = $this->page_title;                  /**              * This is the content of the post.  This is where the output of              * your plugin should go.  Just store the output from all your              * plugin function calls, and put the output into this var.              */             $post->post_content = $this->getContent();                  /**              * Fake post ID to prevent WP from trying to show comments for              * a post that doesn't really exist.              */             $post->ID = -1;                  /**              * Static means a page, not a post.              */             $post->post_status = 'static';                  /**              * Turning off comments for the post.              */             $post->comment_status = 'closed';                  /**              * Let people ping the post?  Probably doesn't matter since              * comments are turned off, so not sure if WP would even              * show the pings.              */             $post->ping_status = $this->ping_status;                  $post->comment_count = 0;                  /**              * You can pretty much fill these up with anything you want.  The              * current date is fine.  It's a fake post right?  Maybe the date              * the plugin was activated?              */             $post->post_date = current_time('mysql');             $post->post_date_gmt = current_time('mysql', 1);                  add_post_meta($post->ID, '_wp_page_template', 'objects-new.php', true);                  return($post);               }              function getContent()         {             return '
Hi there!  You are viewing my fake post!
';         }              function detectPost($posts){             global $wp;             global $wp_query;             /**              * Check if the requested page matches our target               */             if (strtolower($wp->request) == strtolower($this->page_slug)){ //09.03 removed:  || $wp->query_vars['page_id'] == $this->page_slug                 //Add the fake post                 $posts=NULL;                 $posts[]=$this->createPost();                      /**                  * Trick wp_query into thinking this is a page (necessary for wp_title() at least)                  * Not sure if it's cheating or not to modify global variables in a filter                   * but it appears to work and the codex doesn't directly say not to.                  */                 $wp_query->is_page = true;                 //Not sure if this one is necessary but might as well set it like a true page                 $wp_query->is_singular = true;                 $wp_query->is_home = false;                 $wp_query->is_archive = false;                 $wp_query->is_category = false;                 //Longer permalink structures may not match the fake post slug and cause a 404 error so we catch the error here                 unset($wp_query->query["error"]);                 $wp_query->query_vars["error"]="";                 $wp_query->is_404=false;                  }             return $posts;         }     }          /**      * Create an instance of our class.      */     new FakePage;     ?>      i made two modifications to the standard plugin. maybe they interfer with the rewrite_rules? (i tried deactivating this plugin – didn't change a thing) 1) using a "hierarchical" slug. it works but: is it allowed? 2) let the fakepage use a custom template: `add_post_meta($post->ID, '_wp_page_template', 'objects-new.php', true);` (right before returning the post in `createPost()`)


title: Which wordpress theme is compatible Optima Express theme (real estate inventory) plugin?

text: I am using Optima Express theme (real estate inventory) plugin for my wordpress website. And it is working perfect in admin are.   But as i started to use it in front end it is started to conflict with Jquery of current active theme.   It does work with Twenty-Eleven, Twenty-Twelve but not the "Striking" and "Karma"themes I wish to use with this plugin. What should i do ? Should i go to everyplace in code and write JquerynoConflict OR any better solution for this ? All suggestion will be welcome.


title: Taxonomy page wpml dropdown not working

text: I have created the custom post type with the taxonomy product-categories. I have installed wpml and added the menu with the custom category. When the menu created using the custom post type category with taxonomy is clicked . Then the WPML language selector in the header is not displaying the language list. Please guide me how to sort this please The Language selector dropdown is listed in all the pages but not listing in the Taxonomy pages


title: Creating a admin widget for /wp-admin/post.php?

text: Hello and thank you for helping in advance, I am trying to create a widget that lives inside the post.php page for when editing a post that exists (Not new-post.php, I need an ID). This custom widget is going to get the posts ID and shoot it to another database to store it, it'll do this through ajax and have it's own independent save button. Pretty simple right? Except I can't figure out how to get my widget to show on the post.php page. Here is my test code in themes/myTheme/functions.php, just to try and get it in the right place...but it's not working.               function artist_associator_dashboard_widget_function(){         echo "Hello world";     }          function artist_associator_add_dashboard_widget(){         wp_add_dashboard_widget('artist_associator_dashboard_widget', 'Artist Associator', 'artist_associator_dashboard_widget_function');     }     add_action('wp_dashboard_setup','artist_associator_add_dashboard_widget');      I also tried putting in a few other actions that looked promising but it wasn't working out, couldn't find my functions.


title: Is it possible to set the upload location to a different server?

text: Our university has given our student society a 1GB portion of storage to be used for our website. We're low on their bandwidth priority however so it did not work speedily with Wordpress. I managed to purchase ourselves our own domain name, including hosting at a very cheap price (£14 per annum total). The only problem (not a problem yet, but in the future it might be) is that it comes with only 250mb of storage. Is there a way to set wordpress uploads over a certain size (500kb for example) to be automatically uploaded to our university-provided hosting instead? I'd quite like the majority of pictures to load fast, but with massive uploads not hogging our limited storage capacity. I should emphasise that I want my website users to be able to upload in the conventional way, but for their files above a certain size to be automatically stored in another storage location, instead of the default one.


title: Control resizing of uploaded images

text: I am looking for the regular images that get uploaded from the media uploader. I want to put in an image resize script instead of using WordPress to manage the images. The main reason being is that I don't want 3 images created every time I upload an image. I want just the size that is chosen from the media uploader. I did some reading on this site and figured out how to get the sizes. Now I need to know if there is a hook that can grab the image? I have only ever worked with the thumbnail. Where are the regular images called from that get inserted into the body of the post?


title: How to load script-related styles automatically?

text: Scenario: It is common that a JS dependency is bundled with a style file to work properly (just think about your favorite slideshow jQuery plugin). AFAIK, in this situation, the script and style have to be included in separate `wp_enqueue_script` and `wp_enqueue_style` calls. I am thinking about how to **automate this process**. A solution I could come about is to declare the configuration in a .json file in which an entry looks like this:               "jquery-plugin": ["static/js/jquery-plugin.js", "1.0", ["jquery"], "jquery-plugin.css"]      (the configuration is `[file_path, version, js dependency, bundled css file]`). When my plugin is loaded, the .json file is read, parsed and then the scripts and styles are registered. Also, information about whether a script has a bundled style file is kept in a global array, let's call it `$_scirpts_has_style`. With `$_scirpts_has_style`, the bundled style can get `wp_enqueue_style`'d automatically after the corresponding script is `wp_enqueue_script`'ed. So, what I basically want is some signal which informs me that a script is enqueued, but I cannot find such signal (action/filter). `script_loader_src` is something very close but it is triggered when the script is getting printed, which is too late to enqueue a style file. Is there any action/filter that does this? Or, What's your solution to this problem?


title: Posts without featured image using other post's featured image

text:
I am using the following code (see bottom) to display a custom post called 'artists'. I am also using `<?php if (has_post_thumbnail( $post->ID ) )` so I can set the background of a div using the post thumbnail (I don't think this is the problem). I want to display all of the posts on one page so use `'numberposts' => -1,`. I have noticed that the posts after the first twelve posts are using another posts featured image if they do not have one assigned. If I assign a featured image to any post in question then it does show the correct image. I just don't understand why every post after the first twelve are using another posts featured image. Is there something wrong with the loop as I'm using `'numberposts' => -1,`? There's no harm in this as I'll be assigning an image to each one but want to understand why this might be happening. ![enter image description here](http://i.stack.imgur.com/FX4he.png)                  <?php          $args = array(          'post_type' => 'artists',         'numberposts' => -1,         'orderby' => 'title',         'order' => 'ASC'      );          $myposts = get_posts( $args );     foreach ( $myposts as $post ) : setup_postdata( $post ); ?>          <?php if (has_post_thumbnail( $post->ID ) ): ?>     <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>     <?php endif; ?>
             <a href="<?php esc_url( the_permalink() ); ?>">                          <div class="artist-box mobile" style="background-image: url('<?php echo $image[0]; ?>')">

VIEW ARTIST

+

<?php the_title();?>

     <?php endforeach;      wp_reset_postdata();?>


title: How to get the list of users logged in to wordpress and expose it in JSON?

text: Is there a way to get the list of users logged in to wordpress site and expose it in JSON? Please throw some lights to achieve this.


title: what is firing cron

text: I've been having problems while trying to setup a simple cronjob. A lot of the WordPress tutorials like this one http://tommcfarlin.com/wordpress-cron-jobs/ specify a crontab with some time schedule and in WordPress they specify another time schedule. Can't seem to understand that. In the tutorial is specificed every 15 minutes: `*/15 * * * * wget -q -O – http://yourdomain.com/wp-cron.php?doing_wp_cron` and then in the code they say: `wp_schedule_event( time(), 'hourly', 'my_hourly_event' );` So this cron is going to run every 15 minutes or every hour?


title: Twenty Fourteen Customization: Link Post Formats

text:
A solution for this issue for the previous default theme, Twenty Thirteen, was found by me here. It's perfect for what I'm trying to do: set my own desired URL as the link in the title, rather than the first link appearing in a post being the URL the post title will point to. Unfortunately, the way things are done in Twenty Fourteen is quite different. Here's how the code in `content-link.php` currently looks:                        <?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
             <?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?>
         <?php             endif;                  if ( is_single() ) :                 the_title( '
', '
' );             else :                 the_title( '
', '
' );             endif;         ?>
                              <a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'link' ) ); ?>"><?php echo get_post_format_string( 'link' ); ?>                               <?php twentyfourteen_posted_on(); ?>      I'm pretty lost. To make things a little more complicated, I currently have the custom link post custom_field name aq_format_link. Here's what my **previous** theme's `format-link.php` file looked like:                       $link = get_post_meta( get_the_ID(), $key = 'aq_format_link', $single = true );


title: Function to auto-set a featured image that is already in use

text: _I don't even know where to start with figuring this out...._ This function for functions.php grabs the first attached image in a post and sets it as the featured image. The problem is that it will not attach an image if it is already attached to another post. I've tested this a number of times. **How can this function be changed to allow an image that is already attached to another post be set as the featured image on a new post?**                   function wpse127196_auto_set_featured_image() {                   global $post;                   $featured_image_exists = has_post_thumbnail($post->ID);                       if (!$featured_image_exists)  {                       $attached_image = get_children(     "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" );                if ($attached_image) {                       foreach ($attached_image as $attachment_id => $attachment) {                                     set_post_thumbnail($post->ID, $attachment_id);                                         }                                    }                                 }               }         add_action('save_post', 'wpse127196_auto_set_featured_image');         add_action('draft_to_publish', 'wpse127196_auto_set_featured_image');         add_action('new_to_publish', 'wpse127196_auto_set_featured_image');         add_action('pending_to_publish', 'wpse127196_auto_set_featured_image');         add_action('future_to_publish', 'wpse127196_auto_set_featured_image');


title: wordpress not displaying my form

text: When I create a page with the content as `[contact-form-7 id="199" title="Untitled"]` , it displays the form, but when I use it as               <div class="first"><?php $recentProjects = get_post('275'); echo $recentProjects->post_content; ?> </div>      it is not working. It is displaying `[contact-form-7 id="199" title="Untitled"]` instead of form.


title: URL rewrite breaking pagination

text: I have been reading around and cannot seem to figure this out. Everything is working fine except that pagination seems to not work, I am adding a second rewrite rule, shouldn't this fix that? I can get to the first page fine, but any page beyond throws a 404. Here is my code:               // Rewrite the Sermon URL     function sermon_rewrite() {         $cpt = 'sermon';         $tax = 'series';              add_rewrite_rule(             '^'.$cpt.'/([^/]+)/([^/]+)/([^/]+)/?',             'index.php?post_type='.$cpt.'&'.$tax.'=$matches[1]&'.$tax.'=$matches[2]&'.$cpt.'=$matches[3]',             'top'         );         add_rewrite_rule(             'sermon/([^/]+)/page/?([0-9]{1,})/?$',             'index.php?post_type='.$cpt.'&'.$tax.'=$matches[1]&paged=$matches[2]',             'top'         );     }     add_action('init','sermon_rewrite');      **EDIT** If I go to the following url This works: mysite.com/sermon/term/childterm/page2/ This does not: mysite.com/sermon/term/childterm/page2/ Any idea what is causing that?


title: Wordpress child pages not working

text:
I am creating a wordpress CMS and I have added multiple pages under one parent page. I am generating the links for all the child pages of a page and then when user clicks on the links, they should be able to open the child page. How ever when I click on the links, the index page is opened and no child page content is displayed. May be it is due to the use of the .htaccess file. I dont have any knowledge of htaccess. Any help?               <?php                 $pages = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'post_date', 'sort_order' => 'desc' ) );                      foreach ($pages as $page) {                 ?>

<?php echo $page->post_title; ?>
                     <?php echo substr(strip_tags($page->post_content),0,50); ?>                          <a href="<?php echo get_post_permalink($page->ID); ?>">Read More...

                      <?php                          }                 ?>        .htaccess                # BEGIN WordPress         <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /         RewriteRule ^index\.php$ - [L]         RewriteCond %{REQUEST_FILENAME} !-f         RewriteCond %{REQUEST_FILENAME} !-d         RewriteRule . /index.php [L]         </IfModule>          # END WordPress


title: Change global values from templates

text: I am trying to check for a php variable in each of my template in order to assign it a different styling but the value seems to disappear, can you please help, I already spent hours trying to figure this out. I know there is something small I'm missing. So here is everything: I have a page a which links to b and pass a value in the URI as www.b.com/?value=h now the b file receive the value and change the global variable's value to the one passed in the URI, then redirect back to the page. This is the code in my b file: ` $server = $_SERVER["REQUEST_URI"]; $valuePos = stripos($server, "="); $nodes = substr($server, ($valuePos + 1)); $endPos = stripos($server, "e"); $gender = substr($server, ($valuePos + 1), ($endPos)); $valuePos = stripos($nodes, "-"); $redirecturl = substr($nodes, ($valuePos + 1)); header( 'Location: '.$redirecturl ); ` $gender is the global variable that I have declared in function.php, I have set its default value to neutral. Now when I try to access $gender from another template it just displays the default value (neutral). Please help


title: Wordpress add_permastruct unwanted matches

text: I'm working on a project which involves filtering some customs posts on the front-end. I managed to create the permalinks including a custom field, but it seems that the rewrite rule matches some unwanted pages, making them not display-able on the frontend. The code I use for rewriting :               $wp_rewrite->add_rewrite_tag('%competition%', '([^/]+)', 'competition=');     $wp_rewrite->add_rewrite_tag('%prize_category%', '([^/]+)', 'prize_category=');     $wp_rewrite->add_permastruct('competition', '/au/%prize_category%/%competition%/', false);      The problem is the following. It does what it should do for this url: `http://example.com/au/win-a-holiday/win-a-long-weekend-at-the-rees-hotel- queenstown/` But it also matches this one: `http://example.com/au/win-a-holiday/` Is there anyway I could force the second parameter `%competition%` to be **mandatory**? So the rule will apply only for URLs like: `http://example.com/au/param1/param2` not for `domain.com/au/param1/` ? Thanks, George


title: Trying to get property of non-object wordpress error message

text:
I am running the really-simple-facebook-twitter-share-buttons. I have placed the below code on my site as the plug in recommends, which is:
<?php echo really_simple_share_publish();?>
      This plugin is working on all of my site, except I have a custom taxonomy page that is causing the following error with the plugin: Notice: Trying to get property of non-object in /home3/answr/public_html/wp- includes/post-template.php on line 29 I have reviewed line 29 and here is what I think is happening. My taxonomy page has two main custom queries built into it and two wordpress loops. These queries modify the main wordpress query for the page. It seems if the first query does not return results then it causes the error above if the plugin is active. However, if the first query returns results then there is no error and the plugin works fine even if the second query returns results. And if the plugin is not active I get no error whether the first query returns results or not. Here is my code for reference. I have been trying to solve this for some time and I am out of ideas. Does anyone have ideas what could be causing this issues or what I should try to solve it. Thank you!               <?php              query_single('dealers', 'publish', '1', $taxtype, $value);     ?>          <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); ?>          <?php           $address=get_post_meta($post->ID, 'wpcf-street_address', TRUE);      $city=get_post_meta($post->ID, 'wpcf-city', TRUE);      $state=get_post_meta($post->ID, 'wpcf-state_abbreviation', TRUE);      $zip=get_post_meta($post->ID, 'wpcf-zip_code', TRUE);      $phone=get_post_meta($post->ID, 'wpcf-phone_number', TRUE);      $paid=get_post_meta($post->ID, 'wpcf-paid', TRUE);     $post_id=get_the_ID();     get_each_dealer_brand($post_id);?>          <?php      echo "
";     if($paid==1)     {         echo "

";the_title();echo "

";         echo "

$address | $city, $state $zip

";         echo "

P: $phone

";             echo "

$brands_list

";     }     echo "
";     ?>          <?php endwhile; ?>          <?php          wp_reset_query();      wp_reset_postdata();      unset($brands_list);     ?>          <?php else : ?>          <?php               $paidnull="true";     ?>          <?php endif; ?>          <?php              query_single('dealers', 'draft', '0', $taxtype,  $value);     ?>               <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); ?>                    <?php $address=get_post_meta($post->ID, 'wpcf-street_address', TRUE);     $city=get_post_meta($post->ID, 'wpcf-city', TRUE);     $state=get_post_meta($post->ID, 'wpcf-state_abbreviation', TRUE);     $zip=get_post_meta($post->ID, 'wpcf-zip_code', TRUE);     $phone=get_post_meta($post->ID, 'wpcf-phone_number', TRUE);     $paid=get_post_meta($post->ID, 'wpcf-paid', TRUE);     $post_id=get_the_ID();     get_each_dealer_brand($post_id);     ?>               <?php      echo "
";     if($paid==0){         echo "

";the_title();echo "

";         echo "

$address | $city, $state $zip

";         echo "

P: $phone

";             echo "

$brands_list

";     }     echo "
";     ?>          <?php endwhile; ?>          <?php /*Resets current query*/     wp_reset_query();      wp_reset_postdata();      unset($brands_list);?>          <?php else : ?>          <?php /*If there were no paid dealer and no non-paid dealers we must show a 404 error*/     if ($paidnull=="true")     {         echo "
There Are No Dealers Found for your Search
";         echo "
Use the search below to search a different area
";         echo "
";     }?>     <?php endif; ?>


title: Use register_post_type() to modify an existing post type

text: There are lots of situations where a theme or plugin registers a post type and you want to modify it. There is of course `add_post_type_support()` and `remove_post_type_support()`, but those don't give access to the full list of arguments that `register_post_type()` takes. In particular, maybe I want to disable a post type archive, hide the admin UI, hide from search, etc. while leaving the rest of the post type settings alone. The Codex page for `register_post_type()` dangles this in front of me: > ## Description > > Create or modify a post type. But in the past, when I've try to do this, it hasn't seemed to work. Is this function really for modifying post types, and if so, can you simply redeclare a couple arguments and leave the rest alone? Seeing that there isn't even a `deregister_post_type()` function, I don't understand how it can be done.


title: Is there a way of putting the facebook social plugins into page template php files?

text: I was wondering if there was any way of putting the features that come with the "Facebook" wordpress plugin, such as comments, recommend and subscribe, on my front page which I created using a template page, like maybe a do_shortcode or get_shortcode solution to put it into the page? Thanks :)


title: Dynamic css for a widget plugin

text:
I have a plugin that creates a widget to show latest posts and I would like to add a dynamic css file to style the post title without using inline styles. So for example i have                public function widget( $args, $instance )         {             extract( $args );             $title = apply_filters('widget_title', $instance['title'] );                  echo $before_widget;             echo $before_title . $title . $after_title;                       // WP_Query arguments             $args = array (             'cat' => $instance['categories'],             'posts_per_page' => $instance['latest_x_posts'],             );                  // The Query             $query = new WP_Query( $args );                  if( $query->have_posts() ) { while( $query->have_posts() ) { $query->the_post();                  ?>
<a href="<? the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?>
          <?php      and                public function form( $instance )         {             $defaults = array(             'title' => 'Latest Posts',             'categories' => NULL,             'latest_x_posts' => 5,             'post_title_color' => ''             );                       $instance = wp_parse_args( (array) $instance, $defaults ); ?>      i need to add a dynamic css...something like this:                     i need someone to point me in the right direction. Thanks


I am working on a plugin settings page and get a 404 page if I post a value containing url value like below.               <input type="hidden" name="<?php echo $profile[ 'id' ]; ?>" value="<?php echo (urlencode('http://adnan.pk')); ?>">      I have tried a lot of functions like esc_url and esc_url_raw but this problem is only with URL's :(


title: Filtering in admin broken for custom post type in 3.8.1?

text: Is there a known issue with the All, Published, Scheduled and Drafts filters in the post listing page for custom post types for 3.8.1? The links update as well as the URL, but the listing doesn't refresh. It even appears that the query isn't paging as well.


title: Filtering the Comment Form Allowed Tags

text: How can I remove some of the allowed HTML tags in comments/posts? For whatever reason, the following code, placed in my theme's `functions.php`, didn't work:               add_action('init', 'my_html_tags_code', 10);     function my_html_tags_code() {         define('CUSTOM_TAGS', true);         global $allowedposttags, $allowedtags;         $allowedposttags = array(             'strong' => array(),             'em' => array(),             'pre' => array(),             'code' => array(),             'a' => array(               'href' => array (),               'title' => array ())         );              $allowedtags = array(             'strong' => array(),             'em' => array(),             'a' => array(               'href' => array (),               'title' => array ())         );     }      Tags such as `<div>` or `<pre>` are still available when commenting.


title: Fatal error when accessing Pages in WP admin (and problems editing any pages)

text: I have a site that's been going for about 4 years with several hundred pages. I've had strange problems when accessing the Pages section (to choose a page for editing) and while in Page editing. These have been resolved (up until now) by deactivating plugins down to the bare minimum (three that are essential for the user experience), then working on page creation or editing, then reactivating plugins. The symptoms were two-fold: Pages - this showed up totally blank; could not see any pages listed Individual page editing (if I used the Edit Page option in the admin bar) - the page contents would be white, although I could use my mouse to select text in this area (it would highlight, showing it was there) - and the lower section would only show a couple of the panels (it would stop loading the page) Today I reached the point where I had errors even if I deactivated all plugins, so I need some urgent help. I did a cleanup on the database which pared it down from 93 mb to 58 mb (removing page revisions, optimizing database tables, etc.) and now I can edit pages as long as I deactivate all plugins. However, I'm concerned that the problem will get worse, and that I won't be able to do any page creation or editing at all. At this point, when I'm only loading two plugins (the very bare minimum for users to be able to navigate the site and watch videos - EmbedIt and JC Submenu) I'm getting the following error message when I access the Pages section of the admin area: Fatal error: Out of memory (allocated 147587072) (tried to allocate 72 bytes) in /homepages/30/d364769427/htdocs/acbestpractices/wp-includes/meta.php on line 778 If anyone has any ideas for what I can do to fix the issue, I'd be most grateful. I will also appreciate referrals to someone who can troubleshoot and fix this for a reasonable consulting fee; feel free to offer your own services if appropriate.


title: pingbacks testing

text: I have a few questions regarding functionality testing of PBs in a new wp installation (3.0.4):   1. Are pingbacks sent immediately when a post is published, or are they scheduled as a cron job? If the later is correct, how often does the job run and can I trigger it manually?   2. Are there any other terms for PBs to be sent besides having "Attempt to notify any blogs linked to from the article" set to on, and of course a link to another blog in the post content? (for example, should the sender post be public and not private? should the blog be non private?)   3. Should the outbound link be placed in the post content or can it be placed in a custom field of the post in order for the PB to be sent?   4. In case PBs are not sent nor received in my blog, what is the best way to debug and detect the problem? Thanks in advance!


title: How to avoid conflict of plugin style and theme style?

text: I have used twitter bootstrap to my plugin. But after install the plugin, it is changing style of the theme that has already bootstrap. How can i avoid this conflict?


title: Get monthly archives for custom post type

text: I know this is a rather common topic, but I can't seem to resolve the issue I'm having. Any help is greatly appreciated, I'm spinning my wheels at this point. Using Custom Post Type UI plugin, I've created some custom post types (I'll use 'blog' in this example). I've set has_archive => true, and I've also used a plugin called Custom Post Type Archives to get my pagination to work properly. So far, I have my permalinks, tags, categories and pagination working. However, the issue is when I try to use the wp_get_archives function. I understand this doesn't grab CPTs, so I've used the function that comes with the Custom Post Type Archives Plugin (wp_get_custom_post_archives). Depending on how I tweak the arguments, it spits out either a 404, or it loads the archives, but just displays every entry (not just those specific to the selected month). Ideally, I just want it to display monthly archives.               <?php wp_get_post_type_archives('blog');      Take a look here: http://www.metropoliscreative.com/coding/w/blog/ I've used this to register the post type and believe I've done it properly. Not sure what I'm doing wrong at this point.               register_post_type('blog', array(                'label' => 'Blog',             'description' => 'Blog Entries',             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'capability_type' => 'post',             'hierarchical' => false,             'rewrite' => array(                 'slug' => 'blog'),             'has_archive' => true,         'query_var' => true,         'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),         'taxonomies' => array('category','post_tag',),         'labels' => array (           'name' => 'Blog',           'singular_name' => 'Blog',           'menu_name' => 'Blog',           'add_new' => 'Add Blog',           'add_new_item' => 'Add New Blog',           'edit' => 'Edit',           'edit_item' => 'Edit Blog',           'new_item' => 'New Blog',           'view' => 'View Blog',           'view_item' => 'View Blog',           'search_items' => 'Search Blog',           'not_found' => 'No Blog Found',           'not_found_in_trash' => 'No Blog Found in Trash',           'parent' => 'Parent Blog',         ),) );


title: Custom sidebars - get_sidebar() problems

text: I want to have different sidebars on different pages. So firstly I registered a few basic sidebars in functions.php. So they will be always there no matter where I move my theme. Let's name them Standard Sidebar, Special Sidebar, Tiny Sidebar. The next step was creating sidebars metabox below posts and pages. It lists all the sidebars using foreach $GLOBALS['wp_registered_sidebars'] loop and allows user to pick one. Now, here comes the trouble. I don't know how to display my sidebars. I have a meta value but get_sidebar() accepts only names from sidebar.php file. What about registered (not included in sidebar.php) sidebars? I know I could add all my sidebars to sidebar.php/save them as sidebar- name.php, but again, I'm going to use sidebar generator to add addtional sidebars to three basic ones. Any ideas, walk-troughs how to accomplish this? Displaying registered sidebars by name will be a serious breakthrough in my case.


title: Custom "Insert into Post" button

text: I am trying to make a simple plugin that sets a background image. I have it linked to the media library so that when you click "Insert into Post" it does a custom function. However, obviously this custom function is undesirable in any other context. As such I would like to make a separate button "Make Background" that would call the custom function. Any ideas? Thanks


title: Set a Category As My Homepage using add_rewrite_rule

text: When someone visits the homepage of my wordpress site: http://www.mysite.com/wordpress/ I want them to see the contents of this page: http://www.mysite.com/wordpress/category/cars/ Attempt # 1: adding the following block of code in my theme's functions.php:               function add_my_rule() {         global $wp;          $wp->add_query_var('args');            add_rewrite_rule('/', 'category/cars/', 'top');     }     add_action('init', 'add_my_rule');      Nothing. As an experiment, I thought I'd try to see if I could make every page redirect to a specific page, so I tried the above, but with different arguments to add_rewrite_rule:               add_rewrite_rule('^.*$', 'index.php?page_id=3', 'top');      Again, nothing. Attempt # 2: the following code in functions.php:               function wpse_asc_cat_pages( $query ) {         if ( $query->is_home() && $query->is_main_query() ) {             $query->set( 'cat', 26 );         }     }     add_action( 'pre_get_posts', 'wpse_asc_cat_pages' );      Again, nothing.


title: Display feeds from twitter

text:
I have rss feeds from my twitter account I am using the following code to display the feeds but no able to do so. Result is no item.               <?php // Get RSS Feed(s)     include_once( ABSPATH . WPINC . '/feed.php' );          // Get a SimplePie feed object from the specified feed source.     $rss = fetch_feed( 'https://script.google.com/macros/s/AKfycbyp8Wwo8-dxWdPjO0atNZJbKPpy0LRaDTszisMWZhsdXU0XYOs/exec' );          if ( ! is_wp_error( $rss ) ) : // Checks that the object is created correctly              // Figure out how many total items there are, but limit it to 5.          $maxitems = $rss->get_item_quantity( 5 );               // Build an array of all the items, starting with element 0 (first element).         $rss_items = $rss->get_items( 0, $maxitems );          endif;     ?>
         <?php if ( $maxitems == 0 ) : ?>
<?php _e( 'No items', 'my-text-domain' ); ?>
         <?php else : ?>             <?php // Loop through each feed item and display each item as a hyperlink. ?>             <?php foreach ( $rss_items as $item ) : ?>
                     <a href="<?php echo esc_url( $item->get_permalink() ); ?>"                         title="<?php printf( __( 'Posted %s', 'my-text-domain' ), $item->get_date('j F Y | g:i a') ); ?>">                         <?php echo esc_html( $item->get_title() ); ?>
             <?php endforeach; ?>         <?php endif; ?>


title: Setting pagination for images attached to a post

text: I am trying to figure out how to paginate a post for it's images. I have a custom post type set up to act like a gallery - images only. And would like to paginate the images. I am having a hard time trying to figure out where to start with this. I am using get_posts() within the loop to get the images attached to the post. I would like to set it up so 30 images display per page. Any idea where I should start? Or do I need to alter the way I have this gallery feature set up in WP? Thanks in advance!


title: Possible to “Attach” images to multiple posts without uploading twice from Add media Section?

text: How can I attach images to a post which have already been attached to other posts without having to upload them twice? I don't want to insert the images into the post, I simply want to attach the same set of images to multiple posts.


title: Wordpress plugin with its own "site"/theme

text: I am currently starting a plugin development project and ideally I'd like the plugin to run using its own custom theme as if it was it's own separate thing. Is it possible to include a theme within the plugin that has its own custom page layout etc and would only use that template when the related pages are accessed? The idea is to have the ability for users to log-in to a members only area using wordpress' log-in. Is this possible or something I need to rethink? Thanks


title: Why WP_Query::is_date() returns false when 'date_query' argument is set?

text: WordPress 3.7 introduced 'date_query' argument for `WP_Query`. That's pretty useful and allow very complex date-based queries, however something strange happen when using `WP_Query` conditional methods on query using that argument. Example:               $args = array(            'tax_query'=> array(         'relation' => 'AND',         array(           'taxonomy' => 'category',           'field'    => 'slug',           'terms'    => 'uncategorized'         ),         array(           'taxonomy' => 'post_tag',           'field'    => 'slug',           'terms'    => array('foo', 'bar')         )       ),            'date_query' => array(          array(            'year'  => $today["year"],            'month' => $today["mon"],            'day'   => $today["mday"],          )       )          );          $query = new WP_Query( $args );      The query should returns posts posted today and having 'uncategorized' category or 'foo' and 'bar' tags. And it does, so far so good. Now consider the following conditional methods:               $query->is_archive();  // returns true, as guessable     $query->is_category(); // returns true, as guessable     $query->is_tag();      // returns true, as guessable      but               $query->is_date();  // returns false     $query->is_day();   // returns false     $query->is_month(); // returns false     $query->is_year();  // returns false      I thought that the problem can be caused by the fact I mixed 'tax_query' and 'date_query', but that's not the problem, proof:               $args = array(       'date_query' => array(          array(            'year'  => $today["year"],            'month' => $today["mon"],            'day'   => $today["mday"],          )       )     );          $query = new WP_Query( $args );          $query->is_date();    // returns false     $query->is_day();     // returns false     $query->is_month();   // returns false     $query->is_year();    // returns false     $query->is_archive(); // returns false this time      Is this a bug, or I'm missing something? (I've searched WP Trac, but found nothing related).


title: When sending a newsletter -not with wordpress- the server has 100% cpu

text: When sending a newsletter (not with wordpress, but with another external newsletter campaign tool) to **3,298 recipients** , we have unique opens: **155** , the server has 100% cpu from too many httpd instances and mysql. The dedicated machine...   CentOS Linux 6.5   Linux 2.6.32-431.17.1.el6.x86_64 on x86_64   Webmin version: 1.701   Proccessors: 4   Real memory: 15.57 GB total   Virtual memory: 4 GB total   Apache/2.2.15 (Keep Alive On)   MySQL v.5.1.73-log   PHP v.5.3.3   APC v.3.1.13   ![APC Stats](http://i.stack.imgur.com/EEHLS.jpg) WordPress 3.9.2 running Bucket (http://themeforest.net/item/bucket-a-digital- magazine-style-wordpress-theme/6107209) Child theme.   Database size = 1.6 GB   wp_posts = 118999 (rows)   wp_postmeta = 1656568 (rows) WordPress Plugins running   1\. Additional Image Sizes (zui)   2\. Contact Form 7   3\. Custom User Profile Photo   4\. Disqus Comment System   5\. Google Analytics for WordPress   6\. Newsletter Pro   7\. NextGEN Gallery by Photocrati   8\. NextScripts: Social Networks Auto-Poster   9\. P3 (Plugin Performance Profiler)   10\. PixCodes   11\. PixTypes   12\. Post title marquee scroll   13\. UBM Premium   14\. Vixy YouTube Embed   15\. W3 Total Cache (APC enabled)   16\. Wordfence Security   17\. WP-Optimize   18\. Yet Another Related Posts Plugin from **wp-confing.php**               /** Enable W3 Total Cache */       define('WP_CACHE', true); // Added by W3 Total Cache       /** Enable W3 Total Cache */            define( 'AUTOMATIC_UPDATER_DISABLED', true );       define('DISABLE_WP_CRON', true);       define( 'DISALLOW_FILE_EDIT', true );            define('WP_MEMORY_LIMIT', '256M');       define('WP_MAX_MEMORY_LIMIT', '512M');        Results from MySQLTuner script               MySQLTuner 1.3.0 - Major Hayden <major@mhtx.net>       Run with '--help' for additional options and output filtering       [OK] Currently running supported MySQL version 5.1.73-log       [OK] Operating on 64-bit architecture            -------- Storage Engine Statistics -------------------------------------------       [--] Status: +CSV +InnoDB +MRG_MYISAM       [--] Data in MyISAM tables: 442M (Tables: 25)       [--] Data in InnoDB tables: 1G (Tables: 68)       [!!] Total fragmented tables: 61            -------- Security Recommendations  -------------------------------------------       [OK] All database users have passwords assigned            -------- Performance Metrics -------------------------------------------------       [--] Up for: 5d 21h 7m 0s (35M q [70.046 qps], 379K conn, TX: 152B, RX: 7B)       [--] Reads / Writes: 59% / 41%       [--] Total buffers: 5.9G global + 4.2M per thread (500 max threads)       [OK] Maximum possible memory usage: 8.0G (51% of installed RAM)       [OK] Slow queries: 0% (23K/35M)       [OK] Highest usage of available connections: 17% (88/500)       [OK] Key buffer size / total MyISAM indexes: 128.0M/75.2M       [OK] Key buffer hit rate: 99.8% (101M cached / 155K reads)       [OK] Query cache efficiency: 46.9% (11M cached / 23M selects)       [OK] Query cache prunes per day: 0       [OK] Sorts requiring temporary tables: 1% (30K temp sorts / 1M sorts)       [!!] Temporary tables created on disk: 32% (1M on disk / 4M total)       [OK] Thread cache hit rate: 99% (259 created / 379K connections)       [!!] Table cache hit rate: 0% (96 open / 64K opened)       [OK] Open file limit used: 0% (2/65K)       [OK] Table locks acquired immediately: 99% (21M immediate / 21M locks)       [OK] InnoDB buffer pool / data size: 4.0G/1.0G       [OK] InnoDB log waits: 0       -------- Recommendations -----------------------------------------------------       General recommendations:           Run OPTIMIZE TABLE to defragment tables for better performance           Temporary table size is already large - reduce result set size           Reduce your SELECT DISTINCT queries without LIMIT clauses           Increase table_cache gradually to avoid file descriptor limits           Read this before increasing table_cache over 64:       Variables to adjust:           table_cache (> 64)        Can someone please suggest what to look for?   Thank you!


title: How to dynamically resize the height of an iframe

text: On my pages I have few `[iframe src="myHtmlDocument.html"...]` built on the iframe plugin which I use to embed JavaScript in my pages. `myHtmlDocument.html` is a simple html document with text-only content and few script to dynamically visualise information from a database. I am struggling on how to set the height of the iframe to make it dynamically adapt to different browsers. Indeed if I set the height of the iframe with `height="xxx"` the page may visualise correctly on one browser and not with a different one depending on the zoom level (I think). I tested the same page on Firefox on a Mac and Safari on the iPhone and while Firefox visualise the entire content of `myHtmlDocument.html` on the iPhone I am only able to visualise part of it. I tried different configuration of the option `same_height_as` of the plugin but I didn't seem to be able to influence the height at all.