title: How can I order metaboxes in my posts in WordPress?

text:
hello i did add a custem filed and this is my code               add_action( 'add_meta_boxes', 'cd_meta_box_add' );     function cd_meta_box_add()     {         add_meta_box( 'my-meta-box-id', 'المعلومات الرئيسية لفلل مشروع', 'cd_meta_box_cb', 'post', 'normal', 'high' );     }          function cd_meta_box_cb( $post )     {         $values = get_post_custom( $post->ID , true);         $text1 = get_post_meta( $post->ID, 'my_meta_box_text1', true );         $text2 = get_post_meta( $post->ID, 'my_meta_box_text2', true );         $text3 = get_post_meta( $post->ID, 'my_meta_box_text3', true );         $text4 = get_post_meta( $post->ID, 'my_meta_box_text4', true );         $text5 = get_post_meta( $post->ID, 'my_meta_box_text5', true );         $text6 = get_post_meta( $post->ID, 'my_meta_box_text6', true );         $textarea = get_post_meta( $post->ID, 'my_meta_box_textarea', true );         $text7 = get_post_meta( $post->ID, 'my_meta_box_text7', true );         $text8 = get_post_meta( $post->ID, 'my_meta_box_text8', true );         $text9 = get_post_meta( $post->ID, 'my_meta_box_text9', true );         $text10 = get_post_meta( $post->ID, 'my_meta_box_text10', true );         $text11 = get_post_meta( $post->ID, 'my_meta_box_text11', true );         $textarea2 = get_post_meta( $post->ID, 'my_meta_box_textarea2', true );         $text12 = get_post_meta( $post->ID, 'my_meta_box_text12', true );         $text13 = get_post_meta( $post->ID, 'my_meta_box_text13', true );         $text14 = get_post_meta( $post->ID, 'my_meta_box_text14', true );         $text15 = get_post_meta( $post->ID, 'my_meta_box_text15', true );         wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );         ?>
             حالة المشروع             <input type="text" name="my_meta_box_text1" id="my_meta_box_text1" value="<?php echo $text1; ?>" />

             الموقع             <input type="text" name="my_meta_box_text2" id="my_meta_box_text2" value="<?php echo $text2; ?>" />

             مساحة الأرض             <input type="text" name="my_meta_box_text3" id="my_meta_box_text3" value="<?php echo $text3; ?>" />

             مساحة البناء             <input type="text" name="my_meta_box_text4" id="my_meta_box_text4" value="<?php echo $text4; ?>" />

             عدد الادوار             <input type="text" name="my_meta_box_text5" id="my_meta_box_text5" value="<?php echo $text5; ?>" />

             عدد الغرف             <input type="text" name="my_meta_box_text6" id="my_meta_box_text6" value="<?php echo $text6; ?>" />

             المواصفات             <textarea name="my_meta_box_textarea" id="my_meta_box_textarea"><?php echo $textarea; ?></textarea>

             نوع الفيلا             <input type="text" name="my_meta_box_text7" id="my_meta_box_text7" value="<?php echo $text7; ?>" />

             التشطيب ونوعية التصميم             <input type="text" name="my_meta_box_text8" id="my_meta_box_text8" value="<?php echo $text8; ?>" />

             تأسيس المصاعد ويشمل             <input type="text" name="my_meta_box_text9" id="my_meta_box_text9" value="<?php echo $text9; ?>" />

             تأسيس تمديدات التكييف ويشمل             <input type="text" name="my_meta_box_text10" id="my_meta_box_text10" value="<?php echo $text10; ?>" />

             المسبح             <input type="text" name="my_meta_box_text11" id="my_meta_box_text11" value="<?php echo $text11; ?>" />

             الضمانات             <textarea name="my_meta_box_textarea2" id="my_meta_box_textarea2"><?php echo $textarea2; ?></textarea>

             ضمان المبنى - سنوات             <input type="text" name="my_meta_box_text12" id="my_meta_box_text12" value="<?php echo $text12; ?>" />

             ضمان تمديدات الكهرباء - سنوات             <input type="text" name="my_meta_box_text13" id="my_meta_box_text13" value="<?php echo $text13; ?>" />

             ضمان تمديدات السباكة - سنوات             <input type="text" name="my_meta_box_text14" id="my_meta_box_text14" value="<?php echo $text14; ?>" />

             ضمان المسابح - سنوات             <input type="text" name="my_meta_box_text15" id="my_meta_box_text15" value="<?php echo $text15; ?>" />
                        <?php        }                    add_action( 'save_post', 'cd_meta_box_save' );     function cd_meta_box_save( $post_id )     {         // Bail if we're doing an auto save         if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;              // if our nonce isn't there, or we can't verify it, bail         if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;              // if our current user can't edit this post, bail         if( !current_user_can( 'edit_post' ) ) return;              // now we can actually save the data         $allowed = array(              'a' => array( // on allow a tags                 'href' => array() // and those anchords can only have href attribute                  )         );              // Probably a good idea to make sure your data is set                 if( isset( $_POST['my_meta_box_text1'] ) )             update_post_meta( $post_id, 'حالة المشروع', wp_kses( $_POST['my_meta_box_text1'], $allowed ) );         if( isset( $_POST['my_meta_box_text2'] ) )             update_post_meta( $post_id, 'الموقع', wp_kses( $_POST['my_meta_box_text2'], $allowed ) );                      if( isset( $_POST['my_meta_box_text3'] ) )             update_post_meta( $post_id, 'مساحة الأرض', wp_kses( $_POST['my_meta_box_text3'], $allowed ) );                 if( isset( $_POST['my_meta_box_text4'] ) )             update_post_meta( $post_id, 'مساحة البناء', wp_kses( $_POST['my_meta_box_text4'], $allowed ) );                 if( isset( $_POST['my_meta_box_text5'] ) )             update_post_meta( $post_id, 'عدد الغرف', wp_kses( $_POST['my_meta_box_text5'], $allowed ) );                 if( isset( $_POST['my_meta_box_text6'] ) )             update_post_meta( $post_id, 'عدد الأدوار', wp_kses( $_POST['my_meta_box_text6'], $allowed ) );              if( isset( $_POST['my_meta_box_textarea'] ) )             update_post_meta( $post_id, '
', esc_attr( $_POST['my_meta_box_textarea'] ) );                         if( isset( $_POST['my_meta_box_text7'] ) )             update_post_meta( $post_id, 'نوع الفيلا', wp_kses( $_POST['my_meta_box_text7'], $allowed ) );                         if( isset( $_POST['my_meta_box_text8'] ) )             update_post_meta( $post_id, 'التشطيب ونوعية التصميم', wp_kses( $_POST['my_meta_box_text8'], $allowed ) );             if( isset( $_POST['my_meta_box_text9'] ) )             update_post_meta( $post_id, 'تأسيس المصاعد ويشمل', wp_kses( $_POST['my_meta_box_text9'], $allowed ) );             if( isset( $_POST['my_meta_box_text10'] ) )             update_post_meta( $post_id, 'تأسيس تمديدات التكييف ويشمل', wp_kses( $_POST['my_meta_box_text10'], $allowed ) );             if( isset( $_POST['my_meta_box_text11'] ) )             update_post_meta( $post_id, 'المسابح', wp_kses( $_POST['my_meta_box_text11'], $allowed ) );                 if( isset( $_POST['my_meta_box_textarea2'] ) )             update_post_meta( $post_id, '
', esc_attr( $_POST['my_meta_box_textarea2'] ) );             if( isset( $_POST['my_meta_box_text12'] ) )             update_post_meta( $post_id, 'ضمان المبنى - سنوات', wp_kses( $_POST['my_meta_box_text12'], $allowed ) );             if( isset( $_POST['my_meta_box_text13'] ) )             update_post_meta( $post_id, 'ضمان تمديدات الكهرباء - سنوات', wp_kses( $_POST['my_meta_box_text13'], $allowed ) );             if( isset( $_POST['my_meta_box_text14'] ) )             update_post_meta( $post_id, 'ضمان تمديدات السباكة - سنوات', wp_kses( $_POST['my_meta_box_text14'], $allowed ) );             if( isset( $_POST['my_meta_box_text15'] ) )             update_post_meta( $post_id, 'ضمان المسابح - سنوات', wp_kses( $_POST['my_meta_box_text15'], $allowed ) );          }      i have 2 problems th first one it cant be edit because it become an empty value after saving and the secode problem that it dosent apear by the way it order in code the order become sooooo bad in posts the first meta become the second and the 5 become 10 and the order soooo bad i am so sorry for my bad english but i really need help in this please : ( and i am going crazy i dont know how i do fix meta order inside posts


title: List custom taxonomy as navigation - taxonomy pages with all it's posts?

text: I have no idea how to do this and really need your help please … First I created a custom-post-template called "wr_event" - then I added a custom taxonomy (like categories) to this post-template!               register_taxonomy(         'Type of event',         'wr_event',         array(             'taxonomy' => 'event_type',             'label' => 'Types',             'singular_label' => 'Type',             'hierarchical' => true,             'rewrite' => true)     );      I did all that in my `functions.php` file. The "types" I created in my taxonomy in the wp-backend right now are "Lectures", "Workshops", "Festivals". If I create a post (event) and assign it to a "category" (taxonomy) I get this url `localhost.com/lectures/my-post-title` and the `single-wr_event.php` template is used. This is already a big step towards what I finally want. What I don't know is how I can now kind of create `pages` for my taxonomies like it automatically works for posts and categories? e.g. I said I have this right now: `localhost.com/lectures/my-post-title` but when I just enter `localhost.com/lectures/` I want all the posts assigned to this taxonomie listed. And I'd like to add a navigation in my header that lists all taxonomies I created just like 'wp_list_categories'. Any ideas on how to this?


I need to receive some special $_GET parameters for a custom page I'm making, i know how to receive this through a simple $_GET like mysite.net/products/?id=1 , but I wanted to use the URL style of my WordPress like mysite.net/products/1. How to retrieve $_GET variables from rewritten URLs?


title: Is it possible to skip certain specified pages when using < prev and next > links?

text: thanks for taking a minute to read my question. I've done some googling and I can't seem to find the answer to this question anywhere. Forgive me if it's somewhere here on stack exchange already. I'm using this plugin to allow "< prev" and "next >" links in my set of pages. I can change the page order using the wordpress admin menu, so this is almost perfect. However, I have a couple of pages I would like to skip in the "previous" and "next" loop. For instance - I'm using a static home page. At one point, the "next" link links over to the home page. I'd like to exclude the home page and a couple others from this loop. Is this possible? What's the best way to do this? Thanks! Tim P. S. The plugin works pretty much the same way as Next/Prev post built-in functionality works. I'm assuming if there's a way to exclude posts from this loop, that it will work the same way for pages with the plugin. Thanks


title: flexible rewrite 'ramble' URLs with Wordpress

text: I want to access my post with id 17 like this: http://localhost/archives/17/moot-bla-foo-ramble In other words, the id shall decide, everything thereafter may (or may not) be the slug or anything else. Much like these links leading to the same page (many other sites do the same):   * http://www.amazon.de/pair-of-blue-suede-shoes/dp/B005EFYRF0   * http://www.amazon.de/nice-fancy-coffee-maker/dp/B005EFYRF0 I tried to define a rewrite-rule like this near the top of my .htaccess:               RewriteRule ^archives/(\d{1,12})(?:/.*) archives/$1 [NC]      This _almost_ works, i.e. goes to the right page, but get's me a page-not- found then, because wordpress looks at PATH_INFO again (I think) and states `$query_string` now is `string attachment=moot-bla-foo-ramble` I do not want to do a 301 redirect. My favourite or course, if such thing existed in Permalink Settings:Custom Structure               /archives/%post_id%/%wildcard%      Albeit that would make the 'ramble' mandatory, so even better...               /archives/%post_id%(/%wildcard%)?      wishful thinking, I guess.


title: Display posts in alphabetical order for a particular category

text: I`m looking for a solution to dispaly posts in alpahbetical order if category is "Glossary" otherwise display the posts in ascending order. When I tried the following code its works perfect for category Glossary,but the order of other posts went wrong.               <?php global $query_string;           if(is_category('Glossary'))     {     query_posts($query_string . "&orderby=title&order=ASC");     while ( have_posts() ) : the_post();     the_title();     endwhile;                          }     else{     query_posts($query_string . "&order = ASC"); ?>                  <?php while ( have_posts() ) : the_post(); ?>                         <?php  the_title(); ?>                          <?php endwhile; ?>     <?php } ?>      Hope someone will help me to solve the problem.


title: Galleries of images attached to posts

text: I have several "categories" and so called "projects" (post of content type "project"). To each project corresponds a category. What I call a "gallery", is several images, with each image attached several strings to (description, author). To each category and to each project should be attached a gallery. If to a project a gallery isn't attached, on the project page the gallery of the category should be shown. (Note that what I call here "categories" may or may not be the same as what is called "categories" in the manuals of WordPress.) How to do it in WordPress?


title: Too much recursion error when chosing image from image library for two different meta boxes in one post

text: There must be a solution for this. I am using this solution for chooosing images from media library. http://www.webmaster-source.com/2010/01/08/using- the-wordpress-uploader-in-your-plugin-or-theme/ THE PROBLEM: I am using two meta boxes for custom post type “products”. First consists of two metafields what is for adding two addition product pictures The second one is for creating a simple gallery for this product. Each of them has their own tb_show and window.send_to_editor stuff. The thing is that everything works fine when there are registered only one metabox – the first or the second. If there are registered both of them, the last registered via add_meta_box , brings the error in firebug “ **too much recursion”** when pressing “Insert into post” button. How to solve this? This is very mission critical, to have two of the metaboxes in post, to add different type of images? Also, the default Insert image in to post should work. Maybe someone has a class for this because I see, the problem is if there are two original_send_to_editor functions registered in one post page.


title: How to change the wording in wp-admin back-end?

text: I don't want to edit core files in order to change the page where a user enters new posts, so is there a way to do it within a theme, perhaps within functions.php ..? Specifically, I'm trying to change the wording of the 'Set featured image' text to something like 'Set featured image - 50 pixels by 50 pixels'


title: How can I make a WordPress database portable and url independent?

text: ## Issue I am about to embark on some WordPress development in a multi person team environment. (3 or more people working on the same codebase at a time, each developing locally) With other CMSes we have worked with, everyone has pointed their installs at the same database and because of how that CMS/database has worked, it has meant we can all have the same content feeding into our installs (located at differing urls) from the same database without much issue (other than occasionally having to sync uploads folders) My question is, with WordPress, what prevents us from using this same approach and how can we solve these issues? eg. Three copies of WordPress all running off of the same database. http://dev.local/developer-a/   http://dev.local/developer-b/   http://dev.local/developer-c/ etc I hope it goes without saying that this will only be in a development environment prior to launch. ## Main issues   1. References to specific urls within the database (`wp_posts` and `wp_options` tables it seems)   2. If one person installs a plugin, the other installs won't have it and will cause concurrency issues in the database   3. Keeping uploads folders in sync ## Current Solution Currently I have the beginnings of a solution for the first issue in place. I place the following in a file in my mu-plugins folder. The code essentially filters the post content as it goes into and out of the database by replacing any instance of the url with a unique token.               <?php          define('PORTABILITY_TOKEN', '{_portable_}');          function portability_remove_home($content)     {         $content = str_replace(get_option('home'), PORTABILITY_TOKEN, $content);              return $content;     }          add_filter('content_save_pre', 'portability_remove_home');          function portability_add_home($content)     {         $content = str_replace(PORTABILITY_TOKEN, get_option('home'), $content);              return $content;     }          add_filter('the_content', 'portability_add_home');     add_filter('the_editor_content', 'portability_add_home');      I have set the home and siteurl options via php using the environment of where WordPress is installed to work them out. (again, this is for development only) This means that to each individual install WordPresses post content will look like it is running on that url by the time it gets to the client.               <?php     if (!defined('WP_HOME'))     {         // define WP_HOME (aka url of install) based on environment.         // IF THIS ISN'T WORKING, DEFINE IT EARLIER.         define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . str_replace($_SERVER['DOCUMENT_ROOT'], '', dirname(__FILE__) ) );     }          if (!defined('WP_SITEURL'))     {         // Assumes WordPress is in a separate directory called 'wp', relative to WP_HOME.         // IF IT'S DIFFERENT, DEFINE IT EARLIER.         define('WP_SITEURL', WP_HOME . '/wp');     }      The second and third issues seem solvable with the appropriate symlinks (all developing on the same machine) ## Actual Questions   1. Can I improve my handling of the differing urls in anyway? Is there anything I have missed that will have the url hardcoded into the database?    2. Any gotchas I should be aware of with the symlinking?   3. Any other issues anyone can think of? I realise these questions are very specific, if anything is unclear, comment on this and I will amend / clarify. Thanks.


title: Server crashed trying to restore wordpress multisite, images are not found pls help

text: I had an issue with a server that was serious enough to have to take it completely offline and then rebuild the os. I have gotten to the point where the new server is up and running. I have managed to get all the wordpress files and database files transfered over to the new server. **The Problem** For some reason wordpress is not finding any of the images stored in the wp- content/blogs.dir/... folder. One thing I did notice is that the htaccess file was not copied over, so my best guess is because wordpress reroutes via /folders/ etc that this may be the problem. I did take the distrubtion .htaccess file that I was able to find and added that into the site, but it is not working. Is htaccess the problem? If so how do I regenerate one that will work for the multisite subdomain setup? thanks


title: Slider do not add alt attribute. Cant get alt attribute from a media library!

text:
I use a slider to show my post thumbnails. But the problem is that the slider adds thumbnails without the `alt` attribute:   `<img src="http://example.com/wallpaper-791556-1180x500.jpg" />` But I want to have the `alt` attribute, as you may already guessed. I've read a lot about it and about array, but had not succeed in fixing it. I really hope, someone would be so kind to help me. The CODE that post images:   `

 <?php $count = of_get_option('w2f_slide_number'); $slidecat =of_get_option('w2f_slide_categories'); query = new WP_Query( array( 'cat' =>$slidecat,'posts_per_page' =>$count ) ); if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); ?>
 <?php $thumb = get_post_thumbnail_id(); $img_url = wp_get_attachment_url( $thumb,'full' ); //get full URL to image (use "large" or "medium" if the images too big) $image = aq_resize( $img_url, 1180, 500, true ); //resize & crop the image ?> <?php if($image) : ?> <a href="<?php the_permalink(); ?>"><img src="<?php echo $image ?>"/> <?php endif; ?>

