Divide Loop Into Days & Categories

If you could help, I'd greatly appreciate it, because I'm halfway there, but I'm currently stuck! The site I'm working on needs to have it's posts, within the loop, divided up by days, and then under those days, be divided up by categories. Currently, I have the days working, but can't for the life of me get the categories divided under the days. Here's what I basically have at the moment as far as layout goes:
Wednesday, July 30, 2014
     <POST ONE>     <POST TWO>     <POST THREE>
Tuesday, July 29, 2014
     <POST ONE>     <POST TWO>      It's great that it's working and the days are divided, but like I said, I need those days to be divided into categories as well. For example, I need something like this:
Wednesday, July 30, 2014

Columns
     <POST ONE>
Links
     <POST TWO>     <POST THREE>
Tuesday, July 29, 2014

Columns
     <POST ONE>
Links
     <POST TWO>      Currently, this is what my loop looks like:
                 <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                     <?php if( $current_date != get_the_date('l, F j, Y') ){                         echo '
'.get_the_date('l, F j, Y').'
';                         $current_date = get_the_date('l, F j, Y');                     } ?>                     <?php get_template_part(THEME_LOOP."post"); ?>                 <?php $counter++; ?>                 <?php endwhile; else: ?>                     <?php get_template_part(THEME_LOOP."no","post"); ?>                 <?php endif; ?>                 <?php customized_nav_btns($paged, $wp_query->max_num_pages); ?>
      Once again, like I said, any help would be greatly appreciated! Thanks for taking a look! **UPDATE:** I've been messing around and I think I'm almost there. This should be working, but I can't get any posts to spit out. Would someone mind taking a look and let me know what's going wrong? Thanks! Here's my current loop now:
                 <?php                 $_start=(floor($wp_query->query_vars['paged'])-1)*5;                 if($_start<0){$_start=0;}                      for($_d=$_start;$_d<$_start+5;$_d++) {                     $_today=date("l, F j, Y", mktime(0, 0, 0, date("m")  , date("d")-$_d, date("Y")));                     echo "
$_today
\n";                 ?>

Columns

                            <?                               $_year=date("Y", mktime(0, 0, 0, date("m")  , date("d")-$_d, date("Y")));                               $_mon=date("m", mktime(0, 0, 0, date("m")  , date("d")-$_d, date("Y")));                               $_day=date("d", mktime(0, 0, 0, date("m")  , date("d")-$_d, date("Y")));                               $the_query = new WP_Query( 'year=' . $_year . '&monthnum=' . $_mon . '&day=' . $_day.'&category_name=Column-2' );                               while ( $the_query->have_posts() ) : $the_query->the_post();                                 global $wpdb;                                 $comments = $wpdb->get_results("SELECT DISTINCT(comment_content) FROM $wpdb->comments WHERE comment_post_ID ='".get_the_ID()."' AND comment_approved = '1'");                                 $_count = count($comments);                                 $_comment='';                                 if($_count==1)                                   {                                   $_comment=' (1 comment)';                                   }                                 elseif($_count>1)                                   {                                   $_comment=" ($_count comments)";                                   }                                 $excerpt=str_replace("\n",' ',get_the_excerpt());                                 echo "".get_the_title()."                                                                              <fb:comments-count href=".get_permalink()."></fb:comments-count> — ".get_the_author()."
\n";                  endwhile;                               wp_reset_postdata();                             ?>                             <?php                             if(function_exists('show_columns'))                                {                               show_columns(30,$_d);                               }                             ?>

News

                           <?php                                $_year=date("Y", mktime(0, 0, 0, date("m")  , date("d")-$_d, date("Y")));                               $_mon=date("m", mktime(0, 0, 0, date("m")  , date("d")-$_d, date("Y")));                               $_day=date("d", mktime(0, 0, 0, date("m")  , date("d")-$_d, date("Y")));                               $the_query = new WP_Query( 'year=' . $_year . '&monthnum=' . $_mon . '&day=' . $_day.'&cat=-3,-2204' );                               while ( $the_query->have_posts() ) : $the_query->the_post();                                 global $wpdb;                                 $comments = $wpdb->get_results("SELECT DISTINCT(comment_content) FROM $wpdb->comments WHERE comment_post_ID ='".get_the_ID()."' AND comment_approved = '1'");                                 $_count = count($comments);                                 $_comment='';                                 if($_count==1)                                   {                                   $_comment=' (1 comment)';                                   }                                 elseif($_count>1)                                   {                                   $_comment=" ($_count comments)";                                   }                                 $excerpt=str_replace("\n",' ',get_the_excerpt());                                 echo "".get_the_title()."                                                                              <fb:comments-count href=".get_permalink()."></fb:comments-count> — ".get_the_author()."
\n";                                                         endwhile;                               wp_reset_postdata();                            ?>
                             <?php                                 if(function_exists('show_daily_links'))                                  {                                 show_daily_links(30,$_d,1);                                 }                               ?>

                    <?         if($_d==$_start)     #     if(false)           {     ?>          <?           }     ?>               <?         }     ?>
     <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); }      else { ?>
<?php next_posts_link('Next Page »') ?>

<?php previous_posts_link('« Previous Page') ?>
     <?php } ?>


Wordpress landing page displaying vague HTML links

