title: Wordpress Search Filter Only for Page with Child of Child of Child of Child of Child

text: after browsing question from this site I found the workaround for this:               function SearchFilter($query) {         if ($query->is_search) {             global $post;             $query->set( 'post_parent', 21 );         }         return $query;     }     add_filter('pre_get_posts','SearchFilter');      When I do this, its only search child of parent 21 not child of child of parent 21. Also, query_vars only accept single value for post_parent. any solution for this is highly appreciated. thanks


title: How can I show different image links for different languages with qTranslate?

text: I have a set of links, each with an image - how can I show different links depending on the language selected (using qTranslate) - the images have text on them.. At the moment I show these links using the rotating links widget. Are there any plugins to help with this? or do I need to resort to PHP?


title: Customizing wordpress default widgets?

text: Is there anyway to customize the default WordPress widgets or do i need to create my own? For example, I want my recent post widgets to display date aswell. Thanks in advance! /Richard


title: Remove "Next Post" in nav_menu

text: I am creating my custom navigation menu with background-images. The menu items have a title from the Page, and that title is displayed above my background image, which is not what I want because the image itself already contains the link text.               /* menu items */     function nav_menu_items($classes, $item) {          $classes[] = "item-". $item->attr_title;           return $classes;     }      add_filter('nav_menu_css_class', 'nav_menu_items', 10,2);          .item-myitem a {     background: url(someimage);     text-decoration: none;     width: 20px;     }      However in the HTML it is displayed as (background-image is OK)               Next Post      How do I remove that "Next Post"?


title: Why this plugin doesn't work with media upload page?

text: I found this plugin very useful ajaxed-status It was created for post and page, and I want to apply it on media library. so I commented out the line `if (is_admin() /*&& ($pagenow=='edit.php' )*/)` and added this:               add_filter ( "manage_upload_columns", array ($this, 'add_new_columns' ) );     add_action ( "manage_media_custom_column", array ($this, 'manage_columns' ), 0, 2 );      Then, I got the status column on Media Library list page, and I can click the status to make it change to new status. But, the change can't be saved. From Firebug, I can see the ajax response is correct. I hope the original author, @Bainternet , or other people, may help figure this out. * * * **update** I tried update_post_meta to save the $status as meta. It works. Just can't save it as post_status by wp_update_post.


title: "Warning: call_user_func_array() [function.call-user-func-array]:" above comments form

text: I've been struggling with a warning message above the comments field on a site I'm building for a friend and I'd be very grateful if you're able to help. I've asked on the Wordpress Codex, but unfortunately there's been no response. Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'tl_spam_free_wordpress_comments_form' was given in /home/euanmitc/public_html/wp-includes/plugin.php on line 405 I've attempted to comment out the offending line in the plugin.php I have also deactivate all plugins with no success. You can see an example here: http://euanmitchell.com.au/2012/05/future- education/ The site uses a Thesis theme. Please let me know if you have an ideas for possible solutions. Best regards, Les Thomas


title: If I backup my wordpress blog, how can I back-up all the external images I've embedded?

text: As in - some of the images I've uploaded - like the ones at http://astroclimatology.wordpress.com/2011/11/02/interesting-dif-between- surface-temperature-and-p850-temperature/ - use images from a webpage that won't be here a year from now - as I'm leaving the school in a year.


title: How to add category exclusion to rss feed

text: I'm trying to exclude certain categories from the mydomain.com/feed Researching online I came across this code:               <a href="<?php bloginfo('url'); ?>/feed?cat=-3&cat=-12">Entries (RSS)      Now the question is should I create a function (if yes what function to create) so I can exclude categories without having anyone to redirect to custom feed URLs


title: How to set featured image in wp_insert_post

text: I have a register form with upload field and when the user registers i create a new post. I need to have the uploaded picture on the featured image of the post. I have see something like this but i don't understand all :s               $upload_dir = wp_upload_dir();     $image_data = file_get_contents($image_url);     $filename = basename($image_url);     if(wp_mkdir_p($upload_dir['path']))         $file = $upload_dir['path'] . '/' . $filename;     else         $file = $upload_dir['basedir'] . '/' . $filename;      file_put_contents($file, $image_data);          $wp_filetype = wp_check_filetype($filename, null );     $attachment = array(         'post_mime_type' => $wp_filetype['type'],         'post_title' => sanitize_file_name($filename),         'post_content' => '',         'post_status' => 'inherit'     );     $attach_id = wp_insert_attachment( $attachment, $file, $post_id );     require_once(ABSPATH . 'wp-admin/includes/image.php');     $attach_data = wp_generate_attachment_metadata( $attach_id, $file );     wp_update_attachment_metadata( $attach_id, $attach_data );          set_post_thumbnail( $post_id, $attach_id );      But how to get the image url because the image is not yet sent ...


title: wpdb select from using array as search parameters

text: Similar to how you can insert into an array using code such as               $wpdb->insert( $table_name, $inputs); //where inputs is an array      I want to do a sql select statement with code such as               $wpdb->get_results("SELECT * FROM " . $table_name . " WHERE " . $input);      where input could contain several search parameters. Is anything like this possible?


title: permissions access error

text: I'm getting this when saving a post after editing:               Forbidden          You don't have permission to access /wp-admin/post.php on this server.          Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.      All file permissions are 644 and directory permission are 755 and owner is myftpuser:myftpuser (this is my FTP user login). I've tried changing all permission to 755 but didn't work. Has anyone had this issue, is there a solution?


title: I am having problem sorting custom post type using WP_Query

text: I have a custom post type called personnel Look at this code:               $args = array( 'post_type' => 'personnel',                     'posts_per_page' => -1,                     );     $personnel_query = new WP_Query( $args );      Above works fine but I wanted the posts to be sorted alphabetically. I tried this:               $args = array( 'post_type' => 'personnel',                     'posts_per_page' => -1,                      'orderby' => 'title',                     'order' => 'ASC'                   );     $personnel_query = new WP_Query( $args );      But it doesn't have any effect on the sorting. I tried both ASC and DESC for the order-attribute. What am I doing wrong?


title: Job of meta_key meta_value fields in database tables

text: I'm researching the structure of WordPress database and there is something that really get me confuesd. Could someone please explain, what is the _exact_ job of `meta_key` and `meta_value` fields in `wp_commentmeta`, `wp_postmeta`, `wp_usermeta` tables? What is the job of these tables anyway? I did read the Database Description in the Codex, but still don't get it.


title: Where does the code to add a lightbox effect go?

text: I am not a developer but am working on a Wordpress site for my church. It can be found in its "under construction" stage at Seminole Heights Baptist Church Test Site I installed the plugin for WidgetKit Lite for Wordpress It installed successfully On the slider of the church site, the first slider is a picture of me waving that reads "First Time? Watch our welcome video" that goes to a youtube page with no relevance. Its just there to test video. What I want to do is create an effect that pops out a box. I apparently cannot post more than one link until I have 10 reputation points but the site I wanted to reference is for Greenway Carpet I like how the background goes dark and the video box pops out becoming the focal point.


title: differences between behavior get_option vs get_site_option in multisite

text: I am converting a bunch of sites to multisite and I am confused about the behavior differences between get_option and get_site_option. It appears that get_site_option actually means "get_network_wide_option" and get_option means "get_option_for_this_site", and the same for the update versions. Given this, if a plugin wants to have discrete settings for each site, it needs to use get_option and update_option. On the other hand, if it wants option values to be constant across all sites, then use the get_site_option version. Is my understanding of this correct?


title: Alter any uploaded image BEFORE saving (apply blur or similar even on the original version)

text: I am looking for a way to add a blur effect or similiar to any saved image. I do not want to have the unaltered originals on my server. The reason is that I am sued for using a copyrighted image which simply was a youtube preview. So I hope if enough alteration, even of the original version, would help me to avoid sth. like this in the future. I have searched hours for this but to no avail. Basically i am looking for a simple functions.php script which deals with that. Thanks in advance


title: Adding multiple real estate properties to back end

text: Client has a property management site. He wants clients to signup and enter rental each property into the system, with photos as well. These properties entries will not be accessible to public, but only to the user himself and the PM "admins". I could create a custom content type, that would be pretty easy I suppose.   * How would I make them unpublished by default?    * How would I create Prop mgmt specific admins, who would be able edit listings as well, but not have access to any of the pages or posts or any other admin related things? Thanks for any assistance.


title: How do I get an external php page to load using javascript

text: There is a snippet of JavaScript code I would like to include in a WordPress page. What's happening is the code isn't loading properly and it's getting hung up somewhere in WordPress's native redirect commands. This is the code I was supplied (and which works on their site and on other non-WordPress domains):               <link href="http://www.othersite.com/thepage.php?uid=1234" type="text/css" rel="stylesheet" />           Link to OtherSite      If I look directly at the my page source with the code, it is pointing in the right direction. If I open my browser's javascript console for the exact same page, it shows the link has redirected itself back to my domain so instead of going to othersite.com/page.php it is actually trying to get to `mysite.com/page.php`. I have tried               Redirect 301 mysite.com/thepage.php othersite.com/thepage.php      I have also tried adding the following to my `functions.php` (which broke everything)               <?php      if (function_exists('myscript')) {     function myscript() {          if (is_page('ThePage')) {         wp_register_script('myscript', 'http://www.othersite.com/thepage.php?uid=1234'__FILE__);          wp_enqueue_script('myscript');     }     }     }     add_action('init', 'myscript');     ?>      Does anyone know how I can get this to work? EDIT @cole Honestly I have no idea why the `__ FILE__` is there. I know enough about this stuff to be a menace to myself but not really enough to create my own work. The PHP stuff is what I put together based on the tutorial The Ins and Outs of The Enqueue Script For WordPress Themes and Plugins. EDIT @morganestes I thought that was a little odd myself, but that's what they gave me. The CSS isn't intended to mess with anything in the othersite php, just the link-back to them at the bottom. I put your code into functions.php and while it didn't exactly break the site like my other attempts, it did have the unfortunate effect of being placed at the very top outside any of my theme elements. It also didn't fix the problem; wordpress is still changing the link from othersite.com to mysite.com. EDIT @helga The fundamental problem is that Wordpress is taking it upon itself to magically rewrite my outbound link to refer to a non-existent internal location.


