Listing posts by grouping dates

I have a music events site http://www.zarpa.eu. I'm using the Future is Now plugin to help me to schedule the events http://wordpress.org/extend/plugins/the-future-is-now/ I'm trying to group events by dates, something like this: http://pt.yeaaaah.com/pt/agenda-de-concertos Is there a simple solution for this? I tried many things and I searched for all over Google and nothing.. Thank u :)


Why is json_decode failing?

I'm trying to determine if this is related to my having the latest version of PHP on my server while using the latest version of Wordpress. Or if I'm just doing it wrong: Here's my function that is correctly returning values (I can see them when I do an echo or a var dump):                   function my_Get_CURL (){         $url        = 'http://someotherserver/event/94303?radius=30';         //  Initiate curl             $ch = curl_init();         // Disable SSL verification             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);         // Will return the response, if false it print the response             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);         //header         $headers = array(             'Content-type: application/json'         );         curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);         // Set the url             curl_setopt($ch, CURLOPT_URL,$url);         // Execute             $json_content=curl_exec($ch);              $json = json_decode($json_content, true);        // echo $json_content;             return array(                  'distance' => $json->distance,                 'data' => $json->data             );         }              add_filter('the_content', 'my_Get_CURL', 1,3);      Here's what var_dump or echo produces:               [{"distance": 0.0, "data": {"event_id": "1179", "post_id": "1564", "location_id": "19", "location_postcode": "94301"}}, {"distance": 2.162680661505968, "data": {"event_id": "1193", "post_id": "1578", "location_id": "19", "location_postcode": "94301"}}      Is it me or, as I've read some scattershot reports on json_decode in Wordpress, is it the fact that I'm using php v5.3.2? Should I be using wp_remote_retrieve_body instead? What's the difference between what that does and the CURL options I'm using? Also, I did try this approach too..which was textbook. Still nothing gets returned:               function my_wpRemote() {              // Send GET request to remote API         $api_url = 'http://remoteserver/event/94303?radius=30';         $api_response = wp_remote_get( $api_url );              // Get the JSON object         $json = wp_remote_retrieve_body( $api_response );              // Make sure the request was succesful or return false         if( empty( $json ) )             return false;              // Decode the JSON object         // Return an array         $json = json_decode( $json );              return array(             'distance'  => $json->distance,             'data' => $json->data         );     }     add_filter('the_content', 'my_wpRemote', 1,3);


Custom term link return 404 error

I have create a custom post type and a taxonomy while i am clicking on the taxonomy link it returns 404 error, This how i created the custom post type and taxonomy.               function create_post_type_press()     {         $labels = array('name' => __( 'News', 'example' ),                         'singular_name' => __( 'News', 'example' ),                         // 'add_new' => __( 'Add New Article', 'example' ),                         'add_new_item' => __( 'Add News', 'example' ),                         'edit_item' => __( 'Edit News', 'example' ),                         'new_item' => __( 'New News', 'example' ),                         'view_item' => __( 'View PNews', 'example' ),                         'search_items' => __( 'Search News', 'example' ),                         'not_found' =>  __( 'No News found', 'example' ),                         'not_found_in_trash' => __( 'No News found in Trash', 'example' ),                         'parent_item_colon' => '',                         'menu_name' => 'News');              $args = array(  'labels' => $labels,                         'public' => true,                         'publicly_queryable' => true,                         'show_ui' => true,                         'query_var' => true,                         'show_in_nav_menus' => true,                         'capability_type' => 'post',                         'menu_icon' => get_template_directory_uri() . '/image/settings.png',                         'hierarchical' => false,                         'menu_position' => 90,                         'supports' => array( 'title', 'editor', 'thumbnail', 'revisions', ),                         'rewrite' => array( 'slug' => 'news-topic', 'with_front' => false ));         register_post_type( 'news_article' , $args );     }     add_action( 'init', 'create_post_type_press' );                 function news_topic() {           register_taxonomy(           'topic',           'news_article',               array(                   'hierarchical' => true,                   'label' => 'Topics',                   'query_var' => true,                   'rewrite' => array('slug' => 'news-topic')               )           );       }       and this is for getting the taxonomy link.                   function get_terms_dropdown($taxonomies, $args){             $myterms = get_terms($taxonomies, $args);             $output ="<select id='dynamic_select'><option selected class='drop_down'>Default</option>";             foreach($myterms as $term){                 $root_url = get_bloginfo('url');                 $term_taxonomy=$term->taxonomy;                 $term_slug=$term->slug;                 $term_name =$term->name;                 $link = $term_slug;                 $output .="<option>".$term_name."</option>";             }             $output .="</select>";         return $output;         }         $taxonomies = array('topic');         $args = array('orderby'=>'count','hide_empty'=>true);         echo get_terms_dropdown($taxonomies, $args);      When i am clicking on the link it goes to `http://domain/news/taxonomy`


Slow query when dealing with wp_wpsc_submited_form_data

I found that my wp-ecommerce is slow at the following query: > SELECT `wp_wpsc_submited_form_data`.value, `wp_wpsc_checkout_forms`.* FROM > `wp_wpsc_checkout_forms` LEFT JOIN `wp_wpsc_submited_form_data` ON > `wp_wpsc_checkout_forms`.id = `wp_wpsc_submited_form_data`.`form_id` WHERE > `wp_wpsc_submited_form_data`.log_id = 656 OR `wp_wpsc_checkout_forms`.type = > 'heading' ORDER BY `wp_wpsc_checkout_forms`.`checkout_set`, > `wp_wpsc_checkout_forms`.`checkout_order` /* From [/products-page/your- > account/] in [/nas/wp/www/staging/*/wp-content/plugins/wp-e-commerce/wpsc- > theme/functions/wpsc-user_log_functions.php:659] */; With the performance: > Query_time: 7.282546 Lock_time: 0.000076 Rows_sent: 18 Rows_examined: 713142 About 713K row examined, and it took 7.2 seconds. This is really slow. I have the following ideas how to solve this problem:   1. There are about 40K items in `wp_wpsc_submited_form_data`. I think I can clear them to reduce the number of row examined. I think `wp_wpsc_submited_form_data` contains just logs that can be clear at all. But I am not too sure, what do you think?   2. Ask my host provider to tune my database query. Because I don't think that 713K of rows should take 7 seconds to examine; it could be either the IO throughput or the memory allocation at my host provider side that requires correction. What do you think? Which is the real culprit here, the long list of rows, or the IO throughput?


Send an email to users reminding them about the event 2 days in advance

In my database, I already have the users list and the events list with their dates and times. How do I send an email to the users list reminding them about the event 2 days in advance? I need it to be automatic. Is there a plugin for this? Or do I need to use Cron? Or Transient? Any example? Thanks!


Poor Image thumbnail quality

I'm trying to create high-quality thumbnails to display in my menu but cant seem to get a good resolution. We would like to avoid making our authors have to upload two different images so if there is a nice, automatic way to do this that would be great. What is the best approach to this in WP? I can do any custom coding needed just looking for advice from someone who has dealth with this before. ![enter image description here](http://i.stack.imgur.com/Mieua.png)


How to lock a post or page

How to lock a post or page from editing or deleting but can be viewed on site? I am not able to lock a post, I read several articles but can't find my answer. Any help?


Why use the Settings API over a new administration menu?

I'm writing a 'quote-me' plugin which provides the end-user with a quote based on data they submit through a front-end form. The quote is calculated according to a price list. The price list varies depending on the time of year so I need a way of letting the admin-user update the prices via the back-end dashboard. My first thought was to use the Settings API but have since seen administration menus can be created. Considering my objective above, should I create a new admin menu or should I use the Settings API? Which is more appropriate for my use case and why? Hoping someone can explain. Thanks in advance. **UPDATE:** My confusion came from my assumption that the Settings API is to be used for just the _Settings_ administration menu. But now I know the Settings API can be used across the whole set of administration menus, including new ones I create. Thanks for your answers and comments!


Thumb doubles the image file size

My original images are 420x500/840x1000 and the file size varies around 15-30kb per image. Though when resized by wordpress/woocommerce into a thumb to 340x340(crop) the image size gets to 50kb+. The resizing happends automatically by Wordpress/woocommerce. Link to website - I'm using XING, a theme from Themeforest. The image sizes has been changed in Woocommerce "Image Alternatives" to crop and 340x340px.               function gpp_jpeg_quality_callback($arg)     {     return (int)100;     }               add_filter('jpeg_quality', 'gpp_jpeg_quality_callback');      Found this code in Functions.php though. Is this the issue?


how to make a plugin secure, so any one if changes something in plugin, it just disables it self and notify us on server?

can you please tell me about plugin development,because most of wordpress plugin material referred but no one can define how to make a plugin secure, so any one if changes something in plugin, it just disables it self and notify us on server. Thanks in advance.


Change template if tag selected

I've got the following code, which changes the page template if 'street-style' is picked from the categories. However, I'd like to change this to the tag 'street'. I currently have:               function get_custom_cat_template($single_template) {          global $post;                 if ( in_category( 'street-style' )) {               $single_template = dirname( __FILE__ ) . '/street-gallery.php';          }          return $single_template;     }          add_filter( 'single_template', 'get_custom_cat_template' ) ;      If I change `in_category` to `is_tag`, nothing happens. Is this not possible, or am I doing it incorrectly?


Random loop with code to prevent duplicate output returns no output at all from time to time

I have a custom taxonomy with several quotes assigned to each term. Two terms (`general` and `yoga`) share the same pool of three quotes. On my `front- page.php` i randomly draw one quote from each term and display it as an introduction to each section. In the case of the terms `general` and `yoga` i've included a failsafe, the variable `$do_not_duplicate`, to prevent that in the second draw the same quote is picked again and that i have the same quote twice on a single page. The code of the first block is:
         <?php             $args = array(                 'post_type' => 'quotes',                 'thesections' => 'general',                 'posts_per_page' => 1,                 'orderby' => 'rand'             );             $the_query = new WP_Query( $args );             if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); $do_not_duplicate = $post->ID; ?>             <q><?php the_field( 'quote_text' ); ?></q>
