title: get_avatar() default image not working as of wp 3.5

text: As of upgrading to wp 3.5 the get_avatar function started not pulling in my default backup image. This has worked for many years this way and curious to why it would stop. I am using the normal use of the function as this: the $url value is the correct path to my default image found in my images folder in my theme. ` echo get_avatar($author->user_email, $size = '50', $url); ` I did a little digging into the image that was being put there that is "missing" and it looks like the url is using an image server on the wp.com domain (guessing somehting like akamai). Not sure why though since i have the image local and dont want to use this as the image hosting location. image URL starts with: http://i1.wp.com/ I looked at the source code function in the pluggable.php file. Maybe it is something to do with the gravatar return? Maybe they are changing the image location to be on the server? Any idea what is going on here? I see there are functions that can change the way that it works to exclude gravatar but would rather still have that functionality if i can. Thanks


title: Different Server for Images

text: I am on a shared hosting on HostGator and now I want to take one other shared hosting on some server and want to put only the images used on my site to it. So that those http requests of images could go to another server, is that possible? and how? thanks.


title: comments_popup_link() - how to load different classes/images according to different comment condition?

text: As the Codex says the syntax:               <?php comments_popup_link( $zero, $one, $more, $css_class, $none ); ?>      it's clear that we can load different texts according to different comment conditions, like "Comments Open", "1 Comment", "2+ Comments" and "Comment off", and additionally we can load CSS class to the portion. I want to load different images from an Image-sprite with the different comment-conditions:   * When comment is open but no comment is posted - load one   * When comment[s] is/are posted - load one   * When comment is closed - load one **What I thought**   ...is to load different classes, so that I can enable different images to the `<div>` using CSS, targeting the classes. But **HOW**?   We have only a single class to the `<div>` and a single class to the `comments_popup()`:               <div class="comments-link">        <?php comments_popup_link( __( 'Post a Comment', 'your-theme' ), __( '1 Comment', 'your-theme' ), __( '% Comments', 'your-theme' ), 'comment-popup', __( 'Comment is OFF', 'your-theme' ) ) ?>     </div>


title: Validating values using Settings API?

text: I'm using the Settings API to create options for plugin. Do I need to validate the input values for the security (for example stripslashes etc)? (I could not find that part in most of the tutorials). Here's what I'm doing:               <form method="post" action="options.php">         <?php             settings_fields( 'sandbox_theme_display_options' );             do_settings_sections( 'sandbox_theme_display_options' );             submit_button();                     ?>     </form>           function sandbox_initialize_theme_options() {         add_settings_section(             'general_settings_section',                      __( 'Display Options', 'sandbox' ),             'sandbox_general_options_callback',             'sandbox_theme_display_options'         );              add_settings_field(              'show_header',             __( 'Header', 'sandbox' ),             'sandbox_toggle_header_callback',             'sandbox_theme_display_options',             'general_settings_section',             array(                 __( 'Activate this setting to display the header.', 'sandbox' ),             )         );          register_setting(             'sandbox_theme_display_options',             'sandbox_theme_display_options'         );          }     add_action( 'admin_init', 'sandbox_initialize_theme_options' );


title: Custom mod rewrite function not responding

text: My url is               http://domain.com/author/john/?posts=pending      What I want is               http://oyecow.com/author/john/pending      My function               add_rewrite_rule('^(author)/([A-Za-z0-9_- ]+$*)/?', 'index.php?posts=$matches[1]','top');     }     add_action('admin_init', 'create_custom_rewrite_rules');          add_filter('query_vars', 'foo_my_query_vars');     function foo_my_query_vars($vars){         $vars[] = 'pending';         return $vars;     }      In my author.php I've added               $check = get_query_var('pending');     if ($check = 'pending') { echo 'yay' ;}      The author name can have alphanumeric (both uppercase and lowercase) and dash. I flushed rules form wordpress permalinks, but still my seo url is showing 404 error page.


title: Create a Loop with Posts Ordered by Most Recent Comments

text: Using query_posts, how can I order the list of posts so the ones with the most recent comments are at the top? I'm looking for something similar to how Questions here on SE are ordered when you sort by "Active."


title: Show category with link

text:
I am trying to show the category of posts with link to its page, so I used this code but I don't know What's wrong with it. It is only showing the category without link.
<?php        foreach((get_the_category()) as $category) {           echo $category->cat_name . ' ';           echo $category_link = get_category_link( $category_id );                                  }      ?>


title: Wordpress Architecture as a CMS - Posts & Pages

text: How can I associate posts with pages? Trying to determine the best architecture / strategy to achieve the following... Using WordPress as a CMS   8 Pages each with sub pages   Each page can also have posts I can set up 8 categories where each category matches a page and then list the posts in that category under the page but that seems clunky. Is there a better way? Example:   Awards Page   has sub page Annual Awards and   has sub page Monthly Awards   has post March 2012 Awards which should be displayed on Awards Page & Monthly Awards Page Thanks in advance.


title: Removing fields from the Media Uploader/Gallery

text: I've been searching high and low for an answer. I simply want to remove the Alternate Text, Caption, Description and Link URL- fields from the uploader and gallery view. I seem that every thing else than this Media-thingy can be removed. Thanx for helping out:)


title: Multisite, upload images directly to Amazon S3

text: I have created a multisite network but I've noticed people are uploading a lot of image files which are clogging up my server space. Is there a way I can amend the default network theme (Users are limited to using 1 standard theme) so that all images are uploaded to my S3 account and then displayed as per usual in the Wordpress media uploader? I want to be able to do this automatically as oppose to having all my network's users having to install a plugin manually as some of them aren't exactly tech savvy.


title: wp_list_pages() but only show children on the branch you are on

text: Lets say I have this menu:               Top         |___    Sub 1                 |___    Sub Sub 1                 |___    Sub Sub 2                 |___    Sub Sub 3                 |___    Sub Sub 4         |___    Sub 2                 |___    Sub Sub 1                 |___    Sub Sub 2                 |___    Sub Sub 3                 |___    Sub Sub 4         |___    Sub 3                 |___    Sub Sub 1                 |___    Sub Sub 2                 |___    Sub Sub 3                 |___    Sub Sub 4         |___    Sub 4                 |___    Sub Sub 1                 |___    Sub Sub 2                 |___    Sub Sub 3                 |___    Sub Sub 4      I can list that menu using this:                   if( 0 == $post->post_parent && 0 == count( $children ) )             return;              if( 0 == $post->post_parent )         {             $child_of = $post->ID;         }         else {             $parents = get_post_ancestors( $post->ID );             $child_of = end( $parents );         }              $args = array         (             'child_of' => $child_of,             'echo' => 0,             'title_li' => ''         );              $pages = wp_list_pages( $args );      This is fine but I don't want to show all page items. What I want is that only imediate children of the page you are on is shown. So if I'm on page `Top` the menu should appear like so:               Top         |___    Sub 1         |___    Sub 2         |___    Sub 3         |___    Sub 4      If I'm on page `Top/Sub 3` the menu should appear like so:               Top         |___    Sub 1         |___    Sub 2         |___    Sub 3                 |___    Sub Sub 1                 |___    Sub Sub 2                 |___    Sub Sub 3                 |___    Sub Sub 4         |___    Sub 4      And so on, so that it can work to any depth. Rarst put up a nice answer but this was for when using WordPress menus. I'm looking for the same for wp_list_pages(). Looking for an answer that uses a Walker or filters/hooks. I know how to solve this problem with CSS but this doesn't fix the problem of unnecessary HTML being sent to the browser.


title: Using wp_list_categories to show more than one custom taxonomy

text:
I'm using wp_list_categories like this:                                                   $taxonomy     = 'colors';                                         $orderby      = 'count';                                         $show_count   = 0;      // 1 for yes, 0 for no                                         $pad_counts   = 0;      // 1 for yes, 0 for no                                         $hierarchical = 1;      // 1 for yes, 0 for no                                         $title        = '';                                         $empty        = 0;                                         $number       = 1;                                         $style        = 'list';                                              $args = array(                                           'taxonomy'     => $taxonomy,                                           'orderby'      => $orderby,                                           'show_count'   => $show_count,                                           'pad_counts'   => $pad_counts,                                           'hierarchical' => $hierarchical,                                           'title_li'     => $title,                                           'hide_empty'   => $empty,                                           'number'       => $number,                                           'style'        => $style                                         ); ?>

Colors

                                             <?php wp_list_categories( $args ); ?>
      ...but I have more than one taxonomy that I want to list. What is the best way to do this? Thank you.


title: Add exception for specific tag

