Contact form with Jquery and PHP don't work

<?php/*    Template Name: Contact  */?>     <?php get_header(); ?>         <?php               wp_enqueue_script( 'jquery.validate.min', get_bloginfo('template_directory') . '/js/jquery.validate.min.js', array('jquery') , 3.1, true );           wp_enqueue_script( 'jquery.form', get_bloginfo('template_directory') . '/js/jquery.form.js');           wp_enqueue_script( 'contact', get_bloginfo('template_directory') . '/js/contact.js');           wp_enqueue_style('contactstyle', get_template_directory_uri() . '/css/contactstyle.css');              ?>
                     <form id="contactform" action="processForm.php" method="post">

                             Name:	                             <input type="text" id="name" name="name" />

                             Email:	                             <input type="text" id="email" name="email" />

                             Message:	                             <textarea id="message" name="message" rows="5" cols="20"></textarea>

                             	                             <input type="submit" value="Send!" id="send" />

                 </form>

      also i have the `processForm.php`                  <?php         // Clean up the input values         foreach($_POST as $key => $value) {             if(ini_get('magic_quotes_gpc'))                 $_POST[$key] = stripslashes($_POST[$key]);                  $_POST[$key] = htmlspecialchars(strip_tags($_POST[$key]));         }              // Assign the input values to variables for easy reference         $name = $_POST["name"];         $email = $_POST["email"];         $message = $_POST["message"];              // Test input values for errors         $errors = array();         if(strlen($name) < 2) {             if(!$name) {                 $errors[] = "You must enter a name.";             } else {                 $errors[] = "Name must be at least 2 characters.";             }         }         if(!$email) {             $errors[] = "You must enter an email.";         } else if(!validEmail($email)) {             $errors[] = "You must enter a valid email.";         }         if(strlen($message) < 10) {             if(!$message) {                 $errors[] = "You must enter a message.";             } else {                 $errors[] = "Message must be at least 10 characters.";             }         }              if($errors) {             // Output errors and die with a failure message             $errortext = "";             foreach($errors as $error) {                 $errortext .= "
".$error."
";             }             die("The following errors occured:
". $errortext ."
");         }              // Send the email         $to = "MY-EMAIL";         $subject = "Contact Form: $name";         $message = "$message";         $headers = "From: $email";              mail($to, $subject, $message, $headers);              // Die with a success message         die("Success! Your message has been sent.");              // A function that checks to see if         // an email is valid         function validEmail($email)         {            $isValid = true;            $atIndex = strrpos($email, "@");            if (is_bool($atIndex) && !$atIndex)            {               $isValid = false;            }            else            {               $domain = substr($email, $atIndex+1);               $local = substr($email, 0, $atIndex);               $localLen = strlen($local);               $domainLen = strlen($domain);               if ($localLen < 1 || $localLen > 64)               {                  // local part length exceeded                  $isValid = false;               }               else if ($domainLen < 1 || $domainLen > 255)               {                  // domain part length exceeded                  $isValid = false;               }               else if ($local[0] == '.' || $local[$localLen-1] == '.')               {                  // local part starts or ends with '.'                  $isValid = false;               }               else if (preg_match('/\\.\\./', $local))               {                  // local part has two consecutive dots                  $isValid = false;               }               else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain))               {                  // character not valid in domain part                  $isValid = false;               }               else if (preg_match('/\\.\\./', $domain))               {                  // domain part has two consecutive dots                  $isValid = false;               }               else if(!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/',                          str_replace("\\\\","",$local)))               {                  // character not valid in local part unless                   // local part is quoted                  if (!preg_match('/^"(\\\\"|[^"])+"$/',                      str_replace("\\\\","",$local)))                  {                     $isValid = false;                  }               }               if ($isValid && !(checkdnsrr($domain,"MX") || checkdnsrr($domain,"A")))               {                  // domain not found in DNS                  $isValid = false;               }            }            return $isValid;         }              ?>      and the `contact.js`                 $(function() {             // Validate the contact form           $('#contactform').validate({             // Specify what the errors should look like             // when they are dynamically added to the form             errorElement: "label",             wrapper: "td",             errorPlacement: function(error, element) {                 error.insertBefore( element.parent().parent() );                 error.wrap("

");                 $("	").insertBefore(error);             },                  // Add requirements to each of the fields             rules: {                 name: {                     required: true,                     minlength: 2                 },                 email: {                     required: true,                     email: true                 },                 message: {                     required: true,                     minlength: 10                 }             },                  // Specify what error messages to display             // when the user does something horrid             messages: {                 name: {                     required: "Please enter your name.",                     minlength: jQuery.format("At least {0} characters required.")                 },                 email: {                     required: "Please enter your email.",                     email: "Please enter a valid email."                 },                 message: {                     required: "Please enter a message.",                     minlength: jQuery.format("At least {0} characters required.")                 }             },                  // Use Ajax to send everything to processForm.php             submitHandler: function(form) {                 $("#send").attr("value", "Sending...");                 $(form).ajaxSubmit({                     success: function(responseText, statusText, xhr, $form) {                         $(form).slideUp("fast");                         $("#response").html(responseText).hide().slideDown("fast");                     }                 });                 return false;             }           });         });      But the form only loading, and never sent the email. Also, o create a folder call php and put there the processForm.php but the result is the same. Any help for this? Thanks in advanced. **Updates:** **1st** I used the $.noConflict(); method with this uses:               $.noConflict();     $(function()      {         // Validate the contact form        $('#contactform').validate({      but i see an 404 error page. processForm.php **2nd:** `jQuery(document).ready(function($){` but not load the send email


Failed to invoke other hook from the init hook

