Pulling Post Image Attachments in WordPress 3.9

For some reason the functions I'm using for pulling post images/attachments isn't working after updating to 3.9, has something changed in the way we pull attachments? The code I'm using in single.php               <?php     $attachments = get_children(     array(         'post_type' => 'attachment',         'post_mime_type' => 'image',         'post_parent' => $post->ID     ));     if(count($attachments) > 1) { ?>
             <?php ct_status(); ?>
                             <?php ct_slider_images(); ?>

                         <?php ct_slider_images(); ?>

     <?php } else {         ct_first_image_lrg();     } ?>      Image functions:               /*-----------------------------------------------------------------------------------*/     /* Get the first image attached to the current post */     /*-----------------------------------------------------------------------------------*/          function ct_get_post_image() {         global $post;         $photos = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID'));         if ($photos) {             $photo = array_shift($photos);             return wp_get_attachment_url($photo->ID);         }         return false;     }          /*-----------------------------------------------------------------------------------*/     /* Display first image large */     /*-----------------------------------------------------------------------------------*/          function ct_first_image_lrg() {         $photo = ct_get_post_image();         if ($photo) { ?>         <a href="<?php the_permalink(); ?>">             <img src="<?php echo get_template_directory_uri(); ?>/img_resize/timthumb.php?src=<?php echo ct_get_post_image() ?>&w=945&zc=1" />                  <?php }     }          /*-----------------------------------------------------------------------------------*/     /* Display all images attached to listing */     /*-----------------------------------------------------------------------------------*/          function ct_slider_images() {         $photos = ct_get_images('full');         if ($photos) {             foreach ($photos as $photo) { ?>                 <li data-thumb="<?php echo get_template_directory_uri(); ?>/img_resize/timthumb.php?src=<?php echo $photo ?>&w=500&zc=1">                     <img class="photo" src="<?php echo get_template_directory_uri(); ?>/img_resize/timthumb.php?src=<?php echo $photo ?>&h=400&w=945&zc=1" title="<?php the_title(); ?>" />
             <?php }         }        }


Custom taxonomy auto suggest not working in wordpress admin

I've added to my theme a new custom taxonomy in order to add future filtering capabilities to a custom post type called 'product' (I use the wooCommerce plugin which defines this custom post type).               $labels = array(         'name'                       => _x( 'Types de produit', 'Taxonomy General Name', 'my-child-theme' ),         'singular_name'              => _x( 'Type de produit', 'Taxonomy Singular Name', 'my-child-theme' ),         'menu_name'                  => __( 'Type de produit', 'my-child-theme' ),         'all_items'                  => __( 'Tous les types', 'my-child-theme' ),         'parent_item'                => __( 'Type parent', 'my-child-theme' ),         'parent_item_colon'          => __( 'Type parent :', 'my-child-theme' ),         'new_item_name'              => __( 'Nouveau type', 'my-child-theme' ),         'add_new_item'               => __( 'Ajouter nouveau type', 'my-child-theme' ),         'edit_item'                  => __( 'Modifier type', 'my-child-theme' ),         'update_item'                => __( 'Mettre à jour type', 'my-child-theme' ),         'separate_items_with_commas' => __( 'Séparer les types avec des virgules', 'my-child-theme' ),         'search_items'               => __( 'Rechercher types', 'my-child-theme' ),         'add_or_remove_items'        => __( 'Ajouter ou supprimer types', 'my-child-theme' ),         'choose_from_most_used'      => __( 'Choisir parmi les types les plus utilisés', 'my-child-theme' ),     );          $args = array(         'labels'                     => $labels,         'hierarchical'               => false,         'public'                     => true,         'show_ui'                    => true,         'show_admin_column'          => true,         'show_in_nav_menus'          => true,         'show_tagcloud'              => true,     );          register_taxonomy( 'product_item_type', 'product', $args ); // Add this tax to the post_type 'product' from WooCommerce      Everything is fine with this new taxonomy execpt I can't link easily a product_item_type to a product in the product edit screen. If I begin to write the name of the tag, nothing is suggested. If I click on the "Choose from most used ..." link, an error tells me that "No tag was found". If I enter a tag, then add it, the tag is created, but if I enter the name of an existing tag, this new tag is added with a new slug. I've no error in my JS Console and WPDebug doesn't tell anything :( So, did I forgot something when I created the custom taxonomy or is there something particular to make this work? Thanks


Displaying direct children of other pages on homepage

I am trying to display the DIRECT children of another page on the homepage but I can't seem to get it working it just shows all of the page titles on the site.. It needs to be within a wp_query as I require to use advanced custom fields on the pages My code:               <?php                      $the_query = new WP_Query( array( 'post_type' => 'page', 'parent' => 42, 'child_of' => 0,) );                          while ( $the_query->have_posts() ) : $the_query->the_post();                              echo '
'; the_title(); echo '
';                              echo '
' ; the_field('enter_stuff_here'); echo '
';                          endwhile;                          wp_reset_postdata();                 ?>      My understanding was if I used the ID of the parent that this would show all of the DIRECT children of this page (please note I don't want t o show grandchildren but ONLY DIRECT child pages) Thanks in advance for the help!


How to set global variable in functions.php

I want to be able to echo the URL of the featured image of a post and after looking some on the web I found the following which works fine when I put it in a loop in my front page template.               <?php $thumbSmall = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'small' );     $urlSmall = $thumbSmall['0']; ?>          <?php echo $urlSmall; ?>      However, want to use variable $urlSmall in other places than in the front page template, and this is where my limited coding skills let me down. I tried to just copy paste               wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'small' );     $urlSmall = $thumbSmall['0'];      into my functions.php but that did not work. I need these variables to be globally recognized. What do I do here? write some kind of function?


Wrapping shortcodes in another shortcode

I'd like to wrap existing shortcodes in post content inside a new shortcode that I'm adding to my plugin. The existing content looks like this:                Some text - could be HTML or other shortcodes      ....      [component id=12]      [component id=13]      [component id=14]      ....      Some text - could be HTML or another shortcodes      I'm trying to write a script that will go post by post, extract out any shortcodes of the form `[component id=X]` and wrap them in another shortcode as follows:                Some text - could be HTML or other shortcodes      ....      [components]          [component id=12]          [component id=13]          [component id=14]      [/components]      ....      Some text - could be HTML or another shortcodes      I'm having trouble writing up the regex for this. I'm hoping to use `preg_replace_callback()` to achieve this, but not sure if this is the appropriate function or not.


How do I permanently disable Pingbacks?

How can I permanently disable pingbacks on my wordpress multi user installation? I have disabled access to the wp-trackback.php file through permissions (chmod 000 trackback.php) thinking this would stop any pingbacks from being received. I do not want to run any SQL queries on the posts table, as there is a separate posts table for each blog.


Displaying latest Posts - fixed height - Excerpt vs. Content?