text: I'm using this piece of code to generate Related Posts by looking at the tags of posts. The problem is I have use a tag named Featured in order for a post to show up in a slideshow. So posts are showing up as related because of that matching Featured tag, even though they are not alike at all. So is there an easy to to exclude the tag "Featured" in this code?               <?php $tags = get_the_tags(); ?>     <?php if($tags): ?>     <?php $related = get_related_posts($post->ID, $tags); ?>     <?php if($related->have_posts() && $related->found_posts >= 3 && get_option('pyre_related') == 'On'): ?>      I am guessing there needs to be a tag__not_in or something similar included but I just don't know PHP well enough to know the syntax. **UPDATED** : I didn't end up using Chip Bennett's answer (which may have worked). I had to find the functions.php which was hidden in a special subfolder inside the theme. Using tag__not_in did not seem to work. It seem to always return the same posts (the most recent posts even if they shared no similar tags. Here is the entire get_related_posts function.               function get_related_posts($post_id, $tags = array()) {         $query = new WP_Query();              $post_types = get_post_types();         unset($post_types['page'], $post_types['attachment'], $post_types['revision'], $post_types['nav_menu_item']);              if($tags) {             foreach($tags as $tag) {                 $tagsA[] = $tag->term_id;             }         }              $args = wp_parse_args($args, array(             'showposts' => 4,             'post_type' => $post_types,             'post__not_in' => array($post_id),             'tag__in' => $tagsA,             'tag__not_in' => 795,             'ignore_sticky_posts' => 1,         ));              $query = new WP_Query($args);              return $query;     }


title: wpdb::prepare was called incorrectly

text: I have this code to remove orphaned posts after deleting custom post type. It works, but this code...               global $wpdb;     $wpdb->query(          $wpdb->prepare(          "DELETE a,b,c FROM wp_posts a         LEFT JOIN wp_term_relationships b ON (a.ID=b.object_id)         LEFT JOIN wp_postmeta c ON (a.ID=c.post_id)         WHERE a.post_type='attorneys'"       )     );      ...is throwing this error: > PHP Notice: wpdb::prepare was called **incorrectly**. The query argument of > wpdb::prepare() must have a placeholder. So, after reading the explanation on make.wordpress.org by Andrew Nacin, I (sorta) gather that ...well.. I'm missing the second argument. Then after reading this stack post, I'm wondering if I even need the `prepare()` function. **Are there** any variables holding unknown values? I'm not clear on this. ...what am I missing? UPDATE: This code also works, but w/o the prepare() I wonder if its safe.               global $wpdb;     $wpdb->query(        "DELETE a,b,c FROM wp_posts a       LEFT JOIN wp_term_relationships b ON (a.ID=b.object_id)       LEFT JOIN wp_postmeta c ON (a.ID=c.post_id)       WHERE a.post_type='attorneys'"     );      Please advise.


title: Custom search filter causes menu and query_posts problems

text: I'm using a custom search filter (using my custom query var `type`), like so:               function fteh_pre_get_posts( $query ){         if( isset( $query->query_vars['type'] ) )             $types = explode( ',', $query->query_vars['type'] );             $query->set( 'post_type', $types );              return $query;     }          if ( ! is_admin() ) {          add_action( 'pre_get_posts', 'fteh_pre_get_posts' );     }      I noticed this causes a registered custom menu to disappear. Without the `!is_admin()` it also confused the menu builder (it showed some posts instead of all my pages in Pages section). Adding the condition helped with that, but I can't figure out how to bring back my menu. It's properly registered and called, build and saved in proper theme location and worked before adding that filter. Now it just uses the `fallback_cb` (in my case the default `wp_page_menu`) instead of my custom menu. As soon as I remove that action from `pre_get_posts`, everyting is back to normal. I don't see how `pre_get_posts` hook is related to the custom menus - does anyone know why it would cause such a weird behavior? **UPDATE:** I now discovered another problem caused specifically by the snippet above - all my custom queries on pages (simple stuff like `query_posts('post_type=organization')`) stopped working and display normal posts instead of custom post types set up in `query_posts`.


title: Bootstrap collapse in custom WordPress widget

text:
I am building a custom widget and using Bootstrap 3 for the styling. I want to implement an accordion has seen here. However, I cannot get it to work correctly. I am including transition.js, collapse.js and component- animations.scss in my calls to `wp_enqueue_scripts` and `wp_enqueue_styles`. Also I have deregistered the WP included jQuery and registered the version included with Bootstrap. I either get one of two scenarios. Scenario one is nothing works at all. All scripts are being called correctly and in the right order according to Chrome Dev Tools. Scenario two is I can get it work, but only once. My thinking it is some sort of conflict. Here is my markup: (I'm not worried about the actual widget functionality right now, just trying to get the UI to work).

                                      Monday

                     <label for="<?php echo $this->get_field_id('mondayStart'); ?>">Open                     <input class="form-control" type="text" id="<?php echo $this->get_field_id('mondayStart'); ?>" name="<?php echo $this->get_field_name('mondayStart'); ?>"/>

                     <label for="<?php echo $this->get_field_id('mondayEnd'); ?>">Close                     <input class="form-control" type="text" id="<?php echo $this->get_field_id('mondayEnd'); ?>" name="<?php echo $this->get_field_name('mondayEnd'); ?>"/>

                     <label for="<?php echo $this->get_field_id('mondayEnd'); ?>">
Closed

                     <input class="form-control" type="checkbox" id="<?php echo $this->get_field_id('mondayClosed'); ?>" name="<?php echo $this->get_field_name('mondayClosed'); ?>"/>

       That markup is repeated for each day of the week. Here is scenario one javascript:                $('.collapse').collapse();      and here is scenario two javascript:                $(document).ready(function() {           $('.panel-title a').click(function() {                $('.collapse').collapse('toggle');            });       });


title: What is $interim_login?

text: I found an `$interim_login` variable within the `wp-login.php` file, and I'm not sure what it does or what it is. The documentation around the interwebs is pretty sparse. What is `$interim_login`?


title: How do I add a server-independent external rewrite rule?

text: External rewrite rules are awesome. They let you define rewrites that don't necessarily pass through WordPress' `index.php`. This means you can map arbitrary rules to arbitrary files like:               $wp_rewrite->add_external_rule( '^somethingrandom/?$', 'wp-content/wp-uploads/hiddendirectory/somefile.php' );      Then, any request to `http://site.url/somethingrandom/` will _actually_ be served a static PHP file from a different directory. This is amazing, and it lets you do all sorts of nifty stuff. **But it only works with Apache.** The `add_external_rule()` method writes its registered rules out to `.htaccess`. Since Nginx doesn't use an `.htaccess` file, external rules are completely ignored by that server. What I need is a server-independent way to programatically register rules like the one above. Any ideas?


title: Custom role, capabilities, and post type: preview button wrecks things

text: I'm using the Members plugin to manage capabilities of a custom role that will only be able to edit/publish a custom post type that I created in my functions.php file. After much work, I got this working, except the preview button does not work and (what's worse) prevents saving/publishing custom posts. Everything works fine as long as I do not click the preview button. But when I click the preview button the preview tab does not show any of the changes I've made since the last save. Then when I press the publish/update button, my changes are not saved/published, but are loaded into the preview tab, as if I had pressed preview. Nothing else happens in the browser tab where I'm using WordPress to edit the post, the spinner next to the update/publish button just keeps spinning. Everything works fine from my admin account, and if I give the custom role the "edit_posts" capability that solves it. So it looks like something is going wrong with the custom capabilities for this role, but I can't figure it out. Below is my code from functions.php. Thanks for any suggestions.               // Register Custom Post Type     function mnp_custom_post_type() {     $labels = array(         'name'                => 'Wiki Pages',         'singular_name'       => 'Wiki Page',         'menu_name'           => 'Wiki Pages',         'parent_item_colon'   => 'Parent Wiki Page:',         'all_items'           => 'All Wiki Pages',         'view_item'           => 'View Wiki Page',         'add_new_item'        => 'Add New Wiki Page',         'add_new'             => 'New Wiki Page',         'edit_item'           => 'Edit Wiki Page',         'update_item'         => 'Update Wiki Page',         'search_items'        => 'Search wiki pages',         'not_found'           => 'No wiki pages found',         'not_found_in_trash'  => 'No wiki pages found in Trash',     );          $rewrite = array(         'slug'                => 'wiki',         'with_front'          => false,         'pages'               => true,         'feeds'               => true,     );          $capabilities = array(         'edit_post'           => 'edit_wiki_page',         'read_post'           => 'read_wiki_page',         'delete_post'         => 'delete_wiki_page',         'edit_posts'             => 'edit_wiki_pages',         'edit_others_posts'      => 'edit_others_wiki_pages',         'publish_posts'          => 'publish_wiki_pages',         'read_private_posts'     => 'read_private_wiki_pages',         'delete_posts'           => 'delete_wiki_pages',         'delete_private_posts'   => 'delete_private_wiki_pages',         'delete_published_posts' => 'delete_published_wiki_pages',         'delete_others_posts'    => 'delete_others_wiki_pages',         'edit_private_posts'     => 'edit_private_wiki_pages',         'edit_published_posts'   => 'edit_published_wiki_pages',     );          $args = array(         'label'               => 'wiki_page',         'description'         => 'Wiki pages',         'labels'              => $labels,         'supports'            => array( 'title', 'editor', 'revisions', ),         'taxonomies'          => array( 'category', 'post_tag' ),         'hierarchical'        => false,         'public'              => true,         'show_ui'             => true,         'show_in_menu'        => true,         'show_in_nav_menus'   => true,         'show_in_admin_bar'   => true,         'menu_position'       => 25,         'menu_icon'           => '',         'can_export'          => true,         'has_archive'         => true,         'exclude_from_search' => false,         'publicly_queryable'  => true,         'rewrite'             => $rewrite,         'capabilities'        => $capabilities,     );          register_post_type( 'wiki_page', $args );     }          // Hook into the 'init' action     add_action( 'init', 'mnp_custom_post_type', 0 );          // map meta capabilities     add_filter( 'map_meta_cap', 'my_map_meta_cap', 10, 4 );          function my_map_meta_cap( $caps, $cap, $user_id, $args ) {          /* If editing, deleting, or reading a wiki_page, get the post and post type object. */     if ( 'edit_wiki_page' == $cap || 'delete_wiki_page' == $cap || 'read_wiki_page' == $cap ) {         $post = get_post( $args[0] );         $post_type = get_post_type_object( $post->post_type );              /* Set an empty array for the caps. */         $caps = array();     }          /* If editing a wiki_page, assign the required capability. */     if ( 'edit_wiki_page' == $cap ) {         if ( $user_id == $post->post_author )             $caps[] = $post_type->cap->edit_posts;         else             $caps[] = $post_type->cap->edit_others_posts;     }          /* If deleting a wiki_page, assign the required capability. */     elseif ( 'delete_wiki_page' == $cap ) {         if ( $user_id == $post->post_author )             $caps[] = $post_type->cap->delete_posts;         else             $caps[] = $post_type->cap->delete_others_posts;     }          /* If reading a private wiki_page, assign the required capability. */     elseif ( 'read_wiki_page' == $cap ) {              if ( 'private' != $post->post_status )             $caps[] = 'read';         elseif ( $user_id == $post->post_author )             $caps[] = 'read';         else             $caps[] = $post_type->cap->read_private_posts;     }          /* Return the capabilities required by the user. */     return $caps;     }


title: IE and WordPress

text: I'm developing a WordPress based website. Using latest version of WordPress and Genesis theme. I've to use a seperate stylesheet for IE, how can I add that? Sorry for this silly question, I'm new in web development :(


title: Passing a variable from a FOREACH loop in a link

text:
How would you pass a variable from a foreach loop, through a link? I have tabs that display correctly. The jQuery works. But when I call the variable $category down where the content sorts, $category doesn't have a value.

             ALL
          <?php          $categories=  get_categories('child_of=104');          foreach ($categories as $category) {         $option = '
cat_name;             $option .= '">cat_name;             $option .='\');">';             $option .= $category->cat_name;             $option .= '
';             echo $option;         }     ?>

                  <?php                 /**Get the posts by a category*/                 $portfolio_posts = new WP_Query('category_name=portfolio');                 /** Initiate the output*/                 $output = '';                 /** Loop through the post */                 while ($portfolio_posts->have_posts()): $portfolio_posts-> the_post();                          /** Add Thumbnail to the anchor if present     */                     $output .= '
ID) . '">';                     $size='medium';                     if(has_post_thumbnail($post->ID))                         $output .= get_the_post_thumbnail($post->ID,$size);                        /** Close the widget*/                     $output .= '
';                      endwhile;                 echo $output;             ?>

                     <?php             $output = '';             $output = '
cat_name.'">';         ?>
"                  <?php                      $category_name = strtolower($category->cat_name);                           /**Get the posts by a category*/                 $portfolio_posts = new WP_Query('category_name='.$category_name);                 /** Initiate the output*/                      $output = '';                 /** Loop through the post */                 while ($portfolio_posts->have_posts()): $portfolio_posts-> the_post();                          /** Add Thumbnail to the anchor if present     */                     $output = $category_name;                     $output .= '
ID) . '">';                          $size='medium';                     if(has_post_thumbnail($post->ID))                         $output .= get_the_post_thumbnail($post->ID,$size);                        /** Close the widget*/                     $output .= '
';                      endwhile;                 echo $output;                      rewind_posts();             ?>

        The jQuery tabbing works. Thanks.