<?php the_title(); ?>
 <?php print_excerpt(300); ?>
 <?php endwhile; endif; ?>

` And another problem is `
 ` do not show alt too! How can I fix that or where shoud I look for the code of this homegallery? **SOLVED IT!**


title: Schedule Sticky Posts

text: I'd like to display the most two recent published sticky posts by modifying the primary loop. A simple affair with the following loop. However, if I schedule a sticky post to be published in the future, the loop fails - only displaying one sticky post. It's like it can see that there is a new sticky post, but since it's scheduled it does not display. And then the loop thinks it's already displayed the two posts I requested. Any ideas?               /* Get all sticky posts */         $sticky = get_option( 'sticky_posts' );              /* Sort the stickies with the newest ones at the top */         rsort( $sticky );              /* Get the 2 newest stickies (change 2 for a different number) */         $sticky = array_slice( $sticky, 0, 2 );            /* Query sticky posts */       query_posts( array( 'post__in' => $sticky, 'ignore_sticky_posts' => 1 ) );       while (have_posts()) : the_post();        the_title();        the_excerpt();        endwhile();          /* Continue with Page Template */


title: Listing all term items alphabetically / sorting loop

text: I have my own custom post type and it has its own taxonomy and terms. Whenever user visits http://example.com/mytaxonomy/myterm I want the page to display all items within this term alphabetically. I've created taxonomy-mytaxonomy.php file where I list the items using this loop:               while ( have_posts() ) : the_post();          the_title();      endwhile;       The question is - how to output these items in alphabetical order? query_posts() mixes these with regular posts.


title: Output custom field value

text: I am reading wp codex about outputing custom field value. http://codex.wordpress.org/Function_Reference/get_post_custom From that link, It shows how to output all custom fields associated with specific post How can I take only specific custom fields value? For example I added custom field name "SkypeID". In each post, skype ID can be anyone's skype ID I want to be able to get the value of skype ID and output it on my function.php. On my function, I want to be able to insert it so that I can produce a post/page and add skype call button that will invoke skype application and then call the user mentioned on the custom field. Here is my skepe call button so far.               <div id="SkypeButton_Call_ValidSkypeID_1" style="margin:-32px 10em;">     <script type="text/javascript">     Skype.ui({     "name": "call",     "element": "SkypeButton_Call_ValidSkypeID_1",     "participants": ["ValidSkypeID"],     "imageSize": 32     });     </script>     </div>      this code works if I hard coded a valid skype ID in replacement to ValidSkypeID on line 1. What I am trying to do now is to be able to insert skypeID on that location if there is a skype ID given in custom post. Thanks


title: get_post_meta is returning image id

text: I'm using this script to get image filename, stored in a custom meta called background:               $background = get_post_meta( '22', 'background', true );     echo $background;      But it is returning the id of the image, not his filename.


title: What has happened to my shop pages and top menu?

text: Reference site I need the top menu to look like it does on the HOME page. and I need the individual product pages to not show the details twice like it is now. What happened? I thought this was a WooTheme and when I updated to the latest versions of everything it got all shifted around. Also WooThemes doesn't recognize my username so I can't even login to download the theme again from that site.


title: Unable to locate WordPress Plugin directory. ftp_base not working?

text: I have Wordpress 3.6 running on ubuntu 12.04 LTS with apache2. Wordpress is running out of the root directory on apache, ie. /var/www I have an FTP server setup (VSFTPD). I have it set to chroot to the home directory of FTP users. I have a single FTP user set up, with a folder in the home directory called public_html. In there, I have mounted /var/www so that user can access the root directory on apache. I have a UMASK of 002 set on VSFTPD and dr-xrwsr-x on /var/www. All directories in /var/www are 775 and all files are 664. I can log into the ftp server with the ftp user and create, overwrite and delete files and folders wherever I like in /public_html, as expected. If I use wordpress to install a plugin with the same ftp credentials, it fails with `Unable to locate WordPress Content directory (wp-content).` I checked the wp-config.php documentation, it said to add in `FTP_BASE` to my config, which I did like so:               define('FTP_BASE', '/public_html/');      I restarted apache and logged out and back in to wordpress. The plugin install still fails with the same message. If I turn on protocol debugging in VSFTPD (`log_ftp_protocol=YES`), I can see wordpress logging in to VSFTPD, but it never changes directory to /public_html, despite FTP_BASE being set in my config. What is weird, is it does try and CD to /var/www/wp-content, which obviously won't work. What is going on? Is Wordpress ignoring my `FTP_BASE`? My vsftpd log:               Sat Sep 21 04:16:15 2013 [pid 2] CONNECT: Client "w.x.y.z"     Sat Sep 21 04:16:15 2013 [pid 2] FTP response: Client "w.x.y.z", "220 (vsFTPd 2.3.5)"     Sat Sep 21 04:16:15 2013 [pid 2] FTP command: Client "w.x.y.z", "USER ftpuser"     Sat Sep 21 04:16:15 2013 [pid 2] [ftpuser] FTP response: Client "w.x.y.z", "331 Please specify the password."     Sat Sep 21 04:16:15 2013 [pid 2] [ftpuser] FTP command: Client "w.x.y.z", "PASS <password>"     Sat Sep 21 04:16:15 2013 [pid 1] [ftpuser] OK LOGIN: Client "w.x.y.z"     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "230 Login successful."     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "PASV"     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "227 Entering Passive Mode (w,x,y,z,204,159)."     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "TYPE A"     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "200 Switching to ASCII mode."     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "NLST /var/www/wp-content"     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "150 Here comes the directory listing."     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "226 Transfer done (but failed to open directory)."     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "PWD"     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "257 "/""     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "PASV"     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "227 Entering Passive Mode (w,x,y,z,102,89)."     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "NLST /"     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "150 Here comes the directory listing."     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "226 Directory send OK."     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "CWD /"     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "250 Directory successfully changed."     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "PWD"     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "257 "/""     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "CWD /"     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "250 Directory successfully changed."     ...(above 10 lines repeated 4 times)     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP command: Client "w.x.y.z", "QUIT"     Sat Sep 21 04:16:15 2013 [pid 3] [ftpuser] FTP response: Client "w.x.y.z", "221 Goodbye."


title: Auto login user with link from Mail

text: I created (a sort of) automatic login to WordPress by sending newsletters from providers like Mail Chip. When the user clicks on a link in this newsletter, s/he should be able to automatically log into her/his account without having to enter the login information. I already have a portion of the script, but I do not know how to get links from having to send. I have found this solution on StackOverflow, but I do not understand how to implement the solution in my site.


title: Displays a string of linked images

text:
How do I displays a string of linked images for a post using php? Terms `http://domain.com/106.jpg,http://domain.com/109.jpg,http://domain.com/112.jpg`
<?php the_field( 'gallery' ); ?>
`


title: Display registerd taxonomy in admin dashboard

text: I've installed a theme and I am trying to follow its logic and hierarchy in order to register and display a new taxonomy .so I have added a new post type called product (which displays correctly in the admin panel) and now I want to add new taxonomy called product category to it . However, this new taxonomy doesn't show in the admin I dont know why? Here's the code:                      class SH_Taxonomies           {         function __construct()            {         // Hook into the 'init' action     add_action( 'init', array($this, 'taxonomies'), 0 ); }              // Register Custom Taxonomy             function taxonomies()  {                 register taxonomy                $labels = array(                 'name'                       => _x( 'Category', 'Product Category', SH_NAME ),             'singular_name'              => _x( 'Category', 'Category', SH_NAME ),             'menu_name'                  => __( 'Category', SH_NAME ),             'all_items'                  => __( 'All Categories', SH_NAME ),             'parent_item'                => __( 'Parent Category', SH_NAME ),             'parent_item_colon'          => __( 'Parent Category:', SH_NAME ),             'new_item_name'              => __( 'New Category Name', SH_NAME ),             'add_new_item'               => __( 'Add New Category', SH_NAME ),             'edit_item'                  => __( 'Edit Category', SH_NAME ),             'update_item'                => __( 'Update Category', SH_NAME ),             'separate_items_with_commas' => __( 'Separate Categories with commas', SH_NAME ),             'search_items'               => __( 'Search Categories', SH_NAME ),             'add_or_remove_items'        => __( 'Add or remove Categories', SH_NAME ),             'choose_from_most_used'      => __( 'Choose from the most used Categories', SH_NAME ),         );              $rewrite = array(             'slug'                       => 'product_category',             'with_front'                 => true,             'hierarchical'               => true,         );              $args = array(             'labels'                     => $labels,             'hierarchical'               => true,             'public'                     => true,             'show_ui'                    => true,             'show_admin_column'          => true,             'show_in_nav_menus'          => true,             'show_tagcloud'              => true,             'rewrite'                    => $rewrite,         );              register_taxonomy( 'product_category', 'sh_product', $args );         }         }


title: Create permalink for my custom URL

text: I am trying to redirect all requests with "somestring" in the URL to a specific template. That means: `http://mysite.local/mysitename/somestring` to a specific template in file `somefile.php` below is my code:               function custom_templates(){            /* To load template for specific page URLS */         if(strpos($_SERVER['REQUEST_URI'], 'somestring')){           if(substr($_SERVER['REQUEST_URI'], -1) != '/' || substr($_SERVER['REQUEST_URI'], -2) == '//')   {         $auth_vars = end(array_filter(explode("/", $_SERVER['REQUEST_URI'])));         $url="/somestring/".$auth_vars."/";        wp_redirect($url , 301);          exit;       }         // if we have a 404 status       if ($wp_query->is_404) {           // set status of 404 to false           $wp_query->is_404 = false;           $wp_query->is_archive = true;       }       header("HTTP/1.1 200 OK");         include (get_stylesheet_directory() . '/somefile.php');         exit;         }     }          add_action('template_redirect', 'custom_templates');      It's working in the following cases:               http://mysite.local/mysitename/somestring?dummyquerystring     http://mysite.local/mysitename/somestring/////     http://mysite.local/mysitename/somestring?dummyquerystring/////      Not working in following cases:               http://mysite.local/mysitename/somestring/?dummyquerystring     http://mysite.local/mysitename/somestring/?dummyquerystring/     http://mysite.local/mysitename/somestring/?dummyquerystring////      How can I make it work exactly in the same way WordPress handles URLS?