Related to this question (Use wp init hook to call other hooks?) but not the same. Sometimes, I found that the hook will failed to run when I place inside the init hook, e.g. Not Work:               add_action('init','my_init');     function my_init() {         add_filter('locale', ...     }      Work:               add_action('init','my_init');     add_filter('locale', ...      Of course some hooks/filters will just work okay inside the init hook, but **definitely not all of them.** So it seems to me that **it is a bad practice to chain actions/filters together?**


Archive-Custom-Post-Type order by Event Date, ASC, and hide events that have completed

I am building a site for a personal project and I have a series of Events created via a Custom Post Type. I then need these events to be displayed by a custom meta value (Event Start Date) and in ASC order. I have managed to figure that out and the code I used is below:               /*CUSTOM ARCHIVE FOR EVENTS*/         function events_pagesize( $query ) {         // exit out if it's the admin or it isn't the main query         if ( is_admin() || ! $query->is_main_query() )         return;         // so its not admin, and its the main query, is it the tr-events post archive?         if ( is_post_type_archive( 'tr-events' ) ) {         // it is!! Set the posts_per_page to 6         $query->set( 'posts_per_page', 4 );         $query->set( 'order' , 'asc' );         $query->set( 'meta_key', 'wpcf-tr-order-date');         $query->set( 'orderby', 'meta_value');         return;         }         }         add_action( 'pre_get_posts', 'events_pagesize', 1 );      My question is how to hide posts past a specific date AND how would I also create an Archive view to display Events that have completed? I've seen tons of posts about this and most options break pagination. This option as a function in the functions.php gets me 70% there.


Custom Post Type, Taxonomy, and Geo-Coded Radius Search

I've been struggling with this for the last few days and just keep seem to get it right. Here's the situation: I have a provider directory (hospitals) in a custom post type. The 2,000+ providers were imported via CSV with location data, for which I then used the geomashup plugin to add coordinates as meta info. So all the posts have the necessary components to getting this done. Now what I need to do is build a search for on the frontpage that lets the user enter a zip code or city (text box), select a radius (in miles, from a dropdown list), and (optionality) a specialty (which is stored in a custom taxonomy). I've messed with a loop based on the query info in the geomashup docs, but to no avail. I've been plugging in specific lat/long coordinates which should return results, yet nothing shows up. Here's the query code I've been using:               <?php      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $rq = new WP_Query( array(         'posts_per_page' => 9999,         'paged' => $paged,         'geo_mashup_query' => array(                 'near_lat' => 26.055,                 'near_lng' => -80.153,                 'radius_mi' => 50,         ),     ) );          while ($rq->have_posts()) : $rq->the_post(); ?>      Ultimately, I need help figuring out how to configure the search form on the homepage, pass the variables to the search results page, and get results to show up. There are various "find nearby" plugins and answers here related to radius searches, but there are simply too many of these items and they needed to belong in a CPT w/ custom taxonomy and not be plugin based.


Links on FAQ page aren't working

I apologize if this is a naive question. I'm a Ruby on Rails developer and I'm not yet very comfortable with WordPress. I built a WP site featuring an FAQ page using Q and A Focus Plus FAQ plugin. It works just fine except none of the links on the FAQ page, despite having valid `href` attributes, actually work. You can see what I'm talking about if you visit my site. I don't really know where to begin trying to debug such a funky problem. It of course seems like it should just work out of the box. Any advice?


Adding a "Sign In/My Account" link to an external app

I'm using (or I'm going to use) WordPress for my product's marketing site. I use Rails for the product's application. Right now on my marketing site, which is currently in Rails, I have a link that reads either "My Account" or "Sign In" depending on whether you're signed in or not. I'd like to duplicate this feature on my WP site but I of course won't have the privilege of doing it in as direct a way as I am on my Rails marketing site now. I'm thinking I'll want to keep track via a cookie whether the user is logged in, which I assume is possible because the application and marketing site will both be on the same TLD. What's not clear to me is what would be a good way to read that cookie in WP. Any suggestions?


How to enable Zend Optimiser+ with Batcache

I am using Batcache with APC Object Cache Backend so far. A lot of posts on internet claiming that using Zend Optimizer instead of APC would reduce CPU and memory usage. I could enable Zend Optimizer on my server. But I haven't found a plugin or workaround to make Batcache works with Zend Optimizer. Is that a "Zend Optimizer Object Cache Backend" for Batcache? How to make Batcache use Zend Optimizer? Thank you.


Wordpress Custom field Colors

I came across this code and would like to use it in my project. It works fine, but the problem is, I need to change those colors in the array to instead pick transparent images from url since I am using it for background. My first option was to find if someone could change the solid color to a gradient, but due to the complexity in my project, picking background images will be simpler.               /* Define the custom box */     add_action( 'add_meta_boxes', 'wpse_61041_add_custom_box' );          /* Do something with the data entered */     add_action( 'save_post', 'wpse_61041_save_postdata' );          /* Adds a box to the main column on the Post and Page edit screens */     function wpse_61041_add_custom_box() {         add_meta_box(              'wpse_61041_sectionid',             'Title Color',             'wpse_61041_inner_custom_box',             'post',             'side',             'high'         );     }          /* Prints the box content */     function wpse_61041_inner_custom_box($post)     {         // Use nonce for verification         wp_nonce_field( 'wpse_61041_wpse_61041_field_nonce', 'wpse_61041_noncename' );              // Get saved value, if none exists, "default" is selected         $saved = get_post_meta( $post->ID, 'title_color', true);         if( !$saved )             $saved = 'default';              $fields = array(             'red'       => __('Red', 'wpse'),             'green'     => __('Green', 'wpse'),             'blue'      => __('Blue', 'wpse'),             'default'   => __('Default', 'wpse'),         );              foreach($fields as $key => $label)         {             printf(                 '<input type="radio" name="title_color" value="%1$s" id="title_color[%1$s]" %3$s />'.                 ' %2$s ' .                 '
',                 esc_attr($key),                 esc_html($label),                 checked($saved, $key, false)             );         }     }          /* When the post is saved, saves our custom data */     function wpse_61041_save_postdata( $post_id )      {           // verify if this is an auto save routine.            // If it is our form has not been submitted, so we dont want to do anything           if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )                return;                // verify this came from the our screen and with proper authorization,           // because save_post can be triggered at other times           if ( !wp_verify_nonce( $_POST['wpse_61041_noncename'], 'wpse_61041_wpse_61041_field_nonce' ) )               return;                if ( isset($_POST['title_color']) && $_POST['title_color'] != "" ){                 update_post_meta( $post_id, 'title_color', $_POST['title_color'] );           }      }      And the code link: Add a checkbox to post screen that adds a class to the title


Disable wordpress widget automatically on error

I have a small widget which gets some information from other websites. Now, at times it is possible that these other websites are not available. Is it possible to disable or hide a widget automatically (through the `WP_Widget` class, i.e. in my code that extends it) whenever I detect an error? I don't wish to disable it permanently, I just don't want to have failures that break my page and at the same time I don't want to display things like 'Error retrieving data' or whatever... I just want to hide the widget all along.


How to add categories to products in woocommerce programatically?

I have studies the database intensively and know which all tables are updated when a category is added to a product. Is there any inbuilt woocommerce function to add categories? It updates 2 or 3 tables but want to leave it to woocommerce. Thanks for your help.


Adding different classes to anchor in navigation menu

Is this possible? I want to add different classes to the anchors, so not the same on all anchors. How can I do this? PS: I am using this:               function add_nav_class($output) {         $output= preg_replace('/<a/', '<a class="your-class"', $output, 1);         return $output;     }     add_filter('wp_nav_menu', 'add_nav_class');      But I want to add different classes to the links... So like this:

      and so on...


select post preview image from nextgen gallery

My website has a theme that uses the preview images in the post overview pages. However these images are neither automatically selected nor did I select an image in the past. However, even if I try to select an image. For example within a page that only shows a gallery such as this one I can not select any image for the nextgen gallery. The only images that I see are the ones directly within `/files`. Which were uploaded with the media library (which I dislike because it puts all files in a flat directory structure). My gallery files are in the sub folder (and its subfolders) `/files/gallery`. So how can I use gallery images for a post preview?


If modified on same day, show only time

I have a date on each post and comment which shows the date of placement. If I edit it, it shows me the date of the post and the modified date. That's fine, but now, I want to show only the post date AND the TIME of the modified date only if the post is edited on the same day as it's posted. So for example:               If a post is has been submitted on 8 march 2013 15:00, show me: 08-03-2013 15:00     If a post is edited on 8 march 2013 16:30, show me: 08-03-2013 15:00 - 16:30     If a post is edited on 9 march 2013 17:00, show me: 08-03-2013 15:00 - 09-03-2013 17:00      How can I do this? I am using something like this, except for the AM and PM.               <?php the_modified_date('F j, Y'); ?> at <?php the_modified_date('g:i a'); ?>      How can I only show the time if it's modified on the same date?


Just migrated site, and now it cannot find the WP-Contents folder

I use Backup Buddy a lot to migrate a dev site to production, but for some reason I'm having a problem on this one. The site seemed to install fine at the new location, but when I try and update a plugin via SSH in WP-Admin, it's telling me it is "Unable to locate WordPress Content directory (wp-content). Also, if I copy a new plugin into the plugins folder, WP-Admin doesn't pick it up. I've click on Permalinks to make sure that is working okay. The site acts like it's working fine, but something is screwed up, and I'm now sure what to do. My wp-config file has this for the path:               /** Absolute path to the WordPress directory. */     if ( !defined('ABSPATH') )     define('ABSPATH', dirname(__FILE__) . '/');          /** Sets up WordPress vars and included files. */     require_once(ABSPATH . 'wp-settings.php');      Anyone have any ideas? Thanks! Note: If this matters, the dev server was Ubuntu 12.04 LTS and the production server is Debian 7.3. Both using a LAMP stack.


Getting the author name on author archive page

My template not work for author name on author archive. I tried change to get_the_author but nothing changed. Hope someone help me out. Thank in advance. ![enter image description here](http://i.stack.imgur.com/ozxRo.png)


How to display a list of categories

I'm trying to set up a list of categories with clickable links to that category. I've looked at:   * Display list of Sub-Categories and the posts they contain, within one main Category and am not quite sure where to put the code or how to access it on the page. I understand the PHP well enough - it's pretty straightforward, I'm just relatively new to WP and need some help implementing.


Unautop / Sanitize content added to a post through a plugin

I am using the SimpleReach plugin that adds some content to every post using the content hook. The content that is being added is               <!-- SimpleReach Slide Plugin Version: {{srslide_plugin_version}} -->     <script type='text/javascript' id='simplereach-slide-tag'>         __reach_config = {           pid: '{{srslide_pid}}',           title: '{{title}}',           tags: {{{tags}}},           authors: {{{authors}}},           channels: {{{channels}}},{{slide_logo_elem}}           slide_active: {{srslide_disable_on_post}},{{slide_icon_elem}}           date: '{{published_date}}',           url: '{{canonical_url}}',           header: '{{srslide_header_text}}'         };         var content = document.getElementById('simplereach-slide-tag').parentNode, loc;         if (content.className){ loc = '.' + content.className; }         if (content.id){ loc = '#' + content.id; }         __reach_config.loc = loc || content;         (function(){         var s = document.createElement('script');           s.async = true;           s.type = 'text/javascript';           s.src = document.location.protocol + '//d8rk54i4mohrb.cloudfront.net/js/slide.js';           __reach_config.css = '{{srslide_css_url}}';           var tg = document.getElementsByTagName('head')[0];           if (!tg) {tg = document.getElementsByTagName('body')[0];}           if (tg) {tg.appendChild(s);}         })();     </script>      However Wordpress is sanitizing the content by adding extra breaks and paragraphs before and after. I want to disable autop only for this content so that breaks/paragraphs aren't added. Is there a way to do it?


Wordpress, alternative single post template

For a project of mine I need to define an alternative template for single posts. To be more specific I need each post to be displayed as usual when the website is browsed but I need to create different single pages reachable from different URL to create a sort of a mini-website for each post. (I'm actually using the WooCommerce plugin and what I need to do is to create a mini-website for each product. This needs to be something "outside" from the main website, with a complete different graphic template and is going to be reachable through a QR-code). Hope it makes a bit of sense. Thanks for your advices and/or suggestions. Angelo


Get publish post link?

Is there a way I can call a link so when clicked it publishes the post via the ID I provide? I have `get_delete_post_link( $postID )` set fine, and would like to do the same to make a draft go to published, or if you can't publish post, make it pending. I also have this code running in my functions.php file so may be also a way to call this if a link is clicked.


get_delete_post_link redirect

I am using this to allow users to delete their own posts on the front end of my site:               <a onclick="return confirm('Move this post to the trash? You can restore it later.');" href="<?php echo get_delete_post_link($postid); ?>">Trash Post      The problem is, this refreshed the current page and adds some query args to the URL (trashed=1 and ids=123). What I want to happen is that the user is redirected to a certain page with specific query args, like so:               mysite.com/yourarticles/?user=123&post=321&action=trash      How can I change where the get_delete_post_link function redirects to?


Custom URL rewrite rule for migrating to WordPress

I am trying to move my image gallery site from one CMS to Wordpress. On current CMS I have page with medium size image on it with URL: www.my-example-site.com/folder-one/subfolder-one/example-image-name.jpg.html and another page with full resolution of same image on it with URL like this: www.my-example-site.com/full-image/folder-one/subfolder-one/example-image- name.jpg-some-custom-keywords.html I managed to make same address on test WP for medium size image, I created same categories with, and used same URL slug for categories. After that, under settings --> permalinks I made custom URL structure like: www.my-example-site.com/%category%/%postname%.jpg.html and that made me the same urls for page with medium size image on it. But, problem is with page with full size image on it. Is there any way (some rewrite rule or something) to get another page to. It could be 301 redirect to something like this: www.my-example-site.com/folder-one/subfolder-one/example-image- name.jpg.html?-some-custom-keywords.html or anything similar, just to be able to use data as like on stardard page. than I can use custom url check (on very top of single.php) to see if page contains "?-some-custom-keywords.html" to include file for generating that new page, if there is no that variable to include file for generating standard post page. Please note that there are multiple different combination for "-custom- keywords.html" suffix (about 15) If you have any question or suggestion please ask. Regards.


Custom title for custom post types

I need to change the title for a custom post type ("movie") in my site. I added the following function to my functions.php file but I see no changes in the title:               function theme_wp_title( $title, $sep ) {         global $wp_query, $page, $paged;              if ( is_feed() )             return $title;              // Add the blog name         $title .= get_bloginfo( 'name' );              // Add the blog description for the home/front page.         $site_description = get_bloginfo( 'description', 'display' );         if ( $site_description && ( is_home() || is_front_page() ) )             $title .= " $sep $site_description";              if ($wp_query->query_vars['post_type'] == 'movie') {             $title .= "movie ";         }              // Add a page number if necessary:         if ( $paged >= 2 || $page >= 2 )             $title .= " $sep " . sprintf( __( 'Page %s', 'theme' ), max( $paged, $page ) );              return $title;     }     add_filter( 'wp_title', 'theme_wp_title', 10, 2 );      Any ideas? Thanks


What is the correct way to integrate wordpress with another php application?

I want to integrate wordpress blog with another php application so both will have same theme and when i do changes in wordpress menu or wordpress sidebar, the changes will apply automatically to the other php application pages.


Themes and Plugins page "not found"

When trying to access my Themes or Plugins page on the three Wordpress sites I run they are all listed as "Not Found". I am not sure when this started, but I recently set up my third site and was looking to change the base 2014 theme when I noticed this issue. I checked my other two sites and was given the same error. I checked other pages in the Dashboard and was able to navigate normally, I have no idea what is going on. Running version 3.8.1


wp_set_object_terms bugging

I'm working on a plugin where I set custom terms for posts on save. I use the save_post hook. It all works fine except when I for example also change the title of the post, the custom terms setting doesn't work. What's up with that?               function on_post_save($post_id) {         if (!isset($_POST['ccadmin-' . $this->box_id])) {             return;         }              if (!wp_verify_nonce($_POST['ccadmin-' . $this->box_id], 'ccadmin-action-' . $this->box_id)) {             return;         }              if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {             return;         }              if (isset($_POST['post_type']) && 'page' == $_POST['post_type']) {                  if (!current_user_can('edit_page', $post_id)) {                 return;             }              } else {                  if (!current_user_can('edit_post', $post_id)) {                 return;             }         }         ?>             <pre>         <?php             //var_dump($_POST);         ?>             </pre>         <?php         //die();         $child_taxonomy = $_POST['child_' . $this->taxonomy];         remove_action('save_post', array(&$this, 'on_post_save'));         wp_set_object_terms($post_id, (int)$child_taxonomy, $this->taxonomy, false);          }      Thanks in advance!


Menu not always using correct link

I moved a Wordpress install from /wordpress/ folder to root by just copying the index and .htaccess file to root and then updating the permalinks etc. All works fine but I have a problem with the menu in the top nav. The menu works fine while you're on the main page and scrolls down to the area it should be. But when you go to one of the posts under services like http://angrychickenmedia.com.au/filming/ and then press on for instance "team" in the menu it will point to http://angrychickenmedia.com.au/wordpress/#team thus suddenly adding the /wordpress/ to it and ending up at a blank page. Anyone have an idea how I can solve this?


CSS changes not taking effect

I make changes to my style.css file but they do not take effect on the website. Style.css is located here: /wp-content/themes/academy/style.css I have made changes to it previously and the changes did take effect, but now I'm making new changes and they're not. I have tried adding the CSS with the changes via FTP, and I have also tried using the "Editor" from the Wordpress menu. If I view the source of the CSS file in the browser the changes do not appear. I can pull the file off my server with FTP and look at the code and see that the CSS is there. I can also see the CSS in the Wordpress editor. I have cleared the cache and cookies, refreshed the browser, used different browsers (Firefox and Chrome). The CSS that I am entering is valid. Just a simple:               #bg-image {      position: fixed;       top: 100;       left: 0;       min-width: 100%;      min-height: 100%;      }      I've waited about an hour thinking there might be a delay. It's still not working. My main questions are: 1.) Do I need to somehow "trigger" the new file to actually take effect? 2.) Is Wordpress doing something internally to cache the old file and if so, can I turn this feature on/off when I need to?


Adding an Options Page to a Plugin

The first set of code adds a menu item to the sidebar. I'm attempting to add an options page (the type which shows up as a sub-page) under this. I tried to do so with the second code... but this isn't working. How do I add an options page under a plugin's menu?               // Add menu page in sidebar     function admin_menu_wlseo() {       add_menu_page('SEO', 'SEO', 'manage_options', 'wlseo', 'options_page_wlseo');     }          // Add options page in sidebar     function admin_stuff_wlseo() {       add_options_page('Stuff', 'Stuff', 'manage_options', 'wlseo-stuff', 'options_page_wlseo');     }


Sort All Posts by Category Name in the Admin Panel?

I'm working on a pretty complicated site where everything is managed by category type including automatic spinner image submission, etc.. Unfortunately, its doggone difficult to manage things when the admin panel "All Posts" sorts them by date (DESC) I'm thinking it sure would be handy to have the show "All Posts" in category name order. I Found this small routine, that works for sorting by Post name.                /*      Plugin Name: Set Post Order In Admin      Version: 0.1      Plugin URI: http://wordpress.org/support/topic/336715/      Description: In Posts->Edit, display posts in title order.      Author: MichaelH      Author URI: http://codex.wordpress.org/User:MichaelH/MyPlugins      check out: http://codex.wordpress.org/Class_Reference/WP_Query      in the section order and orderby parameters  */      function set_post_order_in_admin( $wp_query ) {         if ( is_admin() ) {                $wp_query->set( 'orderby', 'name' );              $wp_query->set( 'order', 'ASC' );  /* ASC or DESC */         }      }      add_filter('pre_get_posts', 'set_post_order_in_admin' );      That works okay for sorting by title, but I really need to be able to sort by category name. I tried playing with the $wp_query->set( 'meta_key', 'category' ); and $wp_query->set( 'orderby', 'meta_value' ); but when I started using those, I just got an empty return for All Posts within my admin panel. Any ideas on what is missing? I've tried a number of terms for 'meta_key' all of them fail. Anybody been here before? Any idea on how to achieve the goal of sorting All posts in the admin panel by category (parent)?? many thanks, zip.


Category location styling

http://www.milknhny.co.uk/DVine/?page_id=19 Please can someone help, i have added the categories, however it appears to be off line. I have tried to style this in a class but this screws up the whole thing. I wrapped like the below but it seemed to apply to the whole of the div it was wrapped in
<?php get_category(); ?>
      Please can someone assist, do i edit the main style within the themes? Your help is greatly appreciated. Thanks


Want home page to click through to two different page types

Looking for correct vocabulary to accomplish the following: Home page to show small images for following pages. On click through, (editor chooses) to display distinct page type: EITHER 1: Page that displays in sequence: long text description, multiple images. OR 2. Page that displays image-only gallery with simple right-left arrow navigation to short series of images. Both types of pages will exist on the site. thank you!


wp_update_user isn't instantly?

I'm trying to update a user mail recieved by $_POST and use it instantly. It gets changed, however it outputs the old one. What is the way to do it?               global $current_user;     get_currentuserinfo();          if (isset($_POST['email'])) {             wp_update_user( array('ID' => $current_user->ID, 'user_email' => $_POST['email']) );             get_currentuserinfo(); //just in case     }          echo '
You'll recieve a mail here: ' . $current_user->user_email . '
'; //outputs old mail      Maybe it has to be with the global $current_user var? EDIT: Chuncky fix,               global $current_user;     get_currentuserinfo();          $email = $current_user->user_email;          if (isset($_POST['email'])) {          wp_update_user( array('ID' => $current_user->ID, 'user_email' => $_POST['email']) );          $email = $_POST['email'];     }          echo '
You'll recieve a mail here: ' . $email . '
';


Breadcrumb not showing custom category post type

I have an issue when it come to displaying the custom post type category in my breadcrumb menu on the page it looks something like the following Home / / Post Title _when it should be_ Home / Custom Cat Name / Post Title It shows the post on the page and the posts title but not the category? Breadcrumb menu code:                           /*********************                 breadcrumbs menu                 *********************/                 function the_breadcrumb(){                     echo '
';                     if (!is_home()){                         echo '
';                         echo 'Home';                         echo '

 |
';                         if (is_category() || is_single('post')){                             echo '
';                             the_category('

 |

 ');                             if (is_single()){                                 echo '

 |

';                                 the_title();                                 echo '
';                             }                         } elseif (is_page()){                             echo '
';                             echo the_title();                             echo '
';                         }                     }                     elseif (is_tag()){                         single_tag_title();                     }                     elseif (is_day()){                         echo"
Archive for "; the_time('F jS, Y'); echo'
';                     }                     elseif (is_month()){                         echo"
Archive for "; the_time('F, Y'); echo'
';                     }                     elseif (is_year()){                         echo"
Archive for "; the_time('Y'); echo'
';                     }                     elseif (is_author()){                         echo"
Author Archive"; echo'
';                     }                     elseif (isset($_GET['paged']) && !empty($_GET['paged'])){                         echo "
Blog Archives"; echo'
';                     }                     elseif (is_search()){                         echo"
Search Results"; echo'
';                     }                     echo '
';                 }      Thanks


What is the index [0] for on post meta fields?

Trying to improve my PHP knowledge through test and try! I am confused on [0] arguments at following WordPress PHP code               global $post;     $custom = get_post_custom($post->ID);     $price = $custom['price'][0];     $coMake = $custom['coMake'][0];          echo $custom['price'][0];      Are they for indexing/referencing inputs on the page? if so why they are same?! can you please let me know why and when to use them?


Get page id by title?

I'm using the following code to insert the content from another wp page into my main home page. Is it possible to make it work with a page **title** instead of an id number? Eg. Not $page_id = 518 but $page_id = 'about' instead????               $page_id = 518; //Your Page ID     $page_data = get_page( $page_id );     // Displays the title     echo '<h1>'. $page_data->post_title .'</h1>';     // Displays the content     echo apply_filters('the_content', $page_data->post_content);     ?>


Set parent theme language with custom .mo files

I am using Buttercream as my parent theme. I have translated the .mo file located in `themes\buttercream\languages` and saved it as `nl_NL.mo` and `nl_NL.po`. Now I want to display the parent theme in Dutch (`nl_NL`). I can't edit `functions.php` of the parent theme because if it gets updated I'll lose my changes. What do I have to do to get the theme in another language?


Database sync between local and production

I was watching Mark Jaquith's presentation at WCSF 2013 recently and in the Q&A Mark mentioned something about rsync - after a quick Google I can see this is done via SSH - my question is this: is this something that can be done to a local development environment? Do you still need to copy the database and change configuration, url references etc? For a local setup should I just stick to using a script to change the references?


Turn raw url into clickable links

I have a custom field that contains a bunch of urls in it. I want them to be clickable links in that custom field only. How can I do this? I could just manually convert them to html links but that's too time consuming for 100+ links


Does Akismet plugin expose any hooks, functions, class that can work with custom code?

I have custom code that handles comment insertions using `wp_insert_comment`. Does `Akismet plugin` expose any hooks, functions, class that can work with the same and possibly elsewhere where custom forms for user content submissions are involved? Or do I need to write custom code to make calls to Akismet API?


Order posts alphabetically: how to set order=asc in mysql query?

I have this `function`:                 global $wpdb;       // adjust the query to fit your needs         $posts = $wpdb->get_results( $wpdb->prepare(         "SELECT * FROM $wpdb->posts WHERE         post_type = 'post' AND post_status = 'publish' AND         post_title LIKE %s",      How do I set the order => ASC in this query? I want to show my `posts` alphabetically...


Show menu in sidebar if on specific page AND specific user role (is_page, current_user_can)

I tried combining two conditions: is_page and current_user_can but it didn't work. Found an example at StackExchange where the user role was spelled out. But the Wordpress codex says "Do not pass a role name to current_user_can(), as this is not guaranteed to work correctly." On the same page, this link is included for reference/further reading: http://docs.appthemes.com/tutorials/wordpress- check-user-role-function/ I tried adapting that code, and added this to my functions.php               function plastics_check_user_role( $role, $user_id = null ) {          if ( is_numeric( $user_id ) )     $user = get_userdata( $user_id );     else         $user = wp_get_current_user();          if ( empty( $user ) )     return false;          return in_array( $role, (array) $user->roles );     }      Then, here's what I put in the sidebar.php file:               <?php         if (is_page(array('page1')) && plastics_check_user_role('Administrator')) :             echo '
Title 1
' . wp_nav_menu(array('theme_location'=>'menu1' ));         elseif (is_page(array('page2'))) :             echo '
Page 2
' . wp_nav_menu(array('theme_location'=>'menu2' ));         elseif (is_page(array('page 3'))) :             echo '
Page 3
' . wp_nav_menu(array('theme_location'=>'menu3' ));         endif;     ?>      Still not working. What am I missing? Is it because it's in the sidebar? * * * I prefer to spell out the role - not specify user capabilities - because my 5 custom user roles have exactly the same capabilities, but I restrict pages based on the role. (Hacky workaround: I could add custom capabilities to each role, but that seems like a strange way of doing it....)


frontend show edit profile with selected custom options

So I have many custom user profile fields. When I use `do_action( 'show_user_profile', $profileuser );` hook it displays all custom user profile fields.. But I would like to show only certain fields. For example               add_action('show_user_profile', 'add_extra_profile_fields1');          function add_extra_profile_fields1() {         // add extra profile fields to user edit page     }          add_action('show_user_profile', 'add_extra_profile_fields2');          function add_extra_profile_fields2() {         // add extra profile fields to user edit page     }      Now is there a way to display only `add_extra_profile_fields2` using `show_user_profile` hook?


How do I enable HTML5 prefetching on this page?

Site example: http://www.ianstuart-bride.com I currently have this bit of code in header.php, but it does not work as desired:               <?php if (is_archive() && ($paged > 1) && ($paged < $wp_query->max_num_pages)) { ?>         <link rel="prefetch" href="<?php echo get_next_posts_page_link(); ?>">         <link rel="prerender" href="<?php echo get_next_posts_page_link(); ?>">     <?php } elseif (is_singular()) { ?>         <link rel="prefetch" href="<?php bloginfo('home'); ?>">         <link rel="prerender" href="<?php bloginfo('home'); ?>">     <?php } ?>      The homepage prefetch points to a non-existent page. I would like to disable prefetching on the homepage. I want to enable prefetching on these pages, for the 'Next' dress. This is the code for the single dress pages. I tried this, but it linked to the current page instead of the next one:                   <link rel="prefetch" href="<?php echo get_permalink($next_dress) ?>">         <link rel="prerender" href="<?php echo get_permalink($next_dress) ?>">


How to add to cart via AJAX Woocommerce

I have been searching for a while, this. I want to add an item via AJAX. When you add an item to a cart in Woocommerce the page reloads with the GET parameter `add-to-cart="The current product ID"`. I want to do it via AJAX. In the admin area is a checkbox to enable that featured that is labeled "Enable AJAX buttons to add to cart on the product list" But it doesn't do anything, it stills reloading the page.


Custom product slider from woocommerce products

I want to create a custom products slider for my woocommerce theme. I want to retrieve the thumbnails from my products with a custom taxonomy (`product_tag`) for example "t-shirt". I'm calling the "product_tag" like this :               <?php      $categories = get_terms( 'product_tag', 'orderby=count&hide_empty=0' );           $count = count($categories);      if ( $count > 0 ){          echo "
";          foreach ( $categories as $categories ) {            echo "
" . $categories->name . $categories->count . "
";               }          echo "
";      }          ?>       But how can I get the URL thumbnails from this `product_tag`? Something like `wp_get_attachment_url( $id )` but for products?


Child page Custom post type return 404

I have a custom post type with this structure > parent/child-1/child-2-of-child-1/child-3-of-child-2/ All child return 404 error. My CPT settings are:               $rewrite = array(             'slug'                => 'guide',             'with_front'          => true,             'pages'               => true,             'feeds'               => true,         );         $args = array(             'label'               => __( 'Guide', 'text_domain' ),             'description'         => __( 'Guide Description', 'text_domain' ),             'labels'              => $labels,             'supports'            => array( 'title', 'editor', 'custom-fields','author','page-attributes' ),             'hierarchical'        => true,             'public'              => true,             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_nav_menus'   => true,             'show_in_admin_bar'   => true,             'menu_position'       => 100,             'menu_icon'           => '',             'can_export'          => true,             'has_archive'         => true,             'exclude_from_search' => false,             'publicly_queryable'  => true,             'rewrite'             => $rewrite,             'capability_type'     => 'page',         );      I flushed my rules but 404 is always returned


Three menus - parent / child / sibling

Firstly, apologies for the terminology used here, I will try to be as descriptive as possible. I am trying to create a menu system that will achieve the following:   1. List top level pages as one menu (level 1)   2. When on a top level page, list the child pages in a separate menu (level 2)   3. When on a child page, list the child pages of that child as a further separate menu (level 3) From the Codex this creates the menu which happily lists 3 levels of pages:               <?php if(!$post->post_parent){         // will display the subpages of this top level page         $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");        }             else{         // diplays only the subpages of parent level         //$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");              if($post->ancestors)         {          // now you can get the the top ID of this page          // wp is putting the ids DESC, thats why the top level ID is the last one          $ancestors = end($post->ancestors);          $children = wp_list_pages("title_li=&child_of=".$ancestors."&echo=0");          // you will always get the whole subpages list         }        }             if ($children) { ?>         <ul>          <?php echo $children; ?>         </ul>        <?php } ?>      This is fine, but all page listings are in a single list, in one place. I need to split this out so I can just grab the child pages, and display that menu in a `<div>` in one part of my page, then i need to grab the third level pages, and display those in another part of my page, in a separate `<div>.` Any clues how to do this? Many thanks


Server B handling add_image_size() differently than Server A

I'm curious what dependencies `add_image_size()` has because I just copied a theme over to a new server and began adding thumbnails to custom post types only to find out that my request for hard-cropping is being ignored, and the images are kept proportional. **functions.php**               ...     set_post_thumbnail_size( 80, 80, true );     add_image_size( 'micro', 32, 32, true);     add_image_size( 'featured', 340, 225, true );     add_image_size( 'videowide', 460, 225, true );     ...      On my local server (WAMP Server on Windows Vista) the `true` is respected, and the images are cropped in such a way that extra pixels are lost - edges aren't respected. On my live server (CloudLinux Server 5.5 x64), the images are kept proportional. Is there some gdlibrary dependencies or something I am needing to change on the live server to get the expected results?


Is it possible to filter get_adjacent_post() with tags?

I've been using get_adjacent_post() to determine the previous and next posts. How would I go about determining the next and previous links to posts matching the same tag as the current post? It seems this function allows you to do this with posts in the same category, but not with the same tag.


Custom Comment Types

I have created a custom post type for a sort of gallery whereby users can upload work etc. In addition to this I have taxonomies for this type such as categories, tags, colors, etc. But I want users to be able to do two things. a) comment b) critique. As far as I know WordPress doesn't support Custom Comment Types so I can't create the critique comments, any ideas on how I could do this? Thanks.


Hook in a sidebar widget and add some markup

I'm looking to hook into a sidebar widget, this one in particular loads the members. All I'm looking to do is add a link into the widget, I managed to get a result but it's not quite right. It doesn't load the original function, instead it replaces it. Here's how I far I got:               function members_dir_link(){     echo 'View Members';     }     add_filter('bp_has_members','members_dir_link');


Change Permalink Structure for Tag.php template

Im using a custom post type to build a filterable gallery and taking advantage of the tags taxonomy within it. I am also using a custom taxonomy called years. at the moment, the permalink structure of the gallery page is `www.example.com/gallery` it is filtered by tags and years. i have made a `taxonomoy-years.php` template and used               'rewrite' => array('slug' => 'archive/projects', 'with_front' => false)      to change the permalink structure from www.example.com/years/2000 to www.example.com/archive/projects/2000 when you filter using years. When i filter using tags, its running off a the `tag.php` template, so the permalink structure is `www.example.com/tag/studentwork` but i would like it to be `www.example.com/archive/tag/studentwork`. This is the code that defines my custom post type:               function add_post_type($name){              add_action('init', function() use($name)  {              register_post_type($name,array(             'public' => true,             'label' => ucwords($name),             'labels' => array(                 'add_new_item' => "Add new $name item",                 'edit_item' => "Edit $name item"             ),             'supports' => array('title', 'editor', 'excerpt', 'comments', 'thumbnail'),             'taxonomies' => array('post_tag'),                   ));     });          }      Can anybody help?


Automatically adding a link to the next page link before '<!--nextpage-->' tag in posts?

I'm using the following snippet to automatically break a too long post into multiple pages               function filter_more_with_nextpage( $content ){              $content = str_replace( '<!--more-->', '<!--nextpage-->', $content );         $content = preg_replace( '/<!--nextpage-->/i', '<!--more-->', $content, 1 );              return $content;     }     add_filter( 'content_save_pre', 'filter_more_with_nextpage' );      works like a charm, but I'd like to add automatically a link `<a>` element before the page break to help directing users to the following page. I don't wish to put the link in the post content manually (from wp backend) nor have it inserted automatically in the post content (I don't want it saved along the post itself). Rather, I'd wish to have it generated just before `<! --nextpage-->` tag breaks the current page.


Weirdness in jQuery supplied with WordPress

I've got a problem with the jQuery supplied with WordPress. The following HTML exhibits this problem:               <!DOCTYPE html>

                                      This is a typical situation in my WordPress site, where WordPress's jQuery is included (for the admin bar) at `<head>`, and my own CDN / fallback jQuery is included before the end of `</body>`. The console output of this page is:               window.jQuery     Uncaught TypeError: Property '$' of object [object Object] is not a function       I can solve this problem in several ways, for instance, I could replace the jQuery `<script>` part in `<body>` to:                     Without the `window.jQuery` check. But this is not optimal considering I've included jQuery twice. I then tried replacing the `<script>` in `<head>` to:                     Surprisingly, this also solved the problem. I knew about `wp_deregister_script`, but for admin, this also disables jQuery in the dashboard. I'd like to retain admin bar for admin. So currently the site only breaks (see console output above) when admin is logged in. I'm wondering if the jQuery supplied with WordPress is anything special. I'm using version 3.5.1, and I'm planning on using jQuery in my own theme. Should I just include it twice to address this issue?


Output shows a page instead of a list of blog postings

I have the below code in `front-page.php` (with that page set in Settings > Reading); however, something is wrong because the posts aren't showing. The output is shown below. Can someone identify what the problem may be?                   <?php get_header();?>

Latest News
                              <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                                  <article class="entry" id="post-<?php the_ID(); ?>">                                 <?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?>

<?php the_title(); ?>
                                     <time datetime="<?php the_time('c'); ?>"><?php the_time('F d, Y'); ?></time>                                     <?php the_content(); ?>
Categorized under: <?php the_category(', '); ?>
                                     <a class="read-more" href="<?php the_permalink() ?>" rel="bookmark" title="Read <?php the_title_attribute(); ?>">

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

              <?php get_sidebar(); ?>         <?php get_footer(); ?>      The code above outputs the html below. Note: "Home" is a page, not a post.

Home
             <time datetime="2012-08-29T06:38:44+00:00">August 29, 2012</time>
Categorized under:


site-description css is overriden

I'm trying to change the site-description color of my twentythirteen header to #220E10. My style.css file reads :               .site-description {         font: 300 italic 20px "Source Sans Pro", Helvetica, sans-serif;         color: #220E10;         text-align: center;         margin: 0;         padding-bottom: 25px;     }      However, the color of my header (viewable here) remains #FF6000. I know the css file is the used as a source for size, font and other details, since I can effectively change those and see the results happen. The color will not change however. I suspect the override has something to do with the basic Wordpress editor which allows you to change the color of your header text. I can't seem to be able to identify the location of the source css being used for this color. The #FF6000 color is not present in my style.css file, except for that intentional navbar. Could you help me edit the site-description to a different color ?


Custom post types and categories for my unique permalink situation

recently I've taken on a project that is a bit overwhelming due to the fact I have never made a website this big before. It's a travel website that features reviews, photos, user articles, etc. Anyways, I've been reading a lot of threads here about custom post types, categories, and taxonomies, but I'm a very indecisive person and would like some of your guys' advice on how I should tackle this specific permalink structure. So let's get down to it. There are currently 4 'post types' of the site that include: destinations / travel-logs / photo gallery / hotel reviews. I was also given a permalink structure that goes like this (with example):               site.com/post-type/continent/country/city/     site.com/travel-logs/europe/france/paris/      So my idea is to set each 'post type' as custom post types, then each continent/country/city as categories. For you skimmers:               'travel-logs,destinations,etc' => custom post type     'continent,country,city' => category      My question is this: will it work? If I have 5 custom post types and a ton of hierarchical categories for the locations, will it work and be efficient? Or should I use taxonomies instead of custom post types?


Need some hints for my own WP theme development

After taking some online tutorials I am willing to create my own custom theme for my myself. This is going to be an online Contact Lense store! So far I have learned how to generate and use Custom Post Types, Custom Taxonamyies, Metaboxes , and Option pages.but there is still one confusing part left for me(hopefully not more! :-))   I need to get some user inputs through HTML Select Options like following image to finalize the users orders: ![enter image description here](http://i.stack.imgur.com/k0IXT.jpg) Now my questions are:   1- Do I have to create some thing lik Metaboxes to manipulate these data from users?   2- can I handle these kind of data through simple Form ans Post function in PHP? If so where should I store these data? Do I have to create a table on my own to handle these things?   I really appreciate your time regrading this post,


Advanced Custom Fields: single-books.php works, books.php does not

I'm using CPT UI to create the post type (books). I am running in debug mode. This is all happening on default, Wordpress 3.8, twenty twelve theme. I created a field group called Books in ACF and added three fields: book_title, book_author, pub_year. I set the field group to show if post type is books. I then copied page.php, renamed it books.php, and replaced the default header with Template Name: Books. I created a new page called Book Entries and set the template style to Books. I added this page to the menu. I added the necessary php script in books.php to show the post data. I then used Add Books to enter four different sample book titles using the custom fields and saved them. I am able to view them individually on single-books.php, but when I go to Book Entries I see... no post data. I see everything else, like title, header, footer, sidebars, comments, but no post data. Below is the code for books.php:               <?php     /**      * Template Name: Books      *      *      *      * @package WordPress      * @subpackage Twenty_Twelve      * @since Twenty Twelve 1.0      */          get_header(); ?>

     <?php if ( have_posts() ) : ?>
<?php the_field('book_title'); ?>

<?php the_field('book_author'); ?>

<?php the_field('pub_year'); ?>
                 <?php while ( have_posts() ) : the_post(); ?>                          <?php get_template_part( 'content', 'page' ); ?>                          <?php comments_template( '', true ); ?>                 <?php endwhile; // end of the loop. ?>     <?php endif; wp_reset_postdata(); ?>

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


how to remove header from registration page?

How can i remove the header,search and my home,activity,forum etc from registration page.os there any plugin to modify registration page.I am using buddypress plugin.I do not want to call color.css for my registration page.


wpdb update add current timestamp not working

So using the $wpdb->update to add some data to a custom table, trying to add the current timestamp but it's not saving the right stuff(0000-00-00 00:00:00 this is saved). overview code                 $wpdb->update('mytable',           array(               'value' => 'hello world',                'edit'  => date("Y-m-d h:i:s") //saves 0000-00-00 00:00:00           ),           array(               'option_name' => 'the row'           ),            array('%s, %s')       );


Attempting to filter posts using get_terms

Using get_terms I've created three lists of term links. What currently happens if I click on a term is to see the archive for that term, what I'm attempting to achieve now is when I click a second term I want to see an archive for both terms not just the latest term. Basically creating some level of filtering posts. My first guess is that I have to set some variable to affect the query, any suggestions on how to go about this? Or is there a better way of achieving this?
Filter By Deployment:
     <?php     $deployments = get_terms( 'deployments', array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1) );         echo '
';         foreach ( $deployments as $deployment ) {             echo '
slug, 'deployments').'">'.$deployment->name.'
';         }         echo '
';     ?>
Filter By Category:
     <?php     $categories = get_terms( 'category', array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1) );         echo '
';         foreach ( $categories as $category ) {             echo '
slug, 'category').'">'.$category->name.'
';         }         echo '
';     ?>
Filter By Keyword:
     <?php     $tags = get_terms( 'post_tag', array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1) );         echo '
';         foreach ( $tags as $tag ) {             echo '
slug, 'post_tag').'">'.$tag->name.'
';         }         echo '
';     ?>


output button depending the taxonomy

I'm trying to display two different buttons depending on the taxonomy the post is related to. I have a custom post type called "project". I have a taxonomy called "villes" (cities). For example if i'm on the city "lausanne" i need the red button displayed and if i'm in any other city i need the green button. I've added a metabox in my post for my button link and it work well (the button is shown only if the metabox is filled. Now i want to make this condition I made my code to display my button like this.                  /* store post ID and metadata in variables */     $postid = get_the_ID();     $website_link = get_post_meta( $postid, '_inscr', true );          /* output the button on the condition of $website_link being meaningful */     if ( ! empty( $website_link ) ) {        echo do_shortcode('[reveal_modal text="Je m\'inscris" size="medium" button="true"] <iframe src='. get_post_meta($post->ID, '_inscr', true).' height="1200" width="960"></iframe>[/reveal_modal]');     }      do I have to declare another condition like : if > website link if filled and my taxonomy = "lausanne" .... ? Any help would be appreciated.


Protect wp-login, but get an internal server error

I am trying to protect my wp-login by               #Protect wp-login     <Files wp-login.php>     AuthUserFile ~/.htpasswd     AuthName "Private access"     AuthType Basic     require user myusername     </Files>      after the password protect I get a 500 internal server error and not the wp- admin How can I fix this? And how can I logout and try again to see if it works?? ps: source from the codex


WP Multisite development with Mamp Pro and wildcard subdomains, not really working for me

I´m trying to set up a local development environment for me to work on a Wordpress multisite that I´m building. I use Mamp Pro with default ports (Apache: 80, MySQL: 3306), and I also added a new host with the same domain name as the page will have when going live. So, now when I go to http://mylivedomain.com I get to my development page, and database entries seem to use the same url as it should when going live as well. Enabling multisite from here was no problem, but I´m struggling to get Wildcard subdomains to work. In the advanced tab under Host in Mamp Pro, I added: "ServerAlias *.mydomain.com", but that doesn't work for me. I´m able to add a new site from the Admin dashboard, but when trying to visit it I just get a 404. Can anyone steer me in the right direction? I´m the 'design guy' so all this techinical jizz is really over my head, but I try...:)


Variable scope producing undefined variable notices in included files

I'm building a Wordpress Theme and on the front page the user is able to select how they would like to order their posts. I've then created two functions that take the users selection through the variable `$user_choice` and develop a query based off of that choice. However, I'm having trouble with scope and getting the following notices/errors: > Notice: Undefined variable: user_choice in /Users/Chappell/Websites/LFB/wp- > content/themes/lfb/front-page-loop.php on line 3 > > Notice: Undefined variable: user_choice in /Users/Chappell/Websites/LFB/wp- > content/themes/lfb/front-page-loop.php on line 5 > > Notice: Undefined variable: header_query in /Users/Chappell/Websites/LFB/wp- > content/themes/lfb/front-page-loop.php on line 7 > > Fatal error: Call to a member function have_posts() on a non-object in > /Users/Chappell/Websites/LFB/wp-content/themes/lfb/front-page-loop.php on > line 7 _front-page.php_                   <?php get_header(); ?>

                          <?php                               $user_choice = 'most-recent';                              echo $user_choice;                              if (isset($_GET['formSubmit'])) {                                  $user_choice = $_GET['options'];                              }                              switch ($user_choice) {                             case $user_choice === 'most-commented';                                 $title_text = 'most commented';                             break;                             case $user_choice === 'most-recent';                                 $title_text = 'most recent';                             break;                             case $user_choice === 'most-viewed';                                 $title_text = 'most viewed';                             break;                             case $user_choice === 'featured';                                 $title_text = 'featured';                             break;                             default:                                  echo 'No posts were found matching this query.';                         }                                 ?>

Now displaying <?php echo $title_text . " Liverpool articles"; ?>

                                 <form role="form" class="form-inline pull-right orderer">
                                         Order By:                                         <select class="form-control order-select" name="options">                                             <option value="most-recent" <?php if ($user_choice === 'most-recent') { echo 'selected'; }?>>Most Recent</option>                                             <option value="most-commented" <?php if ($user_choice === 'most-commented') { echo 'selected'; }?>>Most Commented</option>                                             <option value="most-viewed" <?php if ($user_choice === 'most-viewed') { echo 'selected'; }?>>Most Viewed</option>                                             <option value="featured" <?php if ($user_choice === 'featured') { echo 'selected'; }?>>Featured</option>                                         </select>

                                         <input type="submit" class="btn btn-default" id="orderer" value="Submit" name="formSubmit">
                                 </form>

                              <?php get_template_part('front-page-loop'); ?>
                          <?php get_sidebar(); ?>

              <?php get_footer(); ?>      **Front-page-loop.php**               <?php           /*  Takes the user choice from the home page select button and produces     *   a WP_Query relevant to that choice. Displays 1 posts per query.     *   @param string $user_choice     */          function main_post_arg_finder($user_choice) {              switch ($user_choice) {             case $user_choice === 'most-commented';                 $args = array(                     'orderby' => 'comment_count',                     'posts_per_page' => 1                     );             break;             case $user_choice === 'most-recent';                 $args = array(                     'orderby' => 'date',                     'posts_per_page' => 1,                     'cat' => 239                     );             break;             case $user_choice === 'most-viewed';                 $args = array(                     'meta_key' => 'lfb_post_views_count',                     'orderby' => 'meta_value_num',                     'posts_per_page' => 1                     );             break;             case $user_choice === 'featured';                 $args = array(                     'orderby' => 'date',                     'posts_per_page' => 1,                     'category_name' => 'featured'                     );             break;             default:                  echo 'No posts were found matching this query.';         }                 $header_query = new WP_Query($args);              return $header_query;     }          /*  Takes the user choice from the home page select button and produces     *   a WP_Query relevant to that choice. Displays an unlimited amount of posts per     *   query.     *   @param string $user_choice     */          function posts_arg_finder($user_choice) {         switch ($user_choice) {             case $user_choice === 'most-commented';                 $args = array(                     'orderby' => 'comment_count',                     );             break;             case $user_choice === 'most-recent';                 $args = array(                     'orderby' => 'date',                     'cat' => 239                     );             break;             case $user_choice === 'most-viewed';                 $args = array(                     'meta_key' => 'lfb_post_views_count',                     'orderby' => 'meta_value_num',                     );             break;             case $user_choice === 'featured';                 $args = array(                     'orderby' => 'date',                     'category_name' => 'featured'                     );             break;             default:                  echo 'No posts were found matching this query.';         }                 $query = new WP_Query($args);              return $query;          }           ?>
              <?php echo $user_choice;              main_post_arg_finder($user_choice);                  if ( $header_query->have_posts() ) : while ( $header_query->have_posts() ) : $header_query->the_post() ?>                          <?php $do_not_duplicate = $post->ID; ?>
                                  <a href="<?php the_permalink();?>">
<?php the_title();?>
                             <?php the_post_thumbnail('thumbnail', array('class' => 'img-responsive')); ?>                             <?php post_meta(); ?>                             <?php the_excerpt(); ?>

                      <?php endwhile;                  else :                      echo '
No main post found
';                  endif; ?>

                   <?php posts_arg_finder();                  $i = 0;                    if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();                          if ( $post->ID == $do_not_duplicate ) continue;                          if ($i != 0 && $i % 1 == 0) { // add new row after 1 post                         echo '

';                     }                          $i++; ?>
                              <a href="<?php the_permalink();?>">
<?php the_title();?>
                         <?php post_meta(); ?>                         <?php the_excerpt(); ?>

                   <?php endwhile;                  else :                      echo '
No posts found
';                  endif; ?>


Updating post meta for custom post types

I'm writing a plugin for work (still) and having one more issue. I've added my meta boxes as needed. However, the problem I'm having occurs when _saving_ the post. My snippets for saving pretty much come from this post. I've also recieved a similar answer here, but it's just not working for some reason. :/                 protected function __update_post_meta( $post_id, $field_name, $value = '' )       {        if ( empty( $value ) OR ! $value )        {         delete_post_meta( $post_id, $field_name );        }        elseif ( ! get_post_meta( $post_id, $field_name ) )        {         add_post_meta( $post_id, $field_name, $value );        }        else        {         update_post_meta( $post_id, $field_name, $value );        }       }      The above is called using the following. However, I'm not sure my problem lies with the actual saving now that I think of it. I'm thinking it might be the `nonce` which may be throwing it off.                 public function _wp_save_post( $post_id, $post )       {        if ( empty($_POST)          OR !isset($_POST['argus_edit_visitor'])          OR !wp_verify_nonce( $_POST['argus_edit_visitor'], 'argus_edit_visitor' ) )        {         return $post->ID;        }             if ( ! current_user_can( 'edit_post', $post->ID ) ) return $post->ID;             // v_f_name | v_l_name | v_workstation | v_id        // Argh!             $this->__update_post_meta( $post->ID, 'v_f_name', $_POST['v_f_name'] );        $this->__update_post_meta( $post->ID, 'v_l_name', $_POST['v_l_name'] );        $this->__update_post_meta( $post->ID, 'v_workstation', $_POST['v_workstation'] );        $this->__update_post_meta( $post->ID, 'v_id', $_POST['v_id'] );       }      The nonce is used like the following: `<input type="hidden" name="argus_edit_visitor" id="argus_edit_visitor" value="{$nonce}" />` and created using `$nonce = wp_create_nonce( plugin_basename( __FILE__ ) );`. The input field is inside block of html being stored in variable $html. Stackexchange was parsing my html otherwise I'd paste it here. -Zack **EDIT:** Just tested it, and it **is** the nonce's fault.   **EDIT2:** Typo on my part, but still doesn't work.


wordpress domain setup with ec2 apache

I'm struggling to get my WP domains to display correctly. I'm using ec2 apache with a domain from namecheap. In namecheap, I've done the "pointing," putting my elastic IP for both the @ and www, and selected "A (Address) for both. Right now, www.mysite.com directs to the homepage of my WP. But as soon as I click links in my WP, the url goes back to xxx.ElasticIP.xx/sub-page instead of www.mysite.com/sub-page The General settings in my WP still have the xxx.elasticIP.xx for both the site URL and WP URL. Any help greatly appreciated!


Custom Links in Walker Class

I am creating a custom walker class. I need to identify the custom links that will be added to the menu from **Appearace > Menu > Custom Link** so that they will have a different format to the page/post links Any thoughts on how I can do this within walker class possibly using if statement? something like               if (link = custom-link) {       // Do something     }


WordPress 3.5: Switch back to Old Media Uploader?

Is there any way to switch back to the old media uploader in WordPress 3.5? The new one is very slow for me, as I have thousands and thousands of images across my site, and I have a few plugins that only work with the old uploader.


Author's Id from wp list authors function

I'm new in wordpress. I want to display all author list with its ID. I'm using `wp_list_authors` function but didn't get any author id from the author list. So, How can I get Author's ID in listing of all author?


2 language CPT content

I'm working on a CPT Portfolio to present my job I wish to be able to have it in 2 languages but I would prefer not to use an additional plugin since that is only 2 fields that would be in 2 language my idea is : # on the back office of this CPT   * remove original excerpt   * remove original text editor   * create a custom meta box for language 1   * add to this meta box a custom text area 'intro language 1'   * add to this meta box a custom text editor 'intro language 1'   * create a custom meta box for language 2   * add to this meta box a custom text area 'intro language 2'   * add to this meta box a custom text editor 'intro language 2' # on the front end   * have a lang switcher with a cookie   * use the correct PO/MO file according to lang   * call the right text area / text editor content according to the lang is that the correct way to do it? Thank you in advance for all your help, I'm just scratching the admin section customisation


Creating 'posts page' loop based on the page itself

The setting `Settings -> Reading -> Posts Page` is set to my 'News' page, and the loop for the `home.php` template is populated with posts... great. However I want to also be able to create another loop (even with `WP_Query` if needed) of which contains the actual page of which I've specified my `Posts Page` to be. Whenever I try and and instantiate this loop it returns loads of posts instead of the page I've asked for, here's my code, compare the args with the request SQL:               <?php              $page = new WP_Query(array('post_type' => 'page', 'page_id' => 39));         print_r($page);              // REQUEST: SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'page' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') ORDER BY wp_posts.post_date DESC LIMIT 0, 10          ?>      You can see the request SQL query is wrong, I'm guessing because I've set the page as the `Posts Page` it's preventing me from using it within a loop. Is there a way around this? I want to use the title, content and custom fields within the `home.php` template. Thanks


Display latest 5 posts on homepage

I'm currently using a custom made Twentytwelve child theme and would like to display the last 5 posts on the homepage using a shortcode. I have tried using the code below (added to `functions.php`) but to no avail - when I add the shortcode to the homepage, it doesn't display anything although as far as I can see, it should and I have a test post live.               function custom_prev_posts($limit = 5){     global $wpdb, $post;     $html = '';     $prev_posts = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.post_date < '%s' AND $wpdb->posts.post_type = 'post' AND $wpdb->posts.post_status = 'publish' ORDER BY $wpdb->posts.post_date DESC LIMIT $limit", $post->post_date ) );           if($prev_posts){     $html .= '
';     foreach ( $prev_posts as $prev_post  ) {     $html .= '
ID ) . '">' .$prev_post->post_title . '
';     }     $html .= '
';     }     return $html;     }          add_shortcode('last5', 'custom_prev_posts');      I'm thinking the issue may be related to the Twentytwelve theme. Any ideas what I'm doing wrong or does anyone know of a working way to display the latest 5 posts inside a page?


a one-off rewrite rule

I have _one_ page that I need to change the URL for. Currently, the page resides at example.com/departments/human-resources/ (human-resources is a sub-page of /departments/ ) My client wants to maintain the legacy url for the hr department which is: http://example.com/hr/ How can I rewrite any request for `^/hr/?$` to `^/departments/human- resources/$` but keep the URL the same? That is, nobody will ever see /departments/human-resources/. My current .htaccess looks like this:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>      I've tried adding a rewrite rule that writes /hr/ to /dept/h-r/ before the index.php line, but this gives me a 404.


How to update wp_posts with just the returned comment count from wp_comments (SQL GROUP BY)

I am doing a special migration from someone's custom CMS to a WP installation. I successfully got the posts and comments migrated into their respective tables. Now I need to get the comment count into the wp_posts table for each matching id. I have something like this. I'm close, I think:               SELECT COUNT(comment_content) AS total_comments, comment_post_ID AS commentID     FROM wp_comments     GROUP BY comment_post_ID;     --mysql won't let me run the group by on just the returned count column, so I'm stuck with    two columns of data when I just want to insert one          UPDATE wp_posts SET comment_count = total_comments WHERE wp_posts.ID = commentID;     --So I tried to set my returned data to variables and assign them into the update statement..which doesn't work      Anyway, perhaps I need to iterate all the posts, find a matching ID and update it by moving the cursor? Or is there an easier way i'm missing somehow?


With WordPress Importer, why can't I import post meta containing a multi-dimensional array, in which value(s) of that array contain line breaks?

## The Question With WordPress Importer, why can't I import post meta containing a multi- dimensional array, in which value(s) of that array contain line breaks? Is there a workaround that I can do to save my data so it will work? Is there something I can do in my sanitation proces to format the data differently before saving it to the post meta? ## The Background Info I've created a WordPress plugin that provides a layout builder. Users can construct the content for a custom layout with certain "elements" given to them (i.e. a slider, a set of columns, a content input, etc), and then apply that custom layout to a static page on their site. Originally, my goal was for all custom layouts to work with WordPress's import/export tool. So each custom layout is actually a custom post type post, and its respective set of "elements" are saved as post meta to that post. So, essentially I'm saving this _single_ multi-dimensional array with all "elements" as a custom field to the custom post, which is the custom layout. ## The Problem If any of a custom layout's "elements" contain any user-inputted text with a line break, it prevents that post meta from being imported through _Tools > Import > WordPress_. The result is that the the custom post (i.e. custom layout) gets imported but the element's post meta is empty. So the user sees a blank layout with no elements. So, this first example has no line breaks and _does_ work. ![](http://picturestack.com/264/757/GC3exchange4apt.jpg) ![](http://picturestack.com/264/362/0wOexchange1DGG.jpg) However, in this second example the user has put in a line break and so it _does not_ work and the problem described above occurs. ![](http://picturestack.com/264/362/V7mexchange3Jch.jpg) ![](http://picturestack.com/264/362/gq9exchange2EzE.jpg) ## Possible Solutions? I'd really like to be able setup sample content for users and give them the WordPress import file so they can quickly import these sample layouts. So, I'm just trying to figure out if anything can be done to avoid this? Is it possible within my sanitization process I can format the data any differently before I store it in the post meta? Obviously I'd just strip out all the white space, but then the user won't be able to format their text within the options of the layout builder.


Is there a (sane) way to get all custom fields for a post, which do not have a leading underscore?

I know about `get_post_custom()`, but that returns _all_ custom fields, including those with a leading underscore. Is there a reasonable way to get only the ones without a leading underscore? Would I just have to resort to using `get_post_custom()` plus a regex to parse the results?


How to add the Author on my RSS Feed

just done on my feed burner, I noticed however, that author is not being labeled in the RSS feed: http://feeds.feedburner.com/BiotechStart . How should I able to do that? any idea please.


Retrieving multisite blog IDs, somehow failing to foreach them properly

Working on a directory listing and have cobbled together the shortest query I can. It appears to return the listing ok (I think) but the foreach is somehow failing to process the array properly. Can anyone give me a tip on what I'm doing wrong?               global $wpdb;      $site_blog_ids = array($wpdb->get_results($wpdb->prepare("SELECT blog_id FROM wp_blogs     where blog_id > 1"))); // get all subsite blog ids          print_r( $site_blog_ids ); // checkem - output is "Array ( [0] => Array ( [0] => stdClass Object ( [blog_id] => 2 ) [1] => stdClass Object ( [blog_id] => 3 ) [2] => stdClass Object ( [blog_id] => 5 ) ) ) "          foreach( $site_blog_ids as $site_blog_id ) { //iterate through the ids     print_r( "siteid ".$site_blog_id ); // checkem - this just outputs "array array" ??       The blog IDs aren't coming through the foreach properly somehow, it's just outputting "array array" whereas it should show the list of blog IDs. Does this look like a problem with the $site_blog_ids array or did I mess something else up? Thanks for any help! David V.2 per MBoynes' help. Fixed the double array because wpdb already outputs an array. But it's still not working at the foreach to ouput the $site_blog_id, and changing to "$site_blog_ids[0] AS $site_blog_id" only outputs the first one in the array and then stops.               global $wpdb;      $site_blog_ids = $wpdb->get_results($wpdb->prepare("SELECT blog_id FROM wp_blogs where     blog_id > 1")); // get all subsite blog ids          print_r( $site_blog_ids ); // checkem - output is "Array ( [0] => stdClass Object ( [blog_id] => 2 ) [1] => stdClass Object ( [blog_id] => 3 ) [2] => stdClass Object ( [blog_id] => 5 ) ) "          foreach( $site_blog_ids AS $site_blog_id ) { //iterate through the ids     print_r( "siteid= ".$site_blog_id."
" ); // checkem - this shows no blog ids output at all ??      v.3 Working version for posterity global $wpdb; $site_blog_ids = $wpdb->get_results($wpdb->prepare("SELECT blog_id FROM wp_blogs where blog_id > 1")); // get all subsite blog ids               print_r( $site_blog_ids ); // checkem - output is "Array ( [0] => stdClass Object ( [blog_id] => 2 ) [1] => stdClass Object ( [blog_id] => 3 ) [2] => stdClass Object ( [blog_id] => 5 ) ) "          foreach( $site_blog_ids AS $site_blog_id ) { //iterate through the ids     print_r( "siteid= ".$site_blog_id->blog_id."
" ); // checkem - anything in the loop that needs the blog ID value must pull it with the ->blog_id key.


Cache WordPress for offline use

Client of mine will be out in the sticks and needs to have an offline version of her WordPress site. Is there a way to cache the entire site so that it is available offline? I know I can use Xampp but she is not tech savvy enough and I am concerned something might go wrong at this event she will be at. If worst comes to worst this is the option I will take but if there are other alternatives I will appreciate it. Thanks


Make different sites on multisite reference same script

I'm using multisite and want all my scripts to point to the same URL so they are optimized as well as they can be. Currently I have: http://www.site.com/news/wp-content/themes/js/bxslider.js http://www.site.com/events/wp-content/themes/js/bxslider.js But they both reference the same file. I'd like them to be both something like: http://www.site.com/wp-content/themes/js/bxslider.js That way it would save people having to download the same file again even though they already have it cached locally. This question is the same question but the solution isn't up to date. Does anyone have any ideas of code or any plugins that might help solve ? Thanks


Convert many posts from having a specific meta_key to use a post_format

I have 350 posts that were using a plugin-provided option stored in a meta_key ("custom_post_template", to be precise). I want to convert these posts to assign them a specific post_format ("gallery"). I could do it one by one, but it's going to take ages (there are 4000+ posts), so i'm looking at a clever SQL query that could do that. Right now, i have found how to retrieve the 350 posts that were using the old system:               SELECT *      FROM  `wp_postmeta`      WHERE  `meta_key` LIKE  'custom_post_template'      But i don't understand where Wordpress keeps track of the post_format-to-post association. What would be the SQL query?


A plugin is giving me "You do not have sufficient permissions to access this page." error

I noticed this morning that I was logged off from my site. Whenever I tried to access /wp-admin it gave me a "You do not have sufficient permissions to access this page." error. After an hour of searching, restoring backups and checking database tables in vain, I finally solved the issue by simply renaming my plugins folder; meaning that one of my plugins caused this issue. My question is: How can I track down the culprit? I think one of the following plugins caused this issue as they have been updated recently, and works by messing with the WP core files and DB tables.   1. Google XML Sitemaps   2. Ithemes Security (AKA Better WP Security)   3. W3 Total Cache As of now I'm afraid to reactive any of these plugins.


Add tooltips with image in Wordpress Menu?

I want to add tooltips with image modal inside my menu dropdown. See this link: My site When on the dropdown menu, when we hover on the the product item, I want a tooltips with image to it. How could I achieve this whether with plugin or something elses? Thank you so much!


Add a filetype to the permitted upload types?

I'd like to attach an LDraw lego design file (.ldr) to one of my wordpress posts. However the upload media widget complains that the file type cannot be uploaded "for security reasons", which is totally understandable since this is not a "common" file extension it would have been programmed to accept like PDF. How can I make .ldr an exception to the forbidden file-types list or otherwise permitted?


What is the best way to avoid spammers registering to my blog?

I would like to be able to easily control who registers to my blog because recently I had tons of spam users registering. I came accross the plugin Stop Spammer Registrations, but i'm not sure it is reliable enough and I would also like to have a full log of every user who was rejected by the plugin/service. Is there any good alternative? Thanks


Custom columns on edit-tags.php main page

I am trying to add custom columns to edit-tags.php for a custom taxonomy that I have created. This custom taxonomy is called equipment-types and it only applies to one custom post type called equipment. I am trying to use the same filters and actions that I would use to add custom columns on the edit.php page. I was able to actually create the custom columns with this filter:               add_filter('manage_edit-equipment-types_columns', 'define_equip_types_columns');      However, I cannot seem to populate these columns with any data. Normally, for the edit.php page I would use the following action:               add_action('manage_posts_custom_column', 'my_post_type_columns_content'));      And then within the my_post_type_columns_content function I would conditionally output column data based on the post-type. The problem is I can't seem to find a similar hook for the edit-tags page. Adam Brown's website lists these hooks:               manage_blogs_custom_column          manage_comments_custom_column          manage_comments_nav          manage_link_custom_column          manage_media_custom_column          manage_media_media_column          manage_pages_custom_column          manage_plugins_custom_column          manage_posts_custom_column          manage_sites_custom_column          manage_themes_custom_column          manage_{$post->post_type}_posts_custom_column      None of which I think would be any help. Does anyone know of a way to do this? I'm so close, I have the columns created with titles, I just need to fill them with data! EDIT: To be clear, I am not trying to make custom fields. I am trying to make custom COLUMNS in the table to the right on the main taxonomy page. Regularly on the edit.php page where it displays All Posts for that post type I can make custom columns such as the quantity column like this: > ![enter image description here](http://i.stack.imgur.com/zBmXD.jpg) However, I don't think there is a hook to populate the columns on the edit- tags.php main page, even though I can create a custom column such as Image URL below: > ![enter image description here](http://i.stack.imgur.com/K9sX6.jpg)


Displaying the facebook profile picture in the WP-FB AutoConnect widget?

Is ther a way of displaying the facebook profile picture in the WP-FB AutoConnect widget? Like the bbPress login widget: ![enter image description here](http://i.stack.imgur.com/WoLnj.png) The WP-FB AutoConnect widget doesn't show it (I think it is like this by default): ![enter image description here](http://i.stack.imgur.com/InkUi.png) (I'm using the latest version of the plugin + Wordpress 3.1 + bbpress plugin (also the latest version).


Filter or order based on custom field

I have added a custom field to some posts called 'frontpagerank' The plan is to order the posts by this value but first I just want to filter out any that don't use a front page rank. I have achieved this by putting the relevant posts into another array. But what to do next? Also tried a query: $the_query = new WP_Query(array( 'meta_key' => '0', 'meta_value' => '44' ));               while ($the_query->have_posts()) : $query->the_post(); $count++;      This just does nothing. This code is hard to debug!


Custom Post Type “Event”: chronological list of recurring events

i'm looking for a good and easy way to have a custom post type "event" that can have multiple dates. (I have tested about 20 plugins). I think i have no problem building a metabox allowing the user to duplicate the field group "date and time" multiple times. But **how would a query look like that creates a chronological list of events from the meta data?** (The project is a playing schedule for a theatre. Productions play on several dates.) Thank you!


Display list of Sub-Categories and the posts they contain, within one main Category

I've found tons of code and plugins to do various things; from show posts for specific cats, subcats of a cat, etc.. BUT, I cannot for the life of me find, nor do I know the WP API well enough to do what I need with it.. Here is what I'm trying to accomplish: Display a UL of all subcats within Cat31, and the posts for each of those subcats:   * **SubCat1**     * Post 1      * Post 2   * **SubCat2**     * Post 1      * Post 2   * **SubCat3**     * Post 1      * Post 2 It's pretty straight forward, but all the loops I have tried fail either at the subcat loop or the post loop (one or the other works, I cannot get them both to work..) So, unless I can find a plugin to do this (I'd prefer to code this into a template file!) then I need to figure out how to: Loop Subcats within Cat31 while looping subcasts, loop posts for each subcat Any help is GREATLY appreciated!


Direct link to category?

I'm trying to build up a menu of category links for specific categories I'd like to highlight and apply styling/classes to. I've tried this sort of thing.
<a href="<?php get_site_url(); ?>category/Gadgets"> Gadgets
      And
 Gadgets
      It's showing up as sitename/category/category/category/gadgets on the front end. I can't use `<?php wp_list_categories('orderby=name&title_li='); ?>` because it's going to spit out all of them and limit the styling I can do on the html. I just want to link to categories directly, by name, preferably without hard coding in the site name.


Specific and Different Ads for each Post?

I am working with a magazine client who sells adversiting offline in their magazine and now has a WordPress online magazine. Each of their stories is broken into different posts, and they are using the Wootheme Spectrum. They want the ads in the magazine to correspond to the ads online. So if Story B has Ad Z, then online, Post B should have Ad Z in the sidebar. However, Story A and C might have differents ads. What's the best way to accomplish this?   * Custom plugin?   * Plugin?   * Adsense? Thank you.


Template redirect inside of plugin not redirecting

I have this inside of my plugin but it's not loading it ...                function templateRedirect()      {     if(is_home()){         echo 'hello';     }      }       add_action('template_redirect', 'templateRedirect');


Space in WordPress Attribute Causing Problems

I'm trying to write my first caption plugin and having some difficulties. I'm setting up a shortcode like so:               function Shortcode_Caption( $atts, $content=null ){             // DEFAULT ARGUMENTS ARRAY               $args=shortcode_atts( array(         'caption' => 'Caption',         'link' => 'http://www.link.com'        ), $atts);             // ENCLOSED SHORTCODES        if($content){           return '
               '.$content.'
';        };     };            add_shortcode( 'Caption', 'Shortcode_Caption' );      Some JS picks it up from there. So then when the shortcode is used:               [Caption caption="This is the Text" link="http://www.go_here.com"]some content[/Caption]      The above doesn't work, because of the spaces in the "caption" attribute. However, removing the spaces works 100%:               [Caption caption="Text" link="http://www.go_here.com"]some content[/Caption]      I'm not sure what I'm doing wrong with this? Thanks!