title: Making that Admin Bar transparent or a blue color

text: The question title is pretty self-explanatory - I don't really like the new Admin's bar's colour but I find it useful and want to keep it so I would like to change the colour of it. However, I'm not the best at web scripting, let alone CSS so I wondered if anybody here would help me to make the Admin Bar the following sort of HEX color: #62BACE. If that color isn't really possible, or it is easier - I wouldn't mind having a transparent admin bar! Any assistance would be very kind and grately appreciated! Thanks in advance PS If there's a plugin that does this for me I wouldn't mind using it - I just don't know of any and can't code in CSS...


title: How to load WordPress on non WP page?

text: I want to use the `get_option()` function of wordpress in one of my theme's files, which is not related to WP, it is just located in the same directory of the other theme files. I need this file because of some extra IPN paypal related actions, but I need some values from the options table that exists in WP to be called in this page in order for it to work. I know I can't just use `get_option()` as this file is overlooked by wordpress. Is there any approach by including some parts of wordpress in my theme to make this functionality only work?


title: Best practices for user registration with Wordpress from an MVC background

text:
Ok so I used to develop in Wordpress a lot but in the last year have been using Codeigniter instead. Obviously there are times when Codeigniter is more applicable to a situation than Wordpress and vice versa, but I've had to come back to use Wordpress for my next project. With MVC it makes so much sense to have all the "echoing" in the views and haver all the processing in the controllers etc.. but now coming back to Wordpress I feel odd echoing inside a function. I am making a registration page (most of the code is from here but I am yet to change it to my custom fields etc) where the HTML is in the template page with a `do_action ('process_customer_registration_form');` and all the processing AND ECHOING is done in function.php:                   function registration_process_hook() {         if (isset($_POST['adduser']) && isset($_POST['add-nonce']) && wp_verify_nonce($_POST['add-nonce'], 'add-user')) {                  // die if the nonce fails             if ( !wp_verify_nonce($_POST['add-nonce'],'add-user') ) {                 wp_die('Sorry! That was secure, guess you\'re cheatin huh!');             } else {                 // auto generate a password                 $user_pass = wp_generate_password();                 // setup new user                 $userdata = array(                     'user_pass' => $user_pass,                     'user_login' => esc_attr( $_POST['user_name'] ),                     'user_email' => esc_attr( $_POST['email'] ),                     'role' => get_option( 'default_role' ),                 );                 // setup some error checks                 if ( !$userdata['user_login'] )                     $error = 'A username is required for registration.';                 elseif ( username_exists($userdata['user_login']) )                     $error = 'Sorry, that username already exists!';                 elseif ( !is_email($userdata['user_email'], true) )                     $error = 'You must enter a valid email address.';                 elseif ( email_exists($userdata['user_email']) )                     $error = 'Sorry, that email address is already used!';                 // setup new users and send notification                 else{                     $new_user = wp_insert_user( $userdata );                     wp_new_user_notification($new_user, $user_pass);                 }             }         }              if ( $new_user ) : ?>
         <?php             $user = get_user_by('id',$new_user);             echo 'Thank you for registering ' . $user->user_login;             echo '
Please check your email address. That\'s where you\'ll recieve your login password.
 (Be sure to check your spam folder)';         ?>
         <?php else : ?>                  <?php if ( $error ) : ?>
                     <?php echo $error; ?>
             <?php endif; ?>              <?php endif;          }     add_action('process_customer_registration_form', 'registration_process_hook');      My question is... is it best practice in WP to have content echoed within an action function like it is at the end if this one? Why not just have a standard if(isset(submit)) situation and process the form in the same page? I know thatby moving it to the functions its seperating the logic, but it's also echoing a response within the function.. Doesn't seem right. Thanks


title: Advanced Custom fields not available yet during publish_page action