![Wordpress landing page](http://i.stack.imgur.com/inR8R.jpg) I uploaded all the wordpress files from my local computer to the server via ftp and changed the wp-config.php file. The wordpress landing page is shown in the image. It is diplaying 'Sports Loyalty' and some other links which are part of the files uploaded in some other folder on that server. Wordpress has not been installed prior to this. What is exactly happening? Are the plug-in files clashing or something? What is the possible solution to this?


Export Header and Footer

I want to export the header and footer from WordPress as HTML with same the design: CSS, images, JavaScript files. But not main content page. I want to do this, because I will use the same design in the future. Can any one give ideas for my requirements?


Second loop pagination changes URL, not content

I'm reasonably new to WordPress and I believe I am missing something conceptual here. I have assigned a static post to be my front page. My front-page.php template begins with a standard loop:               <?php if (have_posts()) : ?>                     <?php while ( have_posts() ) : the_post(); ?>
<?php the_title()?>
                 <?php the_content(__('Continue Reading'))?>         <?php endwhile; ?>         <?php wp_reset_postdata();?>         <?php else : ?>
Not Found

<?php _e("Empty Text Here."); ?>
     <?php endif; ?>       This successfully outputs the content of my post. Great. Now I am attempting to insert a second loop below this that will output a finite list of other posts followed by a pager. The pager shows up and when it is clicked the page reloads as expected, but the content remains unchanged. Here is my second loop?               <?php     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $args=array(         'paged'             =>  $paged,         'posts_per_page'    =>  2,          'post_type'         => 'type_here'     );     $wp_query = new WP_Query($args);?>     <?php if ( $wp_query->have_posts() ) :?>         <?php while ($wp_query->have_posts() ) : $wp_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
         <?php endwhile;?>         <?php wp_pagenavi(); ?>         <?php wp_reset_query(); ?>     <?php else: ?>         <?php echo 'Empty Text Here';?>     <?php endif;?>      My taxonomy pages all paginate perfectly so I'm thinking my mistake is programmatically subtle or conceptually flagrant. Is it not possible for a post template to feature a secondary loop with its own pagination? Given that pagers generate a loop agnostic URL I am guessing that WP assumes that only the original loop qualifies for paging? > http://mysite.com/page/2/ Thanks for your help!


Wp_query: sort by PHP variable

Here is my problem: For my articles, I use a custom post type "exhibitions" and posts for all other news. I am displaying them in one query ['post_type' = array('exhibitions','posts')]. The **orderby parameter** for posts should be their _publish date_ , for exhibitions it should be _custom meta value_ (end date of the project). That way, posts would be displayed in following order:   1. Exhibition 1 (publish date: 2.1. 2013, end date: 4.4. 2013)   2. Post 1 (publish date: 13.3. 2013)   3. Exhibition 2 (publish date: 1.4. 2012, end date: 1.3. 2013)   4. Post 2 (publish date: 28.2. 2013) ## Define PHP variable from date (posts) and end-date meta value (exhibitions) and then sort by it? I came up with an idea to define PHP variable (end-date meta value for exhibitions, publish date for posts) and sort the wp_query by that. Am I going in the right direction or not? If so, how to incorporate the variable to wp_query? I've found some related articles/questions, but none of them helped me so far. ## Orderby filter? Orderby filter sounds also as the way to go: Orderby filter @Wordpress.org forums Thanks! /// Johaness's solutions is pretty much what I was aiming for. Here is my slightly modified function:               function save_sort_meta( $post_id ) {     $prev_val = get_post_meta( $post_id, 'sort_date', true );     /* set value only if not set yet (i.e. if this is a new post and not an update ) */     if ( 'exhibitions' === $_POST['post_type'] ) {             $my_meta = get_post_meta( $post_id, '_my_meta', true );         $datum_end_hidden = $my_meta['datum-end-hidden'];         update_post_meta( $post_id, 'sort_date', $datum_end_hidden);     } else {         /* using time() assuming "end_date" is a unix timestamp, adjust if not */         update_post_meta( $post_id, 'sort_date', time());     }     }     add_action( 'save_post', 'save_sort_meta' );      And here's my query:               $args = array(     'showposts' => '22',     'post_type' => array('post','exhibitions'),     'post_status' => 'publish',     'meta_key' => 'sort_date',     'order' => 'DESC',     'orderby' => 'meta_value_num'     );      For some reason, "post" posts stay in the end of the wp_query (although when I echo custom value "sort_date", it shows correctly and is larger than exhibitions, that should stay "bellow"). Does it have some connection with my removal of checking the update of the post? I did it, because I want to change values on update as well. ## Edit: Code above works! Okay, I found out where was the problem - it's quite embarassing. :) The "end date" meta value of "exhibition" post types was provided by jQuery UI Datepicker - which saves the date in miliseconds. All I needed to do was to divide $datum_end_hidden by 1000. :) Thank you VERY MUCH!


Set up the link in a reply to the parent comment?

I'm styling chronological order comments. I found this snip on this WordPress Answers site from here               comment_reply_link(        array_merge(          $args,            array(              'reply_text' => __( 'Reply ↓',              'themetextdomainname' ),              'depth' => 1,              'max_depth' => 2      )));      So my reply button appears just like I want on non-nested comments. I just need the last piece to include the link back to the parent comment. So where do these following lines go; I'm assuming in the callback function, but exactly where?               $pcom = get_comment($comment->comment_parent);     echo 'comment_parent).'">This is a reply to '.$pcom->comment_author.'';


Issue with Custom Roles in Multisite

So I've been going through hell with Custom Roles. I will try to be as descriptive as possible, to highlight my issue. Before anyone mentions it - I would like to avoid using a plugin, since that, to me, is overkill of what I view to be a simple problem. What I want: 3 Roles - Admin, Lesser Admin, User What I originally attempted: I removed the two roles Author & Contributor, to leave Administrator, Editor, and Subscriber. That worked no problem. I am having a problem with the next piece - to rename the remaining roles. I originally just did the most common suggestion               global $wp_roles;     $wp_roles->roles['editor']['name'] = 'Lesser Admin';     $wp_roles->role_names['editor'] = 'Lesser Admin';      for the last two roles (I kept Admin the same because it was close enough). But this didn't work. No matter what hooks I attached to it (I put it under `add_action('init',...)` but that did not work. So I tried to be fancy and wrote my own code to handle this.               function permissionsModification(){         $blogs = wp_get_sites();         $current_blog = get_current_blog_id();              foreach($blogs as $blog):                  switch_to_blog($blog['blog_id']);                  if(get_role('author') !== null)                 remove_role('author');                  if(get_role('contributor') !== null)                 remove_role('contributor');                  $toChange = array(                 'editor' => array('lesser', 'Lesser Admin'),                  'subscriber' => array('user', 'User')             );             foreach($toChange as $old => $new):                      $role = get_role($old);                 if($role !== null):                          if(get_role($new[0]) === null)                         add_role($new[0], $new[1], $role->capabilities);                          $users = get_users(array('role'=>$old));                     foreach($users as $user):                         $user->remove_role($old);                         $user->add_role($new[0]);                     endforeach;                          $opt = get_option('default_role');                     if($opt === $old)                         set_option('default_role', 'administrator');                          remove_role($old);                 endif;                  endforeach;              endforeach;              switch_to_blog($current_blog);     }     add_action('init','permissionsModification');      The Good News: It did succeed in renaming the roles, and the old roles were gone. Bad News: An extremely strange bug is occurring. I am getting "Undefined Index: Name" errors everywhere in Capabilities.php. I searched the database (have phpMyAdmin access), and found that in one of the sites - the subscriber role was still there! I thought it might have something to do with default roles, so since registrations are prohibited I set it to administrator to test, but still no dice (although it did set that to the default role). Viewing the network admin user panel shows an "empty" space for where a role should be, and if you inspect the element it has the value subscriber. So I am pretty certain that the subscriber role's name got deleted and that's where the errors are coming from. Now, the interesting part - I walked through this code line by line with `print_r` riddled everywhere - and the subscriber role is indeed getting deleted. But I have no idea how it's getting added back in. I wonder if this has to do with the fact that this is a multisite wordpress, since the subscriber role only is present in one table. But I am still a bit lost on how to fix it. Any advice would be much appreciated.


Child theme not working properly

There's a theme that I want to customise and when I use a child theme in it's most basic form, the main navigation bar disappears, the fonts seem different and there's a few other oddities. The problem theme is PR Pin (http://wordpress.org/themes/pr-pin). My child theme literally only has the style.css file containing my child them name, the template and the import of the parent theme's css.               /*      Theme Name:   Custom Theme for sallymustang.com (pr-pin)      Template:     pr-pin     */          @import url("../pr-pin/style.css");      I don't know why activating the child breaks the parent when there's nothing changed. Any help?


Deep Nested Custom Rewrite and Custom Taxonomy

I'm trying to get my custom taxonomy to nest deep categories, and then also pull up the post. Each post always needs to be three categories deep:               example.com/thinger/cat_1/cat_2/cat_3/post_name_here      I've set up my custom taxonomy and post type like so:                   function thinger_register() {              $labels = array(             'name' => __('Thingers', 'post type general name'),             'singular_name' => __('Thinger', 'post type singular name'),             'add_new' => __('Add New', 'Thinger'),             'add_new_item' => __('Add New Thinger'),             'edit_item' => __('Edit Thinger'),             'new_item' => __('New Thinger'),             'view_item' => __('View This Thinger'),             'search_items' => __('Search Thingers'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );              $args = array(             'labels' =>$labels,             'public' => true,             'publicly_queryable' =>true,             'show_ui' =>true,             'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' >= false,             'menu_position' => null,             'supports' => array('title','editor','thumbnail','revisions')           );               register_post_type( 'thinger' , $args );     }              add_action('init', 'thinger_register');              function create_thinger_taxonomies() {              $labels = array(             'name'              => _x( 'Categories', 'taxonomy general name' ),             'singular_name'     => _x( 'Category', 'taxonomy singular name' ),             'search_items'      => __( 'Search Categories' ),             'all_items'         => __( 'All Categories' ),             'parent_item'       => __( 'Thinger Category' ),             'parent_item_colon' => __( 'Thinger Category:' ),             'edit_item'         => __( 'Edit Category' ),             'update_item'       => __( 'Update Category' ),             'add_new_item'      => __( 'Add New Category' ),             'new_item_name'     => __( 'New Category Name' ),             'menu_name'         => __( 'Categories' ),         );              $rewrite = array(             'slug'              => 'thinger',             'with_front'        => false,             'hierarchical'      => true         );              $args = array(             'hierarchical'      => true,             'labels'            => $labels,             'show_ui'           => true,             'show_admin_column' => true,             'query_var'         => true,             'rewrite'       => $rewrite,         );              register_taxonomy( 'thinger_category', array( 'thinger' ), $args );          }         add_action('init', 'create_thinger_taxonomies', 0 );      On the back end it works perfectly. I can make posts and categories without fail. When it comes to the URL's, they only work as `example.com/thinger/post_name_here`. So I added the follower customer rewrites to try and fix that:                   add_rewrite_rule( '^thinger/(.+?)/(.+?)/$', 'thinger.php?posttype=$matches[2]', 'top' );         add_rewrite_rule( '^thinger/(.+?)/(.+?)/(.+?)$', 'thinger.php?taxonomy=$matches[3]', 'top' );         add_rewrite_rule( '^thinger/(.+?)/(.+?)/?$', 'thinger.php?taxonomy=$matches[2]', 'top' );            add_rewrite_rule( '^thinger/(.+?)/(.+?)/(.+?)/(.+?)$', 'thinger.php?taxonomy=$matches[3]&post_name=$matches[4]', 'top' );      Which seems to work when I query just the categories. I can use the taxonomy.php file to do what I have to depending on what I'm looking at just fine. Seems to be that thinger.php never gets called for anything. When I add the post_name on the end, I get an error 404 page. Am I using the rewrites incorrectly here? Basically what I'm trying to do is use the taxonomy.php page to display the "thingers" that fall into that category or sub-category, and when there is a post_name on the end have it show that one "thinger". P.S.: I'm using the Monkeyman Rewrite Analyzer, but I don't exactly understand what it's telling me, and I don't want to use a plugin to do this for me. I would like to learn how this works in and out.


WPTouch Mobile does not display posts

I use the WP Touch Mobile plugin for the mobile version of my website. However, no posts are displayed on the static pages. Does anyone know to fix this bug ? Thanks for your help


How to assign custom field an unique number?

I have created a CPT for a client who will use this to manage payments. Their database currently has assigned ID for each of their clients. I have imported the data in a custom field for them. The question is when they add a new client I want to make sure the during the save/update process it checkes to see if the custom field is a duplicate and to display an error message. I believe part of my solution is here: http://codex.wordpress.org/Plugin_API/Action_Reference/save_post But I am stuck as to exactly how that works for my case.... cpt = kerk custom field = wpcf-id


Can display previous post with or without wp_pagenavi

I use Wordpress with the free version of Pageline platform theme. I figured out that the "previous/next entries" links are displayed on the main page but not on my others static pages. I tried to use the wp_pagenavi plugin. Then, I can see the links at the bottom of the page of which the post number is higher than the one displayed. However, when I click on the link, the same posts are displayed while the number page in the URL title changes. Anyone can help me to fix that ? Thanks for your help


How to add username in toolbar link?

I installed a plugin and want to add the link of the plugin in the toolbar. But I have an issue with the url. The url shows fullname, but I need to show username. I tried replacing `fullname` in the code with `id` and `domain`. But it did not work.               <?php              function wsi_menu2(){         global $bp, $wp_admin_bar;              // Only show if viewing a user                  // Provides: <body text='black'>     $bodytag = str_replace("Admin", "", $bp->loggedin_user->fullname);              $wp_admin_bar->add_menu( array(             'parent' => 'my-account',             'id'     => 'FacebookInviteFriends',             'title'  => 'Album',             'href'   => 'http://mysite.com/members/'.$bodytag.'/album/',              'onclick' => 'FacebookInviteFriends();'         ) );       }            function wsi_menu3(){         global $bp, $wp_admin_bar;              // Only show if viewing a user                  // Provides: <body text='black'>     $bodytag = str_replace("Admin", "", $bp->loggedin_user->fullname);         $wp_admin_bar->add_menu( array(             'parent' => 'my-account-friends',             'id'     => 'my-account-friends-social-invites',             'title'  => __( 'Send Social Invites', 'buddypress' ),             'href'   => 'http://mysite.com/members/$bp->loggedin_user->fullname/album/',              'onclick' => 'FacebookInviteFriends();'         ) );         $wp_admin_bar->add_menu( array(             'parent' => 'my-account',             'id'     => 'FacebookInviteFriends',             'title'  => 'Album',             'href'   => 'http://mysite.com/members/'.$bodytag.'/album/',              'onclick' => 'FacebookInviteFriends();'         ) );       }      Any idea how to make this work for username?


Disabling WP MultiSite breaks registration

I am trying to remove / disable MultiSite following the instructions here - http://wpmututorials.com/how-to/how-to-disable-multisite/ I am able to successfully disable MultiSite however it breaks the registration system. After disabling the MultiSite when I click ‘Complete Sign Up’ the registration page refreshes and comes back blank, just with the heading ‘Create an Account’ no registration form is on the page. If I refresh this page it loads up again as a normal registration page. No activation emails are being sent. I have tried all basic troubleshooting steps and have narrowed down to the point that I can say editing following code breaks the registration. `define('WP_ALLOW_MULTISITE', true);` Whether I change 'true', to 'false' or remove the code or comment out the code, registration system breaks. If I restore the code and re upload wp- config.php, registration starts working. I will be grateful for any guidance provided. Thank you very much


shortcodes - style them or change/remove the square brackets?

I sometimes use for the clients, plugins that are based on wordpress shortcodes,they do offer a lot of options for the clients to play with like adding tabs galleries and so on. But I see that the appearance of the shortcode itself is still a bit confusing to them. so is there a way to customize them like instead of `[gallery]content here...[gallery/]` it will be something like : `open gallery... end of gallery` and with out the square brackets?


Retrieve Plugin Settings and insert into XML string

Apologies for any confusion as I'm completely out of my depth here: I've been trying to write a plugin which will send form data as XML to a CRM using SOAP. The basic plugin works fine, but I would like to make it more modular, allowing different users to add their own credentials to the sent data. I've followed all the instructions to create an Admin settings page, the data is written into the WP database, now I would like to pass those variables into my message. I've tried using:                   $options = get_option($this->option_name);      at the top of the page, then inside the message, inserting this:                   $xmlInputData='<?xml version="1.0" encoding="utf-8" ?><data><settings><origin="'.echo $my_options['origin'];.'" username="'.echo $my_options['user'];.'" password="'.echo $my_options['password'];.'" /></settings><enquiries><lead productName="Appointment Booking"><customer><name>'.$_REQUEST['first-name'].' '.$_REQUEST['last-name'].'</name><email>'.$_REQUEST['email'].'</email><postcode>'.$_REQUEST['postal'].'</postcode><houseNumber></houseNumber><address></address><city></city><region></region><tel>'.$_REQUEST['phone-number'].'</tel><mobile></mobile><notes></notes></customer></lead></enquiries></data>';      but the code is flagged as having syntax errors. I'm trying to escape the XML to insert the PHP but I don't have enough experience of this. Can anyone help me to understand where I'm going wrong? I've been tinkering with this for a while now but desperately need this to work soon. Thanks in advance.


Using a dropdown to alter an option value on plugin settings page

I'm trying to implement a dropdown menu on my plugin's settings page. When the user selects a choice from the dropdown and presses the Save Changes button, I need the choice's value to be appended to the value of an option stored in the WP database. Any ideas how to do this? The option is plugin_options['embedded_url']. Let's say the user chooses Calculator2...then plugin_options['embedded_url'] = 'http://www.google.com?id=signing".               <?php     // Creates an option group, a main settings section on the settings page, and an input field for the URL.     add_action('admin_init', 'plugin_admin_init');     function plugin_admin_init() {         register_setting('plugin_options', 'plugin_options', 'plugin_options_validate');         add_settings_section('plugin_main', 'Main Settings', 'plugin_section_text', 'plugin');         add_settings_field('plugin_url', 'URL to embed: ', 'plugin_setting_url', 'plugin', 'plugin_main');         add_settings_field('plugin_query', 'Query to add: ', 'plugin_add_query', 'plugin', 'plugin_main');     }          // Adds a description of the main settings section.     function plugin_section_text() {     echo '
Change the embedded URL. Must begin with http:// or https://
';     }          // Adds the custom URL input field and saves the URL as the value for key     'embedded_url'.     function plugin_setting_url() {         $options = get_option('plugin_options', array('embedded_url' => 'http://www.google.com')); // Default value for 'embedded_url'         echo "<input id='plugin_url' name='plugin_options[embedded_url]' size='40' type='url' value='{$options['embedded_url']}' />";     }     // Adds dropdown menu     function plugin_add_query() {         $options = get_option('plugin_options');         echo '
<select><option value="">CalculatorDefault</option><option value="?id=signing">Calculator2<option value="?id=SFDCalculatorFlow">Calculator3</option></select>
';     }


How to Display an Image Uploaded through a Meta Box in a Template?

I am just learning to create a meta box to upload a file in `wp- content/uploads` folder through this code:               //display image meta box     function display_image_box() {         global $post;         wp_nonce_field( plugin_basename( __FILE__ ), 'wp_custom_noncename' );         echo '<input id="post_media" type="file" name="post_media" value="" size="25" />';     }          //upload image      function update_custom_meta_data( $id, $data_key, $is_file = false ) {         if( $is_file && ! empty( $_FILES ) ) {             $upload = wp_handle_upload( $_FILES[$data_key], array( 'test_form' => false ) );             if( isset( $upload['error'] ) && '0' != $upload['error'] ) {                 wp_die( 'There was an error uploading your file. ' );             } else {                 update_post_meta( $id, $data_key, $upload );             }          }       }     //save image     function save_custom_meta_data( $id ) {         if( ! wp_verify_nonce( $_POST['wp_custom_noncename'], plugin_basename( __FILE__ ) ) ) {             return;         }          if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {             return;         }          update_custom_meta_data( $id, 'post_media', true );     }      add_action( 'save_post', 'save_custom_meta_data' );          //register script     function register_admin_scripts() {         wp_register_script( 'custom_admin_script', get_template_directory_uri() . '/js/admin.js' );         wp_enqueue_script( 'custom_admin_script' );     }     add_action( 'admin_enqueue_scripts', 'register_admin_scripts' );      This is working and the file uploads nicely but I can't display it because I'm getting an array like this:               [post_media] => Array     (         [0] => a:3:{s:4:"file";s:81:"E:wampwwwtestchild/wp-content/themes/twentyeleven/uploads/2012/12/coffee_star.jpg";s:3:"url";s:60:"wp-content/themes/twentyeleven/image/2012/12/coffee_star.jpg";s:4:"type";s:10:"image/jpeg";}     )      How can I display the image in my template?   In addition, how to save the URL ( `wp- content/themes/twentyeleven/image/2012/12/coffee_star.jpg` ) only as meta data?


Display all posts of current viewing tag

I'm having problems getting all related posts of the current viewing tag. Does anyone know how you can do this dynamic? I want to create a own kind of 'archive' page for this.


How to exclude certain files from the plugin editor?

Is there a way to tell WordPress not to list certain files of my plugin in the Plugins -> Editor screen?


Permalinks, Rewrites, Get Variables, Oh My!

Ok, so I know it's a silly title, but it's exactly how I feel right now.. I've created some custom rewrites for WordPress and they work great, the only problem is that now I need to add pagination. My rules are messing with the pagination and vice versa. The page url will update when I click on a pagination link, but the query stays the same.. Here's what I have in my functions.php               // ADD REWRITE FOR VIDEOS -> GROUP     add_rewrite_tag('%group%','([^&]+)');          // ADD REWRITE FOR VIDEOS -> VALUE     add_rewrite_tag('%value%','([^&]+)');          // ADD REWRITE FOR VIDEOS TO ACCEPT GROUP & VALUE     add_rewrite_rule('^car-videos/group/([^/]*)/value/([^/]*)/?','index.php?page_id=40&group=$matches[1]&value=$matches[2]','top');      Here's my pagination code               <div class="pagination">                                 <?php $total_pages = $loop->max_num_pages;                                                if ($total_pages > 1){                                           $current_page = max(1, get_query_var('paged'));                                                echo paginate_links(array(                                                   'base' => get_pagenum_link(1) . '%_%',                                                   'format' => 'page/%#%',                                                   'current' => $current_page,                                                   'total' => $total_pages,                                                  'prev_text'    => __('Previous'),                                                 'next_text'    => __('Next')                                             ));                                           }                                    ?>                             </div>      Here's how I'm getting the group and value variables               $urlGroup = $wp_query->query_vars['group'];     $urlValue = $wp_query->query_vars['value'];      I use this in my WP_Query               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;      How would I rewrite the rule to allow for pagination? Is there something I'm doing wrong?


custom taxonomies on pages

i need some help how can i display custom taxonomies on selected pages? i mean i have 3 custom taxonomies location,duration & courses i have created three pages where i want to display the terms of these custom taxonomies, i have displayed it on my posts by using function               <?php echo do_shortcode("[terms]"); ?>      but same thing i want to make display on my pages also, how can i do that??????


What are best practices for configuring a server for Wordpress sites?

I hired a sysadmin to set up a VPS server for me and, unfortunately, it looks like things were not set up correctly. When trying to install and update plugins, I run into permissions errors all the time. WP Super Cache is the main issue as it causing my readers to run into 502 errors. Currently, my site does not load pagination (no Page 2, Page 3, etc..). **12/1 Update:** The apache server has restarted itself multiple times today and in the past 3 hours since my request to the host provider, all I've got so far is that they are monitoring it. And it has restarted since they began monitoring too... The sysadmin that set up the server mentioned that in order for it to work properly under DSO mode, wp-admin, wp-content and wp-plugins folders would need to be changed to 777 permissions. The only problem is that I still couldn't get a 3.0.2 upgrade to work under those settings today (504 timeout nginx error this time) so I'm still concerned about running it that way for many reasons. I've been told that if I run under PHP mode though (think that's right?), that I will hog up more RAM with queries, etc and I'm already at 60% usage in DSO mode. This doesn't make any sense to me because my blog ran a little slow but still ok without any downtime on shared hosting. I'm now on a very reputable VPS w/ 512MB ram and my site only gets 10-12k pageviews a day. The host said that they have tweaked the config to optimize ram so I don't think anything is set incorrectly. Still trying to figure out what is going on here. Developing.....


Roles & capabilities GUI that does not create separate table

After reviewing plugins that deal with user roles and capabilities I concluded that I might be better off just hardcoding my settings into my functions.php file. This actually worked out well for me in end effect but I kept running into an issues while I was finalizing the code. As I am sure many of you know (and I ended up finding out the hard way) any new capabilities added through code to an existing role which has been assigned to a user won't work. Rather it seems the role and associating capabilities are written into the database the first time the new role is assigned to a user. If I am incorrect with this assumption please let me know. In any case... I have been getting frustrated with dealing with things manually and although I don't like the idea of plugins, this specific situations has be believing a GUI might actually work very well. What I am looking for is a plugin or some non bloated code which essentially is just capable of reading the roles and their associating capabilities from the default wordpress database and outputs these values into a checkbox list. So, basically the ability to just select a role which in turn displays every default capability from wordpress as well as any custom capability which is assigned to any user... Then just a checkbox next to every capability assigned to that role. The admin could update the values by checking/unchecking applicable capabilities and one should have the ability to just enter a new capability by pasting the capabilities name into a text field. My logic here is that if this existed then your NOT adding ANY additional custom code to the database or anything that requires more resources. The key benefit here is that you finally have a simple way to deal with updating roles. What I am not sure about is if this same logic would apply to being able to manually change the capabilities for individual users... If anyone also knows the answer to this question pleaseclet me know.


Custom taxonomy listing page when no term set (all terms)

I've created a custom taxonomy "foo" with rewrite slug "foo" and query_var "foo". Say for example, I also have terms "bar" and "baz" in the "foo" taxonomy. At the moment, permalinks like `/foo/bar` and `/foo/baz` work fine, using my `taxonomy-foo.php` template. What I'd like to do is be able to hit `/foo` and retrieve all posts with a link to any "foo" taxonomy. Currently, this URL shows a 404. How can I achieve this? If I can somehow hook into the rewrite code and set a default term value (`'all'` for example) if missing, that might be a way to move forward but I'm not sure if this is possible. I'd preferably like to use the `taxonomy-foo.php` template file for the "catch all", dealing with the logic of showing posts from one or all terms in there. Cheers **Edit** : I've figured how to catch a request for `/foo` and set some defaults using `add_filter('request', ...)` though I had to use an existing term as using anything else generates a 404. Is there any way to avoid this limitation?


get_posts() and 'posts_per_page' arg

$args = array(     'posts_per_page'=>  -1,     'post_type'     =>  'listing',     'meta_query'    =>  array(             array(                     'key'       =>  'ListingRid',                     'value'     =>  $listing_ids,                     'compare'   =>  'IN'             )     )     );     $query = get_posts( $args );      I'm pulling home listings from a remote server and inserting them as custom posts into Wordpress. Only active listings are made available, to update the posts and clear the expired ones I grab an array of all active `'ListingRid'` from the server and put them in an array (have also tried a comma separated string) in `$listing_ids` and compare that array with what I currently have in my Wordpress db, then do a `posts__not_in` check and delete those posts that it returns. This snippet works fine on localhost running wamp server. When I run it on my vps (ubuntu) as soon as my script hits this block nothing after it is executed. If I remove the `'posts_per_page' => -1`, line it works, but as expected only returns 5 posts when I need it to return ~1,600.


Lost in creating multiple meta boxes

I've been working for days to get this working without luck. Hope someone can help me. I created multiple metaboxes but my backend shows the boxes empty, I am lost and don't know where to go with this. Note that I am not closed to use multiple metaboxes as long as I can divide in blocks the info but I'm a noob... so any help is accepted. Please be patient because I need a detailed explanation. My code is:               $prefix = 'ikos_';     $metaboxWrapper = array();          $metaboxWrapper[] =     $meta_box = array(     'id' => 'features',     'title' => 'Property Features',     'page' => 'post',     'context' => 'normal',     'priority' => 'high',     'fields' => array(         array(             'name' => 'Price (in USD)',             'desc' => '',             'id' => $prefix . 'text',             'type' => 'text',             'std' => ' '         ),                array(             'name' => 'Price (in Mexican Peso)',             'desc' => '',             'id' => $prefix . 'text',             'type' => 'text',             'std' => ' '         ),              array(             'name' => 'Address',             'desc' => '',             'id' => $prefix . 'textarea',             'type' => 'textarea',             'std' => ''         ),              array(             'name' => 'Property for',             'id' => $prefix . 'select',             'type' => 'select',             'options' => array('Sale', 'Rent', 'Vacational Rental')         ),              array(             'name' => 'Area (m2)',             'desc' => '',             'id' => $prefix . 'text',             'type' => 'text',             'std' => ' '         ),              array(             'name' => 'Area of terrain (m2)',             'desc' => '',             'id' => $prefix . 'text',             'type' => 'text',             'std' => ' '         ),             array(             'name' => 'Number of rooms',             'desc' => '',             'id' => $prefix . 'text',             'type' => 'text',             'std' => ' '         ),              array(             'name' => 'Number of bathrooms. Include half bathrooms (ex. 2 1/2)',             'desc' => '',             'id' => $prefix . 'text',             'type' => 'text',             'std' => ' '         ),              array(             'name' => 'Service Bathroom',             'id' => $prefix . 'checkbox',             'type' => 'checkbox'         ),              array(             'name' => 'Furnished',             'id' => $prefix . 'checkbox',             'type' => 'checkbox'         )     ));      Then I have more metaboxes with checkbox groups like this:               $metaboxWrapper[] =     $meta_box = array(       'id' => 'installed',     'title' => 'Installed',     'page' => 'post',     'context' => 'normal',     'priority' => 'high',     'label' => 'Installed',       'desc'  => '',       'type'  => 'checkbox_group',              'fields' => array(       'options' => array(           'one' => array(               'label' => 'Air conditioner',               'value' => 'one'           ),           'two' => array(               'label' => 'Stationary gas',               'value' => 'two'           ),           'three' => array(               'label' => 'Water heater',               'value' => 'three'           ),               'four' => array(               'label' => 'Hurricain shutters or hurricain protection',               'value' => 'four'           ),              'five' => array(               'label' => 'Telephone line',               'value' => 'five'           )     )       ));      And to show them I have this but doesn't work. I can't even go to the part of saving and showing data in front end...so I don't know if it works. Still I pase it here so you can point me if I am doing it wrong.               add_action('admin_menu', 'mytheme_add_box');          // Add meta box     function mytheme_add_box() {     global $metaboxWrapper;          foreach($metaboxWrapper as $meta_box)     {     add_meta_box($meta_box['id'], $meta_box['title'], 'mytheme_show_box', $meta_box['page'],  $meta_box['context'], $meta_box['priority']);     }     }               // Callback function to show fields in meta box     function mytheme_show_box() {     global $meta_box , $post;     // Use nonce for verification     echo '<input type="hidden" name="mytheme_meta_box_nonce" value="',    wp_create_nonce(basename(__FILE__)), '" />';     echo '
';     foreach ($meta_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;             case 'textarea':                 echo '<textarea name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="4" style="width:97%">', $meta ? $meta : $field['std'], '</textarea>', '
', $field['desc'];                 break;             case 'select':                 echo '<select name="', $field['id'], '" id="', $field['id'], '">';                 foreach ($field['options'] as $option) {                     echo '<option ', $meta == $option ? ' selected="selected"' : '', '>', $option, '</option>';                 }                 echo '</select>';                 break;             case 'radio':                 foreach ($field['options'] as $option) {                     echo '<input type="radio" name="', $field['id'], '" value="', $option['value'], '"', $meta == $option['value'] ? ' checked="checked"' : '', ' />', $option['name'];                 }                 break;             case 'checkbox':                 echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';                 break;               // checkbox_group       case 'checkbox_group':       foreach ($field['options'] as $option) {           echo '<input type="checkbox" value="'.$option['value'].'" name="'.$field['id'].'[]" id="'.$option['value'].'"',$meta && in_array($option['value'], $meta) ? ' checked="checked"' : '',' />                   '.$option['label'].'
';       }       echo ''.$field['desc'].'';       break;                  }         echo     '	',             '
';     }     echo '
';     }          do_action('save_post', 'mytheme_save_data');     // Save data from meta box     function mytheme_save_data($post_id) {     global $metaboxWrapper;     // verify nonce     if (!wp_verify_nonce($_POST['mytheme_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 ($meta_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);         }     }     }          // check autosave     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {     return $post_id;     }


Insert After Second Paragraph Without <P> Tag?

I use a code like the one shown below to insert ads after the first paragraph. The problem is that this code requires the content to be displayed within paragraph tags and I would like to use this code to insert a DIV.   When I simply replace the tags with div tags the code no longer works. How do I remove the paragraph tags from the code while allowing the code to remain functional?               <?php     $paragraphAfter= 1; //display after the first paragraph     $content = apply_filters('the_content', get_the_content());     $content = explode("<p>", $content);     for ($i = 0; $i <count($content); $i++ ) {     if ($i == $paragraphAfter) { ?>          CONTENT GOES HERE          <?php }     echo $content[$i] . "</p>";     } ?>


How do you make RSS feeds work under IIS 7?

Running IIS 7 and WP 3.0. I've got a web.config that has the necessary rewrite rules to make permalinks work, and they're working. However, if I point to n-nexus.realtimepublishers.com/content/?feed=rss2, the server first generates an HTTP 404. Weirdly, it then delivers the RSS feed. The problem is that the initial 404 makes things like FeedBurner and Safari barf; Firefox displays the feed properly (you can see the 404 error in Live HTTP Headers, though). What the heck am I not configuring properly? UPDATE: Disabled all plugins. No change. Boo.


How do I let users upload files to a chosen location?

I found some plugins which let me make my own forms but none worked for different reasons. I simply want to make a form so that users can upload files to a folder located in www.chusmix.com/images I'm trying this code, but it sends me to a "page not found":               <form enctype="multipart/form-data" method="post" action="http://chusmix.com/Imagenes/grupos">          Please specify a file:<br>     <input type="file" name="datafile" size="40">     </p>     <div>     <input type="submit" value="Send">     </div>     </form>      Thanks


How do I make search only search in post content?

I want to have two search bars, one which works normally and one that searchs only in the post content but I can't even find the code of the search funtion to create the second. Can I use a plugin to make my search function only search in post content? Thanks in advance


Hide all posts by an author

We have a category called "Tech", and want to hide posts from a specific author on this page. For example, John Smith's posts do not show in Tech category, or any category for that matter, even search. How could I do this? I don't want to hide the author name, I want to completely hide all posts by author X from the search, category, taxonomy pages etc. Thank you


WP NAV MENU - Dropdown always showing

I'm having some trouble getting the wp_nav_menu to work properly. This is the first time I have worked with this and for the most part it has all come together. My only issue that I am having is with the functionality of the dropdown menus. All of the pages are appearing correctly in the appropriate spot (the primary navigation), but the "fly outs" or drop down submenus are always appearing. I have of course registered the menu and have placed the wp_nav_menu portion in the navigation. My guess is I have no added support for the dropdown menus to BE drop down menus? I might also mention that this is a custom theme. I've built it from the bottom up. It's also in a development environment which will be hard to show you guys a live example. For this reason I have attached a screenshot.               wp_nav_menu( array(          'menu' => 'Primary Navigation',          'container_class' => 'primaryNav',          'depth'           => 2,          'fallback_cb' => 'none',          'theme_location' => 'Primary Navigation',     ));          register_nav_menu( 'Primary Navigation', 'Primary Navigation' );          add_theme_support( 'menus' );      I've come across two possibilities. I've seen mention of "walker," to which I have little to no understanding of. OR maybe it's as simple as adding some jquery to make them work? I am just under the impression that the functionality should already be there? Thanks in advance for any help. Will


Can I disable the autocomplete?

I've recently upgraded to WordPress 3.0, and am having a lot of problems with the autocomplete function when editing posts via 'quick edit' (e.g. /wp- admin/edit.php) - for example, editing tags. The autocomplete box often obscures the textbox I'm trying to enter text into, and sometimes gets 'left behind' once the 'update' button has been clicked. Is there a way to disable the autocomplete? **UPDATE** To clarify, this is a _Wordpress_ autocomplete feature, not a _browser-based_ one. **UPDATE 2** It looks as if I need to remove the 'suggest' argument to "load-scripts.php", referenced at the bottom of each admin page like so:               <script type='text/javascript'       src='http://www.example.com/path/to/wordpress/wp-admin/load-scripts.php?c=1&load=hoverIntent,common,jquery-color,suggest,inline-edit-post'>     </script>      That seems to be generated by:               do_action('admin_print_footer_scripts');      but I lose the code trail at that point - anyone?


How can I version the main CSS file?

How can I instruct wordpress to use a filename other than 'styles.css' for my main stylesheet - for example, styles-1.css? I'd like to do this for versioning and caching purposes.


Need to return a string as permalink insted of str_replace

I'm using this code to get a alphabetic list of CPT's at my site. It's great and works perfect. One problem, the snippet returns urls as a string, tha just converts the_title to a slug, and that does NOT work when the title contains special characters. I simple need a solution of how to return the_permalink instead of this title- to-slug hack :)               <?php $list = '';      $tags = get_terms( 'inspirations-emne' );      $groups = array();     if( $tags && is_array( $tags ) ) {     foreach( $tags as $tag ) {     $first_letter = mb_strtoupper( mb_substr($tag->name,0,1) );     $groups[ $first_letter ][] = $tag;}     if( !empty( $groups ) ) {     foreach( $groups as $letter => $tags ) {     $list .= "\n\t" . '

' . apply_filters( 'the_title', $letter ) .'

';     $list .= "\n\t" . '
';     foreach( $tags as $tag ) {     $lower = mb_strtolower($tag->name);     $name = str_replace(' ', ' ', $tag->name);     $naam = str_replace(' ', '-', $lower);     $list .= "\n\t\t" . '
'.$name.'
';     }}}}else $list .= "\n\t" . '
Beklager, men ingen emner blev fundet
';print $list;     echo "
";     ?>      Any help to modify this snippet is much appreciated! Thanks.


How to use google custom seach for a particular post category and it's terms

I'm using Google custom search for my site. I need that Google only show search result for posts under a particular WordPress category. Though I need Google should index all. Is it possible to do with Google search, without compromising the site indexing ?


Echo custom taxonomy slug

I feel like I'm _this close_ but can't figure out if it's a synax or variable thing. I'm tring to echo the slug to auto-populate the corresponding image.               <?php              $terms = get_the_terms( $post->id, 'series', array( 'parent' => 0 ) );          $terms_slugs = array();         foreach( $terms as $term ) {             $terms_slugs[] = $term->slug;          }              if( !empty($terms_slugs) ) :           echo "/assets/products/" . $terms_slugs. "/logos/" .$terms_slugs . "-logo.png" ;         endif;     ?>


How do I change TinyMCE button "i" to create a i tag rather than em?

I want to give the "italic" button back the "styling" behaviour, rather than the spammy `<em>`. I want that button to print a `<i>` tag, rather than `<em>`. `<em>` tags became popular to spam search engines, but now I want it to be what it is: a styling feature to e.g. change the voice of the narration. I've got a script to create my own styles, so I'll include the `<em`> tag there, to use it as what it **REALLY** is: **EMPHASIS**. I'll then style it accordingly (big, bold). So now my problem is, I'm sure I can find the setting / string / parameter to hack in JavaScript, but... Do you know a way to hook it from / for WordPress?


Wordpress page edit does not save selected template

The feature did work in the past however pages now seem to default to 'Default Template'. I can see my available page templates in the drop-down on the Page edit page, however after saving the admin simply shows 'Default Template' again. I have tried disabling all plugins as well as remaking some of the templates, however the behaviour continues. Any ideas? Note: I'm using latest self-hosted WordPress. Update: After some digging it would appear that I am getting 'Table xxx/wp_postmeta' is marked as crashed and should be repaired". However running repair through phpmyadmin does not fix the issue. Update: Rebuilt the table entirely, still have issue. (Originally posted this question here: http://webapps.stackexchange.com/questions/33627/wordpress-page-edit-does-not- save-selected-template)


How to edit bbPress template files - WordPress + BuddyPress + bbPress?

I am using BuddyPress 1.6.1, bbPress 2.1.2 and WordPress 3.4.2 I follow the guide here. In the end, I did the trick pointed out by Sarah Gooding because mywebsite.com/forums was blank right after the above installation   * Created a page called "Forums" with permalink mywebsite.com/forums   * Insert bbPress shortcode [bbp-forum-index] into "Forums" page My questions are 1) How do I customise page templates for the forum e.g. Forum page, topic page etc. My current theme is a child theme of twentyeleven and it has the following structure > themes/bp-twentyeleven/ >   >   >     /activity/ >   >     /blogs/ >   >     /forums/ >   >         index.php >   >         forums-loop.php >   >     /groups/ >   >     /members/ >   >     /registration/ >   >     header.php >   >     sidebar.php >   >     style.css >   _Notes_   * Apparently, bp-twentyevelen/forums/index.php is being ignored.   * The reason for this set up is that I need the site to looks like TwentyEleven and has BuddyPress' functionality at the same time 2) How do I make sure that bbPress functions will work for my site e.g. do I copy and past all the functions in functions.php of bbPress' default theme over my theme's functions.php? 3) How do I ensure that whatever I will get from 1) and 2) (probably from bbPress experts somewhere) will not conflict with BuddyPress' functionality or my theme? BuddyPress setting screenshots are here and here. bbPress settings screenshot is here.


WordPress Post Editor Toolbar Missing

I've just migrated from one host to another (VPS). Now the post editor toolbar has gone away. And also parts of the website shows on the admin side when using the post editor. The only thing I did was move the site from one hosting provider to another. Any idea what could be going on here? I'm using WordPress v3.4.2. I tried to attache images, but as I new user, the system refused. Don't have enough reputation. Also, could not add comments. In any case, the toolbar is completely missing, and checking/unchecking the visual editor makes no difference. Also part of the website displays on the rightside of the post being edited. Doesn't look very good!


Does Wordpress support a shortcode calling itself from within a shortcode call?

I've built a super-crazy Wordpress framework that has a million and one shortcodes, one of those is a columns shortcode which supports a count parameter that allows you to define a column and the appropriate class will be added. **My shortcode is as follows:**               add_shortcode('column', 'column_shortcode');     function column_shortcode($atts, $content = '')     {         extract(shortcode_atts(array(            'count' => 12         ), $atts));              if (stripos($count, '_') === FALSE)         {             if ((int) $count > 12)             {                 $count = 12;             }         }              $html = '
';         $html .= do_shortcode($content);         $html .= '
';              return $html;     }      There appears to be an issue however when the column shortcode is used within a column, is this a known issue or does Wordpress not support shortcodes of the same name being nested within one another? What essentially happens is the column inside is prematurely closed off in the outputted HTML and I see [/column] wrapped in paragraph tags being shown on the front-end. However if I create another shortcode and call it child, using the exact same code as above only the child shrotcode is just [child] instead of [column] everything works as expected. Here is the code from the WYSIWYG editor in my Wordpress installation. Exhibit A is the ideal scenario, I don't want to have to use two different shortcodes that do the same thing. Exhibit B is what works by simply duplicating the shortcode. **Exhibit A - does not work**               [column count="9"]          [column count="8_9"]          Welcome to the site.          Who's brave enough to fly into something we all keep calling a death sphere? Well, then good news! It's a suppository. A true inspiration for the children. Ah, computer dating. It's like pimping, but you rarely have to use the phrase "upside your head."          [/column]          [/column]      **Exhibit B - works**               [column count="9"]          [child count="8_9"]          Welcome to the site.          Who's brave enough to fly into something we all keep calling a death sphere? Well, then good news! It's a suppository. A true inspiration for the children. Ah, computer dating. It's like pimping, but you rarely have to use the phrase "upside your head."          [/child]          [/column]


Limit posts/pages in admin to user roles

I'd like to limit the posts and pages listed in the admin area to certain roles. There are plugins out there that can do some of what I need but they aren't granular enough for my needs. For example I have a 'Advice editor' role and I want to limit them to seeing and editing the 'Advice' pages (and by extension any categories I might wish to add). I have this cobbled together from various posts. It works but I can't get the list to include the parent and all children (it is either the parent or the children but not both). This maybe more of a WP_Query question or there maybe a different way to do it:               // http://docs.appthemes.com/tutorials/wordpress-check-user-role-function/     function appthemes_check_user_role( $role, $user_id = null ) {          if ( is_numeric( $user_id ) )     $user = get_userdata( $user_id );     else         $user = wp_get_current_user();          if ( empty( $user ) )     return false;          return in_array( $role, (array) $user->roles );     }          // http://www.johnparris.com/how-to-hide-pages-in-the-wordpress-admin/     function jp_exclude_pages_from_admin($query) {          if (!is_admin()) {         return $query;     }          global $pagenow, $post_type;          if (appthemes_check_user_role("Advice Editors")) {           if ($pagenow == 'edit.php' && $post_type == 'page') {              //$query->query_vars['post_parent'] = 7;         //$query->query_vars['post__in'] = array( '7' ); // Enter your page IDs here         //$query->set('post__in', array('7'));         $query->set('post_parent__in', array('7'));          }          }          }     add_filter( 'parse_query', 'jp_exclude_pages_from_admin' );      I have come across the Press Permit plugin which can do this but it is a paid- for plugin and I'd like to understand this myself anyway. EDIT: I appreciate I can just put array the post_ids to include but I want to limit this by parent page and its children programmatically, in case future children pages are added (IDs are too vague in this case). Thanks in advance


How to translate "Permanent link to" text

My theme contains the following to create permalinks:
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>
      However I want to translate the "Permanent link to" text. How do I do that? Thank you.


How to control the width of the container in theme customizer wordpress?

How can i control the width of `#container` in theme customizer through functions.php in wordpress. I want to make a control so i can set the width from 100% to 60% or 30% of my `#container` How can i add this to my functions.php. Please help


calling admin-ajax.php from admin-ajax.php

I'm writing a plugin that calls the output of another plugin's ajax, which is set-up at `wp_ajax_` I would have called the functions directly, but limitations in the plugin make that a non-option. To make it clear, this is what's happening:   * User selects an action, then hits apply   * My plugin function is called in admin-ajax.php (via the `wp_ajax_` hook)   * The plugin function creates a nonced url like this: `$url = wp_nonce_url( admin_url( 'admin-ajax.php?action=plugin_action&post_id=' . $post_id), 'plugin_action' );`   * then I call that url with `wp_remote_get` output is `0`. Now the strange thing: instead of calling the url with `wp_remote_get` I echoed it, then copy pasted it in my browser and it gave me the correct output. ( **so it's not a matter of a missing** `die()`!) I've also tried putting my own function in edit.php (using the `load-` hook) instead of admin-ajax.php too, but the result was the same (0). Now the codex shows that the `load-` hook is executed before `wp_ajax`, so that's expected behaviour (the action is not added yet) but even in wp_ajax with a priority of 99 I get `0`. Any ideas on what's going on? Could it be that the action is not added yet when I call it directly from admin-ajax.php? If so, is there a better place to put my own action? (one that fires after wp_ajax)


