How to display users with posts published between two dates (Sorted by Post-Count) [Multisite]

I'm trying to make a list of users who have published posts within two given dates. My attempts using WP_User_query just work for one blog ID and takes time to load because it runs through a lot of `foreach` and `if` statements. Also it seems that not all users are stored in the arrays I'm using. I have a feeling that I'm doing it totally wrong but I can't find any wordpress function which could help me. I would like to do this with an wpdb query but I don`t know how to check for all users and their post count. My current code is this:               $blogids = array( 2, 4, 5, 6 );          global $blog_id;          $startdate = "2012-03-01";     $enddate = "2012-04-31";          //$wp_user_search = new WP_User_Query( array( 'role' => 'subscriber', 'blog_id' => $blog_id, 'fields' => array('ID', 'user_nicename', 'display_name') ) );          $userlist = array();     $usercountlist = array();          foreach($blogids as $blogid) {              $wp_user_search = new WP_User_Query( array( 'role' => 'subscriber', 'blog_id' => $blogid, 'fields' => array('ID', 'user_nicename', 'display_name') ) );         $usernicenames = $wp_user_search->get_results();          foreach($usernicenames as $usernicename){                   $user_count = $wpdb->get_var( $wpdb->prepare( "         SELECT COUNT(ID) FROM ". $wpdb->base_prefix . $blogid ."_posts WHERE post_status = 'publish' AND post_type = 'post'         AND post_author = ".$usernicename->ID." AND post_date >= '".$startdate."'         AND post_date < '".$enddate."' HAVING COUNT(ID) > 0         " ) );                   //$userlist[$user_count] = $usernicename->user_nicename;              if($user_count) :           $userlist[] = $usernicename->display_name;           $usercountlist[] = $user_count;         endif;              }          }               $userlist = array_combine($userlist, $usercountlist);          $str = serialize($userlist); // Serialises the array $array and store as $str     $strenc = urlencode($str);  // Encode the serialised array          $temp_folder = str_replace("//", "/", $_SERVER['DOCUMENT_ROOT']."/_temp/");          $file = $temp_folder.'userstats.txt';     file_put_contents($file, $strenc);          $content2 = file_get_contents($file);     $arr = unserialize(urldecode($content2));          echo "
";     arsort($arr);     $i = 0;     foreach ( $arr as $key => $value ) {     if($value > 0 && $i < 10):     echo "
".$key." (".$value.")
";     $i++;     endif ;     }     echo "
";


How do I list a custom field and custom taxonomies for each result in a loop?

How do I list a custom field and custom taxonomies for each result in my loop below?               <?php     $temp = $wp_query;     $wp_query= null;     $wp_query = new WP_Query();     $wp_query->query('post_type=customtype&showposts=10'.'&paged='.$paged);     while ($wp_query->have_posts()) : $wp_query->the_post();          the_title(); // <- works     //list custom field here     //list custom taxonomy here          endwhile;          wp_pagenavi();                   ?>


Use Custom Database with Custom Post Type

I decided to ask this question as searching online left me really overwhelmed and not knowing which direction to take. I am about to tackle a project that has its own custom database (finished e-r design) in MySQL, and I want to use Wordpress as its CMS.   1. Can I make custom post types but pull/save records from/to the custom database? if so, any link to resources would be much appreciated, like:     * Should I merge the databases or can I keep working them independently?     * For the custom post type's admin area, how do I use this to pull/save entries from/to the custom database's table(s) for individual records?     * Do I use/make custom fields in the custom post types and then rely on some hook to pull/save them from/to the custom database?     * Will I be able to delete the posts in Wordpress and also delete the corresponding entry in the custom database?   2. Is there a wiser way to go about this whole thing? I'm very open to suggestions/informed guidance. I found the following resources, but I just can't pull them all together:   1. http://stackoverflow.com/questions/7538337/save-the-data-of-custom-metabox-to-database - but how do I do this for a custom database?   2. http://www.deluxeblogtips.com/meta-box - is this something I should look at or is it overkill?   3. http://Wordpress.org/support/topic/migrate-from-custom-database-to-Wordpress-database - this kind of hits the spot but not quite; if I want to work on the custom database without merging it with Wordpress what do I do? Again, I'm just fumbling my way around these options as these are what I've come across so far. If someone knows a better/more correct way to tackle the whole problem and not just piecing-together disparate info ending up with a frankensteined setup then I would love to hear what you have in mind.


Paypal Post IPN handeling nightmare

I'm trying to integrate paypal standard with my Wordpress site and all was going well until I wanted to do one simple thing:   * The user submits a paypal payment   * Paypal posts the IPN to my server   * Post IPN Hook adds a user_meta   * If user reloads current page, it checks to see if previous user_meta is set to 1, if it is, displays "you have already purchased your ticket" I thought this would be pretty straight forward, but if I add this to my `functions.php` for the post IPN Hook :               add_filter("gform_paypal_post_ipn", "update_order_status", 10, 4);     function update_order_status($ipn_post, $entry, $config, $cancel){              // if the IPN was canceled, don't process         if($cancel)             return;              global $current_user;         get_currentuserinfo();         $currUID = $current_user->ID;         update_user_meta($currUID, 'eventRegistration', 1);              return;      }      Absolutely nothing happens. My thought is that since the IPN is bouncing from off-site, maybe the user ID isn't available? Or am I wrong here? Figuring that I'm correct about the user ID not being avail, I was thinking of another way to grab the user ID. Since I'm using Gravity Forms with the PayPal addon, all forms submitted are stored in a database tables `wp_rg_lead` & `wp_rg_paypal_transaction`. Since every IPN posts a transaction id, I figured I could do a JOIN between the two tables using the transaction ID sent by paypal. so I tried:               $txn_id = 'aRandomStringOfNumbersAndLetters'; // The transaction ID that paypal POSTs          $uid = $wpdb->get_col( $wpdb->prepare(      "     SELECT wp_rg_lead.created_by     FROM wp_rg_lead, wp_rg_paypal_transaction     WHERE wp_rg_lead.id = wp_rg_paypal_transaction.entry_id AND wp_rg_paypal_transaction.transaction_id = %s     ",     $txn_id       ) ); which returned the user ID associated with the transaction ID. I thought to myself, great! This will work! However, if I try to combine all this in to my `functions.php` nothing seems to work in its entirety. This:               add_filter("gform_paypal_post_ipn", "update_order_status", 10, 4);     function update_order_status($ipn_post, $entry, $config, $cancel){              // if the IPN was canceled, don't process         if($cancel)             return;              $txn_id = $ipn_post["txn_id"]; // transaction ID POSTed by PayPal              $uid = $wpdb->get_col( $wpdb->prepare(          "         SELECT wp_rg_lead.created_by         FROM wp_rg_lead, wp_rg_paypal_transaction         WHERE wp_rg_lead.id = wp_rg_paypal_transaction.entry_id AND wp_rg_paypal_transaction.transaction_id = %s         ",         $txn_id          ) );               update_user_meta($uid[0], 'eventRegistration', 1)                   return;      }          function update_order_status($ipn_post, $entry, $config, $cancel){              $txn_id = $ipn_post["txn_id"]; // transaction ID POSTed by PayPal              $uid = $wpdb->get_col( $wpdb->prepare(          "         SELECT wp_rg_lead.created_by         FROM wp_rg_lead, wp_rg_paypal_transaction         WHERE wp_rg_lead.id = wp_rg_paypal_transaction.entry_id AND wp_rg_paypal_transaction.transaction_id = %s         ",         $txn_id          ) );               update_user_meta($uid[0], 'eventRegistration', 1)     }      Produced nothing useful. If I remove the SQL query and say change the update_user_meta to `1, 'eventRegistration', $txn_id` and submit a paypal request, the meta updates fine. I'm kind of at a loss, I must be missing something. Any help would be much appreciated! Thanks! Tre


GD star rating function problem

If anyone can help me out with this you'll be a life saver. I've been trying to use the wp_gdsr_render_review() function to add the results to my theme with no success. The results appear fine if I use the GD star rating widget so they are definitely being stored okay. Is there a known problem with wp_gdsr_render_review()? I created the function using the build tool. Here is the exact code I used: wp_gdsr_render_review(get_the_id(), 54, 'oxygen', 16); Please help! Martyn


Custom metabox for menu administration page?

I've been googleing around but failed to find a solution for my need. I'm using wordpress 3.0 and TwentyEleven theme as default pack. In the Dashboard -> appearance->menus that allow user can create menu items from Pages,Categories,and custom link. Now I want to add a box like those boxes above but it would list my custom-post-type's taxonomy and metadata. How can I accomplish with this task ? I know how to add metabox and taxonomy for custom post type but cannot do with this sort of thing.


Custom ul class

I need help for my custom Wordpress Layout. It should look like this (HTML):

                  About

                  Services

                  Contact

      In Wordpress:

Test/Site

      My Code:               <?php         wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'collapse navbar-collapse navbar-ex1-collapse' ) );      ?>


How to create a custom shortcode based on the layout?

Hi I am developing a custom post type plugins. Which has shortcode support. Already i have created a shortcode which is going to use for default layout design. Again i have to create a onemore shortcode for another layout design. My current shortcode **[testimonial]** i want the shortcode something like this **[testimonial style="fancy"]**. How can i do it.can any one suggest me . Thanks


I made a local clone of a website that's running LIVE in order to safely work offline for a while. On every page of the local version I get a HUGE warning which says **Notice: Constant WP_POST_REVISIONS already defined in C:\xampp\htdocs\local- tutorials\wp-config.php on line 95** I guess it's been defined twice, once in `wp-config.php` and once elsewhere, right? However, I've no clue where it's been defined for the second time. I searched `wp-config.php` for a second instance but no luck. I then checked the `functions.php` in my theme but it doesn't contain any statement on revisions. Googling leads mainly to rather old threads that seem to address a different issue. I believe the error is related to a reasonably recent (< 1 year?) Wordpress update since it didn't occur previously but I'm not 100% sure on that. Thank you in advance for any suggestions. **UPDATE** After searching all files, three contained `wp_post_revisions`:   * C:\xampp\htdocs\local-tutorials\wp-config.php    * C:\xampp\htdocs\local-tutorials\wp-includes\default-constants.php    * C:\xampp\htdocs\local-tutorials\wp-includes\revision.php I commented out the `wp_post_revisions` in `default-constants.php` and this seems to solve the problem. I find that a bit awkward since `wp-config.php` is (partly) meant to override default constants. So I think it's strange I get this huge error when I do so. Or am I missing something?


Is it possible to remove subscription box from Jetpack stats page?

Is it possible to remove following box from Jetpack's stats page as I'm using Feedburner? ![Jetpack](http://i.stack.imgur.com/X1tiV.png)


save_post not working

In order to create (or update, whenever a post is updated) a unix-timestamp meta, I used following code to fire on save_post. I pasted this code in functions.php. But I believe this is not working, as I can't access the related unix meta created by save_post in loop anywhere in a custom template. **EDIT:** After answers and comments I added priority and arguments in save_post hook event and also updated the way of retrieval. The problem now seems as follows - When a post is created then the save_post does not fires, but if I update the post (after creating it) save-post fires. Plus, on updation (at any point after creation) if I change values of start date and end date, it doesn't reflect, it always takes the value which was used while creating the post. Code -               function vg_update_timestamp( $post_id, $post ) {              $offerstartdate = get_post_meta($post_id, 'offer_cmb_offer_from_textdate', true); //not unix timestamp         $offerenddate =  get_post_meta($post_id, 'offer_cmb_offer_till_textdate', true);  //not unix timestamp              $timestamp_start = strtotime( $offerstartdate );         $timestamp_end = strtotime( $offerenddate );              update_post_meta($post_id, 'offer_cmb_offer_from_textdate_unix', $timestamp_start );             update_post_meta($post_id, 'offer_cmb_offer_till_textdate_unix', $timestamp_end );       }     add_action( 'save_post', 'vg_update_timestamp', 0, 2 );      In Template (Custom Template) am using following code to retrieve the field -               $unix_version_s = get_post_meta($post->ID, 'offer_cmb_offer_from_textdate_unix', true);     $unix_version_e = get_post_meta($post->ID, 'offer_cmb_offer_till_textdate_unix', true);          $unix_start = strtotime($unix_version_s);     $unix_end = strtotime($unix_version_e);          /******     Converting date to desired format      **************************************/          $offerstartdate = gmdate("l, M j, Y", $unix_start);     $offerenddate = gmdate("l, M j, Y", $unix_end);          /*****     and then am using $offerstartdate and $offerenddate wherever needed, but its returning Jan 1, 1970 [which i think is because the value is zero or nill]     *****/


404 error on cyrillic url

I am using Another Wordpress Classifieds Plugin (awpcp) with Ukrainian translation. Due to it's limitations I am forced to use Cyrillic urls. While the site navigation works perfectly, when I reload some pages or create an external link to those pages I receive a 404 error. Normalize URLs 1.1 Plugin fixes problem completely, but for some reason my homepage stops loading.. Site is hosted on Hostgator shared hosting with php 5.3 enabled. Wordpress version is WordPress Uk 3.4.3-alpha. To access problematic page please click "Куплю (0)" category on the following page: ukrcoins.com/дошка-оголошень/ Please, advice a possible solution. Thanks! Getting a Normalize URLs 1.1 Plugin to work seems to be the easiest way.


Wordpress widget/sidebar dividers?

I have a widget sidebar, but I'd like dividers between them. I can achieve this in CSS using boring borders, but I have a png image I'd rather use instead. Is there a way to insert a divider after each widget item? (apart from the last one of course). I can do this in jQuery quite easily but I'd rather do it in the template file if at all possible I'm guessing it's something for the functions file or where I register the sidebar? Thank you


Cookie Details Requested

We have Wordpress 3.4 installed and looking for details regarding functionalities of cookies created by wordpress. This information is needed so that we can align with EU cookie laws. So please suggest where can I find details.


Display number of posts via adress bar?

when i call this link ;               ?s=key&order=ASC      wp display my search query order by ASC.               ?s=key&order=ASC&number=10      how can we display whatever i want to display postnumber like 10 or more ? is that possible ?


Count post that have specific meta value

How do I count only the post that have a specific custom meta field value?               $productCount = wp_count_posts('product');     echo $productCount->publish;      That gives me all the total of all the post. How do I find out how many of those post have say a custom meta value of "cat"?


Feed Code Error

Since last Thursday I've been having this issue with my RSS feed at www.theqnews.ca/feed/ A CDATA section was not closed. Line: 34 Character: 25 Is there a fix for this? I've looked on Wordpress.org and have tried a few things there with nothing helping out. I've also posted in the Support Forums but nobody has answered. Any ideas? Thanks!


Format Date for Manual Insertion into post

I have the following `$mydate = "26 January, 2012, 5:05 AM";` I want to format this date properly so I can insert it into a post_date. Is there a simple way to do it?               $post_ information = array (         //other data is also inserted         'post_date' => $mydate;     );


category title and description in multi language issue

![enter image description here](http://i.stack.imgur.com/NFhIK.jpg) How to change the category title and description in multi language? Plz help me anyone.. I have installed this plugin : mLanguage Version 1.6.1! 1


Twenty Twelve Widget Taking Space

I am using the twenty twelve theme and in this theme I used the `Main Sidebar` for widgets. I used the code below to make the widgets disappear in my `homepage ( front page )`. The code works however, the widget area is still taking the space. How can I stretch my content to fill the whole width?               <?php If ( !is_front_page ) { get_sidebar() } ?>      Before Applying the code the widget is still visible see image below: ![The Image Before the code](http://i.stack.imgur.com/ODUaE.jpg) After Applying The Code Above it removes the widget but the widget is still taking up space. ![After Applying the Code](http://i.stack.imgur.com/QSEID.jpg)


Why is the Page Title missing on Pages added with add_submenu_page?

Adding sub menus is easy with `add_submenu_page` and is working fine as long if you define a `$parent_slug`:               add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function );      if you set the `$parent_slug` to `NULL` as described here to hide it from any menu item the title of the page will get ignored (`$page_title`)               add_submenu_page( NULL, $page_title, $menu_title, $capability, $menu_slug, $function );      I've tested it with all versions from 3.3 up to the latest 4.0


High CPU load when loading images in media library

I notice it uses high cpu when I load images from my media library. I have about over 1 million images uploaded and they are organized into folders by Post ID. Any tips to reducing CPU?


How to prevent deleting a user

I'm trying to disable the user when the user is deleted. So I want to keep the data of user, but preventing access. I know that I've the option to reassign in wp_delete_user() but I prefer keep the ID and user data. I've tried to do with this code:               remove_action( 'delete_user', 'wp_delete_user' );     add_action( 'delete_user', 'edit_user_status' );          function edit_user_status( $user_id ){         #edit user_status     }


Meta box dropdown of custom posts

I am trying to display a dropdown select metabox on the "add new" page of a custom post type which displays a drop down list of titles from a separate custom post type ( it's an effort to relate the two CPT's together - one being "clients" and the other being "projects" so that when creating a new project one would be required to select a client from the drop down select ). All works well except for the fact that somehow the query is affecting WordPress because when i click "add new **project** " instead of an empty field for the title like you'd normally get it is populated instead with the title of the first **CLIENT**. I thought that by adding wp_reset_postdata() that it would solve the problem but it didn't. Can anyone help? ( I am only adding what i think is the relevant/problematic piece of code as the metabox code itself works as expected as far as i can see and i assume the problem is with the way i've done the query)                 <select name="my_meta_box_select" id="my_meta_box_select">       <?php        $my_loop = new WP_Query( array( 'post_type' => 'clients', 'posts_per_page' => 10 ) );       while ( $my_loop->have_posts() ) : $my_loop->the_post();       $title = get_the_title();       ?>       <option value="<?php echo $title ?>" <?php selected( $selected, $title ); ?>><?php echo $title ?></option>       <?php       endwhile;       ?>                   </select>            <?php       wp_reset_postdata();       }


Conditional display faults

I'm trying to get the line of codes below to display it's content on "web- design-portfolio" and "web-design-portfolio-2" but it ends up messing up every other pages on my website and displays the "Ul" element on them. Any ideas what the problem could be.               <?php           is_page(array('web-design-portfolio','web-design-portfolio'));  { ?>
                          <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<a href="<?php the_permalink() ?>">
                                <?php if( has_post_thumbnail() ) { ?>
  <?php the_post_thumbnail($size, $attr); ?>
<?php } ?>                                <?php the_content(); ?>                      <?php endwhile; else: ?>
Woops...

Sorry, no posts we're found.
                      <?php endif; ?>

«

1

2

»

                  <?php } ?>


Add a custom function to widget code

Hopefully, this is an easy question - I'm just a bit confused. I've got a custom widget with the usual structure:               class My_Widget extends WP_Widget {       function My_Widget() {         // widget actual processes       }       function form($instance) {         // outputs the options form on admin       }       function update($new_instance, $old_instance) {         // processes widget options to be saved       }       function widget($args, $instance) {         // outputs the content of the widget       }     }     register_widget('My_Widget');      I's like to add my own custom function to it, so I can reuse it. Something like:               function item_width_cols_to_class( $cols_num = null ) {         if( $cols_num ){             switch ( $cols_num ){                 case '2':                     return "col140";                     break;                 case '3':                     return "col220";                     break;                       case '4':                     return "col300";                     break;                       case '5':                     return "col380";                     break;                 case '6':                     return "col480";                     break;                       case '7':                     return "col540";                     break;                       default:                     return "";                     break;             }         }     }      However, when I add that code to My_Widget class I got an error saying: `"Fatal error: Call to undefined function 'item_width_cols_to_class()'"`. I'd think it's possible to add custom functions to a widget as it extends the WP_widget class. Am I doing something wrong? :S Thanks for help, Dasha


Edit page shown after login in Wordpress?

I am currently using the wp_login hook to run a php function when a user logins. However, I want to show users who login notifications (a pop up with recent posts, etc) and I was planning to do this by running a javascript function. Is it possible to edit the page shown to the user after login? This is the code I have so far:               add_action( 'wp_login', 'my_login_function' );     add_action( 'wp_footer', 'the_footer_function' );          function the_footer_function(){         if (defined('FIRST_RUN')){             echo "<script>jQuery(document).ready( function(){alert('hello');});</script>";             define('FIRST_RUN', false);         }     }          function my_login_function($user_login){          global $altdb;          $user_info = get_userdatabylogin($user_login);          $wonAwards = $altdb->get_var("SELECT achievement_id FROM user_".$user_info->ID." WHERE isTold='false'");          define('FIRST_RUN', true);          //$altdb->query("UPDATE user_".$user_info->ID." SET isTold='true' WHERE isTold = false") or die(mysql_error());     }      Any help is appreciated.


is_archive() doesn't work on public query var archive pages?

> Public query vars are those available and usable via a direct URL query. E.g.               example.net/?category_name=tech&tag=gadgets      But doesn't `example.net/?category_name=tech&tag=gadgets` show an **archive**? It definitely uses the `archive.php` template, but for some reason, the `is_archive();` conditional tag doesn't seem to work. If `is_archive();` isn't the conditional tag to check these archives with, what is?


Why wp_nav_menu() doesnt show the proper meny when invoked two consecutive times?

I just noticed something weird I never saw before. I'm working on a project using WP 3.6.1. This project that has two different menus (actually, three, but that's not important). I'm calling them through the `wp_nav_menu` function. I've done this kind of thing quite a few times now... but today is different. Today it doesn't work :( My PHP code, placed in header.php, looks like this:
                     <?php wp_nav_menu('header_main'); ?>

                     <?php wp_nav_menu('header_secondary'); ?>
                   The menu items are declared in `functions.php` and two different Menus are configured through the dashboard to show up in each location.                   if (function_exists('register_nav_menus')){             register_nav_menu('header_main', 'Menú principal' );             register_nav_menu('header_secondary', 'Menú secundario' );         }      But the first menu keeps on being printed in the two locations. As I said above, using two different menu is something that Ive done in the past, but today I don't see the error... and there _is_ and error, as it is not working :S Any ideas?


Replacing parent theme's IE-specific CSS

I'm trying to do exactly what was apparently achieved in this discussion. However, I'm finding that my IE-specific stylesheet's being loaded all the time! My parent theme includes this in its functions.php:               wp_enqueue_style( 'twentytwelve-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentytwelve-style' ), '20121010' );      And I'm adding this to my child theme's functions.php - which, if I understand correctly, should remove the parent version of ie.css and replace it with mine:               function PREFIX_remove_scripts() {     wp_dequeue_style( 'twentytwelve-ie' );          // Now register your styles and scripts here     wp_enqueue_style( 'treetop-ie', get_stylesheet_directory_uri() . '/css/ie.css',     array( 'twentytwelve-style' ), '20121010' );          }          add_action( 'wp_enqueue_scripts', 'PREFIX_remove_scripts', 200 );      Well, my ie.css is loading, all right, but in _all_ browsers. What did i get wrong? Thanks... adam


Operations with custom fields values in a loop

I have a foreach for displaying all the post in one taxonomy filter by terms.   I have a custom field for display a numeric value.   What I need, is to make two math operation with all the values of that field, across all post in that term. I mean: Taxonomy X has 4 terms.   Each term has 4 posts.   Each post, has 1 custom_field.   I need to make the sum of all custom_field value in that term, and the average of that custom field. So, for now I have:               <?php foreach ( $prod_terms as $prod_term ) {     $prod_query = new WP_Query( array(      'post_type' => 'prod_cientifica',      'prod_area' => $post_slug,      'tax_query' => array(         array(         'taxonomy' => 'prod_tipo',         'terms' => array( $prod_term->slug ),         'operator' => 'IN',         'get' => 'all',          'field' => 'slug'         )     )     ) );          if ( $prod_query->have_posts() ) : while ( $prod_query->have_posts() ) : $prod_query->the_post(); ?>

<?php the_title(); ?>

<?php the_field('prod_autores'); ?>

<?php the_field('prod_info'); ?>

<?php the_field('prod_fi'); ?>

     <?php endwhile; endif; ?>      What i need, is to make the sum of all **prod_fi** field in every term. Also, the average of that field too. Any idea? Thanks! -- Edit with code. I tried several options by now. The closer one was this:               <?php     if ( $prod_query->have_posts() ) : while ( $prod_query->have_posts() ) : $prod_query->the_post();      $total_fi = array();     $meta_key = 'prod_fi';//set this to your custom field meta key     $total_fi = $wpdb->get_col($wpdb->prepare         ("SELECT meta_value FROM wp_postmeta as pm         INNER JOIN wp_term_relationships as tr ON (pm.post_id = tr.object_id)          INNER JOIN wp_term_taxonomy as tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id)         WHERE 1         AND tt.taxonomy = 'prod_tipo'         AND pm.meta_key = %s",          $meta_key));         echo 'Total FI '.array_sum( $total_fi );         ?>      But, this one shows me the total ammount of all custom_field in taxonomy. this one, doesn't stop of sum in each term, it continues.               $factorI = get_field('prod_fi');      if($factorI) {$factor_total += $factorI;}     echo $factor_total;      Thank u. * * * I've found a dirty fix to this. I know this is not the way, please if someone knows the right way to do this, I will be happy!!!!               <?php     //start the foreach for each term in taxonomy     foreach ( $prod_terms as $prod_term ) {     $prod_query = new WP_Query( array(         'post_type' => 'prod_cientifica',         'prod_area' => $post_slug,         'tax_query' => array(              array(                 'taxonomy' => 'prod_tipo',                 'terms' => array( $prod_term->slug ),                 'operator' => 'IN',                 'get' => 'all',                  'field' => 'slug'                 )              )     ) );     ?>

<?php echo $prod_term->name; ?>
         <?php                   // First while for fetch the value of "prod_fi" and make the math.                  while ( $prod_query->have_posts() ) : $prod_query->the_post();              $factorI = get_field('prod_fi');              if($factorI) {$factor_total += $factorI;}                         // count post for average math operation             $count_posts = $prod_query->current_post + 1;             $factorP = $factor_total / $count_posts;         endwhile; ?>
<?php _e('Publicados: ', 'twentytwelve'); ?> <?php echo $count_posts; ?>

<?php _e('FI medio: ', 'twentytwelve'); ?> <?php echo $factorP; ?>

<?php _e('FI: ', 'twentytwelve'); ?> <?php echo $factor_total; ?>
              <?php                  //original query to fetch the post in the term         if ( $prod_query->have_posts() ) : while ( $prod_query->have_posts() ) : $prod_query->the_post(); ?>

<?php the_title(); ?>

<?php the_field('prod_autores'); ?>

<?php the_field('prod_info'); ?>

          <?php endwhile; endif; ?>
     <?php     // Reset math operation of factor_total, so it don't continue sum        $factor_total = null;        $prod_query = null;        wp_reset_postdata();      } //endforeach     ?>      * * * Edited again!               <?php      // Fetch all post in taxonomy divided by terms.      foreach ( $prod_terms as $prod_term ) {         $prod_query = new WP_Query( array(         'post_type' => 'prod_cientifica',         'prod_area' => $post_slug,         'tax_query' => array(             array(             'taxonomy' => 'prod_tipo',             'terms' => array( $prod_term->slug ),             'operator' => 'IN',             'get' => 'all',              'field' => 'slug'             )         )     ) );     ?>     <?php if($prod_query->have_posts()) : ?>

<?php echo $prod_term->name; ?>
         <?php          // Declare total and count before loop         $factorTotal = 0;         $factorCount = 0;         // First loop to fetch prod_fi value         while ( $prod_query->have_posts() ) : $prod_query->the_post();                      $factorI = get_field('prod_fi');              if($factorI) { // Only if it exists                       $factorTotal += $factorI; // Add it                       $factorCount++; // Count it             }         endwhile; ?>
            <?php _e('Publicados: ', 'twentytwelve'); ?> <?php echo $factorCount; ?>

            <?php _e('FI medio: ', 'twentytwelve'); ?> <?php echo $factorTotal; ?>

            <?php _e('FI: ', 'twentytwelve'); ?> <?php echo ($factorTotal / $factorCount); ?>
              <?php         if ( $prod_query->have_posts() ) : while ( $prod_query->have_posts() ) : $prod_query->the_post(); ?>

<?php the_title(); ?>

<?php the_field('prod_autores'); ?>

<?php the_field('prod_info'); ?>

         <?php endwhile; endif; ?>
     <?php endif; ?>     <?php     // Reset things, for good measure     $factor_total = null;     $prod_query = null;     wp_reset_postdata();     } //enforeach     ?>


get_post_meta() not loaded with wp-load

I am executing this code in my external php file (= I am accessing his externaly without loading the full WP; I have a reason why I am doing it) that is located here:               http://******.com/wp-content/themes/mycartheme/file.php      I have this code to check if the code exist in the post_meta table and if yes grab the post_id of that row and make another query to grab the custom field value `rw_email_dealer` of that post id.               define( 'SHORTINIT', true );     require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' );          global $wpdb;          $code = "2302327676";          $unique_check = $wpdb->get_var(                   "SELECT post_id                    FROM {$wpdb->postmeta}                    WHERE meta_key = 'rw_code'                    AND meta_value = '{$code}'                    LIMIT 1"     );          if ($unique_check == NULL) {        die('Die!');     }     else {         $email_dealer = get_post_meta($unique_check, 'rw_email_dealer', true);           print_r($email_dealer);     }      I can get the $unique_check (the post_id value). No problem here. However, if I try this               $email_dealer = get_post_meta($unique_check, 'rw_email_dealer', true);       I am getting the error:               Fatal error: Call to undefined function get_post_meta()       So, I guess that the code for that function is not loaded with:               require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' );      How can I solve that so I can use that function `get_post_meta()` in external php files that don't come with WordPress?


Cannot seem to replace the native menu with the menu I created, so 2 menus appear

Helping a friend w/ a navigational menu on a WordPress PHP site -- called it **Primary Menu**. I'm trying to override the default navigational menu with the jquery-mega-menu I created in the widget area I created. **Here's the problem:** I'd like to have the menu in the widget area I created, " **my_mega_menu** ", which calls the Primary Menu. But the inkthemes_nav() function adds the Primary Menu also. When I comment this out in header.php, it shows only the menu I want it to show, but it breaks the functionality of the menu; the drop- downs don't drop down into the sub-menus. Does anybody know if it's possible to eliminate the inkthemes_nav native menu, but maintain the functionality of the jquery-mega-menu I created? ![Double Menu](http://i.stack.imgur.com/W5pbQ.jpg) **Here's the code in my header.php:**

                       <?php _e('Pages Navigation Menu', 'colorway');      ?>              <?php inkthemes_nav(); ?>                 <?php /* Widgetized sidebar */     if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('my_mega_menu') ) : ?>     <?php endif; ?>

      Thanks for any guidance anybody can offer to point me in the proper direction (what I should be looking for, what to do, etc.)!


Redirect after get_delete_post_link

I've created a custom post type with front-end submission. I added a delete link using `get_delete_post_link` ... which works great, except it brings me to a "Page not found" after the post is deleted. I'd like to be able to redirect to another page after the post is deleted. I know I can use the `add_filter( 'get_delete_post_link', 'some_function' )` ... but I wouldn't want that to fire every time that function is run in case I create other custom post types with front end submisison. I know about `wp_delete_post`... but I can't call that from a link. What would be the best way to do this? Can't find any real solutions after some reading. Thanks!


WordPress Multisite Dilemma!

We are running our main domain as a WordPress install from past 3 years and were adding sub-domains as seperate WordPress installs. With the time, we thought that it would be a better idea to have our main domain as a MultiSite and manage other sub-domains as its child sites. But the question is - Is it worth? What would happen to the links? What about the SEO that have build up in three years? Is there anything to worry about? If anyone of you can answer this and also - What needs to be done to move an already running site to a MultiSite interface? Thanks a ton, in advance.


Custom priority with the_content filter based on user input

Currently, in my plugin Contextual Related Posts, I have an option to automatically add the related posts to the content using               add_filter('the_content,'ald_crp')      I know I can change the priority of the filter by adding a number greater than 10 (which is WordPress default).               add_filter('the_content,'ald_crp',20)      However, what I would like to do is let the user set the priority of the filter from within the options page which I can use and set the_content filter accordingly. The plugin already has its own settings page. My plugins doesn't use classes. It uses functions. Any suggestions / code samples for this?


get meta fields and taxonomy of any post type

I have created 6 different custom post type, each having different post meta and taxonomies associated with it. I am displaying all different custom post types in a dropdown using `get_post_types()` function, Now, onchange of dropdown, I want to display associated meta fields and taxonomy. I know that this information is not saved in DB unless a post is created, so is it possible to read this information like WordPress is reading or please suggest me if this is possible or not.


How to use Repeater field of advance custom field

I have crated one Repeater field with four sub field, how to write code in the place of my html for exp ,this a HTML code

Fencing

Slashing

Earthwork

Excavation

Equipment


echo category description in single.php

i asked this on SO but got no where. i will try asking here. this works fine in category.php `<?php echo category_description(the_category_id()); ?>` but it does not work in single.php, just the category id shows up not the description. any ideas, how to get this done? thanks in advance Edit: in category: `<?php echo strip_tags(category_description(4)); ?>` in single `<?php echo category_description(the_category_id()); ?>` cat id = 4 i know i'm not striping the tags..for single i'm just trying to display the cat desc when in the single post page.


Pull in taxonomy links using get_the_terms?

I am having issues with the get_the_terms php that is pulling in my current posts categories (custom taxonomy portfolio_category). I can successfully pull in the last category. If you look at this page you'll see links along the top: http://www.slarc.com/portfolio-view/central-control-building-east-texas/ those links are pulled in via get_the_ters_list but the links don't have: www. slarc. com / projects in front of it. Where I need it to jump to a page with the same slug. That's why I started working with the code below. It works, but it only pulls in ONE taxonomy? This is the second line of links on the page: http://www.slarc.com/portfolio-view/central-control-building-east-texas/ PHP Code: ID, 'portfolio_category' );                               if ( $terms && ! is_wp_error( $terms ) ) :                       $portfolio = array();                      foreach ( $terms as $term ) {                     $portfolio[] = $term->name;                 }                      $portfolio_category = join( " | ", $portfolio );             ?>

                     <?php echo 'slug.'">'.$term->name.''; ?>

                  <?php endif; ?>      How can I pull in all the taxonomies?? FYI-Ignore the links on top that show up. These are brough in with the get_the_terms_list But those need the http:// www. slarc.com/ projects in front of the links. Thanks, Lorne EDIT (GOT THE WORKING CODE Thanks jfacemyer!): PHP Code: ID, 'portfolio_category' );                               if ( $terms && ! is_wp_error( $terms ) ) :                       $portfolio = array();                      foreach ( $terms as $term ) {                     $portfolio[] = $term->name;                 }                      $portfolio_category = join( " | ", $portfolio );             ?>
             <?php                 $url = site_url();                     foreach ( $terms as $term ) {                         $linklist .= "
slug . "'>" . $term->name . "
\n";                     }                 echo "
" . $linklist . "
";             ?>
                  <?php endif; ?>


How can I call a specific file (via php) by referencing the logged-in username?

I want to setup a page that will display different content for each registered user of my site who falls within a specially-created user role ('map_user'). So, for example, if a site user who is in the 'map_user' category logs into the site they're automatically forwarded to a specific page. This page then refers to their username, calls specific external content (html) based on that username and includes it in the page. I've managed to solve the first problem (forwarding users based on their user role) through a combination of plugins and functions. But I'm struggling with the second part, once they've arrived at the destination page. I've created a template for the page and included the following php within it:               <?php if ( is_array( $user->roles ) && in_array( 'map_user', $user->roles ) ) : ?>         <div id="mapContent">             <?php require("/mapping/{$user->data->user_login}.html/"); ?>         </div>     <?php endif; ?>      Where am I going wrong? (My php skills are very much of the copy/paste or "steal and adapt" variety, so I'm prepared to have stupid mistakes pointed out to me :) )


Help to enqueue a js functions ( jquery)

I have this js function (the `textualizer.js` is external) but I can't make it works on WordPress. Any help? I already added               wp_register_script( 'textualizer', WP_THEME_URL . '/assets/js/textualizer.js');     wp_enqueue_script( 'textualizer' );      to theme functions. What am I doing wrong? I know it's probably simple, but I can't figure it out. EDIT: i changed the function in functions.php, a user in irc channel told me that i was missing the correct action hook. still doesn't work... http://pastebin.com/L8ZRSvzU


jQuery slider widget similar to cnet.com

I'm building a WP theme that requires a splash graphic "slider" widget (similar to what you see on cnet.com). I'd like to build one myself, mainly so I can have full control over the bits, but if there are any available with licensing options for inclusion in commercial shipping software, I'd consider those as well. Does anyone have an example they could share of creating a "graphic slider" widget (or plugin) using the built in WP jQuery script via enqueue? By "graphic slider" I just mean a script that displays a series of named images, along with an index at the bottom that shows the current slide and allows tracking back/forward and to specific slides in the rotation. It would be a bonus, if the widget had a control panel to allow the user to upload/delete each slider graphic as well as define the target URL for each image in a user friendly GUI with upload capability. Thanks in advance for the help. Hope the question is not too conceptual.


WordPress Multisite domain mapping with different IPs

Hey there, I have 5 different sites with 5 different IP's on cyberwurx shared account. How can I install wordpress multisite and use the domain mapping plugin and also keep my sites on different IP's? Any ideeas? Ty!


Adding post-formats to Twenty Ten child theme

So I have been building a child theme for a site. Wanted to add post formats to a twentyten child theme. Now, the goal of my child theme is to copy over the absolute least amount of code/templates from the parent as possible. I originally figured if I added additional post formats to a twentyten child theme, using a custom function which uses add_action after_setup_theme, it would work. However, that does nothing. Something like (either with or without the 2 existing formats, doesn't matter):               function voodoochild_setup(){          add_theme_support( 'post-formats', array( 'aside', 'gallery', 'link' ) );     }          add_action( 'after_setup_theme', 'voodoochild_setup' );       The only way I've found to add post formats, is to copy the entire twentyten_setup action to my child functions.php from twentyten, and edit that small portion from there, adding my formats. This works fine, and I'm cool with it. I just want to know if it's necessary. Is there a better way to register new formats onto a child theme without hauling that big block of code over to the child?


Using template tags in external JS file

I’d like to know how to use the `get_bloginfo( 'template_directory' )` tag in an external JS file. I just found out that it’s possible using the `wp_localize_script` function but I didn’t manage to get it to work … _functions.php_               wp_enqueue_script( 'custom_js' );     wp_localize_script('custom_js', 'wp_urls', array( 'template_dir' => get_bloginfo( 'template_directory' ) ));       _header.php_ (beneath `wp_head();`)               <script>         alert(wp_urls.template_dir);     </script>


How to programatically change username (user_login)?

As in the title, how to programatically change user's login? I wanted to use `wp_inser_user` function, but it appears that when updating current user, it doesn't change his/hers username. Should I use `$wpdb->update` for that? If yes, how would code for changing username look like? What consequences would changing user login have, given that WordPress API doesn't allow changing usernames? Thanks!


"lambda_xx" on all wordpress login pages

I have the oddest thing happening on all the Wordpress installations on a single server. I don't know if anyone has seen this or knows what it is. On the login page, there is an error message that says "lambda_49" and every time I refresh the page, the number after the underscore goes up by one. Has anyone seen this before or know what it's about?


Wordpress widget args - classname?

Could someone explain to me what "classname" in the $widget_ops array means when you're creating a custom widget? It doesn't seem to have any relevance. I've searched both the source and the db and can't find any instance of it.               $widget_ops = array( 'classname' => 'example', 'description' => 'widget description ' );          $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'example-widget' );          $this->WP_Widget( 'example-widget', 'Example Widget', $widget_ops, $control_ops );


Shortcode strips formatting and returns at content top

Using the Advanced Custom Fields plugin and I've got a shortcode going for a repeater field, but it returns the list at the content top. I changed it from an `echo` to a `return`, which I understood would fix the issue of it appearing at the top of the content, but it didn't and now it strips all the html out and returns the whole thing as one big text block. Clearly I'm doing something wrong.               function teamlist_shortcode($atts, $content = null) {     if (get_field('aw_team_members')):     while (has_sub_field('aw_team_members')):          $string = '
' . the_sub_field('team_name') . '

' . the_sub_field('team_title') . '
' . the_sub_field('team_bio');          endwhile;     return $string;     endif;      }     add_shortcode('teamlist', 'teamlist_shortcode');


Hide allow trackbacks/pingbacks

Under the discussion tab on the post page, there's 'allow comments' and 'allow trackbacks and pingbacks', how would I hide the option to allow pingbacks from users but still have it be on by default?


How to add custom "Menu Settings"

I want to be able to tell the wordpress menu's on what page to show. The way my menu is shown now: ![How it looks default](http://i.stack.imgur.com/lu5Bo.png) I want to have the option in the menu settings like so: ![Where I want the setting](http://i.stack.imgur.com/VouCf.png) But I cannot find any documentation about the menu settings. Did I miss something? I am able to create a list of pages. I just cannot find where I can add these settings. ## Edit I created a workaround. I am using the meta boxes on the pages and a dropdown to select the menu. So now I can choose a specific sidebar menu for each page instead of a menu for specific pages.


cloning a WP_Query

I'm working with several nested loops in order to create a statistics table for teams in a league and I'm having trouble getting my original query back. I've read that I should clone the original query but can't find an explanation of how to do it or where to put it. Here's what I've come up with (definitely not working):               $team = new WP_Query(array('post_type' => 'team_page') );      $i=0;          if ( $team->have_posts() ) {     while ( $team->have_posts() ) {          $team->the_post();          $team_id = $team->posts[$i]->ID;             $args = array(            'post_type' => 'match_report',            'post_status' => 'publish',            'meta_query' => array(              'relation' => 'OR',                   array(                      'key' => 'report_home-select',                      'value' => $team_id,                      'compare' => '=',                   ),                   array(                      'key' => 'report_away-select',                      'value' => $team_id,                      'compare' => '='                   )            ),             array(                 'key' => 'report_type',                 'value' => 'cup',                 'compare' => '='                  ),                                            );              $reports_played = new WP_Query($args);          $played = $reports_played->found_posts;         $i++;                  $args = array(            'post_type' => 'match_report',            'post_status' => 'publish',            'meta_query' => array(                array(                      'key' => 'report_home-select',                      'value' => $team_id,                      'compare' => '=',                ),            )                                            );              $hometeams = new WP_Query($args);         $team_is_home =  $hometeams->found_posts;             $args = array(            'post_type' => 'match_report',            'post_status' => 'publish',            'meta_query' => array(                array(                      'key' => 'report_away-select',                      'value' => $team_id,                      'compare' => '=',                ),            )                                            );              $awayteams = new WP_Query($args);                $team_is_away =  $awayteams->found_posts;          $temp_query = clone $wp_query;          if ( $hometeams->have_posts() ) {     while ( $hometeams->have_posts() ) {     $hometeams->the_post();     $scorehome = get_post_meta($post->ID, 'report_homescore', true);     }     } else {     $scorehome = 0;     }     wp_reset_postdata();     $wp_query = clone $temp_query; ?>
                                  <?php the_title(); ?>	                                  <?php echo $played;?>	                                                    9	                                  0	                                  2	                                  	                                  10	                                  33	                                  27
           <?php } ?>


Woocommerce add product variations block to my custom template

I'm playing around with woocommerce and I followed their instructions to do my own single-product template by copying to my theme's folder within the structure they recommend. So the thing is that the product page is working pretty well, but I'm facing some issues when is a variable product involved. My question is, are there any hook or something to display the variations associated with that specific product, something like when you add product's attributes manually like:               <?php echo apply_filters('single_add_to_cart_text', __( 'ADD TO MY BASKET', 'woocommerce' ), $product->product_type); ?>      That will add the single add to cart button individually, is there a similar code to display the product variations? Thanks a lot.


IPN for s2member

I want to integrate a local gateway. So planned to receive the response from local gateway to ipnhandler.php (for example) and then ipnhandler will sent post data to s2m via cURL. I need to know how the parameters should be. I've tried with a demo form but nothing was happened, no log, no message. So need your help. Form was               <form action="http://example.com/s2m/?s2member_paypal_notify=1&s2member_paypal_proxy=LocalGate&s2member_paypal_proxy_verification=905e5a3c73480046f4354946788b8ea1" method="POST">     <input type="hidden" name="first_name" value="Tanmoy" />     <input type="hidden" name="last_name" value="SK" />     <input type="hidden" name="custom" value="example.com" />     <input type="hidden" name="item_number" value="1:hello" />     <input type="hidden" name="txn_type" value="w4324rewq423" />     <input type="hidden" name="payer_email" value="1234@mail.com" />     <input type="hidden" name="period" value="30" />     <input type="hidden" name="mc_amount" value="30" />     <input type="hidden" name="recurring" value="1" />     <input type="submit">     </form>      They have a documentation on it also, can be found here.


Shortcode for Twitter Bootstrap Collapse

Im trying to create shortcodes for Twitter Bootstrap Collapse. This is what Im trying to achieve:               [collapse-group]       [collapse accordion="#accordionOne" title="my heading1"]some text[/collapse]       [collapse accordion="#accordionTwo" title="my heading2"]some more text[/collapse]     [/collapse-group]      So for example 'my heading1' would show and 'some more text' would be collapsible. Here is the code Im using, the last shortcode [collapse] is causing a server error on my local install.               function collapse-group( $atts, $content = null ) {       return '
"'.$content.'"
';       }       add_shortcode("collapse-group", "collapse-group");          function collapse($atts, $content = null) {           extract(shortcode_atts(array(           'accordion' => '',         'title' => ''           ), $atts));            return '

             "'.$title.'"

"'.$content.'"

';       }            add_shortcode("collapse", "collapse");      I know there are plugins but I'd prefer to have this custom made for this specific instance so I don't have to rely on a plugin with all sorts of other bloat. Im hoping an answer to this question would be useful to others.


How can I list posts in an archive but grouped by categories

In an archive of a term I want to list the posts but grouped by another taxonomy terms for example im in taxonomy archive "books" list all posts by a taxonomy term of author   * Author      * post     * post   * Author      * post     * post


Unable to rename permalink

I have a custom content type, `'Events'`. I'm unable to rename the slug of one event from `'2010-2'` to `'2010'`. There are 6 or 7 other entries of the same content type and they're all fine. Here's what I've done:   * Verified no items in the Trash (for every content type, just to be sure)   * Manually removed drafts, autosaves and revisions from the database   * Verified that no other existing piece of content has `2010` in its slug **EDIT** Worth noting that "`/events/2010`" actually redirects to "`/events/2010-2`"


Archive Page Isn't Showing Article Excerpts

I'm using the _tk theme (bootstrap + _s) and in the reading form I've set the Posts page to a static page because I'm using a static front page. I've also set it to show a summary for each article. The problem is that the page displays the full article, except for the featured image, and I can't find out how to correct it. I know it's using index.php and calling content.php which tests for is_archive to show the excerpt if it's an archive page. For some reason WordPress isn't classifying the page as an archive page. Inspecting the code shows no archive class on the body tag. I added an Archive widget and clicking a link from there displays an archive page correctly. I also added a conditional is_page to the if statement and get the same results. Please enlighten me.


Custom admin TinyMCE - order items

I would like to know, how can we order wordpress editor buttons? I want to add the "format/style" dropdown after the heading dropdown. ![enter image description here](http://i.stack.imgur.com/mx9hi.png) Here is my code:               function enable_style_dropdown($buttons) {         $buttons[] = 'styleselect';         return $buttons;     }     add_filter("mce_buttons_2", "enable_style_dropdown");               function myformatTinyMCE( $in ) {         $in['block_formats'] = 'Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6';         $style_formats = array (             array( 'title' => 'Testimonial content', 'block' => 'p', 'classes' => 'Testimonial' ),             array( 'title' => 'Testimonial description', 'block' => 'p', 'classes' => 'Job-description' ),               array( 'title' => 'Testimonial person', 'block' => 'p', 'classes' => 'author' ),         );         $in['style_formats'] = json_encode( $style_formats );         $in['style_formats_merge'] = false;         $in['wordpress_adv_hidden'] = false;         return $in;     }     add_filter( 'tiny_mce_before_init', 'myformatTinyMCE' );      Thanks


Trigger email send after custom post publish

I have a custom post type set up so that a user in the role of contributor can create a post, but an administrator has to approve the post and publish it. I'd like to hook into the event when the administrator publishes this post type and then send an email to all contributors that there has been a post. I tried a test email to myself hooking off of 'save_post' when publishing a post and it worked, but I got sent five emails. There's no loop in the function:               add_action( 'save_post', 'clr_test_email' );          function clr_test_email($post_id) {             mail("myemail@gmail.com","        ok hooked into save post","Testing save post trigger".$post_id,"From: crou@zzz.com\r\nContent-Type: text/plain;charset=utf-8");          }      So I'm not sure if 'save_post' is my best bet. There used to be a 'publish_post' hook, but according to the Codex it has been deprecated. Any thoughts?


Ajax loop in sidebar to load post titles/categories

I have a sidebar that displays the 20 latest posts, what I'd really like to do is _Ajaxify_ that loop so there's a `load more` button at the bottom. The problem is, it's a fairly complicated loop and getting WordPress to work properly with Ajax is not childs play. I'm fairly familiar with jQuery but I'm no expert when it comes to complicated server side stuff. I've been reading about Ajax and WordPress for days now and I can't get anything to work properly, or at all. I tried this: How can I fetch loop of post titles via AJAX? And it didn't work, gave me a server error. Here's my little loop.   Even if I could just see how to output the post titles, ignoring all the other stuff with an Ajax request I'm sure I could hack away at it from there.   I just can't get it to work, at all.
     <?php         $sidebar_query = new WP_Query(array(             'showposts' => 20         ) );     ?>          <?php while ($sidebar_query->have_posts()) : $sidebar_query->the_post(); ?>
         <?php if(has_post_thumbnail()) :?>
                 <?php the_post_thumbnail('sidethumb'); ?>
          <?php else :?>         <?php endif;?>             <a href="<?php the_permalink() ?>">                          <?php             $cat_names = wp_list_pluck( get_the_category(), 'cat_name');             echo wp_sprintf_l( '%l', $cat_names );         ?>
<?php the_title (); ?>
                              <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?>
          <?php endwhile; wp_reset_query(); ?>


Basics: adding template tag to display custom fields in the post

_I've just started learning so this might be a noob question_. > Displaying Custom Fields > > With a Custom Field added to the post, it's time to display your books and > mood to the world. To display the Custom Fields for each post, use the > the_meta() template tag. The tag must be put within The Loop in order to > work. **Many people add the_meta() template tag to the end of their post** > or in their Post Meta Data Section. - Custom Fields on Codex I think I'm misinterpreting the bold part but I tried to add the tag `<?php the_meta(); ?>` in my post and it's not showing up. Screenshot here.


change register url on wp-login page

I am just trying to change the url of "register" on wp default login page(domain.com/wp-login.php)   1. I want to change the url on register link.   2. when you are on domain.com/wp-login.php?action=register, I want to redirect to domain.com/register I have added redirect link. but it's not working.                RedirectMatch 301 /wp-login.php?action=register$ http://domain.com/register/$1      Am I missing something? I just want to use my register page (domain.com/register/)


Disqus comments only show up on newest post

I've setup Disqus comments on our company blog (link) By creating a comments.php file with:

           and on the single.php file               get_template_part( 'content', 'footer' );     if ( comments_open() || get_comments_number() ) {         comments_template();     }     $previous_post = get_adjacent_post( false, '', true );     $next_post     = get_adjacent_post( false, '', false );      but the comments box only displays on the newest post. I reached out to Disqus support but they haven't replied to me since the beginning of the week. I attempted to use the prepackaged Disqus plugin and it did not seem to work at all (didn't display comments anywhere) so that's why I went with the universal javascript version instead.


WordPress HTML Menu

I'm trying to get the menu on my WordPress site to append the class like so:

Home

         Subjects

A Subject

Another Subject

Something else here

Nav header

External link

Sign in to externalmemberssite.net

      But I end up with this:

                 Sample Page

      Then this is the PHP code to generate the menu:               $defaults = array(         'menu_class'        => 'nav navbar-nav navbar-right',         'items_wrap'        => '
%3$s
'         );          wp_nav_menu( $defaults );


Hook when category is added to post

I'm trying to do something when a category is added to post and saved. I thought that using the `save_post` hook would have registered when a category is added to a post, but it doesn't appear to. When I edit a post and do nothing but change the categories for the post, I don't get the `save_post` hook fired (editing the title, body, etc fires the `save_post` hook successfully). Is there another way to use `add_action`/`add_filter` to detect when a category is added to a post?


Get the author of the latest revision

I would like to display the author (username) of the **latest revision** of a post from inside the loop. I tried `get_the_author()`, which echoes the username and `$post->post_author()`, which returns the user_id, but both return the original post author and not the latest _revisor_.


Custom Post Type on Homepage - Studiopress Genesis Framework

I have used to below function to register a new 'guide' content type:               add_action( 'init', 'guide_post_type' );     function guide_post_type() {     register_post_type('guides',          array(               'label' => 'Guides',             'description' => '',             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'capability_type' => 'post',             'hierarchical' => false,             'rewrite' => array('slug' => 'guide'),             'query_var' => true,             'has_archive' => true,             'exclude_from_search' => false,             'supports' => array('title','editor','excerpt','comments','thumbnail','author',),             'labels' => array (                 'name' => 'Guides',                 'singular_name' => 'Guide',                 'menu_name' => 'Guides',                 'add_new' => 'Add Guide',                 'add_new_item' => 'Add New Guide',                 'edit' => 'Edit',                 'edit_item' => 'Edit Guide',                 'new_item' => 'New Guide',                 'view' => 'View Guide',                 'view_item' => 'View Guide',                 'search_items' => 'Search Guides',                 'not_found' => 'No Guides Found',                 'not_found_in_trash' => 'No Guides Found in Trash',                 'parent' => 'Parent Guide',                 ),         )      );     }      I want to display these posts on the homepage of my blog along with normal posts. To do that I have created a new `home.php` file with the below code:               remove_action( 'genesis_loop', 'genesis_do_loop' );     add_action( 'genesis_loop', 'custom_homepage_loop' );          function custom_homepage_loop() {     global $paged;     global $query_args;     $args = array(         'post_type' => array('post','guide')     );          genesis_custom_loop( wp_parse_args($query_args, $args) );     }          genesis();      However, I am still unable to see any guide post types on my homepage. Any suggestions?


Removing buttons from the editor

I have this nice little function to remove buttons from the tinyMCE editor in WordPress, so far I've been able to remove most of the ones I need to.               function custom_disable_mce_buttons( $opt ) {         $opt['theme_advanced_disable'] = 'justifyfull,forecolor,removeformat,justifycenter,justifyright,justifyleft,charmap,indent,outdent,undo, redo';         return $opt;     }     add_filter('tiny_mce_before_init', 'custom_disable_mce_buttons');         The button control list can be found here: http://www.tinymce.com/wiki.php/TinyMCE3x:Buttons/controls The problem is, there's a few more ones I'd like to remove, like the spellchecker and the 'insert more tag', but I can't find documentation anywhere of the codes/names for these buttons to remove them. Any got any info on this?


jQuery Ajax() doesn't work when the page is accessed as a WordPress template page

In one file (test_ajax.php) I have a which on change loads another page (registration_form_race_type.php) with a short message via jQuery Ajax(). It works fine when "test_ajax.php" is accessed via its absolute URL which is :               http://46.20.119.207/~asuntosf/wordpress_test/wp-content/themes/test_ajax/test_ajax.php      But amazingly enough, the Ajax functionality ceases to work if the exact same page "test_ajax.php" is accessed via its WordPress address which is :               http://46.20.119.207/~asuntosf/wordpress_test/?page_id=13      I insist these both URLs point to the same two PHP files. Here is the code of "test_ajax.php" :               <?php     /*     Template Name: Page Test Ajax 01     */     ?>     <html>     <head>         <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>         <script type="text/javascript">             jQuery(function () {                     jQuery('#event_id_from_list').change(function() {                            var event = jQuery("#event_id_from_list").val();                      var data = "event_id=" + event;                              jQuery.ajax({                         url: 'registration_form_race_type.php',                          type: 'GET',                         data: data,                         success: function(data){                              jQuery('#div_race_type').html(data);                          }                     });                          });             });         </script>     </head>     <body>         <select class='required' type="text" name="event_id_from_list" id="event_id_from_list" />             <option value='Paris'>Paris</option>             <option value='London'>London</option>             <option value='Rome'>Rome</option>         </select>            <div id='div_race_type' class='section'>                         <?php require_once('registration_form_race_type.php'); ?>                    </div>     </body>     <html>      And the code of the page called via Ajax, "registration_form_race_type.php" :               <?php if (isset($_GET['event_id'])) echo 'you selected '.$_GET['event_id']; ?>


the_time function inside HTML dom parser

I have recently bought a theme, where I want to modify some things. The theme makes use of shortcodes. One of these shortcodes is adding the most recent posts. In these most recent posts is the date not included. I want to add the date, but I found out that these shortcodes are in shortcodes.php, written in some kind of HTML DOM parser??? I tried to add some code, I found out how to make a div and span, but when I add the_time() in the code,it will show up outside of this div and span. I don't know how to fix it.               $html .= '
          '.the_time().'
';


WP Rewrite issue

I'm trying to build this structure: for single page:               www.example.com/london/restaurants/monrooe/      where:   * "london" is a query var   * "restaurants" is a category   * "monrooe" is the post name. How can I do it? That's code I have so far:               function setup_city_var($vars){            $vars[] = "city";       return $vars;     }               function create_custom_rewrite_rules() {            global $wp_rewrite;       $rewrite_tag = '%city%';            // Add the rewrite tokens       $wp_rewrite->add_rewrite_tag( $rewrite_tag, '(.+?)', 'city=' );            // Define the custom permalink structure       $rewrite_keywords_structure = $wp_rewrite->root . "$rewrite_tag/%pagename%";            // Generate the rewrite rules       $new_rule = $wp_rewrite->generate_rewrite_rules( $rewrite_keywords_structure );            $wp_rewrite->rules = $new_rule + $wp_rewrite->rules;            return $wp_rewrite->rules;     } // End create_custom_rewrite_rules()      It doesn't work, it's a 404 Any Ideas? Thanks


Static homepage duplicate issue

I already made a post on official wordpress forum,but hava no replay to my question. Also made a search in the forum here and in Google as well but couldn't find solution for my problem. I'm using CMS theme for my website foxcleaners.co.uk with static homepage. The problem is that i have to choose a post which the theme will use as a homepage.OK,i made a post for the homepage and set as noindex,nofollow,but Google has indexed this post!!Also can anyone tell me how Google found this post?There is no links to it.I don't have categories menu on sidebar..?The best solution will be if someone can tell me how to set a unique homepage (without to choose post or page).I love WP but this is huge problem for people like me who wants to use it as CMS system.


Disable custom taxonomy on admin bar

I created a custom taxonomy and i want to disable the taxonomy to show on the admin bar below my custom post type. How do i disable it?. The reason i want to disable is because the user is not allowed to add a category.


How to make post stick to its own div

A Wordpress theme has 4 boxes in front page. Each box has its own posts. please see the screenshot http://prntscr.com/1231qw I want to let the user edit the post using admin panel and when he save the post then post will again publish to its original box instead of another location which is usually happened. How can i make a post specific to its div? is there any way? Any advise please?


How to change pagination base from slash to query form?

Can this function...               function custom_pagination_base() {     global $wp_rewrite;     $wp_rewrite->pagination_base = 'p';     $wp_rewrite->flush_rules();     }     add_action( 'init', 'custom_pagination_base' );      ...be somehow used to change the from of the url from "page/2/" not to "p/2/" but to "?p=2"?


How to get URL param to shortcode?

I can't find solution for this ... URL: _www.foo.com/some_page/?name=John_ Page content: > Hi [Name]! Worpress still redirects back to _www.foo.com/some_page/_ I tried everything ... I need something like the following in _functions.php_               function name_shortcode() {         return $_GET['name'];     }     add_shortcode( 'Name', 'name_shortcode' );      And on another page: Click here _www.foo.com/some-page/?name=John_


How to load JS for specific screen size using wp_enqueue_script?

I need a option so that when I am adding some script using wp_enqueue_script it should load for specific screen size. Like when the screen size will be below 768px the script will not load. I am using something like this for now.....               if(!wp_is_mobile()){             wp_enqueue_style( 'wpm_animation_css', get_template_directory_uri() . '/assets/css/animation.css', array(), '1.1', false );             wp_enqueue_script( 'uikit.min', get_template_directory_uri() . '/assets/js/uikit.min.js', array( 'jquery' ), '2.4.0', true );         }      Any help will be really appreciated. Thanks Sabbir


Are there ways of logging in that bypass wp-login.php altogether?

I have a WP install that's been getting hammered the last couple days by brute force login attempts. The site has the Limit Login Attempts plug-in installed. And when I started getting frequent notifications about lockouts, I decided since I only access the `wp-login.php` file and the `wp-admin` from one place, to block all IPs but my own via `.htaccess`. I've tested the `.htaccess` block by removing my IP from the exception list, and it does indeed block access to wp-login.php. So it appears to work from that aspect. However, even with IPs blocked, Limit Login Attempts keeps reporting (frequent) lockouts from IPs. I thought this was curious, since with the `.htaccess` block in place, it seems as though it should be impossible to get to the `wp-login.php` script to begin with, let alone get so far as having an attempted login get processed by the plug-in. So I tried another experiment: While already logged into WP, I changed the name of `wp-login.php` to `wp-login.xyz` thus disabling the script from running entirely. Even with the login script completely disabled, I still got notices that login attempts are being made and IPs are being locked out. Then I thought perhaps someone's got an auth cookie. So I changed the salts. Still the attempts come. I've looked at the codex for help on the Authentication API, but most of the sources there are incomplete, and in any case I'm not finding how it might be possible to attempt a login other than via `wp-login.php`. So my question is: What, if any, other means of attempting a login are possible without the `wp-login.php` script? And how can any such alternate login routes be disabled? EDIT: .htaccess code (first lines of file): This is in the WP root directory (same location as `wp-login.php`.               <FilesMatch wp-login.php>     order deny,allow     Deny from all          # Allow from this IP address     allow from xx.xxx.xxx.xx  #My IP     </FilesMatch>          ErrorDocument 401 "Sorry. No logins here!"     ErrorDocument 403 "Sorry. No logins here!"


Hide username from users list

I've hidden the username column from users administration with the following code:               function modify_user_columns($column) {         $column = array(             "cb" => "<input type=\"checkbox\" />",             "username" => __('Username'),             "name" => __('Name'),             "email" => "E-mail",             "birthdate" => "Narozeniny",             "sleva_moto" => "Sleva moto"                   );         return $column;     }     add_filter('manage_users_columns','modify_user_columns');      The problem is I cannot enter details of any user now, as normally the user detatils are accessed when clicking on the username. Is there a way to add the link to detail page to the `Name` column?


Extract the last published post in wordpress (3.3)

How do I extract the last published post in Wordpress? I would be grateful if someone can just point out the relevant action hooks that I should check out. I have seen publish_post, edit_post, save_post, get_the_tags, sanitize_** functions in post.php but so far no success. I want to export the entire array of the last published post from the wordpress database. How do I do that? thanks.


Plugin fatal error

I'm trying to activate a plugin I made on a network site. I'm getting an error:               Plugin could not be activated because it triggered a fatal error.      I have the debug mode on and it outputs all errors into a debug.log, however nothing is given for this error. Is there another way to see what the error may be? The plugin registers a CPT with taxonomy. It was recently deactivated to test a few changes I made. Upon the reactivation it is failing. Something to note, the custom post type has 900 posts and 1400 taxonomy terms. Hopefully something comes to light without having to redo all that work for the posts.


How do i hide categories from menus which don't yet contain posts?

I would like to hide a large number of categories from both the primary and secondary menus which have already been create however don't as yet contain posts. Any PHP code i can use for this as there's a large number of categories.


Editing Category RSS Feeds

I have the following PHP code below that I would like to add to the category feed in WordPress.               <?php if(get_the_post_thumbnail()): ?>     <featured-item><?php echo wp_get_attachment_url(get_post_thumbnail_id($post->ID)); ?></featured-item>     <?php endif; ?>      I know that I can edit `feed-rss2.php` to add it into the general feed. But the same code isn't allowing me to add it to the category view of the same RSS feed. Where do I place this code for the generated RSS feed?


Custom post types ordering & hooks

I have   * `archive-member.php` copy/pasted from the `archive.php` which I use to output the list of all posts with custom post type `member`   * `taxonomy-meber_type.php` file copy/pasted from the `taxonomy_post_format.php` file to output the list of posts (eg.`members`) with taxonomy `member_type` (this is accessed via a menu using the permalinks to each taxonomy value & slug , eg. : `type_de_membre/membre`, `type_de_membre/membre-honoraire`, etc...) as per here. This works perfectly, but I would like to order this output by `member_lastname`, which is a custom field added using ACF, related to the memeber custom post type. I have adapted the hook in the codex to list all the relevant posts(members...), which seems to work fine for the pages where taxonomy is defined (eg. `membre/membre`) but not on the `archive-member.php` file listing all posts with `post-type="member"`, but can't make the one for listing alphabetically work at all, on whichever page: I have copied below the 2 hooks. I'm ok with PHP mysql queries, but a real newbie to fiddling with the hooks & generally with WP queries etc, so bear with me & thanks for your explanations. Both hooks as I adapted them:               add_filter('posts_orderby', 'member_alphabetical' );     add_filter('post_limits', 'member_limits' );          function member_alphabetical( $orderby )     {      /* global $gloss_category;*/     if( !is_admin() && is_post_type_archive('member_type') ){     /*  if( is_tax( 'member' )) {     */     // alphabetical order by custom field 'member_lastname'          return "member_lastname ASC";     /*  }     */       // not in glossary category, return default order by       return $orderby;     }      }          function member_limits( $limits )     {       /*global $gloss_category;*/          if( !is_admin() && is_tax('member_type') ){          // remove limits          return "";       }            // not in glossary category, return default limits       return $limits;     }      Thank you !


Enqueue Javascript Correctly for 3.5

I am trying to create tabs for admin settings page in wp, but I think I'm doing it wrong. The example below shows how I did it but I don't know how to change this to use it correctly with no conflict ie. $.               function my_plugin_load_js() {     wp_deregister_script('jquery');     wp_register_script('jquery', 'http://code.jquery.com/jquery-1.8.3.js');     wp_enqueue_script('jquery');          wp_deregister_script('jquery-ui-core');     wp_register_script('jquery-ui-core', 'http://code.jquery.com/ui/1.9.2/jquery-ui.js');     wp_enqueue_script('jquery-ui-core');     }     add_action('admin_enqueue_scripts', 'my_plugin_load_js' );          function mypluginjs() {     echo '<script type="text/javascript">     jQuery(function() {        jQuery( "#tabs" ).tabs();     });     </script>';     }     add_action( 'admin_print_scripts', 'mypluginjs' );


WordPress navigation only shows post of page one, even if on page two

Got a little problem hopefully I can get some help. I noticed that after I added a "sort post by" code to my index my navigation broke. If you click on page two you still get the contents of page one. I did a little digging and found the problem, only thing is I not sure how to fix it. Here is the loop from my index page. Now I need to exclude a selected category from the main loop, that's the first part. The second part is if I add $orderby to the query_posts string (second to the last line) then the navigation breaks. If I remove it then it works. I tried to have to query_posts strings, but that didn't work out. Anyway to make this work or do I have to give up one for the other?                       <?php         $featcat = get_option($shortname.'_featured_category');               $category_id = get_cat_ID($featcat);     $paged = (get_query_var('paged'))?get_query_var('paged'):1;     $q = array();     $q['category__not_in'] = array($category_id);     $q['paged'] = $paged;     query_posts($q.$orderby);     if (have_posts()) : while (have_posts()) : the_post(); ?>


Using GROUP CONCAT in my-sql query with wp_usermeta table

I have a query that is meant to return user details from Wordpress tables. It would be fine if I was just SELECTing column names that I want, but within Wordpress there is a usermeta table which has 2 columns - 1 called metakey and 1 called meta value. I want to get certain bits of user info from meta keys such as first_name and last_name, but they are all within the same column - metavalue. Here is what I have:                   $allquery="SELECT $comma_separated, wp_usermeta.meta_value, wp_usermeta.meta_key,      //comma_seperated are a list of values to search for seperate by ",". this is name, email         GROUP_CONCAT(             wp_usermeta.meta_value             ORDER BY wp_usermeta.meta_key         ) AS name         FROM wp_users         LEFT JOIN wp_usermeta         ON wp_users.ID = wp_usermeta.user_id         WHERE  (wp_usermeta.meta_key = 'first_name'             OR wp_usermeta.meta_key = 'last_name')             AND wp_users.user_login = '$spec_user'         GROUP BY wp_users.ID";              $names = array();         $allresult=mysql_query($allquery) or die(mysql_error());               while($rows=mysql_fetch_array($allresult)){                    $names[] = $rows['name']; //name is from the group_concat in query             $emails[] = $rows['user_email'];          }      The problem is, this just returns a single row. I think it could be something to do with the line: AND wp_users.user_login = '$spec_user' Where $spec_user is a user entered value. What I want ideally is all rows returned where the user_login column equals what the user has entered. Not just from that table, but from the usermeta table.


Exclude the first 'n' number of posts of a tag from home page?

**Use case (example):** Using a separate, custom query my website's home page shows 5 featured posts, tagged 'Highlights (highlights)', followed by the latest posts, from the main query. I don't want the 5 featured posts, i.e. the first 5 posts tagged 'highlights', to appear among the latest posts. To put it another way, the latest posts should include all the latest posts, but in doing so, if it finds a post is tagged 'highlights' and is among the first 5, it should be excluded. All this, without breaking the pagination. How do I do this? * * * I have faint idea as to how I can do this:               function itsme_filtered_latest_posts( $query ) {              if( $query->is_home() && $query->is_main_query() ) {                  $query->set( ... );                  $query->set( 'offset', ... );              }          }     add_action( 'pre_get_posts', 'itsme_filtered_latest_posts' );      Like I said, I only have a faint idea, which is as good as having none.


Does Wordpress perform better with curl installed?

Wordpress doesn't require curl but it seems to use it if it's available (see line 295). I'm guessing HTTP requests will perform better using curl or Wordpress wouldn't even try to use it. Is this true? And if so, what evidence (scientific or intelligent guess) is there that this is true?


Ajax custom search not functioning as expected

I have a custom search I have created that is handled by an ajax call. It functions correctly for the admin but not for non-admin, but logged in, users. Admin will get the expected results returned. A logged in user that is NOT admin will get an ajax error and never even reach the memberSearchAjax function that is added with `add_action( 'wp_ajax_memberSearchAjax', 'memberSearchAjax' );` It's like when the ajax request attempts to hit `admin-ajax.php` it fails in some manner, but only if the logged in user is NOT admin. **My question... why might this Ajax request only work for Admin and not for other logged in users?** Some code... I enqueue and localize my custom script:               function memberSearch_scripts() {         wp_enqueue_script( 'memberSearch', get_stylesheet_directory_uri() . '/js/memberSearch.js', array( 'jquery' ) );         wp_localize_script( 'memberSearch', 'memberSearchObject', array(                 'ajaxurl' => admin_url( 'admin-ajax.php' ) )         );     }          //add_action( 'wp_enqueue_scripts', 'memberSearch_scripts' );     add_action( 'init', 'memberSearch_scripts' );      Then a fairly complex function named memberSearchAjax handles the search. I use add_action on this like so:               add_action( 'wp_ajax_memberSearchAjax', 'memberSearchAjax' );     add_action( 'wp_ajax_nopriv_memberSearchAjax', 'memberSearchAjax' ); <-- added this to see if it would help... doesn't      My javascript ajax looks like this:               $('#searchMembersForm').on('submit', function (e) {                 e.preventDefault();                 $('.searchMembersLetter').removeClass('active');                 var spinner = '

';                 $('#memberSearchResults').html(spinner);                 $.ajax({                     type: 'POST',                     dataType: 'json',                     url: memberSearchObject.ajaxurl,                     data: {                         'action': 'memberSearchAjax',                         'firstName': $('#firstName').val(),                         'security': $('#security').val(),                         'datasource': 1                     },                     error:function(jqXHR, textStatus, errorThrown){                         console.log(textStatus);                         console.log(errorThrown);                         console.log(jqXHR);                         $('#memberSearchResults').html('
There was an error with your request. It is:
' + errorThrown.message + '
');                     },                     success: process                 });             });      The success function, named "process" is quite complex so I'm not including it but non-admin users never reach it anyway.


Unable to add custom fields in custom taxonomy meta box in wordpress-3.5.2. I have checked solution in various blogs but Unable to solved this problem. I am using wordpress-3.5.2 What I am trying is :-               // A callback function to add a custom field to our "adtag" taxonomy     add_action( 'adtag_edit_form_fields', 'adtag_callback_function', 10, 2);          // A callback function to save our extra taxonomy field(s)      add_action( 'edited_adtag', 'save_taxonomy_custom_fields', 10, 2 );      I have tried solution from below link:- http://www.codehooligans.com/2010/07/07/custom-meta-for-new-taxonomies-in- wordpress-3-0/ http://sabramedia.com/blog/how-to-add-custom-fields-to-custom- taxonomies http://www.wpbeginner.com/wp-tutorials/how-to-add-additional-custom-meta- fields-to-custom-taxonomies/ http://shibashake.com/wordpress-theme/add-term-or-taxonomy-meta-data Please refer image where I need to add custom fields:- ![enter image description here](http://i.stack.imgur.com/mp61K.png)


Query sql for truncate post_content in wp_posts table

Hello all i need remove all info in Wordpress posts content and i'ld like do it from phpmyadmin with a query. I need remove only the text and images from all posts content but not the entire post, so i need know the sql query for do it, please someone can help me? Stew


Is there any fundamental difference in developing a wordpress multi-network site?

I would really like to know: Is there any fundamental difference in developing a multi-network site as opposed to a normal wordpress site? More Specifically:   1. Is the wordpress plugin development process the same?   2. Is theming the same? Can I use common AND separate stylesheets?   3. Will my old WP queries continue to work the same across the site network?   4. Can I expect popular wordpress plugins for taxonomies, custom fields and custom posts to work seamlessly across the network?   5. Can I create custom post types that are unique to each network? I am completely new to multisite but am totally game with the single wordpress install. Would really appreciate guidance from this community.


How to hook wp_list_pages?

How can I hook the wp_list_pages function so that it reads a value of a custom field and displays it instead of displaying the page title?


Google Map Integration

I want to create a Interactive google map as per http://www.rightmove.co.uk/property-for- sale/map.html?locationIdentifier=REGION%5E93932 .. I just wanna ask if I can do that using wordpress plugin, or can I have that kind of fucntionality even without using wordpress plugin? but how?.. here are the details.. any tip please.. do I have to do to manually or there is an easy way for me to be able to do that.. please help me :)


Not Getting Sidebar

The sidebar I'm using uses an if else statement. No matter what I do it always displays the else default sidebar. They seem to be registered, as they show up in the admin widgets section. I can can add widgets to them, but they do not show up in the page. Only the default sidebar. This is the sidebar template                                <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>

Search
                         <?php get_search_form(); ?>

Categories

                             <?php wp_list_categories('title_li='); ?>

Archives

                             <?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>

Meta

                             <?php wp_register(); ?>
<?php wp_loginout(); ?>
                             <?php wp_meta(); ?>

                 <?php endif; ?>                       this is what calls it                  <?php get_header(); ?>
         <?php get_sidebar(); ?>
             <?php if (have_posts()) : while (have_posts()) : the_post(); ?>             <article id="post-<?php the_ID(); ?>" class="post postbrdr" role="article">
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>
                          Published <time datetime="<?php echo the_time('Y-m-j'); ?>"><?php echo the_time(get_option('date_format')); ?></time> by <?php the_author_posts_link(); ?>.     Filed under <?php the_category(', '); ?>. Total of <a href="<?php comments_link(); ?> "><?php comments_number( 'no comments', '1 comment', '% comments' ); ?> in the discussion.<?php edit_post_link('Admin Edit', ' ', '.'); ?>
                     <?php the_content(); ?>

             <?php endwhile; ?>

                     <?php previous_posts_link( "« Older Entries"); ?>

                     <?php next_posts_link( "Newer Entries »"); ?>

             <?php else : ?>

Whoops! Looks like we can't find this post.

It seems like this post is missing somewhere. Double-check the URL or try navigating back via the website menu links.

             <?php endif; ?>

          <?php get_sidebar( 'responsive' ); ?>     <?php get_footer(); ?>      and here is responsive.php                            <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?>

Blog Categories

     <?php wp_list_categories('title_li='); ?>

Post Archives

     <?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>

                   <?php endif; ?>              >      and this is the registration               * Setting up custom sidebars      *      */     if(function_exists('register_sidebar')) {         register_sidebar(array(             'name' => 'Main Sidebar',             'id' => 'main',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
'         ));              register_sidebar(array(             'name' => 'Responsive Sidebar',             'id' => 'responsive',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
'         ));


"Reversable" and "Re-useable" Subcategories (or other taxonomic structure)

Hope you can help a WP newbie :) It is my understanding (and please correct me if I'm wrong!) that I cannot use the same subcategory slug in multiple parent categories, i.e. this structure is impossible with WP's category functionality: > >        example.com/design/exotic/my-post/ >        example.com/travel/exotic/another-post/ >   My question is a two-parter:   1. Are there any plugins or code I can use to coax WP into structuring URLs this way?   2. Is there a way to tweak the category archive page template to generate `example.com/exotic/`, which would include posts from `/design/exotic/` and `/travel/exotic` If this is way more trouble than it is worth, please let me know. If so, I'm willing to sacrifice the subcategory in the URL structure. #2 is the most important to me: being able to have a `mysite.com/exotic/` page that draws from multiple categories. Thanks!


Calling setup_postdata() causes "Call to undefined function get_userdata()" error?

The exact error is: > Call to undefined function `get_userdata()` in /wp-includes/query.php on > line 3567 I am using `get_posts()` in my plugin, which in turn uses `setup_postdata()` wherein `get_userdata()` is executed. I have no clue what's going on. I looked at `query.php` and it looks like `get_userdata()` is a global function, it shouldn't have any problem accessing it right? **MORE DETAIL** : My plugin is in a class form. This is just the basic structure. There are multiple functions in the actual code actually. Please take note of the `get_posts()` function where the post query occurs. If I remove it, the error won't show up.               class myPlugin() {        var $post_type = '';             function __construct($post_vars = array()){            if ($post_vars) $this->post_type = $post_vars['post_type']            $this->get_posts();        }             function get_posts() {            $args = array('numberposts' => -1, 'post_type' = $this->post->type, 'post_status' => 'publish');            $myposts = get_posts( $args );            foreach( $myposts as $post ) : setup_postdata($post);                print_r($post->ID);            endforeach;        }     }          return new myPlugin($_POST);      If I place the query in functions.php(and maybe outside the class or function scope which I have not tried), it works. That's my workaround for now, but I'd like to integrate it into my plugin.