title: Pretty URLs for Custom Post Type & Custom Taxonomy with Duplicate Slugs on WPML

text: I'm interested getting some help for a rather complex setup. I'm working on a publication and interested in creating a special subsection with a custom taxonomy. Think of this as an editorial subsection with different categories - travel, food, fashion, etc. I want to create a setup like this:   1. home.com/subsection (archive for all articles)   2. home.com/subsection/travel (archive for travel sub_category articles)   3. home.com/subsection/travel/post-name (the post)   4. BONUS home.com/subsection/travel/hotels/post-name (post in subcategory of heirarchical taxonomy) BONUS *numbered for later reference **The Setup So Far...** This is a multi-lingual site on WPML. I'm using a custom post type (subsection) and taxonomy (sub_category) to create the subsection because I want the articles to be searchable on the same blog, yet filterable by a custom taxonomy on archive pages (I don't want travel from the main site and the subsection to be on the same archive page). A custom taxonomy also keeps the division between the subsection's taxonomy and the main site clean. **Problems - duplicate slugs and ugly urls** However, this means that I have some new and some duplicate categories between the main site and this subsection. This has meant I've had to create new slugs such as travel-sub to make them distinct. So, instead of home.com/subsection/travel, I'd have home.com/subsection/travel-sub. Using Custom Post Type Permalinks I've been able to get 1 and 3 with the modified slug (travel-sub). However, the taxonomy archive is home.com/subsection/sub_category/travel-sub and not home.com/subsection/travel as I wanted to have it. I understand the basics of why wordpress does this. Slugs must be unique, otherwise home.com/subsection/travel with a duplicate travel category could refer to the travel category of the main site or the subsection. However, the context in the url string makes me think there is a way to make rewrite rules to route the request to wordpress as I've outlined. Effectively I'd want to have /subsection/travel parsed to a query for all subsection custom posts of sub_category equal to travel. Does anyone know a way that I can achieve the URL structure I outlined above? **UPDATE: Hacky Partial Solution** The best solution for getting the urls in 1, 2, and 3 comes from this response: Custom Taxonomy specific to a Custom Post type However, it doesn't help avoid running into duplicate slugs between the main site and subsection. Getting clean urls with duplicate slugs has a different solution that involves writing custom rewrite rules for every slug. As I alluded to in my question, I thought there would be a way to use rewrites to translate between the urls I want and the querystring wordpress needs. While I'm not satisfied, this process works. Code is mostly from http://someweblog.com/wordpress-custom-taxonomy-with-same-slug-as-custom-post- type/ This function (placed in functions.php) iterates though all custom taxonomies associated with custom posts types and generates a rewrite rule (commented // make rules). I modified the code to support duplicate slugs for the custom taxonomy by stripping "-sub" string from the custom taxonomy slug. So, the "travel-sub" slug for "Travel" in my custom taxonomy linked to the subsection becomes "travel" in the url, but remains "travel-sub" in the wordpress querystring. Finally these new rules are merged with the existing rules. Flush the rewrite rules by resaving your permalink structure and you should be good to go. However, this is not satisfying because functions like get_category_link won't return the pretty url structure, and without adding a 301 redirect, there will be two urls pointing to the same content. Additionally, it doesn't achieve the nested custom_post_type/tax_term/post_name structure I wanted from point 3 or the hierarchical structure.               function taxonomy_slug_rewrite($wp_rewrite) {         $rules = array();         // get all custom taxonomies         $taxonomies = get_taxonomies(array('_builtin' => false), 'objects');         // get all custom post types         $post_types = get_post_types(array('public' => true, '_builtin' => false), 'objects');              foreach ($post_types as $post_type) {             foreach ($taxonomies as $taxonomy) {                      // go through all post types which this taxonomy is assigned to                 foreach ($taxonomy->object_type as $object_type) {                          // check if taxonomy is registered for this custom type                     if ($object_type == $post_type->rewrite['slug']) {                              // get category objects                         $terms = get_categories(array('type' => $object_type, 'taxonomy' => $taxonomy->name, 'hide_empty' => 0));                              // make rules                         foreach ($terms as $term) {                             $rules[$object_type . '/' . str_replace('-sub', "", $term->slug) . '/?$'] = 'index.php?' . $term->taxonomy . '=' . $term->slug;                         }                     }                 }             }         }         // merge with global rules         $wp_rewrite->rules = $rules + $wp_rewrite->rules;     }     add_filter('generate_rewrite_rules', 'taxonomy_slug_rewrite');


title: how a query can use local parameters in plugin function?

text: I've wanted to add a custom post type, so i've done a plugin to put on/off this post type. i have widgets inside the plugin in order to print posts with this custom type, that call more or less a "getter" function :               function get_vouchers($new_args = array())     {         $type = 'voucher';         $args=array(           'post_type' => $type,           'post_status' => 'publish',           'posts_per_page' => -1,           'ignore_sticky_posts'=> 1         );         $args = array_merge($args, $new_args);         $my_query = new WP_Query($args);              $posts = $my_query->get_posts();              return $posts;     }      I thought as the wp query were inside my function (local scope), it would use this function parameters (especially the post type). It is not the case. For some pages, the widget calls this function and list all posts that have voucher post type, but on some other pages, the widget lists all posts (affected by pre_post_update hook). How can i do in order that my get_posts only use the given post type ? thanks,


title: Displaying values from related field - if empty shows current post type's link and title

text: I'm working with custom post types. In the post type awards I have a relationship field that links each award to a post from the post type project. I'm using the following code to return the values from this field - it should not return anything if $work_value is empty:               <?php      $work_value = get_post_meta($post->ID, 'work', false );     // check if the custom field has a value     if( ! empty( $work_value ) ) {         foreach ( $work_value as $work ) {              //get id for related post and put in ID             $id = $work[ 'ID' ];             //show the related post name as link             echo 'for '.get_the_title( $id ).' ';         } //end of foreach     } //endif ! empty ( $work_value )     ?>      However, if the field is empty (and I checked, it really is empty) it outputs the permalink and title of the current post (from post type awards). How can I solve this? Thanks!


title: How to echo the_excerpt without the P tag wrapper?

text:
In the code snippet below, I trying to get the_excerpt to be written out without tags. However, the source formatting shows that the_excerpt is always wrapped in P tags. How can I pull the excerpt without tags?               foreach($myrecentposts as  $idxrecent=>$post)      { ?>
         <a href="<?php the_permalink(); ?>"><?php the_title(); ?>         <?php echo strip_tags(substr( the_excerpt(), 0, 75 ))."..." ?>
<?php }         echo "

";}


title: Rewrite Question

text: I'm having troubles with creating my rewrite. I've been searching here (and other sites) for an example, but so far, no luck. My testing site is:               ../?attachment_id=3027&attachment_category=yosemite      I would like it to display this:               ../portfolio/yosemite/3027      or even these:               ../portfolio/3027/yosemite/          ../3027/yosemite/      I tried to add this to my `.htaccess`:               RewriteRule ^([^/]*)/([^/]*)/$ /?attachment_id=$1&attachment_category=$2 [L]      but obviously that didn't work. Any ideas would be appreciated as I continue to find an answer. **Edit #1** Tried this, but no luck.               add_filter( 'query_vars', 'my_query_vars' );     function my_query_vars( $query_vars ) {         array_push($query_vars, 'attachment_id', 'attachment_category');         return $query_vars;     }          add_filter( 'rewrite_rules_array', 'my_rewrite_rules_array' );     function my_rewrite_rules_array( $rules ) {         $my_rules = array();         $my_rules['portfolio/(\d+)/(\d+)/?$'] = 'index.php?attachment_id=$matches[1]&attachment_category=$matches[2]';             return $my_rules + $rules;         }          add_action( 'wp_loaded', 'my_flush_rules' );     function my_flush_rules() {     if (!$rules = get_option('rewrite_rules'))         $rules = array();          if (!isset($rules['portfolio/(\d+)/(\d+)/?$'])) {         global $wp_rewrite;         $wp_rewrite->flush_rules();        }     }


title: How to shorten code with function?