title: Sets post_parent in custom post type posts automatically based on cpt->page name

text: I'm trying to write a function that will "pair" my custom post type with a page with the same name as the custom post type. The aim is that when a custom post type is saved, it checks if there's a page with the same name as the custom post type post, and if so, it pulls the id from that page and puts it as the parent id for the CPT post. It's a hacky way for me to keep a bond between them (the custom post type posts inherits different values from the page). However, I can't get it to work, it drops me an id, but it's the wrong id (it grabs the id of the page with the highest id), not sure what I'm doing wrong. Here's the current code:               function find_parent_for_cpt( $data , $postarr ) {         global $post;         if ($post->post_type != 'post' || 'page'){             $post_type = $post->post_type;                  $mypages = get_pages();             foreach($mypages as $page){                      if($page->post_title==$post_type) {                     $data[ 'post_parent' ] = $page->ID;                     return $data;                 }             }         }     }     add_filter( 'wp_insert_post_data' , 'find_parent_for_cpt' , '99', 2 );


title: Long-Running Meta Box Save (Performance)

text: I have a meta box that's designed to allow the user to check a few boxes to (basically) tie two posts together. The problem is that we have so many posts in the system that the request takes up to 10 minutes to complete. I have several solutions in mind, but I don't know what the most "WordPressy" way to take care of it is. My thoughts:   1. Better-performing PHP code!   2. Better performance through straight SQL.   3. Offload current logic onto a thread, and just warn users that data shown may not be up-to-date. The current performance of my PHP is not ideal at all, but I don't know of a better way to handle it. Here's a chunk of my code from the meta box's save function:               $schedules = $_POST['schedules'];     delete_post_meta($post_id, 'schedules');     foreach($schedules as $metaVal) {       add_post_meta($post_id, 'schedules', $metaVal);     }          if (!$schedules) {       $schedules = array();     }          $allSchedulesQuery = new WP_Query(array(       'post_type' => 'vendor_schedule',       'posts_per_page' => -1,       'fields' => 'ids'     ));          foreach ($allSchedulesQuery->posts as $schedulePostId) {       $scheduleVendors = get_post_meta($schedulePostId, 'schedule-vendors');       if (!$scheduleVendors) {         $scheduleVendors = array();       }            // if schedule is unchecked       if (!in_array($schedulePostId, $schedules)) {         $scheduleVendors = array_diff($scheduleVendors, array($post_id));       }       // if schedule is checked       else {         $scheduleVendors[] = $post_id;       }       $scheduleVendors = array_values(array_unique($scheduleVendors));       delete_post_meta($schedulePostId, 'schedule-vendors');       foreach($scheduleVendors as $metaVal) {         add_post_meta($schedulePostId, 'schedule-vendors', $metaVal);       }     }      The code above is from a save function on a meta box tied to the `vendor_post` custom post type. All input is appreciated. Thanks.


title: What's the purpose of the paged.php file?

