nginx + W3 Total Cache: rewrite rules issue

nginx 1.2.7 + WP 3.5.1 + W3TC 0.9.2.8. Rewrite rules generated by the plugin simply don't work, server returns 404 after including them in nginx server config. Or maybe I'm doing something wrong? Here is my **nginx.conf** :               user www-data;     worker_processes 2;     pid /var/run/nginx.pid;          events {         worker_connections 1024;     }          http {         include /etc/nginx/mime.types;         index index.html index.htm index.php;         default_type application/octet-stream;              sendfile on;         tcp_nopush on;              log_format main '$remote_addr - $remote_user [$time_local] '             '"$request" $status $body_bytes_sent "$http_referer" '             '"$http_user_agent" "$http_x_forwarded_for"';              access_log /var/log/nginx/access.log main;         error_log /var/log/nginx/error.log warn;              include /etc/nginx/conf.d/*.conf;     }      Here is my **virtual server config** :               server {         listen 80;              server_name example.com www.example.com;         root /var/www/example.com;              access_log /var/log/nginx/example.access.log;         error_log /var/log/nginx/example.error.log;              location / { try_files $uri $uri/ /index.php?$args; }              location ~ \.php {             try_files $uri =404;             fastcgi_pass unix:/var/run/php5-fpm.sock;             fastcgi_index index.php;             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;             include fastcgi_params;         }              include /var/www/example.com/nginx.conf;          }      And finally **config generated by W3TC** (included in server's config):               # BEGIN W3TC Minify cache     location ~ /wp-content/cache/minify.*\.js$ {         types {}         default_type application/x-javascript;         expires modified 2628000s;         add_header X-Powered-By "W3 Total Cache/0.9.2.8";         add_header Vary "Accept-Encoding";         add_header Pragma "public";         add_header Cache-Control "max-age=2628000, public";     }     location ~ /wp-content/cache/minify.*\.css$ {         types {}         default_type text/css;         expires modified 2628000s;         add_header X-Powered-By "W3 Total Cache/0.9.2.8";         add_header Vary "Accept-Encoding";         add_header Pragma "public";         add_header Cache-Control "max-age=2628000, public";     }     location ~ /wp-content/cache/minify.*js\.gzip$ {         gzip off;         types {}         default_type application/x-javascript;         expires modified 2628000s;         add_header X-Powered-By "W3 Total Cache/0.9.2.8";         add_header Vary "Accept-Encoding";         add_header Pragma "public";         add_header Cache-Control "max-age=2628000, public";         add_header Content-Encoding gzip;     }     location ~ /wp-content/cache/minify.*css\.gzip$ {         gzip off;         types {}         default_type text/css;         expires modified 2628000s;         add_header X-Powered-By "W3 Total Cache/0.9.2.8";         add_header Vary "Accept-Encoding";         add_header Pragma "public";         add_header Cache-Control "max-age=2628000, public";         add_header Content-Encoding gzip;     }     # END W3TC Minify cache     # BEGIN W3TC Page Cache cache     location ~ /wp-content/cache/page_enhanced.*html$ {         expires modified 3600s;         add_header X-Powered-By "W3 Total Cache/0.9.2.8";         add_header Vary "Accept-Encoding, Cookie";         add_header Pragma "public";         add_header Cache-Control "max-age=3600, public";     }     location ~ /wp-content/cache/page_enhanced.*gzip$ {         gzip off;         types {}         default_type text/html;         expires modified 3600s;         add_header X-Powered-By "W3 Total Cache/0.9.2.8";         add_header Vary "Accept-Encoding, Cookie";         add_header Pragma "public";         add_header Cache-Control "max-age=3600, public";         add_header Content-Encoding gzip;     }     # END W3TC Page Cache cache     # BEGIN W3TC Browser Cache     gzip on;     gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;     location ~ \.(css|htc|js|js2|js3|js4)$ {         expires 2628000s;         add_header Pragma "public";         add_header Cache-Control "max-age=2628000, public";         add_header X-Powered-By "W3 Total Cache/0.9.2.8";     }     location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$ {         expires 3600s;         add_header Pragma "public";         add_header Cache-Control "max-age=3600, public";         add_header X-Powered-By "W3 Total Cache/0.9.2.8";         try_files $uri $uri/ $uri.html /index.php?$args;     }     location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ {         expires 31536000s;         add_header Pragma "public";         add_header Cache-Control "max-age=31536000, public";         add_header X-Powered-By "W3 Total Cache/0.9.2.8";     }     # END W3TC Browser Cache     # BEGIN W3TC Minify core     rewrite ^/wp-content/cache/minify.*/w3tc_rewrite_test$ /wp-content/plugins/w3-total-cache/pub/minify.php?w3tc_rewrite_test=1 last;     set $w3tc_enc "";     if ($http_accept_encoding ~ gzip) {         set $w3tc_enc .gzip;     }     if (-f $request_filename$w3tc_enc) {         rewrite (.*) $1$w3tc_enc break;     }     rewrite ^/wp-content/cache/minify/(.+\.(css|js))$ /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1 last;     # END W3TC Minify core     # BEGIN W3TC Page Cache core     set $w3tc_rewrite 1;     if ($request_method = POST) {         set $w3tc_rewrite 0;     }     if ($query_string != "") {         set $w3tc_rewrite 0;     }     if ($request_uri !~ \/$) {         set $w3tc_rewrite 0;     }     if ($http_cookie ~* "(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle)") {         set $w3tc_rewrite 0;     }     set $w3tc_enc "";     if ($http_accept_encoding ~ gzip) {         set $w3tc_enc _gzip;     }     if (-f "$document_root/wp-content/cache/page_enhanced/$http_host/$request_uri/_index.html$w3tc_enc") {       set $w3tc_rewrite 0;     }     if ($w3tc_rewrite = 1) {         rewrite .* "/wp-content/cache/page_enhanced/$http_host/$request_uri/_index.html$w3tc_enc" last;     }     # END W3TC Page Cache core      Server returns 404. What's wrong? Desperate for your help, Wordpress Answers.


how to find and correct plugin query performance issues

I have recently uploaded a new site I've been working on for a while - which is working and performing very well on the localhost - there is no notable sluggishness to the load-times. Once uploaded to the server ( dreamhost dreampress WordPress optimized VPS ) - the site is so slow as to be almost unusable - what should I test, how and with what tools? While my question may be very specific - I'd like to know about a good general routine for debugging and fixing this type of environmental difference - and include the following data to show people what I've looked into so far. Update --- : The number of requests and cached hits to the database is roughly equal between the local and live site - but the main problem seems to be a very long "waiting" cycle on page loads - between 10 - 20 seconds - but how can I find out what is happening in that time - what is the site waiting for? Update ---- : Tested page load via pingdom \- averaging about 12 - 15 seconds to load Tested DNS - all 6 tests passed without error Tested Ping / TraceRoute - all clear Plugin Data ---- : Here is a pie chart from the godaddy P3 plugin for the localhost plugin resource usage and load time impact: ![enter image description here](http://i.stack.imgur.com/aTZK6.png) However, once uploaded ( to dreampress WordPress optimized VPS server ) the site is so sluggish and unresponsive, it's almost unusable - here is the same data from the live site: ![enter image description here](http://i.stack.imgur.com/a4BeV.png) The SabaiDiscuss Wrappers plugin goes form using 4% or resources to over 50% - the number of queries jump from 71 to 159 There are two additional plugin running on the live site - MinQueue to cache and minify scripts / sources and another debugging plugin. Debug Bar gives me these two sets of data: Localhost ---- :               PHP     5.3.5     MySQL     5.5.8     Memory Usage     35,760,984 bytes          TOTAL QUERIES:     82     TOTAL QUERY TIME:     56.2 ms      Development Server --- :               PHP     5.3.27     MySQL     5.0.67     Memory Usage     29,408,256 bytes          TOTAL QUERIES:     88     TOTAL QUERY TIME:     6,497.3 ms      Which seems to show the same number of queries are being run, but taking 1000 times longer to complete.


Disable inline_edit() on edit.php

In the class `WP_Posts_List_Table` there is a function named `inline_edit()` and it is responsible for rendering the entire quick edit table that is used (but initially hidden) on `wp-admin/edit.php`. I want to **prevent** that table from being rendered because the site I'm working on has thousands of category terms and they all get added to this quick edit table as list items with checkboxes. It makes `edit.php` huge and slow loading (and in certain cases with some jQuery plugins even make some browsers stall). I have not found any way, with filters or actions in `WP_Posts_List_Table`, to prevent this table from being rendered. Nor no way to make `edit.php` _not_ call `$wp_list_table->inline_edit();` at the end. Is there some (proper) way to achieve my goal? Without hacking core, of course. (I do know how to disable the quick edit link in the post rows with `post_row_actions` filter but that huge table is still being rendered and sent with `edit.php`.)


W3 Total Cache doesn't detect memcached

I have a wordpress installation (latest version) running on a debian server with memcached and php5-memcached installed (memcache appears on phpinfo()), but W3 Total Cache doesn't seem to recognize it, the compatibility test reports the extension as not installed and doesn't offer memcaced as an option in the various cache configurations. PHP is running as FastCGI if that's important. How can I get memcache to work with W3TC?


WooCommerce - how to display product category above product?

I'm a newbie at modifying wooCommerce. I hope someone can help me with a problem i'm having while trying to make a minor change to the plugin to fit with a request from my client. I'm trying to modify WooCommerce to display the category name for each product. **I want the category name to be shown above the product image on the main shop page**. (the view where many products are shown on the screen at once) I've searched around, and i can't seem to find how to call the product->category to get the category name for each product being shown. In the wooCommerce files, i've found content-product.php   (in templates/content-product.php) and i'd like to inject the category for each product by adding to this action: `do_action( 'woocommerce_before_shop_loop_item_title' );` I understand that I can add a function in my theme's functions.php to inject some new code into the ''woocommerce_before_shop_loop_item_title' but I can't work out how to get the category for each product. can someone help? or tell me where i might be able to find the answer? any help will be much appreciated, thank you!


How to show year/month archive including months with no posts

I found a partial answer at: http://floatleft.com/notebook/wordpress-year- month-archives/ This solution shows all months that have posts. Its not even that much code:               <?php             $year_prev = null;             $months = $wpdb->get_results(   "SELECT DISTINCT MONTH( post_date ) AS month ,                                             YEAR( post_date ) AS year,                                             COUNT( id ) as post_count FROM $wpdb->posts                                             WHERE post_status = 'publish' and post_date <= now( )                                             and post_type = 'post'                                             GROUP BY month , year                                             ORDER BY post_date DESC");             foreach($months as $month) :                 $year_current = $month->year;                 if ($year_current != $year_prev){                     if ($year_prev != null){?>
                     <?php } ?>
<?php echo $month->year; ?>

                 <?php } ?>
                     <a href="<?php bloginfo('url') ?>/<?php echo $month->year; ?>/<?php echo date("m", mktime(0, 0, 0, $month->month, 1, $month->year)) ?>">                         <?php echo date("F", mktime(0, 0, 0, $month->month, 1, $month->year)) ?>
             <?php $year_prev = $year_current;             endforeach; ?>
      My problem is that the designer added all the months, not just the ones that have posts. How could I edit this to show all months, not just the ones with posts. I am using 3.8.1 thanks


