title: Editing Theme to apply Co-Authors Plus

text:
I'm trying to implement the Co-Authors Plus Plugin. It says that you will need to change some PHP in the theme. The documentation outlines the changes. I believe I have found where I would need to change it in my theme. In the `post-author-info.php` file:               <?php     /**      * Post Author Info      *      * @package WP Journal      * @subpackage Include      */      ?>
         <a href="<?php the_author_meta('url'); ?>"><?php echo get_avatar( get_the_author_meta('email'), '80' ); ?>
<?php _e('By', 'contempo'); ?>: <a href="<?php the_author_meta('url'); ?>"><?php the_author(); ?>

<?php the_author_meta('description'); ?>

      Just adding this line:               <?php if ( function_exists( 'coauthors' ) ) { coauthors(); } else { the_author(); } ?>      …seems to give me something that I want. Both "Admin" And "Andrew Gable" are displayed. ![](http://i.imgur.com/Po5jPLs.png) But, I'm unsure on how to get it to link correctly, and how to handle photos and multiple Bio's.


title: Reduce Database Queries in Code

text:
Can i reduce the queries by compresing this ?, cand i reduce queries, if i can , how can i do? Note : The images are in diferent size http://oi55.tinypic.com/rwp3ex.jpg

Stiri din lumea cinematografiei

     <?php     $recentPosts = new WP_Query();     $recentPosts->query(array(          'post_type' => 'stiri',         'showposts' => 1,         'offset'=>0,         'taxonomy' => 'stire',         'stire' => 'articole-speciale'         )     );     ?>     <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>     <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php $excerpt = the_title();echo string_limit_words($excerpt,5);?>
<a href="<?php the_permalink() ?>"><img src="/scripts/timthumb.php?src=<?php the_field('imagine_stire'); ?>&h=240&w=418&zc=1" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />

     <?php $excerpt = get_the_excerpt();echo string_limit_words($excerpt,80);?><a class="detalii" href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Stire %s'), the_title_attribute('echo=0')); ?>">...detalii     <?php endwhile; ?>
          <?php     $recentPosts = new WP_Query();     $recentPosts->query(array(          'post_type' => 'stiri',         'showposts' => 6,         'offset'=>1,         'taxonomy' => 'stire',         'stire' => 'articole-speciale'         )     );     ?>     <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>

<img src="/scripts/timthumb.php?src=<?php the_field('imagine_stire'); ?>&h=40&w=40&zc=1" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />

<a href="<?php the_permalink() ?>"><?php $mytitle = get_the_title(); if ( strlen($mytitle) >60 ) $mytitle = substr($mytitle,0,60); echo $mytitle; ?>

     <?php endwhile; ?>

     <?php     $recentPosts = new WP_Query();     $recentPosts->query(array(          'post_type' => 'stiri',         'showposts' => 5,         'offset'=>1,         'taxonomy' => 'stire',         'stire' => 'articole-speciale'         )     );     ?>     <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>

<a href="<?php the_permalink() ?>"><img src="/scripts/timthumb.php?src=<?php the_field('imagine_stire'); ?>&h=77&w=218&zc=1" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />

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

     <?php endwhile; ?>

     <?php     $recentPosts = new WP_Query();     $recentPosts->query(array(          'post_type' => 'stiri',         'showposts' => 4,         'offset'=>1,         'taxonomy' => 'stire',         'stire' => 'articole-speciale'         )     );     ?>     <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>

<a href="<?php the_permalink() ?>"><img src="/scripts/timthumb.php?src=<?php the_field('imagine_stire'); ?>&h=77&w=143&zc=1" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />

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

     <?php endwhile; ?>


title: Installing Wordpress in another Install?

text: I'm trying to install one wordpress site in a different directory on the same server as another, and access it as a sub-directory of the site. Maybe this describes better- File structure:               public_html/       index.php       wp/ # main install       2012/ # secondary install      The desired url structure: mydomain.com/ (this points to the main install in the **wp** folder) mydomain.com/2012/ (this points to the secondary install in the **2012** folder) I can tell that the database is connected correctly on both installs. And the primary install is working fine, but I think the permalink settings of the primary install are interfering with the requests for the secondary install. Does anyone have any suggestions? The .htaccess file in the root folder:               # 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


title: Uncaught ReferenceError: jQuery is not defined . How do I define it correctly?

text: The following code is in the same php script. But I get `Uncaught ReferenceError: jQuery is not defined` in chrome debugger. validate.js is in plugins/validate/validate.js I know this is the problem , as I tried validate.js when not using wordpress, by including it externally, & it worked fine. I am using the code below, on a page. What is the solutions please?               add_action( 'init', 'load_jquery' );     function load_jquery() {         wp_enqueue_style( 'jquery');     }               function add_my_css_and_my_js_files() {         wp_register_script( 'validate', plugins_url( '/validate.js', __FILE__ ) );     }     add_action( 'wp_enqueue_scripts', "add_my_css_and_my_js_files" );


title: API for creating blogs on Multisite?

text: Is there some API or plugin that allows for creation of sites on a multisite install? Jetpack doesn't seem to allow it, and the xml rpc doesn't seem to support multisite. Is there something I can use as a JSON API or some other sort of http call to do this?


title: What could cause a WP Option to get truncated?

text: I have a WP plugin, where all admin setting field values were suddenly changed to the letter 'a'. All settings are stored in one 'big' option in the table. Seemed like the serialization gone wrong. I run a `var_dump` on the `get_option` value and it returned a truncated string, not an array as usual. I'll update the question once I can reproduce the truncated string again. I only use the 'Save changes' button and let the WP Options API write to the option, getting the values from user changeable or hidden HTML fields. Is there any special characters or similar that can prevent an option from being written properly which could result in the serialized array being truncated? The cause has something to to with Instagram or an Instagram user name.


title: Display pages from specific page template

text:
Okay I have found the following code on line, which seems to be working and displaying all of the pages using the page_library_html.php template. This code only shows the title of them though. Can someone help me get the post content to show in as well as the title in . Thanks in advance **Current code**               <?php             $product_pages_args = array(         'meta_key' => '_wp_page_template',         'meta_value' => 'page_library_html.php'     );          $product_pages = get_pages( $product_pages_args );     ?>               <?php     foreach ( $product_pages as $product_page ) {         echo '

ID ) . '">' . $product_page->post_title  . '

';          }     ?>


title: how to setup user access media library?

text: I think this could be a simple answer but I can't really find. except administrator, users are not able to see "media library". Is there anyway to setup to show (display on dashboard) media library for non- admin users? I may need give access by user-type or something else. then they see what they uploaded.                function my_files_only( $wp_query ) {     if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/upload.php' ) !== false ) {         //if ( !current_user_can( 'level_5' ) ) {             global $current_user;             $wp_query->set( 'author', $current_user->id );         //}     }      }        add_filter('parse_query', 'my_files_only' );


title: Correct way to perform non-cacheable DB query

text: Consider the code               function getNow() {         global $wpdb;              $now = $wpdb->get_var("SELECT NOW()");              $wpdb->flush();              return $now;     }      I am using the above method to avoid caching effect of the `get_var` method, **when I run the function, I always get the same result, e.g.**               echo getNow();     sleep(10);     echo getNow(); // Same result as above      Questions:   1. Are there any better way to write the above function to avoid the caching effect?   2. Why `$wpdb` ONLY cache the last result but not all the queries' result in the same request? Sound like a little bit overkill for just the last query, right?


title: Incorrect data after modifying post using backlink from wp_die

text: I have hook:               function myHook( $post_ID, $post )     {         $data = get_post_meta($post_ID, 'data', true);         if ($data)         {             _log('data:' . $data);             /* here some checks and validation */             if (!valid)                 wp_die('Error', 'Error',  array( 'response' => 500, 'back_link' => true ));         }         else              wp_die('Error', 'Error',  array( 'response' => 500, 'back_link' => true ));     }          add_action( 'save_post', 'myHook', 0, 2 );      Problem is that when data is incorrect and user uses back_link to correct data and tries to publish post again, his changes are not applied. Old data is taken into analysis. How can I fix this? Thanks in advance


title: Can I call Options Framework in footer.php?

text: I have integrated the Options Framework into my theme. Can I call `of_get_option(...)` in footer.php?


title: Upload Image from Front End and Resize

text: I'm working on adding the possibility to add some custom_post_type from the front end. I can link Images to them, but apparently they are not resized. And I really need the special sizes that I have define on my functions.php. Here is what I do :               if(!empty($_FILES['IMAGE'])){             include_once ABSPATH . 'wp-admin/includes/media.php';             include_once ABSPATH . 'wp-admin/includes/file.php';             include_once ABSPATH . 'wp-admin/includes/image.php';             $file = $_FILES['IMAGE'];                  $upload = wp_handle_upload( $file, array('test_form' => false));               if(!isset($upload['error']) && isset($upload['file'])){                 $title = $file['name'];                      $filetype = wp_check_filetype( basename($upload['file'], null ));                      $ext = strrchr($title,'.');                 $title =($ext !== false) ? substr($title, 0, -strlen($ext)) : $title;                        //$url_img = wp_get_attachment_url( $attach_key );                   $attach_key = '_thumbnail_id';                   $attach_id = wp_insert_attachment($attachment,$upload['file']);                   $existing_download = (int) get_post_meta($new_eta_ID, $attach_key, true);                   if(is_numeric($existing_download)){                     wp_delete_attachment( $existing_download );                   }                   update_post_meta($new_eta_ID, $attach_key, $attach_id,true);               }           }      So it uploads the selected files, but it's not resizing. How can I do that ? Thanks !


title: Frontend upload of multiple files

text: I hope this question is considered on topic since both the tag "plugins" and the meta blog-post "is-it-okay-to-ask-a-question-about-how-to-use-a-specific- plug-in-here" seem to disqualify it but anyway here goes. (If it is of-topic I would very much appreciate a pointer as to where I could ask my questions and not just a vote for deletion :) ) =============================================== I recently got a WP-site in my lap because I knew the most about "computers" ;) The site works fine but one thing we would like to add to the site is a possibility for users to upload pictures which then can be added to galleries by moderators/admins. I found a plugin for this https://wordpress.org/plugins/frontend-uploader/ But the problem is I can only make it upload one picture at a time. What we really would like is to present a page where you could either upload many files at once or better yet just drag and drop in files. There doesn't seem to be a plugin for this usecase and all my googling has only led me to sites like http://kvcodes.com/2013/12/create-front-end-multiple-file-upload-wordpress/ which describe how you could build this functionality yourself. So I have two questions   1. Is there really no plugin for this? In my mind this is a really common usecase and I can't see why there shouldn't be a plugin for it.   2. If I have to build it myself then how do I go about doing it? I know my way around programing and a terminal but I don't know squat about wordpress (yet :)). Eg. if you look at the "tutorial" in the above link it has some html and some php but where do I put this inside my wp-installation? Do I create a plugin with the php-files and then publish a page containing the html using the admin backend? or...? Most examples I find about building your own stuff for wordpress gives you some html and some php-example code but nowhere do they explain where to put it. I could probably find this out by trial and error but I was hoping to speed this up a bit by asking :) (I had more links prooving that I actually did my googling before asking here but my rep-count was to low for anything more than two links...)


