How does order=asc effect a wp_query (its acting pretty weird in a loop)

I have a wp_query for a custom post type: events. I have a seven day calendar that is showing featured events on a page. Here is the wp_query and supporting code: https://gist.github.com/1030760 you can see the calendar at seattleite.com/calendar/ the thing works great with one exception. It should be showing a featured event on Sunday. If I change the order => 'asc' to order => 'desc' I see the event for sunday but then I lose the event for today. If I simply remove the order => item then I see what I see if I set order => 'desc' any idea how order is affecting my loop?


Custom post type's get_permalink returns wrong url

Currently my permalink setting is `/paper/%postname%/`. I am developing a plugin, so the following is done during the activation. I am programatically adding a new custom-post-type called 'meta', like this (at 'init'):               register_post_type( POST_TYPE,       array(       'labels' => array('menu_name' => 'meta'),       'public' => true,       'rewrite' => array('with_front'=>false,'slug'=>'meta','pages'=>false)       )     );      Then in the activation I programatically added a meta post, and use `get_permalink()`. But I get the following url: `http://localhost/wordpress/paper/faq/` This url leads to the 'not found' page. The correct url should be: `http://localhost/wordpress/meta/faq/` In the admin meta post edit page, the displayed permalink is the correct `http://localhost/wordpress/meta/faq` I also tried to `flush_rewrite_rules();` before I call `get_permalink()`. But it didn't work. Does anyone have any idea?


Form clears on focus

I have this form for in the admin, and it auto fills the next fields, which are similar to this one, via Ajax. That works fine, however, after pressing tab to go to the next input field, it clears that field. I don't want that to happen. It doesn't seem to be any of the classes. What can it be? I am using firefox.                   <form name="post" action="' . admin_url("admin.php") . '" method="post" class="initial-form hide-if-no-js">
                              Title
                     <input name="title" id="title" autocomplete="off" type="text">


Change the avatar ratio in bbPress login widget

I am using bbPress on my site and have (bbPress) Login Widget on my sidebar. Is there a way to change the default image size from 40 to 80 or other number? here is the code from the core files: ` <?php echo get_avatar( bbp_get_current_user_id(), '40' ); ?> ` How do I change that default 40 px without editing the core files?   Can i filter it somehow? Thanks in advance, you are my last hope to find answer to this problem of mine!


Custom Plugin w/ Custom Post Types - Custom Posts Are Showing at all Privilege Levels - Is this possible to adjust?

We created a custom plugin. The custom plugin allows users to post specific post types. Under each user account, all of these custom post types display under the relative post type. For example, user Foo logs in and posts A, B and C Articles. Then, user Bar logs in and can see A, B and C Articles in his Articles post type list. User FooFoo can also see Articles A, B and C. These Articles are shared across all users BUT we need the Articles confined only to the specific user they belong to. Is this possible? Since we are using our own custom plugin and creating these custom posts utilizing the standard WP custom post types?


register_post_status and show_in_admin_all_list