Echo User Avatar from Mainsite in Multisite subsite

Users can register and set a custom avatar on my multisite mainsite (`example.com`). I also have two subsites with subdomain set up - for example: `xy.example.com` On my main site I echo the user avatar with this code:               <?php global $current_user; get_currentuserinfo(); echo get_avatar( $current_user->ID, 30 ); ?>      **My Problem:** The user avatar doesn't show up on my subsites. The users are already listed in my subsite backend. Is there any way to echo the same avatar for each user from the mainsite on my subsite `xy.example.com`? I read, is that possible something with the blog id? But have no idea how this work. Would be great if someone can help me out.


Migrating Multisite setup to a different domain

I have migrated my wordpress(with network sites enabled) to another domain, changed domain in wp-config.php and change the domain column for the only blog in wp_blogs table in db to the new domain. Problem is i don't see Network Menu anymore when i click my username. If i delete everything else besides: `define('WP_ALLOW_MULTISITE', true);` and click on network setup, it says that the network is already setup, still i repaste the shown instructions in wp-config.php[after deleting previous] and .htaccess, but no use. PS: I also changed my username from "a" to webmaster in db during the process, changed it everywhere.


Facebook like plugin with Multi Option-Needed

i need to integrate facebook like button with some of additional features. those are..   * every article/post has a 'Like' button (so that using this, when someone clicks 'Like' it'll appear in their Facebook news feed and add them to my Facebook page count direct from within my site)  please help me to get all these features with like button. is there any plugin done? or how to achieve from code?


Prevent empty Post Title on form submit via front end post (wp_insert_post_)

I am creating a post from the front end using (shortened for brevity);               if (empty($_POST['my_title'])){           echo 'error: please insert a title';     } else {           $title =  $_POST['my_title'];     }           $new_post = array(     'post_title'    => $title,     'post_status'   => 'publish',     'post_type'     => 'post'          $pid = wp_insert_post($new_post);         If no Post Title is present on **submit** then the form returns the error message, **error: please insert a title** However WordPress still inserts the post with a title of **(no title)**. Is there a way through simple PHP validation to prevent `wp_insert_post` from accepting an empty value? _(without using Javascript)_. ![IMAGE](http://i.imgur.com/QqjSM.jpg)


Why users disable the WordPress update?

Users install plugins which disable update reminders. Plugins:   * disable WordPress Core Updates   * disable WordPress Plugin Updates   * disable WordPress Theme Updates Look at the counter of plugins downloads. I know that some users change the WordPress core files or plugin or theme files, but there is WordPress hooks and child themes. If user will disable the updates:   * user will not see new features of newer WP versions or plugins or themes;   * user will use software without bug fixes and probably with security issues **So why users disable the WordPress update?** Is there any other reasons disabling updates except of modifying the files?


Setting title using wp_title filter

I want to do something very simple but I'm stuck finding where in WordPress I need to perform this. When someone on my WordPress site visits a blog post page I want the title in the blog post to replaced the title of the page. I think I can do this with the wp_title filter hook? I thought about something like the following :-               add_filter('wp_title', 'filter_pagetitle');          function filter_pagetitle($title) {      $the_post_id    = get_the_ID();      $the_post_data  = get_post($the_post_id);      $title = $the_post_data->post_title;           return $title;     }      However I am a bit lost as to where I put this, I thought it would need to be in loop-single.php as I want this to apply only to single pages, but I have also seen that this needs to be in functions.php within my theme? Any help would be appreciated :-) Rich


How to add code just below opening body tag in Genesis framework

We need to add two snippets of code, one right below the opening body tag, and the other right before the closing body tag. What is the best way to do this? I checked out the wp_enqueue_script, but it appears the content would be in the head section.


Form submit from modal window to parent window

Trying to submit a field value from a popup modal window to my WordPress parent window meta-box. On my add post page I have a metabox with a field type 'text'. ![Meta-box](http://i.stack.imgur.com/ZmIoA.png) The id of my 'text' field type input is 'tumble2_kaltura-video' Next to the metabox text field is a button link which opens up a modal box: ![Kaltura popup window](http://i.stack.imgur.com/58Exe.png) Once I select my video in the modal box, there is a submit button that when clicked will send out a shortcode. _Normally this shortcode is sent to the wp- editor_ ![shortcode output to editor](http://i.stack.imgur.com/brn7h.png) What script do I need to use in order to send the shortcode from the modal box to the metabox text field 'tumble2_kaltura-video'? Here is my kaltura code that is 'in charge' of normally sending the value to the editor. Need to change something in here to target my metabox instead. https://gist.github.com/3162011 I tried pasting my code in here instead of gist, but no matter how I formatted it, it was always messed up.


How to check if txt file exists inside template folder?

I have a folder inside my theme where I hold some txt files which I am including in a theme. The problem is that before including txt file I need to check if it does exist. I fail checking it the following way and have no idea why it wont work, always returns false.               $themeLocation = get_bloginfo('template_url');     $fileName1 = $themeLocation.'/txtfolder/file1.txt';          if(is_file($fileName1)){        echo 'It does exist';     } else {        echo 'Error';     }


Get value of custom field in category admin

I am using cfs-custom-category-fields plugin. In their documentation it says that to get the value of a custom field in category you should use `CfsTaxonomy::get('field_name')` This works well when I am in a category page, like `category-24.php`. But it doesn't work in `index.php`. How do I get the value in a non-category page? I tried something like this:               $cat_id = 29;         if($cat_id=29){             echo CfsTaxonomy::get('arata_in_listare');         }?>       But it doesn't work. I suppose I need to create a category page-like environment.


How can I install my custom-made theme on a wordpress.com blog?

I've only ever worked with WordPress on my own server. I'm using wordpress.com for my development environment, but I can't for the life of me figure out how to upload my themes since as far as I know I have no FTP access... I'm sorry if this is something that should be obvious, but all I'm finding in searches is how to FTP themes into personal WP installs, which I already know.


using post meta data as permalink tags

I have a client who would like their wordpress permalinks to look like this:                /%category%/%state%/%city%/%street%/      I can get this information easily enough with custom meta data in the post editor, but I'm at a loss to see a method for creating custom permalink tags. Can anyone tell me how this might be achieved? Cheers!


How to Use metada Value in Url and is it possible?

> **Possible Duplicate:**   >  How to use Post Custom Metadata in Post Titles and Post Permalinks hii i want to know that how can i use my metadata value for post url which i add with my every post in custom field First of all is this possible to make url with that and fetch post data with value. Like domain.com/metadata_value And if it is possible where become the Wordpress POST PERMALINK Function? that i can edit that manually And How ? And is thiS safe and Faster Method or it can crate troubles or can damage my word press Speed ?and how much effect on speed and SEO Thanks


How to use Post Custom Metadata in Post Titles and Post Permalinks

I am very new to WordPress. How can I use post custom metadata in place of Post Titles, and as the Post Permalink? For example, instead of `domain.com/the-post-title`, the permalink would be `domain.com/$postcustommetadata`. I posted my idea in the WPORG support forums. I have a general idea, but don't know how to implement it, because I don't yet fully understand WordPress conventions, classes, etc. Thanks Plzz HeLp


Universal problem: first request after ~25 second inactivity always slower (~1 second) than subsequent requests (~1/10sec)

It's something I noticed ever since I started working with WordPress. It's a universal issue, in the sense that it doesn't matter if the WP installation is on my shared hosting account (haven't tried different providers though), or a local LAMP setup. Brand-new, clean WordPress, with 1 post, 1 page, and defaukt theme - or old WP, with hundreds of posts, a heavy theme and tons of plugins... doesn't make a difference. Currently working on a screaming fast local virtual machine (i7-3930k with a fast SSD, CentOS 6.2, Softaculous, standard Apache and MySQL, nothing else running on the box) and the scenario goes like this:   1. First time load, any front- or backend pages: about 1 second delay.   2. Subsequent load of the same or ANY OTHER PAGE (front- or backend), WITHIN ~25 seconds: virtually instantaneous response.   3. Wait 25 seconds, reload, the 1-second delay is back This 25-second interval is about the best measurement I was able to do within the limits of my patience, but it's got pretty good accuracy and repeatability. Further observations:   * Different installations on the same LAMP are "isolated" from each other, i.e. loading one site, then immediately loading another one does not make the latter to load fast.   * My current "solution" is having a tab open with a dummy page that reloads itself every 20 seconds Did anyone else notice this issue? What could it be? I'd be happy to provide any and all details to help track this thing down. Thank you all!


Match two posts in categories

I have blog posts each having three or more categories. The issue is that I need to search related posts and I have to match at least two categories i.e. there must be two common categories. I am using this query:                  $args = wp_parse_args($args, array(         'showposts' => 10,         'post__not_in' => array($post_id),         'ignore_sticky_posts' => 1,         'category__in' => wp_get_post_categories($post->ID)     ));         $query = new WP_Query($args);      I am trying `category__in` but it gives all posts which match even just one category.


Move wp-content htacess

I notice that when I rename the wp-content and plugins folders http://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content my multisite network htacess still references wp-content: see this line below: RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     **RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]**     RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]     RewriteRule . index.php [L]      What should the proper rewrite rule be if you move wp-content?


Modify search function in WordPress (TwentyTwelve)

I want to remove "Search for" text from search form in TwentyTwelve, to wrap in in a div for styling, and probably to play with php a bit – and I'd appreciate some advice on how to do that best. My "sub-questions within a question": 1) Where is the main search function is located? 2) Should I create a separate custom file, add code to functions.php - or is it okay in this case to just edit the original search function? Thank you in advance for your help!


MP3 Manager for Wordpress

Looking for the following functionality, there does not seem to be a single way to do this, at least not that I was able to find. I would gladly pay for a plugin that did all of this to save me the time of writing one. This is for a bands' site, so keep that in mind.   * Create a new post type of Albums   * Allow admins of the site, in a user friendly way, to upload multiple MP3 files at once.   * Parse ID3 tags from the albums.   * Using the files' ID3 tags, create a post of the Album title if one does not exist.   * When the album post type for each individual album is clicked, it displays all of the tracks and users can play these tracks from the site or download them. Does this functionality (or something similar) currently exist? I really appreciate any guidance :) MG


Does Wordpress have to be released under the GPL?

WordPress uses MYSQL, which is released under GPL. So I think Workpress **MUST** be under GPL. But my friend said WordPress doesn't include MySQL program when it released, so it can be released under other license, and don't need to open source. Which is correct?


How to avoid duplicate Url for the home page

I am working on this web . I need to fiugure it out on how to avoid repeating the URL in the home Page. The Home page has actually two url creativesquaresummercamp.com/ creativesquaresummercamp.com/welcome-to-your-best-summer/ I want my Home page just having this url creativesquaresummercamp.com This is happening of course because this specific page has been selected page as Home Page. The permalink of this page obviously is: creativesquaresummercamp.com/welcome-to-your-best-summer/ How can i figure it out this issue? Thanks


mass delete posts based on metadata

I need to delete all posts that have a certain meta value for a certain meta key. I am looking for how to do this directly in the DB. So for instance, I have a meta field called "state", and I want to delete all posts (and there are thousands) whose meta value for that key is NOT equal to "CA". I have found queries that delete all posts of a certain type and all associated meta data, but can't find one that will let me delete posts BY metadata.


Exclude custom post type from list

<?php          $custom_post_types = get_post_types(              array(                 '_builtin' => false,                 'public' => true             ),             'objects'          );              foreach ( $custom_post_types as $custom_post_type ) {             $custom_post_type->permalink = get_post_type_archive_link( $custom_post_type->label );         }              echo '
';         foreach ( $custom_post_types as $custom_post_type ) {             echo '
';             echo 'permalink . '">' . $custom_post_type->label . '';             echo '
';         }         echo '
';         ?>      I want to exclude products and sales CPT from the list. Can anyone help please? Also I want to display the list in ACS order.


How Can I Limit Users to Post Creation For My Frontend Theme?

I have exactly a same site like stachexchange. In my theme all users can ask questions. But I want to limit users to post for preventing spam. Example: **1 post per hour**. Default new registration role is author. Bainternet's Posts Creation Limits plugin doesn't work with front end and I don't have any shortcode in my theme. Here is the my posting ask a question front page.Please help me.I am using Robust Q&A Theme.(In themeforest)                   <?php     /**      * @package WordPress      * @subpackage Robust Q&A - WPQA      */      ?>          <?php     include (TEMPLATEPATH . '/translations.php');     // Define the Post Redirect     $redir = $post->ID;          /////////////////////////////     //$_COOKIE Checkers       //     ///////////////////////////          // Get Question Reported Cookie to Display Success Message     if (isset($_COOKIE['content_reported_'.$post->ID])) {         $reported_content = $_COOKIE['content_reported_'.$post->ID];         if(isset($reported_content) && $reported_content != NULL) {             $message = $t_message_sucsess_content_reported;         }     }          // Get Answer Posted to Question Cookie to Display Success Message     if (isset($_COOKIE['answer_posted_'.$post->ID])) {         $new_answer_posted = $_COOKIE['answer_posted_'.$post->ID];         if(isset($new_answer_posted) && $new_answer_posted != NULL) {             $message = $t_message_answer_success_posted;         }     }          // Get Comment Posted on Answer Cookie to Display Success Message     if (isset($_COOKIE['comment_posted_'.$post->ID])) {         $new_comment_posted = $_COOKIE['comment_posted_'.$post->ID];         if(isset($new_comment_posted) && $new_comment_posted != NULL) {             $message = $t_message_sucsess_comment_on_answer;         }     }          // Get Question Already Reported Cookie to Display Error Message     if (isset($_COOKIE['already_reported_'.$post->ID])) {         $already_reported_question = $_COOKIE['already_reported_'.$post->ID];         if(isset($already_reported_question) && $already_reported_question != NULL) {             $message = new WP_Error('already_reported_question', $t_message_already_reported_content);         }     }          // Get Forgot Question Note Cookie to Display Error Message     if (isset($_COOKIE['forgot_add_note_'.$post->ID])) {         $forgot_question_note = $_COOKIE['forgot_add_note_'.$post->ID];         if(isset($forgot_question_note) && $forgot_question_note != NULL) {             $message = new WP_Error('forgot_question_note', $t_message_forgot_note_text);         }     }          // Get Question Note Added Cookie to Display Success Message     if (isset($_COOKIE['question_note_added_'.$post->ID])) {         $question_note_added = $_COOKIE['question_note_added_'.$post->ID];         if(isset($question_note_added) && $question_note_added != NULL) {             $message = $t_message_note_added_to_question;         }     }          // Get Best Answer Selected Cookie to Display Success Message     if (isset($_COOKIE['best_answer_selected_'.$post->ID])) {         $best_answer_selected = $_COOKIE['best_answer_selected_'.$post->ID];         if(isset($best_answer_selected) && $best_answer_selected != NULL) {             $message = $t_message_best_answer_selected;         }     }          // Get Remove Question Email Alerts Cookie to Display Success Message     if (isset($_COOKIE['removed_question_email_alerts_'.$post->ID])) {         $remove_message_email_alerts = $_COOKIE['removed_question_email_alerts_'.$post->ID];         if(isset($remove_message_email_alerts) && $remove_message_email_alerts != NULL) {             $message = $t_message_email_alerts_removed;         }     }          if ( isset($_POST['answer_post']) == '1') {         $answer_content = $_POST['answer_content'];         $source_link = $_POST['source_link'];         $message = post_new_answer($answer_content, $source_link);     }          if ( isset($_POST['comment_on_answer_post']) == '1') {         $comment_content = $_POST['comment_content'];         $comment_parent_id = $_POST['comment_parent_id'];         $message = post_new_comment_to_answer($comment_content, $comment_parent_id);     }          if ( isset($_POST['best_answer_post']) == '1') {         $best_answer_id = $_POST['best_answer_id'];         $best_answer_parent_question = $_POST['best_answer_parent_question'];         $message = select_best_answer($best_answer_id, $best_answer_parent_question);     }          if ( isset($_POST['report_content']) == '1') {         $reported_item_id = $_POST['reported_item_id'];         $reported_type = $_POST['reported_type'];         $question_id = $_POST['question_id'];         $message = report_content_item($reported_item_id, $reported_type, $question_id);     }          if ( isset($_POST['add_note_to_question']) == '1') {         $add_note_text = $_POST['add_note_text'];         $question_id = $_POST['question_id'];         $message = add_note_to_question($add_note_text, $question_id);     }          if ( isset($_POST['remove_email_alerts']) == '1') {         $question_id = $_POST['remove_alerts_question'];              $message = remove_question_email_alerts($question_id);     }          get_header();?>

                                                  <?php //get_search_form(); ?>

<a href="<?php echo home_url(); ?>/<?php echo $t_ask_a_question_permalink;?>/"><?php echo $t_ask_question; ?> <img src="<?php echo get_template_directory_uri(); ?>/images/grey-add-btn-icon.jpg" alt="" />
                             <?php if ( current_user_can('manage_options')) {?>
<?php edit_post_link($t_edit_page_link); ?>
                             <?php } ?>                             <?php include (TEMPLATEPATH . '/breadcrumb.php'); ?>

                                                                         <?php if (have_posts()) : ?>                         <?php query_posts($query_string . ""); ?>                         <?php while (have_posts()) : the_post(); ?>
                             <?php                              if (isset($message)) {                                 display_message($message);                             } ?>
                                 <form action="" method="post" name="reportContent">
<?php echo $t_report_content_message_text; ?>

                                     <input type="hidden" value="<?php echo $post->ID ?>" name="reported_item_id" />                                     <input type="hidden" value="Question" name="reported_type" />                                     <input type="hidden" value="<?php echo $post->ID; ?>" name="question_id" />                                     <input type="hidden" value="1" name="report_content" />                                     <input type="submit" class="process" value="<?php echo $t_report_question;?>" />                                 </form                                 >

                                          <?php                                          // Get data for displaying avatar                                         $author = $authordata;                                          $blog_url = get_template_directory_uri();                                         $selected_avatar_image = get_user_default_icon($author->ID);                                         $avatar_image = '/images/default-user-avatar-'.$selected_avatar_image.'.jpg';                                         $url = $blog_url . $avatar_image ;                                              // Get data for linking to member profile when clicking avatar image                                         $main_url = home_url();                                         $author_name = get_the_author_meta('nicename');                                         $profile_link = '/'. $t_profile_permalink .'/';                                         $author_profile_link = $main_url . $profile_link . $author_name;                                         $email_question_asker = get_post_meta($post->ID, 'alert_asker_emails', true);                                     ?>                                                           <div class="questionBox" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<?php the_title(); ?>
                                             <a name="<?php the_ID(); ?>">
<?php the_content(); ?>

                                                 <form action="" method="post" name="addNoteToQuestion">                                                     <?php echo $t_add_note_popup_heading_text; ?>:                                                     <textarea name="add_note_text"></textarea>

                                                     <input type="hidden" value="<?php echo $post->ID ?>" name="question_id">                                                     <input type="hidden" value="1" name="add_note_to_question" />                                                     <input type="submit" class="process" value="<?php echo $t_add_a_note_link;?>" />                                                 </form                                                 >

                                                 <form action="" method="post" name="removeEmailAlerts">
<?php echo $t_remove_email_alerts_text;?>

                                                     <input type="hidden" value="<?php echo $post->ID ?>" name="remove_alerts_question">                                                     <input type="hidden" value="1" name="remove_email_alerts" />                                                     <input type="submit" class="process" value="<?php echo $t_remove_email_alerts_link;?>" />                                                 </form                                                 >

                                                                                <?php // Show Question Note if Set                                             $author_note = get_post_meta($post->ID, 'question_note', true);                                                  if ($author_note != NULL) { ?>
<?php echo $t_author_note_heading_text;?>:
<?php echo $author_note; ?>
                                             <?php } ?>                                                  <?php // Show Source Link Code if Set                                             if (isset($source_link) != NULL) { ?>
<?php echo $t_link_text;?>: <?php echo $source_link; ?>
                                             <?php } ?>                                                  <?php                                             $posttags = get_the_tags();                                             if ($posttags) {?>
<?php the_tags($t_tags_text.' ' , ' ', ''); ?>
                                             <?php } ?>