title: Cannot add edit themes and add plugins after multisite update

text: After updating a multisite installation to WP 3.8, when in the My Sites Dashboard, hovering over "Themes" or "Plugins", no submenu pops out. There are however submenus popping out of "Sites", "Users", and "Settings". I found advice elsewhere to disable plugins one by one, and make sure a standard theme is being used. However, with a multisite installation I suppose there is no way to make sure a standard theme is being used (unless all sites are changed to that theme). Any ideas how to understand and fix this situation? Is there anywhere to locate an error message? I should mention that one of the sites is using a private plugin that I wrote, but it does not seem to have any problems as far as I can tell.


title: Get the alt text of the image in a array

text:
I have a php code. That put the thumbs on the screen. I have this:               <?php if (has_post_thumbnail()) : ?>
         <?php             $attachment_id = get_post_thumbnail_id();             $image_attributes = wp_get_attachment_image_src( $attachment_id, 'full' )         ?>         <img src="<?php echo $image_attributes[0]; ?>" width="186" height="137" alt="">         <?php //the_post_thumbnail('default_product_img'); ?>
     <?php endif; ?>      The code is good. The images are showing and that is good. But now i have a problem. I can not putt the alt text in the image. How can i add the alt text of the image, in the alt tag of the image? Thank you for helping


title: Unlimited WordPress Menu