text: In context of the template hierarchy chart? From what i gather, the paged.php file is something to do with an archive? ![enter image description here](http://i.stack.imgur.com/mxVPw.png)


title: How to Custom Edit Post Title & Permalink Slug?

text: I'm trying to build some functionality where if you're logged into an admin account you'll see a small 'edit' link next to each post title. clicking will use jquery to create 2 form inputs - 1 with the current post title and the other containing the current slug. I'd ideally like to then allow admins to edit any post/slug from the post page itself using Ajax. To accomplish this I need to find how to update MySQL when the user hits "save". What would be the best way to go about doing this? I think I'll need to create a new .php file which is called by JavaScript, passing in the title/slug vars. But I'm not sure which Wordpress core files have the SQL code for updating a post title. Any help would be greatly appreciated!


title: Get rid of "comment" field on non-blog pages

text: How can I get rid of "comment" field at bottom of page I want to use as a static page or pages on site such as "About" ; "Contact" , etc.


title: Default Wordpress widgets always appear

text:
I added only 3 Widgets to my sidebar, however when I set their visibility to hidden in post pages they disappear but ALL the default widgets appear. I want to remove the default widgets from appearing because I don't want any widgets on my post page. Here is the code that makes all the default widgets appear.

         <?php get_search_form(); ?>

<?php _e( 'Pages', 'alkane' ); ?>

<?php wp_list_pages('title_li='); ?>

<?php _e( 'Categories', 'alkane' ); ?>

<?php wp_list_categories('title_li='); ?>

<?php _e( 'Archives', 'alkane' ); ?>

<?php wp_get_archives('type=monthly'); ?>

<?php _e( 'Calendar', 'alkane' ); ?>
         <?php get_calendar(); ?>

<?php _e( 'Recent Posts', 'alkane' ); ?>

<?php wp_get_archives('type=postbypost&limit=5'); ?>

<?php _e( 'Tag Cloud', 'alkane' ); ?>
         <?php wp_tag_cloud('smallest=10&largest=20&number=30&unit=px&format=flat&orderby=name'); ?>

<?php _e( 'About Alkane', 'alkane' ); ?>

<?php printf( __( '%s', 'alkane' ), $alkane_theme_data['Description'] ); ?>

<?php _e( 'Blogroll', 'alkane' ); ?>

<?php wp_list_bookmarks('title_li=&categorize=0'); ?>

<?php _e( 'Meta', 'alkane' ); ?>

             <?php wp_register(); ?>
<?php wp_loginout(); ?>

<a href="<?php bloginfo( 'rss2_url' ); ?>" title="Syndicate this site using RSS 2.0">Entries RSS

<a href="<?php bloginfo( 'comments_rss2_url' ); ?>" title="The latest comments to all posts in RSS">Comments RSS

WordPress.org
             <?php wp_meta(); ?>


title: How to disable users changing their display_name?

text: What would I have to do to prevent users changing their display_name?


title: I'm having some issues with previous_post_link() and next_post_link()

text:
I've been developing a Wordpress site lately and have come across an issue. I need the user to be able to navigate between posts, I'm using the standard Wordpress functions `previous_post_link()` and `next_post_link()` which should in **THEORY** output the links to the next and previous posts in the database... BUT the only links that appear are in the case of the latest post; the first post that was published and in the case of the first post that was published; the latest post. There are 5 posts and they all produce the same links, I'm not doing anything silly or outside of the box. I also had some initial issues with pagination on the main blog feed but that appears to be fixed now.... Here is my code: `single.php`               <?php get_header(); the_post();?>

BLOG

                 <img class="single__image" src="<?php echo Image::get(wp_get_attachment_url(get_post_thumbnail_id($post->ID))); ?>">
Posted on <?php the_time('jS F Y'); ?> by <?php the_author(); ?>

<?php the_title(); ?>

                     <?php the_content(); ?>

<?php previous_post_link(' %link'); ?>

<?php next_post_link('%link '); ?>

          <?php get_footer();?>      and here is the main blog feed: `index.php`               <?php get_header(); ?>

BLOG

                 <?php while(have_posts()) : the_post(); ?>
                         <img class="blog__image" src="<?php echo Image::get(wp_get_attachment_url(get_post_thumbnail_id($post->ID))); ?>">

Posted on <?php the_time('jS F Y'); ?> by <?php the_author(); ?>

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

<?php echo get_the_content_excerpt(30); ?>
                             <a class="blog__post__more" href="<?php the_permalink(); ?>">Continue Reading

                 <?php endwhile;?>                      <?php if(!have_posts()) : ?>
There are no posts to display at this time.
                 <?php endif; ?>
                  <?php get_template_part('partials/sidebar', 'landing'); ?>

<?php previous_posts_link(' Newer Posts'); ?>

<?php next_posts_link('Older Posts '); ?>

     <?php get_footer(); ?>      I hope that someone is able help me with this issue, if you're able to direct me to potential fixes that would be great! Though I have already searched and searched, tried peoples suggestions etc which is why I've chosen to make this post. If something isn't clear please let me know :) Thanks in advance!


title: how to add pagination to the organize series plugin

text: I'm thinking of using the organize series plugin for posts featuring learning videos. As they are step1, step2 etc I'd rather use pagination instead of the next/previous links. Does anyone know how I'd do that?


title: help getting featured image using get_posts

text:
I am using a homepage sorter to arrange the posts on the front page of my site because of that, I am getting the posts in this manner so that I can call each post individually instead of in a foreach loop                   $args = array( 'numberposts' => -1,'category_name' => 'homepage');     $home_post = get_posts( $args );     $image = get_the_post_thumbnail($post->ID);     global $more;     $more = 0;      Then I can call each post this way               <?php if( isset( $home_post[1] ) ) { ?>
<?php echo $home_post[1]->post_excerpt; ?>
      <?php } ?>      My problem is that get_posts has no way to get the post thumbnail outside of using a loop. I can't use a loop because I need my post called in a switch statement. I can't find a way to get the post thumbnail. Do you know of a way?


title: Make table disappear when fields are left blank?

text:
I made a table out of the fields in a custom meta box I created, but now I'd like to know if I could have the table disappear if none of the fields were filled in. Is this too complicated, is there a better solution, or should I just try to fill in all the fields as much as possible? This is what I have so far: _EDIT_ *
      <?php      $anime_anname = get_post_meta($post->ID, 'anime_anname', true);      $anime_angenre = get_post_meta($post->ID, 'anime_angenre', true);      $anime_andirector = get_post_meta($post->ID, 'anime_andirector', true);      $anime_anmusic = get_post_meta($post->ID, 'anime_anmusic', true);      $anime_anstudio = get_post_meta($post->ID, 'anime_anstudio', true);      $anime_anlicense = get_post_meta($post->ID, 'anime_anlicense', true);      $anime_annetwork = get_post_meta($post->ID, 'anime_annetwork', true);      $anime_anrun = get_post_meta($post->ID, 'anime_anrun', true);      $anime_anepisodes = get_post_meta($post->ID, 'anime_anepisodes', true);           if (         !empty($anime_anname)         || !empty($anime_angenre)         || !empty($anime_andirector)         || !empty($anime_andmusic)         || !empty($anime_anstudio)         || !empty($anime_anlicense)         || !empty($anime_annetork)         || !empty($anime_anrun)         || !empty($anime_anepisodes)          ) {     // Table goes here.     }      This is the code for the meta box:               $prefix = 'anime_';          $anime_box = array(         'id' => 'anime-meta-box',         'title' => 'Anime Details',         'page' => 'post',         'context' => 'normal',         'priority' => 'high',         'fields' => array(             array(                 'name' => 'Name',                 'desc' => 'Add the name of the Anime in either English or Japanese(Romanji).',                 'id' => $prefix . 'anname',                 'type' => 'text',                 'std' => ''             ),             array(                 'name' => 'Genre',                 'desc' => 'Is it a thriller, action/adventure, etc...',                 'id' => $prefix . 'angenre',                 'type' => 'text',                 'std' => ''             ),             array(                 'name' => 'Directed by',                 'desc' => 'Name of director(s).',                 'id' => $prefix . 'andirector',                 'type' => 'text',                 'std' => ''             ),             array(                 'name' => 'Music by',                 'desc' => 'Name of composer(s)',                 'id' => $prefix . 'anmusic',                 'type' => 'text',                 'std' => ''             ),             array(                 'name' => 'Studio',                 'desc' => 'Studio which owns the anime.',                 'id' => $prefix . 'anstudio',                 'type' => 'text',                 'std' => ''             ),              array(                 'name' => 'Licensed by',                 'desc' => 'Name of both American and Japanese license holders.',                 'id' => $prefix . 'anlicense',                 'type' => 'text',                 'std' => ''             ),             array(                 'name' => 'Network(s)',                 'desc' => 'Networks which air the show in both Japan and the United States.',                 'id' => $prefix . 'annetwork',                 'type' => 'text',                 'std' => ''             ),              array(                 'name' => 'Original run',                 'desc' => 'Date of when the anime first aired and when it stopped.',                 'id' => $prefix . 'anrun',                 'type' => 'text',                 'std' => ''             ),             array(                 'name' => 'Episodes',                 'desc' => 'Number of episodes.',                 'id' => $prefix . 'anepisodes',                 'type' => 'text',                 'std' => ''             ),              )     );          add_action('admin_menu', 'anime_add_box');          // Add meta box     function anime_add_box() {         global $anime_box;              add_meta_box($anime_box['id'], $anime_box['title'], 'anime_show_box', $anime_box['page'], $anime_box['context'], $anime_box['priority']);     }          // Callback function to show fields in meta box     function anime_show_box() {         global $anime_box, $post;              // Use nonce for verification         echo '<input type="hidden" name="anime_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';              echo '
';              foreach ($anime_box['fields'] as $field) {             // get current post meta data             $meta = get_post_meta($post->ID, $field['id'], true);                  echo '
',                     '', $field['name'], ':	',                     '';             switch ($field['type']) {                 case 'text':                     echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:97%" />',                         '
', $field['desc'],'';                     break;                  }             echo    '',                 '
';         }              echo '
';     }          add_action('save_post', 'anime_save_data');          // Save data from meta box     function anime_save_data($post_id) {         global $anime_box;              // verify nonce         if (!wp_verify_nonce($_POST['anime_meta_box_nonce'], basename(__FILE__))) {             return $post_id;         }              // check autosave         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {             return $post_id;         }              // check permissions         if ('page' == $_POST['post_type']) {             if (!current_user_can('edit_page', $post_id)) {                 return $post_id;             }         } elseif (!current_user_can('edit_post', $post_id)) {             return $post_id;         }              foreach ($anime_box['fields'] as $field) {             $old = get_post_meta($post_id, $field['id'], true);             $new = $_POST[$field['id']];                  if ($new && $new != $old) {                 update_post_meta($post_id, $field['id'], $new);             } elseif ('' == $new && $old) {                 delete_post_meta($post_id, $field['id'], $old);             }         }     }      And finally, the creator of the theme did something similar, where the fields would disappear if nothing was entered. Here is what he did:

<?php the_post_thumbnail('review-thumb-big'); ?>

                                  <div class="overall-score <?php $send_rate = get_post_meta($post->ID, "leetpress_overallscore", true); rating_color($send_rate); ?>">                                 <?php echo get_post_meta($post->ID, "leetpress_overallscore", true); ?>                                 Overall Score

                                 <?php if(get_post_meta($post->ID, "leetpress_criteria1", true)) { ?>
                                     <?php echo get_post_meta($post->ID, "leetpress_criteria1", true); ?>:                                     <?php echo get_post_meta($post->ID, "leetpress_crit1_rating", true); ?>/10                                     <div class="score-bg" style="background:url(<?php echo get_template_directory_uri(); ?>/images/score-<?php echo get_post_meta($post->ID, "leetpress_crit1_rating", true); ?>.png) no-repeat;">

                                 <?php } ?>                                 <?php if(get_post_meta($post->ID, "leetpress_criteria2", true)) { ?>
                                     <?php echo get_post_meta($post->ID, "leetpress_criteria2", true); ?>:                                     <?php echo get_post_meta($post->ID, "leetpress_crit2_rating", true); ?>/10                                     <div class="score-bg" style="background:url(<?php echo get_template_directory_uri(); ?>/images/score-<?php echo get_post_meta($post->ID, "leetpress_crit2_rating", true); ?>.png) no-repeat;">

                                 <?php } ?>                                 <?php if(get_post_meta($post->ID, "leetpress_criteria3", true)) { ?>
                                     <?php echo get_post_meta($post->ID, "leetpress_criteria3", true); ?>:                                     <?php echo get_post_meta($post->ID, "leetpress_crit3_rating", true); ?>/10                                     <div class="score-bg" style="background:url(<?php echo get_template_directory_uri(); ?>/images/score-<?php echo get_post_meta($post->ID, "leetpress_crit3_rating", true); ?>.png) no-repeat;">

                                 <?php } ?>

                              <?php if(get_post_meta($post->ID, "leetpress_good", true)) { ?>

<?php echo get_post_meta($post->ID, "leetpress_good", true); ?>

<?php } ?>                         <?php if(get_post_meta($post->ID, "leetpress_bad", true)) { ?>

<?php echo get_post_meta($post->ID, "leetpress_bad", true); ?>

<?php } ?>


title: How can I make my custom templates respect permissions?

text:
I use the Members plugin to manage permissions on my site. For standard templates, it works great - when the user doesn't have permission to see a page, they get the following message: > Sorry, but you do not have permission to view this content. How can I make sure I still get this message in my custom templates? Which tag do I need to include? **EDIT.** Template source:               <?php     /*     Template Name: Stats     */     ?>               <?php     get_header();     ?>

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

Listeners are counted every minute. The green line is the maximum during any given time period. The red area is the average number of listeners during the same time period.

Listeners over the last hour
           <img class="alignnone" title="Listeners over the last hour" src="<?php echo get_graph(60,60); ?>" alt="" width="481" height="149" />

Listeners over the last day
           <img class="alignnone" title="Listeners over the last day" src="<?php echo get_graph(3600,24); ?>" alt="" width="481" height="149" />

Listeners over the last week
           <img class="alignnone" title="Listeners over the last week" src="<?php echo get_graph(86400,7); ?>" alt="" width="481" height="149" />

           <?php get_sidebar(); ?>

               <?php get_footer(); ?>      Note: The purpose of this template is to act as a front end for a shell script. Any content on the database is irrelevant, so there's no loop. (Though including a dummy loop didn't seem to help.)


title: How can I make a site viewable in multiple languages?

text: I am aware of the question What are options are there to implement a multi language site, but the answers there are focused on multi-language support on the backend as well as the frontend. I am only concerned with offering multi- language viewing of a site's content, not multi-language content creation. Could it be as simple as putting the Google Translate Tools code on my site? I see that there are at least a couple of plugins that offer this functionality - anyone have experience with those?


title: Can the WP e-Commerce Plugin Support a Large Number of Products?

text: Is this plugin good to use on a large site with many products or should I look for another solution? I am concerned with the security as well the ability to scale. Anyone have any experience dealing with this plugin for sites with many products?


title: How to add a link in a image's caption?

text: I would like to add a link to the caption of a photo in one of my posts. I can type in the HTML for the link in the caption, but when I publish the post the link gets removed. **How do you add a link to a caption?** This would be really useful for giving photo credit.


title: Need advice > converting category assignments to custom post meta values

text: Before I found out about the ability to add a meta box (with custom post meta selections) to the page and post editor, I was (and still am to a degree) using categories to define custom post meta. For example, to make a post nofollow, or noindex, I created a category called nofollow and another called noindex and assigned one or both of those categories to a post or page. Then in my header.php file, I'd do an in_category test in order to write the appropriate meta tags to the page. Example:               <?php     if (in_category('noindex') && in_category('nofollow')){?>     <meta name="robots" content="noindex, nofollow">     <?php}?>      I also have custom categories for things like "Disable Adsense for this page", "Don't Show Image Attachments for this Page", "Hide this page from menus", etc... So now that I've decided to move away from using categories where I should be using custom post meta, The above code in header.php instead becomes...               <?php          if (get_post_meta( $post->ID, '_noindex', true ) && get_post_meta( $post->ID, '_nofollow', true )){>?         <meta name="robots" content="noindex, nofollow">     <?php } ?>      So that's my plan, but now I have the problem of upgrading sites that use the old means of defining custom post options via the category assignments. So I need a routing that goes about reassigning the category values to custom post meta values for each post and page in the site I'm upgrading. I'm just looking for some quick advice on how to go about this and possibly some code hints on the neccessary routine. Since this is a theme that can be updated, as part of the update process, I'd like to run a script one time, when the theme is first installed, (or the user clicks my upgrader utility) that runs through the options table and for every instance of one of my custom category assignments, it creates the requisite custom meta assignment for that post or page. For example, if a post currently belongs to the "Hidden" category, it would be assigned to the "_hidden" post meta. Hopefully I've explained this well enough. I appreciate any insights you can provide. Perhaps its as simple as a series of custom SQL statements that run for each possible category assignment?


title: WordPress filtering utm_ GET variables from url unless logged in as admin, not sure why?

text: So I am having an issue where I can't pull variables such as mysite.com/?utm_campaign=testing unless I am logged in as admin or editor. When logged out and just a regular users I can't grab any variables which start in utm_ such as utm_campaign. However utmcampaign works, and any other variable I try. Just not utm_ ones. I disabled all my plugins but still have the same issue. Not sure where the filtering is coming from and not sure why it only filters when not logged in as admin. I tried accessing the variable using three different methods: 1\. Injecting PHP code using the "Code Insert Manager" plugin                <?php echo $_GET['utm_testing']; ?>         1. Using the built-in function of formidablepro to grab the GET variables.   2. Using the same code as #1 but inside my footer.php file of my template.  All have same results.


title: How can a plugin create a page/form in the front end?

text: How can a plugin create a page/form in the front end thats not listed in pages (if possible). it should only be accessed through a direct link.


title: How to make an activities stream mixing posts and comments?

text: What I'm currently trying to make is an activities stream wich list :   * The posts,   * the comments,   * both mixed between them and ordered by date. My idea is to make two queries, but i don't know how to mix them up. Here are my queries :               // Query the posts :     $queryPosts = "         SELECT * FROM $wpdb->posts         WHERE post_type = 'post'         AND post_status = 'publish'         ORDER BY post_date DESC     ";          // Query the comments :     $queryComments = "         SELECT * FROM $wpdb->comments         ORDER BY comment_date DESC     ";      Is that possible with some kind of SQL JOIN ? **UPDATE:**   I tried what was suggested by @scribu about using SQL UNION and it's working well :               SELECT ID AS entry_id, post_date AS entry_date, post_content AS entry_content FROM $wpdb->posts     WHERE post_type = 'post'     AND post_status = 'publish'     UNION     SELECT comment_ID AS entry_id, comment_date AS entry_date, comment_content AS entry_content FROM $wpdb->comments     ORDER BY entry_date DESC      What I'm trying to do now is access some data which are in the posts table and not in the comments table. Any idea ? Thanks by advance.


title: Custom Field - Do Not Show if Value is Empty?

text:
This is the code I've added to a single.php file and I need to NOT display the Article Reference echo line, if the custom field value is empty. I am using Genesis, if that matters. How should this be written? Also, is there a better way to write this code? Thanks, Louise               function custom_do_grid_loop() {     // Intro Text (from page content)     echo '
';     echo '
'. get_the_title() .'
';     if ( has_post_thumbnail() ) {         echo '
' . get_the_post_thumbnail() . '
';     }      echo '

' . get_the_content() . '
';     echo '
Article Reference: ' . genesis_get_custom_field( 'article_reference' ) .'
';          echo '
';     echo '
';     }


title: How do I display the text inside the WP editor for a page with a custom template?

text: I am working in a Child theme on a page with a custom template. That custom template is not displaying any text that I enter into the wordpress editor. How do I "call" that text and display it in my custom template? Is there something like               <?php get_editor_text(); ?>      I just need a way to display the text inside the editor box on the custom teplate page. How would I accomplish this in wordpress?


title: How can I display only the post titles from a selected category in columns?

text: I'm working on a website where the client wants a static page displaying information about a certain category. Then under the static information she wants all the posts from that category in a 2 column list. So I need to have an alphabetically ordered list linking to all the post in a selected category. I have the code to do this, but I need to be able to break the list up in columns. Here is the code I have displaying the post...               <?php     if (is_page() ) {     $category = get_post_meta($posts[0]->ID, 'category', true);     }     if ($category) {       $cat = get_cat_ID($category);       $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;       $post_per_page = -1; // -1 shows all posts       $do_not_show_stickies = 1; // 0 to show stickies       $args=array(         'category__in' => array($cat),         'orderby' => 'title',         'order' => 'asc',         'paged' => $paged,         'posts_per_page' => $post_per_page,         'caller_get_posts' => $do_not_show_stickies       );       $temp = $wp_query;  // assign orginal query to temp variable for later use          $wp_query = null;       $wp_query = new WP_Query($args);        if( have_posts() ) :              while ($wp_query->have_posts()) : $wp_query->the_post(); ?>             <div <?php post_class() ?> id="post-<?php the_ID(); ?>">             <_li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to          <?php the_title_attribute(); ?>"><?php the_title(); ?><_/li>      I know my HTML skills aren't the best, but here is the entire template page... https://gist.github.com/889340


title: wp_get_theme Warning: Illegal offset type

text: I'm using `Post templates` plugin. But its very outdated. I'm getting `Warning: Illegal offset type` at this line               $templates = $themes[$theme]['Template Files'];      Here is my full function code.               function get_post_templates() {         $themes = wp_get_themes();         $theme = wp_get_theme();         $templates = $themes[$theme]['Template Files'];         $post_templates = array();              $base = array(trailingslashit(get_template_directory()), trailingslashit(get_stylesheet_directory()));              foreach ((array)$templates as $template) {             $template = WP_CONTENT_DIR . str_replace(WP_CONTENT_DIR, '', $template);              $basename = str_replace($base, '', $template);                  // don't allow template files in subdirectories             if (false !== strpos($basename, '/'))                 continue;                  $template_data = implode('', file( $template ));                  $name = '';             if (preg_match( '|Single Post Template:(.*)$|mi', $template_data, $name))                 $name = _cleanup_header_comment($name[1]);                  if (!empty($name)) {                 if(basename($template) != basename(__FILE__))                     $post_templates[trim($name)] = $basename;             }         }              return $post_templates;          }      Can someone tell me how to fix that?


title: Custom comments

text: I'm trying to create a custom comments page with pagination. I have non-hierarchical custom type "apartments". It makes urls like:               /apartments/ - for acrhive     /apartments/%id%/ - for post page     /apartments/%id%/comments-page-X/ - for comments (X is some number)      How do I create page `/apartments/%id%/questions/` for comments? And remove `/apartments/%id%/comments-page-X/` if possible. I would like to make this url structure for comments:               /apartments/%id%/questions/ - first page of the comments     /apartments/%id%/questions/page/X/ - pagination for comments (X is some number)      What is the solution?


I have been trying to remove sidebar so i can use full width of page but no luck. Does anyone have any idea how to enable full width page template in woo theme memorable?


title: Retreive post thumbnail and display it as tooltip on hover?

text: I used a plug in to retrieve all the post from a category. The post is displayed in an unordered list `<ul><li>` and everything if fine, even the `<a>` tags to the post. Now, for more usefulness (it's a word?), I would like, on hover of the link, to display the first image of the nextgen gallery found in this post. I do not have enough know-how to retro engineer the ngg plugin, but there should be a way to get, let's say the thumbnail of a post and set it as a tooltip.


title: BuddyPress - How to add logout in nav menu

text: How to add a logout option to the main nav menu (not to the top bar) in BuddyPress?


title: How to add editable/dynamic values to dropdown of a Custom Post Type Meta Box

text: I am new to custom post types so I might not be explaining this the right way (apologies), but I am developing a WP project based on football games - with a major part of this involving which teams playing one another. The problem I am having is working out a way to easily add teams to the dropdown list that I am using. Right now it's something I am adding directly to the plugin form. The problem is for a home and away team I have to repeat the team list, and it's not exactly easy to manage if I end up working with 100's of different teams. Is there a better way to do this? Ideally I'd like a way to load in entries on one page and then display them in a dropdown that I can reuse as different field elements. (i.e. a home team and away team that has the same values) I have been extending the example from tutsplus movie review example. Some of the code snippets for what I'm doing is as follows:               add_action( 'admin_init', 'my_admin' );          function my_admin() {     add_meta_box( 'football_Game_meta_box',     'Football Game Details',     'display_football_Game_meta_box',     'football_Games', 'normal', 'high' );     }      And inside function **display_football_Game_meta_box()** I have data like (I'm sure you can see the problem):                       <option value="Arizona Cardinals" <?php echo $football_Game_team_home == "Arizona Cardinals" ? 'selected="selected"' : '' ?>>Arizona Cardinals</option>             <option value="Atlanta Falcons" <?php echo $football_Game_team_home == "Atlanta Falcons" ? 'selected="selected"' : '' ?>>Atlanta Falcons</option>             <option value="Baltimore Ravens" <?php echo $football_Game_team_home == "Baltimore Ravens" ? 'selected="selected"' : '' ?>>Baltimore Ravens</option>             <option value="Buffalo Bills" <?php echo $football_Game_team_home == "Buffalo Bills" ? 'selected="selected"' : '' ?>>Buffalo Bills</option>             <option value="Carolina Panthers" <?php echo $football_Game_team_home == "Carolina Panthers" ? 'selected="selected"' : '' ?>>Carolina Panthers</option>             <option value="Chicago Bears" <?php echo $football_Game_team_home == "Chicago Bears" ? 'selected="selected"' : '' ?>>Chicago Bears</option>             <option value="Cincinnati Bengals" <?php echo $football_Game_team_home == "Cincinnati Bengals" ? 'selected="selected"' : '' ?>>Cincinnati Bengals</option>             <option value="Cleveland Browns" <?php echo $football_Game_team_home == "Cleveland Browns" ? 'selected="selected"' : '' ?>>Cleveland Browns</option>             <option value="Dallas Cowboys" <?php echo $football_Game_team_home == "Dallas Cowboys" ? 'selected="selected"' : '' ?>>Dallas Cowboys</option>             <option value="Denver Broncos" <?php echo $football_Game_team_home == "Denver Broncos" ? 'selected="selected"' : '' ?>>Denver Broncos</option>             <option value="Detroit Lions" <?php echo $football_Game_team_home == "Detroit Lions" ? 'selected="selected"' : '' ?>>Detroit Lions</option>             <option value="Green Bay Packers" <?php echo $football_Game_team_home == "Green Bay Packers" ? 'selected="selected"' : '' ?>>Green Bay Packers</option>             <option value="Houston Texans" <?php echo $football_Game_team_home == "Houston Texans" ? 'selected="selected"' : '' ?>>Houston Texans</option>             <option value="Indianapolis Colts" <?php echo $football_Game_team_home == "Indianapolis Colts" ? 'selected="selected"' : '' ?>>Indianapolis Colts</option>             <option value="Kansas City Chiefs" <?php echo $football_Game_team_home == "Kansas City Chiefs" ? 'selected="selected"' : '' ?>>Kansas City Chiefs</option>             <option value="Miami Dolphins" <?php echo $football_Game_team_home == "Miami Dolphins" ? 'selected="selected"' : '' ?>>Miami Dolphins</option>             <option value="Minnesota Vikings" <?php echo $football_Game_team_home == "Minnesota Vikings" ? 'selected="selected"' : '' ?>>Minnesota Vikings</option>             <option value="New England Patriots" <?php echo $football_Game_team_home == "New England Patriots" ? 'selected="selected"' : '' ?>>New England Patriots</option>             <option value="New Orleans Saints" <?php echo $football_Game_team_home == "New Orleans Saints" ? 'selected="selected"' : '' ?>>New Orleans Saints</option>             <option value="New York Giants" <?php echo $football_Game_team_home == "New York Giants" ? 'selected="selected"' : '' ?>>New York Giants</option>             <option value="New York Jets" <?php echo $football_Game_team_home == "New York Jets" ? 'selected="selected"' : '' ?>>New York Jets</option>             <option value="Oakland Raiders" <?php echo $football_Game_team_home == "Oakland Raiders" ? 'selected="selected"' : '' ?>>Oakland Raiders</option>             <option value="Philadelphia Eagles" <?php echo $football_Game_team_home == "Philadelphia Eagles" ? 'selected="selected"' : '' ?>>Philadelphia Eagles</option>             <option value="Pittsburgh Steelers" <?php echo $football_Game_team_home == "Pittsburgh Steelers" ? 'selected="selected"' : '' ?>>Pittsburgh Steelers</option>             <option value="San Diego Chargers" <?php echo $football_Game_team_home == "San Diego Chargers" ? 'selected="selected"' : '' ?>>San Diego Chargers</option>             <option value="San Francisco 49ers" <?php echo $football_Game_team_home == "San Francisco 49ers" ? 'selected="selected"' : '' ?>>San Francisco 49ers</option>             <option value="Seattle Seahawks" <?php echo $football_Game_team_home == "Seattle Seahawks" ? 'selected="selected"' : '' ?>>Arizona Cardinals</option>             <option value="St. Louis Rams" <?php echo $football_Game_team_home == "Seattle Seahawks" ? 'selected="selected"' : '' ?>>Seattle Seahawks</option>             <option value="Tampa Bay Buccaneers" <?php echo $football_Game_team_home == "Tampa Bay Buccaneers" ? 'selected="selected"' : '' ?>>Tampa Bay Buccaneers</option>             <option value="Tennessee Titans" <?php echo $football_Game_team_home == "Tennessee Titans" ? 'selected="selected"' : '' ?>>Tennessee Titans</option>             <option value="Washington Redskins" <?php echo $football_Game_team_home == "Washington Redskins" ? 'selected="selected"' : '' ?>>Washington Redskins</option>      A screenshot of how this ends up looking like is: ![Screen Grab](http://i.stack.imgur.com/qdqeS.png)


title: Why will using __construct instead of widget_class_name when creating widget trigger out of memory error

text: I find that if I use               class widget_name extends WP_Widget {         function __construct() { ... }     }      instead of               class widget_name extends WP_Widget {         function widget_name() { ... }     }      I get an error like > `Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to > allocate 523800 bytes) in /var/www/vhosts/klifmedia.net/httpdocs/jm/km/wp- > content/themes/km/functions.php on line 77`


title: Restrict access in wp-admin area?

text: What action or filter do I have to check or compare against $pagenow? In the admin area, I need to let non admin and editor users only to access:               index.php (dashboard)     upload.php (attachments management)     media.php (attachments management)     media-new.php (attachments management)      Thanks in advance.


title: How to use alias domain for multisite installation?

text: Is it possible to use alias-domain for multisite installation? I have tried domain-mapping plugin and Multi Domains plugin for WordPress, but this does not solve this problem. Example: I have installed WordPress multisite on domain.com. My bloggers have sub- domains like myblog.domain.com. Now I want to add an alias domain like domain.co.uk. So, myblog.domain.com will be the same as myblog.domain.co.uk I have tried to set up an alias but it just redirects the domain to the signup-page (wp-signup.php)


title: How to load a different theme for categories?

text: I need to load a completely different theme for my categories. My search came up with `switch_theme` function but it changes the theme permanently while I only need the theme change only occur on my category pages. Then I found this.               add_filter( 'template', 'my_change_theme' );     add_filter( 'option_template', 'my_change_theme' );     add_filter( 'option_stylesheet', 'my_change_theme' );          function my_change_theme($theme)     {         if ( is_category() )             $theme = 'theme_for_cats';              return $theme;     }      The problem with this one is, it only loads the correct stylesheet. The markup stays the same as my default theme.   Any help is appreciated.


I have registered my custom taxonomy and want to use dropdown in back end... code given here Taxonomy dropdown metabox in the back-end works like a charm.... but now in admin there are two metaboxes one is my custom which shows as drop down and another is default which takes comma seprated input similar as tags and i dont want that... So how could i remove that default meta box...


title: How to check if user is in back end?

text: In my application, i have one form. Now if user is in front end i want to display the title but if he is in back end i do not want to display it. I do not want to check it based on user role.


title: Action hook 'save_post' triggered when deleting posts

text: I developed a custom plugin which rewrite some content of my posts, but when i move a post to trash, the action hook 'save_post' is triggered and the post is not deleted. A simplified version of my code :               add_action('save_post', 'rewrite_post', 10, 2);          function rewrite_post($post_id) {         remove_action('save_post', 'rewrite_post');              $title = preg_replace('/\_/', ' ', get_the_title($post_id));         $my_post = array();         $my_post['ID'] = $post_id;         $my_post['post_title'] = $title;         $my_post['post_status'] = 'publish';         wp_update_post($my_post);              add_action('save_post', 'rewrite_post');     }      How can i prevent this hook getting triggered when i delete posts ?


title: Adding post thumbnail in programatically inserted post

text: I want to insert post programatically so here is the code to add one:               global $user_ID;     $new_post = array(         'post_title' => 'My New Post',         'post_content' => 'Lorem ipsum dolor sit amet...',         'post_status' => 'publish',         'post_date' => date('Y-m-d H:i:s'),         'post_author' => $user_ID,         'post_type' => 'post',         'post_category' => array(0)     );     $post_id = wp_insert_post($new_post);      How to add a featured image to post and trigger it for testing ?


title: Broken pagination on custom search query

text:
I've been searching through various questions and answers for some time now, but can't figure it out. I should state that I'm still a novice when it comes to WP coding. The thing is, I'm using a custom query to exclude certain post category named 'Pioneer' from showing up in search results. It works "fine" (I've read about WP's search flaws), it gives me posts as it should on the landing page, but it gives me 404 error on pagination `/page/2/?=''`, so I concluded that URL works ok and that the problem is in the query itself.                   <?php $category_id = get_cat_ID('Pioneer'); ?>         <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>         <?php $q = array(); ?>         <?php $q['category__not_in'] = array($category_id); ?>         <?php $q['paged'] = $paged; ?>         <?php $q['posts_per_page'] = 5 ?>         <?php query_posts($q); ?>         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>             <?php include('post.php') ?>             <?php endwhile; ?>             <?php get_template_part( '/inc/nav' );?>             <?php else : ?>

No posts found.

Try a different search?
                 <?php get_search_form(); ?>
         <?php endif; ?>        * I didn't modify WP's default search function.    * I'm using Advanced custom fields plugin to create a field for youtube links, although that field is not included in `post.php` so I don't think it's a plugin problem also.   * This same query works fine on `index.php`.    * I've tried using wp_reset_query(); with no luck.   * Even tried an "idea" that the number of displayed posts in `Settings > Reading` needs to be lower than the number specified in the query. I'd appreciate if someone could point me in the right direction of what I'm doing wrong.


title: HTML Validation fails because of ampersands in RSS link

text:
I use Wordpress' own rss.php to pull in the last 10 items from an external RSS feed. Wordpress automatically adds campaign info to the link like this:               http://domainname.com/postname?utm_source=rss&utm_medium=rss&utm_campaign=postname      Because of the ampersands, the page doesn't validate. Was wondering if I can add anything to the code below to solve it. * * *                    <?php $blogfeed = get_post_meta($post->ID, 'blog_feed', true);         if($blogfeed) : ?>

                         <?php             include_once(ABSPATH.WPINC.'/rss.php'); // path to include script             $feed = fetch_rss($blogfeed); // specify feed url             $items = array_slice($feed->items, 0, 10); // specify first and last item             ?>                  <?php if (!empty($items)) : ?>                 <?php foreach ($items as $item) : ?>

<a href="<?php echo $item['link']; ?>" target="_blank"><?php echo $item['title']; ?>

<?php echo $item['atom_content']; ?>

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

          <?php else : ?>          <?php endif; ?>


title: Securing a multi-user permission structure

text: I'm currently working on a team that needs two distinct users from the same `wpadmin` group to be able to modify the wordpress files. Following the guide at Hardening WordPress (Codex), the following commands would give `755` and `644` access to directories and files respectively:               find /path/to/my/wordpress/install/ -type d -exec chmod 755 {} \;     find /path/to/my/wordpress/install/ -type f -exec chmod 644 {} \;      But the lack of the `g+w` permission would make this unusable on a multi-user environment. What best practices should I follow in this case? Is it secure to just do               find /path/to/my/wordpress/install/ -type d -exec chmod 775 {} \;     find /path/to/my/wordpress/install/ -type f -exec chmod 664 {} \;      To add group access?


title: Show author post count in sidebar - Variable

text:
I need to display something of a mini author statistic in my sidebar on the single posts page. I'm using the PHP code widget, to allow me to insert PHP code into a widget. What I've done is run a loop in the sidebar like this:               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

               <?php echo 'Posts made: ' . get_usernumposts(4); ?>
     Author Rank: <?php the_author_meta('user_level'); ?>
     Author's Name: <?php the_author_meta('display_name'); ?>
     User ID: <?php the_author_meta('ID'); ?>

              <?php endwhile; else: ?>
<?php _e('No posts by this author.'); ?>
              <?php endif; ?>      So that shows the number of user posts for the author ID '4'. And yes, the function still works properly though it's deprecated. I obviously need something a bit more dynamic, as the author data varies post to post, so a static ID is not going to do the trick. I've no idea why there isn't something like               <?php the_author_meta('post_count'); ?>      I suppose that would be too convenient. I've seen a lot of queries that select post counts in various ways, all of which either aren't what I need or do not work in or outside of my loop in the sidebar. My first thought, though I am no expert with PHP is to assign a variable to the value of usernumposts that pulls the data from the value of               <?php the_author_meta('ID'); ?>      I don't know if this is possible at all, but it would certainly achieve my goals. So can this be done? How? And if not - what are my other options? Thanks!


title: For one linked image per post, override that link with a permalink when on the main page

text: Is there an existing plugin that allows a person to, in a post, put a link on an image, but when the post is shown as part of the main-page list, have that image link to the post's permalink instead. If not, can you point me in the right direction to custom code this myself? (What files to edit, what WP functions already exist that might help me...) I have a decent grasp of functional/procedural PHP, but have only the slightest experience editing WP code. I am using WordPress 3.9 and the theme "Twenty Ten" Feel free to re-tag this question. I am not familiar enough with WP or WP.SE to know what tags are best.


title: Widget Areas Still Appearing in WP ADMIN When They Shouldn't

text: I had a bunch of "Widget Areas" registered for my theme. I removed a few and added a few. The ones which I removed, I deleted the code which is hooked on `widgets_init` for registering the sidebars. I have also "unregistered" the old "widget areas". I've looked in the database, and see no references to these Widget Areas. However, for some reason, when I navigate to `WP ADMIN -> Appearance -> Widgets` the old "Widget Areas" are still appearing, when they shouldn't be. The code which registers them has been removed, and they've already been "unregistered". Is there some sort of cache for registered widget areas or something?


title: How to orderby meta_value_num with dollar ($) sign

text: The custom fields all have prices including $ signs, and a dot as separator.               $theQuery = new WP_Query(array(     'orderby' => 'meta_value_num',     'meta_key' => 'price',     'order' => ASC       ));      All formatted like this: $24.95 $190.00 $1.40 They won't sort correctly due to the dollar sign, is it possible to ignore or remove the first character / $ sign in this WP_Query?


title: Each User has a Personal Blog

text: Is there a way for a website running Wordpress to have users register, and then each user have their own, personalized blog or page which others can see, or should I use another engine for this, and if so, which?


title: Media upload - choose only one file

text: It is possible to restrict the upload process to choose only one file. Now a person can select various files from pc, Im trying to find a way to restrict this feature just to one file. Thanks in advance.


title: Order query by meta_value with multiple custom fields

text: I would like to get ordered all my posts with multiple cutom fields (WordPress 3). Exemple, I've 2 custom couple meta_key/meta_value : " order_submenuexpositions / numeric " " display_submenuexpositions / boolean " I tried like this, but the result it's not orderer by meta_value from "order_submenuexpositions" meta_key :               SELECT * FROM wp_posts     LEFT JOIN wp_postmeta wpostmetaOrder ON ( wp_posts.ID = wpostmetaOrder.post_id AND wpostmetaOrder.meta_key = 'order_submenuexpositions' )     LEFT JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id     LEFT JOIN wp_term_relationships wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)     LEFT JOIN wp_term_taxonomy wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id)     WHERE wp_postmeta.meta_key = 'display_submenuexpositions'     AND wp_postmeta.meta_value = 'true'     AND wp_posts.post_status = 'publish'     AND wp_posts.post_type = 'post'     AND wp_term_taxonomy.taxonomy = 'category'     ORDER BY wpostmetaOrder.meta_value ASC,wp_postmeta.meta_value ASC      how can i do it ? thank you !


title: Can I wrap an unordered list inside a shortcode?

text:
So, I created an events page for my client that holds lots of details about events. We found no particular event plugins to be helpful for their purpose, so I built a a custom template using advanced custom fields. They are very computer illiterate and will need to be entering these events in very frequently. I used a few shortcodes from my theme to create the layout for these pages. Now I want to take basically make the page super simple for them to fill out, like a form, and output the same layout. To so this, I need to code the shortcodes into my template. All of the shortcodes have opening & closing tags, like this:               [one-half] content [/one-half]      I want to put this list (which includes my advanced custom fields), inside the shortcode tags:

<?php the_field('highlights_list_item#1'); ?>

<?php the_field('highlights_list_item#2'); ?>

      All I have found so far (that is helpful) for putting content inside a shortcode, is this:               <?php echo do_shortcode('[one_half]'.$text_to_be_wrapped_in_shortcode.'[/one_half]'); ?>      But how do I put a list inside there? Can I have advanced custom fields inside shortcode tags? I thought about just styling this to match what the shortcode does, but I'd like to learn this. Also, I have another section that I will have to do the same thing with, but it is a toggle with an advanced custom field paragraph inside of it. I really appreciate the help!!


title: Add a Meta Box for uploading a SECOND Featured Image?

text: I'd like to add a meta box to my posts and page editor that will allow me to upload an image and use it as sort of a SECOND featured image. The idea is that my client will be able to upload an image to this meta box to customize the page/posts header image. Here is an example of what the final result would be: http://gointrigue.com/locations-and-dates/ As you can see at the top of the page there is a large banner of a dancer. Right now this is hardcoded with CSS. I'd like for this to instead be editable by my client from within the Wordpress post/page edit screen on a per page and per post basis. How do I get started?


title: How can I insert a dynamic URL in my email template?

text: I'm not sure if that's even possible, but I thought I should give it a try. I'm using WP Better Emails plugin in order to create HTML emails for my buddypress website. I want to add to the footer an option for the user to change his notification settings. Something like this: Do you want to update your notification settings? Change Settings. I need to make 'Change Settings' a dynamic link that it'll redirect user to 'http://connect.stage.tgg.gr/members/%username%/settings/notifications/' How can I achieve this through HTML? Can I perhaps do it through a filter?


title: Is there anything special I have to think of when setting post_date_gmt when inserting a new post?

text: I'm inserting information from a user into a custom post type. `$current_user` it a user-object. Is there anything special I have to think of when setting `post_date_gmt` when inserting a new post with wp_insert_post? (Or could I just fetch the value from the user-table like below?               $pupil = array(                   'post_title'      => $current_user->display_name,                   'post_date'       => $current_user->user_registered,                   'post_date_gmt'   => $current_user->user_registered,                   'post_type'       => 'pupil',                   'post_status'     => 'private',                     //This registration cpt is not available for public                   'post_author'     => $current_user->ID                 );                 $postid_pupil = wp_insert_post( $pupil )


title: Can a child theme based on Starker theme be released as free to use theme for public use?

text: I created a child theme named "Naksh" based on "Starker" theme.Now i want to show case it on wordpress,so can I release it under GPL.Also is there any money I need to pay to Starker theme creator for using his theme as a starting point?


title: upload file with front-end submission and forward the data in an email

text: I have an email set up using `wp_mail` that forwards my front-end submission data as well as posting it to the dashboard. The part that I am having trouble with is forwarding the attachment file with that email. I found this post helpful: File upload from front-end form (as attachment) not working I can only get the email to forward a url of the image **OR** post it to the dashboard, but not both. I really need it to do both. Problem is $movefile does just that, moves it from the dashboard to the email. Is there a way to do both-keep it in the dashboard and forward with that email?                   //successfully uploads file to dashboard         if ($_FILES) {             foreach ($_FILES as $file => $array) {             $newupload = insert_attachment($file, $pid);         }                   //successfully sends file url          if ( ! function_exists( 'wp_handle_upload' ) ) require_once( ABSPATH . 'wp-admin/includes/file.php' );             $uploadedfile = $_FILES['file'];             $upload_overrides = array( 'test_form' => false );             $movefile = wp_handle_upload( $uploadedfile, $upload_overrides );         if ( $movefile ) {             echo "File is valid, and was successfully uploaded.\n";             var_dump( $movefile);         } else {           echo "Possible file upload attack!\n";         }           }


title: Internet Explorer opens links to .msi files as text in a new tab

text: I'm really struggling with this issue. The WordPress site I manage has had .msi files available to download for a long time. Since the recent update to WordPress 3.8, Internet Explorer no longer downloads .msi files correctly. Instead, it opens a new tab and displays thousands of lines of garbage code. Even if you right click and save as, the extension shows up as .htm instead of .msi. Chrome and Firefox continue to download the .msi files correctly. Only IE has this issue. CPanel shows the .msi files having the MIME-type application/octet-stream, so what I believe is the correct MIME-type is being sent to IE. In the functions.php file, I found the following:   ` function send_nosniff_header() {   @header( 'X-Content-Type-Options: nosniff' );   }` Which, ideally, would tell IE to not sniff the MIME-type... But I have no idea if it is correct. Or in the correct spot. I didn't create this site, I'm only trying to maintain. And to make things more interesting, I'm brand new to WordPress. So if anyone has any ideas that might help, I would really appreciate it. Thanks.


title: Remove / Hide Attachment Display Settings in Add Media popup / dialog

text: I would like to filter out the 'Alignment' and 'Link to' options for Inserting Images. Ideally with php in the functions.php file. Thanks! ![settings are on bottom right](http://i.stack.imgur.com/hBBpe.png)


title: Settings keep redirecting to options.php on save attempt

text: So I've desperately been looking around and can't seem to find where my error is occurring and/or what is causing it. **_Background_** I've got a plugin that I've developed that I'm currently using and have been using for over a year. I've been using it on both Single-Site and Multi-Site installs and have not had this particular issue ever occur before or since. It's only affecting one of the 46 different WP installs that I currently support. This site is installed on the same server as multiple other sites that are not having any problems with the plugin. **_Problem_** With the plugin activated and configured on a Single-Site Install, all other settings are locked down and I'm unable to save. Any attempt to save settings causes a redirect to "options.php" and the settings are not updated. **_Solution Attempts_** I've tried using the default TwentyFourteen theme as well as the TwentyTen theme, but all with no luck. I've attempted to change the action on the plugin settings form, but again with no luck. I've also already deactivated all plugins and then stepped through them one by one and they all work except for this one. That's how I was able to determine that this plugin was the culprit. I've also tried a complete Re-install of WordPress, with a complete Database re-install and again with no luck. The only solution is to deactivate the plugin. There are also no errors being thrown in the Apache logs Has anyone run into this issue before and if so can you please let me know what you did to fix it? The plugin in question is https://wordpress.org/plugins/header-login/ It is a fairly simple plugin that we use internally to allow for SSO. This was my first plugin I've ever created, so I'm not saying it's perfect. I've just never had this issue before and like I said, I'm running it on 46 different installs and 6 different servers, both Single Sites and Multi-Sites with a similar set of plugins on those installs. If you need any further information, please let me know and I can answer any questions.


title: What is generating Similar Posts and Related Posts on my blog?

text: I checked in my list of plugins, and I have nothing that seems like Related Posts or Similar Posts. Yet, at the end of my posts I find two very similar sections titled as such. Any idea how to turn one of them off, and how to understand what plugins are responsible for generating them?


title: WordPress query for most recent posts from multiple categories

text: I have 5 categories. I want to query each category and get a list of the most recent posts from them. I also only want single post from each category, with no duplicates. Is there a way to do this without writing 5 queries? Can it be done with one query? I should end up with the following results: 1|most recent post from CategoryA   2|most recent post from CategoryB   3|most recent post from CategoryC   4|most recent post from CategoryD   5|most recent post from CategoryE


title: Is there a way to separate a site inside a network (multisite) into its own wp site?

text: If there is a network (multisite installation) with 10 sites inside. Is there a clean way to separate that site to its own site in a different server? How?


title: Adding special characters to slug?

text: Is it possible to prevent WP from stripping out certain characters when customizing a URL? For example, affiliate ids usually have something like `?id=something`. Customizing a content's slug with that results in the `?` being converted to a `\`. Any way to keep WP from rewriting the URL?


title: Does anyone have any frameworks to setup custom post types and related actions/filters?

text: So I know that setting up custom post types ranges from just registering them to adding custom permalinks, custom sorting, customizing columns in the admin, etc. I was wondering if anyone had a template or framework that they use regularly to set up custom post types in projects? Do you start from scratch every time or do you have a base line you start from that you customize?


title: WP insert post PHP function and Custom Fields

text: The wordpress function is used for submitting data programatically. Standard fields to submit to incude the content, excerpt, title, date and many more. What there is no documentation for is how to submit to a custom field. I know it is possible with the `add_post_meta($post_id, $meta_key, $meta_value, $unique);` function. What I don't know is how to include that into the standard wp_insert_post function.               <?php      $my_post = array(          'post_title' => $_SESSION['booking-form-title'],          'post_date' => $_SESSION['cal_startdate'],          'post_content' => 'This is my post.',          'post_status' => 'publish',          'post_type' => 'booking',       );       wp_insert_post( $my_post );       ?>      Any ideas, Marvellous


title: Fullscreen gallery plugin

text: I have been looking for wordpress fullscreen gallery that would support WP core gallery feature and is not based on flash. It should look similar to mashable.com (i.e. http://mashable.com/2012/03/03/instagram-products-decor/) or


title: wp_mail is undefined

text: I am writing a plugin that opens up a form to invite people to a website by email and want to use `wp_mail()`. Whenever I use the `wp_mail()` function in any file in my plugin folder I always end up with: PHP Fatal error: Call to undefined function wp_mail() The code segment in question is:               function send_email() {         $subject = 'test';         $message = 'this is a test from send invitation';         $to = 'navanitachora@gmail.com';         wp_mail($to, $subject, $message);     }      I am at my wits end as to why this should be happening when so many plugins use `wp_mail()`. Thanks in advance.


title: Integrating an interactive map into a Wordpress custom post type

text:
A while ago I created an interactive map for my website using Ian Lunn's BBC News Map, and custom fields to set the html for each area. It looks like this:- ![enter image description here](http://i.stack.imgur.com/PvdUF.jpg) I'm now trying to integrate this with a custom post type, the idea is that each map area would become a category with a list of posts in that category underneath (item 1, item 2 in the picture). I've found examples of displaying a custom post type by category, but my template looks like this

North West

<?php if($data = get_post_meta($post->ID, 'North-West', true)) { echo $data; } ?>

North East

<?php if($data = get_post_meta($post->ID, 'North-East', true)) { echo $data; } ?>

      Requiring custom code for each section. Is there an approach which would allow me to display the posts by category and keep the template code the way it is now, or should I rewrite the template so a single template can display all the areas. Thanks in advance...


title: How to make "sticky" pages (and query by them)

text: I have query_posts() with page_type set as 'page'. Is there any way I can make certain pages appear higher and thus, make them sticky?


title: xmlrpc.php act as threat to wordpress security?

text: please could any one suggest what are the necessary steps needs to make wordpress sites more secure. i know it is kind of general question but still if still any hacks which improves security of wordpress site, i will be happy to take suggestions.


title: How can i use a global variable in a .css file generated with php?

text: I am including a .css which i parse with php like so               <link rel="stylesheet" type="text/css" media="all" href="<?php echo get_childTheme_url(); ?>/css/productgallery.php" />      Now in productgallery i can not use a global variable (an array) which i have set in functions.php How do i fix this?


title: Adding a <code> button to the WYSIWYG editor?

text: I've been looking for a way to add a button to wrap text in ` for the WYSIWYG editor in Wordpress 3.3.1. I tried this:               function enable_more_buttons($buttons) {      $buttons[] = 'code';      return $buttons;     }     add_filter("mce_buttons_3", "enable_more_buttons");      But that did not work as expected. It did display a button, but it brings up a popup window to edit the HTML. In addition to it would be nice to have and .


title: Does a WP site consumes memory resources when there are NO visitors?

text: I understand that every time a visitor goes to a website, it triggers the PHP code that then demands system resources. My situation is that I have many websites, some not used, just sitting there, and I am wondering if they are demanding anything from my server. I know that there is wp-cron file, that is supposed to work only if there is some visitor to the site. But what about google bots, do they count ? If not - then how come these sites backup would still work and send the file to my e-mail? p.s: I feel like this question should be phrased as a ZEN question: "If a WordPress is on a server - and no one listens - did it load?"


title: Are there any downsides to installing WordPress on Windows versus Linux?

text: We're planning on installing WordPress on Windows Server 2008 to be consistent with the rest of our servers and leverage administrative expertise. The server will not be running anything else. Are there any gotcha's to be had for Wordpress on Windows versus Linux (outside of server licensing costs)?


title: Disable escaping html

text: I'm using SyntaxHighlighter Evolved to highlight code examples. E.g.               [csharp]     string s = "text";     List<int> numbers = new List<int>();     [/csharp]      When I first save it, it's ok, but when editing wordpress changes the text to               [csharp]     string s = "text";     List<int> numbers = new List<int>();     [/csharp]         After second edit it becomes               [csharp]     string s = &quot;text&quot;;     List&lt;int&gt; numbers = new List&lt;int&gt;();     [/csharp]         How do I disable escaping? I want the content to be exactly what I type.


How to add automatically keyword to taxonomies when a post published, and assign them to the post for example i have in my post edition, a custom meta box, when you complete this input, a function should generate a group of keywords in background , and i want these keywords are automatically adding to a specific custom taxonomy in that post when it published, this is possible? i try with > wp_set_object_terms and nothing working great, thx _sorry for my worst english_


title: Suggestions for Implementing a Wedding Website in WordPress?

text: A would like to create a website in WordPress that allows user to create wedding websites. What suggestions can you give me on how to implement it?


title: Add CSS to head depending on nav menu walker

text: I have a custom walker for a navigation menu on my website, and within it I have some custom CSS that I want to apply to each menu, however, I cannot simply echo it there because even though it works fine, it is invalid code according to W3 validator. The solution is to send that css code to the Head section, but I am stumped how. Note: The css code is dynamic and will change, so hardcoding the css into the stylesheet won't work. I have all the css stored in an array as such.               class Special_Walker extends Walker_Nav_Menu     {          function start_el(&$output, $item, $depth, $args) {                  //menu generation code                  $css_code[] = //store css code in array                   $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );                  }         }     }      How can I extract the $css_code to echo it into the head section? Is there a way to do it using the wp_head function + action?


title: WordPress WXR import - importing a large file

text: I am in the process of working on a project involving the migration of old custom driven cms data into a WordPress powered site. To do this migration, we have decided to convert the data from the current site into a WXR import file. The issue we're facing though is that the resulting WXR file is about 100mb in size. (about 10000 posts, of varying types and about 80000 attachments) The import is obviously a very slow process given a file that size, so my question is: **Does anybody have any experience of importing a file that large?** **If so, what can be done to speed up the process? More memory, more cpu? etc?** My current idea is to spin up a large EC2 instance and try the import on there, and then export the resulting MySQL to the final hosting location.