<?php echo $t_in_text;?>: <a href="<?php echo home_url(); ?>/<?php echo $t_category_permalink;?>/"><?php the_category(', ','multiple') ?> | <?php the_time(get_option( 'date_format' )); ?>
                                                  <?php // ADD Question Note                                             global $current_user;                                             get_currentuserinfo();                                                  if ($post->post_author == $current_user->ID && $author_note == '') { ?>
|<a href="#addNotePop" onclick="return; false" class="boxy" title="<?php echo $t_add_a_note_link;?>"><?php echo $t_add_a_note_link;?>
                                             <?php } ?>                                                  <?php                                              $email_question_asker = get_post_meta($post->ID, 'alert_asker_emails',true);                                                  if ($post->post_author == $current_user->ID && $email_question_asker == 'true') {?>
|                                                 <a href="#removeEmailAlerts" onclick="return; false" class="boxy" title="<?php echo $t_remove_email_alerts_link;?>"><?php echo $t_remove_email_alerts_link;?>
                                             <?php } ?>

<a href="<?php echo home_url(); ?>/<?php echo $t_profile_permalink;?>/<?php echo $author->user_nicename; ?>/"><?php echo $author->display_name; ?><?php echo getPointLevel($author->ID, 'sm'); ?><?php $expert_user = get_user_meta($author->ID, 'expert', true); if($expert_user == 'yes') { ?><img src="<?php echo get_template_directory_uri(); ?>/images/expert-badge-icon.png" alt="<?php echo $t_expert_text;?>" class="expertImg" /><?php } ?>
                                           <?php                                     if (is_user_logged_in()) {                                     ?>                                          <div class="bylineBoxShare" id="report<?php echo $post->ID ?>"><a href="#reportPop" onclick="return; false" class="boxy" title="<?php echo $t_report_question;?>"><img src="<?php echo get_template_directory_uri(); ?>/images/flag-this-icon.png" alt="<?php echo $t_report_question;?>" />
                                          <?php } else { ?>
<a href="<?php bloginfo('siteurl'); ?>/<?php echo $t_login_permalink;?>/?redir=<?php echo $redir; ?>" title="<?php echo $t_login_signup_report_content_text;?>"><img src="<?php echo get_template_directory_uri(); ?>/images/flag-this-icon.png" alt="<?php echo $t_report_question;?>" />
                                           <?php } ?>                                          <span class="adminURL" id="<?php echo admin_url();?>">                                     <span class="templateURL" id="<?php echo get_template_directory_uri(); ?>">                                     <?php $post_id = $post->ID;?>                                     <?php $current_like_count = get_post_meta($post_id, 'like_count');?>                                     <?php if (isset($current_like_count[0]) == NULL || $current_like_count[0] == 0){$current_like_count[0] = 0;}?>                                     <span class="likeCount-<?php echo $post_id ?>" id="likeCountCurrent-<?php echo $current_like_count[0]?>">                                          <?php                                     if (is_user_logged_in()) {                                              global $wpdb;                                         $current_user_id = get_current_user_id();                                              $get_user_liked_question_value = "SELECT * FROM " . $wpdb->prefix . "rqa_liked_content WHERE user_id ='". $current_user_id . "' AND like_content_id ='". $post_id . "'" ;                                         $users_liked_question_value = $wpdb->get_results($get_user_liked_question_value);                                              if (isset($users_liked_question_value[0]->user_id) == $current_user_id && isset($users_liked_question_value[0]->like_content_id) == $post_id) {                                              ?>

<img src="<?php echo get_template_directory_uri(); ?>/images/like-icon.png" alt="<?php echo $t_like_text;?>" /><?php if ($current_like_count[0] > 0) { echo $current_like_count[0];} else {echo $t_like_text;} ?>

                                              <?php } else { ?>
                                                 <div class="bylineBox right likeThisLink" id="like-this-<?php echo $post_id; ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/like-icon.png" alt="<?php echo $t_like_text;?>" /><?php if ($current_like_count[0] > 0) { echo $current_like_count[0];} else {echo $t_like_text;} ?>

                                                   <?php } ?>                                          <?php } else { ?>

<a href="<?php bloginfo('siteurl'); ?>/<?php echo $t_login_permalink;?>/?redir=<?php echo $redir; ?>" title="<?php echo $t_login_signup_like;?>"><img src="<?php echo get_template_directory_uri(); ?>/images/like-icon.png" alt="<?php echo $t_like_text;?>" /><?php if ($current_like_count[0] > 0) { echo $current_like_count[0];} else {echo $t_like_text;} ?>

                                     <?php } ?>

                                                          <?php endwhile; ?>                                               <?php endif; ?>                                          <?php wp_reset_query();?>

                                      <?php                                 // List out the number of Answers - Exlcuding Comments on Answers                                 $answers_count = c_parent_comment_counter($post->ID);                                      // Var to show comments on answers count - not used                                 // $comments_on_answers_count = $post->comment_count - $number_of_parents;                                      if ($answers_count < 1) {?>
