title: navigation doesn't work in custom header.php

text:
I've made a custom `header-blog.php`(for blog page/`home.php`) in addition to `header.php`, both of which use the exact same `<nav>` code. On the pages that use `header.php`, the navigation works perfectly. However, on the blog page(`home.php`), which uses `header-blog.php`, the navigation doesn't work- all links lead to "Nothing found." What could be the cause of this? How can I fix it? This is my first time with something like this, so any insight and ideas are greatly appreciated. header-blog.php               <!DOCTYPE html>                        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />         <meta name="generator" content="Wordpress <?php bloginfo('version'); ?>" />         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />         <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title>         <link rel="pingback" href="<?php bloginfo('pingback url'); ?>" />         <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />         <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" />         <link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/img/favicon.ico" />         <?php wp_head(); ?>

                 <a href="<?php bloginfo('url'); ?>"><img src="<?php echo get_template_directory_uri(); ?>/img/logo.png" alt="Urban Palate logo" id="logo" />

<img src="<?php echo get_template_directory_uri(); ?>/img/about.png" alt="Urban Palate intro" />

<img src="<?php echo get_template_directory_uri(); ?>/img/portfolio.png" alt="Urban Palate portfolio" />

<img src="<?php echo get_template_directory_uri(); ?>/img/blog.png" alt="Urban Palate blog" />

<img src="<?php echo get_template_directory_uri(); ?>/img/contact.png" alt="Urban Palate contact" />


title: Wildcard subdomain for the same site

text: Is there any way to make all requests to any subdomain load the same Wordpress website e.g. user1.example.com, user2.example.com and user3.example.com all load the same website, but with the links pointing to the current subdomain? I'd like to keep mostly the same content across the different websites. The only difference is that by reading the subdomain I can offer customized content (website title, etc) specifically to that user, or add a hook to display an error message if the user doesn't exist. At the moment the network install requires me to manually define every website, with different contents across them.


title: Related Posts: Notice: Undefined offset: 0

