Multisite on Rackspace Cloud (ubuntu lucid)

First post in this astonishing exchange. Glad to be here. I've installed WP3 on Rackspace Cloud, under an Ubuntu Lucid installation, properly configured all the multisite dependancies, network blogs are being successfully created, data is stored in the database, which leads me to one conclusion regarding my failure in actually USING network blogs, and that that it's somehow connected to Apache configuration. I admit I'm still slow on my Apache, but I'm getting there. Any leads you can share with me? Thank you.


html mail sended with wp_mail shows plain

I have a invoice.html that i want to send i use the following function to replace some things in the html                foreach($variables as $key => $value){       $template = str_replace('{{ '.$key.' }}', $value, $template);     }      after that i send the mail:               $to = get_option('admin_email');     $subject = "Someone reserved from ".get_bloginfo('name');     $headers = 'From: '. $email . "\r\n" .    'Reply-To: ' . $email . "\r\n";     $headers  .= 'MIME-Version: 1.0' . "\r\n";     $headers .= 'Content-type: text/html';     add_filter( 'wp_mail_content_type', 'set_html_content_type' );     function set_html_content_type() {     return 'text/html';     }          wp_mail($to, $subject, strip_tags($template), $headers);      the mail i get in my mail is like this               Invoice article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary { display: block; } audio, canvas, video { display: inline-block; } audio:not([controls]) { display: none; height: 0; } [hidden], template { display: none; } html { font-family: sans-serif; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } body { margin: 0; } a { background: transparent; } a:focus { outline: thin dotted; } a:active, a:hover { outline: 0; } h1 { margin: 0.67em 0; font-size: 2em ...       (and the rest of the css) and then some html text without the html tags...so it does recognize html because it doesnt show and stuff like that but it doesnt use the css... how come ?


How Do I create multiple Top Level Admin Menu Pages To submit data to the options table?

I am trying to create more than one top level options page in my wordpress theme. But right now I can only save the data for one. How can I save the data for two without having to create tabbed panels?               // create custom plugin settings menu     add_action('admin_menu', 'baw_create_menu');          function baw_create_menu() {          //create new top-level menu      add_menu_page('BAW Plugin Settings', 'BAW Settings', 'administrator', 'baw-settings', 'baw_settings_page');          //call register settings function     add_action( 'admin_init', 'register_mysettings' );     }               function register_mysettings() {     //register our settings     register_setting( 'baw-settings-group', 'new_option_name' );     register_setting( 'baw-settings-group', 'some_other_option' );     register_setting( 'baw-settings-group', 'option_etc' );     }          function baw_settings_page() {     ?>

Your Plugin Name
          <form method="post" action="options.php">     <?php settings_fields( 'baw-settings-group' ); ?>     <?php do_settings_sections( 'baw-settings-group' ); ?>

         New Option Name	         <input type="text" name="new_option_name" value="<?php echo get_option('new_option_name'); ?>" />

         Some Other Option	         <input type="text" name="some_other_option" value="<?php echo get_option('some_other_option'); ?>" />

         Options, Etc.	         <input type="text" name="option_etc" value="<?php echo get_option('option_etc'); ?>" />

          <?php submit_button(); ?>             </form>
        <?php      }               // create second custom plugin settings menu     add_action('admin_menu', 'bax_create_menu');          function bax_create_menu() {          //create new top-level menu     add_menu_page('BAX Plugin Settings', 'BAX Settings', 'administrator', 'bax-settings', 'bax_settings_page');          //call register settings function     add_action( 'admin_init', 'register_settings' );     }               function register_settings() {     //register our settings     register_setting( 'bax-settings-group', 'option_name' );     register_setting( 'bax-settings-group', 'other_option' );     register_setting( 'bax-settings-group', 'etc' );     }          function bax_settings_page() {     ?>

Your Plugin Name
          <form method="post" action="options.php">     <?php settings_fields( 'bax-settings-group' ); ?>     <?php do_settings_sections( 'bax-settings-group' ); ?>

         New Option Name	         <input type="text" name="new_option_name" value="<?php echo get_option('option_name'); ?>" />

         Some Other Option	         <input type="text" name="some_other_option" value="<?php echo get_option('other_option'); ?>" />

         Options, Etc.	         <input type="text" name="option_etc" value="<?php echo get_option('etc'); ?>" />

          <?php submit_button(); ?>          </form>
     <?php      }


Locked out of WordPress Site Admin after enabling Force SSL on WordPress Https (SSL)

I am in a terrible fix. I have been locked out of Site Admin and the solutions offered by the plug-in team in their documentation aren't working. I've tried both methods using Webmatrix. I have to launch my site on Friday and I don't know what to do. This is what they suggested: How do I reset the plugin's settings?   Go to `/wp-content/plugins/wordpress-https/wordpress-https.php` and uncomment (remove the two forward slashes before) the line below, or go to your `wp- config.php` file and add this line. Hit any page on your site, and then remove it or comment it out again.               define('WPHTTPS_RESET', true);      The settings won't save! Did you reset the plugin following the steps above and forget to comment the line back out or remove it from `wp-config.php`?


How to Debug the 'save_post' Action?