<?php echo $t_no_answer_yet_answer_now_text;?>
                                 <?php }                                 if ($answers_count == 1) {?>
<?php echo $answers_count; ?> <?php echo $t_answer_text;?>
                                 <?php }                                      if ($answers_count > 1) { ?>
<?php echo $answers_count; ?> <?php echo $t_answers_text;?>
                                 <?php } ?>

                                  <?php comments_template(); ?>                                  <?php                             // If logged in change nav to My Account and Log Out                             if ( is_user_logged_in()) { ?>                                     <?php // Users cant post answers ?>                                 <?php $users_cant_answer = get_option('robust_qa_admin_answer_only');                                 if ($users_cant_answer == true && (!current_user_can('manage_options') && $current_user->expert == 'no')) {?>
<?php echo $t_admins_answer_questions_only_text; ?> <a href="<?php echo home_url(); ?>/<?php echo $t_ask_a_question_permalink;?>/"><?php echo $t_admin_answer_link;?>
                                 <?php } else {?>

<?php echo $t_answer_this_question_heading;?>

                                                  <form action="" method="post" name="answerSubmitForm" id="answerSubmitForm">

                                                 <fieldset><textarea rows="10" cols="40" name="answer_content" id="answer_content" ><?php if (isset($_POST['answer_content'])) { echo $_POST['answer_content']; }?></textarea></fieldset>                                                 <?php echo $t_source_link_heading;?>: (<?php echo $t_optional_text;?>)                                                 <input type="text" name="source_link" class="sourceLinkInput" value="http://" />                                                 <input type="hidden" name="answer_post" value="1">                                                   <input type="submit" value="<?php echo $t_add_answer_btn;?>" />

                                             </form>

                                      <?php } ?>                             <?php } else { ?>

<?php echo $t_must_be_logged_in_to_answer;?>

<?php echo $t_already_a_member_text;?> <a href="<?php echo home_url();?>/<?php echo $t_login_permalink;?>/?redir=<?php echo $redir; ?>"><?php echo $t_login_text;?>
<?php echo $t_not_member_yet_text;?> <a href="<?php echo home_url();?>/<?php echo $t_signup_permalink?>/?redir=<?php echo the_ID(); ?>"><?php echo $t_signup_text;?>

                             <?php } ?>

                                     <?php                                      $single_cat = get_the_category();                                     $single_parent_cat = get_category($single_cat[0]->category_parent);                                     $main_question_id = get_the_ID();                                          if ($single_cat[0]->category_parent != 0) { ?>
<a href="<?php echo home_url(); ?>/<?php echo $t_category_permalink;?>/<?php echo $single_parent_cat->slug; ?>/<?php echo $single_cat[0]->slug; ?>/"><?php echo $t_more_category_questions_heading;?>
                                     <?php } elseif ($single_cat[0]->category_parent == 0) { ?>
<a href="<?php echo home_url(); ?>/<?php echo $t_category_permalink;?>/<?php echo $single_cat[0]->slug; ?>/"><?php echo $t_more_category_questions_heading?>
                                     <?php } ?>