title: Pagination and Related Posts

text: Is it possible to use pagination with the following related posts code, which is embed in single.php of my theme.                   <?php          // for use in the loop, list 5 post titles related to first tag on current post               $tags = wp_get_post_tags($post->ID);               if ($tags) {                   $first_tag = $tags[0]->term_id;                   $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                   $args = array(                      'tag__in' => array($first_tag),                      'post__not_in' => array($post->ID),                      'posts_per_page'=> 5,                      'caller_get_posts'=> 1,                      'paged'=> $paged                   );                   }                   $the_query = new WP_Query( $args );                       if( $the_query->have_posts() );                       while ($the_query->have_posts()) : $the_query->the_post(); ?>                                  <?php get_template_part( 'content' ); ?>                      <?php endwhile; ?>


title: Replace get_the_category() with Hikari permalink

text: I want to edit my theme I have bought. I'm using the Hikari permalink plugin to set which category I want to have as the default (instead of lowest ID number). Now my theme just uses `get_the_category()`, and `get_the_category_list()` to display the category (or list of categories). I want both of these to just show the single category that I chose via the Hikari link. This website shows how to extract the category and print it. That's all well and good but I'd have to run through the whole theme with loads of edits. How would I go about editing these functions with the code from the above website? I presume if I edit the core files, they'll get overwritten (I haven't even bothered looking). Is there a way to override these functions that will be futureproof - maybe a hook or something? EDIT... I've tried this but get an error. Any ideas....? ` function get_hikari_main_category() { // extract the category from hikari permalink plugin $category_id = get_post_meta(get_the_ID(), '_category_permalink', true); if ( $category_id ) { return get_term($category_id, 'category'); }               // no main category defined, get the default one     $terms = wp_get_object_terms(get_the_ID(), 'category');     if ( $terms ) {       return $terms[0];     }      } add_filter('get_category', 'get_hikari_main_category'); `


title: add_image_size is not generatin images of correct dimensions

text: I am trying my hands with WP `add_image_size` method and this is the entry in my theme's `function.php`               if ( function_exists( 'add_theme_support' ) ) {      add_theme_support( 'post-thumbnails' );      set_post_thumbnail_size( 100, 65); // default Post Thumbnail dimensions        }          if ( function_exists( 'add_image_size' ) ) {       add_image_size( 'home_page_featured', 200, 225, true);     }      I tried with both parameters of crop factor but seems nothing is working for me. I am uploading `Dimensions 628x355` and want that beside all OOB image size, `home_page_featured` should be get created with dimensions 200x225, but WP is generating it as `200x113` i tried with `Regenerate Thumbnails` plugin but seems like it is not working, not sure where i am doing wrong.


title: How to individually set WP_DEBUG on a sub-directory multisite?

text: According to this question, it's possible to turn on/off `WP_DEBUG` for specific sites on a multisite. Is it possible to do this with a **sub-directory multisite**?


title: Programmatically Set First Image as Featured

text: I have over 400 posts with images inside them, I have got a new template which requires a featured image for each post, something my last template did not require... I am wondering if there is a script I can add to my functions.php to be able to grab the first image in each post and set it as the featured... So far i have found this, but it is not working...               function auto_set_featured() {     global $post;     $has_thumb = has_post_thumbnail($post->ID);     if (!$has_thumb)  {     $attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" );         if ($attached_image) {             foreach ($attached_image as $attachment_id => $attachment) {                 set_post_thumbnail($post->ID, $attachment_id);             }         }     }     }     add_action('the_post', 'auto_set_featured');     add_action('save_post', 'auto_set_featured');     add_action('draft_to_publish', 'auto_set_featured');     add_action('new_to_publish', 'auto_set_featured');     add_action('pending_to_publish', 'auto_set_featured');     add_action('future_to_publish', 'auto_set_featured');      This script will work for new posts, but i need it to affect all my older posts, any suggestions?


title: Ignore image urls in wp_query search

text: I'm doing a keyword search using wp_query as so:               $wp_query = new WP_Query( 's=' . $_GET['s'] );      It is returning a post that has `$_GET['s']` in one of its image URLs, and I don't want this to happen. I'd like to exclude any attachment URL from the search. Is this possible using the wp_query arguments? Maybe a way to only search the title/body of a post?


title: Custom fields are not displaying in page with multiple loops

text:
I have multiple loops on my home page. I am trying to display custom fields in each loop. But some of them are not showing. Any idea, why? Here is the code:               //check for Featured Events here        $featured = new WP_Query (array(        'category_name' => 'Featured Events',        'posts_per_page' => 2)         );          if ($featured -> have_posts()) {          while ($featured->  have_posts()) : $featured -> the_post(); ?>
 <?php the_title(); ?>

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

         <?php echo get_post_meta($post->ID, 'Start Time', true); ?>           <?php if ( get_post_meta($post->ID, 'End Time', true) != "") { ; ?>           -           <?php echo get_post_meta($post->ID, 'End Time', true); }?>
                <?php if ( get_post_meta($post->ID, 'Sponsor', true) != "") { ; ?>
          <?php echo get_post_meta($post->ID, 'Sponsor', true); ?>
     <?php }; ?>      <?php if ( get_post_meta($post->ID, 'Cost', true) != "") { ; ?>
           <?php echo 'Cost: '. get_post_meta($post->ID, 'Cost', true); ?>
 <?php };          if ( get_post_meta($post->ID, 'Location', true) != "") { ; ?>
          <?php echo 'Location: '. get_post_meta($post->ID, 'Location', true); ?>
           <?php };          global $more;     $more = 0;        the_content('Read more please');        if ( get_post_meta($post->ID, 'link', true) != "") { ; ?>
 <a href="      <?php echo get_post_meta($post->ID, 'link', true); ?> "           > Click here for more information
           <?php } endwhile;           }           wp_reset_query(); ?>

          <?php         $ann_query = new WP_Query (array(        'category_name' => 'announcement',        'orderby'=> 'modified',        'posts_per_page' => 5) );              if ($ann_query -> have_posts()) {          while ($ann_query->  have_posts()) : $ann_query -> the_post();              if( $post->ID == $do_not_duplicate ) continue; //This is the Magic Line     // echo 'NON urgent announcement should follow '; ?>
 <?php the_title(); ?>
              <?php      //The code must be inserted ahead of the call the_content, but AFTER the_post()     global $more;     $more = 0; ?>
          <?php echo get_post_meta($post->ID, 'Date', true); ?>

               <?php echo get_post_meta($post->ID, 'Start Time', true); ?>          <?php if ( get_post_meta($post->ID, 'End Time', true) != "") { ; ?>           -           <?php echo get_post_meta($post->ID, 'End Time', true); }?>
               <?php if ( get_post_meta($post->ID, 'Location', true) != "") { ; ?>
          <?php echo 'Location: '. get_post_meta($post->ID, 'Location', true); ?>
           <?php };          the_content('Read more please');         if ( get_post_meta($post->ID, 'link', true) != "") { ; ?>
 <a href="          <?php echo get_post_meta($post->ID, 'link', true); ?>           " > Click here for more information
              <?php }                  endwhile;   }                 wp_reset_query(); ?>


title: displaying links if term is used

text:
I want to display a list of terms for navigation and am using:
                 <?php                  $terma = term_exists('group_a_teams', 'group' );                 if ($terma !== 0 && $terma !== null) { ?>
                          <a href="<?php echo get_term_link( 'group_a_teams', 'group' ); ?>">Group A Teams
                 <?php } ?>                                      <?php                  $termb = term_exists('group_b_teams', 'group' );                      if ($termb !== 0 && $termb !== null) { ?>
                     <a href="<?php echo get_term_link( 'group_b_teams', 'group' ); ?>">Group B Teams
                     <?php } ?>
                   It works fine until I add in the if clauses so that if no taxonomy is applied it doesn't throw an error. The problem is that the terms do indeed exist but are not necessarily applied. Which function should I be using then?


title: Image as a link using wp_nav_menu()

text: In creating a custom navigation menu in TwentyTen ( WP3.01), is it possible to make an image a link to a page on the same site, using wp_nav_menu() ? Is it the case that wp_nav_menu() echos or returns only text and cannot be made to return or echo an image? If this is the case, is there a workaround?


title: Duplicate Custom Header Functionality into the post edit screen

text:
Within wordpress 3.0 you have the ability to create a custom header image with a very slick built in cropping tool. I found out that the code being utilized for this is located within wp- admin/custom-header.php. What I am looking to do is including this same functionality within my own custom post type so that I can create many header images and rotate through them while also adding additional fields to each post. Does anyone know how to do this? Here is the code from the custom-header.php file.               <?php     /**      * The custom header image script.      *      * @package WordPress      * @subpackage Administration      */          /**      * The custom header image class.      *      * @since 2.1.0      * @package WordPress      * @subpackage Administration      */     class Custom_Image_Header {              /**          * Callback for administration header.          *          * @var callback          * @since 2.1.0          * @access private          */         var $admin_header_callback;              /**          * Callback for header div.          *          * @var callback          * @since 3.0.0          * @access private          */         var $admin_image_div_callback;              /**          * Holds default headers.          *          * @var array          * @since 3.0.0          * @access private          */         var $default_headers = array();              /**          * Holds the page menu hook.          *          * @var string          * @since 3.0.0          * @access private          */         var $page = '';              /**          * PHP4 Constructor - Register administration header callback.          *          * @since 2.1.0          * @param callback $admin_header_callback          * @param callback $admin_image_div_callback Optional custom image div output callback.          * @return Custom_Image_Header          */         function Custom_Image_Header($admin_header_callback, $admin_image_div_callback = '') {             $this->admin_header_callback = $admin_header_callback;             $this->admin_image_div_callback = $admin_image_div_callback;         }              /**          * Set up the hooks for the Custom Header admin page.          *          * @since 2.1.0          */         function init() {             if ( ! current_user_can('edit_theme_options') )                 return;                  $this->page = $page = add_theme_page(__('Header'), __('Header'), 'edit_theme_options', 'custom-header', array(&$this, 'admin_page'));                  add_action("admin_print_scripts-$page", array(&$this, 'js_includes'));             add_action("admin_print_styles-$page", array(&$this, 'css_includes'));             add_action("admin_head-$page", array(&$this, 'help') );             add_action("admin_head-$page", array(&$this, 'take_action'), 50);             add_action("admin_head-$page", array(&$this, 'js'), 50);             add_action("admin_head-$page", $this->admin_header_callback, 51);         }              /**          * Adds contextual help.          *          * @since 3.0.0          */         function help() {             add_contextual_help( $this->page, '
' . __( 'You can set a custom image header for your site. Simply upload the image and crop it, and the new header will go live immediately.' ) . '
' .             '
' . __( 'If you want to discard your custom header and go back to the default included in your theme, click on the buttons to remove the custom image and restore the original header image.' ) . '
' .             '
' . __( 'Some themes come with additional header images bundled. If you see multiple images displayed, select the one you’d like and click the Save Changes button.' ) . '
' .             '
' . __( 'For more information:' ) . '
' .             '
' . __( 'Documentation on Custom Header' ) . '
' .             '
' . __( 'Support Forums' ) . '
' );         }              /**          * Get the current step.          *          * @since 2.6.0          *          * @return int Current step          */         function step() {             if ( ! isset( $_GET['step'] ) )                 return 1;                  $step = (int) $_GET['step'];             if ( $step < 1 || 3 < $step )                 $step = 1;                  return $step;         }              /**          * Set up the enqueue for the JavaScript files.          *          * @since 2.1.0          */         function js_includes() {             $step = $this->step();                  if ( ( 1 == $step || 3 == $step ) && $this->header_text() )                 wp_enqueue_script('farbtastic');             elseif ( 2 == $step )                 wp_enqueue_script('imgareaselect');         }              /**          * Set up the enqueue for the CSS files          *          * @since 2.7          */         function css_includes() {             $step = $this->step();                  if ( ( 1 == $step || 3 == $step ) && $this->header_text() )                 wp_enqueue_style('farbtastic');             elseif ( 2 == $step )                 wp_enqueue_style('imgareaselect');         }              /**          * Check if header text is allowed          *          * @since 3.0.0          */         function header_text() {             if ( defined( 'NO_HEADER_TEXT' ) && NO_HEADER_TEXT )                 return false;                  return true;         }              /**          * Execute custom header modification.          *          * @since 2.6.0          */         function take_action() {             if ( ! current_user_can('edit_theme_options') )                 return;                  if ( empty( $_POST ) )                 return;                  $this->updated = true;                  if ( isset( $_POST['resetheader'] ) ) {                 check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );                 remove_theme_mod( 'header_image' );                 return;             }                  if ( isset( $_POST['resettext'] ) ) {                 check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );                 remove_theme_mod('header_textcolor');                 return;             }                  if ( isset( $_POST['removeheader'] ) ) {                 check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );                 set_theme_mod( 'header_image', '' );                 return;             }                  if ( isset( $_POST['text-color'] ) ) {                 check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );                 $_POST['text-color'] = str_replace( '#', '', $_POST['text-color'] );                 if ( 'blank' == $_POST['text-color'] ) {                     set_theme_mod( 'header_textcolor', 'blank' );                 } else {                     $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['text-color']);                     if ( strlen($color) == 6 || strlen($color) == 3 )                         set_theme_mod('header_textcolor', $color);                 }             }                  if ( isset($_POST['default-header']) ) {                 check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );                 $this->process_default_headers();                 if ( isset($this->default_headers[$_POST['default-header']]) )                     set_theme_mod('header_image', esc_url($this->default_headers[$_POST['default-header']]['url']));             }         }              /**          * Process the default headers          *          * @since 3.0.0          */         function process_default_headers() {             global $_wp_default_headers;                  if ( !empty($this->headers) )                 return;                  if ( !isset($_wp_default_headers) )                 return;                  $this->default_headers = $_wp_default_headers;             foreach ( array_keys($this->default_headers) as $header ) {                 $this->default_headers[$header]['url'] =  sprintf( $this->default_headers[$header]['url'], get_template_directory_uri(), get_stylesheet_directory_uri() );                 $this->default_headers[$header]['thumbnail_url'] =  sprintf( $this->default_headers[$header]['thumbnail_url'], get_template_directory_uri(), get_stylesheet_directory_uri() );             }         }              /**          * Display UI for selecting one of several default headers.          *          * @since 3.0.0          */         function show_default_header_selector() {             echo '
';             foreach ( $this->default_headers as $header_key => $header ) {                 $header_thumbnail = $header['thumbnail_url'];                 $header_url = $header['url'];                 $header_desc = $header['description'];                 echo '
';                 echo '<input name="default-header" type="radio" value="' . esc_attr($header_key) . '" ' . checked($header_url, get_theme_mod( 'header_image' ), false) . ' />';                 echo '';                 echo '
';             }             echo '

';         }              /**          * Execute Javascript depending on step.          *          * @since 2.1.0          */         function js() {             $step = $this->step();             if ( ( 1 == $step || 3 == $step ) && $this->header_text() )                 $this->js_1();             elseif ( 2 == $step )                 $this->js_2();         }              /**          * Display Javascript based on Step 1 and 3.          *          * @since 2.6.0          */         function js_1() { ?>          <?php         }              /**          * Display Javascript based on Step 2.          *          * @since 2.6.0          */         function js_2() { ?>          <?php         }              /**          * Display first step of custom header image page.          *          * @since 2.1.0          */         function step_1() {             $this->process_default_headers();     ?>
     <?php screen_icon(); ?>
<?php _e('Custom Header'); ?>
          <?php if ( ! empty( $this->updated ) ) { ?>

<?php printf( __( 'Header updated. Visit your site to see how it looks.' ), home_url( '/' ) ); ?>

     <?php } ?>
<?php _e( 'Header Image' ) ?>

     <?php _e( 'Preview' ); ?>	              <?php if ( $this->admin_image_div_callback ) {           call_user_func( $this->admin_image_div_callback );         } else {         ?>         <div id="headimg" style="max-width:<?php echo HEADER_IMAGE_WIDTH; ?>px;height:<?php echo HEADER_IMAGE_HEIGHT; ?>px;background-image:url(<?php esc_url ( header_image() ) ?>);">             <?php             if ( 'blank' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) || '' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) || ! $this->header_text() )                 $style = ' style="display:none;"';             else                 $style = ' style="color:#' . get_theme_mod( 'header_textcolor', HEADER_TEXTCOLOR ) . ';"';             ?>
<a id="name"<?php echo $style; ?> onclick="return false;" href="<?php bloginfo('url'); ?>"><?php bloginfo( 'name' ); ?>
             <div id="desc"<?php echo $style; ?>><?php bloginfo( 'description' ); ?>

         <?php } ?>

     <?php _e( 'Upload Image' ); ?>
<?php _e( 'You can upload a custom header image to be shown at the top of your site instead of the default one. On the next screen you will be able to crop the image.' ); ?>
         <?php printf( __( 'Images of exactly %1$d × %2$d pixels will be used as-is.' ), HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT ); ?>
         <form enctype="multipart/form-data" id="upload-form" method="post" action="<?php echo esc_attr( add_query_arg( 'step', 2 ) ) ?>">
             <?php _e( 'Choose an image from your computer:' ); ?>
             <input type="file" id="upload" name="import" />             <input type="hidden" name="action" value="save" />             <?php wp_nonce_field( 'custom-header-upload', '_wpnonce-custom-header-upload' ) ?>             <input type="submit" class="button" value="<?php esc_attr_e( 'Upload' ); ?>" />
         </form>

          <form method="post" action="<?php echo esc_attr( add_query_arg( 'step', 1 ) ) ?>">

         <?php if ( ! empty( $this->default_headers ) ) : ?>
     <?php _e( 'Default Images' ); ?>
<?php _e( 'If you don‘t want to upload your own image, you can use one of these cool headers.' ) ?>
         <?php             $this->show_default_header_selector();         ?>
         <?php endif;              if ( get_header_image() ) : ?>
     <?php _e( 'Remove Image' ); ?>
<?php _e( 'This will remove the header image. You will not be able to restore any customizations.' ) ?>
         <input type="submit" class="button" name="removeheader" value="<?php esc_attr_e( 'Remove Header Image' ); ?>" />
         <?php endif;              if ( defined( 'HEADER_IMAGE' ) ) : ?>
     <?php _e( 'Reset Image' ); ?>
<?php _e( 'This will restore the original header image. You will not be able to restore any customizations.' ) ?>
         <input type="submit" class="button" name="resetheader" value="<?php esc_attr_e( 'Restore Original Header Image' ); ?>" />
         <?php endif; ?>

              <?php if ( $this->header_text() ) : ?>
<?php _e( 'Header Text' ) ?>

     <?php _e( 'Display Text' ); ?>
         <?php $hidetext = get_theme_mod( 'header_textcolor', HEADER_TEXTCOLOR ); ?>         <input type="radio" value="1" name="hidetext" id="hidetext"<?php checked( ( 'blank' == $hidetext || empty( $hidetext ) )  ? true : false ); ?> /> <?php _e( 'No' ); ?>         <input type="radio" value="0" name="hidetext" id="showtext"<?php checked( ( 'blank' == $hidetext || empty( $hidetext ) ) ? false : true ); ?> /> <?php _e( 'Yes' ); ?>

     <?php _e( 'Text Color' ); ?>
             <input type="text" name="text-color" id="text-color" value="#<?php echo esc_attr( get_theme_mod( 'header_textcolor', HEADER_TEXTCOLOR ) ); ?>" />             <?php _e( 'If you want to hide header text, add #blank as text color.' );?>             <input type="button" class="button hide-if-no-js" value="<?php esc_attr_e( 'Select a Color' ); ?>" id="pickcolor" />

              <?php if ( defined('HEADER_TEXTCOLOR') && get_theme_mod('header_textcolor') ) { ?>
     <?php _e('Reset Text Color'); ?>
<?php _e( 'This will restore the original header text. You will not be able to restore any customizations.' ) ?>
         <input type="submit" class="button" name="resettext" value="<?php esc_attr_e( 'Restore Original Header Text' ); ?>" />
         <?php } ?>

         <?php endif;          wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
<input type="submit" class="button-primary" name="save-header-options" value="<?php esc_attr_e( 'Save Changes' ); ?>" />
     </form>
          <?php }              /**          * Display second step of custom header image page.          *          * @since 2.1.0          */         function step_2() {             check_admin_referer('custom-header-upload', '_wpnonce-custom-header-upload');             $overrides = array('test_form' => false);             $file = wp_handle_upload($_FILES['import'], $overrides);                  if ( isset($file['error']) )                 wp_die( $file['error'],  __( 'Image Upload Error' ) );                  $url = $file['url'];             $type = $file['type'];             $file = $file['file'];             $filename = basename($file);                  // Construct the object array             $object = array(             'post_title' => $filename,             'post_content' => $url,             'post_mime_type' => $type,             'guid' => $url);                  // Save the data             $id = wp_insert_attachment($object, $file);                  list($width, $height, $type, $attr) = getimagesize( $file );                  if ( $width == HEADER_IMAGE_WIDTH && $height == HEADER_IMAGE_HEIGHT ) {                 // Add the meta-data                 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );                      set_theme_mod('header_image', esc_url($url));                 do_action('wp_create_file_in_uploads', $file, $id); // For replication                 return $this->finished();             } elseif ( $width > HEADER_IMAGE_WIDTH ) {                 $oitar = $width / HEADER_IMAGE_WIDTH;                 $image = wp_crop_image($file, 0, 0, $width, $height, HEADER_IMAGE_WIDTH, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file));                 if ( is_wp_error( $image ) )                     wp_die( __( 'Image could not be processed.  Please go back and try again.' ), __( 'Image Processing Error' ) );                      $image = apply_filters('wp_create_file_in_uploads', $image, $id); // For replication                      $url = str_replace(basename($url), basename($image), $url);                 $width = $width / $oitar;                 $height = $height / $oitar;             } else {                 $oitar = 1;             }             ?>
     <?php screen_icon(); ?>
<?php _e( 'Crop Header Image' ); ?>
          <form method="post" action="<?php echo esc_attr(add_query_arg('step', 3)); ?>">
<?php _e('Choose the part of the image you want to use as your header.'); ?>

<?php _e( 'You need Javascript to choose a part of the image.'); ?>

             <img src="<?php echo esc_url( $url ); ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" />

         <input type="hidden" name="x1" id="x1" value="0"/>         <input type="hidden" name="y1" id="y1" value="0"/>         <input type="hidden" name="width" id="width" value="<?php echo esc_attr( $width ); ?>"/>         <input type="hidden" name="height" id="height" value="<?php echo esc_attr( $height ); ?>"/>         <input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo esc_attr( $id ); ?>" />         <input type="hidden" name="oitar" id="oitar" value="<?php echo esc_attr( $oitar ); ?>" />         <?php wp_nonce_field( 'custom-header-crop-image' ) ?>         <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Crop and Publish' ); ?>" />
     </form>
             <?php         }              /**          * Display third step of custom header image page.          *          * @since 2.1.0          */         function step_3() {             check_admin_referer('custom-header-crop-image');             if ( $_POST['oitar'] > 1 ) {                 $_POST['x1'] = $_POST['x1'] * $_POST['oitar'];                 $_POST['y1'] = $_POST['y1'] * $_POST['oitar'];                 $_POST['width'] = $_POST['width'] * $_POST['oitar'];                 $_POST['height'] = $_POST['height'] * $_POST['oitar'];             }                  $original = get_attached_file( $_POST['attachment_id'] );                  $cropped = wp_crop_image($_POST['attachment_id'], $_POST['x1'], $_POST['y1'], $_POST['width'], $_POST['height'], HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT);             if ( is_wp_error( $cropped ) )                 wp_die( __( 'Image could not be processed.  Please go back and try again.' ), __( 'Image Processing Error' ) );                  $cropped = apply_filters('wp_create_file_in_uploads', $cropped, $_POST['attachment_id']); // For replication                  $parent = get_post($_POST['attachment_id']);             $parent_url = $parent->guid;             $url = str_replace(basename($parent_url), basename($cropped), $parent_url);                  // Construct the object array             $object = array(                 'ID' => $_POST['attachment_id'],                 'post_title' => basename($cropped),                 'post_content' => $url,                 'post_mime_type' => 'image/jpeg',                 'guid' => $url             );                  // Update the attachment             wp_insert_attachment($object, $cropped);             wp_update_attachment_metadata( $_POST['attachment_id'], wp_generate_attachment_metadata( $_POST['attachment_id'], $cropped ) );                  set_theme_mod('header_image', $url);                  // cleanup             $medium = str_replace(basename($original), 'midsize-'.basename($original), $original);             @unlink( apply_filters( 'wp_delete_file', $medium ) );             @unlink( apply_filters( 'wp_delete_file', $original ) );                  return $this->finished();         }              /**          * Display last step of custom header image page.          *          * @since 2.1.0          */         function finished() {             $this->updated = true;             $this->step_1();         }              /**          * Display the page based on the current step.          *          * @since 2.1.0          */         function admin_page() {             if ( ! current_user_can('edit_theme_options') )                 wp_die(__('You do not have permission to customize headers.'));             $step = $this->step();             if ( 1 == $step )                 $this->step_1();             elseif ( 2 == $step )                 $this->step_2();             elseif ( 3 == $step )                 $this->step_3();         }          }     ?>


title: Random Custom Post Type

text:
So i have a custom post type, and everything is correct when displaying. But i want that the custom post type appear random. I tried orderby => 'rand' but probably not in the right place and probably something is missing. I'll left here the 3 files php that is necessary: **archive-job_listing:**               <?php do_action('before_front_page_jobs'); ?>

                  <a href="<?php echo add_query_arg( 'post_type', APP_POST_TYPE, get_bloginfo('rss2_url') ); ?>"><img src="<?php bloginfo('template_url'); ?>/images/feed.png" title="<?php _e('Latest Jobs RSS Feed',APP_TD); ?>" alt="<?php _e('Latest Jobs RSS Feed',APP_TD); ?>" />                  <?php _e('Latest Jobs',APP_TD); ?> <?php if ($paged>1) { ?>(<?php _e('page', APP_TD ) ?> <?php echo $paged; ?>)<?php } ?>                  <?php if (isset($_GET['action']) && $_GET['action'] == 'Filter') { ?>                  — <a href="<?php echo jr_get_current_url(); ?>"><?php _e('Remove Filters',APP_TD); ?>             <?php } ?>
              <?php             $main_wp_query = $wp_query;                   $args = jr_filter_form();              query_posts( $args );                  // call the main loop-job.php file             appthemes_load_template( 'loop-job.php', array( 'main_wp_query' => $main_wp_query ) );         ?>              <?php jr_paging(); ?>              <?php wp_reset_query(); ?>

          <?php do_action('after_front_page_jobs'); ?>

      **loop-job**
              <?php while (have_posts()) : the_post(); ?>                  <?php appthemes_before_post( 'job_listing' ); ?>                  <?php                 $post_class = array('job');                 $expired = jr_check_expired( $post );                      if ( $expired ) {                     $post_class[] = 'job-expired';                 }                 $alt=$alt*-1;                      if ($alt==1) $post_class[] = 'job-alt';                      if ( !empty($main_wp_query) && jr_is_listing_featured( $post->ID, $main_wp_query ) ) $post_class[] = 'job-featured';                  ?>                  <li class="<?php echo implode(' ', $post_class); ?>">

<?php _e('Company',APP_TD); ?>

<?php echo get_avatar(get_the_author_meta( 'ID', $post->post_author ), 60); ?>

<?php _e('Job', APP_TD); ?>
                          <?php appthemes_before_post_title( 'job_listing' ); ?>
                         <a href="<?php the_permalink(); ?>"><?php the_title(); ?>                         <?php jr_job_author(); ?>
                          <?php appthemes_after_post_title( 'job_listing' ); ?>
<?php _e('Location', APP_TD); ?>

<?php jr_location(); ?>
                     <?php echo date_i18n(__('j M',APP_TD), strtotime($post->post_date)); ?> <?php echo date_i18n(__('Y',APP_TD), strtotime($post->post_date)); ?>

<?php _e('Type',APP_TD); ?>

<?php jr_get_custom_taxonomy($post->ID, 'job_type', 'jtype'); ?>

                  <?php appthemes_after_post( 'job_listing' ); ?>              <?php endwhile; ?>              <?php appthemes_after_endwhile( 'job_listing' ); ?>
                    <?php appthemes_loop_else( 'job_listing' ); ?>              **tpl-jobs-by-date**
              <?php         $dateargs = array();         $title = '';         $today = getdate();              switch ($show) :             case "week" :                 $title = __('This Week\'s Jobs',APP_TD);                 $dateargs = array( 'year' => $today["year"], 'w' => date('W') );             break;             case "lastweek" :                 $title = __('Last Week\'s Jobs',APP_TD);                 $week = date('W');                 $year = $today["year"];                 if ($week==0) :                     $week = 53;                     $year = $year-1;                 else :                     $week = $week-1;                 endif;                 $dateargs = array( 'year' => $year, 'w' => $week );             break;             case "today" :                 $title = __('Today\'s Jobs',APP_TD);                 $dateargs = array( 'year' => $today["year"], 'monthnum' => $today["mon"], 'day' => $today["mday"] );             break;             case "month" :                 $title = __('This Month\'s Jobs',APP_TD);                 $dateargs = array( 'year' => $today["year"], 'monthnum' => $today["mon"] );             break;         endswitch;              $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;              $main_wp_query = $wp_query;              $args = array(             'post_type' => APP_POST_TYPE,             'orderby' => 'rand',             'post_status' => 'publish',             'ignore_sticky_posts'   => 1,             'paged'=>$paged         );         $args = array_merge($dateargs, $args);         query_posts($args);         ?>
<?php echo $title; ?>
              <?php appthemes_load_template( 'loop-job.php', array( 'main_wp_query' => $main_wp_query ) );  ?>              <?php jr_paging(); ?>

          <?php do_action( 'after_jobs_by_date', 'date',  $show ); ?>

      **filter-form**               function jr_filter_form() {          if (get_option('jr_show_filterbar')!=='no') : ?>     <form class="filter" method="get" action="<?php echo jr_get_current_url(); ?>">         <?php         $job_types = get_terms( 'job_type', array( 'hide_empty' => '0' ) );         if ($job_types && sizeof($job_types) > 0) {             foreach ($job_types as $type) {                 ?>
<input type="checkbox" name="<?php echo $type->slug; ?>" id="<?php echo $type->slug; ?>" <?php                           if (isset($_GET[$type->slug]) || !isset($_GET['action'])) echo 'checked="checked"';                       ?> value="show" /> <label for="<?php echo $type->slug; ?>"><?php echo $type->name; ?>
                 <?php             }         }         ?>
         <input type="submit" value="<?php _e('Filter', APP_TD); ?>" class="submit" />         <input type="hidden" name="action" value="Filter" />         <?php             // hidden fields for search             if (isset($_GET['s'])) {                 echo '<input type="hidden" name="s" value="'.esc_attr($_GET['s']).'" />';             }             if (isset($_GET['location'])) {                 echo '<input type="hidden" name="location" value="'.esc_attr($_GET['location']).'" />';             }             if (isset($_GET['radius'])) {                 echo '<input type="hidden" name="radius" value="'.esc_attr($_GET['radius']).'" />';             }         ?>

     </form>     <?php endif;          return jr_process_filter_form();     }      I hope someone can help me and highlight me. Probably a noobie question but i read and try and i cannot find the solution.


title: How to display category information from a custom post

text: I have created a page that uses custom posts: http://www.africanhealthleadership.org/resources/toolkit/ Each tool (Preparation, Assessment, etc.) is a custom post. On the WP Admin, each tool is a category; each category has a "description" field. I would like to output those descriptions on the Toolkit page. I tried using this and nothing displayed: `<?php echo category_description( $category ); ?>` Right now, the descriptions are hard-coded in to the page. The one for preparation begins "Preparation tools establish..." Thank you for any ideas! Jeff * * * Here is the loop that spits out the custom post type:               <?php     query_posts( array( 'post_type' => 'portfolio', 'toolkit' => 'preparation' ) );     //the loop start here     if ( have_posts() ) : while ( have_posts() ) : the_post();     ?>     <?php the_content(); ?>     <?php endwhile; endif; wp_reset_query(); ?>      And Here is the code from functions.php               add_action('init', 'portfolio_register');          function portfolio_register() {          $labels = array(         'name' => _x('Toolkit', 'post type general name'),         'singular_name' => _x('Tool', 'post type singular name'),         'add_new' => _x('Add New Tool', 'tool'),         'add_new_item' => __('Add New Tool'),         'edit_item' => __('Edit Tool'),         'new_item' => __('New Tool'),         'view_item' => __('View Tool'),         'search_items' => __('Search Toolkit'),         'not_found' =>  __('Nothing found'),         'not_found_in_trash' => __('Nothing found in Trash'),         'parent_item_colon' => ''     );          $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'query_var' => true,         'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',         'rewrite' => true,         'capability_type' => 'post',         'hierarchical' => false,         'menu_position' => null,         'supports' => array('title','editor','thumbnail')       );           register_post_type( 'portfolio' , $args );     }          register_taxonomy("toolkit", array("portfolio"), array("hierarchical" => true,   "label"     => "Tool Categories", "singular_label" => "Tool", "rewrite" => true));


title: Can I add custom meta for each image uploaded via media-upload.php?

text: I'm calling media-upload.php via a custom icon click inside the content editor and I would like to add a custom meta value for all images that are uploaded when the media-upload.php is called from my custom function. For example, for each of the images that are uploaded, I want to insert a value into wp_postmeta of _customAttachment = 1 like so:               update_post_meta($post['ID'], '_customAttachment', true);      I know how I can pass the current post-id to the media-upload.php (via querystring parameters), but I have no idea how to attach my update_post_meta filter to the save/upload trigger in media-upload.php Is there a filter for this?


title: Attach Files Metabox

text: Does anyone happen to know how to create a simple "attach/browse" button that can be placed into a metabox which upon clicking it would open a lightbox where the user would be able to view all the media files, tick the ones he wants to attach and click an "attach" button on the bottom. After clicking "attach" the post metabox would update with all the files he selected...


title: Querying custom fields with Carrington mobile theme

text:
Does anyone know why querying custom fields does not work in the Carrington mobile theme? I´m using this:               get_post_meta($post, 'key', true)      But the query does not return anything. Anyone know why? Added code:               while (have_posts()) : the_post();         $category = get_the_category($post);               $title = get_the_title($post->ID);         $link = get_permalink($post->ID);         $store = $category[0]->cat_name;         $volum = get_post_meta($post->ID, '2Volum', true);         $produsent = get_post_meta($post->ID, '1Produsent', true);         $pris = get_post_meta($post->ID, '3Pris', true);              echo '';         echo '
';         echo '
' . $title . '
';         echo '
' . $pris . '
';         echo '
' .$produsent . '
';         echo '
' . $volum . '
';         echo '
';         echo '';          endwhile; // End the loop. Whew.


title: Downloading entire site locally with httrack

text: I had a bit of a scare with a malformed database last night which got me to getting onto making sure I have so many redundant backups of my site that I am covered in the event of the server dying, my home backup server dying, etc. :) That said, I am trying to use `httrack` to download the entire site, but I run into a case where it ONLY gets the root site (for example): `test.mylovelysite.com` But I need it to crawl: `test.mylovelysite.com/page/2/` etc., etc., etc. I can go and tell it to download each page manually, but what I'm trying to do is:   * Capture all the site content locally:      * Pictures     * Comments     * Videos I can open the downloaded files in Chrome and the only local page is the root page right now. Any link just points me back to the actual site itself I am trying to backup. I've tried the export function within Wordpress, but I'm not looking for an XML file, I'm looking for an entire local backup of the site. I have SFTP ac


title: Check if "Break comments into pages" is selected

text: I am working with a `paginate_comments_links()` function and the thing is that I have customized it slightly (wrapped with a div), I need to check if check box "Break comments into pages..." in WP admin -> Settings -> Discussion Settings -> Other comment settings was checked. So the question is how would I grab the results? The issue is that if it is not checked `paginate_comments_links()` will not do anything, but my div will appear.


title: Twenty fourteen slider navigation doesn't work

text:
I want to add navigation to the default slider.js of twentyfourteen. I have tried lots of ways, but I don't understand how must I do it. Any suggestions to make this work? index.php
     <?php          query_posts('post_type=slider');         if (have_posts()) {              $slider_index=1;             while(have_posts()): the_post(); $image=wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'home_slider');?>                      <div rel="<?php echo $slider_index;?>" class="slide_element">                     <img src="<?php echo $image[0];?>" title="<?php the_title();?>" />

<?php echo get_the_excerpt();?>
                              <?php } ?>

             <?php $slider_index++; endwhile;?>           slider.js                   // Default settings.     $.featuredslider.defaults = {         namespace: 'slider-',     // String: prefix string attached to the class of every element generated by the plugin.         selector: '.slides > li', // String: selector, must match a simple pattern.         animationSpeed: 600,      // Integer: Set the speed of animations, in milliseconds.         controlsContainer: '',    // jQuery Object/Selector: container navigation to append elements.              // Text labels.         directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false)         prevText: featuredSliderDefaults.prevText, // String: Set the text for the "previous" directionNav item.         nextText: featuredSliderDefaults.nextText  // String: Set the text for the "next" directionNav item.          };


title: How to Take Ownership of a Theme

text: I installed WordPress on my website along with a theme close to what I wanted. I then changed virtually all the formatting to make it conform to my site. I don't plan on publishing my version, but I would like to make it my own so as not to confuse it with the original. I get notices about updates to the original and I don't want to inadvertently upgrade it. I see that the folder under themes has the name of the theme, but I imagine there's more to it than that. I can do database alters if necessary. Would it be easier just to create a new theme and copy all the files to it?


title: Adding an additional menu in Wordpress

text: I am using wp_nav_menu() and I want to add the search box as a part of the menu. I am having trouble figuring it out and was hoping for some assistance: My code:                       <?php              $args = array('theme_location' => 'primary', 'container' => false);             wp_nav_menu( $args );              ?>      Now I want to add an additional <li> element to the end or the menu <ul> and all I want in the <li> is the output of:                       <?php get_search_form();?>      Can this be done?


title: Getting Thumbnail Path rather than Image Tag

text: I see many methods of showing thumbnails in WordPress, but I'm not immediately sure how I could get only the path to a post's thumbnail rather than the html- ready code generated by functions like `the_post_thumbnail()` and `get_the_post_thumbnail()`. What methods are available to me to get _only_ the path of the thumbnail (to set it as a bgimage) rather than the `<img />` tag? Do I only have the option of parsing the results of the `get_` method or is there an easier way?


title: Remove line breaks in wp_list_categories()?

text: I am trying to output a list of categories per an article. I am using the following code, `<?php wp_list_categories('child_of=270&style=none'); ?>` (string) Style to display the categories list in. A value of list displays the categories as list items while none generates no special display method (the list items are separated by `<br>` tags). How do I remove the stupid `<br />` after each output? Frustrating how this code `<?php the_category(', '); ?>` Will output the links without a line break... Any help would be greatly appreciated.


title: Display all custom post types in archives.php

text: How would I do this? `archive.php` only has this:               wp_get_archives('type=monthly');      And `wp_get_archives()` does not have a parameter to display all post types. Also I think `archive-[post_type].php` is not the one I am looking for since I want all post types to be displayed in one archive page. Thanks! W


title: best way to stop this wordpress duplicate content

text: I noticed in google that actually searches in my blog are getting indexed on multiple pages resulting in duplicate content. Suggestions on how to stop this? example /               ?s=radiofixes     /page/10/?s=radiofixes     /page/11/?s=radiofixes     /page/2/?s=radiofixes     /page/3/?s=radiofixes     /page/4/?s=radiofixes     /page/5/?s=radiofixes     /page/6/?s=radiofixes     /page/7/?s=radiofixes     /page/8/?s=radiofixes     /page/9/?s=radiofixes      I was thinking paramaters in google, but would I put to ignore?


title: custom url with custom post

text: I want to change my custom post URL. I want to remove " **item** " from URL. With the below code and with custom post type url plugin http://wordpress.org/plugins/custom-post-type-permalinks/ my URL is: Original URL : **`http://mywebsite/wp/item/america/mayer/`** Want to change it to **`http://mywebsite/wp/america/mayer/`** Without using `htaccess`. **WordPress Code**                   function aitDirItemPostType() {                  register_post_type( 'ait-dir-item',                 array(                     'labels' => array(                         'name'          => 'Items',                         'singular_name' => 'Item',                         'add_new'       => 'Add new',                         'add_new_item'  => 'Add new item',                         'edit_item'     => 'Edit item',                         'new_item'      => 'New item',                         'not_found'     => 'No items found',                         'not_found_in_trash' => 'No items found in Trash',                         'menu_name'     => 'Items',                     ),                     'description' => 'Manipulating with items',                     'public' => true,                     'show_in_nav_menus' => true,                     'supports' => array(                         'title',                         'thumbnail',                         'author',                         'editor',                         'excerpt',                         'comments',                     ),                     'show_ui' => true,                     'show_in_menu' => true,                     'menu_icon' => AIT_FRAMEWORK_URL . '/CustomTypes/dir-item/dir-item.png',                     'menu_position' => $GLOBALS['aitThemeCustomTypes']['dir-item'],                     'has_archive' => true,                     'query_var' => 'dir-item',                     'rewrite' => array('slug' => 'item'),                     'capability_type' => 'ait-dir-item',                     'map_meta_cap' => true                 )             );             aitDirItemTaxonomies();                  flush_rewrite_rules(false);         }          add_action( 'init', 'aitDirItemPostType');


title: Create theme files for plugin

text: Basically I've made a plugin to create a new post type (event). Now I want to create a `single-event.php` layout file. I don't want to have to stick it in the theme folder, I want to put it into my plugin folder. How do I make wordpress know its there? Thanks


title: Loop inside the loop

text:
I'm working on a project where I need display 2 post from one category and also I need to put another loop between this post post to display random list of post from other category. Easiest way to do so is to create 3 queries, but when I created 2 queries for one category, but here I got problem one loop breaks and display both posts, second works fine. I used offset parameter for second query but it doesn't work.               <?php                  $first_query_args = array(               'category_name' => 'first-category',               'tag' => 'special-tag',               'post_per_page' => 1,             );                  $first_query = new WP_Query( $first_query_args );                  if ( $first_query->have_posts() ) : while ( $first_query->have_posts() ) : $first_query->the_post();                  // First query stuff goes here                  endwhile; endif;                  wp_reset_query();                   // Query for Random posts             $query_for_random_args = array(                 'category_name' => 'cat-for-rand',                 'post_per_page' => 3,                 'orderby' => 'rand',             );                  $query_for_random = new WP_Query( $query_for_random_args );                  if ( $query_for_random->have_posts() ) :         ?>
                  <?php while ( $query_for_random->have_posts() ) : $query_for_random->the_post(); ?>
                     <?php if ( has_post_thumbnail() ) { ?>                         <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'list-image' ); ?>                         <a href="<?php the_permalink(); ?>" ><?php the_title(); ?>
                  <?php } endwhile; ?>
                  <?php endif; wp_reset_query(); ?>              <?php                       $second_query_args = array(               'category_name' => 'first-category',               'tag' => 'special-tag',               'offset' => 1,               'post_per_page' => 1,             );                  $second_query = new WP_Query( $second_query_args );                  if ( $second->have_posts() ) : while ( $second_query->have_posts() ) : $second_query->the_post();                  // Second query stuff goes here                  endwhile; endif;     ?>      ( This code What I use for those loops ) Any ideas how can I solve this problem? or how can I use 2 queries for similar task? Cheers George