<?php the_field( 'quote_origin' ); ?>             <?php endwhile;                     wp_reset_postdata();                 else: ?>
DB error
             <?php endif; ?>
      The code of the second block is:
         <?php             $args = array(                 'post_type' => 'quotes',                 'thesections' => 'yoga',                 'posts_per_page' => 1,                 'orderby' => 'rand'             );             $the_query = new WP_Query( $args );             if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); if( $post->ID == $do_not_duplicate ) continue; ?>             <q><?php the_field( 'quote_text' ); ?></q>
<?php the_field( 'quote_origin' ); ?>             <?php endwhile;                     wp_reset_postdata();                 else: ?>
DB error
             <?php endif; ?>
      Problem is, it works most of the time, but after two or three page reloads, where the quotes are updated properly and no duplicates are shown, it happens that the second block remains blank with no output while the first block shows a quote. No php errors in the logs are shown, nor errors in wp debug mode - nothing. Is it due to the small number of quotes in the term (3 quotes) or is there an error in the code? I literally have no idea what the problem is in this case and what leads to those no shows in the second block every few reloads. :/ Best regards Ralf


Create a plugin with Calendar picker

I am currently creating a plugin and need one of the fields to be a drop down calendar picker. Will I have to build this as well or is there a hook I can use to use something already produced by WordPress?


Delete wp_deregister_script('jquery') returns an not shown error

To register my scripts i have this code in my functions.php               function enqueue_scripts() {               wp_deregister_script('jquery');               wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js');               wp_register_script('flexslider', get_stylesheet_directory_uri() . '/js/flexslider.js', 'jquery', '', TRUE);                    wp_enqueue_script('jquery');               wp_enqueue_script('flexslider');     }          add_action('wp_enqueue_scripts','enqueue_scripts');      The problem is when i delete these lines:               wp_deregister_script('jquery');     wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js');      the site ignores the jQuery that was registered from wordpress. But in the source code the script is shown. Does anyone have an idea?


Can't use admin_enqueue_scripts or wp_enqueue_script

I've suddenly had an issue that neither `admin_enqueue_scripts` or `wp_register_script` are working properly, they were working fine for a while but suddenly stopped working. In the following function, the first `wp_register_script` is working fine and loading modernizr, and the `wp_enqueue_style` is working fine and loading globalstyle, but neither the require or the global scripts are loading.               function theme_enqueue_scripts(){         wp_register_script('modernizr', get_stylesheet_directory_uri()  . '/js/modernizr.js');              wp_register_script('require', get_stylesheet_directory_uri()  . '/js/vendor/requirejs/require.js', array(), false, true);              wp_register_script('global', get_stylesheet_directory_uri()  . '/js/global.js', array('require'), false, true);              wp_enqueue_style('globalstyle', get_stylesheet_directory_uri()  . '/css/global.css');     }     add_action('wp_enqueue_scripts', 'theme_enqueue_scripts');      And the following function doesn't load admin-nav.js using `admin_enqueue_scripts()`               function navigation_script() {         wp_register_script('admin-nav', get_stylesheet_directory_uri()  . '/js/admin-nav.js',array(), null, true);         }     add_action( 'admin_enqueue_scripts', 'navigation_script' );


How to make top level menu think it has a current item

This question has always tripped me up, but it seems like there should be an easy solution. I have created a couple pages in a hierarchy as follows.               About Us         - History         - Mission          Events         - Field Day         - Labor Day Picnic      I have also created three menus in Wordpress. A "Main" Menu that holds:               About Us     Events      This menu is displayed horizontally across the top of the website. I also have two secondary menus, "AboutUsMenu" which just holds the following two pages:               History     Mission      The third menu, "EventsMenu" which holds the other two sub pages:               Field Day     Labor Day Picnic      I added a meta box on the page editor which let's me associate one of the two sub menus with every page. This allows me to show my "Main" menu across the top of the website, and then on each page, I can dynamically figure out which sub menu to show on any page. The problem occurs when the user visits a sub page, say /about-us/mission. Since I'm on the mission page, "Main" menu does not give the About Us page a css class of current_page_item. Technically, it's not the current page, but I would like to be able to style it as the current page since it is the active section as far the user is concerned. Main menu doesn't know anything about the sub page so Wordpress can't add the current_page_item or current_page_ancestor CSS class. I'm using wp_nav_menu to write all menus. Can anyone tell me an easy way to link all of this together so the menus will understand they are the current menu items.


Splash screen in htaccess, now links are not working

I wanted to use an already made html page for my wp site in root. Didnt want to move all wp inside a folder so I used the answer here using htaccess. Problem is, now if I write /wp-admin I got to the parent directory without redirecting to wp-admin/index.php. Also, If I am into mysite.com/blog.php and write wp-admin, I get a redirect into the same blog. I can see the admin bar on top but cant get into the dashboard from blog.php I have to write mysite.com/wp-admin/index.php or mysite.com/wp-admin/ and click on index.php Help please D: Here's my htaccess:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress          DirectoryIndex splash.php directorio.php


Trying to use wp_set_object_terms while supplying an array for both term id, and texonomies

I'm trying to use `wp_set_object_terms` ref : http://codex.wordpress.org/Function_Reference/wp_set_object_terms while passing array for both the terms and taxonomy for some reason i keep getting : `Warning: Illegal offset type in isset or empty in /home1/stodeckc/public_html/clicktranslate/wp-includes/taxonomy.php on line 231` this is how i am trying to set it:               parents[] = array(         'item_id' => 15,         'app_name' => 'justanotherone'     );          foreach($parents as $parent){         $cat_ids[$parent['item_id']] = (int)$parent['item_id'];         $taxonomies[$parent['item_id']] = $parent['app_name'];     }     wp_set_object_terms( 42, $cat_ids,$taxonomies);      am i missing something ? Thanks


How to stop Wordpress Search form from searching only in current page?

My wordpress search form (code below) appends the query string to current page only. For example if I go to `http://Website/unknown-page` and then use the form to search for some content the query string looks like this `http://Website/unknown-page?s=Search` and only searches within the current page. It should be searching from the root like this: `http://Website/?s=Search` How do I fix this?                                    <form class="form-inline" role="search">
                                         Search:                                         <input type="text" name="s" class="form-control" placeholder="Search">
                                       <button type="submit" class="btn btn-default">Submit</button>                                 </form>


wordpress - add a custom admin section with fields for name, address, city,state, and photo upload

Am attempting to create a custom post type and have it contain very specific info. Name, address, city, state, zip and photo - as a post. Need to have the admin section show form fields named as what these items are. Yes, I could use custom fields, however want to do it right and setup form input boxes (or meta boxes) for each specific piece of data. Having the post creation dialog have a specific file upload input for the photo would be pretty smooth. Will use plugins if necessary, however would rather code it in, as it is very specific (and should stay that way). Looking for suggestions or tutorials that would cover this specific need, or plugins that anyone has used that do this.


if(!is_user_logged_in()) returns true when 404

I'm running a closed website for registered users only. For doing so I check in if user is logged in               // no non-authenticated users allowed     if( !is_user_logged_in() ) {         wp_redirect('/wp-login.php');         //auth_redirect();         exit;     }      But sometimes It just logged me out, and I could not understand where to seek the problem. it happened ocassionally and so it was really hard to debug. Now: with different function I found that `if( !is_user_logged_in() )` returns true on 404 page. I'm still debugging but I want to hear your opinion, is this normal or intended? Could you confirm if this is same with your installaton? I'm running latest version of Wordpress * * * Update: still cant undestand, in footer.php               if(!is_user_logged_in()) {         echo '123';     }      echos 123 but my function does not redirect.. but its still strange and have problem with another plugin because of this. plugin looks like this:               add_action("wp_footer","bpln_store_ids");     function bpln_store_ids(){         if(!is_user_logged_in())             return;      ?>      <div id="bpln-notification-ids" style="display:none;">      <?php echo join(",",bpln_get_all_notification_ids(bp_loggedin_user_id()));?>      </div>     <?php     }      since check returns true, the actual content will never be displayed


Showing just the menu toggle next to logo in twenty fourteen

For mobile, I want to eliminate the black menu bar, search box/icon and move the menu toggle up so that on mobile, my site just has the logo and the menu toggle. This gives a bit more room for content.


How to set a category by day name?

I have a category for each day. Sunday, Monday, Tuesday, etc. I want to show this category fixed depending on the day of the week. I'll also have other categories to filtering. So, the category `day` will be fixed, and the other ones can be added or not, depending on the user input. What is the best approach to achieve this?


order by numeric value for meta value