On my static frontpage, I would like to fetch the two latest posts as shown in this link. Now the posts should always be displayed like this (i.e. constant height, limited number of characters), no matter what! If the post uses the more-tag or not - it should always look like in the picture. How can that be achieved? I tried both content and excerpt but somehow there always are cases in which the layout gets messed up. Is there a 'standard' way of doing this? (I'm just asking about getting the actual content, i.e. the "text text text" bit - I have done all the rest) Many thanks


Walker Nav Menu - down arrow for top level, but right arrow for below

I'm using Donald Harvey's solution with Custom Walker_Nav_Menu to show an arrow where submenu items belongs. It worked for me in a project where I had a left sidebar vertical menu. But when I'm utilizing the code for a top nav menu with a drop down menu for the subs, and I incorporated Font Awesome icon as an arrow, the problem is:               Home | Level 0 ▼ | Services | Works          +-----------+          | Level 1   |-----------+---------+          | Level 1 ▼ | Level 2 ▼ | Level 3 |          +-----------| Level 2   |---------+                      +-----------+      You can understand that, **from Level 1** to all the children, the arrow should not point down, but should point right (`►`) as my submenus are not opening from below, but on the right. So how can I modify this to show the desired arrows in place?               if ( !empty( $children_elements[$element->$id_field] ) ) {           $element->classes[] = 'arrow';          $element->title .= '';     }


Varying Search Result Pages

I have two different kinds of search results on my site and I'd like to change the look of the search result page entirely. I've played around with the search form a bit but I'm unsure how to force it to redirect to an alternate search.php Any help would be appreciated               <form role="search" method="get" id="searchsupport" action="/">         <label class="screen-reader-text" for="s">Search for:</label>         <input type="text" onfocus="if (this.value == 'Search')           {this.value = '';}" onblur="if (this.value == '')           {this.value = 'search';}" id="s" name="s" value="search" class="search-form round">          <input type="hidden" id="searchsubmit">          <input type='hidden' name='post_type' value='software, documents' />     </form>


Remove specific product from shop in woocommerce

I have product category named "Test_category" in my shop. Specifically for that i want to hide this all product from my shop, Only hide for some time not delete or set status as pending from admin. Regards.


added a meta box to post however when saving menu while debug on throws a warning

I've added several meta boxes to post and the function that suppose to save those boxes. When i save menus ( appearance -> menu). it throws a warning for each added menu or sub menu `Notice: Undefined index: image_price_variation in /home1/xxx/public_html/xx/wp-content/plugins/xxx-shopping- cart/xxx_metabox_functions.php on line 89` Although i am saving menus and not posts. Here is a short version of the code:               function add_custom_meta_boxes() {            /*  Adding price meta box to post   */     add_meta_box(           'oap_price_box',           'Product Price',           'oap_price_mockup',           'post',           'side',         'high'     );           // ...      }     add_action('add_meta_boxes', 'add_custom_meta_boxes');          /* Prints the price  html mockup */      function oap_price_mockup( $post ) {     wp_nonce_field( plugin_basename( __FILE__ ), 'image_price_variation' );     $productPrice = (double)get_post_meta( $post->ID, 'productPrice', true );     $html  = '$ <input type="text" size="7" name="productPrice" placeholder="price" value="'.(($productPrice != '') ? $productPrice : '').'" />';         echo $html;     }          function save_meta_boxes_post_data( $post ) {         // verification     if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )          return;          if ( !wp_verify_nonce( $_POST['image_price_variation'], plugin_basename( __FILE__ ) ) ) // - This is line 89 ..         return;          if ( 'post' == $_POST['post_type'] ) {         if ( !current_user_can( 'edit_post', $post ) )             return;     }          $post_ID = $_POST['post_ID'];          /*  Saveing Price*/     if(isset($_POST['productPrice']) && $_POST['productPrice'] != ''){         $price = (double)sanitize_text_field( $_POST['productPrice'] );         update_post_meta($post_ID, 'productPrice', $price);     }          }     add_action( 'save_post', 'save_meta_boxes_post_data' );      The error comes from the nonce field not being presented however doesn't WP separate between post saving to menu saving ? if so is there something i could do to change mine to do that?


Adding Google Custom Search to a Public Released Theme

I'm not sure if this is possible with the newer Google AdSense code which has the AdSense server holding all the colour settings etc... via an ad channel, but maybe there's a legacy code that will work. Publicly released AdSense theme (used by thousands of AdSense publishers) I'd like to add a Custom Google Search box where the template files deal with all settings except the pub-number (added on options page). I've had the code working for years with Google content ad units and Google search ad units using the old legacy code (users add their pub-number and it works without having to setup an ad in their AdSense control panel, the old legacy code holds all the colour settings etc..., editable via options) and now I'm looking at also adding the newer custom search box I recall receiving an email from Google AdSense one of my sites that does use the old search box code won't work soon. The problem is the new code looks like this:               <form action="http://www.google.com/cse" id="cse-search-box" target="_blank">       <div>         <input type="hidden" name="cx" value="partner-pub-1234567890:uniquechannel" />         <input type="hidden" name="ie" value="ISO-8859-1" />         <input type="text" name="q" size="31" />         <input type="submit" name="sa" value="Search" />       </div>     </form>     <script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script>      I'm assuming uniquechannel references the ad channel (it's not the actual channel ID, but must be based on it). I've tried removing the ad channel, but get a bad request. The closest I can get to what I want is a user creating their own ad like the one above and either pasting the uniquechannel code in an option box, but then it would use whatever colours they selected when they setup the ad not the ones I'd setup to match in with the theme. I have a feeling there isn't a way around this, but since finding this site I've been really impressed with the code I'm finding here (solved loads of problems I've been stuck on), so worth a try :-). David


cannot update wordpress from 3.4.2 to 3.5

I am trying to update wordpress from 3.4.2 to 3.5 . However, when I update, I get my old version 3.4.2 back. What could be causing this? When I click on update it shows all the steps but in the final step it gives back the 3.4.2 screen and the version remains un updated.


Comment Moderation / Profanity filter

I'm using bbPress to create a forum. I need to use content moderation or a profanity filter. I don't want to moderate every post before it's posted just those that contain words that are in the list of profanity words. Wordpress has a comment moderation list but if a word in the list is used the post is added to the moderation queue for moderation but the user gets no message what has happened. If the user uses a word that is in the list I would like the post to be added to the moderation queue for moderation but the user to get a message wheat has happened. I can't find a plugin to do this so I was thinking if it would be possible to add this functionality in a plugin. Is there an action hook I could use to hook into the comment moderation process so I could display a message


Root level category, tag, author and archive pages to work

I want root level Wordpress urls to work for category, tag, author and archive page. For example right now categories pages are.               domain.com/category/cat-name/      it shows posts under cat-name category. But if someone visits               domain.com/category/      it shows 404 error, page not found. I want all these URLs to show some unique content created specifically for each link.               domain.com/category/     domain.com/tag/     domain.com/author/     domain.com/archive/      How can we do that?


What are the additional fields in wp_comments used for?

I'm working on a rather odd implementation that stretches the limits of WP a little - its a healthcare site where patients are a custom post type and procedure requests related to each patient are stored in comments on that post. I started off by storing alot of data in commentmeta, but I want an easier way to access it than having to pull from a meta table. I'd also like to be able to use the built-in functions where available ( **wp_insert_comment** can set most of the fields in wp_comments table through the arguments passed to it). My question is - where are these other values set and accessed in WordPress? Specifically, I'm curious about:   * comment_karma   * comment_type   * comment_approved I have one meta value I want to set, which I'm hoping to use `comment_type` for. I also want to set a flag on each request to show whether or not it has been confirmed and responded to. It seems like `comment_karma` would work well for this, as it is completely unsused, although I'm not sure if it can be set directly with **wp_insert_comment**. Are there any consequences I should be aware of when doing this? Would I be better off just adding additional columns to the table, or does this approach sound like it would work?


Dashboard search function doesn't work well