text: I am limited to like 80 menus. My menu consists of 1000 menus. How can I increase the limitation of Appearance > Menu I tried modifying the php.ini (using reseller account) and increase the `max_var`, but that didn't work


title: Changing behavior of the loop twice in one page

text:
I'm trying to set up a wordpress blog. I have one loop with featured posts, that pulls from the 'Featured' category and displays a slider of prominent posts. Below that, I have the regular feed of posts. The regular feed works great, but the featured posts only show posts from wherever the bottom loop happens to be. Example, if I am on page one of the main feed, the top slider will only show posts with the category featured that are also on page one. How can I make my slider loop pull from ALL Featured category posts? EDIT: Added code, below:               <?php     /** Homepage file */     get_header(); ?>

         <?php if ( have_posts() ): ?>
             <?php while ( have_posts() ) : the_post(); ?>             <?php if ( in_category('featured') ): ?>

<?php the_post_thumbnail(); ?>

<a href="<?php esc_url( the_permalink() ); ?>" title="Permalink to <?php the_title(); ?>" rel="bookmark"><?php the_title(); ?>
                         <?php if (get_post_meta($post->ID, "Author", true)): ?>                         By <?php echo get_post_meta($post->ID, "Author", true); ?>                         <?php endif; ?>                         <?php the_content(__("Continue reading »")); ?>
             <?php endif; ?>             <?php endwhile; ?>
<?php endif; ?>

Recent Reviews
         <?php if ( have_posts() ): ?>
         <?php while ( have_posts() ) : the_post(); ?>

<?php the_post_thumbnail(); ?>

<a href="<?php esc_url( the_permalink() ); ?>" title="Permalink to <?php the_title(); ?>" rel="bookmark"><?php the_title(); ?>
                         <?php if (get_post_meta($post->ID, "Author", true)): ?>                             By <?php echo get_post_meta($post->ID, "Author", true); ?>                         <?php endif; ?>
                     <?php the_content(__("Continue reading »")); ?>

         <?php endwhile; ?>

<?php previous_posts_link('Newer Entries »') ?>

<?php next_posts_link('« Older Entries ') ?>
                   <?php else: ?>
No posts to display
         <?php endif; ?>
     <?php get_footer(); ?>


title: Change content layout based on menu hierarchy