I have read countless posts on ordering data by numeric value ( as opposed to string - it i have a numeric meta value and it gets ordered like this 1 11 12 2 233 etc as opposed to the way i want it I am using WP_Query have tried using meta_query => 'NUMERIC' but i'm not sure if that's what it's actually supposed to do eg               $args =  array(         'meta_query' => array(                 array(                       'type' => 'NUMERIC'                 )         ),         'orderby' => 'meta_value',         'meta_key' => '_date',         'post_type' => 'events',         'posts_per_page' => 5,         'order' => 'ASC'      );


Get author total post votes from post meta

In author.php, i have the list with the posts written by the author.   I'm trying to get the total number of votes, from the author posts.   All posts have a post_meta with a numbered value. i need to count the total votes from all the posts that made from this user/author. Is that possible? is a query available, that can handle this request? thanks a lot!


How to Create Custom Post Type with Multiple Color Options?

Can you please let me know what is the best choice to create a Custom Post type like "Pen" which has Taxonomy called "Brand" now each of these post has definitely Black color which I will use as Custom Post Meta but some of Pen has more than 3 or 4 colors.Now I am kind of confuse to how to do that? Besides I need to print out the available color of the pan(if available) and link to them. **Update:**               <?php     // Register Custom Post Type     function custom_post_type_pens() {     $labels = array(         'name'                => 'Pens',         'singular_name'       => 'Pen',         'menu_name'           => 'Pen',         'parent_item_colon'   => 'Parent Product:',         'all_items'           => 'All Pens',         'view_item'           => 'View Product',         'add_new_item'        => 'Add New Pen',         'add_new'             => 'Add Pen',         'edit_item'           => 'Edit Pen',         'update_item'         => 'Update Product',         'search_items'        => 'Search Pens',         'not_found'           => 'No Pen Found',         'not_found_in_trash'  => 'No products found in Trash',     );     $args = array(         'label'               => 'Pens',         'description'         => 'Product information pages',         'labels'              => $labels,         'supports'            => array( ),         'hierarchical'        => false,         'public'              => true,         'show_ui'             => true,         'show_in_menu'        => true,         'show_in_nav_menus'   => true,         'show_in_admin_bar'   => true,         'menu_position'       => 5,         'menu_icon'           => '',         'can_export'          => true,         'has_archive'         => true,         'exclude_from_search' => false,         'publicly_queryable'  => true,         'capability_type'     => 'page',     );     register_post_type( 'pens', $args );          }          // Hook into the 'init' action     add_action( 'init', 'custom_post_type_penss', 0 );          // Register Custom Taxonomy     function custom_taxonomy_pen()  {              $labels = array(             'name'                       => 'Brands',             'singular_name'              => 'Brand',             'menu_name'                  => 'Brands',             'all_items'                  => 'All Brands',             'parent_item'                => 'Parent Brand',             'parent_item_colon'          => 'Parent Brands:',             'new_item_name'              => 'New Brand Name',             'add_new_item'               => 'Add New Brand',             'edit_item'                  => 'Edit Brands',             'update_item'                => 'Update Brand',             'separate_items_with_commas' => 'Separate Brands with commas',             'search_items'               => 'Search Brands',             'add_or_remove_items'        => 'Add or Remove Brand',             'choose_from_most_used'      => 'Choose From the Most Used Brands',         );         $args = array(             'labels'                     => $labels,             'hierarchical'               => true,             'public'                     => true,             'show_ui'                    => true,             'show_admin_column'          => true,             'show_in_nav_menus'          => true,             'show_tagcloud'              => true,         );         register_taxonomy( 'brand', 'pens', $args );          }       // Hook into the 'init' action     add_action( 'init', 'custom_taxonomy_pen', 0 );          add_action( 'add_meta_boxes', 'cd_meta_box_add' );       function cd_meta_box_add()       {           add_meta_box( 'my-meta-box-id', 'Pen Details', 'cd_meta_box_cb', 'pens', 'normal', 'high' );       }            function cd_meta_box_cb()       {           ?>           Price           <input type="text" name="my_meta_box_text" id="my_meta_box_text" />           Sale On           <input type="checkbox" name="my_meta_box_text" id="my_meta_box_text" />           Sale Price           <input type="text" name="my_meta_box_text" id="my_meta_box_text" />          Color Optins           <input type="checkbox" name="my_meta_box_text" id="my_meta_box_text" />
       <?php            // $post is already set, and contains an object: the WordPress post           global $post;           $values = get_post_custom( $post->ID );           $text = isset( $values['my_meta_box_text'] ) ? $values['my_meta_box_text'] : '';           $selected = isset( $values['my_meta_box_select'] ) ? esc_attr( $values['my_meta_box_select'] ) : '';           $check = isset( $values['my_meta_box_check'] ) ? esc_attr( $values['my_meta_box_check'] ) : '';                // We'll use this nonce field later on when saving.           wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );          ?>
              Text Label              <input type="text" name="my_meta_box_text" id="my_meta_box_text" value="<?php echo $text; ?>" />

              Color              <select name="my_meta_box_select" id="my_meta_box_select">                  <option value="red" <?php selected( $selected, 'red' ); ?>>Red</option>                  <option value="blue" <?php selected( $selected, 'blue' ); ?>>Blue</option>              </select>

           Featured post:              Color              <select name="my_meta_box_select" id="my_meta_box_select">                  <option value="red" <?php selected( $selected, 'red' ); ?>>Red</option>                  <option value="blue" <?php selected( $selected, 'blue' ); ?>>Blue</option>              </select>          Remove

              <input id="adder" type="button" class="button-primary" value="Add More Color Options"></button>

              <input type="checkbox" id="my_meta_box_check" name="my_meta_box_check" <?php checked( $check, 'on' ); ?> />               Do not check this
           <?php                }      ?>


Theme Splash Image within the "Appearance -> Themes" control panel

I have created a theme, and its all working fine. Within the WordPress control panel under **"Appearance -> Themes"** , you can see the available themes _(Twenty Fourteen, Twenty Thirteen etc etc)_ and they all have a splash image demonstrating what your blog could look like. My theme just shows a blank canvas. Is there a way of adding an image or something to represent my theme? I bet I have missed something really obvious. :/


wp_ prefix changed. What is the way to change so any prefix is understood?

I have a plugin with a line calling wp_capabilities. This works with the default prefix. If someone changes the prefix to something else (bluehost scripts do this), how do I fix this code? Can you also explain why? I can hard code it for the individual site but how do I make it 'universal'? Change:               $current_user->data->wp_capabilities[$role_name];      To:               $current_user->data->wp_xyz_capabilities[$role_name];      I understand (and use) {$wpdb->prefix} in an SQL statement works fine. I've looked at $table_prefix as well as $wpdb->prefix but the combinations I've tried in PHPStorm state expecting semicolons or red lines appear stating there is a problem. Thank you for your time and explanation.


wp_customize_image_control default value

I am trying to create a custom theme using Wordpress 3.4's customization options. I would like to create an option to change the theme's logo, but I would like to also display a default logo image. I am using the following code in my function.php page:               $defaultbranding = "get_bloginfo('template_directory') . '/images/logo.png";              $wp_customize->add_setting( 'change_branding', array(             'default' => get_bloginfo('template_directory') . '/images/logo.png',         ) );              $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'change_branding', array(             'label'   => 'Image Control',             'section' => 'theme_settings',             'settings'   => 'change_branding',         ) ) );      And in the theme's header.php page:               src='<?php echo get_theme_mod( 'change_branding' , 'default' ) ?>'      I would like the 'default' value on the front end to be:               get_bloginfo('template_directory') . '/images/logo.png'      Is there some way I can achieve this? Thanks in advance for any help.


List taxonomies with thumbnails

I've added an extra field to a taxonomy called "albums" via this function:               add_action( 'albums_edit_form_fields', 'albums_taxonomy_edit_meta_field', 10, 2 );     function save_taxonomy_custom_meta( $term_id ) {     if ( isset( $_POST['term_meta'] ) ) {         $t_id = $term_id;         $term_meta = get_option( "taxonomy_$t_id" );         $cat_keys = array_keys( $_POST['term_meta'] );         foreach ( $cat_keys as $key ) {             if ( isset ( $_POST['term_meta'][$key] ) ) {                 $term_meta[$key] = $_POST['term_meta'][$key];             }         }         // Save the option array.         update_option( "taxonomy_$t_id", $term_meta );     }     }      The metadata is saving fine and now I'd like to list or query my taxonomies in a page by displaying next to the taxonomy's name the value of the metadata attached to every taxonomy (in this case, the image). Anybody knows how to do it ?


How to i18n text coming from the db or from an external source

I'm writing a plugin and i wanted to i18n correctly text which i'm storing in the db or in an external file. How should i do that?As of now we are generating pot files with wordpress and so all the Translatable text is in calls               __( 'text', 'plugin_name');      But there is some text i would like to store in the db or in another format and that i don't know how to put into the POT files. The only thing that come to my mind is to use arrays for these data structures so that i can translate the values, but are there other options?


How Can I Centralize Content Usage and Approval in a WordPress Multi-Site installation