Is it possible to validate PHP code? I have a Custom Post Type (Film) with Custom Meta Boxes. Everything is working fine, I can add new Films and details to the Custom Meta Boxes. My problem is with the Update button. If I create a new film, add info and click Update a get a white screen. I know the problem is with the function.php and the Custom Post Type but how do I find the mistake? If I check of the source of the white page it shows 2 empty lines but code has no leading or trailing empty lines.                   <?php             add_action( 'admin_print_styles-post-new.php', 'film_style', 11 );             add_action( 'admin_print_styles-post.php', 'film_style', 11 );                  function film_style() {                 global $post_type;                 if( 'films' == $post_type )                     wp_enqueue_style( 'film-style', get_stylesheet_directory_uri() . '/css/filmMetaBox.css');             }         ?>              <?php             add_action('init', 'film_init');             function film_init(){                 $film_labels = array(                     'name' => _x('Film', 'post type general name'),                     'singular_name' => _x('Films', 'post type singular name'),                     'all_items' => __('All Films'),                     'add_new' => _x('Add new Film', 'film'),                     'add_new_item' => __('Add new Film'),                     'edit_item' => __('Edit Film'),                     'new_item' => __('New film'),                     'view_item' => __('View film'),                     'search_items' => __('Search in films'),                     'not_found' =>  __('No films found'),                     'not_found_in_trash' => __('No films found in trash'),                      'parent_item_colon' => ''                 );                 $args = array(                     'labels' => $film_labels,                     'public' => true,                     'publicly_queryable' => true,                     'show_ui' => true,                     'query_var' => true,                     'rewrite' => true,                     'capability_type' => 'post',                     'hierarchical' => false,                     'menu_position' => null,                     'supports' => array('title','editor'),                     'has_archive' => 'films',                     'register_meta_box_cb' => 'cd_meta_box_add'                 );                 register_post_type('films',$args);             }         ?>         <?php             add_action( 'add_meta_boxes', 'cd_meta_box_add' );             function cd_meta_box_add(){               add_meta_box( 'my-meta-box-id', 'Film Credits', 'cd_meta_box_cb', 'films', 'normal', 'high' );             }                  function cd_meta_box_cb( $post ){               $values = get_post_custom( $post->ID );                    $title = isset( $values['meta_box_title'] ) ? esc_attr( $values['meta_box_title'][0] ) : '';               $director = isset( $values['meta_box_director'] ) ? esc_attr( $values['meta_box_director'][0] ) : '';               $desc = isset( $values['meta_box_desc'] ) ? esc_attr( $values['meta_box_desc'][0] ) : '';                    wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );                    ?>

                       Film Title                       <input type="text" name="meta_box_title" id="meta_box_title" class="textInput" value="<?php echo $title; ?>" />

                       Director                       <input type="text" name="meta_box_director" id="meta_box_title" class="textInput" value="<?php echo $director; ?>" />

                       Description                       <textarea name="meta_box_desc" id="meta_box_desc" class="textInput" col="100" row="5"><?php echo $desc; ?></textarea>

               <?php             }                  add_action( 'save_post', 'cd_meta_box_save' );             function cd_meta_box_save( $post_id ){               if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;// Bail if we're doing an auto save                    // if our nonce isn't there, or we can't verify it, bail               if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;                    if( !current_user_can( 'edit_post' ) ) return;// if our current user can't edit this post, bail                    $allowed = array( // now we can actually save the data                   'a' => array( // on allow a tags                       'href' => array() // and those anchords can only have href attribute                   )               );                    if( isset( $_POST['meta_box_title'] ) )//if data set save it.                   update_post_meta( $post_id, 'meta_box_title', wp_kses( $_POST['meta_box_title'], $allowed ) );               if( isset( $_POST['meta_box_director'] ) )                   update_post_meta( $post_id, 'meta_box_director', wp_kses( $_POST['meta_box_director'], $allowed ) );               if( isset( $_POST['meta_box_desc'] ) )                   update_post_meta( $post_id, 'meta_box_desc', wp_kses( $_POST['meta_box_desc'], $allowed ) );             }         ?>


Wordpress mu domain mapping

I've asked this question on the plugin support page but can't get an answer :/ Is it possible to use the domain mapping plugin to map domains in Wordpress (multisite) that are mapped to domains with a subdirectory? I can get foo.example.com to map fine, but I can't get example.com/foo to map from blogs.mywebsite.com/bar I get a redirect back to the the route of the site blogs.mywebsite.com. I'm using the latest wordpress and the latest install of the wordpress domain mapping plugin. Is what I'm trying to do achievable?


call adminbar greeting in other place

I have disabled wordpress adminbar by adding this filter:               add_filter('show_admin_bar', '__return_false');      But I still want to use it's greeting in other place. By greeting I mean a dropdown menu which says: Howdy admin. Is there any easy way to do this?


Exclude categories from homepage but not from sidebar

I would like to exclude categories from my homepage, but I want them to still display in the sidebar shown on the homepage, how can I do that? At the moment my code excludes from both the content area and the sidebar, and I am putting the code in the functions.php file:               function exclude_category_home( $query ) {         if ( $query->is_home ) {                 $query->set( 'cat', '-5, -34' );         }         return $query;     }          add_filter( 'pre_get_posts', 'exclude_category_home' );


How do I change the login logo URL and hover title?

I am trying to change the login logo URL and hover title. I am using the code below but `return bloginfo('url');` and `return bloginfo('name');` aren't outputting the desired `href` and `title`. I'm also using a child theme if that matters at all. What do I need to use instead of `return bloginfo('url');` and `return bloginfo('name');`?               /* ==  Change Logo URL ==============================*/          function my_url_login(){         return bloginfo('url');     }     add_filter('login_headerurl', 'my_url_login');               /* ==  Change Logo URL Hover Text ==============================*/     function my_url_login_hover(){          return bloginfo('name');     }     add_filter('login_headertitle', 'my_url_login_hover');


Woocommerce include custom stylesheet after woocommerce styling

After the upgrade to WC 2.1.2 my styling seems to be overruled by the standard WC styling. Is there a way to overrule the standard WC styling without using solutions like using the `!important` or other hackish methods? Maybe by enqueueing it in a certain way in `functions.php`? A lot of people recommend to disable WC styles and to copy all the styles into your own theme styles. But isn't this bad if Woocommerce adds functionality?


Remove link to post thumbnail in next_image_link() in single-attachment.php

I've added navigation to single-attachment.php:

<?php previous_image_link( false, ' '); ?>

<?php next_image_link(false, ' '); ?>

<a href="<?php echo get_permalink($post->post_parent) ?>" >

      and set in css own backgorund-image in .previous .next and .close works well, but I would like to remove links to thumbnails post. Anyone have any idea how to do it?


get_edit_post_link returning incorrect post id - why?

I have an array of post-ids, something like:               Array ( [0] => 3164 [1] => 3174 [2] => 3176 [3] => 3220 [4] => 3230 [5] => 3232 )       I'm trying to fetch the post-edit-link for a custom post type, but without luck when using `get_edit_post_link()` I'm editing a CPT course and showing reserves for this course.               foreach($pupil_reserves_course as $pid) {                             $pupil_edit_link =  get_edit_post_link($pid);                          $po = get_post($pid);                 $pupil_name = $po->post_title;                                               //Post title - column is used for pupils name                 $pupil_registered = mysql2date( get_option('date_format'), $po->post_date ); //Format date from settings in admin                                             echo '' . $pupil_registered .  '' . $pupil_name . '';                 $id = $po->ID;                 echo '' . $pupil_registered .  '' . $pupil_name . '';                   echo '
';             }      The `pupil_edit_link()` returns link with post id of current post id (post ID of the course I'm editing) and not the actual id of the array `$pupil_reserves_course`. `$id` is returning the correct post id of the pupil. I could use the second link, but I really would prefer using `get_edit_post($id)`. What am I doing wrong?


Problem with checkbox using custom field archive

How can i get archive base a custom field. I try this but my hosting say there is a problem with my code, the code make manny select in the database.. I have 1 post type, and 2 custom field >   * Post Type : produse >   * custom field : culoare >   * custom field : marime > How can i make a corect and not loading problem script... Can somebody tell me were i do rong? This i have in function.php               /* ------------ Search Avansat -----------*/          add_action('pre_get_posts', 'my_pre_get_posts');          function my_pre_get_posts( $query ) {         if( is_admin() ) { return; }         $meta_query = $query->get('meta_query'); // get original meta query              // validate type         if( (empty($_GET['culoare'])) && (empty($_GET['marime']))  )         {             return;         }              // get types as an array         // - use explode to get an array of values from type=a|b|c         $culori = explode('|', $_GET['culoare']);         $marimi = explode('|', $_GET['marime']);              // set compare for the meta_query         // - http://codex.wordpress.org/Class_Reference/WP_Query         $meta_query['relation'] = 'OR';                   foreach( $culori as $culoare )         {             $meta_query[] = array(                 'key'       => 'culoare',                 'value'     => '"' . $culoare . '"',                 'compare'   => 'LIKE',             );         }              foreach( $marimi as $marime )         {             $meta_query[] = array(                 'key'       => 'marime',                 'value'     => '"' . $marime . '"',                 'compare'   => 'LIKE',             );         }              $query->set('meta_query', $meta_query); // update the meta query args              return; // always return     }      in my php arhive file i have this               <?php      $field = get_field_object('culoare');     $values = explode(',', $_GET['culoare']);     ?>
     <form>       <fieldset>         <legend>Cauta dupa culoare:</legend>             <?php if (!empty($field['choices'])) : $i = 0; foreach( $field['choices'] as $choice_value => $choice_label ): ?>             <?php $culoareIndex = strtolower($choice_value); $i ++; ?>             <input type="checkbox" name="culoare[]" value="<?=$choice_value?>" id="checkbox-1-<?=$i?>" class="regular-checkbox-<?=$culoareIndex?>"             <?php if( in_array($choice_value, $values) ): ?> checked="checked" <?php endif; ?> />             <label for="checkbox-1-<?=$i?>">             <?php endforeach; endif; ?>              </fieldset>     </form>              The select that my hosting provider say:               15561572 cinemago_       localhost cinemago_c      1157  Query SELECT post_id, meta_key, meta_value FROM co_postmeta WHERE post_id IN (32,101) ORDER BY meta_id ASC          15561580 cinemago_       localhost cinemago_c      1156  Query SELECT post_id, meta_key, meta_value FROM co_postmeta WHERE post_id IN (32,101) ORDER BY meta_id ASC          15561603 cinemago_       localhost cinemago_c      1155  Query SELECT post_id, meta_key, meta_value FROM co_postmeta WHERE post_id IN (32,101) ORDER BY meta_id ASC


Custom post type with hierarchical taxonomy url structure

Who can help me to reach second permalink structure of my wordpess website:   * http://www.somesite.com/custom-post-type/some-tax/some-sub-tax/some-sub-tax/post-name/   * http://www.somesite.com/custom-post-type/some-tax/some-sub-tax/some-sub-tax/   * http://www.somesite.com/custom-post-type/some-tax/some-sub-tax/   * http://www.somesite.com/custom-post-type/some-tax/   * http://www.somesite.com/custom-post-type/


Excessive memory used by update_option()

I'm a newer WP developer trying to wrap his head around how to store information in the options table to support a plugin that I am writing. Unfortunately, trying to UPDATE the options table is making my site crash due to exceeding memory limits. The function below is from my class which needs the ability to update the values of the options. I wrote this so that I could overwrite the value of any single key/value pair in the options array.               private function my_update_option($str_key, $str_value) {         $arr_options = get_option( 'my_options' );         $arr_options[$str_key] = $str_value;        update_option( 'my_options', $arr_options );     }      WITHOUT the update_option() function call, one of my memory plugins says that I am using 64.01 of 128M of the allowed PHP memory limits on the server. However, as soon as I use the update_option() function, the site crashes with the following error.               PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 17652686 bytes) in [.......]      I know that I _must_ be doing something horribly wrong here, but based on everything that I have read before I feel like this should work. Why on earth does this function call suddenly add over 100M of required memory usage? I'm not interested in "just raise your memory limit" to solve the problem - I want to know WHY this is crashing so that I can actually write it better and prevent it from using so much memory. Thanks!


Thumbnails are not cropped even after selecting "Crop thumbnail to exact dimensions"

I am moving Wordpress site from one domain to another. In the old domain the WP version was 3.5.2 while in the new domain WP version is 3.8.1. There is a page named "2002" which just contains an image gallery. The text code is something like this:               [gallery columns="6" ids="318,319,320,321,322"]      In the old website it looks like this: ![Thumbnail grid view in the old website](http://i.stack.imgur.com/e9EJY.png) while in the new website it looks like this: ![Thumbnail grid view in the new website](http://i.stack.imgur.com/cAUG8.png) I have set Thumbnail size width and height to 150 and checked _Crop thumbnail to exact dimensions (normally thumbnails are proportional)_ in Settings -> Media Settings. I have also regenerated thumbnails via it's plugin after it. But still it shows the same. Am I missing something in the new website? * * * ### Update: Let's don't consider that I have moved the site. What I did is: I created a new page. Added an image gallery. Set the maximum width and height. Regenerated images. But it doesn't crop images as you can see in the second image. FYI: I have installed Jetpack app (if it may cause this issue)


Filter for changing MediaElement.js Settings

I am trying to change some of the settings that get loaded with MediaElement.js. I can't seem to find a filter or hook to alter the settings that are loaded. The only way I was able to customize the settings is by opening up the core MediaElement.js file and changing the settings there. Obviously this is less than ideal, because I'm forced to edit a core WordPress file which will be overridden on update. How can I change the settings using a filter so my settings aren't lost? I am trying to set               enableKeyboard: false


How is WordPress manipulating the posts like there are folders?

As you know, a WordPress post can usually be seen going to a link similar to this:               myblog.com/2014/03/27/sample-post/      There is no folder named `2014`, `03`, `27` or `sample-post` in the blog. Until now, I used something like this: `page.php?post_id=55`. How is WordPress and other sites (I think StackExchange sites do this too) doing this?


Allow roles below admin to add subscribers only

I want to give a group of user types (Editor + a custom role) the add_users /create_users capability. The only catch is that I wanted to limit that capability to adding 'subscriber' type users only, and nothing above that. Is there a way to do this?


Multiple Unique Author Profiles

I'd like to create multiple user profiles are unique, without just using a "if/then/else" php statement on the author.php template? All I need is the ability to create two different types of profiles.


Can I use multiple nav_walkers?

I am working on a project and I came to the conclusion that I need to use 3 nav walkers:   * one for edit and    * 2 for HTML formatting `class MY_Walker_Nav_Menu_Edit extends Walker_Nav_Menu {} // this extends the menu item edit and adds some custom fields` next is `class MY_Walker_Nav_Menu extends Walker_Nav_Menu {} // this extends the HTML formatting in the front-end for main navigation and using the custom fields values` last one is `class MY_Walker_Nav_Menu_Footer extends Walker_Nav_Menu {} // same as the above just used for another menu in the footer` Currently all walkers in one file and it does not work. I appreciate any suggestion.


Changing widget options via the functions.php when there are no hooks

**The problem** : to change a widget's options with a custom function in functions.php, when there are no useful hooks, and where there are multiple occurrences of the same widget (multiwidget). This would involve:   1. Retrieving the options from "widget_some-widget" in the "wp_options" table. (The returned option containing a string of settings (in serialized form) repeated several times corresponding to several unique occurrences of the same widget.)   2. Changing the value of say the third occurrence of an option instance called `some_name`, from "old-value" to "new-value", and another called `some_other_name`, from "some-old-value" to "some-new-value". (It may be that each occurrence of the widget has its own id within the serialized options string that could be recognised somehow?)   3. Updating the database with the altered options i.e. something along these lines -               function change_widget_configuration() {              $options = get_option('widget_some-widget');          // [code to parse $options string to ensure the correct occurrences of 'some_name' and 'some_other_name' have their values changed]          /* third-occurrence of */    $options['some_name'] = 'new value';     /* third-occurrence of */    $options['some_other_name'] = 'new value';              update_option('widget_some-widget', $options);          }      The widget's serialized options string might look something like this (minus the ellipsis) - `i:3;a:20:{s:5:"title";s:8:"My Title";s:9:"some_name";s:11:"Bit of text";s:15:"some_other_name";s:2:"17";` [...] `s:14:"more_from_this";s:29:"More articles on this subject";}s:12:"_multiwidget";i:1;}` What kind of approach can be taken (with the commented-out code above) to solve this problem? * *This would be very useful for controlling the output of third-party widgets (that do not have any useful hooks) without needing to alter their code, or repeating large chunks of it in the functions.php


Help display image in single post using javascript zoom image..?

Can someone helping me implement single post image with Javascript features with image zoom such i found here : http://www.housetohome.co.uk/galleries/bedroom/adult/Relaxed_country_bedroom_31391.html Thanks max


How do I target the child theme with get_bloginfo();?

In the code below (which is located in my `functions.php` file), in reference to `('.get_bloginfo('template_url').'`, I'm trying to target my child theme but it keeps coming up as the parent theme.               /* ==  Custom Login Logo ==============================*/     function custom_login_logo() {         echo '<style>             .login h1 a { background:url('.get_bloginfo('template_url').'/images/logo-white.png) 0 0;background-size:218px 32px;height:32px;margin-bottom:10px;margin-left:20px;padding:0;width:218px }         </style>';     }     add_action('login_head', 'custom_login_logo');      How can I make it so it targets the child theme's theme folder?


How to add/save Custom Field in user settings/profile "Checkbox list"

i have been working on a custom system for my site where users can have a seperate account, setting and profile page to make my site a bit more interactive and community type. with some other additional stuff. I am new to coding, i have managed to make the profile pages etc. Right now i am stuck in adding a check box list of tags to user settings page. where a user can select multiple tags as interest.. so i can use those to show him recommended posts randomly on his account page . i was able to add two extra fields (Twitter/facebook) in the settings page with this code :               function add_bkmrks_contactmethod( $bcontactmethods ) {     $bcontactmethods['Twitter'] = 'Twitter';     $bcontactmethods['Facebook'] = 'Facebook';     return $bcontactmethods;     }     add_filter('user_contactmethods','add_bkmrks_contactmethod',10,1);      and tehse can be easily called on pages as well by using `$userinfo->Twitter` etc. but i have no clue about the checkboxlist... and calling the array etc. If you guys came across any article or chunk of code which can help me get this resolved i wil be thankful :) cheers Ayaz


Code Friendly Block Quotes

I have a self-hosted Wordpress Blog (located at http://www.dougmolineux.com/wp if you're interesed :) I put a lot of Code Snippets on there, because I'm a programmer. How do I make these "snippets" code friendly? Right now, I am using a simple Blockquote around each one and it converts all single and double apostrophes into strange symbols that will not work when the code is actually copied and pasted. I am willing to convert to a new theme, or alter an existing one. Thanks!


Passing values between enclosing and enclosed shortcodes

Is there a way to pass data between the enclosing and enclosed shortcodes? For example, I would like to do something like:               [boxes per_row=4]         [box]foo[/box]         [box]bar[/box]         [box]baz[/box]         [box]quux[/box]     [/boxes]      And be able to have the different boxes styled differently (eg class='first', class='last', etc). Additionally, I'd like to be able to create a new row when the current row is full. Basically, I want the parent to be able to get called back in some way when the child is called.


6 Recent post on front page with either featured image or content image

In my frontpage.php i want 6 recent blogs with either featured image or the first content image, and if these are not available then i don't want to show that particular post. But i am not getting the first content image. I also want to skip the gallery post but not working properly. ![enter image description here](http://i.stack.imgur.com/1VySO.png)

          <?php if (have_posts()) : while (have_posts()) : the_post(); ?>               <?php             static $count = 0;             if ($count == "6") {                 break;             } else {                 ?>                                            <?php                 if (!has_post_thumbnail()) {                     continue;                 } else {                     if (strpos($post->post_content, '[gallery') !== false) {                         continue;                     } else {                         ?>

                                                              <?php if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail())) { ?>                                             <a href="<?php the_permalink(); ?>">                                                 <?php the_post_thumbnail(); ?>                                                                                <?php                                         }                                         ?>                                                                                <?php                                             /* Get the Name of First Category Fetching all the categories for the post and displaying first pocket */                                             the_category(', ');                                             ?>

<?php echo get_the_time('d') ?>

<?php echo get_the_time('M') ?>

<?php echo get_the_time('Y') ?>

by <?php the_author_posts_link(); ?>

<?php comments_popup_link('No Comments.', '1 Comment.', '% Comments.'); ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

                                 <?php the_excerpt(); ?>                                 <a class="read-more" href="<?php the_permalink() ?>"><?php echo READ_MORE; ?>

                                              <?php }                 }                 ?>                 <?php $count++;             }             ?>         <?php         endwhile;     else:         ?>

         <?php echo SORRY_NO_POST_MATCHED_YOUR_CRITERIA; ?>

     <?php endif; ?>


Wordpress as heavily personalized content management portal, and somewhat like dropbox

My background is not that of a Web-developer (either UI or backend), though I've dabbled a bit in PHP. So please help me improve this question if required. I am trying to evaluate if Wordpress (with a selection of certain plugins), may be a good choice as a heavily personalized content management portal, bordering in some "Dropbox-like" (the cloud storage service) functionalities. The web-portal I am looking for, would allow authorized subscribers to upload their files, while also allowing the administrator to upload, remove, archive such files from the subscriber accounts. The subscribers can access only content in their account, unless they are invited by another subscriber. I expect to have thousands, or even tens of thousands of such subscribers. **Edit _(July 21, 2013)_** To add to the requirements, which weren't very clear initially, I need Wordpress for other things as well, though, I could always limit use of Wordpress to only these additional functionalities (that one expects of a typical Wordpress site):   * Selectively publish (some of the) files, and invite comments on -- on social network sites s.a. Facebook, Twitter, Google+ etc.   * Create diary, with a sense of time-line of events, with reference to files -- some of the diary entries could be public/shared-with-friends or be absolutely private   * Host an ecommerce storefront, via which increased storage could be sold by hosting firm, apart from a marketplace for subscribers to put up some of the content/files (example -- rare vintage photographs/videos) on sale, for other subscribers to purchase. Finally, if something like this could be achieved with Wordpress, could someone suggest the plugins that I might look at ? If there are alternatives, then knowing about them would help too. Is there a consolidated source of Wordpress plugins with detailed description, documentation, use-cases and perhaps some FAQ (in the CPAN sense, for those familiar with the Perl world).


Custom Post Type rewrite with Custom Taxonomy and Custom Meta!

I have a custom post type called 'photos'.   I have a custom taxonomy called 'series'.   Each post will have a custom meta item called '_photo_number'. I want my URLs to go something like this:   Single photo: http://example.com/%series_slug%/%_photo_number%/ All photos in a series: http://example.com/%series_slug%/ I've looked into `add_rewrite_rule` and filtering `post_type_link`, as well as playing with the rewrite options when setting up the post_type and tax. I just can't seem to get my head around the right combination. Any ideas? Thanks in advance.


WordPress pagination with custom post type?

I have searched all over the web to find some solution, but none of them are working for me, can someone help me with this and explain what is wrong? I've spent 3 hours debugging and didn't find the issue. Here is my code:               global $paged;     global $wp_query;     wp_reset_query();          $per_page = get_option('posts_per_page');     $cat_cars = get_term_by('slug', 'cars', 'category');     $page_links_total = ceil($cat_cars->count / $per_page);     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $args = array(         'post_type' => 'cars',         'post_status' => 'publish',         'cat' => $cat_cars->term_id,         'orderby' => 'date',         'order' => 'DESC',         'posts_per_page' => $per_page,         'paged' => $paged     );          $page_links = paginate_links(array(                 'base' => add_query_arg('paged', '%#%'),                 'format' => '',                 'prev_text' => __('«'),                 'next_text' => __('»'),                 'end_size' => 2,                 'mid_size' => 1,                 'type' => 'plain',                 'total' => $page_links_total,                 'current' => $paged             ));          $car_query = new WP_Query($args);      And later i call `have_posts`, `the_post`, etc..   This part works, until I go to the second page of my pagination and get nothing found.


Remove Custom Taxonomy Base

I am using custom taxonomies with WordPress 3.0.4 I am wondering if anyone knows how to remove the taxonomy base from the URL? I have seen plugins that do it for categories and tags, but not for custom taxonomies. For example, I have a custom taxonomy called 'cities'. I would like my URL structure to be mydomain.com/newyork instead of mydomain.com/cities/newyork Is there a function or something I can use?


register_post_type & 'register_meta_box_cb' argument

I just tried the first time to extend a custom post type admin-UI-edit-page with some "meta" boxes (if this is the right word).               register_post_type( 'post_type', array(         'register_meta_box_cb' => 'additional_input_field'     ) );          function additional_input_field()     {         global $post;              $custom = get_post_custom( $post->ID );         $length = $custom["post_type-length"][0];              return print '<label>Length:</label><input name="post_type-length" value="'.$length.'" />';     }      So far i haven't seen any documentation or example about how to use this. A look in the core showed me that it should be equal to:               add_action( 'add_meta_boxes'.$post_type, 'additional_input_field', 10, 1 );      The appropriate hook can be found in (core) `~/wp-admin/edit-form- advanced.php` line #163. The call for add_action in (core) `~/wp- includes/post.php` line #877. The only problem is that it doesn't seem to work as expected. The field get's loaded in front (visually: on top) of everything else. If I try to hook it directly to `'add_meta_boxes'.$post_type`, I get nothing. _Simplified examples in this text to show what i mean. Typos may be there but doesn't matter. The callback fn is taken from some sample code overhere._


order posts by date like craigslist

the image is worth a thousand words. take a look at it.      you know how craigslist has posts organized by date ..ex `Tue 3` post links for tuesday `Wed 4` post links for wed `Thurs 5` post links for thur I know wordpress posts are organized by date by default. take a look at this ![alt text](http://i.stack.imgur.com/6Wm2Q.png) any ideas? btw if this did not make sense let me know. tx


Remove/Add widgets from/to the Available Widgets pool

Is it possible to remove/add widgets from/to the Available Widgets pool (either by plugin or editing core files)? There are 3 widget files located at: /wp-includes/widgets.php /wp-admin/widgets.php /wp-admin/includes/widgets.php I have tried to change both the code and the widget variables but nothing happened. thanks


Multiple information using custom post type

I made a new custom type, it's working fine. My question is: If i want to add in a single post that custom-type with different informations for about x times...how should I do this? **Example:**   Let's say I have "Reduced Price Laptops," with:   * Name    * Price   * Image   * Description I want to make a post where I will post 4 laptops and I want to fill 4 different informations. I want them to be posted in the same article, not 4 separately. Each of them will show up styled separately, but with same design. Let's say a little box. Any ideas/sugestions?


Adding meta boxes to custom post type

The `add_meta_box()` function needs a callback function as an argument to display the meta box on the edit page of a custom type post. My problem is I can not display anything, say in the `input type=text` (for example the values of an already posted post), because I don't have the ID of the post... `get_post_meta` needs the ID of the post to display the values! How can I get the ID of the post?


How do I make sure a plugin loads a script after jQuery

My client has a site running the latest version of WordPress, with Thesis. Currently, jQuery is being loaded in the footer, as the very last script to be loaded. I'm not sure what is causing jQuery to load - possibly Thesis, or something else. We are adding a plugin, which has a script that loads. The script is being loaded in the footer. But it's being loaded BEFORE jQuery, so it fails. The enqueue scripts line is this:               add_action('wp_enqueue_scripts', array($this, 'stb_enqueue_scripts'));      I edited it to be this:               $deps = array("jquery");     add_action('wp_enqueue_scripts', array($this, 'stb_enqueue_scripts', $deps));      But that didn't solve the problem - in fact, the script no longer loaded at all. How can I make sure this script loads after jQuery? Thank you!!


Automating deprecated call checks?

I've recently started revamping and re-releasing some abandoned (yet important) WordPress plugins. As I walk through the code patching other bugs, my IDE highlights deprecated function calls for me, which is fantastic! I fix them immediately when I find them and move on. Anything I _don't_ catch is called out by a Log Deprecated Calls plugin or by setting `WP_DEBUG` to true. But both of these approaches are highly ineffective. With one, I need to actually open the PHP file and manually scan through each line of code looking for a deprecated call. With the other, I need to wait for the deprecated call to be invoked by WP before it's flagged by the system. Is there an easier way or some tool I can use that scans through WP plugins and themes and identifies any use of deprecated functionality?


Is there a Wordpress plugin (or perhaps a Facebook social plugin) which enables users to like posts, comments, and replies?

Basically, it should be a plugin that allows users to like differents elements on the page: posts, comments and replies (bbPress). Any suggestions?


How to change my URL on intranet

I have a WordPress blog installed on my machine. I got a strange requirement from my team but I don't know how I should implement it: blog pages should be segregated under "blog/" or a similar sub-domain. For example: http://example.com/blog/hello-world rather than http://example.com/hello-world How should I do this? The index page of the website is the WordPress front page.


How to display custom taxonomies in posts?

Almost all themes display categories (with its permalink) by default. I am looking for similar type of code to add in my theme. From where can I get it? To create custom taxonomies, I'm using More Taxonomies plugin.


How to change title attribute returned by comments_popup_link()?

I can change label of comments by altering Comment(s) from parameter of following function: `comments_popup_link('No Comments;', '1 Comment;', '% Comments;');` But, seems that title attribute is returned from core modules. Suggest me to alter title attribute without editing core modules.


How do I use add_action on custom widget?

First hope you will take a look example widget http://pastebin.com/2cL7BmgF There have male and female option. Let say I select male and I want add male.css to `wp_head` When I put something like this into the code it's not working.               add_action('wp_head','load_face');     function load_face() {       wp_enqueue_style('style', WP_PLUGIN_URL . '/sample/'.$sex.'.css', null, null, 'screen');     }      Let me know what is the correct code to archive my goal. :)


Limit Number of Sticky Posts to Show

I'm using sticky posts as features posts on home page. I'd like to limit the number of sticky posts to show two the latest two. I found this code, but it makes only on latest sticky post to show. I'd appreciate your help.                       <?php                 /* Get all sticky posts */                 $sticky = get_option( 'sticky_posts' );                      /* Sort the stickies with the newest ones at the top */                 rsort( $sticky );                      /* Get the 2 newest stickies (change 2 for a different number) */                 $sticky = array_slice( $sticky, 0, 2 );                      /* Query sticky posts */                 query_posts( array( 'post__in' => $sticky, 'caller_get_posts' => 1 ) );             ?>


How to remove (or meta noindex) at page /?comments_popup=

I noticed that my website has many page like this:               http://example.com/?comments_popup=837          http://example.com/?comments_popup={id of the page/post}      They are causing many duplicate/thin content pages. I'd like to remove, or at least place meta noindex to this. Which is the file to edit? I presume is in the core of wordpress.


Show custom post type filtered by category

I would like to have a custom post type which contain several sliders for showing in each category page (exact category.php), one for each as planned. All sliders were assigned to related category. Currently I am using http://wordpress.org/plugins/custom-post-type-ui/ to create a custom post type called: slider. And I am having the below code for showing all posts from a category while pressing the cat name in menu. It works fine of course.               <?php $cat = get_the_category(); $cat = $cat[0];　?>     <?php query_posts($query_string . '&cat='. $cat->cat_ID .''); ?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>             <?php the_content(); ?>        <?php endwhile; else: endif; ?>      But the problem is I can't filter the slider (custom post type) by category. Once I call the `wp_query`, it rolls out all the sliders and ignores my get cat id arg. Thought it should show only the slider in certain category, not all category. So I am asking for a query to call the right slider only.


filter a loop base on specific category

i am going to filter my loop base on the category the problem is that when i am using the following code it display all my post.               // Query args     $custom_cat_args = array(         'posts_per_page' => 15,         'order' => 'DESC',         'orderby' => 'post_date',         'category' => get_cat_ID( 'سیاست' )     );     // Instantiate query     $custom_cat_query = new WP_Query( $custom_cat_args );     // Instantiate loop     if ( $custom_cat_query->have_posts() ) : while ( $custom_cat_query->have_posts() ) : $custom_cat_query->the_post();         // Normal loop markup here     // Close loop     endwhile; endif;     // Restore $post global     wp_reset_postdata();


Creating custom theme options page

I am creating a theme for a client and it has a custom front page that has a slider and displays the services they offer. I am looking to add an options page where the client can easily update the slider images, service titles, descriptions and images. I have seen this functionality on other themes and am having trouble trying to implement it. I have followed a few different tutorials and I understand how to add the page to the menu, but am unsure how to get the form to update the information on the front page. Most recently, I followed this tutorial exactly but could not get it to work. When I hit submit, it says "error: options page not found". I saw this in a similar question here, but while the answer solved the error message, it still wasn't updating the information on the front page. Are there any ideas on how to do this? Or any tutorials that would be helpful? I've been looking but most of the tutorials are outdated or deal with the Settings API and not custom fields. The code I'm using is from this tutorial from Webdesigner Depot. **The main problem I have is that the inputted text does not get saved.** In functions.php:               add_action('admin_init', 'theme_options_init');     add_action('admin_menu', 'theme_options_add_page');          function theme_options_init(){         register_setting( 'sample_options', 'sample_theme_options');     }          function theme_options_add_page(){         add_theme_page( __( 'Theme Options', 'sampletheme' ),                        __('Theme Options', 'sampletheme'),                        'edit_theme_options', 'theme_options',                        'theme_options_do_page');     }          function theme_options_do_page() {          global $select_options;          if (!isset($_REQUEST['settings-updated']))             $_REQUEST['settings-updated'] = false;         ?>
             <?php screen_icon(); echo "
". __('Custom Theme Options', 'customtheme')."
";?>             <?php if ( false !== $_REQUEST['settings-updated']) : ?>

<?php_e('Options saved', 'customtheme');?>

             <?php endif;?>             <form method="post" action="">                 <?php settings_fields('sample_options');?>                      <?php $options = get_option( 'sample_theme_options');             ?>

                                                      <?php _e('Display Intro Paragraph', 'customtheme');?>                         	                                                      <input id="sample_theme_options[showintro]" name="sample_theme_options[showintro]" type="checkbox" value="1"         <?php checked( '1', $options['showintro'] ); ?>

                                                      <?php _e( 'Intro Paragraph', 'customtheme' ); ?>                    	                                                      <textarea id="sample_theme_options[introtext]"         class="large-text" cols="50" rows="10" name="sample_theme_options[introtext]">                             <?php echo esc_textarea( $options['introtext'] ); ?></textarea>

                 <input type="submit" value="<?php _e( 'Save Options', 'customtheme' ); ?>" />
             </form>
     <?php }      At the top of header.php:               <?php $options = get_option('sample_theme_options'); ?>      And in home.php:               <?php if ($options['showintro'] == 1) { ?>
                         <?php echo $options['introtext'] ?>

                 <?php } ?>


filter custom post type by meta key in dashboard

I'm looking for a way to expand e customize more this topic how to filter post listing (in WP dashboard posts listing) using a custom field (search functionnality)? I've a custom post type in the dashboard i've managed to have a small search box with a fixed search function to search a specific meta key. The things is that the search form appears on all the /edit.php pages while i need it only in the specific custom post type edit.php page. I tried with               if (isset($_GET['post_type']) && $_GET['post_type'] == 'product')      but it doesn't seem to work.


Preferred way to include Advanced Custom Fields in a plugin?

So I am building a plugin for a site that is already using Advanced Custom Fields (ACF). I wonder what would be the best way to include ACF in my plugin? The site is already using ACF, so is it possible to include ACF from the plugin directory or should I include ACF again?


Hide custom post type and use its slug in new plugin menu

I want to use custom post type in my web app and want to use that url in my plugin menu. I have created custom post type like this.               register_post_type( 'reserve',         array(             'labels' => array(                 'name' => __( 'Reserves' ),                 'singular_name' => __( 'Reserve' ),                 'all_items' => __( 'All Reserves' ),                 'add_new' => __( 'Add Reserve' ),                 'add_new_item' => __( 'Add New Reserve' ),                 'edit' => __( 'Edit'),                 'edit_item' => __( 'Edit Reserve' ),                 'new_item' => __( 'New Reserve'),                 'view' => __( 'View Reserve'),                 'view_item' => __( 'View Reserve'),                 'search_items' => __( 'Search Reserves'),                 'not_found' => __( 'No Reserves found' ),                 'not_found_in_trash' => __( 'No Reserves found in trash' ),                 'parent' => __( 'Parent Reserve')             ),                    'description' => __( 'This is where you can add new Reserves' ),         'public' => true,         'show_ui' => false,         'capability_type' => 'page',         'publicly_queryable' => true,         'exclude_from_search' => false,         'hierarchical' => true,         'rewrite' => array( 'slug' => 'reserves', 'with_front' => false ),         'query_var' => true,         'supports' => array( 'title', 'editor', 'thumbnail', 'comments', 'excerpt',/*, 'page-attributes'*/ ),         'has_archive' => true,         'show_in_nav_menus' => true         )     );      Notice that I have set show_ui as false so that my new custom type wont be displayed on admin sidebar. Now I am creating a my plugin menu as following.               $topslug = 'reserve/admin';      add_menu_page('Reserve Overview', 'Reservation', 'view_reservation_plugin', $topslug, 'show_start_page',RESERVE_URL.'images/menu_icon.png');     add_submenu_page($topslug, 'RESERVE', 'Reserve Builder', 'view_reservation_plugin', 'reserve/manage_reserve', 'show_manage_reserves');      From above code you can find that I have created a menu as Reservation having two submenus 1) Reserve Overview 2) Reserve Builder. Now my issue is I want to change my URL of Reserve Builder. Currently its 'admin.php?page=reserve/manage_reserves'. I want to change it like 'edit.php?post_type=reserve' so that i can use wordpress inbuilt facility. Say if I am passing 'edit.php?post_type=reserve' in add_submenu_page('edit.php?post_type=reserve', 'RESERVE', 'Reserve Builder', 'view_reservation_plugin', 'reserve/manage_reserve', 'show_manage_reserves').Menu gets disappeared. TIA.