<?php echo $t_related_questions_heading;?>:

                                     <?php                                      if (have_posts()) :                                      $args = array(                                         'posts_per_page' => 5,                                         'cat' => $single_cat[0]->cat_ID,                                         'orderby' => 'date',                                     );                                     query_posts($args);                                          ?>                                     <?php while (have_posts()) : the_post();?>                                          <?php if ($post->ID != $main_question_id ) { ?>
<a href="<?php the_permalink(); ?> "><?php the_title(); ?>
                                     <?php } ?>                                     <?php endwhile; ?>                                 <?php endif; ?>                                 <?php wp_reset_query();?>

                                               <?php get_sidebar(); ?>

                   <?php get_footer(); ?>      <?php if ( is_singular() ) wp_enqueue_script( "comment-reply" ); ?>


Hosting Wordpress on Google Apps Engine (GAE)

At Google's 2013 IO conference, one of their many announcements was the ability to host PHP sites and apps on their Google Apps Engine. They even created a tutorial explaining how to set up a Wordpress site on GAE: https://developers.google.com/appengine/articles/wordpress. I am curious about the supposed performance benefits of running a WP site on GAE. What are the advantages and disadvantages of using GAE versus a hosting service provider like BlueHost or GoDaddy?


Sidebar on Single Product Page WP e-commerce on the wrong spot

I cannot get the sidebar on my WP site (twenty-eleven theme) working properly in my wp e-commerce shop. On the products page the sidebar is on the right side of the page, as it should be. On a single products page, however, the content of the sidebar is showing below the content. Have spend many hours searching how to fix this but no luck. Any help would be greatly appreciated. Here's a link to a single productpage: http://test.boarddesign.nl/?wpsc- product=gopro-kite-line-mount Sidebar is below the content Here's a link tot a correct page: http://test.boarddesign.nl/?page_id=43


How to unpublish multiple posts in one click?

I need to unpublish 200 posts in order to make some hard edition. These posts are from 2012 and my site is live with all the posts since 2013 until today. I would like to find a solution to be able to bulk unpublish posts of year 2012 in order for our team to edit them. If there's no solution by date, the other alternative is to select all the posts and un publish them. What would be the plugin or solution in this case?


How to connect different CPTs together?

I hope this question has its place here. I've always thought that connecting different Custom Post Types together is a rather common need, like in popular tutorial examples of custom taxonomy usage (books/authors/titles, films/actors/directors, etc). I personally use "Posts 2 Posts", but support stopped. On Google the most relevant results point to this plugin right now. Which long term alternatives exist? What would a seasoned WordPress web developer use to design a book/author/title management system with WordPress today, if P2P plugin is finished?


wp_query for displaying attachments with a tag

So I am running the following query:               <?php         $args = new WP_Query(array(             'post_type' => 'attachment',             'posts_per_page' => -1,             'oderby' => 'title',             'order' => 'ASC',             'post_status' => 'any',             'post_parent' => null,             'tax_query' => array(                 array(                     'taxonomy' => 'post_tag',                     'field' => 'slug',                     'terms' => 'logo'                 )             )         ));              while ( $args->have_posts() ) : $args->the_post();          ?>      An issue that I need to address is a better sorting method for the attachments. Currently I can only get it by title ASC or DESC. I am aware of the other orderby attributes available with the WP_Query but not all seem to work. I was wondering if anyone knows of a way to modify the upload date of images in the media library because then I could modify my query to go based off of date and we can just edit the dates of the images to show newer ones first etc. Any ideas that could help me with getting more of a manual control of this would be great. Thanks!


Dynamic content in pages

I'm looking to have dynamic content in pages. I've created this page: coaches/basketball/mike-johnson That works great and does everything I want it to do. However, I also want to create something like this without having to go into the admin and create a page each time: coaches/basketball/joe-smith coaches/basketball/ben-murray Is there a good way to do this automatically without manually inserting a new page? Would I need to create a PHP function that would add a page into the database? That doesn't seem like it would scale well for thousands of coaches. I understand how to create coaches/basketball/page?coach_id=100 coaches/basketball/page?coach_id=101 coaches/basketball/page?coach_id=102 etc This is what I'm really looking for, just with a clean URL and also so the page is searchable. Thanks in advance for the help!


How to implement just the wp commenting area on my custom site?

I'm searching for some site where I can find **line by line** explanation of an wp theme's code.   Because, I want to implement on my site just commenting area.   I don't need sidebar, gadgets, searching, archives... all the toys.   My page has everything I need, except commenting area, but I can't find which code lines stands after pressing "submit" button.   I tried to find such a simple template - without success.


Query posts by custom fields

I am making a theme for a hotel, and I need to be able to provide functionality to search by the following custom fields: Location and Price. I need to be able to query them from the query string itself... ie: yoursite.com/?post_type=rooms&location=south yoursite.com/?post_type=rooms&price=20.95 yoursite.com/?post_type=rooms&location=north&price=35 I have found many different questions/answers to this, but none of them seem to specifically address my issue. This one, notably, I believe is really close to solving the issue for me: Query posts and filter at query time by value of custom meta It doesn't make much sense to me. I am used to PHP, however I am new to WordPress as a CMS.


Create a Page Templete to Display Table Of Content for Custom Taxonomies

I have created a custom post type named "Training" & a Custom Taxonomy for the same named "Table Of Content" I need to create a Page template to display Table Of Content Something like this

 Custom Taxonomy 1

 Child Taxonomy 1

 Post Title 1

 Post Title 2

 Post Title 2

 Child Taxonomy 2

 Post Title 1

 Post Title 2

 Post Title 2

 Custom Taxonomy 2

 Child Taxonomy 1

 Post Title 1

 Post Title 2

 Post Title 2

 Child Taxonomy 2

 Post Title 1

 Post Title 2

 Post Title 2

      Here is the php code in functions.php for creating custom taxonomy               // Custom Taxonomy for Training     $labels = array(         'name'                          => 'Table of Content',         'singular_name'                 => 'Table of Content',         'search_items'                  => 'Search Table of Content',         'popular_items'                 => 'Popular Table of Content',         'all_items'                     => 'All Table of Content',         'parent_item'                   => 'Parent Table of Content',         'edit_item'                     => 'Edit Table of Content',         'update_item'                   => 'Update Table of Content',         'add_new_item'                  => 'Add New Table of Content',         'new_item_name'                 => 'New Table of Content',         'separate_items_with_commas'    => 'Separate Table of Content with commas',         'add_or_remove_items'           => 'Add or remove Table of Content',         'choose_from_most_used'         => 'Choose from most used Table of Content'         );          $args = array(         'label'                         => 'Table of Content',         'labels'                        => $labels,         'public'                        => true,         'hierarchical'                  => true,         'show_ui'                       => true,         'show_in_nav_menus'             => true,         'args'                          => array( 'orderby' => 'term_order' ),         'rewrite'                       => array( 'slug' => 'table-of-content', 'with_front' => false ),         'query_var'                     => true     );     register_taxonomy( 'tableofcontent', 'training', $args );      Thanks & Regards


Dynamically changing header text depending on URL in Wordpress html page

My shopping cart displays the order history on the last page the customer visited. For example, www.someurl.com/item1 is the last page the customer visited before checkout. An order confirmation email is sent with a link to that order as well as the customers entire order history. The link address is www.someurl.com/item1/#!/~/orderConfirmation. I would like my header to read "item1" on www.someurl.com/item1, and "history" on www.someurl.com/item1/#!/~/orderConfirmation. I am using Wordpress 3.5.2 with a twenty-twelve child theme Can this be accomplished? Any help is greatly appreciated


Hide the 'Gallery Settings' section of the Gallery tab of the media Thickbox

When I invoke the media uploader from a certain page, I'm looking for a way to hide all of the 'Gallery Settings' options at the bottom of the Gallery tab. I have set a referrer (`dd-options-footer`), so I can check that to ensure the code is only added for my desired page, but it seems that whatever I add does not work. I've tried adding both custom CSS and JS to do this, but it appears that WP overrides this in `wp-admin/js/gallery-min.js` when it outputs the content of the tab. Anyone know how I can do this? Thanks.


Prevent/Disable Automatic Update Check

WordPress automatically checks for updates to itself and all installed themes and plugins. This adds an annoyingly long delay to loading ( _any_ ) WordPress pages. In only happens once per day and subsequent page-loads don’t do it, but it is so long, that it makes me think twice about whether it is worth opening that first page at all (especially if I only need to do a quick thing rather than spending all day in WordPress). I only update once in a while anyway, and would much rather perform updates manually anyway, so I created a plugin to remove the _Updates_ button from the admin bar. I thought that would do the trick, but apparently in only removes the button and the actual check is still performed in the background. Every other program in the world lets you turn them off automatic updates, so I expect that there should be a way to do the same for WordPress, but if there is, it is a little too-well—hidden. When I tried to find a solution, all of the questions that came up were the opposite, about finding a way to force automatic updates to actually apply (not just automatically check for updates). How can automatic update checks be turned off in WordPress?


Implementing an OR statement to wordpress wp_query

I am trying to return all posts that meet the following conditions: The category must be 63 OR the post must have a value associated with the meta key named 'android_link' My current argument array currently does not work because it is asking for both of these conditions to be met. Is it possible to change it so that only one of these conditions must be met to return a post?                   $args = array(             'paged' => $paged,             'order' => 'DESC',             'meta_key' => 'android_link',             'post_type' => array( 'post', 'app' ),             'cat' => '63',                  'meta_query' => array(                 array(                     'key' => 'android_link',                     'compare' => 'EXISTS',                     )                 )             );


Search Result Customization