text: I've tried googling this one but I can't seem to find the right keywords. What I'm trying to do is to have the content of a landing page flow exactly like the hierarchy of the navigation menu. For example, if I had `Home Features Pricing Blog Contact` as my menu, I'd like the content block to be in that order (in the same page). If I changed my menu to something like `Home Blog Pricing Features Contact`, the content block layout should change dynamically in that order as well. Is there a tutorial/plugin out there (or if someone could explain how it's done) to do this? Thanks in advance.


title: Wordpress Tags in class

text:
I have added tags to my Custom Post Type. Now I want to use them to create a isotope portfolio, I can load all tags with this code:               <?php $args = array( 'post_type' => 'portfolio', 'posts_per_page' => 24;     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post(); ?>         <div class="all <?php echo $tag->slug; ?>">             <?php echo the_post_thumbnail(); ?>
<?php the_title(); ?>

     <?php endwhile; ?>      But now I want to add the all tags that from each portfolio item to the `class=""`. With `<div class="<?php $tag->slug; ?>">` I just get the last tag of all the tags that are used. I know there are already a lot of posts about this problem, but every post I have found does not seem to work for me.


title: Is it possible to override the default Gallery Settings form?

text: I'm trying to change the options that are presented for the gallery settings. I can't seem to find a hook or override that gets exactly what I want. I came close with the following, but it only seems to add to the top of the tab.               function media_upload_gallery(){     echo 'test';         }          add_filter('media_upload_gallery', 'media_upload_gallery');      Is it even possible to hook into that form and either replace it or edit it? Levi


title: Best Practice for Server Processing

text: In a theme I have a form that I need posted and some work done on the server. What is the recommended way of doing this? I have it posting to another php file where some work will be done, and then redirected back to the previous url. I'm having some issues with this because all the functions that normally work in a page don't anymore; such as `home_url()` and `get_current_user_id()`. Is there a good/easy way to include the basic WP things to use? Does the php file need to be a wordpress page? Is this even a good way doing this?


title: Multisite and plugins options

text: I need more information about `get_site_option()`, `update_site_option()` and `add_site_option()`. In codex they say it's the same as single install except that in multisite, it returns the network-wide option. Ok but I get confused on the this point : does it mean once network-wide option is set this option is the same in all sites? Or is it overriden per each site? I mean if I do this :                update_site_option('option_group', 'default_options());// default_options() returns an array of default options      Where will it save datas? And will each site get its own values for options after? It's quite unclear for me any hint will be cool.


title: How to give dynamic url path in widget?

text: I have a widget and give link to some text within it like href="http://www.netattingo.com/dev/imc/" as it is static path in widget but when I try to to use "site_url" or "bloginfo". It does not work. What I am doing wrong?


title: if custom posts type exists and there are posts load script

text: I have registered a custom post type `'featured_post'`. I am looking for a way to test if the blog home page has any `'featured_post'` posts on it and if it has load a javascript file. The 'featured_post' posts will make a slider at the top of the blog home page. I had this working using sticky posts but I can't work out how to conditionally load the script if there are posts of CPT 'featured_post'. This is the code that worked for sticky posts:                if ( is_front_page() && is_sticky() ) {                 wp_enqueue_script ('flexslider-js');             }      However this does not seem to work and I don't know why:                   if ( is_front_page() && get_post_type('featured_post') ) {             wp_enqueue_script ('flexslider-js');         }      Thanks in advance.


title: List all blog categories

text: I have created a blog plugin. I have the blog category in my blog. I would like to get the list of all the blog categories and list it in my www.domain.com/blogs/ page. My blog category name is 'blogcategory' . I do not know how to use it in the `list-category` function. I am a nooby to wordpress development.


title: Add rel=canonical to only one page

text: I'm trying to add the `rel="canonical"` tag to only one page, the home page. In order to add the tag, I need to add it to the `<head>` part of the template, in the header.php file. This will add the same rel canonical tag to all the pages of my wordpress website. How can I add rel canonical to only one page, the home page. I don't want to do a 301 redirect, I want to add a rel canonical tag. Or can this be done with some htaccess code (but no 301 redirect)?


title: Query Posts Via WordPress URL

text: I wanted to learn more about querying post types and their custom fields in WordPress. I've got two questions... I've followed this tutorial on Advanced Custom Fields and am trying to understand what is happening here. This is placed in my theme's function file.               add_action('pre_get_posts', 'my_pre_get_posts');     function my_pre_get_posts( $query ) {         if( is_admin() ) {             return;         }              if( isset($_GET['type']) ) {             $type = explode(',', $_GET['type']);                  $meta_query[] = array(                 'key'       => 'type',                 'value'     => $type,                 'compare'   => 'IN',             );         }              $query->set('meta_query', $meta_query);              return; // always return     }      Now I understand this is somehow allowing the URL to alter the query based on its custom field (in this case `type`) and values that are assigned to this post. But how exactly is it working? My second question is, when I pass this query in my URL like so: > `http://example.com/cars?type=coupe,hatchback` it returns all Coupe and Hatchback cars – which is great! This seems to work because my custom field (`type`) only accepts one value. A car has to be either a Coupe or a Hatchback – it can't be both. On the other hand, some of my custom fields (take `for`, for example) can hold more than one value. My `for` custom field can actually take up to five values ("him", "her", "families" etc). For some reason, that code above doesn't play nice when assigned to custom field (like `for`) that can have multiple values. This doesn't work, at all: > `http://example.com/cars?for=him,her` Any ideas why that is and what I have to do to get it to work? Thanks in advance. **EDIT:** Matching multiple values by running the `LIKE` query:               add_action('pre_get_posts', 'my_pre_get_posts');          function my_pre_get_posts( $query ) {     if( is_admin() ) { return; }          if( isset($_GET['type']) ) {                                 $meta_query[] = array(             'key'       => 'type',             'value' => '"' . $_GET['type'] . '"',             'compare'   => 'LIKE',             );     }     $query->set('meta_query', $meta_query);          return;     }


title: Inserting iframe right after <body> on header.php

text: I have an iframe tracking script of sorts that I need to add right after the body tag. After looking around on the web, I found that the body tag is in header.php and I should add a function to functions.php and then add the html to header.php. Not sure if this is right but... I went to _functions.php_ and added this:               function after_body(){         do_action('after_body');     }      Then I went back to _header.php_ , looked up to where the body tag was and added this:               <body><?php after_body(); ?>      But where exactly do I add my html/iframe code?


title: Included posts on a page searchable

text: With Advanced Custom Fields (ACF) I added a 'relationship field' to the pages that can select posts from a custom post type. The chosen posts will be come part of the page. Searching with wordpress search function will not find the page with info from the included elements. For example if i search 'safety' i will not find the page but the costum post named safety. I know how to disable the custom post types from search. How would i be able to find the page? I hope my example is clear? ![example of relationship field and output on page](http://i.stack.imgur.com/7zUuG.png)


title: Not sure why this template for custom post type posts isn't displaying anything. What's missing?

text:
<?php     /**      * Template Name: Movies      */     ?>          <?php get_header(); ?>

          <?php     $type = 'movies';     $args=array(       'post_type' => $type,       'post_status' => 'publish',       'posts_per_page' => -1,       'caller_get_posts'=> 1     );     $my_query = null;     $my_query = new WP_Query($args);     if( $my_query->have_posts() ) {       while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
         <?php       endwhile;     }     wp_reset_query();  // Restore global post data stomped by the_post().     ?>

          <?php get_sidebar(); ?>     <?php get_footer(); ?>


title: WordPress in subdirectory, Multisite using subdomains Nginx

text: I'm usually running WP on Nginx + PHP-FPM in a sub-directory (similar to Mark Jaquith's Skeleton) without any issues, all permalinks are working just fine. Now I tried to do this with WordPress Multisite and got some problems. My wp-config.php settings:               // Give WordPress it's own directory     define( 'WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/core' );     define( 'WP_HOME', 'http://' . $_SERVER['SERVER_NAME'] );          // Use custom content directory     define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/content' );     define( 'WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/content' );      In the filesystem it looks like this:               content/ - wp-content direcotry         index.php         languages/         plugins/         themes/     core/ - wordpress directory         index.php         wp-admin/         wp-content/ - original folder, emppty         wp-includes/         ... - other wp core files     index.php     wp-config.php      With Multisite I want to have subdomain sites, like:               one.example.com     two.example.com     three.example.com      After Network installation I've got a main site on a root domain, which is `example.com`, but it switches to `example.com/core`, which is not what I need. **How to remove this`/core/` part from the main site frontend?** Next, when I go to main site admin, it opens via `example.com/core/wp-admin/` which is correct. But when I go to network admin, it switches to `example.com/wp-admin/network/` and shows 'Not found'. If I manually add `/core/` part in the ulr, it works. **How to add`/core/` part to Network Admin?** Next, the problem with network sites. With some hacking of html source via Firebug I created `one.example.com`. It's frontend works. When I try to access the backend, it goes to `one.example.com/wp-admin` (which is wrong, missing `/core/` part) and browser says 'The page isn't redirecting properly'. If I manually add the `/core/` part and open `one.example.com/core/wp-admin/` it shows the admin page but the styles and scripts are missing, of course. **How to get subdomains admin working?** To further clarify, the correct working urls should be:               http://example.com - main network site     http://example.com/core/wp-admin - main network site admin     http://example.com/core/wp-admin/network - network admin     http://one.example.com - some network site     http://one.example.com/core/wp-admin - some network site admin      Here's my current site config for Nginx:               server {              listen 80;         server_name example.com *.example.com;         root /var/www/example.com/httpdocs;         index index.php;              location / {             try_files $uri $uri/ /index.php?$args;         }              location ~ \.php$ {             fastcgi_split_path_info ^(.+\.php)(/.+)$;             fastcgi_pass unix:/var/run/php5-fpm.sock;             fastcgi_index index.php;             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;             include fastcgi_params;         }          }      This config works fine with regular, single-site WordPress install, when WP is installed in `/core/` dir. I've removed all multisite-specific Nginx rules to be able to start from scratch. I've checked dozens of support topics, Stackoverflow / Stackexchange questions, Nginx forums etc. Tried different configs - couldn't get it running. Thanks ahead for any hints and help!


title: Edit Post Gallery, without adding it in content

text: I'd like to be able to create a gallery in each post, and then displaying it on website using get_post_gallery() function. At the moment that's possible only by adding the gallery shortcode in content. Is it possible to click on "Insert Media" button and be able to access Post Gallery, without having it placed as shortcode in content. Is that possible?


title: How to slidedown and slideup child pages clicking on parent pages in jquery or javascript?

text: I have created a sidebar in wordpress in which all parent pages with subpages are listed. I have used following code in sidebar-left.php file and call this in template file.               <div id="primary" class="widget-area" role="complementary">         <?php         $ancestor_id=get_the_ID();         $descendants = get_pages(array('child_of' => $ancestor_id));         $incl = "";         foreach ($descendants as $page) {                 if (($page->post_parent == $ancestor_id) ||                      ($page->post_parent == $post->post_parent) ||                       ($page->post_parent == $post->ID))                    {                      $incl .= $page->ID . ",";                    }                  }          ?>      <ul>          <?php wp_list_pages(array(                            "child_of" => $ancestor_id,                             "include" => $incl,                             "link_before" => "",                             "title_li" => "",                             "sort_column" => "menu_order"                            ));          ?>       </ul>     </div>      Now what I want that when I list all sub pages of each parent page, all sub pages must hide and only parent pages should be shown and when I click on any parent page then its sub pages slide down and when I click on the same parent page again then its sub pages should collapse means slide up. I know that "wp_list_pages" generates class and id of each `<li>` but I could not understand how to catch current id and use that id in jquery or javascript. Here is link what I exactly want.


title: Can't insert internal links and menu errors appearing

text: I'm getting this error every time I add an item (page, post or category) to my menu system: > Warning: Invalid argument supplied for foreach() in > /home/rootname/public_html/wp-admin/includes/plugin.php line 1261 I also can't insert links to internal pages from within the WYSIWYG editor (no pagesappear in the list). I guess it could be a theme-server conflict issue as I have an identical set up (same theme, plugins etc) on my localhost which is working ok, it's just the live site that is having issues... Any ideas of what I should do? Thanks, Osu **EDIT** Ok, I've found the root of the problem - it's to do with a function in my functions.php file:               /* Remove admin end options */     add_action( 'admin_init', 'osu_remove_menu_pages' );     function osu_remove_menu_pages() {         remove_menu_page('link-manager.php');         remove_submenu_page('themes.php', 'themes.php');         remove_submenu_page('themes.php', 'widgets.php');         remove_submenu_page('plugins.php', 'plugin-editor.php');         remove_submenu_page('users.php', 'user-role-editor.php');         // remove_submenu_page('index.php', 'update-core.php');     }      I'm using it to remove some options on the admin end and would prefer to keep this function if possible just to make the admin end less cluttered. Can anyone see why that might be conflicting with the link system in WP 3.2.1? Thanks


title: How to handle a post before publishing?

text: I want to do a regex match to each post before it gets published, and if the regex fails to match, delete the post entirely, what hook should I use?


title: Help with 4.6. Attachment response object in JSON API plugin

text: I am a big fan of the JSON API plugin. The developer did a great job and I thank him very much. I am learning how to work with json and jquery and am trying to limit the information I get back from an ajax request. I have been able to use the include and custom field options successfully but amd falling a little short understanding 4.6. Attachment response object. Is there a way to limit the result to only provide thumb images? If so, can anyone provide an example of the syntax. I am not sure how to address these objects in the query string. Any help would be awesome. Let me know if I need to clarify anything. I managed to narrow down my result with this request url: `/?json=get_recent_posts&include=title,url,categories,thumbnail,custom_fields&custom_fields=field1'` plugin url: http://wordpress.org/extend/plugins/json-api/other_notes/ plugin author: http://profiles.wordpress.org/users/dphiffer/ Regards, Fellow WordPress Developer


title: wp_postmeta are updated for only one page

text: Code below only updates `wp_postmeta` of one specific post, not all the posts. On other pages the `meta_key` is not even added to the table, so it is not the problem with saving but with something else, and I have no idea what. I've tried generating the meta field with a plugin, Advanced custom fields, but the situation is the same, only the same particular page gets updated, rest are not. What could cause this selective updates?               function damad_add_post_metabox() {          $screens = array( 'post', 'page');          foreach ( $screens as $screen ) {          add_meta_box(         'damad_post_meta_id',         __( 'Options', 'damad' ),         'damad_inner_custom_box',         $screen     );     }     }     add_action( 'add_meta_boxes', 'damad_add_post_metabox' );          function damad_inner_custom_box( $post ) {          wp_nonce_field( 'damad_inner_custom_box', 'damad_inner_custom_box_nonce' );           $homepage = get_post_meta( $post->ID, '_post_featured', true);     echo '<label for="post-featured">';        _e("Include in homepage slider", 'damad');     echo "</label>";     echo '<input type="checkbox" id="post-featured" name="post-featured" value="post-featured"';     if ( 'post-featured' == $homepage ) {     echo 'checked="checked"';     }      echo '/>';     }          function damad_save_postdata( $post_id ) {          if ( ! isset( $_POST['damad_inner_custom_box_nonce'] ) )        return $post_id;           $nonce = $_POST['damad_inner_custom_box_nonce'];           if ( ! wp_verify_nonce( $nonce, 'damad_inner_custom_box' ) )         return $post_id;           if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )          return $post_id;            if ( 'page' == $_POST['post_type'] ) {            if ( ! current_user_can( 'edit_page', $post_id ) )         return $post_id;             } else {              if ( ! current_user_can( 'edit_post', $post_id ) )         return $post_id;       }           $featureddata = $_POST['post-featured'];            update_post_meta( $post_id, '_post_featured', $featureddata );      }      add_action( 'save_post', 'damad_save_postdata' );


title: Easiest way to show total number of subpages

text: I am making a portfolio site where each portfolio entry is a subpage of "Work". In my template, I am trying to say something like: worked on 15 projects and counting, where 15 is the total number of subpages. Whats the easiest way to do this?


title: Check if custom taxonomy has posts with get_categories()

text: I'm using **get_categories** to list all the terms of my taxonomy " **genre** ", but I have other taxonomy called " **brands** ". In Brands page ( **taxonomy-brands.php** ) I need to return all the posts from the brand and the genre they're related. **For example, I have a taxonomy page for Ferrari:** . Brand name: Ferrari .. Genres: Red, Yellow **But I also have a taxonomy page for Wolkswagen:** . Brand name: Wolkswagen .. Genre: Blue, Green The problem is that Ferrari page, is also listing "Blue" and "Green", even if Ferrari doesn't have any posts related to Blue and Green. Finally, is there any way to hide "Blue" and "Green" when they're not used? Here is what I got so far: http://codepad.org/rWaVmuUT If you need a visual example: http://i.imgur.com/PKGpi2o.png - "Sucos" and "CD" should not appear, since this brand only has posts with "Macarrão Instantaneo".


title: Add multiple classes. Different style for each category tag

text: The output of `<?php the_category(', '); ?>` is               my-category-name      I would like add a specific class for each category so I could style it in different colours like in this page. What I'm after is:               alpha     beta     gamma      and the style would be:               .post-category {         margin: 0 0.1em;         padding: 0.3em 1em;         color: #fff;         background: #999;     }         .post-category-alpha {             background: #5aba59;         }         .post-category-beta {             background: #4d85d1;         }         .post-category-gamma {             background: #8156a7;         }      The closest I could find was this answer but it's just for one class and even google didn't help much. Maybe changing the code here a bit? Unfortunately I'm not a coder. Could anyone point me in the right direction, or better suggest a solution here? Thanks. **EDIT** Almost there. I changed that function and pasted it in the theme like this               <?php     $categories = get_the_category();     $separator = ' ';     $output = '';     if($categories){         foreach($categories as $category) {             $output .= 'term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '" class="post-category post-category-'what do I put here?'">'.$category->cat_name.''.$separator;         }     echo trim($output, $separator);     }     ?>      What variable do I put after class="post-category post-category-????"


title: Update content on the fly

text: I am adding function to replace content on the fly for every `width="*"` with width="730px" and every `height="*"`with height="846"               function replace_content_on_the_fly($text){         $replace = array(             // 'words to find' => 'replace with this'             'width="*"' => 'width="730px"',             'height="*"' => 'height="486px"'              );         $text = str_replace(array_keys($replace), $replace, $text);         return $text;     }     add_filter('the_content', 'replace_content_on_the_fly');     add_filter('the_excerpt', 'replace_content_on_the_fly');      However,it doesn't seem to work, anyone know to fix it?


title: Sidebar missing from Homepage

text: The home page displays the sidebar below the rest of all the latest posts, leaving a vacant sidebar area for the majority of the (long) page. The sidebar displays fine on any single post. My **index.php** and **single.php** are practically identical, apart from minor differences in the "next post", "previous post". There are no widgets deployed in the theme sidebar, which is called sidebar1; there are no other sidebars. All the elements of the sidebar are coded into sidebar.php, and there are no conditions to check which page is calling the sidebar, so it should (and is) displaying the same content on both the index page, and on individual posts, just in different locations. Category pages display the sidebar in the correct location too. I thought that there might be posts with `<br clear="all">` listed on the home page, which were pushing the sidebar down, but the only post which has this content is not on the home page any more, and it displays the sidebar fine. None of the individual posts contain content which is too wide - they all display fine as individual posts, and even when the content is too wide, it just displays underneath the sidebar, it doesn't push it downwards. I use a caching plugin, but I have cleared the cache on the server and in my browser. When I display the site in IE8, I receive an error:               Webpage error details     Message: 'ajaxurl' is undefined     Line: 1     Char: 102     Code: 0     URI: http://www.superlogical.net/wp-includes/js/wp-lists.js?ver=20110521      but I receive the same error on individual posts and the sidebar displays fine in IE8. I haven't made any template changes in the last 2-3 days I can think of, and it was displaying fine yesterday. There is nothing in Google Chrome CSS element inspector indicating any CSS issues that I can see. Any ideas about what is happening here?


title: 'ajaxurl' is undefined -- wp-includes/js/wp-lists.js

text: My site displays the following script error in IE8:               Webpage error details     Message: 'ajaxurl' is undefined     Line: 1     Char: 102     Code: 0     URI: http://www.superlogical.net/wp-includes/js/wp-lists.js?ver=20110521      I can't see what is calling wp-lists.js. Any ideas?


title: Copy posts from one blog to another in multisite environment

text: I am creating a plugin for post.php page where user can select (one or more) blogs and copy the post content,title,author,categories everything in selected blogs. The copied post would be the child of original post and now the original post would be parent post. I want to know that is there any WP function which can directly take care of copy posts to other multisite blogs or what would be the best function to do it.


title: Custom Permalink Structure for terms/taxonomies of custom post type

text: So I have a custom post type with 3 taxonomies attached to it. I want users to be able to filter custom posts based on their taxonomy choice. So I have 3 taxonomies, charity, type, location and I want to for exmaple domain.com/findby/location/los-angeles or domain.com/findby/charity/red-cross                  domain.com/post-type/%postname%/        domain.com/findyby/%taxonomy%/%specific-term%/      I know it's doable, I'm just somewhat clueless as to how!


title: Display a consistent Google Plus icon on ALL pages of my site

text: My website is http://tablified.com and I have managed to setup the Google Plus script. The issue is that every page of the site displays a different Google Plus count. For example, if you go on my site you will see that I have about 180 Google Pluses. Now, if you click on something like "Tablified Apps" you will see that the Google Plus number on the top left corner of the screen is changed to 21. How do I display the Google Plus account for the main page across the entire website regardless of the page being displayed? Where should I place the script exactly? I am running this site on Wordpress. Perhaps a plugin could fix this and save me the hassle? The issue is that I need to have it at that EXACT location and I feel like a plugin would not accomplish this. Thanks for your help!


title: Exclude posts with custom taxonomy

text: I need to show a list of custom posts but exclude any that have the custom taxonomy 51, is it possible to do it with the loop below?               $pages = get_children(array('orderby' => 'post_date', 'post_type' => 'news', 'numberposts' => "3"));     $counter = 1;                                    foreach($pages as $post) {         setup_postdata($post);         $fields = get_fields();     }      UPDATE: The custom taxonomy is called opportunity and has the term id 51 in the custom taxonomy. If this helps - this is how I'm grabbing all the custom post's with the custom taxonomy opportunity:               $pages = get_children(array(     'orderby' => 'post_date',      'post_type' => 'news',     'post_status' => 'future',     'numberposts' => "3",     'tax_query' => array(     array(     'taxonomy' => 'news',     'field'    => 'id',     'terms'    => 51,     ),     ),));


title: Get post attachment images dimension and use in embed code

text:
I am trying to make things work like where any post attachment image will generate embed code automatically. Example: If I upload and add two images 1. 250x150 2. 600 x 160 and insert into post. Now that image information I want to auto put into embed code like below.

      where $variable is the data of the attached image/s. So above code our team member can use the embed code to display image.


title: Order Posts by Closest Numeric Values

text: I'm using custom post types to display properties and have a custom price field assigned to each post. On the property page I want to display a list of four similarly priced properties, two less than or equal to the price of the current property and two greater than the current price. Ordering properties numerically by price is easy enough with wp_query, but how do I only display the closest values to the price of the current property?


title: Twenty Eleven theme header images manual next previous buttons

text: I have 3 images in my twenty eleven theme header and they rotate by themseleves I want to add next and forward buttons on left and right of my header image to also rotate them manually when I want to see next header image. please guide


title: What are ideal hooks to call register_sidebars?

text: Where should a plugin ideally hook to call `register_sidebar();`? Will `init` do just fine?               function my_plugin_register_sidebars() {         $args = array(             'name' => 'foo'             'description' => 'bar'             ...         );         register_sidebar( $args );     }     add_action( '**????**', 'my_plugin_register_sidebar' );


title: List of settings available for get_setting of WP_Customize_Manager

text: In the Codex for `get_setting` there are some settings such as `blogname`: http://codex.wordpress.org/Class_Reference/WP_Customize_Manager/get_setting Is there a comprehensive list of these?


title: Clone a wordpress website with same functionality, but different content

text: I have got a Wordpress website and I would like to create a new one with exactly the same functions, themes/templates (apart from the color), plugins, etc. An exact clone of the current one, but with different content and name of sections. Is there any plugin I can use or should I just copy the website, delete contents and change the name of the sections? Is there any tutorial? I can I reset all the id and the stats of the previous website? Thanks in advance


title: List of default WordPress URLs

text: I'm looking for a list of all possible URLs (or URL patterns) that would deliver content or would otherwise cause WordPress to respond to the request with something other than a 404. Let's assume a fresh standard install of the current version. I've looked around and there's lots of documentation on how to create custom URLs to your content or admin area or for various other things, but I haven't found a comprehensive list of what exists by default. Does such a list exist or is there an easy way to compile it?


title: Query does not return content

text: Working on updating an old WP site developed for WordPress 2.0 and have a post (page) query that does not return the "post_content" data. Here is said query:               $the_query = query_posts('post_type=page&post_parent=50&post_status=publish&orderby=menu_order&order=ASC&posts_per_page=100');      And the returned object (one of them):               [0] => stdClass Object         (             [ID] => 249             [post_title] => John Doe             [link_link] => 1             [no_follow_link] => 0             [redirect_url] =>              [target_blank] => 0             [post_status] => publish             [post_name] => john-do             [post_parent] => 50             [guid] => http://beta.mysite.org/             [post_type] => page             [filter] => raw         )      Notably this is missing the post_content. Which is kind of a big deal. Any ideas? I don't think it's a memory limit issue. I've tried many different work-arounds. Suggestions are much appreciated.


title: pre_get_posts Remove posts based on meta value with 'post__not_in'

text: I am attempting to alter the query of pages where the post meta value of `_members_access_role` does not meet that of the currently logged-in user. Here is what I have so far:               // Get all posts with the access level of 'Member'     function members_get_member_posts() {         $post_ids = array();         $args=array(             'post_type' => array('post','tribe_events','document'),             'meta_key' => '_members_access_role',             'meta_value' => 'member',             'post_status' => array('publish','private')         );         $protected_posts = get_posts($args);         if($protected_posts) {             foreach($protected_posts as $p) {                 $post_ids[] = $p->ID;             }         }         // return an array of paid post IDs         return $post_ids;     }          // Hide all posts from users who are not logged-in or are not administrators or members     function members_hide_member_posts($query) {         $current_user = wp_get_current_user();         if(empty($current_user) || ($current_user->roles[0] != 'member' && $current_user->roles[0] != 'administrator') && (false == $query->query_vars['suppress_filters'])) {             $protected_posts = members_get_member_posts();             if($protected_posts)                 $query->set('post__not_in', $protected_posts);         }         return $query;     }     add_filter('pre_get_posts', 'members_hide_member_posts');      If I do a quick `print_r(members_get_member_posts())` I am seeing the array of post IDs correctly - but on the front-end, posts are still showing up when they should not be (since I am feeding in that returned function value to `posts__not_in`). For example, if a public user visits the site, they can still see the Member (role) posts. Was also having a bit of trouble bringing in `global $current_user` object -- as it would not check if `$current_user->ID` was empty or not without the page producing a fatal error about memory limits (even after I set the php.ini file to 256M for the hell of it), so a possible memory leak? Thanks! _Update_ While not documented, I did double-check that you can use an `array()` value for `post_type` in get_posts as of 3.3 (I believe). Also tried without it and returns just posts as it should - so the data is returning, just not "filtering out" that data.


title: How wordpress handle upload images and how to use them in the code

text: When I upload images via the standard media uploader I notice that it upload the original images with the same name but creates other cropped copies of the original one and rename them with originalname-150x150 or -340-120 and so on. I double checked the Media tab in the admin panel, but there are only dimensions for small, medium and large images and aren't the same which wordpress rename the files! And in the most of the case they are more than 3! So, how to configure this? I think that the problem was the custom theme that I'm using but it's not, I changed to default one. Another question, If wordpress makes all this cropping with my uploaded images...how to use them in the php code? There are any function that I can call for getting all this images in different sizes? Thanks


title: How to add drop down sub menu from database fields in the particular menu slug

text: I am creating a menu(not in admin panel) in wordpress, and I want to add drop down menu from my database table fields in a particular menu slug? How can I achieve that, using code? I found the answer from http://www.wpbeginner.com/wp-themes/how-to-add-custom- items-to-specific-wordpress-menus/ but this will add a main nav menu, but I want a sub menu from database. For egs.: I have a `Gallery page` and their are `sub galleries` in the `Gallery`. Then after `gallery slug` the `sub galleries` should be added. See this http://theme.crumina.net/photo/ I want same as `gallery nav menu`, hovering on `gallery menu` the `sub galleries` are shown. **Remember** all these `sub galleries` came from `database table` I have recently started on `wordpress`, so I don't know more about it. Thank in advane.


title: How can I see all the actions attached to an "add_action" hook?

text: I'm working with the admin bar and trying to debug some of the menus and their priorities. I know several callbacks get bound to actions, such as this one:               add_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );      How can I see what is lined up to be called when a hook like `admin_bar_menu` is called?


title: Exclude categories from postquery

text: I asked this question without a clue what was going on. I got an answer with the code below. It worked when I got it. I tested it with shirts only, assuming it worked with the other cats. it doesn't work with hoodies. Why.. idk. Gallery still hides from blog post. Any one see why?               <?php     $gallery = get_cat_id('gallery');     $shirts = get_cat_id('shirts');     $hoodies = get_cat_id('hoodies');     $excluded_cats = '-'.$gallery.',-'.$shirts.',-'.$hoodies;     $limit = 5;     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     query_posts( 'cat=' . $excluded_cats . 'showposts=' . $limit . '&paged=' . $paged );     $wp_query->is_category = true; $wp_query->is_home = false;     ?>      http://threefourink.com/threefoursite/blog/ I just now also realized that its showing all the posts, not $limit of 5 Any help much appreciated!


title: Disable Admin Bar for specific content

text: I have a post type/single page that I'm using to create iframe widgets for embedding on other sites and blogs. The admin bar code is creating that extra 28px space at the top, and if I try to include it in a wordpress text widget, it screws with the existing admin bar on the hosting site for the iframe. I'm using a custom single and custom header file, wondering how I can lose the bar and css associated with it entirely just for that content. Thanks! (also posted on wordpress.org)


title: Custom Post Types and archives

text: I have a custom post type: cats When I visit `http://mysite.com/cats` I see all of my cat posts displayed using the template file `archive-cats.php` I filtered `getarchiveswhere` to only return posts from this custom post type. I output `wp_get_archives` on the page and it correctly lists the months that have cat articles in them. Now my problem... the archive links are like `http://mysite.com/2013/04` which results in a 404. None of them work. My question... how do I get the archive links to point to something that will list that month's archives correctly? I would think something like `http://mysite.com/cats/2013/04` would be best but I don't see how to get anything working, let alone that sort of url.


title: Different registration form for different roles

text: I have customised the worpress registration page by adding new fields using the Cimy User Extra Fields plugin so my site is now fine for allowing users to register as contributors. I now want to create a different link to allow registrations as subscribers but with different fields displaying on the registration form. What is the best way to do this? Another plugin? PHP functions? Thanks.


title: the_excerpt not displaying

text:
I have a loop where I display all posts on the site, the problem is that the_excerpt is not being displayed. What am I doing wrong?                 <?php          $all_posts = get_posts(array('numberposts' => -1));         $total_posts = count($all_posts);         $posts_per_column = intval($total_posts / 3);         $count = 0;         $col = 1;         foreach($all_posts as $post):       ?>                   <div class='post' id='article<?php echo $count; ?>'>
            <a href='<?php the_permalink() ?>'>                      <?php the_post_thumbnail() ?>           <?php              $cat = get_the_category();              $cat_long = $cat[0]->cat_name;             $cat_split = explode(' ', $cat_long);              $cat_short = strtolower($cat_split[0]);           ?>                      <span class='tag <?php echo $cat_short ?>'><?php echo $cat_long ?>
              <div class='inner <?php echo $cat_short ?>'>
<a href='<?php the_permalink() ?>'><?php the_title() ?>

           <?php the_excerpt() ?>


title: Cannot retrieve author in sidebar of single.php

text: Within a post I can use `the_author()` to retrieve the author name, but in the sidebar of a single-post page this does not return anything. How to get metadata on the post author outside the post?


title: Add an admin page, but don't show it on the admin menu

text:
I have a custom plugin 'Charts' that has it's own menu. In that menu are links to the 3 pages for the plugin - 'Charts', 'Add Chart' and 'Edit Chart'. However, I don't want to display the link to 'Edit Chart'. Here is how I add the page in question -               $this->pagehook = add_submenu_page('charts', __('Edit Chart'), __('Edit Chart'), 'edit_charts', 'edit-chart', array(&$this, 'on_show_page'));      I've scoured the internet, and cannot find a way to do this (that works). It's possible to remove whole top level menus (not what I need), and you can remove individual entries from the `$submenu` global (but doing that also removes the registered capability), so no one can access the page -               global $submenu;     if(!empty($submenu['charts'])) : foreach($submenu['charts'] as $key => $page) :             if($page[0] === 'Edit Chart') :                      /** Removes all permissions to access the page */                 //unset($submenu['charts'][$key]);                               /** Removes the title, but the menu entry still exists, so it looks odd */                 $submenu['charts'][$key][0] = '';                  endif;         endforeach;     endif;      I've looked in to hiding it via CSS, but can't see a way to do that through the HTML that Wordpress generates -
Edit Chart
      I've also considered jQuery, but that has similar limitations to the CSS route, plus I refust to believe that I am the only one that has ever wished to do this - there must be a way, I just can't find it! Any hints and tips appriciated. Thanks.


title: Page.php vs Single.php

text:
I have a page.php and single.php template that are 100% identical. Yet, when I render page.php the div don't get nested in the same way as single.php and the layout gets broken. I've even diff'd the output of the two pages and, with the exception of the meta and non visible elements, they are also 100% identical. Following is the code of both templates:               <?php get_header(); ?>          <?php        if ( have_posts() ) while ( have_posts() ) : the_post();        $post_id = $post->ID;     ?>

<?php the_title(); ?>
                  <?php the_content(); ?>                  <?php comments_template( '', true ); ?>             <?php endwhile; ?>

             <?php get_sidebar(); ?>

          <?php get_footer(); ?>      What should I check to fix this issue?


title: Why Does get_posts() Return an Empty Set?

text: I'm writing a custom plugin that is initialized at `init`. This plugin is trying to query for some custom post types already stored in the DB. Here's my code:               $args = array()     $myposts = get_posts( $args );       print_r($myposts);      No matter what arguments I pass into the $args array I don't get anything. For example:               $args = array( 'post_type' => 'page' );      Now, to my confusion if I use the exact same arguments with `get_pages()` I get a result. Maybe this has something to do with when WP Query is initialized?


title: server load. $_SERVER['REMOTE_ADDR'] and $_SERVER['HTTP_HOST']

text: while writing new code and testing it, I incorporate it into my site by testing for the remote IP address as follows; i.e., I'm the only one who will see the new code: in `/functions.php`:               // to hide certain sections/features from people other than myself     $myIP = '219.88.88.88'; // the value as currently indicated by Airport Utility     if( FALSE ) // set to TRUE to initiate Remote Addr test         define( 'ITS_ME', $myIP == $_SERVER['REMOTE_ADDR'] );     else         define( 'ITS_ME', FALSE );      in a template; eg, `front-page.php`:               if( ITS_ME ) // IN DEVELOPMENT         echo gregory_get_featured_announcements();      in addition, five domains point to my server because I'm known by 5 different names in various languages. I use `$_SERVER['HTTP_HOST']` in a filter function hooked to `home_url()` and `site_url()` that sets the domain of internal links to the host that the visitor specified. I'd like to know; is it likely that these will put a heavy load on the server? would a cache plugin like `W3 Total Cache` help?      ### Additional information my apologies. the question is difficult to understand. s_ha_dum is right. I'm testing on the live server. What I'm doing would never be done in a professional setting. I'm developing my own personal blog. `ITS_ME` is a switch which evaluates to TRUE if the visitor loading the site has my IP address; i.e., the visitor is me. If the switch is on, the code within `if( ITS_ME )` conditionals gets executed. This code could be in any of my WP templates. The switch is also used within `functions.php` to selectively `require()` in-development WP files. wrt the domains, if a visitor visits me at domain1.com, all of the internal links will be based on domain1.com. if they visit domain2.com, all of the internal links will be based on domain2.com but otherwise, they're seeing exactly the same content. please see http://wordpress.stackexchange.com/a/73621/15311 Gregory


title: Update get_pages using ajax on form select change

text: I have the following code in my page template file, (below), which works ok when used with the normal form submit. What I'm trying to do is update the get_pages variables using ajax (no page refresh) when the select dropdowns are changed. I can see the data that is returned in the firebug console but can't seem to get it back to php code/variables. Any help would be greatly appreciated, s.               <?php      if ( isset($_POST['sortables']) ) :         $sortables = $_POST['sortables'];     else :          $sortables = 'menu_order';     endif;     if ( isset($_POST['ascdesc']) ) :         $ascdesc = $_POST['ascdesc'];     else :          $ascdesc = 'asc';     endif;                                   ?>                                              <script type="text/javascript">     jQuery(document).ready(function($) {                                     $("#sort, #ascdesc").change(function() {             var $form = $("#myForm");             var dataString = $form.serialize();             $.ajax({                 type: "POST",                 url: "<?php the_permalink(); ?>",                 data: dataString,                                                                                success: function() {                     console.log(dataString);                                         }                 });                                              });                      });     </script>          <?php $thispage=$post->ID; ?>     <section id="list-boxes">            <form action="<?php the_permalink(); ?>" method="post" id="myForm" style="margin:5px 0 15px;">             <select name="sortables" id="sortables">                   <option value="menu_order"<?php if ($_POST['sortables'] == 'menu_order') echo 'selected="selected"'; ?>>Sort by Menu Order</option>                                        <option value="post_title"<?php if ($_POST['sortables'] == 'post_title') echo 'selected="selected"'; ?>>Sort by Title (Alphabetically)</option>                                                         <option value="post_date"<?php if ($_POST['sortables'] == 'post_date') echo 'selected="selected"'; ?>>Sort by Date Created</option>                     <option value="post_modified"<?php if ($_POST['sortables'] == 'post_modified') echo 'selected="selected"'; ?>>Sort by Date Modified</option>                         </select>                 <select name="ascdesc" id="ascdesc">                                         <option value="asc"<?php if ($_POST['ascdesc'] == 'asc') echo 'selected="selected"'; ?>>Ascending</option>                                         <option value="desc"<?php if ($_POST['ascdesc'] == 'desc') echo 'selected="selected"'; ?>>Descending</option>                                     </select>                              <button type="submit" id="sort-submit">Sort</button>                </form>                                          <?php $pages = get_pages('child_of='.$thispage.'&sort_column='.$sortables.'&sort_order='.$ascdesc.'&parent='.$thispage.'&number=2'); $count = 0; foreach($pages as $page) : $content = $page->post_excerpt; $link = get_page_link($page->ID); ?>


title: How do I make WordPress revise an .htaccess file a certain way?

text: I've learned just a slight bit with WordPress Rewrite API -- just enough to add another rewrite rule for a plugin. The plugin works if installed in the root, but I'm finding that if one installs WordPress in a subdir, then I need to do the following changes to the .htaccess file. I'd like to know how to automate these changes if possible. As well, there's a second problem. If one goes to the Permalinks Settings in WordPress, my custom changes get overwritten (except for my special rule that uses WP Rewrite API). So, I need something that uses WordPress Rewrite API so that they don't get overwritten. **Original .htaccess file**               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /mysubdir/     RewriteRule ^index\.php$ - [L]     # my special WP Rewrite API line     RewriteRule ^special(.*)$ /mysubdir/wp-content/plugins/special/app/$1 [QSA,L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /mysubdir/index.php [L]     </IfModule>     # END WordPress      **Changes I Made To Make Plugin Work in a Subdir**               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On          #RewriteBase /mysubdir/          RewriteRule ^index\.php$ - [L]     # my special WP Rewrite API line     RewriteRule ^special(.*)$ /mysubdir/wp-content/plugins/special/app/$1 [QSA,L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d          #RewriteRule . /mysubdir/index.php [L]          RewriteRule . index.php [L]     </IfModule>     # END WordPress


title: Categories and tags for custom post types

text: I'm having a hard time explaining this, so bare with me. Category and tag links for my custom post type aren't working as I expected them to. Instead of getting `http://www.example.com/projects/category/example- category`, the links that are `http://www.example.com/category/example- category`. In other words, I can't figure out how to make my categories post- type specific. In the dashboard, my Projects post type has both a Tags and a Categories section, but editing them results in the same changes being made to the main Posts post type. How can I create post-type specific categories? Here's my code to create the post type:               function projects_create_post_type() {         $labels = array(             "add_new" => "Add New",             "add_new_item" => "Add New",             "all_items" => "All Projets",             "edit_item" => "Edit",             "menu_name" => "Projects",             "name" => "Projects",             "new_item" => "New",             "not_found" =>  "No projects found",             "not_found_in_trash" => "No projects found in Trash",             "search_items" => "Search Projects",             "singular_name" => "Project",             "view_item" => "View",         );         $args = array(             "has_archive" => true,             "hierarchical" => false,             "labels" => $labels,             "menu_icon" => __("dashicons-hammer"),             "menu_position" => 5,             "public" => true,             "slug" => "projects",             "supports" => array(                 "editor",                 "thumbnail",                 "title",             ),             "taxonomies" => array("post_tag", "category"),         );         register_post_type("projects", $args);     }     add_action("init", "projects_create_post_type");


title: Contact Form 7 from adding paragraph and break tags to HTML emails

text: I'm trying to stop Contact From 7 from adding paragraph and break tags to HTML emails but can't figure it out. About 4 blank paragraph tags are added at the beginning of the email and two at the end. This question brings up the same issue, and the fix is said to have come in a recent update but I have the most recent one and no luck. Any ideas?


title: How to get all of the activate_plugin action parameters?

text: I am trying to hook into activate_plugin. I know that activate_plugin has 1 required param and 2 optional ones. I am trying to acquire all 3. Here's my setup:               // create plugin settings menu     add_action('admin_menu', 'pe_create_menu');               function pe_create_menu() {            //create new sub-level menu       add_submenu_page( 'plugins.php', 'Plugin Settings', 'Plugin Enabler', 'administrator', __FILE__, 'pe_settings_page' );            // Add my hook       add_action( 'activate_plugin', 'pe_network_activate', 10, 3 );     }      And my function:               function pe_network_activate( $plugin, $redirect = '', $network_wide = false ) {       $args = var_export( func_get_args(), true);       _log("Args: " . $args); // write to the WP error_log     }      $args returns only the first parameter. How do I get all 3? My goal is to be able to tell when a plugin is being network activated, or just normally activated - hence the need for $network_wide.


title: Custom post types - RSS lastBuildDate issue

text: I'm using CMS Press for custom post types. The issue is the feed doesn't validate because lastBuildDate is blank. I am not using WordPress's default posts for anything and that is causing the problem. I did a test post using WordPress's default post and voila lastBuildDate was filled in and the feed validated. As soon as I deleted the post it removed the date in lastBuildDate and the feed didn't validate. I'm using the code below to add the custom post types in the main feed but this is an issue with the feeds created by the custom post types also. Am I missing something to get the lastBuildDate to populate?               if ( ( is_front_page() && false == $query->query_vars['suppress_filters'] ) || is_feed() ){             $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;             query_posts( array('post_type'=>array('post', 'games', 'entertainment', 'tech', 'podcasts'),'paged'=>$paged ) );     }       **I answered my own question below.**


title: Amazon.com intergration with WordPress?

text: Wanted to know if there was any documentation or plugins that allowed a site to pull prices and other information from Amazon.com on DVD's and other products. I'm creating a plugin that stores information about DVD releases and I would like to create code that pulls the price from Amazon, and calculates the difference compared the MSRP and of course provide a link to the Amazon page for purchase. I do know that much of Amazon's API revolves around the product's Amazon ID number, so I know I'll have to story it with the custom post type associated with the release. Has this been done before?


title: Good tools for locating hooks in a wordpress page/admin interface/blog post?

text: I've recently started using the Hikari Hooks plugin for Wordpress as it seems to allow you to get a good idea of what do_actions are being called on the page, so that you can easily find out where potential hooks for plugin code might lie. Are there better tools/plugins for accomplishing the same thing? In particular I was looking for one that might notify me of post status transition actions such as new_to_publish and draft_to_publish...It appears that Hikari Hooks does notify you of such changes but not that they are available, only if you're already added them as an action.


title: Text cut off on save

text: I am using WP 3.4. My problem occurs when I attempt to copy and paste anything into the post or page editor of WordPress. The situation arises every time I save or attempt to preview the post. The post gets truncated and about 65% of the text gets chopped off the end of the post. This does not happen if I manually enter content into the text box and then preview or save it. This works well on my other WP site but not this new install. I have used text editors to strip out formatting. I have also used the text editor copy and paste feature within WordPress but nothing works. Here’s some background. I first installed WordPress 3.4 through Bluehost. That's when I discovered the problem. I then reinstalled WP through BlueHost. This did nothing to resolve the issue. I then downloaded WordPress and uploaded it to BlueHost but the problem still exists. I tried using the 20/10 theme. Then I tried using the Genesis Framework theme. I also tried using the Genesis Framework with the Prose child theme. The problem would occur each and every time. I should note here that all plugins are turned off while attempting to create a post. I did not link to the site as it is under construction and the only post available was manually entered into the text editor and saved which does not cause a problem. Here is an example of what happens. I copy this text into the text box. > I have been involved in Local SEO long enough to remember my old friend the > Local Business Center. This service offered free business listing similar to > a local directory site. I thought what a great idea.   >  The fact that these listings were being featured by Google for local > searches made them extremely useful. If your local website was having > problems, ranking in the organic results this was a godsend.   >  In the early days just claiming or setting up a listing got your business > onto the first page of the Google results. It was often a one and done > situation for many small business owners.   >  With little or no effort, you could easily land on the first page of the > Google results in most markets. Moreover, this wasn’t always true for many > websites trying to get onto Google results front page. _(for the full text see revision history)_ This is what is left after I save or preview it. > "I have been involved in Local SEO long enough to remember my old friend the > Local Business Center. This service offered free business listing similar to > a local directory site. I thought what a great idea.   >  The fact that these listings were being featured by Google for local > searches made them extremely useful. If your local website was having > problems, ranking in the organic results this was a godsend.   >  In the early days just claiming or setting up a listing got your business > onto the first page of the Google results. It was often a one and done > situation for many small business owners.   >  With little or no effort, you could easily land on the first page of the > Google results in most markets. Moreover, this wasn" It also occurs with much smaller posts as well. I have been working on this problem for about a week and could use any help available.


title: How to remove thumbnail sizes for specific post type on a child theme?

text: The theme I'm using includes a slideshow that generates an additional 4 image sizes for every image that is uploaded. I don't need to have all those images being generated for every image. Is there a way to remove the slideshow thumbnail sizes for a custom post type in my child theme? Thanks


title: Insert attachments from custom uploader into post (regular uploader style)

text: I recently started using this nifty meta box framework: http://www.deluxeblogtips.com/meta-box-script-for-wordpress/ I really like the plupload meta box, however, I need to be able to add the uploaded image into the editor rather than just attaching it to the post. Any idea how I can create a button that inserts the correct attachment into the editor like it works with the regular "insert into post" button when uploading using the regular uploader?