title: Move Custom Fields on General Settings Page to New Location

text:
I've created some custom fields on the General Settings page after studying up on this post: Add multiple custom fields to the general settings page. I'd really like to move them to their own location - preferably a new menu item, or at least under the Settings menu item. I seen tutorials on how to add a new options page under Settings, but haven't gotten these options to show up there:               add_action('admin_init', 'my_general_section');           function my_general_section() {            add_settings_section(       'my_settings_section', // Section ID      'Site Info', // Section Title     'my_section_options_callback', // Callback     'general' // What Page?  This makes the section show up on the General Settings Page     );          add_settings_field( // Phone Number     'phonenumber', // Option ID     'Phone Number', // Label     'my_textbox_callback', // !important - This is where the args go!     'general', // Page it will be displayed (General Settings)     'my_settings_section', // Name of our section     array( // The $args     'phonenumber' // Should match Option ID      )       );      add_settings_field( // State         'state', // Option ID         'State', // Label         'my_textbox_callback', // !important - This is where the args go!         'general', // Page it will be displayed         'my_settings_section', // Name of our section (General Settings)         array( // The $args             'state' // Should match Option ID         )       );      register_setting('general','phonenumber', 'esc_attr');     register_setting('general','state', 'esc_attr');     }          function my_section_options_callback() { // Section Callback     echo '
Additional Settings
';       }          function my_textbox_callback($args) {  // Textbox Callback     $option = get_option($args[0]);     echo '<input type="text" id="'. $args[0] .'" name="'. $args[0] .'" value="' . $option . '" />';     }      What am I missing or what do I need to add? I've tried adding the following, but the fields didn't show up:               add_action('admin_menu', 'theme_options_page');           function theme_options_page() { add_options_page('Theme Settings', 'Theme Settings', 'administrator', __FILE__, 'build_options_page');      }


title: Adding a metabox shortcode "paypal accept payment" in my custom post type back-end

text: I have created a science journal with annotum theme, now I want users to pay when they publish an article, but I don't have programming skills to do this when they click publish to pay with paypal, so I want to create a meta box in my custom post type: articles that contains a WP Easy Paypal Payment Accept widget in admin area of article post type. In dashboard admin area I have created this widget by this code (with shortcode: `Paypal_payment_accept();) :`                 function wpc_dashboard_widget_function() {         // Entering the text between the quotes         echo Paypal_payment_accept();        }        function wpc_add_dashboard_widgets() {         wp_add_dashboard_widget('wp_dashboard_widget', 'Technical information',        'wpc_dashboard_widget_function');        }        add_action('wp_dashboard_setup', 'wpc_add_dashboard_widgets' );       So the question clearly is: ![enter image description here](http://i.stack.imgur.com/akXil.png) ![enter image description here](http://i.stack.imgur.com/Ss45L.png)


title: Admin tabs for custom plugin

text: So I am new to WordPress plugin development, but I try to learn as fast as possible. Basically, I try to create a tabbed navigation for my custom plugin. What I've done so far, you ask?   * one function for displaying menu in left navbar               function mb_menu_page()     {     add_menu_page('Big Name', 'Big Name', 'edit_posts', 'bigname', 'mb_big_name', false, 1);     add_submenu_page('bigname', 'Link1', 'Link1', 'edit_posts', 'bigname',  'mb_big_name');     add_submenu_page('bigname', 'Link2', 'Link2', 'edit_posts', 'bigname2', 'mb_big_name2');     }        * add action               add_action( 'admin_menu', 'mb_menu_page');   * Two new functions(page content)               mb_big_name() && mb_big_name2() Now, how can I get all links for this menu in order to parse them and create my tabbed navigation? Thank you!


title: Filter didn't work on content class (hybrid_post_attributes)

text: I'm developing my new theme using Hybrid core framework and trying to add my class `item` on `hybrid_post_attributes` generated class using filter with this code.               add_filter( 'hybrid_post_attributes', 'my_post_atributes');     function my_post_atributes($attributes){     return  $attributes['class'] = substr_replace($attributes['class'], ' item', -1);     }      I want my 'item' class to be added as the last class from 'hybrid_post_attributes' classes. Here's `hybrid_post_attributes` function.               function hybrid_post_attributes() {              $attributes = array();         $output     = '';              $attributes['id']    = 'post-' . get_the_ID();         $attributes['class'] = join( ' ', hybrid_get_post_class() );         $attributes = apply_atomic( 'post_attributes', $attributes );              foreach( $attributes as $attr => $value )             $output .= " {$attr}='{$value}'";              echo $output;     }      And here's hybrid_get_post_class function.               function hybrid_get_post_class( $class = '', $post_id = null ) {         static $post_alt;              $post = get_post( $post_id );          /* Make sure we have a real post first. */     if ( !empty( $post ) ) {              $post_id = $post->ID;              /* Add hentry for microformats compliance, the post type, and post status. */         $classes = array( 'hentry', $post->post_type, $post->post_status );              /* Post alt class. */         $classes[] = 'post-' . ++$post_alt;         $classes[] = ( $post_alt % 2 ) ? 'odd' : 'even alt';              /* Author class. */         $classes[] = 'author-' . sanitize_html_class( get_the_author_meta( 'user_nicename' ), get_the_author_meta( 'ID' ) );              /* Sticky class (only on home/blog page). */         if ( is_home() && is_sticky() && !is_paged() )             $classes[] = 'sticky';              /* Password-protected posts. */         if ( post_password_required() )             $classes[] = 'protected';              /* Has excerpt. */         if ( post_type_supports( $post->post_type, 'excerpt' ) && has_excerpt() )             $classes[] = 'has-excerpt';              /* Has <!--more--> link. */         if ( !is_singular() && false !== strpos( $post->post_content, '<!--more-->' ) )             $classes[] = 'has-more-link';              /* Post format. */         if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) {             $post_format = get_post_format( $post_id );             $classes[] = ( ( empty( $post_format ) || is_wp_error( $post_format ) ) ? 'format-standard' : "format-{$post_format}" );         }              /* Add category and post tag terms as classes. */         if ( 'post' == $post->post_type ) {                  foreach ( array( 'category', 'post_tag' ) as $tax ) {                      foreach ( (array)get_the_terms( $post->ID, $tax ) as $term ) {                     if ( !empty( $term->slug ) )                         $classes[] = $tax . '-' . sanitize_html_class( $term->slug, $term->term_id );                 }     }      Did my way of using filter wrong?   Thanks.


title: Making the 'add to cart' button redirect to PayPal

text: I want to program the **Add to Cart** button, on a product page, so when the customer press on it, it skips the **Cart** & **Checkout** pages and send him directly to the PayPal payment gateway. Not spending time on the Cart page, nor filling details on the Checkout page.   How can I do this?


title: Allow front end users to add data to a custom post type

text: Hay Guys , I'm currently making a plugin so that the administrator can manage "Subscriptions" to the website. I have made a custom post type and activated it within WordPress and only allowed the title field. This works perfectly on the backend, but now i need a way for front end users to add their email address. How would i implement this, i need to add data to the database, i could easily just write some PHP to manually add the data, but does WordPress have any calls so that i can save data to the database?


title: Query Posts by taxonomy/Taxonomy Child Custom order