text: I get an undefined Offset message with this Query. Can anyone Help?               $terms = get_the_terms( $post->ID , 'filters', 'string');             $term_ids = wp_list_pluck($terms,'term_id');             $second_query = new WP_Query( array(                   'post_type' => 'portfolio',                   'tax_query' => array(                                 array(                                     'taxonomy' => 'filters',                                     'field' => 'id',                                     'terms' => $term_ids,                                     'operator'=> 'IN' //Or 'AND' or 'NOT IN'                                  )),                   'posts_per_page' => 4,                   'ignore_sticky_posts' => 1,                   'orderby' => 'date',  // 'rand' for random order                   'post__not_in'=>array($post->ID)                ) );


title: How to change order of posts in admin?

text: How can I change the order of posts in the admin dashboard, so they display alphabetically according to title, rather than latest first?


title: Possible to use conditionals within add_feed() callback?

text: I'm using `add_feed()` to create some custom feeds but calls to `is_singular()`, `is_home()` etc... just don't seem to work within the callback. Is there a workaround for this? Example code:               add_action( 'init', 'my_init' );     function my_init() {             add_feed( 'new_feed', 'feed_output' );     }          function feed_output() {         if ( is_home() )             load_template( '/path/to/feed/home/template.php' );         else             load_template( '/path/to/feed/template.php' );     }      I've added a trac ticket for this too.


title: Use get variable when rewritten url in wordpress

text: I have many pages which have a lot in common. They are supposed to display the same things but according to their own categories. The logical way to implement this would be to pass a variable through the url and display the info according to it. The only problem is that my wordpress urls are rewritten... I search this site before asking and I know there are posts around here related to that matter but they don't help me as they refer to some obscure regex I just can't associate to my own case. Not to mention some unexplained references to "tags" and "rules" which are quite beyond me. I reallly tried to learn from theses posts but I couldn't make use of them. Basically, my urls are rewritten and I need to add a single variable to this: "http://www.mysite/(mycategory) I don't know how to send the "mycategory" variable AND I don't know how to retrieve it. Any help would be appreciated.


title: Creating shortcodes with user created forms

text: I am creating a plugin. That enables users to create forms, & display these with shortcodes on a site. When creating a form (using custom post types), users will be able to add additional form fields with meta boxes. My question: When a user creates a form (via custom post type), how do I store the field type so the shortcode knows which type to display for the form?


title: WordPress keeps fetching the archive page instead of the template page

text:
I have a template set up and I've created a page in WordPress and have chosen the corresponding template in the drop down. I have created templates for several pages of this site and they've all worked fine; however, this one template is causing problems. WordPress keeps fetching the archive page for some reason. The exact body class is this: `archive post-type-archive post- type-archive-teams logged-in` Here is the template I've created.                       <?php get_header();?>
                          <?php                         $temp = $wp_query;                         $wp_query = null;                         $wp_query = new WP_Query();                         $wp_query->query('post_type=teams&posts_per_page=7');                              while ( $wp_query->have_posts() ) : $wp_query->the_post();                          ?>                          <article class="post team" id="post-<?php the_ID(); ?>">
<?php the_title(); ?>

                                           content here

                          <?php                         endwhile;                          $wp_query = null;                         $wp_query = $temp;                         wp_reset_query();                     ?>
                  <?php get_sidebar(); ?>                  <?php get_footer(); ?>      Can someone help me out in figuring out why this isn't working?


title: Only display a certain number of posts, dependent on how many posts there are available in a query

text: I am trying to write some code for a slider of posts, at the moment my code involves two `WP_Query`s, one inside the other, but I can't help feeling there may be a more efficient way of doing what I'm trying to achieve. Steps are:   1. Check how many published posts there are of a certain post type, using a WP_Query.   2. If there are >= 4, I want to add a slider to the page, so I start printing out slider container.   3. Then within the slider HTML, I use the count of posts from the first WP_Query (`$num_posts`) to work out how many posts I want to print out in the next query. If there are >= 12 available, I want to print all 12. If there are between 8 and 11 available, I want to print out only 8. If there are between 4 and 7 available, I want to print out only 4.   4. I feed the number I want to print out (`$postsToPrint`) into `showposts` as an argument for the second WP_Query. Is there any way of doing this without having two `WP_Query`s? It seems inefficient. Explanation of code here:                   // Initial query which only exists so I can count available posts              $args = array (             'post_type'              => 'mytheme_posttype',             'post_status'            => 'publish',             'showposts' => 12         );              $sliderQuery = new WP_Query( $args );                   // Count how many available posts there are for my slider         $num_posts = $sliderQuery->post_count;              if ($num_posts >=4) : ?>              // Want to add a slider if posts >= 4, so start printing out slider container HTML here.              // I then want to check how many posts were collected in the above query, and only print out a certain number depending on how many there are available                  // if there are 12 available posts, print out all 12             if ($num_posts >= 12) {                 $postsToPrint = 12;             }                  //  else if there are between 8 and 11 available posts, only print out 8             elseif ($num_posts >=8) {                 $postsToPrint = 8;             }                  // if there are between 4 and 7 available posts, only print out 4             else {                 $postsToPrint = 4;             }                  // Second query for actually printing out posts.                  $args = array (                 'post_type'              => 'mytheme_posttype',                 'post_status'            => 'publish',                 'showposts' => $postsToPrint             );                  $loop = new WP_Query( $args );                  while ( $loop->have_posts() ) : $loop->the_post();                      // print out post thumbnail and some other post data in slider                  endwhile;                  // close slider container HTML              endif;      Thanks!


title: Ajax request with jQuery without WP_ajax

text: I try to made a website in full ajax (a html5 website). I use jquery and innerShiv (for ie). For exemple I want to load all the content of the "section" tag of a page. When I use that script, it works perfectly :               var link = 'http://ajax.wuiwui.net';     $('#new').load(link + ' #contenu');      But when i use this one, I can't find element which aren't into the wordpress loop...               $.ajax({       url: link,       processData: false,       success: function(data){         data = innerShiv(data,false);         var truc = $(data).find('#contenu');         $('#new').append(truc);       }     });      For my project I want to load some elements with only one ajax request, so the second script is more intersting. But it dont work... Do you know why ? My project : http:/ajax.wuiwui.net Thanks a lot for your help !


title: How to change the way wp_embed handles only youtube videos?

text:
What i'm trying to do is have youtube videos show a div when they stop playing. Wordpress replaces youtube links automatically with embed code. Instead I'd like to replace it with something like:               function custom_ytube_embed ($content) {         if (strstr($content,'http://www.youtube.com/embed/')) // see if any youtube embeds available         {             $pattern = "/version=3&rel=1&(.*?)&wmode=transparent'/s"; //param pattern             $count = preg_match_all($pattern, $content, $matches); //find pattern and count matches                  foreach ($matches[0] as $match) {             // replace matched params with new params                      if (is_single()) { //autoplay only on single pages                 $new_param = "autoplay=1&enablejsapi=1&modestbranding=1&rel=0&showinfo=0&iv_load_policy=3&wmode=transparent' id='vidID" . $count . "'";             }             else { //all other pages no auto play                 $new_param = "autoplay=0&enablejsapi=1&modestbranding=1&rel=0&showinfo=0&iv_load_policy=3&wmode=transparent' id='vidID" . $count . "'";             }                  //replace params iframe with new params             $content = str_replace($match, $new_param, $content);             $count--;         }         return $content;          }          else {             return $content; // if not found return it anyway         }     }          function div_wrapper($content) {         // match any iframes         $pattern = '~<iframe.*|<embed.*</embed>~';         preg_match_all($pattern, $content, $matches);              foreach ($matches[0] as $match) {             // wrap matched iframe with div             $wrappedframe = '
' . $match . '
';                  //replace original iframe with new in content             $content = str_replace($match, $wrappedframe, $content);         }              return $content;         }          add_filter('the_content', 'custom_ytube_embed');     add_filter('the_content', 'div_wrapper');      This way i could rely on the youtube api to make the player and i can call a funtion when the player is done playing. Also I need to pull the video id from the post as well. At first I tried remove_filter from the_content of the wpembed all together and then using add_filter to the_content to strip the original post of the youtube link and replace it but that isn't ideal if someone was to post something besides a youtube video and my results didn't go as well as I expected. I know my approach probably isn't ideal as I don't have much experience with wordpress. Any help is gladly appreciated.


title: wp-comment-post.php and header already sent issues

text: I'm new here and I really hope somebody can help me. I've tried alone for many days, found a lot of solutions that worked for others, but that didn't work for me and so I really hope somebody here can help me figure it out. I have the "Guan Image Notes" Plugin installed. I finally got it to work (it seems to interfer with other plugins, especially OpenID and Captcha plugins). However I can't seem to get rid of this error message when somebody sends a comment:               Warning: Cannot modify header information - headers already sent by (output started at /hermes/bos.../wp-content/plugins/guan-image-notes/imageannotation.php:178) in /hermes/bos.../wp-comments-post.php on line 95          Warning: Cannot modify header information - headers already sent by (output started at /hermes/bos.../wp-content/plugins/guan-image-notes/imageannotation.php:178) in /hermes/bos.../wp-comments-post.php on line 96          Warning: Cannot modify header information - headers already sent by (output started at /hermes/bos.../wp-content/plugins/guan-image-notes/imageannotation.php:178) in /hermes/bos.../wp-comments-post.php on line 97          Warning: Cannot modify header information - headers already sent by (output started at /hermes/bos.../wp-content/plugins/guan-image-notes/imageannotation.php:178) in /hermes/bos.../wp-includes/pluggable.php on line 934      The comment is still being sent, though! I tried to modify that line. Wrapping it. The content of that line is:               echo " ";        Here*s the whole code: http://pastebin.com/pu86tyn5 I really hope somebody can help me figure this out. I'm a total beginner when it comes to coding. My website looks horrible right now as I'm still trying out things. If you need to check my website, here it is: click Thanks so much in advance.


title: Nested custom post types with permalinks

text: I am trying to set up a multi-level custom post type structure with permalinks that look like `authors/books/chapters`, with authors, books, and chapters all set up as their own custom post type. For example, a typical URL on this site might look like `example.com/authors/stephen-king/the-shining/chapter-3/` Each chapter can only belong to one book, and each book can only belong to one author. I've considered using taxonomies instead of CPTs for authors and books, but I need to associate metadata with each item and I prefer the post interface for this. I'm most of the way there by simply setting up each custom post as a child of an entry in the CPT one level up. For example, I create "Chapter 3" and assign "The Shining" as a parent using a custom meta-box. "The Shining" in turn has "Stephen King" as a parent. I haven't had any trouble creating these relationships. I'm using rewrite tags in the CPT slugs and the permalinks want to work, but they're not quite right. Using a re-write analyzer, I can see that the rewrite rules are actually generated, but they don't seem to be in the right order and so other rules are processed first. ![Here's a screenshot of my rewrite analyzer.](http://i.stack.imgur.com/1pcbA.png) Here's how I've registered my CPTs:               function cpt_init() {            $labels = array(         'name' => 'Authors'        );            $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,          'show_in_menu' => true,          'query_var' => true,         'rewrite' => array(             'slug' => 'author',             'with_front' => FALSE,         ),         'with_front' => false,         'capability_type' => 'post',         'has_archive' => false,          'hierarchical' => true,         'menu_position' => null,         'supports' => array( 'title', 'editor' )       );             register_post_type('authors',$args);            $labels = array(         'name' => 'Books'       );            $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,          'show_in_menu' => true,          'query_var' => true,         'rewrite' => array(             'slug' => 'author/%authors%',             'with_front' => FALSE,         ),         'with_front' => false,         'capability_type' => 'post',         'has_archive' => false,          'hierarchical' => true,         'menu_position' => null,         'supports' => array( 'title', 'editor' )       );             register_post_type('books',$args);                 $labels = array(         'name' => 'Chapters'        );            $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,          'show_in_menu' => true,          'query_var' => true,         'rewrite' => array(             'slug' => 'author/%authors%/%books%',             'with_front' => FALSE,         ),         'with_front' => FALSE,         'capability_type' => 'post',         'has_archive' => false,          'hierarchical' => true,         'menu_position' => null,         'supports' => array( 'title', 'editor' )       );             register_post_type('chapters',$args);          }          add_action( 'init', 'cpt_init' );      So is there any way to change the priority of my rewrite rules so that authors, books, and chapters are all matched first? I also know that I'm going to have to add a `post_type_link` filter, but that seems secondary to getting the permalinks right in the first place. If anyone knows where I can find a comprehensive overview of how that filter works, it would be appreciated.


title: Grab the first paragraph of each post

text:
I have some code that uses preg_match to grab the first paragraph, and then spit it out in the loop:               function first_paragraph() {       global $post, $posts;       $first_para = '';       ob_start();       ob_end_clean();       $output = preg_match_all('%(
]*>.*?
)%i', $post->post_content, $matches);       $first_para = $matches [1] [0];       echo $first_para;     }      However, there is a little problem with this. It only works when I manually wrap text in `<p> </p>` tags in the editor, and not otherwise. Regular expressions are certainly not my forté, so any help or further understanding would be great. And this works, also wraps the images/iframes in p tags:               function first_paragraph() {       global $post, $posts;       $first_para = '';       ob_start();       ob_end_clean();       $post_content = $post->post_content;       $post_content = apply_filters('the_content', $post_content);       $output = preg_match_all('%(
]*>.*?
)%i', $post_content, $matches);       $first_para = $matches [1] [0];       echo $first_para;     }


title: Sorting by date not working?

text: I have a blog which has worked as normal. I recently moved it to another server by cloning the database and copying all the files. Now my posts are ordered randomly. Where do I start troubleshooting?


title: Show the categories the current post has

text: I have a custom post type; posts of this type can have either one or two categories associated with them. I need to display the names of the categories that are associated with each of these custom posts within the loop. Is there a way to do this?


title: Wordpress as CMS: How to manage/handle images assigned to a post as full-sized background images in a slideshow?

text: I wonder if Wordpress is the best CMS or solution for what I wannt to do? I need to find some way to upload images to a post that I can loop as background images. Just like I can upload multiple images and Wordpress automatically creates a `gallery` I don't want that to happen, but use those images directly (without any thumbnails or whatsoever) and be able to create a javascript slideshow that loops through those images. So actually I probably need some way of creating a javascript array within php when I upload images to a post. And when viewing the post I can then loop through this array with javascript. Any idea how to write a function that does that? However I might need single images inside the post - just no galleries. Ideas on that? Tipps or tricks? Is there probably a plugin out there that does that?


title: Edit Comment_Field while using T5 Comment Textarea On Top-Plugin

text:
I’m using the _T5 Comment Textarea On Top_ -Plugin for the comment_field. I’m a newbie to wordpress. So I don’t know, how can i edit the Style of the comment_field or edit the Label? Usually I would put in the array of comment_form in my comments.php like this:                  'comment_field'        => '
...',      But this only adds another textarea. And then I tried to add a new filter like this:               add_filter( 'comment_form_field_comment', 'my_comment_form_field_comment' );          function my_comment_form_field_comment( $comment_field ) {              $comment_field = '
' . $comment_field . '
';              return $comment_field;     }      ...no changes. Sorry, seems a little bit like Trial’n’Error. Maybe you can help me out. Would be great!


title: Trying to edit a WP site locally using MAMP

text: I'm new to WordPress. A friend asked me to redesign his WP blog and I've installed it on my Mac using MAMP. I went through the database setup and imported the site's existing DB and added the tables. It all looks good, as far as I can tell, on the phpMyAdmin site. When I go to url "localhost" in Chrome (and other browsers) I see the blog's front page, which is definitely local, but if I try to login, I'm sent back online. This also happens if I click on any of the links in the blog. I've check that wp-config.php DB_NAME matches the name of the DB I downloaded. Anyone got any ideas what's going on? Thanks Gavin


title: is_page() conditional not working inside an AJAX function

text: I have a jQuery ui tabs that load posts via ajax on sidebar. Now in a specific page i want to filter the query post via `is_page();` conditional. But in my case its not working.               function load_home_classifieds($type){              $query = array(             'post_type' => 'classified',             'posts_per_page' => 5         );              if(is_page('real-estate')){                 //echo 'ok';                 $query['tax_query'] = array(                                                 array(                                                  'taxonomy' => 'classified-category',                                                  'field' => 'slug',                                                  'terms' => array( 'real-estate' ),                                                 'operator' => 'NOT IN'                                                 )                                        );             }              if($type == 'latest'){                  query_posts($query);             get_template_part('loop', 'cfhome');          }         elseif($type == 'random'){             $query['orderby'] =  'rand';             query_posts($query);             get_template_part('loop', 'cfhome');          }         else{             echo 'Invalid request!';                 }     }      Now, my question is how to get the conditional working inside an ajax function?


title: How to Save Different Usermeta Fields According to User Role?

text: I have created some custom roles using a plugin and I have also created custom user meta fields that are show in the Profile pages of each user (/wp- admin/profile.php) I have a problem with saving the custom fields, I can save the fields ok if I don't change the users' role. So, to give an example:   * User 1 has fields a, b, and c and they have a user role of Pending.   * If I change their user role to Owner, the fields they have are a and b   * If I then change their user role to Pending the details that were in field C disappear It seems that WP is removing it from the database. I want to be able to change the roles and fields without losing the data that is stored in the usermeta database table. I think my problem is with the update_usermeta function.               //saving the user fields     add_action( 'personal_options_update', 'save_user_fields' );     add_action( 'edit_user_profile_update', 'save_user_fields' );          function save_user_fields( $user_id ) {     if ( !current_user_can( 'edit_user', $user_id ) )         return false;     update_usermeta( $user_id, 'unit_type', $_POST['unit_type'] );     update_usermeta( $user_id, 'registered_as', $_POST['registered_as'] );     update_usermeta( $user_id, 'date_registered', $_POST['date_registered'] );     update_usermeta( $user_id, 'unit_number', $_POST['unit_number'] );     update_usermeta( $user_id, 'first_name', $_POST['first_name'] );     update_usermeta( $user_id, 'last_name', $_POST['last_name'] );     update_usermeta( $user_id, 'owner1_address', $_POST['owner1_address'] );     update_usermeta( $user_id, 'owner1_tel_day', $_POST['owner1_tel_day'] );     update_usermeta( $user_id, 'owner1_tel_night', $_POST['owner1_tel_night'] );     update_usermeta( $user_id, 'emergency_contact_name', $_POST['emergency_contact_name'] );     update_usermeta( $user_id, 'emergency_contact_tel_day',     $_POST['emergency_contact_tel_day'] );     update_usermeta( $user_id, 'emergency_contact_tel_night',     $_POST['emergency_contact_tel_night'] );     }


title: how to create a folder in wordpress

text: This is the dilema: I want to install wordpress in the root (regular installation for a wordpress site). Although, I want to have different cities to be available for the user to view the content depending on their choice. Example: 1. I have 2 cities (New York and Miami) 2. User chooses Miami 3. URL path should be: http://www.domain.com/miami/ 4. All information about Miami should be displayed (nothing about New York) When creating pages or post ( I would like to have the choice as an admin to put it on the folder(city) I choose to. Hope I am clear on my dilema. Thank you.


title: What 'function' will 'update' a post?

text: I am using a script to import my vbulletin forum posts into wordpress as posts. One quick issue I ran into is there are numerous forum posts with the same title 'please help me'. When I go into the post edit screen the permalink will show 'please-help-me-2' for the second one, and 'please-help-me-3' for the third one. That is exactly what I expect. However, when you go to **view the second one on the front end of the website** , instead of having the -2 appended to the end of the url, it simply says 'please-help-me'. If I 'update' the post, then the permalink saves properly and the front end link changes like it should. **What I need:** Is there a function that I can use to go through the posts database and have it automatically 'update' all the posts so that the permalinks will change properly on the front end? *we're talking 1.25million posts here, so automation is important. thanks


title: get_post_meta returns 0

text: I am trying to get metadata for a post (of custom post type). I had a look in the database, and the table "wp_postmeta" holds a row with "post_id" = 65, "meta_key" = "name_text" and "meta_value" = "Lars Åkerkvist". I am trying to fetch that value, Lars Åkerkvist, using get_post_meta as below               get_post_meta(65,"name_text",true)      But it always returns a 0. What am i doing wrong here?


title: Buddypress - Send New User Activation Link to Admin

text: How do I send the new user activation link to my own email address instead of the user? Is there a simple function I can use to switch things out?               function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) {          $activate_url = bp_get_activation_page() . "?key=$key";     $activate_url = esc_url($activate_url);     $admin_email  = get_site_option( 'admin_email' );          if ( empty( $admin_email ) )         $admin_email = 'support@' . $_SERVER['SERVER_NAME'];          // If this is an admin generated activation, add a param to email the     // user login details     $email = is_admin() ? '&e=1' : '';          $from_name       = ( '' == get_site_option( 'site_name' ) ) ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );     $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option( 'blog_charset' ) . "\"\n";     $message         = sprintf( __( "Thanks for registering! To complete the activation of your account please click the following link:\n\n%1\$s\n\n", 'buddypress' ), $activate_url . $email );     $subject         = '[' . $from_name . '] ' . __( 'Activate Your Account', 'buddypress' );          // Send the message     $to      = apply_filters( 'bp_core_activation_signup_user_notification_to',   $user_email, $user, $user_email, $key, $meta );     $subject = apply_filters( 'bp_core_activation_signup_user_notification_subject', $subject, $user, $user_email, $key, $meta );     $message = apply_filters( 'bp_core_activation_signup_user_notification_message', $message, $user, $user_email, $key, $meta );          wp_mail( $to, $subject, $message, $message_headers );          do_action( 'bp_core_sent_user_signup_email', $admin_email, $subject, $message, $user, $user_email, $key, $meta );          // Return false to stop the original WPMU function from continuing     return false;      } if ( !is_admin() || ( is_admin() && empty( $_POST['noconfirmation'] ) ) ) add_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_notification', 1, 4 );


title: Post count per (day/month/year) since blog began

text: I'm looking to echo the number of posts per month since the blog began, and for months where there was no posts echo '0'. This is the output I want: January 1, February 3, March 8, April 3, ... Any help would be great. Dave


title: How do i get post thumbnail using attachment code

text: Hi i'm using this code below, which links the title of the post to the first attachment in the post. But how do I change it so that it grabs the thumbnail instead?               <?php       $args = array(     'post_type' => 'attachment',     'numberposts' => -1,     'offset' => 0,     'orderby' => 'menu_order',     'order' => 'asc',     'post_status' => null,     'post_parent' => $post->ID,     );     $attachments = get_posts($args);     if ($attachments) {     foreach ($attachments as $attachment) {         if(wp_attachment_is_image( $attachment->ID )) {     echo 'ID) . '">'. get_the_title() .'';              break;        }      }     }     else {     echo ''. get_the_title() .'';     };     ?>      **EIDT: Just as the title link goes to the attachment page of the first image, i want the thumbnail to do the same.** so instead of `'.get_the_title().'</a>'` i want to get the thumbnail attached to the post.


title: Pagination gives 404 error

text: It's seems that this bug of WP never was solved by WP team. I have custom post-type, my url structure is /%category%/%postname%/ And if i click on 2nd page i will get 404 error. I tried everything i found on internet, plugins, codes.. i even changed my pagination base url to NOT be page, so wp don't think that i'm searching for post-type named page. But still nothing. And yes i did the resave process of permalinks, i've tried restoring to deafault and then go back, still nothing... Downloaded wp_navi still the same.. Is there anything i can do to solve this?


title: Custom post type multiple loop by taxonomy term

text: I would like to create one loop that lists the custom posts for each taxonomy term: Term A: Item Item Item Term B: Item Item Item I would like this to be totally dynamic so if I add a new term it automatically appears. I've seen examples where the taxonomy terms are explicity in the code but I am looking for something lower maintenance and more elegant.


title: WordPress plugin failure with MySQL Error 2013

text: I am using a WordPress plugin, SOLDPress. Two weeks ago, everything in this Real Estate plugins Search feature worked properly. This past week, the plugin has started failing with the following error 2013 Lost connection to MySQL server during query. The website is hosted by Go Daddy on one of their virtual machines. The exact same configuration on my development system, hosted by Host Papa works all the time. My plugin developer gave me the following SQL query to execute using phphMyAdmin, in the cPanel, and he was as surprised as I that it also failed. We felt that without all the other overhead it woudl work but I got the same error as above, 19 times out of 20. That means it succeeded once. If anyone could offer some troubleshooting tips and ideas and suggestions I thank you.               SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)     INNER JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id) WHERE 1=1 AND wp_posts.post_type = 'sp_property' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') AND ( (wp_postmeta.meta_key = 'dfd_ListPrice' AND CAST(wp_postmeta.meta_value AS SIGNED) > '0')     AND (mt1.meta_key = 'dfd_ListPrice' AND CAST(mt1.meta_value AS SIGNED) BETWEEN '0' AND '900000') ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 12


title: Show only grandchild pages with get_pages

text:
I've been struggling with a problem where I need to display the content of child and grandchild pages within a page. Currently I have               <?php $mypages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc&parent='.$post->ID);                    foreach( $mypages as $page ) {                   $content = $page->post_content;             if ( ! $content ) // Check for empty page             continue;                  $content = apply_filters( 'the_content', $content ); ?>
<?php echo $page->post_title; ?>

<?php echo $content; ?>

                 <?php $mypages = get_pages( array( 'meta_key' => 'rule', 'hierarchical' => 0 ) );                 foreach( $mypages as $page ) {                           $content = $page->post_content;                     if ( ! $content ) // Check for empty page                         continue;                          $content = apply_filters( 'the_content', $content ); ?>

<?php echo $page->post_title; ?>

<?php echo $content; ?>
                      <?php                     }                    ?>
             <?php                 }                ?>      However This simply brings back all the grandchild pages with the custom field of "rule" under all the child pages. So ideally I'd like to be able to bring back only the grand child pages within each child page, but I can't figure out the code. I have tried several variations on               $mypages = get_pages( array( 'meta_key' => 'rule', 'hierarchical' => 0 ) );      trying out `'parent' =>` etc, but no joy. I have also tried a plug in (Post Tags and Categories for Pages) that adds the category and tags to pages as the name would suggest, but I can't seem to hook into that with `'category' =>` as you would with pages. Incidentally, I'm trying to avoid using a page specific ID as there always the possibility that this may change in the future or a new page may be added.