I am working with a non-profit client that runs several charities under one umbrella. A good metaphor would be to think of the United Way (but it's not the United Way). Can a WordPress multi-site installation do the following: Share content between sites. E.g., if site A has a section called "Advocacy", can that same content also be shown in site B? This would need to include text, photos, etc. How centralized can administration be made? For example, can draft posts from all websites be approved in one location? I'm sure there are other things I need to ask, but I'm still in the investigation phase.


WordPress Rewriting the DOM?

WordPress 3.9.1, Bones Theme. I'm setting up an archive page for regular 'ol blog posts. The theory is to wrap each post's information in a permalink. Such as:               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>         <a class="blog-article-permalink" href="<?php the_permalink() ?>">             <article id="post-<?php the_ID(); ?>">

<?php the_title(); ?>

<?php the_excerpt(); ?>

...

              <?php endwhile; ?>      When I load the page in any browser, I get:               ...
         ...
             ...
                                     Byline Info

...

...

...

      etc... So basically, some part of WordPress is rearranging my carefully coded archive and outputting the link three times as it's own block-level-element and not allowing it to wrap the rest of the article information as intended. I have 6 custom post types set up this way, and their archive pages look and work beautifully with get_posts(). I really want to use the generic loop for the blog, and not hack it up, because why would I? I've read answers such as changing the valid children setting for the TinyMCE, and tried thinking that it may affect the loop somehow, but that didn't work. I guess it makes sense that it would invalidate block-level elements within an `<a>` link tag in html4, but we're using html5 now, where it's perfectly legal. What am I missing here?


Most efficient way to add javascript file to specific post and/or pages?

I am wondering what the most efficient method is to add a javascript file specifically for a post and/or page. Here are a few solutions I came up with:   * Switch to HTML editing view and post your JavaScript in there (pretty bad solution)   * Custom fields with the specific JavaScript for that post/page in the key & value pairs   * In footer.php, load JavaScript files depending on which page you're on (this leads to a lot of conditionals though) On a side note, none of the JavaScript files will be shared between pages - it will literally be specific to what you're currently viewing. Any thoughts?


network site domain mapping still applied after being removed

I have a sub-domain network installation on `www.example.com` One of the sites is `rabbit.example.com` This site used to have a domain mapping to `www.rabbit.com`. I removed this mapping. However, when I go to `http://rabbit.example.com/wp-admin`, it forwards me to `http://www.rabbit.com/wp-admin` I have checked the site settings for `rabbit.example.com`, and the base URL and home URL are set to `rabbit.example.com`. I have double-checked the domain mapping is no longer there. I do not have a caching plugin installed. The site's database table, `wp_10_options`, has the site URL as `rabbit.example.com` Any ideas?


Advanced Taxonomy Queries Wordpress

I am working with wordpress and business listings. I have about 5000 business listing all over the usa. Each business listing has a custom field for state, county and city and brands. My business listings are car dealers and each dealer is loaded into my wordpress database under a custom post type called dealers. I have created two taxonomies called geography (logical structure = states ->county->city) and brands (ie. Honda, Toyota) to be able to view dealers by different queries options. It is my understanding I can query between the geography and brands taxonomy with parameters and it appears to be working. For instance, www.xyz.com/dealers/?geography=alabama&brands=toyota. This query would list a category page of all dealers in my database in the state of Alabama with a brand of Toyota. I now need to create dynamic category pages for hundreds of different query options by geography and brands. Here are the options:   1. All dealers by each state in the USA   2. All dealers by each county in USA   3. All dealers by each city in USA   4. All dealers by each brand   5. All dealers by each brand and state in the USA   6. All dealers by each brand and county in USA   7. All dealers by each brand and city in USA I assume I can have a programmer create a category template in wordpress for each of the above option and rewrite the urls to friendly to query the various options in my db. Can someone provide me some guidance if the above approach appears wise or is there a better approach that would be more efficient? My concern is the above approach might not work and also I spend a lot on programming and then a future release of wordpress changing the permalink structure and my solution does not work anymore. Your assistance is very much appreciated.


Show comments fields in two columns

I am using comment_form(); in loop-single.php file to show the comment form. I have the following fields in it: Name, Email, Website, Title, Comment. Currently all these form fields show underneath each other. I tried to modify the form in such a way so that all textbox values appear in left column & only the textarea appears in the right column. I tried to use comment_notes_after, comment_notes_before, comment_form_top, etc. so far but met with no success. So how can I achieve this (Any working code will be greatly appreciated)?


Efficiency of wp_options vs a new table

I'm building a WordPress theme framework, that will likely have many options as development progresses. I found a related question: When is it appropriate to create a new table in the WordPress database?, which indicates that a new table would be more efficient, but I'd like to know more. It makes sense that if it's faster to use a new table for a thousand entries, it must also be faster for tens or hundreds of entries. What's more, the wp_options table can become very cluttered. What are the differences in query execution time, memory usage, and other factors between these two options?


muliple wordpress installs (network) on different databases

I've installed a network for the main domain and the sub.domain.com It works, but I do prefer to maintain in separate databases, how do I do this? Thanks


Facebook like button that redirects?

Basically, here is an idea: I am starting a daily blog, and in order to gain access to sunday's posts, the user needs to share the site. I have figured out how to redirect once someone presses the +1 button, and how to redirect once someone tweets, but I have yet to figure out how to redirect after a facebook like. If anyone can help with this, I'll be very thankful. For the record, I plan on doing this as whitehat-edly as possible. Basically, the post will say that I'm trying to gain popularity for the site, that I could really use some shares, I'll point out that they get six posts a week without asking for anything, and I'll tell them that I'm fine with them deleting the post if they really don't want to share it. One other thing, I don't really care if they post it on facebook or not. Like, the code doesn't need to check their facebook page to make sure it worked. I just want it so that when they click the button, it posts, and redirects them. The page won't be hidden, if someone had the direct URL they could get to it without sharing. I just want it to be simple, as I'm an amateur, but I also want to use this to get more traffic and a more engaged audience. Thanks in advance, Liam


Disable comments on all posts/pages

Is there a quick way to disable all comments on all posts and pages. I know that you can go into the dashboard under posts, click edit, and Do Not Allow, under comments. Is that the only way?


non-clickable placeholder in the menu

well, I really would like one & more of my top-level menu items (parent menu items that has child menu items) to be non-clickable, so that visitors can only click on the child menu items...could be very nice for a horizontally positioned menu. any plugin out there that can do the trick (or trick or hack or....)?


What is a good jQuery content slider plugin?

I'm looking for a plugin that will let me easily place a jQuery based (because I want to avoid the hassle of multiple javascript libraries) slider on my site in various places. I'd like it to be able to handle images as well as html. I'm aware of the Featured Content Gallery plugin, but I would like to find an alternative (partly because of this tweet by Brad Williams, whose opinion I trust). Ideally, I'd like something that can automatically create a 'slideshow' based on categories, tags, recent posts, etc., but that can also let me manually create a 'slideshow' with whatever post, image, or other content I want to use. Edit: I'm looking for a WordPress plugin, not just a jQuery plugin.


How do I insert CSS into a function?

I have a custom function which allows users to choose between next/previous links and pagination and I'm attempting to add CSS classes to the next/previous links. I've tried this multiple ways and keep crashing my theme. How do I insert CSS classes into the previous and next link?               // Pagination     function my_theme_navigation()      {          global $shortname;              if( get_option( $shortname . '_next_prev_or_paginate' ) == 'Next' ) :              // the block for next-prev navigation              previous_posts_link ('Newer');             next_posts_link('Older');         else :              // the block for pagination             global $wp_query;              $big = 999999999; // need an unlikely integer                    echo paginate_links(                  array(                      'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),                      'format' => '?paged=%#%',                      'current' => max( 1, get_query_var('paged') ),                      'total' => $wp_query->max_num_pages                  )              );          endif;      }      For an example, check the bottom of this page: http://themeforward.com/demo2/


How remove Wordpress Impression from my website

I am developing one wordpress theme for client. I completed the theme. But he is asking about remove the wordpress theme impression. Here impression means when i try to see view page source i am able to see like wp-content like that. I need to remove that. Is it possible to hide this url.?


How can I obscure the fact my site uses WordPress?

Is there anything I can do to prevent somebody from knowing my site is using WordPress by looking at the source code of the front page and trying to access the login page? I am referring to people who scan sites using software that detects the software used to run the website to be able to attack it using any known weak point. If it is not possible to completely hide the fact that the site is using WordPress, is it at least possible to confuse them?


Linking between custom post types as if they where taxonomies?

Let's say we create an IMDB like website. So (for example) we can have two types of custom post types:   * movies   * actors We would like to see in each movie page all of it's actors. And in each actors page all of the movies he played in. Can this cross linking be done using custom post types? If not, is it expected to be possible in the future? If not, is there an alternative (in WP) for doing this? Thanks


Upgrading WordPress and Plugins; any Tips to Avoid Trouble?

Going to upgrade WordPress 2.7.1 to 3.0.1 along with all plugins, any tips to do without trouble? **Edit: 7 September** Dashboard is showing "New version available" for both, WordPress version and for some plugins. So i want to upgrade everything. then what should be upgraded first, WordPress or plugins? And which update would be best for both automatic through dashboard or manually through FTP


Comma seperated list of ID's as an array?

I have the following code that prints a comma separated list which I need in the form of an array, how do I get the list of id's into an array called $excluded_categories with contents as per below?               $categories = get_categories(array('taxonomy'=>'projects_category', 'exclude'=>7, 'orderby'=>'id'));     if ( !empty( $categories ) ) :     foreach($categories as $term){         echo $term->term_id.', '; // prints: 1,2,3,4,5,6,8,9,         }     endif;          $excluded_categories would be an array containing: 1,2,3,4,5,6,8,9


Code to determine WP version check

I'm unable to devine what's causing my theme to crash in WP 2.9.2, although I know its something in my query statement below, so I need to do a version check for (version) < 3 to branch it. What is the method to get the currently installed WP version? - I'm just using "wp_version" as a stand in :)               if(wp_version < 3)         $myqueryTopMenu = '';     else         $myqueryTopMenu = new WP_Query();$myqueryTopMenu->query(array('cat' => "$cat,-$catHidden",'post_not_in' => get_option('sticky_posts')));


How to fix pagination after rewriting url? ie. www.site.com/players/type/pro/page/3/

I have a custom post type of `players`, and archive-players.php lists them all at an address such as `www.site.com/players`. I'm then using a url like `www.site.com/players?type=pro` to list another page of just the pro players (modified wp_query based on custom user role, hence why I don't just do this with a taxonomy). I decided I should rewrite the url so it's `www.site.com/players/pro`. The page itself works fine, but my question is: how can I now fix the pagination when the url is something like `www.site.com/players/type/pro/page/3/`? at the moment I'm getting page not found. I'm using wp page-navi for the pagination. In fact, pagination doesn't work when I have it as just `?type=pro` either. The code I have for the rewrite is below. Is it better to rewrite using wordpress or mod_rewrite? I have no experience with either. Am I going about this the right way? I've read some other questions and posts all over the place, but the whole thing just confuses me.               function add_query_vars($aVars) {     $aVars[] = "type";     return $aVars;     }          add_filter('query_vars', 'add_query_vars');          function add_rewrite_rules($aRules) {     $aNewRules = array('players/type/([^/]+)/?$' => 'index.php?post_type=players&type=$matches[1]');     $aRules = $aNewRules + $aRules;     return $aRules;     }          add_filter('rewrite_rules_array', 'add_rewrite_rules');