text:
This is an ongoing request, trying to do maximize some code to display a list of Accomodation by Country, of a certain Type, and a specific Region. So for example, a list of ALL accommodations in FRANCE, By Hotel Rating (1,2,3,4,5), and then by Region (Paris, Marseille etc...) Listing will be -Hotel 1Star   \--Marseille   \---Hotel 1   \---Hotel 2   \--Paris   \---Hotel 1   \---Hotel 2 -Hotel 2Star   etc.. etc... Each Hotel entry is a custom post called Accomodation I have 3 taxonomies, countries (ie France), accomodation-type (ie Hotel 1 star), region (ie Paris). The listing of accommodations "lives" on a country page, so the value of the country is already know. (ie $termcountry->name) My code is a below:                           $taxonomy2 = 'accomodation-type';             $termsacc = get_terms("accomodation-type",array('orderby' => 'slug', 'order' => 'ASC'));                  foreach ($termsacc as $termaccomodation) {                 $taxonomyregion = 'region';                 $termsreg = get_terms("region",array('orderby' => 'slug', 'order' => 'ASC'));                  foreach ($termsreg as $termregion) {                       $query = array(                   'post_type' => 'accomodation',                   'accomodation-type' =>$termaccomodation->name,                   'country' =>$termcountry->name,                    'orderby' => 'title',                    'order' => 'ASC',                   'posts_per_page' => 48,                                    'tax_query' => array(                   array(                         'taxonomy' => $taxonomyregion,                         'field' => 'slug',                         'terms' => $termregion->name,                         'orderby' => 'title',                          'order' => 'ASC',                         )                       )                        );                      query_posts($query);                       $count = 1; //First we set the count to be zeo                      if(have_posts() ) {                    $termaccomodation->slug = str_replace("%e2%80%98", "", $termaccomodation->slug);                  $termaccomodation->slug = str_replace("%e2%80%99", "", $termaccomodation->slug);                       if($termregion->name=="General"){                   $regionname = "";                  }else{                   $regionname = " - ".$termregion->name;                  }                  $id = '';                  $new_id = ++ $id;                  ?>                   <a name="<?php echo   $new_id."-".$termaccomodation->slug."-".$termregion->slug;?>">
                     <?php echo "
".$termaccomodation->name."".$regionname."
";?>                       <?                  while (have_posts()) : the_post();                  $linkacc = get_custom_field("AccomodationLink");                  ?>                  I do my loop stuff and display the accom list.                  then close my loop                  <?php endwhile; wp_reset_query();?>      This is working, but REALLY SLOW... and I am pretty sure it's not the optimal/best way of doing it. Could I pick your brains on this? Help! cheers s


title: validate a metabox based on the category that is selected

text: Ok Let's say I have 2 Categories. If a user select category A, they have to fill in metabox A and similarly for category B, it's metabox B. So my question is, I want to do a validate check, whereby if the user has checked category A, then it is only metabox A that has been filled in, and the same applies for category B. I know JQuery is my best bet - but not too sure how to go about it or how to call the function when clicking the publish button.


title: Routine to convert custom post meta from old to new value

text: I have two custom post meta objects that have been applied to all pages and posts in my sites. The names are MyCustomHeader and MyCustomTitle and I have one of these assigned to each post and page in my site. I've just decided to change the names of these two meta objects so that they do not appear in the Custom Fields fieldset. I've done this by placing an underscore character before them. This changes the values to "_MyCustomHeader" and "_MyCustomTitle". In order to account for the sites that have numerous references to the old post meta names, I need to create a routine that runs once (either in the form of a plugin or a script in my theme options that only executes on theme activation) that goes through the WP database and converts every value that was "MyCustomHeader to "_MyCustomHeader" and also "MyCustomTitle" to "_MyCustomTitle". Any help much appreciated.   * scott


title: Get the ID of the page a menu item links to?

text:
I am currently using a custom walker to customize the output of `wp_nav_menu()`, and I am trying to add additional information to the `<a>` tags. What I want the output for each menu link to look like is:               About Me Page      Where `PAGEID` is the ID of the page I'm linking to. The reason is because I am developing a theme that opens page content in lightboxes, which are triggered by the class in the tag. Below is the code of the custom walker in my `functions.php` file (after the code I'll point to the area where I'm having trouble):               class description_walker extends Walker_Nav_Menu     {                function start_el(&$output, $item, $depth, $args)           {                global $wp_query;                     $pageid = $wp_query->post->ID;                     $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';                     $class_names = $value = '';                     $classes = empty( $item->classes ) ? array() : (array) $item->classes;                     $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );                $class_names = ' class="'. esc_attr( $class_names ) . '"';                     $output .= $indent . '
ID . '"' . $value . $class_names .'>';                     $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';                $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';                $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';                $attributes .= ! empty( $item->url )        ? ' href="'   . '#' .'"' : '';                     $prepend = '';                $append = '';                $description  = ! empty( $item->description ) ? ''.esc_attr( $item->description ).'' : '';                     if($depth != 0)                {                          $description = $append = $prepend = "";                }                      $item_output = $args->before;                 $item_output .= '';                 $item_output .= $args->link_before .$prepend.apply_filters( 'the_title', $item->title, $item->ID ).$append;                 $item_output .= $args->link_after;                 $item_output .= '';                 $item_output .= $args->after;                      $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );                      if ($item->menu_order == 1) {                     $classes[] = 'first';                 }                      }     }      Towards the end are a couple of lines that begin with `$item_output`. The second line is where I'm trying to generate the page ID:               $item_output .= '';      Where `$pageid` is according to:               global $wp_query;         $pageid = $wp_query->post->ID;      This gives me a single, fixed ID for all the links generated. Alternatively, instead of `$pageid` I tried using `$item->ID`, but that gave me the ID of the menu item instead. Any suggestions?


title: How to restore all items from trash

text: I have accidentally deleted a WP user. By deleting it, WP removed all the media files, pages etc. I could retrieve pages and posts from trash. But I could not restore media items. Is there a way to restore all items from trash back?


title: How to display html in only the first level of WP comments?

text: How would I display html code in only the first level of threaded comments? _Example_   L1 Comment   \----L2 Comment   \--------L3 Comment   L1 Comment   I have a piece of html code that contains basically reads "Reply to (author name) or post a new comment" and only need it displayed on L1 comments.


title: Custom permalinks

text: We have a custom type `music`.               /music/     /music/post-name/      Also, we have a tag-like taxonomy `genres`. Its urls are:               /music-genres/genre-name/      I'm trying to make urls like:               /music/     /music/post-name/     /music/genres/     /music/genres/genre-name/      `/music-genres/` should be replaced by `/music/genres/`. Finally we should get url structure like:               /post-type/taxonomy/term/     /post-type/postname/      How do I do this?


title: Can I the caption shortcode to set caption to a data attribute, and with the image's alignment intact?

text: I want to output an image caption in this kind of format:               <img class="alignleft size-medium wp-image-316" alt="Image Title" data-caption="Here lies the image caption" src="http://example.com/wp-content/uploads/image-400x266.jpg" width="400" height="266">      I got the basic caption code from WP Core and ran it through the `add_filter( 'img_caption_shortcode', 'my_magic_caption');` filter, which seems to work fine. My problem is that I can't seem to actually affect the (`$content`) IMG tag itself, only surround it with other html, which is fine but not what I'm looking for. Any guidance would be appreciated.


title: Comment Spammed vs Trashed

text: What's the difference between marking a comment as spam and trashing it?


title: WP Super Cache Bug with Ubermenu

text: Im having a serious issue with WP Super cache and UberMenu. For some reason, every now and again, I will view my site, and it will have the default styling applied to ubermenu and then this unstyled version gets stuck in the cache and stays until I clear it. I clear the cache, and my custom styling from my main stylesheet gets applied and everything is fine for a while. If i turn off caching, its fine. Any ideas what issue may be causing this? Is there a way to exclude the CSS for the ubermenu from supercache? Thanks Andy


title: Add multiple taxonomy filters to edit.php that support search

text: After reading through this fantastic tutorial by Mike Schinkel: Adding a Taxonomy Filter to Admin List for a Custom Post Type? I have discovered a few issues that I need to work out. Search does not seem to work properly with custom taxonomy filters applied. Also, if I output more than one custom taxonomy filter dropdown, what's the best way to prevent a user from specifying values for more than one of the dropdowns? I'm thinking I should just add a JavaScript function, but it might have to be a dynamically generated JavaScript function. I really want to tackle the search issue first, though. Any thoughts? Thanks for your help, Dave Morris


title: Using custom post type as taxonomy

text: I have two custom post types, Books and Authors. Now, each book will have its corresponding author(s). I know how to associate books with authors using custom metas. However, over time, there will be a lot of books and corresponding authors. Which would be the best UI control to show a list of authors to select from, hopefully in a compact manner?


My theme has a "function_exists" wrapper around the is_multisite() call as seen below...               if(function_exists(is_multisite()))     {         //do something     }      However, I'm still getting this error on theme install...               Fatal error: Call to undefined function is_multisite()      What am I missing?


title: Category links suddenly started giving 404 errors

text: My Wordpress blog suddenly seems to have started giving me 404 errors when accessing category pages. For example, http://blog.rtwilson.com/category/tok- related/. Interestingly, this doesn't happen for child categories (such as GIS and Remote Sensing, shown in the sidebar on the above link) but does happen for parent categories (eg. Academic) and categories with no children (like TOK-related). Does anyone have any ideas why this might have happened? I recently changed the permalink structure for my blog posts themselves, but not for the categories. Do I need to rebuild the category list somehow? If so, how? **Update** .htaccess file content:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress


title: Enqueue ONLY Plugin Styles and Scripts

text: Is there a way to enqueue only plugin styles and scripts without wp_head? I have a plugin I'm working on which overrides the page template, but I still want to include all other plugins without including the theme style. Since theme developers don't always enqueue their styles and often hardcode the link, what's the best way around this?


title: What is wrong with this code I have to make a blockquote shortcode

text:
I have a shortcode for a blockquote `[blockquote]this is the quote[/blockquote]` ... this is the code.               function shortcode_shortcodetest( $atts, $content = null ) {         $return = '

';         $return .= do_shortcode( $content );         $return .= '
';         $return .= '
';         return $return;     }     add_shortcode( 'shortcodetest', 'shortcode_shortcodetest' );      so I would be expecting an output of:

this is a test

       or maybe

this is a test

      but what I get is:

this is a test

      ( note posision of opening paragraph tag ) What is causing the opening `p` tag to move to where it does. I have noticed that if I remove either the `div` or `blockquote` from the shortcode function then it doesn't happen, but I wanted to have the wrapper for some styling reasons and because in the full version I have an associated cite possibility ... and obviously I need to have the blockquote.


title: custom single.php not working

text:
Trying to solve this issue for the past hour and I can't figure out what's going on. Trying to create `single-blog.php` (I have a few posts which are under the category 'blog') but Wordpress automatically redirects these posts to single.php! I've flushed the permalinks by **settings** > **permalink** > **save changes** but still nothing happens. To test & to see if Wordpress picks up on single-blog.php the code I used was:               <?php get_header(); ?>
TEST HERE
     <?php get_footer(); ?>


title: Custom editor field displaying HTML in Visual editor

text: I am trying to add a custom WordPress editor field to the General Settings page in the admin. I have it working except that when you save anything with HTML it converts all the code to HTML entities so the HTML displays on the frontend as text. For example...   1. I add a link in the **Text** editor as `<a href="http://www.example.com">Link</a>`   2. I click to the **Visual** editor and everything looks normal...      * **Visual** = Link     * **Text** = `<a href="http://www.example.com">Link</a>`   3. I click save at the bottom and when the page reloads now I get this...      * **Visual** = `<a href="http://www.example.com">Link</a>`     * **Text** = `<a href="http://www.example.com">Link</a>` Am I missing a setting somewhere? My code currently is...               /**      * Add Copyright text to general settings menu      */     $custom_general_settings = new FD_Custom_General_Settings();     class FD_Custom_General_Settings     {         function __construct()         {             add_filter('admin_init', array(&$this , 'register_fields'));         }         function register_fields()         {             register_setting('general', 'footer_text', 'esc_attr');             add_settings_field('footer_text', '<label for="footer_text">'.__('Footer Text' , 'footer_text' ).'</label>' , array(&$this, 'fields_html') , 'general');         }         function fields_html()         {             $value = get_option('footer_text', '');             wp_editor($value, 'footer_text', array('textarea_rows'=>4), false);         }     }


title: Completely remove ability to create users?

text: I have added the code below to a plugin:               add_action( 'admin_init', 'remove_add_users_cap' );     function remove_add_users_cap() {         $role = get_role( 'administrator' );         $role->remove_cap( 'add_users' );         $role->remove_cap( 'create_users' );     }      And I can see that the caps are no longer on my user:               if(!function_exists('wp_get_current_user')) {         include(ABSPATH . "wp-includes/pluggable.php");      }     $current_user = wp_get_current_user();     echo '<pre>';     print_r($current_user);     echo '</pre>';      But I can still add new users O.o ... Is there something else that needs to be done to achieve this? I would like to completely remove the ability for anyone to add a new user when this plugin is activated... This is in a Wordpress Multisite context, and I have a feeling that may be complicating things. Thanks,


title: WP MU - Accessing 'Domain-Mapped' WP-Admin with a subdomain

text: After mapping the domains to each WP MU blog I'm having to separately login to each of the blogs and from what I've read online it's not possible or not secure to keep a user logged in on different domains if you're using cookies.      Is it possible to still have each WP blog mapped (wpmu1.hubdomain.com => www.newdomain.com), however be able to access the WP-Admin through the subdomain version of the WP blog? I'm guessing that if the WP-Admin is still under the same domain I can enable cookies to cross each subdomain?


title: If Child or Grandchild of Page

text: I'm serving a different header in Wordpress depending what section you are within the site, 'residential' , 'business' or other by using the following code. Although i need to extend it to work with grandchildren as well, so another level down.               <?php     /*     Template Name: Package     */      if (is_page('business') || $post->post_parent=="17")     {     get_header('business');     }     else if (is_page('residential') || $post->post_parent=="19")     {     get_header('residential');     }     else      {     get_header();     }     ?>


title: Site layout problems when logged in due to admin bar

text:
Is there a way to when logged in have the banner on my page move down so many specified pixels? This is what it looks like when I'm logged in (as of course the dashboard bar at the top is there and pushes almost everything down (except my banner as it's absolutely positioned). ![enter image description here](http://i.stack.imgur.com/kCBxT.png) And of course this i what it looks like when I'm not logged in. ![enter image description here](http://i.stack.imgur.com/k75Ym.png) I looked on the wordpress codex and found this snippet of code               <?php     if ( is_user_logged_in() ) {         echo 'Welcome, registered user!';     } else {         echo 'Welcome, visitor!';     }     ?>      So I attempted to use it and tried to tell wordpress if the user is logged in show this banner with this styling, else show the other banner with that styling. However as I'm not a programmer this is all I got.               <?php     if ( is_user_logged_in() ) {         <?php the_post_thumbnail();?>                 <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('banner-widget')) : else : ?>
<img class="banner" src="<?php bloginfo('template_directory') ?>/img/BANNER1-averylawoffice.jpg" alt="Banner 1">
                 <?php endif; ?>     } else {         <?php the_post_thumbnail();?>                 <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('banner-widget')) : else : ?>
<img class="h3-banner" src="<?php bloginfo('template_directory') ?>/img/BANNER1-averylawoffice.jpg" alt="Banner 1">
                 <?php endif; ?>     }     ?>      But it doesn't work. Of course. So what can I do to have this banner move down when a user is logged in? Am I on the right track, just missing something?


title: Say I have a tech blog, how best would I store technical specs for a phone, if i use custom post types

text: I've been playing around with WordPress for a couple of months now and when a client requests that he/she be allowed to modify, add content without my intervention, my defacto standard is WordPress. I've found WP to be extremely transparent and flexible compared to other CMS I've experimented with. Say I have a phone review website and I use custom post types to list the phones. I'm assuming this is one of intended applications of custom post types, and I would like your suggestions on how best to store the technical specifications of the phone. Here's an example http://www.theverge.com/products/xperia-acro-s/5697 Click on Full specs and this is an approximate picture of what I'm trying to achieve. My question is 1) Should I use custom fields ( post meta ) for every single specification? This would mean at least 25 custom fields (Screen size, processor,display and so on..) for each custom post ( here, the phone). 2) Have a separate table in the wordpress database with fields as the tech spec (Screen size, processor,display and so on..) In addition to display the tech specs every for every phone, I would also like it implement a 'Compare' feature as well as search for a phone based on the spec. Which of the above methods would you suggest for optimum performance during 'compare' or 'search' ? Thanks for your time.