title: Image cannot be loaded. Make sure the path is correct and image exist

text: I have an online shop. All the latest product images I have uploaded can be seen. However, when I click on the image to enlarge it I get the above message message. I have manage to change it on one product but forgot how I did it... Can anyone help? Here is an example link where the image can be enlarged http://www.handddiamonds.co.uk/shop/1-00ct-pave-semi-set-diamond-ring-3-2/ and one when it cannot http://www.handddiamonds.co.uk/shop/1-00ct-pave-semi-set- diamond-ring-2-2/


title: MySQL Query that looks for post with Custom Field, then changes Category

text:
I'm looking for a MySQL Query that will look for all the posts with custom field "meta_key_I_want_to_find", then if the custom field is detected, add a category to that post. The category has already been created, so I just need to find all of the posts with that Meta_key and then add the category to them. I was thinking something along the lines of this:                   <?php         $username="MY_MYSQL_USERNAME";         $password="MY_MYSQL_PASSWORD";         $hostname="MY_DATABASE_HOSTNAME"; //Your Database hostname usually         $database="MY_DATABASE_NAME";         $my_text = "meta_key_I_want_to_find";  // What I'm searching for         $my_category = '8';    // The category to add it to              // Connect to MySQL and the database and verify:         mysql_connect($hostname,$username,$password) or die(mysql_error());              echo "
Connected to MySQL.";         mysql_select_db($database) or die(mysql_error());         echo "
Connected to " . $database . "
";              // Verify what we're looking for, for troubleshooting:         echo "
Looking for " . $my_text . "
";              // Get the ID field (which is WordPress's post         // number) from any posts that have your text:         $query = "SELECT ID FROM wp_posts WHERE post_content LIKE '%$my_text%'";               // Take those results and go through them:         $result = mysql_query($query) or die(mysql_error());              // While there are results...         while($row = mysql_fetch_array($result))         {         // Verify what we're doing -- changing post         // number such-and-such...         $thisPostHasIt = $row['ID'];         echo "
Row " . $row['ID'] . " contains it, so...
";              // In the wp_term_relationships table,         // update the category number ("term_taxonomy_id")         // with the category number you specified -- but only         // in one of the "result" rows.         // We look for "object_id" to equal one of those         // rows. (The object_id field refers to the WordPress         // post number, just as the ID field did. Why two         // different names? Who knows?)              mysql_query("UPDATE wp_term_relationships SET term_taxonomy_id='$my_category' WHERE object_id = '$thisPostHasIt'");              // And tell us about it:         echo "Changing post number " . $thisPostHasIt . " to category number ". $my_category . "
";         }         echo "
All done!
";          //found on http://wordpress.org/support/topic/mysql-query-to-search-posts-and-change-categories     ?>      ...only instead of looking for a string and replacing it, I need to be able to find all posts with a certain meta_key and then add a category to that. Any suggestions are much appreciated!


