title: Query custom post type by custom field

text: # General Info I used the plugin WP Types (wp-types.com) to create a custom post type called " **artist** ".   In WP Types you can also set another post type as parent post type. This is not possible by default; they implemented this feature by a meta query with the key:   "_wpcf_belongs_%POSTTYPE%_id" (in my case " **_wpcf_belongs_artist_id** ")   and the value is the ID of the parent post. # The Problem Normally if you set a page X as a child of page Y you would have the following permalink structure:   /page-y/page-x/ I thought this plugin would adopt this but it does not. For example I use " **painting** " with the ID **24** as the parent page and " **picasso** " with the ID **72** as the child post with the post type "artist". So this:   /painting/picasso/   does redirect me to:   /artist/picasso/   but outputs the right content. ## My solution approaches As the paid support could not help me I have to try on my own. For writing my own "custom" rewrite rules I have to know the correct query at first. I tried to get my content manually: index.php?_wpcf_belongs_artist_id=24&artist=picasso   redirects me to:   /artist/picasso?_wpcf_belongs_artist_id=24&artist=picasso   with the correct output of the single artist post. This:   index.php?_wpcf_belongs_artist_id=24   just outputs my front page. The only more or less _working_ variant is:   /painting/picasso/?artist=picasso&_wpcf_belongs_artist_id=24 and:   /painting/picasso/?artist=picasso   These _don't_ redirect me to /artist/picasso/… or anywhere but output the correct single artist post. Here you can find some more variants and the whole thread in the support forums of WP Types. First step probably would be to get the right content with a queryvar like "parent_id". After that I can start dealing with the rewrite rules itself, there might be problems because of the double usage of the top level (%pagename% and %parent_id%). This probably will confuse WordPress. # UPDATE 12/17 I tried this code to get all posts with the meta field '_wpcf_belongs_artist_id' and the meta value retrieved from the URL (/?parent_id=24). Unfortunately, it doesn't seem to work. It crashes my submenu's auxiliary queries and outputs just the result of the normal query.               add_filter('query_vars', 'custom_query_vars');     function custom_query_vars($vars) {         $vars[] = 'parent_id';         return $vars;     }          function parent_query( $query ) {         // Exclude         if( $query->is_admin == 1 && !$query->is_main_query() && !$query->is_archive == 1 ) {             return;         }         // retrieve field name / value from URL if exist         $custom_field = '_wpcf_belongs_artist_id';         $custom_value = ( $_GET['parent_id'] ) ? stripslashes( $_GET['parent_id'] ) : '';         if( $custom_field ) {             // add meta key requirement -- we’ll return all posts with some ‘color’             $query->set( 'meta_key', '_wpcf_belongs_artist_id' );             if( $custom_value ) {                 // build meta value requirement -- we’ll return only blue                 $query->set( 'meta_value', $custom_value );             }         }     }     add_action( 'pre_get_posts', 'parent_query' );


title: Create a link to full-sized image attachment?

text:
I'm using some transitional css to "slide" up a div (".mask") which contains a short excerpt of the post when you hover over the post thumbnail. This works very well, but I'd also like to add a text or icon link to each "mask" div which will link directly to the full size version of the image (and hopefully open automatically in fancybox). Here's the code I'm using so far - thanks

<a href="<?php  the_permalink() ?>" rel="bookmark"><?php the_title(); ?>

     <?php tt_thumb(300,185); ?>

     <?php the_content_limit($hp_mid_content_length,'');      ?>


title: Is there a plugin that can replace WP comments with Facebook comments as used by TechCrunch?

text: I've long been impressed by TechCrunch's Facebook comments, is there a plugin for WordPress self-hosted websites which achieves the same effect?


title: Graphing libraries for WordPress

text: I had asked question like this long ago at WPTavern and it fizzled. Hope it fares better this time. :) Drawing graphs can be done with multiple methods (generating image files, JS, Flash) and there are a lot of libraries available overall. However there are some specific factors in context of WordPress:   * it might be efficient to use lighter library with dependency on scripts bundled with WP (like jQuery);   * it needs to be licensed under GPLv2 or compatible to fit in official repository (note that it has more harsh requirements than WP itself);   * there are probably some specifics that make things easier/harder to use with WP techniques, like passing data to JavaScript with localization functions. What libraries or other solutions had you used to build graphs in WordPress? Please one thing per answer, so it is easier to discuss and vote on.


title: Plugin To Insert Chinese Characters in Posts or Pages

text: My daughter is blogging from China. She wants to insert Chinese characters occasionally into her post so that she can explain what these mean. She has a Mac, which lets her type these quickly. When she tried to post them, she got ?? symbols. I checked the blog theme (TwentyEleven) and it's HTML5 and has this tag:               <meta charset="UTF-8" />       So, she's doing that properly at least. I imagine she'll need some kind of plugin that lets her use a shortcode or something in order to properly display the character. What plugin do you suggest? Note that I may have needed to turn on UTF-8 setting in MySQL, that it might have been MySQL that was the problem? When you use Fantastico in cPanel to create a blog, it sets the encoding to Latin1 instead of UTF8. So, I had to use phpMyAdmin to find her blog database (difficult -- you have to click wp_options table and see if it's the right blog database). Then, I clicked the SQL tab and pasted the following, then clicked Go:               alter table wp_posts convert to character set utf8 collate utf8_general_ci;      I will report back if this fixes it.


title: how wordpress generates permalinks as /%category%/%post%/

text: I am not here to discuss the efficiency of using categories as the base for permalinks. I would like to know in **what file and what line is the code to how Wordpress picks out a category for the permalink if the post is in multiple categories**. I asked this on IRC a while ago and I can't find the code anymore. Thanks.


title: Auto post Spams on my wordpress blog?

text: i don't know what the hell are these spam links on my friend's photo-blog posts! when i publish a post, this texts shown there! what should i do? (sorry for my very bad English) blog: http://www.bius87.com http://i.stack.imgur.com/YdSY3.jpg


title: Different Language for Frontend and Backend

text: I use a English WordPress package and this is very well. Now, I would like to translate some elements of the blog (like "posted on", "comments") etc, but do leave the dashboard interface intact in English. Is there any mecanism to translate just the site elements?


title: Best practices: Custom theme sidebar menu - hardcode or widget?

text: Is it best to hardcode a sidebar menu using functions.php or sidebar.php OR use the custom menu widget? Are there times when each is appropriate?


title: How can I get WP to build a feed based on multiple taxonomy terms

text: Currently, the best way to get a feed generated for a single taxonomy term is by letting wordpress generate the content automatically:               example.com/wordpress/feed?tax_slug=term_slug      However, is there a built in way of being able to produce a feed using multiple terms from the same taxonomy? For example:               example.com/wordpress/feed?tax_slug=term1,term2,term3&another_tax_slug=term4,term5      The idea is to use built in wordpress functionalities to generate the feed, and not have to manually create one.


title: How can I get category ID by category name?

text: I have a few categories with the same name [some of them are sub-categories]. And I want to get an array of ID's for certain cattegory name. I tried this:                $term = get_term_by('name', $cat_name, 'category');      but it seems that `get_term_by()` returns only the first term that match the query.


title: AJAX call fails when sending JSON but works with URL style string

text: When making an AJAX request is works when my data is a URL style string.               var options = {         type: 'post',         data: 'action=my_action'     };      The function will get called and return some fake data just fine. If I try to make the same call but use JSON, it doesn't work. I've tried several different ways of doing it, but admin.php just return -1. Is there something in jQuery or Wordpress that I need to change to allow this? Here are a couple of the other ways I've tried.               var options = {         type: 'post',         data: { action: 'my_action' }     };          var options = {         type: 'post',         data: JSON.stringify({ action: 'my_action' })     };      The example in the docs have it using a JSON object too. http://codex.wordpress.org/AJAX_in_Plugins


title: wp_nav_menu() mark current item ancestor of custom post type

text: This solution does almost what I want it to. Only thing is, I have my menu set up as follows:               Menu item 1     Menu item 2        Custom post type 1        Custom post type 2        Custom post type 3     Menu item 3      Using the solution I mention adds the tag "current_url" to the sub menu of the custom post type I'm in ("Custom post type 1"). But I want it to add a "current_menu_item" (or something) to "Menu item 2". Any way to do this?


title: Multisite - 404 when accessing sub-sites

text: Setting up a multisite on a blog which root url is dev.domain.com, using subdomains. So, for example, a subsites address : site1.dev.domain.com Everything works fine as long as i stay on the main site (dev.domain.com) When i try to access any of the other sites, I get a 404 error. Here is my .htaccess sitting in the root               <IfModule mod_rewrite.c>     # BEGIN WordPress     RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]     RewriteRule . index.php [L]     # END WordPress          </IfModule>      Any hint as to what is causing the 404 or suggestions to solve it would be much appreciated.


title: Generate a WP post from Youtube Feed

text: Normally when you get a Youtube feed, it will display the description/title from the YT video. However, I want a post to be generated when a new video is posted on YT so that an admin/editor can go back and change the title or add a teaser.


title: How to skip woocommerce checkout out page?

text: I use woocommerce plugin for my shop. I want to skip the checkout page where users give shipping details. So the system will be when they select a product and after go to the cart page they will go to paypal and from paypal we will get the adress. Any idea how i can build this, Please help me. I am newbie.


title: How to remove contextual help on WP 3.3.2?

text: How to remove the contextual help and its tab completely from Wordpress v3.3.2? The add_filter for contextual help that used to work like wonder on older version no longer work now. Update: (trimmed solution from Chip Bennett)               function wpse50787_remove_contextual_help() {         $screen = get_current_screen();         $screen->remove_help_tabs();     }     add_action( 'admin_head', 'wpse50787_remove_contextual_help' );


title: 2 tick boxes appearing below comments

text: In my site I have two tick boxes appearing above each other underneath the comments section. I have tried disabling pingbacks etc. How do I remove these? example - http://vikingsandc.co.uk/2012/11/test-text-test-text/


title: wp_list_pages sort order is different for different languages