text: I have a function that I use that ties into the publish_page action that I use to create multiple pages on my site. This function worked perfectly for a while, but ceased to function correctly after a recent update. Unfortunately I didn't notice it at the time, nor did the client, so I'm not sure exactly which update killed it. The issue is that if I try and get the pages custom fields using the post id that is passed into the function, they are not saved to the database yet. For instance:               function tk_publish_pub($post_id) {          if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;          $slug = 'pubs';          //get all the pages to copy     while(the_repeater_field('default_pub_pages','options')):         $post_object = get_sub_field('page_template');          $pages_to_copy[] = $post_object->ID;     endwhile;          $admin_user = get_field("admin_user", $post_id);     $allpages = implode(", ", $pages_to_copy);          mail("tomyemail@gmail.com", "test data", "Post ID: $post_id \n Admin user for post: $admin_user \n Pages to copy: $allpages \n Post_name: " . get_field('subdomain_id', $post_id));     return;     }      ACF works correctly at this stage (I get my list of 'pages to copy') so I know its not that. However, where I try and get the admin user, it and any other ACF field from the published page are not saved to the database yet. Anyone ran into this before?


title: Remove 'Check Compatibility' from Plugins menu

text: Is there a way to remove the 'Check Compatibility' link that appears under plugins in the plugin menu? If so, how can I remove the link from a given set of plugins, and alternatively from all plugins at once?


title: update_post_meta() not working in bulk option

text: I am following this https://gist.github.com/michael-cannon/5820098 to update bulk values but its not working. I tried to debug each and every step but can't get the exact error. I have the following codes of js:               $( '#bulk_edit' ).on( 'click', function() {         // define the bulk edit row         var $bulk_row = $( '#bulk-edit' );              // get the selected post ids that are being edited         var $post_ids = new Array();         var $langs = {};              $bulk_row.find( '#bulk-titles' ).children().each( function() {             $post_ids.push( $( this ).attr( 'id' ).replace( /^(ttle)/i, '' ) );         });              // get the data         $('.uni_lng-checklist li input[type="checkbox"]:checked', $bulk_row).each(function(){             var k = $(this).attr('name').replace('wpcf[languages-kerk][', '').replace(']', '');             var v = $(this).attr('value');             $langs[k] = v;         });                   // save the data         $.ajax({             url: ajaxurl, // this is a variable that WordPress has already defined for us             type: 'POST',             async: false,             cache: false,             data: {                 action: 'save_bulk_custom_language', // this is the name of our WP AJAX function that we'll set up next                 post_ids: $post_ids, // and these are the 2 parameters we're passing to our function                 wpcf: $langs,             }         });          });      and the ajax action hook is :               add_action( 'wp_ajax_save_bulk_custom_language', 'uni_save_bulk_custom_language' );     function uni_save_bulk_custom_language() {            $post_ids = ( ! empty( $_POST[ 'post_ids' ] ) ) ? $_POST[ 'post_ids' ] : array();       $languages = ( ! empty( $_POST['wpcf'] ) ) ? $_POST['wpcf'] : null;            if ( ! empty( $post_ids ) && is_array( $post_ids ) ) {         foreach ( $post_ids as $post_id ) {             update_post_meta( $post_id, 'wpcf-languages-kerk', $languages );         }       }            die();     }      I tried to check the `update_post_meta` function which return true every time, means its updating the value. but when i try to check in the database or when the page refresh on bulk update its displaying blank even in the database. Can anyone please help me to detect the exact problem?


title: Weird characters being added to my link

text: I created a simple image link that's linking to a page within my Wordpress website and for some reason weird characters are being appended to in which is not allowing the user to get the the page destination. Please help! This is the website: http://bit.ly/1ko2xwM its the link under "click here to preview". I'm just doing a simple anchor tag.                <img src="<?php bloginfo( 'template_url' ); ?>/images/Book-Preview-CTA.png" alt="Look Inside Book">


title: Connecting to a 2nd DB gives me no results when querying

text: I'm trying to access a different DB on the same localhost as my wp db is and I did this like so: functions.php:               add_action('init','my_new_db');     function my_new_db(){      $newdb = new wpdb( 'test', 'test',  'test',  'localhost');      $newdb->show_errors();     }      Following this in page.php:                 <?php       global $newdb;            $test = $newdb->prepare( "SELECT `...`, `...` FROM ..." );       $result = $newdb->get_results($test);            return($result);             ?>      The dots are correctly filled in don't worry about that, though this is the message I query and I get no error or no result.


title: I'm getting a '500 Internal Server Error' when I try adding menu items

text: For some reason, I suddenly get `500 Internal Server Error` when I try to add menu item to a menu and I can't figure out why. I'm running Apache2 with Centos 6 OS on a VPS.   I have PHP 5.8 and MySQL 5.1 This is the error message: > Internal Server Error > > The server encountered an internal error or misconfiguration and was unable > to complete your request. (...)   * My error_log file shows nothing.    * I can create new menus   * I can not add pages or custom links to menu items   * I've deleted the .htacess file and get the same error   * I can add new pages and posts Can anyone help me to figure out what may cause this weird problem?


title: List Users alphabetically with heading

text: How can I show a list of Users with alphabetical headings? For example: **A**   Adam   Alan **B**   Bill   Bob I've found examples that do it with Posts, but I can't figure out how to make it work with `WP_User_query()` :(


title: Drop-Down Menu of Current Child Pages

text: Sorry if my question title didn't make much sense. I'll try and explain. I am using the 'Contact Form 7' plugin on a WordPress site and would like to display the child pages of the current page in a select menu, I.E. =>               <select><option>This is a child page</option><option>This is another child page</option></select>      Of course, the option markup would be the dynamic function; markup that says basically that we want to display the child pages of the current page wrapped in an option field for each one. The result should be a drop-down menu that someone could select the child pages title and submit it with the form. The reason being, the child pages are tours and all I need is the title to be passed to a select field so we know that' the tour they're interested in.


title: This plugin throws error on the events page only

text: On my clients website http://pacificwomen.org/events/ we are getting the error on the Console and the loader is spinning but doesn't load the page. I' am already attempted many times but still it doesn't work at all. This error mostly happens when jQuery is not loading on page. But I' am already loading jQuery, Well only in Events page this is happening but the rest its working fine. My client is really angry on me regarding this issue.               Uncaught TypeError: undefined is not a function     Uncaught ReferenceError: jQuery is not defined     Uncaught TypeError: Cannot read property 'fn' of undefined     Uncaught ReferenceError: jQuery is not defined     Uncaught ReferenceError: $ is not defined application.js:1     Uncaught ReferenceError: $ is not defined share-options.js:3     Uncaught ReferenceError: jQuery is not defined     Uncaught ReferenceError: jQuery is not defined jquery.fancybox.pack.js?v=2.1.5:46     Uncaught ReferenceError: jQuery is not defined     Uncaught ReferenceError: jQuery is not defined     Uncaught ReferenceError: jQuery is not defined jquery.fancybox-thumbs.js?v=1.0.7:162     Uncaught ReferenceError: $ is not defined


title: Functions.php and includes

text: My functions.php file is getting on the long side. Is it all right to use includes to break it up (php includes I mean) or is this considered bad form?


title: How to provide translations for a WordPress TinyMCE plugin?

text: I know that I can get my translations into JavaScript doing:                   $MyTranslations = array(             'translation1' => __("Some String 1", "MyTranslations"),             'translation2' => __("Some String 2", "MyTranslations")         );         wp_localize_script( 'jquery', 'my_translations', $MyTranslations );      But looking at some of WordPress TinyMCE plugins they use calls like this:               {     title : ed.getLang('advlink.link_desc'),     ...     }      How is WordPress getting their translations into `getLang()`? Am I supposed to do it this way or do I just use my first bit of code and access the variables directly like:               {     title : my_translations.translation1,     ...     }


title: How to configure folders with 'Child Theme'?

text: I created a 'Child Theme' for customize my Template but I don't know how to subscribe some files that found in folders of the theme. I tried to do like this: Original files: theme/css/file.css I would like: child-theme/css/file.css Is it possible do that? Thanks in advance.


title: Remove custom post type slug

text: I'm creating a new website based on a theme using custom post type and WordPress 3.2.1. The problem is that my content was previously using %postname% permalinks and all my SEO is build on this. Using CPT add a slug like : http://mysite.com/slug-cpt/postname I tried this rule in the register_post_type function but it doesn't work : 'rewrite' => array('slug' => false, 'with_front' => false) I also read this but it's not good for me : Permalinks in Custom Post types Any idea ?


title: Exclude admin bar from showing avatar customization

text: I am customizing the WP avatar (to fit a grid) and do not want the avatar customization to show on the admin bar drop down or in the dashboard or on the site (when the admin bar is visible). I have excluded the avatar change from the dashboard using this code in functions.php:               function foo_change_avatar($class) {         if(!is_admin()) {                // avatar customization code         }         return $class;     }     add_filter('get_avatar','foo_change_avatar');      How can I also prevent my customization from showing in the admin bar dropdown when the admin bar is visible on the site?


title: Registration Page

text: I've recently installed a wordpress network to my website and i'm stuck with a huge problem! my default blog now redirects to the signup form automatically and not the blogs home page. I have set the static page in the reading settings, and disabled registrations. it still redirects to domain.com/wp-signup.php?new=domain.com and it should go just to domain.com is there an easy way of stopping this from happening? **Solved this** , all it is is a missing `define( 'NOBLOGREDIRECT', 'http://www.domain.com' );` from wp-config.php


title: wordpress add_submenu_page not working

text: I have a built a plugin which creates a custom menu like this:                   add_menu_page( 'Wholesale Pricing', 'Wholesale', 'manage_options', 'woo-wholesale', 'woo_wholesale_page_call');       I am now trying to add a subpage item underneath this. I have read the codex and came up with:               add_submenu_page( 'woo-wholesale', 'Registrations', 'Registrations', 'manage_options', 'woo-wholesale-registrations', 'wwpr_page_call' );       I am guessing this is incorrect as the submenu item isnt showing. Can anyone shed any light on this please?


title: Displaying Saved Meta Box Data in Drop Down with selected()

text:
I have a custom meta-box for certain custom post types, and one of those fields in the meta-box is a drop down. I am providing the field correctly, saving the information, and even calling it correctly (so I know it is being saved properly), however, when you return to edit the post, or update, the drop-down always has the first `<select>` option listed, which I'm afraid my confuse some of the people editing these post types in the future. For example, if an editor selects "Option 2", then hits Publish or Update, "Option 2" is saved and called in the loop, but the drop down immediately shows "Option 1" again. Is there a way to have the 'selected' option that is saved be displayed on top, or at the top of the list, so it appears to the editor as saved? My functions code :               function meta_options(){         global $post;         $custom = get_post_custom($post->ID);         $price = $custom["price"][0];         $selected = isset( $values['location'] ) ? esc_attr( $values['location'][0] ) :'';       ?>     Price:<input name="price" value="<?php echo $price; ?>" />     Location :
     <select name="location" id="location">           <option value="Option 1" <?php selected( $selected, 'Option 1' ); ?>>Option 1</option>           <option value="Option 2" <?php selected( $selected, 'Option 2' ); ?>>Option 2</option>       </select>     <?php } ?>      and then saving that information:               function save_price(){         global $post;         update_post_meta($post->ID, "price", $_POST["price"]);         update_post_meta( $post->ID, 'location', esc_attr( $_POST['location'] ));       }      Am I doing this correctly? Is there an easy way to accomplish this? Many thanks.


title: Wp backend page content not showing, but actual page is fine

text: I'm having a little problem where, well long story short, i get told to "fix" a WordPress gallery etc...be it add/remove images or whatever but when i log in and go to that page, be it in "visual" or "HTML" view, there's nothing in the content area. like i don't see **anything** in there. its blank like if it was a new page. i expect to see something liek short code or you know, something like for example `**[gallery link="file"]**` or something but again, nothing shows on the backend. Now when i go to that same page on the actual live site, and or when i click on the "view page" to preview, the page and its content is show up just fine. Any ideas as to whats going on? Thanks in advanced.


title: Query by multiple meta elements not seeming to work - wordpress is timing out

text: Trying to run a query that pulls:   * get me 4 posts or pages that are not in sticky_posts and have `(my_featured_post = 1 AND photo-image_post_id > 0) OR (my_featured_post = 1 AND photo-image_page_id > 0)`   * OR if it's easier to do - somehow saying `(my_featured_post = 1) AND (photo-image_page_id>0 OR photo-image_post_id >0)` I tried               $query = new WP_Query(         array(             'meta_query' => array(                 'relation' => 'OR',                 array(                     'key' => 'my_featured_post',                      'value' => '1',                      'compare' => '='                 ),                  array(                     'key' => 'photo-image_post_id',                      'value' => '0',                      'compare' => '>'                 ),                 array(                     'key' => 'my_featured_post',                      'value' => '1',                      'compare' => '='                 ),                  array(                     'key' => 'photo-image_page_id',                      'value' => '0',                      'compare' => '>'                 ),             ),             'post_type' => array( 'post', 'page' ),             'post__not_in' =>get_option('sticky_posts'),             'posts_per_page'=> 4,                )     );      This does not seem to work. What should I do?


title: Custom plugin route in Wordpress

text: Okay so my question is quite simple. I need to implement some custom routing rules for my plugin. Those routes would only take one argument (so nothing complicated) and would look like : http://www.example.org/myroute/myargument And ideally, this would call a custom class, and display a custom template (that could directly access the class). What's the best approach for this ? Cheers


title: Wordpress Visual Composer Row Visibility

text: Visual Composer can hide the Row on Ipad (below 1024) and hide it on Iphone (below 480) as well. The problem I am having now is, I have two ROW and I want to make it 1st Row (Visible on Desktop only) and 2nd Row (Visible on Ipad and Iphone only). The first row I can do it easily with the option Visual Composer provided. But for the 2nd row which I would like to visible only for Desktop having the problem since I cannot find the option on Visual Composer. Am I missing any features on Visual Composer to hide row for Desktop only (above 1024) or is visual composer lacking this option? If visual composer lacking option, is there any plugins which offering this feature or is there any way which I can solve it? Thank you for your help.


title: nested conditional to check for feature image and custom field?

text:
I have this working for the most part, but some of the syntax is wrong someplace because when the post DOESNT have a thumbnail, it still prints that last echo and closes a div outside of the conditional. Can someone help me get this syntax on this code right? Basically I want: Check for venue image, if it's there, display it. If there IS a thumbnail image, then check for a custom field, if it's there, display it. If not, do nothing, if no venue image, do nothing. Here is my code:               <?php      if ( has_post_thumbnail() )      echo '
';     { // check if the post has a Post Thumbnail assigned to it.     the_post_thumbnail();     if ( get_post_meta($post->ID, 'Venue Image Notation', true) ) {     echo '' . get_post_meta($post->ID, 'Venue Image Notation', true) . ''; }     else {}     echo '
';     }     ?>


title: Create hundreds of users with just ID in phpMyAdmin

text: I'm trying to do the same as this post. But I have a problem with the > insert records into your wp_users table containing all the ID's of the > members you want to import Right now, I have 3 members with respectively ID 1, 11 and 12. But I need to insert 500 users, with ID from 2 to 502. How do I create these ID line in my database without creating one by one ? Right now, I know how to add one at a time, but it starts at id 510 (because I've deleted older users). I want to start at ID 2... Thanks a lot ! Cédric


title: How to sort posts by last name (2nd word) on ONE category only?

text: I have an "author" category that is used as a list to browse multiple posts containing author biographies. I have Smart Category Ordering installed and right now it is sorted by title ascending. Unfortunately there isn't many options on this plugin and I haven't found alternatives. Posts are titled "Firstname Lastname (country)" and I want Lastname (or some custom field value) to determine the post ordering for the AUTHORS category only. I have other categories for news posts I don't want affected. I've seen some ways to do it in PHP but that would affect the entire site.


title: PHP get the first post separately from array returned by wpdb->get_results()

text: Apologies if the title isn't clear, can't quite think how to word this. I'm getting a pretty standard list of posts like this:                   $pageposts=$wpdb->get_results("                 SELECT * FROM $wpdb->posts                  WHERE post_type='post' AND post_status='publish'                  ORDER BY post_date DESC LIMIT 6             ", OBJECT);         $firstpost = array_shift($pageposts);        But this isn't returning what I expect. Instead of `$firstpost` conatining the first post in the array `$pageposts` (like the docs say it should), it contains the oldest - and `$pageposts` still also contains that post (which it shouldn't according to the docs), however the latest post is missing. I don't know what the Gordon Bennet is going on with this, I've also tried `array_pop()` which should do the opposite of `array_shift()`, but with similarly strange results (latest post shown but `$firstpost` still contains the wrong value). OK I've waffled on a bit, so to conclude, here's what I'm trying to do: I want to make a single query, get the result, and print out the latest post in one area of the page and then the rest of the posts in another area. Trouble is, in the HTML, the older posts come before the one new post, so I need to split it into a separate variable and make sure the older posts don't show this new one with the others. Does this make sense? Any help appreciated :)


title: How to add custom classes to more than one separate menu's a link in wordpress?

text:
Here is a link to my website: website I have placed the following code to this document in /wp-includes/nav-menu- template.php Towards the end of the code are several lines that start with $item_output. In particular, you want to look at this piece:               $item_output .= '';      Because this line determines the output for the beginning of the link html. I have changed it to something like this:               $item_output .= '';      Then all your links in the menu will have class="btn btn-warning btn-block" added to them. * * * That said, it doesn't allow a custom class for each menu and I several menus that don't need the class="btn btn-warning btn-block" inside of the a link. (or at least I don't know how to code it). This is an issue for me. Does anyone know how to code this request? For those asking **why would you want to do this?** I want to have my main (top) menu links to be buttons. Here is the function I'm using to call the menu:                    <?php                                        $defaults = array(                    'theme_location'  => '',                    'menu'            => 'main-nav',                        'container'       => 'ul',                    'container_class'    => 'nav navbar-nav',                        'before'          => '',                    'after'           => '',                    'menu_class'      => '',                    'menu_id'         => 'menu',                    'echo'            => true,                    'fallback_cb'     => 'wp_page_menu',                    'link_before'     => '',                    'link_after'      => '',                    'items_wrap'      => '
%3$s
',                    'depth'           => 0,                    'walker'          => ''                    );                                        wp_nav_menu( $defaults );                                        ?>


title: AJAX call - failling to call do_action

text: I am trying to make an AJAX call for a plugin.               <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>     <script type="text/javascript">     jQuery(document).ready(function($) {     $.post(         '<?php admin_url('admin-ajax.php'); ?>',         {             action : 'AAA'         },         function( response ) {             alert( "[[[[" + response + "]]]]" );         }     );     }      The ajax call is working fine.               add_action( 'wp_ajax_nopriv_AAA', 'fAAA' );     add_action( 'wp_ajax_AAA', 'fAAA' );          function fAAA(){           echo "123";           die();     }      For some reason my fAAA is not getting called. I used `var_dump( $wp_filter['wp_ajax_nopriv_AAA'] );` to check the actions. * in the plugin, it showed that the action is added * when i looked in admin- ajax.php, the action is not there. Any help?


title: Widget modifications in a child theme

text: Can I modify widgets in a child theme? When I change the footer, I don't need extra steps -- it just works. What about widgets? Example: A widget of a theme I am using makes use of google maps. I'd like to add some options to google maps options array. My idea is to just copy the widget to the appropriate directory in the child theme and add those lines. Will that work as expected?


title: Meta_query with relation 'OR' killing server CPU

text: function get_nb_offres( $typeOffre ) {              global $type_bien_correspondances;         $args = array(             'post_type' => 'annonces',             'meta_query' => array(                 'relation' => 'OR'             )         );              foreach( $type_bien_correspondances[$typeOffre] as $typeBien ) {             $args['meta_query'][] = array(                     'key' => 'type_de_bien',                     'value' => $typeBien             );         }              $annonces = new WP_Query( $args );         return $annonces->post_count;     }      My global $type_bien_correspondances is here :               $type_bien_correspondances = array(         'Appartement' => array(             'studios',             'T1',             'T2',             'T3',             'T4',             'T5'         ),         'Immeuble' => array(             'immeuble'         ),         'Programme neuf' => array(             'programme neuf'         ),         'Maison, Villa' => array(             'maison',             'villa',             utf8_encode( 'propriété' )         ),         'Fond de commerce' => array(             'fond de commerce'         ),         'Terrain' => array(             'terrain'         )     );      And finally my call to the get_nb_offres() function is here :               // Within a function     return get_nb_offres( 'Appartement' );      My problem is when running this code my server CPU goes crazy and I can't do anything but restart it. Commenting the 'relation' line make the code work but it's not what I'm expecting. I can still muddle through this problem running several WP_Query but I would prefer to understand where the bug comes from. EDIT Not really an answer but several clues to optimize my query.


title: Load WP content with ajax less server demanding and faster than normal page loading?

text: This is a technical doubt I had after reading some articles about WP ajax process (cannot find them though). Is it faster and cheaper to load WP content (any content, page, post, widgets etc...) using WP ajax API than making a full canonical page request? I thought about this because maybe passing through wp-admin/admin-ajax.php is lighter than loading a new page running the whole WP stack altogether. Am I right?


title: can hyperlinks be displayed in excerpts?

text: By default, it looks like all hyperlinks are stripped out of excerpts. Perhaps this is to prevent link power from diluting. Is there a way to allow hyperlinks to display in excerpt content?


title: Is there a quick way to inject i18n domain into theme/plugin files?

text: I do have prepared theme files (with __(), and _e(), etc), but they lack domain argument. There are lots of such string scattered around the theme files, editing by hand seems to be a dreadful perspective. Is there any tool to do this quickly? I remember there was a script somewhere, but I can't find it now.


title: uml diagrams of wordpess

text: Where can I find UML diagrams of WordPress (Data flow diagrams,State diagram, component diagram, use case diagram, deployment diagram)?


title: WP 3.1 getting tax_query to work in query_posts()

text: I'm trying to filter my posts using multiple custom taxonomies for my custom posts with the following code, but I keep getting blanks with my new code i.e. no posts appear in the loop. It works like this: the user chooses a term for custom taxonomies 'fttype', 'ftperiod' and 'ftduration' from three different dropdowns in a form, and this is passed to the code below as:   * $ft_t_ns   * $ft_p_ns   * $ft_d_ns I originally had this code (which works, albeit without pagination), but the new code I'm trying to implement so that I can use WP 3.1's in-built capability of filtering by multiple custom taxonomies isn't working (see my new code further down). Can anyone see what I'm doing wrong here? Been fighting with this for a while... Thanks osu **OLD CODE**               // Set todays date to check against the custom field StartEventDate     $todaysDate = date('Y/m/d');          // Convert spaces in taxonomies and terms into hyphens so that search works correctly (uses slug)     $ft_t_ns = osu_convert_spaces($ft_t);     $ft_p_ns = osu_convert_spaces($ft_p);     $ft_d_ns = osu_convert_spaces($ft_d);          // Build query     // NOTE: AS OF WP 3.1, SEE V2 FOR HOW TO PASS AN ARRAY TO query_posts(). YOU PROBABLY WON'T NEED     // QUERY MULTIPLE TAXONOMIES PLUGIN EITHER FOR V2'S APPROACH OF PASSING AN ARRAY TO WP_Query() TO WORK.     // READ MORE ON 'MULTIPLE TAXONOMY HANDLING' HERE:     // http://codex.wordpress.org/Function_Reference/query_posts#Taxonomy_Parameters     $ft_args = 'post_type=ftevent';     $ft_args .= '&fttype=' . $ft_t_ns;     $ft_args .= '&ftperiod=' .$ft_p_ns;     $ft_args .= '&ftduration=' . $ft_d_ns;     $ft_args .= '&posts_per_page=' . $ft_ppp;     $ft_args .= '&meta_key=StartEventDate&meta_compare=>=&meta_value=' . $todaysDate;     $ft_args .= '&orderby=meta_value&order=ASC&paged=' . $paged;          // Create query     query_posts($ft_args);      **NEW CODE**               $ft_args = array(         'post_type' => 'ftevent',         'posts_per_page' => 5,         'paged' => $paged,         'orderby' => 'meta_value',         'order' => 'ASC',         'meta_query' => array(             array(                 'key' => 'StartEventDate',                 'value' => $todaysDate,                 // Custom field type. Possible values are 'NUMERIC', 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL',                  // 'SIGNED', 'TIME', 'UNSIGNED'. Default value is 'CHAR'.                 'type' => 'DATE',                 // Operator to test. Possible values are 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN'.                 // We choose 'BETWEEN' because we need to know the date has not passed to show the event                 'compare' => 'BETWEEN'             )         ),         'tax_query' => array(             'relation' => 'AND',             array(                 'taxonomy' => 'fttype',                 'field' => 'slug',                 'terms' => $ft_t_ns,                 // Operator to test. Possible values are 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN'.                 // We choose 'IN' because we need to make sure the term is in the current array of posts                 'operator' => 'IN',             ),             array(                 'taxonomy' => 'ftperiod',                 'field' => 'slug',                 'terms' => $ft_p_ns,                 'operator' => 'IN',             ),             array(                 'taxonomy' => 'ftduration',                 'field' => 'slug',                 'terms' => $ft_d_ns,                 'operator' => 'IN',             ),         )     );          // Create query     query_posts($ft_args);


title: Can anyone clarify difference between archive-{posttype}.php, type-{posttype} and date.php?

text: I'm trying to get the custom archives per post-type working, but after a week of trying, searching and scratching head I still cannot get it working. I'm mainly talking about the `{post-type}/{year}` or `{post-type}/{year}/{month}` permalinks. They always throw a `404`. Only `index.php?year={year}&monthnum={month}&post_type={post_type}` links do work. So right now I temporarily created some custom rewrite rules which translate permalinks in working links. But, how to get the native archive functionality working for post-types? I am clueless about what is the difference between the `archive-{posttype}.php`, `type-{posttype}` and `date.php` templates and tried all of them to get them working. No luck though. `type-{posttype}.php` does work in order to list all the post-types, but `archive-{posttype}.php` or `date.php` do not make the `/{year}/{month}` permalinks to work. Basically what I need is: `/{post-type}` to list all the posts of this custom post type `/{post-type}/{year}` to list all of them of a particular year `/{post-type}/{year}/{month}` to specify further on a month. And lastly: is there a template to be created which outputs all the years and months of the custom post type with `wp_get_archives()`? Or do I have to create a different template to create them for each post-type? Hope I was a bit clear. Running on wp3.1


title: something like is_childtheme()

text: in the functions.php of a parent theme, I would like to check for wheter the theme is being run directly, or it is run via a child theme. Is there a conventional way of doing this? I cant find the is_childtheme() function I would have liked to have found.. so whats the best way? Check for theme name and compare it to parent theme's maybe? how can this be done?


title: How do I convert a mathematical Microsoft Word document to a WordPress blog post?

text: I have a Microsoft Word document which I would like to convert to WordPress. The document is in Hebrew. It contains mathematical equations generated with MathType. It also contains images. Just copying and pasting the text of the document to the text area (in WordPress control pannel) wouldn't work because of the equations and images. What is the simplest way to do it?


title: Can I use WP_Query one time and then filter the results multiple times

text:
I am using the following code 20 times in one page template to query specific data for each section. All of the pages data comes from the same post type, just I need it divided up by a specific custom field value and then order by another specific custom field value. Is there a way to run WP_query just one time and then filter the data into groups based on one custom field value and then orderby another??
     <?php             $args = array(         'post_type' => 'listing',         'post_status' => 'publish',         'posts_per_page' => '96',         'meta_key' => 'price_value',         'orderby' => 'meta_value_num',         'order' => 'ASC',         'meta_query' => array(                     array(                         'key' => 'category_value',                         'value' => 'category 1',                         ),                     array(                         'key' => 'sold_value',                         'value' => 'No'                         )         )     );          $custom = new WP_Query( $args ); ?>
Category 1 (<?php echo $custom -> found_posts; ?>)
         <?php $margincounter = 1; ?>         <?php if ($custom->have_posts()) : while ($custom->have_posts()) : $custom->the_post(); ?>         <?php include get_template_directory() . '/includes/listings_grid.php';      ?>         <?php endwhile; else: ?>         <?php endif; wp_reset_query(); ?>


title: Retrieve posts by author

text: I am trying to retrieve all custom post types created by the current user. I have this piece of code:               wp_get_current_user();          $args_my_items = array(         'posts_per_page' => 10,         'post_type' => 'mycustomposttype',         'post_author' => $current_user->ID);          query_posts($args_my_items);      What ends up being returned are all posts of type "mycustomposttype". It does not filter by post_author. Am I using the wrong query parameters? How can I filter by the current user? Thanks.


title: Counting post fields

text: Is there a way to count the amount of empty fields of a post (or the fields of a plugin as they relate to the different)? For example, I have 1,500 posts on my site. Each post has important fields (information) needed for the proper functionality and user accessibility (i.e. city, state, zip code, address, etc), but not every post has all of these fields filled out. So what I want to do is know how many posts are missing certain fields. For example, how many posts are missing the city field and so forth. Is there a plugin or a function that can count the amount of fields are missing? I would really appreciate any help or advice with this. This would be very helpful for multiple reasons. Thanks in advance, Gary


title: Do I need FTP set up to upload files to wordpress server

text: Does FTP need to be set up on a server hosting my wordpress site. I am unable to upload files and there are still many things to check, but I need a straight answer to this before I waste too much time. All I have done to get this site up and running is copy the document root from my localhost to a remote server. There is no FTP or cpanel set up on that server. I am unable to upload files from the wordpress admin interface. Do I need to setup FTP in order to upload these files?


title: WP E-commerce wpml translation or multilingual

text: Ok, i need to setup a shop, my choice, WP, now, the shop should be french and english, with product variation and newsletter tracking, this is the baseline Now, everybody is talking about wp e-commerce from instinct, a company that look serious, but now, there is a paid, a free, a commercial version. There is getshopped.org wich is ? the same or another site, there is wpml that said we will be compatible, but waiting for the new version. On the site, they dont talk about wpml, of state compatibility. No mean to contact without registering.. So here is my question. How can we get strait answer from a company that have a HUGE base of client that use there product. Is it possible to make a multilingual shop with e-commerce and wpml or qtranslate ? and where i can get answer... It's sad to see that even before installing the software, it so difficult to get help... just imagine when i will be on deadline... Tell me from your experience please, and thanks in advance


title: How to: inspect global variables in WordPress

text: ## People are often confused about how to get data from global objects/vars **Question:** In which ways can you inspect global variables? * * * This Q was written because it's needed pretty often over here at WA. I just wanted to have it as a fav to link over here (people often don't take a look at github gist links). _Feel free to modify the example if something is wrong or you think that the explanation is missing something. If you want to add other useful stuff, please add each as a single answer. Thank you._


title: Password protected category based attachment/media list?

text:
I am working on building a custom template, and I'm running into some trouble using the password protected feature for wordpress pages. Basically, the content from the page I have published and set to password protected behaves as expected, but then I have a call to get_posts() where I loop through the returned array from the category I created for the media/attachments for this specific category. Here is my loop code:
                     <?php if(have_posts()): while(have_posts()): the_post(); ?>
                             <?php the_title('
','
'); ?>                             <?php the_content(); ?>
                                  <?php    $args = array(                                     'post_type' => 'attachment',                                     'posts_per_page' =>25,                                     'numberposts' => null,                                     'category_name' => 'board-documents'                                 );                                 $attachments = get_posts($args);                                      $post_count = count ($attachments);                                 if ($attachments) {                                     foreach ($attachments as $attachment) {                                         $url = wp_get_attachment_url($attachment->ID);                                         $title = get_the_title($attachment);                                         echo '
'.$title.'
';                                     }                                 }                             ?>

                         <?php endwhile; else: ?>
404 Error Page Not Found!

We cannot find anything related to your search criteria please try different search term or use navigation.
                         <?php endif; ?>
                           Wordpress requests the password and until it received it, one line of text is hidden, which basically describes the list of attachments. However, whether the password is entered or not, the list of attachments from the 'board- documents' category is displayed, which basically defeats the purpose of the page I am trying to create. Here is what is being output from the above code without any password being entered: ![picture of problem](https://www.evernote.com/shard/s110/sh/4b55f031-bd91-46fb-89cb- db24cf78a701/6f5cc8dc5296891678aa15ca12db0a83/res/5d19e6da-607b-430b-ae74-062deccd150e/skitch.png) The part in the red is my list item (currently only one in the media library for this category) that I am trying to have hidden as well until after the correct password is entered. I'm relatively new with Wordpress, but I was thinking that a better way to do this would be to create a new instance of the WP_Query object, and if that's the case any help to point me in the right direction as to how I would accomplish this with a nested loop would be appreciated. I've done similar things that way before but with normal "post" type post items in a category, this is my first venture into trying to accomplish something similar with "attachment" type posts, and I think that might be what I'm having trouble wrapping my mind around. Oh also, I'm trying to avoid having to use a 3rd party plugin if at all possible. I understand that might make things easier, but this is also an effort to learn more about WP as well vs. relying on something that I don't completely understand as a solution. Thanks in advance!


title: Permalink category + tag and replace

text: is it possible a permalink structure "category+tag"? Example:               www.website.com/CATEGORY-TAG/postname/      I need also replace some tags into the permalink, for example: tag: LAMBORGHINI -> FERRARI               www.website.com/car-LAMBORGHINI/      to               www.website.com/car-FERRARI/      Can you help me? Thanks a million!


title: How do I "fix" a wp-blog-header.php error message?

text: I recently updated a site and received the following error message: > Fatal error: Call to undefined function wp() in /home/atlmp/public_html/wp- > blog-header.php on line 14 I checked the file and there doesn't seem to be any issues, so I can't figure out what's wrong?               <?php     /**      * Loads the WordPress environment and template.      *      * @package WordPress      */          if ( !isset($wp_did_header) ) {            $wp_did_header = true;            require_once( dirname(__FILE__) . '/wp-load.php' );            wp();            require_once( ABSPATH . WPINC . '/template-loader.php' );          }          ?>      Any help would be greatly appreciated.


title: WP navigation list classes

text: I'm using this code to display my menu:               <?php           $menu_args = array(          'container'       => '',           'menu_class'      => '',           'menu_id'         => 'main-menu',          );          wp_nav_menu($menu_args );           ?>      It works totally fine, but I don't know how to get rid of all these classes attached to every li in my menu? Example:               <li id="menu-item-227" class="menu-item menu-item-type-post_type current-menu-item page_item page-item-77 current_page_item menu-item-227">      It's pretty long, isn't it? I don't need classes and even IDs here at all, since my menu has one already. Any ideas?


title: Variable not working in sidebar loop

text: I have variable working in the loop of my homepage, but when I try to use that line `$variable = $post->post_title; $variable = str_replace( ' - ', '<br />' ,$variable); echo $variable;` in my sidebar with the same loop, the title disappears.               <?php     $recentPosts = new WP_Query();     $recentPosts->query('showposts=9&cat=191,2875,2574');     ?>           <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>           <?php $variable = $post->post_title; $variable =    str_replace( ' - ', '<br />' ,$variable); echo $variable; ?>


title: How to Display ACF Relationship Custom Field as Link to Specific Custom Post?

text: OK. I am reading this ACF tutorials, but I am not getting into this. I have 2 post types: **Lists** and **Contacts**. Every List must be related to some Contact, and I use **Relationship** custom field type (list_supplier), which is limited to only one choice (or Contact). All I have to do is to **display link on Lists template as Title of Contact post** which is now related with that List. Plugin   http://wordpress.org/plugins/advanced-custom-fields/ **UPDATE:** OK. I am close to solve this, but I have some problems with filter. Here is the code I am using in my template:                <?php $contacts = get_field('list_supplier'); ?>                         <?php if( $contacts ): ?>                             <?php foreach( $contacts as $contact ): ?>                                 <a href="<?php echo get_permalink( $contact->ID ); ?>" target="blank"><?php echo get_the_title( $contact->ID ); ?>                             <?php endforeach; ?>                         <?php endif; ?>      In one moment I make it work on front end, but there was some problem with filters. When I add some of these filters into functions.php, choices from custom field **list_supplier** disappear. When I remove filter **list_supplier** chioces are there, but they are not showing on front end. I know that problem is in filter, but I dont know how to wrote it.


title: Meta Query for specific months

text: I have a custom field which stores a date in a timestamp. I want to run a query that display posts based on the month, for example all entries from March, the specific day or year doesn't matter. I'm guessing i need to use the DATE or the DATETIME type for the meta query, but i don't know how to proceed:               if ($_GET['month']) {         $meta_query[] = array(                 'key' => 'event_start_date',                 'value' => $_GET['month']         );     }          $args = array(         'post_type' => 'event',         'paged' => $paged,         'posts_per_page' => -1,         'tax_query' => $cleanArray,         'meta_key' => 'event_start_date',         'orderby' => 'meta_value_num',         'order' => 'DESC',         'meta_query'=> $meta_query     );          $events = new WP_Query($args);


title: create functions based on array values

text: I am working on a function set that will add a piece to each custom post type on a site. Since I won't know what CPTs are registered, I wrote a function to get them all (simple). However, I now need to create a function for each value in an array (a small settings page) to properly finish this off. here's my array example:               $types = array ('type_a', 'type_b', 'type_c');      so I basically want to generate a function called `type_a_page`, `type_b_page`, etc within the same overall class. **UPDATE** I realized this code is only a small part and doesn't explain why I'm trying to achieve this. Here is the code base in it's entirety https://gist.github.com/4687698


title: How do you create dynamic customised sections in Wordpress?

text: I am very new to Wordpress and I just like to ask a fundamental question about its structure. I understand that Wordpress uses different files as templates for different sections or types of pages. What I'd like to know is what if I have certain parts within the page that contains other bits of data like in the image below (the ones with the question marks): ![enter image description here](http://i.stack.imgur.com/jrJ9K.jpg) Let's say, referring to the image above, that the 3 boxes in a row will display reviews and the 2 boxes in a row at the bottom will display just random quotations. These boxes have their own styling and the content would be dynamic. It would be quite straight forward if they were static (I just copy paste the HTML code) but it's making them editable via Wordpress that I'm not sure how to go about. Note that these sections are not performing any special function but rather, just displaying content (title, text or image). I guess my question boils down to: **How do I create any custom section I want in a Wordpress page and make them editable / dynamic?** Reading up a bit, I came across concepts like: widgets, custom fields, and meta boxes. But I'm not exactly sure which one of these is the best tool or if there are better ones.


title: Enable Submit Comment Without Page Reload (Using Ajax)?

text: When user writes a comment and hits the submit button, WordPress reloads the page, before the comment is shown to the user. Is there an Ajax-based solution that allows users to submit questions dynamically, without refreshing the whole page?


title: How can I remove the first two words and shorten get_the_title()

text: Some of my posts' titles have leading words, followed by a colon. I am removing the leading words and the column of every post title in the loop with the following:               <?php       $title = get_the_title();       $title_array = explode(':', $title);       $first_word = $title_array[1];       echo $first_word;     ?>      How can I also limit the total length of the remaining title by character count?


title: How to use wordpress plugin functions on my "home" page?

text: The problem I am facing right now is, that I can't use functions provided by wordpress plugins on my "Home" page. To be precise: I use wordpress together with the wp-e-commerce plugin, which has no real documentation. I had a template with some js-written checkout script which I need to replace with wp-e-commerce. The frontpage showed a featured product and some jcarousel to show other products. The only thing I'd need to change are the functions, f.e. `the_title()` -> `wpsc_the_product_title()`.


title: Issues when changing permalink Structure

text: I wanted to change the slug of the portfolio of my page, it is actually /portfolio-item/ i went to my `custom_post_types.php` file and changed the rewrite rule of the slug to my needs, but when i flush my permalink structure all my portfolio items get their permalink changed to `mysite.es/myslug//`. Am i doing something wrong? Is anything else needed when changing the permalink structure?               // Register Custom Post Type: 'Portfolio'     function ss_framework_register_post_type_portfolio() {              $labels = array(             'name'               => __( 'Portfolio', 'ss_framework' ),             'singular_name'      => __( 'Project', 'ss_framework' ),             'add_new'            => __( 'Add New', 'ss_framework' ),             'add_new_item'       => __( 'Add New Project', 'ss_framework' ),             'edit_item'          => __( 'Edit Project', 'ss_framework' ),             'new_item'           => __( 'New Project', 'ss_framework' ),             'view_item'          => __( 'View Project', 'ss_framework' ),             'search_items'       => __( 'Search Projects', 'ss_framework' ),             'not_found'          => __( 'No projects found', 'ss_framework' ),             'not_found_in_trash' => __( 'No projects found in Trash', 'ss_framework' ),             'parent_item_colon'  => __( 'Parent Project:', 'ss_framework' ),             'menu_name'          => __( 'Portfolio', 'ss_framework' ),         );              $args = array(             'labels'              => $labels,             'hierarchical'        => false,             'supports'            => array( 'title', 'editor', 'thumbnail' ),             'taxonomies'          => array( 'portfolio-categories' ),             'public'              => true,             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_nav_menus'   => true,             'publicly_queryable'  => true,             'exclude_from_search' => true,             'has_archive'         => true,             'query_var'           => true,             'can_export'          => true,             'rewrite'             => array( 'slug' => 'portfolio-item' ),             'capability_type'     => 'post',             'menu_position'       => null,             'menu_icon'           => SS_BASE_URL . 'functions/assets/img/icon-portfolio.png'         );              register_post_type( 'portfolio', apply_filters( 'ss_framework_register_post_type_portfolio', $args ) );          }add_action('init', 'ss_framework_register_post_type_portfolio');


title: Any idea why Google not caching my site?

text: My site www.books-for-children.com (developed in Wordpress) has been live for about two months and still has not been cached by Google, which seems highly unusual. Any ideas why? Thank you.


title: Getting Theme element into plugins page editor in wp admin

text: I'm having a hardtime integrating a theme editing element (in default page/post editor in wp-admin) into page/post editor made by the plugin BU Versions. Basicly I need this theme element > ![theme element](http://i.stack.imgur.com/Osabu.png) to get in the plugin editor > ![plugin editor](http://i.stack.imgur.com/niAXr.png) I've been googling and the only thing I found that could be relevant was this plugin wiki. I don't really know what to do with that since I know only HTML, CSS and some Javascript atm, and don't know where to look.


title: One post carries 30 postmeta values, is this too much?

text: I have some data saved as post meta, occasionally some plugins may save an extra piece. Now I installed bbpress, it saves at least 10 pieces of post meta. Adding them together, there are nearly 35 pieces of post meta per post. I think WordPress can handle much more if without bbpress. **With bbpress forum, the number of posts will increase dramatically, multiply by the number of post meta, it will be a huge post meta table**. Will it be a problem?


title: using OOP approach to create plugin but stuck at making hyperlinks to work

text: I am new to wordpress development so please be patient if my question sounds simple or ridiculous, since I have been doing object oriented programming in PHP so i wanted to use the OOP approach in wordpress plugin development as well and came across Boilerplate. I have gone through the code in detail but I am still confused. At present it comes with a view of `admin.php`, i wanted to create another page for testing purpose so i created a file view/`admin2.php`, I then want to create a hyperlink in `admin.php` to redirect the user to `admin2.php`, how can i do it? if i simply do the following, it does not work and gives me 404 error               go to admin 2      I know i can create a sub menu but i do not want to do that yet. I will really appreciate any help here. **UPDATE** This is what my `admin.php` looks like               <?php     echo 'Go to admin 2 page';     ?>      This is what my `admin2.php` looks like               <?php     echo 'Go to admin page';     ?>


title: BuddyPress: hook to add new profile fields and groups

text: I am writing a plugin that adds additional profile group and some fields in it when activated. I am using basic `$wpdb` functions to insert new rows into **bp_xprofile_groups** and **bp_xprofile_fields** So the whole process looks very lame:   1. I add new row to **bp_xprofile_groups** ;   2. I get ID of that row ( _WHERE name = 'New Group Name'_ );   3. I use these ID to insert new rows to **bp_xprofile_fields** Some fields are options so in total I make 5 SQL queries just to create 1 group field and 4 option fields with 2 checkboxes in that field group. I would like to make it using BuddyPress hooks. I found what I need: `xprofile_insert_field_group($args)` and `xprofile_insert_field($args)` so it looks like this:               $args = array(         'name'           => 'Test',         'description'    => '',         'can_delete'     => '0'         );     xprofile_insert_field_group( $args );      and then I am suppose to use xprofile_insert_field() but I do not know ID of a group I just created to use in field_group_id:               $args = array(         'field_group_id'           => ?????,         'parent_id'    => '',         'type'     => 'textbox',         ...         ...         );     xprofile_insert_field( $args );      Does anyone have any suggestions?


title: importing data from non-wordpress mysql db

text: I have created an import file to get the articles from a non-wordpress db and bring them in as posts in wordpress, I am not sure how to bring over the thumbnail image into my custom field I defined as "thumbnail". Any suggestions. Here is the code I am using:                   $results = mysql_query("SELECT headline, abstract, article, author, posted,    category, img, facilities FROM articles",$lclink);              $i = 0;     while ($row = mysql_fetch_array($results,MYSQL_ASSOC)) {        $post = array();        $post['post_status'] = 'publish';        $post['post_category'] = array(1);        $post['post_date'] = date('Y-m-d H:i:s',strtotime($row['posted']));        $post['post_title'] = $row['headline'];        $post['post_excerpt'] = $row['abstract'];        $post['post_content'] = $row['article'];        $post['post_author'] = $row['author'];                       $posts[$i] = $post;        $i++;     }          require('./wp-load.php');          foreach ($posts as $post) {       wp_insert_post($post);     }


title: Proper Failure of Plugin Activation

text: I am currently developing a plugin, which depends on another plugin (json- api). I use the following code to check for the presence during startup and in the constructor, in case the json-api plugin is deactivated later on:               require_once (ABSPATH . '/wp-admin/includes/plugin.php');          class MyPlugin {         public function __construct() {             // ...              // register a check for dependency             add_action('plugins_loaded', array( $this, 'dependency_check' ));              }              public function dependency_check() {             if (!class_exists('DEP_CLASS'))                 $this->dependency_failed();         }              protected function dependency_failed() {             if (current_user_can( 'activate_plugins' ))                 deactivate_plugins( plugin_basename ( __FILE__ ) );                  add_action('admin_notices', array ($this, 'notify_dependency_problem') );         }              public static function notify_dependency_problem() { /* ... error message shown ... */ }              public function activate() {             if (!is_plugin_active('dep_plugin/start.php')) {                 $this->dependency_failed();                 return false;             }         }     }          register_activation_hook(__FILE__, array('MyPlugin', 'activate'));     new MyPlugin();      This works fine so far - however, Wordpress additionally shows a "Plugin Activated" notice, which is misleading to the user. Additionally, the buttons ("Activate", "Edit", "Delete") below the plugin are now missing as well.   1. How is it possible to get rid of the "Plugin Activated" Message ( **Note** : Thanks to @toscho, this has been resolved via a `unset($_GET['activate'])`) and    2. how to get the buttons back?


title: Strange characters - despite everything being UTF-8

text: Not sure why this thread was closed, but this is the same issue inflicting many people. All my WP config settings are in order:               //define('DB_CHARSET', 'utf8');     //define('DB_CHARSET', 'utf8_unicode_ci');     //define('DB_COLLATE', '');      I even tried enabling them one by one. None worked. When I save a post, weird characters appear in place of apostrophes and spaces. This happens whether I type content manually or I've tried a few plugins.   1. UTF-8 Sanitize   2. Convert WP to UTF-8  ..etc. None of them work. The problem persists. I've also changed the database's character set and collation in MYSQL. Screenshot: ![MySQL tables/columns are all utf-8](http://i.stack.imgur.com/ET8uo.jpg) This is a screenshot of me entering some content by pasting it: ![Text is fine when entering it in the WP UI](http://i.stack.imgur.com/MHM8J.jpg) But immediately upon saving, the text comes back with garbled characters having replaced it: ![Annoying garbled characters](http://i.stack.imgur.com/ZiO4i.jpg) What else? I went through the rigmarole of dumping the entire MySQL DB, then removing all older non-utf8 characters via TR command.               tr -cd '\11\12\15\40-\176' < file-with-binary-chars > clean-file      Where the `file-with-binary-chars` was the MySQL dump. Then I restored the table. My MySQL config is all utf8:               [client]     default-character-set=utf8          [mysqld]     character-set-client=utf8     collation-server=utf8_unicode_ci     character-set-server=utf8      My browser is Chrome. The encoding is UTF-8 (in the VIEW menu). What else can I do? Do I need to make all the plugin files utf-8 as well? FYI, this blog is one of the Wordpress blogs. There are other newer Wordpress installations on the same server using the same installation of MySQL 5.6.17, but they don't have such an issue. My guess is that this being an older blog may have some variations in the text entered long ago, but frankly after having done all of the above, I really don't know what else I can do. Thanks for any inputs or pointers!


title: How to fetch all videos in custom page which uploaded in wp-admin (Media) in wordpress

text: I want to fetch all videos which are uploaded in back end wp-admin media. How to show all videos or audios which I uploaded on a custom page?


title: After adding filter to plugin's code, post's content doesn't display

text: After adding a filter to plugin's code, the post-template.php is not showing the post's content. This code in plugin's index file:               add_filter('the_content','post_add_me');     function post_add_me(){         $content = 'Test text here';         return $content;     }


title: Wordpress monthly archive category specific

text:
I have built a specific page to display only the posts in specific children categories. I want to have the monthly archive on the right hand side but only relating to those specific children categories. So far I have this, however it is ignoring the child_of and displaying everything.               <?php $arc = array(     'type'            => 'monthly',     'limit'           => '',     'format'          => 'html',      'before'          => '',     'after'           => '',     'show_post_count' => false,     'echo'            => 1,     'order'           => 'DESC',     'child_of' => 19);?>     <?php wp_get_archives( $arc ); ?>       And here is my page of code.

Knowledge
             <?php                 $catquery = new WP_Query( 'category_name=knowledge' );                 while($catquery->have_posts()) : $catquery->the_post();             ?>
                     <?php if ( has_post_thumbnail() && ! post_password_required() && !is_single() ) : ?>
                         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >                             <?php the_post_thumbnail('full', array('class' => 'img-responsive'));   ?>
                     <?php endif; ?>

<?php the_time('F j, Y'); ?>

                             <?php                                                            $categories = get_the_category();                                 $separator = ' ';                                 $output = '';                                 if($categories){                                 foreach($categories as $category) {                                 $output .= 'term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '">'.$category->cat_name.''.$separator;                                 }                                 echo trim($output, $separator);                                 }                             ?>

                          <a href="<?php the_permalink() ?>" rel="bookmark" class="entry-title"><?php the_title(); ?>                     <?php the_excerpt(); ?>                     <a class="read-more" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >                         Read More...
             <?php endwhile; ?>                  <?php wp_reset_query(); ?>

Categories

                     <?php                          $args = array(                       'orderby' => 'name',                       'order' => 'ASC',                       'child_of' => 19                       );                     $categories = get_categories($args);                       foreach($categories as $category) {                          echo '
term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'';                         echo '('. $category->count . ')
';  }                      ?>

                 <?php $arc = array(                     'type'            => 'monthly',                     'limit'           => '',                     'format'          => 'html',                      'before'          => '',                     'after'           => '',                     'show_post_count' => false,                     'echo'            => 1,                     'order'           => 'DESC',                     'child_of' => 19                 ); ?>                            <?php wp_get_archives( $arc ); ?>


title: Working with "Event Manager" Plugin and "lightbox plus colorbox" plugin for featured image

text:
currently working with "event manager" & "lightbox plus colorbox plugin" for featured image, I have loaded image using featured image but on output side when clicking on that featured image thumbnail, lightbox open well but display same event image & description.. I have used Event Manager Shortcodes... Here my output code:

                 Date/Time	                 Event Name	                 Venue	                 Details

         <?php echo do_shortcode('[events_list limit="100"]

                                      #_EVENTDATES
                     #_EVENTTIMES                 	                                      #_EVENTNAME                 	                                     #_LOCATIONNAME
                                 #_LOCATIONADDRESS
                    #_LOCATIONTOWN
                    #_LOCATIONSTATE
                    #_LOCATIONCOUNTRY
                 	                                       #_EVENTIMAGE{50,50}

                                            {has_image}#_EVENTIMAGE{/has_image}                             #_EVENTNOTES

              [/events_list]');?>

      Is there any other way to display featured image of particular event page ???? I am not getting any idea.


title: Custom loop in addition to default on archive page

text: I'm trying to create an interface on the admin that will allow our authors to select top resources to place as an aside on our archive page. I'm trying to add a loop in addition to the original query run on the archive page. I have   1. set up a page with a repeater field   2. referenced this page in the archive to grab the repeater info (by naming the repeater the same as a taxonomy slug and using `get_queried_object()->slug`. I'm running into some interference between the two loops: **archive.php** :               //REPEATER LOOP          <?php      $slug = get_queried_object()->slug;     $posts = get_field($slug, 156053); //returns the post objects from the page with the repeaters          if( $posts ): ?>              <ul>         <?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>             <?php setup_postdata($post); ?>             //post markup         <?php endforeach; ?>         </ul>         <?php wp_reset_postdata(); ?>          <?php endif; ?>          //ORIGINAL ARCHIVE LOOP          <?php while (have_posts()) : the_post(); ?>       <?php get_template_part('templates/content', get_post_format()); ?>     <?php endwhile; ?>      In this case, the first loop works as intended, and the original archive loop returns correct number of posts, but the postdata is from the original loop. (i.e. the first loop returns 3 results, the second loop returns 26 results but the first 3 are the same as the 3 from the original loop and the remainder are blank). I have found that changing the of the repeater loop variable `$post` takes away the conflict with the original archive loop, but then the repeater loop brings in the first post of the archive loop (x3, the number of posts designated by the repeater) I'm really scratching my head over this one. Any help greatly appreciated!


title: TwentyThirteen - Footer overlapping content

text: So, I'm designing a theme for a friend of mine, but there is a problem with the footer. Assuming the very bottom of the browser window is 1000px, it seems that the page content ends at 1000px, and the footer sits between 900px - 1000px. Thusly, the last 100px of content are cut off, and unreadable. How can I move the bottom of the content to end at 900px, leaving room for the footer? See here: http://level42.ca/village/contact-me/ Note the submit comment button is cut off. * * * I'm no expert by any means, and I hope what I've said makes sense.


title: 404 error on every post and page other than home

text: I am developing a wordpress theme and I think at some point I messed something up pretty badly in the wordpress system because nothing works anymore. I have tried several different themes, mine and the ones that come with wordpress. I have removed all plugins. I even reinstalled all of the wordpress files through ftp. No matter what I try I always get 404 errors when I try to view a page or a post or anything other than the actual home page. I have not anything fancy with the urls. For example, I am trying to view the default "Hello World!" post simply using the /1. I haven't added an .htaccess file. All of the back end stuff is working fine. I don't know how this makes sense, and I don't know where to go next while trying to debug this.


title: Nice way to print_r arrays

text: So you know how Drupal has functions in modules like Devel that allow you to output arrays in a nice format like `dsm($array)` or `krumo($array)`... Does WordPress have an equivalent or a nice way of displaying `print_r($array)`?


title: Can installing a plugin delete an entire theme directory?

text: I installed a plugin named "Contact Form With Captcha" via the Admin's back- end, and as soon as I activated and configured it, my entire customized theme disappeared! Because my last backup was from yesterday night, I ended up losing many precious hours of customizations... But before trying to re-do the work I lost, I need to know:   1. Do WordPress plugins have permissions to delete entire directories? (it's a Linux based host)   2. Is there a quality control process for plugins before they enter the WordPress official repository? I am using the latest WordPress 3.3.1 version. **Update:** After making sure that I have a backup of the most recent changes, I tried installing that "Contact Form With Captcha" plugin again and... it didn't delete anything! Moreover, it works beautifully. How the first installation lead to theme directory deletion will probably remain a mystery for me.


title: add_filter() doesn't work in loop

text: I'm trying to order the posts in the home page by modified date, and I put this code in the functions.php of my active child theme:               function orderby_last_modified() {       return 'post_modified DESC';     }      If I add the filter in the same functions.php file it works:               add_filter('posts_orderby', 'orderby_last_modified');      But I only want the filter in the home page loop, when I change that line to the home page it just dont work.               <?php     add_filter('posts_orderby', 'orderby_last_modified');     if(have_posts()):     while(have_posts()) atom()->template('teaser');     remove_filter('posts_orderby', 'orderby_last_modified');     ?>


title: Google 404 Errors

text: It seems Google Tries to crawl pages I never created and gets a 404 error, but it thinks or maybe somewhere in my code, google thinks there is a second page. For example, I have this page http://ecsimplified.com/portfolio_category/tops But not this page that google found a 404 error: //ecsimplified.com/portfolio_category/tops/page/2/ Since I didn't create this page or link to this page, why would it find this error?


title: Post data returning null

text: I'm writing code from within a plugin and I'm attempting to create a two-part registration form. I'm using POST to determine if the first part of the form was submitted or not. Unfortunately, though, the POST data is not coming through. Here is what my form looks like:               <form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post">     <input type="submit" name="user_info_form" id="user_info_form" />     </form>      This should POST back to the same page, in theory. I then use the below code to read the POST data.               if(isset($_POST['user_info_form']))     {     echo "found data";     }     else     {     echo "nothing found";     }      Unfortunately, "nothing found" is being outputted following a form submission. Is there any reason for this that has to do with WordPress? I've been at this for hours now so any help is _very_ much appreciated!


title: How is a user's primary blog determined?

text: The `wp_usermeta` database table has a `primary_blog` meta field for each user. Where is the value for that field set in the Admin Panel, and how can I override the default value?


title: How to use custom fields to replace top-level parent title with an image using wp_list_pages?

text:
I'd like to integrate `get_post_meta` into the `wp_list_pages` mix so that any top-level parent list items get replaced with images ONLY when a key exists in the post's custom fields section. I can't do it with the Featured Image b/c that's already being used for another purpose inside the post itself. Here's my Walker_Page class in functions.php:               /**      * Extend the default page walker class to append class names for pages that      * are parents.      * @uses Walker_Page      *      * http://wordpress.stackexchange.com/questions/11821/class-parent-for-wp-list-pages      *      */      class My_Page_Walker extends Walker_Page     {         /**          * Filter in the classes for parents.          */          function _filterClass( $class )          {              $class[] = 'parent'; // change this to whatever classe(s) you require              return $class;          }               /**           * This is effectively a wrapper for the default method, dynamically adding           * and removing the class filter when the current item has children.           */          function start_el( &$output, $page, $depth, $args, $current_page )          {              if ( !empty($args['has_children']) )                  add_filter( 'page_css_class', array( &$this, '_filterClass') );                   parent::start_el( $output, $page, $depth, $args, $current_page );                   if ( !empty($args['has_children']) )                  remove_filter( 'page_css_class', array( &$this, '_filterClass') );          }      }      So, I'm currently using `wp_list_pages` to show Custom Post Type posts like this:
<?php     $args = array(         'walker'=>new My_Page_Walker,         'post_type' => 'region',         'menu_class' => 'nav-menus',         'title_li' => ''     );     wp_list_pages($args);     ?>
      It spits out the following code:

City

Suburb

Complex

      and I'd like the following:

Suburb

Complex

      where `city-name.jpg` is defined in the custom fields section. It should only show up for the post title that has a custom field. Is this a really complex amount of code where I can't use `wp_list_pages`? I honestly can't find an answer online.


title: Removing Duplicate Custom Taxonomy Terms from within a Dropdown Select?

text: I have a custom post type that includes a custom taxonomy, called `client_name`. There is a page that loads these custom post types and displays them. What I need to develop is a dropdown list that displays all the custom taxonomy of those custom posts, which I have done, but I need to remove duplicates, and arrange them alphabetically, which is where I am having problems. This is what I am trying for removing duplicates (it doesn't work):               <?php     <form method="post" id="clientform" action="" onsubmit="return getURL(this.url.value)">       <select name="url" id="client">         <option selected="selected">By Client</option>         <?php           $args=array(                 'post_type' => 'our_work',             'post_status' => 'publish',             'order' => 'ASC',             'posts_per_page' => -1           );           $my_query = new WP_Query($args);           $k=0;           if( $my_query->have_posts() ) {              while ($my_query->have_posts()) : $my_query->the_post();               $termArray[$k] = array (trim(get_the_term_list( $post->ID, 'client_name')));               // $text = trim(get_the_term_list( $post->ID, 'client_name'));               for ($i = 0; $i <= $termArray.count; $i++ ) {                     for ($j = 0; $j <= $tempArray.count; $j++) {                   if ($tempArray[$i] == $tempArray[$j]) {                             unset($tempArray[$k]);                      $termArray = array_values($termArray);                   }                 } // end of for                  $k++;              ?><option value="<?php bloginfo('url'); echo "/client_name/"; echo $termArray[$k]; ?>"><?php echo $termArray[$k]; ?></option><?php              } ?>                 <?php              endwhile;            }            wp_reset_query();          ?>       </select>       <input type="submit" id="clientsubmit" value="Search" />     </form>      Ok, now I ran across this PHP function the other day and it does what I want, I just dont know how to use it correctly. > `array_unique($input);` Help me out guys .... Note the code listed above is only one code branch I was trying, not the whole file. * * * ## UPDATE Hey this does help me quite a bit, it and I found this to use, this gets me like 95% done, but not 100% yet. I tried your code, and I tried this one I am using, and it removes the dup's but anything that comes after it wont display hmm.... Heres the WP code:               <?php     if( $my_query->have_posts() ) {        while ($my_query->have_posts()) : $my_query->the_post();         $termArray[$i] = trim(get_the_term_list( $post->ID, 'client_name'));         $termArray = array_unique($termArray);         $termArray = array_values($termArray);         print_r($termArray);           print_r(sizeof($termArray));         if ($termArray[$i] != '') {            ?><option value="<?php bloginfo('url'); echo "/client_name/"; echo $termArray[$i]; ?>"><?php echo $termArray[$i]; ?></option><?php          }// end of if $i++;        endwhile;      }      wp_reset_query();      And here is the output from the array, it duplicates the array output because it is called every time a new post is called within the loop. The page is available here: > `http://magicvideo.com/cms/work/` View the source to see what i mean.


title: wordpress featured image

text: I'm new to Wordpress and I'm trying to create a new theme for it. I've downloaded the latest version (3.2.1) and installed it successfuly. But when I install my wordpress theme (to start to add the PHP) and try to create a new post, what happens is that the Set Featured Image box disappears and it only shows again when I return to the default theme. Any suggestions for this? Thank you


title: Why do posts disappear from admin after upgrading from WP 2.7.1 to 3.0.1?

text: After upgrading from WP 2.7.1 to 3.0.1, many of my posts are not showing in the admin section. I have almost 30 posts, but they're not showing on the post admin page. I created a mirror so I have a backup. But the problem is I can't upgrade WP +all plug-ins which I'm using in 2.7.1 because many posts are not showing on testing mirror. But they are showing on main live version.


title: How to pass NULL in where array for $wpdb->update

text: how to get results of a row with NULL element? I have to update the row which contains only the post_id and the repeat value, 'start' and 'end' should be NULL mysql table screenshot: http://i.imgur.com/l27is.png               $wpdb->update( $schedule_table, array( 'rpt' => $event_tag ), array( 'post_id' => $post_ID, 'start' => NULL, 'end' => NULL ), array( '%s' ) );     $wpdb->print_error();      I get this error: WordPress database error: [] UPDATE `wp_MW_3_schedule` SET `rpt` = 'monday' WHERE `post_id` = 357 AND `start` = '' AND `end` = ''


title: Setting a default parent page

text: I have a site I'm putting together for a friend and I would like all new pages that are created to be the children of a set page (page id 495). I assume that I need to edit the meta-boxes.php file but not sure other than that. Can anyone help me with this? I'd appreciate any comments. Joe


title: Can't Find BBPress data in Database

text: I have installed BBPress in my Buddypress Based Wordpress Site. And i m unable to find any table of bbpress which contains data from the forum in my database. Where can i find it?


title: How should I force WordPress to give proper name for the uploading images?

text: How can I force WordPress to give a proper file name for images like "http://www.mysite.com/wp-content/uploads/2012/07/mona_lisa_painting.jpg" instead of "http://www.mysite.com/wp-content/uploads/2012/07/28.jpg". Do I need any plugin? Or should I not to use standard "Set featured image" upload form? I heard that it's very important for google. Thanks to everyone!


title: Using stackexchange markup in WordPress (plugin?)

text: What plugin/etc lets me use stackexchange markup in WordPress? I was sure someone would've asked this question, but both of these searches:               +"stackexchange markup"      +"stack markup"       returned nothing.


title: Exclude parts of default css import

text: I'm importing Twenty Thirteen's default stylesheet, but I want it to leave my buttons alone. I could of course disable all mentions of "button" in the temaplate's `style.css`, but that would only work until the next update - I suppose. Is there any way to exclude the styling of certain elements from being imported?


title: Display WordPress Post Content in 3 Columns

text:
How can I display WordPress Post Content in 3 Columns and in order using WP_Query(); ? For example,
         Post-1         Post-4

         Post-2         Post-5

         Post-3         Post-6
      Any help is appreciated! Thanks.


title: Get_the_date doesnt show todays date

text: I tried the_date, the_time and get_the_date to show todays date on the website. But wordpress takes latest post's date and publishes it. For example on the index page if the latest post was posted on 12 of August despite i placed that code on very top of the page it shows 12of august as date. also when i visit any of the single page it shows that post's date. i need help on this.. thanks and if necessary this is the header code http://jsfiddle.net/AvMkY/


title: Settings API vs Theme Customizer

text: **When would it be appropriate to use the settings API, and when would it be better to use the theme customizer?** Having Googled around all morning, I haven't been able to find any well considered and recent guidance on this matter. While it's still early to say, I feel that the theme customizer is a suggestive first step towards bringing in more _Squarespace-like_ editing features. Does anyone know of any plans to sunset the settings API in favour of the theme customizer? Should we all slowly be moving towards it, or would we be better off sticking to the settings API? Can they live side-by-side, and if so, where would the division of responsibilities lay?


title: Are Post IDs Unique Across all Post Types?

text: I thought Wordpress post IDs were only unique within each post type, so that the first instance of each post type would have an ID of 1 and they would count up from there. In order to get a specific instance of a custom post type, you would have to designate that post type in the query. But according to this answer on another question, post IDs are actually unique to each post, regardless of post type. I checked in the posts table for the site I'm working on now, and sure enough the post IDs are unique. But I'm sure I read somewhere (a couple years ago) that they weren't. Did Wordpress change the way it sets post IDs, or have I just been wrong this whole time?


title: Combine two taxonomies in a hierarchical tree

text: For example, I have WooCommerce products that have taxonomies:   * brand (e.g. Converse, adidas, D&G) (taxonomy id: product_brand)   * category (e.g. Boots, Sneakers, Sandals, Heels) (taxonomy id: product_cat) Of course, not every brand includes all categories. I need to list the categories by brand. (something similar to what Zappos does. E.g.:               Converse     - Sandals (2)     - Sneakers (6)          D&G     - Boots (10)     - Heels (4)     - Sandals (7)      Is there any light way to do this except looping through all products with specific brand and checking for its category?


title: How to auto strip hyperlinks & images in wordpress post

text: I creat a post form on front-end for wordpress members by use **DJD Site Post** plugin. Plugin url: http://wordpress.org/extend/plugins/djd-site-post/ And now i want to auto strip all hyperlink & images in post when user copy & paste content from other website (with many links). I use the simple editor in plugin (tinymce editor). How to auto strip all hyperlinks & images in post befor record to database (or when user click the submit button) by **php functions** or **tinymce functions** (exclude admin user)? Here is some code in the plugin i think need to edit: (I'm using case **simple** )               // Set editor (content field) style     switch($djd_options['djd-editor-style']){         case 'simple':             $teeny = true;             $show_quicktags = false;             add_filter( 'teeny_mce_buttons', create_function ( '' , "return array('bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'undo', 'redo', 'unlink', 'fullscreen');" ) , 50 );             break;         case 'rich':             $teeny = false;             $show_quicktags = true;             break;         case 'html':             $teeny = true;             $show_quicktags = true;             add_filter ( 'user_can_richedit' , create_function ( '' , 'return false;' ) , 50 );             break;     }      Thanks all for help. (Sorry if my english is not good.)


title: Getting the correct header image on a smaller device

text: I have a Twenty eleven child theme, and I've modified the functions.php.               'width' => apply_filters( 'twentyeleven_header_image_width', 1200 ),     'height' => apply_filters( 'twentyeleven_header_image_height', 105 ),      The theme looks good on a normal screen, but on a smartphone, the header image get's distorted (see below). How can I modify the theme to, either eliminate the header image or to add a smaller image in this case? ![enter image description here](http://i.stack.imgur.com/H1Ehw.png)


title: wp_redirect hangs, but returns true

text:
I have no idea what I'm doing wrong, but I can't get the wp_redirect to actually redirect the page. I enabled the wp_debug to check for "header already sent" errors, but nothing. I installed the "Better HTTP Redirects" plugin to check the response, but it says 302 found. If I check the wp_redirect response like this, it says "redirect success". But nothing really happens in the end, no errors show up either.               if ( wp_redirect( admin_url( 'admin.php?page=plugin_test&success=item_saved' ) ) ) {        echo 'redirect success';      } else {        echo 'no';     }      I tried to add ob_start to the init, and add an action for the admin_init and call ob_start from there but both made no difference. This is a stripped down version of the code I have, but it has the same problem. What happens in the complete code is that the user fills in a form, adds the item and it is saved to the db. After that the user is redirected and a custom msg is shown. The whole script works fine, except for the last redirect.               class Submit_Test {              function __construct() {             add_action( 'init', array( $this, 'init' ) );         }              public function init() {             add_action( 'admin_menu', array( $this, 'create_admin_menu' ) );             }              public function create_admin_menu() {                        add_menu_page( 'Plugin test', 'Menu', 'manage_options', 'plugin_test', array( $this, 'item_list' ) );         }              public function item_list() {             if ( isset( $_REQUEST['actions'] ) ) {                 $this->add_item();             }                   if ( isset( $_GET['success'] ) ) {                 $this->show_success_notifications();             }                  if ( $_GET['action']['add_item'] ) {                  ?>                     <form method="post" action="" accept-charset="utf-8">                         <input type="submit" name="actions" class="button-primary" value="add_item" />                     </form>                 <?php             } else {                 ?>

Current Item

Add Item

                 <?php             }            }              public function add_item() {             if ( wp_redirect( admin_url( 'admin.php?page=plugin_test&success=item_saved' ) ) ) {                 echo 'redirect success';                 } else {                 echo 'no';             }                   exit();         }              public function show_success_notifications() {               echo 'yes';          }        }          new Submit_Test;      Any ideas on how to get the redirect to work, and what i'm doing wrong? I'm out of ideas on what could be the problem here.


title: Category and tag with same name

text: IN my blog, if I have a category and tag with the same name, it will make the tag have a number in the URI. Example: **category/php** **tags/php-2** Is there anyway to make my tags with the same name as an existing category, to not append a number to the end of them for my links?


title: How to save dynamically generated value in post type?

text: I'm trying to use the count of the amount of people that register a post id to a table in the DB. I want to save this `COUNT` value to the post_meta so when I display the list of posts it can also show the amount of people "registered".               function get_custom_field($field_name){         return get_post_meta(get_the_ID(),$field_name,'true');          $attendee_number = $wpdb->get_var("SELECT COUNT(user_id) FROM ".$wpdb->prefix."mro_attendees WHERE event_id = ".$project_id);     $attendee_limit = get_custom_field('project_limit');     $attendee_status = $attendee_number . '/' . $attendee_limit;      I then take the value of `attendee_status` and use it in a `hidden` field which saves to the post meta and then call it as one of the values in a loop I create. The issue is that it does not update this value if I change the limit on the page, it can not dynamically change in other words. It saves it as is when it loads on the post edit page. So when I load the page to create the post, there is no `COUNT` so its `0` entries and there is no limit so it's `NULL`. So the attendee_status variable will be `0/` How do I create this X/Y limit status so that it updates when there is a new entry or when the limit custom field is updated?


title: Writing directly to WP_Posts table

text: We directly add posts to WP_Posts table using filemaker. Once the post has been published, however, wordpress seems to be disregarding the existence of certain fields. For example, we have data in the Post_Excerpt field, but it doesn't appear where expected when post is published. However, if we go into Wordpress interface to edit the post, the excerpt appears in the edit field. Then if we select "Update" the excerpt starts appearing on the published post as expected. Also having issues with thumbnails not appearing until we go into the post via Wordpress and click "Update". It seems then that Wordpress is running some process when a post is published from the Wordpress interface, that we're missing when we write directly to WP_Posts. Any suggestions? Thanks!


title: URL rewrite based on a custom field value

text: I'm working on a migration from another CMS to WordPress. The old site had terrible SEO-unfriendly URLs in the format `http://example.com?lid=1234`. We have imported all the posts from the old site into WordPress and are storing the `lid` as a custom field. We would love the old URLs to still work if possible, but as there are about 3,000 posts using .htaccess is out of the question. So my question is: how would I create a rewrite rule that extracts the `lid` value from the URL and redirects to the post that contains it in the custom field? (the `lid` value is unique, so there are no worries about more than one post with the same custom field value) Many thanks Simon


title: Refine Search Results

text: I'm looking for a simple way to achieve search filtering like this : http://ckclinical.co.uk/search/ They are obviously pointing people to a empty search and then filtering by category. I've spent hours running round in circles :) Thanks.


title: Moving sharedaddy buttons (in Jetpack) to the top of a post?

text: How would one move the sharedaddy buttons included in Jetpack to be placed before a post's or page's content, rather than after it? I see that in `sharing-service.php` the function that prints the buttons is hooked to the_content filter hook: `add_filter( 'the_content', 'sharing_display', 19 );` I'm not sure what to place in my functions.php file to override that, though. I'm assuming I somehow need to cause the output from `sharing-service.php` to be prepended to `the_content` rather than appended to it.