Show array of meta_value in Edit Post Coloum

what I'm trying to do is add a new coloumn to Edit post page (done) and in that coloumn show data taken from a set of custom fields (partially done). This is my code (I use it as a plugin so it simpler to modify it). It adds the metabox in posts so I can easily add custom fields.               <?php     // the plugin base directory     global $maismeta_base_dir;     $maismeta_base_dir = plugin_dir_url(__FILE__);          // Add the Meta Box     function add_custom_meta_box() {         add_meta_box(             'custom_meta_box', // $id             'Impostazioni di ricerca', // $title              'show_custom_meta_box', // $callback             'post', // $page             'normal', // $context             'high'); // $priority     }     add_action('add_meta_boxes', 'add_custom_meta_box');          // Field Array     $prefix = 'custom_';     $custom_meta_fields = array(         array (             'label' => __('Proprietario','maismeta'),             'desc'  => __('Inserisci le informazioni sul proprietario.','maismeta'),             'id'    => $prefix.'textarea_proprietario',             'type'  => 'textarea',         ),         array (             'label' => __('Sesso affittuario','maismeta'),             'desc'  => __('Inserisci il sesso disponibile.','maismeta'),             'id'    => $prefix.'checkbox_group_sesso',             'type'  => 'checkbox_group',             'options' => array (                 'Uomo' => array (                     'label' => __('Uomo','maismeta'),                     'value' => 'Uomo'                 ),                 'Donna' => array (                     'label' => __('Donna','maismeta'),                     'value' => 'Donna'                 ),                 'Altro' => array (                     'label' => __('Altro','maismeta'),                     'value' => 'Altro'                 )             )         ),         array (             'label' => __('Numero occupanti','maismeta'),             'desc'  => __('Inserisci il numero degli occupanti.','maismeta'),             'id'    => $prefix.'checkbox_group_occupanti',             'type'  => 'checkbox_group',             'options' => array (                 '1' => array (                     'label' => __('1','maismeta'),                     'value' => '1'                 ),                 '2' => array (                     'label' => __('2','maismeta'),                     'value' => '2'                 ),                 '3' => array (                     'label' => __('3','maismeta'),                     'value' => '3'                 ),                 '4' => array (                     'label' => __('4','maismeta'),                     'value' => '4'                 ),                 '5' => array (                     'label' => __('5','maismeta'),                     'value' => '5'                 ),                 '6' => array (                     'label' => __('6','maismeta'),                     'value' => '6'                 ),                 '7' => array (                     'label' => __('7','maismeta'),                     'value' => '7'                 ),                 '8' => array (                     'label' => __('8','maismeta'),                     'value' => '8'                 ),             )         ),         array (             'label' => __('Facoltà di riferimento','maismeta'),             'desc'  => __('Scegli le facoltà di riferimento.','maismeta'),             'id'    => $prefix.'checkbox_group_facolta',             'type'  => 'checkbox_group',             'options' => array (                 'Agraria' => array (                     'label' => __('Agraria','maismeta'),                     'value' => 'Agraria'                 ),                 'Economia' => array (                     'label' => __('Economia','maismeta'),                     'value' => 'Economia'                 ),                 'Farmacia' => array (                     'label' => __('Farmacia','maismeta'),                     'value' => 'Farmacia'                 ),                 'Giurisprudenza' => array (                     'label' => __('Giurisprudenza','maismeta'),                     'value' => 'Giurisprudenza'                 ),                 'Ingegneriea' => array (                     'label' => __('Ingegneriea','maismeta'),                     'value' => 'Ingegneriea'                 ),                 'Lettere e Filosofia' => array (                     'label' => __('Lettere e Filosofia','maismeta'),                     'value' => 'Lettere e Filosofia'                 ),                 'Lingue e letteratura straniera' => array (                     'label' => __('Lingue e letteratura straniera','maismeta'),                     'value' => 'Lingue e letteratura straniera'                 ),                 'Medicina e chirurgia' => array (                     'label' => __('Medicina e chirurgia','maismeta'),                     'value' => 'Medicina e chirurgia'                 ),                 'Scienze della formazione' => array (                     'label' => __('Scienze della formazione','maismeta'),                     'value' => 'Scienze della formazione'                 ),                 'Scienze matematiche fisiche e naturali' => array (                     'label' => __('Scienze matematiche fisiche e naturali','maismeta'),                     'value' => 'Scienze matematiche fisiche e naturali'                 ),                 'Scienze politiche' => array (                     'label' => __('Scienze politiche','maismeta'),                     'value' => 'Scienze politiche'                 )             )         ),          );          /* jQuery era qui */          // The Callback     function show_custom_meta_box() {         global $custom_meta_fields, $post;         // Use nonce for verification         echo '<input type="hidden" name="custom_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';              // Begin the field table and loop         echo '
';         foreach ($custom_meta_fields as $field) {             // get value of this field if it exists for this post             $meta = get_post_meta($post->ID, $field['id'], true);             // begin a table row with             echo '
                     '.$field['label'].'	                     ';                     switch($field['type']) {                         // text                         case 'text':                             echo '<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$meta.'" size="30" />
'.$field['desc'].'';                         break;                         // textarea                         case 'textarea':                             echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" cols="60" rows="4">'.$meta.'</textarea>
'.$field['desc'].'';                         break;                         // checkbox                         case 'checkbox':                             echo '<input type="checkbox" name="'.$field['id'].'" id="'.$field['id'].'" ',$meta ? ' checked="checked"' : '','/>                                     '.$field['desc'].'';                         break;                         // select                         case 'select':                             echo '<select name="'.$field['id'].'" id="'.$field['id'].'">';                             foreach ($field['options'] as $option) {                                 echo '<option', $meta == $option['value'] ? ' selected="selected"' : '', ' value="'.$option['value'].'">'.$option['label'].'</option>';                             }                             echo '</select>
'.$field['desc'].'';                         break;                         // radio                         case 'radio':                             foreach ( $field['options'] as $option ) {                                 echo '<input type="radio" name="'.$field['id'].'" id="'.$option['value'].'" value="'.$option['value'].'" ',$meta == $option['value'] ? ' checked="checked"' : '',' />                                         '.$option['label'].'
';                             }                             echo ''.$field['desc'].'';                         break;                         // checkbox_group                         case 'checkbox_group':                             foreach ($field['options'] as $option) {                                 echo '<input type="checkbox" value="'.$option['value'].'" name="'.$field['id'].'[]" id="'.$option['value'].'"',$meta && in_array($option['value'], $meta) ? ' checked="checked"' : '',' />                                          '.$option['label'].'
';                             }                             echo ''.$field['desc'].'';                         break;                         // tax_select                         case 'tax_select':                             echo '<select name="'.$field['id'].'" id="'.$field['id'].'">                                     <option value="">Select One</option>'; // Select One                             $terms = get_terms($field['id'], 'get=all');                             $selected = wp_get_object_terms($post->ID, $field['id']);                             foreach ($terms as $term) {                                 if (!empty($selected) && !strcmp($term->slug, $selected[0]->slug))                                      echo '<option value="'.$term->slug.'" selected="selected">'.$term->name.'</option>';                                  else                                     echo '<option value="'.$term->slug.'">'.$term->name.'</option>';                              }                             $taxonomy = get_taxonomy($field['id']);                             echo '</select>
Manage '.$taxonomy->label.'';                         break;                         // post_list                         case 'post_list':                         $items = get_posts( array (                             'post_type' => $field['post_type'],                             'posts_per_page' => -1                         ));                             echo '<select name="'.$field['id'].'" id="'.$field['id'].'">                                     <option value="">Select One</option>'; // Select One                                 foreach($items as $item) {                                     echo '<option value="'.$item->ID.'"',$meta == $item->ID ? ' selected="selected"' : '','>'.$item->post_type.': '.$item->post_title.'</option>';                                 } // end foreach                             echo '</select>
'.$field['desc'].'';                         break;                         // date                         case 'date':                             echo '<input type="text" class="datepicker" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$meta.'" size="30" />
'.$field['desc'].'';                         break;                         // slider                         case 'slider':                         $value = $meta != '' ? $meta : '0';                             echo '

                                     <input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$value.'" size="5" />
'.$field['desc'].'';                         break;                         // image                         global $secondazona;$secondazona = plugin_dir_url(__FILE__);                         case 'image':                             $zonaimmi = $secondazona.'images/image.png';                                 echo ''.$zonaimmi.'';                             if ($meta) { $zonaimmi = wp_get_attachment_image_src($meta, 'medium');  $zonaimmi = $zonaimmi[0]; }                                          echo    '<input name="'.$field['id'].'" type="hidden" class="custom_upload_image" value="'.$meta.'" />
                                             <input class="custom_upload_image_button button" type="button" value="Choose Image" />                                              Remove Image
'.$field['desc'].'';                         break;                         // repeatable                         case 'repeatable':                             echo '+
';                             $i = 0;                             if ($meta) {                                 foreach($meta as $row) {                                     echo '
|||                                                 <input type="text" name="'.$field['id'].'['.$i.']" id="'.$field['id'].'" value="'.$row.'" size="30" />                                                 -
';                                     $i++;                                 }                             } else {                                 echo '
|||                                             <input type="text" name="'.$field['id'].'['.$i.']" id="'.$field['id'].'" value="" size="30" />                                             -
';                             }                             echo '
                                 '.$field['desc'].'';                         break;                     } //end switch             echo '