title: Object params keeps getting turned into string?

text: I'm new to PHP/Wordpress and I'm using the JSON API plugin. I'm passing some params to a JSON endpoint using javascript. The params I'm passing is an object and looks something like this:               var paramsObj = {       meta_query: {         '0' : {           key: 'user',           value: 123         },         '1' : {           key: 'division',           value: 'championship'         }       }     };      However paramsObj keeps getting turned into string like so when I check my api json:               "{"0":{"key":"user","value":"123"},"1":{"key":"division","value":"chapionship"}}"      How do I stop this from happening and have paramsObj remain as a PHP array? Thanks!


title: Wordpress permalinks on subfolder in iis7 not working

text: I have IIS 7.5. mod rewrite active. Currently, my wp site is inside subfolder. Here is web.config in my root folder :               <rewrite>     <rules>     <rule name="site2.com" stopProcessing="true">     <match url=".*" />     <conditions>     <add input="{HTTP_HOST}" pattern="^(www.)?site2.com" />     <add input="{PATH_INFO}" pattern="^/site2/" negate="true" />     </conditions>     <action type="Rewrite" url="\site2\{R:0}" />     </rule>     </rules>     </rewrite>      While in my wp site:               <?xml version="1.0" encoding="UTF-8"?>     <configuration>     <system.webServer>     <rewrite>     <rules>     <rule name="wordpress" patternSyntax="Wildcard">     <match url="*" />     <conditions>     <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />     </conditions>     <action type="Rewrite" url="index.php" />     </rule></rules>     </rewrite>     </system.webServer>     </configuration>      It seems my main web.config is not working to accomodate permalink in my wp site. Is anyone have solutions?


title: Showing custom taxonomy column in taxonomy category listings immediately after create category