Google Map iframe in a tab issue

I have embedded a map on the third tab on a page. Page here > 'Itinerary' tab If you go straight to the tab while the page is still loading - it loads the map perfectly. However, if you wait until the page has fully loaded and then click on the tab 'Itinerary', the map loads totally zoomed out and not where it should be. I have tried entering all the details like               <iframe src="http://ridewithgps.com/routes/1342529/embed" height="500px" width="100%" frameborder="0" http://maps.google.com/maps?ll=43.790716,4.166708&z=8&t=m&hl=en-GB&gl=US&mapclient=apiv3&skstate=action:mps_dialog$apiref:1&output=classic></iframe>      but it still won't work for me. I am very little knowledge of Javascript but I'm guessing that it needs to be reloaded no the tab or something to get it to zoom in.


walker class for custom menu structure

i design a html template for hospital website and my menu structure is like this:

                 About
 Mass General

Hospital Overview

                                 Why Mass General

Awards & Recognitions

History

Leadership

Mass General in Focus

Quality & Safety

In the Local & Global Community

Massachusetts General Physicians Organization

                                 Multimedia

Videos

Slideshows

Audio

View All Multimedia

                                 News & Events

Events Calendar

Mass General News

                                 Support Mass General

Make a Gift

Volunteer

Blood Donor Center