Permanent names of attached files required

Simple: How to delete uploaded file ? Secondary: How to replace uploaded file and to keep its filename (inclusive the path) and all links (inclusive on the whole internet!!!) the same?


How do I get a single page navigation depending on the previous page?

I figured this would be a fairly comon thing. But I can't seem to find out how to do it. Or I'm just not using the correct search terms. I've got a website with a hompage that lists all my posts, and 3 menu items that each list a category. When I click on a post via a category, then I want the next|prev navigation to stay in that category. When I click on a post via the homepage, I want the next|prev navigation to be chronolonical. This is de navigation code which is in my single.php `<?php next_post_link('%link', '< Previous ', FALSE); ?> <?php previous_post_link('%link', '| Next >', FALSE); ?>` This is the correct setupt for navigating there from the homepage, but not when I get there via a category. Please help, I've been banging my head on this for hours now! Kind regards.


Want image captions to be from img ALT tags not title tags

Okay,here's my challenge. My client doesn't like how when you roll over an image in the gallery a tooltip shows up with the image's descritpion, which is taken from it's title tag. But he still wants the image description to show up as the caption when you click on the image and enlarge it. Here is a link to a page in the site, if you roll over the first image in the gallery, you'll see what I'm talking about and hopefully it'll make sense. http://mbigelowphotographer.com/wp/engagements I've tried to find ways on hiding browser default tooltips but I've had no luck. So I thought of placing the image's description in the images alt tag instead of the title tag. Which is fine, I took care of that in the gallery.php file. But now I can't figure out where in the shutter-reloaded.js, for the image caption to pull the alt tag instead of the title tag. I'm hoping its a simple solution that I'm just overlooking since I am only vaguely familiar with javascript. Or maybe I'm way off and it's not in that js file. Any help would be appreciated. Thanks in advance. I am sure I'm being vague in my description here, don't hesitate to ask for more details. http://wordpress.org/extend/plugins/nextgen-gallery/


$_GET & $post_ID

I got a set of meta boxes containing different form fields. All of them are build inside a set of classes. Now I have the problem that I have to hook the construction of the fields early enough to hook the needed scripts & styles. Everything is fine - I can display them, styles & scripts appear & work, saving the data works - but I can't retrieve the post meta data to fill the values of the fields. Point is that the fields get hooked at `admin_menu`, which is too early to get the `$post_id`. Now I saw that I could also use `$_GET['post']` to retrieve the ID. What speaks against this?


Having trouble generating pagination links on custom query

I'm using a custom query on a page after the initial loop to list some posts from a category I'm associating with that page. Im doing this:                   query_posts(array(            'category_name' => $name,            'orderby' => 'date',            'order' => 'DESC',            'posts_per_page' => 1,            'paged' => $paged));      I've also tried using `get_query_var('paged')` in place of $paged btw. then I do my loop and it shows the correct number of posts, 1. I actually am getting links generating on the page if I use `previous_posts_link()` or `next_posts_link()`, however, if I use `echo paginate_links()` after or even in my loop, no links are generated and where as I have 2 posts in that category currently so I expect to see at least a link to page 2. It seems like there is a lot of info out there about passing the correct info to query_posts for this instance but not what function to use to actually render the pagination links so i'd appreciate any insight. Thanks. Edit:(full code)
     <?php          if (have_posts()) : while (have_posts()) : the_post(); ?>              <article class="post" id="post-<?php the_ID(); ?>">