I need the search for highly customized. I've a custom post type with custom field. Search result should be displayed in this way:   1. First search should be performed into all title and displayed them   2. Then into a custom field and shown then (except those which were shown in step 1) So, I planned about using fully custom MySQL query. I'll search inside title first and store post ids into an array. Then run another query into post meta table and show result except those posts which were shown in first step based on the array of post id. Don't know if it's a good idea. Can you please give me an idea to perform my task in an effective way? Thanks


Limit search to a parent page and its child pages

Is it possible to modify the default "search engine" to limit the search to a specific page and its sub-pages? And how? Thanks!


How can I add only related products?

I want to seperate tabs and related products, so I used:               remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );     do_action( 'woocommerce_after_single_product_summary' );      This code worked well, but i want to add related products again to the single product page. How can I add related products only? Thank you.


Determine plugin name from within plugin_action_links filter

Is there any way to determine what plugin the plugin_action_links filter is addressing when it processes the filter? I'm trying to add some actions for each plugin on the `/wp-admin/plugins.php` page. Code looks as so:               public function _add_plugin_links(){         $plugins = get_plugins();         foreach($plugins as $k=>$plugin){             add_filter( 'plugin_action_links_' . $k, array(&$this, '_plugin_action_links') );         } // foreach $plugins     }          public function _plugin_action_links( $links ) {        $plugin = 'test'; // Somehow get plugin name here?        $links[] = 'Plugin name is: '.$plugin;        return $links;     }      I am able to append this text to the end of each plugin link list, but cannot determine exactly which plugin I am adding the text to. Adding a global variable from within `_add_plugin_links()` simply returns the very last plugin that is parsed from the plugins list.


Add Schema Image Designation Inside a Wordpress Function?

I would like to add itemprop="articleSection" to a thumbnail.               <?php the_post_thumbnail('thmb-index'); ?>      This is what I've tried:               <?php the_post_thumbnail('post-thumbnail',array('itemprop'=>'image')); ?>      How can I do this in the most simple and effective way? Preferably, I would like to incorporate it into `<?php the_post_thumbnail('thmb-index'); ?>` itself, not functions.php.


Add a "default sorting" menu to child store pages

I'm new to WordPress WooCommerce and I can't figure out how to add a "default sorting" drop-down filter to my _category_ shop pages. I know it's on the plain old "SHOP" page, but my navigation doesn't even show that page (I set that up that way by choice). I have category pages (Cupcakes, Balloons, Plush, Cakes) and sub-category pages (for example: Cupcakes—Flavors Cupcakes—Assortments, Cupcakes—Holiday&Seasonal [etc.]), and I would like to have a "sort-by (price, popularity, average rating, newest) drop-down menu on ALL of those unique pages. Seems like such a basic thing. Does anyone know how to do this? Is it even possible? I am using the "Shoppest" theme. Here is my full archive-product.php page code.               <?php          /**           * The Template for displaying product archives, including the main shop page      which is a post type archive.           *           * Override this template by copying it to yourtheme/woocommerce/archive-     product.php      *      * @author      WooThemes      * @package     WooCommerce/Templates      * @version     2.0.0      */               if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly               get_header('shop'); ?>                   <?php                  /**          * Shoppest - remove woocommerce_output_content_wrapper & breadcrumb          *           * woocommerce_before_main_content hook          *          * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)          * @hooked woocommerce_breadcrumb - 20          */         do_action('woocommerce_before_main_content');     ?>          <?php         // check sidebar position         $options = get_option('shoppest');         $layout = ( isset($options['shop_layout']) && !empty($options['shop_layout']) ) ? $options['shop_layout'] : 'sidebarleft';         //echo $option['shop_layout'];         if ( $layout != 'fullwidth' ) {             $cssclass = 'span9';             if ( $layout == 'sidebarleft') $cssclass .= ' contentright';         } else {             $cssclass = 'span12';         }     ?>          <div role="main" id="content" class="<?php echo $cssclass; ?>">              <?php // make show page title false ?>              <?php if ( apply_filters( 'woocommerce_show_page_title', false ) ) : ?>
<?php woocommerce_page_title(); ?>
              <?php endif; ?>              <?php              /*              *  Shoppest - remove woocommerce_archive_description [ that display description]              *              *  @hooked sama_shop_slider - 10              */             do_action( 'woocommerce_archive_description' );         ?>              <?php if ( have_posts() ) : ?>                  <?php                 $options = get_option('shoppest');                 $icon_layout = ( isset($options['shop_icon_layout']) ) ? $options['shop_icon_layout'] : true;             ?>
                          <?php                         /**                          * Shoppest - remove woocommerce_result_count                          *                          * woocommerce_before_shop_loop hook                          *                          * @hooked woocommerce_result_count - 20                          * @hooked woocommerce_catalog_ordering - 30                          */                         do_action( 'woocommerce_before_shop_loop' );                     ?>                          <?php if ($icon_layout) { ?>
                             <?php _e( 'Display', 'samathemes' ); ?>
                                 <button id="grid" class="btn btn-primary active"></button>                                 <button id="list" class="btn"></button>

                     <?php } ?>
             <?php woocommerce_product_loop_start(); ?>                      <?php woocommerce_product_subcategories(); ?>                      <?php while ( have_posts() ) : the_post(); ?>                          <?php woocommerce_get_template_part( 'content', 'product' ); ?>                      <?php endwhile; // end of the loop. ?>                  <?php woocommerce_product_loop_end(); ?>                  <?php                 /**                  * woocommerce_after_shop_loop hook                  *                  * @hooked woocommerce_pagination - 10                  */                 do_action( 'woocommerce_after_shop_loop' );             ?>              <?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?>                  <?php woocommerce_get_template( 'loop/no-products-found.php' ); ?>              <?php endif; ?>              <?php             /**              * woocommerce_after_main_content hook              *              * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)              */             do_action('woocommerce_after_main_content');         ?>
           <?php         /**          * woocommerce_sidebar hook          *          * @hooked woocommerce_get_sidebar - 10          */         if ( $layout != 'fullwidth' ) {             do_action('woocommerce_sidebar');         }     ?>          <?php get_footer('shop'); ?>


how to fix broken links in archive.php

Here's more info to clarify my question. I used WordPress for the blog page of my site http://prygara.com/blog/. When you go to Post Categories on the left and then Posted In link or if you just go into a single post and then Categorized As link, I am getting Error 404 - Not Found. I don't know PHP language but my guess is that the error is due to a broken link. Though I may be wrong. The following code may be the culprit in archive.php               <?php the_tags(__('Tags:', 'kubrick'), ', ', '
'); ?>           <?php printf(__('Posted in            |           <?php edit_post_link(__('Edit', 'kubrick'), '', ' | '); ?>          <a class="page" href="<?php comments_popup_link(__('No Comments »', 'kubrick'), __('1     Comment »', 'kubrick'), __('% Comments »', 'kubrick'), '', __('Comments Closed', 'kubrick')    ); ?>      Appreciate any help


custom post template ignored after altering permalinks

I've built a site with a custom post type called Testimonials and am using a custom template to display the posts _edit: template name is page- testimonials.php_. All is working as expected with the default permalink structure, however when I set the permalinks to /%postname%/ the custom template is ignored and the posts are showed on a blog archive.... Here's the code I've used to register the post type. Have I missed something required to make it use the proper template with custom permalinks?               add_action( 'init', 'create_post_type' );     function create_post_type() {         register_post_type( 'testimonial',             array(                 'labels' => array(                     'name' => __( 'Testimonials' ),                     'singular_name' => __( 'Testimonial' ),                     'add_new_item' => __('Add New Item'),                     'edit_item' => __('Edit Item'),                     'new_item' => __('New Item'),                     'view_item' => __('View Item'),    'add_new_item' => __('Add New Item'),                     'edit_item' => __('Edit Item'),                     'new_item' => __('New Item'),                     'view_item' => __('View Item')                 ),                 'public' => true,                 'has_archive' => true,                 'rewrite' => array('slug' => 'testimonials',                 'show_in_nav_menus' => true,                 'capability_type' => 'page',                 'hierarchical' => true,                'supports' => array( 'title', 'editor', 'thumbnail' ),                'query_var' => true)             )         );     }


Multiple wp_query loops showing first 5 posts on all pages instead of older posts[Resolved]

I am trying to highlight the newest post in a separate layout and rest of them in a masonry index. There are 5 posts per page and I am getting the newest 5 posts on previous posts pages as well. I had all posts in a single loop under masonry index. I tried making the first element of masonry index a different width via css first-of-type property but it disturbs the masonry layout. Then I decided to use a separate loop for first post and second one with masonry layout for rest of posts, but I ended up getting first 5 posts on every page where older posts should be shown. Please advise how this can be resolved. Thanks in advance!               <?php      //First Query     $args1 = array(     'posts_per_page'   => 1,     'post_type'        => 'albums',     'post_status'      => 'publish',      );      $query1 = new WP_Query($args1);          //First Loop     if ( $query1->have_posts() ) {       while ( $query1->have_posts() ) {         $query1->the_post();?>         <?php get_template_part( 'entry-slide',get_post_type('albums') ); ?>         <?php comments_template();        }      }        wp_reset_postdata();            echo'
';       //Query2          $args2 = array(     'offset'           => 1,     'post_type'        => 'albums',     'post_status'      => 'publish',     'suppress_filters' => true );           $query2 = new WP_Query( $args2 );          //loop2     if ( $query2->have_posts() ) {      while( $query2->have_posts() ) {         $query2->the_post();?>
         <?php get_template_part( 'entry',get_post_type('albums') ); ?>
        <?php comments_template();         }      } //end second loop            echo '
';      get_template_part( 'nav', 'below' );?>

      <?php get_sidebar(); ?>

            <?php get_footer(); ?>      **UPDATE #1:** Wow! this worked(I added $paged variable before the loops):                 $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;      and then in the args i removed the offsets and added this instead:                 'paged' => $paged      But now I am getting a duplicate latest post because of removing the offset in the second loop. Please share your ideas on how the duplicate can be removed. Will this work : add offset in second loop in $args2 if it is the first page? Let me try and I'll share how that worked. **UPDATE #2** I have added this code to add an offset and remove duplicate latest post on the 1st page:               if ( $paged == 1 ){               $offset=1;           } else{               $offset='';           }      This helped but I am getting a post duplicate in the previous posts. I am yet to figure out why that's happening (and would appreciate if you can share your ideas). Rest all good.