text:
Now on the front page, in the part with post excerptions I have such a code:

     <?php      $piwa = get_posts(      array(         'posts_per_page' => 2,         'cat'  => 81,         'post__not_in'   => $news_ids,     'offset' => 1     )     );     foreach ( $piwa as $post ) {     setup_postdata( $post );     ?>
<a href='<?php the_permalink(); ?>' class="subtytulyWiad"><?php the_title();   ?>
         It's used to avoid double posts, because in other place i show the newest posts from mostly all categories. I'd like to shorten this code, because i repeat it some times (in div class wiadPodtyt). The problem is this function is changed with such variables like number of posts (posts_per_page) and category id (cat). How to write it corectly? ## Update In response to @totels, I tried this:               function print_alko($allpost=8, $postpage=1, $postcat=81)     {     $news = get_posts(      array(          'posts_per_page' => $allpost,          'cat' => -88         )     );     // Get an array with just the IDs of the posts in the $fruit array     $news_ids = wp_list_pluck( $news, 'ID' );      //'post__not_in'   => $news_ids powinno by? po cat=>...     $piwo = get_posts(      array(         'posts_per_page' => $postpage,         'cat'  => $postcat,         'post__not_in'   => $news_ids     )     );     foreach ( $piwo as $post ) {     setup_postdata( $post );          echo '
';     the_post_thumbnail();     echo '
';     echo '

';     echo '
';     echo "'.the_title().'

';     }            echo '

';     $piwa = get_posts(      array(         'posts_per_page' => 2,         'cat'  => $postcat,         'post__not_in'   => $news_ids,     'offset' => 1     )     );     foreach ( $piwa as $post ) {     setup_postdata( $post );     echo "
';     the_title();      echo '
';     }     wp_reset_query();     echo '

';     //koniec fcji print_alko     }      and the result is only 1 last news, graphically corect, but wrong content. Something is wrong with the wp_query - it makes wrong query.


title: Rewrites rules disappear after a while

text: **My Plugin** I implemented a small plugin to be able to show events with a specific custom field in a special order. To have some nice permalinks I also used the add_rewrite_rule function to add those rules. Here is the important part of my plugin:               // Add rewrite rule for event archives on activation     function event_archive_activate() {         add_rewrite_rule( '^(januar|februar|maerz|april|mai|juni|juli|august|september|oktober|november|dezember)([0-9]+)', 'index.php?pagename=event_archive&event_month=$matches[1]&event_year=$matches[2]', 'top' );         flush_rewrite_rules();     }     register_activation_hook( __FILE__, 'event_archive_activate' );          // Remove rewrite rule for event archives     function event_archive_deactivate() {         flush_rewrite_rules();      }     register_deactivation_hook( __FILE__, 'event_archive_deactivate' );          // Register the custom query var so WP recognizes it     function event_archive_add_query_vars( $vars ) {         $vars[] = 'event_month';         $vars[] = 'event_year';         return $vars;     }     add_filter( 'query_vars', 'event_archive_add_query_vars' );      **The problem** So I upload this plugin, actitave it and the rule is successfully written to the options table. Everything is working just fine and all the permalinks shows the correct pages. But after a while, the rewrite rule disappears from the rewrite rules in the options table. I searched for another call of the flush_rewrite_rules() function my WordPress directory, but only ma plugin and the core files are using it. I have no idea where and when the rule is deleted from the options table and how to prevent it in the future. My only solution so far is to deactivate the plugin and reactivate it, to have the rules saved to the options table again. **Solution**               // Flush added rewrite rules on activation     function event_archive_activate() {         event_archive_set_rewrite_rules();         flush_rewrite_rules();     }     register_activation_hook( __FILE__, 'event_archive_activate' );          // Add rewrite rule for event archive on init     function event_archive_set_rewrite_rules() {         add_rewrite_rule( '^(januar|februar|maerz|april|mai|juni|juli|august|september|oktober|november|dezember)([0-9]+)', 'index.php?pagename=event_archive&event_month=$matches[1]&event_year=$matches[2]', 'top' );     }     add_filter( 'init', 'event_archive_set_rewrite_rules' );


title: Superfish Menu Not Loading

text: Im currently trying to integrate a superfish menu into my wordpress theme, however it seems to be disappearing. I believe i have coded the js and the css correctly... can someone give me a pointer as to whats up? Or how to integrate into the functions.php _**FURTHER UPDATE_ *** Ok.... so i put the functions back into my header.php as below:                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">     <html xmlns="http://www.w3.org/1999/xhtml">     <head>     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />     <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?></title>     <meta name="keywords" content="Holiday, free CSS template, clean, neat, aqua, white, templatemo" />     <meta name="description" content="Holiday is a clean and neat free CSS template using aqua and white colors." />     <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" />      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js">     </script>     <script type="text/javascript" charset="utf-8"></script>     <?php function my_theme_scripts() {     wp_register_script( 'jquery' );     wp_enqueue_script( 'superfish', 'js/superfish.js', array( 'jquery' ) );     }         add_action('init', 'my_theme_scripts');     ?>          <script>           $(document).ready(function(){          $("ul.sf-menu").superfish();      });      </script>          <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'sf-menu', ) ); ?>


title: Rewrite Endpoints not Indexing with google

text: I don't know if anyone else has found this, but I've created some Endpoints for Authors to now have several pages, but Google isn't seeing any of them. It seems to see the parent url, but not any of the endpoints. Anyone had this issue or know if endpoints need something extra to be seen? Hopefully thats not too vague.


title: How to build a simple nav system of custom post type categories and its posts?

text:
I've been searching the web for a long time now, but couldn't find a solid simple anwser to, what seems to be a basic question: I have to output a list of custom post type categories and the posts of the first category on index page. Each category of the list should link to its page, showing its posts, and each post should go to the single page. I have a custom post type and its custom taxonomy registered and it seems to work. This is on functions.php:               <?php     function my_custom_post_empreendimento() {     $labels = array(         'name'               => _x( 'Empreendimentos', 'post type general name' ),         'singular_name'      => _x( 'Empreendimento', 'post type singular name' ),         'add_new'            => _x( 'Add New', 'book' ),         'add_new_item'       => __( 'Add New Empreendimento' ),         'edit_item'          => __( 'Edit Empreendimento' ),         'new_item'           => __( 'New Empreendimento' ),         'all_items'          => __( 'All Empreendimentos' ),         'view_item'          => __( 'View Empreendimento' ),         'search_items'       => __( 'Search Empreendimentos' ),         'not_found'          => __( 'No empreendimentos found' ),         'not_found_in_trash' => __( 'No empreendimentos found in the Trash' ),          'parent_item_colon'  => '',         'menu_name'          => 'Empreendimentos'     );     $args = array(         'labels'        => $labels,         'description'   => 'Holds our empreendimentos specific data',         'public'        => true,         'menu_position' => 5,         'supports'      => array( 'title', 'editor', 'thumbnail', 'custom-fields' ),         'has_archive'   => true,         'publicly_queryable' => true,         'show_ui' => true,         'can_export' => true     );     register_post_type( 'empreendimento', $args );       }     add_action( 'init', 'my_custom_post_empreendimento' );          function my_taxonomies_empreendimento() {     $labels = array(         'name'              => _x( 'Empreendimento Categories', 'taxonomy general    name' ),         'singular_name'     => _x( 'Empreendimento Category', 'taxonomy singular name' ),         'search_items'      => __( 'Search Empreendimento Categories' ),         'all_items'         => __( 'All Empreendimento Categories' ),         'parent_item'       => __( 'Parent Empreendimento Category' ),         'parent_item_colon' => __( 'Parent Empreendimento Category:' ),         'edit_item'         => __( 'Edit Empreendimento Category' ),          'update_item'       => __( 'Update Empreendimento Category' ),         'add_new_item'      => __( 'Add New Empreendimento Category' ),         'new_item_name'     => __( 'New Empreendimento Category' ),         'menu_name'         => __( 'Empreendimento Categories' )     );     $args = array(         'labels' => $labels,         'hierarchical' => true,         'label' => 'Empreendimentos',           'query_var' => true,           'rewrite' => array('slug' => 'empreendimentos')     );     register_taxonomy( 'empreendimento_category', 'empreendimento', $args );     }     add_action( 'init', 'my_taxonomies_empreendimento', 0 );     ?>      But the linking-to-which-template part isn't clear. This is on index.php:               <?php get_header(); ?>
     <?php $post_type = 'empreendimento';     $tax = 'empreendimento_category';     $tax_terms = get_terms($tax);     if ($tax_terms) {     foreach ($tax_terms  as $tax_term) {     $argslist=array(       'post_type' => $post_type,       '$tax' => $tax_term->slug,       'post_status' => 'publish'     );     $my_query = null;      $my_query = new WP_Query($argslist);      if( $my_query->have_posts() ) { ?>
       <?php echo '
slug, $tax).'">'.$tax_term->name.'
'; ?>
       <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>                  <?php endwhile;     }      wp_reset_query();        }     }     ?>

     <?php     $args = array(         'post_type' => 'empreendimento',         'tax_query' => array(             array(                 'taxonomy' => 'empreendimento_category',                 'field' => 'slug',                 'terms' => 'comerciais',                 'order' => 'ASC'             )         )     );?>

     <?php $empreendimentos = new WP_Query( $args );     if( $empreendimentos->have_posts() ) {         while( $empreendimentos->have_posts() ) {             $empreendimentos->the_post();             ?>

<?php the_title(); ?>

                 <?php $endereco = get_post_meta($post->ID, 'Endereço', true); ?>                 <?php echo $endereco; ?>

                 <?php $status = get_post_meta($post->ID, 'Status', true); ?>                 <?php echo $status; ?>

             <?php         }     }     else {         echo 'Oh ohm no empreendimentos!';     }     wp_reset_query();     ?>

     prev     next

     <?php get_footer(); ?>      Guess I don't need two queries to do this but I couldn't figure how to merge them. Than I have a page to which I associate a template with the same code above, but the links don't work. Any thoughts? Thank you in advance.


title: reCAPTCHA on page template without plugin