<?php the_title(); ?>
             <?php //include (TEMPLATEPATH . '/_/inc/meta.php' ); ?>
                 <?php the_content(); ?>                 <?php //wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>
             <?php edit_post_link('Edit this entry.', '
', '
'); ?>
         <?php endwhile; endif;              $name = '';         if(isset($pagename))         {             $name = $pagename;         }         if($name == '5a' || $name == '4a' || $name == '3a' || $name == '2a')         {             echo '
';             query_posts(array('category_name' => $name, 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => 1, 'paged' => $paged));                  if (have_posts()):                 while (have_posts()):                     the_post(); ?>                               <article <?php post_class() ?> id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>"><?php the_title(); ?>
                     <?php include (TEMPLATEPATH . '/_/inc/meta.php' ); ?>
                         <?php echo substr(strip_tags(get_the_content()), 0, 280).'...';?>                         <a class="quick_link" href="<? the_permalink()?>">(read more...)

                 <?                 endwhile;                 echo paginate_links();                 ?>
<?php previous_posts_link('« Previous') ?>

<?php next_posts_link('More »') ?>
                 <?             endif;             echo '
';              }         ?>


Gravatar Size Via Theme Functions?

Currently, to call comments I am simply using:               <?php wp_list_comments(); ?>      in comments.php. This is calling up gravatars, which I would like to be able to set the size of. How can I set the size of gravatars in my comments.


Filter RSS feed for custom post type to events for next 7 days only

I'm trying to create a custom RSS feed that shows posts from the custom post type 'events' for the next 7 days ahead only. The feed is already sorted by event start date order rather than published date through the plugin, I just can't figure out how (as a beginner in PHP!) how to limit the feed to only the 7 days ahead. This is the query I have so far, which works fine until I try to filter the feed against a date and then it returns no posts :-( Any pointers much appreciated!               date = date("d-m-Y");     $date = strtotime($date);     $date = strtotime("+7 day", $date);          $args = array(         'post_type' => 'event',         'showposts' => 10,         'meta_key' => 'st_date',         'meta_type' => 'date',         'value' => $date,         'compare' => '<'         );          query_posts($args);


Widget on the right side of the page overlaps with the left side

I added the mailchimp widget to the right column of my blog. But for some reason, it overlaps with the main content of the blog. Here is a screenshot of what happens![enter image description here](http://i.stack.imgur.com/USPoR.png) Would anyone know why this happens and how to stop it from happening? Thank you!


NextGen Gallery Slideshow Positioning Issue

I have been having an issue with the non-flash version of the NextGen Slideshow on my website. The slideshow seems to initially load the first slide about 5px below the desired position. The slide then moves up about a second or 2 later into the correct position. I have tried putting the slideshow in other widget areas and all result in the same positioning error. The page in question in here: www.ukjiayuan.com So far have been unable to get any support, but would really appreciate it if anyone can reccomend a solution. Many Thanks


Taxonomy Parent Name

Was just wondering how I would modify this piece of code:               <?php     $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );     echo $term->parent;     ?>      ...to display the parent name, rather than just an integer? Currently it returns the ID. Thanks.


Is it usual to have a non-Feedburner feed on a WordPress blog?

Is it usual or beneficial to have a non-feedburner feed on the site? At the moment I have only a feedburner feed. My blog is WordPress with a custom template. Which of these links would I use to create a Feed?: > http://blog.wordfruit.com/?feed=rss > > http://blog.wordfruit.com/?feed=rss2 > > http://blog.wordfruit.com/?feed=rdf > > http://blog.wordfruit.com/?feed=atom Or would it be one of these (for when using custom permalinks)?: > http://blog.wordfruit.com/feed/ > > http://blog.wordfruit.com/feed/rss/ > > http://blog.wordfruit.com/feed/rss2/ > > http://blog.wordfruit.com/feed/rdf/ > > http://blog.wordfruit.com/feed/atom/ Or a different link? Also, how do I create the Feed -- with the use of a plugin?


How do I turn off the Admin Bar for all Subscribers?

Maybe this is a stupid question. When a user logins to my Wordpress site with the Subscriber role, they have the WP Admin Bar appearing at the top of the page. The user can go into their dashboard and turn this off themselves. But how can I turn this off by default for all existing and new users?


Include text in echoed hyperlink

I´d like to include an extra two words into an echoed hyperlink. I have no PHP knowledge so far. Could anyone put me in the right direction?               <p class="excerpt"><strong> Bekijk meer van <?php echo get_the_term_list ( $post->ID, 'store' , '' )   ?>      It gives Bekijk meer van **storename**. I want it to show something like Bekijk meer van **extra1 storename extra 2**.


Odd page behaviour after removing sidebar

One of my web pages is displaying odd behaviour, after selecting a no sidebar template for the page. The sidebar has disappeared, but elements within the sidebar, now show in the bottom right-hand corner of the page Here is the PHP for the no sidebar template.               <?php     /*     Template Name: Page without sidebar     */     ?>          <?php     global $inove_nosidebar;     $inove_nosidebar = true;     include('page.php');     ?>      Here is a link to a image of the how the page looks at present. http://www.thedash.org.uk/wp-content/uploads/2013/03/Sidebar.jpg Any ideas or suggestions would be greatly appreciated. Thanks.


Twenty Eleven theme, how to change style to a specific "format"

My question is: it is possible to change the background color (for exemple) to an article who is categorized under "quote" format. (or whatever format like Aside or Link)? I want that an article in Quote format appears different from others, with a specific font color, or specific background color. Is that possible? The theme is Twenty Eleven Thank you!


Connect LDAP with Wordpress-Login

I have a wordpress-page where i offer webapps, mostly for free. Now, I want to connect this page with my LDAP-directoy from my first page. I tried several Plug-Ins but they did not work, yet. I am a bit sceptical how it should work with this plugins, but however, i gave it a try. I need this LDAP connect for the former costumers, so that it is still saved, which app they already downloaded and how the rated it. Furthermore i want to replace the rating by the wordpress comments, so that the page is even more based on wordpress. Now i am wondering what to do next. Has is more sense to build a special front-end-login for the users, so that wordpress itself does not connect with LDAP or is there any plugin that delivers this servers? Or should i try to connect LDAP and wordpress by myself?


What is the right way to code links for Wordpress pages?

this is really a two part question, neither of which I can find the direct answer to. (1) What's the correct way to link assets like buttons or include files like JS? Currently, the src attr for things like this is set to:               src="<?php bloginfo('template_url'); ?>/path/to/my/file.xxx"      Is that correct for deploying my site to production? In other words, it shouldn't really matter if it's www.mysite.com or www.mysite.dev because the PHP snippet will render to whatever the site URL is, right?. Currently it's in a staging environment with that top-level (but fake) .dev domain. (2) For navigation and other text links, is it okay that I use relative paths in the href attr? Is there a reason I should use absolute paths instead? Is there a SEO reason? I ask because right now my development URL (as mentioned above) is www.mysite.dev, so if I use absolute paths, I will have to go through and change each one to .com before deploying to production, which I don't want to do. Note: In case you're wondering, I am using DesktopServer from ServerPress as my Wordpress dev environment.


if/else on custom query gives 200 OK when condition not met?

**What?** I am modifying my theme to show comments of a post on a separate page. **How?** Mostly based on this answer but with improved checks and code. So this is what my page-comments.php (kinda) looks like: **(The code is very easy to scan through, trust me!)**               <?php get_header(); ?>          <?php         /*          * (Example URL: example.com/comments/?original_post=ID)          *          * Check if HTTP variable (original_post) exists in queried URL,          * AND that it is set to some value (ID), AND that the value (ID) is a number.          */         if( array_key_exists( 'original_post', $_GET ) && isset( $_GET['original_post'] ) && ctype_digit( $_GET['original_post'] ) ) {                  $query_original_post = new WP_Query( array(                 'posts_per_page' => 1,                 'p'              => $_GET['original_post'],                 'post_type'      => 'any',             ) );                  if( $query_original_post->have_posts() ) {                      while ( $query_original_post->have_posts() ) : $query_original_post->the_post();                          // [...]                      endwhile;                 wp_reset_postdata();                  } else {                      /*                  * Return 404 error if there are no posts                  */                 global $wp_query;                 $wp_query->set_404();                 status_header( 404 );                 nocache_headers();                 get_template_part( '404', 'archive' );                 //exit();                  }              } else {                  /*              * Return 404 error if the HTTP variable (original_post) doesn't              * exist in queried URL, OR it isn't set to any value (ID),              * OR the value (ID) isn't a number.              */             global $wp_query;             $wp_query->set_404();             status_header( 404 );             nocache_headers();             get_template_part( '404', 'archive' );             //exit();              }     ?>          <?php get_footer(); ?>      _(The code I use to return a 404 error is based onthese two solutions.)_ As you can see I am doing two checks in the code ( **at least that's what I intended to do** ):   1. Check if HTTP variable (original_post) exists in queried URL, AND that it is set to some value (ID), AND that the value (ID) is a number. OTHERWISE, return a 404 error with appropriate headers.   2. Check if the custom WordPress query (`$query_original_post`) has any results to loop over. OTHERWISE, return a 404 error with appropriate headers. **Problem:**   1. Is that the right way to do it? (or at least, can it be any simpler?)   2. _(If yes to #1)_ It appears to work, but returns 200 OK header when I go to an URL like: `example.com/comments/?original_post=NUMBER`, where NUMBER is any positive integer over 4 digits long (e.g. 14532). I don't understand the relation. Why'd something like ``example.com/comments/?original_post=14532` return 200 OK header when I am logged-into WordPress, and 404 error (which it should) when I am not?


Display MP3 as media using an URL from a custom field

I created custom field and placed this inside the loop:               <?php echo get_post_meta($post->ID, 'ses', true); ?>      But now the link is all text. I would like it to be like my theme does when I use this shortcode:               [media url="http://www.example.com/songname.mp3"]


random reason on refresh

I am editing the sidebar widgets and have added one for users who are not logged in or registered. the widget requests that users register or login and I am wanting to add a random reason (quote) as to why they should join which will change after every reload of the page. I have chosen to use the "text" in the site which does not seem to load any of the JavaScript codes that I enter. It obviously does not read them. does anyone know of how I can do this? If i'm using the wrong widget type then which one will read and display the JavaScript code? or is there a none JavaScript way of doing this? thank you. Site link: PLEASE CLICK HERE


Why is querying posts messing up my pages?

I am working on a theme at the moment and I have set up a post template. This post template is linked to some custom post types. When I query_posts for my post type on the actual post template itself it makes the content disappear for some reason? Is there something I am missing here? Thanks, Mark My loop is as follows:               <?php         $query = 'posts_per_page=10&post_type=articles';         $queryObject = new WP_Query($query);              // The Loop...         if ($queryObject->have_posts()) {             while ($queryObject->have_posts()) {                 $queryObject->the_post(); the_title(); the_content();             }         }     ?>


FYI: How to make Time.ly all-in-one event calendar mobile friendly

This is much more of an **FYI/How-to** than a question. I just wanted to share something cool with everyone. Enjoy! Time.ly puts out a great WordPress Events Calendar plugin with free and pro versions. However, seeing as how the default calendar view is "month" for a lot of people _and_ that "month" on mobile looks terrible, I wrote up a little blurb of my experience with the calendar and mobile devices on my website. I walk through the process of creating an "if ... then" statement of sorts to determine if a visitor is on a mobile device or not; depending on the device, the agenda view or the month view will be displayed! Hope this helps someone! In the answers section below is the walkthrough from my write up. * * * **//edit:** if someone would create the following tags on this post, that'd be great, thanks!               <timely> <all-in-one-events-cal>


Returning an image url from its attachment ID using a custom post type plugin

I'm using a custom post type plugin that returns an uploaded file's attachment ID instead of its url. I've been able to get the image to display using wp_get_attachment_image_src as outlined in the codex here http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src but my problem is getting it to play nicely with the code on the template page used to call the information from the custom post type set up using the [WCK Custom Fields Creator][1] plugin. Stripping it down to the basics, this is what calls the custom post type info from the template page:               <?php          $slideshowplatform = get_post_meta($post->ID, 'slideshowplatform', true);         foreach($slideshowplatform as $slide) {             echo '';         }     ?>      I'm having difficulty reconciling this with what the codex provides:               <?php          $attachment_id = 8; // attachment ID         $image_attributes = wp_get_attachment_image_src( $attachment_id ); // returns an array     ?>          <img src="<?php echo $image_attributes[0]; ?>">      It seems like something like the following should work, but I'm obviously missing something with the php syntax               <?php          $slideshowplatform = get_post_meta($post->ID, 'slideshowplatform', true);         foreach($slideshowplatform as $slide) {             $image_attributes = wp_get_attachment_image_src( $slide['slide'] );             echo '<img src="<?php echo $image_attributes[0]; ?>" />';         }      ?>      Any thoughts would be appreciated, thanks.


Way to show content of a post, but if exceeds character limit revert to excerpt?

So I am working on a site for a client of mine. We have about 50+ posts filed in a category called "Articles". I created a custom page template that has a custom query to display all the posts in a bullet list on this page, and if you click on it you can go directly to the post to read more or open a PDF directly. Where I am hitting a road block is we have 2 specific articles that are more then just PDF's, they are about 3-6 paragraphs instead. SO I wanted to know if it is possible to display all the posts in the list like I am now, and if it exceeds around 100 characters then revert to the excerpt we made for those posts specifically. Currently my code looks like this:                               <?php                 //for each child of category 16 (articles), show title of posts                 $cat_args=array('child_of' => 16, 'orderby' => 'name', 'order' => 'DESC');                 $categories=get_categories($cat_args);                   foreach($categories as $category) {                     $args=array('showposts' => -1, 'category__in' => array($category->term_id), 'caller_get_posts'=>1);                     $posts=get_posts($args);                       if ($posts) {                         echo '
term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'
 ';                         foreach($posts as $post) {                           setup_postdata($post); ?>

<?php echo get_the_content(); ?>

                           <?php                         } // foreach($posts                       } // if ($posts                     } // foreach($categories                 ?>      Thank you! Been pulling my hair out for days on this one.


post_password_required() not recognizing cookie set with correct password

Using the below code:               <?php if ( post_password_required() ) { ?>         <form method="post" action="/wp-pass.php">
This content is password protected. To view it please enter your password below:
             <input type="password" style="margin:10px 0;" size="20" id="pwbox-<?php the_ID(); ?>" name="post_password"/>
             <input type="submit" value="Submit" name="Submit"/>
         </form>     <?php } else { ?>         // echo out all of the post content     <?php } ?>      worked to hide specific content behind the Wordpress password protected functionality. However, this has stopped working. The cookie is still being set and I can see it in the browser settings, but the function has stopped recognizing that the correct cookie is present and just reloads the page asking for the password again. I don't use this functionality a lot, so it's hard to say wehen it stopped working exactly, but it could be related to upgrading Wordpress to the most recent release. Would that make sense? **UPDATE** : Here's the exact cookie content:               Name:   wp-postpass_xxxxxxxxxxxxxxxxxxxxx     Content:    secret     Domain: www.domain.com     Path:   /     Send for:   Any kind of connection     Accessible to script:   Yes     Created:    Monday, June 25, 2012 11:55:26 AM     Expires:    Thursday, July 5, 2012 11:55:25 AM      As you can see, the cookie contains the correct password content but the function has stopped recognizing this as being correct or valid. **UPDATE #2** Removed the testing URL now that the solution has been posted.


Show multiple tax_query from 2 or more post_type in a single code

i've been trying with no success to show 2 custom taxonomies from 2 post_type, here's my code:               <?php                     /**                      * Display a list of the most recent news in 'Avisos'                      *                      */                     $avisos_query = new WP_Query( array(                         'post_type' => array('noticia','comunicado'),                         'posts_per_page' => 5,                         'tax_query' => array(                             'relation' => 'AND',                             array(                                 'taxonomy' => 'clasificacion',                                 'field' => 'slug',                                 'terms' => 'avisos'                             ),                             array(                                 'taxonomy' => 'anos',                                 'field' => 'slug',                                 'terms' => '2011'                             )                         )                     ) );                     // Display the custom loop                     if ( $avisos_query->have_posts() ):                  ?>      I've been searching around here and WP but nothing. Thank you!


Checking url from plugin

I'm trying to change the login url from wp-login.php to simply 'login'. I'd been looking through another plugins source to find ways of doing it. Some of the applicable parts that I've got so far:               register_activation_hook( __FILE__, 'my_plugin_activate' );     register_deactivation_hook( __FILE__, 'my_plugin_deactivate' );          add_action( 'init', 'my_plugin_rewrite' );     add_action( 'login_init', 'my_plugin_login_init' );     add_action( 'template_redirect', 'my_plugin_display' );          function my_plugin_activate() {         add_rewrite_tag( '%login%', '([^/]+)');         add_permastruct( 'login', '/%login%' );         flush_rewrite_rules();     }          function my_plugin_login_init() {         if ( '/wp-login.php' == $_SERVER['PHP_SELF'] ) {             header( 'HTTP/1.0 404 Not Found' );             global $wp_query;             $wp_query->set_404();             require TEMPLATEPATH . '/404.php';             exit;         }     }          function my_plugin_display() {         global $wp_query;         switch( $wp_query->query_vars['pagename'] ) {             case 'login' :                 include( ABSPATH . '/wp-login.php' );                 exit;                 break;         }     }      The problem I'm having is in the "my_plugin_display" function. `$wp_query->query_vars['pagename']` happens to be empty. How can I test if the url is at `/login`? Is this the right hook to use?


Tough Custom query: archive page with custom meta_value_num

I trying to add parameters to the query string of an archive page. So I verified that the following method works: `query_posts($query_string . '&order=ASC&meta_key=mykey&orderby=meta_value_num')` My problem is thus: My meta-value as-is can't be sorted properly; it first has to be altered via the php substr() function. But that breaks the query. Any ideas how to get this done? I've seen solutions posted where the database is queried directly, but aside from that obviously not being ideal, I also couldn't figure out how to page that. Any help would be immensely appreciated :)


Avoiding "headers already sent" in Wordpress

I've created quite a few custom websites but I've come across this problem with various addons/plugins or just general code. How can I avoid the "headers already sent" error? I've tried to put the code as far up in the header.php file as possible but have never managed to get around the error. Is there an easier way to avoid it? My latest bit of code that's getting the error is using the html2pdf script. It always happens in the header.php file, I've removed all extra spaces etc and made sure it's unicode-8 etc but just cannot get rid of the problem in the header.php file.


Admin Bar below footer as unstyled list of links

My admin bar is showing at the bottom as an unstyled list of links, you can see it on http://advocaateindhoven.net I'm using WP version 3.2.1. Already tried deactivating every plugin to see if something changed but it didn't. Does anyone know what the problem is? Help appreciated!


Custom Post Type Template Insert not working properply

I am trying to insert Custom Template file through the plugin that handle a custom post type. Rest of the plugin working great except the template including part.               class ClassName{              public function __construct() {             add_action( 'template_redirect', array( $this, 'uniThemeRedirect') );         }                   public function uniThemeRedirect(){                  global $wp_query;             global $wp;                  // Specific Custom Post Type             if( $wp->query_vars["post_type"] == "videos" ){                 $templateFilename = "single-videos.php";                      if( file_exists( TEMPLATEPATH . '/' . $templateFilename ) ){                     $return_template = TEMPLATEPATH . '/' . $templateFilename;                 }                 else {                     $return_template = UNISLIDER_TEMPLATES . $templateFilename;                 }                      $this->doThemeRedirect( $return_template );             } else {                 echo 'not working';             }              }                   public function doThemeRedirect( $template_url ){             global $post, $wp_query;             if( have_posts() ){                 echo $template_url;                 require_once ( $template_url );             }             else{                 $wp_query->is_404 = true;             }              }          }          $handle = new ClassName();      I am following this http://stackoverflow.com/questions/4647604/wp-use-file-in- plugin-directory-as-custom-page-template#answer-4975004 example. But when i visit on the http://www.domain.com/videos where videos is my custom post type. i get the 'not working' means no template include.   **Can anyone please help me what wrong i have done??** **UPDATE: This is how i register the Custom Post Type**               $labels = array(                  'name'=>__('UniVideos', 'unislider'),                   'singular_name'=>__( 'Videos', 'unislider' ),                   'add_new'=>__( 'Add New', 'unislider' ),                   'add_new_item'=>__( 'Add New Video' ),                   'edit_item'=>__('Edit Video'),                   'new_item'=>__('New Video'),                   'view_item'=>__('View Videos Images'),                   'search_item'=>__('Search Slide'),                   'not_found'=>__('Noting Found'),                   'not_found_in_trash'=>__('Nothing found in Trash'),                   'parent_item_colon'=>''              );                   $args = array(                  'labels'=>$labels,                   'public'=>true,                   'has_archive'=>true,                   'publicly_queryable'=>true,                   'show_ui'=>true,                   'query_var'=>true,                   'menu_icon'=>'',                   'rewrite'=>true,                   'capability_type'=>'post',                   'hierarchical'=>false,                   'menu_position'=>NULL,                   'supports'=>array( 'title' )              );                   register_post_type( 'videos', $args );


Display PHP within HTML values

What is the correct way to display a value in a link using php? The (Advanced Custom Fields) php works correctly outside of the html.               Book on Expedia.com <a class="alignright" href="<?php the_field( 'expedia' ); ?>" target="_blank" ><input class="resume_contact_button" type="button" value="<?php the_field( 'low_rate' ); ?>">


How to change the gravatar image from front end?

How can user change the own gravatar image from front end? for the back-end there are lot of plugins (like user photo etc.), by which user can easily change the gravatar image?


Plot location on Google map using full address specified in custom field

Is there an easy way to plot a location on a Google map using an address specified in a custom field? For example, if a post has the following address specified; 1600 Pennsylvania Avenue, NW Washington, DC 20500 A Google map will automatically be displayed on the page with with a marker on this exact location? Surely it can't be that difficult. I've looked at the API but nothing sprung out at me


why the archive of custom taxonomy term shows nothing?

I have a custom post type for which I have created a custom taxonomy called 'tag'. `taxonomy-tag.php` file looks like this:               <?php get_header(); ?>          <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>
<?php echo $term->name; ?> Archives
                <?php if (have_posts()) : ?>             <?php while (have_posts()) : the_post(); ?>
                        <a href="<?php echo get_permalink(); ?>" title="<?php the_title(); ?>">                     <?php the_title(); ?>
                  <?php endwhile; ?>           <?php endif; ?>               <?php get_footer(); ?>      When this code is executed, it displays only things outside the loop. The loop find no result even if I have many posts of the specific custom post type bind to many terms of the custom taxonomy. Have you faced such issue? I am stuck and your help is highly invaluable.


Plugin settings checkbox

I am creating catagory checkbox select. My code to render the category checkbox is:               // CHECKBOX - Name: plugin_options[chkbox2]     function setting_chk2_fn() {              $options = get_option('plugin_options');         $categories = get_categories('orderby=name');           $wp_cats = array();                foreach( $categories as $category_list ) {               $wp_cats[$category_list->cat_ID] = $category_list->cat_name;           }                foreach( $wp_cats as $v ) {             echo "<input type='checkbox' name='plugin_options[chkbox2]' value='{$options['chkbox2']}' />";             echo $v;             echo '<br>';         }     }      All catagories are rendered properly but it is not saving in database. Thanks for reading


Wordpress custom taxonomy

I'm using a custom taxonomy called 'product_cat' and post type called 'product', I'm trying to display all parent terms, child terms and grandchild terms within the taxonomy. So I get a list like this, But I only want the grandchild terms to be displayed if I'm on the child page.               Courses (parent)     - Industry (child)     -- Industry One (grandchild)     -- Industry Two (grandchild)     -- Industry Three( grandchild)     - Trade (child)     -- Trade One (grandchild)     -- Trade Two (grandchild)     -- Trade Three (grandchild)          Essential Packages (parent)     - Construction (child)     -- Construction One (grandchild)     -- Construction Two (grandchild)     -- Construction Three (grandchild)      I'm currently using this snippet to try and help me but its not working the way I'm wanting it to.               <?php         $taxonomyName = "product_cat";            $parent_terms = get_terms($taxonomyName, array('include' =>'67', 'orderby' => 'slug', 'hide_empty' => false));            echo '
';             foreach ($parent_terms as $pterm) {                 echo '
';                     echo ''.$pterm->name.''; // Child                      $terms = get_terms($taxonomyName, array( 'child_of' =>'67', 'orderby' => 'slug', 'hide_empty' => false));                     echo '
';                         foreach ($terms as $term) {                             echo '
name, $taxonomyName ) . '">'.$term->name.''.$term->count.'
';  // GrandChild                         }                     echo '
';                  echo '
';              }         echo '
';     ?>      If anyone could help me out and point me into the right direction I'd really appreciate all the help.


Display an icon based on post type

I have a defined set of seven different post types and would like to display an icon for each one in the search results list. I've got the following code to display the post type but have no idea how to extend it into an if               <?php $post_type = get_post_type_object( get_post_type($post) );     echo $post_type->label ; ?>      Any help appreciated.


is_home() returns true while it shouldn't

I have a problem with `is_home()`. It is placed in my `footer.php` and it returns `true` when it shouldn't. I have a page template on which I perform a query with `query_posts()`. When I pass the following as the argument,               array( 'cat' => $lekarz_page_cat_id, 'paged' => get_query_var('paged') )      it returns `false` which is ok, but when the argument is               array('post__in' => $pz_posts, 'paged' => get_query_var('paged'))      it returns `true` when it shouldn't. Can someone tell me why this is so?


How can I alter the visible menu according to which level I am on

I want to be able to alter what is visible in the menu according to which level in the site structure I am on, for example on top level page:- Home Level 1 page (Current) -Level 2 page               -Level 2 page          -Level 2 page      Level 1 page Level 1 page Level 1 page etc on level 2 page: Home Level 1 page (Current page parent)               -Level 2page (Current)               -- Level 3 page (child of current)               -- Level 3 page (child of current)               -- Level 3 page (child of current)          -Level 2page          -Level 2page          -Level 2page      on level 3 page Level 1 page               -Level 2page (parent)              --Level 3 page (current)      Is this possible and how do I do it? Many thanks


theme or plugin or server is outputting html before the init hook fires, how is it possible to prevent this

I have a plugin that detects the useragent of a request made during the init hook and if it matches my desired value, I set a flag so that my own xml content is sent during the found_posts filter instead of the html that the theme sends. the problem is that on a few rare sites, the theme is sending some of it's content before my plugin can send it's own which causes the the external site that is calling to have an xml error because there is non xml code before the bit my plugin sends. I've tried installing the theme to my local server but the problem doesn't happen there, everything is ticketyboo! so I can only imagine that it is something to do with the server that the site is hosted on. It only seems to happen when someone has set their theme to use a custom homepage. What could be causing this? I can show what happens if I use the useragent switcher plugin for firefox and set it to use a new useragent of "Commentluv" and visit http://willtaft.com which shows the xml error . viewing the source of the page shows that my plugin didn't send it's content until most of the theme content had already been output if I view http://willtaft.com/blog/ using the firefox set to send the 'Commentluv' useragent then everything is working as it should and I can see the xml my plugin sends. This is driving me crazy! I can't replicate the problem on any of my sites, it only happens on a very few sites and then, only with sites using a custom home page. I've even tried using an output buffer at the init stage if it detects that the Commentluv useragent is requesting the page and clearing it before my plugin sends the xml but even that wont work on the problem sites. I'd love to hear any suggestions


Query to import data from one MultiSite table to another (pages/sub-pages)

I'm updating a standard install with about 500 (eek!!) pages to a MultiSite for easier sub-site management. I basically want to take a sub-page and its children from the root site and copy the data to a new/fresh MultiSite-site. The WordPress import/export option doesn't work for this so I've had to do it using a MySQL query but I'm completely stumped? The source table is 'wp_posts' destination is 'wp_2_posts', any ideas?


How-to show last 5 posts

How-to show last 5 posts that are published after current post? Explained on image below: IMAGE FOR EXPLAINE


Retrieve post info within AJAX helper function

I have a button within a post which a user can click. Once clicked, an AJAX call is made. My question is, within my PHP AJAX helper function (located in my theme's function.php) how can I retrieve, for instance, the ID of the post that the request was sent from. I can get the ID from the markup and pass it in the AJAX call but it seems messy, i.e.               <article id="post-12">     <!-- article content -->     </article>               // JS     var postID = $("article").attr("id");      Is there a better way? Some kind of global that is accessible perhaps?


Problem Keeping Permalink Structure

I have just set up my WP blog on heroku and have one minor problem. I have set the permalink structure in Settings to be postname (/%postname%/). Whenever I come back to the blog after a while I get an error for root.com/blog and all other simple pages I have set up. Going back and hit on save in the permalink settings, gets the links back to work again. So something is not saving these settings right. Instead of postname, it uses the default settings which is probably something like ?p=123 What can I do? Is there a way I could force these settings through a function or similar? Thanks for all the suggestions. Appreciate it.


What are the Best Practises When Using AJAX in Plugin Development?

I am in the middle of creating a plugin and everything works fine with the AJAX calls but one question I can't seem to find the answer to is about best practise. I route the AJAX calls through `/wp-admin/admin-ajax.php` and have my php functions in the theme `functions.php` script. However, I've just thought that this doesn't seem such a good idea because what do you do when the user activates your plugin, do you need to create a function to write your code to functions.php on activation? Similarly, what if the user changes theme? Therefore, I was just wondering if there are other ways to do it or what is the common approach for this type of thing.


How can I add "posted by 'author'" to each post?

With a multi-user blog, how can I add a _posted by Some Author_ line, or something similar, at the top of each post, as in this blog? I assumed this should be something very basic, and there should be a setting for it, but I can't seem to find it anywhere.


What is the best way to make a custom page from a plugin?

After hours seeking through the WordPress sources it I was unable to find ANY reasonable method of creating a front end page from a plugin. My goal was simple, I wanted http://mysite.com/friends to show a page generated by my plugin. This is a multi-site installation and I do not want blog owners to be able to eliminate this page. My final implementation doesn't involve users blogs but it could. wp-includes/theme.php: I added this function               function get_extension_page_template() {         $page = get_queried_object();         $templates = array($page->ID.'.php');         return get_query_template($page->ID,$templates);     }      wp-includes/template-loader.php: I added this just ofter the if(is_404() line(near line 8)               elseif ( is_extension_page() && $template = get_extension_page_template()) :      wp-includes/query.php: I added two functions               function set_extension_page($page,$object) {         global $wp_query;         return $wp_query->set_extension_page($page,$object);     }          function is_extension_page() {       global $wp_query;         return $wp_query->is_extension_page();     }      wp-includes/query.php: I added two properties to the WP_Query class               var $extension_page = null;     var $extension_page_object = null;      wp-includes/query.php: I added two methods to the WP_Query class                 function set_extension_page($page,$object) {           $this->extension_page_object = $object;           $this->extension_page = $page;       }       function is_extension_page() {          return isset($this->extension_page);       }      wp-includes/query.php: I changed the get_queried_object method in the WP_Query class               function get_queried_object() {             if ( isset($this->queried_object) )                 return $this->queried_object;              if (isset($this->extension_page_object)) {             return $this->extension_page_object;         }             $this->queried_object = NULL;             $this->queried_object_id = 0;                  if ( $this->is_category || $this->is_tag || $this->is_tax ) {                 $tax_query_in_and = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'NOT IN' ), 'NOT' );                      $query = reset( $tax_query_in_and );                      if ( 'term_id' == $query['field'] )                     $term = get_term( reset( $query['terms'] ), $query['taxonomy'] );                 else                     $term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] );                      if ( $term && ! is_wp_error($term) )  {                     $this->queried_object = $term;                     $this->queried_object_id = (int) $term->term_id;                          if ( $this->is_category )                         _make_cat_compat( $this->queried_object );                 }             } elseif ( $this->is_post_type_archive ) {                 $this->queried_object = get_post_type_object( $this->get('post_type') );             } elseif ( $this->is_posts_page ) {                 $page_for_posts = get_option('page_for_posts');                 $this->queried_object = & get_page( $page_for_posts );                 $this->queried_object_id = (int) $this->queried_object->ID;             } elseif ( $this->is_singular && !is_null($this->post) ) {                 $this->queried_object = $this->post;                 $this->queried_object_id = (int) $this->post->ID;             } elseif ( $this->is_author ) {                 $this->queried_object_id = (int) $this->get('author');                 $this->queried_object = get_userdata( $this->queried_object_id );             }                  return $this->queried_object;         }      wp-includes/class-wp.php: I changed the handle_404 method to the following               function handle_404() {             global $wp_query;                  if ( !is_admin() && ( 0 == count( $wp_query->posts ) ) && !is_404() && !is_robots() && !is_search() && !is_home() ) {                 // Don't 404 for these queries if they matched an object.                 if ( ( is_extension_page() || is_tag() || is_category() || is_tax() || is_author() || is_post_type_archive() ) && $wp_query->get_queried_object() && !is_paged() ) {                     if ( !is_404() )                         status_header( 200 );                     return;                 }                      $wp_query->set_404();                 status_header( 404 );                 nocache_headers();             } elseif ( !is_404() ) {                 status_header( 200 );             }         }      The final result is that I can create an object in plugins on patched sites and test for certain conditions, such as $blogpage = $this->ID and then call set_extension_page($this->ID,$this); to register the page to be displayed. The theme must also have a template setup for that plugin which is named (first parameter of set_extension_page).php but its better than nothing. I admit this is just an ugly hack, but it works. It would be nice to see a feature like this added to wordpress in the future.


How to upload multiple files/images when developing a wordpress plugin?

I decided to learn how to develop wordpress plugins and I am totally confused and frustrated. I've already read some good tutorials and I guess I am already familiar with the basics. Now, I want to start developing my first plugin and I decided to start with a javascript image slider. At this stage I know how to set up an admin page with all the settings I need (e.g. slider name, slider themes, which transitions to use, which pagination type etc..). I also know how to create a custom type for my slider, how to register scripts and styles, how to generate shortcodes and template tags etc.. What I am confused is how to go on with adding the images itself. I have seen some of the existing plugins but none seems to follow a common solution for this. In some one has to upload each image individually (the image being the post type itself), others use the wp file uploader but only one image can get uploaded at a time etc.. The one I like the most is Nivo Slider, which adds the meta_box_upload with the plupload multiple file uploader script. My question is, which options do I have here? Also, I can't seem to find any good tuts on this either (maybe cause of my lack of experience?). Any hints would be much appreciated. Thanks!


Circumventing the normal image upload process

I have a page that I would like to work on little techniques and then show them off. I built a scrolling banner that uses images and then scrolls them in order. I have successfully built this with static HTML but I have never done so in Wordpress. I have uploaded the images to my MAMP server and I call them in their respective s. It all works except the images don't load. Also, while troubleshooting I loaded an image by itself on the same page and it did not display either. How can I load images in for an individual page? Techicnally, they aren't to be used outside of that page. Hmm. -Josh                   <?php         /*              Template Name: scrolling headers                   */              get_header(); ?>

                        <?php get_footer(); ?>