title: Custom field values get deleted

text: I created a custom post type:products which also has custom fields: price & shipping. Occasionally, if I leave the edit product window open or refresh it, I lose the values inside price and shipping. Can someone please advise on this.               add_action('save_post', 'save_details');      function save_details()     {          global $post;         update_post_meta($post->ID, "price",        $_POST["price"]        );         update_post_meta($post->ID, "shipping",     $_POST["shipping"]     );         update_post_meta($post->ID, "long_title",   $_POST["long_title"]   );         update_post_meta($post->ID, "upload_image", $_POST["upload_image"] );     }


title: Exclude a category from a query that includes its parent category

text:
I am trying to use ids to control the structure of the output of my categories. I need to exclude a category that is part of the parent category that is being queried. What I am trying is :               <?php $the_query = new WP_Query('cat=14$cat=-45&showposts=20');             $permalink = get_permalink( $post_id );             while ($the_query->have_posts()) : $the_query->the_post();?>
                 <a href="<?php the_permalink() ?>" rel="bookmark" class="postTitleLink">                 <?php the_title(); ?>
             <?php wp_reset_query(); ?><?php endwhile; ?>      What would be the correct way to show everything in category id 14, except for category 45? I want to treat 45 differently and show all of its sub categories in a different way. To try and help describe what I want :               #12     - #14     - #14     - #14      -- #45       --- #50        ---- #60       --- #51     - #14      instead of cat=- should I be using conditional statements instead .. !in_category ? Thanks for any help!


title: Link Featured Thumb to Attachment Page, If Possible

text: Are featured thumbs uploaded the same as other images and have their own attachment post url? I'm trying to utilize the 3.0+ post formats and am using the featured image when creating a post under the 'image' post format. I would like to link the image from the blog loop to its attachment page, which I have already customized for my gallery post format images. Looking for the right direction. One thing I noticed is that custom post types can have their own page templates e.g.:               single-post_type.php      but post formats do not? So my questions: 1. - how do you link a featured image from the blog home page to its attachement page (or what is the best solution if it does not have one)? 2. - is there a way to create custom 'single' pages for post formats (or do I use conditionals on single.php)? Thanks.


title: Custom Post Type Templates from Plugin Folder?

text: I'd like to offer my custom post type as a Plugin, so that people can use it without touching their theme folder. But custom post type templates -- such as single-movies.php -- reside in the theme folder. Is there a way to get WP to check for a single-movies.php in the plugin's folder? Hooking a function into the Filer Hierarchy? Or get_template_directory(); ?


title: Create pagination and order according to alphabet

text: is it possible to create an alphabet pagination? as well as alphabet order of a query post??? I can't a solution on this based on the regular queries. I would appreciate any help, thanks in advanced. UPDATED* _*_ * Well since apparently this hard to understand, I will explain myself better. I'm looking for a way to query post based on the alphabet order that allow me paginate **NOT** by page but alphabet first letter. In this order I cannot use default order_by = 'title' as some1 suggested. PD: ifyou are going vote down, at least contribute with something, I don't think that is really hard to understand that more than the 50% of the users of the site don't use english as first language, so even if we do all our best to help the community we can make mistake sometimes. In this order if you are going to say "Explain yourself better" at least give an opinion of what you understood.


title: Show Video in Excerpt

text: So I recently figured out how to change my blog page to display excerpts by changing the `<?php the_content(); ?>` to `<?php the_excerpt(); ?>` in my `index.php` file. I am using a custom child theme and unfortunately had to edit the parent twenty eleven `functions.php` file to modify the continue reading link to read more, which I know isn't the correct way, but for some reason when I created a function in my `functions.php` in the theme folder it wasn't overriding and when I deleted the lines in the parent `functions.php` file the post content disappeared!? (I guess that is question 1) My real question now is when I do get the excerpts to work video does not display in the excerpt post so it looks like I have a sentence and the post ends when there should be a video displayed. I don't want users to be confused and think that is the end of the post...   1. Is there another way to override the functions.php file so that I can do the excerpts read more without editing the parent functions.php   2. How can I get my videos to display in my excerpts? Thanks and I hope this makes sense let me know if you need clarification!


title: widgets in contacts only

text: I have a few pages listed in my top menu. these are: contacts, My account and messages. I have added a map to the "Pages Sidebar" tab in admin. But it seems to add the map to all 3 pages listed above but I only want it to appear on the contact page and not the other 2 as in the other 2 I would like something else (an advert to memberships maybe). How can I do this? thank you for your help.


title: Do I only need to import style.css for a child theme?

text: I am creating a child theme for the first time, and sort of learning as I go. I am having an issue with the way videos are showing up on a mobile phone with my child theme, but not with my parent theme. I'm wondering what is going on. On my child theme the videos show up large when viewed on a mobile device (http://wpdallas.com/test) However, in the parent theme the videos show up fine: http://wpdallas.com/plain In my child them I am importing the following css, do I need to import every CSS file into my child theme, or just the style.css? (I've found conflicting info when learning how to do this.)The parent theme has about 20 different css files. I'm wondering if I need to import them all into my child theme, or if I need to delete the other two below, and just leave the first one (style.css.) Just trying to figure out why the child theme isn't styling correctly. Thanks.                @import url("../Standard/style.css");         @import url("../Standard/standard_framework/css/standard_framework.css");          @import url("../Standard/css/lib/adapt/mobile.css");


