This plugin throws error on the events page only

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


Functions.php and includes

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?


How to provide translations for a WordPress TinyMCE plugin?

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,     ...     }


How to configure folders with 'Child Theme'?

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.


Remove custom post type slug

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 ?


Exclude admin bar from showing avatar customization

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?


Registration Page

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


wordpress add_submenu_page not working

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?


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

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.


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

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.


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

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?


Custom plugin route in Wordpress

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


Wordpress Visual Composer Row Visibility

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.


nested conditional to check for feature image and custom field?

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 '
';     }     ?>


Create hundreds of users with just ID in phpMyAdmin

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


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

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.


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

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 :)


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

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 );                                        ?>


AJAX call - failling to call do_action

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?


Widget modifications in a child theme

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?


Meta_query with relation 'OR' killing server CPU

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.


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

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?


can hyperlinks be displayed in excerpts?

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?


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

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.


uml diagrams of wordpess

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


WP 3.1 getting tax_query to work in query_posts()

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);


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

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


something like is_childtheme()

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?


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

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?


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

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(); ?>


Retrieve posts by author

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.


Counting post fields

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


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

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?


WP E-commerce wpml translation or multilingual

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


How to: inspect global variables in WordPress

## 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._


Password protected category based attachment/media list?

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!


Permalink category + tag and replace

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!


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

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.


WP navigation list classes

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?


Variable not working in sidebar loop

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; ?>


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

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.


Meta Query for specific months

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);


create functions based on array values

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


How do you create dynamic customised sections in Wordpress?

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.


Enable Submit Comment Without Page Reload (Using Ajax)?

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?


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

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?


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

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()`.


Issues when changing permalink Structure

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');


Any idea why Google not caching my site?

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.


Getting Theme element into plugins page editor in wp admin

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.


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

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?


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

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';     ?>


BuddyPress: hook to add new profile fields and groups

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?


importing data from non-wordpress mysql db

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);     }


Proper Failure of Plugin Activation

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?


Strange characters - despite everything being UTF-8

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!


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

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?


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

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;     }


Wordpress monthly archive category specific

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 ); ?>


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

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.


Custom loop in addition to default on archive page

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!


TwentyThirteen - Footer overlapping content

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.


404 error on every post and page other than home

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.


Nice way to print_r arrays

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)`?


Can installing a plugin delete an entire theme directory?

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.


add_filter() doesn't work in loop

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');     ?>


Google 404 Errors

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?


Post data returning null

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!


How is a user's primary blog determined?

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?


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

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.


Removing Duplicate Custom Taxonomy Terms from within a Dropdown Select?

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.


