Enable Media Modal Dropdown Filter

Trying to figure this out for a plugin I'm working on: Using the built in media modal in WordPress to select media and I noticed a few difference between a media modal frame that is set as `post` vs `select`. `post`, which is used by WordPress to insert media into a posts content, has a dropdown filter so you can see just the images or audio: ![Media Modal Example 1](http://i.stack.imgur.com/ktN4W.jpg) If you use `select`, which the more simpler modal that most tutorials use, the dropdown is absent: ![enter image description here](http://i.stack.imgur.com/IqYkA.jpg) I was wondering if there was a way to activate that dropdown filter?


How can I add a custom button to the post editor toolbar?

I'd like to add a button the the WordPress editor's toolbar. When clicked, I want to open a modal dialog (exactly like what you get when you click the "Paste from Word" icon). This might be more than one question, so the first question I have is what code to I need to add to my theme's functions.php to place the button with a click event that opens a modal window similar to the Word dialog?


Fetching review value using wpdb class

I'm generating an XML file using PHP for a website where they review tech products. In the XML file, I have to display the rating of products. For rating purposes, I'm using GD Star Rating plugin. I've been experimenting with wpdb class to fetch the rating of each product. However I've not had any luck so far. I'm using the following SQL code on phpmyadmin and I'm able to to fetch the rating for any product review I want               SELECT review FROM tableName_gdsr_data_article WHERE post_id = 4627      But when I try this SQL code in PHP, as seen below, all I get is bunch of errors.               $post_id = $post->ID;     $reviewScore = $wpdb->query(         $wpdb->prepare(          "SELECT review FROM tableName_gdsr_data_article WHERE post_id = '$post_id'"         )     );      Does anyone have any idea why the code above doesn't work? Any help would be much appreciated. Thanks in advance


Overwrite default XMLRPC function from plugin