How to set separate "lang" attribute for post or page titles

I am creating a multilingual website in English and Hindi on WordPress. Half of the site is in English and rest is Hindi. In a previous question asked by John Doe here at stackexchange s_ha_dum showed how to do that with all the posts' titles. What I want is to give Hindi lang attribute to Hindi content and English lang attribute to English content. Let me know if question is not clear enough, thanks in advance


post__in works but also prints the word Array

First line of the code below carries post ids captured via a form. Then rest of the code helps pull the post-thumbnail of the respective post ids               $sel_ids = $_SESSION['selected_ids'];     if ( ! is_array( $sel_ids ) ) { //the check to prove that $sel_ids is a valid array     return;     }          require_once('../../../../wp-load.php');          $args = array( 'post__in' => $sel_ids, 'post_type' => 'post' );     $posts = get_posts($args);          foreach ($posts as $post) {         echo get_the_post_thumbnail($post->ID, 'coverimage');     }      ![enter image description here](http://i.stack.imgur.com/snVly.jpg) > Thumbnails display fine but before the thumbnails, the code also outputs a > word `Array` which is definitely unwanted. * * * I have tried commenting out the lines one by one to isolate what line exactly is the culprit. So I found that this line `$args = array( 'post__in' => $sel_ids, 'post_type' => 'post' );` generates the unwanted string `Array`. My guess is the var `$sel_ids` needs some work. **FYI** a `var_dump($sel_ids)` prints `array(2) { [0]=> string(2) "67" [1]=> string(2) "16" }`. I also tried the code `explode(',', $sel_ids);` from the answer here but it prints a warning `Warning: explode() expects parameter 2 to be string`. Which I think makes sense because I know that $sel_ids is an array, but then why is it printing the word `Array`, odd. * * * **FYI** Since the code is a part of an html email. Here is a relevant part of the source of the email in gmail. Just in case it helps to infer the issue better.               Array<img src="http://xxxxxxxxx.com/wp-content/uploads/2014/04/360.jpg">       * * * **UPDATE** : Test code `<pre><?php print_r($args);?></pre>` outputs the results below. I suspect the word `Array` is being printed out from `[post__in] => Array`. How do I remove or replace this.               Array     (         [post__in] => Array             (                 [0] => 67                 [1] => 16             )              [post_type] => post     )


Default permalink changes

I need to use in my permalinks same titles for different post types and as far as I know the slug must be unique so the permalinks cannot be: custom-post-type-1/hello-world custom-post-type-2/hello-world custom-post-type-3/hello-world it will be like this: custom-post-type-1/hello-world custom-post-type-2/hello-world-2 custom-post-type-3/hello-world-3 how can I add a default -1 to the first permalink so the links will be like this: custom-post-type-1/hello-world-1 custom-post-type-2/hello-world-2 custom-post-type-3/hello-world-3


Error in database connection

I am using Wamp server, I want to develop website using WordPress. I have configured wp-config.php. Still it is showing me > Error establishing a database connection. How should I solve this error?


Allow variable amount of comments before pagination

There is an option in the admin settings allowing you to define how many comments should be listed before creating a new page for the next ones. I would like to have the same number of comments for all my posts unless it belongs to one specific category (where I would like to set a different number of comments before pagination). How can I do that?


Help with if statement inside while loop

I have the following snippet of code, basically I get the set value of id from the metabox, get the current id based on the loop, try and match, if htey match I want to pull the values from the matched id, currently i can only get the id, but i would like to get the associated custom field values of that post as well. Also I don't know why, even if it matches the value, it will still echo out the else statement twice, i guess cause it's in the while loops, but how do i get ride of that?               <?php                        $list_agent = get_post_meta( $post->ID,'ec_agents',true );                           $args = array( 'post_type' => 'agent_type');                                $the_query = new WP_Query( $args );                         $id = $post->ID;                         while ( $the_query->have_posts() ) : $the_query->the_post();                                  if ($id == $list_agent) {                                 echo "success";                                 the_title();                                      //Both Meta values not showing                                 echo get_post_meta( $post->ID,'_agent_phone',true );                                 echo get_post_meta( $post->ID,'_agent_email',true );                             } else {                                 echo "better luck next time";                             }                         endwhile;                              wp_reset_postdata();                         ?>


Single file upload

I would like to allow user to only upload one file at a time using the flash uploader interface. I found around here a link to a hack allowing to generate an error message when more than one file is selected but that's not what I want. I would like to only take the first file into consideration and just ignore the other files. Would it be possible?


Comments screen in backend, how to disable Quick Edit | Edit | History | Spam | for non admins

I'm trying to adjust the comments screen for non admins to my project. Right now I'd like to disable **Quick Edit | Edit | History | Spam** under any comment left for any post created by the user. Thanks!


Storing Comment Meta as an Array

I need to add multiple checkboxes to a post comment form (a Woocommerce product review form, to be exact) that allows people to choose which health condition the product is best for. Upon choosing X number of checkboxes and leaving a written comment, I need those values stored in the commentmeta table as an array. Then I need to print out each selected checkbox value inside that person's comment as an unordered list. Where I'm stuck is storing more than one checkbox in commentmeta. Here's what I have so far for creating the checkboxes:               add_action( 'comment_form_logged_in_after', 'additional_fields' );     add_action( 'comment_form_after_fields', 'additional_fields' );     function additional_fields () {              echo '
' .         ''. __('Conditions') . '*:
         ';              $conditions = array(             "cancer" => "Cancer",             "crohns" => "Chrons",             "fibromyalgia" => "Fibromyalgia"         );         foreach( $conditions as $condition )             echo '<input type="checkbox" name="condition" id="condition" value="'. $condition .'"/> '. $condition .'';              echo '
';          }      Then here's where I store the data:               add_action( 'comment_post', 'save_comment_meta_data' );     function save_comment_meta_data( $comment_id ) {              if ( ( isset( $_POST['condition'] ) ) && ( $_POST['condition'] != '') )             $filtered_condition = wp_filter_nohtml_kses($_POST['condition']);              add_comment_meta( $comment_id, 'condition', $filtered_condition );          }      This only stores one of the values, though. How do I get it to store the values of each selected checkbox as an array? Elsewhere in the site, I need to sort products by those values. So, if 2 products have had the Cancer checkbox selected, I'll output those 2 products on the page by querying which products have that meta value.


meta_query and strange orderby behaviour

this is my problem query, which picks all future or pending events.   Note that some posts only have _startdate without _enddate (1-day events).               $args = array(      'post_type'=> 'events',      'meta_query' => array(         array(         'key' => '_startdate',         'value' => $today,         'type' => 'DATE',         'compare' => '>='         ),         array(         'key' => '_enddate',         'type' => 'DATE',         'value' => $today,         'compare' => '>='         ),         'relation' => 'OR',         ),     'meta_key'=> '_city',      'orderby' => 'meta_value',      'order' => 'ASC',     ) ;      Everything works great until I change **_city** to **_startdate** or **_enddate**. Can you please help me with this query (to sort by _startdate ) ? Thanks


Get term name and term parent into custom post type permalink

**That i would like (for taxonomy page):** Current URL : myurl.com/commerce/artisans/boucherie/ What i try to do URL :myurl.com/commerce/artisans/alimentation/boucherie/ Alimentation is the parent of Boucherie. **That i would like (for single page) :** Current URL : myurl.com/commerce/artisans/alimentation/singlepost What i try to do URL : myurl.com/commerce/artisans/alimentation/boucherie/singlepost Alimentation is the parent of Boucherie. Thank you for your help. This is my code:                    //This code tells WordPress when to run our setup function     add_action('after_setup_theme', 'map');          function map(){          //setup slider post type     //Set the names of the labels for the Post type interface      $post_labels = array(             'name' => 'Carte',             'singular_name' => 'Carte',             'add_new' => 'Ajouter un point carte',             'add_new_item' => 'Ajouter un point carte',             'edit_item' => 'Editer un point carte',             'new_item' => 'Nouveau point carte',             'view_item' => 'Afficher un point carte',             'search_items' => 'Rechercher un point carte',             'not_found' =>  'Aucun point carte',             'not_found_in_trash' => 'Aucun point carte trouves dans la corbeille',             'parent_item_colon' => ''         );               //Setup the rules for this post type. You can read more about what each of these do in     //the WP codex under register_post_type().         $post_args = array(             'labels' => $post_labels, //Add the labels that we set above             'public' => true,             'publicly_queryable' => true,//hide this post type from being accessed directly             'show_ui' => true,             'show_in_menu' => true,             'query_var' => true,             'rewrite' => array('slug'=>'commerce/artisans/%map_categories%','with_front'=>false),             'capability_type' => 'post',             'hierarchical' => false,             'supports' => array('title','editor' ), //specify what items the post type supports.             'has_archive' => false,             'menu_icon' => get_stylesheet_directory_uri() . '/map.png',         );         //register the post type using the arguments we have setup above.         register_post_type('map',$post_args);         register_taxonomy( 'map_categories', 'map', array( 'hierarchical' => true, 'label' => 'Categories', 'query_var' => true, 'rewrite' => array('slug'=>'commerce/artisans','with_front'=>false) ) );          }          function map_categories_link( $post_link, $id = 0 ){         $post = get_post($id);           if ( is_object( $post ) ){             $terms = wp_get_object_terms( $post->ID, 'map_categories' );             if( $terms ){                 return str_replace( '%map_categories%' , $terms[0]->slug , $post_link );             }         }         return $post_link;       }     add_filter( 'post_type_link', 'map_categories_link', 1, 3 );


Problems with functions.php! Error!

Suddenly I got the message: > **Parse error: syntax error, unexpected T_CLASS in > /home/spandabe/public_html/wp-content/themes/modularity-lite/functions.php > on line 72** when opening my site www.spandabel.dk I only changed things in header.php, not in functions.php! And now I cannot do anything before I get this right! This is how my functions-php looks like:                   <?php     /**      * @package WordPress      * @subpackage Modularity      */          $themecolors = array(         'bg' => 'eeeeee',         'border' => 'eeeeee',         'text' => '111111',         'link' => '000000',         'url' => '000000'     );     $content_width = 950; // pixels          // Grab the theme options page     require_once ( get_template_directory() . '/theme-options.php' );          // Add default posts and comments RSS feed links to head     add_theme_support( 'automatic-feed-links' );          // Add post thumbnail theme support     add_theme_support( 'post-thumbnails' );     set_post_thumbnail_size( 150, 150, true );          // Add a new image size     add_image_size( 'modularity-slideshow', 950, 425, true );          // Register nav menu locations     register_nav_menus( array(         'primary' => __( 'Primary Navigation', 'text_domain' ),     ) );          // Get wp_page_menu() lookin' more like wp_nav_menu()     function modularity_page_menu_args( $args ) {         $args['show_home'] = true;         $args['menu_class'] = 'main-nav';         return $args;     }     add_filter( 'wp_page_menu_args', 'modularity_page_menu_args' );          // Give Modularity a custom background     add_custom_background();          // Allow custom colors to clear the background image     function modularity_custom_background_color() {         if ( get_background_image() == '' && get_background_color() != '' ) { ?>                                  <?php }     }     add_action( 'wp_head', 'modularity_custom_background_color' );          // To use a sidebar, or not to use a sidebar, that is the question. This generates the appropriate class     function modularity_sidebar_class() {         $options = get_option( 'modularity_theme_options' );              if ( $options['sidebar'] == 1 ) {             echo "15 colborder home";         }         else {             echo "24 last";         }        }          // The header business begins here:          // No CSS, just IMG call     define('HEADER_TEXTCOLOR', '');     define('HEADER_IMAGE', '');     define('HEADER_IMAGE_WIDTH', 950);     define('HEADER_IMAGE_HEIGHT', 250);     define( 'NO_HEADER_TEXT', true );          function modularity_admin_header_style() {     ?>          <?php     }          add_custom_image_header( '', 'modularity_admin_header_style' );     // and thus ends the header business          // Comments in the Modularity style     function modularity_comment( $comment, $args, $depth ) {         $GLOBALS['comment'] = $comment;         switch ( $comment->comment_type ) :             case '' :         ?>         <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">             <div id="comment-<?php comment_ID(); ?>" class="comment-wrapper">
                     <?php echo get_avatar( $comment, 75 ); ?>
                         <?php comment_author_link(); ?>

                     <?php if ( $comment->comment_approved == '0' ) : ?>                         <?php _e( 'Your comment is awaiting moderation.', 'modularity' ); ?>
                     <?php endif; ?>                     <?php comment_text(); ?>
                         <?php                             /* translators: 1: date, 2: time */                             printf( __( '%1$s at %2$s', 'modularity' ), get_comment_date(),  get_comment_time() ); ?><?php edit_comment_link( __( '(Edit)', 'modularity' ), ' ' );                         ?>

                         <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>

              <?php                 break;             case 'pingback'  :             case 'trackback' :         ?>

<?php _e( 'Pingback:', 'modularity' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __('(Edit)', 'modularity'), ' ' ); ?>
         <?php                 break;         endswitch;     }          // The Sidebar business     $options = get_option( 'modularity_theme_options' );     if ( $options['sidebar'] == 0 ) {         $optional_description = __( 'The optional Modularity Lite sidebar is currently deactivated but can be activated from Appearance > Theme Options', 'modularity' );        } else {         $optional_description = '';      }          if ( function_exists('register_sidebar') ) {         register_sidebar(array(             'name' => 'Sidebar',             'id' => 'sidebar',             'description' => $optional_description,             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ));              register_sidebar(array(             'name' => 'Footer 1',             'id' => 'footer-1',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ));              register_sidebar(array(             'name' => 'Footer 2',             'id' => 'footer-2',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ));              register_sidebar(array(             'name' => 'Footer 3',             'id' => 'footer-3',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
'         ));              register_sidebar(array(             'name' => 'Footer 4',             'id' => 'footer-4',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
'         ));      }                    // Load Base Javascripts     if (!is_admin()) add_action( 'init', 'load_base_js' );     function load_base_js( ) {              wp_enqueue_script('jquery');         //wp_enqueue_script('jquerynav', get_bloginfo('template_directory').'/js/nav.js', array('jquery'));         wp_enqueue_script('cycle', get_bloginfo('template_directory').'/js/jquery.cycle.js', array('jquery'));         //wp_enqueue_script('search', get_bloginfo('template_directory').'/js/search.js', array( 'jquery' ) );          }          // Load Dom Ready Javascripts     function load_dom_ready_js() { ?>                        <?php }     add_action('wp_head', 'load_dom_ready_js');      Does anybody have an idea what has happened?? Thanks in advance! / Anne btw - the theme I'm using is Modularity Lite


How can I save a multiple select array with the settings API for a plug-in options page?

I'm thinking this may be more of a problem with my PHP rather than my use of the settings API, but I can't seem to get Wordpress to save an array of data for a multi-select box. The multi-select box corresponds to a custom meta field, and the select options are the custom post types that will display that meta field. Here is the display code:               case 'select2':               echo "<select id='$id' style='width:15em;height:10em;' class='select$field_class' name='" . $buddha_option_name . "[$id]' multiple>";               foreach($choices as $item) {                        $item = explode("|",$item);                   $item[0] = esc_html($item[0], 'buddha_textdomain');                        $selected = ($options[$id]==$item[1]) ? 'selected="selected"' : '';                   echo "<option value='$item[1]' $selected>$item[0]</option>";               }              echo "</select>";               echo ($desc != '') ? "
$desc" : "";          break;        `$choices` is defined here as 'choices':               $options[] = array(           "section" => "custom_meta",           "id"      => BUDDHA_SHORTNAME . "_meta_email",           "title"   => __( 'Email Meta Box', 'buddha_textdomain' ),           "desc"    => __( 'Select post types to have custom email meta box.', 'buddha_textdomain' ),           "type"    => "select2",           "std"    => print_r($buddha_option_name[$id]),           "choices" => array( __('Posts','buddha_textdomain') . "|post", __('Pages','buddha_textdomain') . "|page", __('Faculty/Staff','buddha_textdomain') . "|staff", __('FAQ','buddha_textdomain') . "|faq", __('Documents','buddha_textdomain') . "|docs", __('Courses','buddha_textdomain') . "|courses" )       );      And the validation code:               case 'select2':                      // process $select_values                          $select_values = array();                          foreach ($option['choices'] as $k => $v) {                              // explode the connective                              $pieces = explode("|", $v);                                   $select_values[] = $pieces[1];                          }                      // check to see if selected value is in our approved array of values!                      $valid_input[$option['id']] = (in_array( $input[$option['id']], $select_values) ? $input[$option['id']] : '' );                  break;       Currently, if I select more than one value from the multi-select field, WP will only save one value (usually the first alphabetical value). I need it to save more than one value in the array. I thought adding `[]` to the end of `[$id]` might help, but no.


I need to find which is the file that checks the DB for correct login (username, password)

I let users to register in my page, however I want to improve the password security that is saved in the DB. For this I need to find out which is the file that makes the query   `where pass=pass and login=login` Which one is it? Thank you.


Clickable image link sends people to wrong URL

On my website www.wilsonstransportation.com, on the header of our custome theme page, we have a "Get a Quote" image on the right hand side. When you click it, it is taking people to http://wilsonstransportation.com/wp- content/themes/wilsons/contact-us/get-a-quote . It should be sending people to www.wilsonstransportation.com/contact-us/get-a-quote . We are losing quite a bit of business because of this. In the header.php, this is what shows up:
     <a href="<?php bloginfo('template_url'); ?>/contact-us/get-a-quote" class="">      how do I change the URL to go to the normal page again? This all of a sudden changed when we updated a few wordpress things. HELP


How to prevent new terms being added to a custom taxonomy?

I've created some custom taxonomies using register_taxonomy, but I want to prevent new terms from being added. I noticed that there is a 'capabilities' argument available in register_taxonomy, is that what I should be using and if so, how would I use it? Here's some of my code, I'm using a plugin I created to add the taxonomies (hence the public static function part). Is there an easy way to prevent new terms being created for my taxonomy? Thanks Osu               public static function register_directory_styles_taxonomy()         {             $labels = array(                 'name'                      => 'Music styles',                 'singular_name'             => 'Music style',                 'search_items'              => 'Search music styles',                 'all_items'                 => 'All music styles',                 'parent_item'               => 'Parent music style',                 'edit_item'                 => 'Edit music style',                 'update_item'               => 'Update music style',                 'add_new_item'              => 'Add new music style',                 'new_item_name'             => 'New music style',                 'choose_from_most_used'     => 'Choose from most used music styles'             );                  $args = array(                 'hierarchical'  => true,                 'labels'        => $labels,                 'rewrite'       => false                 // 'show_ui'        => false             );                  register_taxonomy( 'ibmstyles', 'ibmdirectory', $args );         }


WordPress Comment spam issue

I'm Trying to completely disable WordPress Comments. I have manually disabled comments via the WordPress back-end setting and I also created a new blank file called "no-comments-please.php" and then I added the below to my functions.php. Yet the comments show up in their numbers.               add_filter( 'comments_template', 'remove_comments_template_on_pages', 11 );     function remove_comments_template_on_pages( $file ) {     if ( is_page() )     $file = STYLESHEETPATH . '/no-comments-please.php';     return $file;     }