title: how to add version of style.css in wordpress

text: How to add version of `style.css` in WordPress like below i can do in Joomla.               <link rel="stylesheet" href="/templates/example/css/style.css?v=1.2">      i know that the `style.css` will load dynamically. please help me to how to do that.


title: Is it possible to paginate posts correctly that are random ordered?

text: I found this problem on Wordpress Support and the topic unfortunately is now closed. I have this same issue... (read below) * * * We have created a site where members can recommend things like favourite books, movie, songs, etc. For this problem I will use the Movies page as an example. The "Movies" page is ultimately a custom page template that asks wordpress to display a random list of ALL posts that have been given the category "movies" (category 31). It displays the title of these movies in random order using the code below.               <?php      $rand = new WP_Query("cat=31&showposts=-1&orderby=rand");      while($rand->have_posts()) : $rand->the_post();     ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>     <?php endwhile; ?>      Problem is the list is getting rather long and I would like to split it up into two or more pages of about 10 movies each. To achieve this, I have used the code below.               <?php      $page = (get_query_var('paged')) ? get_query_var('paged') : 1;      query_posts("cat=31&orderby=rand&showposts=10&paged=$page");      while ( have_posts() ) : the_post()      ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>     <?php endwhile; ?>      But there is a problem because although it splits up the data into pages of 10 posts each (paginates), it fails to include a new set of 10 posts on page 2 and so forth. In other words, because it is listing things in a random order, it just goes out and gets another 10 random posts (or in this case movie titles). As a result, we have some repeated movie title posts instead of a new set of 10 random movie titles on page 2, etc. My question is - what can I add to this code to get wordpress to "remember" which random 10 posts it included on page 1, and then have it get a new set of 10 posts to put on pages 2, 3, etc. until all posts are displayed. I would like there to be only one occurrence of a post per page when sorted randomly in sets of 10.


title: How to remove header images from all pages except the home page? skeleton theme

text: I'm using the Skeleton theme and the header image is on all pages. I only want it on the home page. Anyone got a solution?


title: PHP in Edit Post link

text: What is the best way to add php to the edit link? For example: insert `<?php echo of_get_option('dappo_actionbtncolor', 'dappblue' ); ?>` into the span tag of `<?php edit_post_link( __( 'Edit this', 'mytheme' ), '<span class="edit-link">', '</span>' ); ?>`


title: Showing errors with $wpdb update

text: I am using `$wpdb->update` to update a custom table I have in my database. When I `var_dump` the result it returns:               int(0)      So I tried `$wpdb->print_error()` to see what's wrong. However, it shows nothing. I also tried `$wpdb->show_errors()`, but again it showed nothing. The wpdb docs don't go into much detail on how to use these functions, so I am unsure if I am using them correctly. But why would the result of updating a table return 0, and not show any errors?


title: Allow unfiltered HTML in titles for low level users?

text: How can the `unfiltered_html` capability be given to non network admins in a multisite install to allow HTML in titles? In wp-includes/capabilities.php (below) it appears that this capability can not be given to non super_admins.               case 'unfiltered_html':             // Disallow unfiltered_html for all users, even admins and super admins.             if ( defined('DISALLOW_UNFILTERED_HTML') && DISALLOW_UNFILTERED_HTML ) {                 $caps[] = 'do_not_allow';                 break;             }             // Fall through if not DISALLOW_UNFILTERED_HTML         case 'delete_user':         case 'delete_users':             // If multisite these caps are allowed only for super admins.             if ( is_multisite() && !is_super_admin() )                 $caps[] = 'do_not_allow';             else                 $caps[] = $cap;             break;      Is this possible without removing all html filtering or committing the dirty deed? ### Use Case: Editors and writers are demanding the ability to use `<br/>` tags in titles to split into 2 or 3 lines when needed. ### Current Workaround: Alternate title metabox that replaces the_title on front end when filled in. (It's confusing the writers) ### Easier Solution: Give them super admin access (publisher will not allow)


title: Adding link to dashboard sidebar, nested under custom post type

text: I hope there is an easy answer for this, as it doesn't seem like it should be difficult and could make my backend much easier for other's to use. I'm trying to add links to custom post types - that is, a **shortcut in the sidebar** , not a typical wordpress link that you would put in the link category. Let's say my sidebar looks like:               Dashboard     ----------     Posts     ...     Stores (custom post-type)     - All Stores     - Add Store     - My custom link      The last line would be the custom link. Hopefully it is possible to make this link appear as a child to a custom post type, but if not at least having a static link would be a good start. The closest I could find on Google was this page about adding separators to the admin panel, which is useful for indicating my custom post types. Unfortunately the code for this is very alien to me (and the comments are only present on the obvious code, which is very frustrating). I assume that the code used for the separator is at least close to what I need, though. At the very least, where should I even look for an answer?


title: Why Pagination is not working on Category.php