text: I'm using the following code               wp_list_pages(array('exclude' => '','title_li' => '','sort_column' => 'menu_order'))      If I switch the language the sorting is different. One of the main menu points is listed at the end of the page when switching to my second language. Why does this happen? The pages have a sorting of zero when editing a page ...


title: can the_excerpt function also get images?

text: Not sure if im going about this in the right way but, overall, ive been told to create, kind of like a news box on my home page and so, the "latest news" is going to be this clients posts. now i know i can control `the_excerpts();` content length etc but, i cant seem to find any way for it to also allow an image. when i showed the client the "news box" he wants whatever image is associated with the post, to come through. so i thought of `"the_content();"` but i dont think thats what i need(though im not sure which one will work best with what i need) so the main questions here for me are   1. Can i somhow get the image to come through with the excerpt, or   2. If the excerpt function doesnt allow it, then what can i use?


title: Tabbed content for WordPress sidebar

text: Is there a tutorial that will show me how to create a custom tabbed content area for my sidebar? I want to have two tabs - one for a specific category each (news & events) This tutorial http://net.tutsplus.com/tutorials/javascript-ajax/create-a-tabbed-interface- using-jquery/ shows how to create the tabs but how do I add the code for WordPress to show the excerpts of posts with thumbnail images from the categories so it shows in the selected tab?


title: WP_Query returns no results

text: I'm using wp_query to create a custom query that retrieves search results but it is returning 0 results. Here is the code:               $query = 's=the&posts_per_page=5&paged=1';     $custom_query = new WP_Query();     $custom_query->query($query);          if( $custom_query->have_posts() ) {             while ( $custom_query->have_posts() ) : $custom_query->the_post();                         $this->get_article();             endwhile;     }     else             $this->posts_404();      When I search for the word 'the' through the search box on the UI, it returns 37 hits, but searching for the word 'the' with my custom query returns 0. So, I suspect there must be a problem with my query. Result: of `print_r($Custom_query)`:               WP_Query Object (       [query_vars] => Array        ( [s] => the          [posts_per_page] => 5          [paged] => 1          [error] =>          [m] => 0          [p] => 0          [post_parent] =>          [subpost] =>          [subpost_id] =>          [attachment] =>          [attachment_id] => 0          [name] =>          [static] =>          [pagename] =>          [page_id] => 0          [second] => [minute] => [hour] => [day] => 0 [monthnum] => 0 [year] => 0          [w] => 0          [category_name] => [tag] => [cat] => [tag_id] => [author_name] => [feed] => [tb] => [comments_popup] => [meta_key] => [meta_value] => [preview] => [sentence] => [fields] =>          [category__in] => Array ( )          [category__not_in] => Array ( )          [category__and] => Array ( ) [post__in] => Array ( ) [post__not_in] => Array ( ) [tag__in] => Array ( ) [tag__not_in] => Array ( ) [tag__and] => Array ( ) [tag_slug__in] => Array ( ) [tag_slug__and] => Array ( )      [ignore_sticky_posts] => [suppress_filters] =>      [cache_results] => 1      [update_post_term_cache] => 1     [update_post_meta_cache] => 1      [post_type] => any [nopaging] =>      [comments_per_page] => 50 [no_found_rows] =>      [search_terms] => Array ( [0] => the ) [order] => DESC )      [tax_query] => WP_Tax_Query Object ( [queries] => Array ( ) [relation] => AND )         [meta_query] => WP_Meta_Query Object ( [queries] => Array ( ) [relation] => )         [post_count] => 0      [current_post] => -1      [in_the_loop] =>      [comment_count] => 0      [current_comment] => -1      [found_posts] => 0      [max_num_pages] => 0      [max_num_comment_pages] => 0      [is_single] => [is_preview] => [is_page] => [is_archive] => [is_date] => [is_year] => [is_month] => [is_day] => [is_time] => [is_author] => [is_category] => [is_tag] => [is_tax] =>      [is_search] => 1      [is_feed] => [is_comment_feed] => [is_trackback] => [is_home] => [is_404] => [is_comments_popup] => [is_paged] => [is_admin] => [is_attachment] => [is_singular] => [is_robots] => [is_posts_page] => [is_post_type_archive] =>      [query_vars_hash] => 16a0222409543c8384496148e5b60565      [query_vars_changed] => [thumbnails_cached] =>      [query] => Array ( [s] => the [posts_per_page] => 5 [paged] => 1 ) [request] => SELECT * FROM wp_posts WHERE 1=2 [posts] => Array ( ) )


title: change url for portfolio image

text: I am working on champer theme , I add portfolio by guideness of documentation, but when i click on image , its go on another page, but I want to stay in similar page, not changing. how can I do this. i am wanted my portfolio Image behaviour like seo Optimization In this link. http://www.gallyapp.com/tf_themes/?theme=Chamber my portfolio.php code is                     <?php          session_start();                 if(!isset($hide_header) OR !$hide_header)               {           get_header();                }                 if(isset($_SESSION['pp_portfolio_style']))                {              $pp_portfolio_style = $_SESSION['pp_portfolio_style'];             }             else          {     $pp_portfolio_style = get_option('pp_portfolio_style');            }                if(empty($pp_portfolio_style))           {     $pp_portfolio_style = '2';            }                   include (TEMPLATEPATH . "/templates/template-portfolio-     ".$pp_portfolio_style.".php");                 ?>


title: Woocommerce - Specific template for product category?

text: I'd like to create a specific template for specific category (not for single product). Is it possible and how to do it? Thanks,


title: Cookie is not marked as HttpOnly

text: I am trying to get my wordpress driven website to be PCI compliant and the report states that we have a failure due to: "Cookie is not marked as HttpOnly: 'wordpress_test_cookie=WP+Cookie+c heck; path=/; domain=..." I read wordpress documentation and it seems that this security is automatically set. Can anyone enlighten me on how I can fix this? http://tr.im/4v8sv


title: Have different site location for wp-admin in IIS

text: I'm attempting to put a WordPress blog on a Windows server. PHP and WordPress installed just fine, and I have a working website, and admin site. However, I want to access the wp-admin directory using SSL (with a self-signed cert that I installed). I'm also looking to have the SSL cert only be used for admin, by me - I understand the browser warnings, and it will be on a funky port, but obviously I don't want regular users to have to deal with this. Everything works fine if I tell the WordPress settings that my site lives on https://example.com:4443/ - I can get to the entire site, including admin, using that URL. However, http://example.com/ does not work when I do this. I'm looking for a way to have the best of both worlds - SSL on a funky port for admin, and regular HTTP on port 80 for the rest of the site, but I can't seem to figure out how to have two different URLs. Is this possible? The issue is definitely with WordPress - IIS and PHP are perfectly fine running in both worlds simultaneously, but the app itself doesn't work. I've got full server rights, so I can do whatever crazy IIS settings or php.ini settings are needed. Windows Server 2008R2


title: Image rotation fails to regenerate custom sized thumbnail

text: I'm using custom image dimensions in functions.php like this:               add_image_size( 'custom-size-thumbnail', 120, 120, true );      I uploaded some pictures with wrong orientation, so I used "edit" options to rotate them... Problem is, that only original size pictures (full, large, medium, thumbnail) are regenerated (as a new file in the FTP directory - original picture.jpg, rotated picture-e1384125509778.jpg). My custom sized, however, are not :-( (no new file is created, theme is still loading one with wrong orientation). Any idea how to fix this? Thanks


title: Add template meta box to category edit page?

text: Is there any non-plugin solution to add template meta box on the category edit screen? Template meta box like that on the page edit screen, but this one for category. I'd like to have this function built into the theme page. Something similar to the one Mike Schnikel did for Scott B here.


title: Why does "get_option" pull in the older value in options.php, rather than the newer value, on submission of a form?

