Meta Data for Custom Post Type not saving

I'm in the process of building a custom plugin, and I'm having trouble saving meta data for the custom post type. The boxes display correctly in the editor, but when I click Publish or Save Draft, the values I've entered are not retained. I've pasted snippets of my code below. I've followed a few tutorials, and looked through several questions here, but it looks like I've followed everything correctly, and I can't figure out where I went wrong. I'm sure it's something obvious. Any help would be greatly appreciated. Custom Post Type               // Register the Jobs post type     function fg_registerJobsPostType() {         // Floodgate Jobs Post Type         $fg_postType = 'fg_job';              $jobsLabels = array(             'name'               => _x( 'Floodgate Jobs', 'post type general name', '' ),             'singular_name'      => _x( 'Floodgate Job', 'post type singular name', '' ),             'menu_name'          => _x( 'Floodgate Jobs', 'admin menu', '' ),             'name_admin_bar'     => _x( 'Floodgate Job', 'add new on admin bar', '' ),             'add_new'            => __( 'Add New', 'Floodgate Job', '' ),             'add_new_item'       => __( 'Add New Job', '' ),             'new_item'           => __( 'New Job', '' ),             'edit_item'          => __( 'Edit Job', '' ),             'view_item'          => __( 'View Job', '' ),             'all_items'          => __( 'All Jobs', '' ),             'search_items'       => __( 'Search Jobs', '' ),             'parent_item_colon'  => __( 'Parent Jobs:', '' ),             'not_found'          => __( 'No Jobs found.', '' ),             'not_found_in_trash' => __( 'No Jobs found in Trash.', '' ),         );              $jobsArgs = array(             'labels'             => $jobsLabels,             'public'             => true,             'publicly_queryable' => true,             'show_ui'            => true,             'show_in_menu'       => true,             'query_var'          => true,             'rewrite'            => array( 'slug' => 'fg_job' ),             'capability_type'    => 'post',             'has_archive'        => true,             'hierarchical'       => false,             'menu_position'      => 5,             'supports'           => array( 'editor', 'custom-fields' )                 );              register_post_type( 'fg_job', $jobsArgs );     }     add_action( 'init', 'fg_registerJobsPostType' );      And The Metaboxes               // Register the Jobs Metaboxes     function fg_registerJobsMetabox() {         /* Add meta boxes on the 'add_meta_boxes' hook. */         add_action( 'add_meta_boxes', 'fg_addJobMetaboxes' );              /* Save post meta on the 'save_post' hook. */         add_action( 'wp_insert_post_data', 'fg_saveJobsMeta', 10, 2);     }     add_action( 'load-post.php', 'fg_registerJobsMetabox' );     add_action( 'load-post-new.php', 'fg_registerJobsMetabox' );          // Build the display components for the Jobs Metaboxes     function fg_addJobMetaboxes() {         add_meta_box(             'fg_jobDesc',      // Unique ID             esc_html__( 'Job Description', 'Business Cards' ),    // Title             'fg_jobDescMetabox',   // Callback function             'fg_job',         // Admin page (or post type)             'side',         // Context             'default'         // Priority         );              add_meta_box(             'fg_jobStatus',      // Unique ID             esc_html__( 'Job Status', 'Printing' ),    // Title             'fg_jobStatusMetabox',   // Callback function             'fg_job',         // Admin page (or post type)             'side',         // Context             'default'         // Priority         );              add_meta_box(             'fg_jobDueDate',      // Unique ID             esc_html__( 'Due Date', '' ),    // Title             'fg_jobDueDateMetabox',   // Callback function             'fg_job',         // Admin page (or post type)             'side',         // Context             'default'         // Priority         );              add_meta_box(             'fg_jobPriority',      // Unique ID             esc_html__( 'Job Priority', '' ),    // Title             'fg_jobPriorityMetabox',   // Callback function             'fg_job',         // Admin page (or post type)             'side',         // Context             'default'         // Priority         );     }      And the save functions               function fg_verifyMetaNonce($metaKey) {         return  (isset($_POST[$metaKey . '_nonce']) && wp_verify_nonce( $_POST[$metaKey . '_nonce'], basename(__FILE__)));     }          function fg_saveMetaData($postID, $metaKey, $newMetaValue) {         /* Get the meta value of the custom field key. */         $metaValue = get_post_meta( $postID, $metaKey, true );              /* If a new meta value was added and there was no previous value, add it. */         if ( $newMetaValue && '' == $metaValue )             update_post_meta( $postID, $metaKey, $newMetaValue, true );              /* If the new meta value does not match the old value, update it. */         elseif ( $newMetaValue && $newMetaValue != $metaValue )             update_post_meta( $postID, $metaKey, $newMetaValue );              /* If there is no new meta value but an old value exists, delete it. */         elseif ( '' == $newMetaValue && $metaValue )             delete_post_meta( $postID, $metaKey, $metaValue );     }               // Save the Jobs Metadata     function fg_saveJobsMeta($postID, $post) {         /* Get the post type object. */         $postType = get_post_type_object( $post->postType );          /* Check if the current user has permission to edit the post. */     if ( !current_user_can( $postType->cap->edit_post, $postID ) )         return $postID;              // Save the Job Description         $metaKey = 'fg_jobDesc';                  /* Verify the nonce before proceeding. */             if ( verifyMetaNonce($metaKey) )                 return $postID;                  /* Get the posted data and sanitize it for use as an HTML class. */             $jobDesc = ( isset( $_POST[$metaKey] ) ? sanitize_text_field( $_POST[$metaKey] ) : '' );              fg_saveMetaData($postID, $metaKey, $jobDesc);              // Save the Job Status         $metaKey = 'fg_jobStatus';                  /* Verify the nonce before proceeding. */             if ( verifyMetaNonce($metaKey) )                 return $postID;                  /* Get the posted data and sanitize it for use as an HTML class. */             $jobStatus = ( isset( $_POST[$metaKey] ) ? sanitize_text_field( $_POST[$metaKey] ) : '' );                  fg_saveMetaData($postID, $metaKey, $jobStatus);              // Save the Job Description         $metaKey = 'fg_jobDueDate';                  /* Verify the nonce before proceeding. */             if ( verifyMetaNonce($metaKey) )                 return $postID;                  /* Get the posted data and sanitize it for use as an HTML class. */             $jobDueDate = ( isset( $_POST[$metaKey] ) ? sanitize_text_field( $_POST[$metaKey] ) : '' );                  fg_saveMetaData($postID, $metaKey, $jobDueDate);              // Save the Job Description         $metaKey = 'fg_jobPriority';                  /* Verify the nonce before proceeding. */             if ( verifyMetaNonce($metaKey) )                 return $postID;                  /* Get the posted data and sanitize it for use as an HTML class. */             $jobPriority = ( isset( $_POST[$metaKey] ) ? sanitize_text_field( $_POST[$metaKey] ) : '' );                  fg_saveMetaData($postID, $metaKey, $jobPriority);     }


loading javascript CDN with local fallback (not jQuery)

I'm trying to modify this to register and enqueue a jQuery plugin from a CDN with local fallback. However, when the URL fails (or if I give it a fake url) Firebug receives 2 aborted calls to the URL before loading the local fallback. With the jQuery fallback like the link, it only receives 1 aborted call. It looks like it is trying to load the script twice before using the fallback.               function gavsiu_scripts() {       if (is_single() && comments_open() && get_option('thread_comments') || is_page_template('page-contact.php')) {         wp_register_script('jquery_validate', '//ajax.aspnetcdn.com/ajax/jquery.validate/1.11.0/jquery.validate.min.js', array('jquery'), null, false);         add_filter('script_loader_src', 'gavsiu_jquery_validate_local_fallback', 10, 2);         wp_enqueue_script('jquery_validate');       }     }          add_action('wp_enqueue_scripts', 'gavsiu_scripts', 100);          function gavsiu_jquery_validate_local_fallback($src, $handle) {       static $add_fallback = false;            if ($add_fallback) {         echo '<script>if(typeof $().validate == \'undefined\') document.write(\'<script src="' . get_template_directory_uri() . '/js/jquery.validate.min.js"><\/script>\')</script>' . "\n";         $add_fallback = false;       }            if ($handle === 'jquery_validate') {         $add_fallback = true;       }            return $src;     }


Displaying terms based on loop posts?

I have a shortcode that shows a loop for a custom post type:               while ( $loop->have_posts() ) : $loop->the_post();          // do something     endwhile;      Some of the posts are in categories ($term->name), how do I display list of these categories and posts within them **based on that loop**? Example: I have 2 categories - "Foo" and "Bar", I have 5 posts in "Foo" and 5 posts in "Bar". I'm displaying all the posts and get something like this below them: > Foo (5) | Bar (5) But in different loop I'm using posts_per_page() limiter, and I'm displaying only 3 posts, not 10, so I want to get: > Foo (3) I was trying something like this:               while ( $loop->have_posts() ) : $loop->the_post();              $terms = get_the_terms($post->ID, 'portfolio_categories');               foreach ( $terms as $term ) {           $draught_links[] = $term->name;        }             var_dump($draught_links);              // do something     endwhile;      But doing foreach inside of while loop is messy and I'm getting something like > Foo (1) Foo (2) Foo (3) Foo (4) Foo (5) Foo (5) Bar (1) Foo (5) Bar (2) ... Any ideas?


How to extract images of post and pages excluding header and logo image in wordpress?