I want to overwrite the "metaWeblog.newMediaObject" xmlrpc call so the file is saved remotely. From mw_newMediaObject in class-wp-xmlrpc-server.php, i see that there is a hook:               do_action('xmlrpc_call', 'metaWeblog.newMediaObject');      So I should be able to do something in my plugin like:               add_action ('xmlrpc_call', 'myWewMediaObject');     function myWewMediaObject ($method) {         if ($method=='metaWeblog.newMediaObject') {            //perform some custom action         }     }      However, since the do_action call is at the beginning of the mw_newMediaObject function, I am unsure how to stop the execution after my plugin function exists. Please let me know if I am on the right track and if there is another way to do this.


Different style for most recent article

I'd like to make my most recent article display a large with a larger thumbnail and with more content, while the rest of the posts in the loop show a small thumbnail and only the title with no content. Is there a way I can do this in one `while(have_posts())` loop?


Is there a wordpress listserv or email group plugin?

There are plenty of WP plugins for one-way correspondence... ie mailing lists where the owner can send out newsletters, etc. but i am looking to integrate the functionality of a listserv or email group for my WP users, where anyone in the group can address the whole group, but those outside the group cannot. i _could_ do this in google groups, but was hoping to integrate it w/ my club's WP site so that i could use it in conjunction with a membership plugin to keep track of who has paid the club dues and so forth. edit to add: i think that MailPress or especially Email Users might work (Email Users if I adjust the capabilities) but ideally the group would be able to send messages from their emails to a single address (like with google groups) and not have to log in to send a message from the admin. there is no way i am going to be able to teach all of these people how to use WP, so i want the friction to be minimal. is this possible w/ WP?


custom image size not being fetched

I'm developing a theme for a customer in which i need several versions of the same image. In my functions.php file i've added all the image sizes i need. For instance:               if ( function_exists( 'add_theme_support' ) ) {        add_theme_support( 'post-thumbnails' );      }     if ( function_exists( 'add_image_size' ) ) {         add_image_size('frontpage-post-thumbnail', 192, 192,true );         add_image_size('listing-post-thumbnail', 670, 290,true );         add_image_size('preview-post-thumbnail', 640, 640,true );         add_image_size('preview-onepost-thumbnail', 480, 480,true );         add_image_size('preview-twopost-thumbnail', 240, 240,true );         add_image_size('page-single-thumbnail', 160,9999, false);     }      Now, in my archive.php template, i need the "listing-post-thumbnail" version, but wordpress uses the original image instead. I've checked and the 670x290 version of the image exists in the same folder as the original. Here is the code in archive.php                                   <figure>                             <a href="<?php the_permalink(); ?>" title="Access node: <?php the_title(); ?>">                              <?php echo get_the_post_thumbnail($id, array(670,290)); ?>                             </a>                         </figure>


is_home() returns false on the home page! When is the home page NOT the home page?

I've placed the following code in my functions.php file               if(!is_home()){ echo "Not Home";}     if(is_home()){ echo "Home";}      However, no matter what page I'm on, I get "Not Home", And I'm real sure I'm on the home page, but still get "Not Home". What am I missing?


Building tags and archive using meta from custom post type

I have a custom post type, promotions, and it has 2 meta fields to set dates with jQuery date picker, begin date & end date, year, month, day. What I'm trying to do is show a list of months with a header for the year between each grouping, clicking a month would take you to an archive of promotions posts that began in the same year as the heading, clicking the year would be an archive of all the promotions that started in that year. Example:               2012       January       March     2011       December       August       June      I realize an easy way to do this could be to just have a year and month taxonomy for the end date and beginning date but it has been requested, and would be the most user friendly, to only require the user entering data to have to enter the ending date, and begining date of the promotion once. Thanks


Is there a plugin that counts posts by author?

I want to have a page listing all the authors and the number of posts each of them has published. Is there a plugin that does this already? Being able to count number of comments as well would be a plus. Thanks for the help.


Is there a plugin for rating of multiple questions for wordpress?

I have developed a site in worpdress. I need to manage a different questions like "How would you rate our customer service", "How satisfied were you with our service" and more questions and rate these questions and have view on the admin. I tried to find the plugin but could not find. Can anyone let me know if that type of plugin exists or do I need to do with my own codes? Thank you in advance


Define a name to the posts slug

I would like to use the url `http://site.com/post/title-of-the-post` for my posts and I've saw in my admin page I have the current url `http://site.com/%slug%/title-of-the-post` obiouvsly incorrect. How can I define the slug for my default posts? I'm using various custom post types so I would like to name the default posts simply to `post`, is it possible?


Get the current hierarchy php page

Does exist some way to get the current searched hierarchy php page in `Wordpress`? I've set a default category to my posts named `post` so if I digit `http://site.com/post` which php page is searched in the `hierarchy`? It would be great to get the current page searched.


Multiple Queries and Excluding Repeating Posts?

I'm trying to work out how to exclude posts used in the first four custom queries in the last typical query.. haven't been able to find anything that will explain how to do this clearly. My First four loops:               <?php      // Loop 1         $first_query = new WP_Query('category_name=funding&showposts=1'); // select category         $ids = array();          while($first_query->have_posts()) : $first_query->the_post(); ?>                  <?php the_title(); ?>
              <?php endwhile;               // Loop 2         $second_query = new WP_Query(array('post__not_in' => $ids,'category_name' => 'industry','posts_per_page' => 1)); // select category         while($second_query->have_posts()) : $second_query->the_post();         $ids[] = get_the_ID(); ?>                  <?php the_title(); ?>
              <?php endwhile;               // Loop 3         $third_query = new WP_Query(array('post__not_in' => $ids,'category_name' => 'open-consultations','posts_per_page' => 1)); // select category         while($third_query->have_posts()) : $third_query->the_post();         $ids[] = get_the_ID(); ?>                  <?php the_title(); ?>
              <?php endwhile;               // Loop 4         $fourth_query = new WP_Query(array('post__not_in' => $ids,'category_name' => 'policy','posts_per_page' => 1)); // select category         while($fourth_query->have_posts()) : $fourth_query->the_post();         $ids[] = get_the_ID(); ?>                  <?php the_title(); ?>              <?php endwhile; ?>      A typical WordPress query that I want to remove repeating posts from:               <?php if ( have_posts() ) : ?>          <?php /* Start the Loop */ ?>     <?php while ( have_posts() ) : the_post(); ?>          <a href="<?php the_permalink(); ?>"><?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'category-thumb', array('class' => 'alignleft')); } ?>                       <?php the_time('l, F jS, Y') ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
              <?php the_excerpt(); ?>
          <?php endwhile; ?>     <?php wp_pagenavi(); ?>           <?php endif; ?>


How to deactivate my plugin upon deactivation of NextGen

i'm writing this plugin and i need to deactivate it when NextGen is deactivated:               <?php     /*     Plugin Name: Plugin Name     Description: Description     Version: 1.0     Author: Author     Author URI: Author URI     */          // ini_set( "display_errors", 0);          global $nextgenUrl;     $nextgenUrl = str_replace('/','\\',WP_PLUGIN_DIR.'nextgen-gallery\nggallery.php');          register_deactivation_hook( $nextgenUrl , 'disattiva' );          [... other code ...]          function disattiva(){         deactivate_plugins(__FILE__);     }      but it doesn't work. Any idea? :( I've also used these urls:               $nextgenUrl = 'nextgen-gallery\nggallery.php';     $nextgenUrl = '/nextgen-gallery/nggallery.php';      and still it doesn't work.


category__not_in and id values from variable

How can I set the values for category__not_in from two variables. On my example I just hardcode the ID of each category to exclude, but... how can I pass these values from some variables ?                   $category_a = get_category_by_slug('fbrt');         $category_b = get_category_by_slug('contact');              $exclude = get_the_ID();         global $wp_query;         $exclude = $wp_query->post->ID;         $args = array(             'category_name' => 'olympic-physique',             'category__not_in' => array(1, 2),             'posts_per_page' => -1,             'orderby' => 'title',              'order' => 'DESC'     );


Child theme grabbing wrong location fo parent theme files

I purchased a Wordpress theme this week, and to keep my changes separate from the original theme, I created a child theme for it. Right now it's just a barebones child theme, the style.css file and screenshot. The parent theme has several CSS and jQuery scripts that it includes. The problem however is that the child theme looks for these files in the child theme directory, rather than the parent. For example if I am using the parent theme the location would be: ParentTheme/js/jquery.easing.js However in the child theme, it looks for the files here: ChildTheme/js/jquery.easing.js Rather than the parent theme like I would assume. I tried copying the CSS and JS folders, but that didn't work either. Am I doing something wrong? How would I use a child theme for a parent theme that has several CSS and JS files that are needed? You can take a look for yourself here if you would like: http://panther.c1.vadc1.cloudweb.com/~jsfashio/


Wordpress - Admin Manage Posts - Multiple Filters by Parent Category

Lets say I have the following Categories in Wordpress: Product Category - Cat A - Cat B - Cat C Service Type - Service A - Service B - Service C On the Manage Posts page on the Admin side, I want to have 2 drop down filters for both Product Category, and Service Type, so I can filter by both on the backend. How can I do this?


Adding a unique class to wp_nav_menu

How would I go about adding a unique class to the direct child li elements of the main parent ul element generated with wp_nav_menu?

Page1

Sub-Page1-1

Sub-Page1-2

           I'd like to add the class `menu_element` to `li id="menu-item-30"` and every child li of the parent ul after. Is this possible? Thanks in advance!


If I set the permissions to the CSS file in my theme to 444 and then attempt to edit it in the Appearance Editor, WordPress is not prevented from editing the file and in fact change the permissions to 644 while it makes the edit. Why does WordPress change a file's permissions? How do I make the site more secure and prevent this?


How to add a second custom menu in my sidebar when theme only supports one?

I simply want a second menu in my sidebar to show on all pages. My theme only supports one custom menu though. I am using the first custom menu for the top level nav, and I wanted my 2nd custom menu in the sidebar. I created a second menu and tried adding it using the custom menu widget, however this just adds my first menu, I'm guessing because the theme only supports one menu.


Upgrade to Google Analytics for Wordpress 5.0.5 creates warning messages

The upgrade to 5.0.5 on my WP installs appears to have added some new features which aren't being checked correctly in the code - you will probably see errors like this one Notice: Undefined index: anonymize_ips in /.../wp-content/plugins/google- analytics-for-wordpress/frontend/class-ga-js.php on line 79 Notice: Undefined index: debug_mode in /.../wp-content/plugins/google- analytics-for-wordpress/frontend/class-ga-js.php on line 114  How do I get rid of these?


Randomly Display One Image From a 10-Image For Loop

I have a Wordpress function that loops thru 10 input fields & saves the data from those input fields. The data entered is either an absolute or relative link to an image. The loop looks like this.               <?php for ($i = 1; $i < 11; $i++) { ?>              <input type="text" name="<?php echo 'fresh_banner'.$i ?>" value="<?php echo $settings['fresh_banner'.$i]; ?>" />          <?php } ?>      The saving looks like this:               <?php          function freshSaveThemeSettings() {              $settings = get_option( "freshThemeSettings" );                  for ($i = 1; $i < 11; $i++) {                      $settings['fresh_banner'.$i] = $_POST['fresh_banner'.$i];                  }              $updated = update_option( "freshThemeSettings", $settings );          }          ?>      To output one of the images, it goes something like this:               <?php               $settings = get_option( "freshThemeSettings" );               echo $settings['fresh_banner1'];           ?>      What I'm trying to do is randomly display one of the images at a time. Each time the page is refreshed, a new image would be displayed. What is the best way to go about this?


Display Content if Meta Checkbox is checked?

Basically i have a custom post with a custom metabox, with a checkbox inside it. If you check the box i want something (styled box) to appear within the post loop. If not checked the box doesn't appear... I have the following in my template page..               <?php get_header(); ?>          <?php $loop = new WP_Query( array( 'post_type' => 'books','posts_per_page' => '-1') ); ?>          <?php while (have_posts()) : the_post() ; $meta = get_post_meta( get_the_ID(), 'rw_title_block', true ); ?>          <?php if( checked( $meta, 1, false ) ) : ?>            check box is checked to display stuff like... <?php the_title(); ?>          <?php endif ?>               not checked ignore this stuff...          <?php endwhile; ?>          <?php wp_reset_query() ?>          <?php get_footer(); ?>      The metabox functions code (this seems to display fine in the admin.)               $meta_boxes[] = array(     'id'         => 'test_metabox',     'title'      => 'Test Metabox',     'pages'      => array( 'books', ),     'context'    => 'normal',     'priority'   => 'high',     'show_names' => false,      'fields'     => array(              array(             'name' => 'Test Checkbox',             'desc' => 'field description (optional)',             'id'   => $prefix . 'title_block',             'type' => 'checkbox',         ),          ),     );      Thank you for any help, it would be a life saver. Regards.


noheader on the user/frontend side

I have an application which has the following structure on the user/frontend side:               usercontroller: generates output     userformhandler: processes user input and redirects back to usercontroller      So, when the user inputs data the following type of URL is called:               http://localhost/wordpress/?page_id=4&ftype=userform&func=edit&noheader=true      In this model, the userformhandler processes the data, saves it and then redirects back to the usercontroller. On the admin side (which calls ftype=adminform) this works fine. On the user side however, I get the following error:               WARNING: CANNOT MODIFY HEADER INFORMATION - HEADERS ALREADY SENT BY      (OUTPUT STARTED AT /VAR/WWW/HTML//WORDPRESS/WP-INCLUDES/L10N.PHP:156)      IN /VAR/WWW/HTML/WORDPRESS/WP-INCLUDES/PLUGGABLE.PHP ON LINE 881      The headers are being sent from the search box of the twentyeleven theme. Some investigation leads me to believe that the noheader parameter is only honored in ./wp-admin/admin.php ... Seeing this, is there any way to do this type of processing on the user side without generating headers, ie: do some processing which does not generate output and redirect back to another controller on the user side? Greetings/Thanks


Combo/Drop down box on plugin settings page that allows additional options to be added

I'm not sure what this is called and have not had much success searching for it yet. In a plugin settings page, I would like a 'combo box' or 'drop down box' that also includes the ability to add an option that is not currently included. That newly added option would be added to the options in the box from that point on. Is there such a function within the Settings API or does it need a separate text box that is then added to the options array? Or a better way altogether? Thanks :)


Allow anonymous comments, but prevent spam

1. Captcha, reCapthca and the like have serious usability issues. And basically anything that requires a user to fill an extra field (other than the comment) each time the user posts a comment, is considered bad usability. ( **NOTE:** I hope you do realize that users need only enter their name and email address once when it comments on a website, unless he clears the cache.) So, plugins like **Better WordPress reCAPTCHA, WP-reCAPTCHA, Spam Free WordPress**, etc. although are extremely good at what they do, are out of the question considering the aforementioned concerns.   2. Plugins like **Bad Behavior, WP-Hashcash Extended** (successor of WP-Hashcash), .htaccess rules for preventing recognized spamming techniques and bots, etc. aren't without false positives. Sometimes, they are known to even block search engine crawlers coming from a new IP address range. Also, depending on JavaScript to basically authenticate comments isn't really a _great way_ , IMO. Just saying. **As I see it, it all boils down toAkismet, Impostercide, and Cookies for Comments anti-spam plugin combo.** _(AntiSpamBee, Defensio, and TypePad AntiSpam, among others, are aimed to be Akismet alternatives. While many don't like Akismet because it's from a company that believes in open source, but isn't free, many of us still acknowledge that it's next to none.)_ **So...**   * What _else_ should I do? (rather, should I be doing something else that's more effective?)   * Has anyone tried ZigTrap? How does it compare to others? (Too many false positives is a moderation/spam queue overhead.) **PS:** I am sure that there's no "best for all" solution. But it will help if you can share what works best for you. **TLDR:** How do I prevent spam on WordPress comments without requiring manual approval or user login/registration?


Display the deepest child category from Category X (in loop)

I have a number of top-level categories including "News" and "Sport". They each have multiple levels of child categories as shown below.   * **News**     * Australia        * NSW          * Sydney   * **Sports**     * Cycling        * Road Cycling       * BMX     * Triathlon In my loop I want to display a single category - **what ever is the deepest child category of "Sport"**. I have found some code on StackOverflow that does returns the deepest child category, but not from a **specific category**. It returns the the deepest child category from _all_ top-level categories. So if a post is in two categories (Sydney and Triathlon) the code shows Sydney as the deepest child category. I somehow need to specify that which top-level category I want the deepest child to come from. In this case that would be "Sport" and the deepest child cat would therefore be "Triathlon".


show most viewed posts of last days by link?

I use this link to get most viewed posts:               http://mydomain.com/?post_type=movies&meta_key=post_views_count&orderby=meta_value&order=ASC      But that gives me ALL posts from this post type in order of the most viewed - but I'd like to have only the latest most viewed posts from that custom post type of e.g.. 30 days. How could I handle this? thank you! AD


Why is get_post_format() for "Standard" returns empty

I've enabled custom posts types               add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote', 'image' ) );      The default post type is set on `Standard`, and it works for all but the `Standard` type, when I have a standard post the `get_post_format()` return empty. did I miss something in enabling them?


export category and sub-category

I'm trying to export a specific category with it's sub-categories. However, Wordpress export option allows either to export all of the categories or to export one specific category at a time. Is there any solution? Thanks.


Images uploading to wrong folder

Images keep uploading to /uploads/2010/07 instead of /uploads/2011/06. Permissions are set to 777 just to find out if 755 is an issue, and it's not. I don't have anything in Media to define a new path. It just keeps uploading to the oldest folder. This was an XML dump from another WP to the new WP, so I'm not sure if that had anything to do with it, or not. I can see the image files fine and they post in the post editor, they're just going to the oldest folder and it's not autocreating a new one. I'm running the latest wp 3.1.3. I do have a bunch of plug-ins, the image thumbnail regenerator is one, and I've got a bunch of plugins for sidebar widgets, but nothing out of the ordinary.


what types of order can I pass to get_posts() via orderby?

Here describes get_posts() function. I would like to know what types of order can I pass to `get_posts`? in WP admin, I can see menu order, title, date, random and ...


Websites defaced by uploading script using theme editor

We've had several Wordpress sites defaced, all of them having the same pattern (at least the raw access log says so). From the logs it appears they directly login to Wordpress then go to theme editor > edit the 404.php file with a malicious code, they now run the code to deface the site. Here is the log (the site replaced with example.com)               125.167.118.62 - - [01/Aug/2012:14:22:58 +0800] "GET / HTTP/1.1" 200 6318 "-" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:23:00 +0800] "GET /wp-content/themes/Wallbase/css/supersized.css HTTP/1.1" 200 2556 "http://example.com/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:23:00 +0800] "GET /wp-content/themes/Wallbase/js/effects.js?ver=3.4.1 HTTP/1.1" 200 890 "http://example.com/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:23:00 +0800] "GET /wp-content/themes/Wallbase/js/superfish.js?ver=3.4.1 HTTP/1.1" 200 3083 "http://example.com/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:23:00 +0800] "GET /wp-content/themes/Wallbase/style.css HTTP/1.1" 200 23095 "http://example.com/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:23:01 +0800] "GET /wp-content/themes/Wallbase/js/supersized.3.1.3.min.js?ver=3.4.1 HTTP/1.1" 200 11671 "http://example.com/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:23:00 +0800] "GET /wp-content/themes/Wallbase/css/prettyphoto.css HTTP/1.1" 200 19697 "http://example.com/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:23:01 +0800] "GET /wp-content/themes/Wallbase/js/jquery.prettyPhoto.js?ver=3.4.1 HTTP/1.1" 200 22373 "http://example.com/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:23:02 +0800] "GET /favicon.ico HTTP/1.1" 404 - "-" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:23:00 +0800] "GET /wp-includes/js/jquery/jquery.js?ver=1.7.2 HTTP/1.1" 200 94861 "http://example.com/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:23:02 +0800] "GET /wp-login.php HTTP/1.1" 200 2171 "-" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:23:04 +0800] "GET /wp-admin/css/colors-fresh.css?ver=3.4.1 HTTP/1.1" 200 36317 "http://example.com/wp-login.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:23:04 +0800] "GET /wp-admin/css/wp-admin.css?ver=3.4.1 HTTP/1.1" 200 108246 "http://example.com/wp-login.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:23:07 +0800] "GET /wp-admin/images/button-grad.png HTTP/1.1" 200 243 "http://example.com/wp-admin/css/colors-fresh.css?ver=3.4.1" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:23:07 +0800] "GET /wp-admin/images/wordpress-logo.png?ver=20120216 HTTP/1.1" 200 5048 "http://example.com/wp-admin/css/wp-admin.css?ver=3.4.1" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:13 +0800] "POST /wp-login.php HTTP/1.1" 302 - "http://example.com/wp-login.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:14 +0800] "GET /wp-admin/ HTTP/1.1" 200 52163 "http://example.com/wp-login.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:19 +0800] "GET /wp-admin/load-styles.php?c=1&dir=ltr&load=admin-bar,wp-admin&ver=3.4.1 HTTP/1.1" 200 28480 "http://example.com/wp-admin/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:20 +0800] "GET /wp-includes/js/thickbox/thickbox.css?ver=3.4.1 HTTP/1.1" 200 3870 "http://example.com/wp-admin/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:20 +0800] "GET /wp-admin/css/colors-fresh.css?ver=3.4.1 HTTP/1.1" 304 - "http://example.com/wp-admin/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:20 +0800] "GET /wp-content/themes/Wallbase/images/slide.png HTTP/1.1" 200 198 "http://example.com/wp-admin/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:21 +0800] "GET /wp-admin/load-styles.php?c=1&dir=ltr&load=wp-jquery-ui-dialog&ver=3.4.1 HTTP/1.1" 200 1087 "http://example.com/wp-admin/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:22 +0800] "GET /wp-admin/images/wpspin_light.gif HTTP/1.1" 200 2193 "http://example.com/wp-admin/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:24 +0800] "GET /wp-admin/images/media-button.png?ver=20111005 HTTP/1.1" 200 3117 "http://example.com/wp-admin/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:20 +0800] "GET /wp-includes/css/editor.css?ver=3.4.1 HTTP/1.1" 200 43861 "http://example.com/wp-admin/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:20 +0800] "GET /wp-admin/load-scripts.php?c=1&load=jquery,utils&ver=3.4.1 HTTP/1.1" 200 37529 "http://example.com/wp-admin/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:21 +0800] "GET /wp-admin/load-scripts.php?c=1&load=admin-bar,hoverIntent,common,jquery-color,wp-ajax-response,wp-lists,quicktags,jquery-query,admin-comments,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,postbox,dashboard,thickbox,plugin-install,media-upload,word-count,jquery-ui-resizable,jquery-ui-draggable,jquery-ui-button,jquery-ui-position,jquery-ui-dialog,wpdialogs,wplink,wpdialogs-popup&ver=3.4.1 HTTP/1.1" 200 56368 "http://example.com/wp-admin/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:51 +0800] "GET /wp-includes/images/admin-bar-sprite.png?d=20111130 HTTP/1.1" 200 3999 "http://example.com/wp-admin/load-styles.php?c=1&dir=ltr&load=admin-bar,wp-admin&ver=3.4.1" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:51 +0800] "GET /wp-admin/images/arrows.png HTTP/1.1" 200 494 "http://example.com/wp-admin/css/colors-fresh.css?ver=3.4.1" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:51 +0800] "GET /wp-admin/images/menu-shadow.png HTTP/1.1" 200 131 "http://example.com/wp-admin/css/colors-fresh.css?ver=3.4.1" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:51 +0800] "GET /wp-admin/images/wp-badge.png?ver=20111120 HTTP/1.1" 200 14352 "http://example.com/wp-admin/load-styles.php?c=1&dir=ltr&load=admin-bar,wp-admin&ver=3.4.1" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:52 +0800] "GET /wp-admin/images/white-grad.png HTTP/1.1" 200 210 "http://example.com/wp-admin/css/colors-fresh.css?ver=3.4.1" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:52 +0800] "GET /wp-admin/images/xit.gif HTTP/1.1" 200 182 "http://example.com/wp-admin/load-styles.php?c=1&dir=ltr&load=admin-bar,wp-admin&ver=3.4.1" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:51 +0800] "GET /wp-admin/images/menu.png?ver=20120201 HTTP/1.1" 200 13585 "http://example.com/wp-admin/css/colors-fresh.css?ver=3.4.1" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:52 +0800] "GET /wp-includes/js/thickbox/loadingAnimation.gif HTTP/1.1" 200 5886 "http://example.com/wp-admin/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:24:51 +0800] "GET /wp-admin/images/icons32.png?ver=20111206 HTTP/1.1" 200 13441 "http://example.com/wp-admin/css/colors-fresh.css?ver=3.4.1" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:25:00 +0800] "GET /wp-admin/theme-editor.php HTTP/1.1" 200 47622 "http://example.com/wp-admin/" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:25:03 +0800] "GET /wp-admin/css/colors-fresh.css?ver=3.4.1 HTTP/1.1" 304 - "http://example.com/wp-admin/theme-editor.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:25:04 +0800] "GET /wp-admin/load-scripts.php?c=1&load=admin-bar,hoverIntent,common,jquery-color&ver=3.4.1 HTTP/1.1" 200 5480 "http://example.com/wp-admin/theme-editor.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:25:25 +0800] "POST /wp-admin/theme-editor.php HTTP/1.1" 200 48032 "http://example.com/wp-admin/theme-editor.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:25:28 +0800] "GET /wp-admin/css/colors-fresh.css?ver=3.4.1 HTTP/1.1" 304 - "http://example.com/wp-admin/theme-editor.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:25:48 +0800] "GET /wp-admin/theme-editor.php?file=404.php&theme=twentyten HTTP/1.1" 200 26759 "http://example.com/wp-admin/theme-editor.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:25:50 +0800] "GET /wp-admin/css/colors-fresh.css?ver=3.4.1 HTTP/1.1" 304 - "http://example.com/wp-admin/theme-editor.php?file=404.php&theme=twentyten" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:27:20 +0800] "GET /wp-admin/images/button-grad-active.png HTTP/1.1" 200 284 "http://example.com/wp-admin/css/colors-fresh.css?ver=3.4.1" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:27:20 +0800] "POST /wp-admin/theme-editor.php HTTP/1.1" 302 - "http://example.com/wp-admin/theme-editor.php?file=404.php&theme=twentyten" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:27:58 +0800] "GET /wp-admin/theme-editor.php?file=404.php&theme=twentyten&scrollto=22492&updated=true HTTP/1.1" 200 151535 "http://example.com/wp-admin/theme-editor.php?file=404.php&theme=twentyten" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:28:06 +0800] "GET /wp-admin/css/colors-fresh.css?ver=3.4.1 HTTP/1.1" 304 - "http://example.com/wp-admin/theme-editor.php?file=404.php&theme=twentyten&scrollto=22492&updated=true" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:29:01 +0800] "GET /wp-content/themes/twentyten/404.php HTTP/1.1" 200 39291 "-" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:29:04 +0800] "GET /wp-content/themes/twentyten/404.php?x=img&img=sort_asc HTTP/1.1" 200 85 "http://example.com/wp-content/themes/twentyten/404.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:29:04 +0800] "GET /wp-content/themes/twentyten/404.php?x=img&img=ext_lnk HTTP/1.1" 200 572 "http://example.com/wp-content/themes/twentyten/404.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:29:04 +0800] "GET /wp-content/themes/twentyten/404.php?x=img&img=small_dir HTTP/1.1" 200 498 "http://example.com/wp-content/themes/twentyten/404.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:29:04 +0800] "GET /wp-content/themes/twentyten/404.php?x=img&img=ext_diz HTTP/1.1" 200 1034 "http://example.com/wp-content/themes/twentyten/404.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:29:04 +0800] "GET /wp-content/themes/twentyten/404.php?x=img&img=change HTTP/1.1" 200 290 "http://example.com/wp-content/themes/twentyten/404.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:29:04 +0800] "GET /wp-content/themes/twentyten/404.php?x=img&img=ext_php HTTP/1.1" 200 1125 "http://example.com/wp-content/themes/twentyten/404.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:29:04 +0800] "GET /wp-content/themes/twentyten/404.php?x=img&img=download HTTP/1.1" 200 161 "http://example.com/wp-content/themes/twentyten/404.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:29:05 +0800] "GET /wp-content/themes/twentyten/404.php?x=img&img=arrow_ltr HTTP/1.1" 200 88 "http://example.com/wp-content/themes/twentyten/404.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:29:05 +0800] "GET /wp-content/themes/twentyten/404.php?x=img&img=ext_png HTTP/1.1" 200 175 "http://example.com/wp-content/themes/twentyten/404.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:29:05 +0800] "GET /wp-content/themes/twentyten/404.php?x=img&img=ext_css HTTP/1.1" 200 134 "http://example.com/wp-content/themes/twentyten/404.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:29:05 +0800] "GET /wp-content/themes/twentyten/404.php?x=img&img=ext_txt HTTP/1.1" 200 132 "http://example.com/wp-content/themes/twentyten/404.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:29:29 +0800] "GET /wp-content/themes/twentyten/404.php?x=ls&d=%2Fhome%2Fexample%2Fpublic_html%2F&sort=0a HTTP/1.1" 200 27424 "http://example.com/wp-content/themes/twentyten/404.php" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:29:31 +0800] "GET /wp-content/themes/twentyten/404.php?x=img&img=ext_htaccess HTTP/1.1" 200 117 "http://example.com/wp-content/themes/twentyten/404.php?x=ls&d=%2Fhome%2Fexample%2Fpublic_html%2F&sort=0a" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:29:32 +0800] "GET /wp-content/themes/twentyten/404.php?x=img&img=ext_html HTTP/1.1" 200 1125 "http://example.com/wp-content/themes/twentyten/404.php?x=ls&d=%2Fhome%2Fexample%2Fpublic_html%2F&sort=0a" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:30:17 +0800] "GET /wp-content/themes/twentyten/404.php?x=f&f=index.php&ft=edit&d=%2Fhome%2Fexample%2Fpublic_html HTTP/1.1" 200 7686 "http://example.com/wp-content/themes/twentyten/404.php?x=ls&d=%2Fhome%2Fexample%2Fpublic_html%2F&sort=0a" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:30:20 +0800] "GET /wp-content/themes/twentyten/404.php?x=img&img=ext_exe HTTP/1.1" 200 118 "http://example.com/wp-content/themes/twentyten/404.php?x=f&f=index.php&ft=edit&d=%2Fhome%2Fexample%2Fpublic_html" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:30:21 +0800] "GET /wp-content/themes/twentyten/404.php?x=img&img=ext_gif HTTP/1.1" 200 175 "http://example.com/wp-content/themes/twentyten/404.php?x=f&f=index.php&ft=edit&d=%2Fhome%2Fexample%2Fpublic_html" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:30:21 +0800] "GET /wp-content/themes/twentyten/404.php?x=img&img=ext_ini HTTP/1.1" 200 134 "http://example.com/wp-content/themes/twentyten/404.php?x=f&f=index.php&ft=edit&d=%2Fhome%2Fexample%2Fpublic_html" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:30:21 +0800] "GET /wp-content/themes/twentyten/404.php?x=img&img=ext_rtf HTTP/1.1" 200 164 "http://example.com/wp-content/themes/twentyten/404.php?x=f&f=index.php&ft=edit&d=%2Fhome%2Fexample%2Fpublic_html" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:31:14 +0800] "POST /wp-content/themes/twentyten/404.php?x=f&f=index.php&ft=edit&d=%2Fhome%2Fexample%2Fpublic_html%2F HTTP/1.1" 200 11608 "http://example.com/wp-content/themes/twentyten/404.php?x=f&f=index.php&ft=edit&d=%2Fhome%2Fexample%2Fpublic_html" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:33:28 +0800] "GET / HTTP/1.1" 200 3336 "-" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"     125.167.118.62 - - [01/Aug/2012:14:34:25 +0800] "GET /wp-content/themes/twentyten/404.php?x=f&f=index.php&ft=edit&d=%2Fhome%2Fexample%2Fpublic_html%2F HTTP/1.1" 200 11597 "http://example.com/wp-content/themes/twentyten/404.php?x=f&f=index.php&ft=edit&d=%2Fhome%2Fexample%2Fpublic_html" "Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0"      Now what baffles me is according to logs they all them seem to have logged-in directly to Wordpress as if they know the password (since it's only one login attempt in line 16 above). This is true even for sites only up one day ago and the passwords are not simple ABCs. It is also worth noting that only accounts with Wordpress installed were defaced. Normal HTML-only sites on the same server were not defaced. And while it's possible that there are key-loggers in client stations it certainly don't make sense as the hacker could've simply used cpanel instead of gong to all the trouble in WP. Given these facts, how can a hacker login to Wordpress and be successful on one attempt? EDIT: I found this in the log too but this is coming from the server's IP not the hacker's. But what's interesting is the "Alexa Toolbar" phrase is the same as this script I found: http://pastebin.com/raw.php?i=hcvPE8YV               [01/Aug/2012:14:22:47 +0800] "POST /wp-login.php HTTP/1.1" 200 3266 "-" "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; Alexa Toolbar; .NET CLR 2.0.50727)"     [01/Aug/2012:14:22:48 +0800] "GET /wp-admin/theme-editor.php HTTP/1.1" 302 - "-" "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; Alexa Toolbar; .NET CLR 2.0.50727)"     [01/Aug/2012:14:22:48 +0800] "GET /wp-login.php?redirect_to=http%3A%2F%2Fexample.com%2Fwp-admin%2Ftheme-editor.php&reauth=1 HTTP/1.1" 200 2187 "-" "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; Alexa Toolbar; .NET CLR 2.0.50727)"


Why does "Blog pages show at most" interfere with my custom wp_query?

I'm very new to WordPress, especially when it comes to creating a custom loop as per below. This works fine, however I'm perplexed why "Blog pages show at most" (under Settings > Reading) is interfering with the query. In the example below, I have post_per_page set at 10. If I leave the default "Blog pages show at most" setting as 10 posts it works fine because they both match and calculates the pages correctly. However if I change the "posts_per_page" to 5, I get a few extra pages added to the pagination, which display "page not found" when clicked. Is it possible to override this setting from the admin? I thought creating a custom wp_query would override this anyway. What am I doing wrong? I'm also using wp_pagenavi for the pagination as you can see in the example below, and have a custom post type of "listing". I'm using WordPress 3.1.3.               <?php $custom_query = new WP_Query( array( 'post_type' => 'listing', 'posts_per_page' => 10, 'paged' => get_query_var('paged') ) ); ?>            <?php if ( $custom_query->have_posts() ) : while ( $custom_query->have_posts() ) : $custom_query->the_post(); ?>                <div id="post-<?php the_ID(); ?>">                // stuff here         </div>          <?php endwhile; endif; ?>          //wp_pagenavi      <?php          if (function_exists('wp_pagenavi')) {         wp_pagenavi( array( 'query' => $custom_query ) ); }      ?>          <?php wp_reset_postdata(); ?>


how to get original image using wp_get_attachment_image_src

I want to get the original image with the same width and height as uploaded. My original image is 630*370. Using the following function call I get a thumbnail sized at 630*198.               wp_get_attachment_image_src($PriImgId,array('630','370'));      How can I get it at 630*370


Print Current Post Index number within Loop

I'm working on WordPress where I have following code to get posts within loop.                       <?php                     $posts = $woo_options['woo_latest_entries'];                     query_posts('post_type=post&category_name=company');                     if ( have_posts() ) : while ( have_posts() ) : the_post(); $count++;                  ?>                  /// Post Content Goes Here //                  <?php endwhile; endif; ?>      Which Output posts inside Loops something like this...               Post Goes Here ....          Other Post Goes Here ....          Another Post Goes Here ....     .....      What I want is to print current posts index number within loop. Example                1. Post Goes Here ....           2. Other Post Goes Here ....           3. Another Post Goes Here ....      .....      How Can I Achieve This ? Thanks. **EDIT** Ohh ! I can do it this way ..               <?php      echo $wp_query->current_post +1;      ?>      Is there any other / Better way ?


WordPress and Git: How does Git interact with your IDE?

Everyone has been telling me I should use Git. What I don't understand is how git interacts with your IDE. Say i'm developing on Dreamweaver, and I switch branches, my IDE isn't going to reflect that so how do I get the two aligned? Plugins? = more complicated than simple FTP sync ... Or am I missing something?


WP_Query Attachment adds additional attachment count and need to link attachment to post url

I just wonder why WP_Query adding one more additional attachment with the defined number or posts. Also need to link attachment (thumbnail) to the post url. Here is my code               <?php     $query = new WP_Query( array( 'post_type' => 'news', 'showposts' => 5, 'orderby' => 'rand' ) );     if( $query->have_posts() ){         while($query->have_posts()){             $query->the_post();             $image_query = new WP_Query( array( 'post_type' => 'attachment', 'post_status' => 'inherit', 'post_mime_type' => 'image', 'showposts' => -1, 'post_parent' => get_the_ID() ) );             while( $image_query->have_posts() ) {                 $image_query->the_post();                           echo '
';                 echo wp_get_attachment_image( get_the_ID() );                 echo '
';             }         }     }     ?>


How to protect parts of my code from TinyMCE modification when switching from text to visual mode?

I've got the following problem. When I switch from 'text' to 'visual' mode - TinyMCE is automatically messing around in the code doing unwanted things which breaks my styling - not so good ;/. Is there a way to protect parts from being modified by the text editor automatically? Some kind of [dont_touch_my_code] shortcode or something like that? This is my code before:               [eo_events numberposts="6" showpastevents="false" event_category=""]

         %start{M}%%start{Y}%
          %start{d}%

 %event_title%
%event_excerpt%       %start{H:i}% - %end{H:i}% Uhr  %event_venue%

     [/eo_events]      And this is the code after switching to visual mode and back.               [eo_events numberposts="6" showpastevents="false" event_category=""]

%start{M}%%start{Y}%%start{d}%

 %event_title%
     %event_excerpt%     %start{H:i}% - %end{H:i}% Uhr %event_venue%

     [/eo_events]


How to show more than 10 order on woo commerce order view

I am trying to get orders by user id. I have tried this and not working.                         <?php echo do_shortcode("[woocommerce_view_order per_page='20']"); ?>      is there any way to put pagination to show all of order history? I also wonder which file, function I need to modify if I want to add "see more" button at the bottom of the order page show 10 each when it's clicked. we may work on "see more" button with ajax. Thanks,


When importing posts to a new site if XML file has postmeta not setup on new server what happens?

I have a few XML exports from one domain, and all the posts have postmeta which no longer exists on the new domain. An example is `<wp:post_parent>70</wp:post_parent>` The new domain has no post parents for any post or page. What happens when I import these XML files. Will WordPress only import data where a custom field or postmeta exists on the new domain for that post type?


Prevent Duplicate Attachment When Using wp_insert_post

I am trying to use `wp_insert_attachment` while using `wp_insert_post`. It's successfully creating the post and attachment. It have no problem if I only use the `wp_insert_post` function, but when I activating the `wp_insert_attachemnt`, the script create both, duplicate posts and attachments 3 times of the previous created posts and attachments. Here is the code **(UPDATED)** :               add_action('admin_menu', 'awpht_admin_opt');          function awpht_admin_opt() {         add_plugins_page('AWPHT Control', 'Automatic Photoblog', 'manage_options', 'awpht_option_control', 'awpht_option_control_page');     }     function enqueue_awpht_style() {         wp_register_style( 'awpht_admin_style', plugins_url('awpht-main.css', __FILE__) );         wp_enqueue_style('awpht_admin_style');     }          add_action( 'admin_enqueue_scripts', 'enqueue_awpht_style' );               //Administration Menu     function awpht_option_control_page() {     ?>

Automatic Photoblog
     <form method="post" action="">

Post Category	<input type="text"/>

Post Status	<select name="awpht_post_status">     <option>Publish</option>     <option>Draft</option>     </select>

          <input type="submit" name="awpht-create-posts" class="button button-primary button-large" id="awpht-create-posts" value="Create Posts"/>     </form>
               <?php     if (isset($_POST['awpht-create-posts'])) {          //Get Images Folder Path     $awphtdir = wp_upload_dir();     $awphtimgdir = $awphtdir['basedir'];     $upload_path = $awphtimgdir."/photoblog/";               $awpharritle = array();     $awpht_content = array();     $awphtfname = array();     $attch_imgurl = array();     $attch_title = array();     $attch_fname = array();               // Fetch Images Names From Folder     foreach(glob($upload_path."*.*") as $filename){     $attch_fname[] = $awphtdir['basedir']."/attachments/".basename($filename);     // Filwname with extension     $allfname = basename($filename);     $awphtfname[] = $allfname;          //Filename without Extension     $awpht_title = preg_replace("/\\.[^.\\s]{3,4}$/", "",basename($filename));     $attch_title[] = $awpht_title;     $adspc = array("-", "_", ".");          //Post Title     $awphttitle = str_replace($adspc, " ", $awpht_title);     $awpharritle[] = $awphttitle;          //Get image url     $awpht_dir = wp_upload_dir();     $awpht_imgurl = $awpht_dir['baseurl'].'/photoblog/'.$allfname;     $attch_imgurl[] = $awpht_imgurl;          //Post Content     $awpht_content[] = "";             }          //Create Posts With The Available Data     $year = '2014';     $postdate = $postdate = date($year.'-02-23 18:57:33');     $awpht_length = count($awpharritle);          for($i=0; $i<$awpht_length; $i++ ) {          //Check If Post Already Exist/ Prevent Duplicates     if (!get_page_by_title($awpharritle[$i], 'OBJECT', 'post')){          $awpht_the_posts[$i] = array(       'post_title'    => $awpharritle[$i],       'post_content'  => $awpht_content{$i},       'post_date'     =>   $postdate,       'post_status'   => 'publish',       'post_author'   => 1,     );     // Insert the post into the database     $post_id = wp_insert_post( $awpht_the_posts[$i]);          //Set category and tag     wp_set_post_terms( $post_id , 2 ,  'category' );     wp_set_post_terms( $post_id , 'test, text, play' ,  'post_tag' );               //INSERT ATTACHMENT     $awpht_filetype = wp_check_filetype($awphtfname[$i], null );     $awpht_attachment = array(             'guid' => $attch_imgurl[$i],             'post_mime_type' => $awpht_filetype['type'],             'post_type' => 'attachment',             'post_title' => $attch_title[$i],             'post_content' => '',             'post_status' => 'inherit'                         );       $awphtattach_id = wp_insert_attachment( $awpht_attachment, $attch_fname[$i], $post_id );               //Create thumbnail with resized images     require_once(ABSPATH . 'wp-admin/includes/image.php');                     $awphtattach_data = wp_generate_attachment_metadata( $awphtattach_id, $attch_fname[$i] );     wp_update_attachment_metadata( $awphtattach_id, $awphtattach_data );               // Set Featured Image     set_post_thumbnail( $post_id, $awphtattach_id);     //update_post_meta($post_id, '_thumbnail_id', $awphtattach_id);     echo get_the_post_thumbnail($post_id, 'thumbnail');                  }             }         }        }      My question: How to prevent the script from creating duplicate attachments and posts? Best Regards


How to store post rating system data post independent?

There's code below for simple post rating system (tutorial from this site TUTORIAL ) - it works fine but i need to change it a bit. Now where user votes, he is not able to vote again for same post for $timebeforevote (1440 minutes). I want to block user voting for all post not just for this one. I think the problem is function is looking for user ip in current post meta field with this code:               $meta_IP = get_post_meta($post_id, "voted_IP");     $voted_IP = $meta_IP[0];      Returns `$voted_IP` and compares it with `$ip = $_SERVER['REMOTE_ADDR'];` I tried to modify it with query (where query looks for ip in meta field for all posts) so it would search for ip in all posts but it didn't work. I am trying to make it work for 2 days and nothing works. POST RATING SYSTEM CODE:               $timebeforerevote = 1440;          add_action('wp_ajax_nopriv_post-like', 'post_like');     add_action('wp_ajax_post-like', 'post_like');          wp_enqueue_script('like_post', get_template_directory_uri().'/js/post-like.js', array('jquery'), '1.0', 1 );     wp_localize_script('like_post', 'ajax_var', array(         'url' => admin_url('admin-ajax.php'),         'nonce' => wp_create_nonce('ajax-nonce')     ));          function post_like()     {         $nonce = $_POST['nonce'];              if ( ! wp_verify_nonce( $nonce, 'ajax-nonce' ) )             die ( 'Busted!');              if(isset($_POST['post_like']))         {             $ip = $_SERVER['REMOTE_ADDR'];             $post_id = $_POST['post_id'];                  $meta_IP = get_post_meta($post_id, "voted_IP");                  $voted_IP = $meta_IP[0];             if(!is_array($voted_IP))                 $voted_IP = array();                  $meta_count = get_post_meta($post_id, "votes_count", true);                  if(!hasAlreadyVoted($post_id))             {                 $voted_IP[$ip] = time();                      update_post_meta($post_id, "voted_IP", $voted_IP);                 update_post_meta($post_id, "votes_count", ++$meta_count);                      echo $meta_count;             }             else                 echo "already";         }         exit;     }          function hasAlreadyVoted($post_id)     {         global $timebeforerevote;              $meta_IP = get_post_meta($post_id, "voted_IP");         $voted_IP = $meta_IP[0];         if(!is_array($voted_IP))             $voted_IP = array();         $ip = $_SERVER['REMOTE_ADDR'];              if(in_array($ip, array_keys($voted_IP)))         {             $time = $voted_IP[$ip];             $now = time();                  if(round(($now - $time) / 60) > $timebeforerevote)                 return false;                  return true;         }              return false;     }          function getPostLikeLink($post_id)     {         $themename = "twentyeleven";              $vote_count = get_post_meta($post_id, "votes_count", true);              $output = '
';              if ($vote_count == 0)             $output .= '0
głosów w rankingu';         else             $output .= ''.$vote_count.'
głosów w rankingu';              if(hasAlreadyVoted($post_id))             $output .= '';         else             $output .= '                         ';         $output .= '
';              return $output;     }


Work on theme files on a server & browser preview before installing it

A friend of mine who has got a live Wordpress website has bought a new theme. Before he's going to install and use it, he would like to adapt the theme's styles to his current web design. I uploaded the theme files on a different server because I hoped that I can preview the pages while I work on the CSS, but that doesn't work (blank pages). Is there any possibility to work on the theme CSS files incl. page preview without already installing the new theme?


Size article thumbnails and retrieve them directly from database

I've integrated the Wordpress database directly with my .NET application. What I want is to set the featured image of a post. This featured image must be maximum 800pixels wide, and automatically sized to that width (keeping the correct width/height ratio). `Medium size` is set tp 300x300 `Large size` is set to 1024x1024 What I did now is go to `Settings > Media` and set the width of `Thumbnail size` to 600 and unchecked the checkbox `Crop thumbnail to exact dimensions (normally thumbnails are proportional)`. Now when I upload a new featured image, where can I find the filename of the image with a width of 600px and how can I retrieve it via SQL? **UPDATE** I see these rows in [wp_postmeta]               meta_id post_id meta_key                meta_value     76      16      _wp_attached_file       2014/01/sitelargeblah.png     77      16      _wp_attachment_metadata a:5:{s:5:"width";i:1920;s:6:"height";i:1643;s:4:"file";s:25:"2014/01/sitelargeblah.png";s:5:"sizes";a:4:{s:9:"thumbnail";a:4:{s:4:"file";s:25:"sitelargeblah-175x150.png";s:5:"width";i:175;s:6:"height";i:150;s:9:"mime-type";s:9:"image/png";}s:6:"medium";a:4:{s:4:"file";s:25:"sitelargeblah-300x256.png";s:5:"width";i:300;s:6:"height";i:256;s:9:"mime-type";s:9:"image/png";}s:5:"large";a:4:{s:4:"file";s:26:"sitelargeblah-1024x876.png";s:5:"width";i:1024;s:6:"height";i:876;s:9:"mime-type";s:9:"image/png";}s:14:"post-thumbnail";a:4:{s:4:"file";s:25:"sitelargeblah-604x270.png";s:5:"width";i:604;s:6:"height";i:270;s:9:"mime-type";s:9:"image/png";}}s:10:"image_meta";a:10:{s:8:"aperture";i:0;s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";i:0;s:9:"copyright";s:0:"";s:12:"focal_length";i:0;s:3:"iso";i:0;s:13:"shutter_speed";i:0;s:5:"title";s:0:"";}}      I see the 300px width and the 1024px width, but no 800px width of the thumbnail. Why not? I can not simply append 800x800 after the value in `_wp_attached_file`, since the resized image is not an exact square, but with dimensions ratios preserved.


How do i use fontawesome icons in TinyMce editor?

I'm trying to add a youtube button in TinyMce editor. here is a recent-posts.js file which is in the js folder of the theme directory.               (function() {        tinymce.create('tinymce.plugins.buttons', {           init : function(ed, url) {                   //for recent post button              ed.addButton('recentposts', {                 title : 'Recent posts',                 image : url + '/youtube.png',                 onclick : function() {                    var posts = prompt("Number of posts", "");                    var text = prompt("List Heading", "");                         if (text != null && text != ''){                       if (posts != null && posts != '')                          ed.execCommand('mceInsertContent', false, '[recent-posts posts="'+posts+'"]'+text+'[/recent-posts]');                       else                          ed.execCommand('mceInsertContent', false, '[recent-posts]'+text+'[/recent-posts]');                    }                    else{                       if (posts != null && posts != '')                          ed.execCommand('mceInsertContent', false, '[recent-posts posts="'+posts+'"]');                       else                          ed.execCommand('mceInsertContent', false, '[recent-posts]');                    }                 }              });                        //for youtube video               ed.addButton('youtube', {                 title : 'YouTube',                 text: 'YouTube',                           onclick : function() {                    var id = prompt("Video id", "");                    var text = prompt("Video Heading", "");                         if (text != null && text != ''){                       if (id != null && id != '')                          ed.execCommand('mceInsertContent', false, '[yt id="'+id+'"]'+text+'[/yt]');                    }                    else{                       if (id != null && id != '')                          ed.execCommand('mceInsertContent', false, '[yt posts="'+id+'"]');                    }                 }              });                },           createControl : function(n, cm) {              return null;           },           getInfo : function() {              return {                 longname : "me The Most Brilliant",                 author : 'me',                 authorurl : 'http://www.google.com',                 infourl : 'http://www.google.com',                 version : "1.0"              };           }        });        tinymce.PluginManager.add('buttons', tinymce.plugins.buttons);     })();      code in functions.php is               function register_button( $buttons ) {        array_push( $buttons,"recentposts", "youtube" );        return $buttons;     }          function add_plugin( $plugin_array ) {        $plugin_array['buttons'] = get_template_directory_uri() . '/js/recent-posts.js';        return $plugin_array;     }          function my_recent_posts_button() {             if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {           return;        }             if ( get_user_option('rich_editing') == 'true' ) {           add_filter( 'mce_external_plugins', 'add_plugin' );           add_filter( 'mce_buttons', 'register_button' );        }          }          add_action('init', 'my_recent_posts_button');      In place of `image : url+'/youtube.png'` i'm trying to use `text :'<i class="fa fa-camera-retro"></i>'` But in text editor insted of font awesome icon , it is just showing as a text as it is. Where should i place the font awesome file and how should i call it and how to use it in TinyMce?


How to replace permalinks

I have exported and imported my wordpress project into live server. Now the problem is I have permalink structures as "localhost" format. When I click on any links in my website it redirects me to localhost. How can I change that? my .htaccess file is given below               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /myproject/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /myproject/index.php [L]     </IfModule>


Add quantity field with each product on shop page-wooCommerce via ajax

Creating a `wp-content/themes/your-theme/templates/loop/add-to-cart.php` file with:               <?php     /**      * Custom Loop Add to Cart.      *      * Template with quantity and ajax.      */          if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.          global $product;     ?>          <?php if ( ! $product->is_in_stock() ) : ?>              <a href="<?php echo apply_filters( 'out_of_stock_add_to_cart_url', get_permalink( $product->id ) ); ?>" class="button"><?php echo apply_filters( 'out_of_stock_add_to_cart_text', __( 'Read More', 'woocommerce' ) ); ?>          <?php else : ?>              <?php             $link = array(                 'url'   => '',                 'label' => '',                 'class' => ''             );                  switch ( $product->product_type ) {                 case "variable" :                     $link['url']    = apply_filters( 'variable_add_to_cart_url', get_permalink( $product->id ) );                     $link['label']  = apply_filters( 'variable_add_to_cart_text', __( 'Select options', 'woocommerce' ) );                 break;                 case "grouped" :                     $link['url']    = apply_filters( 'grouped_add_to_cart_url', get_permalink( $product->id ) );                     $link['label']  = apply_filters( 'grouped_add_to_cart_text', __( 'View options', 'woocommerce' ) );                 break;                 case "external" :                     $link['url']    = apply_filters( 'external_add_to_cart_url', get_permalink( $product->id ) );                     $link['label']  = apply_filters( 'external_add_to_cart_text', __( 'Read More', 'woocommerce' ) );                 break;                 default :                     if ( $product->is_purchasable() ) {                         $link['url']    = apply_filters( 'add_to_cart_url', esc_url( $product->add_to_cart_url() ) );                         $link['label']  = apply_filters( 'add_to_cart_text', __( 'Add to cart', 'woocommerce' ) );                         $link['class']  = apply_filters( 'add_to_cart_class', 'add_to_cart_button' );                     } else {                         $link['url']    = apply_filters( 'not_purchasable_url', get_permalink( $product->id ) );                         $link['label']  = apply_filters( 'not_purchasable_text', __( 'Read More', 'woocommerce' ) );                     }                 break;             }                  // If there is a simple product.             if ( $product->product_type == 'simple' ) {                 ?>                 <form action="<?php echo esc_url( $product->add_to_cart_url() ); ?>" class="cart" method="post" enctype="multipart/form-data">                     <?php                         // Displays the quantity box.                         woocommerce_quantity_input();                              // Display the submit button.                         echo sprintf( '<button type="submit" data-product_id="%s" data-product_sku="%s" data-quantity="1" class="%s button product_type_simple">%s</button>', esc_attr( $product->id ), esc_attr( $product->get_sku() ), esc_attr( $link['class'] ), esc_html( $link['label'] ) );                     ?>                 </form>                 <?php             } else {               echo apply_filters( 'woocommerce_loop_add_to_cart_link', sprintf('%s', esc_url( $link['url'] ), esc_attr( $product->id ), esc_attr( $product->get_sku() ), esc_attr( $link['class'] ), esc_attr( $product->product_type ), esc_html( $link['label'] ) ), $product, $link );             }              ?>          <?php endif; ?>      And in your theme `functions.php` :               <?php           function cs_wc_loop_add_to_cart_scripts() {         if ( is_shop() || is_product_category() || is_product_tag() || is_product() ) : ?>                        <?php endif;     }          add_action( 'wp_footer', 'cs_wc_loop_add_to_cart_scripts' );     ?>      This code works fine but whenever I add more more then one quantity, it adds only one product to cart means only quantity is not adding. Any help would be greatly appreciated.


Have multiple loops on a page appear after/between page content

I created a function (in function.php) that allows me to put additional loops for different categories into pages:               function custom_summary($atts) {         extract(shortcode_atts(array(               "category" => "",             "posts" => ""         ), $atts));              $my_query = new WP_Query("category_name=$category&posts_per_page=$posts");         while ($my_query->have_posts()) : $my_query->the_post();             // Do all the things.         endwhile;          }     add_shortcode('summary', 'custom_summary');      Unfortunately, no matter where I put the shortcode `[summary category="cats" posts="3"]` it is always displayed before the content of the page. In other words, the new WP_Query is processed before anything else happens with page's contents. How can I make the loop appear exactly where I put the shortcode in the backend (e.g. between content on the page)?


Multiple Backend Users as single Frontend User

Is there a good way to map multiple backend users to a single frontend user? Basically I want to do the following, we host a blog which is maintained by multiple persons, each as it's own credentials, but to the outside world they act as a single individual. So I need a way to have user1, user2 and user3 as log, but I want them to be a single user (virtually) on the frontend (like MrXY for example), thus leading to a single link to a profile page, a single email address that fetches from gravatar and a single name, without the need to hack the database each time for that. I am aware that I could user an extra account just for the comments, with shared credentials, but I do not want to to this, I still need a way to keep them appart, so that I can tell if someone does a bad job or a good job. And before I forget, we use bbpress as well, and allow users to register themselves. So mapping all accounts is no solution. It has to be editor-admin all map to one specified account.


Media Library Image Sizes in Bones theme (add_image_size)

I'd like to create new thumbnail options in Bones and have followed the instructions in the Bones theme Functions.php file. I am expecting therefore that one should be able to choose from the Size Dropdown menu the new thumbnail I have set like this. (note, the default wp sizes is showing) ![enter image description here](http://i.stack.imgur.com/2tydJ.jpg) taken from this example http://www.limecanvas.com/adding-custom-image-sizes- to-wordpress-3-5-media-manager/ Am I misunderstanding how it works in Bones perhaps? These are the instructions from the Functions.php file. > To call a different size, simply change the text inside the thumbnail > function. > > For example, to call the 300 x 300 sized image, we would use the function: > for the 600 x 100 image: But I don't want to be use the PHP code, rather a specific size from the dropdown menu as mentioned from the Add Media (Media Library) as above Many thanks **EDIT:** In the Bones theme, this is where the *add_image_size* is added: https://github.com/eddiemachado/bones/blob/master/functions.php And this is where the *add_theme_support* function is called: https://github.com/eddiemachado/bones/blob/master/library/bones.php **EDIT:** I can see that the images are being generated so that part is working. I just don't get the dropdown option to choose the images from.


Edit category output

I am using the following to display all the categories from my custom post type. How can I edit it so instead of having the output of the categories in `<ul><li>` elements it has `<a href ....` instead? I need to edit the output of `wp_list_categories( $args );`               <?php $customPostTaxonomies = get_object_taxonomies('video');          if(count($customPostTaxonomies) > 0)     {          foreach($customPostTaxonomies as $tax)          {              $args = array(                   'orderby' => 'name',                   'show_count' => 0,                   'pad_counts' => 0,                   'hierarchical' => 1,                   'taxonomy' => $tax,                   'title_li' => ''                 );                 echo '';              wp_list_categories( $args );              echo '';          }     } ?>


Move from old custom field to new post_thumbnails

I've just taken over a busy WordPress site that's got ~800 posts so far. The site's been around long enough that it was started up before post_thumbnails was available. They worked around that shortcoming with a custom field called 'Image' that held a value of the relative path to the image, e.g., "/wp-content/uploads/2012/11/image.jpg" The theme is using Tim Thumb to make the different thumb sizes. I'd love to get away from this and just use the post_thumbnails feature and set the sizes in functions.php and get rid of timthumb.php altogether. I've searched, but haven't found a good way to make the switch. Any suggestions?


Stable tag of plugin in the readme file

If I am pushing a new version (v0.2) of my plugin (v0.1) on the repo, what does I do with the stable tag in readme file? Change it to v0.2? What should come here? Clarifications please :)


How to force function to run as the last one when saving the post?

I don't know how to force this function to run as the last function after all other save things from WP are executed. This is my current code in my plugin:               add_action( 'save_post', 'do_custom_save' );      function do_custom_save( $post_id ) {                    // No auto saves          if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;               // make sure the current user can edit the post          if( ! current_user_can( 'edit_post' ) ) return;              // assure the post type         if ( ! get_post_type($post_id) == 'post' ) return;                   $latitude  = $_POST['rw_company_latitude'];         $longitude = $_POST['rw_company_longitude'];         $zoom      = '6';              $lat_lon_zoom = $latitude . ', ' . $longitude . ', ' . $zoom ;              update_post_meta($post_id, 'company_map', $lat_lon_zoom );               }      **How to force this code to be executed and saved the mixed variable as the last thing? After all the other saving and updating is done.** Because right now it's updated ok, but then again rewritten by the value from original map field $_POST['company_map']. I need to somehow tell WP that this function should run as the last function when performing saving/updating post stuff. How to do that?


upper limit on concurrent editing?

I am about to install a multi-site wordpress and was wondering if there is a big performance degradation if there are multiple concurrent editors using the system at the same time, or what the average safe number of them would be? I am not talking about editing the same record, just editing separate records at the same time. I had a previous wordpress site that would always slow down significantly when there were multiple admins/editors logged in at the same time... Does anyone have any experience with this, resources they could point me to, or some table of average acceptable loads (say on a shared or dedicated server)? Thanks!


Wordpress can't find IXR_Client

Trying:               $client = new IXR_Client('http://othersite.com/xmlrpc.php');      I get the error **Fatal error:** Class 'IXR_Client' not found in footer.php I can see the class in _wp-includes/class-IXR.php_ , and I've checked that the path to this file is correct in _wp-includes/functions.php_ as per this discussion. Am I missing something needed to use this class in my custom theme's footer?


How to get CGI variables?

I need to do two things:   1. Add a CGI variable (say filter=21) to the current query and make a link to this modified URL.   2. Fetch the value of CGI variable "filter". How to do that in WordPress?


Pagination problem by using WP_Query

Sorry for me, if I use incorrect words or sentenses, my English is poor, i.e. I'm from Russia. I have problem with pagination by using WP_query and pagination links like next_posts_link and previous_posts_link. My permalinks set is /%category%/%postname%/. WP 3.3.1. There is my code:               <?php     $paged = (get_query_var('page')) ? get_query_var('page') : 0;     $looks = new WP_Query('cat=3&posts_per_page=4&paged='.$paged);     while ($looks->have_posts()) : $looks->the_post(); ?>
         <a class="look_thumb" href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">         <?php the_post_thumbnail('medium'); ?>
<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>

     <?php endwhile; ?>     <?php next_posts_link('Другие записи >>'); ?>     <?php previous_posts_link('Предыдущие записи <<'); ?>     <?php wp_reset_postdata(); ?>      next_posts_link and previous_posts_link don't apear on page. This custom loop from my template page: 'looks_page.php'. What's wrong!? I'm trying fix it problem by during 3 days, but no results :(.


Why are the comments disabled by default on my custom_post_types?

I am using a custom post type + taxonomies in a podcast solution for a client. The setting (settings >> discussion) for comments is set to "allow comments". When I add / edit posts under the "posts" tab, comments are enabled by default. However, when I add / edit posts under the custom post type (podcast) - comments are disabled by default. The user can still manually enable comments for each post, but this is obviously not ideal. Thoughts? UPDATE: Relevant Code in functions.php               function create_my_post_types() {     register_post_type( 'podcast',         array(             'labels' => array(                 'name' => __( 'Podcast' ),                 'singular_name' => __( 'Podcast' ),                 'new_item' => __( 'New Episode' ),                 'add_new_item' => __( 'Add New Episode' )             ),             'public' => true,             'hierarchical' => true,             'menu_icon' => get_stylesheet_directory_uri() . '/assets/podcast-icon.png', // 16px16             'menu_position' => 9,             'supports' => array( 'title', 'editor', 'comments', 'post-templates'),             'register_meta_box_cb' => 'add_podcast_metaboxes' // This registers the metabox that we'll add later.         )     );      }


Get title of post without using the_title();

Noob question. Is there another way of getting a posts title without using the_title(); I'm asking because I am using a function the take a string parameter, then after some code, returns this string. When I pass in the_title(); as this parameter, for some reason it isn't coming in as a string, therefore, the method fails. When I pass in "some random string" instead of the_title(); the function works properly. Make sense?


Need category header to link to category archive list

I tried using wp_list_categories, but that just gives me a list of the categories. I currently have this code in my category-recipes.php file:

<?php echo get_cat_name(38); ?>
                     <?php                     $recipes = new WP_Query();                     $recipes->query('showposts=5&orderby=rand&cat=38&post_type=recipe');                          while ($recipes->have_posts()) : $recipes->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?>
                     <?php endwhile; ?>
      I was thinking about putting a link tag before the `get_cat_name` but I am not sure what to include in it.


Limit files uploaded per folder

I upload over thousands of images everyday and I want to limit the number of files that can be stored in a folder cause it's not good to have like 5000 files in a folder because it increases the load time. I want to do like this; for every 500 files uploaded auto create a new folder and upload it to that new folder. Is there a plugin/script that can do this?


How to call a function from a plugin from within a different plugin's admin options panel?

I have a basic plugin admin options panel for events. I want to call a function that is from a different social media plugin (Mingle). I can call Mingle plugin functions in the theme, but not within core files of other plugins, or other plugins' admin panels it seems. I have tried including the other plugin's files, adding a hook to the theme functions file, add_action, add_filter, init etc. But I do not know what the first argument for those actions would be, since I want the function inserted into a specific admin page from another plugin. The only solution that has worked is merging the code of the two plugins, although it seems odd that there is not a simpler method.


PHP if have image display image, if else text

I'm a front-end web developer struggling with some theme option support. I am struggling to write a simple function in my header.php which allows me to do the following: "if user uploads an image, use the image. If else use 'logo_text' and echo output. If user doesnt upload image or logo_text use default of 'My Site'" Can anyone point me in the right direction to get started? I don't know where to begin for this one.

<a href="<?php bloginfo('url'); ?>/home" title="<? echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">             <? $novus_logo_text = get_option('novus_logo_text'); echo $novus_logo_text; ?>
                      <a href="<?php bloginfo('url'); ?>/home" title="<? echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">             <? $novus_logo_upload = get_option('novus_logo_upload'); echo ''; ?>


Proper way to create custom static page

I'm fairly new to WordPress. I'm creating a page with a form. It works, but being so new, I'm wondering if I'm doing it in the best way. I'll use Twenty Twelve as an example theme.   1. copy 'page.php' from Twenty Twelve (we'll use 'xxx.php' as the new template page name);   2. working in xxx.php from here forward, add '// Template Name: My Template' to the top;   3. 'require' my class file (which handles drawing the form, handling $_POST, etc.) and create instance;   4. copy contents of 'content-page.php' to 'xxx.php', overwriting where it says 'get_template_part( 'content', 'page' );'   5. right below 'the_content()', call my class method that either draws the form or shows output after handling $_POST;   6. create a new page in admin, using 'My Template' So, is this the 'normal' way to do what I'm trying to do, or is there a better way? Also, where should I store the class file and related css/js? If I store them in the theme directory I'd have to remember to move them before deleting the theme.


Import Excel (or csv) Table with user-data as subscribers to wordpress

i have a tough problem. From an existing database with user-data I need to transfer those users as subscribers to my wordpress database. My user-profiles have various additional custom fields that I need for my user-details.               login   email   first_name  last_name   institut    country_code    city    zip street  phone   country_code_person city_person zip_person  street_person   homepage    sex entry_year  student payed      Exactly the same columns are in my excel (or csv) sheet. How can I iterate through an excel sheet and transfer all the users to the database? Since I'm fairly new to this I have no clue. Do I do this with MySQL or any other way? Do you have tipps or tricks for me, maybe a snippet or anything? Thank you in advance, Matt


How to make the 'more' link point to the post instead of the category list

I'm using the List Category Posts plugin to list a certain categories posts on a page in my site. The default 'more' link functionality is to point to a full list of the categories posts. I'd like to have a 'more' link after each post + excerpt which links to the specific full post. Can his be done?


Basic multiple loops only displaying first loop

I'm trying to set up multiple loops on a page. The first loop will display the latest four blog posts, and the second loop below it will display the latest eight blog posts with pagination. I set up the template below but only the first four blog posts show. Ideally, four blog posts for the first loop would show, then the same four would show in the second loop right below it. Did I misunderstand something? Can someone help me figure out where I went wrong?                   <?php get_header();?>

Latest News

                          <?php                         $featuredPosts = new WP_Query();                         $featuredPosts->query('showposts=4');                              while ($featuredPosts->have_posts()) : $featuredPosts->the_post();                     ?>                          <div class="post" id="post-<?php the_ID(); ?>">

<?php the_title_attribute(); ?>

<?php the_content_rss('', TRUE, '', 20); ?>

                          <?php endwhile; ?>

                     <?php query_posts( array(                           'posts_per_page' => 8,                           'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ),                      ));                     ?>

              <?php get_footer(); ?>


Can a user spread virus on my Multisite?

Can a user spread Virus or do an harm to Multisite Installation ? Can a user take a chance of using "HTML " option in posts? In what ways do my Multi-site have chances to get attacked ? Could you suggest me some precautions to follow with multisite ? I wanted to maintain Muilti-site for Public registrations with full features like any other Blogging platform does.


How do I attach an invoice PDF to an email in the Dukapress plugin for Wordpress?

I'm using the eCommerce plugin Dukapress for my WordPress website. I want to attach the invoice PDF to the admin's email, but I'm not sure how to go about this. I'm under the impression that the only way you can do this is through editing the php files contained in the plugins folder, wp_content/plugins/dukapress/dukapress.php. ## This code is from Dukapress's dukapress.php file               function dpsc_pnj_send_mail($to, $from, $name, $subject, $msg, $attachment = FALSE)      {         global $wpdb;         $headers  = 'MIME-Version: 1.0' . "\r\n";         $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";         $headers .= 'From: ' . $name . ' <' . $from . '>' . "\r\n";         if ($attachment = TRUE)          {             if ($dp_shopping_cart_settings['dp_shop_pdf_generation'] === 'checked')              {                 $mail_attachment = array(DP_PLUGIN_DIR. '/pdf/invoice_' . $attachment . '.pdf');                 @wp_mail($to, $subject, $msg, $headers, $mail_attachment);             }             else                 {                 @wp_mail($to, $subject, $msg, $headers);             }         }         else          {             @wp_mail($to, $subject, $msg, $headers);         }     }      I've already tried changing $attachment = FALSE to $attachment = TRUE, but it didn't make any difference. I can also settle for having the PDF's information displayed in the email instead of attached in a separate file if that's easier. Any suggestions will be greatly appreciated, even if I am way off.


How to customize admin posts based on the user who is logged in

We are building a site that will have 10-15 photographers posting content. There will be a common blog + each admin has their own portfolio to manage. "Portfolio galleries" and "portfolio pages" are two custom types and they are categorized using "Artist", a custom taxonomy. We would like all admins:   1. to be able to see all blog posts    2. be able to post in the blog    3. be able to add new "portfolio galleries" and "portfolio pages" and have them automatically tagged with the "artist" taxonomy with the same value as their name (i.e. John Smith will be able to only create portfolio pages and galleries automatically tagged with *Artist = "John Smith"*)    4. be able to only view portfolio pages and galleries that belong to them (i.e. John Smith will only see portfolio pages and galleries that are marked with *Artist = "John Smith"*)  Finally we would also like to have a couple of "super admins" that will have access to every post on the site. Any ideas on how to go building something like this? Is it even feasible? * * * **EDIT** Following @בניית אתרים suggestion I have read a bit more about Roles and Capabilities and realized that Wordpress already supports out of the box the ability to limit users from editing other people's posts. All I needed to do was to switch all the users to be _Authors_ instead of _Editors_. In brief #1, #2 and #4 from the above list are resolved. I still need to get #3 to work using `save_post`.


What is a settings group actually for?

say i have an option               update_option('pp_options', $options);      when i want to create a form for that, i learnt that i have to create a settings group               register_setting('pp_options_group', 'pp_options');      then in the form do               settings_fields('pp_options_group')      but i dont really what is the settings group actually for? i know its to do with sanitization but why the need to create a group for sanitization?


how to load the language file in plugin?

I'm unable to load the plugin's locale file _(.mo)_. I did all the procedues described in the http://codex.wordpress.org/Writing_a_Plugin but its not working. If I the lang string to the wordpress default `wp- content/language/de_De.mo` file then its show the correct translated string. but not loading the data from my plugin folder :( **EDIT:**               $plugin_dir = basename(dirname(__FILE__)) ."/lang/";     load_plugin_textdomain( 'tboy_displayTimeZone', null, $plugin_dir );


Saving Taxonomy Terms

I have an interesting problem which I hope someone can quickly answer. I have created my own metabox which, based on "MY METABOX CODE" (list below) is correctly displaying a dropdown list of all my terms within the "event_types" taxonomy I created. Where I am running into an issue is being able to SAVE/UPDATE the term associated with a post when a different term is selected from the dropdown and the post is updated. After tinkering around with various code bits I was able to figure out that by MANUALLY entering the term_ID number(s) [separated by commas] into the array area I am getting the results I am looking for. For example if on saving the post a function were to call this code               wp_set_post_terms( $post_id, array(5,7), 'event_types', FALSE);      then my post WILL UPDATE and associate the term_ID 5 & 7 to it which as you can see I am passing in the array. The problem is that this is hard coded into my functions.php file and not based on a user selected dropdown value (note: I am actually only trying to pass one ID but I did two for testing as explained below). I have also been able to figure out that if I add the following code to my metabox file then I am able to echo a list of assigned term IDs but the last item has a comma.               <?php $event_types = wp_get_object_terms($post->ID, 'event_types');      foreach ($event_types as $event_type) { echo $event_type->term_id . ','; } ?>      So... it seems I have 85% of my problem solved. The Remaining 15% of my problem remains as follows:   1. What do I need to add to my functions.php file code (listed below) so that when I create/update a post the NEW VALUE selected from my taxonomy dropdown list is passed into the array?   2. Although in this example I am looking to ensure that only a SINGLE taxonomy can be associated with a post, there are other situations where I would like to create a checkbox list which would require me to pass more than one value into the array. As such, what would I need to change so that a comma separated list of term IDs is passed into the array? If your answer involves using some or part of the example code I listed above where I echo the IDs then how do I ensure the last ID which is printed does not have a comma at the end? (Is there a different/better way to do it? I saw hints which might relate to adding a filter but I am not sure how this is done...) Thank you guys very much in advance - below is the code I am currently using in each file. **CODE IN MY FUNCTIONS.PHP FILE**               function save_event_taxonomy_terms($meta, $post_id) {             $event_types = wp_get_object_terms($post->ID, 'event_types');              wp_set_post_terms( $post_id, array($names), 'event_types', FALSE);         }      **MY METABOX CODE**               <select name='post_event_types' id='post_event-types'>     // DISPLAY TERMS AS DROP DOWN OPTIONS         <?php          $names = wp_get_object_terms($post->ID, 'event_types');          $event_types = get_terms('event_types', 'hide_empty=0');          ?>         <option class='event_type-option' value='' <?php if (!count($names)) echo "selected";?>>Not Assigned</option>         <?php foreach ($event_types as $event_type) {             if (!is_wp_error($names) && !empty($names) && !strcmp($event_type->slug, $names[0]->slug))              echo "<option class='event_type-option' value='" . $event_type->slug . "' selected>" . $event_type->name . "</option>\n";              else             echo "<option class='event_type-option' value='" . $event_type->slug . "'>" . $event_type->name . "</option>\n";          }         ?>     </select>


How to make child theme ignore a parent themes template

I have a childtheme of twentythirteen in which i want to use the same template for pages and the blogposts-overview. But in twentythirteen is a page.php and an index.php. So I need override both, meaning I have to do all edits twice. Any elegant solution for that?


Revert multiple posts to an older revision?

Is there a way to revert many/all posts to the closest revision to a particular date, all at once? The specific use case I need it for is to remove all the spammy viagra links from the content on a briefly-infected blog. Any solution welcome.


Disabling image thumbnails and automatic regeneration

When image uploaded to the wp gallery - thumbnails automatically created, in my case 294x294, 191x191, 99x99 - these thumbnails are generated at very high compression / low quality. In order to improve the appearance of the products in my shop and to add some product description to the thumbnails, I Photoshopped my own set of 294x294, 191x191, 99x99 images and uploaded them directly to the server via ftp replacing automatically generated thumbnails. But for some reason over time my thumbnails get replaced with automatically generated images again and again, probably due to some size threshold. WP generated thumbnail, 7.5kb : ![WP generated thumbnail](http://i.stack.imgur.com/UePsu.jpg) Required thumbnail, 14kb : ![enter image description here](http://i.stack.imgur.com/mHi5V.jpg) What script does automatic regeneration of already existing thumbnails and is there any way to disable it?