text: I add my custom taxonomy column with this code:               function manage_my_category_columns($columns)         {          if ( !isset($_GET['taxonomy']) || $_GET['taxonomy'] != 'products' )          return $columns;          $columns['image_column'] = 'Image';          return $columns;     }     add_filter('manage_edit-products_columns','manage_my_category_columns');          function manage_category_custom_fields($deprecated,$column_name,$term_id){          if ($column_name == 'image_column') {            $t_id = $term_id;            $cat_meta = get_option( "products_$t_id");            echo "<img src='".$cat_meta['img']."' style='height:50px;width:50px;'/>";               }         }     add_action('manage_products_custom_column','manage_category_custom_fields',10,3);      When I add new category, custom column not shown immediately after create: ![enter image description here](http://i.stack.imgur.com/wtbqr.png) After page refresh the custom column will be shown: ![enter image description here](http://i.stack.imgur.com/QfDxO.png) Is there any way to show custom column with default columns immediately after create new category?


title: how to display custom fields of post on a web page

text: I want to ask that how can i dispaly custom field of a post on a web page . I have used get_post_meta but it resulted in just an array .i cant figure out what is the problem


title: How to create a second posts page which client can update

text: Bit of a wordpress novice and so just wanted to know the best way to do this. I am currently creating a wordpress site for a client. They have a Latest News section which is the primary 'blog'/posts page. The sidebar also displays the latest blog post. Now what I would like to do is create a Special Offers page, which works the same as the blog post page, displaying the latest offers, and which the client can update easily through the admin. I would also like to feature the latest special offer in the sidebar. What would be the best way to do this, as I am assuming you can only have one main posts page? Any help would be greatly appreciated. Thanks


title: WP-eComerce Advance Meta Tag data in descending order

text: I am use WP-Ecommerce plugins for ecommerce support Now i am set custom meta like this ![enter image description here](http://i.stack.imgur.com/UcJVx.png) and it will display in ascending order like this ![enter image description here](http://i.stack.imgur.com/KrDKR.png) so i need to display it in descending order how can i do this? please help me. Thanks in advance.


title: Solutions for generating dynamic javascript / CSS

text: Let's say you need to generate javascript or CSS code that depends on the current context. For example you have a form on the homepage that fires an ajax request on submit, and a different form on the single page. Or in the case of CSS, you want to create a theme that allows its users to build their own layout, change colors etc. Solutions I see so far:   1. Include the code in the head section of the document (or at the end in case of JS)   2. Do a special request that outputs the code, like _site.com?get_assets_. This is slow because WP gets loaded twice.   3. Store it in temporary files for a certain amount of time, and load it from there. Not very reliable for public themes or plugins.   4. Javascript only - make it static by putting it into a normal file that gets loaded every time. In this case you would have to make your code handle any situation Do you know others? Which way would you go?


title: How to add first name, last name and company name to my custom registration form

text:
I´m trying to add first name, last name and company name to my custom registration page. The registration form almost works, but there is a problem. So far I´ve got this code, but I cant get the first name, last name and company name registered. Can anyone help me out please?               <?php if(!is_user_logged_in()) { ?>               <?php     if(get_option('users_can_register')) {     //Check whether user registration is enabled by the administrator     ?>          <?php          if($_POST)              {         //We shall SQL escape all inputs         $username = $wpdb->escape($_REQUEST['username']);         if(empty($username)) {             echo "ERROR... please type username";             exit();         }         $email = $wpdb->escape($_REQUEST['email']);         if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/", $email)) {             echo "ERROR... please valid email";             exit();         }         $first_name = $wpdb->escape($_REQUEST['first_name']);         if(empty($first_name)) {             echo "ERROR... please add first name";             exit();         }         $last_name = $wpdb->escape($_REQUEST['last_name']);         if(empty($last_name)) {             echo "ERROR... please add last name";             exit();         }         $companyname = $wpdb->escape($_REQUEST['companyname']);         if(empty($companyname)) {             echo "ERROR... please add company name";             exit();         }                                  $pass1 = $wpdb->escape($_REQUEST['pass1']);     $pass2 = $wpdb->escape($_REQUEST['pass2']);     if ($pass1 != $pass2){         echo "ERROR... password's does'nt mach";             exit();          }     $random_password = $pass1;         $status = wp_create_user( $username, $random_password, $email );         if ( is_wp_error($status) )             echo "ERROR... username allready exist's";         else {             $from = get_option('admin_email');             $headers = 'Fra: '.$from . "\r\n";             $subject = "Registreringen er fullført";             $msg = "Hi, you are now registered. Here is your username and password:\n\n$username\n$random_password";             wp_mail( $email, $subject, $msg, $headers );             echo "Thank you for registering. You can now log inn.";         }              exit();          } else {     //Embed the register form and javascript here          ?>

               <form id="wp_signup_form" action="" method="post">
     Username:
     <input type="text" name="username" style="width:350px; margin-bottom:3px;">

     First name:
     <input type="text" name="first_name" id="first_name" style="width:350px; margin-bottom:3px;">

     Last name:
     <input type="text" name="last_name" id="last_name" style="width:350px; margin-bottom:3px;">

     Companyname:
     <input type="text" name="companyname" id="companyname" style="width:350px; margin-bottom:3px;">

     E-mail
     <input type="text" name="email" style="width:350px; margin-bottom:3px;">

     Password:
     <input id="password" class="input" type="password" value="Passord" name="pass1" style="width:350px; margin-bottom:3px;" />

     Repeat password:
     <input id="repeat_password" class="input" type="password" name="pass2" style="width:350px; margin-bottom:3px;" />

          <input type="submit" id="submitbtn" name="submit" value="Register" class="knapp" style="padding:8px;">     </form>          <?php     // embedded          }     ?>          <?php         }          else      ?>
     <?php } else { ?>     You are allready registered and logged inn. <a href="<?php bloginfo('url'); ?>/profilside">Click here to load your profilepage.     <?php } ?>


title: Creating a custom multilingual form

text: I need to create a special form for my website where users cand specify a series of data including some textfields, combo boxes and sliders (from 0 to 100). Also I need this form to be qTranslate compatible, for my website is multilingual. What would be the easiest, cheapest approach for this? I tried the lite version of Ninja Forms plugin but it offers very few form element types. I also started creating my own template with the form elements but I don't know how to make it work with qTranslate. And I'm thinking this solution is maybe reinventing the wheel and there's a fastest approach than programming it myself.


title: wordpress before or after javascript problem

text: hi guys im aqeel im trying to implement a slide show in a wordpress site's home page but it not working it simply contains the `easyslider1.5.js` file which i put in js folder css which of course in css folder. Then i used               wp_register_script( 'slides', get_bloginfo('template_url')."/js/easySlider1.5.js" );     wp_enqueue_script('slides');      not worked then               <script src="<?php echo get_template_directory_uri(); ?>/js/easySlider1.5.js" type="text/javascript"></script>      i also used it with `get_bloginfo()` but did not work .... okay i am using them before               wp_head();      and the `jquery` code               <script type="text/javascript">       $(document).ready(function(){          $("#slider").easySlider({              auto: true,              continuous: true          });        });       </script>      and using it after `wp_head();` but slide show is not working..... i am working on a project n i really need your help guys.


title: How to style a specific nav menu item?

text: I have a site, which now have a new registration form and I want to highlight it by blinking the menu item. you can see the site here. I wan to blink "Registration for seminar" item. I am using Polyon theme. How can I do that?


title: Get URL from shortcode tag

text: I am running a wordpress site and I need the correct regex syntax to get a URL from some shortcode that is returned inside the_content(). When I use the_content(), it will return something like this:               Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nulla enim, euismod ut pharetra nec, commodo a augue. Etiam sit amet nibh mauris, eu ornare purus. Vestibulum sed sem enim, sit amet congue leo.           [video mp4=<<insert video url here>> poster=<<insert imgae placeholder url>>]      How can I get just the video mp4 URL?


title: Current path on page in functions.php

text: How can I get the current path of my page? I know how to do it inside a template file, but I need it inside `functions.php`. And it has to be before the `send_headers` hook, because I'll use this info to set a cookie. I tried using PHP, but I'm getting `/wp-admin`


title: Multiple Content Block

text: I'm trying to create a custom post type and would like that post type to have two content blocks. So that in the loop I can ask for content-1 and content-2 separately. I can write the code just having the hard time figuring out how I should start, i.e., is there a way to add another "post content" block easily. Should I remove the existing content block and use two custom fields (can custom fields have the Kitchen Sink?)? Thanks!


title: How to set the captcha at the bottom of comments textarea

text: Hii I am new to word press. I have downloaded BotDetect captcha. It works finely. But currently it appears just above the comments text area. How can it be set at the bottom of comments text area.Can you help me??please


title: Displaying additional meta from a custom post type on the page?

text: I have added the custom field which displays in the custom post type "portfolio" just fine.               // Add more custom field         function woo_metaboxes_add($woo_metaboxes) {                  // Check for post type = portfolio             if ( get_post_type() == "portfolio" || !get_post_type() ) {                      $woo_metaboxes['custom_field'] = array (  "name" => "custom",                                             "label" => "Custom field",                                             "type" => "text",                                             "desc" => "description");                  }                    return $woo_metaboxes;              }      I can save the data in the "portfolio" custom post type, no issues there. The problem I'm having is displaying of the data on the page.. I'm currently using:   `<?php echo get_post_meta($post->ID, 'custom_field', $single = true); ?>`   within the loop through portfolio items (each portfolio item is a custom post). I can't get the text I entered in the custom field to show up on the page. Any ideas?


title: How to get the site administrator/s by blog id

text: I wanted to display the site administrator/s not super administrator by blog id. Which outputs the site admin id and avatar. How to accomplish this?


title: how to do logout redirect to current url

text: I'm using custom menu for `login/logout` here below is my code:               <?php        if(is_user_logged_in()) {           $user = wp_get_current_user();           echo 'Welcome '.$user->user_firstname.'       | <a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout';        } else { ?>           <?php wp_loginout(); ?>           or <a href="<?php bloginfo('url') ?>/wp-login.php?action=register">     Register     <?php } ?>      but problem is :   1. redirect to 404 page not current page...   2. I want to add user gavatar if he/she logged in Any help greatly appreciated.


title: Add AJAX "Load more" on custom query block

text:
I have a `index,php` with various `new WP_Query` all working ok, but in this block I need to implement that "AJAX thing people love - the load more posts":
Latests articles <?php bp_site_name(); ?>
             <?php        $destaque = get_term_by('slug', 'destaque', 'post_tag');        $video = get_term_by('slug', 'video', 'post_tag');             $nd_query = new WP_Query (array('tag__not_in' => array($destaque->term_id, $video->term_id), 'posts_per_page' => 5, 'paged' =>$paged));        while ($nd_query->have_posts()) : $nd_query->the_post(); ?>             <span class="box-excerpt" id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?>
                     <?php endwhile; ?>      Tought this was simple but I can't even figure out how to set a pagination in this block. If there's anything than AJAX let me know. **NOte!** I'm modifying an BuddyPress theme, that came with some AJAX, maybe is there smeway to re-use things.


title: How to find out which function is causing a 404

text: So I am trying to upgrade a WordPress project and for one section I get the 404 instead of seeing a product page. I looked around and tried adding this to my `functions.php`                   add_action('wp_head', 'show_template');         function show_template() {             global $template;             print_r($template);         }      but on the top it just shows me `wordpress-3.5.2/wp- content/themes/mytheme/404.php`. Can anyone teach me how to trace the error? WP_DEBUG_LOG does have a few depracations and stuff but I'm not sure if that's relevant... Is there a systematic way to trace which function is responsible for this? I'll paste what WP_DEBUG shows just in case: > Notice: Undefined index: HTTPS in > /Users/emai/Documents/wordpress_projects/mytheme/wordpress-3.5.2/wp- > content/plugins/audio-player/audio-player.php on line 127 > > Notice: Undefined index: SERVER_PORT_SECURE in > /Users/emai/Documents/wordpress_projects/mytheme/wordpress-3.5.2/wp- > content/plugins/audio-player/audio-player.php on line 127 > > Warning: session_start() [function.session-start]: Cannot send session cache > limiter - headers already sent (output started at > /Users/emai/Documents/wordpress_projects/mytheme/wordpress-3.5.2/wp- > content/plugins/audio-player/audio-player.php:127) in > /Users/emai/Documents/wordpress_projects/mytheme/wordpress-3.5.2/wp- > content/plugins/wp-e-commerce/wpsc-core/wpsc-constants.php on line 17 > > Notice: add_custom_background is deprecated since version 3.4! Use > add_theme_support( 'custom-background', $args ) instead. in > /Users/emai/Documents/wordpress_projects/mytheme/wordpress-3.5.2/wp- > includes/functions.php on line 2841 > > Notice: add_custom_image_header is deprecated since version 3.4! Use > add_theme_support( 'custom-header', $args ) instead. in > /Users/emai/Documents/wordpress_projects/mytheme/wordpress-3.5.2/wp- > includes/functions.php on line 2841 > > Notice: Undefined index: /js/js_gallery/jquery-1.6.1.min.js in > /Users/emai/Documents/wordpress_projects/mytheme/wordpress-3.5.2/wp- > includes/class.wp-scripts.php on line 163 > > Notice: Trying to get property of non-object in > /Users/emai/Documents/wordpress_projects/mytheme/wordpress-3.5.2/wp- > includes/class.wp-scripts.php on line 163 > /Users/emai/Documents/wordpress_projects/mytheme/wordpress-3.5.2/wp- > content/themes/mytheme/404.php


title: Is it possible to pull and display a single landscape oriented image

text: I wanted to know if this is possible. I have gone through a lot of threads on the internet for this one and there does not seem to be one good solution. I run a business website based on wordpress and now there is this peculiar requirement wherein I need a hack/code to pull and display one single image ( from among the other images uploaded/attached to that post ). Now the tricky part is that the image must be a horizontally/landscape oriented image only. And if it does not find a landscape image it may return nothing. Please let me know if need more clarifications. If you must know, I already have a featured image.


title: Post thumbnail to append post content via ajax click event

text:
I've searched hi and dry, tried various tutorials but I just cant get anything to work and its been a good 3 weeks now :( I have a loop that displays custom post thumbnails in a grid using this jquery script I'm trying to make these thumbnail call an ajax event along with a nonce for security as per this ajax tutorial . I just can't seem to find a clear way of doing it as there just isn't one tutorial that implements this clearly. I'm not sure which part of the thumbnail (href/id/slug!?!?) I need to send along with my ajax call to display the correct post content in a new div. There are lots of themes out there that do this of course and after purchasing 2 they both don't use the `ajax-admin.php` or nonces to do the request and I really want to learn how to do it like that as from what I've read its much better practice. I'm pretty sure that where I'm failing is in the jQuery as all the WordPress script in my `functions.php` and `index.php` are carbon copies of the code from the ajax tutorial mentioned above. If anyone has a working example or pointers to good tutorials that would be great. I'm able to connect to the database (checked in firebug) but I don't know how via a click so my guess is thats its in the jquery side of things! A snippet of my current code where I think changes might be made:               function showPreview( $item ) {              var preview = $.data( this, 'preview' ),             // item´s offset top             position = $item.data( 'offsetTop' );              scrollExtra = 0;              // if a preview exists and previewPos is different (different row) from item´s top then close it         if( typeof preview != 'undefined' ) {                  // not in the same row             if( previewPos !== position ) {                 // if position > previewPos then we need to take te current preview´s height in consideration when scrolling the window                 if( position > previewPos ) {                     scrollExtra = preview.height;                 }                 hidePreview();             }             // same row             else {                 preview.update( $item );                 return false;             }              }              // update previewPos         previewPos = position;         // initialize new preview for the clicked item         preview = $.data( this, 'preview', new Preview( $item ) );         // expand preview overlay         preview.open();          }          function hidePreview() {         current = -1;         var preview = $.data( this, 'preview' );         preview.close();         $.removeData( this, 'preview' );     }          // the preview obj / overlay     function Preview( $item ) {         this.$item = $item;         this.expandedIdx = this.$item.index();         this.create();         this.update();     }          Preview.prototype = {         create : function() {             // create Preview structure:             this.$title = $( '

' );             this.$description = $( '

' );             this.$href = $( 'Visit website' );             this.$details = $( '

' ).append( this.$title, this.$description, this.$href );             this.$loading = $( '

' );             this.$fullimage = $( '

' ).append( this.$loading );             this.$closePreview = $( '' );             this.$previewInner = $( '

' ).append( this.$closePreview, this.$fullimage, this.$details );             this.$previewEl = $( '

' ).append( this.$previewInner );             // append preview element to the item             this.$item.append( this.getEl() );             // set the transitions for the preview and the item             if( support ) {                 this.setTransition();             }         },                        update : function( $item ) {                  if( $item ) {                 this.$item = $item;             }                  // if already expanded remove class "og-expanded" from current item and add it to new item             if( current !== -1 ) {                 var $currentItem = $items.eq( current );                 $currentItem.removeClass( 'og-expanded' );                 this.$item.addClass( 'og-expanded' );                 // position the preview correctly                 this.positionPreview();             }                  // update current value             current = this.$item.index();                  // update preview´s content             var $itemEl = this.$item.children( 'a' ),                 eldata = {                     href : $itemEl.attr( 'href' ),                     largesrc : $itemEl.data( 'largesrc' ),                     title : $itemEl.data( 'title' ),                     description : $itemEl.data( 'description' )                 };                  this.$title.html( eldata.title );             this.$description.html( eldata.description );             this.$href.attr( 'href', eldata.href );                  var self = this;                  // remove the current image in the preview             if( typeof self.$largeImg != 'undefined' ) {                 self.$largeImg.remove();             }                  // preload large image and add it to the preview             // for smaller screens we don´t display the large image (the media query will hide the fullimage wrapper)             if( self.$fullimage.is( ':visible' ) ) {                 this.$loading.show();                 $( '' ).load( function() {                     var $img = $( this );                     if( $img.attr( 'src' ) === self.$item.children('a').data( 'largesrc' ) ) {                         self.$loading.hide();                         self.$fullimage.find( 'img' ).remove();                         self.$largeImg = $img.fadeIn( 850 );                         self.$fullimage.append( self.$largeImg );                     }                 } ).attr( 'src', eldata.largesrc );              }              },                   open : function() {                  setTimeout( $.proxy( function() {                    // set the height for the preview and the item                 this.setHeights();                 // scroll to position the preview in the right place                 this.positionPreview();             }, this ), 25 );              },                   close : function() {                  var self = this,                 onEndFn = function() {                     if( support ) {                         $( this ).off( transEndEventName );                     }                     self.$item.removeClass( 'og-expanded' );                     self.$previewEl.remove();                 };                  setTimeout( $.proxy( function() {                      if( typeof this.$largeImg !== 'undefined' ) {                     this.$largeImg.fadeOut( 'fast' );                 }                 this.$previewEl.css( 'height', 0 );                 // the current expanded item (might be different from this.$item)                 var $expandedItem = $items.eq( this.expandedIdx );                 $expandedItem.css( 'height', $expandedItem.data( 'height' ) ).on( transEndEventName, onEndFn );                      if( !support ) {                     onEndFn.call();                 }                  }, this ), 25 );                  return false;              }      and the ajax code I'd like inserted and implemented instead of appending the content via inline html               function ajaxloadpost_loadpost(postid,nonce) {     jQuery.ajax({         type: 'POST',         url: ajaxloadpostajax.ajaxurl,         data: {             action: 'ajaxloadpost_ajaxhandler',             postid: postid,             nonce: nonce         },         success: function(data, textStatus, XMLHttpRequest) {             var loadpostresult = '#loadpostresult';             jQuery(loadpostresult).html('');             jQuery(loadpostresult).append(data);         },         error: function(MLHttpRequest, textStatus, errorThrown) {             alert(errorThrown);         }     });      }


title: read more, even if excerpt not trimmed

text: I am using the excerpt field (Not the tag, because the excerpt also serves as a lead paragraph). I altered the "more"-link to be an arrow >.               function fabs_excerpt_more( $more ) {         return ' >';     }     add_filter( 'excerpt_more', 'fabs_excerpt_more' );      But it only appears, if the excerpt is trimmed down. I also tried this:               function fabs_excerpt_more($output) {      global $post;      return $output . 'ID) . '">>';     }     add_filter( 'the_excerpt', 'fabs_excerpt_more' );      In that case the > appears for every excerpt, but after the closing p-tag. Is there a way to let it appear directly after the last word?


title: Multisite Â&nbsp wrong encoding problem

text: After I upgraded multisite system from 3.5 to 3.5.1, I started having a weird encoding problem - all `&nbsp` are rendered as `Â&nbsp`. All of my pages (as well as the DB entries) are UTF-8 encoded. All the meta tags on the pages are (automatically) set to               <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">      However, when I view the page, some of the characters are incorrectly displayed. Upon further examination of the request headers, it turned out that the server is setting the encoding to ISO-8859-1. The problem seems to be that on the base website (www.blabla.com), my               <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">      has no effect on the browser, even with `AddDefaultCharset utf-8` set in `.htaccess` - the response header still says               Content-Type:text/html; charset=iso-8859-1      However, on the very same install and with the same settings, my sub-directory website (www.blabla.com/sub) gets the response header as               Content-Type:text/html; charset=UTF-8      Changing to a different theme (TwentyTwelve) temporarily, switching off all the plugins does not solve the issue.


title: TCPDF and permalinks

text: I am currently using a post to pdf plugin 'Hacklog down as pdf' which works ok. I've used it before in a current working environment. It suddenly stopped working but I have found out that when changing my permalink structure to the default '?p=5463', for example, it works perfectly. It stops working when I switch back to the custom structure `/%category%/%postname%/`. Since I must keep it this way, I am wondering if anyone has any suggestions on how I might get around this problem. I believe that since the plugins uses `/generate.php?id=5463` to generate pdfs it may be be expecting the id but in fact being passed the permalink structure causing the error. Could a solution be with my .htaccess file? Ideas would be much appreciated! **ERROR message:** `No webpage was found for the web address:` `../plugins/down-as-pdf/generate.php?id=35130` `Error 6 (net::ERR_FILE_NOT_FOUND): The file or directory could not be found.`


title: Clearfix Shortcode

text: A client of mine has been having trouble placing images on a page of her WordPress site. The page is to have an image (left aligned) with some text on the right, then another image with some text on the right, etc. Unfortunately when the text is shorter than its image, the following image is placed to the right of the first image, which makes the layout quite a jumble. She's using the visual editor, and has difficulty with the text editor, so adding `class="clearfix"` (referencing the usual `after:` clearfix hack[1] in `styles.css`) to the last paragraph before the succeeding image was not going to work for her. So I undertook adding a clearfix shortcode for my client's convenience. (Answer to come.) * * * [1]: Cf. http://css-tricks.com/all-about-floats/, also see http://perishablepress.com/lessons-learned-concerning-the-clearfix-css-hack/


title: Limit to add one post per category only

text: What is the best way to implement a site that has one post per category only? The structure of the site is that it has an "About", "Services", "Bio" etc. Per custom post types or per categories?


title: Where should I use get_option in a plugin

text: I am working on creating a plugin to help me with future development projects. I want to make sure what I am using best practices when I write it. My question is about the use of get_option in my plugin. I have setup an options page for the plugin and have set a couple options there. Is it better to check the option on the add_action step or with the function that is being added. I have written up a short example to help illustrate my question. Thanks!               if ( get_option('my_option[option_1]') ==='1' ) {       add_action('init', 'my_action')     }      or               add_action('init', 'my_action');     function my_action() {       if ( get_option('my_option[option_1]') ==='1' ) {         //do stuff here       }      My thoughts are that if I check get_option first then I can set it as a var in my plugin and then just check the var anytime I need it. But as I said I am new to plugin development so I don't fully understand the best way to use get_option. Thanks!


title: first load of the page gives 404 error

text: I'm having problem loading the page first time on my browser. For example if I load the page from a link it gives me 404 error but when I refresh the page It works perfectly. Any ideas on how to solve this issue?


title: How can I show a .swf file?

text: What is an easy way to show an `.swf` file in my homepage? I have uploaded the `.swf` file in my uploads directory but I cannot show it via simple directive. What should I do to make it working?


title: New User Registration email

text: I am receiving an email notification whenever a new user is added to my site. I need to change the default 'send-to' address. It is using a personal email, rather than my 'webmaster' email. Where is the setting for this?


title: Permalinks not working

text: I know, asked and answered a million times. For the life of me I can't find my error. Trying to set up Permalinks to use post name, /%postname%/ Trying to visit anywhere else other than the homepage yields a 404 error. Default permalink setting works fine. any help would be greatly appreciated. .htaccess in web root                   # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      httpd.conf file in /etc/apache2               #     # This is the main Apache HTTP server configuration file.  It contains the     # configuration directives that give the server its instructions.     # See <URL:http://httpd.apache.org/docs/2.2> for detailed information.     # In particular, see      # <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>     # for a discussion of each configuration directive.     #     # Do NOT simply read the instructions in here without understanding     # what they do.  They're here only as hints or reminders.  If you are unsure     # consult the online docs. You have been warned.       #     # Configuration and logfile names: If the filenames you specify for many     # of the server's control files begin with "/" (or "drive:/" for Win32), the     # server will use that explicit path.  If the filenames do *not* begin     # with "/", the value of ServerRoot is prepended -- so "log/foo_log"     # with ServerRoot set to "/usr" will be interpreted by the     # server as "/usr/log/foo_log".          #     # ServerRoot: The top of the directory tree under which the server's     # configuration, error, and log files are kept.     #     # Do not add a slash at the end of the directory path.  If you point     # ServerRoot at a non-local disk, be sure to point the LockFile directive     # at a local disk.  If you wish to share the same ServerRoot for multiple     # httpd daemons, you will need to change at least LockFile and PidFile.     #     ServerRoot "/usr"          #     # Listen: Allows you to bind Apache to specific IP addresses and/or     # ports, instead of the default. See also the <VirtualHost>     # directive.     #     # Change this to Listen on specific IP addresses as shown below to      # prevent Apache from glomming onto all bound IP addresses.     #     #Listen 12.34.56.78:80     Listen 80          #     # Dynamic Shared Object (DSO) Support     #     # To be able to use the functionality of a module which was built as a DSO you     # have to place corresponding `LoadModule' lines at this location so the     # directives contained in it are actually available _before_ they are used.     # Statically compiled modules (those listed by `httpd -l') do not need     # to be loaded here.     #     # Example:     # LoadModule foo_module modules/mod_foo.so     #     LoadModule authn_file_module libexec/apache2/mod_authn_file.so     LoadModule authn_dbm_module libexec/apache2/mod_authn_dbm.so     LoadModule authn_anon_module libexec/apache2/mod_authn_anon.so     LoadModule authn_dbd_module libexec/apache2/mod_authn_dbd.so     LoadModule authn_default_module libexec/apache2/mod_authn_default.so     LoadModule authz_host_module libexec/apache2/mod_authz_host.so     LoadModule authz_groupfile_module libexec/apache2/mod_authz_groupfile.so     LoadModule authz_user_module libexec/apache2/mod_authz_user.so     LoadModule authz_dbm_module libexec/apache2/mod_authz_dbm.so     LoadModule authz_owner_module libexec/apache2/mod_authz_owner.so     LoadModule authz_default_module libexec/apache2/mod_authz_default.so     LoadModule auth_basic_module libexec/apache2/mod_auth_basic.so     LoadModule auth_digest_module libexec/apache2/mod_auth_digest.so     LoadModule cache_module libexec/apache2/mod_cache.so     LoadModule disk_cache_module libexec/apache2/mod_disk_cache.so     LoadModule mem_cache_module libexec/apache2/mod_mem_cache.so     LoadModule dbd_module libexec/apache2/mod_dbd.so     LoadModule dumpio_module libexec/apache2/mod_dumpio.so     LoadModule reqtimeout_module libexec/apache2/mod_reqtimeout.so     LoadModule ext_filter_module libexec/apache2/mod_ext_filter.so     LoadModule include_module libexec/apache2/mod_include.so     LoadModule filter_module libexec/apache2/mod_filter.so     LoadModule substitute_module libexec/apache2/mod_substitute.so     LoadModule deflate_module libexec/apache2/mod_deflate.so     LoadModule log_config_module libexec/apache2/mod_log_config.so     LoadModule log_forensic_module libexec/apache2/mod_log_forensic.so     LoadModule logio_module libexec/apache2/mod_logio.so     LoadModule env_module libexec/apache2/mod_env.so     LoadModule mime_magic_module libexec/apache2/mod_mime_magic.so     LoadModule cern_meta_module libexec/apache2/mod_cern_meta.so     LoadModule expires_module libexec/apache2/mod_expires.so     LoadModule headers_module libexec/apache2/mod_headers.so     LoadModule ident_module libexec/apache2/mod_ident.so     LoadModule usertrack_module libexec/apache2/mod_usertrack.so     #LoadModule unique_id_module libexec/apache2/mod_unique_id.so     LoadModule setenvif_module libexec/apache2/mod_setenvif.so     LoadModule version_module libexec/apache2/mod_version.so     LoadModule proxy_module libexec/apache2/mod_proxy.so     LoadModule proxy_connect_module libexec/apache2/mod_proxy_connect.so     LoadModule proxy_ftp_module libexec/apache2/mod_proxy_ftp.so     LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so     LoadModule proxy_scgi_module libexec/apache2/mod_proxy_scgi.so     LoadModule proxy_ajp_module libexec/apache2/mod_proxy_ajp.so     LoadModule proxy_balancer_module libexec/apache2/mod_proxy_balancer.so     LoadModule ssl_module libexec/apache2/mod_ssl.so     LoadModule mime_module libexec/apache2/mod_mime.so     LoadModule dav_module libexec/apache2/mod_dav.so     LoadModule status_module libexec/apache2/mod_status.so     LoadModule autoindex_module libexec/apache2/mod_autoindex.so     LoadModule asis_module libexec/apache2/mod_asis.so     LoadModule info_module libexec/apache2/mod_info.so     LoadModule cgi_module libexec/apache2/mod_cgi.so     LoadModule dav_fs_module libexec/apache2/mod_dav_fs.so     LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so     LoadModule negotiation_module libexec/apache2/mod_negotiation.so     LoadModule dir_module libexec/apache2/mod_dir.so     LoadModule imagemap_module libexec/apache2/mod_imagemap.so     LoadModule actions_module libexec/apache2/mod_actions.so     LoadModule speling_module libexec/apache2/mod_speling.so     LoadModule userdir_module libexec/apache2/mod_userdir.so     LoadModule alias_module libexec/apache2/mod_alias.so     LoadModule rewrite_module libexec/apache2/mod_rewrite.so     #LoadModule perl_module libexec/apache2/mod_perl.so     #LoadModule php5_module libexec/apache2/libphp5.so     LoadModule hfs_apple_module libexec/apache2/mod_hfs_apple.so          <IfModule !mpm_netware_module>     <IfModule !mpm_winnt_module>     #     # If you wish httpd to run as a different user or group, you must run     # httpd as root initially and it will switch.       #     # User/Group: The name (or #number) of the user/group to run httpd as.     # It is usually good practice to create a dedicated user and group for     # running httpd, as with most system services.     #     User _www     Group _www          </IfModule>     </IfModule>          # 'Main' server configuration     #     # The directives in this section set up the values used by the 'main'     # server, which responds to any requests that aren't handled by a     # <VirtualHost> definition.  These values also provide defaults for     # any <VirtualHost> containers you may define later in the file.     #     # All of these directives may appear inside <VirtualHost> containers,     # in which case these default settings will be overridden for the     # virtual host being defined.     #          #     # ServerAdmin: Your address, where problems with the server should be     # e-mailed.  This address appears on some server-generated pages, such     # as error documents.  e.g. admin@your-domain.com     #     ServerAdmin you@example.com          #     # ServerName gives the name and port that the server uses to identify itself.     # This can often be determined automatically, but we recommend you specify     # it explicitly to prevent problems during startup.     #     # If your host doesn't have a registered DNS name, enter its IP address here.     #     #ServerName www.example.com:80          #     # DocumentRoot: The directory out of which you will serve your     # documents. By default, all requests are taken from this directory, but     # symbolic links and aliases may be used to point to other locations.     #     DocumentRoot "/Library/WebServer/Documents"          #     # Each directory to which Apache has access can be configured with respect     # to which services and features are allowed and/or disabled in that     # directory (and its subdirectories).      #     # First, we configure the "default" to be a very restrictive set of      # features.       #     <Directory />         Options FollowSymLinks         AllowOverride All         Order deny,allow         Deny from all     </Directory>          #     # Note that from this point forward you must specifically allow     # particular features to be enabled - so if something's not working as     # you might expect, make sure that you have specifically enabled it     # below.     #          #     # This should be changed to whatever you set DocumentRoot to.     #     <Directory "/Library/WebServer/Documents">         #         # Possible values for the Options directive are "None", "All",         # or any combination of:         #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews         #         # Note that "MultiViews" must be named *explicitly* --- "Options All"         # doesn't give it to you.         #         # The Options directive is both complicated and important.  Please see         # http://httpd.apache.org/docs/2.2/mod/core.html#options         # for more information.         #         Options Indexes FollowSymLinks MultiViews              #         # AllowOverride controls what directives may be placed in .htaccess files.         # It can be "All", "None", or any combination of the keywords:         #   Options FileInfo AuthConfig Limit         #         AllowOverride All              #         # Controls who can get stuff from this server.         #         Order allow,deny         Allow from all          </Directory>          #     # DirectoryIndex: sets the file that Apache will serve if a directory     # is requested.     #     <IfModule dir_module>         DirectoryIndex index.html     </IfModule>          #     # The following lines prevent .htaccess and .htpasswd files from being      # viewed by Web clients.      #     <FilesMatch "^\.([Hh][Tt]|[Dd][Ss]_[Ss])">         Order allow,deny         Deny from all         Satisfy All     </FilesMatch>          #     # Apple specific filesystem protection.     #     <Files "rsrc">         Order allow,deny         Deny from all         Satisfy All     </Files>     <DirectoryMatch ".*\.\.namedfork">         Order allow,deny         Deny from all         Satisfy All     </DirectoryMatch>          #     # ErrorLog: The location of the error log file.     # If you do not specify an ErrorLog directive within a <VirtualHost>     # container, error messages relating to that virtual host will be     # logged here.  If you *do* define an error logfile for a <VirtualHost>     # container, that host's errors will be logged there and not here.     #     ErrorLog "/private/var/log/apache2/error_log"          #     # LogLevel: Control the number of messages logged to the error_log.     # Possible values include: debug, info, notice, warn, error, crit,     # alert, emerg.     #     LogLevel warn          <IfModule log_config_module>         #         # The following directives define some format nicknames for use with         # a CustomLog directive (see below).         #         LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined         LogFormat "%h %l %u %t \"%r\" %>s %b" common              <IfModule logio_module>           # You need to enable mod_logio.c to use %I and %O           LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio         </IfModule>              #         # The location and format of the access logfile (Common Logfile Format).         # If you do not define any access logfiles within a <VirtualHost>         # container, they will be logged here.  Contrariwise, if you *do*         # define per-<VirtualHost> access logfiles, transactions will be         # logged therein and *not* in this file.         #         CustomLog "/private/var/log/apache2/access_log" common              #         # If you prefer a logfile with access, agent, and referer information         # (Combined Logfile Format) you can use the following directive.         #         #CustomLog "/private/var/log/apache2/access_log" combined     </IfModule>          <IfModule alias_module>         #         # Redirect: Allows you to tell clients about documents that used to          # exist in your server's namespace, but do not anymore. The client          # will make a new request for the document at its new location.         # Example:         # Redirect permanent /foo http://www.example.com/bar              #         # Alias: Maps web paths into filesystem paths and is used to         # access content that does not live under the DocumentRoot.         # Example:         # Alias /webpath /full/filesystem/path         #         # If you include a trailing / on /webpath then the server will         # require it to be present in the URL.  You will also likely         # need to provide a <Directory> section to allow access to         # the filesystem path.              #         # ScriptAlias: This controls which directories contain server scripts.          # ScriptAliases are essentially the same as Aliases, except that         # documents in the target directory are treated as applications and         # run by the server when requested rather than as documents sent to the         # client.  The same rules about trailing "/" apply to ScriptAlias         # directives as to Alias.         #         ScriptAliasMatch ^/cgi-bin/((?!(?i:webobjects)).*$) "/Library/WebServer/CGI-Executables/$1"          </IfModule>          <IfModule cgid_module>         #         # ScriptSock: On threaded servers, designate the path to the UNIX         # socket used to communicate with the CGI daemon of mod_cgid.         #         #Scriptsock /private/var/run/cgisock     </IfModule>          #     # "/Library/WebServer/CGI-Executables" should be changed to whatever your ScriptAliased     # CGI directory exists, if you have that configured.     #     <Directory "/Library/WebServer/CGI-Executables">         AllowOverride None         Options None         Order allow,deny         Allow from all     </Directory>          #     # DefaultType: the default MIME type the server will use for a document     # if it cannot otherwise determine one, such as from filename extensions.     # If your server contains mostly text or HTML documents, "text/plain" is     # a good value.  If most of your content is binary, such as applications     # or images, you may want to use "application/octet-stream" instead to     # keep browsers from trying to display binary files as though they are     # text.     #     DefaultType text/plain          <IfModule mime_module>         #         # TypesConfig points to the file containing the list of mappings from         # filename extension to MIME-type.         #         TypesConfig /private/etc/apache2/mime.types              #         # AddType allows you to add to or override the MIME configuration         # file specified in TypesConfig for specific file types.         #         #AddType application/x-gzip .tgz         #         # AddEncoding allows you to have certain browsers uncompress         # information on the fly. Note: Not all browsers support this.         #         #AddEncoding x-compress .Z         #AddEncoding x-gzip .gz .tgz         #         # If the AddEncoding directives above are commented-out, then you         # probably should define those extensions to indicate media types:         #         AddType application/x-compress .Z         AddType application/x-gzip .gz .tgz              #         # AddHandler allows you to map certain file extensions to "handlers":         # actions unrelated to filetype. These can be either built into the server         # or added with the Action directive (see below)         #         # To use CGI scripts outside of ScriptAliased directories:         # (You will also need to add "ExecCGI" to the "Options" directive.)         #         #AddHandler cgi-script .cgi              # For type maps (negotiated resources):         #AddHandler type-map var              #         # Filters allow you to process content before it is sent to the client.         #         # To parse .shtml files for server-side includes (SSI):         # (You will also need to add "Includes" to the "Options" directive.)         #         #AddType text/html .shtml         #AddOutputFilter INCLUDES .shtml     </IfModule>          #     # The mod_mime_magic module allows the server to use various hints from the     # contents of the file itself to determine its type.  The MIMEMagicFile     # directive tells the module where the hint definitions are located.     #     #MIMEMagicFile /private/etc/apache2/magic          #     # Customizable error responses come in three flavors:     # 1) plain text 2) local redirects 3) external redirects     #     # Some examples:     #ErrorDocument 500 "The server made a boo boo."     #ErrorDocument 404 /missing.html     #ErrorDocument 404 "/cgi-bin/missing_handler.pl"     #ErrorDocument 402 http://www.example.com/subscription_info.html     #          #     # MaxRanges: Maximum number of Ranges in a request before     # returning the entire resource, or one of the special     # values 'default', 'none' or 'unlimited'.     # Default setting is to accept 200 Ranges.     #MaxRanges unlimited          #     # EnableMMAP and EnableSendfile: On systems that support it,      # memory-mapping or the sendfile syscall is used to deliver     # files.  This usually improves server performance, but must     # be turned off when serving from networked-mounted      # filesystems or if support for these functions is otherwise     # broken on your system.     #     #EnableMMAP off     #EnableSendfile off          # 6894961     TraceEnable off          # Supplemental configuration     #     # The configuration files in the /private/etc/apache2/extra/ directory can be      # included to add extra features or to modify the default configuration of      # the server, or you may simply copy their contents here and change as      # necessary.          # Server-pool management (MPM specific)     Include /private/etc/apache2/extra/httpd-mpm.conf          # Multi-language error messages     #Include /private/etc/apache2/extra/httpd-multilang-errordoc.conf          # Fancy directory listings     Include /private/etc/apache2/extra/httpd-autoindex.conf          # Language settings     Include /private/etc/apache2/extra/httpd-languages.conf          # User home directories     Include /private/etc/apache2/extra/httpd-userdir.conf          # Real-time info on requests and configuration     #Include /private/etc/apache2/extra/httpd-info.conf          # Virtual hosts     #Include /private/etc/apache2/extra/httpd-vhosts.conf          # Local access to the Apache HTTP Server Manual     Include /private/etc/apache2/extra/httpd-manual.conf          # Distributed authoring and versioning (WebDAV)     #Include /private/etc/apache2/extra/httpd-dav.conf          # Various default settings     #Include /private/etc/apache2/extra/httpd-default.conf          # Secure (SSL/TLS) connections     #Include /private/etc/apache2/extra/httpd-ssl.conf     #     # Note: The following must must be present to support     #       starting without SSL on platforms with no /dev/random equivalent     #       but a statically compiled-in mod_ssl.     #     <IfModule ssl_module>     SSLRandomSeed startup builtin     SSLRandomSeed connect builtin     </IfModule>          Include /private/etc/apache2/other/*.conf


title: Adding capabilities to default roles

text: I created a custom post type and gave it the following capabilities:               add_action( 'init', 'create_team_page_post_type' );          function create_team_page_post_type() {     $args = array(         'labels' => team_page_post_type_labels( 'Team Page' ),         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'show_in_menu' => true,         'query_var' => true,         'rewrite' => true,         'capability_type' => array('team', 'teams'),         'capabilities' => array(                 'publish_pages' => 'publish_teams',                 'edit_pages' => 'edit_teams',                 'edit_page' => 'edit_team',                 'edit_others_pages' => 'edit_others_teams',                              'delete_pages' => 'delete_teams',                 'delete_page' => 'delete_team',                 'delete_others_pages' => 'delete_others_teams',                 'manage_pages' => 'manage_teams',                 'read_private_pages' => 'read_private_teams',                                'read_page' => 'read_team'             ),         'map_meta_cap'=> true,               'has_archive' => true,         'hierarchical' => true,         'menu_position' => null,         'supports' => array('title',             'author',             'editor',             'thumbnail',         )     );          register_post_type( 'team_page', $args );     }      I also checked `$GLOBALS['wp_post_types']['team_page']`to make sure they were all there and everything seems to be behaving as it should:               [cap] => stdClass Object         (             [edit_post] => edit_team             [read_post] => read_team             [delete_post] => delete_team             [edit_posts] => edit_teams             [edit_others_posts] => edit_others_teams             [publish_posts] => publish_teams             [read_private_posts] => read_private_teams             [read] => read             [delete_posts] => delete_teams             [delete_private_posts] => delete_private_teams             [delete_published_posts] => delete_published_teams             [delete_others_posts] => delete_others_teams             [edit_private_posts] => edit_private_teams             [edit_published_posts] => edit_published_teams             [create_posts] => edit_teams         )      So I'm guessing my problem lies in incorrectly assigning these capabilities which I did like so:               $role_object = get_role( 'administrator' );         $role_object->add_cap( 'publish_teams');         $role_object->add_cap( 'edit_teams');         $role_object->add_cap( 'edit_team');         $role_object->add_cap( 'edit_others_teams');         $role_object->add_cap( 'delete_teams');         $role_object->add_cap( 'delete_team');         $role_object->add_cap( 'delete_others_teams');         $role_object->add_cap( 'manage_teams');                 $role_object->add_cap( 'read_private_teams');         $role_object->add_cap( 'read_team');      I thought that was the problem but when I `print_r(get_role( 'administrator' ));` I get:                WP_Role Object     (     [name] => administrator     [capabilities] => Array         (             [manage-teams] => 1             [edit-teams] => 1             [edit_others_teams] => 1             [delete_teams] => 1             [edit-team] => 1             [delete_others_teams] => 1             [delete_team] => 1             [read_private_teams] => 1             [read_team] => 1             [manage_teams] => 1         )     )      That list is shortened considerably. Anyway it still doesn't work. I cannot access my custom post type as admin unless I change the capability type back to "page" or "post."


title: Pretty Permalinks cause site to crash on main domain

text: Here is the problem I am getting in a nutshell. Pretty Permalink + Main Domain = Site goes down Immediately. MySQL gets hammered. Pretty Permalink + Sub-Domain = Site is up No Permalink (default links) + Main Domain = Site is up. My pretty permalinks use the very standard Redirect rules for wordpress into the .htaccess file (I haven't touched this file). For example, my site is mydomain.com. For months, my staging domain was on staging.mydomain.com. I was using the pretty permalinks on this site to access content: staging.mydomain.com/project/my-project. When the launch date came, I switched staging to main domain by changing the path in my httpd config file to point the main domain to the staging server path. And the site went down immediately - MySQL gets hammered. If on the main domain, I change the permalinks to default, the site stays up. I have researched this topic a lot, and I am no closer to a solution. I would much appreciate any help!