text:
There are two different category "Life Sciences" and "General Lab" and there are sub-categorical product on "Life Sciences". Now "General Lab" category want to fetch all the sub-category and products which "Life sciences" have. The code is in category.php. Here is the whole code: `

                  <?php if ( is_category('general-lab') ) : ?>                      <?php //FETCHING ONLY GENERAL LAB CATEGORY                          $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                          $the_query = new WP_Query("posts_per_page=10&category_name=life-sciences&paged=".$paged); ?>
<?php echo single_cat_title("", TRUE); ?>
                      <?php $count=0; while ( $the_query->have_posts() ) : $the_query->the_post(); ?>                      <?php if($count % 2 == 0) echo '
'; else echo '
'; ?>                     <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php echo get_post_meta($post->ID, '_mcf_block-one', true); ?>

<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
                              <?php the_excerpt(); ?>

                   <?php if($count % 2 != 0) echo '

';?>                      <?php $count++; endwhile; ?>                      <?php if (  $the_query->max_num_pages > 1 ) : ?>

<?php previous_posts_link( __( '← Previous', 'twentyten' ) ); ?>

<?php next_posts_link( __( 'Next → ', 'twentyten' ) ); ?>

                 <?php endif; ?>                  <?php else : ?>
<?php echo single_cat_title("", TRUE); ?>
             <?php $count=0; while (have_posts()) : the_post(); ?>                  <?php if($count % 2 == 0) echo '
'; else echo '
'; ?>                 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php echo get_post_meta($post->ID, '_mcf_block-one', true); ?>

<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
                          <?php the_excerpt(); ?>

               <?php if($count % 2 != 0) echo '

';?>                  <?php $count++; endwhile; ?>             <?php if (  $wp_query->max_num_pages > 1 ) : ?>

<?php previous_posts_link( __( '← Previous', 'twentyten' ) ); ?>

<?php next_posts_link( __( 'Next → ', 'twentyten' ) ); ?>

             <?php endif; ?>                  <?php endif; ?>

             <?php $current_category = single_cat_title("", FALSE);                 $parent_cat = get_the_category();                 $back_to_current = get_cat_name($parent_cat[0]->category_parent);          if ( is_category( array( 'life-sciences','consumables','histology','forensics','pharmaceutical' ) ) == $current_category) { ?>     <?php echo '

'.$back_to_current.'
'; wp_nav_menu( array('container_id' => 'sub-page', 'menu' => $current_category ) ); echo '
';  } elseif ( is_category('general-lab')) { ?>     <?php echo '

'.$current_category.'
'; wp_nav_menu( array('container_id' => 'sub-page', 'menu' => $back_to_current ) ); echo '
'; } else { ?>     <?php echo '

'.$back_to_current.'
'; wp_nav_menu( array('container_id' => 'sub-page', 'menu' => $back_to_current ) ); echo '
'; } ?>


title: How to add a custom thumbnail size for a specific category?

text: The default thumbnail size for the Wordpress theme I use generates category thumbnails for the homepage and archive page at 200x110px. I would like to add a custom thumbnail size for a specific category of 200x200px that would display on the homepage and on the category archive page. I have experience working with Wordpress but I am not an expert. Based on the responses I've read to similar questions, I believe the answer lies in functions.php but I need detailed instructions on how to achieve this. If anyone could help, I would greatly appreciate it. Thanks!


title: How do i paginate query_posts with numeric pagination?

text: I have post type called **blog** and i'm showing posts for the type using `query_posts`, eg.               query_posts('post_type=blog');      I would like to add pagination for this post type in the following format.               [First] [1][2][3][4][5] [Last]      Please let me know how can I do this? Thanks.


title: How do I get a child theme to load scripts from the parent theme?

text: Pretty new to WordPress functions, so apologies if this is basic stuff. I've designed a parent theme that registers and enqueues two scripts like so:                   if ( !function_exists( 'scherzo_scripts' ) ) :              function scherzo_scripts() {                  if (!is_admin()) {                  wp_register_script( 'html5shiv', get_template_directory_uri() . '/js/html5.js');             wp_register_script( 'css3mediaqueries', get_template_directory_uri() . '/js/css3-mediaqueries.js');             wp_enqueue_script('html5shiv');             wp_enqueue_script('css3mediaqueries');                  }         }              add_action('init', 'scherzo_scripts');          endif;      I'm finding that if I install a child theme the scripts don't run. To try and force them to run I create a new `functions.php` file in the child theme folder and add:               function scherzo_scripts() {                  if (!is_admin()) {                      wp_register_script( 'html5shiv', get_template_directory_uri() . '/js/html5.js');                 wp_register_script( 'css3mediaqueries', get_template_directory_uri() . '/js/css3-mediaqueries.js');                 wp_enqueue_script('html5shiv');                 wp_enqueue_script('css3mediaqueries');                  }              }              add_action('init', 'scherzo_scripts');      But no joy. Am I doing something wrong?


title: What is the role and history of the $content_width global variable?

text: I just stumbled over a global variable called `$content_width`. It was new to me, so far I could see that it's used in themes, both the standard twenty ten one and third party ones. It looks like that it contains the width of the content area in pixels. But since global variables are not documented in codex, I have trouble to find valid and funded information about it. When was the `$content_width` global variable introduced and for what reason? Is there a ticket related to it?


title: Display/query post formats

text: WP 3.1 has everyone excited, if somewhat confused, about post formats. ### Enabling new post formats The issue of enabling post formats has been covered at length. It's as simple as adding this line to functions.php: `add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );` ### Displaying Posts of a certain Format But the issue of _displaying_ these posts has hardly been covered at all. Lets document the process of displaying/querying posts of a certain format using an example: Let's say we want to put a Twitter-like status update in the sidebar. It's easy to enable the `status` post format, but how to I actually query for those posts to make them show up in the sidebar? I've done quite a bit of searching and haven't found an answer to this problem, all are welcome to contribute. If we come up with a good answer, I think it would be the first to document this issue. With thanks!


title: Is there a template tag/function for getting the URL (or slug or name or ID) of the blog page when using a "static" front page

text: Done some reasonable searching for this and don't think it's been asked before. I've got a site which I'm developing a custom template/theme for. The site will use a page as the front page (rather than the list of posts), but I want to create a link in the template to the page of blog posts. There are some functions for finding various URL's like site_url() and admin_url(), and, of course, there's bloginfo(), but I can see anything that will get me the name/slug/URL/ID of the page used as the blog page. I'm sure I've seen this somewhere before but can't track it down now that I need it. Any ideas? Thanks RW


title: Order form for WP (similar to a wishlist)

text: Can anyone **recommend a plugin** to accomplish the following in WP? **1)** I have a form where a visitor can enter his contact information and list the nice to have items with a price. _For example:_               Item Name   |    Item price in $     --------------------------------     iPhone      |    100      iPad        |    200      **2)** I want the form to be able to calculate total price, add shipping and other fees and display the grand total. If possible, I'd like to also display all this in a different currency using a currency converter. For example,               Totals                |    Price in $          |    Price in Euro     -----------------------------------------------------------     Total Items           |    300                 |    200     Total with Fees       |    480     Pre-Payment           |    144     Payment               |    336      _Total Items = 100+200 from the example above Total with fees, pre-payment, and payment are calculated based on a custom formula._ **3)** I _do not need a shopping cart or e-commerce option_. The visitor fills out the wishlist form, sees the calculated totals and if he wants, submits this form. Thanks!!


title: How to call custom taxonomy categories with shortcodes

text: I've just had one questions solved over here: How to display posts from a single category within a custom taxonomy. Now I'm wondering how to take this code:               <?php         $args = array(             'posts_per_page' => 1,             'post_type' => 'inventory',             'tax_query' => array(                 array(                     'taxonomy' => 'inventory-category',                     'field' => 'slug',                     'terms' => array(                          'bulk-racks'                      )                 )             )                );     query_posts( $args ); while ( have_posts() ): the_post();          // do stuff here     ?>          <?php endwhile; ?>      and call it using shortcodes, for example to display the bulk-racks category by using this or something similar [inventory-category="bulk-racks"] I know how to create a basic shortcode but I don't know how to write the function that would return the posts based on the shortcode category name input. Once again any help would be greatly appreciated.


title: Getting the warning: Missing argument 2 for manage_posts_custom_column()?

text: I created a custom post type, two custom taxonomies and displayed them in the 'manage post section, but I'm getting the following warning: > Warning: Missing argument 2 for manage_posts_custom_column() in > /home/aleche23/alexchen.info/wp-content/themes/techozoic- > fluid/functions/custom-post-types.php on line 95 Picture: ![enter image description here](http://i.stack.imgur.com/Gwqgp.png)               <?php          /**      * Create the Blocks custom post type and the Sections custom taxonomy      */     add_action('init', 'create_post_type');                  // Register custom post types and custom taxonomies             function create_post_type() {                 register_post_type('blocks',array(                     'labels' => array(                         'name' => __( 'Blocks' ),                         'singular_name' => __( 'Block' ),                         'add_new_item' => 'Add New Block',                         'edit_item' => 'Edit Block',                         'new_item' => 'New Block',                         'search_items' => 'Search Block',                         'not_found' => 'No Blocks found',                         'not_found_in_trash' => 'No Blocks found in trash',                     ),                     'public' => true,                     'hierarchical' => false,                     'taxonomies' => array( 'section'),                     'supports' => array('title','editor','thumbnail','custom-fields'),                     'rewrite' => array('slug'=>'blocks','with_front'=>false),                     'menu_position' => 50,                 ));                 register_taxonomy('location','blocks',array(                     'hierarchical' => true,                     'labels' => array(                         'name' => __( 'Locations' ),                         'singular_name' => __( 'Location' ),                         'add_new_item' => 'Add New Location',                         'edit_item' => 'Edit Location',                         'new_item' => 'New Location',                         'search_items' => 'Search Location',                         'not_found' => 'No Location found',                         'not_found_in_trash' => 'No Locations found in trash',                         'all_items' => __( 'All Locations' ),                     ),                     'query_var' => true,                     'rewrite' => array( 'slug' => 'location' ),                 ));                 register_taxonomy('section','blocks',array(                     'hierarchical' => true,                     'labels' => array(                         'name' => __( 'Sections' ),                         'singular_name' => __( 'Section' ),                         'add_new_item' => 'Add New Section',                         'edit_item' => 'Edit Section',                         'new_item' => 'New Section',                         'search_items' => 'Search Section',                         'not_found' => 'No Sections found',                         'not_found_in_trash' => 'No Sectionss found in trash',                         'all_items' => __( 'All Sections' ),                     ),                     'query_var' => true,                     'rewrite' => array( 'slug' => 'section' ),                 ));                 // Add initial terms                 if (!get_option('yoursite-blocks-initialized')) {                     $terms = array(                         'Intro',                         'Tagline',                         'Mainbar',                         'Sidebar',                         'Featured',                         'Content',                     );                     foreach($terms as $term) {                         if (!get_term_by('name',$term,'section')) {                             wp_insert_term($term, 'section');                         }                     }                     update_option('yoursite-blocks-initialized',true);                 }             }             // Arrange the position of elements in the table                 add_filter('manage_blocks_posts_columns', 'manage_blocks_posts_columns');                  function manage_blocks_posts_columns($columns) {                 $columns = array(                     'cb' => '<input type="checkbox" />',                     'title' => 'Name',                     'location_column' => 'Location',                     'section_column' => 'Section',                     'author' => 'Author',                     'date' => 'Date',                 );                 return $columns;             }             // Verify that we are indeed working with only the custom post type and use a switch statement to test against the column                 add_filter('manage_posts_custom_column', 'manage_posts_custom_column');                  function manage_posts_custom_column( $column,$post_id ) {                 global $typenow;                 if ($typenow=='blocks') {                     $location_taxonomy = 'location';                     $section_taxonomy = 'section';                     switch ($column) {                     case 'location_column':                         $location_column = get_the_terms($post_id,$location_taxonomy);                         if (is_array($location_column)) {                             foreach($location_column as $key => $location) {                                 $edit_link = get_term_link($location,$location_taxonomy);                                 $location_column[$key] = '' . $location->name . '';                             }                             echo implode(' | ',$location_column);                         }                         break;                     case 'section_column':                         $section_column = get_the_terms($post_id,$section_taxonomy);                         if (is_array($section_column)) {                             foreach($section_column as $key => $section) {                                 $edit_link = get_term_link($section,$section_taxonomy);                                 $section_column[$key] = '' . $section->name . '';                             }                             echo implode(' | ',$section_column);                         }                         break;                     }                 }             }             // Output multiple taxonomy filters                 add_action('restrict_manage_posts' ,'restrict_manage_posts');                  function restrict_manage_posts() {                      // Only display these taxonomy filters on desired custom post_type listings                 global $typenow;                 if ($typenow == 'blocks') {                          // Create an array of taxonomy slugs you want to filter by - if you want to retrieve all taxonomies, could use get_taxonomies() to build the list                     $filters = array('location', 'section');                          foreach ($filters as $tax_slug) {                         // Retrieve the taxonomy object                         $tax_obj = get_taxonomy($tax_slug);                         $tax_name = $tax_obj->labels->name;                         // Retrieve array of term objects per taxonomy                         $terms = get_terms($tax_slug);                              // Output html for taxonomy dropdown filter                         echo "<select name='$tax_slug' id='$tax_slug' class='postform'>";                         echo "<option value=''>Show All $tax_name</option>";                         foreach ($terms as $term) {                             // Output each select option line, check against the last $_GET to show the current option selected                             echo '<option value='. $term->slug, $_GET[$tax_slug] == $term->slug ? ' selected="selected"' : '','>' . $term->name .' (' . $term->count .')</option>';                         }                         echo "</select>";                     }                 }             }      Which argument I am missing?


title: Multi user site and image captions

text: On multi user sites when authors select images from the media library they can choose images that other authors have uploaded. The problem is that they can edit the caption and it changes it for both the post they're making and any previous posts that have the same image and caption, this doesn't make any sense. Is there a way to stop authors from user images uploaded by other authors or fixing the image caption problem?


title: Using custom post template

text: i'm trying to implement a custom post template for all posts filed under a specific category. I'm making use of **WP-O-Matic plugin** that puts in the **RSS feeds in this category** and would like to make a bit of customization for the branding on posts filed under this particular category. I found the below code from here: http://www.nathanrice.net/blog/wordpress- single-post-templates/ But when I add this to my functions.php I get a warning: > Parse error: syntax error, unexpected T_LNUMBER, expecting T_STRING or > T_VARIABLE or '{' or '$' in public_html/wp- > content/themes/mytheme/functions.php(16) : runtime-created function on line > 1               add_filter(          'single_template',          create_function(                 '$t',                  'foreach( (array) get_the_category() as $cat )                  {                          if ( file_exists(TEMPLATEPATH . "/single-{$cat->1176}.php") )                                  return TEMPLATEPATH . "/single-{$cat->1176}.php";                  }                  return $t;'          )     );      Any idea on how to figure this out. P.S: I tried using a different approach where I made single.php as a doorway page to run a WP query. If category id matches then it renders custom- template.php else default-template.php As mentioned here. But I continue to get the following error: > Parse error: syntax error, unexpected T_LNUMBER, expecting T_STRING or > T_VARIABLE or '{' or '$' in public_html/wp- > content/themes/mytheme/functions.php(16) : runtime-created function on line > 1 > > Warning: call_user_func_array() [function.call-user-func-array]: First > argument is expected to be a valid callback, '' was given in > /public_html/wp-includes/plugin.php on line 166


title: Dynamically tax_query

text: I have this for example:               $myquery['tax_query'] = array(         'relation' => 'OR',         array(             'taxonomy' => 'cities',             'terms' => 'boston',             'field' => 'slug',             'operator' => 'NOT IN'         ),         array(             'taxonomy' => 'cities',             'terms' => 'chicago',             'field' => 'slug',             'operator' => 'NOT IN'         ),     );     query_posts($myquery);      But I would like to make it dinamically, because I have a form with checkboxes. Each checkbox would be a term of my taxonomy "cities". The idea is that if a user select any of the checkboxes, it should show all posts that are NOT in marked terms. But I would like to generate as many arrays for tax_query as checkboxes selected. I mean: If a user check Boston, I create:               array(                 'taxonomy' => 'cities',                 'terms' => 'boston',                 'field' => 'slug',                 'operator' => 'NOT IN'             ),      If a user check Chicago:               array(                 'taxonomy' => 'cities',                 'terms' => 'chicago',                 'field' => 'slug',                 'operator' => 'NOT IN'             ),      If a user check both of them:               array(                 'taxonomy' => 'cities',                 'terms' => 'boston',                 'field' => 'slug',                 'operator' => 'NOT IN'             ),             array(                 'taxonomy' => 'cities',                 'terms' => 'chicago',                 'field' => 'slug',                 'operator' => 'NOT IN'             ),      How can I do it?


title: http upload error as a subscribed user

text: Im getting an http error when uploading a featured image as a Subscriber. If I upgrade the user to editor or admin all works well. My server is Ubuntu 12.10, NGINX, WP 3.5.1 I have checked php.ini already, no success.


title: go to home page when i select default in select-box

text: I'm new for WordPress. I'm using following code,               <div id="cat_list">         <?php wp_dropdown_categories(array('show_option_all' => 'Categories') ); ?>      </div>      And my JavaScript is,               <script type="text/javascript">         var dropdown = document.getElementById("cat");         function onCatChange() {             if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {                 location.href = "<?php echo get_option('home');     ?>/?cat="+dropdown.options[dropdown.selectedIndex].value;             }         }         dropdown.onchange = onCatChange;     </script>      If I select any Category means, that goes to correct page. But my requirement is, Will be go home page when re-select `Categories` (show_option_all). Any option is in WordPress? other what to do?


title: Showing all tags in admin -> edit post

text: Someone knows how to show 'all tags' insteads of the 'most used tags' in edit post of administration panel? This should give the ability to select with a single click tags that are not yet used! Here is a screenshot of what I mean: screenshot Thank you very much. Ok, I've resolved in this manner: go to wp-admin -> include and open ajax- actions.php file, inside wp_ajax_get_tagcloud function edit line 658, that shows as this:               $tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) );      and change it with this:               $tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC', 'hide_empty' => 0 ) );      this will work for me; hope could be useful.


title: Allow certain part of a page to be easily updated for client?

text: My client has asked me to create an about me section which will include a picture, job title and description for each team member as floated elements. They also want it to be as easily updateable as adding a post to a blog. So if they wanted to add a new team member within the same page, they will want to upload the image and enter text into the job title and description box and click publish. Then the new member will appear next to the existing ones. As a newbie to WP, how would I go about achieving this? I've heard of custom post types but I can't find any tutorials on displaying data in one page. Any tutorial links or advice would be highly appreciated.


title: How to restore file or theme?

text: Accidentally messed up page.php in Twenty Twelve theme. How do I replace it with the original file, or reinstall the theme?


title: Does WordPress send data about your blog back to Automattic or somewhere else?

text: > **Possible Duplicate:**   >  Does WordPress send data about your blog to WordPress.org or Automattic? I've recently heard someone say that WordPress sends data about your blog to home (where ever that is). Is that true? and if so what is sent away or where in the code can I see what's exchanged?


title: How do I hide one menu item link for logged in and logged out users

text: Using bbPress and s2Member, I need to hide the registration link in the menu for logged in users and the members directory link for non logged in users.


title: Add HTML input tag to to site navigation

text:
I'm building a site using the twentytwelve theme. I need to add an input text box situation on the far left of the menu navigation bar. Here is the HTML from Header.php and the css from style.css. HTML
<?php _e( 'Menu', 'twentytwelve' ); ?>
                  <a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?>                  <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>


title: Wordpress - how to replace <!--more--> with string on the_content() in single.php

text: I want to add text on a single wordpress blog post page where the "read more" text would usually be inserted. However, I can't configure a plugin to replace that text. I tried a few different sources, but I'm having trouble finding the solution. After looking through WordPress plugin: finding the <!--more--> in the_content and the page it links to, I still haven't been able to find a solution to this.


title: New to wordpress, Question about editing PHP

text: Ok, I am pretty new to wordpress, and I have been reading a lot of the documentation online and testing things out on my own blog. I have just run into a couple of general questions. At first glance for a newb editing the PHP is a little over-whelming. Different themes have different files. There is a whole list of functions that I need to get used to. I started to fret because I wasn't sure where to start if I wanted to make simple tweaks to a post, a page etc. I have been reading a lot of the documentation of how Wordpress is structured and how wordpress posts get populated, so I'm starting to understand a little better, but I still have a question. I have tried installing a few plugins and some cases I noticed that after I switched themes, the plugin didn't work. In cases like that, do I need to edit the PHP files of the theme to make the plugin work? Or am I missing settings somewhere. Any assistance or explanation would be greatly appreciated.


title: Does wordpress create activity, update logs?

text: Does wordpress create any dated logs of activity? ie core updates, plugin download dates etc?


title: Changing the language for each individual site in wordpress multisite

text: I currently have a multisite setup and I currently have two sites, one is English (default) and the other I want it to be French. Since I can't have a separate config file and separate language folders I need to be able for each language site to use their respective .po file for the front end user. English for the backend is fine for both sites. How can I do this? I don't see anywhere in the settings the selection of the language. Is there a plugin? Can I just add a simple line of code? Please help me! Thanks!


title: Is user listing on wordpress private?

text: I'm creating a website using Wordpress. Users are registering on it as "Subscribers". When you register, you have a small panel with some custom info on it (that I made, creating a custom template) Each user shouldn't know other users exist. I started developing this without knowing if when registered users are available "to the world" (google indexing them, for example). Is user registration data is publicy available in a Wordpress installation, by some url, perhaps? Can Anonymous users see registered ones, or can Registered Ones see all others registered ones? Where I can get this information on wordpress docs? Are registered users on Wordpress supposed to be available to all? I couldn't get any information about this. Can someone help?


title: Profiles site with access levels

text: I'm building a site for a intranet that display data about people (totally legal!!). we will call these people Alumni. The structure is like this: there are three roles, administrators, alumni, watchers. The alumni register themselves and input their data. During registration they choose which data is "private", which is "public". Alumni have to be accepted by administrators after registration. Watchers can see public data of Alumni. Alumni are Watchers in respect of other Alumni. Administrators can watch also private data of the Alumni, modify this data, accept alumni after registration, delete Alumni. Would be nice if alumni could cancel themselves with confirmation by administrators, but this is not urgent. So, my idea is that alumni should be a CPT connected to the registered alumni maybe by author relationship or via a metadata. These post should be shown in front end only after login. Watchers and Alumni should not be able to login to the back end. As I said before in the alumni CPTs there is public data visible to all logged in users and private data visible only to the owner Alumni and Administrators. I know is a bit tricky and I don't ask you for the code. But since I'm not expert in wordpress yet I would like to hear from you some suggestion about how to structurize the site and about which APIs or plugin should I use to achieve my target. Many thanks!!


title: Getting the comment number relative to all the post's comments

text: Any ideas how to accomplish this? Something like this would work, but if there are threaded comments you get the wrong number, because pages with threaded comments have actually more comments than the `comments_per_page` setting:               $c_page = get_query_var('cpage');     $c_per_page = get_query_var('comments_per_page');          $number = ($c_page * $c_per_page) - $c_per_page + $current_c_index;      (`$current_c_index` is a global variable storing comment count for the current page loop) * * * _Later edit:_ A partial solution is to extend the Walker_Comment class, do a clone of the paged_walk() function in which you increase the counter within the `$top_elements` loop. But still that doesn't count child comments :(


title: Adding TinyMCE custom buttons when using teeny_mce_before_init

text: I'm using the following code to produce a different TinyMCE bar to the default WordPress setup:               if (function_exists('wp_tiny_mce')) {              add_filter("mce_external_plugins", "add_myplugin_tinymce_plugin");         add_filter('mce_buttons', 'register_myplugin_button');              add_filter('teeny_mce_before_init', create_function('$a', '           $a["theme"] = "advanced";           $a["skin"] = "wp_theme";           $a["height"] = "75";           $a["width"] = "800";           $a["onpageload"] = "";           $a["mode"] = "exact";           $a["elements"] = "elm1, elm2";           $a["editor_selector"] = "mceEditor";           $a["plugins"] = "safari,inlinepopups,spellchecker";                $a["forced_root_block"] = false;           $a["force_br_newlines"] = true;           $a["force_p_newlines"] = false;           $a["convert_newlines_to_brs"] = true;                return $a;'));              wp_tiny_mce(true);     }      Can anyone tell me how to work a basic custom button in there? All I need is a straightforward button which prints [ph_min] into the editor area. I've tried using the following filters to no avail:               function register_tcustom_button($buttons)     {         array_push($buttons, "|", "highlight");         return $buttons;     }          function add_tcustom_tinymce_plugin($plugin_array)     {         $plugin_array['highlight'] = WP_PLUGIN_URL . '/sf-tinyMCE-custom-buttons/mce/min_max_buttons/editor_plugin.js';         return $plugin_array;     }          add_filter("mce_external_plugins", "add_tcustom_tinymce_plugin");     add_filter('mce_buttons', 'register_tcustom_button');      Is there any way of doing this, or will I have to use write a manual TinyMCE init which isn't supported by WP?


title: Fatal error: Call to a member function query() on a non-object in my ajaxpage

text: i am creating a new plugin,i got this error Fatal error: Call to a member function query() on a non-object in my ajax page. how to solve this error. this is my code:               if (isset($_REQUEST['ckballvalue']))      {         $allvideos=$_REQUEST['ckballvalue'];      $now = date("Y-m-d H:i:s", time());      global $wpdb;      $insert_video =$wpdb->query("INSERT INTO " . $wpdb->prefix . "hdflvvideoshare (link,post_date)     VALUES ('".$allvideos."','".$now."')") or die('not inserting');      }          // i am calling this page by js:      function chkbox() {          $('[name^=checkbox]:checked').each(function() {              var ckballvalue=($(this).val());              $.ajax({              type: "POST",              url: "<?php echo $site_url; ?>/wp-content/plugins/<?php echo $contus; ?>/ajaxpages/ajaxpage.php",              data: "ckballvalue="+ckballvalue,              success: function(msg){ }          });          });      }


title: Any Wysiwyg tool to edit wordpress site based on given theme?

text: I dream of a wordpress dashboard that would be mostly Wysiwyg and let the user edit a site based on a given theme. In fact this is something I know is technically possible as I have seen it in this tool: http://visualwebsiteoptimizer.com/features.php (see the video; it is not a wordpress tool, but it shows how one can edit a webpage underlying code with a Wysiwyg interface). For example if I am using WooThemes Optimize, the dashboard would show me the homepage and let me edit the titles, the text in the button, the featured image, etc. Does anyone know a tool that can do that? or any hint how I can get there?


title: Display all comments or recent comments per user on author page

text:
I have author pages for each author and I want to see all of their comments (or all of their recent comments) if I click on their nickname. How can I do this? I tried the beneath code, but that does not show the unique comments per user... It just outputs all recent comments from everyone combined, but I don't want that.               <?php     $author_email = get_the_author_meta( 'user_email' );     $args = array(         'author_email' => $author_email,         'number' => '10'     );     $comments = get_comments($args);     foreach($comments as $comment) :         echo('
' . $somment->comment_content),'
comment_post_ID).'>', get_the_title($comment->comment_post_ID), '
', '<time>' . $comment->get_comment_date . '</time>', '
';     endforeach;          ?>


title: Create 3 buttons for new post for a different category

text: I am customizing the admin panel of WordPress. I have users with roles to only write to 3 categories. I would like to design 3 buttons or divs to create a new post but each one for a different category. That in the dashboard. I will have a different dashboard for role user Any idea? ![explanation image](http://i.stack.imgur.com/SqFTY.jpg)


title: How to get next previous category in same taxonomy?

text: Like WP `get_adjacent_post` function gives the next and previous post data based on the parameters i want to get the next/previous category data is there any `WP` built in function which does the right job or i have to write a custom query for that.               // Next/previous post example     $in_same_cat = false;     $excluded_categories = '';     $previous = true;     $previous_post = get_adjacent_post($in_same_cat,$excluded_categories,$previous);      i want next category by `category slug` or by `category id` Any help would be appreciated


title: How to let contributors to create a new revision(draft) editing their published posts

text: I'm using a custom post type to let contributors have a personal page on the site. Any time a user registers to my site a script creates a custom type post that has the registering user as author. To moderate users entries this post is pubblished by an editor. I would like users (contributors) to be: - uncapable to add other posts of this custom type - capable to edit the already pubblished post they are author of - their changements must be approved by an editor before being pubblished I'm using User Role Editor to manage roles and capabilities. is there a way to do that?


title: Should I use wpdb prepare?

text: I'm new to SQL and am wondering if I need to use `wpdb->prepare` for the following query to a table I've created               global $wpdb;     $tablename = $wpdb->prefix . "my_custom_table";     $sql = "SELECT * FROM " . $tablename . " ORDER BY date_created DESC";     $resulst = $wpdb->get_results( $sql , ARRAY_A );      Do I need to use `prepare` here? How would I do that? Cheers


title: Custom page template how to check is_page from functions.php?

text: Have a custom page template and trying to make the excerpt length dynamical depending on what page you are in. Functions.php               <?php          function custom_excerpt_length($length){         if (is_page(15)) {         return 20;         } else {         return 150;          }     }     add_filter ( 'excerpt_length', 'custom_excerpt_length');          ?>      cant get is_page to work from functions in my custom template page. If i try `echo is_page(15);` in the static custom template value is **true**. i'am little confused. Is it possible to call `is_page()` from _functions.php_ (WP 3.1.2)


title: Initialize WordPress customizer variables

text: I have recently starting integrating the wordpress customizer into my theme. Given the fact that i already had a theme options page, i use these values as default values of my new options (in the add_setting parameter). All my new options are held into a variable called 'theme_options' which is an array of values. The problem i have is that a user has to visit the customization page and click "save" on his first install to populate the 'theme_options' variable. I am wondering if there is a way to initialize this field on theme activation directly (just like many theme options framework do). Thanks in advance !


title: get_pages() not ordering as it should

text: I'm using get_pages() function to get all subpages from a page like this:               $childrens = get_pages(array('child_of' => 7,                                   'sort_column' => 'post_date',                                   'sort_order' => 'DESC',                                   'depth' => -1));      This is supossed to get me a list of all pages (no matter if direct children, children of children, etc) orderen by the date they were created, but instead its showing me the list of pages in a strange order, here's the output when I run a foreach on the $childrens array and output the post_date on each:               2011-05-10 15:37:03     2011-05-10 15:35:59     2011-05-10 15:01:18     2011-05-10 17:12:32     2011-05-10 15:00:47     2011-05-10 14:00:14     2011-05-11 04:19:08     2011-05-10 23:52:54     2011-05-10 15:20:12     2011-05-10 15:05:10      As you can see they're not ordered by date descending, I tried using other options in the sort_column key but none seemed to e working correctly, does anyone know what could be wrong? Thanks in advance!


title: Displaying images with relative paths in the editor

text: By default it seems the editor inserts images using an absolute path. We're developing a site in /staging/ and plan to move it later on. Is there a way to get relative paths on images to display properly in the editor? Maybe there's a function or snippet in the editor that resolves to the upload path or something? So for example, my images in my home page are:               <img class="alignnone size-full wp-image-21" title="Authentic Chinese Food" src="wp-content/uploads/2011/04/panel_authentic.jpg" alt="Authentic Chinese Food" />      which display fine on the page itself, but not in the editor. Thanks! John.


title: Creating a podcast directory site - how to allow user to upload "large" files?

text: I wish to create a podcast directory site. For which, I'd like the users of my site to be able to upload audio files which are "large" (e.g: more then 2 or 8 MB), and to make that upload "easily" go to the correct field in a relevant plugin (such as "podcasting") Any suggestions will be welcomed.


title: Installing local to live WP into subdirectory

text: I am having a bit of trouble moving a local WP site live and into a subdirectory. I want a static homepage for now (index.html in the root folder) while I work on the live site (would be found in root/folder/, so website.com/subfolder/). Following these steps I've had success installing WP into the root folder, but it doesn't work for a subdirectory. I was wondering if someone could walk me through how to get it to work, so I have a static homepage and am able to work on the WP site live. My host is dreamhost.


title: How to Query Post

text: On my homepage I have a slider at the top and then three columns below that. I would like to pull the three latest post for a category in each column. So each column will have three post titles and dates for a single category. Can anyone tell me what the Query would be? Thanks in advance, 14ner


title: Create a Plugin to Download Files from Web to Server

text: I'm writing a plugin and want to have a feature where, in the Admin area, the user will click on a link and it will download a theme to the /themes directory on their server. How would I do this? Thanks.


title: How do I allow http/ftp access to files I have uploaded?

text: I am hosting on godaddy (yes, i know - shameful - but it is a proof of concept for now) I have artifacts/installers for a mobile phone project (Windows .CAB file) and part of my build server steps FTP the files up to the server. I can see them using the web browser FTP client on my godaddy account. Unfortunately when I type in the url of my domain then /downloads (the location I thought I put them) i do not see the files or what I expect. Instead I am just brought to my homepage. I suspect there is some setting I need to do to allow a pass-through or something to allow that url to be viewed? I think I am using the TwentyTen theme 1.2 Alternatively, how do I list all the files in a directory using some wordpress-defined page? (like list all the files in my uploads/downloads directory that I placed there) - I do not want to have to manually change this - I just want them reflected on my site when they are available. EDIT To clarify - I have uploaded files to my "server" and I see them at: www.mydomainname.com/downloads using an ftp viewer. However, when I go to that domain with a web browser it gets directed to my main homepage and is not "allowed" by WP.


title: remove custom taxonomy base / slug

text: > **Possible Duplicate:**   >  Remove slug in taxonomy url I'm using proreview theme and it uses a custom taxonomy called "review-cats" In of this www.domain.com/review-cats/clothing I want www.domain.com/clothing I've been trying to find a solution for 2 days not ... relevant code > register_taxonomy( > > "review-cats", > > array("reviews"), array( "hierarchical" => false, "label" => "Categories", > "singular_label" => "Category", "rewrite" => true ) );


title: grab neighboring content in a query

text: I'm grabbing a post based on a **querystring** parameter. How can I get the **neighboring** posts for a _previous_ and _next_ button? This will get _tricky_ when you're on the first/last items. Here is how I'm getting the target post:               $the_id;     if($_GET['the_id']) $the_id = $_GET['the_id'];     $arr = array('post_type' => 'my_cpt', 'showposts' => 1);          if($the_id >= 0) {         $arr['p'] = $the_id;     }          query_posts($arr);      *note that if there was now querystring param, I'm just loading from the _most recent_ post of that type.


title: Custom-Taxonomy as categories: Remove "most-used" tab?

text: I created a custom-taxonomy for a custom-post-type which functions as kind of categories for this post-type. The Metabox for my taxonomy has two tabs. One for my Categories and a second tab called "Most Used" just like the normal categories for normal posts has. Is there a way to get rid of this "Most Used" tab? Thanks in advance?


title: Registering custom TinyMCE buttons, for admin area, to work with custom instances of wp_editor

text: Thanks to this answer here, I am able to use different instances of `wp_editor` to determine which buttons each of my differing TinyMCE instances use. However, I'm struggling to actually get my buttons registered - they're simply not appearing on the TinyMCE interface the way I think they should! I've tried two different approaches - putting the code in my `species- profiles` plugin (a Custom Post Type called `species` in which I wish the TinyMCE instances to feature), and putting the code in my theme's `functions.php`. The code I'm using is:               function add_SF_buttons() {         if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )             return;         if ( get_user_option('rich_editing') == 'true') {             add_filter('mce_external_plugins', 'add_SF_buttons_plugins');         }     }          function add_SF_buttons_plugins($plugin_array) {         $plugin_array['pH'] = get_bloginfo('template_directory') . '/tinymce_buttons/pH/editor_plugin.js';         $plugin_array['pH_min'] = get_bloginfo('template_directory') . '/tinymce_buttons/pH_min/editor_plugin.js';         $plugin_array['pH_max'] = get_bloginfo('template_directory') . '/tinymce_buttons/pH_max/editor_plugin.js';         return $plugin_array;     }          add_action( 'init', 'add_SF_buttons' );      The code I'm using to initialise the `wp_editor` instance as per aforementioned answer is this:               <?php         wp_editor(             $distribution,             'distribution',             array(               'media_buttons' => false,               'textarea_rows' => 8,               'tabindex' => 4,               'tinymce' => array(                 'theme_advanced_buttons1' => 'bold, italic, |, bullist, numlist, |, pH, pH_min',                 'theme_advanced_buttons2' => '',                 'theme_advanced_buttons3' => '',                 'theme_advanced_buttons4' => '',               ),             )         );     ?>      The plugins I'm trying to use all look like this:               (function() {         tinymce.create('tinymce.plugins.pH', {             init : function(ed, url) {                 ed.addButton('pH', {                     title : 'pH',                     image : url+'/pH.png',                     onclick : function() {                         var caret = "caret_pos_holder";                         var insert = '[pH]';                         ed.execCommand('mceInsertContent', false, insert);                         ed.selection.select(ed.dom.select('span#caret_pos_holder')[0]); //select the span                         ed.dom.remove(ed.dom.select('span#caret_pos_holder')[0]); //remove the span                     }                 });             },             createControl : function(n, cm) {                 return null;             },             getInfo : function() {                 /*                  * I intentionally left the information of                  * Brett Terpstra, as his code was the                  * foundation for this.                 */                 return {                     longname : "Brett's YouTube Shortcode",                     author : 'Brett Terpstra',                     authorurl : 'http://brettterpstra.com/',                     infourl : 'http://brettterpstra.com/',                     version : "1.0"                 };             }         });         tinymce.PluginManager.add('pH', tinymce.plugins.pH);     })();      As far as I'm aware, everything I've done there is correct? Yet the custom buttons fail to appear. I guess I'm doing something wrong - initialising them incorrectly, or something. ![How the TinyMCE interface appears](http://i.stack.imgur.com/l7yfA.png) Thanks in advance,


title: Parsing post->ID in included plugin file

text:
running into something that has got me completely puzzled. I have a plugin with a main file that looks like this:               // Global Variables     $mouldings_prefix = 'mouldings_';     $mouldings_name = 'Mouldings';          if(!defined('MOULDINGS_BASE_DIR')) {         define('MOULDINGS_BASE_DIR', dirname(__FILE__));     }     if(!defined('MOULDINGS_BASE_URL')) {         define('MOULDINGS_BASE_URL', plugin_dir_url(__FILE__));     }          // Includes     include('includes/scripts.php'); // Conrols JS/CSS     include('includes/admin-post-types.php'); // Sets up post types/taxonomies     include('includes/helper-functions.php'); // Functions that extend functionality of Mouldings     include('includes/admin-metaboxes.php'); // Metaboxes that appear in the admin (non-ACF)      So nothing too fancy, just sets up some variables and includes some helper files. I have a metabox that is set to display (from `admin-metaboxes.php`) which generates a box on a post type, called `moulding_profiles`               add_action('admin_init','roots_mouldings_meta_init');          function roots_mouldings_meta_init()     {         // http://codex.wordpress.org/Function_Reference/add_meta_box         // add a meta box for each of the wordpress page types: posts and pages         foreach (array('moulding_profiles') as $type)         {             add_meta_box('roots_mouldings_profile_tools', 'Profile Tools', 'roots_mouldings_meta_setup', $type, 'side', 'high');         }     }          function roots_mouldings_meta_setup()     {         global $post;              // using an underscore, prevents the meta variable         // from showing up in the custom fields section         $meta = get_post_meta($post->ID,'_roots_mouldings',TRUE);              ?>              Regenerate CAD File
Clicking the button above will delete the current CAD zip file created for the profile which will be regenerated upon pageload. This is useful if any of the CAD files originally listed have been modified.
         <?php     }      The metabox itself doesn't save any information, more or less just has a clickable button and some description text. The button itself is tied to a `scripts.php` file (also included) which adds in the `admin.js` file and localizes the script and gets the path to a PHP file (which would be called on-click), called `admin-delete-cad.php`               // Script conrol     function mouldings_load_scripts() {         wp_enqueue_script('mouldings-isotope', MOULDINGS_BASE_URL . 'js/jquery.isotope.min.js',array('jquery'),'1.5.17',true);         wp_enqueue_script('mouldings-isotope-script', MOULDINGS_BASE_URL . 'js/script.js',array('jquery'),'',true);     }     add_action('wp_enqueue_scripts','mouldings_load_scripts');          function admin_mouldings_load_scripts() {         wp_enqueue_script('mouldings-admin', MOULDINGS_BASE_URL . 'js/admin.js',array('jquery'),'',true);              $mouldings_admin = array(             'deletecadfile' => MOULDINGS_BASE_URL . '/includes/admin-delete-cad.php'             );         wp_localize_script( 'mouldings-admin', 'mouldingsadmin', $mouldings_admin);     }     add_action('admin_enqueue_scripts', 'admin_mouldings_load_scripts' );      The actual data is parsing to the admin correctly, showing:               /* <![CDATA[ */     var mouldingsadmin = {"deletecadfile":"http:\/\/yhmags.com\/wordpress\/wp-content\/plugins\/mouldings\/\/includes\/admin-delete-cad.php"};     /* ]]> */      and is correctly being called onclick via the following JS (in `admin.js`)               jQuery(document).ready( function($) {         $('#deleteCad').click(function() {             $.get(mouldingsadmin.deletecadfile, function(data) {                 $('#deleteCad').html(data);             });             return false;         });     });      But when I try to access data within `admin-delete-cad.php`, I don't have access to well... any of the default WP info (like the $post->ID) which is what I'm after:               define('WP_BASE_DIR', realpath(dirname(__FILE__).'/../../../../'));     global $post;     $id = $_GET['post'];     echo $id; echo $post->ID;     echo WP_BASE_DIR . '/cad-'.$id.'.zip';      The file itself loads fine (if I just put in a plain text string), but as you can see above, I'm trying to get any post information to work... but nothing is showing up. Been at this for a while, any help would be greatly appreciated. Thanks!


title: Visual Editor: Paragraph styles appear to one admin but not to others

text: The first admin of my site has a full Visual Editor with style sheets. I create new users who are admins (their profile page has same settings with original admin) but they cannot set the style of paragrpaphs (no drop-down list with styles). Any ideas? Thanks.


title: If a post belongs to two categories how do I choose the main category?

text: When I assign a post to two categories always one of categories becomes the main category. Is there any way to specify which category out of the two or more is the main category not a secondary category?


title: Sort posts alphabetically by custom field value, insert divider between different letters

text:
i'm listing all posts of my custom post type "person" alphabetically sorted by the custom field `last_name` on a page. **How would i insert a divider (e.g. an image of the letter) before a letter range starts?** Here's what i'm trying to do: ![alphabetical list with dividers](http://i.stack.imgur.com/xA3sc.jpg) **Update:**   Here's the code i'm using:
     <?php query_posts('post_type=person&post_status=publish&meta_key=last_name&orderby=meta_value&order=ASC');      if ( have_posts() ) while ( have_posts() ) : the_post(); ?>         <li data-id="<?php the_ID(); ?>">             <a href="<?php the_permalink(); ?>" class="ensemble-single-link">                 <?php if ( has_post_thumbnail() ) { the_post_thumbnail(thumbnail); } ?>
     <?php endwhile; // end of the loop. ?>