Custom taxonomy only shows 0 in autocomplete for terms and "Choose from the most used tags"

I have a custom post type (`rezept` that I added a custom taxonomy `Allergiefrei` to. I got this working so far. Adding terms to the custom taxonomy's box works, too, but autocomplete and 'Choose from the most used tags' only shows "0". Here's the code where I register the custom taxonomy:               function register_rezept_taxonomies() {       register_taxonomy(         'Allergiefrei',         'rezept',         array(           'label' => 'Allergien',           'rewrite' => array('slug' => 'allergien')         )       );     }          add_action('init', 'register_rezept_taxonomies');      I'm defining custom taxonomies and the post type in a plugin.


Mail function is not working

My mail function is not working. When I submit form it says mail sent. But not receiving. I tried echo if the mail sent. It is also working. What is the issue here? Anything with mail function ?               <?php     $name    = $_POST[ 'cuf_sender' . $n ];     $email   = $_POST[ 'cuf_email' . $n ];     $subject = $this->o['subpre'] . ' ' . $_POST[ 'cuf_subject' . $n ];     $msg     = $_POST[ 'cuf_msg' . $n ];          $extra = '';     foreach ( $_POST as $k => $f ) {         if ( strpos( $k, 'cuf_field_' ) !== false ) {             $extra .= $this->o[ substr( $k, 4, 7 ) ] . ": $f\r\n";         }     }          $headers =         "MIME-Version: 1.0\r\n" .         "Reply-To: \"$name\" <$email>\r\n" .         "Content-Type: text/plain; charset=\"" . get_settings( 'blog_charset' ) . "\"\r\n";     if ( ! empty( $from ) ) {         $headers .= "From: " . get_bloginfo( 'name' ) . " - $name <$from>\r\n";     } else if ( ! empty( $email ) ) {         $headers .= "From: " . get_bloginfo( 'name' ) . " - $name <$email>\r\n";     }          $fullmsg =         "Name: $name\r\n" .         "Email: $email\r\n" .         $extra . "\r\n" .         'Subject: ' . $_POST[ 'cuf_subject' . $n ] . "\r\n\r\n" .         wordwrap( $msg, 76, "\r\n" ) . "\r\n\r\n" .         'Referer: ' . $_SERVER['HTTP_REFERER'] . "\r\n" .         'Browser: ' . $_SERVER['HTTP_USER_AGENT'] . "\r\n";          if ( wp_mail( $to, $subject, $fullmsg, $headers, $email ) ) {         echo $to;         exit();


update_field() with repeater fields issue

I’m having a problem with the popular Advanced Custom fields plugin, trying to update/append rows in repeater fields. I’m trying to migrate all data from one table into user meta and I keep getting the following error. Catchable fatal error: Object of class WP_Error could not be converted to string in C:\wamp\www\baca\wp-content\plugins\advanced-custom- fields\core\fields_functions.php I’m not sure what I’m doing wrong as I’m following the resources at http://www.advancedcustomfields.com/resources/functions/update_field/ but not working and I'm not having any luck with the support on their website. Below is the code I’m using. Can someone see what I'm doing wrong?               function add_members() {         global $wpdb;         $results = $wpdb->get_results( "SELECT * FROM members" );               foreach($results as $row) {                  $new_user = array(                 'user_login' => $row->CompanyName,                     'user_pass' => wp_generate_password ( 12, false ),                     'user_url' => $row->Website,                     'user_email' => $row->Email,                     'wp_capabilities' => 'Subscriber'             );                  $pid = wp_insert_user($new_user);                  if($pid) :                  $field_key = "field_52f4fedbcdb79";             $post_id = $pid;             $value = get_field($field_key, $post_id);             $value[] = array(                 "more_contacts_name" => $row->ContactName,                  "more_contacts_email" => $row->ContactEmail,                  "acf_fc_layout" => "row_1"             );             $value[] = array(                 "more_contacts_name" => $row->ContactName2,                  "more_contacts_email" => $row->ContactEmail2,                  "acf_fc_layout" => "row_2"             );             update_field( $field_key, $value, $post_id );                endif;              }     }     add_action( 'edit_user_profile', 'add_members' );


cannot override post_types in WP_Query()

I'm creating a featured post slider which takes 4 pages or posts from the 'featured' category. I'm trying to use WP_Query, but am having no joy :( my slider query is:               $ml_featured = new WP_Query(               array(             'posts_per_page' => 4,             'post_type' => array('page', 'post'),             'category__in' => 22         )     );               if( $ml_featured->have_posts() ) {         while( have_posts() ) : $ml_featured->the_post();                  // looping              endwhile;     }     else {         // no posts     }      fire_PHP shows the WP_Query contains:               WP_Query(         query =         array(             ['posts_per_page'] => 4             ['post_type'] =>                 array(                     [0] => 'page'                     [1] => 'post'                 )             ['category__in'] => 22         )              query_vars =         array(                  ['posts_per_page'] => 4             ['post_type'] =>                 array(                     [0] => 'wod'                     [1] => 'attachment'                 )             ['category__in'] =>                 array(                     [0] => 22                 )       I'm using Genesis, building upon the sample child theme. In order to display my custom post type 'WOD' on the homepage I've added to functions.php:               add_filter( 'pre_get_posts', 'ml_wods_home' );     function ml_wods_home( $query ) {              if ( is_home() && false == $query->query_vars['suppress_filters'] )             $query->set( 'post_type', array( 'wod', 'attachment' ) );              return $query;     }      as suggested at Justin Tadlock. This works well on its own, but seems to be interfering with the slider query: Please note that query['post_type'] is overwritten by query_vars['post_type']. In addition, the browser is timing out frequently as I mess around... I found that Michael Fields had a related issue , posted a solution, (which I think I'm implementing) but its not working for me, and I don't understand it.. What am I missing?! TIA, Tim


Posts don't appear on the Blog page

I am in the process of building a book review site for my daughter using the twentyten theme. For some reason the "Blog" page does not display any of the posts that I have written. I have searched the entire forum and have tried various things such as de-activating all plugins and reactivating them, but that has not helped. Can anyone help? The URL is http://teenbooktalk.co.uk


Limit access to dashboard to X amount of days

Is it possible to give users with roles A or B access to the dashboard for a certain amount of days, by comparing the date of creation of the website with the current date?   The scenario would be: user with role A or B logs in and, if X amount of days have elapsed since the creation of their website, the dashboard links would not work and they would be shown a certain page.   Thank you!


Load Pages Menu in single.php

I've searched a lot but didn't find an answer ... My Wordpress has got 4 main areas, each one also has a news (posts) section and an own submenu. If I load a post (with single.php) is it possible to get the corresponding submenu to that area? I'm thinking about sub stringing the slug to get the right area. Help is really appreciated. Thx, Oliver Additional Info: * There is a sidebar which I also show in single.php * The sidebar should contain the menu tree of one area * A post is not connected to the menu


Customize Query to include a custom parameter

I have a link on a page, which goes to a loop using information from a meta field on that page. I'm a bit confused by this, but I'm trying to learn because this seems quite powerful. As I understand I'm to add a query var to the global $wp_query.               function themeslug_query_vars( $qvars ) {       array_push( $qvars, 'meta_id' );       return $qvars;     }     add_filter( 'query_vars', 'themeslug_query_vars' , 10, 1 );      But this doesn't seem to show up if I print out $wp_query. Am I missing something?


Outputing Post Object title as a div class with ACF

I have Post Object field set up for pages. What I want to do is to output title of the posts associated with the page as a class of the div surrounding the page listing. But, the code inside the foreach loop is not being executed. I've tried with setup_postdata($post) and without, per ACF documentation, the result is always the same. Here is the code:               function pages() {     $args = array(         'post_type' => 'page'         );     $pages = get_posts($args);         foreach ($pages as $page) {?>             <div class=" <?php                  $ancestors = get_field('ancestor');                     foreach ($ancestors as $ancestor) {                         $class_ancestor_raw = get_the_title($ancestor->ID);                         $class_ancestor_temp = explode(' ', $class_ancestor_raw);                         $class_ancestor_str = implode('-', $class_ancestor_temp);                         $class_ancestor = strtolower($class_ancestor_str);                         echo $class_ancestor;                     }                  ?>">                 <?php echo $page->post_title; ?>             </div>             ?>         <?php } ?>


Page-CPT.php redirects to archive or single.php

I have set up a custom post type called cpt_top_ten_list. I am trying to set up a page to display all of my custom post types. I've named my new page page-top-ten.php, and added a template tag at the top of the page. Created a page in the dashboard called 'Top Ten List' and assigned that page my new template. Now when I go to the page it seems to redirect me to an archives page of the custom post type. If I turn off archive capabilities for the cpt it redirects me to page.php. If I add `flush_rewrite_rules();` into functions.php, my new custom page works but none of the other pages work. When I take out the `flush_rewrite_rules();` all the pages work except my cpt. I've tried refreshing my permalink settings by going into the page and re- saving out my settings. I'm confused as to what is going on here. Why wouldn't my cpt page being recognized as such? Its very strange.               function register_top_10_list_custom_post_type() {             // All the labels             $names  = array(                 'name' => 'Top 10 List',                 'singular_name' => 'Top 10 List',                 'add_new' => 'Add New List',                 'add_new_item' => 'Add New List',                 'edit_item' => 'Edit List',                 'new_item' => 'New List',                 'all_items' => 'All Lists',                 'view_item' => 'View List',                 'search_items' => 'Search Lists',                 'not_found' =>  'No lists found',                 'not_found_in_trash' => 'No lists found in Trash',                  'parent_item_colon' => '',                 'menu_name' => 'Top 10 Lists'               );             //CPT's paramters             $args = array(                 'labels' => $names,                 'public' => true,                  'publicly_queryable' => true,                 'show_ui' => true,                  'show_in_menu' => true,                  'query_var' => true,                 'menu_icon' => get_stylesheet_directory_uri() . '/inc/cpt/images/top-10-icon.png', /* the icon for the custom post type menu */                 'capability_type' => 'post',                      'has_archive' => true,                  'hierarchical' => false,                 'menu_position' => null,                 'taxonomies' => array('category', 'post_tag'),                 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )             );          //register CPT         register_post_type( 'cpt_top_ten_list', $args );     }     //initiate CPT     add_action( 'init', 'register_top_10_list_custom_post_type' );


TinyMCE: Move buttons from 2nd row to top row

I have disabled many of the TinyMCE buttons making the two rows quite empty. Is it possible to move the remaining buttons from the second row (that is displayed when hitting the _Kitchen Sink_ button) to the top row?


WordPress for a very large website

I've searched and searched but I did not find an answer online. Also, I've posted this on StackOverflow and apparently it wasn't ok and I reposted this here. I hope it's ok. I have this website which is very large: a lot of **articles** , **comments** , **likes** for articles (not Facebook likes but own likes), **ratings** for articles, **multiple users** that **each have a blog** , **forum** , **user wall** , **user friends** etc. My team and I made it 5-6 years ago in CakePHP and now the client wants to remake it. I thought WordPress would be a good solution given the tendency towards articles and stuff, and WordPress (at least I think) knows best about articles and stuff. I've checked and WordPress supports multiple blogs, I can customize the user's fields, I can make user relations, user galleries and everything; also, I've done a few themes in WordPress (about 10) and I really like the way it's coded. Is it a good solution to remake it in WordPress? Considering about **50,000 articles** and each about **100 comments** and about **100,000 users** (worst case scenario), would WordPress be able to render the website in less than one second (just the server side, not including CSS, JS and other stuff). As far as I know WordPress only has like 20-30 tables (MySQL), while the website has 180 tables now. So, it will fit 180 tables worth of information into about 20-30 tables. Won't that get too slow, crowded, etc? Sorry for the long question, but I want to be sure I'm making the right decision. In short: for a website with a lot (and I mean a lot) of content and a lot of traffic, is WordPress a viable solution?


Writing a webscraper plugin for Wordpress

i'm absolutely new to Wordpress, however pretty experienced PHP coder. I would like to add a webscraper plugin. The backend is done, all i need is to create a "Create new post from link" link in the Wordpress menu, which leads to a page with just a text input and a button. The button calls a function that sends a get request to my script, which returns the parsed content of the link and then creates a new post using the parameters. If someone could just throw some keywords at me where i best start to look, i will highly appreciate it! So basically my question is: How do i add an item to wordpress menu that links to a fully customizable site (i tried register_post_type, however i figured i don't need a fully new post type) Thanks in advance for your help!


How to prevent WP overwriting my custom htaccess rewrites?

I've used some custom rewrites implemented by the Roots framework. Occasionally they get wiped: certainly if I visit Settings > Permalinks, but also at seemingly random times. My htaccess reads so:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          RewriteRule ^css/(.*) /wp-content/themes/the-hit-centre/css/$1 [QSA,L]     RewriteRule ^js/(.*) /wp-content/themes/the-hit-centre/js/$1 [QSA,L]     RewriteRule ^img/(.*) /wp-content/themes/the-hit-centre/images/$1 [QSA,L]     RewriteRule ^plugins/(.*) /wp-content/plugins/$1 [QSA,L]     RewriteRule ^media/(.*) /wp-content/uploads/$1 [QSA,L]          RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>      I've tried removing the               # BEGIN WordPress      comments, but then WP just writes a new block of code. **Is there a hook I can call in functions.php that will prevent WP refreshing the permalinks?** thanks, Tim


Editor have not permissions for a plugin

I use static html output plugin to export pages to html, but only the admin can use this plugin. A editor have not permissions to export a html page. It says: You do not have sufficient permissions to access this page. when a editor try it. How can I make this plugin available for the editors on my site? **I found the solution, the plugin has the capability manage_options; I change it to edit_posts**


Custom Dashboard Home Screen Options

I want to make the entire Homepage on the Dashboard empty and add in my own custom screen options. How do I go about doing this? Do I create one from scratch or edit what's already there? Is there some kind of codex for this, I'm not even sure what they're called... For example, If I just wanted to add a small message to the Dashboard Homepage `"Hello World"` how would I go about doing this?


Is it safe to assume that a nonce may be validated more than once?

From what I have gathered, once a nonce is generated it is valid for reuse for the next 48 hours. Is it safe to code with this in mind? I'm writing a plugin that does a bit of toing and froing with the client via AJAX and want to know if I should just generate a nonce when the page loads and use that for all communication or generate a new one for every request and include it in the response.


How to change custom post type status when non-admin updates post?

I allow users to submit posts (as a custom post type, "tribe_events") to my website. **Is there a snippet I can add to my functions.php file that would change a post's status from "published" to "pending" when a non-admin updates a post?** Currently I'm not allowing users to edit/update their posts since WordPress keeps them as "published." If I can change that functionality I could let them edit their posts (I could review the changes they made before re-publishing the post), which would be a much more user-friendly experience. Any advice for this novice coder would be greatly appreciated. Thank you!


Conditional output for start_lvl based on title

I want to add a custom class to the UL tag on start_lvl if the user writes "full" on the title area of the menu. Something like this:               public function start_lvl( &$output, $depth = 0, $args = array() )                  if ( user writes "full" )             $output .= "\n$indent
\n";         } else {             $output .= "\n$indent
\n";         }     }      Looking for other sources I've found a way to include what I want on LI tags using $item->`attr_title` but doesn't seems to work on start_lvl.


Wordpress Post featured image URL in the header

I want to add the featured image URL of a post to the header. When a Facebook user shares a Wordpress page, this code in the header: The `rel="image_src"` attribute is what facebook is searching for.               <link rel="image_src" href="FEATUREDIMAGEURL">      Will return a specific image for the share. However, I cannot figure out how to add the URL of the post's featured image... Can you? I tried this:               <?php if (has_post_thumbnail( $post->ID ) ): ?>     <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ); ?>     <link rel="image_src" href="<?php echo $image; ?>">     <?php endif; ?>      But it gave me a `Parse error: syntax error, unexpected ';'` error.


Multiple sites/domains with content all managed by single installation of Wordpress

I've had an interesting request from a client, and subsequently spent a couple of hours looking into it. The crux of it is exactly as the title of this post suggests: they have 3 separate sites with unique domains, but the subject material & content for all three is ostensibly the same. They would like to be able to manage a single pool of content from a single, central location, and for those changes to be echoed across the 3 sites. For example, there is an _Order Details_ page with an email address to enquire about back-catalogue items and a list of links to purchase stuff from. The client wants to be able to change that email address from _info@_ to _sales@_ and switch out the iTunes link for an Amazon link - and then for those changes to be updated on the _Order Details_ page of each one of the three sites. I've taken a look at **WPMU** ; I hadn't used it before, but I just did a quick installation and have been reading up on it for the last hour or so, but I don't think it's what we're after, as each subdomain's content is 'siloed' (as you'd expect). I've also looked into services like InfiniteWP, which looks great and suggest that this kind of feature is 'in the works' (for a price), but obviously in the meantime involves switching between active sites to update posts & pages one site at a time. So, does anyone know if this kind of thing is technically feasible, or if the client is asking for the moon on a stick? **Update:** Client has just thrown a spanner in the works by suggesting that a single news post could be posted to one, two, or all three sites. Which makes things... interesting (read: headachey).


Add Wordpress MU Network Admin via Database

I am working on getting a copy of a WordPress MU network up and running on my local machine for development purposes (using WordPress 3.2.1 at the moment). I need access to the network administration options. In the usermeta table, I changed my `user-level` to `10` and `capabilities` to `a:1:{s:13:"administrator";b:1;}` In the sitemeta table, I added myself to the serialized array of users in the `site_admins` option. While this did get me access to the generic wp-admin page, I still do not have access to any of the network admin options (such as automatic upgrade for WP, plugins, or themes, etc).


Set unique term_id from custom meta keys

I have a function to set a custom meta keys values to a taxanomy, term.               $category20 = $fields['field_52dd3aa1d6bc0']; // gps     wp_delete_object_term_relationships( $post_id, 'gps' );     wp_set_object_terms($post_id, $category20, 'gps', true );      From GPS meta key, value is set to `Yes`. Also on other fields meta key value is the same for example `Yes` and `No`. When i use `wp_set_object_terms` function to store a term, same values is stored under the same `term-id` identificator. How can i fix this? Term ids is setting from slug? Update: This code works:               wp_insert_term(       ''.$category20.'', // the term        'gps', // the taxonomy       array(         'description'=> 'GPS use',         'slug' => 'gps-yes'       )     );      But no more for remove:               wp_delete_object_term_relationships( $post_id, 'gps' );      Figured out, working solution to use meta key for taxanomy terms:               wp_delete_object_term_relationships( $post_id, 'gps' );     if (!term_exists($category20, "gps")) {         wp_insert_term(           ''.$category20.'', // the term            'gps', // the taxonomy           array(             'description'=> 'GPS use',             'slug' => 'gps-yes'           )         );     }     wp_set_object_terms($post_id, $category20, 'gps', true );


Wordpress permalinks and javascript redirection

I need to use javascript redirection in one of my scripts. With `/%postname%/` WP permalinks structure redirection works like it should but with default it always redirects to home page. `/%postname%/` structure script:               window.location.replace(encodeURIComponent("http://www.url.com/customposttype/postslug"));      default permalinks structure script:               window.location.replace(encodeURIComponent("http://www.url.com/?customposttype=postslug"))


How to bind data-src attribute for the image in the post using jquery?

I'm trying to use foresight.js for responsive image in the wordpress blog. For that I have to add the `data-src` attribute in the place of `src` in the `<img>` tag. Or I have to get the url from the image in the post and need to bind my new tag near the old `<img>` tag and wrap that old `<img>` tag in `<noscript>` tag. I don't have any idea how to do it. Basically it must looks like this:


Clean install - Changing permalinks in twentyeleven give 404

interesting problem that I encountered, not sure if it's bug or not.. On a clean install using the **twentyeleven** theme I try changing the _Permalink Settings_ to something different from the _Deffault_ and every post starts giving Page Not Found 404. The Pagination and the top Nav Menu also stop working. What needs to be changed for all of this to start working, because the same problem is present when I start creating custom theme? EDIT: Figured it out! The solution was very simple - turning the _rewrite module_ of WAMP.


save_post requiere at least one uploaded file to be published

Is there a way to check the Published status of a post, and if it doesnt has at least one image or file uploaded, then change status of published to draft? Thanks in advance.


Any Good Analytics Plugins for WordPress? (standalone)

Recommend any good analytics plugins you may have used and found useful. Reports such as site traffic by page, point of entry, top out going links, browser and OS information. The plugin may be paid or free. **EDIT** : The reason I asked this question is to discover any new plugins that are not very popular but others have found useful. Please post any analytics plugin you may have found useful.


Function Get User Object By Username?

Which function can be used to get the user's object using the username? I've tried get_userdatabylogin() but the function seemed to throw an error: Parse error, unexpected T_STRING on line xx The function was called like so: get_userdatabylogin($username);


How can we make managing lots of pages in WordPress Admin better?

WordPress obviously comes from a blogging background but can be used to serve sites with a lot of Pages. However, where it falls short for me is not in regard to performance but in the Admin area's handling of lots of Pages, child pages etc. It quickly becomes a chore to move through the list of Pages trying to find what you're looking for, especially without the ability to drill down into page hierarchies etc. What techniques / plugins do people use to deal with this issue?


"An automated WordPress update has failed to complete - please attempt the update again now"-- But there is no .maintenance file

I am trying to manually upgrade my wordpress to the latest version (3.0.3)-- after autoupgrade fails. After the upgrade everything works fine except for one little nagging message at the top of my admin area: > An automated WordPress update has failed to complete - please attempt the > update again now I search the Internet and everyone is saying that it is because of a `.maintenance` file located in the Wordpress root folder, a relic of a failed auto-upgrade or a manual upgrade. In the second case one would just have to delete that file and everything would be fine. But I search my wordpress installed directory, there is no such file. Any idea what contributes to this problem?


Delete backgound for ID with conditional if statement

how can I delete a background for #main only on my posts. I know that I have to create a conditional `if` statement in my functions.php file with `if (is_post())` but I'm just not sure how to write it.


apache_mod_loaded setting can fubar plugins?

I had a user recently who reported an issue with my plugin's options page not loading. They would click on the "settings" link but only got a blank page. There was also an issue with the rich text editor showing up on the category edit screen. I could not figure out why, on almost every other site but their's, the plugins loaded fine. We disabled all plugins except mine and still could not get the plugins to load properly. Some time passed and I got an email from the user that he had resolved the issue (WP 3.1 site) by editing the file wp-admin/includes/misc.php changing...               $got_rewrite = apache_mod_loaded('mod_rewrite', true);      To...               $got_rewrite = true;      Anyone have any insights into why the unedited file might cause issues with plugins?


Show widget differently depending on if it's in the sidebar or footer

I've made a custom widget which shows thumbs of my latest videos. These thumbs are set to be 300px wide, which is the same width of my sidebar. My problem is that i also want to be able to use it in my footer where the width of widgets are only 220px wide. So basically what i want to do is: if the widget is shown in the sidebar use `<?php the_post_thumbnail('media-thumb-sidebar'); ?>`and if the widget is used in the footer use `<?php the_post_thumbnail('media-thumb-footer'); ?>` Anyone know how i could do this? Thanks :)


Build page base on category

I know how to hardcode that... but i like to have a plugin with shortcode that will make it for me... do you know any... If not, i will have to make it myself Have a page (blank) and build it base on post category. So in page xyz display all the post with category=abc. So the build page will display all the abc post back to back. Framework do that, but i only have a simple theme... how to do that ? And yes, i know that clicking on category will just do that, but it's less managable !


Move admin menu at the end

I installed a plugin for my users in WPMU and I want to make it appear at the end of the admin menu .... I tried this but the menu never appears at the end:               function custom_menu_order($menu_ord) {       if (!$menu_ord) return true;            return array(           'index.php', // Dashboard           'edit.php', // Posts          'upload.php', // Media         'options-general.php', // Settings        => 'admin.php?page=support', // my plugin          );     }       add_filter('custom_menu_order', 'custom_menu_order'); // Activate custom_menu_order       add_filter('menu_order', 'custom_menu_order');      my plugin menu is "admin.php?page=support"


Cache issue with WP_Query and custom field filtering

I have three separate WP_Queries on a page. Each of them return custom post type items that have a certain checkbox checked and then display one of those randomly. The checkbox has been added using Custom Metaboxes and Fields for WordPress.               <?php     $front1_args = array(         'post_type' => 'work-item',         'meta_key' => '_cmb_work_front_large',         'meta_value_num' => 1,         'orderby' => 'rand',         'posts_per_page' => '1'     );     $front1_query = new WP_Query($front1_args);     while ($front1_query->have_posts()) : $front1_query->the_post();         ?>     <div>        post content comes here     </div>     <?php      endwhile;      wp_reset_postdata();     ?>      However unpicking the checkbox on a certain post sometimes has no effect. The query still returns all items that at some point have had the checkbox checked regardless if they have it now. Setting `cache_results`, `update_post_meta_cache` and `update_post_term_cache` to false has no effect. Any ideas what might cause this? Is this a cache issue at all, or is CMB maybe at fault?


Import custom database into wp and keep the post id

Hello guys I have a project where I need to import an old database to wp but I need a solution to keep the old id's as posts id so i can make the links look the same as the old website in this way we will avoid problems whit the links already indexed . Any idea ?


Ordering stylesheet above <style> using functions.php

I'm loading a stylesheet and a `style` into the header using functions.php. This works but the stylesheet is being presented below the `<style>`. I need to order the stylesheet **above** the `style` block.               /*-----------------------------------------------------------------------------------*/     /*  Load CSS into header     /*-----------------------------------------------------------------------------------*/          function folio_dynamic_css() {              wp_enqueue_style( 'theme', get_template_directory_uri() . '/assets/css/style.css', false, '1.0', 'all' );              ob_start();              echo '<style type="text/css">';              # css styles here              echo '</style>';              # compress CSS         $output = ob_get_clean();         echo preg_replace('/^\s+|\n|\r|\s+$/m', '', $output) ."\n";          }     add_action('wp_enqueue_scripts', 'folio_dynamic_css', 1 );


Hook/Cron Problem

I have this fuction in my fuctions.php               <?php      if ( !wp_next_scheduled('re-post2') ) {        wp_schedule_event( time(), 'hourly', 'rep-post2' );     }          function repostads() {         global $wpdb;      $querystr = "         UPDATE $wpdb->posts          INNER JOIN $wpdb->repost         ON $wpdb->posts.ID = $wpdb->repost.post_id         AND $wpdb->repost.DIA_FINAL >= NOW()         AND $wpdb->repost.ESTADO = 'OK'         SET $wpdb->posts.post_date = NOW()          ";     }     add_action ( 're-post2', 'repostads' );          ?>      I try to insert the query code in a sample page, and works fine, but when I insert in functions.php don´t make nothing. what´s the error? thanks


Inefficient Query Confusion

**Edit #3 - meta_keys as an array** This seems to compare more than just the "opening_time" I can set the opening time for the wrong date or even leave it blank and it will still grab a post if the "panel_time" is in range. Am I missing something?               $keys = array('opening_time', 'closing_time', 'artist_talk_time', 'special_event_time', 'lecture_time', 'panel_time', 'workshop_time');          $args = array(      'post_type' => 'event',      'orderby'     => 'meta_value',      'order'       => 'asc',      'meta_query' => array(      'relation' => 'OR',         array(             'key' => $keys,             'value' => array($today,$future),             'compare' => 'BETWEEN',             'type' => 'DATE'         ),          )     );      **Edit #2 to show sorting of met_keys after the posts query** This is the code that sorts all the posts by their respective meta keys. It moves this into days and orders by start date whether it is a panel or a workshop.   I just need a way to get posts to this stage. It would be stupid to runt all "events" custom posts types through this since after a few years the list would be very long for the computer to chunk through right? Any suggestions?                     <?php        $event_query = new WP_Query( $args );        if ($event_query->have_posts()) : while ($event_query->have_posts()) :  $event_query->the_post();              $keys = array('opening_time', 'closing_time', 'artist_talk_time', 'special_event_time', 'lecture_time', 'panel_time', 'workshop_time');       $custom_field_keys = get_post_custom_keys();            foreach ($custom_field_keys as $custom_field_key) {          if (in_array($custom_field_key, $keys)) {                   $custom_field_value = get_post_meta($post->ID, $custom_field_key, true);               if ($custom_field_value >= $thedate && $custom_field_value <= $future) {                  $counttest++;                  $times[] = array($custom_field_value, $post->ID, $custom_field_key);               }           }       }            endwhile;             if ($counttest >0) {            echo $counttest;            if ($counttest>=2) {               echo ' Events ';           }            if ($counttest<2) {                echo ' Event ';           }       }       endif;       $counttest=0;            asort($times);             foreach ($times as $event) { $time_value = $event[0]; $post_id = $event[1]; $time_key = $event[2];  // changed the foreach here                if ($time_key == 'opening_time') {/* do something */  }                else if ($time_key == 'artist_talk_time') { /* do something */ }           else if ($time_key == 'closing_time') { /* do something */ }           else if ($time_key == 'special_event_time') { /* do something */ }                rewind_posts();        }        ?>      **Edit to add suggestion about another possible solution to simplify things** Can I put the keys as a series like the code below? I put it into my test site and it seems to work because I have a function below that sorts the posts by the key values. Or does this have problems of its own?               $args = array(      'post_type' => 'event',      'orderby'     => 'meta_value',      'order'       => 'asc',      'meta_query' => array(      'relation' => 'OR',         array(             'key' => 'opening_time','closing_time','artist_talk_time','special_event_time',             'value' => array($today,$future),             'compare' => 'BETWEEN',             'type' => 'DATE'         ),          )     );      Have been trying to figure out where the bottle neck in my code is. I commented different parts to try to isolate to offending portion. If I comment out this section of code it runs at normal speed, but with this query it can take an very long time to load + 10 seconds. Is there an inherent inefficiancy with this query? Is there an easier way to do it. All of the key values are in the format Y-m-d 00:00. Thank you in advance.               <?php          $today = date("Y-m-d 00:00");  //set today's date for upcomming events sidebar       for ($i=0; $i<10; $i++) {       $thedate = strtotime ( '+'.$i.' day' , strtotime ( $today ) ) ;       $thedate = date ( 'Y-m-d H:i' , $thedate );            $thedaytext = strtotime ( '+'.$i.' day' , strtotime ( $todaytext ) ) ;       $thedaytext = date ( 'l' , $thedaytext );            $thedatetext = strtotime ( '+'.$i.' day' , strtotime ( $todaydatetext ) ) ;       $thedatetext = date ( 'F j' , $thedatetext );            $future = strtotime ( '+24 hours' , strtotime ( $thedate ) ) ;       $future = date ( 'Y-m-d H:i' , $future );        $times = array();              $args = array(            'post_type' => 'event',            'orderby'     => 'meta_value',            'order'       => 'asc',            'meta_query' => array(            'relation' => 'OR',               array(                   'key' => 'opening_time',                   'value' => array($today,$future),                   'compare' => 'BETWEEN',                   'type' => 'DATE'               ),               array(                   'key' => 'artist_talk_time',                   'value' => array($today,$future),                   'compare' => 'BETWEEN',                   'type' => 'DATE'               ),               array(                   'key' => 'closing_time',                   'value' => array($today,$future),                   'compare' => 'BETWEEN',                   'type' => 'DATE'               ),               array(                   'key' => 'special_event_time',                   'value' => array($today,$future),                   'compare' => 'BETWEEN',                   'type' => 'DATE'                 )           )       );            $event_query = new WP_Query( $args );             if ($event_query->have_posts()) : while ($event_query->have_posts()) :  $event_query->the_post();            endwhile;       endif;       }


Tax Query is only showing normal posts, not Custom Post types too?

This has been bugging me for the best part of a day now, so I'm appealing to help in order to calm my nerves. I run a site that has many custom post types. Every post type shares the use of the post_tag taxonomy. I need to create a page that shows all the posts that are tagged with "video". It's not working like I expect. It's only showing the normal blog posts - not the other custom post types that are also tagged with 'video'. Below is the code that I've got. For reference the function get_bonn_post_types is an array of all the post types on my install.               $args = array(     'post_type' => array(get_bonn_post_types()),     'tax_query' => array(         array(             'taxonomy' => 'post_tag',             'field' => 'slug',             'terms' => 'video'         )     ));     query_posts($args);      Why isn't this working. Any help is of course much appreciated! :)


WP 3.3 update disabled editor stylesheet? Or TinyMCE Advanced problem?

I have several CMS websites using TinyMCE Advanced plugin and the editor- style.css style sheet to make editor text resemble website text. After updating to WP 3.3, the editor no longer uses the stylesheet on any of the sites. This might not be a WP 3.3 problem: once I updated WP, TinyMCE Advanced showed that it needed to be updated, so updated that. The problem could very well be with the latest version of TinyMCE Advanced. Any clues about why or how to fix? Although I still don't know if the problem is with WP 3.3 or TinyMCE Advanced (I suspect the latter), the following function in my functions.php file enables the editor stylesheet:               // Add custom stylesheet to TinyMCE editor     if ( ! function_exists('tdav_css') ) {         function tdav_css($wp) {         $wp .= ',' . get_bloginfo('stylesheet_directory') . '/editor-style.css';             return $wp;         }     }     add_filter( 'mce_css', 'tdav_css' );      Problem solved.


Problem uploading files, after changing domain name

I just changed my WordPress website domain name (on the same server). Everything works fine, and the paths are correct. I can install plugins and updates without any problem. However, I can only upload media when the `wp-content` directory's permissions is set to 777. When I get it back to 755 I get an error that the file couldn't be copied to the folder. What could cause this problem?


get_the_excerpt() with fallback like the_excerpt()

You know when using `the_excerpt()` and no "excerpt" is set on a post it automatically uses the first 50 words or so. Is the same also possible when using `get_the_excerpt()` For instance I'm using `get_the_excerpt()` like this …               $return .= sprintf('

%2$sa

%3$s

',                     get_permalink( get_the_ID() ),                     get_the_title(),                     get_the_excerpt()             );      However if no excerpt is set, the `get_the_excerpt()` function doesn't show a fallback (the first 50 or so words). Any idea how to make that work?


Why does the TwentyTen Theme sidebar <ul> have a class called 'xoxo'?

Why is the CSS class called 'xoxo'? What does it mean?


Is there a conditional tag to determine whether the post is _any_ custom post type?

We know you can do `if ( is_singular( 'my-cpt' ) )` to test for a _specific_ custom post type, but what about doing one thing if the post is a built-in post type, and another if it is not? Is it enough to just test against `if ( is_singular() && ! is_singular( 'post' ) )`? Or are there some implications or subtleties that are escaping me at the moment?


WP Multisite - How to create a custom "router" for blog prefixes?

I'm trying to create a custom route for a WP Mutlisite network. If you're familiar with WPMS, you know that the db tables for each blog on the network begin with something like `{prefix}_2_`. Normally, visiting `mysite.com/blogname` is what takes you to the blog's homepage. What I'd like to do, is have `mysite.com/2` (look for numeric URI) route to the homepage of the blog whose db tables begin with `{prefix}_2_`. Is this possible?


I customized a few sites. On my own i updated wordpress by diffing the (old) version and my site. Than i moved the folder away and put the new wordpress version and applied the patch. It seemed to work perfectly but binary files were missing (specifically plugin images). So i copied/overwrote the plugin folder. I have a feeling i was lucky that it worked and i didnt do this right. Is diff/patch a good way to update wordpress? Should i be diffing my site from WP and apply it to the new version? Or should i diff the old version and new version than apply that patch to my site? There is also the issue about binary files. How do i update wordpress on customized sites?


iPad WordPress theme?

I want to convert one HTML5/CSS3 theme in WP This theme is build for iPads, now my question is is that possible to convert it? If yes then how? I mean should i create each different page template (ex. dashboard, calender etc..) I just want to conform it before start that how should i need to understand before start it?