Organ & Tissue Donations

      How can I create a custom walker class for this structure?


Custom Taxonomy List links being re-written

I am trying to show a list of terms from my Job Category. I tried the following:               function job_listing_taxonomy_list( $taxonomy,$hide ) {         $args = array('order'=>'ASC','hide_empty'=>$hide);         $terms = get_terms( $taxonomy, $args );         if ( $terms ) {             printf( '
', esc_attr( $taxonomy ) );             foreach ( $terms as $term ) {                 printf( '
%s
', esc_attr( $term->slug ), esc_html( $term->name ) );             }             print( '
' );         }     }      However, when I click the link of one of the terms that are generated, for example:               http://example.com/?s=&job_listing_category=finance      it is changed to:               http://example.com/?s?job_listing_category=finance      Why is the =& changing to a '?' ? I've spent a good half an hour combing Google and this site for answers, but I'm not entirely sure what to even look for! On a side note, I did have a Custom Post Type Permalink Rewrite plugin installed earlier which caused a Strict Standards error, but after disabling it (turns out I wasn't using it anyway), I now get this error.... Any suggestions? Edit: I've tried replacing the & with &, but it didn't make a difference


Wordpress Multisite - Create Default Post and New Category On New Site Install

I've looked around quite a bit, but couldn't find help with creating a new, initial blog post and new category (or renaming the default category) once a new sub-domain has been installed. I've added a script in the mu-plugins folder and have tried to find code for, and figure this out but to no avail. Any help is appreciated. Can this be done? I've found and successfully used the code to create new pages, but that's as far as I can go.


Print the whole page?

I am trying to make a loop to loop all pages beneath each order. I want this because I want to make a one-pager with a page as an element of the one-pager. So that you can go into WP to edit a page and choose a template, and it will be printed through a loop. It was going well until I thought of something. I have a loop, but it displays the title and the content, so not the whole page. I want several pages with different page templates. So you can go in the dashboard, select the template and it will be printed differently (and also different custom fields are added each template). My loop is this:               $args = array( 'post_type' => 'page', 'order' => 'ASC' );     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post();     ?>     <div class="section" id="<?php echo $post->post_name; ?>" style="background-image: url('<?php the_field('backgroundimg_home'); ?>'); background-color: <?php the_field('achtergrondkleur'); ?>">
<?php the_title(); ?>
         <?php the_content(); ?>
     <?php endwhile; ?>      So i want to print each page beneath each other, I have no idea how.. Isn't there just something like get_the_page..? I studied the WordPress codex but couldn't find anything.


Calling a function on admin_init when WP core files are in a subdirectory

I have an install set up along the lines of this tutorial, whereby my core files (wp-admin, wp-includes) are separate from the content folder:               /wp/wp-includes/     /wp/wp-admin/     /wp/wp-load.php etc     /custom-content/plugins/     /custom-content/themes/     /custom-content/uploads/      So far everything is working great; the core and plugins are loaded via svn:externals and working fine. The only issue I've stumbled on is trying to run a simple function to streamline the admin area for the client. Currently I'm trying the following, which has worked on regular installs (with the wp- content folder in the same directory as the other folders):               add_action( 'admin_init', 'remove_menu_pages' );          function remove_menu_pages() {          global $current_user;         $current_user = wp_get_current_user();         $current_user_id = $current_user->ID; // get the user ID              if ($current_user_id != '1') { // End client will have user id of 2              // Remove the "Tools" menu             remove_menu_page('tools.php');              }     }      This has worked fine in the past, but doesn't seem to work in the new setup. As far as I can tell, I'm having trouble hooking into `admin'_init`; I've also tried enqueuing a stylesheet for the admin area without any luck. Am I missing something obvious?


email wordpress users using BCC

I am currently using the below code to email users when a new post is published, but I need it to BCC all users and not TO all users. Any ideas?               function email_members($post_ID)  {     global $wpdb;     $usersarray = $wpdb->get_results("SELECT user_email FROM $wpdb->users;");     $users = implode(",", $usersarray);     mail($users, "New WordPress recipe online!", 'A new recipe have been published on http://www.wprecipes.com');     return $post_ID;     }          add_action('publish_post', 'email_members');


Remove border on custom meta box

How can i remove the border/box on a custom meta box? I need to remove the class "postbox" from a custom meta box, so that it looks just plain. How can i do that?


Getting rid of files not used by latest upgrade

After doing a Wordpress upgrade I notice that there are some files that have an old creation date. Am I safe to delete these on the assumption that they were part of the previous release and so aren't needed for the latest release? I've used windiff to compare two different downloaded releases (i.e. not my live site) and I can spot files that were in the old, but not in the new, but it would be easier to get rid of the old ones if the answer to my question above was "yes". For example, comparing 3.2.1 with 3.3.1 there are 80 files in 3.2.1 not present in 3.3.1. Here are a few:   * wp-admin\css\login-rtl.css   * wp-admin\css\login.css   * wp-admin\css\ms.css   * wp-admin\css\nav-menu-rtl.css


How to make WP_Query 'post__in' accept an array?

I have a function that returns a comma separated list of post ids that a particular user can access. I want to use this list in a WP_Query loop. The custom function:               $array = user_albums();     foreach( $array as $post ) {         if( !in_array( $post->ID, $array ) )             $ids[] = $post->ID;     }     $access_ids = implode( ', ', $ids );      So here is the situation:   1. On my test site the id list is `158, 162, 145, 269`.   2. Inserting the list of ids returns only the first post. `'post__in'=> array( $access_ids ),`   3. Inserting the list of ids not in an array returns an error. `'post__in'=> $access_ids ,`   4. Inserting the post ids manually returns correct posts `'post__in'=> array( 158, 162, 145, 269 ),` **What could I be doing wrong?**   I appreciate any help.


WooCommerce - Is is possible to replace downloadable file and allow existing customer to get it?

I have a WooWommerce 2.0 shop where I sell downloadables and, from time to time, I have to replace existing files with newer versions. When I replace the file URLs for the downloadable files, Customers who already purchased them earlier cannot get the latest version by following the link they received with their order, receiving a "No File Defined" error instead. Is there a way to ensure that the link received with an order always grants access to all the files defined for the Downloadable Product, no matter what they are? Alternatively, would there be a way to send updated links to existing Customers? Thanks in advance for the answers.


How to include error message on login

I am a novice with php, so I need help with this one. Please bear with me. I want to include an error message on the wp_login.php page when visitors are redirected from a "user only/logged in" page. Below is the code I have for the page template which I use for "users only." It checks if the user is logged in or not. if he is not, he is redirected to the login page. This is where I get stuck. I tried to but together some code I found on google but no luck. Is there a way to pass an error message from here to the login page?               if (!is_user_logged_in()) { auth_redirect(); }     add_action('login_head','ref_access');          function ref_access() {          global $error;          if( !empty($_GET['ref']) && 'access' == $_GET['ref'] )         $error  = 'Restricted area, please login to continue.';}      Any code suggestions would be appreciated.


How to remove ( 0, 0 ) from forum page in bbpress

I would like to remove trailing (0, 0) from the /forums page (forums being the 'forums base') in bbpress. The site is also using buddypress and bbpress got installed as a part of 'group forums'. Here's how the /forums page looks like at the moment: General Forums               General (0, 0),     Methodology (0, 0),     Implementation (0, 0),     Tools (0, 0),     Training (0, 0),     New to Lean and Six Sigma (0, 0),     The Water Cooler (0, 0)


Include Drafts or Future posts with count_user_posts?

I'm use the code below to get the number of posts by a user and it works fine but it only includes published posts. How can I modify this code or use different code to have it include "future" post_status's or "drafts", for example.               <?php     $post_count = count_user_posts($curauth->ID);     echo '<p>User post count is ' . $post_count;     ?>


Where does WordPress store a list of Super Admins?

I had to switch around my Super Admins. I did it through the MySQL tables directly. I now have 1 official Super Admin for my network (which is what I want & need) but WordPress shows that I have 2 Super Admins:               All (71) | Super Admins (2)      Where does WP store the SA count or the list of SA's?


wordpress upload permission on nginx & ubuntu

I have a problem with wordpress upload folder permission on nginx/ubuntu VPS. keep getting the error: > “asr.jpg” has failed to upload due to an error Unable to create directory > uploads/2014/02. Is its parent directory writable by the server? here are my uploads folder settings: `drwxrwxr-x 8 www-data www-data 4096 Feb 6 14:41 uploads` I also check that wordpress/php is running as the www-data user.


404 Error on Custom Post Type / Custom Taxonomy

I have a registered post type with 'rewrite' set as slug=>cpt_name, with_front=>true.               register_post_type( 'objection_handling',                        array(                                            'rewrite' => array(                                                 'slug' => 'objection_handling',                                                 'with_front' => true                                                 )      I then have a wp_list_pages function with an argument as post_type=>cpt_name. This function successfully displays an unordered list of my custom post type. I then have custom taxonomies with rewrite=>false.               register_taxonomy(                       'objection_topics',                       'objection_handling',                       array(                             'hierarchical' => true,                             'public' => true,                             'query_var' => true,                             'rewrite' => false,                             'labels' => array(                                               'name' => __( 'Objection Handling Topics' ),                                               'singular_name' => __( 'Objection Handling Topic' ),                                               'hierarchical' => true                                               ),                             )                       );      Now I'm thinking this will output a URL like : /objection_handling/[title-of- page] but I'm getting 404 errors.


Adding Gravatar to rss feed

So I have a mailchimp email that goes out and shows the latest posts that have been made on the site. The users on the site all have gravatars and I want to include that in the rss feed so that I can point the mailchimp image reader to them. I have tried using snippets like:               <?php echo get_avatar( get_current_user_id(), 48 ); ?>      or               <?php echo get_avatar( get_author_email(), 48 ); ?>      and adding that to the rss template in /wp_includes (I would love to do it in functions.php but honestly I just want it to work for this one site so I don't care how I get it done). It's curious because when I do searches I can only find people trying to figure out how to remove it instead of insert it... I am at a loss.


Query_vars not working for me

I'm trying to add an all pages link to posts when I have `?all=1` at the end of the URL it's returning "not set", I'm not sure what I'm doing wrong. I've looked here and my code is the same as here: http://codex.wordpress.org/Custom_Queries#Custom_Archives functions.php               add_filter('query_vars', 'all_pages' );     function all_pages( $qvars ) {     $qvars[] = 'all';     return $qvars;     }      single.php               global $wp_query;     if (isset($wp_query->query_vars['all'])) {         $remove_pagination = $wp_query->query_vars['all'];          echo "all set";          } else { echo "not set"; };


How to save the same post in multiple blogs?

I would like to write my post in one of the my 3 blogs and the same post will be published in the other two blogs. How can I do that?


Where can i get wpcom-carousel?

I am looking for a good carousel, I loved the one at http://icanhascheezburger.com/ and http://tylertalent.com/photos/ I looked at the code and it seems its called wpcom-carousel, but I dont know which plugin on my wordpress installation would give me the same carousel.


How can I list random authors from current post category?

The following lists authors of the current category.   But I want this to be a list of 6 random authors from current post category.               foreach((get_the_category()) as $category) {       $postcat= $category->cat_ID;      }          $current_category_ID = $postcat;     $current_cat_id = $current_category_ID;     $author_array = array();     $args = array(     'numberposts' => -1,     'cat' => $current_cat_id,     'orderby' => 'author',     'order' => 'asc',          );     $cat_posts = get_posts($args);     foreach ($cat_posts as $cat_post) :     if (!in_array($cat_post->post_author,$author_array)) {     $author_array[] = $cat_post->post_author;     }     endforeach;     foreach ($author_array as $author) :     $auth = get_userdata($author)->display_name;     $auth_link = get_userdata($author)->user_login;     $autid= get_userdata($author)->ID;     $link = get_author_posts_url($autid);     echo ''. get_avatar( $autid, '46' ).'';     echo "";     echo '
'.$auth.'
';     echo "";     echo "

";     echo "
";     endforeach;


Retrieve query var within functions.php

I have query var set using the following filter:               add_filter('init', 'add_query_vars');     function add_query_vars() {         global $wp;         $wp->add_query_var('user_login');     }      I am able to retrieve the query var using `get_query_var('user_login');` in page templates without any hiccup. However, on using `get_query_var('user_login');` within a function inside of functions.php, no value is returned. What is the correct way to retrieve the query var within a function inside of functions.php?


How to Link to WP Pages Internally and Extenally

Converting my HTML template to WP Theme I am confused how to linkto the pages in WP? For Example I have an Item div which I would like to link to my store page when user click on that but I dont know how to get the correct URL for my store page?! This is also happening when I would like to link from another site to my page for example how I can link to my page from here?   http//www.ghazalphoto.portfolio.html Or   http//www.ghazalphoto.portfolio.php Or   http//www.ghazalphoto.portfolio


Custom Theme Fields in Settings Menu - apply filters to one of those fields?

I found an interesting concepts of adding an additional option to the "General Options" in Wordpress.               /**      * Custom Theme Settings      * see http://digwp.com/2009/09/global-custom-fields-take-two/      */          add_action('admin_menu', 'add_gcf_interface');          function add_gcf_interface() {         add_options_page('Other', 'Other', '8', 'functions', 'otherGlobalOptions');     }          function otherGlobalOptions() {         ?>

Sonstiges
         <form method="post" action="options.php">             <?php wp_nonce_field('update-options') ?>
Welcome Message
             <textarea name="welcomemessage" cols="100%" rows="7"><?php echo get_option('welcomemessage'); ?></textarea>

<input type="submit" name="Submit" value="Save" />
             <input type="hidden" name="action" value="update" />             <input type="hidden" name="page_options" value="welcomemessage" />         </form>
         <?php     }      **This works just fine.** I'm just wondering now if there is a chance to apply a filter to that input? Like I can do `add_filter('the_content', 'wr_replace_text', 100);` I want to do               add_filter('welcomemessage', 'wr_replace_text', 100);      Is that somehow possible, because this doesn't work for me at the moment. Kind regards, Matt


How to add a body class to all interior pages except the homepage

I want to add a class to the body tag to all pages EXCEPT the homepage. Right now I have. `<?php body_class('interior'); ?>` But it adds 'interior' to ALL pages including the home page. What is the best standard way of adding a class to the body tag?


render html no formatting

How can I get WordPress to render a page without it adding any addtional html? I'm trying to build a dialog that will work on mobile devices and I only want to show that dialog and not have any of the standard wordpress content around it.


Paginate WordPress Category Pages

I am using the following `query` on my `category.php` template:               <?php         $paged = (get_query_var("paged")) ? get_query_var("paged") : 1;         query_posts("posts_per_page=2&paged=".$paged);     ?>      The one thing that I've noticed is that this breaks my pagination...with this code the pagination returns "paged" in the url: http://example.com/?cat=12&paged=2, fortunately or unfortunately it's a simple issue with the url...instead of returning "paged" in the url, it should return "page" or http://example.com/?cat=12&page=2. I have tried altering my code (as explained: http://codex.wordpress.org/Function_Reference/get_query_var for pages):               <?php         $page = (get_query_var("page")) ? get_query_var("page") : 1;         query_posts("posts_per_page=2&page=".$page);     ?>      But that doesn't work either...any ideas? Thanks,   Josh


wp-admin won't load after setting wp-login custom url

I changed the wp-login.php url to /login/ so all links in registration and forgot password emails have /login/ rather than wp-login.php. The problem now is that when I visit /wp-admin/ or click on the dashboard once logged in, it starts by going to wp-login.php?redirect_to... and then goes to /login/. ## How can I fix it to keep the custom login url but also access wp-admin? Functions.php               add_filter('site_url',  'wplogin_filter', 10, 3);     function wplogin_filter( $url, $path, $orig_scheme )     {      $old  = array( "/(wp-login\.php)/");      $new  = array( "login");      return preg_replace( $old, $new, $url, 1);     }               add_filter( 'lostpassword_url', 'custom_lostpass_url' );     function custom_lostpass_url( $lostpassword_url ) {         return get_option('siteurl'). '/forgot-password/';     }


Run query_posts if SESSION is empty?

I am having trouble running query_posts when my page loads for the first time, i.e Session is empty. When the page loads for the first time and the SESSION is empty, the following code runs:                   <?php         $id = 106;       if ((empty($_SESSION['r1']))){                             echo "This Line Prints";                 query_posts("cat=-.'$id'&".$query_string);                 wp_reset_query();                     echo "This Line also Prints";             }         ?>      The two statements mentioned in the above code are printing but the query_posts is not running here. However when I am running it outside the session it is working fine :S How can I run this query_posts if the Session is empty? Why doesn't this code work?


hiding permalink in admin if the user is subscriber

I don't want to show the permalink if the user is subscriber. Can anyone help me to achieve that? PS: I'm talking about the permalink which appears `below title` while creating new post. PPS: I modified the rules for subscriber. They can able to submit the post for review


WP Post Meta Box Field Not Showing Updated Field

Problem with the nonce field. Trying to figure out why the meta box won't display the saved field after page refresh, i.e. enter code in code field. Hit save. The code just entered does not reappear in the code field. Thank you. Here is the code I'm using:               $meta_box_code = array(         'id'       => 'id-meta-box-code',         'title'    => __( 'code', 'framework' ),         'page'     => 'post',         'context'  => 'normal',         'priority' => 'high',         'fields'   => array(             array(                 'name' => __( 'The Code', 'framework' ),                 'desc' => __( 'Place Your Code Here:', 'framework' ),                 'id'   => 'id_code',                 'type' => 'textarea',             ),         ),     );          add_action( 'admin_menu', 'add_the_meta_box' );          function add_the_meta_box() {         global $meta_box_code;              add_meta_box(             $meta_box_code['id'],             $meta_box_code['title'],             'show_the_meta_box',             $meta_box_code['page'],             $meta_box_code['context'],             $meta_box_code['priority']         );     }          function show_the_meta_box() {         global $meta_box_code, $post;              echo '<input type="hidden" name="id_meta_box_nonce" value="', wp_create_nonce( basename( __file__ ) ), '" />';         echo '
';              foreach ( $meta_box_code['fields'] as $field ) {             $meta = get_post_meta( $post->ID, $field['id'], true );             switch ( $field['type'] ) {                 case 'textarea':                     echo '
', '', $field['name'], '' . $field['desc'] . '	', '';                     echo '<textarea name="', $field['id'], '" id="', $field['id'], '" value="', '" rows="8" cols="5" style="width:100%; margin-right: 20px; float:left;">', '</textarea>';                     break;             }              }              echo '
';     }               function id_save_data( $post_id ) {         global $meta_box_code;              if ( ! isset( $_POST['id_meta_box_nonce'] ) || ! wp_verify_nonce( $_POST['id_meta_box_nonce'], basename( __file__ ) ) ) {             return $post_id;         }              if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {             return $post_id;         }              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 ( $meta_box_code['fields'] as $field ) {             $old = get_post_meta( $post_id, $field['id'], true );             $new = $_POST[$field['id']];                  if ( isset( $new ) && ! empty( $new ) && ( $new != $old ) ) {                 update_post_meta( $post_id, $field['id'], $new );             } elseif ( '' == $new && $old ) {                 delete_post_meta( $post_id, $field['id'], $old );             }         }          }          add_action( 'save_post', 'id_save_data' );


BuddyPress on Multisite

Does having BuddyPress installed on a Multisite setup mean that users in each of the different sites can interact or view the actions or content of users on other sites in the network?


Make user as Default contributor for all Blog Posts

I need to get a different requirement, where a particular user need to set as default contributor. I'm not sure whether wordpress actually makes a user default. But for now i need to make a user as default contributor to all the posts, posted on the Blog. Question is : How to set a user as default Contributor?


How can I prevent or workaround Wordpress GUID mangling?

I am importing posts from an RSS feed into a custom post type. I have a filter on post_type_link so that whenever one of these posts is displayed in RSS or other parts of the site, it links back to the original post location. When I create the post I set the GUID for the new post to be the same as the one from the RSS feed, because the GUID should never change. Despite this, Wordpress changes the GUIDs, by prepending "http://" to all of them. This has two effects:   1. The next time I scrape the RSS feed the GUIDs do not match, and I get duplicate posts.   2. If a user subscribes to both the original RSS and my feed, they see all posts twice. Both these two problems are the exact reason why the GUID exists and must never change. So my question is why does Wordpress insist on changing the GUID, and how can I prevent or workaround this problem? I tried adding a filter to get_the_guid to fix the mangled GUIDs, but Wordpress puts the 'http://' back on after calling get_the_guid but before printing the RSS.


How is custom menu hierarchy output handled?

I'm looking to pass custom nav_menus through an RSS feed so I can grab them on other sites to create the same custom menu on multiple sites. What I can't figure out by looking through the database is how WP is storing the data it needs to know which items are parent>child related for hierarchy. How does it know to output the "child" pages as a separate ul even if they aren't "officially" set as parent>child (from edit post screen), only visually in the Menus area? I can look at just the post type of nav_menu_item in the database and the menu_order column lists the items in top to bottom order but nothing seems to reference the menu>submenu relationship. Thanks for anything you can tell me.


Wp_User_Query not sorting by meta key

I'm trying to list users sorted by a meta value. I store a score for each user in their user meta which is just a number but the loop isn't sorting. I include the score in the loop so that I can see that it's not being sorted correctly. What am I doing wrong?                $args = array(         'meta_key' => 'score',         'meta_value' => 0,         'meta_compare' => '>',         'orderby' => 'meta_value_num',         'number' => 20      );      $suggested_user_query = new WP_User_Query( $args );      $users = $suggested_user_query->get_results();      echo '
';          echo '
';          foreach ($users as $user) {              // get all the user's data              $user_info = get_userdata($user->ID);              echo '
';          echo '
'.bp_core_get_user_displayname( $user->ID ).'
';          $score = get_user_meta( $user->ID, 'score', true );              echo $score;              echo '
';          }          echo '
';           echo '
';


Can I move to wordpress.org and continue to be included as a wordpress.com favorite blog?

I'm listed as a wordpress.com favorite blog. If I move over to wordpress.org, will I continue to be listed as a favorite with wordpress.com?


sql for querying post and their category

I'm trying to query the wordpress database for the post and what category they belong in. Is there a sql query that I can use for this? Thanks,


How to disable categories/most used in 'add new post'? I tried function: remove_meta_box(), but it doesn't work for me, i tried it in functions.php for my theme, it's mistake?


how to reduce the number of spam comments

I've got the Akismet plugin on my WordPress site but I've been getting more and more spammy comments (that get caught). I'm amazed at the number as the site isn't that popular and doesn't have much traffic. Are there any methods for reducing spam?


remove and then add wpautop

I'll start by saying yes, I searched, and _yes_ , I found an answer to this question. It's basically the solution I came up with but I want to make sure this isn't a bad solution. Here's the real question. I want make the post title a part of the first paragraph on certain types of posts. My solution is straightforward. I call this instead of `the_content` for a certain category.               function yb_link_post() {       $link_post_title = '' . get_the_title() . '';       $link_post_content = $link_post_title . ' — ' . get_the_content();            remove_filter('the_content', 'wpautop');       echo wpautop($link_post_content);       add_filter('the_content', 'wpautop');     }      So is this a bad way to do this? I have a hunch that removing and then adding `wpautop` could have repercussions that I'm not considering. Can anyone tell me if this is a good solution, or if there's a smarter way to do this?


Wordpress MU - get requested subdomain

I've installed WordPress MU and I am using sub-domains. Now if subdomain doesn't exist it will redirect visitor to a page defined in wp-config.php like this:               define( 'NOBLOGREDIRECT', 'http://www.mydomain.com/404-error' );      Now on that page I have some script and I need to extract "originally requested URL". E.g. if user wanted to visit: blogs.mydomain.com and that blog doesn't exist - user will see http://www.mydomain.com/404-error and on that page - how can I detect which domain user requested ? I've tried `$_SERVER['HTTP_REFERER']` but it's always empty.


How can you use custom types/taxonomies?

The custom types/taxonomies feature of WP 3.0 is a neat one. I can think of a few ways to use the duo: to display projects, a portfolio, or a gallery. What else can custom types and taxonomies be leveraged for?