I have tried this code to get all images from media library and i am sucessfully getting the source urls of all the images but now i want to exclude all the unwanted images like logo, header images ,etc ... In short i want to extract all images attached to posts and pages ..               if(is_single() || is_page() || is_home() ){                 global $post;            $query_images_args = array(          'post_type' => 'attachment', 'post_mime_type' =>'image', 'post_status' => 'inherit', 'posts_per_page' => -1,'numberposts' => 1      );           $query_images = new WP_Query( $query_images_args );      $images = array();              foreach ( $query_images->posts as $image) {              $images[]= wp_get_attachment_url( $image->ID );                   }                 echo "<pre>";                  print_r($images);                  echo "</pre>";       My output Here the first image is a header image which is unwanted for me ..How to exclude it ..I have tried using attachment size but it cant be unique all the time .. Have a look at it               Array     (         [0] => http://localhost/wordpress/wp-content/uploads/2013/03/AboutUsSlider.jpg         [1] => http://localhost/wordpress/wp-content/uploads/2013/03/7325996116_9995f40082_n.jpg         [2] => http://localhost/wordpress/wp-content/uploads/2013/03/6310273151_31b2d7bebe.jpg         [3] => http://localhost/wordpress/wp-content/uploads/2013/03/4764924205_ce7470f15a.jpg         [4] => http://localhost/wordpress/wp-content/uploads/2013/03/2166105529_70dd50ef4b_n.jpg         [5] => http://localhost/wordpress/wp-content/uploads/2013/03/1494822863_aca097ada7.jpg         [6] => http://localhost/wordpress/wp-content/uploads/2013/03/1385429771_453bc19702.jpg     )


trying to write a variable into a wp_query, need help!

I am not a php coder, I am a designer and html and css guy. However, I am stuck at the moment trying to write a piece of code that will find the name of a post, then get and display all of the posts that have that name as their category. Something like this, Agent bio page has info about the agent and the bio post is his name and cat name. He has listings under his name which is also his category in the wp backend under categories. So under the bio info, I need to create a function that will display a list of all of his posts and display them with the thumbnail, some excerpt text and a couple of the custom fields I have created. this will be on a agent-single.php that will be used for every agent i have so it needs to find the post name with his slug in it and find posts based on that. Is there any way to actually do this or am I hoping for something that can not be done in wp?                 $template = basename(get_permalink());  // get agent here       $taskarr = array (         'post_type'   => 'listing',         'post_status' => 'publish',         'category' => $template,         'order'       => 'ASC',         'orderby'     => 'meta_value_num',         'metakey'     => 'listing_date', // this is a custom field         'metakey'     => 'location',       );       $tasks = get_posts($taskarr);       foreach( $tasks as $task ) {           //  Do stuff here, for example:           echo '<li>';           echo $task->post_title;           echo $task->the_excerpt;           echo $task->location;               echo '</li>';       }      this was inside my main loop which was a normal loop and of course it mutilates my code! ugh!!!


Determining a Widget Instance and Sidebar Location?

When using the filter:               add_filter('widget_display_callback', 'function_name');          function function_name($instance) {        /* Some Code */        return $instance;     }      Is it possible to determine the sidebar name and/or ID the particular widget instance is located within `function_name`?


Where is the WP auto-save draft JavaScript?

If you write a title, then move away from (blur) that input field, WordPress will auto-save a draft for you, likely in order to create a post slug placeholder for you. I'm looking to possibly extend this functionality to also save on blurring of the content body TinyMCE pane. The logic is not entirely straightforward -- for example, it appears to saves a draft only when the post is yet unpublished -- so I need to look further into the logic. In order to scope this change, I need to find where in the JavaScript (?) codebase WordPress does this auto-saving. Having trouble so far. Does anyone know?


WP 3.4 - what action/hook is called when theme customisation is saved?

i'm looking for the action/hook called when saving theme customs colors in the new admin interface? i need to call a custom function to save a set of php generated images. if anyone have clues... :) thanks


WordPress Template works until page becomes a child

Ok so this is really strange. I do not consider myself a WordPress expert, but I am also not a beginner either. I created a template that works just the way I need it. Basically it checks for the attachments associated with the page and displays them in a gallery. This template works fine when there is no parent. When it becomes a child, however, it breaks. It reverts back to the static home page and the pages title becomes (space) - (site name), indicating to me that WordPress is confused as to what type of page it is. Here is the full template page:               <?php          /*          Template Name: Gallery          */          wp_register_script( 'script', get_template_directory_uri() . '/js/product-script.js' );     wp_register_script( 'jPages', get_template_directory_uri() . '/js/jPages.js' );     wp_enqueue_script( 'jPages');     wp_enqueue_script( 'script' );          get_header();           global $post;          $querystr = 'SELECT ' . $wpdb->prefix . 'posts.post_title AS "imageTitle", ' . $wpdb->prefix . 'posts.post_content AS "imageDescription", ' . $wpdb->prefix . 'posts.guid AS "imageGuid" FROM ' . $wpdb->prefix . 'posts WHERE ' . $wpdb->prefix . 'posts.post_parent = '. $post->ID .' AND ' . $wpdb->prefix . 'posts.post_type = "attachment" ORDER BY post_title  LIMIT 1';          global $wpdb;          $post_item = $wpdb->get_row($querystr);          $first_title = $post_item->imageTitle;     $first_attachment = $post_item->imageGuid;     $first_description = $post_item->imageDescription;               $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID, 'order' => 'ASC', 'orderby' => 'title' );          $attachments = get_posts($args);          if ($attachments) {           ?>
          <?php echo the_title(); ?>
              <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>

                          <?php                               foreach ( $attachments as $attachment ) {                              $title = apply_filters( 'the_title' , $attachment->post_title );                              $full_src = wp_get_attachment_image_src( $attachment->ID, 'full' );                              $thumb_src = wp_get_attachment_image_src( $attachment->ID, array( 100, 100) );                              $description = $attachment->post_content;                              $description = str_replace('*', '
', $description);                         $first_description = str_replace('*', '
', $first_description);                                   if ( get_post_meta($attachment->ID, 'new', true))                         {                             $new = 'New!';                         }                              $ul = '

';                         $end_ul = '

';                                   ?>
                                       <a class="thumb " href="<?php echo $full_src[0]; ?>" title="<?php echo $title; ?>" rel="<?php echo $full_src[0]; ?>" >                                      <img src="<?php echo $thumb_src[0]; ?>" alt="<?php echo $title; ?>" class="clearfix gallery-imgs"  />
                                 <?php echo $new; echo mb_strimwidth($title, 0, 14, '...'); ?>
<?php echo $description; ?>

<?php  echo $title; ?>

<?php echo $new; ?>

                              <?php                         unset($new);                          }                          ?>

                  <?php                  echo '
';                  echo '

'.$first_title.'

';                  echo '
';                  echo '';                  echo '
';                  echo '
';                  echo '
'.$first_description.'
';                  echo '

     <?php          endwhile; endif;          }     ?>
     <?php require ('modal-menu.php');?>
     <?php     get_footer();          ?>       Thinking that something in my code may be breaking it, I've already tried removing the initial query and the modal section at the end to no avail. Normally I'm searching for answers to this on my own...but in this case I have absolutely no idea where to even begin. Thanks for any help!


A Depth Like Parameter For "get_posts"

Wordpress has stumped me for the first time in a very long time. I am trying to limit the depth of a get_posts call in my template. I want to get children but limit it to a depth of only 3 as I am generating a faux menu. Is there a way perhaps through a subquery I can limit the depth without excluding pages or checking the page_parent value 3 times?


Change the search icon in twenty fourteen

I guess the title says all. I'm trying to change the search icon of the twenty fourteen theme, because I need a darker one. I tried like this:               .search-toggle {             background: url('http://www.citizen-science.at/wordpress/wp-content/themes/cs/img/search-icon.png');         }      which results in nothing.


Display widget outside sidebar?

I want to display a widget outside the sidebar, but I can't get my code to work. The theme name is `radius-primary-sidebar` and my widget id is `text-20` (according to the html in the admin page. See image #1). I've tried using `the_widget("radius-primary-sidebar", "widget-id=text-20")`, but that didn't return anything. What I'm I doing wrong? I'm using wordpress `3.5.2`. From `/wp-admin/widgets.php` in the admin panel. ![enter image description here](http://i.stack.imgur.com/6OMne.png)


Include Wordpress Page in TWIG Template File

A programmer recently converted my Wordpress site to the TWIG engine and I am having a great deal of difficulty trying to include the contents of a page in the template. Below is my TWIG file for a calendar. The commented-out PHP is how I used to call up the page's content, which no longer work.

{{ section.title }}

Games

TCG

Anime

PokéBeach

                     {#                        <?php                     $id = 32242;                      $p = get_page($id);                      echo apply_filters('the_content', $p->post_content);*/                      ?>                     #}


Menu Multiple Taxonomies

I have a post_type "products" which has both "Category" and "Brand" taxonomies. Each product has exactly 1 Category, and exactly 1 Brand. I would like to display a menu which first lists the Categories as the top- level menu, and then lists the Brands contained in each as a Sub-Menu. Each Sub-Menu should only display the Brands which are associated with Products in that specific top-level Category. The links in the Sub-Menu should then go to a page that only shows Products in the selected Brand and Category... but I think I can figure this part out with wp_query. Mostly I am confused on the Menu issue. Any help is greatly appreciated!


Trying to create site-wide Active Directory sync with Multisite

we have a multisite server running, and we've got the Active Directory Integration plugin running. It works great individually, but each time I create a new site I have to manually activate plugin and do a bulk-import. Is there a way to set up Multisite to use Active Directory Integration (or any other sync method) site-wide instead of on each individual site? Thanks!


How to upload a media file via FTP and then create an attachment post with it?

I need to upload a very large video. I can not upload it via the built-in uploader since my upload_max_filesize is set to just 2M and I'm unable to override it (I've set the upload size to 50M and post size to 100M in .htaccess and php_info() does reflect my Changes) When I try to use the browser based upload tool I get this message: > The requested resource /wp-admin/media-new.php does not allow request data > with POST requests, or the amount of data provided in the request exceeds > the capacity limit. How do I upload a file manually via FTP and make it appear in the Media Library?


Using development versions of jQuery, TinyMCE, ...?

Is there a plugin or another easy way to get debug versions of the external Javascript libraries? ("External" because they were not written by the WordPress team, not because they come from Google or another CDN). If I define the `SCRIPT_DEBUG` constant to `true`, I get debug (non-minified) versions of most Javascript files in WordPress. However, some external libraries are still using the minified versions (check `wp_default_scripts()` for the scripts that don't have the `$suffix` part in their URL). I am creating a TinyMCE plugin and thus it would be handy to have the full TinyMCE source code when stepping up and down the call stack while debugging. (I know TinyMCE is loaded in an even more special way, but I'm also thinking of the jQuery library, which uses the standard `wp_register_script()` method.) I know that TinyMCE can be loaded as a compressed or a non-compressed Javascript, but both of these versions have been minified first, so that is not what I want. I want to load a non-minified version of TinyMCE, and possibly also the non-minified versions of the plugins.


how to limit and display tag?

Hi i need to show random 3 tags for a post. all my posts have been tagged with more than 10 tags, i need to display any 3 tags randomly. for eg: A sample post               Tag1     Tag2     Tag3      I am currently using `<?PHP the_tags()?>` to generate all tags how to restrict it to 3 randomly generated tags.


Wordpress Themes Directory: Template which hits the standards?

Is there a template which I can use for themes which I want to submit to the wordpress themes directory? A naked template which hits the standards of the Wordpress Themes Directory and which I could use as base for developping new themes would be great. Is there maybe an official "naked" theme which can be used for that?


How to correctly get post type in a the_title filter

I want to prepend text to the post titles of a specific custom post type, but the filter below didn't work. Instead of changing only that CPT's post titles, it changed _all_ titles on the given CPT's pages—menus items, posts in secondary loops, etc. What am I doing wrong? I'm guessing it's something to do with the scope of get_post_type().               add_filter( 'the_title', 'add_cpt_prefix' );          function add_cpt_prefix( $title ) {         if ( get_post_type() == 'press' ) {             $title = 'Press: ' . $title;         }         return $title;     }


Setting a custom $query->query_vars['meta_key'] breaks the WordPress menu

First of all, my problem is very similar to this one: http://stackoverflow.com/questions/10629245/wordpress-menu-disappears-when- query-query-varsmeta-key-is-set However, the answer accepted for this question does not help me for some reason. I am using the following code in my functions.php file to filter posts based on a custom field, which is set in the URL of a page:               function my_pre_get_posts( $query )     {         // validate         if( is_admin() )         {             return;         }              if( isset($_GET['county']) )             {                 $query->set('meta_key', 'venue_county');                 $query->set('meta_value', $_GET['county']);             }            }         return;          }     add_action('pre_get_posts', 'my_pre_get_posts');      I copied the code from this tutorial http://www.advancedcustomfields.com/resources/tutorials/creating-wp-archive- custom-field-filter/ The above code works, in that it filters the results on the venues archive page, if county has been set in the URL. However, this then breaks the wordpress main navigation menu. When I try and apply the fix to the code, by adding               if( ! $query->is_main_query()) return;      This fixes the menu but breaks the URL filtering, so all posts are returned not only those with a custom field of venue_county set to something. It's very frustrating, any help would be most appreciated! For example, is there a way of checking to see if the query is for the nav menu and not touching it if it is, but still allow modifying the second query of actually getting the posts on the page? I think this is what `if( ! $query->is_main_query()) return;` is supposed to do... Thanks


Run multiple domains under 1 wordpress instance

I have a question. I am trying to set up two domains under one wordpress instance. For instance, I have a wordpress site on www.site1.com I have another domain called www.site2.com. Now, I want to run the same wordpress site that is under www.site1.com on www.site2.com I tried using the wordpress domain mu mapping plugin http://wordpress.org/plugins/wordpress-mu-domain-mapping/installation/ But it only allows me subdomains or directories of www.site1.com Can anyone help?


How to do I get a list of active plugins on my wordpress blog programmatically?

I have 2 blogs, one which is multisite and one which isn't. I want to get a list of plugins active on both the blogs so I can compare them. On the multisite blog, I want to list the plugins which are enabled network-wide as well as site wide.


Can't publish posts, Jetpack won't connect, empty notification emails to my inbox

I own a self-hosted Wordpress blog and I am experiencing a lot of issues:   * Jetpack stopped working and it won't connect: `verify_secrets_missing : The Jetpack server encountered the following client error: Verification took too long`;   * can't post any entry, the _Publish_ button has been replaced with _Send for revision_ ;   * emails are sent to my inbox to notify a new comment, except there's no actual new comment and the email has empty fields;   * everytime I try to add a new user an empty email is sent to my inbox and the user isn't actually added. I am desperate to bring my blog back to normal, so far I have:   * deactivated all plugins and then re-activated;   * switched to the Twenty Eleven theme to rule out any theme-specific problems;   * reset the plugins folder by FTP;   * re-uploaded all files & folders (except the wp-content folder) from a fresh download of WordPress. Needless to say all this attempts have miserably failed. Then I've found out that my hosting had set the space for my DB to 5MB, now I have reset the space to 400MB, but still the issue remains. Any ideas about what can I try to get all back to normal?


Buddypress Plugin for register user from other site's

Buddypress plugin which register user from other social sites like...Facebook, twitter and also from google. I think there is one buddypress exist only for facebook but not for others.. any one know about.


Optimize CPT-function with a loop

I want to optimize my functions of a Custom Post Type (CPT). Now I have 10 meta boxes. For each box I have an extra function. The aim is to produce the 10 boxes in one function. I already tried the following code. The problem is that the entered values do not get saved.               function optimize() {          global $post;          $custom = get_post_custom($post->ID);          for ($i=0; $i<=9; $i++) {             $field_name[] = $custom['field_name'];             $checkbox_nr[] = $custom['checkbox_nr'];                  echo 'Field Name '.($i).' <input name="field_name' . $i . '" value="' .  $field_name[$i][0] . '" />';                  }               update_post_meta($post->ID, "field_name1", $_POST["field_name1"]);     }


Toggle Shortcode Sanitize Title

Wondering if anyone can help me out... here is my custom theme shortcode:               add_shortcode('toggle', 'shortcode_toggle');     function shortcode_toggle( $atts, $content = null ) {     extract(shortcode_atts(array(         'title'      => '',         'class'      => '',     ), $atts));          $out .= '
' .$title. '
';     $out .= '
';     $out .= '
';     $out .= do_shortcode($content);     $out .= '
';     $out .= '
';      return $out; } This is located in my themes functions.php file. I want to be able to echo the title that is entered in for the toggle in the
      ... but I need it to strip out all characters and formatting (no spaces/symbols etc)... Any ideas? Thanks!


Tag URLs load a single post

I recently rebuilt a WordPress install (maintained database, replaced WordPress/plugins/theme files) after the site was compromised. It is working more or less correctly now, with the exception of tag links:               http://www.foo.com/tag/bar      forwards to a post tagged with `bar`, rather than displaying a list of posts tagged with `bar`. I've already replaced .htaccess with a newly generated one from options -> permalinks, to no avail. Google indicates a somewhat similar problem happening in conjunction with DB-Cache, which I do not have installed. Any ideas?


Will this js code work in a page template?

I have been given this code that I want to adapt and use to change a link in a `template.php` file, I have not been able to adapt it to work so would love any help that can be given.               <script type="text/javascript">     jQuery(document).ready(function($) {         if ( $(document).width() < 1500 ) {             $('.change-link > a').each( function(){                 newlink = 'Enter New URL';                 $(this).attr('href',newlink);             });         }     });     </script>      Will it work in a `template.php` and be able to choose between this link:               <?php include( TEMPLATEPATH . '/includes/projects.php'); ?>      and this link depending on the browser size?               <?php include( TEMPLATEPATH . '/includes/projects.php'); ?>      Or will it require more code in other pages of my WordPress theme?


Wordpress custom taxonomy page

I've got a question that I've seen being asked before, but none of the answers solved my problems. It's something I've run into before, but never managed to solve. I've got a clean Wordpress installation and in the `functions.php` file I've created a custom post type               register_nav_menu('main', 'Main navigation menu');          function add_custom_post_type() {         $labels = array(             'name' => _x('Books', 'post type general name'),             'singular_name' => _x('Book', 'post type singular name'),             'add_new' => _x('Add New', 'book'),             'add_new_item' => __('Add New Book'),             'edit_item' => __('Edit Book'),             'new_item' => __('New Book'),             'all_items' => __('All Books'),             'view_item' => __('View Book'),             'search_items' => __('Search Books'),             'not_found' =>  __('No books found'),             'not_found_in_trash' => __('No books found in Trash'),              'parent_item_colon' => '',             'menu_name' => __('Books')         );              $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,              'show_in_menu' => true,              'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'has_archive' => true,              'hierarchical' => false,             'menu_position' => null,             'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )         );               register_post_type('book', $args);     }      I've made an `archive-book.php` and `single-book.php` template files for those and everything works okay. I can view the books when I go to "http://localhost/wordpress/book" Now I want to create a custom taxonomy, so I did this in `functions.php` as well:               add_action('init', 'add_custom_post_type');          function add_custom_taxonomy() {         register_taxonomy(             'rating',             'book',             array(                 'label' => 'Rating',                 'hierarchical' => true,                 'show_ui' => true,                 'query_var' => 'book',                 'has_archive' => true,                 'rewrite' => array(                     'slug' => 'book/rating'                 )             )         );     }      And the taxonomy shows up in the admin page, I can add new terms, and add them to books. But now comes the problem. I've I want to go to an overview of all books with, let's say, rating "nice", I would go to "http://localhost/wordpress/book/rating/nice". I've created the following template files: taxonomy-rating-nice.php, taxonomy-rating.php and taxonomy.php. But somehow wordpress just shows the index.php file and doesn't list any books. I've tried flushing the rewrite rules with:               add_action('init', 'custom_taxonomy_flush_rewrite');     function custom_taxonomy_flush_rewrite() {         global $wp_rewrite;         $wp_rewrite->flush_rules();     }      And:               flush_rewrite_rules(false);      But nothings seems to help. So, anybody who can help me? If you need more information, please tell, cause I really want to fix this problem!


Show posts of parent in edit.php

I'm creating a post type for a site where there 4 main 'parent' pages in a custom post type. For the sake of argument the post type is 'schools' the 4 (of many) parents are: Cambridge Teesside Newcastle Sunderland The post type 'schools' is a hierarchical post type, and what I would like to do is treat any children of the top 4 pages as a blogroll in the individual pages. To do this I would like to add a custom menu item on the post type menu that looks something like this edit.php?post_type=schools&parent=123 Is this possible? If not, does anyone know of another way I can achieve this? Cheers


How to: Get the first image from the next and previous post in single.php? (5 posts)

I know I can call a function below but it works in loop at `index.php` only.               function catch_that_image() {        global $post, $posts;        $first_img = '';        ob_start();        ob_end_clean();        $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);        $first_img = $matches [1] [0];             if(empty($first_img)){ //Defines a default image           $first_img = "/images/default.jpg";        }             return $first_img;     }      However, I try to using this function in `single.php` or posting page. It was display only image at own ID only (can't display an image from next and previous posts). Can I make it display together in `single.php`?


WordPress Multisite Permalinks on mapped domain = server 404 error

I am setting up a multiblog. In sub-blogs that mapped on a different domain, permalinks work with only "default" values. They broke if set to other valid values. My main domain name is abc.com   I have three subdomains: aaa.abc.com, bbb.abc.com, ccc.abc.com   Everything works fine. Now, I need to map bbb.com to bbb.abc.com (for example). I've tried two methods: using the MU domain mapping plugin, and following the instructions there. In both cases, I get the exact same behavior:   * Everything seems to work.   * Domains are correctly setup and map correctly   * Links on blogs work if set to "default" (p=123)   * Permalinks on non-mapped sites (ccc.abc.com) work   * **on domains that are mapped (bbb.com) permalinks break if set to anything but default (yyyy/mm/post_name).** I've read countless threads, tried to modify my htaccess one thousand times, both trying the old markup, the new one, and several custom ones I found on different posts.   I've tried one million different custom permalinks (I'm pretty sure any kind permalink will not work). this is my configuration for this domain name (the relevant part at least):               <VirtualHost *:80>         ServerAdmin root@localhost         ServerName abc.com         ServerAlias *.abc.com         ServerAlias *.def.com         ServerAlias *.ccc.com         ServerAlias *.bbb.com         ServerAlias *.ghi.com                   DirectoryIndex index.html index.htm index.php         DocumentRoot /my_root/              RewriteCond %{HTTP_HOST} ^www.abc.com$ [NC]         RewriteRule ^(.*)$ http://abc.com/ [R=permanent,L]              <Directory /my_root>                 Options Indexes FollowSymLinks MultiViews                 AllowOverride All                 Order allow,deny                 Allow from all         </Directory>      What can I do?


Wordpress Load more posts by ajax not working

i need to get the wordpress posts while click the load more button or something else, so i have followed the tutorial by Here               <?php     /*             Template Name: Additional Posts         */     $offset = htmlspecialchars(trim($_GET['offset']));         if ($offset == '') {             $offset = 5;         }              $args = 'post_type=event&posts_per_page=3&offset=$offset';                                $my_query = new WP_Query($args);                         if ( $my_query->have_posts() ) {                         while ($my_query->have_posts()) : $my_query->the_post();                           $event_id = get_post_meta( get_the_ID(), '_event_id', true );                     $location_id = get_post_meta( get_the_ID(), '_location_id', true );                     $custom_fields = get_post_custom(get_the_ID());                          global $wpdb;                     $em_states = $wpdb->get_results("SELECT *from  ".EM_LOCATIONS_TABLE." WHERE location_id = '$location_id' ");                     $em_ticket_price = $wpdb->get_results("SELECT *from  ".EM_TICKETS_TABLE." WHERE event_id = '$event_id' ");                     ?>

<?php echo get_the_post_thumbnail(get_the_ID(), array(269,168) ); ?>

<?php echo $em_states[0]->location_town;?> - <?php the_title(); ?>

<?php  $star_time = get_post_meta( get_the_ID(), '_start_ts', true );  echo date('g:i:s a ',$star_time);?>-<?php   $end_time = get_post_meta( get_the_ID(), '_end_ts', true );  echo date('g:i:s a ',$end_time); ?>

 <?php                                  $terms = get_the_terms(get_the_ID(), 'event-categories' );     if ($terms && ! is_wp_error($terms)) :         $term_slugs_arr = array();         foreach ($terms as $term) {             $term_slugs_arr[] = $term->name;         }         $terms_slug_str = join( " | ", $term_slugs_arr);     endif;     echo $terms_slug_str;?>

<?php echo $custom_fields['wpcf-from'][0]."-".$custom_fields['wpcf-to'][0]; ?>

Price Range

<?php echo $em_ticket_price[0]->ticket_price; ?>€

        <?php endwhile; } ?>                             and my jquery is follows                      it is working, but while click the get more link, am again getting the same posts as well as in the my original loop here in my page , i know that paged query is missing, or else what am missing ?


custom session variables being lost in FF

for whatever reason firefox is dropping my custom session variables. the variables are for a custom user system that is built into my custom theme. this only happens in firefox, the user system works perfect in all other browsers. heres the top of my header.php:               <?php          session_start();          global $errors, $success, $u_cache;          include 'sub-user-auth.php';          ?>      here is sub-user-auth.php:               <?php          $u_cache['logged_in'] = false;          if (!empty($_POST['u_signin']))     {         $errors = array();         $success = '';              foreach ($_POST as $k => $v)             $$k = trim(htmlspecialchars($v, ENT_QUOTES));              if (empty($u_username))              $errors[] = 'You must enter your username';         else if (empty($u_password))              $errors[] = 'You must enter your password';         else if (mysql_result(mysql_query("select count(*) from `users` where `username`='".mysql_real_escape_string($u_username)."' and `password`='".md5($u_password)."'"), 0) == 0)             $errors[] = 'Invalid username and/or password entered';              if (empty($errors))         {             foreach ($_POST as $k => $v)                 $$k = trim($v);                  $_SESSION['u_username'] = $u_username;             $_SESSION['u_password'] = md5($u_password);                  if ($u_remember == 'yes')             {                 setcookie('u_username', $u_username, time() + 31536000);                 setcookie('u_password', md5($u_password), time() + 31536000);                        }                  $success = 'You have been signed in successfully! Please click here to continue to your account.';                  foreach ($_POST as $k => $v)                 $$k = '';         }     }          if (!empty($_COOKIE['u_username']) && !empty($_COOKIE['u_password']))     {         $u_cache['u_username'] = $_COOKIE['u_username'];         $u_cache['u_password'] = $_COOKIE['u_password'];     }     else if (!empty($_SESSION['u_username']) && !empty($_SESSION['u_password']))     {         $u_cache['u_username'] = $_SESSION['u_username'];         $u_cache['u_password'] = $_SESSION['u_password'];     }          if (!empty($u_cache['u_username']) && !empty($u_cache['u_password']))     {         $sql = mysql_query("select * from `users` where `username`='".mysql_real_escape_string($u_cache['u_username'])."' and `password`='".mysql_real_escape_string($u_cache['u_password'])."'");              if (mysql_num_rows($sql) != 0)         {             while ($row = mysql_fetch_assoc($sql))             {                 foreach ($row as $k => $v)                     $u_cache[$k] = htmlspecialchars(stripslashes($v), ENT_QUOTES);             }                  $u_cache['logged_in'] = true;             $u_cache['fav_leagues'] = explode(',', $u_cache['fav_leagues']);             $u_cache['fav_teams'] = explode(',', $u_cache['fav_teams']);         }     }          if ($u_cache['logged_in'])     {         if (is_page(array('sign-in', 'sign-up', 'forgot-password')))         {             header('Location: '.get_bloginfo('url').'/my-home');             die();         }     }     else     {         if (is_page(array('my-home', 'edit-home', 'sign-out')))         {             header('Location: '.get_bloginfo('url').'/sign-in');             die();         }     }          ?>      what happens is it lets me log in, shows me the "my-home" page, then kicks me off almost immediately after and sends me back to the sign-in page. all of the custom session variables are dropped.


How to set thumbnail for each tag?

I would like to set thumbnails for each tag. I actually need two type of thumbnails. 16 x 16 and 90 x 90. 16 x 16 will be used infront of tag name like stackoverflow. 90 x 90 will be used in tag page as tag avatar. Is there any readymade plugin available? Can anyone help me? Thanks


How do you set up a WordPress blog with multiple authors to allow something like StackExchange's "community wiki" feature?

I'm thinking about having a blog with multiple authors. In the WordPress Roles documentation, authors can publish posts but only edit their own and not posts by other authors, which is what I'm looking for. I also want to allow certain posts to become open for anybody to edit without upgrading anybody to 'Editor', similar to the community wiki feature here on the StackExchange sites. Is this possible?


remove_filter( 'comment_author', 'floated_admin_avatar' ); doesn’t work

In a small plugin I’ve written to add an IP address column to the comments list I want to remove the avatars.   In line 156 I tried to use `remove_filter`:               remove_filter( 'comment_author', 'floated_admin_avatar', 50 );      Well … I know this function fails sometimes, but **why does it fail here?** My workaround is:               $_GET['comment_status'] == 'spam'          and add_filter( 'pre_option_show_avatars', '__return_zero' );      I guess I stared too long at this code to see what went wrong. I need a hint into the right direction.


Unable to upload new file as a product

I'm trying to upload an XML file (RSS feed) as part of a product in the WP- Ecommerce plug-in. The idea being that a customer buying the product would be given this XML file to download which ideally launch iTunes to download the balance as part of a podcast. I can't seem to upload the .XML feed file. I can upload other file types without a problem, but that one seems to be blocked. Where would I go to allow .XML files to be uploaded? Is it a WP-ECommerce thing, a WordPress thing, or perhaps something on the hosted server itself?


WP Customize refresh problem

Hi I am adding options to WP Customize. Mostly everything works, but One of my variable is not refreshed in the preview window.               $wp_customize->add_setting('checkbox', array(             'capability' => 'edit_theme_options',             'default' => false,         ));          $wp_customize->add_control('checkbox_control', array(         'settings' => 'checkbox',         'label'    => __('Activate Coming Soon Page', 'ln'),         'section'  => 'general_settings',         'type'     => 'checkbox',         'priority' => 1,     ));      This is how I add the checkbox and here is my check in functions.php               function template_redirect() {      if(true == get_theme_mod('checkbox')) {             include (TEMPLATEPATH . '/coming-soon.php');             exit;         }     }     add_action( 'template_redirect', 'template_redirect' );      So everything works. ~The only problem is that the preview window when you are in WP Customize and click the checkbox it reloads the page but it doesn't shows the change. If I click save and refresh manually then everything is fine. Any suggestion how to fix this issue? Thank you UPDATE: **I found what is breaking WP CUSTOMIZER, it is the exit of the redirect. Is there another way how to fix this issue. I need to redirect to that page if the checkbox is TRUE**                function template_redirect() {          if(true == get_theme_mod('checkbox')) {                 include (TEMPLATEPATH . '/coming-soon.php');                 exit;  !!!!!!!!!!!!!!!!!             }         }         add_action( 'template_redirect', 'template_redirect' );


TimThumb cache directory issue

I have a site with 9000 posts and those posts have external images and they are not stored on my server. These posts have thumbs that show on the homepage. My problem is this: whenever someone visits the site, many text files get created in the cache directory via `thumb.php` and they go up to 9000 if all my posts are featured. There are only text files in the cache directory, and they are not cleared any way automatically. How do I make them get cleared automatically? GoDaddy doesn't allow more than 1024 files to be stored in a single directory and therefore they issued a warning to me this morning. And I need to get those cache folders cleared automatically. I have `('FILE_CACHE_ENABLED', TRUE);` btw if this has anything to do with this issue. I didn't even touch `thumb.php`. My other sites work well and nothing is stored in their cache. I have also checked TimThumb's configuration page online. I've tried Timthumb Vulnerability Scanner, I have no caching plugin installed, I've also tried to create a cron job schedule, but on GoDaddy I could only manage to clear the directory at certain times, not for when a certain size is reached. GoDaddy allows up to 10 cron jobs and up to 5 minutes to function between cron jobs. During those 5 minutes, more than 1024 text files are created, which doesn't work for me. But I believe there must be something that can be done to clean the cache automatically? Thumbs are hosted elsewhere already. Cache only creates text files to identify, but doesn't clean them. Can anyone help me with this pretty please? Please explain what I need to do step by step as I have a very limited knowledge on this.


Admin - no Featured image choice in create new/page|post

I am developing a WP theme and I wanted to add a thumbnail/featured image to a new page/post but there is no such option/choice - like it used to be, I am using WP 3.8.1, I did try to turn off all the plugins - didnt help, I also checked the console for any errors - no error. Interesting is that with the native "Twentyfourteen" theme it works/shows. Any idea what might cause this behaviour? Is there anywhere anything what could turn this off?


Added new bulk action, but only work on bottom dropdown

I've added Archived bulk Action to my CPT, but my problem is that everything work fine only if we select the action in the second dropdown. That's how i've added the new Bulk Action               add_action('admin_head', 'add_bulk_action');     function add_bulk_action() {         global $wp_list_table;         $current_screen = get_current_screen();              if($current_screen->id == 'edit-programmation') {                 $wp_list_table->_actions = array_merge(                 $wp_list_table->get_bulk_actions(),                 array( 'archive' => __( 'Archiver' ) )             );         }     }      And my custom bulk action verification               add_action('load-edit.php', 'custom_bulk_action');     function custom_bulk_action() {     global $typenow;     $post_type = $typenow;          if($post_type == 'programmation') {              // get the action         $wp_list_table = _get_list_table('WP_Posts_List_Table');  // depending on your resource type this could be WP_Users_List_Table, WP_Comments_List_Table, etc         $action = $wp_list_table->current_action();              /* $action return -1 if I don't choose my action from the bottom dropdown... */              $allowed_actions = array("archive");         if(!in_array($action, $allowed_actions)) return;                   // security check         check_admin_referer('bulk-posts');              // make sure ids are submitted.  depending on the resource type, this may be 'media' or 'ids'         if(isset($_REQUEST['post'])) {             $post_ids = array_map('intval', $_REQUEST['post']);         }              if(empty($post_ids)) return;              // this is based on wp-admin/edit.php         $sendback = remove_query_arg( array('archived', 'untrashed', 'deleted', 'ids'), wp_get_referer() );         if ( ! $sendback )             $sendback = admin_url( "edit.php?post_type=$post_type" );              $pagenum = $wp_list_table->get_pagenum();         $sendback = add_query_arg( 'paged', $pagenum, $sendback );              switch($action) {             case 'archive':                      $archived = 0;                 foreach( $post_ids as $post_id ) {                          if ( !perform_archiving($post_id) )                         wp_die( __('Error while archiving spectacle.') );                          $archived++;                 }                 $sendback = add_query_arg( array('archived' => $archived, 'ids' => join(',', $post_ids) ), $sendback );                 break;                  default: return;         }              $sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status',  'post', 'bulk_edit', 'post_view'), $sendback );              wp_redirect($sendback);         exit();     }     }      Thank's for your help.


WordPress - "tag page" additional, custom content

Please look at it here TAG page morsblog [dot] dk/tag/stranden/ For THIS TAG, I want to write some text in WordPress (it should have possibility to add defined text to any defined tag). It should look something like this: http://farblog.dk/tag/motorsav-bukser/ Is it possible to make a little plugin that make the text be shown, and providing an opportunity to display the Adsense code below? Thanks!


How do I park secure.primary.com on top of the multisite ID:1 domain: www.primary.com (primary multisite domain)

We have a multisite setup, the primary domain needs to have www.primary.net, and secure.primary.net mapped in wordpress so the primary site's content loads on both. The problem we are facing is secure.primary.com doesn't work. secure.primary.net always ends up at: http://www.primary.net/wp- signup.php?new=secure.primary.net The headers returned from the server are as follows: Status: HTTP/1.1 302 Moved Temporarily Date: Tue, 16 Oct 2012 19:55:53 GMT Server: Apache Location: http://www.primary.net/wp- signup.php?new=secure.primary.net Content-Length: 0 Connection: close Content- Type: text/html; charset=utf-8 Basically I just need this to work, even if it means ripping into the core Wordpress files and making changes. I've tried various domain mapping plugins and such and nothing works correctly. One of the problems is that they don't allow mapping on the primary network domain. Any suggestions on what I can edit in WordPress or a starting point would be great. Thanks.


Only one category per post

How to make each post/page have one and only one category. Categories could have radio box instead of checkbox next to each.


How to disable a network enabled plugin for just one site?

I'm in the process of setting up a (potentially) large multisite network, and I'm looking to make it as easy as possible now to add and configure sites when needed. I'm currently at the phase where I'm dealing with plugins. With multisite I am aware of several different ways you can activate plugins   * Put the plugin in `/plugins`, activate it on every site invidually   * Put the plugin in `/plugins`, use 'network activate' to activate it on **all** sites   * Put the plugin in `/mu-plugins`, automatically activated on every site Now, I've been playing with the settings and I want to activate Akismet on all sites **but** one or two. I thought I would be able to network activate the plugin and then disable it on a single site, but I am unable to do so - if I use network activate then there is only the option to 'network deactivate' - which deactivates the plugin across all sites. Is there a way to have the handy functionality of network activate but yet still have the convenience of being able to deactivate plugins on a site-by- site basis?


Is the part "category" fixed to an URL to an archive or post?

I'm asked to set up a WordPress-based site, which is not intended to run as blog mainly but anyway we want to use the common article area sometimes. Now my client resents that the URL to an article or archive includes "/category/". He wants to make use of tags but categories are redundant since he only wants to have an area called "news" which holds all stuff written as common articles. So my question is: Can I set my theme to simply make URLs like this: "example.com/news/an-article-about-something"?


Which plugin can do horizontal scrolling of RSS feeds in WordPress

I need a plugin which can do horizontal scrolling of RSS feeds in wordpress, I have got a vertical scrolling RSS feeds but cannot find a horizontal one


How to create custom message on plugin update

I saw this message today when accessing my plugin page: ![custom plugin update message](http://i.stack.imgur.com/v1SP2.png) So, how do I create this if I want to update my own plugins that's hosted on wordpress?


I need a plugin in wordpress like google tasks

I need a plugin like google tasks, in which we can add in to do tasks on the wordpress page


How to get last_updated and newest_blogs in WP 3.0

We were using WPMU version 2.9.1, in which we had a plugin - Fimii WPMU Stats mu-plugin - that showed us last updated blogs, and newest blogs.   We now upgraded to Wodpress 3.0, and the commands for the plugin don't work anymore. Does anyone know of a replacement for that plugin? Or something else that will show the data?


Limit author image size

Is there a way to limit the size (dimensions) of the image a user can upload to their profile? It looks like Wordpress does do some kind of limiting as uploading a 1024x768 image the result gets scaled down to 360x270, but where is that configured, either in the UI (which I haven't found) or through code? This is the section of the user profile I'm referring to: ![alt text](http://i.stack.imgur.com/dIZiy.png)


How to get current_cat in navbar, in single post

In a site I have using Wordpress 3.0, when I'm in a single post, the navbar showing the categories doesn't give the parent category the class of "current_cat" and therefore that category is not highlighted. How can I make Wordpress give the parent category that class in single_post mode?


Post meta vs separate database tables

When developing plugins that requires data storage, what's the pros and cons of using one method or another ? The explanation given in the codex is not detailed: > Before jumping in with a whole new table, however, consider if storing your > plugin's data in WordPress' Post Meta (a.k.a. Custom Fields) would work. > Post Meta is the preferred method; use it when possible/practical.


What to do when theme and WordPress coding standards conflict?

I am considering different starter themes such as _s and roots. Roots looks very good, especially its sass fork. Anyway, there's one thing that concerns me. It seems like Roots doesn't follow the WordPress coding standards of themes and plugins. What standard do I then follow if I want to use Roots as a starter theme?


Displaying custom post type on category pages but not on blog listings

I think this is a fairly simple issue but I haven't got my head around it. **Question: how do I get my custom posts to show only on the category archives, but not in the blog post listing page?** Background: I have a custom post type "video", with has_archive true and 'taxonomies' => array('category', 'post_tag') - I want to use standard categories with this custom post type. I have successfully got my category pages to display by setting post_type and using the hook pre_get_posts as follows:               function my_query_post_type($query) {         if ( is_home() && false == $query->query_vars['suppress_filters'] )             $query->set( 'post_type', array( 'post', 'video', 'attachment' ) );         return $query;     }     add_filter('pre_get_posts', 'my_query_post_type');      If I don't use pre_get_posts, then my videos don't show - as expected. However, now my blog post listing page shows the custom posts - as expected because I've changed the post_type in query. **Question: how do I get my custom posts to show only on the category archives, but not in the blog post listing page?**


Why is WP-Query spelled like it is?

I'm new to PHP and WordPress, and I'm curious: Why is WP-Query capitalized like it is? Is this a PHP naming convention, based on the type of query? Or what? Thanks.


Taxonomy menu with post count and multiple parents

I'm using WordPress 3.1.3 and trying to make a "product" menu with post count in each category. Like this:   * New Cars (4)      * BMW (2)     * Ford (1)     * Nissan (1)   * Used Cars (10)      * BMW (3)     * Ford (1)     * Nissan (6) For this, I've created custom post type `Cars` and taxonomies `Type` and `Brand`. Not sure if it the best way to do this, but here's my code:               <?php $auto_types = get_terms('type', 'hide_empty=1'); ?>
     <?php foreach( $auto_types as $auto_type ) : ?>
         <a href="<?php echo get_term_link( $auto_type->slug, 'type' ); ?>">           <?php echo $auto_type->name; ?> (<?php echo $auto_type->count; ?>)                              <?php                     $terms = get_terms('brand');                     $count = count($terms);                     if($count > 0) :                         ?>
                             <?php foreach ($terms as $term) : ?>
                                 <a href="/?type=<?php echo $auto_type->slug ?>&brand=<?php echo $term->slug ?>">                                         - - <?php echo $term->name; ?> (<?php echo $term->count; ?>)
                             <?php endforeach ?>
                         <?php endif ?>
                <?php endforeach ?>
      So my questions are:   * is this is a good way to do it?   * how do I filter post counts? **Edit** - I've managed to solve my second problem, but i'm still not sure if it's a good way to do it. Here's new code:               <?php $auto_types = get_terms('type', 'hide_empty=1'); ?>
         <?php foreach( $auto_types as $auto_type ) : ?>
             <a href="<?php echo get_term_link( $auto_type->slug, 'type' ); ?>">                  <?php echo $auto_type->name; ?>                          <?php $auto_brands = get_terms('brand', 'parent=0' ); ?>
                     <?php foreach ($auto_brands as $auto_brand) : ?>                         <?php $brand_filter['tax_query'] = array(                                 'relation' => 'AND',                                 array(                                     'taxonomy' => 'type',                                     'terms' => array($auto_type->slug),                                     'field' => 'slug',                                 ),                                 array(                                     'taxonomy' => 'brand',                                     'terms' => array($auto_brand->slug),                                     'field' => 'slug',                                 ),                             );                         $tax_query = new WP_Query($brand_filter);                             $count = 0;                         if ( $tax_query->have_posts() ) : while ( $tax_query->have_posts() ) : $tax_query->the_post();                             $count++;                         endwhile; endif; wp_reset_postdata();                             if ( $count > 0 ) : ?>
                                     <a href="/?type=<?php echo $auto_type->slug ?>&brand=<?php echo $auto_brand->slug ?>">                                         - - <?php echo $auto_brand->name; ?> (<?php echo $count; ?>)
                     <?php endif; endforeach ?>

                    <?php endforeach ?>
      **Edit 2** - Changed `query_posts()` method to `wp_query()` (thanks to VicePrez), but is it efficient to use query to only get correct post count or there's a better way to make this menu?


Function to get image from media library

Is it possible to retreive media image directly into the library... Something like get_media ('all') and it return a array with image url, caption, description etc etc..


auto create blog posts depending on list

I looked for a plugin, but couldn't find anything that suited me. What I would like to see is: Say I have a list of zipcodes. I want a blog post for EACH zipcode that contains text (same for ALL the posts), except of course for that zipcode, which will be unique in each post, in body of post, and title. is this possible? (If not.. it would be a big pain to create thousands of blog posts with all the same content (basically)...) Thanks


I made a custom page but Wordpress seems to strip any HTML I put in this page

How can I avoid wordpress stripping HTML content from a custom PAGE?


Hide a nav menu item based on get_user_meta results

I'm trying to hide a navigation menu item under certain circumstances. Specifically, if a user is logged in AND has already registered their product bar code, I want to hide the 'Register Kit' link (which has a class of 'ac- regkit'). Below is the PHP I've added to the head section of header.php, just before wp_head();.               /* If User is loggied in, hide LOG IN and SIGN UP links */     <?php if ( is_user_logged_in() ) { ?>         <style>             .ac-login { display: none; }             .ac-signup { display: none; }         </style>              /*If user has not yet registered their DNA Test Kit, show link */         <?php             $current_user = wp_get_current_user();             $user_id = $current_user;             $key = 'redeem_code';             $single = true;             $ac-barcode = wp_get_user_meta( $user_id, $key, $single);             if ( $ac-barcode = '' ) { ?>             <style>                 .ac-regkit { display: inline; font-weight: bold; }                 .ac-regkit a { color: red; }             </style>         <?php }; ?>     <?php } ?>      And this is the error I'm getting: > **Server Error** The website encountered an error while retrieving > http://athleticode.com/. It may be down for maintenance or configured > incorrectly. I'm not an expert in PHP, so I'm sure it's a syntax error or something like that -- and there is probably a better way to achieve this result -- so any help would be greatly appreciated.


Links in the_content not linked

I have alot of old posts that are being pulled with the_content() context. In the_content() there is links in the text, however none of them are hyperlinked it just shows like http://twitter.com/twitterrocks with it not linked. Is there a way to link all links in my the_content() and make them target="_blank" ? Thanks in advance!


How do you display posts in a dynamic table?

I'm currently using a plug-in called SortTable Post. It automatically takes your posts and puts them into a table that you like. It's a great idea, but the issue is that the plug-in hasn't been updated since 2011, and there are too many problems with it. Here is an example of SortTable Post >> http://chicagoexecutivecoaching.com/smartleadership/smart-leadership-archives/ I've been looking for an alternative. The maker of the TablePress plug-in answered someone asking the same question with: > Instead, you should look into implementing a Page Template with a custom > "The Loop", in which you use WordPress Template Tags to print the output as > a HTML table. You can then add the sorting/search/pagination features to > that table as well, by manually loading the DataTables JavaScript library > (www.datatables.net) into the page. That is a bit beyond my abilities at the moment. How EXACTLY would you do this? I'd need a step-by-step guide to do this. Help is greatly appreciated :)


Add forward slash on categories url (serve one version of a url)

How can I a add forward slash on categories URLs and serve only that version of a category (meaning URLs not ending in forward-slash will redirect to URLs ending in forward slash). I manage to remove the category base using the "WP No Category Base" plugin but I need to add a forward slash on the category URL. Examples:               www.example.com/es  <- this is a category (needs a forward-slash '/')          www.example.com/es/hola.html <- this is a post so, it's ok, no changes needed.      The plugin Permalink Trailing Slash Fixer doesn't solve the problem here.


Limit ONE link per post

I've been browsing around Google for quite some time now, but I have yet to find a close answer. Anyway, is there a way to limit a user to just one link (preferably outbound) per post?


Hide a div when a custom field is empty

I am having trouble hiding a div when the input of a custom field is empty. This is the code I am using but can not seem to get it to work. The field that displays the content is _cmb_fe_wysiwyg                <?php             if( empty( $post->post_content) ) {                //empty                }             else {                   echo '
';                         echo '
Ingredients
';                       echo wpautop( get_post_meta( get_the_ID(), $prefix . '_cmb_fe_wysiwyg', true ) );                        echo '
';                }       ?>


Modify hard-coded conditionals for roles to custom roles

Hopefully this makes sense. I'm still learning. There is a function in a plugin I'm developing that I want to modify to recognize custom roles. My function works when it is hard-coded to accept administrator, editor, author, contributor, and subscriber. However, I'm stuck on modifying the conditional to accept all editable roles. Here is the working code (but hard-coded):                   if ( $current_user->data->wp_capabilities['administrator'] ) {             $role = 'administrator';         } elseif ( $current_user->data->wp_capabilities['editor'] ) {             $role = 'editor';         } elseif ( $current_user->data->wp_capabilities['author'] ) {             $role = 'author';         } elseif ( $current_user->data->wp_capabilities['contributor'] ) {             $role = 'contributor';         } elseif ( $current_user->data->wp_capabilities['subscriber'] ) {             $role = 'subscriber';         }              if ( isset( $role ) ) {             /* If they are an admin then we grant them all permissions that they ask for */             if ( $current_user->data->wp_capabilities['administrator'] ) {                 foreach ( $new_caps as $new_cap ) {                     $capabilities[ $new_cap ] = true;                 }                 $user->add_role( $role );             } /* Otherwise lets check if their role deserves that capability    */             else {                 foreach ( $new_caps as $new_cap ) {                     if ( $wp_roles->get_role( $role )->has_cap( $new_cap ) ) {                         $capabilities[ $new_cap ] = true;                         $user->add_role( $role );                     }                 }             }         }      Instead of if ... administrator then assign role .... it should be a variable. I'm guessing but somehow editable roles should be available (?) such as the following.                   $all_roles = $wp_roles->roles;              $editable_roles = apply_filters('editable_roles', $all_roles);      Can someone help me out and suggest how to rewrite the conditional so it is not hard-coded? Thank you.


Which hook to use to add notification message at beginning of my <body>

i want to add dynamic messages to the beginning of my but I can't figure what hook to use. I have tried get_header but i can't append content to it... any idea? I don't want a solution that requires javasript as i want it to work without javascript.


Search in Two Categories

I want to search in two categories without using the search box at all. So far, I have this code to display the desired categories,               <?php wp_dropdown_categories('child_of=3&hierarchical=1&depth=1&hide_empty=0&name=cat[one]'); ?>     <?php wp_dropdown_categories('exclude=3&hierarchical=1&depth=1&hide_empty=0&name=cat[two]'); ?>      I have names as array cat as I wanted them to GET from URL and build custom query. I have tried many things but failed. I just want the user to just press search and it should display posts that are in "Both" categories. Please help. Thanks.


Link directly to media file through 'add link'

I'm trying to achieve exactly what the title says. I'm building a site for a client, and am trying to make the site as user friendly as possible. They aren't very IT literate, and already are experiencing problems with what is something that is simple. I know it's possible to use 'add media' and then change the text within the media gallery modal, but I think it's worth asking the question. I use a plugin called WP Document Revisions on another site, which sets up what looks like a document repo/custom post type called 'Documents'. You upload a file with a 'document', and then when you highlight your text, click 'add link' in a post or page, you can select the CPT directly from the editor interface under 'Or link to existing content' - the URL returned is that of the actual media file itself (PDF, .doc etc) This works perfectly and allows users to hyperlink whatever text they want, to files really easily but the plugin has a bug whereby I think if you have other CPTs, it doesn't display the 'Documents' option in wp-admin which is super frustrating. A lot of other people have this issue and there's not much going on in the support forums in terms of responses from the devs. As this plugin does what I need, but a whole load of other stuff too, I was just wondering if it's possible to replicate the small feature I need, perhaps through the use of a CPT that returns the URL of the attached file, rather than of the page. Any insight on how this might be achieve would be greatly appreciated.


After I set the title, it over-wrote all the titles for the individual pages

A few days ago I set the title tag for my home page by doing this: Settings => General but it turned out that this didn't just change the title of the home page. It actually changed the title of every page on the site to that one title. What is the way for me to correctly set the title for the home page, and not over-write the titles for all the individual pages? EDIT: To explain things further. I set the title tag to be this:               <title>0xdata - Open source software engineering developer community and events</title>      But now the individual pages have titles like this: Title - Open source software engineering developer community and events » Open source software engineering developer community and events Thank you!


Hiding Google Analytics code based on theme options

I'm doing up a WordPress theme at the moment, and I want users to be able to add Google Analytics to their site by just adding their tracking code -- you know, the `UA-20149670-1` -type number thing. At the moment I have all the Google Analytics JavaScript code sitting in the `<head>` of my pages, with the tracking code being set by the user via a theme option text input form. However, if the user _doesn't_ add a tracking code, then all the Google JavaScript is still left sitting in the `<head>`, without a tracking code, bloating up the header. How can I code this so that the Google Analytics code only appears after the user puts in their tracking code? Additionally, at the moment the Google Analytics code is all still in `header.php` -- ideally I'd like to move it instead to `functions.php`. How best would I do that? Thanks.


How can I replace an oEmbed URL in post with actual embed HTML

What I want is to get the output of the Twitter oEmbed system into my actual posts. IMHO the embed output itself is high-quality, semantic HTML and I'd rather have it inside the post than in the embed metadata in case their js stops working (in which case the tweet would display as a sensible blockquote). So what I need is to hijack the oEmbed system and, upon processing it, replace the embed URL in the post with the HTML from Twitter. Clearly the solution should also be able to handle other kinds of embeds. UPDATE: Just to be clear, I know how oEmbed works by default (i.e. the URL will be replaced with the oEmbed HTML when the 'the_content' filter is run on the post content) and that is not what I want. What I need is a way to hijack that system and, instead of only having the content replaced at display time, have the embed URL itself replaced inside the post_content in the the database with the HTML returned from the oEmbed provider.


Pagination for event query

I'm working on a WP_Query using the Modern Tribe Events Calendar My problem is with pagination. Is this the incorrect way to paginate the WP_Query or could there be another method for paginating the Events Calendar? I found a tutorial that uses the WPNavi plugin but I would like use core wordpress functions.               <?php      $upcoming = new WP_Query();     $upcoming->query( array(         'post_type'=> 'tribe_events',         'eventDisplay' => 'upcoming',         'posts_per_page' => 1)     );          if ($upcoming->have_posts()) : while ($upcoming->have_posts()) : $upcoming->the_post(); ?>                  <?php tribe_get_template_part( 'list/single', 'event' ) ?>          <?php endwhile;          else :          echo 'no upcoming events';      endif;          wp_reset_query();      ?>

<?php posts_nav_link(); ?>


Automatic Wordpress Backup Plugin works, but says it's not

I just installed Automatic Wordpress Backup on a fresh install of wordpress, with no other plugins installed, nothing else has changed from the default install. The plugin is saying zip is not found, I verified with my host that it is, and updated the path for it in automatic-wordpress-backup.php. I also have debug turned on, and am about to have to turn it off due to the number of warnings and notices displayed. It appears to be mostly Notices about deprecated arguments and Warning: Cannot modify header information. It also causes me to just get a blank page after updating info, for example I just changed the permalinks, after I hit save it takes me to a blank page, it made & saved the changes, but I can't tell my client that it's just going to work that way. Is this normal? Any suggestions?


the_post_thumbnail('medium') still gives thumbnail-size img

All the sources mention this as if it worked. Medium size is set to 635x194, but I still get this out:               <img width="100" height="100" title="fjaril" alt="fjaril" class="attachment-thumbnail" src="http://blogg.nassjo.se/klassblogg/files/2012/12/fjaril-100x100.jpg">      As you see, it hard-links to the shrunken thumbnail size. Docs say I should get a class matching the size argument in the img HTML also. Where should I look, and what to fix? I'm just trying to get the first post on the front page to display its featured image medium-sized. I'm modifying content.php in the theme. I can search-and-replace, but that would break if the customer changes thumbnail sizes. The website is here: http://blogg.nassjo.se/ **Update:** Just made a **child theme** , and there, it works as it should. See http://blogg.nassjo.se/klassblogg/ **Update 2** I made a child theme for the main site also, but that did (unexpectedly) _not_ make it work. I have to conclude that the_post_thumbnail('medium') only works on the site where it was posted. I've put the img html in a var and search/replaced to get the medium size and url, and that hack works. I'll leave the question up for a bit, in case someone can help me find the real reason so I can remove the hack.


WP-types not showing per product

I need some assistance I have had a website written by someone, who has took my money and not finished the project. I need to get this finished ASAP and looking for some assistance with what they have done. They have created an online ordering system for a takeaway, and used wp-types plugin to setup ingredients per product. However, what they haven't then done is setup the custom types showing in the basket or in the transaction confirmation email and on the admin orders screen it only shows 1 set of custom meta for the entire order. Anyone able to help with using this plugin. Thanks in advance Simon


Backup Buddy Questions

I have two hosting accounts.   1. Account #1) My personal hosting account   2. Account #2) My reseller hosting account I am hosting a friend/client on my personal account as an `Add On` domain. I just purchased a reseller account and want to move this friend to their own cpanel as an account on my reseller. I've created the new account for them, using the domain name from the WordPress they are hosting on my personal hosting account... I've just purchased BackUp Buddy but have limited faith in the software. I have just created a BackUp Buddy of the site I am trying to save. If I don't remove the `Add On` domain from my personal hosting account the site won't propagate on the new account because it'll link back somehow. I know this because I tried this with an empty site I had. The problem is, when I **remove** an `Add On` domain it deletes ALL the folders. So I would lose the entire site. Here is my thoughts on the process I need to do.   1. Create BackUp Buddy Backup file [done]   2. Download importbuddy.php file [done]   3. FTP Copy the entire Folder structure of the WordPress install as extra measure [done]   4. Remove `Add On` domain [ _scared, not done yet_ ]   5. Change Namerservers to point to new account on my reseller [to do]   6. Run Importbuddy.php [to do]   7. Delete MySQL DB & DBUser on personal account [to do] Then... if there is a problem... I **BELIEVE** I can:   1. Change Nameservers back.   2. Upload copy of files structure. And the site is back... Am I correct? I'm very concerned that something irreversible is going to happen to this site.


Why do folders have Empty Index.php Pages?

1. /wp-content/   2. /plugins/   3. /themes/ All have empty index.php files in it. Are they safe to delete? What is their purpose, why even be in the default install if they're empty? What is their purpose?


Show custom messages on dashboard menu page

How can add custom helper message on dashboard menu page. Say i want to add some message in "Users" menu page. Thanks in advance to all experts bro...


Hosting plugin with excanvas (dependency of flot, jqPlot and more) in official repository?

Considering using flot for graphs in plugin and a little lost with dependencies and licensing here.   1. WordPress repository demands GPLv2-compatible.   2. flot is under MIT license, which is GPL-compatible.   3. flot uses excanvas (for IE compatibility) under Apache License 2.0 which is compatible to GPLv3, but not v2. So is or is not flot compatible to repository? Aside - I had started wiki-style question if you want to suggest and discuss alternative libraries Graphing libraries for WordPress


Manually Removing Plugins

Are there any special procedures needed to remove a plugin manually? I have some plugins I need to remove but can't access the `/wp-admin` area till they are removed.


Need some help with "the_widget()" function

I am trying to create code to display certain default WordPress widgets on my e-commerce site. I have 6 content boxes which display WordPress widgets: • Pages • Latest Posts • Archive (last 12 months) • Blog Post Categories • Blog Calendar • Blog Tag Cloud I was originally using other functions to do this: wp_get_archives, wp_list_categories, etc. and the code I was using worked just fine.. However when I was looking for a way to also include the Blog Calendar and the Tag Cloud widgets, I stumbled across the "the_widget" function. So I thought it wouldn't be a bad idea to use this same function for all of my external widgets. (am I wrong here???) I have actually read the Reference page for this function.. Unfortunately the reference page is incomplete and there are not enough examples on this page or elsewhere on the web to help me figure out how to structure my code. Specifically I don't know what arguments to use to do the following: ~ Limit the number of archive links to only the last 12 months ~ Not display the widget title ~ Limit the recent posts to just the last five posts ~ Limit the number of tags in the tag cloud I cannot find ANYTHING anywhere on the web that would help me figure this out.. Hoping someone here knows the magic answers..


Custom post type permalink structure

I've browsed tons of Q/A on stackexchange, google, wordpress forums... but haven't found yet a definitive answer to what looks like to be a common issue since the introduction of custom post types. I've set my permalinks structure from Wordpress admin permalink settings page as:               /%post_id%/%post_name%/      since this is a good practice to improve database performance however, I noticed my custom post types (I have several in one configuration) still appear as:               %cpt_slug%/%post_name%/      while what I really want is               %cpt_slug%/%post_id%/%post_name%/      and actually would love if it could also work as               %cpt_slug%/%post_id%/%taxonomy%/%post_name%/      but as for now, I would like to get the post_id work in the cpt structure how to achieve this? there was a wordpress plugin but apparently it was withdrawn because had some issues (and anyway is no longer mantained)


Wordpress 3.2(Multisite) - How to add custom user meta fields to signup form?

I want to add custom user meta fields to registration page. I use WP multisite so I have to modify `wp-signup.php`. Adding some field is easy for me(I am programmer :P). But I have a problem with this line of code:               wpmu_signup_user($user_name, $user_email, apply_filters('add_signup_meta', array()));      I have searched all Wordpress with bash command:               find -name "*" | xargs grep -ni "add_signup_meta"      And havent found where exactly is specify `add_filter` for `add_signup_meta`. Can somebody tell me where exactly `add_signup_meta` filter is located? Or maybe where is a easier way to add some fields? WordPress 3.2.1 PS I have tried many plugins for adding custom user fields. Only one is good choice(Cimy User Extra Fields) but unfortunately it doesnt add custom fields for registration(probably this is broken).


get post id using the $query_vars variable

How can I get the ID of a post (or page) based on the $query_vars variable? I want to do something like               $query_vars['post_id']      But I don't have a reference page that has the list of $query_vars perams. The code will be using the template_redirect action hook.


Get posts in archive page

I am using this code to show posts in columns. How can I set this part ('cat=3&numberposts=5&offset=0') as so archive page should automatically get posts from clicked catagory?
          <?php $posts = get_posts('cat=3&numberposts=5&offset=0'); foreach ($posts as $post) : start_wp(); ?>     <?php static $count1 = 0; if ($count1 == "5") { break; } else { ?>          <a href="<?php the_permalink() ?>" rel="<?php _e("bookmark", "solostream"); ?>" title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?>"><?php the_post_thumbnail( 'homepage-thumb' ); ?>
<?php the_title(); ?>
     <?php the_field('price'); ?>

     <?php $count2++; } ?>     <?php endforeach; ?>

          <?php $posts = get_posts('cat=3&numberposts=5&offset=5'); foreach ($posts as $post) : start_wp(); ?>     <?php static $count2 = 0; if ($count2 == "5") { break; } else { ?>          <a href="<?php the_permalink() ?>" rel="<?php _e("bookmark", "solostream"); ?>" title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?>"><?php the_post_thumbnail( 'homepage-thumb' ); ?>
<?php the_title(); ?>
     <?php the_field('price'); ?>

     <?php $count2++; } ?>     <?php endforeach; ?>


Multiple editable content on page [Solved]

* * * EDIT: I've found out that by using Advanced Custom Fields I can edit multiple fields on a page. Why WP doesn't have this feature by default I'll never know. This is the kind of ability I was looking for that PerchCMS has by default. Thanks for your answers. * * * I'm new to writing websites using Wordpress as a CMS, and in the past I've used a CMS called PerchCMS which allows me to add extra multiple sections by using the php tag of:               <?php perch_content('InformationTitle');?>     <?php perch_content('Information');?>     <?php perch_content('AboutTitle');?>     <?php perch_content('AboutContent');?>      With Wordpress I really don't understand how to add multiple sections in this way, I trawled the Internet for answers, but there appear to be no answers anywhere else. Part of my code is as follows:               <?php if (have_posts()) : ?>         <?php while (have_posts()) : the_post(); ?>                       <img src="<?php bloginfo('template_directory'); ?>/assets/img/logo.png" class="fg3 logo" alt="Logo" />

                   <?php the_content('services'); ?>

                   <?php the_content('about'); ?>

      With this method, all the content I write gets repeated. What am I doing wrong? I understand that the loop is there to loop through the posts on the page, and I've seen mention of plugins such to achieve this, but surely Wordpress should offer this by default? There are many many sites that have different sections that need to be edited independently. Any help is greatly appreciated.


How to localize data array in plugin's option page

So i am localizing data saved in an array for my plugin's options, however the data is only localized in the front end, how can I localize data in the plugin's option page as well? The following is what I use to print the data in the front end to be used by my jquery script,               /* localize array data */         $data = get_option('lu_ban_data');          wp_localize_script( 'lu_ban', 'lu_ban_object', $data);


Editor doesn't load properly on my self-hosted WordPress 3.3

I have a self hosted WordPress install on my small VPS running WordPress 3.3.1 powered by nginx. As of the last 3.3 update, the editor fails to load properly - I cannot see the toolbar etc. When trying to load and edit any existing posts, even the text of the post doesn't load. My browser's error console shows the following error: > Uncaught SyntaxError: Unexpected end of input load-scripts.php:153 > > Uncaught ReferenceError: fullscreen is not defined editor_plugin.js:1 Screenshot: ![enter image description here](http://i.stack.imgur.com/7LiqT.png) Any suggestions?


Why do we include jQuery in the header?

I was told not to mess with the core files. Also, I don't want jQuery to load on every single page.


Where is the content cache when using apply_filters('the_content...?

The following code block is giving me an accumulated result:               foreach($sections as $section) {         $content_post = get_post($section->ID);         $content = $content_post->post_content;         $content = apply_filters('the_content', $content);         echo $content;     }      If I catch the value of `$content` _before_ the `apply_filters()`, it seems to work fine, but after and each result is appended to the previous value of `$content`. If I change the final line to:               $content = wpautop($content);      It works as I want (I only need the paragraph formatting), but I am frustrated as I do not understand why the previous method hasn't worked.


Code that displays images - images get shown multiple times

On My category.php page i've got a list of categories with the title and the description. **Here's the code:**               <?php      $cat_id = get_query_var('cat');     $catlist = get_categories('hide_empty=0&child_of=' . $cat_id);     echo "
";          foreach($catlist as $categories_item)     {     echo '
term_id ) . '" title="' . sprintf( __( "View all products in %s" ), $categories_item->name ) . '" ' . '>' . $categories_item->name.'
 ';         echo '
'. $categories_item->description . '
';     }     echo "
";     }     ?>      This code outputs categories that are children of the current category. For example if i'm on a category page called 'Products' the child categories of that will be shown. I'm also using a plugin called Taxonomy Image, so i can assign an image to a category. **Here's the code that shows the image:**               $terms = apply_filters( 'taxonomy-images-get-terms', '' );     if ( ! empty( $terms ) ) {              foreach( (array) $terms as $term ) {             print 'taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'detail' );         }          }      The problem is i want the markup like this.
 category title
 category description             category image      I've got the h1 and the p but if i want the image in the category list the code that displays my image needs to go inside the code that displays my categories. This is where the problem lies, because all of the category images then get shown under every category. So under the first category title and description all of the images will be shown, then the same under the second category and so on. How can i combine the code to get the markup i want and only show the correct image for each category and not all of the images? I appreciate this might not be very clear but i've tried to explain it the best i can. Thanks


how to render dashboard widgets conditionaly in wordpress admin

I would like to render some custom dashboard widget conditionally. If logined user have more than or equal to editor role I would like to render some more widgets than a user with subscriber role. How to do this? Any help please...


Easy way to change custom post type name for permalinks?

I've pretty much finished building a site based around a theme that uses a custom post type called portfolio. Now, having just switched my permalinks to a custom structure, posts of that type display as www.mywebsite.com/portfolio/postname I want it to be called 'projects' instead of portfolio so it displays www.mywebsite.com/projects/postname Changing the name throughout the site take forever as it's referenced on numerous occasions in the various php files. Is there an easy way to change this without manually replacing?


How To make Custom page of every Category

Hii i have seen many blogs which posted thing in the same design for example if you see this http://www.songs-pk.info/2011/nayika-malayalam-2011/ there page create alwayz in the same style download button and play button and the same td tr combination how can i make this mean did we just have to give links once we create page ? or how this all is possible for maximum time saving


Setting up wordpress on a hosting server for the first time

I'm moving a wordpress CMS installation from one host to another. Pretty straightforward I think. I have moved applications running on a Tomcat server but not wordpress. Is the following correct - Restore the database from backup - Can I create a backup dump using wordpress admin GUI or do I need to manually restore on DB itself. Would you recommend using the 5 minute install - http://wordpress.org/download/ ? Once wordpress and the database is intalled on hosting site apply any theming to the CMS. Are there any pitfalls I should watch out for ? Am I on the right track ?


Editor html formatting is different from view source

Here's what I see when I click on the HTML tab in the editor...
                    Test ...          test test test? test, test, i.e.,       ... Get Content Here
      And here's what I see when I look at view source in Chrome and FF:

                     Test …

                 test test test? test, test, i.e.,
                  … Get Content Here

      Any ideas what's going on?


Nextgen gallery show thickbox/shutter from link instead of image

I'm trying to show the gallery in a thickbox or shutter window from a link. if i have a gallery [nggallery id=1] i want to have a link "view photos" and when i click on it a thickbox/shutter window should popup. i have this working for shutter:
[nggallery id=1]
     View photos      and this working for thickbox:
[nggallery id=6]
     View photos      It opens but the images count is wrong.It counts the gallery images + the images in the page.In this case my gallery has 13 images but the first image(the one in the link) appears twice and then the count is 14 instead of 13.This is really annoying!! is there a way to solve it? Is there an alternative to show the gallery via single link?


When and Where to use wp_insert_post()

I'm building a function that creates a group of pages with a common parent ID. If I run wp_insert_post() on a parent ID twice, does the function create the pages twice while altering the slugs? Or am I safe to put this in my functions.php like so:               add_action('init', 'AddMyPages');


Custom-Posttype & Custom Taxonomy WP_Query

I add a custom post type with custom taxonomy and i wish to get all postings into this by a template, but the result is 0               $args=array(       'post_type' => 'contents',       'post_status' => 'publish',       'tax_query' => array(           'taxonomy' => 'content-category',           'field' => 'id',           'terms' => array(5,26,28)       ),       'meta_key' => 'fs16'     );     $query = new WP_Query($args);      The SQL-Query is followed (don't know why):               SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) JOIN wp_icl_translations t ON wp_posts.ID = t.element_id AND t.element_type = 'post_contents' JOIN wp_icl_languages l ON t.language_code=l.code AND l.active=1 WHERE 1=1 AND 0 = 1 AND wp_posts.post_type = 'contents' AND (wp_posts.post_status = 'publish') AND (wp_postmeta.meta_key = 'fsk16' ) AND t.language_code='en' GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10      What's going wrong here?


My title won't update

No matter how many times I go into settings, and update my website title, it remains the same. And does not update? I've tried clearing my cache, uninstalling my old theme, searched through source files, and CANNOT figure out why - my title just won't update. Any suggestions?


Support for simultaneous editing

I'd like to allow multiple authors/editors to simultaneously edit a single page. Each author should immediately see any changes made by any other users concurrently editing the page (just like happens in Google Docs). Is there any way to do this in Wordpress? Is there any plugin that makes it possible?