TinyMCE with custom buttons on a meta box

Firstly please allow me to apologise - my fourth question in the week that I've been here! You've all been very helpful though, which is why I keep coming back.. I'm trying to put together a custom post type which doesn't utilise the 'editor'. There is a lot of input fields on the page and most of them will need a custom TinyMCE editor. I have meta boxes with textareas. I've tried the following code:                     with...                   if (function_exists('wp_tiny_mce')) {                  add_filter('teeny_mce_before_init', create_function('$a', '                 $a["theme"] = "advanced";                 $a["skin"] = "wp_theme";                 $a["height"] = "75";                 $a["theme_advanced_buttons1"] = "bold, italic, pastetext, pasteword,                     bullist, numlist, link, unlink, outdent, indent, charmap, removeformat, spellchecker, fullscreen";                      return $a;'));                  wp_tiny_mce(true);         }      They don't seem to work together. The TinyMCE editor appears on the right element but it's just the default WP editor, not the settings I've tried to implement. So, my three questions are... **Question 1** When using meta boxes for custom post types, what's the best (by best I probably mean most flexible and integrated and least "hacky") way to add a custom TinyMCE editor to multiple elements? **Question 2** A follow on from Question 1... How do I go about adding custom buttons to such a setup? **Question 3** Is it possible to change the minimum height of the TinyMCE editor? It seems to be force-capped at 100px. My research and attempts at making this work appear to indicate that WordPress' built in TinyMCE functions won't do the job. Might it be best for me to make this completely bespoke, i.e. deregister the existing tinyMCE scripts and register my own? If so, is it possible to only do this on my custom post type pages? Thanks in advance, apologies for the essay! * * * **MAJOR EDIT - QUESTIONS 1 & 2 RESOLVED** OK, courtesy of Martin's post (and Mike's code!) I've managed to set up multiple textareas with custom buttons:               function meta_genus_species() {         global $post;              $genus = get_post_custom_values( 'genus', $post->ID );         $species = get_post_custom_values( 'species', $post->ID );         $etymology = get_post_custom_values( 'etymology', $post->ID );         $family = get_post_custom_values( 'family', $post->ID );         $common_names = get_post_custom_values( 'common_names', $post->ID );              if (!isset($id)) { $id = "etymology"; }         if (!isset($temp_min)) { $temp_min = plugins_url('images/temp_max.png' , __FILE__); }         if (!isset($temp_max)) { $temp_max = plugins_url('images/temp_min.png' , __FILE__); }         if (!isset($pH_min)) { $pH_min = plugins_url('images/pH_max.png' , __FILE__); }         if (!isset($pH_max)) { $pH_max = plugins_url('images/pH_max.png' , __FILE__); }          $tinyMCE = <<<EOT              EOT;         echo $tinyMCE;              ?>

Description of taxonomy.

             Genus
                 <input name="genus" class="text" value="<?php if(isset($genus[0])) { echo esc_attr( $genus[0] ); } ?>" />                 Testing...

             Species
                 <input name="species" class="text"  value="<?php if(isset($species[0])) { echo esc_attr( $species[0] ); } ?>" />                 Testing...

             Etymology             <textarea cols="50" rows="5" name="etymology" id="etymology"><?php if(isset($etymology[0])) { echo esc_attr( $etymology[0] ); } ?></textarea>             Description

             Family             <input name="family" class="text"  value="<?php if(isset($family[0])) { echo esc_attr( $family[0] ); } ?>" />             Description

             Common Names             <input name="common_names" class="text"  value="<?php if(isset($common_names[0])) { echo esc_attr( $common_names[0] ); } ?>" />             Description

         <?php          }          function meta_authored() {         global $post;              $species_author = get_post_custom_values( 'species_author', $post->ID );         $year_described = get_post_custom_values( 'year_described', $post->ID );              ?>
         Species Author
             <input name="species_author" class="text" value="<?php if(isset($species_author[0])) { echo esc_attr( $species_author[0] ); } ?>" />
         Year Described
             <input name="year_described" class="text" value="<?php if(isset($year_described[0])) { echo esc_attr( $year_described[0] ); } ?>" />

         <?php     }      I am absolutely over the moon! I've been working SO hard to find that information. Thank you ever so much Martin :) **Just Question 3 to answer now!**


Load ajax if is_home()

I want to show some simple things on homepage with ajax. The problem is I want to load everything when is_home() is true. Php, js, everything. **In funtions.php:**               add_action('init', 'pint_functions_separation_test');     function pint_functions_separation_test(){          if ( is_home() ) {               require_once('functions_hometest.php');          }     }      **functions_hometest.php:**               <?php     if (file_exists("./wp-load.php") && file_exists("./wp-blog-header.php")){         define('WP_USE_THEMES', false);         require_once("./wp-load.php");         require_once("./wp-blog-header.php");     }          add_action( 'wp_ajax_nopriv_ajaxtest', 'ajaxajaxtest_handle_request' );     add_action( 'wp_ajax_ajaxtest', 'ajaxajaxtest_handle_request' );          function ajaxajaxtest_handle_request() {            echo json_encode("evo me");            die();          }     ?>      **JS:**               <script>     jQuery(document).ready(function () {         jQuery.ajax({             url: '<?php echo admin_url( 'admin-ajax.php'); ?>',             data: ({                 'action': 'ajaxtest',             }),             type: 'POST',             dataType: 'json',             success: function (data) {                 jQuery("#test_div_id").html(data);             }         });     });     </script>      Wordpress on homepage loads functions_hometest.php but **ajax returns 0.** And if I call php file just with                require_once('functions_hometest.php');      everything works great, but I wan't to keep loading of functions on bare minimum. Does that make any sense? PS. I tried to call with               add_action('get_header', 'pint_functions_separation_login');      but i get the same results. Thank you


Author Nickname URL Friendly

Using the below code to chnage the author page url to use the "nickname". Works ok but when the nickname is more than one word it doesnt make it url friendly. Any way to do this?               add_filter( 'request', 'wpse5742_request' );     function wpse5742_request( $query_vars ) {       if ( array_key_exists( 'author_name', $query_vars ) ) {         global $wpdb;         $author_id = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM {$wpdb->usermeta}    WHERE meta_key='nickname' AND meta_value = %s", $query_vars['author_name'] ) );         if ( $author_id ) {             $query_vars['author'] = $author_id;             unset( $query_vars['author_name'] );             }       }        return $query_vars;      }          add_filter( 'author_link', 'wpse5742_author_link', 10, 3 );     function wpse5742_author_link( $link, $author_id, $author_nicename )  {       $author_nickname = get_user_meta( $author_id, 'nickname', true );       if ( $author_nickname ) {         $link = str_replace( $author_nicename, $author_nickname, $link );       }       return $link;      }          add_action( 'user_profile_update_errors', 'wpse5742_set_user_nicename_to_nickname', 10, 3 );     function wpse5742_set_user_nicename_to_nickname( &$errors, $update, &$user ){       if ( ! empty( $user->nickname ) ) {         $user->user_nicename = sanitize_title( $user->nickname, $user->display_name );       }     }


Error instead of search results

I am making a blog (wordpress) and I hope to have a search engine in it. I put the "search" as my widget but when I input something into box, an error page is shown. How can I make a search engine so that it will search the posts in my blog? Thanks so much.


Add screen options to custom admin pages

I want to add screen options to my plugin settings page, like the ones that are available in the Dashboard. ![enter image description here](http://i.stack.imgur.com/GoD60.png) I tried using the `add_option` method of the `WP_Screen` object and found that it supports only two options. `per_page` and `layout_columns`. Does anyone know what screen option to use to get options like the one in Dashboard page? **Edit** : Let me explain what I am trying to a little bit. I have different sections in my Bulk Delete Plugin and each section let's people delete posts based on some criteria (like category, tags, custom taxonomy etc). I want to let users choose which sections they want to use and which sections that they want to hide, similar to the Dashboard page, where users can choose which dashboard widgets they want to see and which ones to hide. Now, to implement this, I want to show a list of checkboxes (one for each section) and let user choose which one to show. To show the list of checkboxes, I had to call the `add_option` method of the `WP_Screen` object. When I was doing that, I figured out that currently `add_option` function only supports these two types and the others are just ignored.   * per_page   * layout_columns But, only in the dashboard page checkboxes are shown. I want to know how to replicate a similar thing in the screen options section of my custom admin page as well.


Is a *.wordpress.com blog easy to migrate?

As a student software developer who is about to graduate, I find it is time to start my own blog. I've been told it is important to make a name for yourself, to stand out from the rest. Therefore I decided to make a Wordpress website. Since I live in Belgium, I would like a `.be` domain. But, I'm new to Wordpress and I want to go full-on with my own theme from the start. However, I would like to avoid the cost of my domain during the development phase of my website, so I'm planning to create it on the free `*.wordpress.com` domain first. ## My question: If I do this, will I have an easy time migrating everything to my own domain? Which features of my web hoster (server, database, disk space, etc) should I look for specifically, to make the process go smoothly?


register_sidebar() will not wrap an element properly

I am trying to add a widget for for some reason I cant wrap an element around the widget. Here's the html in the index.php:

                         <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Intro')) : ?>                                                      <?php endif; ?>

      And here's function.php code:               if (function_exists('register_sidebar')) {         register_sidebar(array(             'name'=> 'Footer',             'id' => 'footer',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ));         register_sidebar(array(             'name'=> 'Intro',             'id' => 'intro',             'before_widget' => '',             'after_widget' => '',             'before_title' => '
',             'after_title' => '
',         ));     }      First sidebar wraps the div as expected the second opens and closes the `<p>` (with some whitespace) before contents of the widget. Issue is the same if I add the p tag in the before_widget/after_widget properties. Here's the output:

test

Studio phi is all about architecture, design aesthetics and helping people to put their great ideas on paper and eventually on the ground or maybe even on the water... as far as our imaginations go.

      What is my mistake? Edit: It seems that div wraps as expected but p won't, no idea why this would make a difference.


Theme options: Display ID of page options

I am building a theme options page and everything is great. There is a function to display the list of page options.               $all_pages = get_pages();     $page_options = array();     $page_list = array();     $page_list_footer = array();     $checked_options = array();          foreach ($all_pages as $page){         $page_list[] = "acera_nav_header_".$page->ID;         $page_list_footer[] = "acera_nav_footer_".$page->ID;         $page_title = get_page($page->ID);         $page_options[] = $page_title->post_title;         $checked_options[] = "not";     }      This is the option:               array(      "under_section" => "Pages",     "name" => "Pages",     "desc" => "",     "id" => "anything",     "type" => "select",     "options" => $page_options,     "tip" => ""),      This is the front end code to display the selected page.               <?php echo stripslashes(get_option('anything'))  ?>      Everything is working just fine, but the problem is that I want to display the name of the page in the admin back end, and to display the ID of the selected page in front end. This way , it displays the name of the page in front end. How can I display the ID instead. Please if there is any solution or tweaks I can do for this, help me, I would be so thankful. Thanks


Move jetpacks Googleplus Author from bottom of post?

i am trying to make jetpack play nicely with my theme. i have moved the sharedaddy Likes and Sharing with great success and would like to target the Google+ author output in the same way. here is the code i am using to remove the sharedaddy likes and sharing                   remove_filter( 'the_content', 'sharing_display',19 );         remove_filter( 'the_excerpt', 'sharing_display',19 );         if ( class_exists( 'Jetpack_Likes' ) ) {                 remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 );         }      and i add it back where i need it with this...                   $get_jet =  '';         if ( function_exists( 'sharing_display' ) ) {                 $get_je = sharing_display();         }              if ( class_exists( 'Jetpack_Likes' ) ) {                 $custom_likes = new Jetpack_Likes;                 $get_je .= $custom_likes->post_likes( '' );         }         if($get_je){             echo '
';             echo    $get_je;             echo '
';         }      How can i target the Google+ author in the same way?


How to get vim to autocomplete WordPress API functions?

I guess built-in omnicomplete is a start, but perhaps we're talking some neocomplcache plugin module or something themsuch? Googling "vim wordpress autocomplete" doesn't really give much.


How to Increment ID value within ACF Repeater Field Loop

The code below is meant to display an Advanced Custom Fields Repeater field. I need to have unique values for the "for" attribute of the Label tag, and for the ID value of the trailing checkbox input field. Also, in order for the field label to work correctly, I need the "for" value to match the ID value of the input field, and each value needs to be unique for each time the field is repeated or displayed on the front end. See how this displays currently on the front end in the source: Imgur The ID and "for" value are blank, but need to be matching values for each row of fields, but also needs to be unique per row.               <?php     if ( get_field('ingredients-list') )     {         echo '
';         while ( has_sub_field('ingredients-list') )         {         echo '
  <input type="checkbox" class="check" id=""> ';                 if ( get_sub_field('quantity') ) echo '' . get_sub_field('quantity') . ' ';                 if ( get_sub_field('measurement') ) echo '' . get_sub_field('measurement') . ' ';                 if ( get_sub_field('ingredient_name') ) echo ''. get_sub_field('ingredient_name') .'';                 if ( get_sub_field('measurement') ) echo '' . get_sub_field('notes')  . ' ';             echo '';         echo '
';     }     echo '
';      } ?>


Menu's breaking, now showing all page links on site

There's something quite odd happening on a site I'm working on I can't figure out why at all. I have a custom post type set up for `news` and categories so the user can select what type of news it is (e.g. specials, offers etc).   On the news archive I have a sub-menu set up linking to all the categories so the user can filter the news items by category.      I have a `category.php` file set up and a function in the functions file that filters the news items on the fly:               function set_post_type_for_category_archive_wpse_101930($qry) {       if (is_main_query() && is_category()) {         $qry->set('post_type', 'news');       }     }     add_action('pre_get_posts','set_post_type_for_category_archive_wpse_101930');      But for some reason when you're on a category archive page, e.g. `www.website.com/news/category/offers` the sub-menu breaks, and instead of being the categories list, it's now displaying a list of all page links on the site, e.g. Home, About, Gallery, Contact etc and I can't figure out at all why this is happening, is there a solution to this? Any suggestions would be greatly appreciated!


How we add tabs in plugin page

I want to add tabs in my test-plugin. I have add a folder '3 test plugin' with file '3 test-plugin.php'. I have activate plugin and add in the setting admin menu. Please give the details of adding tabs in my plugin file. thanks in advance. file code is follow: ## Hello World Options Enter Text " /> (ex. Hello World) " />


How to use radio buttons in WordPress plugin options using register settings?

How do I get this to save the radio buttons? It saves the checkboxes but I've tried a lot of methods and can't get it to save the radial buttons. Any help will be appreciated. Working Plugin Example just drop into wp-content/plugins/myplug folder.               <?php     /*     Plugin Name: myplug     Version: 0.1     Plugin URI: http://myplug.org     Author: ME     Description: Stupid plugin     */          add_action('admin_init', 'myplug_register_options');  // register options for the form     add_action('admin_menu', 'myplug_admin_links');  // register admin menu hyperlinks          /** Function to register form fields **/     function myplug_register_options(){         register_setting('myplug_options_group', 'myplug_settings', 'myplug_validate');     }          /** Function to add hyperlinks to the admin menus using hooks and filters. **/     function myplug_admin_links() {       add_options_page('myplug Setup', 'myplug', 'manage_options', 'myplug', 'myplug_admin_page' );  // add link to settings page       add_filter( 'plugin_action_links', 'myplug_settings_link', 10, 2 );  // add link to plugin page     }          /** Function to create link for plugin_action_links filter **/     function myplug_settings_link($links, $file){         if ( $file == plugin_basename( dirname(__FILE__). '/myplug.php')){                 $settings_link = '' .__('Settings') . '';                 array_unshift( $links, $settings_link ); // place before other links         }     return $links;     }          /** Validate User Input **/     function myplug_validate($input) {         $input['value1'] = wp_filter_nohtml_kses($input['value1']);         $input['value2'] = wp_filter_nohtml_kses($input['value2']);         $input['select_display'] = wp_filter_nohtml_kses($input['select_display']);     return($input);     }          /** Draw the Settings Page **/     function myplug_admin_page(){     ?>

Options
       <form method="post" action="options.php">       <?php settings_fields('myplug_options_group'); ?>       <?php $myplug_options = get_option('myplug_settings'); ?>             <input type="checkbox" name="myplug_settings[select_value1]" value="1" <?php checked('1', $myplug_options['select_value1']); ?> />             value1:             <input style="display:inline-block;width:300px;" type="text" name="myplug_settings[value1]" value="<?php echo $myplug_options['value1']; ?>" />
             <input type="checkbox" name="myplug_settings[select_value2]" value="1" <?php checked('1', $myplug_options['select_value2']); ?> />             value2:             <input style="display:inline-block;width:300px;" type="text" name="myplug_settings[value2]" value="<?php echo $myplug_options['value2']; ?>" />
             <?php echo 'display:  ' . $myplug_options['select_display'] . '
'; ?>             <input type="radio" name="select_display" id="item1" value="item1"     <?php if($myplug_options['select_display'] == 'item1') echo 'checked="checked"'; ?> />             <input type="radio" name="select_display" id="item2" value="item2"     <?php if($myplug_options['select_display'] == 'item2') echo 'checked="checked"'; ?> />       <?php submit_button(); ?>       </form>
     <?php     }     ?>


Shortcode are not working in Option tree textarea

I am using option tree. In textarea, i place shortcode               [layerslider id="1"]      its not working, i also found same post replied by plugin author allow shortcodes in textarea in option tree applied the               do_shortcode('[layerslider]');      still no solution


get_usermeta() deprecated in favor of get_user_meta(). But why doesn't it make use of it?

While coding WP I just wondered about this simple fact: `get_usermeta()` is deprecated since version 3.0. The warning suggests me to use `get_user_meta()`. Even the parameters are pretty similar, I wonder why the deprecated function is not making use of the new function as well. Isn't that a sign that the new function does not really does what the deprecated did? I'm wondering because I need to replace deprecated calls and wonder a bit. What makes me even wondering more is the simple fact that `get_user_meta()` is quite an alias of the 2.9 function `get_metadata()` with only a constant value'ed parameter 'user' given. Help ;) _**Edit:_** A counter-example is `clean_url()` - it's deprecated, the error message shows what this is about and the deprecated function aliases the new one: `esc_url()`, so it's clear what to do.


Random Featured Image Based on Category

I am looking to extend the below code to select a random featured image based on a specific category. The below works but uses an overall list of images to pull from vs a list of images based on specific categories. In the below, any image starting wtih "UF-" is selected at random to be used as the featured image. Can someone help point me in the right direction? Ideally, looking to have several images for each category that are used at random.               function autoset_featured() {          global $post;          $already_has_thumb = has_post_thumbnail($post->ID);          if (!$already_has_thumb)  {              $attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" );              if ($attached_image) {                   foreach ($attached_image as $attachment_id => $attachment) {                        set_post_thumbnail($post->ID, $attachment_id);                   }              } else {                   set_post_thumbnail($post->ID, get_image());              }          }     }          function get_image(){          $list = array();          $data = array();               $media_query = new WP_Query(                         array(  'post_status' => 'inherit',                                 'post_parent' => 0,                                 'post_type' => 'attachment',                                 'post_mime_type' => 'image/jpeg'                   ));               foreach ($media_query->posts as $post) {               $fullpath = wp_get_attachment_url($post->ID);           $list     = (explode("/", $fullpath));           $string   = $post->ID.'|'.$list[sizeof($list)-1];                    if (substr($list[sizeof($list)-1],0,3) == 'UF-') {                 array_push($data,(explode("|", $string)));                     $idx      = mt_rand(0, count($data)-1);             $img_id   = $data[$idx][0];               }          }               return $img_id;     }          add_action('the_post', 'autoset_featured');     add_action('save_post', 'autoset_featured');     add_action('draft_to_publish', 'autoset_featured');     add_action('new_to_publish', 'autoset_featured');     add_action('pending_to_publish', 'autoset_featured');     add_action('future_to_publish', 'autoset_featured');


Is there ANYTHING about this query that's incompatible with WordPress 2.9.2?

I've been puzzling over this one for two days. Still can't figure it out. I'm testing a theme release in multiple versions of WordPress using xampplite on localhost on a PC. I'm having a problem on WP 2.9.2 that does not occur on any other newer installations of WP. Take a look at the query below. As long as I leave the commented line in place, it works fine. However, when I uncomment the line, it crashes my xampplite Apache server. WTF?               $the_query = new WP_Query(array(       'posts_per_page' => 5,       'offset' => 0,        'order' => 'ASC',       'post__not_in' => get_option("sticky_posts"),     //  'cat' => get_cat_ID('top-menu'),       ));     print "<p>header.php";exit;      I've even tried to hard code the cat attribute to a static number:               'cat' => 3      It still crashes! Is this a problem with the code, wordpress 2.9.2 or with my Xamplite setup? Seems odd that it works in all newer other versions of WP I've got set up on this same box.


Does wordpress.com appears in the URL if I buy custom domain service from WP.com

Let's say I buy a custom domain myblog.com and I host at wordpress... if I access the dashboard page on my blog, will it have wordpress.com in the URL? I want to be able to manage my blog behind school firewall.. thanks


Do multiple jobs on date change without WordPress cron job

I m trying to randomize several posts on my client's site which are on different pages , everyday. So I wrote a function which returns true on date change, and if does, I randomize the post ids and save them into the database and use the same values throughout the day, So here is what I m doing,               function comi_date_change(){          date_default_timezone_set('Asia/Kolkata');         $current_date = date('j F Y');         $comi_current_date = get_option('comi_current_date');         if($current_date == $comi_current_date){              return FALSE;         }else{             update_option('comi_current_date', $current_date );               return TRUE;         }     }      When I check the condition mocomi_date_chage() to be true or false, it works but only once, because, the moment this function executes, it saves the current date into the database and it returns false for the rest? I don't want to use WordPress cron job function `wp_schedule_event()`, is there any alternative? Thanks


Only Show an Advanced Custom Fields custom field on a specific template

I am building a site that will rely on Advanced Custom Fields to control the information displayed on a page template. Is there a way I can programmatically show a field (or fieldgroup) only when that template is selected?


Prev and Next link for splitting single post into multiple pages

I have pagination on my site like this: > Pages 1 2 3 4 … and so on. I am doing this by adding `<\--nextpage-->` where i want to split my long pages into multiple pages. I want to add previous and next links to the page numbers that looks like this: > Prev 1 2 3 4 5 6 7 Next


Taxonomy search filters

I have developed an educational courses database of several countries using several taxonomies. Country, institute, study level and some other are taxonomies. If user click on some country, all courses in that country will appear. How the result can be filtered (institute, study level etc) while remaining in the same country. I would like to put it on archive page so each search could be further filtered.


How to override my plugin's php classes with duplicates that are in my child theme folder

I have a child theme in wordpress and one of the plugins I am using is called jigoshop. I made a copy of a few php classes from the plugin and placed them in my child theme folder. I want these clases to override the ones from the plugin folder. How would I go about doing that? Thanks!!


Using the Settings API, how should I add multiple values to an option?

I'm trying to add/ update additional values to an option created with the Settings API. I'm trying to do this with my validation callback function, but I'm not getting very far. Here is my code:               function tccl_settings_option_validate( $input ) {         add_option( 'tccl_settings_option', $input );     }      This is causing a pretty big error. How should I be doing this? What I would like to do is use the validation callback to add values to the option array without overwriting it.


Custom Post Type Archive Page not showing

I have a category on my website called 'profiles' I am in the process of moving this category to a custom post type called 'profiles'. My problem is I cannot get the archive page to show for this custom post type. When I go to the url `mywebsite.com/profiles` it takes me to a single post page for a post in the profiles category. I have included `has_archive = true;` in my `functions.php` I didn't have a problem creating an archive page for another custom post type I did on the same website so Im really lost as to why this is not working this time. Any advice would be most appreciated?               add_action( 'init', 'profile_custom_init' );          /* Here's how to create your customized labels */     function profile_custom_init() {     $labels = array(         'name' => _x( 'Profiles', 'post type general name' ), // Tip: _x('') is used for localization         'singular_name' => _x( 'Profile', 'post type singular name' ),         'add_new' => _x( 'Add New', 'Profile' ),         'add_new_item' => __( 'Add Profile' ),         'edit_item' => __( 'Edit Profile' ),         'new_item' => __( 'New Profile' ),         'view_item' => __( 'View Profile' ),         'search_items' => __( 'Search Profile' ),         'not_found' =>  __( 'No Profile found' ),         'not_found_in_trash' => __( 'No Profile found in Trash' ),         'parent_item_colon' => ''     );          // Create an array for the $args     $args = array( 'labels' => $labels, /* NOTICE: the $labels variable is used here... */         'public' => true,         'publicly_queryable' => true,         'has_archive' => true,         'show_ui' => true,         'query_var' => true,         'rewrite' => true,         'capability_type' => 'post',         'hierarchical' => false,         'menu_position' => 10,         'supports' => array( 'title', 'editor','thumbnail', 'excerpt', 'custom-fields' ),             'taxonomies' => array('category')         );               register_post_type( 'profile', $args ); /* Register it and move on */     }


Loading wp-load.php in an external PHP file throws unknown error

I'm loading wp-load.php in order to access WP functions inside of a PHP file that I'm using to process form submissions. Everything works perfectly fine on localhost and every server I've tested (except one). It does not, however, work on one particular server (which is running on rackspace). I'm loading it like this:               $oldURL = dirname(__FILE__);     $newURL = str_replace(DIRECTORY_SEPARATOR . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'cgc-post-image-gallery' . DIRECTORY_SEPARATOR . 'includes', '', $oldURL);     include($newURL . DIRECTORY_SEPARATOR . 'wp-load.php');      This is in a file called process-submission.php that is called when the form is submitted. The error is thrown after the form is submitted. Unfortunately, the server is configured such that it does not display what the actual error is, only that an error has occurred. The really weird thing is that I have another plugin running (that I wrote) on the exact same server and site that is loading wp-load.php in the exact same manner, except it works perfectly fine! Through some testing I have been able to determine that the error is thrown the moment the include() function is reached. I thought perhaps this file loading wp-load.php and the other plugin (the one that is working) loading the file might be causing a conflict, but the other one still works perfectly fine. Also, neither of the files are ever actually loaded in WP (only accessed from the form on the front end), so there is no redeclaring of anything. Any ideas why including wp-load.php would throw an error in this instance, but not the other? The problem also occurs if I try to load wp-blog-header.php


Automatically install wordpress plugin at theme activation

I'm looking into using http://tgmpluginactivation.com/ to activate required plugins for my custom theme during the theme activation step. From what I can tell, this class only Activates plugins automatically, but it doesn't automatically Install plugins I have bundled with my theme. Does anyone know if it's possible to automatically Install plugins upon theme activation? Preferably, in a way that can still make use of TGM?


Testing for a shortcode using a function. 404 page throwing PHP Notice

I'm using the following function (can't remember where I found it, but I think it was written by pippin so thanks to him) to test for a shortcode.               function has_shortcode($shortcode = '') {             $post_to_check = get_post( get_the_ID() );             // false because we have to search through the post content first        $found = false;             // if no short code was provided, return false        if ( !$shortcode ) {           return $found;        }             if (  stripos( $post_to_check->post_content, '[' . $shortcode ) !== false ) {           // we have found the short code           $found = true;        }             // return our final results        return $found;     }      The problem is, on a page such as a 404 page I get the following errors:               Notice: Trying to get property of non-object in /wp-includes/post-template.php on line 30     Notice: Trying to get property of non-object in theme-functions.php on line 49      On theme-functions in line 49 is this line from the above function               if (  stripos( $post_to_check->post_content, '[' . $shortcode ) !== false ) {      If I remove the function call **if( has_shortcode('gallery') )** ... from another file, the two errors go away. I believe the two are related and if I fix the function it will clear them both. I can "kind of" understand why this is happening... my understanding is that on the 404 page there is no $post variable set so somehow I need to modify the function to test first. Am I right?


How to export bbPress (forums, topics, replies) and all users?

I've searched a little and I could not find a straight working answer. I want to export all users and their bbPress(2.1.2) forums, topics and replies to another fresh WordPress installation? If anyone has a suggestion. Thanks


get_the_excerpt() not returning anything when post has no excerpt

When trying to call `get_the_excerpt()` the page does not return anything on posts that have no excerpt. I thought WordPress usually 'fake' it and create one using the first x characters from `the_content()`. Or have things changed?


How to modify post content before writing to database?

Hi~ I'm back again and I'm trying to add another function to the script I was working on a plugin that notify my friends of new post that mentions(@) them. Now I want to change the plain text of my friends' names that I mentioned into links to their own wordpress blog address (if they have) once I hit publish. So @David will become David. I search this question many times but all results are like following:               add_filter('the_content', 'replace_custom_word');      which doesn't really modify the database, right? Edit: I don't know, maybe I'm wrong. Below is the code I'll use to get David's blog address.                       $friend_url = $wpdb->get_var( $wpdb->prepare( "                                                                 SELECT comment_author_url                                                            FROM $wpdb->comments                                                            WHERE comment_author                                                            LIKE %s ",                                                            $friendCorrectName                                                            )) ;      So please tell me what's the best way of doing this. Thanks a lot in advance! The complete code for this script is pasted below too, please feel free to comment on what I have now too. :） You can check out my last post if you see something weird, or you can just ask me.               function email_friend()  {              // get post object         $post = get_post($id);         // get post content         $content = $post->post_content;         // get how many people is mentioned in this post         $mentionCount = preg_match_all('/(@[^\s]+)/', $content, $matches);                   // if there is at least one @ with a name after it         if (0 !== $mentionCount) {                  $friendList = array();//for storing correct names                  for ($mentionIndex=0; $mentionIndex < $mentionCount; $mentionIndex++) {                      $mentionName = $matches[0][$mentionIndex];                   $mentionName = str_replace('_',' ',$mentionName); //change _ back to space                 $mentionName = substr($mentionName, 1); //get rid of @                 //for security and add wildcard                 $friend_display_name_like = '%' . like_escape($mentionName) . '%';                       global $wpdb;                      // get correct name first                 $friendCorrectName = $wpdb->get_var( $wpdb->prepare( "                                                                     SELECT comment_author                                                                FROM $wpdb->comments                                                                WHERE comment_author                                                                LIKE %s ",                                                                $friend_display_name_like                                                                )) ;                      // get friend email by comment author name                 $friend_email = $wpdb->get_var( $wpdb->prepare( "                                                                     SELECT comment_author_email                                                                FROM $wpdb->comments                                                                WHERE comment_author                                                                LIKE %s ",                                                                $friendCorrectName                                                                )) ;                      // get friend's blog address                 $friend_url = $wpdb->get_var( $wpdb->prepare( "                                                                 SELECT comment_author_url                                                            FROM $wpdb->comments                                                            WHERE comment_author                                                            LIKE %s ",                                                            $friendCorrectName                                                            )) ;                      //if we have David's blog address in database                 if ($friend_url) {                               //this is where I need help with.                      //I need to modify post content before writing it into database now                     //I need to change the plain text name after @ to a link to his blog                                                                   }                      if($friend_email) {// if found email address then email                          $postTitle = get_the_title($id);                     $post_permalink = get_permalink( $id );                     $to =   $friend_email;                     $subject =   'Arch!tect mentioned you in his new post 《'.$postTitle .                      '》';                     $from = "noreplay@swotong.com";                     $headers = "From:" . $from;                     $message = "Arch!tect mentioned you in his new post《".$postTitle .                      "》 check it out？\n\n"  ."Post link：".$post_permalink                     ."\n\n\nPlease don't reply this email.\r\n";                          if(mail($to, $subject, $message, $headers)) {                         //if send successfully put his/her name in my list                         array_push($friendList, $friendCorrectName);                     }                      }                   }              $comma_separated_list = implode(",", $friendList); //friend list array to string                   // now send an email to myself about the result             $postTitle = get_the_title($id);             $post_permalink = get_permalink( $id );             $to =    'myOwn@email.com';             $subject =   "Your new post《".$postTitle .              "》has notified ".count($friendList)."friends successfully";             $from = "noreplay@email.com";             $headers = "From:" . $from;             //list all friends that received my email             $message = "Your new post《".$postTitle .              "》has notified ".count($friendList)."friends successfully:\n\n".             $comma_separated_list;             mail($to, $subject, $message, $headers);         }          }//end of email_friend function          add_action ( 'publish_post', 'email_friend' );      **EDIT2: to be more specific, the code above where I comment " //this is where I need help with. " is the place I need help with.**


Add Bootstrap Classes to Recent Posts Widget

I am building a site that is based on an existing theme, lawyers. I am tasked to make the recent posts widget look like the practice areas section, I would need to add some structural divs (bootstrap "rows") and classes on the list items so the widget output would look like this:

Recent Posts Widget Title

Recent Post

Recent Post

Recent Post

Recent Post

      I'm assuming this can be done relatively easily with filters, i'm just not too sure how.


Add extra field when admin create user

I have created extra field that user can edit on their 'Your Profile' page. The extra field also available on WordPress register page. What I want to ask is, how to add the field to User > Add new page ? So, when admin creates a user, admin also input the user's extra field


Syntax Highlighting Plugins and 3.2.1

I was looking for some decent syntax highlighting plugins to display php code on posts. But most of the plugins in the wordpress repository are not updated for years. I found wp-syntax causing issues with the theme. So is there any good plugin with less bugs and better syntax highlighting that works fine with wordpress 3.2.1 ?


Licensing: Can I include SWFs without source in a plugin released on wordpress.org?

Suppose I create a WP plugin that includes a couple of SWFs that I create (not third-party SWFs). According to http://wordpress.org/extend/plugins/about/ , if I want to publish that plugin on wordpress.org I have to release it as GPLv2 or compatible. The first question is more theoretical:   * Do I have to release the source code for the SWFs for GPLv2 compliance? Doing a little research, it appears this question has been argued before: http://smackdown.blogsblogsblogs.com/2011/02/18/as-it-turns-out-wordpress-itself-is-not-100-gpl-compliant-after-all-and-they-violate-the-mit-license-as-well/ . The second question is more practical:   * If I tried to release a plugin that includes SWF "binaries" without source code on wordpress.org:     * Would I be blocked from publishing the plugin on wordpress.org?     * Would I be permitted to publish it, but publicly excoriated?     * Would nothing happen? Thanks for your thoughts, JP


Showpost and last

I need your help. I would like to bring up the last (number) from my template classified ads. Here's the code:               <?php      $the_query = new WP_Query( array(                 'showposts' => 10,                 'post_type' => 'ad',                 'tax_query' => array(                                     array(                                     'taxonomy' => 'ad_category',                                     'field' => 'id',                                     'terms' => array('8')                                     )                                 )         ));     if($the_query->have_posts()):     ?>

Category

         <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
                 <?php colabs_image('width=150&height=150&play=true');?>                 <a href="<?php the_permalink();?>"><?php the_title();?>
         <?php endwhile; ?>

     <?php endif;?>      I tried with showpost, but nothing appears in one ad ... this is not even the last announcement.


Multiple Custom Headers

I am trying to add this function:               add_theme_support( 'custom-header' );      I would like this to somehow combine with multiple headers. I saw some code that was PHP that checked which template was loaded then add the image (header) that was defined in the code. This is not totally optional since I want my theme to allow the user of the theme to change the header for his "buyers" template, the "sellers" template, so forth. Is there any way to make the 'custom header' page allow several custom headers that are called on different templates?


Inserting a Download Link in the Quick Edit Actions of the Media Library?

What's the best way of doing this: On The 'Media Library' page, I would like a link next to 'View' (the 'View' that appears when you hover over a Media item) for 'Download'. The 'Download' hyperlink would link directly to the file, unlike the 'View' link which links to a template-based page with either the embedded image or a link to the non- image file. I have a lot of PDF's in my media library that I look up regularly, having to click on 'View' and then click on the hyper-linked file name just to get to the file is a little cumbersome.


Add all typography options with options tree

I'm new to WordPress theme development, and I had to create a theme with options tree. I have successfully add some options with options tree plugin in my Wordpress theme. But I am really stand when I go to add typography option. I have complete section an settings on theme option with `'type' => 'typography'`, after that I see I have find some options on dashboards theme options like `'font-family'`, `'font-size'`, `'line-height'`, `'font-style'` etc. Now I want to query all methods, but I do not know how can I do this?


Create a blank test.php

Sometimes it's necessary to figure out CSS errors or whatever and then it's great if you have a minimal test page where you just insert the specific code you want to test. How can I create such an empty test.php? All I could find was this. However, doing so will only create a page that will have the same styling as the page.php one, no? I suppose I need to put something into my function.php to tell Wordpress that it should create a new template for test.php? How would I do that? Thanks a lot in advance! :)


How do I load my site without the side bars? This is for an app

My site has a left side bar where I display categories and ads and what not. We are creating a basic android app for it and we are trying to figure out how to load the site on the app without sidebars. I know that I can disable the side bars in the options of WP but I don't want to disable them because I want people to be able to see the sidebar when they visit the site. Is there a trick to just loading the site without including the side bar? I just want to target the middle frame of the site. Any help would be appreciated. site: tablified.com


XML-RPC and post_date

I'm trying to set the post_date via XML-RPC and keep getting an error saying the XML isn't formatted properly. The code goes something like:               $post = get_post( $post_id );          $response = $client->query(          'wp.editPost',         array(              0,              $user,              $pw,              array(                  'post_date' => $post->post_date              )          )      );      I'm hitting the same issue with `wp.newPost`. I know the date should be formatted ISO8601 but I'm just having no luck getting it formatted right.


How to link avatar and nickname to profile

On the single post page I want to link the avatar function to the author profile, but I tried               <a href="<?php the_author_posts_link(); ?>">     <img src="<?php echo get_avatar($post->post_author, '64', $avatar); ?>">           but that doesn't work. Also, how can I display the nickname (display name) and still link to the profile the following code gives a strange link and 404s               <a href="<?php echo get_author_posts_url(); ?>"><?php the_author_nickname(); ?>      some help would be greatly appreciated. Thanks


Search result permalink

how to make permalink available for search result page /?s=one+two+ok to /search/one-two-ok/ thank


How to auto update to latest WP version in IIS localhost?

I have WordPress installs in my IIS localhost server on Win7 desktop done manually and with WebPI install.Both installs are under IIS default website. Either asks for FTP credentials when I try to auto update to the latest WP version. I have FTP server enabled on IIS (users IUSR and Richard). I have checked that read write permissions are enabled on the wordpress root & wp-content folders.   I try putting in the credential values but keep getting no response or > ERROR: There was an error connecting to the server, Please verify the > settings are correct. Credentials asked for are Hostname/FTP user/FTP password and I have tried all manner of credentials I think might be correct but obviously are not. (eg `ftp://localhost`- IUSR -site password etc etc). I am most unsure about the FTP password. I have asked for help with this on WordPress forum, WordPress codex, IIS7 forum, googled & tweeted for help to fix this and found no answer! There are several threads about the issue but most say the fix is to enable read write folder permissions and there is something about using `web.config` file and also editing `wp-config.php`. I do not really want to edit `wp-config.php`. What I really want is to enter the correct ftp credentials for WordPress on IIS and have it work and autoupdate to the latest version. Does anyone know what ftp credentials I have to use to get this done please? Has any WordPress IIS localhost user experienced this and dealt successfully with this ftp autoupdate? Edit 10/10/12 >> Hi mauri- many thanks for your very helpful reply. I followed your instruction on my WordPress blog that MS WebPlatformInstaller(WPI) installed for me and (ta da!) it worked as you said-ie it autoupdated to the latest WP version without asking for the ftp credentials. My only issue is I'm not sure what this is or what I really did apart from following your instruction! I would like to understand all this 'jiggery-pokery'! I add Authenticated users & gave them full permission. I would also really like to fully understand my localhost IIS server...I would also like to know how to set my IIS up so when asked for the ftp credentials I can put in the info & have it work that way too! However very many thanks for your very helpful reply


displaying the categories post

I have this php code below for displaying the post from the specific categories.
     <?php query_posts('category_name=slideshow&showposts=10');     while (have_posts()) : the_post();     echo "
".the_content()."
";     endwhile;?>
      as you can see, it display those post in the category slideshow and the structure of that should be this.

the post 1

the post 2

the post 3

      but the output that is generated is this.

three

two

one

      and the generated structure should not look like that and it looks nasty at all, so im having a problem on this on how to display it properly like to display into this structure.

the post 1

the post 2

the post 3

      So Im wondering if there's someone who could tell me how to fix this. Im open into any suggestions, recommendations and suggestions. Thank you.


Remove a plugin meta box from the dashboard

I'm trying to remove the meta box that the Download Manager plugin creates, as it uses a hardcoded http iframe, caused a mixed content error in ssl. Here is the code that generates the meta box:               wp_add_dashboard_widget('wpdm_dashboard_widget', 'WordPress Download Manager', 'wpdm_dashboard_widget_function');      and here is the code I'm using in my theme's functions.php file:               function remove_dashboard_widgets(){         remove_meta_box('wpdm_dashboard_widget', 'dashboard', 'normal');     }     add_action('wp_dashboard_setup', 'remove_dashboard_widgets');      I also tried 'dashboard-network' as the 2nd parameter, as I'm running a multisite setup. Neither worked for me. Where am I going wrong?


Change the behaviour of archive cpt category and single cpt by plugin, not by theme

I need to know: I have wrote at 60% one plugin, it works well in backend (some settings, some cpt, some custom fields... nothing special). It uses custom post type with custom fields. For now I need to change default archive category behaviour as well as change behaviour of single posts of this CPT _doesn't_touching_ templates (because this plugin will be used not only in the 1 site and there will be many templates). Just programmatically, by filters/actions - change it as I like.. for example, I will need to show up this custom fields in this single custom post type. Does somebody knows about how to do it by plugin?


Force display name as full name

Is there a way I can force all users display names to be `Firstname Lastname` or alternatively change this to be the default?


Custom Post Types in the WordPress Navigation Menu

Hello can someone help me out by pointing me in the right direction as to where I can find out how to add a drop down menu to a theme with my custom post types stored within in, have been looking/searching google for "custom post types in wp_nav_menu", "custom post types in wp_list_pages", "custom post types in wordpress themes", "custom post types in wordpress theme", and have drawn a blank so far, I have managed to find out how to get my posts in the custom post types to appear in with the normal blog posts, but as I will have several posts in the custom post types more than what would be in the normal blog, would make this diluted and I would therefore like to have them in a drop down box in the menu. The menu on this website here http://justintadlock.com/ the "Writing" part on the menu I presume that these are custom post types, but I wish to have the menu on my site like this menu, if anyone can point me in the right direction as to how to achieve this, be is something on the codex, a blog post or something like this I would very much appreciate anything anyone would be able to tell me.


If/Else child list for Custom Post Type single template within loop?

I'm trying to add a feature to my 'Services' custom post type single template that displays one thing if the post type has one or more child post types and another thing if it doesn't. So far I've come up with this, however it doesn't seem to work as expected:               <?php     if($post->post_parent)     $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else     $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0"); ?>     <?php if ($children): ?>

     <?php echo $children; ?>

          <article class="four-column spacer align-left <?php post_class(); ?>"id="post-<?php the_ID(); ?>" role="article">          <?php the_content(); ?>
          <?php else : ?>          <article class="six-column spacer align-left" id="post-<?php the_ID(); ?>" role="article">          <?php the_content(); ?>
           <?php endif; ?>      Can anyone help me and point me in the right direction please? I have set up the Services post type to hierarchical => true and capability_type => post (and have tried page) but still no luck. Obviously the code above needs to sit within the standard page loop. Does this mean I need to use query_posts instead? Many thanks, Adam


Redesigning Custom Post Type "Add New" page

I've been browsing all over google for a solution to this. I'm writing a custom post types plugin for work to log-in visitors that we get. I initially wrote a mock-up _without_ custom post types, then I came around here from a google search and saw a screenshot that showed an example of custom post types to store information about Attorneys. It showed that someone redesigned the "add new"/"edit" page for custom post types with a whole new interface. I was wondering if wordpress @ stackexchange would have any resources to redesign the custom post types "add/edit" pages. I can't remember the search terms that I did to find that article however. Thanks,   -Zack


Can a scrollable date picker be done in Wordpress for archives?

I've been asked by a client to do this: ![enter image description here](http://i.stack.imgur.com/1jJCe.png) But I have no idea how I would go about it, particularly in Wordpress. I searched around Google a bit, but it looks like this design was just lifted from an iPhone or is a Flash animation (I'm lame at Flash, so want to keep things all-based in HTML, CSS and JS - preferably jQuery). Has anyone done this sort of thing? I'm assuming it would be quite complicated as the date picker needs to be populated dynamically as more and more posts are archived and to load the different queries created by selecting a month and year (to show the list of article titles to the right of it) would require some Ajax right? Thanks for any pointers, especially if you can show me where a tutorial exists for this! Osu


Remove from "Wordpress" when reciving email (Should I remove filter?)

I am getting "Wordpress" when I sending my email using wp_mail. So to remove "Wordpress" from my e-mail I am using filter like so:               //Remove "Wordpress" when receiving email      function remove_from_wordpress($email){     $wpfrom = get_option('blogname');     return $wpfrom;     }          add_filter('wp_mail_from_name', 'remove_from_wordpress');      It works great and now I am getting site name instead.      My question: Is this a proper way to do it? Because I am concerned that my filter will maybe break some other plugins. If that is the case how can I avoid that?   Thank you.


Why does my css file keep caching on wp-multisite?

I am quite a newbie in web design and I hope someone can solve this problem for me, I have also tried wordpress forum but can't find the answer. I have a multisite (sub domain) with a strange caching problem that only happens on all sub sites. Everytime I make a css change I have to wait 10mins/a few hours until it takes effect. I'm trying to find out where my theme css files keep caching, its not browser caching, I don't have any cache plugins, and no caching in my htaccess, I have shared hosting and all my host caches are disabled who have also confirmed this. Even if I start a brand new install of multisite with no plugins installed, this will keep happening to all sub sites. My main site is: http://reccoa.com and I have a sub site on: http://test1.reccoa.com both are sharing the same theme For this example I have just deleted my custom1 theme css file: wp- content/themes/custom1/style.css so if you view reccoa.com, it will have no stylesheet and if you view page source and click the following link:               <link rel='stylesheet' id='andym-css' href='http://reccoa.com/wp-content/themes/custom1/style.css?ver=2.0.2' type='text/css' media='all' />      You will get a 404 error, and rightly so because I've deleted the css file. but if you view: http://test1.reccoa.com, this site displays with the css file. And if you view page source and click the following link:               <link rel='stylesheet' id='andym-css' href='http://test1.reccoa.com/wp-content/themes/custom1/style.css?ver=2.0.2' type='text/css' media='all' />      You can see my whole stylesheet (that will take 10mins/a few hours before it removes). Where is this css file coming from when I have deleted it? Does anyone know how I can find out where this file is coming from on my server: http://test1.reccoa.com/wp-content/themes/custom1/style.css?ver=2.0.2


Wordpress theme switcher

I want to set up a theme demos site, so I am looking for a theme switcher. I have tried a few of them, they create the demo url like:               example.com/whatever?themedemo=theme-name      But I am looking for any plugin which generates cleaner urls, for example: example.com/whatever/theme-name If there is any, please let me know. So I am looking


400 Bad Request on Custom Post Type Rewrite

I'm doing some rewriting of the url for a taxonomy and custom post type based on some code I found on here. However on my custom post type archive url I'm getting a 400 Bad Request. I honestly just want to redirect it, but none of my attempts to do so seem to work. My url looks like:               http://example.com/products/%product_description%/      Here is my actual code:               register_post_type('products', array(     'labels' => $labels,     'public' => true,     'show_ui' => true,     'menu_icon' => 'dashicons-admin-plugins',     'capability_type' => 'page',     'hierarchical' => true,     'rewrite' => array('slug' => 'products/%product_description%', 'has_archive' => 'products'),     'query_var' => true,     'exclude_from_search' => false,     'supports' => array(       'title', 'editor', 'revisions',     ),     'show_in_menu'  => true,     'has_archive' => true,       ));     }     add_action('init', 'cptProducts');               function taxProductDescriptions() {       register_taxonomy('product-descriptions','products',     array(       'hierarchical' => true,       'labels' => array(         'name' => _x( 'Product Descriptions', 'taxonomy general name' ),         'singular_name' => _x( 'Product Description', 'taxonomy singular name' ),         'search_items' =>  __( 'Search Product Descriptions' ),         'all_items' => __( 'All Product Descriptions' ),         'parent_item' => __( 'Parent Product Description' ),         'parent_item_colon' => __( 'Parent Product Description:' ),         'edit_item' => __( 'Edit Product Description' ),         'update_item' => __( 'Update Product Description' ),         'add_new_item' => __( 'Add New Product Description' ),         'new_item_name' => __( 'New Product Description Name' ),         'menu_name' => __( 'Product Descriptions' ),       ),       'rewrite' => array( 'slug' => 'products', 'hierarchical' => true, 'with_front' => true ),       'query_var' =>true,     )       );     }     add_action( 'init', 'taxProductDescriptions' );               add_filter('rewrite_rules_array', 'mmp_rewrite_rules');      function mmp_rewrite_rules($rules) {     $newRules  = array();     $newRules['products/(.+)/(.+)/(.+)/?$'] = 'index.php?products=$matches[3]'; // my custom structure will always have the post name as the 5th uri segment     $newRules['products/(.+)/?$'] = 'index.php?product-descriptions=$matches[1]';          return array_merge($newRules, $rules);     }          function filter_post_type_link($link, $post)     {     if ($post->post_type != 'products')     {       $link = str_replace('%product_description%', '', $link);       return $link;     }          if ($cats = get_the_terms($post->ID, 'product-descriptions'))     {         foreach($cats as $cat){            $slug .= $cat->slug . '/';         }         $link = str_replace('%product_description%', substr($slug, 0, -1), $link); // see custom function defined below     }     return $link;     }     add_filter('post_type_link', 'filter_post_type_link', 10, 2);


Blog page problems

Right, please excuse the stupid question. On my new blog I want the home page to be the "home" page I've created, and not the list of articles... that's fine, I go to `Settings -> Reading -> Front page displays` and change `Front page` to `Home`. But now I want `/blog/` to list my articles, however I get a 404 :S I'm a bit stuck on this one, any help would be mucho appreciated.


How can I permanently cache or "archive" a WP blog without needing future maintenance

I have a client who has an annual complete makeover of their website design and content, but they still want their old sites available to view (each with that year's respective design/CSS). Once these blogs are "archived", I don't want to have to maintain them any more w.r.t. updating plugins and core files. Previously, when I have left plugins un-updated for too long, I have had some security issues (or at least, that's what my host blamed the last few hack attempts on). I know there are auto-updating plugins out there, but I don't know about you - I always have to check that nothing is broken with each update (whether auto- updated or manual). I've considered just generating an html mirror, but are there any other "maintenance free" way I can "archive" my old blogs?


WooCommerce causing page editor javascript error

Im trying to get WooCommerce installed correctly so I can do a bulk import of a clients product database into this. Basically when I activate the WooCommerce plugin it causes the page editor javascript to die. I end up with the following JavaScript error > `Uncaught ReferenceError: switchEditors is not defined` Im using the latest version of WooCommerce and the latest version of WordPress - both downloaded yesterday from the original sites not some other site that it could be damaged from. I'm also getting this PHP exception > `PHP Fatal error: Uncaught exception 'Mijireh_Exception' with message > 'Access key required to view checkout preview' in wp- > content/plugins/woocommerce/classes/gateways/mijireh/includes/Mijireh.php:112`


How to set two different themes on one WordPress? (Desktop vs. Mobile)

I created two WordPress themes. First for the Desktop and second for tablet/mobile. I want to set on one URL. When the website opens, the theme should change automatically based on resolution.


Stylesheet being loaded outside of <head>

Wordpress (3.6) is loading two stylesheets (`mediaelement-css`, .../wp- includes/js/mediaelement/mediaelementplayer.min.css?ver=2.13.0 and `wp- mediaelement-css`, .../wp-includes/js/mediaelement/wp- mediaelement.css?ver=3.6) in wp_footer instead of wp_head. I'm getting an HTML5 error because they did not add the attribute property. I found out that this error always happens if a stylesheet is loaded outside of `<head>` without the attribute property. If it is loaded within then it doesn't need the attribute property. Is there a way of loading the two stylesheets in `<head>` instead of `<body>` to get rid of the error?


Flexslider question

A client of mine is using Flexslider by WooThemes on their site and they want to disable swipe support on mobiles/tablets if there is only 1 slide (The script outputs "clone" slides which seem to be causing the problem). I've tried using CSS `display:none` and jQuery `remove();` to remove the clone slides but neither seemed to work. Is there any way that I can disable swipe (or navigation in general) if there is only 1 slide?


Custom Post Type pagination - normal solutions aren't helping

I have multiple custom post types and I need to be able to query them and page through them. This is the query I am trying:               $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;     $offset = ( 10 * $paged ) - 10;     $args=array('paged'=>$paged, 'posts_per_page'=>10, 'post_type'=>'custom-post-type-name', 'offset' => $offset);     query_posts($args);      I've reset the permalinks and I've set the posts per page of WordPress to a lower number than what I'm querying and all I get is a 404 when I go to /page/2/ (my permalinks are set as `/%postname%-%post_id%`). What's most confusing though is on a separate page the following works:               SELECT *, IFNULL(SUM(vote),0) as total FROM wp_posts post LEFT JOIN wp_wdpv_post_votes votes ON votes.post_id = post.ID WHERE post.post_type = 'custom-post-type-name' AND post.post_status = 'publish' AND post.post_date > DATE_SUB(NOW(), INTERVAL 1 DAY) GROUP BY post.ID ORDER BY total DESC LIMIT 0,3      but the following throws up the same 404 problems               SELECT *, IFNULL(SUM(vote),0) as total FROM wp_terms term JOIN wp_term_taxonomy taxonomy JOIN wp_term_relationships relationship JOIN wp_posts post LEFT JOIN wp_wdpv_post_votes votes ON votes.post_id = post.ID WHERE term.term_id = taxonomy.term_id AND relationship.term_taxonomy_id = taxonomy.term_taxonomy_id AND term.slug = 'games' AND taxonomy.taxonomy = 'category' AND post.ID = relationship.object_id AND post.post_type = 'custom-post-type-name' AND post.post_status = 'publish' AND post.post_date > DATE_SUB(NOW(), INTERVAL 1 DAY) GROUP BY post.ID ORDER BY total DESC LIMIT 0,3      Any help on this would be gratefully received.


Child theme functions randomly broke while editing a page -- no errors

My client was editing pages in the admin area of their site, which is currently being hosted on my server. Two of them were logged in simultaneously, but that shouldn't matter. We're using a child theme of a premium theme. I'm a developer. I hadn't touched any files in hours and was not even around when they were editing. All of a sudden they say, all posts and pages were rearranged. Custom post type "portfolio" suddenly got moved to the regular post type (the blog), all pages disappeared (and thus caused 404s), etc. But upon inspecting the database, all is fine. I deactivated every plugin and the problem persisted. But then I switched the theme to twentyfourteen and the problem was GONE! I switched to the parent theme, the problem is also not there either, everything is in order. I repaired tables, I deleted and reuploaded the child theme, nothing is fixing it. On my local server, the problem does not exist with the child theme. I checked the functions.php, but how can anything be amiss there if it's working fine locally? So I am at a loss as to what could have possibly happened, but ironically, we were planning to launch the site tomorrow or the day after. Nothing like this has ever happened to me before, so I hope someone can help. Thank you so much! EDIT: I've identified that it is something in the functions.php of the child theme that is causing the problem, because if I delete the child functions.php, the problem resolves. But I'm stumped as to why this isn't a problem locally, and why the problem started hours after last editing code? If posting the code to the functions.php would help, I can do that. I also copied some of the code to the parent theme's functions, and there was no problem. EDIT: To add the code. Another developer suspects that custom_pre_get_posts was the problem. He commented out the code, and yes, that does fix the problem, but the client really needs the /portfolio-item/ slug to be dropped from the urls. I wonder if this part is conflicting only with the hidden-pages code I added? Either way, it is still a mystery why this code would function for weeks and suddenly break.               <?php          function evol_child_scripts() {     wp_enqueue_style( 'style', get_stylesheet_directory_uri() .         '/stylesheets/css/style.css' );           }     add_action( 'wp_enqueue_scripts', 'evol_child_scripts' );          /*function codex_custom_init() {     $args = array(       'public' => true,       'label'  => 'Hidden Pages'     );     register_post_type( 'hidden', $args );     }     add_action( 'init', 'codex_custom_init' );     */          /**      * Register a custom post type but don't do anything fancy      */     register_post_type( 'hidden', array( 'label' => 'Hidden Pages', 'public' =>         true, 'capability_type' => 'post',  'show_ui' => true, 'query_var' => true,        'supports' => array( 'title', 'editor', 'thumbnail' ) ) );     /**      * Remove the slug from published post permalinks. Only affect our CPT  though.      */     function vipx_remove_cpt_slug( $post_link, $post, $leavename ) {          if ( ! in_array( $post->post_type, array( 'hidden' ) )          || 'publish' != $post->post_status )         return $post_link;          $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );          return $post_link;     }     add_filter( 'post_type_link', 'vipx_remove_cpt_slug', 10, 3 );          /**      * Some hackery to have WordPress match postname to any of our public       * post types. All of our public post types can have /post-name/ as       * the slug, so they better be unique across all posts. Typically core       * only accounts for posts and pages where the slug is /post-name/      */     function vipx_parse_request_tricksy( $query ) {          // Only noop the main query     if ( ! $query->is_main_query() )         return;          // Only noop our very specific rewrite rule match     if ( 2 != count( $query->query )         || ! isset( $query->query['page'] ) )         return;          // 'name' will be set if post permalinks are just post_name,      // otherwise the page rule will match     if ( ! empty( $query->query['name'] ) )         $query->set( 'post_type', array( 'post', 'hidden', 'page' ) );     }     add_action( 'pre_get_posts', 'vipx_parse_request_tricksy' );          function remove_search_filter () {     remove_filter( 'pre_get_posts', 'tr_search_filter' );     }     add_action( 'init', 'remove_search_filter');          function remove_icons() {     wp_dequeue_style( 'icons' );     }          add_action( 'wp_enqueue_scripts', 'remove_icons' );          function tr_widgets_init_2() {          if ( ot_get_option( 'tr_sidebars' ) ) :         $tr_sidebars = ot_get_option( 'tr_sidebars' );         foreach ( $tr_sidebars as $tr_sidebar ) {             register_sidebar( array(                 'id' => $tr_sidebar["id"],                 'name' => $tr_sidebar["title"],                 'before_widget' => '
',                 'after_widget' => '
',                 'before_title' => '
',                 'after_title' => '
',             ));         }     endif;     };     add_action( 'widgets_init', 'tr_widgets_init_2' );               add_filter('post_type_link','custom_post_type_link', 10, 3);      function custom_post_type_link($permalink, $post, $leavename) {               $url_components = parse_url($permalink);          $post_path = $url_components['path'];          $post_name = end(explode('/', trim($post_path, '/')));               if(!empty($post_name)) {              switch($post->post_type) {                  case 'portfolio':                      $permalink = str_replace($post_path, '/' . $post_name . '/',          $permalink);                  break;              }          }          return $permalink;      }           function custom_pre_get_posts($query) {          global $wpdb;               if(!$query->is_main_query()) {              return;          }               $post_name = $query->get('name');          $post_type = $wpdb->get_var( $wpdb->prepare( 'SELECT post_type FROM ' .          $wpdb->posts . ' WHERE post_name = %s LIMIT 1', $post_name ) );               switch($post_type) {              case 'portfolio':                  $query->set('portfolio', $post_name);                  $query->set('post_type', $post_type);                  $query->is_single = true;                  $query->is_page = false;              break;          }               return $query;       }                 add_action('pre_get_posts','custom_pre_get_posts');          function fb_add_search_box ( $items, $args ) {          // only on primary menu     if( 'primary' === $args -> theme_location )         $items .= '
' . get_search_form(          FALSE ) . '
';          return $items;     }      add_filter( 'wp_nav_menu_items', 'fb_add_search_box', 10, 2 );          // Callback function to insert 'styleselect' into the $buttons array     function my_mce_buttons_2( $buttons ) {     array_unshift( $buttons, 'styleselect' );     return $buttons;     }     // Register our callback to the appropriate filter     add_filter('mce_buttons_2', 'my_mce_buttons_2');          // Callback function to filter the MCE settings     function my_mce_before_init_insert_formats( $init_array ) {       // Define the style_formats array     $style_formats = array(           // Each array child is a format with it's own settings         array(               'title' => 'Image Text',              'block' => 'p',               'classes' => 'image-text',              ),           array(               'title' => 'Image Text no Overlay',              'block' => 'p',               'classes' => 'image-text-2',              ),           array(                'title' => 'w/ gray background',              'inline' => 'span',               'exact' => true,                  'classes' => 'gray-background',          ),           array(                'title' => 'w/ white background',              'inline' => 'span',               'exact' => true,                  'classes' => 'white-background',          ),           array(               'title' => 'Image Text no Indent',              'block' => 'p',               'classes' => 'image-text-3',              ),          array(                'title' => 'Button',              'inline' => 'a',               'exact' => true,                  'classes' => 'button small',          ),           array(               'title' => 'Blog Image Caption',              'block' => 'p',               'classes' => 'caption',              ),          array(                'title' => 'Signature',              'inline' => 'span',               'exact' => true,                  'classes' => 'sign',          ),     );       // Insert the array, JSON ENCODED, into 'style_formats'     $init_array['style_formats'] = json_encode( $style_formats );            return $init_array;            }      // Attach callback to 'tiny_mce_before_init'      add_filter( 'tiny_mce_before_init', 'my_mce_before_init_insert_formats' );


Media upload freezes according to metabox order

I created a custom post type and 3 metaboxes for it in the admin section. It looks great and the admin panel for that custom post has, indeed, the 3 boxes. These boxes have all the same code (with a simple change of indentation in the functions names in order to avoid any conflict) and they each are supposed to allow the user to upload a picture. My problem is that, the first metabox always freezes on the upload while the two others work just fine. When I try to upload a picture through the fist metabox, the media-uploader popup shows up, the drag n' drop and preview features are ok (the picture is loaded) but when I try to validate the upload, the tb_close() event never happens. Basically, it freezes... First I thought that my first metabox was badly coded which is weird as it is a clone of the two others but after some tests, I realized that if I swap the order of the metaboxes in the admin panel, the first metabox is always failing while the two others are working just fine. This means that any of the three metaboxes will work or not, depending on its position in the admin panel. This is strange as it tends to prove that it is not related to the code of the metaboxes themselves so I'm stuck as I don't know where to look to debug the issue. Any help would be appreciated. PS: I don't plan to use a plugin for the metaboxes as this website is 90% done and already uses about 25 hand-made custom metaboxes that work very well. FYI: the metaboxes here above are already used in other custom post types with success. The only difference is that this is the first custom post type with more than 2 uploaders at once whithin the same admin panel.


Limit permissions for authors' fields in Types Custom Field

At a bit of a loss. Took over a WordPress project from outsourced coders who left the project a mess. My issue is this: We have a number of authors who can post using a custom type of post created in the 'Types' plugin. In this custom post form, there is a selection box on what 'author' to associate the post with. Yes, you read that correctly. The form is currently set up so that there is no link between post and author. All of our posts are being generated via this custom post form. Is there any way I might be able to lock the selection box to match the intended author, or should I just look into creating a new post form and scrap this one? Thanks.


Using POST method in meta box, no results

I'm having trouble figuring out what's going wrong with my code. I created a meta box for a custom post type (project) that adds people to the project via the edit project page. The box also displays the users who have been added to the projects, but the POST method doesn't seem to be working so none of the code that inserts the data into the database occurs. I tried to echo a value from the form but there is no result so I know the post method is not working. I checked for syntax errors as well. Here is the code for the POST method once form is submitted -               <?php     // Process add form if sent               if(isset($_POST['mro_add_user'])) {                   $_POST = stripslashes_deep($_POST);                   $add_username = $_POST['mro_add_user'];                   if (username_exists($add_username) != NULL) {                     // Check not already registered                     $add_userid = username_exists($add_username);                     $extra_userdata = get_userdata($add_userid);                     $add_firstname = $extra_userdata->first_name;                     $add_lastname =  $extra_userdata->last_name;                     $a_registered = $wpdb->get_var("SELECT user_id FROM ".$wpdb->prefix."mro_attendees WHERE event_id = ".$project_id." AND user_id = ".$add_userid);                     // If not already registered                     if ($a_registered == "") {                         $user_comment = $_POST['mro_add_comment'];                         $wpdb->insert($wpdb->prefix.'mro_attendees', array( 'event_id' => $project_id, 'user_id' => $add_userid, 'first_name' => $add_firstname, 'last_name' => $add_lastname, 'user_comment' => $user_comment ) );                         ?>

<?php _e('User ' . $add_username . ' added.' ); ?>

                         <?php                     } else {                         ?>

<?php _e('User ' . $add_username . ' already on list.' ); ?>

                         <?php                     }                 } elseif(username_exists($add_username) == NULL) {                     ?>

<?php _e('User ' . $add_username . ' not found.' ); ?>

                     <?php                 }                    }               ?>      And here is the form that has the action both of these are in the same code document.               <form id="add_user" name="add_user" method="post" action="post.php?post=<?php echo $project_id; ?>&action=edit">
                                      Username
       <input name="mro_add_user" type="text" id="mro_add_user" size="40" maxlength="150" />

Comment
                                      <input name="mro_add_comment" type="text" id="mro_add_comment" size="40" maxlength="40" />

                   <input type="submit" name="mro_add_user_submit" id="mro_add_user_submit" value="Add User" />
       </form>      I have a GET method for something else in this code that does work.               <a href="post.php?post=<?php echo $project_id; ?>&action=edit&remove_attendee=<?php echo $user->id; ?>&place=<?php echo $num; ?>">Remove User      I'm just confused as to why the GET method works but POST doesn't? Is this something that meta box can't do? Is there another way I can do this in the meta box? Any help or insight would be greatly appreciated!


WPAlchemy Metabox rewriting slug

So here's my problem: I've created a Custom Post Type called "Projects". I've successfully added several metaboxes via WPAlchemy already. Those work fine. Where I'm having a problem is when I create a metabox with checkboxes for Related Projects, I can list out all the Project titles with checkboxes, but when I choose at least one and save the Custom post, it rewrites the Slug. I'm assuming it's because I'm calling `<?php the_title(); ?>`. Here is my code for the meta PHP file:

Add or subtract Athena projects related to this project.
          Available Projects
          <?php          $items = new WP_Query(array(                 'post_type' => 'athena_project',                  'posts_per_page' => 1000         ));          while ( $items->have_posts() ) : $items->the_post();     ?>             <input type="checkbox" name="<?php $mb->the_name(); ?>" value="<?php echo the_title(); ?>"/><?php the_title(); ?>
         <?php endwhile; wp_reset_query(); ?>
         <input type="submit" class="button-primary" name="save" value="Save" />
      Does anyone have a good suggestion for getting around this problem?


Sorting Custom Posts by Custom Field

I'm currently trying to sort custom post types called 'Donors' by the 'County' they live in. I have a custom field setup called County that they can fill in on the Donor post. Is it possible to echo the County name and sort all the custom donor posts with that County name under it in alphabetical order? So it'd look like this: Grant County <---- custom field called 'County' not a link   * Lesner, Brock <---- links to custom post type (donors) (title of post)   * Mathias, Carl Kanwha County   * Applegate, Christy    * Snow, John Here's my current loop:               <?php $custquery = new WP_query (         array(         'post_type'=> 'Donor',         )     );          while ( $custquery -> have_posts() ) : $custquery -> the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
          <?php          endwhile;             wp_reset_query();  ?>


How to get list of posts from permalinks?

I am using an API which tracks metrics on parts of my site. The only useful bit it saves though is the URL (permalink). What is the most efficient way to query up all the posts that match those permalinks, given the fact that I don't have access to the ID's to use `post__in` with `WP_Query`.


Include a php file that is above WP installation hierarchically?

I've come across a number of ways to call the WP "root" folder But what if I want to include a php file that is in a parent folder of WP? Example http://www.site.com/, where the WP blog is in http://www.site.com/blog/ So far I can't find anything on this topic, and including the absolute URL to the file isn't working


Search template error when search is path ?s=

When make a search the path is www.xxxx.com?s=xxxx. This retrieve an error: Notice: Trying to get property of non-object in /home/codetoco/public_html/wp- includes/post-template.php on line 29. If I change "s" by "search" it don`t retrieve an error, but it show a previous version of the template. In the seach form I use name="s". Nobody knows what happens? Searchform.php               <form action="<?php echo home_url(); ?>/" class="searchform" method="get">         <input type="text" name="s" class="search form-control" value="<?php _e('Search...') ?>" onfocus="if(this.value=='<?php _e('Search...') ?>') this.value=''" onblur="if(this.value=='') this.value='<?php _e('Search...') ?>'"/>      </form>      Search.php               <?php get_header(); ?>

                            <?php if ( have_posts() ) : ?>
<?php printf( __( 'Search Results for: %s', 'pukka' ), '' . get_search_query() . '' ) ?>
                              <?php while (have_posts()): the_post(); ?>                                  <article id="post-<?php the_ID(); ?>" <?php post_class('blog-item') ?>>             <?php if (has_post_thumbnail()) { ?>
                 <a href="<?php the_permalink() ?>"><?php the_post_thumbnail('quins-1000', array( 'class' => "img-responsive" ) ) ?>
             <?php } ?>

                         <?php echo quins_display_date_link () ?>

                         <a href="<?php comments_link(); ?>"><?php comments_number( esc_html__('0 comments', 'quins' ), esc_html__( '1 comment', 'quins' ), esc_html__('% comments', 'quins') ); ?>

                      <a href="<?php the_permalink() ?>"><?php the_title() ?>

                          <?php _e('Posted by ', 'quins' ) ;  the_author_posts_link() ?>

                         <?php _e( 'In ', 'quins' ) ; the_category(', ') ?>

                   <?php the_excerpt() ?>
                      <a href="<?php the_permalink() ?>" class="btn-border"><?php echo esc_html( $quins_opt['excerpt_more_link'] ) ?>

                              <?php endwhile; ?>                                  <?php echo quins_pagination(); ?>                              <?php else : ?>                                  <?php get_template_part('content', 'none'); ?>                              <?php endif; ?>

                                             <?php get_sidebar(); ?>

                <?php get_footer(); ?>


Plugin custom Action Hook not working

I am trying to create one basic plugin where I want to create my own action hook. Here is the code for the same.               <?php     /*     Plugin Name: Demo Plugin     Version: 1.0     */          do_action('basic_action_demo');     ?>      Now after activating this plugin I want to use this action hook in my current theme's function.php file, code for the same is as below:               add_action('basic_action_demo','action_demo');          function action_demo()     {         echo "I am inside";     }      Now the problem is my hooked action never gets called, we can see that do_action is called unconditionally so it will be called on each page load but it never gets into "action_demo" method. What I have figured out far is plugin is loaded before my theme'e function.php file is executed. So here do_action is called first and then add_action. A hint would be really appreciated. Update: Below plugin action works.               <?php     /*     Plugin Name: Demo Plugin     Version: 1.0     */          add_action('basic_action_demo','action_demo');     do_action('basic_action_demo');          function action_demo()     {         echo "I am Inside";         die;     }     ?>


Display multiple page contents under single page

Is it possible to display the content of all the pages under a single page?? Like, I have Home, About and Contact us pages. I want all of its contents to display under a single frontend page. Is it possible and how can we do it?


Any easy way to automatically set the first inline image in a post as the thumbnail, for relative images?

I stumbled upon a problem in this post if you use a link like i.e. a relative URL, it won't work is there a neat trick around this problem? this solution should be URL independent. I.e. use a php snippet to get current url in the place of ../ ?


Wordpress MU - Creating a site takes ages

I have 2 dedicated servers. I have Wordpress MU on both. When I try to create a site   1. WP MU 1 on server 1 does it in 3-5 seconds    2. WP MU 2 on server 2 does it in 45-50 seconds What can cause this delay? How can I debug PHP and MySQL? PS: Both WP MU are test installations. No plugins activated. Both OS are CentOS.


Strange Deadlock database error for the query "Delete From wp_options"

I'm experiencing a strange Database error in these days, and it could the the cause of the slowness of my website (tasc.it) in these days. I found this error in the PHP error log, I can see about 4-5 times every day, without a logical time distribution. (I translated the error from italian to english) > WordPress database error Deadlock found when trying to get lock; try > restarting transaction for the query DELETE FROM tb_options WHERE > option_name = '_transient_doing_cron' executed by require('D:\tasc\wp-blog- > header.php'), require_once('D:\tasc\wp-load.php'), require_once('D:\tasc\wp- > config.php'), require_once('D:\tasc\wp-settings.php'), do_action('init'), > call_user_func_array, wp_cron, spawn_cron, get_transient, delete_option What does it mean? How can I solve it? I have PHP 5.5, MySql 5.6 both recently upgraded, and Wordpress 3.9.1.


How to embed custom HTML code with no plugins?

I'm trying to embed this code into a post:               <script src="http://www.stokerposter.com/swfobject.js"></script>     <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="422" height="750">         <param name="movie" value="http://www.stokerposter.com/Stoker_Poster_04.swf" />         <!--[if !IE]>-->         <object type="application/x-shockwave-flash" data="http://www.stokerposter.com/Stoker_Poster_04.swf" width="422" height="750">         <!--<![endif]-->           <img src="http://www.stokerposter.com/Stoker_Poster.jpg" alt="" />         <!--[if !IE]>-->         </object>         <!--<![endif]-->     </object>      But the result in the preview always falls back on the image, and the comment tags `<!--` are visible for some reason. Is there any way to embed this without a plugin? Thanks


Allow Profile HTML for select users

I know there are a ton of post out there about how to allow html in profiles. Most of these warn about the security risk of doing so. My thinking is there has to be a way to only allow users to use html for certain users. I tried this but It doesn't work. I think it's because you can't remove a filter from inside a filter. Any help would be awesome.               add_action('edit user profile update', 'nifty_strip_html');           function nifty_strip_html($user_id) {          if ($user_id == 2){             //if user id is 2 then allow html             remove_filter('pre_user_description', 'wp_filter_kses');                  }           else{                 return; //keep the filtered html           }       }


Combining multiple javascript and css files

Is there any plugin which can automatically combine all the javascript and css files that are used on a page? While I can combine them manually I would like to avoid them as some plugins add their scripts and css. Also different scripts might be needed on different pages so I do not want to have one large script on every page. I am not looking for gzipping, minifing or cache-control as I already have them implemented. Thanks.


Show the First Post from Each of 3 Different Post Types on a Web Page?

I have 3 different custom post types: 1.) `"events"`, 2.) `"winners"` and 3.) `"offers"`. How would I go about retrieving the first (latest) post in each of these post types on a single web page (i.e a home page). Would I use `get_posts()` or would I have to manipulate `the_loop()`?


Unable to load "wpColorPicker" on theme customize page

Whether I'm using a Wordpress default theme or a custom one, I see the JS error: `Uncaught TypeError: Object [object Object] has no method 'wpColorPicker'` when I click "Customize" on the theme. I've also noticed that on the widgets page nothing is draggable. I believe these issues may be related as I just moved this site to a new server. I've verified all files are chmod `755`. I'm a bit unfamiliar with the inner workings of Wordpress. Is there a debug mode or something I can enable? I recognize with the widgets I can enable accessibility mode, but the bigger issue there is I can't Customize my theme due to the JS error. _I've verified that this error persists when all plugins are disabled_


Give users acces to admin a single post or set up WP network?

I have a directory styled site in which companies are listed. I would like to give the owners of the companies(the ones on my site) the option to take control of the content in their company entry. Some entries would still be controlled by myself. The question arises should I give owners admin access to their respective entry through user roles and some custom plugin code, or set up a WP multi- user site/network. Not sure how the WP network works in great detail but figured I would ask for opinions. I'd need to transfer the site over to the network version somehow, or set a function to go to the Network site if one exists for that company/entry. Not sure how that would work. Things I need the owners to be able to do: Update Categories, images, pot thumb nails and content(includes some additional met boxes with text input) as well as several other meta boxes. While I can still control content on the entries without an external admin. Thanx for any and all help/opinions in advance


How can I modify the Capability needed to access a plugin's options?

I have the following **3 different Roles** : `Admin`, `Editor`, and `SEO`. I have installed WordPress SEO by Yoast, and I want to get this:   * **I don't want the editors to see the SEO options** , because they only write posts and don't know about SEO. There is a person with the `SEO` role, who will do the optimization.   * **I don't want the SEO person to see other plugins options**. I just want to have the same capabilities that Editors, but with the SEO functions enabled. I have been trying with some snippets from this site, and I am able to hide the _meta box_ to the `Editors`, but **not the little 'rating box' over the _Publish_ button**. Also I don't know how to deal with the second point, because all the plugins uses the same `manage_options` capability, so I can't assign that capability to the `SEO` role. And **I don't know how to change the capability needed** without modifying the plugin files (what will be lost on plugin update). Thanks in advance.


Link to search page without search parameter

I'm a bit stuck with my actual project. Actually I wanted to link a search icon to the search page (where there's a form & the results). Actually I tried to link like this: `/project/?s=` but it redirects to the index page when `s=` empty - when I assign a parameter like `s=ipsum` it directs to the search page with its results. Is there a way to link to the search page with a clean URL (without doing a search)?