';         } // end foreach         echo '
'; // end table     }          function remove_taxonomy_boxes() {         remove_meta_box('categorydiv', 'post', 'side');     }     add_action( 'admin_menu' , 'remove_taxonomy_boxes' );          // Save the Data     function save_custom_meta($post_id) {         global $custom_meta_fields;              // verify nonce         if (!wp_verify_nonce($_POST['custom_meta_box_nonce'], basename(__FILE__)))              return $post_id;         // check autosave         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)             return $post_id;         // check permissions         if ('page' == $_POST['post_type']) {             if (!current_user_can('edit_page', $post_id))                 return $post_id;             } elseif (!current_user_can('edit_post', $post_id)) {                 return $post_id;         }              // loop through fields and save the data         foreach ($custom_meta_fields as $field) {             if($field['type'] == 'tax_select') continue;             $old = get_post_meta($post_id, $field['id'], true);             $new = $_POST[$field['id']];             if ($new && $new != $old) {                 update_post_meta($post_id, $field['id'], $new);             } elseif ('' == $new && $old) {                 delete_post_meta($post_id, $field['id'], $old);             }         } // enf foreach              // save taxonomies         $post = get_post($post_id);         $category = $_POST['category'];         wp_set_object_terms( $post_id, $category, 'category' );     }     add_action('save_post', 'save_custom_meta');               /* nuova posizione */     // enqueue scripts and styles, but only if is_admin          ?>      As you can see I have 2 sets of checkboxes the first one with 3 possible values: **'Uomo','Donna','Altro'** So the user can easily choose 1,2,3 or all the values. Then I have this to show 2 more coloumns in my edit-post-page:               // ALL POST TYPES: posts AND custom post types     add_filter('manage_posts_columns', 'colonne_informative_head');     add_action('manage_posts_custom_column', 'colonna_proprietario', 10, 2);               // ADD NEW COLUMN     function colonne_informative_head($defaults) {         $defaults['custom_textarea_proprietario'] = 'Proprietario';         $defaults['custom_checkbox_group_sesso'] = 'Sesso occupanti';         return $defaults;     };          // SHOW THE FEATURED IMAGE     function colonna_proprietario($column_name, $post_ID) {         if ($column_name == 'custom_textarea_proprietario') {             $post_colonna_proprietario = get_post_meta($post_ID, 'custom_textarea_proprietario', true);             if ($post_colonna_proprietario) {                 echo $post_colonna_proprietario;             }         };               if ($column_name == 'custom_checkbox_group_sesso') {             $sesso_occupanti = get_post_meta($post_ID, "custom_checkbox_group_sesso", true);           //check that we have a custom field           if ($sesso_occupanti != "")           {             // Separate our comma separated list into an array             $sesso_occupanti = explode(",", $sesso_occupanti);             //loop through our new array             foreach ($sesso_occupanti as $sesso)             {               echo $sesso ;             }           }             };          };      I have no problem with coloumn named: **custom_textarea_proprietario** because it was relatively easy to echo only 1 value. But I have no idea about how to echo the values of second coloumn named: **custom_checkbox_group_sesso** actually it only echoes ' **Array** ' and nothing else. If I open Php my admin and look for the data I'm storing I can see this: **a:3:{i:0;s:4:"Uomo";i:1;s:5:"Donna";i:2;s:14:"Giurisprudenza";}** What i would like to echo in my coloumn in that case is:   * Uomo   * Donna Then one more coloumn with:   * Giurisprudenza I'm almost a newbie in this kind of things so please be nice with me and try to explain things step by step.


Creating Custom Meta Boxes on Plugin Option Page