wordpress featured image

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


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

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.


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

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` = ''


Setting a default parent page

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


Can't Find BBPress data in Database

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?


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

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!


Using stackexchange markup in WordPress (plugin?)

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.


Exclude parts of default css import

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?


Display WordPress Post Content in 3 Columns

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.


Get_the_date doesnt show todays date

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/


Settings API vs Theme Customizer

**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?


Are Post IDs Unique Across all Post Types?

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?


Combine two taxonomies in a hierarchical tree

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?


How to auto strip hyperlinks & images in wordpress post

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.)


Getting the correct header image on a smaller device

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)


wp_redirect hangs, but returns true

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.


Category and tag with same name

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?


How to save dynamically generated value in post type?

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?


Writing directly to WP_Posts table

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!


URL rewrite based on a custom field value

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


Refine Search Results

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.


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

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.


Wordpress .htaccess subdirectory problem

I've been having some issues with my Wordpress install allowing me to access subdirectories, specifically a CodeIgniter install at mydomain.com/codeigniter. I know that technically it should work just fine as- is and recognize folders as they are created. However, this is not happening. I suspect it has something to do with a plugin, but I've tried disabling all of them and the problem still occurs (directs me to the Wordpress 404 page). I've found a solution in the meantime, however. If I create a subdomain, something changes and everything works like it should, accessing the folder both via the direct path and via the subdomain name. Any help? I've tried all sorts of fun stuff with my .htaccess files in both directories, but changing them doesn't do anything. Update: Here's the Wordpress .htaccess in the root folder:               DirectoryIndex index.php index.htm index.html     AddHandler application/x-httpd-php52 .php .php5 .php4 .php          # BEGIN WordPress          <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /          RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteCond %{REQUEST_URI} !^/?codeigniter/     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      And the CodeIgniter .htaccess file in the /codeigniter/ subdirectory.               DirectoryIndex index.php index.htm index.html     AddHandler application/x-httpd-php52 .php .php5 .php4 .php          <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /codeigniter     RewriteCond $1 !^(index\.php|images|robots\.txt)     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule ^(.*)$ index.php?/$1 [L,QSA]     </IfModule>


How to add an option page to custom post type?

As the title says, I have not found any function to add an option page to a particular custom post type. I would like to keep the option page related to a custom post type grouped together in its own panel, instead of adding it to the "Setting" panel, for example. Any suggestion? Thank you


Only show posts with date of today or in the future (i.e don't show past posts)?

Is it possible to only show posts that have todays date or in the future? I don't want to show any posts that are in the past. Also, I want the list to show posts that have a date in the future as in the CMS it shows as scheduled. Here's my loop:

<?php echo the_title(); ?>

         <?php $portfolioloop = new WP_Query(array(         'paged'          => get_query_var('paged'),         'post_type'      => 'news',         'posts_per_page' => 4,         'tax_query'      => array(             array(             'taxonomy' => 'news',             'field'    => 'id',             'terms'    => 51,             ),             ),         )); ?>         <?php while ( $portfolioloop->have_posts() ) : $portfolioloop->the_post(); ?>         <div class="news-item" onClick="location.href='<?php echo the_permalink(); ?>'">
<a style="color:#F45B11!IMPORTANT;" href="<?php echo the_permalink(); ?>"><?php echo the_time('d.m.Y'); ?> / <?php echo the_title(); ?>

             <?php if (get_field('description') != "") { ?>             <?php echo the_field('description'); ?>             <?php } else {              $newscontent = get_the_content();             $newscontent_str = strip_tags($newscontent, '');             echo substr($newscontent_str,0,250) . "…";             } ?>

         <?php endwhile; // end of the loop. ?>
<?php echo $portfolioloop->post_count; ?> opportunities
         <?php if (function_exists('wp_pagenavi')) {         wp_pagenavi( array( 'query' => $portfolioloop ) ); } ?>


How to Featured content with images in home page?

Today i saw a WordPress blog which is using **Featured Articles** in its home page. can any one tell me how to add that code manually to my blog only in home page. **Here is the screen shot and blog url** url : www.itechcode.com ![featured article screenshot](http://i.stack.imgur.com/1Q96d.png)


What is the optimal way to filter out subpages from admin?

I guess it's always possible to hide them with js, but is there a code snippet out there for query level child page filter? I only want top level pages to remain. EDIT: my coder came up with it, stay tuned for a solution


How to allow internal links using wp_kses filtration

I'm working on front end submission and of course I want to secure data by filtering before inserting to database. The form contains repeatable fields group data which I want filter by wp_kses function (external urls, etc.) but it would be great if user will be able to insert internal link to another publication and wp_kses will pass it.. I've managed this way:               $r_step_description = $_POST['step_description'];                 $allowed_html = array(                 'br' => array(),                 'em' => array(),                 'strong' => array(),                 'p' => array(),                 'br' => array()             );             $allowed_a = array(                 'a' => array(                     'href' => true                 ));         for ($i = 0; $i < $count; $i++) {             $domain = strpos($recipe_step_description[$i],'site-name.com');              if(!empty($domain)){                  $allowed_html = array_merge($allowed_html, $allowed_a);}                  $r_steps['steps']['text'][$i] .= wp_kses(wpautop($r_step_description[$i]),$allowed_html);             }      Everything ok with this except one thing. When second link to external domain is present - this link will be unfiltered. Any clue? Thank you in advance!


Displaying posts by year

I'm trying to display posts on the homepage from the current year only. I am using the following:               <?php if ( is_front_page()) { ?>         <?php $current_year = date('Y');  ?>         <?php query_posts( "&year=$current_year&order=DESC"); ?>     <?php } ?>      Yet it doesn't seem to work. I also tried:               <?php query_posts( "&year=' + $current_year + '&order=DESC"); ?>      But that doesn't seem to work either. Can anyone help? Thanks


Wordpress Thumbnail add action if no thumbnail

I was learning how to make my own WordPress plugin, currently I'm confused on how if there is no thumbnail in the post then I use the default image as thumbnail. Code that I used:               add_action( 'the_post', 'mythumb' );          function mythum(){        if (!has_post_thumbnail()) {         $defaultthum = "http://example.com/default.jpg"         echo ('

')        }     }      **My problem:** The default image thumbnail is not in the right position. See this image any idea? Or the hook `the_post` is incorrect?


i have wordpress blog with many posts. each posts associated with many categories and sub categories. i want to display sub categories assoccited with each post in a category archive page. for example, if user clicks on MBA category all posts with category MBA will display. in which, i want to display all sub categories of MBA associted with each post. ie, some post contain mba in london, mba in US as child categories of MBA. or other post may contain MBA in UAE as child category of MBA. all child categories associated with each post should display with posts. please help. Thankz very much...


How can I count articles retrieved by tags

how can i get posts retrieved by tags, I want to count them. The code i want to use in tabs. Ex: Movies(3) , Articles(15) Movies and Articles are Tabs. I know how to retrieve the count of posts from a custom field.               $related_posts = get_field( 'tags' );     $count = 0;     if ( !empty( $related_posts ) ) {         $count = count( $related_posts );     }     echo $count;      How can I count the post retrieved by tags. Ex: Tag Will Smith - this tag has 6 news EX: Articles on the page (6) 6 - mean there are 6 articles containing the tag Will Smith How can I count the articles retrieved. PS: This is how I retrieve the articles.               <?php     $orig_post = $post;             global $post;             $tags = wp_get_post_tags($post->ID);                  if ($tags) {                 $tag_ids = array();                 foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;                 $args=array(                     'tag__in' => $tag_ids,                     'post__not_in' => array($post->ID),                     'post_type'=> 'stiri',                     'posts_per_page'=>20, // Number of related news that will be shown.                     'caller_get_posts'=>1                      );}     $recentPosts = new WP_Query($args);     ?>     <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>


How does Wordpress support Unicode?

I've been looking through Wordpress' codes and they're mostly using PHP's regular string functions, like strlen, strpos, etc. Yet I know Wordpress supports utf8, so how does it do that? Does it overload the regular string functions with multibyte string functions? If so, is that a good idea in practice? If not, then how do they do it?


Fatal error: Allowed memory size exhausted

I have a custom .csv generator functions that basically export data from posts and its post metas. The function works fine on this `WP_query` parameter:               Array(     [tax_query] => Array         (             [0] => Array                 (                     [taxonomy] => lot-status                     [field] => slug                     [terms] => planting                 )         )     [offset] => 1000     [order] => ASC     [posts_per_page] => 500     )      The problem occur when I set the offset to 1500 and WordPress gives me the > Fatal error: Allowed memory size of 37748736 bytes exhausted (tried to > allocate 71 bytes) in /var/www/twitgreen/htdocs/wp-includes/meta.php on line > 574 fatal error notice. I've already set the memory limit to 64M in wp-config.php. `ini_set('memory_limit','64M');` Has anybody found (and solve, hopefully) this kind of problem? A debugging hint maybe?


Output custom field as ul list

I have a custom field who's content I would like to output as a ul list. The custom field contains words that are separated with a spaces between. I'm trying to use this code here but it's not working.                   <?php         $list_items = get_post_meta($post->ID, 'idid');                   if($list_items){                 $list_items = explode(" ", $list_items) {                     echo '
';                         foreach($list_items as $list_item)                             echo '
' . $list_item . '
';                     echo '
';                 }             }              ?>