text:
I'm building a simple post order "plugin" through my theme's functions.php. The function updates the value of an option in options.php on submission of a form. So, for instance, when "1" is inputted in the field next to a post in a WP_Query, the ID of that post is sent to an option in options.php called "post1". So the option is "post1" and the value is "1456" (the ID of the post). If "2" is inputted in the field, it sends the ID of the post to an option called "post2". I would have thought this is fairly straightforward. At the _start_ of the script, I call in all the options such that               $posts1 = get_option('post1');     $posts2 = get_option('post2');      and so on, such that `$posts1`, and `$posts2` are IDs of posts. I then pull these into an array which then goes into a `WP_Query`. This is so that the user knows what the current order of the posts is. Below then is another `WP_Query` that does all the aforementioned magic above of pulling the ID of the post into the option depending on what number the user selects when the form is submitted. What I would have expected is that upon submission of the form, where the options are changed (and they are changed, because I check in options.php each time), the reload of the page would present the newer list above – as in, with the options changed. However, what appears in the first `WP_Query`, which is pulling in the options as above and sending them to the array, is that the _older_ options are being pulled in by the script. I had thought maybe that the script was still working after submission and the options hadn't been changed in time for the page load, so I put a `sleep(10);` before the starting `get_option` list, but still, the older options are pulled in even after ten seconds. If I immediately refresh the page after the original submission and reload of the page, the new options are pulled in – just not on the original submission and reload. Why is this, and how can I fix it? Are there reasons why the script seems to be pulling in options that seem to be like cached or something? Thanks for your help. To reiterate, I am aware that the original `get_option` call is occurring before the `update_option`, but the `update_option` only occurs upon submission of the form, so the page is reloaded. The new options should be presented because the page is reloaded after the `update_option` occurs, but they don't. I _want_ the "old" options to appear on page load initially, so the user can see what the current order of the posts is, can update them, submit the form, then the page reloads, and they should be presented with the options they have just inputted. Here is a simplified version of the code (which I realise is inefficient and clumsy, but I don't think that should affect the issue at hand):                    <?php function functionpostorderit() {     ?>                    <?php          /* THE FIRST LOOP BELOW IS SO USERS CAN SEE THE CURRENT POST ORDER */                        global $post;         global $my_query;                                $posts1 = get_option('post1');                 $posts2 = get_option('post2');                 $posts3 = get_option('post3');                           $post_listids = array($posts1,$posts2,$posts3);                      array_filter($post_listids);                                $paged_l = 1;                 $posts_per_page_l = 25;                 $offset = ( $paged_l - 1 ) * $posts_per_page_l;                 $ids_to_query_l = array_slice( $post_listids, $offset, $posts_per_page_l );                                 $my_query = new WP_Query( array('post_type' => array( 'post', 'feature' ), 'post__in' => $ids_to_query_l, 'posts_per_page' => $posts_per_page_l, 'orderby' => 'post__in', 'ignore_sticky_posts' => 1, 'post_status' => 'publish') );                            if($my_query->have_posts()) {                  echo '
';                  $loop_counter = 0;                       while ( $my_query->have_posts() ) {                 $my_query->the_post();                      $loop_counter++;                        echo '
'.get_the_title() . '<input type="text" name="number_of_'.$loop_counter.'" value="" />'.'
' ;                             }             echo '
';                        }                         else {              }                   wp_reset_postdata();                     ?>
                        <form method="post" action="">                                    <?php                         global $post;         global $my_query;               /* THE SECOND LOOP BELOW IS THE ONE IN WHICH USERS PRIMARILY UPDATE THE ORDER */                               $my_query = new WP_Query( array('post_type' => array( 'post', 'feature' ), 'posts_per_page' => 25, 'orderby' => 'date', 'post_status' => 'publish', 'post__not_in' => $post_listids           ) );                            if($my_query->have_posts()) {                  echo '
';                  $loop_counter = 0;                       while ( $my_query->have_posts() ) {                 $my_query->the_post();                      $loop_counter++;                   $this_id = get_the_ID();                   echo '
' . get_the_title() . '<input type="text" name="number_of_'.$loop_counter.'" value="" />'.$this_id.'
' ;              ${'id_of_' . $loop_counter} = get_the_ID();              $current_id = get_the_ID();              ${'number_of_' . $loop_counter} = $_POST['number_of_' . $loop_counter];              $current_value_input = $_POST['number_of_' . $loop_counter];                                  if(isset($_POST['submit']))             {                   $current_number_of = 'number_of_'.$loop_counter;                                              if($current_value_input !== '') {                                $checking_for_equal = array('number_of_1','number_of_2','number_of_3');                   $remove_equal = array_search('number_of_'.$loop_counter, $checking_for_equal);              unset($checking_for_equal[$remove_equal]);                    foreach ($checking_for_equal as &$valued) {             $valued = $_POST[$valued];              }              if (in_array(${'number_of_' . $loop_counter}, $checking_for_equal))           {                if ($has_run !== "true") {                  echo "
Sorry, posts cannot have the same position. Try again.
";                  $has_run = "true";                  }                               }         else           {                                     if($posts1 == $current_id) {                              $option = 'post1';                              $new_value = '';                              update_option( $option, $new_value );                               }                               elseif($posts2 == $current_id) {                              $option = 'post2';                              $new_value = '';                              update_option( $option, $new_value );                               }                               elseif($posts3 == $current_id) {                              $option = 'post3';                              $new_value = '';                              update_option( $option, $new_value );                               }                                         else {                                    }                              $option = 'post'.${'number_of_' . $loop_counter};                    $new_value = ${'id_of_' . $loop_counter};                    update_option( $option, $new_value );                                   }                                        }                                }                                       }             echo '
';         } else {              }              wp_reset_postdata();                               ?>
<input class="submitter" type="submit" name="submit" value="Update" />
                           </form>                        <?php         }         ?>


title: Set post title and slug from meta fields not working

text: I have a custom post type where I have the post title disabled. I want to set the post title and slug from some custom fields. I was using this and it worked great, but since I've upgraded by site to 3.7.1 (or at least this was when I first noticed the problem), if I try to update the post, Wordpress duplicates it hundreds of times. I've tried changing the filter, such as to the code in this question, but it's still doing it. Any help or workarounds would be much appreciated. Initial code that worked but now doesn't:               function set_people_title( $data , $postarr ) {       if($data['post_type'] == 'people') {           $first_name = get_post_meta($postarr['ID'],'first_name',true);           $last_name = get_post_meta($postarr['ID'], 'last_name', true);           $post_title = $first_name . ' ' . $last_name;           $post_slug = sanitize_title_with_dashes ($post_title,'','save');           $post_slugsan = sanitize_title($post_slug);                $data['post_title'] = $post_title;           $data['post_name'] = $post_slugsan;        }        return $data;      }      add_filter( 'wp_insert_post_data' , 'set_people_title' , '10', 2 );


title: Execute a function using ajax

text:
I have a function called `function getSingleAmazonProduct($asin='')`. It returns an amazon product. I have a form field to enter the `$asin`.
             <form id="productpreview" action="#">             <input type="text" id="asin" name="asin" value="" placeholder="Enter ASIN"/>             <input type="hidden" name="asin_form_post" value="1"/>                           <input type="submit" value="Preview"/>

          if ( isset($_POST['asin_form_post']) && $_POST['asin_form_post'] == '1') {         $asin = $_POST['asin'];         $preview = getSingleAmazonProduct($asin);     }      Can someone tell me how to use ajax to display the returned data within `asinpreview` div?


title: TinyMCE popup windows using WP functions

text: In my editor I would like to use a TinyMCE generated popup to insert in the textarea some complex shortcodes. I use the TinyMCE API to show the popup (bottom of this question). The popup is a PHP file inside my theme. I would like:   1. To protect this file from external access (`if ( ! defined( 'ABSPATH' ) )` does not work).   2. Use some WP functions inside this popup.  Which is the way you could suggest? _TinyMCE API call_               init : function(ed, url) {             // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mcecax_webnews');             ed.addCommand('mcecax_webnews', function() {                     ed.windowManager.open({                             file : url + '/dialog.php',                             width : 650 + ed.getLang('cax_webnews.delta_width', 0),                             height : 500 + ed.getLang('cax_webnews.delta_height', 0),                             inline : 1                     }, {                             plugin_url : url, // Plugin absolute URL                             some_custom_arg : 'custom arg' // Custom argument                     });             });     [...] CUTTED


title: Getting only direct child pages in WordPress with get_pages

text: I am trying to fetch all direct children of a page. But I am getting all children and grand children as well. Any ideas? **PHP Source:**               $args = array(              'child_of' => $post->ID,              'parent ' => $post->ID,             'hierarchical' => 0,             'sort_column' => 'menu_order',              'sort_order' => 'asc'     );     $mypages = get_pages( $args );          foreach( $mypages as $post )     {          $post_tempalte = the_page_template_part();          get_template_part( 'content' , $post_tempalte );     }      My `$args` should be correct according to the documentation, but it's totally ignoring `parent` and `hierarchical`. **My page structure is as follows:** > Parent   >  -Child 1   >  -Child 2   >  --Child 1 to child 2   >  --Child 2 to child 2   >  -Child 3 And I only want to get `child 1`, `child 2` and `child 3`.


title: Using a custom WP_Query with get_template_part loop

text: I have a query for a custom post type:               <?php     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $books = new WP_Query(array(         'post_type' => 'wiki',         'posts_per_page' => '50',         'paged' => $paged     ));     ?>      And i want to loop through these posts using the loop-books.php:               <?php get_template_part( 'loop', 'books' ); ?>      Inside the loop-books.php i have these, just like the regular loop.php, i just changed the have_posts and the_post function to work with the $books query:               <?php if ( $books->have_posts() ) : ?>               <?php while ($books->have_posts()) : $books->the_post(); ?>             <?php the_title(); ?><br/>         <?php endwhile; ?>     <?php endif; ?>      But after this, i get a php error:               Fatal error: Call to a member function have_posts() on a non-object in .../loop-books.php on line 1      So looks like the $books variable is not available inside the get_template_part function. How can i resolve this issue? If i put the $books query inside the loop-books.php its working fine, but i want to separate them.


title: Listen to Post action

text: I am writing a plugin that adds a custom metabox to the post page. I would like to trigger an event when the user navigates away from the _edit post_ page or when a user stops editing a specific post. Is there a way to listen to events on the post page?


title: Creating search form for custom database table

text:
I have a custom table in the WP database which I can display fine, with pagination, using the following code:               <?php          global $wpdb;     $rows_per_page = 50;     $current = (intval(get_query_var('paged'))) ? intval(get_query_var('paged')) : 1;          $rows = $wpdb->get_results( "SELECT * FROM nc_rates_eng");      global $wp_rewrite;          $pagination_args = array(     'base' => @add_query_arg('paged','%#%'),     'format' => '',     'total' => ceil(sizeof($rows)/$rows_per_page),     'current' => $current,     'show_all' => false,     'type' => 'plain',     );          if( $wp_rewrite->using_permalinks() )     $pagination_args['base'] = user_trailingslashit( trailingslashit( remove_query_arg('s',get_pagenum_link(1) ) ) . 'page/%#%/', 'paged');          if( !empty($wp_query->query_vars['s']) )     $pagination_args['add_args'] = array('s'=>get_query_var('s'));          echo paginate_links($pagination_args);          $start = ($current - 1) * $rows_per_page;     $end = $start + $rows_per_page;     $end = (sizeof($rows) < $end) ? sizeof($rows) : $end;          echo "
";     echo "
";     echo "Destination	";     echo "Dial Prefix	";     echo "Cost per Minute (euros)	";     echo "
";     echo "
";               for ($i=$start;$i < $end ;++$i ) {     $row = $rows[$i];          echo "
";     echo "$row->r_dest	";     echo "$row->r_prefix	";     echo "$row->r_rate	";     echo "
";     }     echo "
";     echo "
";           echo paginate_links($pagination_args);          ?>      However, I would also like to be able to take input from the user to search this table and display the results in the same format. What's the best way to do this? I tried adding a simple form to the top of the page and plugging the result into the sql query:               <form method="get" id="searchform" action="">
     Destination: <input type="text" name="destination" id="destination" value="" />
     <input type="submit" id="searchsubmit" value="GO" />     </form>      .....               $dest=$_GET['destination'];     $rates_sql="SELECT * FROM nc_rates_eng WHERE r_dest LIKE " ."'%$dest%'";      .... And this works, but breaks the pagination function. Any help would be greatly appreciated!


title: Wrapping Featured Image on Add/Edit Page in div?

text:
is it possible to wrap the featured image on the add/edit page in a div or other code? I don't mean on the front page of the website, but on the back end on the add/edit pages when you're typing up your post. I'm trying to add this code around it:

Featured Image Code

      The code for the featured image is in `\wp-admin\includes\post.php` but if I add it there it'll be lost when I upgrade. Thank you!


title: $wp_filesystem returns NULL. What are the dependencies?

text: I need to obtain a reference to the $wp_filesystem object. In the test below, the var_dump($wp_filesystem) returns NULL. What additional files are required in order to properly set up $wp_filesystem? I was expecting that since its called in file.php, loading that file would be sufficient to load the object.               <?php     require('../../../wp-blog-header.php');     require('../../../wp-admin/includes/file.php');          $mytest = somefunction();          function somefunction() {       global $wp_filesystem;       var_dump($wp_filesystem);            return;     }     ?>      UPDATE: I've found that I can call WP_Filesystem() directly to create it, so I'm getting the zip extracted fine, now the problem is that the zip file is copied to the destination folder rather than deleted as my ZipArchive method does.               require('../../../wp-blog-header.php');     require('../../../wp-admin/includes/file.php');          function openZip($file_to_open) {          global $target;           global $wp_filesystem;         if(class_exists('ZipArchive'))         {             $zip = new ZipArchive();               $x = $zip->open($file_to_open);               if($x === true)              {                   $zip->extractTo($target);                   $zip->close();                                 unlink($file_to_open);               } else {                   die("There was a problem. Please try again!");               }         }         else         {         WP_Filesystem();         $my_dirs = ''; //What should this be? I'm already passing he $target directory         _unzip_file_pclzip($file_to_open, $target, $my_dirs);         }     }


title: Rewrite author_name

text: I need to rewrite author_name to cat. I searched for hours but can't find anything. I restrict the search results by author instead category because of the performance, it's much faster.   For getting all posts from the user "alex" you have to type: `example.com/?author_name=alex`, I just need to change the "author_name" to "cat" it has nothing to do with the normal wordpress category structure.


title: Wordpress Database Slow - should I switch to InnoDB?

text: I have a WordPress site with well over 10k posts, and things are starting to get very slow whenever I am adding and editing posts. Pages load nice and fast for users, along with the admin lists of posts, but it is when writes or updates occur the server goes to 100% CPU and takes a long time (sometimes longer than PHP's timeout of 60s). I am thinking that this is likely to do with the table level locking of MyISAM, and am thinking of switching this to InnoDB. What are the implications of doing this? Some stats:               select  - per hour ~22k     update  - per hour ~7.6k     set option  - per hour ~7k      I know there are lots of other optimizations I can make, but my feelings are that this might have the biggest impact. Thanks **Edit** : I have found one of the major problems causing the slowness, it was YARPP (Yet Another Related Posts Plugin) that was regenerating the "relatedness" each time, and this seemed to be due to the 2k+ tags we have. I turned off the "consider tags" option and it has sped up considerably. Also, other plugins that regenerate things can cause these kind of issues, such as some XML sitemap plugins. So, my immediate issue is resolved, although I would still love to hear a good answer to InnoDB vs MyISAM for Wordpress!


title: Customizing 1 theme for multiple blogs in a multisite setup

text: I just converted a site to a multisite setup using WordPress 3.0.4. One thing I found in a hurry is that if I wanted to edit a theme's code, the changes would be reflected on all the subsites that use the same theme. Is there a to customize the code so that only a certain subsite receives the changes??


title: Custom post type - change name in sidebar

text: I've created a custom post type, as I'm making a site which will feature job listings. I want the sidebar in the dashboard to show "Jobs" as the name. Here is my code in functions.php               // Register Custom Post Type             function custom_post_type() {                      $labels = array(                     'name'                => _x( 'Jobs', 'Post Type General Name', 'text_domain' ),                     'singular_name'       => _x( 'job', 'Post Type Singular Name', 'text_domain' ),                     'menu_name'           => __( 'Post Type', 'text_domain' ),                     'parent_item_colon'   => __( 'Parent Item:', 'text_domain' ),                     'all_items'           => __( 'All Jobs', 'text_domain' ),                     'view_item'           => __( 'View Job', 'text_domain' ),                     'add_new_item'        => __( 'Add New Job', 'text_domain' ),                     'add_new'             => __( 'Add New Job', 'text_domain' ),                     'edit_item'           => __( 'Edit Job', 'text_domain' ),                     'update_item'         => __( 'Update Job', 'text_domain' ),                     'search_items'        => __( 'Search Jobs', 'text_domain' ),                     'not_found'           => __( 'Not found', 'text_domain' ),                     'not_found_in_trash'  => __( 'Not found in Trash', 'text_domain' ),                 );                 $args = array(                     'label'               => __( 'custom_job', 'text_domain' ),                     'description'         => __( 'Jobs Listing', 'text_domain' ),                     'labels'              => $labels,                     'supports'            => array( ),                     'hierarchical'        => false,                     'public'              => true,                     'show_ui'             => true,                     'show_in_menu'        => true,                     'show_in_nav_menus'   => true,                     'show_in_admin_bar'   => true,                     'menu_position'       => 5,                     'can_export'          => true,                     'has_archive'         => true,                     'exclude_from_search' => false,                     'publicly_queryable'  => true,                     'capability_type'     => 'page',                 );                 register_post_type( 'custom_job', $args );                  }                  // Hook into the 'init' action             add_action( 'init', 'custom_post_type', 0 );      However for some reason this shows up in WP as "Post Type" in the sidebar. But I can't see anywhere that it would be coming from... I thought the `name` label was the name shown in the sidebar? Where did I go wrong? ![enter image description here](http://i.stack.imgur.com/EncIw.png)


title: Random image from tag/custom type on sidebar

text: How would I pull a single random image from custom post type "athletes" and the custom image field "athletethumbnail" to be displayed in my sidebar? (I have PHP enabled for my text widget on sidebar.)


title: Display comment form of specific page in sidebar

text:
I want to display the comment form of a specific page on a sidebar. It will look like this roughly. ![enter image description here](http://i.stack.imgur.com/S1URH.png) * * * ![enter image description here](http://i.stack.imgur.com/i92rH.png) * * * I tried modifying from comments.php and putting it on sidebar.php. But nothing shows up. Help please?               <?php $aspirasi = get_post(2); ?>      <?php if ( 'open' == $aspirasi->comment_status ) : ?>

<?php comment_form_title( __('Post a Comment', 'newtheme'), __('Post a Reply to %s', 'newtheme') ); ?>

                                <form id="commentform" action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post">          <?php if ( $user_ID ) : ?>
<?php printf(__('Logged in as %2$s. Log out?', 'newtheme'),                                 get_option('siteurl') . '/wp-admin/profile.php',                                 wp_specialchars($user_identity, true),                                 wp_logout_url(get_permalink()) ) ?>
          <?php else : ?>
<?php _e('Your email is never published nor shared.', 'newtheme') ?> <?php if ($req) _e('Required fields are marked *', 'newtheme') ?>

<?php _e('Name', 'newtheme') ?> <?php if ($req) _e('*', 'newtheme') ?>

<input id="author" name="author" type="text" value="<?php echo $comment_author ?>" size="30" maxlength="20" tabindex="3" />

<?php _e('Email', 'newtheme') ?> <?php if ($req) _e('*', 'newtheme') ?>

<input id="email" name="email" type="text" value="<?php echo $comment_author_email ?>" size="30" maxlength="50" tabindex="4" />

<?php _e('Website', 'newtheme') ?>

<input id="url" name="url" type="text" value="<?php echo $comment_author_url ?>" size="30" maxlength="50" tabindex="5" />

          <?php endif /* if ( $user_ID ) */ ?>

<?php _e('Comment', 'newtheme') ?>

<textarea id="comment" name="comment" cols="45" rows="8" tabindex="6"></textarea>

<?php _e('You may use these HTML tags and attributes:', 'newtheme') ?> <?php echo allowed_tags(); ?>

          <?php do_action('comment_form', $aspirasi->ID); ?>
<input id="submit" name="submit" type="submit" value="<?php _e('Post Comment', 'newtheme') ?>" tabindex="7" /><input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
                          </form>

     <?php endif /* if ( 'open' == $post->comment_status ) */ ?>


title: Display featured posts for a custom post type by taxonomy

text: Ok, the quick explanation: I'm using a custom post type, 'lakes'. And, using custom taxonomies to organize them. They are: state, watertype and county. I've created a 'page' for each state that displays all the listings using that state's name in the tags. This part works fine. What we want to do is also have some of the lakes set with a tag of 'featured' and display those in a div in the top portion of the page just above the regular results. There would only be perhaps 5 set as featured but the query could also set a limit as well. Where i'm stuck is in how to create the query and results based upon the state page they are currently on. In other words, if they were on Alabama then i'd want the 5 featured listings in Alabama to display. If on Alaska, then the 5 featured from Alaska. These would just display in a typical unordered list that I would format with CSS in the stylesheet. I just haven't gotten any query and loop code to work as it just wants to show the same 5 results no matter what state page they are on. Ideas? Thoughts? Help? Thanks in advance to anyone and everyone. I AM researching the other similar posts as well but could not find the specifics about page-to-page issue.


title: WordPress Query Returning Every Post

text: I have a custom WP query that searches a single custom field, using an array. The custom field is for the country of origin of a post. The array I'm using are the names of the various countries in a region. The objective is to be able to return all posts from a region or continent. Here is my query:               $args = array(             'posts_per_page' => '-1',             'cat' => '4',             'meta_query' => array(                     array(                     'meta_key' => 'Country',                     'meta_value' => $country_search,                     'compare' => 'IN'                     )             )         );         $country_query = new WP_Query( $args );      The `$country_search` variable is an imploded array: 'Albania','Andorra','Armenia','Austria','Belarus','Belgium', etc. What happens is that no matter which region I search for, while the correct country array is returned, the query returns all of the posts in the database. I'm sure it's something simple, but my head is sore from banging it against the keyboard. I greatly appreciate any help. ty


title: Hide the form of the customer's personal details in the checkout page

text: How can I hide the form of the customer's personal details in the checkout page of Woocommerce when he/she is already registered and is buying another product?


title: Sort by category and then date?

text: I'll try to be as clear as possible. My Wordpress site has multiple custom categories and posts types all which need to be displayed on the home page blogroll. But I need the first post on the homepage always to be the most recent post from a specific category. For example the story at the top of the page will always be the latest "hot- dog" category; and below it; sorted chronologically are more "hot-dogs" mixed with "hamburger" and "nachos" How would I accomplish this?


title: Integrate Custom Post Type Events into Calendar

text: I've got a custom post type called Events on my site with a custom field called event_date created via Advanced Custom fields that stores its value in yymmdd format. Everything works just fine and I'm even able to list upcoming events sorted by event_date on my home page. Trouble is, I'd also like to list these events in the Wordpress calendar widget by event_date and I can't seem to figure out how to go about doing that. I see that someone has created a function that allows the Wordpress calendar to show custom post types, however it grabs _all_ custom post types and it can't filter by custom fields: http://bajada.net/2010/07/15/adding-custom-post-types-to-get_calendar-and-the- calendar-widget Can anyone offer any advice? I'd prefer not to use an event plugin since the ones I've tried are too complicated for the client or don't integrate nicely into what I've already built. However I'm open to using a calendar plugin that can tie into custom post types and fields. I just haven't been able to find one.


title: featured image as background image on pages

text: I'm adding a featured image on my page through the dashboard and I want to use it as a background image on the container div of the page. I want to apply the background image through css, so I am thinking to put a style attribute inside my markup. I'm thinking to make something like this:               <div id="<?php echo $post_name; ?>" class="page<?php echo $post_id; ?>" style="background: url(<?php wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' ); ?>) !important;">      But unfortunately this is not working. When I check the output is like this:               background: url() !important;      What is wrong with this ? Any suggestions? Thanks!


title: Query Pages and post excerpts dynamically

text:
I have a custom home page, a blog page which includes a dynamic preview area of the latest 5 blogs, and some other miscellaneous pages. Im trying to design an "events" page where the main page has a sidebar that looks like this: http://imgur.com/ezEIApD You can then click on each section, which will open up and have a brief description of the event taken from the page with a read more link to go to that page. http://imgur.com/Gz9RDYx I have a parent page called "Events Main" and then I have some test pages set up as child pages of the "Events Main" page. How I could go about querying child pages to fill in that content dynamically? I'm currently using this code               $page_id = 85;     $page_data = get_page( $page_id );     $content = $page_data->post_excerpt;     $title = $page_data->post_title;     echo $page_data->post_title;     echo $page_data->post_excerpt;      but I have to go in and fill the page ID number for each section. I need it to automatically populate these fields, so whenever a new child page is added it will show up. Im using a very similar method in the blog part of my page where anytime a new post is added, the shows up on the blog home page and i can then click it to go to the actual post using this code:                   <?php query_posts("posts_per_page=5"); ?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>              <div style="color:#fff;" <?php post_class() ?> id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>"><?php the_title(); ?>

<?php if ( function_exists( 'get_the_image' ) ) { get_the_image(); } ?>

                 <?php the_excerpt(); ?>

<?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>

          <?php endwhile; ?>          <?php else : ?>
Not Found
          <?php endif; ?>       How to do that?


title: Post Type Rewrite Custom

text: Demo for example:   * `my-site.com/shop-virtual/` - Listing all posts of Post type "Products".   * `my-site.com/shop-virtual/products/category` - Listing all posts of Category.   * `my-site.com/shop-virtual/products/category/my-product-single` - Single post `/shop-virtual/` this is custom page with loop for post_type 'products'. Currently looks like this:   * `my-site.com/shop-virtual/` - page list   * `my-site.com/category/my-category` - For categories is thus with base categories of wp.   * `my-site.com/products/my-product` - this is single page of unique product. I tried to use the 'rewrite' the 'register_post_type' that way down but it did not work               register_post_type( 'products', array(         ...         'rewrite' => array("slug" => "shop-virtual/products", "with_front" => false),     ) );


title: Where is the code for "Front Page Template"?

text: I'm using the TwentyTwelve theme. For my static front page I'm using the "Front Page Template", but I want to modify it so it doesn't include the page's title on the rendered page itself. So I went looking for the template file for "Front Page Template" but it's not in the theme. I grepped for "Front Page Template" in the theme directory and got no hits. I poked around other locations in the WP hierarchy but can't find it. Where is it?


title: Wordpress 3.1 not autoupdating

text: Hay All, when i run the auto-update for WordPress 3.1 it doesn't do anything. It says               Downloading update from http://wordpress.org/wordpress-3.1.zip…     Unpacking the update…      But then the browser stops, it leaves a 3 megabyte "wordpress-3.tmp" file in my wp-content folder.


title: Show Daily Archives after specific dates

text: I am currently showing a daily archive using the following                <?php wp_get_archives('type=daily&limit=15'); ?>      It shows all the older posts as daily archives. However, Is it possible to show the archives only after a specific dates. For instance, I would like to show daily archives from August 1, 2013 onward only and not any post which was published before that. I have tried to use the following code but somehow does not work               <?php     function ($where) { return $where . ' AND  (post_date)>= 2013-08-01 '; }     add_filter('getarchives_where');     ?>     <ul>            <?php wp_get_archives('type=daily'); ?>     </ul>       Thanks


title: How to clear the cache?

text: I have made changes in my CSS, but it doesn't work. I know it's because of caching from admin panel. How to clear cache of my WP admin. Is there any method to clear the cache?


title: Google maps .gm-style div now displays as block, thus breaking the map

text: recently my Wordpress page with Google Maps started displaying markers in an odd fashion- look! ![enter image description here](http://i.stack.imgur.com/9N2R7.png) The problem is- Google changed they code and added this baby into the code:                 .gm-style div {         display: block;         }      Overriding the code with, let's say, `display:inline-block !important;` doesn't work, since a new display:block is being automatically generated by Google! (Picture below) ![enter image description here](http://i.stack.imgur.com/XZOF6.png) The site itself is here if anyone wants a peek:               `http://objekt.ee/properties/?lease=rent&view=map`


title: How do I add (css) class to a custom link to make it current_page_item

text:
As a custom menu item wp doesn't add the class current_page_item All other links it does?

Home

Future TV Guide

About

      I would like to show it as an active link


title: Can I sell a theme based off of TwentyTen

text: Can I sell a theme I developed using TwentyTen


title: Injecting JavaScript into a Post with WP3.x

text: I have a client who is trying to inject some JS directly into a post using the web interface. The script is stripped out on the live site. I am unable to replicate this behavior on a local installation. The JS is added as expected. The main difference between my installation and the client's is that my installation is a fresh WP3 installation, whereas the client's is WP3 upgraded from WP2. Is this a configuration option or a legacy issue? Is there some other reason why this might be happening? Rich


title: Personalized Author Area

text: I have most of a site together that is set up to allow people to register as authors and post stories. I had originally suggested we use a form and have the client create the post, since he also wishes for people to add audio and images However, he says he wants it so any Author can add/edit/post anything (don't even get me started on security). I decided to let people register, then send them to a how-to page describing how to create a post, upload an image and add audio file, with screen shot pics. Not the best solution but in budget. Now my client wants this: _What I would like it to be is more of a personalized page. So I would have my pic in the upper left corner and then some information about myself. In the page we would then set up sections that show different types of content for that person. There will be a story section, a picture gallery and a media. I'm guessing that we'll want to have those link to a page that can show them in better organization than we can show on the person's home page (for lack of a better term for it at the moment)._ I personally don't see a cheap or easy way to do this, unless if there is a plugin out there that adds this sort of functionality. But beyond that, has anyone run into this and, if so, how did you solve this personalized page issue? I just don't know how to dumb this down any further for users without massive changes to the system. I'm guessing "knowing about it from the beginning" would have been the best solution...


title: How can I get a list of comments by target

text: I've been looking at the classes WP_Comment_Query and WP_Meta_Query but to be honest, I can't figure out how to use them together. I want to query the database for comments where `wp_posts::post_author == X` and `wp_comments::comment_post_id == wp_posts::post_id`. Could anybody give an example of usage? Since SQL is not my thing, and this next question is not really WP related, but how would a SQL query be built to handle 2 tables?


title: Is there a "widget slider?"

text: This is surprisingly hard to search for on the internet given the keywords that have to be used. I am looking for a widget slider. To be clear, not a slider widget which you can put photos, videos, etc into. I have 3 existing widgets. I would like them to rotate as would any set of photos in your typical slider. Has anyone seen anything like this? There would be a widget in the widget area, and then these 3 widgets would be added to that so that they rotate. I have a map widget, a WooCommerce widget, and a Text widget


title: Get URI from PodPress using PHP

text: We're using podpress as our podcast player, but we'd like to give the option to download the file on a page without a player. So I'm trying to figure out how to extract the URI from the metadata. I'm new to PHP, and struggling to learn it, so I've gotten this far:               <?php           $custom_fields = get_post_custom(get_the_ID());         $my_custom_field = $custom_fields['_podPressMedia'];         foreach ( $my_custom_field as $key => $value ){             echo $key . " => " . $value . "<br />";         }     ?>      which outputs               0 => a:1:{i:0;a:10:{s:3:"URI";s:85:"http://www.writingexcuses.com/wp-content/uploads/Writing_Excuses_8_1_Microcasting.mp3";s:5:"title";s:33:"Writing Excuses 8.1: Microcasting";s:4:"type";s:9:"audio_mp3";s:4:"size";i:12759440;s:8:"duration";s:5:"17:43";s:12:"previewImage";s:86:"http://legacieslost.com/writing/wp-content/plugins/podpress/images/vpreview_center.png";s:10:"dimensionW";i:0;s:10:"dimensionH";i:0;s:3:"rss";s:2:"on";s:4:"atom";s:2:"on";}}      So I can see the data I want right there, and I know I need to create another function that takes the first result and extracts just the value with the key URI, but I can't figure out what that function should look like. I haven't really figured out "array thinking" yet, despite a lot of time looking at this page on the PHP manual. http://php.net/manual/en/control-structures.foreach.php Any advice on construction?


title: Problems with custom post type and hierarchical permalinks

text: I have a custom post type "films" and a hierarchical taxonomy "genre" (terror,drama, action) I would like to obtain this urls:               www.domain.com/films  ----------------------------------> all the films     www.domain.com/films/terror/ ---------------------------> all terror films     www.domain.com/films/terror/vampires -------------------> all vampire films     www.domain.com/films/terror/vampires/post-name ---------> the post      How can I do it?


title: Replace get_the_title and the_exerpt with custom arrays

text:
Here is the code in home.php:               <?php get_header(); ?>

             <?php          $cat1 = stripslashes(get_option('lx_feat_cat'));          //The Query     query_posts('category_name='. $cat1 . '&showposts=9');     //The Loop     if ( have_posts() ) : while ( have_posts() ) : the_post();          $link = get_permalink( $post->ID );     ?>
             <a href="<?php echo $link ?>">             <?php                  if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.                 the_post_thumbnail('thumbnail-home');                 }              ?>
             <?php $slide_title = get_the_title(); ?>
<?php _e($slide_title, lexington-theme); ?>
             <?php the_excerpt(); ?>

                     <?php endwhile; endif;     //Reset Query     wp_reset_query();     ?>

        I would like to replace get_the_title with a custom title and a custom the_exerpt for each slide. I figure I could create two arrays with my custom titles and exerpts and pull those instead of the ones from the database:               <?php     $get_the_title() = "Custom title 1";         $get_the_title() = "Custom title 2";         $get_the_title() = "Custom title 3";          etc for 9 slides..              $the_excerpt() = "Custom exerpt 1";         $the_excerpt() = "Custom exerpt 2";          etc...      My angle was replacing $get_the_title() with $get_the_title_custom[$link] but no luck. Not being that skilled in php, I cannot figure out how to do it without breaking something. Any help would be much appreciated.


title: jQuery code not working when included in functions.php

text: I feel like I am definitely missing something simple here... but for the life of me, can't find what I'm missing. I am of the "bad habit" of including jQuery functions directly in the header.php file (among other spots). This is frowned upon, as I understand, and functions should be kept in a separate file using the wp_enqueue function to load them (if I get that correctly). I have this simple function in my header.php that should fire on document ready:               <script>         // Scroll to Top         jQuery(document).ready(function () {             // Force element to hidden state when page loads             jQuery('.scroll-to-top').hide();                  // Check to see if the window is top if not then display button             jQuery(window).scroll(function () {                 if (jQuery(this).scrollTop() > 200) {                     jQuery('.scroll-to-top').fadeIn();                 } else {                     jQuery('.scroll-to-top').fadeOut();                 }             });             //Click event to scroll to top             jQuery('.scroll-to-top').click(function () {                 jQuery('html, body').animate({ scrollTop: 0 }, 800);                 return false;             });         });     </script>      So to do things "correctly", I take my code out and placed it in myScripts.js (removing script tags of course). I've created a functions.php file specific to my theme, and I've added this code:               <?php         function add_my_script() {             wp_enqueue_script(                 'myScripts', // name your script so that you can attach other scripts and de-register, etc.                 get_template_directory_uri() . '/js/myScripts.js', // this is the location of your script file                 array('jquery') // this array lists the scripts upon which your script depends             );         }              add_action( 'wp_enqueue_scripts', 'add_my_script' );     ?>      But when I load my page, the script doesn't work anymore. It's been working fine the "wrong" way for months now, but I'd really like to get it working as it should before I keep adding other scripts to the site. Any thoughts on what I'm missing here? Do I need another line / call somewhere to activate the script?


title: Show/Hide Custom Meta Boxes using any plugin

text: How can I show and hide the custom meta fields created using Advanced Custom Fields plugin? I want to handle the publish and unpublish of the fields and values from the admin panel. Is there any plugin for this?


title: Remove custom taxonomy 'post-type' from post URL

text: I want to remove custom taxonomy 'post-type' from post URLs like:               http://example.com/wordpress/post-type/post1      to               http://example.com/wordpress/post1      I have used lots of plugins and rewrote URL. But didn't get success. I can not mention real site URL.


title: How to add wordpress blog to Windows 2008 R2 site

text: One way is to install php and wordpress on server following WordPress Windows 2008 Web Server R2 IIS 7.5 setup. Is it possible to reroute url like blog.yourcompanyname.com to another ip address and use linux host to do job?


title: WordPress total posts per page changed and now 404 Http error comes out

text: I have migrate my web site from Joomla to WordPress. All are fine, I have create my Rewrites in htaccess to stop 404 from old URLs but I have problem with pagination. In Joomla web site, I had 6 posts per page, but now in WordPress I need to display 10 posts per page. That's fine too. The problem is that, in WordPress site now the very very last pages return 404 error because of the 10 posts per page I use now. i.e.: In Joomla to get the 60th article I had to go on page 10, but now page 10 does not exists anymore, because In WordPress the very very last page now is the page 6. In that case, I will try to access the 7th, 8th, 9th or 10th page I get a 404 HTTP Error. How can I fix that?


title: <!--more--> help

text:
I have a custom post type called "Blog", in my templates I looping over the blog type and doing the following,               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<?php echo strtolower(the_title()); ?>

<?php userphoto_the_author_thumbnail();?> Posted By <?php the_author(); ?> - <?php the_date("l jS M Y"); ?>

                         <?php $tags = wp_get_post_tags($post->ID); ?>                         <?php foreach ($tags as $tag) : ?>                             <a href="<?php echo $tag->slug; ?>"> <?php echo $tag->name; ?>  |                         <?php endforeach; ?>
                         <?php the_content("Read More"); ?>
             <?php endwhile; endif; ?>      My post consists of this content,               Hello World I am teaser              Hello World I am a the content      I am expecting the output to looks like this,               Hello Word I am teaser     Read More      However what I am getting is the following,                  Hello World I am teaser               Hello World I am a the content


title: Want Page Title to show on menu, but not on page

text: I have set up a static home page. I would like the title, Home, to show on the menu, but not on the page. Can you tell me how to accomplish this? Thank you.


title: PHP or JS for header image rotator?

text: I'm working on a site that is using this PHP script to load a random header image every time it reloads. I would like to use Javascript instead to allow the browser to cache images and improve load times and was wondering if there's any benefit to using the PHP script over some JS script for this scenario.


title: Widget content turns up before title

text: I've recently been trying to create a 'Popular Products' widget for for WP e-Commerce. Since there isn't built-in functionality, I referred to Dave Mackintosh's post here and gave it a shot. Still no success. But since there's a shortcode, I decided to use the 'Shortcodes in Widgets' plugin and place the shortcode in a text widget. It works now, but the issue now is the product list appears outside the widget area, just floating in the sidebar.


title: Two-step login process - Is it possible?

text: Is it possible to do the following with Wordpress (without hacking too much code - I would like to make this a general plugin using simple hooks)?   1. Log in with the username/password.   2. If username/password correct then have another authentication step (a token or a question).   3. If token is also correct, then give user access. For those of you that have bank accounts with Bank of America, this is very similar to their "sitekey" login system. If anyone has any tips or plugin examples, don't hesitate to link them. Thank you! This is virtually identical to the following question: http://wordpress.org/support/topic/two-step-authentication-login-needed on the official forums.


title: Importing multiple RSS feed into Wordpress and sorting them by date

text: I have found the following code to import feeds from multiple feeds and show them in wordpress. But, I want to sort all the combined feeds by date and show only 10. How can I do that? Thanks               <?php       $feed = fetch_feed(array('http://www.site1.com/feed/', 'http://www.site2.com/feed/'));     foreach($feed->get_items() as $item) {        echo $item->get_title();     }     ?>


title: Help with Wordpress function inside a shortcode

text: I'm trying to spice up a theme of mine with some shortcode buttons but I'm having quite a bit of trouble when trying to call the author's name within the button itself. I tried simply including               <?php echo do_shortcode('[button type="square" color="black" size="small"] Posted by <?php the_author(); ?> [/button]'); ?>      in the theme where I want the button with the author's name to appear, but it just gives a button that says 'Posted by '. I'm not the most experienced coder, but I know a little bit of everything from tinkering with various themes over the years. All help is appreciated, thanks in advance! -Matt


title: Favicon not working properly in chrome and in firefox

text: I am using wordpress for my website. I put the favicon.ico file in the wp- content folder and I inserted this code into the header: `<link href="http://seriousautosport.com/wp-content/favicon.ico" rel="shortcut icon" type="image/x-icon" />` Now the favicon works when I'm on the home page and it works on some other random pages. But not on every page. This happens in Chrome and in Firefox. IE works fine and I know why. But how do I get it to work in Chrome and Firefox? Help.


title: Pagination problem (plugin wp-pagenavi) with a custom post type?

text: I am currently developing a WordPress website with a custom post_type called "music". I use the plugin wp-pagenavi to paginate content "music". When I link on the first page, it's OK (see link below) http://carbonpaper- dev.imperatorium.org/music/page/1 But when I link on the 2nd page: http://carbonpaper- dev.imperatorium.org/music/page/2 the expected content is printed, but the template displayed is not the one related to the "music" `post_type/page` as the first page do but the one related to classic "posts" (not the same sidebar, no inclusion of music playback on click. ..) Here is my .htaccess:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-F     RewriteCond %{REQUEST_FILENAME} !-D     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      Should I change this file? otherwise how to fit the extension `wp-pagenavi` with a custom post_type? or what should be the name for the file `{filename}.php` in order to respect hierarchy template? Thank you for your reply, and apologies for my English, I'm French...


title: Set RSS feed update time

text: I want to update my feed just once a day. For example: I want to update the feed every day at 12:00 pm. How to do this without a plugin ?


title: update_option method with support of utf8

text: I am using a plugin the updates the option table using update_option command. When I update content with hebrew characters it turns into gibrish. My database does support hebrew (or any other utf8 chars). Is there any workaround? Thank you!


title: Custom fields doesnt work well with any postTAB plugin

text: Here is my problem: I tried to implement custom fields (text) within a post tab. I tried many post tab plugins and the imlementation to template was succesfull... Unfortunately, the content of the custom field is showing always on TOP of the content and not inside... I tried eveything and every plugin, still same issue. I tried so far: WP UI, Post UI, Easy responsive tabs, everything. My following code:               <?php       $tabContent =  the_field('kotoba');      echo do_shortcode('[restabs alignment="osc-tabs-left" responsive="false"]          [restab title="Tab number 1" active="active"]'.$tabContent.'[/restab]     [restab title="Tab number 1" active="active"]'. the_field('text_field').'[/restab]     [restab title="Tab number 4"]Tab 4 content goes here.[/restab][/restabs]');               ?>


title: How do I prevent one of two multiple loops from repeating on a second page?

text:
I have a page with multiple loops, but the first loop repeats on the second (or Older) page. I want to keep the formatting but stop the post from repeating. You can see the problem here: http://violentology.com/blog/ In my index.php file, I have the code:

                                  <?php get_the_image( array( 'meta_key' => 'feature_img', 'size' => 'full size', 'height' => '450', 'image_class' => 'post-feature-1' ) ); ?>

         <?php get_template_part( 'loop', 'index' ); ?>

         <?php get_sidebar(); ?>

`      In my loop, the code is as follows:
     <?php $my_query = new WP_Query('posts_per_page=1');       while ($my_query->have_posts()) : $my_query->the_post();       $do_not_duplicate = $post->ID;?>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>

<?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?> | <?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?>
                  <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>             <?php the_excerpt(); ?>     <?php else : ?>             <?php the_content(); ?>     <?php endif; ?>       <?php endwhile; ?>
               <?php /* Start the Loop. */ ?>     <?php if (have_posts()) : while ( have_posts() ) : the_post();        if( $post->ID == $do_not_duplicate ) continue; ?>

<?php get_the_image( array( 'meta_key' => 'feature_img', 'size' => 'medium', 'height' => '200', 'image_class' => 'post-feature' ) ); ?>

<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>

<?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?> | <?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?>
                  <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>             <?php the_excerpt(); ?>     <?php else : ?>             <?php the_content('Continue Reading',FALSE,''); ?>     <?php endif; ?>
          <?php endwhile; // End the loop. ?>          <?php endif; ?>
                 <?php next_posts_link('« Older') ?> | <?php previous_posts_link('Newer »') ?>
`


title: Best structure for entering recipes in a WordPress theme?

text: I'm working on building a recipe/meal planning site in WordPress. I need to have recipes indexable and sortable by the ingredients required, and I'm trying to figure out the best way of doing that. Ideally, I would like to have ingredients in one taxonomy, and utensils/appliances required in another taxonomy. I'm coming up against a stumbling block, though, because I can't think of any simple way to associate measurements with the ingredients. Where I'm at now is using custom fields for the ingredients and values for the measurements and units, like this: **Meta Key:** eggs **Meta Value:** 3|eggs **Meta Key:** flour **Meta Value:** 2.75|cups and so on. My question is, is there a better way of structuring this information? Related, there apparently is a microformat specification for recipes, which is essentially the format I plan on using for display. There is a WordPress plugin (hRecipe) to generate this output format, but its not semantic enough for my liking. If/when I figure out a better way of storing this kind of data, I'll probably release it as plugin...


title: What theme is good for posting code?

text: I have my blog hosted at www.alphaot.com and I guess it's good enough. But problems arise when the lines of code get longer than 30 characters. The lines just wrap and get icky or something they even don't wrap! In your experience what's a great WordPress theme for a developers blog to post code to? Also, I'm using Windows Live Writer, any extensions for code publishing you would recommend? **Edit:** More than plugins, I'm interested on a clean, free wordpress theme that is WIDE so the code doesn't have to be wrapped.


title: Order posts by price

text: I have a list of products on a page and am trying to order them by a custom field called "price". Unfortunately, $3,950,000 is coming before $349,000. I've used a couple of codes but neither one is working. Does anyone have any suggestions? Thanks. Here's the first code I've tried.               $query = new WP_Query( array ( 'post_type' => 'product', 'orderby' => 'meta_value', 'meta_key' => 'price', 'order' => 'ASC' ) );      Here's the other code I've tried.               $query = new WP_Query( array ( 'post_type' => 'product', 'orderby' => 'meta_value_num+0', 'meta_key' => 'price', 'order' => 'ASC' ) );


title: Permalink/Pagination issue: Category base name same as page name

text: I currently have a page called "Blog" (slug "blog"), which loads a index.php. All posts in index.php belong to only one post category. A sidebar on index.php contains category links (via wp_list_categories) which load archive.php for that given taxonomy. The problem I am running into is that I currently have the category base name set to the same slug as the page: "blog". I am aware that this can cause issues with the rewrite rules, but for the most part everything looks fine. The only issue is with pagination pages for index.php (mysite.com/blog/page/2 does not work while mysite.com/blog/foo-category/page/2 works fine). Is there a rewrite rule that can help with my current situation? And if so some help would be appreciated. If this is a bad idea, please speak up as well. I was hoping to achieve a somewhat RESTful url structure, but wordpresses permalink structure doesn't appear to be the most flexible. Thanks


title: Ajax calls in wordpress

text: I want to send a ajax request in wordpress which tracks my clicks. For now i have added this in my functions file :               add_action('init', 'my_script_enqueuer');            function my_script_enqueuer() {         wp_register_script("history_script", get_template_directory_uri() . '/js/history_script.js', array('jquery'));         wp_localize_script('history_script', 'myAjax', array('ajaxurl' => get_template_directory_uri().'/functions.php'));         wp_enqueue_script('jquery');         wp_enqueue_script('history_script');       }            add_action("wp_ajax_history_trace", "history_trace");            function history_trace() {           echo 'fasfasgasgas'; die;     }      and in my js file :               jQuery(document).ready( function() {             jQuery("#searchsubmit").click( function() {            jQuery.ajax({              type : "post",              dataType : "json",              url : myAjax.ajaxurl,              data : {action: "history_trace"},              success: function(response) {                 if(response.type == "success") {                    alert('success')                 }                 else {                    alert("false")                 }              }           })                })          })      But when i see my console the rquest appears in red color and there is no response. Please Help!!


title: Creating a custom menu with icon fonts

text: I want to create a custom menu with icon font markup. So I may need to have my list item have e.g. this:               <i class="gen-enclosed foundicon-left-arrow"></i>      contained inside anchor - or even some special characters. Does anyone have any experience doing this and how would I make this as user- friendly as possible, customizable from the admin?


title: Wordpress Recent Comments Widget exclude own comments

text: apologies I have searched either for a recently updated plugin or article and cannot find anything. I am using the standard Recent Comments widget in my sidebar. I like to respond to all comments but don't want my comments to appear in recent comments. For me the filter could work by role or user id (I am the only admin). Is this possible within say functions.php or is there a better way to achieve this - for an amateur :-) Would very much appreciate any guidance.


title: Customizing template menu output to fit zurb foundation markup

text:
I want to have custom main menu markup in my Wordpress template. I want it to fit Zurb Foundation markup - to be specific - for submenus. I've figured out how to customize class & id if list items in navigation. But now I want to conditionally apply proper class to list item which contains submenu (so I can apply proper styling & behavior for dropdown). So I want to achieve this:
Some Link

Some Label

Some Link

      I want to be able to edit also the (multiple) label of (parts of) submenus etc. I understand what this may require is to create a custom Walker class, etc. How I may go about achieving this, what will I put (if) in that class, and where I may put that file/class and how to have it required/included/autoloaded in my template files.


title: Do I require the use of nonce?

text: Im creating a visit/page views counter with ajax,jquery and php, I have been reading a few articles that recommend the use of nonces for data manipulation through ajax, however i am not sure if i need to integrate the use of nonces for my simple counter? my code looks somewhat like this; **jquery**               jQuery.ajax({             type: 'POST',             url: ajaxurl,             data: {action: 'countHits', status: 'true'},             });      **php**               //ajax functions     add_action('wp_ajax_countHits', 'countHits');     add_action('wp_ajax_nopriv_countHits', 'countHits');     function countHits() {              if($_POST['status'] != "") {            $status= $_POST['status'];              if(!isset($_COOKIE['UNIQUEUSER'] && $status == 'true'){            $uniqueUser= get_option('stats');            $uniqueUser['uniqueUser']+=1;            update_option('stats', $uniqueUser);         }     die();      }      So as you can see it is very simple, do I need to use nonces for each ajax request?(i have two separate request in my jquery which return variables one for false one for true) furthermore, if I wanted to implement nonces how would i go about doing that?


title: menu_order not working with slugs that start with admin.php

text: I am filtering the menu_order hook (codex link -> http://codex.wordpress.org/Plugin_API/Filter_Reference/menu_order) to change the order of my links in the admin menu. Currently the ordering will not work on slugs that begin with admin.php, so a settings page with the slug "admin.php?page=custom_settings_page" will just go to the bottom of the list. Anyone know of a workaround for this?               //change admin menu order     add_filter('custom_menu_order', 'my_custom_menu_order'); // Activate custom_menu_order     add_filter('menu_order', 'my_custom_menu_order');          function my_custom_menu_order($menu_ord){          if(!$menu_ord) return true;     return array(         'index.php', //dashboard         'separator1', //first separator         'edit.php', //posts         'edit.php?post_type=custom_post_type1', //custom post type 1         'edit.php?post_type=custom_post_type2', //custom post type 2         'edit.php?post_type=custom_post_type3', //custom post type 3         'upload.php', //media         'separator2', //second separator         'admin.php?page=gf_edit_forms', //THIS GOES TO THE BOTTOM         'edit.php?post_type=page', //pages         'edit-comments.php', //comments         'separator-last', //last separator         'themes.php', //appearance         'admin.php?page=custom_settings_page', //THIS GOES TO THE BOTTOM         'plugins.php', //plugins         'users.php', //users         'tools.php', //tools         'options-general.php' //WordPress options     );          }


title: Is there an A/B testing plugin that lets you vary the heading, featured image, and content in a Wordpress post?

text: If not, are there alternate solutions that can let me accomplish this? Do I need to develop my own plugin?


title: Plugin to Consume a Web Service

text: I'm attempting to write a knowledge base plugin to consume the Salesforce API and pull in solutions in a RESTful style application path; however, some of the core plugin concepts escape me. For example, use of add_rewrite_tag from the Rewrite API produces the following argument error:               Missing argument 3 for WP_Rewrite::add_rewrite_tag()      Forgive my ignorance with the Wordpress core, but doesn't the documentation only describe two arguments? Rather than chase an argument error which probably won't help me much in the grand scheme of things, I would like to start simple and produce statically generated content at a custom URL. For example:               http://example.com/knowledge-base/      Where knowledge-base is handled by a rewrite rule via my custom plugin which in turn would output a simple "Hello World" message with the theme's header/footer wrapped around it. Does anyone know of an existing plugin I can review that demonstrates rewrite concepts a little more clearly than the codex documentation? It seems most examples I've run across append content to existing pages/posts whereas I'm looking to generate something entirely new based on external content.


title: Wordpress 3.2 query_posts and pagination, permalinks issue

text: My question is not new but it just does not work with all found solutions in my case. I am trying to display recent posts on single post using custom query_posts loop. The permalinks structure must be this one: /%category%/%postname%/ Wordpress version: 3.2.1 The page has 2 loops:               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>         <!--first content part-->     <?php endwhile; endif;?>          <?php     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     query_posts('posts_per_page=3&paged='.$paged);          if (have_posts()) : while (have_posts()) : the_post(); ?>         <!--recent posts-->     <?php endwhile; endif; wp_reset_query();?>      So calling next page like http://www.domain.com/category/post-one/page/2/ simply strips off /page/2/ and does nothing else. I am desperate already for looking a working solution and not sure if its possible to fix. Thank you.


title: Numbers of new post since the last visit of user

text: I need to count the number of new post since the last visit of the user on my blog, is it possible? Thanks to all for your help!


title: Theme Customizer not loading JS for live preview

text: I am currently working on adding options to the theme customizer. For the last two hours I have been trying to get the live preview working and I am trying figure out why my theme isn't loading the `theme-customizer.js` file needed for the live preview. All of the options I have added to the theme-customizer work if I save it and then refresh the page. So I know it isn't an issue with the settings. I currently have the hook to call the JS file within the `customize.php` file along with all of the settings for the customizer. I also have a separate `theme-enqueue.php` where I enqueue the other JS files for my theme. Here is an example of the hook I am trying to call the JS file from within my `customize.php` file:               function mytheme_customize_preview_js() {     wp_enqueue_script( 'mytheme-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20120187', true );     }     add_action( 'customize_preview_init', 'mytheme_customize_preview_js' );      When I check the loaded javascript files within chrome, it seems to load all of the ones I need except for this one. Can anyone shed some light on the situation?


title: Custom Post Type / Taxonomy Slug / Post Title with post type archive

text: I've tried plugins, read through stack and spent hours on this, and I just can't seem to find a way to achieve what I want. I can achieve the following permalink structure: `custom-post-type/taxonomy-term/post-title` for example, `our-work/interactive/some-project-title` which also allows `our-work/interactive` to correctly display all our-work posts with the taxonomy term interactive, but I can no longer get the archive page `our-work` to work, here is the code I'm using to achieve the above               function my_custom_post_work() {         $labels = array(             'name'               => _x( 'Work', 'post type general name' ),             'singular_name'      => _x( 'Work', 'post type singular name' ),             'add_new'            => _x( 'Add New', 'book' ),             'add_new_item'       => __( 'Add New Work' ),             'edit_item'          => __( 'Edit Work' ),             'new_item'           => __( 'New Work' ),             'all_items'          => __( 'All Work' ),             'view_item'          => __( 'View Work' ),             'search_items'       => __( 'Search Work' ),             'not_found'          => __( 'No work found' ),             'not_found_in_trash' => __( 'No work found in the Trash' ),              'parent_item_colon'  => '',             'menu_name'          => 'Our Work'         );         $args = array(             'labels'        => $labels,             'description'   => 'Holds our works and work specific data',             'public'        => true,             'menu_position' => 5,             'supports'      => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),             'has_archive'   => true,             'rewrite'       => array( 'slug' => 'our-work/%work_category%')         );         register_post_type( 'work', $args );         }     add_action( 'init', 'my_custom_post_work' );          function mav_taxonomies_work() {         $labels = array(             'name'              => _x( 'Work Categories', 'taxonomy general name' ),             'singular_name'     => _x( 'Work Category', 'taxonomy singular name' ),             'search_items'      => __( 'Search Work Categories' ),             'all_items'         => __( 'All Work Categories' ),             'parent_item'       => __( 'Parent Work Category' ),             'parent_item_colon' => __( 'Parent Work Category:' ),             'edit_item'         => __( 'Edit Work Category' ),              'update_item'       => __( 'Update Work Category' ),             'add_new_item'      => __( 'Add New Work Category' ),             'new_item_name'     => __( 'New Work Category' ),             'menu_name'         => __( 'Work Categories' ),         );         $args = array(             'labels' => $labels,             'hierarchical' => true,             'has_archive'   => true,         );         register_taxonomy( 'work_category', 'work', $args );     }     add_action( 'init', 'mav_taxonomies_work', 0 );          function filter_post_type_link($link, $post) {         if ($post->post_type != 'work')             return $link;              if ($cats = get_the_terms($post->ID, 'work_category'))             $link = str_replace('%work_category%', array_pop($cats)->slug, $link);              return $link;     }     add_filter('post_type_link', 'filter_post_type_link', 10, 2);      Ideally I'd like the following to work:   * `/our-work/` => display all custom posts   * `/our-work/taxonomy-term/` => display all posts with that term selected   * `/our-work/taxonomy-term/post-title/` => the permalink whenever a specific post is clicked. Is there a better way / a way to do this?


title: Multisite new sites not found(404), main site still works

text: I followed wordpress guide to install multisite. My main site (mydomain.com) works well, my multisite is based on subdirectory i.e., (mydomain.com/test/), however it doesn't load at all (404 error). more details                $ cat .htaccess           RewriteEngine On      RewriteBase /wordpress/      RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin      RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]           RewriteCond %{REQUEST_FILENAME} -f [OR]      RewriteCond %{REQUEST_FILENAME} -d      RewriteRule ^ - [L]      RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]      RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]      RewriteRule . index.php [L]      * * *                $ cat wp-config.php          /* Multisite */      define( 'WP_ALLOW_MULTISITE', true );           define('MULTISITE', true);      define('SUBDOMAIN_INSTALL', false);      define('DOMAIN_CURRENT_SITE', 'mydomain.com');      define('PATH_CURRENT_SITE', '/wordpress/');      define('SITE_ID_CURRENT_SITE', 1);      define('BLOG_ID_CURRENT_SITE', 1);          /* That's all, stop editing! Happy blogging. */      * * * It will be great if you can help to fix it. thanks


title: SlideDeck 2, make back-end visible for admins only

text: I'd like to make the back-end of the SlideDeck 2 plugin visible for admin users only.   Also, I'd like to remove that "Insert SlideDeck" button from the editor. How can I do this?


title: How to allow user to select User ID in Formidable Pro form?

text: The goal of this formidable pro form requires three non-standard things to occur. I've written a custom plug-in with code that accomplishes two of the three goals, but I am unable to get the third requirement to work. REQUIREMENT #1: Make the normally hidden UserID field visible to all users of the form, even if they are not logged in to the site. THIS WORKS! REQUIREMENT #2: Filter the contents of this drop-down field so that it only displays a list of users whose role=author, instead of ALL users. THIS WORKS! REQUIREMENT #3: Once the user makes a selection, that value is passed to the UserID variable, such that once the form is submitted, it is treated as if the User selected from the drop-down was the author of the form. HERE IS WHERE I NEED HELP! Here is the code that works for #1 and #2, but fails at #3.               add_filter('frm_setup_new_fields_vars', 'show_user_dropdown', 15, 2);     add_filter('frm_setup_edit_fields_vars', 'show_user_dropdown', 15, 3);     function show_user_dropdown($values, $field, $entry_id=false){     if( $field->id == 898 ){     $values['type'] = 'select';     $values['use_key'] = true;     $values['custom_html'] = FrmFieldsHelper::get_default_html('select');     $wp_user_search = new WP_User_Query( array( 'role' => 'author', 'fields' => array('user_login', 'ID') ) );     $authors = $wp_user_search->get_results();     $values['options'] = array();     foreach ($authors as $a) {     $values['options'][$a->ID] = $a->user_login; } }     return $values; }      Notice that nothing has been assigned to the variable $values['value']. Every attempt I've made to assign something (i.e. ID) to that variable fails to work. Also, if I change this line:               $values['options'][$a->ID] = $a->user_login;      to:               $values['options'][$a->ID] = $a->ID;      Then Requirement #3 works, but #2 fails in part. The User ID WILL be correctly passed to the $values['value'] variable, and the submission will appear to have been authored by the selected user from the drop-down. However, the drop- down will display a list of integers (ID) rather than the user names (user_login). Any help would be greatly appreciated!