Right in my main plugin file, wp-email-capture.php I am calling this:-               add_action( 'admin_init', 'wp_email_capture_add_custom_boxes');      This calls this function:-               function wp_email_capture_add_custom_boxes()     {            add_meta_box("wp_email_capture_admin_supportbox", __('Support', 'WPEC'), "wp_email_capture_admin_supportbox", "wpemailcaptureoptions","side");            //do_meta_boxes( 'wpemailcaptureoptions', 'normal' , NULL); - removed as per SE advice     }      And separately this function:-               function wp_email_capture_admin_supportbox()     {             echo "
If you are having problems with this plugin, please read the Frequently Asked Questions, or alternatively submit a support request.
";     }      I open the WP Email Capture Options page (which has a slug of wpemailcaptureoptions) and I don't see any box, or anything in the sidebar. It's completely baffled me. I _suspect_ it is something on how it is called, I tried with `add_action('add_meta_box',...`, but then even the function wasn't being called. Ideas? If you need anything else, please let me know :) **Edit** I have now moved the "do_meta_boxes" to the options page where I want the meta box displayed and still having no joy, here's the function that manages the option page:-               function wp_email_capture_show_lists()     {         $lists = wpecp_get_all_lists();     do_meta_boxes( 'wpemailcaptureoptions', 'normal' , NULL);         echo '
';         echo '
Lists
';     ?>

         <?php _e('List Name','WPEC'); ?>	         <?php _e('Edit','WPEC'); ?>	               <?php _e('Delete','WPEC'); ?>

         <?php _e('List Name','WPEC'); ?>	         <?php _e('Edit','WPEC'); ?>	               <?php _e('Delete','WPEC'); ?>

          <?php          foreach ($lists as $list)     {          ?>
         <?php echo $list->listid .". ". $list->listname; ?>	          <?php          if ($list->listtype == 2)         {                  $url = $_SERVER["REQUEST_URI"] . "&wpecr_listid=".$list->listid."&external=1";              } else {                  $url = $_SERVER["REQUEST_URI"] . "&wpecr_listid=".$list->listid;         }      ?>              <a href="<?php echo $url; ?>">Edit	           <?php          if ($list->listid != get_option('wp_wpecp_default_list'))         {                  $url = $_SERVER["REQUEST_URI"] . "&delete_listid=".$list->listid;          ?>               <a href="<?php echo $url; ?>">Delete      <?php         }     ?>
     <?php         }              echo '

';         echo "
Add New WP Email Capture List Add New External List
";         echo '

';          } ?>


Same content shared between multiple posts?

I want to have some cotent shared between various posts. **Why?** I am writing a series of posts on backbone js. The thing is every post has some common content ie from where you can download the source code etc. Now everytime I want to make a new post, I just copy paste that same content. Now one problem is: modifying the content. Today I want to modify the content in all the post. Now I have to manually edit the content in each post. It will be great if I can use a shared copy something like partial in ruby on rails and just edit that shared copy and all the post having that shared copy get modified. Any suggestions, plugins etc.


Build dynamic page from cURL (HTML page) response with plugin

I feel like I am missing something simple here, but can't figure it out I need to have my plugin build links to a page that is built entirely via a cURL response. I am building a plugin that interfaces with an external API to pull data and build a dynamic list (of jobs) that is displayed via shortcode. Each list item needs to link to the job advertisement. Through this API, these advertisements are provided (via another cURL) as completed HTML. For each cURL request, a client_id is required which is stored in the wordpress database. The other thing required is a simple ID referring to the job. I originally created a PHP file that had the cURL as a function and pulled the ID from a query string. The link was built with like this:               $_ad_link =  plugins_url( 'includes/ad.php' , dirname(__FILE__) );      But the cURL depends on access to the database in order to pull the client_id (serves as the password). This file doesn't seemed to be recognized as a wordpress file and so does not know what to do with `get_option`in that case. I am not supposed to pass the client_id in any way through the browser via javascript or anything like that. Else I would simply include it in the query string or use AJAX (though I have no experience in AJAX, such as if there is a way to give it the client_id securely). Is there any way to include this file within Wordpress in some way and link to it properly as I hope to do? Or is there another way to take the cURL response (a full HTML page) and display is from a click on a list element? The flow should be:   * User views list of jobs (on the front-end of the site).   * User clicks on a job (link).   * User sees job advertisement (a full HTML file returned from a cURL request). I have a client_id that I need from the wp database and the id of the job (that I can pass through the link). I would like to display the job advertisement as its own page, rather than fooling with an iframe or something of that sort. EDIT: As mentioned in the comments below, I would ideally like to output the cURL response in a new "page" that has only that content. I originally tried to do this by creating a page that had only the cURL request as a function that then output the response to the page. The job-list items would then link to this page which would call the cURL. I need that page (the cURL request) to have access to the wp database, however, and function properly within wordpress. As it was, it would error with get_option. (I am pulling the right id for the job from a query string)                 $job_id = $_SERVER["QUERY_STRING"];       parse_str($job_id);       if(isset($jobid)) {             build_jobad();       }          function build_jobad() {       global $jobid;       $sg_ad_url = 'curl-url-goes-here';                  $cm = curl_init($curl_url);                  $options = get_option('plugin_options');             $clientid = $options['client_id'];                  curl_setopt($cm, CURLOPT_USERPWD, $clientid);             curl_setopt($cm, CURLOPT_HTTPHEADER,  Array('Content-Type: application/json;charset=utf-8'));                  $jobs_ad_output = curl_exec($cm);             curl_close($cm);     }      Is there someway to do it this way? Is there something I am missing to allow this php page to function within wordpress? I assumed it would not work unless it were a template page, which I do not want to create. The cURL response needs to be the **only** html output on the page.


Themes VS Plugins

If I am customizing a WordPress site, should I do that via a theme or a plugin? By customization I mean:   1. Add new custom post type   2. Add new fields to the Users   3. Add new widgets   4. Add custom permalinks I am leaning to creating new plugins for the above, and leave the theme for styling, however I wanted to confirm if this is the right approach. Thanks.


How to load jquery tag-it plugin into admin?

I'm trying to load tag-it jquery plugin into the wordpress back-end for the category edit page, but for some reason I can't. The following are snippets of my code:               function tag_category_fields($tag){         $t_id = $tag->term_id;         $cat_meta = get_option( "category_$t_id");         $tag_items_list = individual_tag();         ?>
         <?php _e('Available Categary Tags'); ?>	                  <form class="category_tag_list_values">         <select id="list_category_tags" name="list_category_tags" style="width: 300px; padding: 5px; overflow-y: auto;" multiple="multiple">         <?php foreach($tag_items_list as $tags){ ?>             <option value="<?php echo $tags->tag_id ?>"><?php echo $tags->name ?></option>         <?php } ?>             </select>
         <input class="uibutton" style="width: 75px" type="button" value="add">         </form>

         <?php _e('Current Category Tags'); ?>	                              <input id="myTags" type="text" />

                     <?php _e('Current Category Tags'); ?>
         <?php     }      This is the html for the added boxes on the page:                  function my_plugin_admin_init() {             wp_enqueue_script( 'myTagScript',              plugins_url( '/js/tag-it.js' , __FILE__ ));             wp_enqueue_script( 'myCategoryTagScript',              plugins_url( '/js/category_tags.js' , __FILE__ ));             wp_enqueue_script("myUi","https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js");        }          function my_plugin_admin_scripts() {             wp_enqueue_script( 'myTagScript' );             wp_enqueue_script( 'myCategoryTagScript' );             }      How I'm loading the scripts for the pages:               jQuery(document).ready(function($){         $("form :button").click(function() {         alert($('#list_category_tags').val());         });                   $('#myTags').tagit();     });      I'm using this plug-in https://github.com/aehlke/tag-it


How can I import a class privately into a plugin?

I've written a Wordpress plugin that makes use of a simple controller/templating library I have authored, to separate out business logic from presentation. I have a (slightly theoretical) query about how to import this "privately" into a plugin in a way that doesn't clash with other plugin usages. The library, called `TemplateSystem`, is a submodule in my git repo for the plugin, and is defined internally thus:               <?php          // Don't define this if it's already been defined     if (!class_exists('TemplateSystem'))     {         abstract class TemplateSystem         {             ...         }     }      Thus, if another plugin makes use of `TemplateSystem`, the loaded copy will be used, rather than creating an error by redefining it. That is fine normally, but now `TemplateSystem` has had a backwards-incompatible change introduced. So, I have two versions of the same library that need to be loaded at the same time. As it stands, either the newer library will break the older plugin, or the older library will break the newer plugin, depending on what order the plugins are loaded by WP. So, here's one potential change to `TemplateSystem` that solves the problem:               <?php          // The 'Change2' part would change with backwards incompatible changes,     // rather than just version numbers (although that would be fine tbh)     namespace TemplateSystem\Change2;          // Don't define this if it's already been defined     if (!class_exists('TemplateSystem\Change2\TemplateSystem'))     {         abstract class TemplateSystem         {             ...         }     }      To avoid name clashes in my use case, I can do this:               <?php     use TemplateSystem\Change2\TemplateSystem as VersionedCommentsTemplateSystem;          class VersionedCommentsController extends VersionedCommentsTemplateSystem     {         ...     }      That works fine alongside the older (non-namespaced) version. Now, I mentioned that this question is theoretical, since I'm the author of the templating library and (although it is publicly available) I don't think anyone else is using it. So, one solution is to ignore this problem; however, it would be good to know how to deal with it properly! Second possibility: the namespace solution above will work fine, except that namespaces require PHP 5.3, and - as various answers on this site show - WP ain't moving from a deprecated version soon. Should I ignore that and require PHP 5.3, even if core isn't moving? That would of course prevent any plugin based on my work from operating on an older server. Or, if you think that plugins (and their libraries) are best requiring just 5.2.4, what is the alternative fix? I was considering a bundled PHP console "build" script that just does some trivial search and replaces, such that the library name is replaced by a custom name for each plugin; thus, the `TemplateSystem.php` file is copied and the copy's class definition renamed internally as `VersionedCommentsTemplateSystem` (i.e. according to the use case). That's rather hacky, but would at least work with more installations. Last possibility, add the change or version number into the class name:               <?php          // Don't define this if it's already been defined     if (!class_exists('TemplateSystem2'))     {         abstract class TemplateSystem2         {             ...         }     }      That would work with 5.2.4+, but is my least preferred solution; my inner purist baulks at the corruption of the class name! What approach would experienced plugin-authors go towards?


Exclude post type with pre_get_posts?

I am using pre_get_posts for a custom taxonomy archive display. Now I added a post type 'photo' sharing the same taxonomy with default post type. How can I exclude 'photo' posts being fetched by the taxonomy archive loop by updating my existing function?               function my_breakfast_query ( $query ) {     // not an admin page and is the main query     if (!is_admin() && $query->is_main_query()){     if (is_tax( 'food', 'breakfast' )){       $tax_query = array(         'relation' => 'OR',         array(           'taxonomy' => 'category',              'field' => 'id',              'terms' => array( 366 )         ),         array(             'taxonomy' => 'food',              'field' => 'id',              'terms' => array( 364 )         )       );       $query->set('tax_query', $tax_query);      }      }     }     add_action( 'pre_get_posts', 'my_breakfast_query' );


Rewrite the HTML markup of wp-login.php

How can I completly rewrite the markup of the login page in wordpress? I dont want to just change labels or the logo... I need to completly rewrite the structure of the page. Thanks ahead!


How to get the cropped image from media library?

i have the url of an image (full size). During the upload it already generates a smaller version (i added this in functions). How can i get this cropped version when i have the full size url? The Image is not in a post so i can't use post-thumbanil() The image is in a slider on the Homepage


Homepage redirects to other site of mine?

I have a website in which the home page **redirects** to a different site, which is also from me. I tried getting on it yesterday and then, it was fine. But now, this evening, when I never touched a thing, it keeps me redirecting to the other site of mine, which is not what I want of course. What the hell goes wrong? It has frustrated me, because I was planning to go live today. Can someone help me out please? I checked all the `plugins`, `index.php`, .`js` files and searched all of the files to see if there is a hardcoded link, but without success. Besides, I have checked my `database` and there I could not find a thing to. PS: only the homepage redirects. Other parts of my website like /contact does not redirect.


Woocommerce: is it possible to replace "download" a file with simply read the file on screen?

woocommerce is the perfect tool for what I want to do, except that I want clients to access a html5 page they paid for (not downloading it). Apparently woocommerce doesn't do this... Do you know a complementary plugin that could do that, or can you give me advices to modify this in woocommerce files? Tx in advance! BI


Are shortcodes case-sensitive?

If I write a plugin and register a shortcode using this code:               add_shortcode('footag', 'footag_func');      and a user uses this in their post:               [FOOTAG]      Is it supposed to work?


Auto update date time 1 times per day?

How to update automatically date time of page to current time only 1 time per day? Example: I write a post on May 28, 2013. And if today is June 9, it will change may 28 to June 9. And if today is June 10, it will change June 9 to June 10. How to do this? Thank you very much !


Searching by meta values showing inappropriate result

I am working on a custom search by meta value and using this:               print_r($_REQUEST);     $args = array(         'post_type' => 'property_post',         'posts_per_page' => 10,         'order' => 'ASC',         'meta_query' => array(                          'relation' => 'OR',                          array(                           'key' => 'custom_textarea',                           'value' => 'me',  // if I use static keyword it works                           'compare' => 'LIKE'                           ),                           array(                           'key' => 'custom_price',                           'value' => array( $_REQUEST['custom_price'], $_REQUEST['custom_price1'] ),                           'type' => 'numeric',                           'compare' => 'BETWEEN'                           ),                           array(                           'key' => 'custom_beds',                           'value' => $_REQUEST['custom_beds'],                           'compare' => '='                           ),                           array(                           'key' => 'custom_bath',                           'value' => $_REQUEST['custom_bath'],                           'compare' => '='                           ),                           array(                           'key' => 'custom_garage',                           'value' => $_REQUEST['custom_garage'],                           'compare' => '='                           )                           )          );      If I use some static keyword for meta value then it works, but with `$_REQUEST` it doesn't. I checked `$_REQUEST` using `print_r($_REQUEST)`:               Array ( [custom_textarea] => aa[custom_price] => 1000 [custom_price1] => 4000[custom_beds] => 2[custom_garage] => 1)      So what should I do to make it work?


Ugly permalinks stopped redirecting to pretty URLs

I have a WordPress 3.2.1 site hosted on a DreamHost shared Debian/Apache server. Since I set up the site two years ago, it's been set to the `/%year%/%monthnum%/%postname%/` permalink structure. It was also redirecting URLs like `/?p=204` and `/?page_id=1836` to their "pretty" counterparts. Now, however, I'm seeing entries in my statistics packages (Piwik & Google Analytics) for the "ugly" URLs. Indeed, they're not redirecting to the canonical locations any more. Does anyone know of a plugin that has been shown to cause a problem like this? Could W3 Total Cache be contributing? I think I updated it sometime in the last few weeks; I was definitely tweaking the settings. (If it helps, my plugin list is published on this page.) I'll debug manually when I have the time, but meanwhile I thought I'd give the #lazyweb a shot.


How do I modify the "Insert Media" lightbox in the admin to only show media items from a category?

I am attempting to resolve a problem I continue to have with the media library. Essentially, what I am looking to do is "automatically" assign media which is uploaded from a custom post type "edit post" page to a predefined category. Based on other answers on this site I have found various people discussing solution (one of these links is below) which allow you to "manually" assign a category to media library elements. My aim however is to somehow define specific post types and the associating category which should be applied. At the same time I would also like the ability to restricting a "specific post type" so when the media library lightbox is requested from the edit post page that the "media library" ONLY shows items within the categories I define. I know this might sound a bit confusing so let me provide a quick example. Let's say I have a custom post type called "employee news". Now let's say that someone proceeds to add/edit a post within this custom post type. Let's further assume that he now uses the editor to add content and now want to add one/more images. As expected he would select the "add media" button above the editor and either (a) upload a new image or (b) select an image from the media library. THESE are the two areas I am talking about. What I need is the correct code to put into my functions.php file so that either one or both of the following can be set individually: (a) Ability to specify a custom post type and define the hidden category name to be associated with any file uploaded to the media library. (b) Ability to specify a custom post type and define the "restricted categories" to be used when presenting the files available for the user to select from. How can this be achieved correct? Related Question related to Category assignment of media elements: Can I add a Category Metabox to attachment? Related Question related to conditional logic related to the media library: Conditional add_filter?


How do I set up my blog home page to show only this weeke's posts automatically?

on my WPWeekly.net website, I am currently having to set the number of posts to show manually in the Setup->Reading. Is there a snippet that will let me have the home page blog show only the current week's posts automatically? Thanks!


how to modify comments form

how i can modify comments form, my theme just call:               <?php comment_form(); ?>


get a simple array of all of the term names that exist in all taxonomies

I may be going about this all wrong but I'm trying to use get terms to get all of the terms that exist in every taxonomy. I think this might be a php question. get_terms allows you to specify which taxonomies it gets terms from in array like this...               get_terms( array(post_tag, category, nav_menu, link_category, post_format), $args )      That works, but I'm writing a plugin and if people have custom taxonomies manually entering the array will not work. So I figured the solution would be to use get taxonomies to generate that array. The problem is, it comes back as an associatave array and I need a simple array. So I did this...               $myarray = 'array('. implode(', ',get_taxonomies('','names')) .')';      which, if I echo $myarray, returns: array(category, post_tag, nav_menu, link_category, post_format) perfect; That's exactly what I have manually entered. now I should be able to stick $myarray in get_get terms where I have it manually entered and it should get everything. Nope. It doesn't like it. Here's the entire snippet of code, along with a pic of what get's echoed out. You can see that $myarray is exactly the same as what's in the working get_terms but it's breaking the second get_terms.               $myarray = 'array('. implode(', ',get_taxonomies('','names')) .')';          echo $myarray . '
';     echo 'array(category, post_tag, nav_menu, link_category, post_format)

';          print_r(get_terms( array(post_tag, category, nav_menu, link_category, post_format), $args )); echo '

';     print_r(get_terms( $myarray , $args )); echo '

';      Result: http://i.imgur.com/tMJUmaz.jpg


Incorporate single WordPress page into an existing static website

I have a static website and I recently created one single WordPress page, or template, that I am trying to incorporate into my existing static site. I am having trouble. My single WordPress page looks exactly like my static site. The WordPress page can be found at 3elementsreview.com/wordpress. I am ultimately trying to get the WordPress page to take the place of 3elementsreview.com/submit (the submit page is temporarily not there as i have taken it down trying to get the wordpress php page to replace it). In addition, I would like my Wordpress page to have the extension submit.html as the static page has. Where am I going wrong with this? Thanks


How to Integrate MailChimp with Contact Form 7

I am trying to integrate a check box, so that the user can opt-in to my MailChimp newsletter, into the Contact Form 7. I used this tutorial : http://www.silenceit.ca/2011/02/28/how-to-integrate- mailchimp-with-contact-form-7 Everything works (sends the data to the email address, and also sends data to mailchimp) But the confirmation dialog never shows up. Only a red box. The function works perfectly though. I think it is because contact form 7 was updated since that blog post. If anyone can help. PLEASE Let me know. My URL: http://s137929.gridserver.com/contact/


Can I output a custom taxonomy as a submenu in the site navigation menu?

I'm building a WP 3.2 site with a couple of custom post types and taxonomies. I'm calling one of these custom post types _programs_ , and its associated taxonomy is called _topics_. I'd like to add an item called "Topics" in the site's horizontal navigation, with a dropdown submenu that lists all categories in the _topics_ taxonomy. Each submenu item would then link to its respective category archive page. Is this possible? I assumed this would be pretty easy in WordPress, but I've been searching around for a while to no avail. **EDIT:** This blog post and plugin come close, but it seems to only apply to blog categories (that is, I don't see how to adapt it for a custom taxonomy).


orderby field - list of available options?

I would like to sort items by the "order" field of the page attributes (see pic). ![enter image description here](http://i.stack.imgur.com/8Fk1r.png) I've come across all kinds of "custom tag" solutions but not one listing all of the _already available_ fields you can use with orderby. I'd like to use the "order" field as shown in the editor. I'd tried replacing the orderby field in the template with "order" but I don't see any results. I'm currently using:               post_type=projects&order=ASC&orderby=order&offset=1&posts_per_page=100


Problems with my conditionals in single.php by category

In my single.php file I would like to have a conditional that checks for the category of the post and display certain images and layout. Here is what I have: http://pastebin.com/dy6TE1yr


Human time difference in months instead of days. How?

I use the following code in my template.               <?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago'; ?>      It shows like 2 days ago, 20 days ago, 90 days ago. Is there a way to show 1 week ago instead of 7 days ago, 1 month ago instead of 30 days ago, 1 year ago instead of 365 days ago? Thanks


Filter WordPress posts by between parameter

How to filter WordPress posts by a taxonomy and between parameter? Consider a mobile website with "memory size" taxonomy, I need to show posts that have more than 256 mb memory and less than 768 mb. Is it possible through WP_Query class or "posts_where" filter? I know that post_meta is better for this purpose, but website has been built before.


add oembed provider

I want to add oembed provider to my buddypress activity content I found this function               <?php wp_oembed_add_provider( $format, $provider, $regex ); ?>       I know I need it to add with `init` filter I've contacted developers of that site and they gave me oembed link. so site is http://www.myvideo.ge/ and they gave me this link: http://embed.myvideo.ge/flv_player/player.php?video_id=xxxx.format so if video is http://www.myvideo.ge/?video_id=2119027 I need to contact http://embed.myvideo.ge/flv_player/player.php?video_id=2119027.mp4 But I have no Idea how to sum everything this


Truncate custom post type content

I am customizing a widget used for displaying testimonials. The widget is working fine, except it shows all content and i want to limit the text/characters so the footer of the website looks balance. Here is the widget code snippet:               function widget( $args, $instance ) {         extract( $args );              $title = $instance['title'] ;         $count = $instance['count'];         $url = $instance['url'];              echo $before_widget;         echo '
';          if ( $title )             echo '
' . $title . '
' ;             ?>         <?php              $query = new WP_Query();             $query->query('post_type=testimonial&posts_per_page='.$count);             ?>             <?php if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); ?>
                 <?php limit_text(the_content(), 15); ?>                                           <?php echo get_post_meta(get_the_ID(), 'pkb_author_name', true); ?>
             <?php endwhile; endif;?>      To truncate it, i use this:               function limit_text($text, $limit) {         if (strlen($text) > $limit) {             $words = str_word_count($text, 2);             $pos = array_keys($words);             $text = substr($text, 0, $pos[$limit]) . '...';         }              return $text;     }      Its not working. What am i doing wrong here?


Ajaxing function in widget class

I want to ajax function declared in function Widget in widget Class ,it have arguments belong to the widget i try this code               add_action('wp_ajax_my_func', 'my_func');     add_action('wp_ajax_nopriv_my_func', 'my_func');      but when call it by ajax it Returned nothing , i use console.log for data response it returned 0 ,when i moved the function to function.php it work.   it's possible to works in the widget class??   my widget function               public function widget( $args, $instance ) {         // outputs the content of the widget               extract( $args );             $title = $instance['title'];             $number = $instance['number'];                  //ajax func.             function loadMoreP($number){                 query_posts('showposts='.$number.'');                 while(have_posts()) : the_post();                 echo '
'.get_the_title().''.the_post_thumbnail('thumbnail').'

';                 endwhile;                 wp_reset_query();                 die();             }             add_action('wp_ajax_loadMoreP',     array($this,'loadMoreP'));             add_action('wp_ajax_nopriv_loadMoreP',    array($this,'loadMoreP'));                       echo $before_widget;             echo $before_title .$title.$after_title;             echo '
';             echo '
';             echo '

<input type="button" id="loadMoreW"    value="Load More" data-offset="'.$number.'">';             echo $after_widget;         }      and the ajax code               $('#loadMoreW').on('click',function(){         $.ajax({             url: 'wp-admin/admin-ajax.php',             type: 'POST',             data: {                 action : 'loadMoreP',                 offset: $('#loadMoreW').data('offset')                  },             success: function(data){                 console.log($('#loadMoreW').data('offset'));                 console.log(data);                 $('#loadMoreW').data('offset', $('#loadMoreW').data('offset')+2);                 $(data).appendTo('.LatestPosts');             }         });      });


Change event firing in wordpress

I have to run a function when a post is published. The function checks a custom meta value and works accordingly. I am using couple of hooks for this purpose:               new_to_publish     draft_to_publish     pending_to_publish     auto-draft_to_publish      Now, `new_to_publish` and `auto-draft_to_publish` are not working. It looks like these two hooks run much earlier than `add_post_meta` hook. As a result, my function doesn't get any meta value and doesn't work. I tried:               add_action('new_to_publish', 'my_custom_function', /*high priority value here*/)      But that doesn't work. Any help is appreciated! Thanks!


How to get Post data from Contact Form 7

Is there any way that I can get POST data from contact form 7. I need those to store in a separate database. I think I can get these values by editing the core of the plugin, but with out that is there a way I can fetch form input values.


Replacing with(out) regex link to attachment by links to files

I tried to do it myself but I have really hard time with Regex (regex is hell. I just don"t understand). Anyway, I think this would be usefull to some people. The context is that we use a plugin to display images in post in a lightbox. It works only if we create the link to the file (the image) and NOT the attachment page. Most of the time, authors forgot to check, lightbox don't pop in, and everyone is disappointed. Bad HTML (note the attachment word in the `href` and that the `href` doesn't end with .jpg) :

      So I guess we could do something like (in the logic) :               function remove_bad_img_links($content) {     $matches = array();     $check_for_attachment_word = preg_match('/]*href\s*=\s*(attachment)([\"\']+)([^>]+?)(\1|>)/i', $content, $matches);     if ( $check_for_attachment ) {                 $image_url = preg_match('/]*src\s*=\s*([\"\']+)([^>]+?)(\1|>)/i', $content, $matches);                 preg_replace('/]*href\s*=\s*(attachment)([\"\']+)([^>]+?)(\1|>)/i', $content, $image_url);          }     return $content;     }     add_filter( 'the_content', 'remove_bad_img_links' );      (I know the code is wrong, ^^, I really don't get regex at all) To produce corrected HTML (the value in the `img src` has remplaced the initial value of the `a href` that was detected as wrong because it contains the word attachment (of simply do it all the time) :

      But writing it, I ask myself if it's really possible, considering that a post could have several occurences of those links... Just asking for reference : is it possible, is it a good idea, what would the regex look like ? I could do it in JS but it would better to SEO to do it in the generated code. EDIT : More research tell me that "Thou shalt not use regular expressions to parse HTML". A better approach is to use DOM : http://stackoverflow.com/questions/3820666/grabbing-the-href-attribute-of-an- a-element Definitively, I was thinking it wrong, it's very bad to parse HTML : http://www.codinghorror.com/blog/2009/11/parsing-html-the-cthulhu-way.html. I will try to use DOM and will come back with update.


Custom query incorrectly returning everything

I'm missing something somewhere, but I cannot connect the dots. Everything outputs properly except that the query returns everything from the DB, not just posts. Can anyone spot a reason for this behavior? Having messed around a bit, I know it's related to add_filter, removing it allows the query to function normally. However, I still don't know what is causing the unintended behavior. **Solved:** I left out a period...I forgot to concatenate the $where parameter passed into my_posts_where(). Gawd. I have been staring at this for 3 hours...               // Filter 'posts where' so we can limit the date range of a custom query     function my_posts_where( $where = '' ) {          // Posts from the last 30 days     // ERROR $where = " AND post_date > '" . date( 'Y-m-d', strtotime( '-30 days' ) ) . "'";     $where .= " AND post_date > '" . date( 'Y-m-d', strtotime( '-30 days' ) ) . "'";     return $where;     }          // Output a list of the most popular entries from the past 7 days     function my_popular_entries() {          // Filter the query     add_filter( 'posts_where', 'my_posts_where' );     $args = array(         'posts_per_page' => 12,         'orderby' => 'meta_value_num',         'meta_key' => 'Views',         'post_type' => 'post',     );     $query = new WP_Query( $args );     remove_filter( 'posts_where', 'my_posts_where' );          // Create the list, assuming we have posts     if ( $query->have_posts() ) :         $html = '

Popular Entries

';              while ( $query->have_posts() ) : $query->the_post();                  $html .= '

';             $html .= '

' . get_the_title() . '

';             $html .= '

';         endwhile;              $html .= '

';         echo $html;              // Reset the post variable         wp_reset_postdata();     endif;     }


Show different badge based upon the user role

## Problem I have authors page and I need to display a different badge for Authors and Subscribers. Authors on the site have certain abilities that differ from Subscribers and I would like to display a different badge based upon their role. ## Example So when somebody comes to the site either admin author, visitor subscriber... they see the badge on the authors page they are visiting based upon their role. If they are looking at the user who's role is 'Author' than the badge is green, and if the users role is 'Subscriber' then the badge is red. Is it possible and how do I make it? ## This code doesn't do the trick :( I was trying to go with this logic but it shows the badge based upon who is looking the authors age not of the author who owns the page. Please help :)                <?php if( is_author_of_current_page() &&  current_user_can('Author') ) { ?>            green badge           <?php } elseif( is_author_of_current_page() &&  current_user_can('Subscriber') ) { ?>            red badge           <?php } ?>


How to check if this is the nth instance of a given shortcode in a post

Suppose I have a shortcode called `[item]`, which I have used 20 times in a particular post. Is it possible, from within the shortcode handler function, to know what the numerical index of the given `[item]` is? Like, whether this is the 1st `[item]` in the post, or the 16th? I know that I would be able to achieve the same result by manually adding an attribute, such as `[item order="1"]` and `[item order="16"]`, but I want to make things as easy as possible when adding and rearranging content. Items are often added, deleted and rearranged in the editing process, and it would be tedious and prone to error for the author and editor to re-number them with every change. Is there a good way to do this? Would it require global variables? Is that bad?


how to not show plugin in admin area

I'm just getting started with wordpress development. I'm trying to create a simple plugin that show results from a db in a table. I can do this, but I'm having trouble with the plugin showing at the top of the admin pages. I'm not sure why it does this. my plugin function:               add_action('init','hello_world');         function hello_world()         {                  global $wpdb;             $query = "Select ID, post_title                       From $wpdb->posts Limit 0, 10";             $results = $wpdb->get_results($query, ARRAY_A);                  echo "

";             echo "

header	header	header	header

";             echo "

                                         Previous

                                         1

                                         2

                                         3

                                         4

                                         5

                                         Next

";             echo "
";             $i = 0;             while($i < 10)             {                 foreach ($results as $item)                 {                     $postID = $item['ID'];                     $postTitle = $item['post_title'];                          echo "
";                     echo "" .$postID."	";                     echo "".$postTitle."	";                     echo "
";                     $i++;                 }             }                  echo "
";             echo "

";         }      calling in index.php                   <?php             if(is_admin())             {                  }             else             {                 if(function_exists('hello_world')) {                     echo "
";                     hello_world();                     echo "
";                 }             }         ?>      how can I prevent this from showing in the admin section?


How to Modify Default Text in a Custom Taxonomy Admin Panel?

I’d like to make a tiny change in one of my custom taxonomy admin panels: rename the label "Description" to "Title".


Change Login URL Without Plugin

I want to change the login url of my Wordpress install away from /wp-admin.php I am aiming to do so and am looking at changing the .htaccess file to add in:               RewriteRule ^login$ http://yourdomain.com/wp-login.php [NC, L]      From what I gather however, going to /wp-admin will still allows people to login using that link. I was thinking of doing some sort of PHP redirect so that when the user types in /wp-admin it goes to the 404 not found page. What is the best way to change the login URL without using a plugin and with the highest security standards?


Linking from CPT page to taxonomy.php

I created a CPT which allows the user to add people to the page. I have already created a page template for displaying all people. This page also displays all categories used for people. My problem: How do I achieve that when the user clicks on a category only people who have this category are displayed? Here are the relevant code excerpts: **function.php** (registering the taxonomy):               function create_people_taxonomies() {         $labels = array(             'name'              => _x( 'Categories', 'taxonomy general name' ),             'singular_name'     => _x( 'Category', 'taxonomy singular name' ),             'search_items'      => __( 'Search Categories' ),             'all_items'         => __( 'All Categories' ),             'parent_item'       => __( 'Parent Category' ),             'parent_item_colon' => __( 'Parent Category:' ),             'edit_item'         => __( 'Edit Category' ),             'update_item'       => __( 'Update Category' ),             'add_new_item'      => __( 'Add New Category' ),             'new_item_name'     => __( 'New Category Name' ),             'menu_name'         => __( 'Categories' ),         );              $args = array(             'hierarchical'      => true, // Set this to 'false' for non-hierarchical taxonomy (like tags)             'labels'            => $labels,             'show_ui'           => true,             'show_admin_column' => true,             'query_var'         => true,             'rewrite'           => array( 'slug' => 'categories' ),         );              register_taxonomy( 'people_categories', array( 'people' ), $args );     }     add_action( 'init', 'create_people_taxonomies', 0 );      **page-cpt-people.php** (page template on which the categories are being displayed):               <?php                  $taxonomy = 'people_categories';             $terms = get_terms($taxonomy); // Get all terms of a taxonomy                  if ( $terms && !is_wp_error( $terms ) ) :             ?>
                     <?php foreach ( $terms as $term ) { ?>
<a href="<?php echo get_term_link($term->slug, $taxonomy); ?>"><?php echo $term->name; ?>
                     <?php } ?>
             <?php endif;?>                  ?>      **My questions:**   * Which file name do I need to give to my taxonomy page so that the user is directed to this page when he clicks on one of the categories in page-cpt-people.php?   * Which code does the taxonomy page need to contain so that the loop displays only those people who have the category selected?


Global functions on WPMU

I work in a multisite environment where all of the sites are related. A lot of recent developments have required me to copy and paste certain functions into many different theme folders, which causes problems if I need to update them everywhere. What would be the best way to have a global "functions.php" file? My thoughts are either to include a file in the themes folder and include it, or create a plugin and network enable the plugin.


Custom post type capability type 'page' not working

I'm trying to create a custom post type that's supposed to be used for a publication issue -> article structure. Since the hierarchical structure is really only meant for pages (refer to `hierarchical` section's note), I figured I'd configure the custom post type to act as a page. Great, except I can't get it to work properly. Even after setting `capability_type` to `page` and `hierarchical` to `true`, the edit screen for the post type is still acting as though it's a post. There aren't any "parent" or "page template" attribute drop down menus. If I change the `capability_type` from `page` to `post`, literally nothing changes with the edit screen. Here's my code:               register_post_type('publication', array(         'label' => 'Publication',         'public' => true,         'show_ui' => true,         'show_in_menu' => true,         'capability_type' => 'page',         'map_meta_cap' => true,         'hierarchical' => true,         'rewrite' => array('slug' => 'publication', 'with_front' => true),         'query_var' => true,         'supports' => array('title','editor','comments','revisions','author','page-attributes'),         'labels' => array (             'name' => 'Publications',             'singular_name' => 'Publication',             'menu_name' => 'Publications',         )     ));      Any ideas what's wrong here?


Default Timezone setting in WordPress - is that global?

Despite the WordPress Options' Timezone setting for the whole WordPress installation, **is it necessary to declare the default timezone in all the date/time places in a WP theme/plugins?**               date_default_timezone_set('Asia/Dhaka');     echo date('d M Y - D - h:i A');      Suppose I'm handling with something where I'm checking whether the date&time is equals to **_TODAY_**. You know what "Today" means is a bit variable - variable to server time, variable to local time etc. That's why I'm looking for a standard procedure to follow in WP projects, whether to set the default timezone each and every time (or do I call them always in the header?) or to avoid them as WordPress itself declared that already (just tune that before). I'm just looking for a standard procedure - what to follow...


Sort loop with query in the link

I want to add some buttons that will sort the post by name asc/desc etc. I want to use query in the link like this               http://domain.tld/?orderby=name&order=asc      Is this safe to use? Are there rewrite rules i can use to change orderby=name to order-name and order=asc to ascending?


WP FullCalendar Image Thumbs on Full Calendar

I’m trying to get WP FullCalendar to display the Event thumbnail in the associated cell on the Calendar. The #_EVENTIMAGE code works fine in the regular calendar, but when entering the shortcode into the "Event Title Format" under "Full Calendar Options" under General tab, the thumbnail just displays as the HTML and not the actual image. Any help would be greatly appreciated


Rolling Back from current WordPress version to previous one

What happens if we rollback from (for example) 3.8 to 3.5.1 and keep the same new DB created by the current version? Will that break anything?


How can I prevent a writer from being able to edit an article that has been scheduled?

In the old WordPress that I had, the writer (a type of user that could not publish) was, after an article was schedule, unable to go back to the article and edit it. But now in WordPress 8.1 they (the writers) are able to go back and edit a schedule article. Is there a way to stop this? writer = contributor


Link to attachment for old articles. Rewrite all pictures to link to attachment page

Can anyone help with a functions filter for old images? Right now all images are without link. For new posts i can add manually link to attachment but for old posts ? http://imgur.com/RMRY3h8 How i can do for old posts to add link to attachment? Thanks


Know which plugin is calling JS in wp_head()?

I'm trying to optimize my header and I was wondering which plugin would call jquery. Is there a debugging tool to know which plugin is doing what in the header ? Thanks !


wp_customizer control default value = 100 - control value

Within WP_Customizer I have two controls for setting the width of the main- column and the width of the sidebar. The default value of the main-column control is 77 and I'd like to set the default value of the sidebar control to equal 100 - whatever value the main-column control is set to, so it will at first display at 23 but if the main-column control changes, then the sidebar control will also change automatically. Is it is currently it outputs a static value of -100 in the sidebar field.               class Customizer_InlineNum extends WP_Customize_Control {         public $fieldwidth = 'text';         public $type = 'number';              protected function render() {             $id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) );             $class = 'customize-control customize-control-' . $this->type; ?>                  <li id="<?php echo esc_attr( $id ); ?>" class="<?php echo esc_attr( $class ); ?>" style="clear:none;display:inline-block;max-width:<?php echo $this->fieldwidth . "%"; ?>">                 <?php $this->render_content(); ?>
         <?php }              public function render_content() { ?>                              <?php echo esc_html( $this->label ); ?>                 <input type="number" <?php $this->link(); ?> value="<?php echo intval( $this->value() ); ?>" />                      <?php }     }          $wp_customize->add_setting( 'pcolumn_width', array (         'default'    => '77',         'type'       => 'option',     ) );     $wp_customize->add_control( new Customizer_InlineNum( $wp_customize, 'pcolumn_width', array (         'label'    => 'Primary Column',         'type'     => 'number',         'section'  => 'customizetab_site',         'fieldwidth' => '33',     ) ) );          $wp_customize->add_setting( 'sidebar_width', array (         'default'    => intval(get_theme_mod('pcolumn_width')) - 100,         'type'       => 'option',     ) );     $wp_customize->add_control( new Customizer_InlineNum( $wp_customize, 'sidebar_width', array (         'label'    => 'Sidebar',         'type'     => 'number',         'section'  => 'customizetab_site',         'fieldwidth' => '33',     ) ) );


Create Administration Menu

Long story short, I am creating an Administration UI for my Homepage Slider, therefore I am hooking to the `admin_menu` as explained in the wordpress codex. Basically, structure wise, I have only to pages:   1. A page with all the slides - 'View All Slides'   2. A page to add a new slide - 'Add New Slide' I want all of the above to go under 'Homepage Slider' category. To get a better idea think how 'Pages' is displayed in the Dashboard. Nevertheless, here is my menu function:               add_action('admin_menu', 'bones_home_slider_menu');          function home_slider_menu() {         add_menu_page('Homepage Slider View',             'Homepage Slider',             'manage_options',             'home_slider_main',             'home_slider_main'         );              add_submenu_page('home_slider_main',             'Add New Slide',             'Add New',             'manage_options',             'home_slider_add_new',             'home_slider_add_new'         );          }      The problem is that `add_menu_page` creates the main menu item and a submenu when used with 'add_submenu_page': ![enter image description here](http://i.stack.imgur.com/aIzb5.png) I've tried to create another submenu, however I don't know how to make 'Homepage Slider' disappear from the submenu.


Which query method to use? (edit- wpdb syntax problems)

I am trying to create a query in order to get all the metadata from a custom post type named match_reports that is associated with a meta_key and meta_value in another custom post type named team_page. The common denominator is the id of team_page which is a meta_value in match_reports. Therefore each team has match reports associated with it whether they are the home or away team. Eventually the results will be looped through in a table so that each team is listed next to its own statistics. I've tried using WP_Query to do this but without much luck: Looping through tabular data and today I've been trying with $wpdb where I was having some trouble with the syntax: Here is what I've come up with so far:               global $wpdb;     $querydetails = "       SELECT wposts.*        FROM $wpdb->posts wposts,        INNER JOIN $wpdb->postmeta wpostmeta.* ON wposts.ID = wpostmeta.post_id       WHERE wposts.post_status = 'publish'       AND wposts.post_type = 'match_report'       AND wpostmeta.meta_key = 'report_home-select'       AND wpostmeta.meta_value = '198'     ";          $teaminfo = $wpdb->get_results($querydetails, OBJECT);      I would love any help or suggestions on the best way to approach this. I know it can be done but its a bit beyond me. I'm also happy to read any tutorials or articles on dealing with $wpdb or complex queries using WP_Query.


How to validate XML-RPC post creation and cancel when needed?

I have an IFTTT recipe that creates posts for me on some occasion, but for some weird reason it creates three, sometimes four posts of the same content. I would like to add an `add_action` hook/callback to validate what will be a new post and, if it already exists, cancel the post, or move it to trash or something like it. I found the the `xmlrpc_prepare_post` but I don't think I can cancel it from there. Unless I can update some attribute and set it to trash?


Copy my user account's wp-admin dashboard layout to other users?

On the Dashboard tab in wp-admin in my user account, I have certain items hidden in Screen Options and I have the panels arranged in a particular way. I want to copy the same layout to my other administrative users, so that they can see certain information and so that I can more easily remotely explain things when I need to. I assume that this information is contained in a database table. What would I need to copy to where?


Display current category without an active link in wp_list_categories

I appreciate your time in looking into this for me. I'm using `wp_list_categories` tag to display a list of categories in my navigation menu and I'd like to disable the link to the current category when viewing said category page. My main reason is that the color attribute in my CSS style for `li.cat-item a` is overriding the color attribute for my CSS style for `.current-category a` and blocking my attempts to create a contrasting text color for the current category item.


How to list recent posts in a wp nav menu?

I've been trying this for some time and didn't get no clear answer. I need to display 11 recent posts inside one of my menu items. My menu is like: > ITEM 1 · MAMBA · ITEM 3 I need to display post titles and respective url's when rollover MAMBA. I got this code from Joeyjoejoe's Category menu item and its last 10 posts as sub- menu but pasted as is I can get recent posts for all submenu items as categories. I had to change it a bit to appear only in MAMBA:               $category_ten_last_posts = array(         'showposts' => 11,         'category_name' => 'mamba',      and the target item:               $post->menu_item_parent = 45;      saddly the code started to repeat the recent posts list, in a duplicated maner: Mamba .......... Post 16 Post 15 ... Post 16 Post 15 ... My question here is how to list a controlled number of recent posts from a choosen category to a specific Menu Item? Thank you for all the help you can give. Best regards. H.


How to add custom meta box under Gallery Settings in the "Edit Gallery" popup

I am developing a theme. I want to add option for the user to choose the type of the gallery which he is adding. Will it be a slider, masonry gallery or some other type. I cannot figure it out how I can add custom meta data in the media popup. Here in the screenshot I am showing where I would like to put it. ![enter image description here](http://i.stack.imgur.com/oAh8w.jpg) I would like to add SELECT, with OPTIONs of the Gallery type. Thank you


echo a shortcode in a shortcode code?

I have a code for shortcode like this [mt_ptcolumn size="pricing-3-col" title="Bronze" price="$99" period="1 domain" button="Purchase" url="#"] and I want to add a shortcode inside button="" like this [mt_ptcolumn size="pricing-3-col" title="Bronze" price="$99" period="1 domain" **button="[another-shortcode]"** url="#"] but it doesnt work. So how do I edit the code below to make it works?               if (!function_exists('mt_ptcolumn')) {         function mt_ptcolumn($atts, $content = null) {             extract(shortcode_atts(array(                 'title'     => 'Basic',                 'price'     => '$40',                 'period'    => 'per month',                 'url'       => '#',                 'button'    => 'Buy Now!'             ), $atts));                  $ptoutput ='';             $ptoutput .= '
'."\n";             $ptoutput .= '
'.$title.'
'."\n";             $ptoutput .= '

'.$price.''.$period.'

'."\n";             $ptoutput .= '
'.$button.'
'."\n";             $ptoutput .= '
'."\n";             $ptoutput .= do_shortcode($content);             $ptoutput .= '
'."\n";             $ptoutput .= '
'.$button.'
'."\n";             $ptoutput .= '
'."\n";                  return $ptoutput;         }         add_shortcode('mt_ptcolumn', 'mt_ptcolumn');     }      Thank you


Global post is always custom post type last post

my global $post is always taking the object of my custom post type "advertisement". So when i'm editing e.g. "Hello world" which post id is 1, it shows me post id of the last advertisement post. If there are no advertisement posts, it works great. Just add that this is happening when metabox is shown in normal context. When it's displayed in side context it also works fine.


Restricted access for other user roles

I have made some restrictions on other user roles than the administrator. I've made it because I use WooCommerce. I have added the following code to my themes functions.php file, and it works fine.               function remove_menus()     {         global $menu;         global $current_user;         get_currentuserinfo();              if($current_user->user_level < 10)         {             $restricted = array(__('Pages'),                                 __('Media'),                                 __('Links'),                                 __('Custom Post Name'),                                 __('Comments'),                                 __('Appearance'),                                 __('Plugins'),                                 __('Users'),                                 __('Tools'),                                 __('Settings'),                                 __('Posts'),                                 __('Produkter'),                                 __('Kontrolpanel'),                  );             end ($menu);             while (prev($menu)){                 $value = explode(' ',$menu[key($menu)][0]);                 if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}             }// end while         }// end if     }     add_action('admin_menu', 'remove_menus');      I want to hide "WooCommerce -> Settings", but I cannot figure out how to make it happen in the above code? Can someone help me?


Collapse subcategories in post edit screen

Is there a plugin to collapse/expande subcategories in post edit screen? In other words I'm looking for analog of CMS Tree Page View plugin, but for categories.


How would you accomplish the following advanced settings page?

Currently I'm developing a new theme for my business. This theme will have a header section with a drop down menu, a slideshow on the background and three featured images with a title, a description and an URL pointing to a page. Here is a screenshot of the website that I put together in Photoshop. So I want those featured images appear in the Theme Options page and let myself (the admin) edit the followings:   * Image (select, upload, reset, etc. #uploader)   * Title (e.g.: Who are we? #textbox)   * Description (e.g.: Here's some important thing about us #textbox)   * Page URL - the page to redirect the user when she clicks on the image (eg.: /pages/about-us #dropdown) There will be 3 featured images each containing 4 properties as it defined above. That is 12 properties altogether. I want to make a nice options page to manage these images and their properties but that couldn't be accomplished by using the standard Settings API functions (`add_settings_field`) that generates a table like form. I don't want 12 text boxes but rather than a nice UI where UI I can upload images, select pages (for the Page URL property) and even set the order of the images (best would be `jquery.ui.sortable`). How would you guys accomplish this scenario?


Replace default avatar

I've searched google quite a bit and every site has the same filter but it doesn't seem to be working for me. Not sure if it's my setup or just old code. I'm trying this:               add_filter( 'avatar_defaults', 'newgravatar' );            function newgravatar ($avatar_defaults) {         $myavatar = get_bloginfo('template_directory') . '/img/blog_noPhoto.jpg';         $avatar_defaults[$myavatar] = "Default Avatar";         return $avatar_defaults;     }      However, when I look at my template code it's adding http://0.gravatar.com/avatar/?d= before the full URL of the image. I am using the "User Avatar" plugin but it seemed to be the same if I disabled that.


remove permalink trailing slash

I need to use the_permalink() in order to construct a simple link from each post . the link should be like               http://www.mysite.com/category/year/post-name?output=something..      I use ?output=something" > the problem is that the trailing slash of the permalink is giving me an extar trailing slash that is breaking my link .               http://www.mysite.com/category/year/post-name/?output=something..       I know that I can construct the structure in another way , but I want to use the permalink (much easier) and i do not want to change the permalink structure sitewide ... any way of getting rid of the trailing slash ??


is_front_page use in sidebar.php

I want to introduce some code into sidebar.php dependant on whether the site was on the front page or not. ( I have a static front page and am using the front-page.php file ). To cut a long story short, I have done some testing and I now have the following code in BOTH my front-page.php file and also in the sidebar.php file; but the two bits of code are displaying conflicting results. The same page is telling me both that I am on front page and not on front page at the same time. The reality is that I actually AM on front page so the question i have is this. Is there something wrong with using the tag is_front_page() in sidebar.php ?               if( is_front_page())            echo "you are on front page";            else            echo "you are not on front page";


How to stack name list in non-alphabetical order?

an update on this: I managed to change from 'orderby'=>'title' to 'orderby'=>'date'as suggested. This almost made the order perfect except one clarinet that falls out of the order and is placed in the wrong place. As far as I know understand, this could be an error in the programming since everything else works in the right order? See: http://www.dnbe.no/ensemblet/ and second from top left: Eirik Jordal , klarinett, should be further down. Anybody knows? Thanks, Martin G, Norway. The whole code:                   <?php get_featured_posts('musicians'); ?>

Musikerne i Det Norske Blåseensemble

                     <?php                         global $post;                         $posts = get_posts(array(                             'post_type'=>'dnbe_musician',                             'post_status'=>'publish',                             'orderby'=>'date',                             'order'=>'ASC',                             'numberposts'=>-1                         ));                         if($posts){                             $c = 0;                             $al = count($posts);                             $r = round($al / 3);                             $id = 1;                             foreach($posts as $post){                                  $post_custom = get_post_custom($post->ID);                                 if($c == 0){ ?>
                                 <?php                                  }                                 if($post_custom['dnbe_musician_instrument'][0] != ''){                                     $instrument = ', '.$post_custom['dnbe_musician_instrument'][0];                                 } else {                                     $instrument = '';                                 }                                 ?>                                 <div class="dnbe_musician" musician_id="<?php echo $id; ?>">
<a href="<?php echo get_permalink($post->ID); ?>"><?php echo $post->post_title.$instrument; ?>

                                 <?php                                 $c++;                                 if($c == $r+1){                                      $c = 0; ?>
                                 <?php }                                  ?>                             <?php $id++;                             }                         }                         wp_reset_query();                     ?>

      Thanks in advance, Martin G, Norway * * * I¨m trying to stack the names of our musicians in the right, non-alphabetical, order on the web page. In the cms the order is right, but on the web page the names are listed alphabetically. The homepage is made by a company, but I now try to edit some parts myself. How do I fix this inside cms? Check out the list here: http://www.dnbe.no/ensemblet/ The code is:                   <?php get_featured_posts('musicians'); ?>

Musikerne i Det Norske Blåseensemble

                     <?php                         global $post;                         $posts = get_posts(array(                             'post_type'=>'dnbe_musician',                             'post_status'=>'publish',                             'orderby'=>'title',                             'order'=>'ASC',


Emailing passwords: Setup installed on home server using XAMPP

I've just delved into the WP world and all in all it's going quite well. I have a server at home that I'm using to host the sites. All is working fine except the password emails are not being sent when a user registers. I've hunted quite a lot online but none of the posts that I've found relate specifically to my scenario. Someone hints at 'all i need to do is set the correct ini options' but that's where the clues ended as the topic was closed. My setup is using xampp with virtual hosts being used to redirect the urls. Any help is hugely appreciated. thanks!


Return only content in excerpt field in loop

I am sure this has been asked before, but I can't seem to find the answer, although it seems simple enough. I have built a custom theme based on another person's design. He uses both the excerpt and the body on the archive pages (using the excerpt as a verbose subhead) and the first 20 words of post's body as the excerpt. For this site, all posts will have a body, but not all posts will have the excerpt. If the excerpt field is blank, I don't want an excerpt to show, unfortunately WP auto-pops the_excerpt() and get_the_excerpt() with a truncated chunk of the content. Is there a way - in The Loop - to only show an excerpt if the actual excerpt field is populated - that is without doing yet another DB call or using custom fields? Thanks.


How to Implement SAM Broadcaster with Wordpress?

I want to implement SAM Broadcaster software in wordpress. This is radio automation software. my client wants to implement with wordpress because he want to add some articles and videos regularly with this software. Current Site: www.radiojazzplus.com Already some of them Implemented in wordpress and their Link is 1.http://classicalmusicbroadcast.com 2.http://operamusicbroadcast.com. i can't open both sites due to ip lock for my country (India).I found plugin here Sam Broadcaster plugin but it's not working fully. If you had done already like please Help me to figure out this problem. i was digging my head for past 4 days and i want your help friends. Thanks in Advance. :)


wp_insert_post let users post to without login...broke

this question has been answered on stackoverflow. here is a link http://stackoverflow.com/questions/4321914/wp-insert-post-with-a- form/4321975#4321975 i'm trying to let users post to my site by using the `wp_insert_post()` function..               <?php $postTitle = $_POST['post_title'];         $post = $_POST['post'];         $submit = $_POST['submit'];              if(isset($submit)){                  global $user_ID;                  $new_post = array(                 'post_title' => $postTitle,                 'post_content' => $post,                 'post_status' => 'publish',                 'post_date' => date('Y-m-d H:i:s'),                 'post_author' => $user_ID,                 'post_type' => 'post',                 'post_category' => array(7,100)             );                  wp_insert_post($new_post);              }          ?>      I got this hooked up to a form on a category page               <form method="post" action="">      <input type="text" name="post_title" size="45" id="input-title"/>          <textarea rows="5" name="post" cols="66" id="text-desc"></textarea>                <input type="hidden" name="cat" value="7,100"/>           <input class="subput round" type="submit" name="submit" value="Post"/>     </form>      I don't know what id did wrong..it's not working. any ideas? thanks


How to convert all links to no follow links of particlular section of a webpage

I just wanna convert all links to no follow links which are being displayed in sidebar or footer or comments. How can i do this?


How to get the post editor and media library to respect HTTPS administration mode?

I have a site with FORCE_SSL_ADMIN turned on. When I'm editing a post with an embedded image, or when I'm viewing images through the media library, they are loaded using the http:// protocol rather than https. This causes a mixed- content warning in IE, which clients kind of freak out about. Does anyone have a recommended approach for finding/replacing these non-secure image URLs while viewing them through the admin? The frontend loads over regular http, so I don't want to do any replacing in the DB that will force images to load over https outside of the admin. I figure this has to be a common problem, so I'd appreciate any advice, even if it's "you can't do that".


I am looking for a way to activate a WordPress plugin via a SQL query. I am aware you can login and hit "activate" on the particular plugin, but I would like to automate the activation as part of a release process. I came across this question which makes me think that it may not be possible as the activate plugins are stored in `wp_options` in a specific format. I am using a heavily-modified version of WordPress 3.3.1.


Billing Same As Shipping issue : Strange loading of the website within the website frame in Firefox and Chrome

I have a website running the latest version of Wordpress and WP E-commerce plugin. On the checkout page, when users click the "Shipping same as billing" box, it forces the website to load within the frame of the checkout page. This happens both in Firefox and Chrome (not tested with other browsers) You can see what I mean here: http://leoandbella.com.au/products- page/checkout/ I have absolutely no idea what causes this and what I can do to fix it. If anyone would kindly point me in the right direction, I would really appreciate it! Thank you very much for your time, Nancy


Display WordPress comments before the plugins?

I am so happy that I found this site =) Well, here is my problem: I want to display the wp comments right after the post, but before the plugins content. What I have tried so far: in single-products.php file, the original code is:               <?php the_content(); ?>     <?php wp_link_pages(array('before' => '
'.__('Pages','eStore').': ', 'after' => '
', 'next_or_number' => 'number')); ?>     <?php edit_post_link(__('Edit this page','eStore')); ?>      I tried put the comments(comments_template()) before and after the "the_content()", but its not correct. If I put:   * Before the_content(), it displays the comments section before the real content   * After the_content(), the comments are displayed below others plugin (simple social and Five rate stars plugins) Is there anyway to insert in between them, I mean, between the post and plugins? FYI: The theme that I am using, didnt display comment, so I have to display/enable it by myself. I am using wp 3.0.1 Plugin I am using:   * Plugin Name: Five Star Rating (http://fsr.dingobytes.com)   * Plugin Name: Simple Social - Sharing Widgets & Icons (Version: 0.2)


Conditional for single-{post-type}.php

Please help with this code for custom post type "video":               If is single-video.php page {               list custom-taxonomy of video. Example actors          } Else { do nothing }      I´m tried with is_single, is_singular, is_page_template but imposible.


is_admin() triggers error

I've a plugin which includes other files and it looks like that :               if( is_admin() ) {              require( DIR.  'file.php' );     }      In this file I run a class. This class is initialized on `plugins_loaded`. The problem is is_admin() return false for my include but true for the init class so I get a fatal error because class is loaded while it does not exist It's probably due to the fact I'm using a conditional tag without any context, isn't it? **EDIT** : the class is initialized on `plugins_loaded` with a condition `is_admin()`


Cannot get the categories of a single custom post

I'm trying to display in a class all the categories each custom post is part of. So for example the wanted output is :

All

Cat

Dog

Fish

Bird

      When we click on the links at the top, the articles show or hide depending on their class and on the filter. For example when clicking on the link "Cat", the second article hide because it doesn't have a "cat" class. Here is my code to display the articles :               <?php     $args = array(         'post_type' => 'realisation'     );          $the_query = new WP_Query( $args );     while ( $the_query->have_posts() ) : $the_query->the_post();         var_dump($post->ID);         $taxo = get_the_terms($post->ID, 'category');         var_dump($taxo);     ?>     <article class="<?php foreach($taxo as $term){echo $term->slug . ' ';}   ?>">      But I don't know why, for each post, $taxo is **false** I also checked the posts ids, and they are corrects. I'm 100% sure that the "category" taxonomy is existing because I'm displaying all the categories in the top list to act like a filter :               <?php                 $args = array(                     'orderby' => 'count',                     'order' => 'DESC',                     'parent' => 9,                     'number' => 4                 );                 $categories = get_terms('category', $args);                 if ( $categories ) {                     foreach ( $categories  as $category ) {             ?>
<a href="" data-filter=".<?php echo $category->slug ?>" ><?php echo $category->name; ?>
             <?php   }                 }             ?>      And this code displays the first 4 categories correctly Did you ever have the same problem ? Thanks you for help


How do filters and hooks really work in PHP

How does filters and hooks actually work in WordPress? I'm asking about something advanced. How is it implemented in PHP? E.g how does it collect all the hooks from the different plugins and "attach" them to the core hooks etc.


How to add meta box to backend menu page

I need to add a **meta box** to the **backend menu page** , in _Appearance->Menus_ (`/wp-admin/nav-menus.php`), to list all the available **post types** , both the defaults & the custom ones. It will contain a list that contains a link to the **archive pages only** of the respective post types to be added to the nav menu. Is this possible?


What is the best way to correlate one-to-many content-type relationships?

I currently have a custom post type setup for the different buildings that a Real Estate developer owns. Each building can have multiple images, a short description and a few different fields setup in a custom metabox. I would like to allow my client to add available space listings for each property, and I'm stuck on the best way to integrate listings with the buildings. The available space listing would require a few fields including square footage, price and an image. I've though about creating a listings taxonomy and even a custom post type for them, but the listings are really a 1-n relationship with the buildings, so neither is an ideal solution. A custom metabox in the building post type seems like it would work, but it would somehow require a way to create multiple instances of the same metabox. Does anyone have any ideas or suggestions?


Remove Comments Metabox but still allow comments

I already know how to remove a metabox from my custom post type edit page. However I want to remove the comments metabox but still allow commenting for the post. Because I notice when I do remove it, it disables comments. Any function I can use?


Is WordPress multisite is good to go?

I am planning to make a website for different type of community. For example different types of developer. PHP Java Android etc Each type will have different registration and profile fields. Now my confusion is either I should create multisite network where each site will contain different developers or just single site can does this job wisely? Some stuffs I need is to allow user anytime start to use other sites like if x user is registered for Java and now he want to register for PHP he should able to place his content without register again and user id also should be the same so whenever I fetch content by userid it will give me all data from different site from the same user. Another question if you prefer to create multisite than what is the best choice.. sub-domain or sub-directory


How to create extendable wordpress plugins

I have a generic question that I would like to ask. How do we go about creating an extendable wordpress plugin. I would like to create a plugin that I can easily allow new extensions to be hooked up to it. Does anyone have any tips or guides or tutorials to doing this?


add_action not working in header?

i need to enable the session variables to my theme , so i have the following code in my theme functions.php               function session_manager() {       if (!session_id()) {             session_start();            // Get variables in query string     $loc= $_SERVER['REQUEST_URI_PATH'] = preg_replace('/\\?.*/', '', $_SERVER['REQUEST_URI']);      $loc = explode("/", $loc);     $loc=$loc[1];     global $storelocation;     global $right_side_bar;     global $header_right;            $_SESSION['location'] = ucfirst(strtolower($loc));       $storelocation= $_SESSION['location'];       $right_side_bar=$storelocation."-Right-sidebar";         $header_right=$storelocation."-Right-header";             }     }     add_action('init', 'session_manager', 1);      `$right_side_bar` is working fine while echo this in right sidebar it showing the session value, but `echo $header_right` is not working in header, i already tried with `wp_head instead of init in add_action` it cause `Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent`


How to extend LINK TO functionality in ATTACHMENT DISPLAY SETTINGS

In WP 3.4.x and earlier, it was possible to add a button to the media manager by messing around in an `attachment_fields_to_edit` filter. For example, a plugin could, when it figured out that an item was an audio file, append some HTML for an extra button to the url field, like so.                $playertag = "[audio $url]";      $fields['url']['html'] .=            "<button type='button' class='button data-link-url='$playertag' urlaudioplayer audio-player-$postid'>Audio Player</button>";       The new media manager has changed the set of buttons that were in that html tag into a pulldown menu -- a `<select .../>` item. The html code is emitted in media-template.php. The new code still calls `attachment_fields_to_edit` filters, but doesn't pass in any fields. Is there a way to extend this select item without hacking the core (which I won't do). Is it conceivable to write a bit of js which will use jQuery to add an item to it?


Category vs Tag vs Table

I have a site that will hold roughly 1000 posts/articles from an in-house magazine dealing with Australian naval history. The articles cover a range of subjects (such as Aviation, Intelligence, Ship Histories, Personal Histories and the like) and I've created categories to suit. The names of ships in an article is very important for research and cross- referencing but there are a LOT of ships. And, how does one distinguish between a ship that is the focus of an article and a ship that is merely mentioned in passing? I have uploaded about 300 articles so far. I've used the categories to identify the subject material, and I've created "tags" for the ship names (and other keywords). But tags dilute the significance of the ship covered by an article; e.g. if the article focuses on HMAS A, but also mentions HMAS B, C and D, then 4 ships are tagged but the relevance of the article to HMAS A is no greater than any of the other three ships. In addition, there's no way to create a list of articles by ship name or to cross-reference articles to the ship name in other material. So, I am pondering whether I should instead create categories for ships that are the focus of an article and use tags only for the names of the "passing reference" ships. This sounds good in theory but it could add, maybe, 300+ extra categories; and in many cases there might not be more than one article where that ship is the focus. Perhaps I am going about it the wrong way; might it be that I need a table devoted to ship names and create a meta link between the post and the table (in much the same way as, say, product names, work in an ecommerce transaction).