I have a CPT called "participants". When I visit it in the dashboard and search for one of the posts belonging to this CPT (I search a work which is part of the title of an existing post), WP doesn't find anything, although the post is right in the list, containing the work I'm searching. Why the search function doesn't work in this case? Here's how I created my CPT:               function my_custom_post_participant() {         $labels = array(             'name'               => _x( 'Participants', 'post type general name' ),             'singular_name'      => _x( 'Participant', 'post type singular name' ),             'add_new'            => _x( 'Add New', 'participant' ),             'add_new_item'       => __( 'Add New Participant' ),             'edit_item'          => __( 'Edit Participant' ),             'new_item'           => __( 'New Participant' ),             'all_items'          => __( 'All Participants' ),             'view_item'          => __( 'View Participant' ),             'search_items'       => __( 'Search Participants' ),             'not_found'          => __( 'No participants found' ),             'not_found_in_trash' => __( 'No participants found in the Trash' ),              'parent_item_colon'  => '',             'menu_name'          => 'Participants'         );         $args = array(             'labels'        => $labels,             'description'   => 'Holds our participants and participant specific data',             'public'        => true,             'menu_position' => 4,             'supports'      => array( 'title', 'custom-fields' ),             'has_archive'   => true,         );         register_post_type( 'participant', $args );      }     add_action( 'init', 'my_custom_post_participant' );          function my_updated_messages_participant( $messages ) {         global $post, $post_ID;         $messages['participant'] = array(             0 => '',              1 => sprintf( __('Participant updated. View participant'), esc_url( get_permalink($post_ID) ) ),             2 => __('Custom field updated.'),             3 => __('Custom field deleted.'),             4 => __('Participant updated.'),             5 => isset($_GET['revision']) ? sprintf( __('Participant restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,             6 => sprintf( __('Participant published. View participant'), esc_url( get_permalink($post_ID) ) ),             7 => __('Participant saved.'),             8 => sprintf( __('Participant submitted. Preview participant'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),             9 => sprintf( __('Participant scheduled for: %1$s. Preview participant'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),             10 => sprintf( __('Participant draft updated. Preview participant'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),         );         return $messages;     }     add_filter( 'post_updated_messages', 'my_updated_messages_participant' );      Please note that I altered search function using this code in functions.php:               add_filter( 'pre_get_posts', 'tgm_cpt_search' );     function tgm_cpt_search( $query ) {         if ( $query->is_search )         $query->set( 'post_type', array( 'page') );         return $query;     };


Is it possible to add custom business logic to a Custom Post Admin Edit Page?

I have a custom post type that has a few fields that accept amounts. Each amount is editable. I would like to display the total of these amounts in another non-editable field on the same Custom Post Admin Page. Is this possible?


Have image slider display only on home page

I have placed a image slider in wordpress theme, however it is showing on all pages. I only want it to show on my home page. This is the code I have for it in my header.php childtheme               <?php     /**      * The Header for our theme.      *      * Displays all of the  section and everything up till
      *      * @package GovPress      */     ?><!DOCTYPE html>     <html <?php language_attributes(); ?>>          <meta charset="<?php bloginfo( 'charset' ); ?>">     <meta name="viewport" content="width=device-width, initial-scale=1">     <title><?php wp_title( '|', true, 'right' ); ?></title>     <link rel="profile" href="http://gmpg.org/xfn/11">     <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">          <?php wp_head(); ?>               <body <?php body_class(); ?>>
              <?php do_action( 'before' ); ?>

<?php _e( 'Menu', 'govpress' ); ?>
                 <?php _e( 'Skip to content', 'govpress' ); ?>                      <?php wp_nav_menu( array('theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>

 <?php echo do_shortcode('[sp_responsiveslider limit="-1"]'); ?>

                      <?php if ( get_header_image() ) : ?>                     <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">                         <img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="">                                      <?php endif; // End header image check. ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?>

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

                       <?php if ( is_page_template('templates/home-page.php') ) {             get_template_part( 'templates/above', 'home-page' );         } ?>


Why do I get accidental comments without (the required) email address?

Somebody translated one of my tutorials here (with my permission). All fine but I got comments that seem unintended on two of my tutorials that the translation links to. Now the weird thing is that they don't have an `comment_author_email`! I tried to post a comment on one of my tutorials (browser logged out) without specifying an email address and I couldn't (that's how it should be). I am using the Anti-spam plugin which -so far- did an outstanding job for me. Does anybody understand what's going on? Should I worry about my site being/getting hacked? What should I do? Thanks in advance! ![enter image description here](http://i.stack.imgur.com/gzD2n.png)


Pagination/infinite scroll with WP_Query and multiple loops

I need that the main page of my site have 3 columns: - The first having the 5 most viewed posts; - The second with the next 5 most viewed posts; - The third with the most recent posts. I don't want the posts to be never repeated in the same column or another column, so I'm using wp_query to get the posts I want, in the number I want. Here's what happens when I load the second page, either using simple pagination or infinite scroll:   * The first loop loads the 5-10 most viewed posts, which was already displayed on the first run of the second loop;   * The second loop loads next 5 most viewed posts, which some has already been loaded on the third loop when it ran the first time;   * The third loop loads the most recent posts and which wasn't been loaded on the first or second loops. While I still loading the next pages, the loops loads the respective posts until I get any posts on the third loop, then have no posts in the second loop, and have all posts loaded into the first loop. Here's the code I'm using:

          <?          $hotArgs =  array(         'post__not_in' => $loaded,         'meta_key' => 'wpb_post_views_count', // Pega o número de visitas do post.         'orderby' => 'meta_value_num', // Ordena do mais visitado para o menos visitado.         'posts_per_page' => '2',         'paged' => $paged         );     $hot = new WP_Query( $hotArgs );               if ($hot->have_posts()) : while ($hot->have_posts()) : $hot->the_post();     $loaded[] = $post->ID;     ?>

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

          <?php endwhile; endif; ?>

          <?     $nextArgs =  array(         'post__not_in' => $loaded,         'meta_key' => 'wpb_post_views_count', // Pega o número de visitas do post.         'orderby' => 'meta_value_num', // Ordena do mais visitado para o menos visitado.         'posts_per_page' => '3',         'paged' => $paged         );      $next = new WP_Query( $nextArgs );          if ($next->have_posts()) : while ($next->have_posts()) : $next->the_post();     $loaded[] = $post->ID;      ?>

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

          <?php endwhile; endif; ?>

          <?       $recentsArgs =  array(         'post__not_in' => $loaded,         'posts_per_page' => '3',         'paged' => $paged         );      $recents = new WP_Query( $recentsArgs );          if ($recents->have_posts()) : while ($recents->have_posts()) : $recents->the_post();     $loaded[] = $post->ID;     ?>

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

          <?php endwhile; endif; ?>

      I think that the solution could be use a php session or variable that stores the id of the posts that have been already loaded, and in the loops check if the posts have been or not loaded before it continues. I tried to make this but it didn't work. I have too little skills on php, and maybe someone could have a better idea in how to make it work. I appreciate any help. Thanks.


How to set hierarchical terms to a post using wp_set_object_terms

I have a hierarchical custom taxonomy called "locations". The parent categories are country names, the child categories are the territories under the country. How can i attach these terms to a post programatically?               $country = 'Egypt';     $territory = 'Hurghada';      So, if the Egypt category doesn't exist, i need to create it, and i need to attach the $territory in a subcategory under Egypt. This is where i am so far:               $post_id = 10;          $country_term_id = term_exists( $country, 'locations' );          if ($country_term_id !== 0 && $country_term_id !== null) {         wp_set_post_terms($id, $country,'locations');     } else {         //I guess this is where i need to set the territory?     }


Get user logged in status from within a plugin. $current_user not defined

I'm writing a plugin which adds a class that creates an endpoint for third party software to make API calls to and check if the current user is logged in. Here's a stripped down version of what I'm doing.               class API_Endpoint{              public function __construct(){             add_filter('query_vars', array($this, 'add_query_vars'), 0);             add_action('parse_request', array($this, 'sniff_requests'), 0);             add_action('init', array($this, 'add_endpoint'), 0);              }                 //other functions...              protected function send_response($msg, $uid = ''){                  global $current_user;                  $uid1 = get_current_user_id();             $uid2 = $current_user->ID;                  $response['message'] = $msg;             $response['uid1'] = $uid1; //always = 0             $response['uid2'] = $uid2; //always = 0             $response['login_status'] = ( is_user_logged_in() ) ? TRUE : FALSE ; //always = false             header('content-type: application/json; charset=utf-8');             echo json_encode($response)."\n";             exit; //prevents the rest of Wordpress from running....         }     }          new API_Endpoint();      I'm logged in when I test this... As you can see from the comments in the code, `$current_user` doesn't seem to be defined, nor is `is_user_logged_in()` working. Any ideas why? It's my understanding that these should be working by the time of the `init` action hook.


Constructing An if Statement with is_category(); in archive.php

I am trying to use an if statement with is_category() in order to build a bigger piece of code later. I can't get the code to recognize the if statement though. Basically below I've posted the coding with the if statement commented out. It works without the if statement but if I uncomment the if statement (and the closing curly bracket) then there is an error and the page doesn't display. I am only checking this on a category page so I assumed it should recognize that it is a category page and display the posts (I can understand it being a problem if I was on a 'tag' archive page, etc.). Why would this have a problem displaying?               <?php     /*if (is_category()) {*/     if ($paged == 0)       $offset = 0;     else       $offset = ($paged - 1) * 11;     global $post;     $category = get_the_category($post->ID);     $category = $category[0]->cat_ID;     $myposts = get_posts(array('numberposts' => 11, 'offset' => $offset, 'category__in' => array($category), 'post__not_in' => array($post->ID),'post_status'=>'publish'));     foreach($myposts as $post) :     setup_postdata($post);     /*}*/     ?>


Allow users to create their own page/s

I Create a network where any register user have a profile, from user profile i want enable user to create own page/s where he can post like Facebook. There is a way to do this with wordpress or i must create it ad hoc? I have see wordpress Multisite can it a solution?


Why would WordPress request FTP information when it can write to the file server?

I don't think this is a duplicate, although I've seen similar questions on here. I have added my primary SSH/FTP user and the user `nobody` to a group called `webserver`, then I ran a `chown -R .webserver /var/www` so that both FTP and Apache would be able to write to the file system. I know that PHP can write to the server -- I can upload an image using the Media Library. However, when I go to install a plugin, it prompts me for my FTP credentials. If I add `define('FS_METHOD', 'direct');` to wp-config.php, this goes away and plugins install without an issue. Why would this happen, though? According to the Codex, the preferred method is direct, and it's _able_ to manipulate the file system directly. So what would make it prompt for FTP instead? Thanks! **EDIT** : I took a look at the source for how it determines what file system method to use (`wp-admin/includes/file.php`, line 933), and I figured out that it can create a test file, but the owner does not match the processor's UID. Taking a look at the PHP manual for `getmyuid()` and `fileowner($file)`, it seems that, instead of using `getmyuid()`, it _should_ be using `posix_getuid()`. Any idea why the developers would use the former? **EDIT 2** : Noted in WordPress bug tracker: https://core.trac.wordpress.org/ticket/10205


Show comments from multiple post IDs in comment template

This may sound like an unusual request but I am try to display comments from several related posts in a single comment template. For example I have several posts on the same topic (`IDs 253, 724, 798`) and I want all comments from these posts to appear next in a continuous thread. So if I am viewing post `ID 724` I can also see the comments from posts `253` and `798`. Can I pass multiple post `ID`s to the comments template to achieve this does this require a custom query before or after the comments template to show all the comments in a merged thread?


grab or load text on demand

## What i want to do I want some content (could be stored any where in a post or custom field) to load only when the user clicks for it to load. This content could be any thing (text,images,html etc) and this may be accomplished through any way (eg ajax, shortcode) i don't mind. ## Specification what i don't what to do is let the content be loaded before hand, be hidden and be displayed when demanded. It has to only load when its wanted or demanded.


Fixed height of the_content()

I have page with news. I'm displaying them as a shortened text (300 chars limit), I'm removing any images using preg_replace() and everything looks fine, until someone uses line breaks in his post. Things gets messy then and my height is way to high sometimes. Ofc I'm using `overflow: hidden;` but its not as good as I would like it to be. Is there a way to trim out those spaces, remove `<strong>` if someone uses it etc.? So my news page looks always as awesome as it should? Cheers


Local wordpress setup with SPAM in the incoming links dashboard section?

I am developing a website on my localhost and i just notice a bunch of incoming links in the dashboard's incoming links section, which doesn't look valid. When i visit the urls i don't see a reffer to my localhost/domain.com. the only plugin i had active was "Regenerate Thumbnails". I disabled the plugin but i can still see the links. How can i fix this? regards


Best way to include jQuery and fire with script at bottom of container

I'm going to be using a jQuery slider on my homepage only (not a WP plugin, but a third party). What I'd like to do is include jQuery, the plugin's jQuery script using a .js file, then include the script needed to fire the plugin right before the closing body tag. I'm a bit confused about how that works. I know WordPress comes with jQuery built in, so does that mean I don't need to include it again? Looking for best practices on this. I understand there are conflict issues that need to be prevented, etc. Thanks


How to remove div container in custom menu?

all                      As per my html theme structure i do not want to add my menu

 under
.      I am using                <?php wp_nav_menu( array( 'menu_class' => 'tlm', 'theme_location' => 'primary-menu' ) ); ?>      By default this wrap my menu with div. like

Dashboard

Patients

Patients

Add Patients

Calender

Images

Support

Logout

      How to remove div container in custom menu ? as i can think there may be need some change in wp_nav_menu() function array.


wordpress plugin noob situation

Hay I am creating my first wordpress plugin. Everything is going well so far. I have been able to add a new navigation tab to the dashboard which links to a function which basicalliy uses 'include' to spit the content of a HTML page onto the wordpress admin area. Heres my code               add_action('admin_menu', 'rooms_menu');          function rooms_menu() {         add_menu_page('Rooms', 'Rooms', 'read', 'rooms-admin', 'show_hotel_dashboard', '' , 9);     }          function show_hotel_dashboard(){         include 'dashboard.html';     }      pretty straight forward, the dashboard.html page is a very simple html page. Now, heres my issue, within this dasboard.html page, how do i link some links to functions? Say i have a link which is               Do action      when i click that link it actually goes to do_action.php not the action within my plugin. Any ideas?


Changing the Order of Admin Menu Sections?

I am getting a bit frustrated over here after having spent a few hours trying to accomplish this fairly simple task without any luck. Essentially I have 5 custom post types which I created and all I want to do is show each of them in a specific order directly under the _"dashboard"_. From the WordPress documentation it seems that you can't really do this because the highest menu order seems to be "5". And above L I am guessing some expert reading this can show me the simple way that I can order the admin menu exactly the way I want to by utilizing the functions file and without utilizing a plugin (which I know exists). Please go ahead and try to create 5 separate post types and include them in a specific order directly under the dashboard... it seems this is not possible.??... is there some type of jquery hack to make this work that someone could share with me or preferably without utilizing jQuery?


Make the plugin directory recognize new version numbers

I updated readme.txt Stable Tag and tagged versions 0.2, 0.3 and latest 0.3.1 in SVN. After checkin, the new version is recognized only partly:   * On the dev-tab it links to the latest version (0.3.1) in the svn repository.   * The link-text still reads "0.1"   * The download button reads "Download Version 0.1"   * All other versions are listed under "other versions" Plugin: http://wordpress.org/plugins/geouri/developers/ **Question** : How to make the directory recognize version 0.3.1 ?


caption shortcode inserts blank paragraph

> [NOTE: Cross-posted from wordpress.org/support/topic/caption-shortcode- > inserts-blank-paragraph to see which site gets a better answer. :] I am setting up a new blog, no plugins yet. I inserted a photo in to a post, align right, with a caption. When I view the post in The zen light theme or the default theme I get a blank paragraph rendered above the image. Why is that and how can I change that? See: http://www.the99ers.net/2010/09/hello/ The relevant code reads: `<p><div id="attachment_19"` Basically, I am pretty sure I want to drop the outer `<p>` and just have the `<div>` float where it needs to go. Why is it doing what it is doing and how can I make it down what I want? Thanks! Sincerely, -danny


How to access my site using IP Address?

I would like to know how to access my website using Ip address instead of domain. Like 173.252.100.16 can used to access facebook. My Website is: www.jijojose.me Server have multiple websites hosted.


How to validate register settings array

I would like to know how to perform a proper validation with the `register_setting()` callback function. Here is a sample part of my code I want to work with:               register_setting( 'wpPart_options', 'wpPart_options', array( &$this, 'wpPartValidate_settings' ) );      `$this` is an array of objects. And here is the content of my `wpPartValidate_settings();` function.               public function wpPartValidate_settings( $input ) {             $options = get_option( 'wpPart_options' );        if ( check_admin_referer( 'wpPart_nonce_field', 'wpPart_nonce_verify_adm' ) ) {           return $input;        }          }      Since `$input` is an array, how can I perfom a proper validation on every input that comes to the validating function? I would like, for example, to perform a `strlen()` check on a text field :               if ( strlen( $input ) != 20 )        add_settings_error( 'wpPart_options', 'textField', __( 'TextField incomplete.', 'wpPart' ) , 'error' );


Splitting an Evolving Site into Multiple Sites, or Maintaining as One Site?

## To Separate or Not to Separate...That is the Question? I currently have what I believe is a mistake in my site architecture. I initially built my two lines of business into the same site. Engineering/Design work and Equipment Liquidation. Learning the hard way I realize I need dedicated domains. I plan to use the same look and feel for both but have 2 separate domains/subdomains. The question is should I install a separate instance of WP for each or simply build it in the same structure with a different landing page and limited navigation between each. Obviously the latter is easier initially but I am concerned this would cause further difficulty later. Anyone have experience with this sort of situation? The theme I am using will support this but I am not convinced it is a good plan. Feel free to look at the site http://realitycramp.com, just be gentle in terms of criticism as it is a work in progress. **Amazed at the quality of contribution on this site.** MM/RC


Which modification to login only certain role?

I have created a special role in WP admin and now I would like to allow to login to certain frontend page only people with this role. How to do that? I still want be able to login for all people for other areas.


Maximum protection without using password/login

I want to hide my WordPress site (or any website) from the world and only allow certain users to enter. What's the best way of doing this without setting up user accounts and passwords? Or perhaps more precise, what's the maximum protection I can get without using accounts? Of course, I've chosen to block search engines under settings->privacy already. But I've thought about blocking people from linking directly to images and files, how can that be done? Is it by putting all the uploads (files/images) in a hidden folder somewhere outside of the WP structure? How do I do that? Thanks!


Why is the loop not empty on some 404s?

I came across a weird issue. Say you access a random url, three or more levels deep:               http://example.com/a/b/c     http://example.com/a/b/c/d     ...      Then `is_404()` is `true`. So far so good. But for some reason the last posts are queried.               $wp_query->request      is               SELECT SQL_CALC_FOUND_ROWS wp_posts.ID          FROM wp_posts          WHERE 1=1              AND wp_posts.post_type = 'post'              AND (                 wp_posts.post_status    = 'publish'                  OR wp_posts.post_status = 'private'                 )          ORDER BY wp_posts.post_date DESC          LIMIT 0, 5      Which then of course makes `have_posts()` return `true` and so on. Can someone explain this? What I found out so far: The reason that only kicks in at three or more levels deep is that before that WP looks for posts and attachments which somehow results in some other behaviour. It seems that even though WP recognises the request as a 404 at one point it then fetches the most recent posts. With the help from @kaiser and @G.M. I've tracked this down to somewhere from /wp-includes/class-wp.php:608


Change wordpress website into android app

I have recently joined a startup company as an android developer. Recently that company has made an e-commerce website in woocommerce a plugin in wordpress. Now customer want an android app for this site. I have analyzed database and files created by woocommerce . It is very complex and I could not understand that complex file and database structure. So please guide me how to use that same database for android app. And please tell is there any free or less expensive plugin available that convert website into android app.Help me please.


Transient api Caches confused

This code works for page 1               <?php                 $paged1 = (get_query_var('paged')) ? get_query_var('paged') : 1;                 $recent1 = get_transient( 'recent1' );                                     if ( false === $recent1) {         $recent1 = new WP_Query ('cat=3&posts_per_page=5'.'&paged='.$paged1);         set_transient('recent1', $recent1, 60*60);         }         // do normal loop stuff         if ($recent1->have_posts()) : while ($recent1->have_posts()) : $recent1->the_post();         ?>
<a href="<?php the_permalink () ?>" rel="bookmark">
<?php the_title (); ?>
      <?php the_post_thumbnail(array(100,100), array('class' => 'alignleft')); ?>      <?php the_advanced_excerpt(); ?>      But there is a problem with pagination. Page 1 confused with page 2 or page 3 and etc. On page/2 there is content of page/1 or on the contrary. How to resolve this ?


wp_register_script Question

I need to add the following JS to the head, but I don't know how to add the "data-cfasync="false" " by using "wp_register_script" or "wp_enqueue_scripts". Please help!!               <script data-cfasync="false" type="text/javascript" src="http://use.typekit.com/YOUR-KIT-ID.js"></script>     <script data-cfasync="false" type="text/javascript">try{Typekit.load();}catch(e){}</script>


functions.php and conditional tags

I'm having the following issue:   some conditional tags do not work on the functions.php file. For example I'm trying to do the following:               if ( is_home() ) :         wp_enqueue_script('accordeon_setup', '/wp-content/themes/44db/js/scripts-accordeon.js');     endif;      and although the site produces no error I cannot see the script in the home page.   The same thing happens with the following conditional tag:               if ( $post->post_parent == '12' ) :      Is there something I'm missing?? Both conditional tags run at the bottom of the functions.php Thank you people !!!


Property value of null when value is assigned inside a method hooked to the wp action hook

In `my_method()` below, I'm assigning an array of post IDs to the property `$this->post_ids` which is to be used later on in my query args - see `process()`. If I hook `my_method()` to the `init` action hook, things work but if I hook `my_method()` to the `wp` action hook, things don't work. When `my_method()` is hooked to `wp`, doing `var_dump( $this->post_ids )` inside `process()` displays `null`. When `my_method()` is hooked to `init`, doing `var_dump( $this->post_ids )` inside `process()` displays `Array[15]`. -               public function __construct() {         // This works         add_action( 'init', array( $this, 'my_method' ) );              // This doesn't work.         add_action( 'wp', array( $this, 'my_method' ) );              add_action( 'wp_ajax_myaction', array( $this, 'process' ) );         add_action( 'wp_ajax_nopriv_myaction', array( $this, 'process' ) );     }      -               public function my_method() {         $this->post_ids = explode( ',', '69,70,71,72,73,80,86,89,90,91,92,93,94,96,169' );     }      -               public function process() {              $args = array(             'offset' => 10,             'post_type' => 'post',             'post__in' => $this->post_ids         );              $this->query = new WP_Query( $args );              // Process the query results here...     }      **Background info:** The `process()` method handles data sent via an AJAX request. After processing, it sends a response to the browser. For example: `echo json_encode( $response )` **My question:** Inside `process()`, why is the value of the `$this->post_ids` property:   * `null` when I hook `my_method()` to `wp`   * `Array[15]` when I hook `my_method()` to `init`? I don't understand why it is different. **Update:** The value of `$this->post_ids` is `null` only inside the `process()` method. Could this be because `process()` is running during an AJAX request?


problem of path with xml file

i'd like to import a flash audio player in my wordpress theme, the import of the file works fine because it shows up on screen, responds to the click on play/pause, but the sound does not start. edit : i found out the path has to be modified in the .as file, with the right path. Thanks sancho All the files are in : /Applications/MAMP/htdocs/wordpress/wp- content/themes/maVersion/ and the mp3 are in : /Applications/MAMP/htdocs/wordpress/wp- content/themes/maVersion/audio i'm in local, so i tried with the whole path (see the first line) or with a "normal" path (like the second line - i made 2 tests for both examples) :               <?xml version="1.0" encoding="utf-8"?>     <PLAYLIST>     <SONG URL="/Applications/MAMP/htdocs/wordpress/wp-content/themes/maVersion/audio/dance.mp3" TITLE="First Track - Dance" ARTIST="John Doe" />     <SONG URL="audio/audio.mp3" TITLE="Second Track" ARTIST="Random Singer"/>     <SONG URL="audio/dance.mp3" TITLE="Third Track" ARTIST="Super Generic Singer"/>     </PLAYLIST>      but still no sound. Does anybody know what the solution is? Thanks Paul


Formatting with <pre>

I'm building a site that doesn't want any styling applied to the entry- content, because it should keep the formatting of the text. Bizarly, it works on old entries, but new entries via the front-end system fail: `http://madebylars.nl/music/?page_id=373` ### Example: This one works:               http://madebylars.nl/music/?tab=the-tallest-man-on-earth-love-is-all      This one doesn't:               http://madebylars.nl/music/?tab=the-tallest-man-on-earth-like-the-wheel      They both look fine in the WordPress back-end, but only one of them looks nice on the front-end. Any thoughts on how to fix this? I'm already wrapping the whole text in `<pre>` tags and stripping wp-content of html-tags. This is the styling I use (on both!):               pre {         background: none;          font: 13px "Courier 10 Pitch", Courier, monospace;         line-height: 1.5;         margin-bottom: 1.625em;         overflow: auto;         padding: 0.75em 1.625em;         display: block;         font-family: monospace;         white-space: pre-wrap;         letter-spacing: normal;         word-wrap: break-word;         word-spacing: normal;         word-break: normal;         margin: 1em 0px;     }


Include Custom Post Type Archive in wp_list_pages

I am wondering how to include a custom post type archive in wp_list_pages. If there were a page ID, I could simply attach that page to the list using the 'include' argument. I know that there is a 'post_type' argument as well... but that will only list the posts, not the archive, and I need this link to be inserted alongside pages. Is there any way for me to pull this off? Here is the code I'm using:               $parentID    = get_top_parent_id($post->ID);     $parentTitle = get_the_title($parentID);     $parentLink  = get_permalink($parentID);          $args = array(         'child_of' => $parentID     );          $pages = get_pages($args);          if ($pages) {              $pageIDs = array();              foreach ($pages as $page) {             $pageIDs[] = $page->ID;         }              $args = array(             'title_li' => '',             'include' => $parentID . ',' . implode(",", $pageIDs)         );              wp_list_pages($args);          }      **UPDATE** Since it seemed like I wasn't going to be able to solve this the way I wanted to, I ended up taking a different approach. I found the question "Display a portion/ branch of the menu tree using wp_nav_menu()" and Rarst's answer is pretty amazing. Below is my little bit of code for creating the sidebar menu that I needed (I use WPML - hence the ICL_object):               <?php     /*      * PAGE SIDEBAR      *     */          $parentID   = get_top_parent_id($post->ID);     $parentLink = get_permalink($parentID);          if ( is_singular( 'custom_post_type_NAME' ) ) {         $cptParentID = icl_object_id( 77, 'page', false );         $parentTitle = get_the_title($cptParentID);     } else {         $parentTitle = get_the_title($parentID);     }          $navArgs = array(         'menu'    => 51,         'submenu' => $parentTitle,         'items_wrap' => '%3$s',         'container' => false     );          ?>

                 <a href="<?php echo $parentLink; ?>" class="widget-title" title="<?php echo $parentTitle; ?>"><?php echo $parentTitle; ?>

                     <?php wp_nav_menu($navArgs); ?>


tax_query: What to pass when I want to have all terms?

…               $args = array(         'post_type' => 'wr_event',         'posts_per_page' => -1,         'meta_key' => 'event_date',         'orderby' => 'meta_value_num',         'order' => $order,         'meta_value' => $yesterday,         'meta_compare' => $compare,         if ( is_null($cat) )             'tax_query' => array(                 array(                     'taxonomy'  => 'event_type',                     'field'     => 'slug',                     'terms'     => $cat,                     'operator'  => 'IN'                     ),                )     );      I'm confused, what do I pass in order to get all posts from all terms? Right now I can for instance pass `sports` in order to get all sports-events, but how do I get all events? I know I could just get rid of the `tax_query()` however I'm using this as a param, where I can pass along a certain tax or if not, i want all posts.


Restrict query_posts by Date?

To display the most popular posts based on page views I am using this code (source):               <?php         query_posts('meta_key=post_views_count&orderby=meta_value_num&order=DESC');         if (have_posts()) : while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
         <?php         endwhile; endif;         wp_reset_query();     ?>      I would like to restrict the query to return posts from a certin date (i.e. the last seven days) and I am unsure how I would achieve this.


Loops in category description

I would like your help to find how to do a thing I need: I have some posts, for example:   * Article Title: Banana   * Article Title: Orange   * Article Title: Lemon   * Article Title: Strawberry All this articles need to have breadcrumb like this: Home > Fruits > #Title# In the "Fruits" category page I would like to create something like this: # Yellow Fruits (and a list of all articles about fruits that are yellow) # Orange Fruits (and a list of all articles about fruits that are orange) # Red Fruits (and a list of all articles about fruits that are red) To do this, I think in the description of category I should write manually the titles (Yellow Fruits, Orange Fruits, Red Fruits), and under each title I should put a loop to put all articles that have a specific tag (for example to the article called "Banana" I will give a tag "yellow"). Do you think it can work? do you have other ideas? Thank you very much


**PROBLEM:** I'am trying to prevent execution of default WordPress query for custom category template. I have found a possible solution, but looks like it preventing execution of all post queries:               function _cancel_query( $query ) {         if ( !is_admin() && !is_feed() && is_search() ) {             $query = false;         }         return $query;     }     add_action( 'posts_request', '_cancel_query' );      Source: http://vadimk.com/2010/05/11/disable-wordpress-search-query/ '@query->is_main_query()' won't work with 'posts_request' action. Is there any elegant way to prevent ONLY default WordPress query, allowing my code to handle getting posts, without performing useless operations? **WHY:** _I have to get featured posts, then fixed amount of normal posts without duplicate content, which implies that post query relies on featured query results, because there is no guarantee that in post query i find enough featured posts to populate featured box. And after all that i will have to add AJAX pagination - still without duplicate content._ **EDIT #2:** If you trying to perform WP_Query in 'pre_get_posts' as Rarst suggested (How to prevent execution of default query, while preserving ability to use WP_Query in template?): "pre_get_posts runs before WP_Query has been setup. Some template tags and conditional functions that rely on WP_Query will not work. For example, is_front_page() will not work, although is_home()will work. In such cases, you will need to work directly with the query vars, which are passed to the pre_get_posts hook as an argument ($query in examples on this page)." Source: https://codex.wordpress.org/Class_Reference/WP_Query WP_Query will be initialized at this stage, before main query, and to avoid result like this ( check out log ) you have to wrap it :               if ($query->is_main_query()) {         $args = array();         $query = new WP_Query( $args );     }      **LOG:**               [30-Apr-2013 17:07:12 UTC] PHP Fatal error:  Maximum function nesting level of '100' reached, aborting! in C:\Users\serwis\Dropbox\www\XYZ\wp-includes\functions.php on line 2769          [30-Apr-2013 17:07:12 UTC] PHP Stack trace:          [30-Apr-2013 17:07:12 UTC] PHP   1. {main}() C:\Users\serwis\Dropbox\www\XYZ\index.php:0          [30-Apr-2013 17:07:12 UTC] PHP   2. require() C:\Users\serwis\Dropbox\www\XYZ\index.php:17          [30-Apr-2013 17:07:12 UTC] PHP   3. wp() C:\Users\serwis\Dropbox\www\XYZ\wp-blog-header.php:14          [30-Apr-2013 17:07:12 UTC] PHP   4. WP->main() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\functions.php:779          [30-Apr-2013 17:07:12 UTC] PHP   5. WP->query_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\class-wp.php:549          [30-Apr-2013 17:07:12 UTC] PHP   6. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\class-wp.php:485          [30-Apr-2013 17:07:12 UTC] PHP   7. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP   8. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP   9. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  10. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  11. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  12. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  13. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  14. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  15. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  16. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  17. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  18. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  19. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  20. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  21. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  22. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  23. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  24. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  25. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  26. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  27. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  28. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  29. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  30. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  31. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  32. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  33. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  34. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  35. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  36. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  37. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  38. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  39. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  40. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  41. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  42. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  43. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  44. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  45. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  46. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  47. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  48. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  49. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  50. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  51. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  52. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  53. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  54. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  55. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  56. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  57. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  58. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  59. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  60. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  61. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  62. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  63. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  64. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  65. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  66. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  67. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  68. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  69. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  70. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  71. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  72. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  73. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  74. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  75. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  76. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  77. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  78. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  79. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  80. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  81. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  82. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  83. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  84. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  85. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  86. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  87. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  88. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  89. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  90. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  91. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  92. do_action_ref_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1924          [30-Apr-2013 17:07:12 UTC] PHP  93. call_user_func_array() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  94. gs_pre_get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\plugin.php:487          [30-Apr-2013 17:07:12 UTC] PHP  95. WP_Query->__construct() C:\Users\serwis\Dropbox\www\XYZ\wp-content\themes\roots-XYZ\lib\custom.php:14          [30-Apr-2013 17:07:12 UTC] PHP  96. WP_Query->query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:3059          [30-Apr-2013 17:07:12 UTC] PHP  97. WP_Query->get_posts() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:2972          [30-Apr-2013 17:07:12 UTC] PHP  98. WP_Query->parse_query() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1922          [30-Apr-2013 17:07:12 UTC] PHP  99. absint() C:\Users\serwis\Dropbox\www\XYZ\wp-includes\query.php:1442


Function call via ajax – can't figure it out?

In my header.php file I've got …               <script type="text/javascript">         var ajaxurl = "<?php echo admin_url( 'admin-ajax.php', 'relative' );?>";     </script>      In my functions.php file I've got …               add_action('wp_ajax_get_event_list', 'get_event_list');     add_action('wp_ajax_nopriv_get_event_list', 'get_event_list');          function get_event_list( $latest = true, $order = 'ASC', $return = false, $year = NULL, $cat = NULL ) {              // Stuff of the function          }      In my script.js file I've got …               $('#year-filter .inactive').click(function(e) {         e.preventDefault();         console.log(ajaxurl); // http://mydomain.com/wp-admin/admin-ajax.php               $.ajax({             type: 'GET',             url: ajaxurl,             data: {                  action: 'get_event_list',                 year: '2012', //param year                 cat: 'vortraege' //param category             },             dataType: 'html',             timeout: 300,             success: function(data){                 console.log('Ajax success');             },             error: function(xhr, type){                 console.log('Ajax error');                 console.log(xhr + " " + type)             }         });     });      I currently get the following error in my console > http://mydomain.com/wp-admin/admin-ajax.php > > Ajax error > > [object XMLHttpRequest] timeout


Walker_Nav_Menu exeption

I'm currently working on a WordPress site and whenever in the admin I go the Appearance > Menus page I get the following error:               ErrorException: Runtime Notice: Declaration of Walker_Nav_Menu_Edit::start_lvl() should be compatible with that of Walker_Nav_Menu::start_lvl() in wp-admin/includes/nav-menu.php line 203      It seems like some sort of PHP compatibility issue. I'm running PHP 5.3.10 on my local dev machine. What would be the best way to remedy this problem?


resetting permalinks after changing page names

After a lengthy staging time, many page categories, pages within pages, need to be retitled. This made a mess of my link structure and now I'm having a real hard time try to figure out how to reset all of the different links. If you had made a page, then created 15 pages within that page as a structure, then another 15 pages in each of those pages, then retitled the first page – how do you edit the link structure? I'm stumped.


delete unattached images on post submit

I have given permission to the users to register on my blog and add the contents (posts). Blog post will allow only 3 images to be inserted (please see the screenshot below) achieved by using custom fields plugin. **EDIT:** below screenshot taken from add new post page. which is for upload the images. ![screenshot](http://i.stack.imgur.com/yK8Dn.png) **Problem:** Few users are uploading multiple images by using any one of Add Image buttons shown above, then they are finalizing 3 images from uploaded images to attach with the post. I found one user has uploaded 20 images and then used 3 images from those to attach to the post. So unnecessarily it's increasing the images in the server directory. **Seeking solution for:** When user clicks on Submit for Review button, unattached images should be removed from his account only. Please suggest me the function which I can add in to function.php of my theme **EDIT:** Amount of images are restricted by providing 3 upload buttons, so the user can select only 3 images to attach to the post (above screenshot). But in this case users are using those buttons to upload multiple images (say 20 images) but using only 3 images from those to attach to the post. So I require a function/filter to clear the unattached images (remaining 17 images), which I can run on Submit post action in function.php.


RSS feed for dynamic set of custom taxonomies terms

I've got a CPT called 'Job' and three different taxonomies associated with it: location, type (permanent/contract) and expertise. I've got a filter on the website that allows to search for jobs of specific expertise of specific type in a certain location: http://www.grovelands.co.uk/roles-we-offer I'd like to create a RSS feed where a visitor can choose a specific set of taxonomy terms (location, type, expertise) to subscribe to. **For example** , a visitor 1 would like to sign up for jobs in 'corporate development' expertise of all types in London are. Visitor 2 wants to sign up 'Risk and Regulation' expertise of 'contract' type in Scotland only. Is such a dynamic RSS possible to create and how to? I would hugely appreciate any tips and hints. Many thanks, Dasha


plugin how to find code and edit it in a template file?

I'd like to add an id to each permalink from a plugin. Jquery just returns the same id for each link. Is there another way I can do this?               add_action('add id for each loop', 'test');     function test() {     ?>               <?php          }      It works fine if I add it to the template directly so is there a way I can find the code from a plugin and add/edit into content.php (custom? loop) template file?               // add the id     <a href="<?php the_permalink(); ?>"><?php the_title(); ?>     // result     <a href="<?php the_permalink(); ?>" id="<?php the_ID(); ?>"><?php the_title(); ?>


Excluding specific widgets from default sidebar class

I have two sidebars using the `register_sidebars` function that display each widget as a list item with a class of `.box`:               <?php if(function_exists('register_sidebars')){          register_sidebars(2, array(         'name'=>'sidebar%d',         'id'  =>'sidebar',         'before_widget'=>'
',         'after_widget'=>'
',         'before_title'=>'
',         'after_title'=>'
',     ));     }     ?>      So the output goes something like:

Lorem ipsum

Blogroll

Example

      What I need is a conditional function so that any Links widget (or one with a class of `.xoxo`) in the sidebars will not get a class of `.box` because I want to style those and only those differently, and in a way that I can simply change certain styles from inside of `.box`. The main problem is that I don't know what function or variables to target with a filter. The codex doesn't do a good job of classifying less-used global variables and I can't see anything in the Filter Reference that looks like it should help.


White Space on translated strings lost

This is really crazy – I've done it before but now the whitespaces in placeholders in my translation strings are lost. For example this is translation of my pot:               This entry was posted in %1$s and tagged %2$s. Bookmark the permalink.      I translated it (german) to this               Dieser Beitrag wurde gepostet in %1$s und hat die Tags %2$s. Bookmarke den permalink.      Just a standard translation of the _Underscore_ Theme. But all tags and categories are combined without a whitespace. I just get               [...]Blog,Blog,Blog[...]      And because of that the whole stuff doesn't do any line breaks just a massive line of links ...


Setup A Default Featured Image

I'm trying to setup a default fallback featured image on my website to ensure consistency with images being displayed for every post, even when an image is not embedded in the post. I've tried a number of plugins - Default Post Thumb and Default Thumb, however neither of these seemed to work. I'm using WP 3.4 and the Suffusion Theme 4.2.2 on the site which can be seen at http://www.aliveradio.net/ I'm not very capable at editing basecode and would prefer to work with plugins, however if anyone could help with code alterations I'd be happy to give it a go. Thank-you in advance for any help you can provide.


add_rewrite_rule and template redirect not working

I have the following pairs:               add_rewrite_rule('^questions/ask/?','index.php?pagename=ask','top');     if(is_page('ask')){             $tname = 'add-question.php';             if(file_exists(TEMPLATEPATH.'/'.$tname)){                 $returntemplate = TEMPLATEPATH.'/'.$tname;             }else{                 $returntemplate = $plugindir.'/default-template/'.$tname;             }             ahaali_do_theme_redirect($returntemplate);      and:               add_rewrite_rule('^questions/ed/([^/]*)/?','index.php?pagename=ed&id=$matches[1]','top');     if(is_page('ed')){                 $tname = 'edit-question.php';                 if(file_exists(TEMPLATEPATH.'/'.$tname)){                     $returntemplate = TEMPLATEPATH.'/'.$tname;                 }else{                     $returntemplate = $plugindir.'/default-template/'.$tname;                 }                 ahaali_do_theme_redirect($returntemplate);             }      Now what happens is the following: The first rule and template redirect works while the second one does not. I have added in the header of my theme               print_r($wp->query_vars);       the result is:               Array ( [pagename] => ed [id] => 10 )       So the rule itself works but the template redirect does not. Any idea why?


Category URL Management

When you keep the category base ( that is you don't remove it by a plug in) WordPress does allow you to browse to your 2 level deep category in two different ways as the example below would demonstrate it. say, your category has a top level item "MULTIMEDIA" and a child under it called VIDEO. Visually, we are talking about a situation like this; ## Category taxonomy               multimedia         video         audio     topics         science         politics       Well, you may get to that child (video) in the following 2 different ways; yoursite.com/category/multimedia/video or yoursite.com/category/video The point here is that WP brings you to the exact same page, regardless of which URL has been used, and there are no redirects here neither, so both URL's remain on the visitor's browser as is just like it was requested at the first place. And with either URL, the resulting content is identical. That's a hateful situation by Google. Google punishes such sites cause your web site got the _same exact content_ appearing under 2 different URL's. ( This is of course when you happen to use both URLs. ) Sure, Nobody would want to do that deliberarely but sometimes you end up with that. And this question is all about that case. Let's say, you wanted to pick the simpler URL for your VIDEO category and you want to stick to that only. Basically, you want the URL to be yoursite.com/category/video This is easy to achieve when you use the custom menu feature that comes with WordPress where you can specify a URL for that particular custom menu item of yours. So, when visitors click on the VIDEO link on the custom menu, they end up coming to yoursite.com/category/video No problems so far... But as soon as they pick a post out of that category, and they end up coming to a post where the post's meta data displays things like "CATEGORIZED in" or "TAGGED by" etc, they will be exposed to the alternative URL for that VIDEO category. So, if a user clicks on the VIDEO link in the "Categorized in" area, the URL that they will end up with would be yoursite.com/category/multimedia/video And with that, there goes your SEO ranking. My question is what techniques do you use here so WordPress always and always use one single URL, the URL you defined in the custom menu. I thought, category slugs could do this, but when I checked it, slug feature allows me to change only the category term in the URL, not the path to it. If it were to give me a choice like video slug: /category/video I would be done. But that choice is not available at this moment. When you do that, you end up with the following slug instead categoryvideo That's because / is not a valid character for a slug. Please suggest an alternative way to tell WordPress to stick to /category/video at all times. Before suggesting the obvious, ( well, just skip the 'multimedia' and make the 'video' a top level cat. ), let me say that that suggestion won't work for our situation.


Meta boxes not displayed, data isn't being saved

As the title says, I have a problem in functions.php (I assume it's in there) which causes custom fields to not be displayed on the new/edit post page, and when I add the meta box myself and save the data by updating the post, the data disappears. However, if I save the data by clicking the Update button for the meta box itself (and do not click the post Update button), the data is saved and displayed properly. I have posted the code in functions.php here.


Custom post template for particular category

Here is my issue: I have one parent category with many sub-categories below it, e.g.               Category        Sub category             sub-sub category......             sub-sub category......             sub-sub category......             sub-sub category......             sub-sub category......             ........      I used the WP dTree plugin to show the categories as a tree. Now I want that when I click any `sub-sub category......` that it shows all the posts in that category in one custom post template. I know how to make post template and I know when I make any post if the template file is defined the post will show that template. However I have a lot of `"sub-sub category......"` categories which contain many posts so it's hard to always define template for each post. If there's any way to display all the posts in a `sub-sub category......` category in one custom template, then please share with me... Below is an example of what I'm trying to do: ![Example of what I'm trying to do](http://i.stack.imgur.com/w5woS.gif)


Issue with custom plugin

I created an audio player in HTML5/Flash with the help of the SoundManager2 API. Now I want to add it to Wordpress as a plugin, so that you don't need programming skills to customize the player. The plugin should just modify a few values in the HTML and the JavaScript and then echo the div with the audio player on the Homepage as a permanent div. Since I didn't really knew how to program plugins I followed the step-by-steps in the book "Professional WordPress : Design and Development". But I have to say that I'm really stuck because the Wordpress dashboard doesn't seem to show anything after activating the plugin besides "Audio player's ID" on the widget tab in "Appearance". Here is my code :               <?php      /*     Plugin Name: Frontpage audio player     Description: Audio player     Version: 0.1     */          register_activation_hook(__FILE__, 'audio_player_install');     function audio_player_install() {            function custom_dependencies() {       ?>         <link rel="stylesheet" type="text/css" href="style-min.css" />                                    <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" />                         <?php       }       add_action('wp_head', 'custom_dependencies');     }          register_deactivation_hook(__FILE__, 'audio-player-uninstall');     function audio_player_uninstall() {       //do something     }          add_action('widgets_init', 'audio_player_register_widgets');     function audio_player_register_widgets() {       register_widget('audio_player_widget');     }          class audio_player_widget extends WP_Widget {       function audio_player_widget() {         $widget_ops = array(           'classname' => 'audio-player-widget',           'description' => 'Displays the audio player on the front page.',         );         $this->WP_Widget('audio_player_id', "Audio player's ID", $widget_ops);       }            function form($instance) {         $defaults = array(           "file_Path" => 'audio/test.mp3',           "background_Ring_color" => '#000',           "loading_Ring_color" => '#000',           "playing_Ring_color" => '#ffd700',           "equalizer_Data_color" => '#ff8C00',         );         $instance = wp_parse_args((array)$instance, $defaults);         $file_Path = strip_tags($instance['file_Path']);         $bg_RingClr = strip_tags($instance['background_Ring_color']);         $loading_RingClr = strip_tags($instance['loading_Ring_color']);         $playing_RingClr = strip_tags($instance['playing_Ring_color']);         $equalizer_DataClr = strip_tags($instance['equalizer_Data_color']);     ?>

Frontpage Audio player settings :
            <form method="POST" action="options.php">         <?php settings_fields('audio_settings_group'); ?>

             Name of the file you want to play : 	                          (You also have to specify the audio file's extension. eg : ".mp3", ".wav", ".ogg")
             (If no file is specified, it will play the last created file by default)                          <input type="text" name="audio-File-url"              value="<?php echo esc_attr('audio-File-url'); ?>" />

             Ring background color : 	             <input type="text" name="background-Ring-color"              value="<?php echo esc_attr('background-Ring-color'); ?>" />	             Default color is "#000".

             Ring color while loading : 	             <input type="text" name="loading-Ring-color"              value="<?php echo esc_attr('loading-Ring-color'); ?>" />	             Default color is "#000".

             Ring color of already played sound : 	             <input type="text" name="playing-Ring-color"              value="<?php echo esc_attr('playing-Ring-color'); ?>" />	             Default color is "#ffd700".

             Equalizer (sound wave graph) color : 	             <input type="text" name="equalizer-Data-color"              value="<?php echo esc_attr('equalizer-Data-color'); ?>" />	             Default color is "#ff8C00".

           <input type="submit" class="button-primary" value="Save Changes" />
       </form>
          <?php            }            function update($new_instance, $old_instance) {         $instance = $old_instance;         $file_Path = strip_tags($new_instance['file_Path']);         $bg_RingClr = strip_tags($new_instance['background_Ring_color']);         $loading_RingClr = strip_tags($new_instance['loading_Ring_color']);         $playing_RingClr = strip_tags($new_instance['playing_Ring_color']);         $equalizer_DataClr = strip_tags($new_instance['equalizer_Data_color']);              return $instance;       }            function widget($args, $instance) {         extract($args);              echo $before_widget;              $file_Path = strip_tags($instance['file_Path']);         $bg_RingClr = strip_tags($instance['background_Ring_color']);         $loading_RingClr = strip_tags($instance['loading_Ring_color']);         $playing_RingClr = strip_tags($instance['playing_Ring_color']);         $equalizer_DataClr = strip_tags($instance['equalizer_Data_color']);              ?>

             <a class="audio-file" href="<?php echo $file_Path ?>">

              <?php         echo $after_widget;       }     }     ?>      Thanks in advance for your help !


create a front end post page template withTinyMCE,

there are alot of front end posting suggestion with wp insert post but is it posible to create a front end post submision with TinyMCE, and similiar editor


Drupal is going Symfony. Would WordPress benefit from doing the same?

If WordPress would do the same, would it lose much in performance?


Moving Share Buttons from a Plugin

I'm using the Share and Follow plugin on my site. I like it for the most part, but the "interactive share buttons" - the ones that appear at the front of the post - are on the first line of my post. This might be OK, except that it shoves the images that are at the beginning of the majority of my posts out of alignment (on both my main page and individual posts). I would much prefer that the buttons appear under the title, but before the first line of content in my post. But because it's a plugin, I can't figure out how to change where the buttons appear.


Custom ReCaptcha Login

I'm trying to add ReCaptcha to my login page. I know there are many many plugins by per request I cannot use plugins. So far so good, I'm able to add the Captcha to my login but unable to show errors. It will error out on me when I enter the wrong password, but if I enter the right password and do not enter the Captcha I get no errors (which I should get a Captcha not filled error). So the only time my `captcha_errors` function fires is when user name / password is wrong. How do I get my login form to check the ReCaptcha before checking the login credentials?               do_action('login_head');          // this function adds captcha to the login form     function addCaptcha() {         if( session_id() == "" )             @session_start();              if (isset( $_SESSION["recaptcha_response_field"] ))              unset( $_SESSION["recaptcha_response_field"] );              ?>

                     <textarea name='recaptcha_challenge_field' rows='3' cols='40'></textarea>                     <input type='hidden' value='manual_challenge' name='recaptcha_response_field'/>

         <?php          return true;     }          function verifyCaptcha($pageid) {         $result = false;         if( session_id() == "" )             @session_start();              $pvk = 'prvk';              if (!empty($pvk) && isset($_POST['recaptcha_response_field'])) {             if(!function_exists('recaptcha_check_answer')) {                 require_once 'recaptchalib.php';             }             $resp = recaptcha_check_answer($pvk, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);             $result = $resp->is_valid;         }         if(!$result)             return $_SERVER["REQUEST_URI"];         else             return admin_url();     }               // this function checks captcha posted with a login     function captcha_errors( $errors ) {         if ( isset( $_SESSION['cptch_error'] ) )             unset( $_SESSION['cptch_error'] );              // return $errros.'TEST';              if ("" ==  $_REQUEST['recaptcha_response_field'] ) {                 return $errors.''. __( 'ERROR', 'captcha' ) .': '. __( 'Please fill out The Cpatcha.', 'captcha' );         }              if ( isset( $_REQUEST['recaptcha_response_field'] ) && verifyCaptcha()) {             // captcha was matched                               } else {             return $errors.''. __( 'ERROR', 'captcha' ) .': '. __( 'Please enter a valid CAPTCHA value.', 'captcha' );         }         return( $errors );     }                         add_action( 'login_form', 'addCaptcha' );     add_filter( 'login_redirect', 'verifyCaptcha', 10, 3 );       add_filter( 'login_errors', captcha_errors);


Shortcodes: Return different based on atts

I have the following shortcode for pullquotes:               //Pullquote shortcode     function pullQuotes($atts, $content = null) {     extract(shortcode_atts(array(         "author" => ''     ), $atts));     return '
'.$content.'
' . $author . '

';     }     add_shortcode("pullquote", "pullQuotes");      Basically I dont want the paragraph containing the $author attribute to be returned if there is no author set (ie: the default '' value). Any ideas?


Syndicate posts to another blog?

i want to import one blog to another but have that constantly happneing. i.e. when i blog on one site i want it to appear on the other? thanks


Can I license my WordPress Theme under the GPL 3.0?

I notice that WordPress uses the GPL 2+ license. Can I release my free theme under GPL 3.0, since that's the most current version? Would it create compatibility issues? Thanks!