I have a custom post status which should be public visible but not displayed in the "all" list of the edit screen. This is how I register the post status:               register_post_status('my_custom_post_status', array(         'label' => __('The Label', 'domain'),         'public' => true,         'exclude_from_search' => true,         'show_in_admin_all_list' => false,         'label_count' => //blablabla     ));      The `show_in_admin_all_list = false` should hide the status in the all-list but it doesn't. Only if I set the public to false it is not visible. But I need `public = true`! Any ideas Codex: http://codex.wordpress.org/Function_Reference/register_post_status


Wordpress rewrite rule not working

www.xyz.com/place?id=(variable)      which I would like in the format:               www.xyz.com/places/(variable)          www.xyz.com/tags?id=(variable)      which I would like in the format:               www.xyz.com/type/(variable)          www.xyz.com/things-to-do-in?id=(variable)      which I would like in the format:               www.xyz.com/things-to-do-in-(variable)      I tried               add_rewrite_rule(         '^http://www.xyz.com/things-to-do-in-([^/]*)/?',         'http://xyz.com/things-to-do-in?id=$matches[1]',         'top'     );      but its not working. What should I do?


Taxonomy terms with the same name are updated between separate custom post types

I have 3 custom post types, and they each have a taxonomy labelled `location`, with some term names shared between them. The problem is, if I update a term name in any of the 3 custom post types, it updates the other 2 also, if the same term name is found. This also happens for the slug of the term Each is registered with different names, so for example:   1. location-A   2. location-B   3. location-C They each have also been assigned to completely different post types. Their slugs are also different. The only thing that's really the same is the locations labels in the admin menus. Normally I wouldn't mind the names updating across each of the taxonomies, but it's causing a headache when limiting search results to each post type. I'm getting posts showing up where they shouldn't. I have also tested this with a another taxonomy, and their shared term names also update each other. It seems to be the naming of the term that's the issue. Is this a bug or am I overlooking it too much? can you just not have 2 terms, in completely different taxonomies and post types with the same name/slug?


ajax for visitors wordpress

I have this code that does ajax in wordpress it is working fine in admin page but i want it work in the main page of my theme                 <?php        add_action( 'admin_footer', 'my_action_javascript' );           function my_action_javascript() {         ?>          <script type="text/javascript" >      jQuery(document).ready(function($) {          var data = {         action: 'my_action',         whatever: 1234     };                                                                                // since 2.8 ajaxurl is always defined in the admin header and points to admin-      ajax.php       $.post(ajaxurl, data, function(response) {         alert('Got this from the server: ' + response);         });            });         </script>      <?php         }           add_action( 'wp_ajax_my_action', 'my_action_callback' );           function my_action_callback() {     global $wpdb; // this is how you get access to the database          $whatever = intval( $_POST['whatever'] );          $whatever += 10;              echo $whatever;          die(); // this is required to return a proper result         }                  add_action( 'wp_ajax_my_action', 'my_action_callback' );        add_action( 'wp_ajax_nopriv_my_action', 'my_action_callback' );


WordPress site causing lots of server IO

Hi I have a VPS and one particular site is apparently causing the server to crash and I am getting alerts about lots of IO going on. How can I troubleshoot to see what is causing the extra load?


How can I use custom properties to set different background on different pages?

The problem isn't that complex (compared to the description I'll write :)) but I'd like to do this as correct as possible (e.g. I could be doing it wrong with Home.php), so I'll give you the whole context. As a part of my design, the page displays different background images. For that I use Supersized, "a fullscreen background slideshow built using the jQuery library". Some of my pages use one background image (no slideshow obviously :), and some use three. Also, I use javascript to detect the users monitor resolution and serve him an appropriate image size:               var imageToBeLoaded = "images/bg_index.jpg";     $(document).ready( function () {     if(window.screen.width > 1024) {       imageToBeLoaded = "images/bg_index_large.jpg";     }});      So the problems are: a) Home.php isn't a page accessible through WP-Admin so I can't give it custom fields. Solution: `if (isHome()){ setDefaultalues();}` b) If I'm not on the homepage, I need to get the custom fields key/vaules but only for the properties that are related to the image background (and as I said before, ever page has 1 to N number of background images). For example, my About page has 5 properties, `bgImg1`, `smallImg1`, `bgImg2`, `smallImg2` and `greeting text`. That means I need to get all the variables and parse the name so I can get e.g. `bgImg1` and `bgImg2`. Additionally, Supersized needs a text description as another parameter, so the page needs to have two more parameteres, `desc1` and `desc2` which I also need to get and combine with the appropriate `bgImg` so I can generate output that looks like this (from the static page): `{image : 'images/bg_rwanda.jpg', title : 'Rwanda Home'}, {image : 'images/bg_rwanda2.jpg', title : 'Rwanda School'}` Pseudocode would look something like this:               var output = "{image : '";     var imageIsLarge= false;     if (getResolution() > 1024 ) { imageIsLarge= true; }     while (hasNextProperty()){       Property prop = nextProperty();       if (imageIsLarge) {           if (prop.getKey().startsWith (bgImageL)){              output += prop.getValue()+", title:";              // etc. Also, I need to set the code to first get the first img,               // not just in any order and pair it with the first  description      Now this seems a bit complex and I have a feeling I could do it simpler, but I have no idea how.


How do I redirect a Wordpress Page

I have a Wordpress URL that looks like this "www.domain.com/wordpress-page" but I want people to be able to retrieve this page even if they type it without the dash (i.e., www.domain.com/wordpresspage"). Is there a WP setting that will redirect the incorrect URL to the correct one?


WordPress 'comment counts' got messed up, because of a plugin - DISQUS

I use wordpress and disqus plugin, when user add comment, after few minute, disqus agent will update wordpress database (wp_posts,wp_comments …etc),but when administrator delete comment, disqus will not update wp_posts's comment_count and wp_comments, I can't get accuracy comment_count and comment counts got messed up, how could I get accuracy comment_count of every post ? Thanks. Sonic


Remove Open Sans from Twenty Twelve theme

I´m creating a child theme for Twenty Twelve v1.0 and I want to remove the Open Sans font. Open Sans is added in Twenty Twelve´s functions.php:               wp_enqueue_style( 'twentytwelve-fonts', add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" ), array(), null );      I´ve tried to deregister/dequeue the stylesheet in my childtheme´s functions.php (see examples below) but to no effect:               function example_scripts_styles() {              wp_deregister_style( 'twentytwelve-fonts' );             wp_dequeue_style( 'twentytwelve-fonts' );     }     add_action( 'wp_enqueue_scripts', 'example_scripts_styles' );      Any ideas how I can remove this file? Thanks!


How to display a number of posts based on a Advanced Custom Field (ACF)

I have the following code working fine in my theme:                    <?php query_posts('showposts=5&post_type=news'); ?>               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
             <a href="<?php the_permalink(); ?>">                 <?php                      if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.                       the_post_thumbnail();                     }                  ?>
                     <?php the_title(); ?>

                <?php endwhile; else: ?>
Sorry, no posts matched your criteria.
      <?php endif; ?>               <?php rewind_posts(); ?>      I need to the number of posts to be based on a custom field. I am not sure how to go about doing this. My set-up: Page template: front-page.php Homepage: set to the 'home' Page Custom field: Custom field is in the 'Home' Page. I am using ACF plugin for custom fields Thanks UPDATE: - screenshots included of my setup ![Edit screen of the 'Home' Page](http://i.stack.imgur.com/er1zO.png) ![Site settings screen](http://i.stack.imgur.com/YZ2i8.png) ![Custom field setup using ACF plugin](http://i.stack.imgur.com/2fest.png)


update_post_meta not working in action hook

I'm having a real problem updating custom fields (within a custom post type) with data from the database. I have a table in the database called `wp_company_profiles` with address fields (i.e. address_1, address_2). I have set custom fields for each in the admin post area with the same values. I am trying to put together a hook that will retrieve the data from the database to update the custom fields. Below is the code, but I can't figure out what its missing.               function get_fields_company_profile($post_id)  {              global $wpdb;              if ($parent_id = wp_is_post_revision( $post_id )) $postid = $parent_id;              $postid = $_GET['post'];              $row = $wpdb->get_row( "SELECT * FROM wp_company_profiles WHERE pid = '$postid' " );              if ($row) {                  // retrieve fields from database             $address1 = $row->address_1;             $address2 = $row->address_2;             $postcode = $row->postcode;             $city = $row->city;                  // update custom fields in admin area             update_post_meta($post_id, 'address_1', $address1);             update_post_meta($post_id, 'address_2', $address2);             update_post_meta($post_id, 'postcode', $postcode);             update_post_meta($post_id, 'city', $city);         }     }     add_action('init', 'get_fields_company_profile');


How to display sub categories under products page using woocommerce with mystile theme

I have been trying to display my product subcategories after you click on the parent category but to no avail. It simply shows all my products for instance: Main product- Pacifier Clips, Subcat- NFL Pacifier clips, but once you click on main product(Pacifier Clip) it shows all Pacifier clips from every category without giving you the option to choose which category. I have tried the settings under catalog in woocommerce but with no success, I have ensured that my subcategories are linked to my parent category. I'm all out of ideas of what to do. I would be willing to add code to resolve the problem but am not sure which php file to edit under woocommerce. Anyone have any idea? Site address: www.innovativehouseholddesigns.com


Duplicate a Wordpress Install for Testing Purposes

I want to test some plugins on my Wordpress site. However, I do not want to mess anything up. Is there a way to duplicate my Wordpress site to a new directory so that I can test plugins there before I push them to the main site?


Page template doesn't display simple HTML if inserted into other page?

I've created a super simple contact page template, just content and a contact form, like so:               <?php     /*     Template Name: Contact     */     ?>          <?php while (have_posts()) : the_post(); ?>
             <?php the_content(); ?>             <form id="contactform" method="post" action="<?php bloginfo('template_directory'); ?>/_assets/submitemail.php">                 <input name="user"  type="text" value="Name" />                 <input name="email" type="text" value="E-Mail"/>                 <input name="url" type="text" value="Website" />                 <input name="subject" type="text" value="Subject" />                 <textarea rows="10" name="message" cols="50" id="message">Your message here...</textarea>                 <input type="submit" class="button" value="SEND" id="send" />

             </form>
          <?php endwhile; ?>      I then need to insert this page into another page (say, homepage) - using custom query. The query is irrelevant, I think, but it's basically getting all created pages and displaying their contents:               <?php          $temp_query = $wp_query;         $args = array('post_type' => 'page', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_status' => 'publish', 'posts_per_page' => 5,);         $wp_query = new WP_Query($args);     ?>          <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); ?>              <div class="block group" id="<?php echo $post->post_name; ?>">                  <?php the_content(); ?>
          <?php endwhile; ?>     <?php endif; ?>          <?php $wp_query = $temp_query; ?>      It seems to work fine for normal pages (those without a custom template), but for this contact page, I'm getting from the query is the content (`the_content()`) but not the form. I also have another custom page template that I'm trying to pull into the homepage, and it's doing the same thing. Any idea what would cause this problem? Never seen anything like that and I've been working with WordPress for years now... Thanks in advance! EDIT: I now see my problem - `the_content()` in my query works correctly - it pulls the entered content of the page. What I'm trying to achieve is get the entire content of the page, including my custom HTML, much like `include()` function in PHP. Would love some tips on how to do that.


Help with a custom rewrite

The following is a snippet from single.php
                                         <?php endif; ?>                                 <?php                                          if($_GET['m'] != "gallery") {                                                 the_content();                                         else {                                                 echo do_shortcode('[gallery link="file"]');                                         }                                 ?>                                                    <?php wp_link_pages(); ?>

      So if I append ?m=gallery to the URL it will convert single.php into a gallery, else it will show the normal content. I was wondering how I could rewrite ?m=gallery to just /gallery. I am using `/%category%/%postname%/` as a custom permalink structure. I would like `/%category%/%postname%/%m%` where %m% is $_GET['m']. My htaccess has the following:                   RewriteEngine On                   # 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      Any help is appreciated. Thanks.


How to get the posts published in last two days using WP_Query?

I am trying to loop through all the post to get the top most shared posts on social network. I want to use the `date_query` parameter in the `WP_query` to get the posts of last two days , last 5 days, last 7 days and last 9 days. How can i implement it through using the `date_query` in `WP_Query` My parameters of `WP_query` are               $args = array(         'post_type'      => 'post',         'order'          => 'desc',         'posts_per_page' => 4,         'orderby'        => 'meta_value',         'meta_key'       => 'esml_socialcount_total',     );


Action while post is being published

I modified the wordpress admin with a plugin I wrote, and my last problem is that there's no action anymore while the post is being updated or published in the admin. I looked around for a function or something that'ld let me do something while the post is being updated but so far I didn't have any luck. Anyone know how to do it ? I'ld like to add HTML (a div) if I can but really anything would be nice ! Thanks for your help :)


Custom SELECT Query With Multiple Meta Values (Ordering Problem)

I have two custom meta values that I am using for an events list and have almost got everything working perfectly except for the ordering. I have two dates (event_date and event_enddate). One of these is a start date which is always present, and the other is an end date which is only used when needed. I have created a query which lists all dates where either of these fields are equal or greater to today's date, which works fine. However, I want all of the events to be ordered solely by the event_date field. How can I do this? I've spent all day trying to do this and just can't work it out! Here's my code:               SELECT DISTINCT wposts.*     FROM $wpdb->posts wposts     LEFT JOIN $wpdb->postmeta wpostmeta ON wposts.ID = wpostmeta.post_id     LEFT JOIN $wpdb->term_relationships ON (wposts.ID = $wpdb->term_relationships.object_id)     LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)     WHERE ((wpostmeta.meta_key = 'event_enddate' AND wpostmeta.meta_value >= CURDATE())      OR (wpostmeta.meta_key = 'event_date' AND wpostmeta.meta_value >= CURDATE()))     AND wposts.post_status = 'publish'     AND $wpdb->term_taxonomy.taxonomy = 'category'     AND $wpdb->term_taxonomy.term_id IN(15)     AND wposts.post_status = 'publish'     ORDER BY wpostmeta.meta_value ASC


How to get ID of the page included with get_page()?

I'm rewriting the question, including exemplary code, I hope it will be easier to understand now. ## 1. My shortcode:                   function testid_shortcode( ) {              global $post;              return $post->ID;            }              add_shortcode('testid', 'testid_shortcode');        ## 2. The issue: I'm using the shortcode on page Example1 [ID=1]:               [testid]      Then I'm including it on different page Example 2 [ID=2]:               $included_page = get_page( $included_id );      $content = apply_filters('the_content', $included_page->post_content);      The shortcode returns "1" and "2" on these pages, while I want it to return "1" AND "1", so simply speaking I want it to retrieve the ID (specifically metaboxes) of the "original" page. Is it possible to fix it somehow? I guess it should be done within the shortcode itself, but have absolutely no idea how. I guess passing a variable with the "original" ID and overwriting the one shortcode gets will do the trick, but how to do that?


CDATA error for RSS feed

The RSS feed of my site is not working. The error message is: > A CDATA section was not closed line 33 character 25 with this on another line below:               <description><![CDATA[<br/>      When I tried to put my blog on amazon and feed burner, both indicated to me that my RSS feed did not work. I validated my RSS on feed validator, and they stated that it did not exist and that it was not valid.   On my blog, I took off my plug in and changed my theme, this did not help the problem. My idea was to go on feed burner and put in a second RSS feed, but I found this would not work without the first RSS feed working. How can I fix this?


Letting user dynamically create fields using Settings API

I created a settings page, using the Settings API, following this tutorial. Now I want to have a button that lets users dynamically add fields, similar to the way it is done in this other one. I don't want to try to "merge" these two things together. There must be a right way to do this. Can someone give me a clue, how to achieve this? I already found this in Pippin's Plugins, where he creates an array for his setting fields and displays them with a foreach-loop. But I'm not shure how this can help me.               /**      * This function introduces the theme options into the 'Appearance' menu and into a top-level       * 'Sandbox Theme' menu.      */     function sandbox_example_theme_menu() {              add_theme_page(             'Sandbox Theme',                    // The title to be displayed in the browser window for this page.             'Sandbox Theme',                    // The text to be displayed for this menu item             'administrator',                    // Which type of users can see this menu item             'sandbox_theme_options',            // The unique ID - that is, the slug - for this menu item             'sandbox_theme_display'             // The name of the function to call when rendering this menu's page         );              add_menu_page(             'Sandbox Theme',                    // The value used to populate the browser's title bar when the menu page is active             'Sandbox Theme',                    // The text of the menu in the administrator's sidebar             'administrator',                    // What roles are able to access the menu             'sandbox_theme_menu',               // The ID used to bind submenu items to this menu              'sandbox_theme_display'             // The callback function used to render this menu         );              add_submenu_page(             'sandbox_theme_menu',               // The ID of the top-level menu page to which this submenu item belongs             __( 'Display Options', 'sandbox' ),         // The value used to populate the browser's title bar when the menu page is active             __( 'Display Options', 'sandbox' ),                 // The label of this submenu item displayed in the menu             'administrator',                    // What roles are able to access this submenu item             'sandbox_theme_display_options',    // The ID used to represent this submenu item             'sandbox_theme_display'             // The callback function used to render the options for this submenu item         );              add_submenu_page(             'sandbox_theme_menu',             __( 'Social Options', 'sandbox' ),             __( 'Social Options', 'sandbox' ),             'administrator',             'sandbox_theme_social_options',             create_function( null, 'sandbox_theme_display( "social_options" );' )         );              add_submenu_page(             'sandbox_theme_menu',             __( 'Input Examples', 'sandbox' ),             __( 'Input Examples', 'sandbox' ),             'administrator',             'sandbox_theme_input_examples',             create_function( null, 'sandbox_theme_display( "input_examples" );' )         );               } // end sandbox_example_theme_menu     add_action( 'admin_menu', 'sandbox_example_theme_menu' );          /**      * Renders a simple page to display for the theme menu defined above.      */     function sandbox_theme_display( $active_tab = '' ) {     ?>

<?php _e( 'Sandbox Theme Options', 'sandbox' ); ?>
             <?php settings_errors(); ?>                  <?php if( isset( $_GET[ 'tab' ] ) ) {                 $active_tab = $_GET[ 'tab' ];             } else if( $active_tab == 'social_options' ) {                 $active_tab = 'social_options';             } else if( $active_tab == 'input_examples' ) {                 $active_tab = 'input_examples';             } else {                 $active_tab = 'display_options';             } // end if/else ?>
                 <a href="?page=sandbox_theme_options&tab=display_options" class="nav-tab <?php echo $active_tab == 'display_options' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Display Options', 'sandbox' ); ?>                 <a href="?page=sandbox_theme_options&tab=social_options" class="nav-tab <?php echo $active_tab == 'social_options' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Social Options', 'sandbox' ); ?>                 <a href="?page=sandbox_theme_options&tab=input_examples" class="nav-tab <?php echo $active_tab == 'input_examples' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Input Examples', 'sandbox' ); ?>
                  <form method="post" action="options.php">                 <?php                          if( $active_tab == 'display_options' ) {                              settings_fields( 'sandbox_theme_display_options' );                         do_settings_sections( 'sandbox_theme_display_options' );                          } elseif( $active_tab == 'social_options' ) {                              settings_fields( 'sandbox_theme_social_options' );                         do_settings_sections( 'sandbox_theme_social_options' );                          } else {                              settings_fields( 'sandbox_theme_input_examples' );                         do_settings_sections( 'sandbox_theme_input_examples' );                          } // end if/else                          submit_button();                      ?>             </form>
     <?php     } // end sandbox_theme_display          /* ------------------------------------------------------------------------ *      * Setting Registration      * ------------------------------------------------------------------------ */                /**      * Provides default values for the Social Options.      */     function sandbox_theme_default_social_options() {              $defaults = array(             'twitter'       =>  '',             'facebook'      =>  '',             'googleplus'    =>  '',         );              return apply_filters( 'sandbox_theme_default_social_options', $defaults );          } // end sandbox_theme_default_social_options          /**      * Provides default values for the Display Options.      */     function sandbox_theme_default_display_options() {              $defaults = array(             'show_header'       =>  '',             'show_content'      =>  '',             'show_footer'       =>  '',         );              return apply_filters( 'sandbox_theme_default_display_options', $defaults );          } // end sandbox_theme_default_display_options          /**      * Provides default values for the Input Options.      */     function sandbox_theme_default_input_options() {              $defaults = array(             'input_example'     =>  '',             'textarea_example'  =>  '',             'checkbox_example'  =>  '',             'radio_example'     =>  '',             'time_options'      =>  'default'            );              return apply_filters( 'sandbox_theme_default_input_options', $defaults );          } // end sandbox_theme_default_input_options          /**      * Initializes the theme's display options page by registering the Sections,      * Fields, and Settings.      *      * This function is registered with the 'admin_init' hook.      */      function sandbox_initialize_theme_options() {              // If the theme options don't exist, create them.         if( false == get_option( 'sandbox_theme_display_options' ) ) {               add_option( 'sandbox_theme_display_options', apply_filters( 'sandbox_theme_default_display_options', sandbox_theme_default_display_options() ) );         } // end if              // First, we register a section. This is necessary since all future options must belong to a          add_settings_section(             'general_settings_section',         // ID used to identify this section and with which to register options             __( 'Display Options', 'sandbox' ),     // Title to be displayed on the administration page             'sandbox_general_options_callback', // Callback used to render the description of the section             'sandbox_theme_display_options'     // Page on which to add this section of options         );              // Next, we'll introduce the fields for toggling the visibility of content elements.         add_settings_field(              'show_header',                      // ID used to identify the field throughout the theme             __( 'Header', 'sandbox' ),                          // The label to the left of the option interface element             'sandbox_toggle_header_callback',   // The name of the function responsible for rendering the option interface             'sandbox_theme_display_options',    // The page on which this option will be displayed             'general_settings_section',         // The name of the section to which this field belongs             array(                              // The array of arguments to pass to the callback. In this case, just a description.                 __( 'Activate this setting to display the header.', 'sandbox' ),             )         );              add_settings_field(              'show_content',                                  __( 'Content', 'sandbox' ),                          'sandbox_toggle_content_callback',               'sandbox_theme_display_options',                                 'general_settings_section',                      array(                                               __( 'Activate this setting to display the content.', 'sandbox' ),             )         );              add_settings_field(              'show_footer',                                   __( 'Footer', 'sandbox' ),                           'sandbox_toggle_footer_callback',                'sandbox_theme_display_options',                     'general_settings_section',                      array(                                               __( 'Activate this setting to display the footer.', 'sandbox' ),             )         );              // Finally, we register the fields with WordPress         register_setting(             'sandbox_theme_display_options',             'sandbox_theme_display_options'         );          } // end sandbox_initialize_theme_options     add_action( 'admin_init', 'sandbox_initialize_theme_options' );          /**      * Initializes the theme's social options by registering the Sections,      * Fields, and Settings.      *      * This function is registered with the 'admin_init' hook.      */      function sandbox_theme_intialize_social_options() {              if( false == get_option( 'sandbox_theme_social_options' ) ) {                add_option( 'sandbox_theme_social_options', apply_filters( 'sandbox_theme_default_social_options', sandbox_theme_default_social_options() ) );         } // end if              add_settings_section(             'social_settings_section',          // ID used to identify this section and with which to register options             __( 'Social Options', 'sandbox' ),      // Title to be displayed on the administration page             'sandbox_social_options_callback',  // Callback used to render the description of the section             'sandbox_theme_social_options'      // Page on which to add this section of options         );              add_settings_field(              'twitter',                                   'Twitter',                                       'sandbox_twitter_callback',              'sandbox_theme_social_options',              'social_settings_section'                    );              add_settings_field(              'facebook',                                  'Facebook',                                      'sandbox_facebook_callback',                 'sandbox_theme_social_options',              'social_settings_section'                    );              add_settings_field(              'googleplus',                                    'Google+',                                       'sandbox_googleplus_callback',               'sandbox_theme_social_options',              'social_settings_section'                    );              register_setting(             'sandbox_theme_social_options',             'sandbox_theme_social_options',             'sandbox_theme_sanitize_social_options'         );          } // end sandbox_theme_intialize_social_options     add_action( 'admin_init', 'sandbox_theme_intialize_social_options' );          /**      * Initializes the theme's input example by registering the Sections,      * Fields, and Settings. This particular group of options is used to demonstration      * validation and sanitization.      *      * This function is registered with the 'admin_init' hook.      */      function sandbox_theme_initialize_input_examples() {              if( false == get_option( 'sandbox_theme_input_examples' ) ) {                add_option( 'sandbox_theme_input_examples', apply_filters( 'sandbox_theme_default_input_options', sandbox_theme_default_input_options() ) );         } // end if              add_settings_section(             'input_examples_section',             __( 'Input Examples', 'sandbox' ),             'sandbox_input_examples_callback',             'sandbox_theme_input_examples'         );              add_settings_field(              'Input Element',                                     __( 'Input Element', 'sandbox' ),                                        'sandbox_input_element_callback',                'sandbox_theme_input_examples',              'input_examples_section'                     );              add_settings_field(              'Textarea Element',                                  __( 'Textarea Element', 'sandbox' ),                                         'sandbox_textarea_element_callback',                 'sandbox_theme_input_examples',              'input_examples_section'                     );              add_settings_field(             'Checkbox Element',             __( 'Checkbox Element', 'sandbox' ),             'sandbox_checkbox_element_callback',             'sandbox_theme_input_examples',             'input_examples_section'         );              add_settings_field(             'Radio Button Elements',             __( 'Radio Button Elements', 'sandbox' ),             'sandbox_radio_element_callback',             'sandbox_theme_input_examples',             'input_examples_section'         );              add_settings_field(             'Select Element',             __( 'Select Element', 'sandbox' ),             'sandbox_select_element_callback',             'sandbox_theme_input_examples',             'input_examples_section'         );              register_setting(             'sandbox_theme_input_examples',             'sandbox_theme_input_examples',             'sandbox_theme_validate_input_examples'         );          } // end sandbox_theme_initialize_input_examples     add_action( 'admin_init', 'sandbox_theme_initialize_input_examples' );          /* ------------------------------------------------------------------------ *      * Section Callbacks      * ------------------------------------------------------------------------ */           /**      * This function provides a simple description for the General Options page.       *      * It's called from the 'sandbox_initialize_theme_options' function by being passed as a parameter      * in the add_settings_section function.      */     function sandbox_general_options_callback() {         echo '
' . __( 'Select which areas of content you wish to display.', 'sandbox' ) . '
';     } // end sandbox_general_options_callback          /**      * This function provides a simple description for the Social Options page.       *      * It's called from the 'sandbox_theme_intialize_social_options' function by being passed as a parameter      * in the add_settings_section function.      */     function sandbox_social_options_callback() {         echo '
' . __( 'Provide the URL to the social networks you\'d like to display.', 'sandbox' ) . '
';     } // end sandbox_general_options_callback          /**      * This function provides a simple description for the Input Examples page.      *      * It's called from the 'sandbox_theme_intialize_input_examples_options' function by being passed as a parameter      * in the add_settings_section function.      */     function sandbox_input_examples_callback() {         echo '
' . __( 'Provides examples of the five basic element types.', 'sandbox' ) . '
';     } // end sandbox_general_options_callback          /* ------------------------------------------------------------------------ *      * Field Callbacks      * ------------------------------------------------------------------------ */           /**      * This function renders the interface elements for toggling the visibility of the header element.      *       * It accepts an array or arguments and expects the first element in the array to be the description      * to be displayed next to the checkbox.      */     function sandbox_toggle_header_callback($args) {              // First, we read the options collection         $options = get_option('sandbox_theme_display_options');              // Next, we update the name attribute to access this element's ID in the context of the display options array         // We also access the show_header element of the options collection in the call to the checked() helper function         $html = '<input type="checkbox" id="show_header" name="sandbox_theme_display_options[show_header]" value="1" ' . checked( 1, isset( $options['show_header'] ) ? $options['show_header'] : 0, false ) . '/>';               // Here, we'll take the first argument of the array and add it to a label next to the checkbox         $html .= ' '  . $args[0] . '';               echo $html;          } // end sandbox_toggle_header_callback          function sandbox_toggle_content_callback($args) {              $options = get_option('sandbox_theme_display_options');              $html = '<input type="checkbox" id="show_content" name="sandbox_theme_display_options[show_content]" value="1" ' . checked( 1, isset( $options['show_content'] ) ? $options['show_content'] : 0, false ) . '/>';          $html .= ' '  . $args[0] . '';               echo $html;          } // end sandbox_toggle_content_callback          function sandbox_toggle_footer_callback($args) {              $options = get_option('sandbox_theme_display_options');              $html = '<input type="checkbox" id="show_footer" name="sandbox_theme_display_options[show_footer]" value="1" ' . checked( 1, isset( $options['show_footer'] ) ? $options['show_footer'] : 0, false ) . '/>';          $html .= ' '  . $args[0] . '';               echo $html;          } // end sandbox_toggle_footer_callback          function sandbox_twitter_callback() {              // First, we read the social options collection         $options = get_option( 'sandbox_theme_social_options' );              // Next, we need to make sure the element is defined in the options. If not, we'll set an empty string.         $url = '';         if( isset( $options['twitter'] ) ) {             $url = esc_url( $options['twitter'] );         } // end if              // Render the output         echo '<input type="text" id="twitter" name="sandbox_theme_social_options[twitter]" value="' . $url . '" />';          } // end sandbox_twitter_callback          function sandbox_facebook_callback() {              $options = get_option( 'sandbox_theme_social_options' );              $url = '';         if( isset( $options['facebook'] ) ) {             $url = esc_url( $options['facebook'] );         } // end if              // Render the output         echo '<input type="text" id="facebook" name="sandbox_theme_social_options[facebook]" value="' . $url . '" />';          } // end sandbox_facebook_callback          function sandbox_googleplus_callback() {              $options = get_option( 'sandbox_theme_social_options' );              $url = '';         if( isset( $options['googleplus'] ) ) {             $url = esc_url( $options['googleplus'] );         } // end if              // Render the output         echo '<input type="text" id="googleplus" name="sandbox_theme_social_options[googleplus]" value="' . $url . '" />';          } // end sandbox_googleplus_callback          function sandbox_input_element_callback() {              $options = get_option( 'sandbox_theme_input_examples' );              // Render the output         echo '<input type="text" id="input_example" name="sandbox_theme_input_examples[input_example]" value="' . $options['input_example'] . '" />';          } // end sandbox_input_element_callback          function sandbox_textarea_element_callback() {              $options = get_option( 'sandbox_theme_input_examples' );              // Render the output         echo '<textarea id="textarea_example" name="sandbox_theme_input_examples[textarea_example]" rows="5" cols="50">' . $options['textarea_example'] . '</textarea>';          } // end sandbox_textarea_element_callback          function sandbox_checkbox_element_callback() {              $options = get_option( 'sandbox_theme_input_examples' );              $html = '<input type="checkbox" id="checkbox_example" name="sandbox_theme_input_examples[checkbox_example]" value="1"' . checked( 1, $options['checkbox_example'], false ) . '/>';         $html .= ' ';         $html .= 'This is an example of a checkbox';              echo $html;          } // end sandbox_checkbox_element_callback          function sandbox_radio_element_callback() {              $options = get_option( 'sandbox_theme_input_examples' );              $html = '<input type="radio" id="radio_example_one" name="sandbox_theme_input_examples[radio_example]" value="1"' . checked( 1, $options['radio_example'], false ) . '/>';         $html .= ' ';         $html .= 'Option One';         $html .= ' ';         $html .= '<input type="radio" id="radio_example_two" name="sandbox_theme_input_examples[radio_example]" value="2"' . checked( 2, $options['radio_example'], false ) . '/>';         $html .= ' ';         $html .= 'Option Two';              echo $html;          } // end sandbox_radio_element_callback          function sandbox_select_element_callback() {              $options = get_option( 'sandbox_theme_input_examples' );              $html = '<select id="time_options" name="sandbox_theme_input_examples[time_options]">';             $html .= '<option value="default">' . __( 'Select a time option...', 'sandbox' ) . '</option>';             $html .= '<option value="never"' . selected( $options['time_options'], 'never', false) . '>' . __( 'Never', 'sandbox' ) . '</option>';             $html .= '<option value="sometimes"' . selected( $options['time_options'], 'sometimes', false) . '>' . __( 'Sometimes', 'sandbox' ) . '</option>';             $html .= '<option value="always"' . selected( $options['time_options'], 'always', false) . '>' . __( 'Always', 'sandbox' ) . '</option>';   $html .= '</select>';              echo $html;          } // end sandbox_radio_element_callback          /* ------------------------------------------------------------------------ *      * Setting Callbacks      * ------------------------------------------------------------------------ */           /**      * Sanitization callback for the social options. Since each of the social options are text inputs,      * this function loops through the incoming option and strips all tags and slashes from the value      * before serializing it.      *        * @params  $input  The unsanitized collection of options.      *      * @returns         The collection of sanitized values.      */     function sandbox_theme_sanitize_social_options( $input ) {              // Define the array for the updated options         $output = array();              // Loop through each of the options sanitizing the data         foreach( $input as $key => $val ) {                  if( isset ( $input[$key] ) ) {                 $output[$key] = esc_url_raw( strip_tags( stripslashes( $input[$key] ) ) );             } // end if               } // end foreach              // Return the new collection         return apply_filters( 'sandbox_theme_sanitize_social_options', $output, $input );          } // end sandbox_theme_sanitize_social_options          function sandbox_theme_validate_input_examples( $input ) {              // Create our array for storing the validated options         $output = array();              // Loop through each of the incoming options         foreach( $input as $key => $value ) {                  // Check to see if the current option has a value. If so, process it.             if( isset( $input[$key] ) ) {                      // Strip all HTML and PHP tags and properly handle quoted strings                 $output[$key] = strip_tags( stripslashes( $input[ $key ] ) );                  } // end if              } // end foreach              // Return the array processing any additional functions filtered by this action         return apply_filters( 'sandbox_theme_validate_input_examples', $output, $input );          } // end sandbox_theme_validate_input_examples     ?>


Display parent taxonomy name and list child taxonomies below it?

I have the following taxonomy structure:   * Rich Media   *     * course prep   *     * demo modules   * Moodle Setup   *     * reteaching an old course   *     * teaching new course I want to display the parent tax name, and the child tax description (not the name). Child tax descriptions would link to tax archives. This is what I have hacked together so far, but I'd like to avoid having to use multiple blocks of this kind - each with a different $term_id. Is there a more elegant way to do this so that any future changes would not require manually adding another block? Any help is much appreciated.

<?php $term = get_term_by('slug', 'rich-media', 'preparingtoteach'); echo $term->name; ?>
                     <?php                         $term_id = 249;                         $taxonomy_name = 'preparingtoteach';                         $termchildren = get_term_children( $term_id, $taxonomy_name );                              echo '
';                         foreach ( $termchildren as $child ) {                             $term = get_term_by( 'id', $child, $taxonomy_name );                             echo '
name, $taxonomy_name ) . '">' . $term->description . '
';                             }                             echo '
';                     ?>


NextGEN Gallery - How to: Only show Fullsize & Only first image of post?

I am using NextGEN Gallery as a kind of replacement for the standard Wordpress gallery function. I created a custom post type that is made to only show images like in an exhibition. On upload I resize the images so they are all the same dimensions. When I insert the gallery into this post type via shortcode, I get a page with the tumbnails linked to the fullsize (resized) images. What I want is that there are _no thumbnails_ , I want to show the fullsize images directly. How do I do this? Of course I could just change the thumbnail size so it matches the full size, but that does not sound like a good practice to me. _Also:_ Is it possible to only grab the first image of every gallery and display it? If so, how?


Is there a way to display hidden chars / unvisible chars in editor like ENTER and LINEFEED?

I am looking for a Wordpress addon or way to show unvisible characters while editing. Explicit to avoid getting Carrage Return Linefeed problems and spaces. ![enter image description here](http://i.stack.imgur.com/09KFv.png)


Custom Meta Field not Working with qTranslate

I am running the newest WordPress and qTranslate. I have made a page that enables some custom fields that are working ok. qTranslate enables languages like tabs when editing a page. But this doesn't happens in my custom meta fields. Any way of making language control on these fields? It would be great if there were some Javascript event listener that would tell me that the user changed the language tab or something. I read about putting like               <!--:ca-->CA<!--:--><!--:es-->ES<!--:--><!--:en-->EN<!--:-->      inside the meta field but since this is going to be used by an end user, and I am sure they wouldn't understand what that means and how to use it. I need different meta field for different languages. Any ideas? Secondly I am trying this:               <?php _e('Published ', 'iris'); ?>      But when I change the page language (qTranslate ?lang=dk / ?lang=en) it never translates the word. It always stays in English somehow. I tried this and this works:               <?php echo _e("<!--:dk-->Udgivet<!--:en-->Published"); ?>      But it doesn't really use the language library and I was hoping there was a way :)


Highlight Search Results in Function.php

I found this function on the net. I have placed this in my custom functions file separate from functions.php.               function highlight_search_term($text){         if(is_search()){             $keys = implode('|', explode(' ', get_search_query()));             $text = preg_replace('/(' . $keys .')/iu', '\1', $text);         }         return $text;     }     add_filter('the_excerpt', 'highlight_search_term');     add_filter('the_title', 'highlight_search_term');      It works fine except it alters the read more link. Hovering over this link shows:               http://www.mysite.com/%3span%20classs=      When it is removed the link is unaffected. What is wrong with it? I have used the following CSS with it:               .search-term {         background: yellow;     }


Highlighting a Menu Item by Post Name

With the help of a couple of users, my last two questions were highlighting a custom menu item through its ID. Now I'm trying to combine the code of the following two functions to make it work by Post Name: Add highlighting to new Admin Dashboard Menu Item               add_action( 'admin_menu', 'create_menu' );     add_action( 'admin_head-post.php', 'wpse_58567_highlight_menu_item' );          function create_menu() {         $settings_page = add_menu_page(                                        'Edit_Post_69',                                         'Edit_Post_69',                                         'add_users',                                         '/post.php?post=69&action=edit',                                         '',                                         get_stylesheet_directory_uri() . '/editicon.png',                                         2                                       );     }          function wpse_58567_highlight_menu_item() {         global $post;              if( 69 != $post->ID )             return;     ?>         <script type="text/javascript">             jQuery(document).ready( function($) {                 $('#toplevel_page_post-post-69-action-edit').removeClass('wp-not-current-submenu').addClass('current');                 $('#toplevel_page_post-post-69-action-edit').find('a:last').addClass('current');             });              </script>     <?php     }      and.... Convert post name into post ID               $post = get_page_by_title( $post_name, OBJECT, 'post' );     echo $post->ID;      I am now trying to combine them so that I can specify a post name instead of a post ID, can anyone point me in the right direction?


Adding custom fields (post meta) before/during wp_insert_post()

Our code base has a ton of logic that executes as the post is inserted/created. However, some of that logic depends on custom post meta. The only way I know of to add post meta to a new post is like so:               $post_id = wp_insert_post($post_obj);     add_post_meta($post_id, 'key', "value");      However, this means that the post meta is not present when hooks on post insertion happen. Is there any way to set up or include post meta as part of `$post_obj`? I tried making up new properties of the post object with `$post_obj->custom_key = 'value'` but it didn't seem to actually end up in the database. The only thing I can think of is to hijack an existing property of the post object that I'm not using, like `menu_order`, and store some information there. That's an ugly hack.


Add category attribute to custom recent post shortcode

I have a recent post shortcode to display a custom post. Everything works fine so far. However, I would like to add a category attribute so I can specify which category to display. My working code is as follows:               function my_recent_posts_shortcode2( $atts ) {         extract( shortcode_atts( array( 'limit' => 7, 'type' => 'g1_event'), $atts ) );              global $paged;         $q = new WP_Query(  array (              'posts_per_page' => $limit,              'post_type' => $type,              "orderby" => 'meta_value',             "meta_key" => 'evt_start_date',             "order" => 'ASC',             'paged' => $paged          ) );              $list = '
';              while ( $q->have_posts() ) {             $q->the_post();                  //for this post, get custom field "event_date" which should be in yyyy-mm-dd format and display as to month, day             //2011-02-22 will display as February 22             $evt_start_date = get_post_meta($post->ID, 'evt_start_date', true);             $evt_start_date = get_post_meta($post->ID, 'evt_start_date', true);             if ($evt_start_date) {                 echo 'The event date is '. date('F j', strtotime($evt_start_date));             }                  $list .= '
' . '' . get_the_title() . '' . '
'. get_post_meta( get_the_ID(), 'evt_start_date', true ) . ' @ ' . get_post_meta( get_the_ID(), 'evt_location', true ) . '
';         }              wp_reset_query();              return $list . '
';     }     add_shortcode( 'recent-events', 'my_recent_posts_shortcode2' );      Right now I place the shortcode using: `[recent-events][/recent-events]` I would like to be able to specify the category ID: `[recent-events cat="62"][/recent-events]` Hope this is clear, thank you.


Browser redirected to a wordpress URL address with a port number from a previous SSH tunnel session

I have set up an apache instance on my ubuntu server in my internal home network. Its internal address is `192.168.1.70`. When I visit `http://192.168.1.70` I get the standard "It Works!" page of apache. For testing purposes, I have put a php info page (`info.php`) in `/var/www`. When I visit `http://192.168.1.70/info.php` I see the standard PHP version + info page. I have also set up wordpress under `/var/www/wordpress` as well as another `info.php` under that same directory. When I visit `http://192.168.1.70/wordpress/info.php` I am getting the same PHP page as above, which is fine. But, when I visit `http://192.168.1.70/wordpress`, instead of seeing the wordpress homepage, I see my browser being redirected to this: `http://192.168.1.70:9980/wordpress` and showing a "could not connect to 192.168.1.70:9980" error. Where did this magic port number come from? Let me help with some background. Earlier today I was managing my ubuntu server remotely from work by `ssh`-ing to it using the following command: `ssh -p ssh_port -L 9980:localhost:80 username@server` in order to be able to test it locally using the `http://localhost:9980/wordpress` URL, as the computer I was using wouldn't allow me to forward ports < 1024. The contents of `/etc/apache2/ports.conf` are:               NameVirtualHost *:80     Listen 80      Why is my browser being redirected to `http://192.168.1.70:9980/wordpress`? Why is port 9980 being used and where is it coming from? Can someone please help out? Thanks Edit: I have just restarted my router at home but the problem persists. Edit: The output of `curl -I http://192.168.1.70` is:               HTTP/1.1 200 OK     Date: Thu, 09 Jan 2014 02:06:51 GMT     Server: Apache/2.2.22 (Ubuntu)     Last-Modified: Wed, 08 Jan 2014 18:05:15 GMT     ETag: "a39cd-b1-4ef7955bf7f23"     Accept-Ranges: bytes     Content-Length: 177     Vary: Accept-Encoding     Content-Type: text/html     X-Pad: avoid browser bug      Edit: The output of `curl -I http://192.168.1.70/wordpress/info.php` is:               HTTP/1.1 200 OK     Date: Thu, 09 Jan 2014 02:08:04 GMT     Server: Apache/2.2.22 (Ubuntu)     X-Powered-By: PHP/5.3.10-1ubuntu3.9     Vary: Accept-Encoding     Content-Type: text/html      Edit: The output of `curl -I http://192.168.1.70/wordpress/` is:               HTTP/1.1 301 Moved Permanently     Date: Thu, 09 Jan 2014 18:51:51 GMT     Server: Apache/2.2.22 (Ubuntu)     X-Powered-By: PHP/5.3.10-1ubuntu3.9     X-Pingback: http://localhost:9980/wordpress/xmlrpc.php     Location: http://192.168.1.70:9980/wordpress/     Vary: Accept-Encoding     Content-Type: text/html; charset=UTF-8


Settings API with custom post type menu limitation

I've created a custom post type menu with `register_post_type`. I want to add a settings sub-menu with lots of options, including extra "Add option to a select list" button. The problem: when using settings api, any `<form>` wants `action="options.php"`. But that ends with a redirect to the edit.php address required when the sub menu is added to the custom post type menu. That means `$_POST` is lost by the time the code get back to the options page - so there is no way to see if those extra buttons were pressed. Not using options.php for the <form> directs the submits directly to edit.php, where it dies with a permissions option. I'd prefer not to use JavaScript to fill in those dynamic settings. Any way to bypass the settings API and `options.php`, and get directly the edit.php but not get the permissions crash? I looked at the source code, as well as tons of plugins with custom post type and a settings page, but they ALL use settings API via `options.php` - and that precludes getting an alternate submit button click back to the settings code. In this case, this is a severe limitation with the Settings API because the redirect at the end loses `$_POST`.


Dynamic Gallery

I'm building a single page website and that means that all the links need to call for post content dynamically. I found this tutorial and with the help from some folks from StackOverflow I managed to create pages that do just that. But a new challenge unfolded itself when I needed to make set of dynamic galleries in a page. So here what needs to happen: There is a list of post- titles with galleries inside each one. When I click one of the links the post with the thumbnails should show right below it. I managed to do just that just fine, but when a thumbnail is clicked, the bigger version should appear right at the side. I applied the same code but it just doesn't work! Here's the code I have 'til now:   * index.php (the gallery section) have_posts()) : $recent->the_post();?>

A Galeria
                                  <?php $args = array('post_type'=>'galeria');                      $myposts = get_posts( $args );                 foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
                         <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                 <?php endforeach;                  wp_reset_postdata();?>

        * thumbnails.php (bringing up the thumbnails. Working.)              $(document).ready(function() {                   var hash = window.location.hash.substr(1);         var href = $('#galerias li a').each(function(){             var href = $(this).attr('href');             if(hash==href.substr(0,href.length)){                 var aCarregar = 'hash+.html #itens';                 $('#thumbnails').load(aCarregar)             }         });              $('#galerias li a').click(function() {                  var aCarregar = $(this).attr('href')+' #itens';             $('#thumbnails').hide('fast',carregarConteudo);             $('#carregando').remove();             $('#thumbnails').append('Carregando...');             $('#carregando').fadeIn('normal');                  window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length);                  function carregarConteudo () {                 $('#thumbnails').load(aCarregar,'',mostrarNovoConteudo);             }             function mostrarNovoConteudo () {                 $('#thumbnails').show('normal',esconderCarregando);             }             function esconderCarregando () {                 $('#carregando').fadeOut('normal');             }                  return false;         });          });      galeria.php (addapted thumbnails to bring the image. Not working) $(document).ready(function() {              var hash = window.location.hash.substr(1);     var href = $('#itens a').each(function(){         var href = $(this).attr('href');         if(hash==href.substr(0,href.length)){             var aCarregar = 'hash+.html #conteudo-galeria';             $('#conteudo-galeria').load(aCarregar)         }     });          $('#itens a').click(function() {              var aCarregar = $(this).attr('href')+' #conteudo-galeria';         $('#conteudo-galeria').hide('fast',carregarConteudo);         $('#carregando').remove();         $('#atracoes').append('Carregando...');         $('#carregando').fadeIn('normal');              window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length);              function carregarConteudo () {             $('#conteudo-galeria').load(aCarregar,'',mostrarNovoConteudo);         }         function mostrarNovoConteudo () {             $('#conteudo-galeria').show('normal',esconderCarregando);         }         function esconderCarregando () {             $('#carregando').fadeOut('normal');         }              return false;     });      }); iamge.php (the image page from the gallery)               <?php get_header(); ?>

              <?php if (have_posts()): while (have_posts()) : the_post(); ?>                                        <?php if ( wp_attachment_is_image( $post->id ) ) : $att_image = wp_get_attachment_image_src( $post->id, "full"); ?>                     <img src="<?php echo $att_image[0];?>" width="<?php echo $att_image[1];?>" height="<?php echo $att_image[2];?>" alt="<?php $post->post_excerpt; ?>" />                 <?php else : ?>                     <a href="<?php echo wp_get_attachment_url($post->ID) ?>" title="<?php echo wp_specialchars( get_the_title($post->ID), 1 ) ?>"><?php echo basename($post->guid) ?>                 <?php endif; ?>                                <?php endwhile; ?>              <?php else: ?>              <?php endif; ?>

                        <?php get_footer(); ?>      Wow, this was long. thank you if you had the patience to follow 'til here. Currently, if I click in the thumbnail, I'm directed to the image.php. PS: The js should also make history work, but it isn't. It's not a priority right now but if you guys know anyway to fix it it'll be much appreciated.


wp_set_object_terms not working in functions.php with custom taxonomy

I am using custom fields with custom taxonomy... And needed to asign new post to custom category. As you know default wp_insert_post not working with 'post_category' with custom posts. So we need to asign with wp_set_object_terms. But there is big problem, when i put for example in function.php file this code: wp_set_object_terms($post_ID, array(1,5), 'custom_cat_taxonomy') its not working at all and the error is: WP_Error Object ( [errors] => Array ( [invalid_taxonomy] => when I put this code in for example in single.php it works and assigns category to post. any ideas how to solve it ?


WP Query multiple select form - meta_query help

I am creating a multiple filter - as in I could filter by all the options if I wanted to do so, i.e terms, calories & price in my case. I am having trouble with meta query args. At present I can search individually by terms or calories, and multiply by terms and calories, and terms, calories and price together but price on it's own does not effect search results? Select:                               <form action="/?page_id=5" method="post">                     <?php                         // Set min/max variables with post input data                                    $min = $_POST['min'];   // Collect min value and set to var                                  $max = $_POST['max'];   // Collect max value and set to var                         // Set filter var with term post input data                         $product_filter = $_POST['product_terms'];                         $cal_filter = $_POST['product_cal'];                         // Set term parameters/arguments                         $args = array(                             'orderby' => 'name',                                 'order' => 'ASC',                                    'hide_empty' => false,                                   'parent' => 0,                                   );                         // Get terms with our arguments                         $shop_terms = get_terms('shop', $args);                             echo '<select name="product_terms[]" multiple>';                             // Set var as an array                             $all_product_terms = array();                             foreach($shop_terms as $shop_term){                                 // Set all terms to our array                                 $all_product_terms[] = $shop_term->name;                                     echo '<option value="'.$shop_term->name.'">'.$shop_term->name.'</option>';                                 }                                 echo '</select>';                                      $all_product_cal = array();                                              $post_args = array(                                'post_type' => 'shop_post',                             'order' => 'ASC',                             'posts_per_page'  => -1,                                                        );                             $posts = get_posts($post_args);                             echo '<select name="product_cal[]" multiple>';                                 foreach ($posts as $post){                                 $keys = get_post_meta( $post->ID, 'calories' );                                 // check if the custom field has a value                                 $all_product_cal[] = $keys[0];                                     if( ! empty( $keys ) ) {                                         echo '<option value="'.$keys[0].'">'.$keys[0].' cal</option>';                                     }                                  }                             echo 'From: £ <input id="shop1" type="text" name="min">';                             echo 'To: £ <input id="shop2" type="text" name="max">';                                echo '</select>';                             echo '<input type="submit" value="go">';                         ?>                  </form>      Edit: Added complete code below Isset and new WP_Query:                   $final_product_term = isset($_POST['product_terms'])  ? $product_filter : $all_product_terms;          $final_product_cal = isset($_POST['product_cal'])  ? $cal_filter : $all_product_cal;               $min_value = isset($_POST['min']) ? $min : '1';         $max_value = isset($_POST['max']) ? $max : '100000';         $args = array(            'post_type' => 'shop_post',         'order' => 'ASC',         'post_status' => 'any',         'orderby' => 'name',         'tax_query' => array(             array(                 'taxonomy' => 'shop',                 'field' => 'slug',                 'terms' => $final_product_term             )         ),         'meta_query' => array(         'relation' => 'OR',             array(                 'key' => 'calories',                 'value' => $final_product_cal,                  ),             array(                 'key' => 'price',                  'value' => array($min_value, $max_value),                  'type' => 'numeric',                  'compare' => 'BETWEEN'             )         )      );      $shop_posts = new WP_Query($args);     if($shop_posts->have_posts()) : while($shop_posts->have_posts()) : $shop_posts->the_post();                          $met = get_post_meta( $post->ID, 'price');              foreach($met as $key => $val );             echo '
';                 echo '
';                 echo get_the_post_thumbnail($post->ID, 'blog-cat');                     echo '
'. get_the_title($post->ID).'
';                         echo '
£'. $val.'
';                                  echo '
';               echo '
';      Default query on page load:               WP_Query Object     (     [query] => Array         (             [post_type] => shop_post             [order] => ASC             [post_status] => any             [orderby] => name             [tax_query] => Array                 (                     [0] => Array                         (                             [taxonomy] => shop                             [field] => slug                             [terms] => Array                                 (                                     [0] => Ball                                     [1] => Bars                                     [2] => Biscuits                                     [3] => Chips                                     [4] => Crackers                                     [5] => Crisps                                     [6] => Fudge                                     [7] => Granola                                 )                         )                 )                  [meta_query] => Array                 (                     [relation] => OR                     [0] => Array                         (                             [key] => calories                             [value] => Array                                 (                                     [0] => 1                                     [1] => 66                                     [2] => 56                                     [3] => 99                                     [4] => 70                                     [5] => 34                                     [6] => 50                                     [7] => 44                                 )                         )                     [1] => Array                         (                             [key] => price                             [value] => Array                                 (                                     [0] => 1                                     [1] => 100000                                 )                                  [type] => numeric                             [compare] => BETWEEN                         )                 )         )


What are the differences between "Latest Posts" and "Static Page"?

WordPress has an option to pick "Latest Posts" and "Static Page" under "Settings" in Admin Panel. My questions:   1. What page template is getting loaded in each of those modes?   2. Why `paged` stops working and `page` starts working when I select "Static Page" - `paged` works, however, when I create new page template with new WP Query and `page` doesn't work (this is about WP Query - I think that everyone knows what I'm talking about - it's pagination).   3. It looks like `get_post_meta($post->ID, "my_custom_field_name", true)` stops working when I select custom page template as "Static Page" but the same thing works when I use it via standard "View Page" in Admin Panel (I haven't tried `global $post`, yet).   4. I think that all my above questions are related to what gets inside `$wp_query` and `$post` in each of those modes. I just don't get these two options :) Can someone provide me some guidance or resources where I could find out more about it?


Editing the variables in a custom URL

I have an existing page in a custom theme that expects a URL in this form: `/story?user=1` but I'd like to be able to use better URLs as well, eg: `/story/username`. I've tried to add a rewrite rule in functions.php as below, which gets me half-way, allowing URLs like `/story/1`:               function my_custom_url() {         add_rewrite_rule('story/([^/]+)/?','index.php?pagename=story&user=$matches[1]','top');     }          add_action( 'init', 'my_custom_url' );      However I'd still like to use the username in the URL. To allow that, I was expecting to change the rewrite rule to this:               add_rewrite_rule('story/([^/]+)/?','index.php?pagename=story&user='.get_user_id($matches[1]),'top');      Where `get_user_id()` is a function that returns the id for a specified username, but that doesn't seem to work (as tested with the Rewrite Analyzer plugin). This answer pointed me towards the `parse_query` hook, so I tried something like this (together with the original rewrite rule):               function my_query_var() {         if ($user = get_query_var('user')) {             $id = get_user_id($user);             global $wp_query;             $wp_query->set('user',$id);         }     }          add_action('parse_query','my_query_var');      However that doesn't seem to work either; Rewrite Analyzer shows that the 'user' portion of the URL remains set to whatever was typed after 'story' in the address bar, rather than the result of `get_user_id()`. Any ideas what I should be doing instead? Thanks! **Edit** Probably worth mentioning that I'm registering the `user` variable as the below:               function register_query_var($query_vars) {         $query_vars[] = 'user';         return $query_vars;     }          add_filter('query_vars','register_query_var');


How can I make this process automatic?

I have a Bakery page. Every time I add a child page such as cakes, I would like to add the page title `cakes` to a custom taxnomy. I also want to add this child page to a menu which displays these child pages. I have found out that I need to hook into the `new_page`. So something like this,               function($page_id){         check if this page is type of page and parent_page is Bakery Page's ID              If yes, then add this page to menu which displays the child pages. I suppose I need the ID of the menu but I do not know how to find it, not even to hard code it.              Lastly I want to add the title of this page to a custom taxonomy.     }      Can you help?


Get the name of category in query

I have parent category, Game (cat ID 42), and some child categories in it: Acrade, Causaul. After I using the loop to get the title of the post, I want to have a child category name. But my code is not working:               <?php      $args = array(         'cat'            => 42,         'posts_per_page' => 12,         'post__in'       => get_option( 'sticky_posts' ),     );          // The Query     $the_query = new WP_Query( $args );     $categories = get_the_category($post->ID);          // The Loop     while ( $the_query->have_posts() ) :          $the_query->the_post();     ?>          <?php     /* if post has a thumbnail */     if (  ( function_exists('has_post_thumbnail') ) && ( has_post_thumbnail() )  ) { ?>
       <a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_post_thumbnail('app_icon', array('title' => get_the_title())); ?>
         <a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?>
       <?php echo $categories ?>
          <?php     } /* end if post has a thumbnail */          endwhile;          // Reset Post Data     wp_reset_postdata();     ?>


Password reset - Disabled for LDAP accounts

I'm using the wpDirAuth plugin to allow LDAP logins and automatic account creation. One snag I've run into is LDAP users can still request a password reset. They receive the email with the link, but the link says the key is invalid. So it's good that it doesn't attempt to change their password. However, I would like to prevent them from the email ever being sent and instead a message saying "Sorry, your account password cannot be changed on this site. Please contract IT Service Desk" upon form submission. Is there a hook I can use once the form is submitted to check if the account is LDAP (I could check for the company email address to identify LDAP accounts) and return the error message?


Insert comment and still use moderation

I have a custom comment form that inserts a comment outside of the loop and applies it to a post. I'm trying to get it to still use the moderation check before it marks as "approve". Is there a way to leverage the moderation tools with a wp_insert_comment? I'm needing to prevent comments with inappropriate words from showing up in the comment feed. Here's my code:               add_action( 'wp_ajax_create_comment', 'create_comment' );         function create_comment(){                  $postID = $_POST['postID'];             $commentAuthName = $_POST['authorName'];             $commentAuth = $_POST['authorID'];             $commentContent = $_POST['commentContent'];             $commentParent = $_POST['commentParent'];             if(empty($commentParent)){                 $commentParent = 0;             }                  $time = current_time('mysql');                  $data = array(                 'comment_post_ID' => $postID,                 'comment_content' => $commentContent,                 'comment_parent' => $commentParent,                 'comment_date' => $time,                 'comment_approved' => 1,                 'user_id' => $commentAuth,                 'comment_author' => $commentAuthName,                 'comment_author_IP' => $_SERVER['REMOTE_ADDR'],                 'comment_agent' => $_SERVER['HTTP_USER_AGENT'],             );                  $commentID = wp_insert_comment($data);             print_r($commentID);             die();         }      **Adding additional clarification: I want to automatically publish and display contents that are not flagged based on the moderation keys. The ones that are flagged, need to be sent to the moderation que.


Order by meta value or date?

Got a custom field called `startDate` but its only on a few events. I was wondering if it isn't set for a post I could use `post_date` to generate the posts list?               // if meta_key _postmeta.startDate isn't set get the rest by posts.post_date          query_posts(         array(             array(                 'posts_per_page' => 10,                 'meta_key' => 'startDate',                 'meta_value' => date('Y-m-d'),                 'meta_compare' => '<',                 'orderby' => 'meta_value',                 'order' => 'ASC'             ),              array(                 'meta_key' => 'post_date',                 'meta_value' => date('Y-m-d'),                 'meta_compare' => '<'             )         )     );


If I remove Category base from my URLs, how difficult will rollback be?

The last time I asked a question that required an opinion response, I was awarded the dubious tumbleweed badge. I'm fearful of adding to my collection, but here goes :) I'm considering writing an option into my theme that would force all pages and posts to have a .html extension and all category landing pages to have URLs without the category base name in them. For this reason, I'd like to get opinions on how feasible it is to switch between my custom URL structure and the WordPress default structure, in the event the site owner wants to revert back after changing to the new structure. In the new structure a category landing page would be addressed without the category base name in the url like so: site.com/blue-widgets This would normally be written: site.com/category/blue-widgets And for this to work, I'm also requiring that all posts and pages end in an extension like .html so as to differentiate between categories and posts of the same name. For example, site.com/blue-widgets.html


How to show last post of each website of a MU wordpress in HomePage

actually I'm running a wordpress MU website and each website has its own "life" but now I would like to show last X posts of each blog of my network on the homepage. I know how to do it using Feeds and a plugin named FeedPress but this is a "dirty" way to do it. Is there anyone who knows how to do it? Please Step by Step instructions I'm not a Noob but.... not even a programmer. Thank you to all!


Upgrading from 2.9.4 to 3.0.x and with a custom theme

I have a site where the Theme is VERY custom and I can no longer work with the developer. Should I be worried about the theme no longer working in 3.0.4. and if so what is the easiest way for me to test my theme before upgrading? Thanks eric


Plugin Localization

i've just built my first plugin for wp, and even if it's not a great "code poetry" ;) it works as it should. It's a plugin that transform the default wp gallery using the GalleryView 3.0 jquery plugin (http://spaceforaname.com/galleryview). The only thing i'm not able to do is localization. Localization for this plugin in means translating the admin interface, where someone can configure the jquery plugin options to change the aspect of the resulting gallery. I've tried to follow the millions of tutorials present on the web, read a lot of posts about this issue on forums and followed the guidelinees of codex... but still with no luck. This is what i've done:   1. Every text line is inside a gettext function ( `__` and `_e` )   2. Using poedit i created the `.po` and `.mo` file scanning the plugin directory (everythig went ok), then i added translations on that file.   3. I named the `.po` file like that `NAME-OF-THE-PLUGIN-it_IT.po` (the `.mo` file was generated with the same name)   4. I've put the translations files inside the plugin folder `/languages` (name of the folder is the same of the plugin and of the translations files)   5. Then i've tried to add the `load_plugin_textdomain` function inside the main plugin file. I've tried because there's no way to get it working. The only thing on which i'm not sure is the fact that the plugin i've created is not under a class + constructor funcions... just because i'm still not so good in coding. I've put the `load_plugin_textdomain` inside an `add_action` on init, like this:               add_action('init', 'gw_load_translation_file');          function gw_load_translation_file() {         // relative path to WP_PLUGIN_DIR where the translation files will sit:         $plugin_path = dirname(plugin_basename( __FILE__ ) .'/languages' );         load_plugin_textdomain( 'gallery-view-for-wordpress', false, $plugin_path );     }      The lines above are not inside a logic, they are just in the main plugin file, like that. This is an example of my use of gettext functions:
<?php _e('Panel Options', 'gallery-view-for-wordpress') ?>
      What did i not understand?


how can I link to a PlugIn admin-sub-menu page after processing a formular

I have a Plugin with 3 submenu_pages. In one page is a formular (in one some text and in one a list of items). when I submit the form, there will be done some processing. after that I don't want to get back to the form-page, but WP shell redirect me to one of the other submenu_pages (in this case a list). how can I achive this?               add_menu_page( 'page1 main page', '0', 'manage_options', 'mg-pi', 'mg_backend');         add_submenu_page( 'mg-pi', 'list smthing', '0', 'manage_options', 'mg-pi-sub-list', 'mg_list');     add_submenu_page( 'mg-pi', 'create', '0', 'manage_options', 'mg-pi-sub-create', 'mg_new_item');         so in `mg_new_item()` is the processing and then it shell redirect to `mg_list()`. but if I do the php call to `mg_list()` the url is still the one of `mg_new_item()`. I know I could do some `header("Location: the-hardcoded-list-url");` but I am looking for the WordPress common way of doing it, with generic Url generation.


Display Post by taxonomy and taxonomy child if exist

I have a registered Taxonomy called Types, which is hierarchical and works. An example of categories will be Hotel in UK --1 star --2 star --3 star Hotel in Spain --1 star --2 star --3 star etc.. I m having trouble finding the right way to display my pages (custom post Hotel). I need the code to display hotels by taxonomy only if they exist any help? UPDATE CODE                $taxonomy2 = 'accomodation-type';      $termsacc = get_terms("accomodation-type",array('orderby' => 'slug', 'order' => 'ASC'));        foreach ($termsacc as $termaccomodation) {        //Here I loop through my tax acc-type        //and check if there is any post by the country $termcountry->name (getting this value higher)     $query = new WP_Query(array('post_type' => 'accomodation', 'orderby'=> $termaccomodation->name,'order' => 'DESC','accomodation-type' =>$termaccomodation->name, 'country' =>$termcountry->name,'posts_per_page' => 48 ));                              and loop.... `


Can I install Analytics before deciding on a theme?

I haven't decided what theme to have on my WordPress site yet. But I do want Google Analytics on the site. Before installing Google Analytics on the site, do I need to decide on the theme? i.e. does the Google Analytics code go into a file that is specific to the theme, or that changes with a changed theme? Thanks


Fix custom query pagination without changing site-wide posts-per-page settings

Many people report problems with pagination of custom queries or custom post type archives: url/page/2 produces a 404 even though all the setup is correct. Many end up figuring out that this is occurring because the posts_per_page of their custom loop is less than the maximum posts per page setting in the admin, which they fix by changing                Settings » Reading » "Blog pages show at most: ____ posts"       to 1. This works in my situation, but I would much prefer to change this only for this specific custom query, rather than the whole site. Is this possible? The relevant WP_Query is this:               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $wp_query = new WP_Query( array(     'post_type' => 'publication',     'posts_per_page' => 5,     'paged'=>$paged));


What's the difference between get_the_time and get_the_date?

Both function returns date and time. What's the difference between them? Do you have any example? Thanks.


add_rewrite_rule: $matches var not replaced by captured value

I want to access a plugin file (when `<a>` is clicked) without exposing actual path of the file. I am using the following rewrite rule:               add_rewrite_rule( 'continue/([0-9]+)/?$', 'wp-content/plugins/my-plugin/continue.php?where=$matches[1]', 'top' );      The request is redirected to `continue.php` but I always get `$_GET['where']=$matches[1]` instead of `$_GET['where']=123` inside continue.php. It should have been replaced by some number. I want something similar to this **Update** I have tried Monkeyman Rewrite Analyzer but my rule does not show up in it. Then why am I being redirected to the correct page? e.g. for `continue/2` it has the following output: `(.+?)(/[0-9]+)?/?$ pagename: continue page: /2`


Editing wordpress dashboard

I've almost edited dashboard of wordpress but now i'm confused with sidebar I can't find page where appereance, posts, comments, settings etc etc. Can anyone know where i can find codes of that sidebar


Stylesheet not being loaded?

I placed a link for an extra stylesheet in my header:                    <link rel='stylesheet' href='<?php echo get_bloginfo('template_url'); ?>/woo.css' type='text/css'/>      Which works fine on my local machine, but on my staging server the CSS is not applied. When I view source and follow the link for the stylesheet, it loads just fine, so I know the link is not broken. But for some reason that stylesheet is not being applied to the page. I checked permissions, they are 644. I am stumped. I've never had this happen before. Using WooCommerce with Rockwell child theme.


What should I use instead of WP_CONTENT_DIR and WP_PLUGIN_DIR?

The WordPress documentation for Determining Plugin and Content Directories states that: > WordPress makes use of the following constants when determining the path to > the content and plugin directories. **These should not be used directly by > plugins or themes** , but are listed here for completeness. It goes on to list `WP_CONTENT_DIR` and `WP_PLUGIN_DIR` among constants that theme and plugin developers should not use, presumably because of this: > WordPress allows users to place their wp-content directory anywhere they > want, so you must never assume that plugins will be in wp-content/plugins, > or that uploads will be in wp-content/uploads, or that themes will be in wp- > content/themes. Mark Jaquith also comments here that those constants should not be used: > Don't use WP_PLUGIN_URL or WP_PLUGIN_DIR — plugins might not be in the > plugins directory. **So, what is the accepted way of referencing the full path to the plugins, wp-content, and themes folders without using these constants?** As a simple example, to output the full path of all installed plugins, I can do this:               <?php     $plugins = get_plugins();          foreach ($plugins as $file => $details) {         echo WP_PLUGIN_DIR . '/' . $file . '<br>';     }      Which produces a list like so:               /var/www/wp-content/plugins/akismet/akismet.php     /var/www/wp-content/plugins/debug-bar/debug-bar.php     /var/www/wp-content/plugins/hello.php      (I might want to do this if I was writing a plugin to allow the user to selectively archive plugins as part of a site backup, for example.) If using `WP_PLUGIN_DIR` is wrong, what is the suggested alternative? There is no equivalent to `wp_upload_dir()` for the plugins, themes, and wp-content folder that I can find, which makes referencing the potentially wandering themes and plugins root directories problematic.


How does a Child Theme works?

I created a child theme and installed it but I don't know how exactly it works! For example, in the parent theme I have the code below:               .header {        margin-top: 10px;        margin-bottom: 10px;        width: 300px;        height: 150px;        background: white;        border-width: 5px;     }      And I want to not include the width: 300px; , the background and the border- width (because i don't want background and border) and change the "margin-top: 10px;" to "margin-top: 15px;" in the child theme. So normally in the child theme I would have:               .header {        margin-top: 15px;        margin-bottom: 10px;        height: 150px;     }      The subject is that if I do that WordPress will automatically check first the `style.css` of the child theme and then the `style.css` of the parent theme. So it will execute the missing code (width: 300px; , the background and the border-width). What should I do? I am a bit confused. Do I have to delete each line I don't want from the parent theme? But if I do that after an update it will add it again.


How to add Ajax to the default widget calendar to support next/previous months loading?

I want to customize or replace the default calendar, similar to the default widget, but with Ajax next and previous months loading. Ideally I would like to be able to do that (red dots are dates with posts): > ![example](http://is.gd/8mvxuv) The left and right parts are preview of next and previous months. But that will be a bit hard to do. Just a simple WordPress calendar with Ajax next/previous and link to days containing posts will be enough. Maybe there is a way (a trick ?) to add Ajax months loading on the default calendar widget. The default one is simple and perfect, but this feature is missing. How could I do that?


Allow dot in wordpress permalinks (only for categories)

I'm using domain names as category. For instance I have category name `google.com` But wordpress converts dot with hyphen in permalinks. Can someone tell me how to allow dot in category permalink?


Clean-up script tags

I want to clean up `<script>` tags generated by WordPress to produce more semantic output for HTML5. You can already do this for `<style>` tags using this code attached to the `style_loader_tag` filter:               //clean up the default WordPress style tags     add_filter('style_loader_tag', 'clean_style_tag');          function clean_style_tag($input) {         preg_match_all("!<link rel='stylesheet'\s?(id='[^']+')?\s+href='(.*)' type='text/css' media='(.*)' />!", $input, $matches);              //only display media if it's print         $media = $matches[3][0] === 'print' ? ' media="print"' : '';                                                                                return '<link rel="stylesheet" href="' . $matches[2][0] . '"' . $media . '>' . "\n";     }      But there isn't an equivalent `script_loader_tag` in core yet. It was proposed in the past, but for now we need a workaround. I've started looking in `/wp-includes/class.wp-scripts.php` at `function do_item( $handle, $group = false )` around line 79 which holds the script output (specifically `lines 117-120`), but I'm having a bit of trouble finding an appropriate filter that could be used here.


Multiple Category Search

I'm trying to create a search feature that will allow users to enter a search term and select a couple of categories. The script searches a single category just fine, but when I add more than one I hit a roadblock. My code is as follows:               <form method="get" id="searchform" action="<?php echo home_url(); ?>">         <input type="text" onclick="this.value='';" onfocus="this.select()" onblur="this.value=!this.value?'Search...':this.value;" value="Search..." name="s" id="s" />         <input type="hidden" name="post_type" value="product" />         <?php wp_dropdown_categories('taxonomy=product_cat&id=make&child_of=15&show_option_all=Select Make...'); ?>         <?php wp_dropdown_categories('taxonomy=product_cat&id=model&child_of=21&show_option_all=Select Model...'); ?>         <input type="submit" id="searchsubmit" value="Search" />     </form>      As I was searching around I discovered: Wordpress Multiple Category Search, which seems to do exactly what I want...however I'm not sure how to incorporate the suggestion. I'm pretty sure you add the following to your functions file:               add_action( 'parse_request', 'category_search_logic', 11 );     function category_search_logic( $query ) {              if ( ! isset( $query->query_vars[ 'cat' ] ) )             return $query;              // split cat query on a space to get IDs separated by '+' in URL         $cats = explode( ' ', $query->query_vars[ 'cat' ] );              if ( count( $cats ) > 1 ) {             unset( $query->query_vars[ 'cat' ] );             $query->query_vars[ 'category__and' ] = $cats;         }              return $query;     }      But, how do I incorporate this into the search form? I'm sure it's something simple, but I'm lost...anyone have any ideas? Thanks, Josh


post__in not working with pre_get_posts, but post__not_in does work

I have an action setup on `pre_get_posts` which I would like to use `post__in` on. I used the following code as a test:               $query->set('post__not_in', array(74485,1528,71460));      This works, the total number of posts is reduced by those 3. However, what if I want to use `post__in` to just return those 3 posts? I tried:               $query->set('post__in', array(74485,1528,71460));      But that didn't work. I thought maybe it was because `post__not_in` is already being used (as the codex says `post__in` and `post__not_in` can't be used together. So I tried:               $query->set('post__not_in', '');     $query->set('post__in', array(74485,1528,71460));      But this still doesn't work. Any help please? Thanks


How to build a movie database with wordpress?

I'm looking for a plugin to build a movie database like Popcritics The plugin would permits me to add custom info (like CustomPress can do) about a movie. Ultimately, the plugin could permit users to register for saving favorites movies. Do you know of one ?