text: I have a template for contact us page which includes a small form with few text fields. I want to add Recaptcha to avoid spams. I already use WP-recaptch plugin which only works for default Registration and comment form. If follow these instructions from recaptcha docs, I get error the same class instance is being declared twice. Thats becoz recaptchalib.php is used by WP-repatcha already. This error will occur even if I use Contact 7 form plugin with recaptcha as every such plugin going to redeclare the same class. I include recaptchalib.php from WP_captcha plugin to my template file and it works well to show Recaptcha box, but it doesnt works at validation part - below code doesnt work:                   require_once ( WP_PLUGIN_DIR . '/wp-recaptcha/recaptchalib.php');         $privatekey = "my key";         if (empty($_POST['recaptcha_response_field']) || $_POST['recaptcha_response_field'] == '') {             $captchaErr = 'Please Enter recaptcha text';         $hasError = true;        }else{           $resp = recaptcha_check_answer ($privatekey,                                     $_SERVER["REMOTE_ADDR"],                                     $_POST["recaptcha_challenge_field"],                                     $_POST["recaptcha_response_field"]);                if (!$resp->is_valid) {             // What happens when the CAPTCHA was entered incorrectly - show error      Please can someone suggest a solution?


title: How to list Custom Taxonomy

text:
I have a WordPress taxonomy, and I was wondering if there's anyway to list the taxonomy like:

All

Image Slider

Youtube

Vimeo

Lightbox Photos

Lightbox Video

          Yup, there should not be any links, but Class filter in it data-filter with the term name. Is it possible? Thanks


title: How to add a handler for a button in plugin?

text:
I am working on my first plugin, and I am having some confusion. I am trying to figure out how to set a handler for a button on my plugin UI. Here is how the button is displayed:

      The confusion is how I am supposed to link that to an action. I know using Jquery I could do something like this:                $('#upload_image_button').click(function(e) {     //Do action here.     }      But what about php? If I had some php I wanted the button to execute, how would run it when the button is clicked?


title: Get current users post URL?

text: I've been trawling through forums but can't find a solution to this. If anyone can help, it would be greatly appreciated! I'm trying to display a link to current users author page (all users have author permissions). I'm using this at the moment:               <a href="<?php echo home_url() . '/author/' . get_the_author_meta( 'user_login', wp_get_current_user()->ID ); ?>" >My personal page      The problem is, the author link displays when there is no user logged in. How can I only display the author link to users that are logged in?


title: WP Login forms action URLs displayed as pretty URLs in browser (ex with Restore Password)

text: I would like to use the WP native login/register/restore password/.. functionality, but display pretty URLs instead of wp-login.php I've been looking at the core code and noticed that most login related forms have got hard coded action URL. For example, the restore password form has got the following action URL               <form name="resetpassform" id="resetpassform" action="<?php echo esc_url( site_url( 'wp-login.php?action=resetpass&key=' . urlencode( $_GET['key'] ) . '&login=' . urlencode( $_GET['login'] ), 'login_post' ) ); ?>" method="post">      So, when I click 'Reset Password' button the information will be submitted to wp-login.php file with the specified action, key and login query variables. If info doesn't pass validation then the form is redisplayed and the URL in the browser is the one that is specified in the form's action, so in this case it is `http://example.com/wp-login.php?action=resetpass&key=xyz&login=zyx`. I would like it to be `http://example.com/password- restore?action=resetpass&key=xyz&login=zyx` For this to work I've tried the following solution. However, I end up in the redirect loop. **Step 1.** The initial restore password URL is `http://example.com/wp- login.php?action=rp&key=xyz&login=zyx`. To make it pretty I've added a re- write rule:               add_action( 'init', 'pretty_login_urls' );     function pretty_login_urls() {         add_rewrite_rule( 'password-restore?([^/]+)/?$', "wp-login.php?$1", 'top' );     }      So, the initial URL to restore form is working. **Step 2.** However, when I submit an un-matching password, the form is redisplayed and URL is now `http://example.com/wp- login.php?action=resetpass&key=xyz&login=zyx`. Notice, that action has changed. Here is where I'm stack. I'd like to display that URL as pretty. I've tried the following solution trying to redirect `wp-login.php` to a pretty URL:               add_action( 'login_init', 'pretty_login_urls_form_action_fix' );     function pretty_login_urls_form_action_fix(){              $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';         if( in_array( $action, array('rp', 'resetpass') ) ){                  $url = home_url( '/password-restore?action='. $action .'&key=' . urlencode( $_GET['key'] ) . '&login=' . urlencode( $_GET['login'] ), 'login_post' );             wp_redirect( $url );             exit;         }     }      However, with this I end up in the redirect loop. Is there a way I can make the URLs display pretty in the browser address bar when the page is reached via a form's action URL. I'd really appreciate any tips. Many thanks, Dasha


title: All In One SEO Plugin - Category INDEX

text: Anyone know how to override noindex on certain categories? I only want a few of my categories to be index but the rest not, in the All in one SEO plugin I have a setting that says "Use noindex for Categories" What I was wondering if there was any way of overriding this on some categories but leave it in place for the majority of categories?


title: Spam injected in w3 total cache page cache

text: I'm trying to fix a site which has been injected with external spam. After inspection I found out that the external content (so far just html advertising different kinds of drugs, no scripts) was in the static pages created by w3 total cache. How can I find out what part is responsible for this? The obvious answer would be the w3 total cache plugin itself, but the pgcache is actually writeable by any part of wordpress so it might be any other plugin or even the WP core. I have searched the web for this problem but found nothing directly relevant. Of course wordpress is updated to the latest version available (3.0.2) as is every installed plugin. It does not depend on the theme as it happened with two different ones.


title: Proper way to create / manage gettext (.po, .pot) files?

text: So I'm trying to figure out how .po and .pot files work, seeing as this is what Wordpress seems to use. But I can't wrap my head around it. I get that a .pot file is a template file that indicates what .po files need to have translations for. What I don't get it how you're supposed to add entries to these files? I can find references on how to do it through the CLI but none of the GUI apps I've tried seem to support this. Is it common for the developer to just use the CLI to create these .pot files and then translators just provide the .po files? Am I missing something? Are there no tools used that take care of the whole process? It all looks good in theory but atm the whole process of managing translations just seems ridiculous, I'd expect an industry standard these days to be a bit more polished and user friendly. I should note, I don't have any problem understanding how to work it myself.. I'm just trying to figure out how everyone does this with non-programmers in their team. I can't possibly ask them to open up their terminal and execute a bash command.


title: recommended breadcrumb plugins with possibility for hiding "Home" link

text: I am using Breadcrumb NavXT plug-in in my pages but now I am facing a problem I need to hide the "Home" link in some pages. I can do that either by hiding it in CSS or by not creating it at all. in PHP If I want to use CSS - I dont have any indication for first link and its ">>" separator - there is no id or special class for it If I go for the PHP solution of not creating it at all in those cases - my problem is I can't send any parameters to the "bcn_display()" function Can I do it with my current plug-in or there is a better one? thanks!


title: Should the page cache be refreshed often?

text: In the w3 total cache there is the option to set the time until the cache is flushed (and thus, recreated on the next time a visitor comes by). My question is, assuming I've got a lot of content on my site that doesn't change almost ever, why would I not just set the caching to stay for days (instead of getting flushed every hour or so)? Is there a problem with that strategy?


title: Hook to get image filename when it is uploaded

text: I want to get the full local filename of an uploaded image so that I can copy it to a new directory and process it with my own image processing scripts. Which hooks/actions should I look into to achieve this? Thanks


title: Related terms - Terms that feature in post of current term

text: Not sure how hard this is but i'll try and explain it as simply as possible. I have a custom post type called: "Movies" with an taxonomy term called "Actor" For example purposes suppose were on the taxonomy page "Tom Cruise" which will output a load of posts(movies) that Tom has been in. What i'm trying to work out is how i can get a related terms(Actors) loop going so i can have this in the sidebar on the Actor terms page. So for example, Tom Cruise's taxonomy will be in the post(Movie) "Tropic Thunder", but so will "Ben Stiller" and others. So on the Tom Cruise term page under related actors i'd like it to display "Ben Stiller" with a link to his term page (and vise versa).


title: can I prevent WP users (even admin) from deleting custom categories?

text: I am writing a plugin where I have custom taxonomy (category). I want to prevent   * **any user** from    * **deleting some** of    * **custom categories**.  Is there any way how to do so. Let's say that category with id1-id10 nobody (admin included) can delete.


title: Wordpress Author Information show paragraph?

text: In back-end I'm update 3 paragraph in Author information. But it's showing frontend it's collapsed. And not showing paragraph. How to fix this problem. Ex: paragraph 1. paragraph 2. paragraph 3. In front-end showing paragraph 1. paragraph 2. paragraph 3. How to fix this?


title: Is it possible to display a DIV to not logged in users and then change it for users who are logged in?

text: Basically I'm putting together a magazine site that wants a strong focal point on the homepage for users who haven't signed up, if the user is logged in we need this content to show something else, is this possible? Basically I need a function to show X if the user is logged in and if not to show Y, the code will be placed in the header so whatever page the user has landed on it will encourage the viewer to register for an account.


title: Implications of porting WordPress MU-based blog to new server/domain

text: I've worked in WordPress quite extensively, but never did much porting. I've just ported a WordPress install from a .org domain on an old server to a .com domain on my own server (VPS). I did a search and replace as well as ran the neat functions.php file trick explained here: http://www.siteground.com/tutorials/wordpress/change-url.htm. It was only after the fact that I discovered that the original developer was using WordPress MU and things seem to be a tied to yet a third domain. (In real life the third domain forwards on the front end to the old .org.) Pretty much everything seems to be working with the exception that when a new user is signed up, the activation link does something funny: it lands on the appropriate .com wp-activate.php page, but once there, the links for View your site and Login are pointing at the third domain rather than the .com. I can't find anywhere in settings why this would be the case, but I'm guessing it has something to do with the activation key. Unfortunately that's an area I know absolutely zero about. The other thing is that in the Site Admin > Blogs listing ... the only blog is listed at the third domain. I think that means that despite all my changes in both the database file and the php files, the blog thinks it's on that third domain. Not sure how that's possible, but I'm guessing it's an MU issue. How do I disassociate the new .com site from the third domain? Is there a reasonably easy way to strip this blog out of MU, or is that even advisable?


title: Change background image per page

text: I would like to have a different background image as per PAGE (category) When the user goes to the `home.php`, call it A, it shall have a background image, then if I send them to a page B, I would like the background image to change. Can anyone steer me in the right direction for this, please? I understand it can be achieved via `.css`.


title: Editing page content through FTP?

text: I currently work with a graphic designer and code primarily HTML/CSS for clients looking to develop a web presence. I don't know much about WordPress. I have a client who wants some minimal changes done to his site, simple things like removing one of the tabs, editing some text, changing some links. His site is hosted through GoDaddy and I've gotten FTP access to all the files. Once I got in, I discovered that his site was created using WordPress - but he has no knowledge of this at all. The previous developers set up everything for him. So my problem is that I can't login to the actual WordPress account (because our client doesn't even know that it exists, so he doesn't know the login) and I can't find anywhere in the file structure where the actual content - what you see on the page - is created. There's a lot of PHP files calling things like `get_header()`. My question is, where is that header information coming from? How do I find the actual HTML so I can edit it? Is there even a way to do this through FTP or do I have to be able to log in through Wordpress? I apologize for having such a beginner question. Thank you for any light you can shed on this for me.


title: Clicking the "Edit Image" button when editing a page shows the full website in the modal window - instead of the image properties

text: I'm experiencing very strange behaviour on a Wordpress site hosted on Windows. When editing a page and clicking on any image to bring up the two buttons (Edit and Delete), after I click the Edit button, the modal window shows the full website (with mobile themed admin buttons), instead of showing the image properties. I have attached 3 photos to illustrate the behaviour: ![Editing the page](http://i.stack.imgur.com/5TDCj.jpg) ![Clicking the image](http://i.stack.imgur.com/KvKt3.jpg) ![Having clicked the "Edit Image" button, and the resulting window!](http://i.stack.imgur.com/Z0B07.jpg) This happens on any image on any post or page. An identical site with identical plugins and setup does not have the same problem though, despite being hosted on the same server. All plugins have been update, and the latest version of Wordpress is active (3.8). Anyone seen this behaviour before? Here's a final image of the correctly working site to show how the image properties window should look: ![enter image description here](http://i.stack.imgur.com/GPSxc.jpg)


title: Home links redirects to old site

text: So I have a issue that can´t really wrap my head around, it is most likely .htaccess related. I have just moved my site from a subdirectory to the main directory, this was done changing the site url and the url of the sitebuilder. The new site works fine, but the links to example.se redirects to http://example.se/www.example.se/Valkommen.html, this is the way the old site was set up. Now I wonder how to stop this from happening, where I unfortunately removed the old site including its htaccess file.


title: Does WP create multiple images?

text: When uploading an image in WP, does it creating multiple sizes (and multiple files) of the image? If so, are they all loaded or just certain ones (which and why)? Meaning, if x images are created from one uploaded, which one does WP show? Why does it need multiple images anyways if you aren't using a responsive web design?


title: Add individual <hx> tag to widget title in sidebar

text: In my sidebar every widget title is enclosed in `<h2>` tags. I use 4 widgets in my sidebar and I'd like to have the first 2 widget titles as `<h2>` and the other 2 as `<h4>`. I changed in my function.php as given below:               'before_title' => '<h4>',      'after_title' => '</h4>',      but that changes all titles.   How can I solve this issue?


title: Seperate functions.php for part of site

text: I built a custom WordPress site for some artists. I'm making one page that is entirely different from the rest of the site. Actually, that and a single.php page. It's for a specific new book, and the only reason it's on the same install is that it shares the blog posts. The rest is all specific. These pages don't need any css or js from the rest of the site - in fact, that is getting in my way. I'm having to overqualified everything and I worry that spill over is going to break the main site. They have their own header-books.php and footer-books.php How can I get them to have their own functions.php so that I can pull in css and js that is totally separate from the main site? (ps - it's way too late for multi site or any big ideas) Thank you.   * DW


title: Page keeps refreshing with Ajax form

text:
I have a simple form on my site with a simple jQuery Ajax call but the page keeps on refreshing. I know that the form is submitting OK but I can't get the alert to work.                      <form action="http://www.domain.com/l/4882/2014-04-09/cx9c5" method="post"       id="solutionvideo">
<input type="email" name="email" id="email" placeholder="Email" data- validation="email" data-validation="required" data-validation-error-msg="Required field" />

<input type="text" name="first" id="first" value="" placeholder="First name" data-validation="required"  data-validation-error-msg="Required field"/>

<input type="text" name="last" id="last" value="" placeholder="Last Name" data-validation="required" data-validation-error-msg="Required field"/>

<input type="text" name="company" value="" placeholder="Company" />

<input type="submit" value="Send" id="submit"/>
     </form>


title: Display a different image for each page with editor

text: We have several PAGES (about us, contact, services, etc...) On each page, we have an area for an IMAGE. The IMAGE is located in the same location on each page. (lower right corner > above the footer) We want to display a different image for each page:   * About Us = smile.png   * Contact Us = map.png    * Services = tools.png ..as an example. We want the client to use WP Page Edit "About Us" > Then have a custom field for "lower-page-image", and allow the client to upload any image they need to for that specific page. What is the best way to do this? We want to avoid Plug-ins, or creating several separate Template pages.


title: Co-Authors Plugin Displaying Wrong Author

text:
I'm using the Co-Authors Plugin and some posts have multiple authors: in `functions.php`               function my_get_multiple_authors(){       if ( function_exists( 'coauthors_posts_links' ) ) {           coauthors_posts_links();       } else {           the_author_posts_link();       }     }      in `single.php`               By <?php my_get_multiple_authors(); ?>      which outputs 2 links               John Doe     Jane Doe      In my archive.php (the archive/author pages are basically the same):               <?php if( is_author() ) { ?>
<?php echo get_the_author(); ?>
     <?php } ?>
         <?php if ( have_posts() ) : ?>             <?php while ( have_posts() ) : the_post(); ?>                  <?php get_template_part( 'my_content_template' ); ?>             <?php endwhile; ?>             <?php else : ?>         <?php endif; ?>
      However, when I navigate to "blahblah/author/johndoe", it outputs the wrong author. It ouputs `<h1>Jane Doe</h1>` Any ideas?


title: I get a 0 after the result of my ajax requests

text: Every time I do a particular Ajax request at the end of the result I get a 0. Why am I getting this and is there a way to get rid of it? The result is good it's just followed by a zero for some reason.


title: Redirect to current user page upon link click

text: I hope this problem does not have too complicated of a solution. I also hope it isn't too easy so I don't feel like a fool for not figuring it out :) On my website, (Wordpress), I have Peter's redirect plugin that redirects users after login to their specified personal page (not profile.php). This is great. However, after leaving their page, the only way to get back to it is to type the address to the page in the address bar, or logout/login again. Is there a way I can create a normal link, that will recognize the currently logged in user, and redirect them accordingly to their personal page? I know this may be basic, but I have search relentlessly through various sites, and other venues to locate an answer, and cannot seem to find one. I imagine it is because I am missing a 'key' word in my search, or it is so basic no one feels it needs to be covered. I also looked at the source code for the a fore mentioned redirect plugin to find this:               $current_user = wp_get_current_user();     $redirect_to = admin_url();     $redirect_url = redirect_wrapper( $redirect_to, '', $current_user );     wp_redirect( $redirect_url );     die();`      I know this probably means something to someone, would this work? If so, where could/should I put it to get the desired results?


title: Where do I edit the user profile with Buddypress?

text: Hey for some reason i cannot find the file to edit the appearance of the user profiles with buddypress. `Mysite.com/members/USER` where do i edit the profile, like adding `<div>` contents


title: Removing a link below from footer

text: My blog http://MyTechFlow.Com having a link below ie: after footer its due to a link in child thems function.php I want to remove it but dont know what to remove & what to keep. Below is the text part of function.php plz suggest me to which line and symbol to remove so that it will remove that link from my footers below part....               $background ? 'url('. $background .')' : '',             $color ? '#'. $color : 'transparent',              get_theme_mod( 'background_repeat', 'repeat' ),              get_theme_mod( 'background_position_x', 'left' ),              get_theme_mod( 'background_attachment', 'scroll' )          ) );     }      function addcopy() {     echo '<b href="http://www.Ariyan.org">Wordpress</a>';     }     add_action( 'wp_footer', 'addcopy' );     //* Add support for 3-column footer widgets     add_theme_support( 'genesis-footer-widgets', 3 );      I want to remove aariyan.org link and also it doesn't left any space after the main footer exit.


title: Email notification

text: Im trying to enrich this notification with subject (post title) and content, rather than its current view and edit links, could anyone help?               <?php          function __notify_admin_on_publish( $new_status, $old_status, $ticket )     {     if ( $new_status != 'publish' || $old_status == 'publish' )         return;          $message = 'View it: ' . get_permalink( $ticket->ID ) . "\nEdit it: " . get_edit_post_link( $ticket->ID );     if ( $post_type = get_post_type_object( $ticket->post_type ) )         wp_mail( get_option( 'admin_email' ), 'New ' . $post_type->labels->singular_name, $message );          }     add_action( 'transition_post_status', '__notify_admin_on_publish', 10, 3 );     ?>


title: Nice scroll to wordpress

text: I am converting html5 to wordpress Theme. I want to use custom scroll for wordpress. The code DEPENDENCIES It's a plugin for the jquery framework, you need to include jquery in your scripts. I will use `<?php wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); ?>` Will it work just by that What about below code?               $(document).ready(       function() {         $("html").niceScroll();       }     );      EXAMPLES 1. Simple mode, it styles document scrollbar (html element prefered): Where to enter this to make it work? After enqueuing , do i need it again to add in `header.php` Explanation will be helpful. How to use this code?               var seq = 0;            $(document).ready(function() {             $("html").niceScroll({styler:"fb",cursorcolor:"#000"});              $("#mainlogo img").eq(1).hide();         function goSeq() {           var nxt = (seq+1)%2;           $("#mainlogo img").eq(seq).fadeIn(2000);           $("#mainlogo img").eq(nxt).fadeOut(2000);           seq = nxt;           setTimeout(goSeq,2500);         };         goSeq();              $(window).load(function(){           setTimeout(function(){             $("#gmbox div").animate({'top':60},1500,"easeOutElastic");           },1500);         });              function trackLink(link, category, action) {           try {             _gaq.push(['_trackEvent', 'tracklink' ,'click',link.href ]);             setTimeout('document.location = "' + link.href + '"', 100)           }catch(err){}         }              $('[rel="outbound"]').click(function(e){                 try {             _gaq.push(['_trackEvent','outbound','click',this.href]);           }catch(err){}         });            });


title: Trying to get styles to register than enque

text: I have the following code in my functions.php file with a call in the header, but nothing is being outputted in the html. There are no stylesheets. I have tried that add action wp_enque_styles with and without the s (style)               <?php     function scripts_and_styles() {       if (!is_admin()) {       // normalize         wp_register_style( 'normal-stylesheet', get_stylesheet_directory_uri() . 'http://necolas.github.com/normalize.css/2.1.0/normalize.css', array(), '', 'all' );       // register main stylesheet         wp_register_style( 'main-stylesheet', get_stylesheet_directory_uri() . '/css/style.css', array(), '', 'all' );            // enqueue styles and scripts         wp_enqueue_style( 'main-stylesheet' );         wp_enqueue_style( 'normal-stylesheet' );        }      }      add_action( 'wp_enqueue_styles', 'scripts_and_styles' );      ?>


title: Older entries link within a category page

text: I have set up a category called 'blog' and have all of my posts displaying from this category. I have selected to display 4 posts / page therefore there is a link at the bottom that says older entries. However, when I click on "older entries" button, it takes me to the store page. I think the url is causing this problem but I have spent the whole night last night to figure it out and I still haven't found a solution yet. My website is: www.talis.com.au My blog is: www.talis.com.au/?cat=28 (how to change it to www.talis.com.au/blog?)


title: contact form-7 drop downs not populating database

text:
I am using contact form 7 with Contact Form to DB Extension. I have this following code for my form. However when I to a test submit only the name and the address populate the database, there isn't even a column for the 4 drop down menus. Not sure why they don't populate the database?
Select a day
     [select date id:day "Monday" "Teusday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"]

And a date
     [select date id:date class:date "1st" "2nd" "3rd" "4th" "5th" "6th" "7th" "8th" "9th" "10th" "11th" "12th" "13th" "14th" "15th" "16th" "17th" "18th" "19th" "20th" "21st" "22nd" "23rd" "24th" "25th" "26th" "27th" "28th" "29th" "30th" "31st"]

Time
     [select date id:time class:time "10:00am" "10:30am" "11:00am" "11:30am" "12:00am" "12:30am" "1:00pm" "1:30pm" "2:00pm" "2:30pm" "3:00pm" "3:30pm" "4:00pm" ]

How Many Bottles
     [select date id:bottles class:bottles "50" "60" "70" "80" "90" "100" "110" "120" "130" "140""150" ]

Your Name

     [text name id:name]

Your Address

     [text address id:address]


title: dbdelta failing with error: "WordPress database error Table 'wp_2_myPlugin' already exists

text: I'm upgrading a plugin and having issues with dbdelta. Here's the original db creation function:               global $jal_db_version;     $jal_db_version = "0.1";          function jal_install() {             global $jal_db_version;             global $wpdb;        $table_name = $wpdb->prefix . "jalPlugin";              $sql = "CREATE TABLE " . $table_name . " (           id mediumint(9) NOT NULL AUTO_INCREMENT,           timestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,           hash text NOT NULL,           uname tinytext NOT NULL,           UNIQUE KEY id (id)         );";             require_once(ABSPATH . 'wp-admin/includes/upgrade.php');        dbDelta($sql);             update_option("jal_db_version", $jal_db_version);     }          // Installs db on plugin activation     register_activation_hook(__FILE__,'jal_install');      You'll probably recognize it from the WordPress Codex on Using Tables -- it works beautifully. (I obviously modified the function name so as not to conflict with other plugins). I'm trying to upgrade my db used for the plugin and having some issues. I thought dbdelta was supposed to be able to see the differences between what you have and what you want and modify a table accordingly. So here's my upgrade script:               global $jal_db_version;     $jal_db_version = "0.2";     function jal_install() {             global $wpdb;        $table_name = $wpdb->prefix . "jalPlugin";              $sql = "CREATE TABLE " . $table_name . " (             id mediumint(9) NOT NULL AUTO_INCREMENT,             timestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,             hash text NOT NULL,             uIP VARCHAR(55) DEFAULT '' NOT NULL,             uname tinytext NOT NULL,             UNIQUE KEY id (id)         );";             require_once(ABSPATH . 'wp-admin/includes/upgrade.php');        dbDelta($sql);             update_option("jal_db_version", $jal_db_version);          }          function jal_install_update_check() {          global $jal_db_version;         if (get_site_option('jal_db_version') != $jal_db_version) {             jal_install();         }     }     add_action('plugins_loaded', 'jal_install_update_check');      I got this code from the same codex page. The db is not updating and I'm getting an error in the error log:               [05-Feb-2012 20:33:18] WordPress database error Table 'wp_2_jalPlugin' already exists for query CREATE TABLE wp_2_jalPlugin (             id mediumint(9) NOT NULL AUTO_INCREMENT,             timestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,             hash text NOT NULL,             uIP VARCHAR(55) DEFAULT '' NOT NULL,             uname tinytext NOT NULL,             UNIQUE KEY id (id)         ) made by require, require_once, require_once, require_once, do_action, call_user_func_array, qrLogin_update_db_check, qrLoginDB_install, dbDelta      It would appear to me that dbdelta is not understanding that it has a job to do... Any ideas? ...and thanks for your time!


title: wp_get_current_user always returns 0 continued

text: I have been busting my head trying to get the user ID with every piece of code possible but it always comes back "0". Not sure what I'm doing wrong. I started out using this:               <?php $user_info = get_userdata(1);       echo 'Username: ' . $user_info->user_login . "\n";       echo 'User level: ' . $user_info->user_level . "\n";       echo 'User ID: ' . $user_info->ID . "\n";     ?>      Which kicks back a bunch of Function undefined errors which I take care of with "require_once" calling files such as pluggable.php, user.php etc... In the end, no more errors and the user is "0". Then tried this:               <?php     $current_user = wp_get_current_user();     if ( 0 == $current_user->ID ) {       echo "Not logged in.";     } else {       echo "logged in";     }     ?>      Which returns another function undefined: **Fatal error: Call to undefined function wp_get_current_user() in ....** Take care of that with the require_once list of files and I get "Not logged in" everytime. Then I went global with this:               <?php global $current_user;           get_currentuserinfo();                echo 'Username: ' . $current_user->user_login . "\n";           echo 'User email: ' . $current_user->user_email . "\n";           echo 'User first name: ' . $current_user->user_firstname . "\n";           echo 'User last name: ' . $current_user->user_lastname . "\n";          echo 'User display name: ' . $current_user->display_name . "\n";          echo 'User ID: ' . $current_user->ID . "\n";     ?>      And I get this **Fatal error: Call to undefined function get_currentuserinfo() in...**. Putting the slew of require_once calls and I get this result: **Username: User email: User first name: User last name: User display name: User ID: 0** Not sure what I'm doing wrong. Out of desperation I even tried moving the file into my theme folder thinking that that might work but nothing. Can anyone help me out??? Thanks in advance!


title: How do I sort post listing by child post count?

text: I have two custom post types called questions and answers. The questions list includes a custom column which displays a count of the answers for each question. I need to be able to sort the listing based on the number of answers. This query works via the MySQL shell and provides the proper output:               SELECT a.ID, a.post_title, COUNT(b.ID) AS child_count     FROM wp_posts a     LEFT JOIN wp_posts b     ON a.ID = b.post_parent AND b.post_status = 'publish' AND b.post_type = 'answer'     WHERE a.post_type = 'question' AND a.post_status = 'publish'     GROUP BY a.ID     ORDER BY child_count DESC      My code so far:               add_filter( 'pre_get_posts', 'column_orderby' );     function column_orderby( $query ) {       if ( ! is_admin() )         return;       $orderby = $query->get( 'orderby' );       if ( 'qa-answers' == $orderby ) {         global $wpdb;         $query->set( 'posts_join', "LEFT JOIN wp_posts b ON a.ID = b.post_parent AND b.post_status = 'publish'" );         $query->set( 'posts_groupby', "{$wpdb->posts}.ID" );       }     }      How can the `COUNT(b.ID) AS child_count` clause be added to the query so that I can reference this in a `$query->set('orderby', 'child_count');` statement?


title: How to determine if the sidebar is empty? Or not active?

text: I used `is_sidebar_active('NameOfSidebar')`, but it seems not working. It returns false all the time. I wanna have a condition that goes like this               if('sidebar is not active'){      //must not display the section title.     }else{      //display the sidebar here..     }


title: Form action URL unrecognized

text: I have a contact form previously used in static websites that I’d like to adapt to use in WordPress. I realize there are numerous plug-ins such as Contact Form 7, but would rather use this since it’s simple and I’m familiar with it. Basically, on submission the form page goes to a second PHP page for the post action, rendering a confirmation note with all of the entered data while simultaneously sending an HTML email using the same data. The flat HTML structure is: **examplesite.com/contact/page-contact.php** = Form Page **examplesite.com/contact/confirmation/page-form-mail.php** = Output Page This has worked fine for my non-CMS purposes. To adapt to WordPress, I set both up as Pages, and included all the form PHP in their respective page templates. Hence: **wpsite.com/contact** – “Contact” page template = “page-contact.php” **wpsite.com/contact/confirmation** – “Confirmation” page template = “page- form-mail.php” My problem is in referencing the confirmation page file in the contact form’s action so the confirmation page actually works within WordPress. When the confirmation page URL is loaded independently, the output skeleton (without the data) is displayed correctly within WordPress. But hard-coding the actual directory path or using other WP method to generate same (i.e., `action=“http://wpsite.com/contact/confirmation/”` ) produces blank output – I assume because PHP is referencing the directory and not the template file, even though the confirmation page is set up using the template. Alternatively, the confirmation output page can instead be referenced directly via:               action="<?php bloginfo('stylesheet_directory'); ?>/page-form-mail.php"      This is functional (it outputs and emails the data) but is no longer within WordPress and of course exposes the full template URL path:               http://wpsite.com/wp-content/themes/wpsite-theme/page-form-mail.php      Seems I’m missing something pretty basic here. How do I reference the actual confirmation php file in the form action and still keep it within WP? Thanks for any suggestions! _Note:_ initially I was using “name” as one of the form variables until I realized that was one of WP’s internals, so then I custom-prefixed all my variables but it’s still not working. (In reading other form questions here, that seems to be a common problem!)


title: Right approach for plugin output styling/template

text: I am creating a plugin that needs to output things on the front end of the site. I tried keeping the default look as clean as possible, but I'd also like to make it easy for the users to modify. My thinking is to include the ability to load a custom stylesheet instead of the default one, if the user creates a stylesheet with a particular name in his theme. Any pointers on how to build that functionality? In the more extreme case that the user wants to change the HTML/PHP used for output completely, I created an action and attached my display function to that action. In this way, a user is able to unattach my default display function, and attach his custom display function via the available hook. Is this the right approach to go about this?


title: How to add a predefined custom field without using a plugin?

text: I´m trying to find a snippet to add a predefined custom field. Does anyone know how or where i can find this? I know I can do this with CustomPress, but I´m trying to do this without a plugin.


title: Adding else if conditional statement to purchased theme

text: I purchased a theme that I want to change a bit. I'm familiar with writing some if/else statements but not this type and not matter what I do, I can't add an else/if without breaking the code. Below is the code from the theme...               <?php        if (!is_404() && !is_attachment()) {           if (is_singular() || is_page('gallery') || is_page('about') && has_post_thumbnail($post->ID) && ($image = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'post-thumbnail') ) && $image[1] >= HEADER_IMAGE_WIDTH) :               echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );           else : ?>               <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('name'); ?>" />     <?php endif; } ?>      The code shows a featured image as a banner on the pages where there is one. I am trying to write an else/if statement that doesn't show the featured image as a banner on the single post pages, and like I said, every time I try adding an else/if, I end up breaking the code.


title: Slow admin - waits and is blocked for a long time

text: I have a wordpress site and sometimes when logged in to the admin it can be quite slow. I've attached an image to show what i mean. The first request waits for about 8 seconds before anything else happens, a lot of the time that is about 2.5 to 3 seconds wait. Then all of the other requests get blocked for several seconds. I do have quite a few plugins (26) could this be the reason or is it something else? What's actually going on here and what I can do to improve it as much as I can? ![enter image description here](http://i.stack.imgur.com/MEbga.jpg) Update: I've deactivated all of the plugins and activated them one by one. The two that seemed to have the biggest effect was Advanced Custom Fields and Use Google Libraries. Here's what i found. These are the requests and time to load the index dashboard page according to the net tab of firebug. With no plugins activated   26 Requests   6-7 seconds With all plugins activated   64 Requests   13 Seconds With all plugins activated but the two mentioned above deactivated   36 Requests   8 Seconds If i activate Advanced custom fields   55 Requests   11-12 Seconds If i deactivate ACF and activate Use Google Libraries   53 Requests   10 Seconds


title: How to add custom_fields value in JSON API using create_post

text: I want to add/update custom fields values using JSON API,anyone explain how we can specified custom_fields values in url for add or update.


title: Group Pages based on Parent in Admin Area

text: EDIT: I've managed to solve this with the help of Reddit. For those interested I used Admin Column View * * * My website has about 50 pages separated under 5 parent pages. In the backend it is a mess of pages, and when I give this website to the client they're going to have no idea what to do with it. The pages span across 3 pages of next buttons, can I group these pages by their parent page so that they're hidden until the parent page is clicked on? Preferably a plugin or something similarly simple to use. Just so there are 5 pages rather than 50 to scroll through. The way it is displayed now:               Parent     - Child     - Child 2     - Child 3      Is really un-client friendly. Thanks in advance


title: Add extra optional text to permalink e.g. "-with-*"

text: I've been scratching my head about this one for a while. I have tried to add a hook within `WP_Rewrite` to ensure that we can pick up pages with a similar structure:               /products/product1-with-*     /products/product2-with-*      The actual page, would be `/products/product1`. The end result would be that the `*` would be used in the page (once processed) to transform it or change the theme etc. It seems that the following is available in WordPress:   * `add_rewrite_endpoint`: This seems to do what I want, but without the URL format I am after. This would yield something like `/with/*` which is not what I want ideally.   * `adding a new route`: This seems overkill for what I need, ideally I don't want to modify/create multiple routes just to tranform the existing ones. I have also tried a few of the normal filters such as `parse_query` and `pre_get_posts` but it seems most of the work of deciding what page to display has been decided at these points. Is there a relatively simple way to parse the URL when requested and strip out the `with-*` part until needed within the page? If not, how would it be accomplished with the new route method?


title: My login form does not work

text:
I have the following code that generates a login form for every page in my blog.               <form action="<?php echo wp_login_url(); ?>" method="post">     username:
     <input name="log" id="login_username" type="text" />
     password:
     <input name="pwd" id="login_password" type="password" />

     <input name="rememberme" id="rememberme" type="checkbox" value="forever" />     remember me

     <input type="submit" value="login" />     <input type="hidden" name="redirect_to" value="/" />     <input type="hidden" name="testcookie" value="1" />     </form>      But it doesn't work. It just lands the user in login page. I'm wondering if I have left out a part of the form! **SOLVED** : I should've just put a hidden input in the form with name of `login` and some value like `true`.


title: modify URL with mod_rewrite or hook

text: i'm trying to achieve the following: user enters this URL into browser `http://mydomain.com/boston/categoryname/postname/` i then want to get the first "folder" and check whether or not it's "boston" or "newyork" - if yes, then remove this part of the URL, add it as an query- parameter and pass the modified URL on to wordpress: `http://mydomain.com/categoryname/postname/?location=boston` i tried this using apache's `mod_rewrite` like this:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /          RewriteRule ^(boston|newyork)/(.*)$ /$2?location=$1 [NC,QSA,L]          RewriteRule ^index\.php$ - [L]          RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]          </IfModule>      in my `functions.php` i add a filter for `request`               add_filter('request', 'request_it');     function request_it($query_vars)      {         print_r($query_vars);     }      it echos               Array (              [page] =>              [name] => postname              [category_name] => boston/categoryname              [location] => boston      )      so the location gets passed on as a query-parameter but the `REQUEST_URI` is still `/boston/categoryname/postname/` instead of `/categoryname/postname/` and wordpress tries to display the wrong content. how can i really strip the location from the URL?   is `mod_rewrite` not the right thing to use?   is there a function where WP evaluates the URLs that are passed to it where i can hook into and look for my `location`?


title: How to check if custom field exists in this widget query

text:
How can I include this (or something similar)               <?php if ( get_post_meta($post->ID, 'url', true) ) { ?>                  <a href="<?php echo get_post_meta($post->ID, "url", $single = true); ?>"><?php the_post_thumbnail('');?>          <?php } else { ?>                  <?php the_post_thumbnail('');?>          <?php } ?>      Into this simple widget query?               query_posts('post_type=sponsors&meta_key=_vof_sponsor_level&meta_value=Gold');     if (have_posts()) :          echo "
";     while (have_posts()) : the_post();         the_post_thumbnail('sponsorwidget');     endwhile;         echo "
";     echo "View all Sponsors »";     endif;      wp_reset_query();      So basically, if the custom field "url" exists it outputs the featured image wrapped in an anchor tag, but if the custom field doesn't exist it just outputs the featured image. Also, I know it's not ideal using query_posts, and that get_posts would be better, but I'm under orders here.


title: Make WP_Query more efficient?

text: Ok - so using a WP_Query to count votes by a user. But now there are 23,000 votes and its using up lots of memory. Is there a way i can make this WP_Query more efficient?               $args = array(         'post_type' => 'vote',         'author'=>$user,         'meta_key'=>'comp_question',         'meta_value'=>$question_id,         'meta_compare'=>'=',         'orderby'=>'date',         'order'=>'desc'     );          $the_query = new WP_Query( $args );      any help appreciated! dc any help appreciated!


title: Adding Category Argument into an Array for WordPress Query

text: I'm new to customizing WordPress and am looking to query an array of posts within a certain category. I have a display that's showing an array of all posts from the site:               $arguments = array(                     'post_type' => 'post',                     'post_status' => 'publish',                     'paged' => $paged,                     'showposts' => $postcount                 );      Basically, I want to be able to show an array of all posts that are only in the category "Nutrition". I figured it's a 'category' argument that would be added into this array?


title: How to update the language used by wordpress from a plugin

text: I'm trying to create a plugin that will be able to translate language used in wordpress. Here's my current code:               add_action('plugins_loaded', function(){         load_plugin_textdomain('ecom', false, dirname(plugin_basename(__FILE__)) . '/lang');      });      The problem is most of the tutorials that I find in the internet relies on updating the `wp-config.php` file to load the specific language file like this:               define('WPLANG', 'spanish');      But as a plugin developer we do not have control on the `wp-config.php` Any ideas? The only solution that I can think of is to read the wp-config.php file and then modify its contents but it really sounds like a bad practice.


title: Polylang: pll_e() & pll__() on functions.php, doesn't work

text: I've on functions.php some functions that echoes blocks of HTML. Problem comes with Polylang plugin, that uses custom functions pll_e() and pll__(). Those works right on index.php on every theme, but doesn't work right on functions.php, wich basically always returns me the default language strings, even having'em registred on admin side. So those blocks printed on index.php using pll_ functions, work fine. But same blocks printed on functions.php, always come in English. I've posted this on oficial plugin support forum. No answers yet. Someone here have an idea of what it can be? Thank you so much!


title: How to initialize PODS?

text: I downloaded the PODS 2 plugin (amazing!) - added a field to existing content type and now I would like to print it using php inside a widget. However I am not sure how to print the fields using pods - I tried to initialize it, but it is not working. Please see my code below. Any ideas?               <?php $mypod = pods( 'my_pod' );      $mypod->display( 'my_field' ); ?>      http://staging.pods.io/docs/code/pods/


title: Making a [gallery] in a loop with attachment IDs?

text: I dont understand why this returns nothing but a blank screen. But if you echo the $attachment->ID you get a string of ID numbers. The goal is to produce a gallery with the wordpress [gallery] shortcode that includes all the featured images in all post.               $args = array( 'posts_per_page' => -1, 'offset'=> 1, 'post_type' => 'attachment' );          $posts = get_posts( $args );          foreach ( $posts as $attachment ) {                   do_shortcode('[gallery type="square" id="'.$attachment->ID.' ,"]');         }      Also, which is it: ID or IDS (the codex shows both?!) and which is better to use ID or INCLUDE to pick which images to use? NOTE: Tried this in default 20-13 and 20-14 themes, got the same blank results.


title: How would I use a media query to make my entire theme responsive or fluid?

text: I've settled on a theme for one of my blogs. Is it possible to just wrap your stylesheet (style.css on most themes) in @media queries, and make your entire theme **responsive** , or **fluid** , so it **works well on all browsers and screen resolutions**? If so, does anybody know how I can accomplish this? Or is there a better, easier way to accomplish this? I mean, can I just put this at the top of my style.css?               @media screen and (max-height: 700px) {         // style.css rules      and of course at the very bottom, just:                   }      Will this make my entire theme fluid or responsive, or is it much more in- depth than that? Any guidance in this regard would be greatly appreciated!


title: Custom taxonomy only showing top level terms in admin?

text: I have a hierarchical custom taxonomy that I add terms to programatically using the following code in a loop:               -- SNIP --         $args = array(             'description'=> '',             'slug' => str_replace(' ','-',preg_replace('/[^\00-\255]+/u', '', $term)),             'parent' => $parent           );              $term_id = wp_insert_term(           $term,            'widgets',            $args         );     -- SNIP --      Which works ok in terms of adding the widget terms in the desired hierarchical structure, however, on the taxonomy management page in admin, there is some really strange behavior. Only the top-level terms are shown in the list (2) even though it says 28 items found and there are pagination links for page 2 which displays nothing. If I delete the top level terms, the second level is shown in the listing, etc. Any ideas as to why this is happening and how to resolve would be appreciated.


title: Wordpress In Menu

text: I am using woocommerce plugin in my WordPress setup. I want the Checkout in the menu bar should appear only when there is something in the cart. How can I do this?


title: Rewrite numeric ID parameter for hierarchical custom post type

text: I've been banging my head against a wall on this one for a while but I'm not quite sure from all the tutorials I read how to see why this isn't doing what I expect. I have a page called `shop-guide/shop-page?id=412` (for example) and I want to change it so it it's `shop-guide/shop-page/id/412/` As far as I can tell I have my code set up correctly, but when I try to navigate to the page I get a 404, and if I use the $_GET version it doesn't rewrite. Here's my code: (in `functions.php`)               function wptuts_add_rewrite_rules() {       add_rewrite_rule(           'shop-guide/shop-page/id/([^/]*)/',           'index.php?p=143&id=$matches[1]',           'top'      );       }       add_action( 'init', 'wptuts_add_rewrite_rules' );


title: Add a custom post when inserting a new user in Wordpress?

text: I want to add a custom post type (called pupil) into Wordpress when inserting a new user. The `wp_insert_user()` is used for creating new users. I have this code:               function register_user_pupil($user_id) {              //Count nr of occurences in user-table for submitted email-adress         $email_form = $_POST['email'];         $sql = "SELECT * FROM $wpdb->users";         $sql .= " WHERE user_email = '%s'";             $count_users_email = intval($wpdb->get_var($wpdb->prepare( $sql, $email)));              //Check if email (from exists) already exists in the system (in users table)         //If it doesn't, create new user into variable. If it does, store that user in variable         //based on email-adress         if ($count_users_email === 0) {             $current_user = new WP_User($user_id);         }         else {             $current_user = get_user_by( 'email', $email_form );         }              //Create a new pupil custom post-type for this user         $user_registration_post = array(           'post_title'      => $current_user->display_name,           'post_type'       => 'pupil',           'post_status'     => 'draft',             //This registration cpt is not available for public           'post_author'     => $current_user->ID         );         $postid_pupil = wp_insert_post( $user_registration_post );              //postid should return something above 0 and not a WP_Error-object         if (is_array($postid_pupil) || intval($postid_pupil) === 0) {                                     throw new Exception('Kan inte skapa en elev-registrering');         }              //Rest of updating is done by function postsubmit() (saving the pupil CPT)          }     //Hook for handling new users      add_action( 'user_register', 'register_user_pupil', 10, 3 );      The issue is that this function is called **AFTER** the user is inserted, I want it to be executed **BEFORE** the actual user is inserted. I've also tried to use the register_post hook, but this code is not called before the user is inserted anyway.I've also tried to figure out if I could use hooks with `pre_{something}`, but with no luck. Anyone could me help me? That would be much appreciated :-)


title: Plugin for Marathon Running Event Management

text: Is there a plugin that works to be a marathon running event management tool? I need things like ways to accept registrations, payments, and displaying the results when the event is over.


title: Using 'strtotime' function to convert a custom-meta-box to a date-stamp

text:
I am building a "podcast" post type in a wordpress build using custom-post- types, meta-boxes & taxonomies. There may be a simpler way to do this.. I'm still learning and this is my first go at it. Either way, I'm almost finished, but I want to add some functionality that will help my client (make it easier to use). One of the custom meta boxes I have is "date" - the reason for this is that the upload date for the podcast (ie the_date) is often different from the day the podcast was recorded (meta-box _date). I know a little bit about the strtotime function in php - and I would LOVE to use this to do some processing on the data input to the "date" field on new podcasts. Right now it is just text, so if the user inputs "Jan 23, 2012" or "January 23, 2012" or "1-23-12" etc - I am stuck with that text for display purposes. However, using the strtotime function, I'm thinking I could convert the user input to a date-stamp that I could display around the site however I like (m,d,y). I'm just not sure where to start exactly - I'm VERY new at php. I'll include the relevant code below. Any help you could provide would be very much appreciated! Thanks! Tim               // Podcast Meta Box          function podcast_info() {     global $post;          // Noncename needed to verify where the data originated     echo '<input id="podcastmeta_noncename" name="podcastmeta_noncename" type="hidden" value="' .     wp_create_nonce( plugin_basename(__FILE__) ) . '" />';          // Get the data if its already been entered     $week = get_post_meta($post->ID, '_week', true);     $date = get_post_meta($post->ID, '_date', true);     $description = get_post_meta($post->ID, '_description', true);          // Echo out the field     echo 'Week
What week of the series is this podcast? (enter the ‘Week X’ OR ‘Guest Speaker’)';     echo '<input class="widefat" name="_week" type="text" value="' . $week  . '" />';     echo 'Date
Enter the Date the podcast was recorded (Format as: ‘mm/dd/yy’)';     echo '<input class="widefat" name="_date" type="text" value="' . $date  . '" />';     echo 'Description
Enter the text you\'d like to display as a description on the media archives list.';     echo '<input class="widefat" name="_description" type="text" value="' . $description  . '" />';          }          // Save the Podcast Meta box Data          function save_podcast_meta($post_id, $post) {          // verify this came from the our screen and with proper authorization,     // because save_post can be triggered at other times     if ( !wp_verify_nonce( $_POST['podcastmeta_noncename'], plugin_basename(__FILE__) )) {     return $post->ID;     }          // Is the user allowed to edit the post or page?     if ( !current_user_can( 'edit_post', $post->ID ))         return $post->ID;          // OK, we're authenticated: we need to find and save the data     // We'll put it into an array to make it easier to loop though.     $podcast_meta['_week'] = $_POST['_week'];      $podcast_meta['_date'] = $_POST['_date'];     $podcast_meta['_thumbnail'] = $_POST['_thumbnail'];     $podcast_meta['_seriesimg'] = $_POST['_seriesimg'];     $podcast_meta['_description'] = $_POST['_description'];          // Convert _date to actual date stamp          foreach ($podcast_meta as $key => $value) {         if(get_post_meta($post->ID, '_date', true))             strtotime('_date');     }          // Add values of $podcast_meta as custom fields          foreach ($podcast_meta as $key => $value) { // Cycle through the $podcast_meta array!         if( $post->post_type == 'revision' ) return; // Don't store custom data twice         $value = implode(',', (array)$value); // If $value is an array, make it a CSV (unlikely)         if(get_post_meta($post->ID, $key, FALSE)) { // If the custom field already has a value             update_post_meta($post->ID, $key, $value);         } else { // If the custom field doesn't have a value             add_post_meta($post->ID, $key, $value);         }         if(!$value) delete_post_meta($post->ID, $key); // Delete if blank     }          }     add_action('save_post', 'save_podcast_meta', 1, 2); // save the custom fields      **EDIT - Working Now - See Code Below**                    <?php $podcast_date = get_post_meta($post->ID, '_date', true);?>     <?php $fixed_date = strtotime($podcast_date); ?>               <?php echo date('m/d/y' , $fixed_date) ; ?>


title: Jeditable Plugin working as it should - scope issue?

text: I am using the Jeditable plugin to enable inline editing on a table inside the admin area, generated by a small plugin I've written. (http://www.appelsiini.net/projects/jeditable). Basically everything is working, but only as long as the code for updating the database field is inside the plugin's code. As soon as I copy that code into another file and try to edit something, I get this error: > Fatal error: Call to a member function update() on a non-object in XXX on > line XX I only understand partly why I get that error. Is it because $wpdb is not initialized? I tried global $wpdb without luck. That's why I think I am missing something, somewhere in the code $wpdb gets "lost" somehow, so the update method can't be found. It is really frustrating, because the code is working, but as soon as I use it in a seperate file, it's not working. If needed I can post the code, but I am hoping it's just a standard issue. EDIT: Ok, so here is my code: That is the Jeditable plugin in action, right after the table (Let's say it's inside the index.php):               <script>         jQuery(document).ready(function() {             jQuery('.edit').editable('../wp-content/plugins/myplugin/save.php', {                 indicator   :   'Saving...',                 tooltip     :   'Please click to edit!',                 id          :   'my_id',                 name        :   'my_value',                 width       :   'none',                 cssclass    :   'editable-input'             });         });     </script>      As you can see, I am calling the save.php which looks like this:               if(isset($_POST['my_id']))     {         error_reporting (E_ALL);              $explode    =   explode('-', $_POST['my_id']);         $my_row =   $explode[0];         $my_id      =   $explode[1];         $my_value   =   $_POST['ck_value'];              if($my_row == 'date') {                  $exp = explode(' ', $my_value);                  switch($exp[1]) {                 case 'Jan': case 'jan': case 'Januar': case 'januar': case '01': case '1':                     $month = '01';                     $montha = 'Jan';                     break;                 case 'Feb': case 'feb': case 'Februar': case 'februar': case '02': case '2':                     $month = '02';                     $montha = 'Feb';                     break;             }                       $day = substr($exp[0], 0, 2);             $wpdb->update($table_name, array('ck_date' => $exp[2].'-'.$month.'-'.$day, 'ck_monthabbr' => $montha) , array('ck_id' => $my_id));             echo $exp[2].'-'.$month.'-'.$day.'<br />';         }              if($my_row == 'ogo') {             $wpdb->update($table_name, array('ck_geo' => $my_value) , array('ck_id' => $my_id));         }              if($my_row == 'vue') {             $wpdb->update($table_name, array('ck_venue' => $my_value) , array('ck_id' => $my_id));         }     }      Inside the index.php, I have global $wpdb and $table_name defined, but save.php doesn't recognize these variables.


title: Wordpress Custom Content and Taxonomy's Archives

text: Ok so I have set up a custom content type: Event I have then set up the custom taxonomies in hierarchical format for Event: Type To display "event" posts in each "type", I'm using the template: taxonomy- type.php I have then set up a widget "Custom Taxonomies Menu Widget" to list the "types" in one of my widget areas with a count for post in each type. My issues: Clicking one of them takes me to pages that don't match the "event" posts that should be there for that "type". (one of which, the party "type, shows no posts available even though I have some in that "type". The count is not right for the posts in each category. (not that big of a deal compared)