title: Paginate Author's Post List on Custom Author Page (ANOTHER THEORY)

text:
Ok so here's another story for my Custom Pagination on Custom Author's Page. What i want to happen there is display the Author's avatar, description, website, and some additional fields, and of course list his post and paginate it.... Here's the screenshot of my custom author page: http://i56.tinypic.com/2cosldy.png As you can see, everything seems to be in order. Now, the problem is the pagination. I used the code by Kreisi (Pagination w/o using plugins). What i did is create a custom loop and call it to Kreisi's function here's the code                   $uid = $curauth->ID;     $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;     $authloop = new WP_Query("author=$uid&paged=$paged");     $ppp = 5; //set my custom number of post to appear          $args = array(                'post_per_page' => $ppp,                'author' => $uid,                'paged' => $paged           );          $authorposts = get_posts($args);               if ( count( $authorposts ) > 0 ) {                                foreach ( $authorposts as $post ):  setup_postdata($post)                              ?>
                             <?php if ( has_post_thumbnail() ) : ?>                                     <img src="<?php echo bloginfo('template_url'); ?>/inc/scripts/timthumb.php?src=<?php echo catch_that_image(); ?>&w=40&h=40&zc=1&q=30" alt="<?php the_title(); ?>" class="authorpostimg"/>                                  <?php else :    ?>                                     <img src="<?php echo bloginfo('template_url'); ?>/inc/scripts/timthumb.php?src=<?php echo catch_that_image(); ?>&w=40&h=40&zc=1&q=100" alt="<?php the_title(); ?>" class="authorpostimg"/>                             <?php endif; ?>                                  <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>" class="authorpostlink"><?php the_title(); ?>                             <?php the_excerpt(); ?>
             <?php                  endforeach;                    wnw_authpagination($authloop->max_num_pages);          } else {             echo '
No articles by this user
';     }      Here's the scenario for further understanding Supposed the blog has a total of 30 blog posts, and the author Ven Francis has 15. If you can see on my variable, i did set the post_per_page value to 5. And on Kreisi's function it has the range of 2. (please visit the link to his code to further figure it out) So what it has to happen is that, pagination should show 5 page-buttons [c] [2] [3] [>] [>>] where [c] is the current... [3] and [>>] is the last page(3rd page). But what is happening on my situation is that, when you hover the [>>] it shows /page/6 and i think it's getting the total number of posts of the blog. And if you click on 3(3rd page). It will still show the 4,5 and [>>] and it should not. like below illustration [<<] [<] [1] [2] [c] [4] [5] [>] [>>] I hope you understand the scenario and the problem. Thanks again and God bless! PS: kreisi's not doing a support for his brilliant code anymore, so i gotta do this on my own. an i need a little help from you guys. Thank you!


title: Add Shortcode tag in Widget/Sidebar

text: I want to add a shortcode tag in the sidebar/widget. I am able to get the required functionality if I add the code in the theme's function.php               add_filter('widget_text', 'do_shortcode');      My problem is that I am searching for a way I can do this from the plugins files itself without affecting any of the theme files. Can anyone tell me if this is possible?


title: WordPress plugin for affiliate referral system

text: I want to create an affiliate system on WordPress . What I mean is when "Member A" invite other to join (ex. "Member B") by using the ?referralId=MemberA querystring, then Member A get points or credits, and when Member B invite Member C, then Member B get points. Is there any WordPress plugin that can do that ? I already tried Affiliate Pro Plus (http://wordpress.org/extend/plugins/affiliate-pro-plus/) but It's not work as expected. When I try to register Member B using Member A's referral, Member B does not count as Member A downline.


title: Metadata in loops

text: I have a standard Wordpress loop displaying items:                    $loop = new WP_Query( array(                  'post_type' => 'images',                    'orderby' => 'menu_order',                  ) );             while ( $loop->have_posts() ) : $loop->the_post();              /* loop code, HTML mostly, a few if statements, nothing special */             endwhile;      Now I want to display CERTAIN data from meta boxes and here comes the trouble. the_meta() works just fine, but get_post_meta() doesn't work at all. Why is this happening? Any fixes? I need to do something like get_post_meta($post->ID, 'metabox_field', true). Any ideas? [update] Alright. More details. I have a custom post type called "images". Each image item has it's own metabox with a few fields inside, let's call them image_date, image_author, copyrights. I want to display image author from field called image_author, so:               <?php          $author = get_post_meta($post->ID, 'image_author', true);          echo $author;     ?>      The problem is it works ONLY when I open SINGLE image (single-image.php), but doesn't in loop (and I want to display this data for each item in loop also). The_meta() works in both places if it changes something. My loop looks exactly as above. I guess that's all :)


title: Script to remove all inactive widgets?

text: I've been working with widgets a lot lately and have amassed a ton of widgets in the inactive widgets collection. Can someone share a script or plugin that will remove all inactive widgets from the site?


title: wordpress site | All-in-one-cufon IE Issue

text: I have a site where i'm using the All-In-One Cufon (Wordpress Plugin), but having some issues getting it to render properly in IE. The website: [removed] The Problem: It works fine so far in Firefox and the other browsers like Chrome. Even in internet explorer the first time the site loads it works fine but when i refresh the page or visit any other pages by clicking a link on the site it stops working (The text is still visible but cufon rendering doesn't work) :o I have been trying to fix this since the past day without any success. I'm not 100% sure but i think it used to work fine awhile back but i just recently noticed this odd behavior and have no clue what could be making this happen. My first thought was a conflict of a plugin, but i tried disabling ALL the plugins except the cufon and it still does the same thing. Is anyone aware / experienced similar issue with their websites? and knows the solution? thanks in advance.


title: URL Rewriting in WordPress

text: How can I rewrite URLs on WordPress? For example, I have a URL like `sitename.com/?page=<numbers>&id=<numbers>` and I want to rewrite it as `sitename.com/page/id/<other info>`. How can I do that? I don't understand the rules!


title: How to force wordpress custom slider text to be static?

text: I have created my own customized slider plugin for wordpress and it is well created with all the features. But now i want to do that 'title' and 'description' displaying with each image should remain static means I want only one 'text' and one 'description' should display on all the images. I want that text and description on foreground should static and on background images slide smoothly. Please help me get rid of this problem, I would be greatly thankful to you.


title: Best way to handle Post-Format Video without using the_content?

text: I have read the Codex and I'm about 3 hours searching around sites for a deep understanding of post-formats but got no answer. Don't know if it is a dumb question but after spending a long time searching I thought here is the best place to get answered. I'm developing a simple theme that have an option to display the posts on a grid style. It displays the thumbnail and the excerpt and I want to display the video instead of thumbnail, if the selected format is set. How is that possible?


title: Migrating data between local and development server

text: I've been working away at a medium-size WordPress site. So far I've just been hosting the site on my local machine and showing it to internal consultants over our local network. Things are working well, and now it's time to show it off to the client. I've been using git all along, so pushing it to the dev server was a breeze. I duplicated the local DB and pushed it to the dev server manually, which was fairly easy except that I had to manually change a few URL entries. Now my question is: what's the best way to keep two instances of WordPress synced? I still have more work to do locally and the DB is going to need to get pushed up again. How do other people manage this in an automated way? One thought I had was to write a git hook to pull the MySQL data down when I push from my local machine and have a hook on the other end to import the data when the dev server pulls. However, if I do this I'll have to worry about changes to the wp_options table. Does anyone have any strategies for making this sort of thing easy? Thanks!


title: Fields for different parts of a page

text: I'm going to use WordPress to manage a mainly static website. Some of the pages (like the typical _about us_ ) have some paragraphs that should be editable from the admin panel. The thing is, I don't want the client to have to deal with the html of the page or anything. The first thing I thought was to use a **page template** , so the html is in the template php file, and the content can be edited from the admin panel. The problem is that the paragraphs are divided by some PHP code and some HTML markup that should not be edited, something like this:               <p> This is the first editable paragraph </p>     <?php /* some php code */ ?>     <img src="not-editable-img.png">     <p> This is the second editable paragraph </p>      If I use a page template, I only have one "field", namely the page's content (that would be output using `the_content`). How can I make it have multiple fields? Something like " _text for paragraph 1_ " and the like? Should I use a custom post type? That would mean creating a custom post type for each page, and having just a single post for each custom post type. Is that the correct way?


title: Use two different index pages

text: This link is pointing to my home directory. I want my users to see `~/home/prototype.php` page when they come to my site. To achieve this, I have set following in my .htaccess file of that directory:               DirectoryIndex /home/prototype.php     # 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      There is a form which they need to fill and submit. The redirection of this form is set to `www.imlovingdogs.com/index.php` i.e. the main index.php page where wordpress starts loading other required files. But this `www.imlovingdogs.com/index.php` doesn't work! How can I achieve this kind of flow for my users?


title: Migrating entire online site to local server gives "The requested URL /login/ was not found on this server."

text: I've followed most Wordpress migration guides that I can find. The steps I've taken sum up to the following:   1. Export my wp database from the existing production site   2. Spin up a new Ubuntu Server with LAMP stack, PHPMyAdmin, and ssh   3. Copy my entire wordpress site from root (htdocs) directory to the /var/www/ directory of my new server   4. Create a new database on the new server's mysql, import the export from step 1   5. Change the wp-options for `site_url` and `home` (I changed them to http://)   6. Run the script found here to clean up the rest of the db. When I point my browser to the ip address address of the new server on my local intranet I get the error:               Not Found          The requested URL /login/ was not found on this server.          Apache/2.2.22 (Ubuntu) Server at 192.168.0.176 Port 80      I get the same error when I try to go to /wp-admin. I think I may not be pointing the url correctly but I'm not sure where to point it to if it's not the root directory of my new server. My .htaccess files are located at               /var/www/.htaccess     /var/www/wp-content/uploads/.htaccess     /var/www/wp-content/themes/Portal/library/.htaccess     /var/www/wp-content/plugins/s2member-files/.htaccess     /var/www/wp-content/plugins/s2member-logs/.htaccess     /var/www/wp-content/plugins/akismet/.htaccess     /var/www/wp-content/plugins/s2member-pro/includes/.htaccess     /var/www/wp-content/plugins/s2member/includes/jquery/.htaccess     /var/www/wp-content/plugins/s2member/includes/.htaccess      The content of the root .htaccess file is               # BEGIN WordPress     Options FollowSymLinks     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteCond %{REQUEST_URI} ^/Appledoc.* [OR]     RewriteCond %{REQUEST_URI} ^/Javadoc.*     RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]     RewriteRule . /wp-login.php?redirect_to=%{REQUEST_URI} [L]     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>     # END WordPress          # BEGIN s2Member GZIP exclusions     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteCond %{QUERY_STRING} (^|\?|&)s2member_file_download\=.+ [OR]     RewriteCond %{QUERY_STRING} (^|\?|&)no-gzip\=1     RewriteRule .* - [E=no-gzip:1]     </IfModule>     # END s2Member GZIP exclusions


title: Capabilites not working

text: I created a custom post type:               add_action( 'init', 'artwork_feature');     function artwork_feature() {     register_post_type( 'artwork',         array(         'labels' => array(                 'name' => __( 'Artwork' ),                 'singular_name' => __( 'Artwork' )             ),         'public' => true,         'exclude_from_search' => false,         'capability_type' => 'artwork',         'supports' => array('custom-fields', 'comments', 'title', 'editor', 'thumbnail'),         'capabilities' => array(                 'publish_posts' => 'publish_artworks',                 'edit_posts' => 'edit_artworks',                 'edit_others_posts' => 'edit_others_artworks',                 'delete_posts' => 'delete_artworks',                 'delete_others_posts' => 'delete_others_artworks',                 'read_private_posts' => 'read_private_artworks',                 'edit_post' => 'edit_artwork',                 'delete_post' => 'delete_artwork',                 'read_post' => 'read_artwork',             ),         'map_meta_cap' => true,         'taxonomies' => array('post_tag'),         'has_archive' => true            )     );      } Then I installed the MEMBERS plugin, created a new role 'Artists' and went into the role and clicked 'Add New Capabilities'. I added:   1. edit_artworks   2. delete_artworks Then in my Admin Role I added:   1. edit_artworks   2. delete_artworks   3. publish_artworks   4. edit_others_artworks   5. delete_others_artworks   6. read_private_artworks Also, following a tutorial I added this to the functions.php:               //Set roles to meta capabilities     add_filter( 'map_meta_cap', 'my_map_meta_cap', 10, 4 );          function my_map_meta_cap( $caps, $cap, $user_id, $args ) {          /* If editing, deleting, or reading a artwork, get the post and post type object. */     if ( 'edit_artwork' == $cap || 'delete_artwork' == $cap || 'read_artwork' == $cap ) {         $post = get_post( $args[0] );         $post_type = get_post_type_object( $post->post_type );              /* Set an empty array for the caps. */         $caps = array();     }          /* If editing a artwork, assign the required capability. */     if ( 'edit_artwork' == $cap ) {         if ( $user_id == $post->post_author )             $caps[] = $post_type->cap->edit_posts;         else             $caps[] = $post_type->cap->edit_others_posts;     }          /* If deleting a artwork, assign the required capability. */     elseif ( 'delete_artwork' == $cap ) {         if ( $user_id == $post->post_author )             $caps[] = $post_type->cap->delete_posts;         else             $caps[] = $post_type->cap->delete_others_posts;     }          /* If reading a private artwork, assign the required capability. */     elseif ( 'read_artwork' == $cap ) {              if ( 'private' != $post->post_status )             $caps[] = 'read';         elseif ( $user_id == $post->post_author )             $caps[] = 'read';         else             $caps[] = $post_type->cap->read_private_posts;     }          /* Return the capabilities required by the user. */     return $caps;      } Now when I create artworks and publish them I can only View them in both roles. I am missing the Edit, Quick Edit, & Trash links. Can someone help?


title: Create more category hierarchical depth for custom post type/taxonomy plugin (widget)

text:
Source: http://getplatypi.com/docs/ A little new to the plugin development world, but so far I am building a post type plugin to support hierarchical categories in a list form with multiple depth levels (the structure I want is similar to: http://msdn.microsoft.com/en-us/library/windows/apps/br211362.aspx). The issue is although I can retrieve all post categories under the top parent category, it doesn't show depth levels if there are multiple sub category levels. I want to allow as much depth as needed and create a list to show for it. For example, right now in the WP Admin I have the category structure:               Parent     - Child Category     -- Sub category of the child category     --- another level of category     - 2nd Child Category      But when I assign the posts to the categories above, the sidebar/widget that displays the posts will only display them underneath the Parent only and not in a hierarchical tree:               Parent     - Posts in Child Category     - Posts in Sub category of the child category     - Posts assigned to another level of category     - Posts in 2nd Child Category      Instead I want it to mimic the depth and hierarchical structure as the categories set up in the backend... Below is the PHP code I am using for the widget... not sure how to modify it.               foreach ( $sorted_termchildren as $child_id => $order ) {             $termobject = get_term_by( 'id', $child_id, 'isa_docs_category' );             //Display the sub Term information, in open widget container             //echo '
' . $termobject->name . '
';             echo '
';             // nest a loop through each child cat's posts             global $post;             $args = array(  'post_type' => 'isa_docs',                          'posts_per_page' => -1,                         'order' => 'ASC',                         'tax_query' => array(                                     array(                                         'taxonomy' => 'isa_docs_category',                                         'field' => 'id',                                         'terms' => $termobject->term_id                                         )                                     ),                         'orderby' => 'meta_value_num',                         'meta_key' => '_odocs_meta_sortorder_key',                         'order' => 'ASC'                 );             $postlist = get_posts( $args );             foreach ( $postlist as $single_post ) {                     echo '
ID == $current_single_postID )                          echo ' class="organized-docs-active-side-item"';                     echo '>ID ) . '" title="' . esc_attr( $single_post->post_title ) . '">' . $single_post->post_title . '
';             }                      echo '
';         } // end foreach ( $sorted_termchildren      Otherwise, is there simply another plugin that does this already? I've searched everywhere. I would like to create this myself, just not sure how to make the code work accordingly. How can I fix this?


title: Custom templates folder

text: I created a custom folder ("/templates") and I put all of my template files in the folder. instead of root ("/wp-content/themes/my-theme/"). It works fine. Do I have to add some function for indicating "/templates/" folder as my templates folder? Usually you put them on root, right? It works fine now but I just wonder if there is anything I have to. I can't find any information on wordpress codex. I just installed WPML and All of templates pages are 404 now. I wonder if it(custom template folder location) causes this 404 pages. cuz woo-commerce pages are showing fine. wc is not in my template folder. it generated by plugin. -------- Additional I created a template www/wp-content/themes/my-theme/tpl-home.php I named this file as a template page.               <?php     /*     Template Name: Home     */     get_header(); ?>      And I moved templates files on www/wp-content/themes/my-theme/templates/tpl- home.php It still works well. I have seen a lot of themes do like this. Do I need to setup some function to indicated the folder?


title: Using 1 taxonomy for multiple post types?

text: I previously declared the taxonomy " artist " for a profile post type. Now i am creating a CD post type and would like to use the same artist list from the profile post type That is one example if i get a solution i will be using this to share a number of other taxonomies among-st post types :D Thanks in Advance. P.S. I use JW Custom Post Types https://github.com/JeffreyWay/Easy-WordPress- Custom-Post-Types/


title: How to have featured image show in standard RSS Widget

text: Is there a way of showing featured images in the standard RSS Widget in WordPress?


title: Adding a custom button to WordPress Add Post (and Edit Post too) screen, that can save the post

text: I am writing a plugin that hides the publish box from authors, so that I can have them click on a button in a custom meta box I created, to save their post. (This is not the sole purpose of the plugin, rest, I can't share. But this step is needed to do the rest.) I want WordPress to save the post to DB as it normally would, when I click on that button. How do I invoke WordPress' post save action from a custom button?


title: How to Display Custom Post Type's Gallery (images ) in Through WP_Query

text:
I am trying to load an Image Slider images from a Custom Post Type image Gallery Feature. For example let say I have an Custom Post Type called banner which I can load images to it's Gallery and I have an HTML code like this:

         slide 1

         slide 1

      Can you please let me know how I can use the custom WP_Query to retrive the images from the custom post and load them into slider instead of above HTML? So far I have done something like this but it is not displaying any image!               <?php     $args = array( 'post_type' => 'banner');     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post();         $gallery = get_post_gallery_images($post);     foreach( $gallery as $image ) {            echo '
';            echo '';            echo '
';         }     endwhile;     ?>      **Update:** The Result of `var_dump($POST)` ![enter image description here](http://i.stack.imgur.com/oZva3.png)


title: Custom select box meta field

text:
For my custom post type i needed to add the Attribute Meta box, but i wanted to add an extra field to it. So here i have copied the Page Attribute meta box code and added my select options, but i need help rewriting the 'Module Type' select box so it functions properly when saving the page.                function page_attributes_meta_box2($post) {           $post_type_object = get_post_type_object($post->post_type);            if ( $post_type_object->hierarchical ) {                $pages = wp_dropdown_pages(array('post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('(no parent)'), 'sort_column'=> 'menu_order, post_title', 'echo' => 0));                if ( ! empty($pages) ) {        ?>
<?php _e('Parent') ?>
        <?php _e('Parent') ?>        <?php echo $pages; ?>        <?php                } // end empty pages check            } // end hierarchical check.            ?>
<?php _e('Order') ?>

<?php _e('Order') ?><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" />

<?php if ( 'page' == $post->post_type ) _e( 'Need help? Use the Help tab in the upper right of your screen.' ); ?>

<?php _e('Module Type') ?>
        <?php _e('Module Type') ?>        <select id="_cnote_module_page_type" name="_cnote_module_page_type">             <option value="default">Default</option>             <option value="parent">Parent</option>             <option value="chat">Chat</option>        </select>        <?php        }          add_action('add_meta_boxes','add_post_template_metaboxr');     function add_post_template_metaboxr() {         add_meta_box('postparentdiv', __('Post Template'), 'page_attributes_meta_box2', 'module', 'side', 'high');     }      **note that i have not renamed everything yet, theres a lot of copy and pasting in here


title: Automate post update for all posts?

text: I have managed to fill custom fields with certain predefined values of all my post, but the changes don't take effect until I manually update the posts. Example:               // Predefined variable and value          $page_description = "This is a sample value that will be put (echo $page_description) into a custom field";               // Echo Variable into Custom Field          echo '<input type="text" name="custom-field-name" value="'.$page_description.'" />';      The above example works as I expected. It inserts the $page_description value into the custom field; so when I go to edit that post I will see the variable value. The issue is that in the current edit screen, without updating yet, if I look at the post on the front end of the site, that custom field has not been updated/saved with that variable value, even though I see in the edit screen. It is not until I update the post that the variable value is saved for good. I have 1,800+ posts that need to be updated. I need a solution to update them. Someone suggested using ajax to auto-update all existing posts so that the new custom field values are saved to the posts. I read an article about it, but not sure how to do it. Or if there is a plugin out there that I can use. I would like some assistance with this. Thanks for any input on this! **UDPATE 6-23-11:** This is the coding I inserting into my theme's custom field file:               $postauth = get_user_meta($post->post_author, 'nickname', true);          /********** UPDATE ALL POST FIELDS Function **********/              //check if data exists              if ($postauth){              //if it exists just echo it out                 echo $postauth;              }else{              //if not , update the post meta with your default value and the echo it out.            $update_author = get_user_meta($post->post_author, 'nickname', true);            update_post_meta($post->ID,'nickname',$update_author);            echo $update_author;         }              /********** End UPDATE ALL POST FIELDS Function **********/      I after inserting the code and adjusting my terms, I saved the file and refreshed my site. The code should update a custom field (Author) for all posts that belong to an author and save the author's nickname into that field. I have a basic search option separately installed that is set to search custom fields. So I tested if the update worked by searching for the nickname of a given author who has 8 posts published. Three of the eight were manually updated and they showed up in the custom field search I did for the author's nickname. Now the other 5 posts did not come up in the search results, which lets me know that all the posts were not updated. Are there any solutions to this? **UPDATE 6-24-11:** I have been searching everywhere in my theme to figure out where to place the solution provided by Bainternet, but no success. I am using the couponpress theme v6.1.4. I have placed the code below in: _header.php, _single.php, system_customfields.php.               //check if data exists. This is checking if the predefined field is empty or not.                                 if ($bizname_field != ''){                                      //if it exists just echo it out                                     echo 'existing value';                                      }else{                                      //if not , update the post meta with your default value and the echo it out.                                      // New Variable Value                                      $newvalue = 'New value here';                                      update_post_meta($post->ID,'custom-field-name',$newvalue);                                      echo $newvalue;                                 }       I am going around in circles and would appreciate some help. Thanks a lot.


title: wp_insert_post - How do I prevent incremental numbers on child pages?

text: I'm using `wp_insert_post` to dynamically generate child pages for a given page using a predefined array of values. The goal is to give each child page the same slug. For example, clicking "Generate Pages" on "example-page" loops through `wp_insert_post` and creates two child pages:               /example-page/about     /example-page/contact      The trouble is that WordPress is adding numbers after the slug on the child pages (because similar child pages have already been created for a different page). My guess is that it's doing a check on slug availability irrespective of the parent/child relationship. I've experimented with trying to run `wp_update_post` after the insertion but to no avail. Any ideas? **UPDATE** Here's a code sample:               $new_page = array(         'post_title' => $child_page["title"],         'post_parent' => $parent_id,         'post_name' => $child_page["slug"],          'post_content' => $child_page["content"],         'post_status' => 'publish',         'post_type' => 'territory'     );           $new_page_id = wp_insert_post($new_page);      Explanation: I am looping through an array of `$child_pages`, in which I've set the unique values for title, slug, and content.


title: Trigger language change in Wordpress

text: I have read this: http://blog-en.icanlocalize.com/installing-wordpress-for- multiple-language-blogs/how-to-localize-wordpress-themes-and-plugins-with- gettext/ Right now, I have qTranslate installed because I could not find a way to "Trigger" to switch to fr_FR. I use qTranslate to "switch" by using `http://mysite.com/page?lang=fr` So, the question is, how do you "trigger" the switch to another language without manually doing the following: `define ('WPLANG', 'fr_FR');`? Best Regards, W