Additional fields on Woocommerce's rating system

I need to add additional fields to a Woocommerce product rating system like this: ![enter image description here](http://i.stack.imgur.com/iYfy7.png) I opened this file: /wp-content/plugins/woocommerce/templates/ **single- product-reviews.php** and saw the following lines:               $comment_form = array(             'title_reply' => $title_reply,             'comment_notes_before' => '',             'comment_notes_after' => '',             'fields' => array(                 'author' => '
' . '' . __( 'Name', 'woocommerce' ) . ' ' . '*' .                             '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" aria-required="true" />
',                 'email'  => '
' . __( 'Email', 'woocommerce' ) . ' ' . '*' .                             '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30" aria-required="true" />
',             ),             'label_submit' => __( 'Submit Review', 'woocommerce' ),             'logged_in_as' => '',             'comment_field' => ''         );      and this               $comment_form['comment_field'] = '
' . __( 'Rating', 'woocommerce' ) .'<select name="rating" id="rating">                 <option value="">'.__( 'Rate…', 'woocommerce' ).'</option>                 <option value="5">'.__( 'Perfect', 'woocommerce' ).'</option>                 <option value="4">'.__( 'Good', 'woocommerce' ).'</option>                 <option value="3">'.__( 'Average', 'woocommerce' ).'</option>                 <option value="2">'.__( 'Not that bad', 'woocommerce' ).'</option>                 <option value="1">'.__( 'Very Poor', 'woocommerce' ).'</option>             </select>
';      Is there any way I can add another select inputs?


Use WordPress as authentication for custom app

I am in the process of developing a custom web application which will require users to login. We have developed a WordPress website to manage the signup and payment/subscriptions for the application. The e-commerce solution we are using is WooCommerce. The application is hosted on a different server than the WordPress website. I would like to, if possible authenticate users via the WordPress database. I have been trying out some XMLRPC methods which can communicate with the WordPress site but it is unreliable at best and I would like to find a solid solution. The process would be:   1. User signs up for the product and creates account on WordPress site   2. User receives confirmation email with a link to the application   3. User logs in to the application using the email address and password entered when creating the account on the WordPress site. I am looking for suggestions on how to implement this and if anyone else has achieved done this previously, how they did it. Thanks!


Change the Featured image for child posts

I have created two post type for my website ("product" and "variation"). Each variation has a feature image and their post parent is a "product" post. I would like to be able to change the different featured images for every variation when I edit the post product. ![Something like this](http://i.stack.imgur.com/KCewS.png) Is there any plugin to resolve this or I have to make a new one?


How to automate wordpress installation in subdomain

How can I automate the installation of wordpress in a subdomain? Example: Upon registration user1 would get automatically wordpress on user1.domain.com. Then, upon registration user2 would get his own wordpress on user2.domain.com, etc. I can program a little bit PHP, but I would rather avoid any programming and would prefer a ready-made solution if it exists. Thank you in advance for your help. Any hint is appreciated.


How to Display Sequential Post Number Count

I know this has been answered at least a couple of times already and there is an answer out there from alchymyth2010 but I am looking for a different solution if possible because I have a fairly big wordpress site, around 30,000 posts and the code from http://wordpress.org/support/topic/display-sequential- post-numbercount-not-post-id makes wordpress hang and eventually times out for some reason. Actually I suspect it hangs because is trying to update all the posts in the db and that takes time. Anyway I am not a PHP aficionado but any kind of help would be great


Customize individual parts of the list - List Category Posts plugin

I was just wondering if there was anyway to customize individual parts of the lists. So for instance if you go to my site at www.r3entertainment.org and check out the Features page, if you look at the top where it says Gaming's Most Memorable Moments.. is there a way for JUST the title link to be underlined and the author to stay normal in each listed post?


Two queries – one with checkbox ticked, one without – comparing meta_query

I am trying to do the following: Two queries 1. Get all people that have director 'yes' ticked 2. Get all people that don't have director 'yes' ticked I have the first query all set up and works well ('people' is a CPT, and director is an ACF of a checkbox 'yes').               <?php $directors = get_posts(array(         'post_type' => 'people',         'orderby' => 'meta_value',         'meta_key' => 'last_name',         'order' => 'ASC',         'posts_per_page' => -1,         'meta_query' => array(             array(             'key' => 'director',             'value' => '"yes"',             'compare' => 'LIKE'             )         )     )); ?>      What this query does it get all 'people', ordered by their last name, and, using `meta_query` gets all those who have the directors checkbox ticked 'yes'. So, my issue is that now what I want to do, for the second query, is get all those people where 'director' 'yes' isn't ticked. ![enter image description here](http://i.stack.imgur.com/9m1hU.png) Here is what I have so far:               <?php $people = get_posts(array(         'post_type' => 'people',         'orderby' => 'meta_value',         'meta_key' => 'last_name',         'order' => 'ASC',         'posts_per_page' => -1,         'meta_query' => array(             array(                 'key' => 'company',             'value' => '"' . get_the_ID() . '"',             'compare' => 'LIKE'             ),             array(             'key' => 'director',             'value' => 'yes',             'compare' => 'NOT LIKE'             )         )     )); ?>      I have tried a few other compare arguments, but can't seem to get it to work. Any help or ideas?


AJAX in wordpress theme loop

I'm trying to make a AJAX request on my theme. I already know wordpress handle AJAX very well, but not directly on theme file. It uses admin-ajax.php for this. I working on this for a long time and really don't know where to put the code. I know there need to put information in admin-ajax.php, function.php and have to specify if user is ou not logged in. Can someone help me with my code? HTML:

      JQUERY:                         EXTERNAL FILE:
Temakis
          <?php     $args = array(         'post_type'      => 'post',         'category_name' => 'temakis');     query_posts($args);     while (have_posts()) : the_post();     ?>
       <img src="<?php the_field("imagem-produto");?>" width="150" height="150" title="<?php echo get_the_title(); ?> "/>

<?php echo get_the_title(); ?>

<? echo get_post_field('post_content'); ?>

R$ <? the_field("preco"); ?>

          <?php endwhile; ?>     <?php wp_reset_query(); ?>      The request is ok, because i`m getting the h3 correctly. Can anyone help me? Thanks!


remove base slug from hierarchical custom post type

I've tried various methods posted here and on stackoverflow and none of them work unfortunately. My CPT is "service_locations" and by default has this structure for main pages:               /service_locations/city-name/      and this structure for the service page(s) for each city:               /serivce_locations/city-name/service-type/      Here is how i'm declaring my CPT:               add_action( 'init', 'service_locations' );     function service_locations() {         register_post_type('service_locations', array(             'label' => 'Service Areas',             'description' => '',             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'capability_type' => 'post',             'hierarchical' => true,             'rewrite' => true,             'query_var' => true,             'exclude_from_search ' => true,             'has_archive' => true,             'supports' => array(                 'title',                 'page-attributes'                 ),             )         );     }      What i need/want is this type of URL structure:               /city-name/      and               /city-name/service-type/      Using this method: http://www.markwarddesign.com/2014/02/remove-custom-post- type-slug-permalink/ i was able to get just /city-name/ to show with no further conflicts. However, the child-page of "city-name" just goes 404.               // Remove the slug from published post permalinks. Only affect our CPT though.     function vipx_remove_cpt_slug( $post_link, $post, $leavename ) {         if ( ! in_array( $post->post_type, array( 'service_locations' ) ) || 'publish' != $post->post_status )             return $post_link;         $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );         return $post_link;     }     add_filter( 'post_type_link', 'vipx_remove_cpt_slug', 10, 3 );          function vipx_parse_request_tricksy( $query ) {         if ( ! $query->is_main_query() )             return;              if ( 2 != count( $query->query )             || ! isset( $query->query['page'] ) )             return;              if ( ! empty( $query->query['name'] ) )             $query->set( 'post_type', array( 'post', 'service_locations', 'page' ) );     }     add_action( 'pre_get_posts', 'vipx_parse_request_tricksy' );      Another issue i'm seeing is that this will ONLY work if you've set your permalink structure to /%postname%/, but because the site will also have a blog the potential for conflicts increases greatly. Ideally, i'd like to be able to show all blog posts as /blog/some-post-name/ and have my city pages and their respective service type child-pages show as above. Any help here is greatly appreciated.


Primary and Secondary Button Classes

I'm trying to style some buttons in a function (below) with the default WordPress button classes but the buttons are not being displayed (only the hyperlinked text is showing). I also tried deactivated all plugins and switching to a default WP theme to see if the buttons would display, but this issue still persists. So perhaps there's an issue with the `a` tags or the classes themselves? Here's the function:               add_filter( 'upme_profile_edit_bar','upme_profile_edit_bar', 10, 3 );     function upme_profile_edit_bar( $edit_buttons , $id, $params ) {         $edit_buttons .= 'Custom Button 1';            $edit_buttons .= 'Custom Button 2';         return $edit_buttons;     }      Thanks for any assistance.


List child categories from parent category on custom taxonomy page

I making some updates to a theme I'm currently working on. I've moved a bunch of categories that have custom post items under them into a parent category that's all within a custom taxonomy. e.g.:               Parent Category     -Child Category     --Item     --Item     --Item     -Child Category     --Item     --Item     -Child Category     --Item     --Item     --Item      I'm able to list them out on a `taxonomy-custom-tax-name.php` page, but when I click on the link of the parent category, it's lists all of the items that are associated the children category and not just the children category themselves. e.g.:               --Item     --Item     --Item     --Item     --Item     ...etc.      I'm trying to get it so it just lists out the children categories with a link to then go to a page with the items attached to that category: e.g.:               -Child Category     -Child Category     -Child Category     -Child Category      I'm currently using this loop on the custom taxonomy page: `<?php global $query_string; query_posts( $query_string . '&posts_per_page=-1' ); if (have_posts()) : while (have_posts()) : the_post(); ?>` I'm not sure if I need to change up my loop statement or if I need to create a `if else` case statement? I've already tried creating separate custom taxonomy pages as well as a separate category page with the parent category name and it's still not working the way I'm try to get it to. I hope that makes sense. This is the first time for me really diving into custom taxonomies so I'm trying to wrap my head around the logic and it seems like there is more than one way to get everything to display correctly.


Problem passing id-specific objects to javascript via wp_localize_script

I'm using wp_localize_script to pass multiple arrays of data into a javascript file. To differentiate between the different arrays (and prevent overwriting), they are labelled relative to the post id from which they originated. The objects I need to use in the js file are like this, for example:               playlist150.tracks     playlist257.tracks      I have set DOM elements to match the object name, for example:

      Within the javascript file, I have the following:               jQuery(document).ready(function($) {            $('.playlist-item').each(function() {              var playerId = $(this).attr('id');              var music = new jPlayerPlaylist({           playerId.tracks         });                  });          });      The problem I am having is that whilst the value of playerId is equal to the name of the objects passed into the javascript file (in this case, playlist150 or playlist257), it does not work as a substitute. I must be missing some basic concept of javascript objects here, please help!


Using shortcodes that wrap around code

I'm using a membership plug in that requires me to wrap protected pages in a short code `[private]content[/private]` I want to use this code in my template so my client doesn't have to manually insert it into the posts/pages. Codex explains to use the following example if there is an opening and closing code like I have.                echo do_shortcode('[iscorrect]'.$text_to_be_wrapped_in_shortcode.'[/iscorrect]');      Now, I have a lot of content to wrap, including HTML + PHP elements. Is there an easier way to wrap my templates than by having to re-format all my code to go inside this echo?


Using Nonce for my Form

Essentially I need to verify my data using a nonce, but I'm not sure that I'm doing it right. What I'm trying to do is remove a menu option for a user that isn't an admin. If a checkbox is checked and the form is submitted, that menu item will be removed for anyone that cannot manage options. EDIT: Got my code posted here instead of Gist:               <?php     /*     Plugin Name: Developer Mode Tools 02     Author: Tyler Gerig     Version: 1.1     Description: Add developer mode options to your wordpress installation.     License: GNU General Public License v2 or later     */          function pretty_dump($dump){             echo '
';             var_dump($dump);             echo '
';     }          /**     *Add an options page for the plugin.     *     *@since 1.0.     *     *@return void     */     function check_admin_page(){             $screen = get_current_screen();             //pretty_dump($screen->base);             if($screen->base == 'settings_page_tgdmt_options_page'){                     if($_POST){                                     $menus_to_remove = array();                                     $tgdmt_menus = $_POST;                                     foreach($tgdmt_menus as $tgdmt_menu){                                             if($tgdmt_menu != 'Save Changes'){                                                     $menus_to_remove[] = $tgdmt_menu;                                             }                                     }                                     update_option( 'tgdmt_menu_settings', array_map('sanitize_text_field', $menus_to_remove) );                                     //pretty_dump($menus_to_remove);                     }                  }             if(isset( $_POST[ 'tdgmt_plugin_noncename']) && wp_verify_nonce( $_POST[' tdgmt_plugin_noncename'], plugins_url( __FILE__))){                     echo 'Nonce verified';             }else{                     echo 'Nonce not verified';             }          }     add_action('admin_head', 'check_admin_page');          function tgdmt_remove_menus(){             if(!current_user_can('manage_options')){                     if(get_option('tgdmt_menu_settings')){                             $tgdmt_remove = get_option('tgdmt_menu_settings');                             foreach($tgdmt_remove as $remove){                                     remove_menu_page($remove);                             }                     }             }     }     add_action('admin_menu', 'tgdmt_remove_menus', 11);          function tgdmt_add_options_page(){             //Add new page under the "Settings tab"             add_options_page(                     __( 'Developer Mode Tools Options' ),                     __( 'Developer Mode Tools Options' ),                     'manage_options',                     'tgdmt_options_page',                     'tgdmt_render_options_page'             );     }          add_action( 'admin_menu', 'tgdmt_add_options_page' );               function tgdmt_menu_settings() {         // Register a binary value called ""         register_setting(             'tgdmt_menu_settings',             'tgdmt_menu_settings',             ''         );     }     add_action('admin_init','tgdmt_menu_settings');               function tgdmt_render_options_page(){             ?>

<?php _e( 'Developer Mode Tools Options'); ?>
                     <form action="<?php //plugins_url( 'tgdmt_update_menu.php' , dirname(__FILE__) )?>" method="post">
                             <?php wp_nonce_field(plugins_url(__FILE__), 'tgdmt_plugin_noncename'); ?>                             <?php                             global $menu;                                     //pretty_dump($menu);                                     $i = 0;                                      //if( current_user_can('manage_options')){                                             foreach($menu as $item){                                                          if($item[0] != ''){                                                             $menu_name = trim(str_replace(range(0,9),'',$item[0]));                                                             echo '<input name="menu'.$i.'" type="checkbox" value="'.$item[2].'" ' . checked( 1, '', false ) . ' />'. $menu_name . '
';                                                             $i++;                                                             //echo '<input id="tgdmt_disable'.$i.'" name="tgdmt_disable'.$i.'" type="checkbox" value="'.$item[2].'" ' . checked( 1, $status, false ) . ' />'.__($menu_name, 'tgdmt').'
';                                                     }                                             }                                     ?>                                          <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e( 'Save Changes', 'tgdmt' ); ?>">
                     </form>
             <?php                    }


How can I make a search form that can search taxonomies and posts?

I have a search bar on the homepage of my theme. I want the user to be able to select from a drop down to search for everything, posts, or taxonomies. I looked at the wp_dropdown function, but its meant for searching under a single tag, and not within a taxonomie group. now I just have a html dropdown next to the search form. how can I use the selection from the dropdown to modify the search? Heres the code im working with               <form class="searchform" method="get" action="#">             <fieldset>                 <legend class="hidden">Search form</legend>
                     <input class="search" name="s" type="text" value="Search Here"/>
                 <select name="cat" id="cat" class="postform" style="display: none; ">                     <option value="0" selected="selected">Everything</option>                     <option class="level-0" value="1">People</option>                     <option class="level-0" value="2">Schools</option>                 </select>                 <button value="submit" class="searchBtn">Submit</button>                              </fieldset>         </form>


Set page template for all pages?

I know the page template is set in the wpdb as meta_key = _wp_page_template and meta_value = template.php. How can I write a SQL script to set each post where post_type = 'page' to a specific template? **EDIT:** Based on the comments below, I'll add the detail that I am wishing to "normalize" my pages since some are set to custom templates.


wp_dropdown_categories by date?

Is there any way to specify a time period for wp_dropdown_categories or wp_list_categories or something else...? I want to create a archive page, so that if your in the archive of 2010, you'll see only the categories wich were used in 2010. do i have to write a custom function for this one? if yes, any suggestion where start? tnx for any kind of answer! best regards, kris


Passing POST data from one WP post to another

I'm trying to pass data between two Wordpress posts via POST method from a form/link. However, the second post does not seem to be able to grab the POST data. I'm wondering if it has anything to do with my permalink structure which has no filenames, only directory paths. Page 1 uses the following form to "link" to page 2 while sending data through a hidden field via POST Method:                <form name="offer" action="http://themotoroilevaluator.com/members-blog/motor-oil-bible-special-offer/" method="post" style="padding: 0px; margin: 0px;">         <input type="hidden" name="discount" value="yes">         <INPUT TYPE="image" SRC="/members-blog/wp-content/uploads/2011/12/special-offer.png" HEIGHT="350" WIDTH="550" BORDER="0" ALT="Discount Plus Additional Special Bonus Downloads - Click Here">     </form>      Then, on page 2 I have the following php code which is supposed to grab the data from that hidden field from the POST array:               $discount = $_POST['discount'];      Should be simple enough, but it's not working. I tried placing the exact same code on a standalone php page and had the form post to that page as the "action", and it worked fine. What do I need to do to get this to work in Wordpress? echoing $discount or $_POST['discount'] yields nothing and print_r($_POST) yields an empty array. Any thoughts?


How to programmatically bring back "excerpts" field in post editor in WP 3.1+

My theme uses some custom options fields, like post excerpt, that were removed from the editor screen with WP 3.1 I understand and support the intent to clean up the content workspaces. However, as a result of the 3.1 upgrade, I have had several support requests related to the fields that suddenly disappeared with 3.1 I issued a tech bulletin informing my theme owners of the change and how to get the excerpts field back using the "Screen options" button, but its still an issue for many users. Is it possible, from functions.php, to reset the screen options for a given WP screen? For example, I want to bring back the "excerpts" field to the post editor screen as well as the "Posts" selector when editing/creating "Custom Menus". PS: I understand that these options can be manually configured via "Screen options", but you might be surprised how many users have never seen or used that button :-) We tend to narrowly focus on the elements we are intent on working with at that instant and block out everything else. I do it myself and its human nature. Perhaps what we really need is a little electronic genie that whispers into our ear: > "The field you are looking for, the one that was here before and is now > gone, is behind that little button up there. Click it and you will open up a > new wing of your WordPress world...and you will be better for it"


Wordpress Login/Logout Single Menu Only

I've written this login/logout for my functions.php in my wordpress theme. The problem is, it's showing a login/logout link in all menus both primary and secondary. Is there a way to get it to appear only in secondary?               add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);     function add_login_logout_link($items, $args) {              ob_start();         wp_loginout('index.php');         $loginoutlink = ob_get_contents();         ob_end_clean();              $items .= '
'. $loginoutlink .'
';          return $items;     }      This is what I ended up using:               add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);     function add_login_logout_link($items, $args) {     if( $args->theme_location == 'top-menu' ) {         ob_start();         wp_loginout('index.php');         $loginoutlink = ob_get_contents();         ob_end_clean();         $items .= '
'. $loginoutlink .'
';     }     return $items;     }


RSS feed showing deleted post

I'm having issues with the RSS feed on the blog I just set up. When I go to /feed, I see an old post that I've since deleted. But when I go to /?feed=rss (which redirects to /feed/rss), I see the correct feed. Additionally, after after signing in as admin, /feed returns the expected result. I'm confused as to where the "incorrect" feed is coming from. Is it being cached somewhere? FYI I'm on 3.01, and the message "An automated WordPress update has failed to complete - please attempt the update again now." shows up in the dashboard. When I try to re-install 3.01, as the message suggestions, it hangs forever. Thanks!


Show Different Custom Menu on Different Category Pages

I have been using in_category function to display a set of menu on the sidebar. However, a much better way would be to show this menu on the top, as a navigation menu -- in the form of custom menus. Question: I already have a custom menu, but is there a way I could replace this custom menu with another one whenever a reader visits a post from a particular category? Example: On homepage, this is the menu: Home | Cat | Dog On a post tagged with CAT category, this is the menu: Home | Cat 1 | Cat 2 From my understanding, this is the current code:               if ( function_exists('wp_nav_menu') ) {     add_theme_support( 'nav-menus' );     register_nav_menus( array( 'primary-menu' => __( 'Primary Menu', 'woothemes' ) )    );     register_nav_menus( array( 'top-menu' => __( 'Top Menu', 'woothemes' ) ) );     }      And...               <?php     if ( function_exists( 'has_nav_menu' ) && has_nav_menu( 'primary-menu' ) ) {         echo '
' . woo_get_menu_name( 'primary-menu' ) . '
';         wp_nav_menu( array( 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'main-nav', 'menu_class' => 'nav fl', 'theme_location' => 'primary-menu' ) );     } else {     ?>
             <?php             if ( get_option( 'woo_custom_nav_menu' ) == 'true' ) {                 if ( function_exists( 'woo_custom_navigation_output' ) ) { woo_custom_navigation_output( 'name=Woo Menu 1' ); }             } else { ?>                      <?php if ( is_page() ) { $highlight = 'page_item'; } else { $highlight = 'page_item current_page_item'; } ?>                 <li class="<?php echo esc_attr( $highlight ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php _e( 'Home', 'woothemes' ); ?>
                 <?php wp_list_pages( 'sort_column=menu_order&depth=6&title_li=&exclude=' ); ?>             <?php } ?>
     <?php } ?>


Getting Rid of the WordPress.com Toolbar on Other Sites?

I recently started a WordPress blog, and now I get an ajax-loaded toolbar showing up at the top of tonnes of pages. It's all links to my WordPress accounts and blogs and stuff. It's fine that it shows up when I'm on WordPress or working with my blog, but I see it now on all sites that (I'm presuming) are built on WordPress.com). i.e. failblog.org. Is there any way to turn off this toolbar? ![Screenshot of WordPress.com Toolbar](http://i.stack.imgur.com/Vw39N.png)


Conditionally Query Custom Post Types by Post Meta for Blog Home Page?

_( **Moderator's note:** The question's original title was: "Custom query: Show custom post types plus custom post type with post meta on blog homepage")_ I'm in need of help with a custom query. I have three custom post types: _"News"_ , _"Events"_ , _"Stories"_. On the main blog page, only News and Events will show. The client can choose to mark a Story _as_ News using features of the plugin Verve Meta Boxes. If a Stories post has a post meta key of `'mark-as-news'` then the that post should display on the main blog page as well. So what I need help with writing is this: > If Stories has post meta `'mark-as-news'` then the main blog page will > display custom post types News and Events, as well as Stories, in descending > order. Can someone please assist? Thanks! ### Edit: Perhaps a better way of wording this would be?: > Show custom post types News and Events, and if there is the key `'mark-as- > news'` for `post_meta`, show Stories.


Trouble with get_next_post() get_previous_post() returning null

I'm using wp as an engine to put blog features in an existing site. I have a place in the blog page where I load `wp-load.php`. I want to get the next and previous posts, but when I load a post from from wpdb, both `get_next_post()` and `get_previous_post()` both return `NULL`. What do I need to do to get those functions to return the proper values? **Edit** Here's the code:               if ( isset($_GET['article_id']) && is_numeric($_GET['article_id']) ) {              $id = $_GET['article_id'];         $objPost = get_post($id);              new dBug(get_next_post());         new dBug(get_previous_post());      } `dBug` is a pretty-printing class. Currently it gives two `NULL`s. I tried this:               if ( isset($_GET['article_id']) && is_numeric($_GET['article_id']) ) {              $id = $_GET['article_id'];         $objPost = get_post($id);         setup_postdata($objPost);         new dBug(get_next_post());         new dBug(get_previous_post());      } but no luck. Still `NULL`.


How do I make a theme "plugin-ready"?

How do I revise a theme so that I can publish my event hooks and anyone can build a plugin to add new functionality easily to my theme?


Use the user_activation_key for other purposes

I need to know if it is safe to use `user_activation_key` (from `WP_User`) for other purpose like email verification (a functionality that I would be creating that would send an email verification first before activating the account created)? So here's how things will work. A user will register using my custom registration form which will be available only on front-end. Upon successful registration, the user will be notified via email that the account has been created along the activation link that is created upon registration using the following convention: `http://www.example.com/verify/?key=SAMPLEACTIVATIONKEY4321` Do you think this will be safe?


Custom rewrite rule is not picked by Wordpress

I am trying to create a custom Rewrite URL something like               function add_my_rule() {             global $wp;          $wp->add_query_var('state');            $wp->add_query_var('state_destination');         add_rewrite_rule('destination/([0-9]+)/([^/]*)/page/([0-9]+)','index.php?pagename=destination&state=$matches[1]&state_destination=$matches[2]&paged=$matches[3]','top');         add_rewrite_rule('destination/([0-9]+)/([^/]*)','index.php?pagename=destination&state=$matches[1]&state_destination=$matches[2]','top');         global $wp_rewrite;         $wp_rewrite->flush_rules();     }     add_action('init', 'add_my_rule');      Idea is to rewrite all URL which have following pattern               www.abc.com/destination/state/state-destination      I have a custom template destination.php and i want all such URL's to be handled there.I have done same in past and that is working fine but now it does not seems working at all as for the given URL               http://localhost/xxx/destination/himachal-pradesh/dalhousie      it always going to `single.php` and not to `destination.php`.I tried to flush the cache and even browser one but seems like either my rewrite Rule is not correct or there is some other issue. Any help in this will help me to move ahead. As an added information my current URL-Structure in WordPress is `/%year%/%monthnum%/%postname%.html` i am using WAMP Server with mode-rewrite enable.


Order Posts by Taxonomy and Meta Value

It's possible to order posts by Meta Value. It's possible to order posts by more than one value. And thanks to the code below it's possible to order by taxonomy. But how can I alter the code below to order by **taxonomy AND meta_value**? **Added to functions.php**               function orderby_tax_clauses( $clauses, $wp_query ) {     global $wpdb;     $taxonomies = get_taxonomies();     foreach ($taxonomies as $taxonomy) {         if ( isset( $wp_query->query['orderby'] ) && $taxonomy == $wp_query->query['orderby']     ) {                 $clauses['join'] .=<<<SQL     LEFT OUTER JOIN {$wpdb->term_relationships} ON {$wpdb->posts}.ID={$wpdb-    >term_relationships}.object_id     LEFT OUTER JOIN {$wpdb->term_taxonomy} USING (term_taxonomy_id)     LEFT OUTER JOIN {$wpdb->terms} USING (term_id)     SQL;                 $clauses['where'] .= " AND (taxonomy = '{$taxonomy}' OR taxonomy IS NULL)";                 $clauses['groupby'] = "object_id";                 $clauses['orderby'] = "GROUP_CONCAT({$wpdb->terms}.name ORDER BY name ASC) ";                 $clauses['orderby'] .= ( 'ASC' == strtoupper( $wp_query->get('order') ) ) ?     'ASC' : 'DESC';             }         }         return $clauses;     }              add_filter('posts_clauses', 'orderby_tax_clauses', 10, 2 );      **Added to index.php**               <?php $args = array(     'post_type' => 'custom_post_type',     'posts_per_page' => -1,     'meta_key' => '_EventStartDate',     'orderby' => 'taxonomy_cat',     'order' => asc     );     $the_query = new WP_Query( $args );          if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query-    >the_post(); ?>          etc. etc.      **Changing this doesn't work**               'orderby' => 'taxonomy_cat meta_value',


Calling the Next category link on an archive page - Wordpress

I've been working on creating a link in my header, should say "see _enter next category name here_ " I've been using this code, found here (I would comment again to ask directly on that question, but I'm not allowed)                   function get_adjacent_category($category_slug,$taxonomy,$type){     global $wpdb;     if($type=="next"){         $operater=" > ";         $orderby=" ORDER BY tt.`term_id` ASC ";     }else{         $operater=" < ";         $orderby=" ORDER BY tt.`term_id` DESC ";     }     $query="SELECT *,(SELECT `term_id` FROM wp_terms WHERE `slug`='".$category_slug."') AS given_term_id,         (SELECT parent FROM wp_term_taxonomy WHERE `term_id`=given_term_id) AS parent_id         FROM  `wp_terms` t         INNER JOIN `wp_term_taxonomy` tt ON (`t`.`term_id` = `tt`.`term_id`)         HAVING  tt.taxonomy='".$taxonomy."' AND tt.`parent`=parent_id AND tt.`term_id` $operater given_term_id $orderby LIMIT 1";     return $wpdb->get_row($query);              }              $next_category =  get_adjacent_category($slug,$taxonomy,"next");         $previous_category =  get_adjacent_category($slug,$taxonomy,"previous");      and while I'm not getting an errors, it's not pulling the next category up for me. Just a blank space. Here's the code I'm using to call the function:
See<?php get_adjacent_category($slug,$taxonomy,"next"); ?>
      Am I calling it incorrectly? If it helps, I'm working with Thesis theme, and here's the website I'm working with. I'm trying to place it on an archive page, mirroring to the "back to blog" link at the top. Any insight would be greatly appreciated!!


Get my site session in wordpress?

I am using a custom site build in zend frameword, i also have a wordpress installed in this directory, for example:               www.mywordpressSite.com // here is my wordpress site..     www.mywordpressSite.com/frameWorkSite // here is my framework site..      All i need to get a framwork session inside wordpress theme, i tried by accessing direcct like,               $_SESSION['userId'];      I tried by making a class in framework and by including this in my wordpress site, but in vain.. Any helpful idea is greatly appreciated..


Should I host support forum on wordpress.org or my own website?

I have a Wordpress plugin WP Pipes hosted at http://wordpress.org/plugins/wp- pipes/. I see that it is convenience for users to ask question right in the support page at http://wordpress.org/support/plugin/wp-pipes, but it will be a pain when we have lots of topics in there. Is there anyone here have experience about that? Should we offer support service right there in wordpress.org or host it in our own website? Any help would be appreciate. PS: I posted this question on stackoverflow but not has much answers for it.


wp-cron still running even though DISABLE_WP_CRON is true

I have created a cron job to run wp-cron.php for me but I am seeing in my FPM logs where it's still running. From what I understand, is that with the cron job it wouldn't be hitting FPM to create any logs. Is there a way to trace this and figure out whats running the file?


appointment plugin doesn't display all appointments

I'm trying to create a appointment plugin, and so far it is working that I can create appointments and see the detail view from the appointment. The problem is, on a page called "appointments" where I wan't to list all appointments, nothing is displayed. I also would like to know, how I can modify the way all appointments are styled. I would like to have it placed in 4 columns. I know the markup for this columns, but I don't know where I have to modify the plugin. Here are the 5 files from my plugin: termine.php               <?php          /**      * Plugin Name: Termine      * Description: Terminverwaltung für Wordpress      * Author: Me      * Version: 1.0      */              setlocale(LC_ALL, 'de_DE.UTF-8');         require_once('posttype.php');         require_once('datumsbox.php');         require_once('termineansicht.php');         require_once('seite.php');          ?>      posttype.php               <?php               add_action('init','post_type_termine');              function post_type_termine(){                  register_post_type(                 'termine',                       array(                     'labels' => array(                         'name' => 'Termine',                         'singular_name' => 'Termin',                         'add_new_item' => 'Neuen Termin anlegen'                     ),                     'public' => true,                     'show_ui' => true,                          'supports' => array(                         'title','excerpt','editor','thumbnail','custom-fields'                     )                 )                  );              }          ?>      datumsbox.php (used to place a box with appointment-details in the backend)               <?php              add_action('add_meta_boxes','nw_termine_addmetaboxes');              add_action('save_post','nw_termine_savedata');              function nw_termine_addmetaboxes(){                  add_meta_box(                 'termine_metabox',                 'Datum und Ort',                 'termine_datumsbox',                 'termine',                 'normal',                 'high'             );              }              function termine_datumsbox(){                  wp_nonce_field('termine_action', 'termine_name');                       echo 'Tag: ';              $wert1=get_post_meta(get_the_ID(), '_tag',true);             echo '<input type="number" step="1" min="1" max="31" id="myplugin_new_field" name="myplugin_field1" value="'.$wert1.'" style="width:4em"/>';                  echo 'Mon.: ';              $wert2=get_post_meta(get_the_ID(), '_monat',true);             echo '<input type="number" step="1" min="1" max="12" id="myplugin_new_field2" name="myplugin_field2" value="'.$wert2.'" style="width:4em" />';                    echo 'Jahr: ';              $wert3=get_post_meta(get_the_ID(), '_jahr',true);             echo '<input type="number" step="1" min="2011" max="2020" id="myplugin_new_field3" name="myplugin_field3" value="'.$wert3.'" style="width:5em"/>';                  echo '
Stunde: ';             $wert4=get_post_meta(get_the_ID(), '_stunde',true);             echo '<input type="number" step="1" min="0" max="23" id="myplugin_new_field4" name="myplugin_field4" value="'.$wert4.'" style="width:4em"/>';                    echo 'Min.: ';             $wert5=get_post_meta(get_the_ID(), '_minute',true);             echo '<input type="number" step="1" min="00" max="59" id="myplugin_new_field5" name="myplugin_field5" value="'.$wert5.'" style="width:4em"/>';                    echo '
Bis: ';             $wert7=get_post_meta(get_the_ID(), '_bis',true);             echo '<input type="text" id="myplugin_new_field7" name="myplugin_field7" value="'.$wert7.'" /> (beliebiger Text)';                     echo '

Adresse für Google Maps:
';              $wert6=get_post_meta(get_the_ID(), '_geo',true);             echo '<input  id="myplugin_new_field6" name="myplugin_field6" value="'.$wert6.'" style="width:90%" />';                     echo '

Angezeigte Adresse:
';              $wert8=get_post_meta(get_the_ID(), '_geoanzeige',true);             echo '<input  id="myplugin_new_field8" name="myplugin_field8" value="'.$wert8.'" style="width:90%" />';                 }                   function nw_termine_savedata($post_id){                  if( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return false;             if( !current_user_can('edit_post', $post_id) ) return false;             if ( !wp_verify_nonce($_POST['termine_name'],'termine_action') ) return false;                       update_post_meta($_POST['post_ID'], '_tag', $_POST['myplugin_field1'], false);             update_post_meta($_POST['post_ID'], '_monat', $_POST['myplugin_field2'], false);             update_post_meta($_POST['post_ID'], '_jahr', $_POST['myplugin_field3'], false);             update_post_meta($_POST['post_ID'], '_stunde', $_POST['myplugin_field4'], false);             update_post_meta($_POST['post_ID'], '_minute', $_POST['myplugin_field5'], false);             update_post_meta($_POST['post_ID'], '_geo', $_POST['myplugin_field6'], false);              update_post_meta($_POST['post_ID'], '_bis', $_POST['myplugin_field7'], false);             update_post_meta($_POST['post_ID'], '_geoanzeige', $_POST['myplugin_field8'], false);                  $zeitstempel=mktime((int) $_POST['myplugin_field4'],(int) $_POST['myplugin_field5'],0,(int) $_POST['myplugin_field2'],(int) $_POST['myplugin_field1'],(int) $_POST['myplugin_field3']);                  update_post_meta($_POST['post_ID'], '_zeitstempel', $zeitstempel, false);              }     ?>      termineansicht.php (detailview of an appointment)               <?php              add_action('the_content','nw_termine_ansicht');              function nw_termine_ansicht( $content ){                  if ( get_post_type() != 'termine') return $content;                  $custom = get_post_custom (get_the_ID());                  $datumsformat = "%A, den %e. %B %G";                  $zeitanzeige = strftime($datumsformat,$custom['_zeitstempel'][0]);                  if(strftime('%R',$custom['_zeitstempel'][0])!='00:00'){                 $zeitanzeige.=strftime(', um %H:%M Uhr',$custom['_zeitstempel'][0]);             }                  if(isset($custom['_bis'][0]) AND $custom['_bis'][0]!=''){                 $zeitanzeige .= ' bis '.$custom['_bis'][0];             }                  $datum='
'.$zeitanzeige.'
';                  $ort='';                  if(isset($custom['_geo']) AND $custom['_geo'][0]!=''){                 $geo=urlencode($custom['_geo'][0]);                      if(isset($custom['_geoanzeige'][0]) AND $custom['_geoanzeige'][0]!='') $adresse=$custom['_geoanzeige'][0];                 else $adresse=$custom['_geo'][0];                      $ort='
Ort: '.$adresse;                 $ort.='';                 $ort.='Auf Google Maps anzeigen »';                 $ort.='
';             }                  return $datum . $content . $ort;              }          ?>      termine.php (a list of all appointments)               <?php          class terminadd{              function rewrite_post($mypost){                  $mypost = stripslashes($mypost);                  if(preg_match("/\[termine\]/",$mypost)){                      $termininfo = "Termin";                      // Hole alle Termine                     // die vergangen sind oder noch kommen                   if(isset($_GET['archiv'])){                     $order='DESC'; $compare='<';                     $title="Vergangene Termine";                 }else{                     $order='ASC'; $compare='>=';                     $title="Kommende Termine";                 }                      $posts = get_posts(                     array('post_type'=>'termine',                             'orderby' => 'meta_value',                             'meta_key' => '_zeitstempel',                             'order' => $order,                             'meta_query' => array(                                     array(                                         'key' => '_zeitstempel',                                         'value' => time(),                                         'compare' => $compare                                     )                             )                         )                 );                            $termininfo = "$title ";                          ob_start();                 global $post;                      foreach ($posts AS $post){                     setup_postdata($post);                     get_template_part( 'content', get_post_format() );                      }                      $mypost = preg_replace("/\[termine\]/",ob_get_contents(),$mypost);                 ob_end_clean();                  }                  return $mypost;         }          }          add_action('the_content', array(new terminadd(), 'rewrite_post'));      I've uploaded these files here: appointment plugin download


User editable blocks per page

I'm pretty sure this question has been asked a million times but I can't seem to find an answer. Imagine a page template with multiple sidebars. What I want the site admin to be able to do is create blocks in Wordpress, this could be an image, text, or both. Each block is assigned to a particular sidebar. The site admin should then be able to edit a page and select which blocks are to appear on that page. I've come across various plugins which allow you to select which widgets appear on which pages, but I can't seem to find anything that would let a user essentially create their own widget within the admin interface, and then select which pages that widget should appear on. So, the solutions I've found so far only half solve the problem. Wordpress Page Widgets is one plugin that kind of does what I want, but although I can select which widgets appear on which page, I can't see to create widgets that are blocks of user created HTML, yes I can drag a 'text' widget into the sidebar and add HTML there, but then you can't really select/deselect that to be visible on different pages. I could resort to creating a plugin to do this, but surely it's a fairly common request?


Calling Function from link in wordpress

I am creating a wordpress plugin in which i have a function               <?php          add_action('init','update_subscription');          function update_subscription($category,$user_name){           update_option($category,$user_name);          }      and in same page i have some links.               Subscribe      i want to call the above function when the link is clicked. how to do that


Two different pages that share the same content?

I have a self-hosted WordPress site. I need to display the same content on two different pages (a contact page and another page used for promotion purposes). They will need to have minor tweaks such as a different heading for the H1 and show two different form fields based on the page. I've used the Advanced Custom Fields plug-in to make it easier for content editors to modify the pages, but I cannot figure out how to just have one place they can go to edit the form fields, sub-text, images, etc. and display this info in two different pages. Can someone help point me in the right direction?


How can I hide media library images from general users?

As an admin I really like the features and functionality of the WordPress 3.5 media manager. With a multi-user site however all users can see all images in the media library - whether uploaded by them or not. Previously a `functions.php` script could mask / restrict access.   For example:               // Hide Media Library tab Tab from each individual agent     function remove_medialibrary_tab($tabs) {         if ( !current_user_can( 'update_core' ) ) {             unset($tabs['library']);             return $tabs;         }    }     add_filter('media_upload_tabs','remove_medialibrary_tab');      This no longer works as I believe the media library is now JavaScript based. **The question:** how can I now hide or mask the WordPress 3.5 media library images from users that did not upload the images in the library? I want users to only see their own images or to only see the images they uploaded to this specific post or page. The current structure and design is great for the likes of a newspaper that wants to share images across their entire organization of users - but not so good for sites that have needs for stricter controls with independent multi- user access. I am not a coder - or am an amateur at best - but it occurs to me that options might include: masking or coding out all attachment filters in the new 3.5 library dropdown menu only leaving the "uploaded to this page" in the list - or - possibly a switch that would allow admins to switch visibility on or off to the media library images for general users. Any guidance or direction on this would be appreciated.


Can't remove Wordpress post image height/width attributes?

I know a few people have asked this question previously; however, I think something may have changed recently in the Wordpress update. I'm building my own responsive theme for my portfolio, and for embedded post images I have added a filter to functions.php to remove the height/width attribute that Wordpress adds to the image automatically. I have used this filter before on other sites therefore I know it should work. However, no matter what I try I can't get Wordpress to embed the image without the height/width attributes, meaning the image doesn't resize on mobiles/tablets. Demo for the image in question is here: http://demo.iamdannygreen.com/cients/dragonfly-pr/ Any help would be greatly appreciated. Thanks Danny


hide specific categories from showing

I'm trying to hide specific categories from showing up on a portfolio home page. I was told that this was the concerned line of code on the php template file               <?php the_terms($post->ID, 'skill-type', '', ', ', ''); ?>      but there is no way to exclude certain types from this function by default. I would need to create a custom function in order to do so. since I don't know much about php, I was thinking maybe some kind of expert could help me over here ? thanks


Trying to show link "Use as featured image" from Attachment window from t31os script

i found this great script from **t31os** that give me the chance to hide fields and buttons when we have to add images on a post in wordpress.               function myAttachmentFields($form_fields, $post) {     // Can now see $post becaue the filter accepts two args, as defined in the add_fitler     if ( substr( $post->post_mime_type, 0, 5 ) == 'image' ) {         $form_fields['image_alt']['value'] = '';         $form_fields['image_alt']['input'] = 'hidden';              $form_fields['post_excerpt']['value'] = '';         $form_fields['post_excerpt']['input'] = 'hidden';              $form_fields['post_content']['value'] = '';         $form_fields['post_content']['input'] = 'hidden';              $form_fields['url']['value'] = '';         $form_fields['url']['input'] = 'hidden';              $form_fields['align']['value'] = 'aligncenter';         $form_fields['align']['input'] = 'hidden';              $form_fields['image-size']['value'] = 'thumbnail';         $form_fields['image-size']['input'] = 'hidden';              $form_fields['image-caption']['value'] = 'caption';         $form_fields['image-caption']['input'] = 'hidden';              $form_fields['buttons'] = array(             'label' => '',             'value' => '',             'input' => 'html'         );         $filename = basename( $post->guid );         $attachment_id = $post->ID;         if ( current_user_can( 'delete_post', $attachment_id ) ) {             if ( !EMPTY_TRASH_DAYS ) {                 $form_fields['buttons']['html'] = "" . __( 'Delete Permanently' ) . '';             } elseif ( !MEDIA_TRASH ) {                 $form_fields['buttons']['html'] = "" . __( 'Delete' ) . "
" . sprintf( __( 'You are about to delete %s.' ), $filename ) . "                          " . __( 'Continue' ) . "                          " . __( 'Cancel' ) . "
";             } else {                 $form_fields['buttons']['html'] = "" . __( 'Move to Trash' ) . "" . __( 'Undo' ) . "";             }         }         else {             $form_fields['buttons']['html'] = '';         }     }     return $form_fields;     }     // Hook on after priority 10, because WordPress adds a couple of filters to the same     hook - added accepted args(2)     add_filter('attachment_fields_to_edit', 'myAttachmentFields', 11, 2 );      But one thing is missing the **Use as featured image** link is not appearing. Is someone have an idea on how i can make appearing the link **Use as featured image** beside the delete link? It is the only thing missing from this great script but i'm not a php expert i try to figure it out but didn't find the soluiton. Thank for any help. Regards


How to get comments by post ID?

I have this custom post query to list all the posts within a specific category. For example I have this:               $args = array('cat' => 'home','post_type' => 'post'));     $post_obj = new WP_Query($args);     while($post_obj->have_posts() ) : $post_obj->the_post();      // do stuff here     endwhile;      So for this page I would like to show the list of posts but also the accompanying comments. I am only showing maximum 2 comments for each post. Is there a built in function to do this?


How can I default a new post to being saved?

I'm trying to figure out how to make it so that as soon as the post-new.php page for a custom post type is loaded, the post is saved. Basically, I'm trying to make sure the post has it's postID saved before anyone even starts entering anything. I suppose I could probably "fake-click" the "Save Draft" button, but I'm wondering if there's a more legit way to handle it.


Posting as different users

I'll try to make this brief. I am a webmaster for a newspaper and in a single day i am uploading an issue of the paper where there are multiple authors to several articles. Question is: how do i make a post and display a custon author name without having to log into a different user just to get it to display correctly. I really want to be able to do this all from one admin account. Thanks folks i really appreciate any help!


truncate post with gallery tag

I have one problem I use this function for truncate posts               function truncate_post($amount,$quote_after=false) {     $truncate = get_the_content();     $truncate = apply_filters('the_content', $truncate);     $truncate = preg_replace('@<script[^>]*?>.*?</script>@si', '', $truncate);     $truncate = preg_replace('@<style[^>]*?>.*?</style>@si', '', $truncate);     $truncate = strip_tags($truncate);     $truncate = substr($truncate, 0, strrpos(substr($truncate, 0, $amount), ' '));     echo $truncate;     echo "...";     if ($quote_after) echo('');     }      but in my posts there is wordpress gallery call               [gallery ids="614,592,591"]      And now I need this truncate to not calculate this gallery tag.. because I get empty fields.. is this can be done? to truncate just text...


Anyone can recognize the current Wordpress backend, but I don't want that. I want to change it using my own design and I want to have a seamless navigating experience for my users. How can I change the dashboard appearance? I googled a lot of posts and questions, and it seems like you can only change the CSS of most things and some people were using hooks to add their own code and what not.


Wordpress Genesis Child Theme Filter divs

I'm trying to html5ize a Genesis child theme. So far I've figured out how to replace the Doctype via hook but am having trouble figuring out how i can change the divs to sections and articles without touching the core files. Can anyone point me in the right direction?


Twitter links in widget don't work?

I am displaying a twitter feed on my homepage: http://www.fairwaterrights.com The feed works fine. But if I click on a link in the twitter post, it doesn't open. For instance, instead of opening `http://bit.ly/lNWyT9` in the browser, it tries to open `http://www.fairwaterrights.com/%22http:/bit.ly/lNWyT9%22`. How can I fix this? Here is the code:               <?php     $username = "fairwaterrights"; // Your twitter username.     $limit = "4"; // Number of tweets to pull in.          /* These prefixes and suffixes will display before and after the entire block of tweets. */     $prefix = ""; // Prefix - some text you want displayed before all your tweets.     $suffix = ""; // Suffix - some text you want displayed after all your tweets.     $tweetprefix = "@fairwaterrights "; // Tweet Prefix - some text you want displayed before each tweet.     $tweetsuffix = "

"; // Tweet Suffix - some text you want displayed after each tweet.          $feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=" . $limit;          function parse_feed($feed, $prefix, $tweetprefix, $tweetsuffix, $suffix) {          $feed = str_replace("<", "<", $feed);     $feed = str_replace(">", ">", $feed);     $clean = explode("<content type=\"html\">", $feed);          $amount = count($clean) - 1;          echo $prefix;          for ($i = 1; $i <= $amount; $i++) {     $cleaner = explode("</content>", $clean[$i]);     echo $tweetprefix;     echo $cleaner[0];     echo $tweetsuffix;     }          echo $suffix;     }          $twitterFeed = file_get_contents($feed);     parse_feed($twitterFeed, $prefix, $tweetprefix, $tweetsuffix, $suffix);     ?>      Thanks for your help!


Get_Posts, only if in both categories

get_posts('numberposts=5&category=93+85')get_posts('numberposts=5&category=9385') Is there a way to have get_posts grab only posts that are in BOTH categories, as above?


Run javascript code after wp_login hook?

After using the `wp_login` hook, is it possible to add a snippet of javascript code to the page seen immediately after the login in wordpress? I want to use this top implement a notification system that notifies the user when they login.


Getting Different Size Of Attachment Images

I'm confused, because there are a lots of functions about attachments . I've tried a lots of functions. I'm setting a _featured image_ for my every blog post. I have to get different sizes of this image. FOr example a need this variations of _featured image_ 600px*400px 300px*150px 64px*64px (Images can be cropped). I'm adding these new image sizes (in `functions.php`):               add_image_size('custombig', 600, 400, TRUE);     add_image_size('customsmall', 300, 152, TRUE);     add_image_size('customimage', 64, 64, TRUE);      (in `single.php`)                <?php             // inside a Loop             if (has_post_thumbnail( $post->ID ))                 $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'customsmall' );         ?>         <img alt="" src="<?php echo $image[0]; ?>" />      But it's printing full size of image. Not cropping or resizing it. Can you teach me getting different sizes of attached images, or suggest me a few articles about this ?


How do you present WordPress to a designer who is afraid?

I have two groups of talented designers that I am trying to nudge away from doing Dreamweaver sites — AKA static pages that are based on "templates" — and toward WordPress. In both cases I have encountered what I can only describe as fear. This fear seems to be based on (a) a concern that they won't be able to "cut it" in this new world, and (b) that if they are "just" doing the main templates (and not all of the generated pages) they will lose billable hours. I think (a) is a matter of education and I'm working on it, but (b) is harder to answer. I believe that they will be able to address oft-stated customer requests for "editable websites," and that they will be able to bid on sites that require more functionality and dynamic interaction with the user than they have dealt with in the past. **Question:** Does anyone have any studies / examples / success stories / whatever that I can use to show them that WP may actually be a major step forward in their ability to find and please customers? It is important that these be from a _designer's_ point of view. Some of this will be anecdotal, but I'm hoping for something more ... concrete. _After thought:_  I wish I could give out more than one Correct Answer. I felt a bit stupid when I saw _case studies_ because that should have been one of the first things I searched on. I liked the comment about The Loop because it gave me a little insight from a designer's point of view about what might be intimidating. I'm going to look for more of those. Addressing _The Fear_ is a bit more difficult because fear, by it's very nature, is not purely rational. Many people have been deeply traumatized by the recession — watching your billables drop by 75-80% overnight through no fault of your own can make you really nervous about _anything_ changing. I saw this in my parents, who were in their 20's during the Great Depression; fifty years later they still had a sense of scarcity in the world.


wp_register_script not loading as expected

I am loading scripts like this:               //load scripts     //wp_register_script( $handle, $src, $deps, $ver, $in_footer );          add_action('wp_enqueue_scripts', 'load_scripts');          function load_scripts() {              if (!is_admin()) {                  wp_register_script('modernizr', get_bloginfo('template_directory') .'/scripts/modernizr-latest.js',false);             wp_enqueue_script('modernizr');                  wp_enqueue_script('jquery', true );                  wp_register_script('cookie',get_bloginfo('template_directory') . '/scripts/cookie.js', array('jquery'), '1.0',true);             wp_enqueue_script('cookie');                  wp_register_script( 'Gmaps', 'http://maps.google.com/maps/api/js?sensor=false', true );             wp_enqueue_script ('Gmaps');                  wp_register_script('plugins', get_bloginfo('template_directory') .'/scripts/plugins.js',true);             wp_enqueue_script('plugins');                  wp_register_script( 'maps_scripts',  get_bloginfo('template_directory') . '/scripts/maps.js', array('Gmaps'), '1.0', true );             wp_enqueue_script ('maps_scripts');                  wp_register_script('history', get_bloginfo('template_directory') .'/scripts/history.js', array('jquery'), '1.0',true);             wp_enqueue_script('history');                   }     }      With this I expect to see all scripts except modernizr loaded into the footer. Instead it is an incorrect mish-mash. From this example jquery, google maps, and the plugins.js still load in the header even though `$in_footer` is set to true. Cookie, maps, and history load in the footer as expected. Can someone please help explain this to me?


Difference between a theme and a plugin?

I'm curious as to what the specific differences are between a theme and a plugin. I get the gist of it...themes have to do with look and feel (html / css) and plugins have to do with adding functionality (code / php). However, a theme like the popular twitter inspired P2 seems to add functionality...not simply enhance the look and feel. That leaves me a bit confused. Can someone on this rockin exchange enlighten me? Much appreciated. Eddie


Update widget form after drag-and-drop (WP save bug)

I've posted a bug-report about this a few months ago (on WordPress trac (Widget Instance Form Update Bug)) and I thought I'd try writing about it here too. Maybe someone has a better solution to this issue than me. Basically the problem is that if you drop a widget into a sidebar, the widget form doesn't get updated until you manually press save (or reload the page). This makes unusable all the code from the `form()` function that relies on the widget instance ID to do something (until you press the save button). Any stuff like ajax requests, jQuery things like colorpickers and so on will not work right away, because from that function it would appear that the widget instance has not yet been initialized. A dirty fix would be to trigger the save button automatically using something like livequery:               $("#widgets-right .needfix").livequery(function(){       var widget = $(this).closest('div.widget');       wpWidgets.save(widget, 0, 1, 0);       return false;     });      and add the `.needfix` class in `form()` if the widget instance doesn't look initialized:                <div <?php if(!is_numeric($this->number)): ?>class="needfix"<?php endif; ?>        ...      </div>      One drawback of this solution is that if you have lots of widgets registered, the browser will eat lots of CPU, because livequery checks for DOM changes every second (tho I didn't specifically test this, it's just my assumption :) Any suggestions for a better way to fix the bug?


Disabling TinyMCE keyboard shortcuts altogether

I've disabled pretty much every button in the visual editor, besides bold and underline. The problem is that the functionality of the other buttons are still there with the keyboard shortcuts. Is there someway to disable the keyboard shortcuts. I don't need them at all.


Has WP and MU fully merged?

I'd heard that WP and MU were fully merging in WP 3.0. Did this happen? Is it now just a matter of installing the latest version of WP and turning on a multiple blog support switch...or is it more complicated than that? Any insight anyone can provide would be most appreciated. Eddie


Convert existing site to network

We have an existing WP3 site and would like to make it multiuser instead of the multiple installs we have now. I add the "WP_ALLOW_MULTISITE" CODE and relaunch - start the Network and then add the multisite code to wp-config and the .htaccess file. As soon as I do that and log out - it no longer finds a database connection. I noticed on previous attempts that a network database has wp_blogs table, and several other tables, where a standard install doesn't have that- I've checked all our other sites/databases. Is there more to do? We have our main site with another independent install within it that handles press releases. I'm looking to consolidate to one and need the separate permalink structure(the second install puts the posts at /resources/media_center/pr


How to force load a page in plugin?

I have a plugin which do very simple task...               if ( $_SERVER["REQUEST_URI"] === '/foo' )     {        // How to display the content of page of ID = 3, without using wp_redirect()     }      So the url is staying at `/foo`, but show the content of page ID = 3 Any idea?


How do I get /blog on my WordPress multisite

I have a 3.0.1 site with `MULTISITE` enabled and would like one of the sites to live at `/blog`, but when I try to create a new site with that path, I get this error:               The following words are reserved for use by WordPress functions and cannot be used as blog names: page, comments, blog, files, feed      How can I get a site at `/blog`?


How Do I Add Custom CSS To Only Certain Widgets

I have a standard dynamic sidebar using `register_sidebar` and `dynamic_sidebar` and I need the last widget in the sidebar (which will not have a set number of widgets) to have a distinct class (`'last_widget'`) added to the `<li>` that wraps it. What's the best way to do this?


Generate a Menu that Displays Child Pages using wp_list_pages() with the New Menu Functionality in WordPress 3.0?

Previously, I was able to selectively load child pages for a currently- selected parent page using logic such as:               if(  $post->post_parent ) {       $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");     } else {       $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");     }          if ($children) { ?>        <ul id="subnav">          <?php echo $children; ?>        </ul>     <?php      } else {     }      There doesn't seem to be a native way to do this using the new register_nav_menus()/wp_nav_menu() functionality. Anyone know how I could patch this together at this point? Here's a screenshot of what I'm trying to achieve: ![Drop down Child menu screenshot](http://i.stack.imgur.com/WJaXb.png)


Automagic Link Shortening for Non-Hosted WP

Blogs hosted on wordpress.com get automatic link shortening via http://wp.me/, but for those who prefer to seek out our own hosting solution is there a plugin that will, upon publishing a new post/page, make an api call to bit.ly (or other such service) store the resulting url and return it from `wp_get_shortlink()`? I have searched without success. Any help would be appreciated.


Update template without undoing all my edits?

I want to edit a wordpress template to have a look and feel more like I want. With things like my flair on it. After I change the template, does this mean I can no longer update it without reverting my changes?


An array of latest wp_titles

I want to get the latest titles with the_title() in an array so that I can loop through them in my javascript function. How can I create this array? Many thanks!


Converting a simple plugin to be placed inside of functions.php

First off, I know it's better practice to use plugins separately than to integrate them in functions.php but this is for a theme framework that will be deployed to multiple sites and it will be easier to have it packaged as part of the theme. I am having trouble using the following code from the plugin located here. My PHP knowledge is limited, I have tried copying and pasting the code directly but it does not work, but works fine when used as a plugin.               class Filosofo_Custom_Image_Sizes {          public function __construct()     {         add_filter('image_downsize', array(&$this, 'filter_image_downsize'), 99, 3);          }          /**      * Callback for the "image_downsize" filter.      *      * @param bool $ignore A value meant to discard unfiltered info returned from this filter.      * @param int $attachment_id The ID of the attachment for which we want a certain size.      * @param string $size_name The name of the size desired.      */     public function filter_image_downsize($ignore = false, $attachment_id = 0, $size_name = 'thumbnail')     {         global $_wp_additional_image_sizes;              $attachment_id = (int) $attachment_id;         $size_name = trim($size_name);              $meta = wp_get_attachment_metadata($attachment_id);              /* the requested size does not yet exist for this attachment */         if (             empty( $meta['sizes'] ) ||             empty( $meta['sizes'][$size_name] )         ) {             // let's first see if this is a registered size             if ( isset( $_wp_additional_image_sizes[$size_name] ) ) {                 $height = (int) $_wp_additional_image_sizes[$size_name]['height'];                 $width = (int) $_wp_additional_image_sizes[$size_name]['width'];                 $crop = (bool) $_wp_additional_image_sizes[$size_name]['crop'];                  // if not, see if name is of form [width]x[height] and use that to crop             } else if ( preg_match('#^(\d+)x(\d+)$#', $size_name, $matches) ) {                 $height = (int) $matches[2];                 $width = (int) $matches[1];                 $crop = true;             }                  if ( ! empty( $height ) && ! empty( $width ) ) {                 $resized_path = $this->_generate_attachment($attachment_id, $width, $height, $crop);                 $fullsize_url = wp_get_attachment_url($attachment_id);                      $file_name = basename($resized_path);                      $new_url = str_replace(basename($fullsize_url), $file_name, $fullsize_url);                      if ( ! empty( $resized_path ) ) {                     $meta['sizes'][$size_name] = array(                         'file' => $file_name,                         'width' => $width,                         'height' => $height,                     );                          wp_update_attachment_metadata($attachment_id, $meta);                          return array(                         $new_url,                         $width,                         $height,                         true                     );                 }             }         }              return false;     }          /**      * Creates a cropped version of an image for a given attachment ID.      *      * @param int $attachment_id The attachment for which to generate a cropped image.      * @param int $width The width of the cropped image in pixels.      * @param int $height The height of the cropped image in pixels.      * @param bool $crop Whether to crop the generated image.      * @return string The full path to the cropped image.  Empty if failed.      */     private function _generate_attachment($attachment_id = 0, $width = 0, $height = 0, $crop = true)     {         $attachment_id = (int) $attachment_id;         $width = (int) $width;         $height = (int) $height;         $crop = (bool) $crop;              $original_path = get_attached_file($attachment_id);              // fix a WP bug up to 2.9.2         if ( ! function_exists('wp_load_image') ) {             require_once ABSPATH . 'wp-admin/includes/image.php';         }              $resized_path = @image_resize($original_path, $width, $height, $crop);              if (              ! is_wp_error($resized_path) &&              ! is_array($resized_path)         ) {             return $resized_path;              // perhaps this image already exists.  If so, return it.         } else {             $orig_info = pathinfo($original_path);             $suffix = "{$width}x{$height}";             $dir = $orig_info['dirname'];             $ext = $orig_info['extension'];             $name = basename($original_path, ".{$ext}");              $destfilename = "{$dir}/{$name}-{$suffix}.{$ext}";             if ( file_exists( $destfilename ) ) {                 return $destfilename;             }         }              return '';     }     }          function initialize_custom_image_sizes()     {     new Filosofo_Custom_Image_Sizes;     }          add_action('plugins_loaded', 'initialize_custom_image_sizes');      I'm aware I can achieve the same results using TimThumb but I would much prefer to use the built in functionality of WordPress Here's a link to the plugin in question:- http://wordpress.org/extend/plugins/custom-image-sizes/ Thanks in advance! Steve


why doesnt is_home() work in functions.php

I'm pulling in scripts.php through functions.php. this is in scripts.php but for some reason, wordpress isn't recognizing is_home(). i've tried resetting the query, but to no avail. Am I hooking into the right function?               if(is_home()){          function my_scripts_method2() {         wp_register_script('cycle', get_template_directory_uri() . '/js/cycle.js', array('jquery'));         wp_enqueue_script('cycle');     }     add_action('wp_enqueue_scripts', 'my_scripts_method2');          function my_scripts_method() {         wp_register_script('homepage', get_template_directory_uri() . '/js/homepage.js', 'cycle');         wp_enqueue_script('homepage');     }     add_action('wp_enqueue_scripts', 'my_scripts_method');     }


Site Migration to WordPress: Handling Feeds

I'm moving a site hosted with another blogging system to WordPress. This site's RSS feed is hosted at the URL               http://example.com/home?format=rss      I want to ensure that users with this RSS Feed in their feed readers continue to get updates when I move to WordPress. Is there a standard way in stock WordPress to handle this? If not, is there a standard plugin to handle this? If not, how **are** people handling this? Apache redirects? Something else?


Why plugin ajax response is -1?

I do not know why this response me -1 always? I am using this code in my plugin file. i want response on click p tag               <?php    function myajax(){ ?>             <?php         echo'
click
';         }              add_shortcode("my_ajax", "myajax");                   add_action('wp_ajax_stravyfuncajax22', 'testfunc11');         add_action('wp_ajax_nopriv_stravyfuncajax22', 'testfunc11');              function testfunc11() {         echo "2";         die();         }     ?>      **EDIT** : added php tag now....


Nav Walker current menu item not displaying

I'm building a theme on top of a starter theme (wp-bootstrap) and am having trouble getting the Nav Walker to show the current menu item. current-menu- item is not there when I use a web inspector on the output html. So therefore I can't style it. This is the code in my template file:                         <?php            /** Loading WordPress Custom Menu  **/            wp_nav_menu( array(               'menu'            => 'main-menu',               'container' => '',               'container_class' => 'navbar-blue',               'menu_class'      => 'nav',               'menu_id' => 'main-menu',               'walker' => new Bootstrapwp_Walker_Nav_Menu()           ) ); ?>      And this is the code in function.php:               include 'includes/class-bootstrapwp_walker_nav_menu.php';      And finally this is the code from the customer nav walker file:               class Bootstrapwp_Walker_Nav_Menu extends Walker_Nav_Menu {          function __construct() {     }       function start_lvl(&$output, $depth) {          $indent = str_repeat("\t", $depth);     $output .= "\n$indent<ul class=\"dropdown-menu\">\n";       }     }      I've looked over a few stackexchange answers and tried changing the code to match them, but nothing has solved the issue (ie: nothing has made current- menu-item appear in the html output). Any help would be appreciated.


Wordpress custom posts and permalinks

I have a custom post type called "menu" with the following categories   * hotboxes   * salads   * soups   * wraps Code:               register_taxonomy(         'menutype',         array("menu"),         array(             "hierarchical" => true,              "label" => "Menu Categories",              "singular_label" => "Menu Category",              "rewrite" => array( 'slug' => 'menu/type', 'hierarchical'=>'true'),              "show_ui"=>"radio", // used a plugin             "query_var" => true         )     );      Right now if I want to say, show all my "hotboxes" it goes to               http://www.mysite.com/menu/type/hotboxes      But if it shows an _individual_ hotbox it just goes to               http://www.mysite.com/menu/hotbox-single-item      Is there a way to rewrite the url so it says               http://www.mysite.com/menu/type/hotbox/hotbox-single-item      The ideal format I am looking for is:               http://www.mysite.com/custom_post_type/custom_taxonomy/post_name      EDIT: I managed to get the link **looking** like the way I wanted by doing:               function menu_post_link( $post_link, $id = 0 ) {                  $post = get_post($id);                  if ( $post->post_type != 'menu')             {                 return $post_link;               }                  if( $terms = wp_get_object_terms( $post->ID, 'menutype' ) ) {                 $custom_taxonomy = $terms[0]->slug;                 $post_link = str_replace('menu', 'menu/'.$custom_taxonomy, $post_link);             }                       return $post_link;              }         add_filter( 'post_type_link', 'menu_post_link', 10, 2 );      Note: My custom post type is called "menu" and my custom taxonomy is called "menutype". This now creates the permalink I want: http://www.mysite.com/custom_post_type/custom_taxonomy/post_name However it generates a 404 error even after flushing my rewrite rules (Settings > Permalinks > save)


Filter/Sort Post Form On Taxonomy page

I am trying to create a form on the taxonomy template that will be able to filter the posts the current user is viewing. I want to use a few drop downs and submit button to do so. My code looks like this - `               <form method="get" id="searchform" name="searchform" action="<?php echo home_url(); ?>/blog/videoscategory/">               <?php      $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );      if ($term->parent == 0) {       wp_dropdown_categories('taxonomy=videoscategory&hide_if_empty=true&depth=2&show_count=0     &title_li=&child_of=' . $term->term_id);     } else {     wp_dropdown_categories('taxonomy=videoscategory&hide_if_empty=true&show_count=0     &title_li=&child_of=' . $term->parent);      }     ?>               <?php wp_dropdown_categories('show_option_all=All U.S. States&taxonomy=states&depth=2&orderby=name&show_count=1'); ?>     <button tabindex="2" type="submit" class="search_btn">                     </button>     </form>      ` The category pages URL looks like this - http://domain.com/blog/videoscategory/bankruptcy-law/ When I submit the form (using 2 dropdowns - sub category and custom tags taxonomy) the url returns like this - http://domain.com/blog/videoscategory/?cat=273&cat=87 How can I correct this? Or is there a better way about going about using a form to sort posts?


Wordpress Popular posts by view with time range

I am using this code provided here to display popular posts by views count. Code found here http://www.wpbeginner.com/wp-tutorials/how-to-track-popular-posts-by-views-in- wordpress-without-a-plugin/ But now I want to add a time range. I would like to display the popular posts for the day. So count will only be for a day and not overall Thanks


Only first category!

I have a category organized like this:   * sport     * football     * basketball     * volleyball   * news     * economy     * world     * country And I want to display only the _sport_ and _news_ root categories, but I don’t know how.


Enqueue Script After TinyMCE initialized

I am making a small live preview area inside a meta box using jquery where i need to get content from tinymce editor. But it seem my script loads before tinymce, this returns null when i try to get content from editor field. **Enqueue:**               add_action('admin_enqueue_scripts', 'wpk_popup_admin_script', 100);          function wpk_popup_admin_script($hook) {         global $post;         if( 'edit.php' != $hook && $post->post_type != 'wpk_popup'  )             return;              if(is_admin()){             wp_enqueue_script( 'jquery' );                  wp_register_script( 'wpk-popup-admin', plugins_url('/js/admin.js', __FILE__), array('jquery'), false, true);             wp_enqueue_script( 'wpk-popup-admin' );         }          }      Tried adding `editor` on dependency but its no use. The script prints just before the tinymce configuration. ![enter image description here](http://i.stack.imgur.com/1uy1L.jpg) **jQ Code for getting editor content:**               html += jQuery('#content_ifr').contents().find('#tinymce').html();      Which returns `NULL`. **Resolved:** Thanks to @birgire, I was able to solve the problem. Here is the final code.               add_action( 'after_wp_tiny_mce', 'custom_after_wp_tiny_mce' );     function custom_after_wp_tiny_mce() {         printf( '<script type="text/javascript" src="%s"></script>',  plugins_url('/js/admin.js', __FILE__) );     }      For Getting or Inserting data I prefer to use tinymce api instead of jquery hack. So, **Getting Data**               var content = tinyMCE.activeEditor.getContent();      **Inserting Content**               tinymce.activeEditor.execCommand('mceInsertContent', false, 'Text to insert goes here')


How to detect when a file has been uploaded?

I'm trying to analyze a file after it has been uploaded using a custom file upload field (ACF). Is there a way to do this using a hook? If not using a hook then maybe theres a Javascript event?


wordpress custom fields multiple data

i need help with wordpress custom fields currently i store date in one custom field called audio using the "," and "$" example: name, link $ name, link $ etc i have managed to use the data and split the data using php in my theme i.e the playlist. i just need help in creating a custom metabox with 2 text fields that can be duplicated by clicking on adding more and two more fields would show. i only want to use only one custom field to store the data. thanks


Dismiss Admin Pointer Temporarily

I have a custom meta field for a page that contains a future date. I'm wanting to make sure this is always a future date and have decided the best way to do so is by creating an admin pointer if the date is in the past. The only problem is the default way to close the pointer sets `user_meta_data` I want to use a cookie instead and nag the user daily until the date is changed. Okay here is some code examples:               add_action( 'admin_enqueue_scripts', 'nifty_admin_enqueue_scripts' );     function nifty_admin_enqueue_scripts() {         // Using Pointers         wp_enqueue_style( 'wp-pointer' );         wp_enqueue_script( 'wp-pointer' );              // Register our action         add_action( 'admin_print_footer_scripts', 'nifty_admin_print_footer_scripts' );     }          function nifty_admin_print_footer_scripts() {         $pointer_content = '
Meetings are are of date
';         $pointer_content .= '
It seems that next meeting date is in the past. Please update this setting.
';     ?>          <?php     }      If you look at the admin-ajax.php you can see the `dismiss-wp-pointer` defined and follow the white rabbit back to where it sets the meta data. I'm thinking there has to be a way to use a cookie instead. Any thoughts would be appreciated. **EDIT:** Originally I was thinking I would need to do this using a cookie, but now that I think about it more I see that this is only ONE option. I've outlined some others below in hopes that someone will have an idea how to do them.   1. Use 2 user meta values one that has the date they last closed it and one has the reset value   2. Use `wp_cron` and delete the key value each day   3. Have the date be part of the key value (ie nifty_$epochtime) then loop through user meta data and split the nifty key on `_` and check the date with current date.    4. Orignal way use a cookie instead.  The only problem is I don't know how to do any of these or which one would work best.


Display Only Certain Category In a Custom Page Template

I have a **Page** in Wordpress that is a **Blog Page Template**. Now my issue is that it displays ALL the posts. I only want it to display posts assigned to a certain **category** How do I do that? Here is my blog.php page: I guess you have to edit it here right?               /*     Template Name: Blog page     */          $gogo_blog_text_no_posts = get_post_meta($post->ID, 'gogo_blog_text_no_posts', true);          $temp = $wp_query;     $wp_query= null;     $wp_query = new WP_Query();     $wp_query->query('posts_per_page='.$gogo_blog_text_no_posts.'&paged='.$paged);      $postcount = 0;     while ($wp_query->have_posts()) : $wp_query->the_post(); $postcount++;          //the loop goes here          $wp_query= null;     $temp = $wp_query;     ?>


Add image size array to a portfolio thumbnail in combination with Masonry Jquery Plugin

add_image_size( 'category-thumb', 250, 9999 ); //300 pixels wide (and unlimited height)      I am using the above code within my functions.php file, to generate various thumbnail sizes for my masonry portfolio theme.               <?php the_post_thumbnail(); ?>      Can the above take an array of images within this to randomise the images that is displayed within the grid? Thanks Kirsty


Wordpress in "Couch Mode"?

I am trying to setup a "Couch Mode" (distraction free reading) on my WordPress blog as laid out in this article. The guide in the article follows these steps:   1. Create a new page in WordPress with slug `read`   2. Add the following rewrite rule at the top of the _.htaccess_ file: `RewriteRule ^read/([0-9]+)/?$ /read/?u=$1 [QSA,L]`   3. Save this file as _page-read.php_   4. Add this link to to single.php of my theme using `<?php the_ID(); ?>` I did everything as per the article but when I click the "Read story without the clutter" link on my posts it throws an error: > Not Found > > The requested URL /read/761/ was not found on this server. My local development wordpress installation is: `localhost/techylab/` While the post where I am trying this Couch Mode is: `localhost/techylab/761/something`


Duplicating/Cloning Multiple Form Fields

Not sure what to call this one, but I am working on a form that asks for product information (name, description, color, features, etc.) but what I'd like to do is give users the option to add additional products by clicking on a link. They could add as many products as they need. After they finish entering information they could click a link that states `"Add another product"` or something similar and the form would give them a whole set of new fields that they could fill out. Through the same form, the page would grow as the items are added and it would be part of the same form (instead of having to submit the form over and over again on a per-product basis). I hope I'm making sense, does anyone know what the term is for this or have any recommendations on a plugin that could do something like this? Magic fields can do this but on the back-end not the front-end. ![enter image description here](http://i.stack.imgur.com/wCVXZ.png)


A attachment file with a php form in wordpress?

I am making a PHP form in **WordPress**. I would like to receive a **notepad or PDF** file along this form when user submit form. I am getting all this in email using mail function in a body variable for example:               $body =" Attachment: $CV ";      Instead of file I am receiving **file name that user uploading** instead of **file**. I am trying to receive file in email. Actually I am learning too that how to do it. My PHP code for assigning to HTML file tag is:               if(trim($_POST['CV']) === '') {     $CVError = 'Please enter your CV.';     $CVError = true;     } else {     $CV = trim($_POST['CV']);     }      and my HTML code for getting file:
     Attachments :*
     <input class="txt" type="file" name="CV" id="CV" value="<?php if(isset($_POST['CV']))   echo $_POST['CV'];?>">
      and this is my mail function code:               $headers = 'From: '.$name.' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;     $headers .= "\r\n" . 'Content-type: text/html';     wp_mail($emailTo, $subject, $body, $headers);     $emailSent = true;      Can you help and modify my code in order to get file in email.


Taxonomy Overview Page?

I'm looking for a way to create an overview page for taxonomies. So say you're on a page for a certain page (domain.com/my_tax/myterm) it would show different content types in the 'myterm' category. Posts, Pages, and a Custom Content types. All of which are pulled through taxonomy.php. I can get this working fine, but when a taxonomy archive for the content type 'Posts' is viewed it ends up going to this overview page rather than a working archive of posts. So currently there's no way to view all posts of a content type and get a working archive. I tried adding `<?php if ( is_post_type_archive() ) { ?>..normal loop..<? } ?>` but the pagination breaks and it's rather buggy at detecting the current post type.


How to automatically change a posts status to draft based on custom field

I would like to set a post to Draft automatically based on a custom field date. Note: **I am using the plugin Magic Fields.** Based on the following code I want to use a custom field 'expiration' to give the date.               function sfn_show_expire() {          global $wpdb;          $server_time = date('mdy');          $result = $wpdb->get_results("SELECT * FROM wp_posts WHERE post_type = 'show' AND post_status = 'publish'");          if( !empty($result)) {             foreach ($result as $a) {                  $show_time = get_the_time('mdy', $a->ID );                  if ( $server_time > $show_time) {                      $my_post = array();                      $my_post['ID'] = $a->ID;                          $my_post['post_status'] = 'draft';                      wp_update_post( $my_post );                  }              } // end foreach          }     }      add_action( 'init', 'sfn_show_expire' );       Ultimately I would like to make this in a cron job, but for now any suggestions to the code would be great.


My permalinks are broken! Can I use mod_rewrite to ignore a physical file?

A website I work on recently posted a file at the root of their website named "2011.html." Now, any 2011 blog posts with the permalink structure of year/month/day/post-name do not work, and instead load the 2011.html file. Trying to bring up the archive at domain.com/2011/ also incorrectly brings up the file. 2010 and other years work as expected. Is there any way I can use mod_rewrite to only acknowledge this file when 2011.html is explicitly in the URL, and use the standard permalink structure with every other URL so that the blog functionality is restored? The link to this file was sent out in a marketing e-mail, and is receiving a lot of activity so it can't be moved or renamed.


multicheck box for post metabox

Hi guys I have a headache on this I make a multicheck with this tutorial wpshout.com/create-an-in-post-theme-options-meta-box-in-wordpress/ the problem is it doesn't save all checked value and it doesn't checked the checked value when editing post. Here are my code I add here an array for muticheckbox                   <?php    function hybrid_post_meta_boxes() {          /* Array of the meta box options. */     $meta_boxes = array(         'title' => array( 'name' => 'Title', 'title' => __('Title', 'hybrid'), 'type' => 'text' ),         'description' => array( 'name' => 'Description', 'title' => __('Description', 'hybrid'), 'type' => 'textarea' ),         'location' => array( 'name' => 'location', 'title' => __('Location:', 'hybrid'), 'type' => 'check', 'options' => array(         'AL' => 'Alabama',         'CA' => 'California',         'DE' => 'Delaware',     ),     );          return apply_filters( 'hybrid_post_meta_boxes', $meta_boxes ); } ?>      I add else statement for multi checkbox                   <?php         function post_meta_boxes() {         global $post;         $meta_boxes = hybrid_post_meta_boxes(); ?>
     <?php foreach ( $meta_boxes as $meta ) :              $value = get_post_meta( $post->ID, $meta['name'], true );              if ( $meta['type'] == 'text' )             get_meta_text_input( $meta, $value );         elseif ( $meta['type'] == 'textarea' )             get_meta_textarea( $meta, $value );         elseif ( $meta['type'] == 'select' )             get_meta_select( $meta, $value );         elseif ( $meta['type'] == 'check' )             get_meta_check( $meta, $value );          endforeach; ?>
      I made a function for multicheck                   <?php function get_meta_check( $args = array(), $value = false ) {          extract( $args ); ?>
                      <label for="<?php echo $name; ?>"><?php echo $title; ?>         	                           <?php foreach ( $options as $option ) : ?>               <input type="checkbox" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value=", <?php echo $option; ?>, " <?php if ( htmlentities( $value, ENT_QUOTES ) == $option ) echo ' checked="checked"'; ?> /> <?php echo $option; ?>,             <?php endforeach; ?>             <input type="hidden" name="<?php echo $name; ?>_noncename" id="<?php echo $name; ?>_noncename" value="<?php echo wp_create_nonce( plugin_basename( __FILE__ ) ); ?>" />
     <?php } ?>      How can I do code with saving all value of checked box? thanks! > > UPDATE                   function save_meta_data( $post_id ) {         global $post;              if ( 'page' == $_POST['post_type'] )             $meta_boxes = array_merge( page_meta_boxes() );         else             $meta_boxes = array_merge( post_meta_boxes() );              foreach ( $meta_boxes as $meta_box ) :                  if ( !wp_verify_nonce( $_POST[$meta_box['name'] . '_noncename'], plugin_basename( __FILE__ ) ) )                 return $post_id;                  if ( 'page' == $_POST['post_type'] && !current_user_can( 'edit_page', $post_id ) )                 return $post_id;                  elseif ( 'post' == $_POST['post_type'] && !current_user_can( 'edit_post', $post_id ) )                 return $post_id;                  $data = stripslashes( $_POST[$meta_box['name']] );             if ( get_post_meta( $post_id, $meta_box['name'] ) == '' )                 add_post_meta( $post_id, $meta_box['name'], $data, true );                  elseif ( $data != get_post_meta( $post_id, $meta_box['name'], true ) )                 update_post_meta( $post_id, $meta_box['name'], $data );                  elseif ( $data == '' )                 delete_post_meta( $post_id, $meta_box['name'], get_post_meta( $post_id, $meta_box['name'], true ) );              endforeach;     }    ?>


Recommendations for requesting quotes?

I have a tab in the header having named `Request Quote`. In my experience I have not yet used a quote functionality. Please provide me any help or any link that will be helpful for me. Is there is any plugin or something else? I need your ideas and suggestions. I shall be very thankful to you all.