Custom Post Type Metabox - Not Saving

I've added a custom post type, which is working great; I've also added two metaboxes, which appear to work well, but the content in them always disappears after a few minutes. If anyone could help out on this I would be eternally grateful, S. //meta box code//               add_action( 'admin_init', 'add_custom_metabox' );     add_action( 'save_post', 'save_custom_details' );          function add_custom_metabox() {         add_meta_box( 'custom-metabox', __( 'Product Description & Ingredients' ), 'descr_custom_metabox', 'sorbets', 'normal', 'low' );     }          function descr_custom_metabox() {         global $post;         $proddescr = get_post_meta( $post->ID, 'proddescr', true );         $ingredients = get_post_meta( $post->ID, 'ingredients', true );         ?>
Product Description:
             <textarea id="proddescr" name="proddescr" style="margin:0;height:7em;width:98%;" cols="45" rows="4"><?php if( $proddescr ) { echo $proddescr; } ?></textarea>

Ingredients:
             <textarea id="ingredients" name="ingredients" style="margin:0;height:7em;width:98%;" cols="45" rows="4"><?php if( $ingredients ) { echo $ingredients; } ?></textarea>
     <?php     }          function save_custom_details( $post_ID ) {         global $post;            if( $_POST ) {             update_post_meta( $post->ID, 'proddescr', $_POST['proddescr'] );             update_post_meta( $post->ID, 'ingredients', $_POST['ingredients'] );         }     }          function get_descr_ingred_box() {         global $post;              $proddescr = get_post_meta( $post->ID, 'proddescr', true );         $ingredients = get_post_meta( $post->ID, 'ingredients', true );              return array( $proddescr, $ingredients );     }


Page not found yet the posts are listed?

OK, seriously. I have a really modified index.php. The result: after the second paginated page, the page returns `Not found` and 404, while the posts are shown already. Can anybody tell me, what it happening? Working example with the problem:   * everything ok: http://petermolnar.eu/photoblog   * everything still ok: http://petermolnar.eu/photoblog/page/2/   * Page not found: http://petermolnar.eu/photoblog/page/3/ and so on. The codes: **index.php**               <?php         define ('REDIRECT_TO_PORTFOLIO', get_option ('siteurl') . '/portfolio/through-a-lupe/' );         $_query_string = $query_string;              if ( is_home() || is_front_page() )         {             wp_redirect( REDIRECT_TO_PORTFOLIO );             exit;         }              $cat = get_query_var('cat');         if ( !empty( $cat ) ) :             $show_pagination = false;             $show_sidebar = false;             $posts_per_page = get_option('posts_per_page ');             $category = get_category( $cat );             $orderby = 'date';             $order = 'DESC';             switch ($category->slug) :                 case 'portfolio':                         wp_redirect( REDIRECT_TO_PORTFOLIO );                         exit;                     break;                 case 'photoblog':                     $posts_per_page = 4;                     $show_pagination = true;                     break;                 case 'wordpress':                     $orderby = 'modified';                     $show_sidebar = true;                     break;                 default:                     $show_sidebar = true;                     break;             endswitch;             $_query_string = $query_string . '&posts_per_page=' . $posts_per_page . '&order=' . $order . '&orderby=' . $orderby;         endif;              get_header();         query_posts( $_query_string );              if ( $show_sidebar ) :         ?>
         <?php         endif;              if ( have_posts() ) :             while ( have_posts() ) :                 get_template_part('singles');             endwhile;         endif;              if ( $show_sidebar ) :         ?>

         <?php             echo wp_list_posts( -1, get_option('posts_per_page ') );         ?>
         <?php         endif;              if( function_exists('wp_paginate') && $show_pagination )             wp_paginate();              get_footer();     ?>      **SOLVED** I could solved after a few hour, please see the first comment for explanation. It is caused by some kind of bug in pagination counter, it always uses the default value to count the pagination instead of the new one. Pagination would have to be re-calculated after a query_posts with per post values.


Build path for a custom portfolio plugin

I'm finishing up a personal site that I've spent many weekends on. I've left one of the (potentially) most complicated parts to the end of production. I'm looking for some advice on how to proceed with a fairly customized portfolio / gallery feature. I'll note that I'm relatively new to wordpress, but not to building things with code (as3, javascritp, c#). Use case looks like this: User opens portfolio page, and a limited number (3 rows of 3) of thumbnail containers populate the screen. Thumbs are pulled in via ajax, and rollovers / effects are applied on the client side. Click of thumb floats a div over the page (ala fancybox). Div contains a larger image and then another hunk of markup detailing category tags, year, notes etc. Link in floated div opens folio item in a "project" page (a custom template), with this same, but perhaps expanded, information. In the long run, the user will have the choice of a few different presentation options, but this is where I'm starting. The content is pretty varied, and so _the format must be pretty flexible_. Everything from single photos or illustrations, to a more complex breakdown and commenting of a completed project (web app or body of images, for example). At the minimum, I need a data returned from query variables - and the easiest would be to just write up a static xml file/s and just run the whole thing via ajax. I could easily build the whole thing on the fly, client side, and just call it a day. That being said, I would really like to integrate this content into wordpress and manage content dynamically. I've seriously considered rolling my own plugin to deal with data CRUD. I figure I need, at least one admin page, and then probably a couple of front facing templates for client side delivery. It would be nice to upload contents as well, but I can easily just use an ftp to do so. So, first real question: how should I proceed with my first plugin, and what built in WP functionality can I leverage to make the process as smooth as possible (making use of the WP_query, or the post / page system, for example). Ultimately, I just need a basic data source / delivery system that I can extract via json or otherwise, and all my needs would be met. Before I begin on one of these two build paths, is there a plugin that may suit my specific needs already? I've poked through Next Gen and the built in WP gallery, but I _think_ they may not be flexible enough... it doesn't seem like it. I'm not concerned with a wealth of features as much as a reliable data creation / delivery system. Thoughts? Thanks in advance -


Paypal Integration

i would like to integrate Paypal payments to my Wordpress website, in order to send a digital product. I only want a simple redirection to the paypal payments form, to either pay through paypal or with a credit card (i have a payments standard account there). The problem is the notifications system. I would like my client to be able to download my digital product right after the payment has occurred. Is there a plugin that handles this situation and makes sure that payment and delivery happen normally (using the paypal notifications system) ? I was taking a look at Paypal Framework and i happen to be a programmer. If i take a closer look at that, would it allow me to do what i want ?


How is my non-published blog getting so much spam?

A few weeks ago I created a new WordPress blog. I bought a new domain name for it, and I have not published/linked to the blog yet (because I wanted to get a few articles up first, I only have 2 so far). I have gotten about 10 spam comments already. I am confused how the spammers could be finding me?


What hook should be used to programmatically create a post only when master post is updated?

Pippin and Jean-Baptiste Jung have very good tutorials on how to programmatically create content when a new post is published using these four actions hooks...   * publish{post_type}   * add_action('new_to_publish_{post_type},   * add_action('draft_to_publish_{post_type},   * add_action('pending_to_publish_{post_type} ... to run this script...               global $user_ID;     $new_post = array(         'post_title' => 'My New Post',         'post_content' => 'Lorem ipsum dolor sit amet...',         'post_status' => 'publish',         'post_date' => date('Y-m-d H:i:s'),         'post_author' => $user_ID,         'post_type' => 'post',         'post_category' => array(0)     );     $post_id = wp_insert_post($new_post);      What hook should I be using to do this function **only** when a post is updated? Thank you!


Differentiate between posts and pages in search results

How can one differentiate between posts and pages in search results? What I need to do is show a `the_time` div for posts but not show it for pages, as it's irrelevant. With a function? `<?php if (!is_page()) }` in the loop below doesn't help.               <?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>     <a href="<?php the_permalink() ?>"><?php the_title(); ?>          //prevent this div from displaying for pages:
<?php the_time('F jS, Y') ?>
          <?php the_excerpt(); ?>          <?php endwhile; ?><?php else : ?><?php endif; ?>


wp_update_term: How could i update the "name"?

I was just looking at wp_update_term and haven't found any possibility to update the "name" of the term. My scenario is pretty simple: I got some predefined taxonomy terms in a config file like this (just an example):               $taxonomy_terms = array(       'taxonomy_a' => array( 'term_a', 'term_b', 'term_c' )      ,'taxonomy_b' => array( 'term_d', 'term_e', 'term_f' )     );      Now i'm trying to update these terms based on their id. So if the id exists, i change just the name. But here does my problem start: wp_update_term doesn't offer any possibility to update the name of term... Does anybody know of some work around, or do i just oversee something? Thanks!


WPMU - How to echo only one URL

I have this code that I am using on a site to check if the current user has a blog on the our wp network and as of now it is echoing the URL for both the main site and their blog. I would like to know, how can I modify the code so that it only echoes for the user's site and not the primary/main site.               <?php if(is_user_logged_in()) {     global $current_user;       $blogs = get_blogs_of_user( $current_user->id );          if($blogs) {              foreach ( $blogs as $blog ) {              echo '
domain . $blog->path .'/upload-and-manage-documents/">My Documents
';              echo '
domain . $blog->path .'upload-and-manage-documents/?ptype=settings&tab=gateways">Settings
';                  }          }     } ?>              <?php endif; ?>      So as of now instead of 2 links, it is echoing 4. How can I fix this? Any help is appreciated. Thanks.


Need to check is_archive during init

I need to check if a page is an archive or not, before my plugin does some URI manipulations. These manipulations only work before `wp` but if I perform them first and then check `is_archive`, the check will always return false. How can I check `is_archive` (or achieve the same end result) during a pre-`wp` hook? It would be great if we could pass `is_archive` a postid to check, but it doesn't work that way. **EDIT** : I realize perhaps I'm explaining myself poorly, as archives don't even HAVE postids, as far as I know. I just need some way to check if the current URI is an archive or not, before `wp` fires. **EDIT** : On further experimenting, it appears that my URI manipulations can't take place any later than `init`, I think because by that point WP has already done its rewriting and such. So, I either need a way to check for an archive page status, within `init`, or do URI rewriting after `init`, either approach is fine with me as long as it gets the intended result.


Custom Post Type - Upload Form

So Im just getting started with Custom Post Types. I'm trying to make a custom post called a Certificate. The thing is, I don't need any of the usual 'editor' boxes or anything that would normally be in a post. All I need is an upload form for a user to upload a file. So I've set up the the Certificate post-type, and I made it so it doesn't support anything, so nothing appears on the page. I then added a 'admin_init' hook to display a form. But now i'm a little stuck. Can someone give me a breif outline of what hooks to use to process the form? How do I make it so it activates this hook only for 'Certificate' post types?


Repeatable configuration package

It's normal that a developer or a shop will spend several hours on each project running the same configuration options (for permalinks, SEO options, user roles, plugins that you always use etc.). I'm coming from Drupal, where installation profiles have allowed me to preconfigure a set of configuration options that I can replicate across dozens of sites. This has saved me and my clients hundreds of hours. I now have an opportunity to do the same in WordPress. I'd like to create a script that installs WordPress, installs some plugins and sets some initial configuration options. This has the potential for useful time/cost savings when scaled across many sites. Is this feasible? Or am I barking up the wrong tree?


Menus, but not by theme location

I'm trying to figure out how to display a menu that has been created, but without having to assign the menu to a theme location. From what I can tell, you have to assign a menu to a theme menu location and then `wp_nav_menu calls` a menu from whatever location you want. I don't want to have to assign a menu to a theme location. Instead, I want to be able to create a menu and then query it within my theme... regardless of theme location. I've created a plugin for myself that uses `wp_get_nav_menus` to list all of the menus I've created... I can then assign any menu to a page/post. Now, I'm stuck trying to figure out how to retrieve that specific menu... again, not menu theme location. Anyone?


How do I find users by password?

I need to add a passkey to each user, so I decided to just giving the user password that value and use WP functionality to store it/retrieve it. So now I need to find **what user that password belongs to** , so a single field would be necessary to identify him, rather than asking for email AND passkey. How do I find a user by password? I know what is stored in the DB are not passwords, but something else, but I don't care. We won't have enough users for getting two with the same MD5 (or whatever is stored) Thanks.


Keeping Objects in Memory

I have built a WordPress plugin using classes. Each project class is created for a specific user. I want to do three things:   * Keep the project object in memory for that user between his or her requests.   * Delete it once the user signs out or after a certain expiration time.   * Delete and recreate if user edits the project information (through a form) for that object. Does anyone know how to do that?


Anyway to assign custom post types to a specific category?

Is there anyway to assign all new posts that have a custom post_type to a specific category? For example, say I have a post_type that is for Actors. Is there anyway to assign any post that is under Actors to a "People" category? (but without displaying the Category box in the WordPress Admin)


Using WAMP, trying to create a plugin, getting error: You do not have sufficient permissions to access this page

Just trying to create a simple plugin with some Theme Options so I can practice. When I try to access the Theme Options page under Settings... I get the: You do not have sufficient permissions to access this page. This is all I have in the plugin:               add_action( 'admin_menu', function(){         add_options_page( 'Theme Options', 'Theme Options', 'administrator', __FILE__, function(){             echo 'Hello';         });     });      Here are the parameters from the WordPress codex:               <?php     add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function);     ?>       I am the admin. Tried creating another admin account, same result. Tried setting the slug parameter to a different slug, same result. I'm using WAMP on my local machine. Any ideas? I came up short when trying to search for this issue when using WAMP on a local machine. Any help would be great.


Custom search: by post data and post metadata?

I'm struggling with a WordPress search function. Maybe it will just help if someone can explain to me how the built in WordPress function works. But here's what I want:   * Two search fields, by name and by location   * The first field should check all the common post data (only posts) + categories   * The second field should only check on the posts custom fields   * Only one field needs to be filled First of all, is this even possible or do I have to use native php+sql? If it is possible, can you please give me a hint on where to start?


Is there a plugin to show the code tag button on the visual editor?

I write a programming blog, so sometimes I just have to write a word to represent a `command` or `function` which I like writing between the code tags. (See, what I just did there). So, just like StackExchange has the "code" button, is there a plugin to add this button to the visual editor? I know I got it on the HTML editor, but I rarely use it. I was thinking of writing a plugin for this, but just in case I'm asking first in case anyone knows of a plugin doing this already.


get_post_meta Not Working After Moving The Second Custom Metabox to The Side

I got 3 custom metaboxes in my custom post type. The previous structure is like the following:               Metabox 1     Metabox 2     Metabox 3      If the `Metabox 2` is moved to the side, the `Metabox 1` won't be able to get data from wordpress database using `get_post_meta("$post->ID", "_meta_key", true );` I have try to globalize `$post` and also replaced `$post->ID` with `get_the_id()` but nothing is working. How to make it working? **EDIT:** I found that it is caused by WP_Query. Best Regards


How to add a new tab to page editor

Anyone knows how to achieve this? ![enter image description here](http://i.stack.imgur.com/wN92P.png) It has something to do with meta boxes, but I just can't figure out the proper syntax.


How do I enable the customize theme page to accept svg's?

I'm currently working on a theme that enables the user to upload a logo via the customize theme page. I want the user to be able to upload an SVG as a logo. Wordpress does not allow SVG's to be uploaded by default. So I used a snippet of code to enable SVG's in de media uploader.               function cc_mime_types( $mimes ){         $mimes['svg'] = 'image/svg+xml';         return $mimes;     }     add_filter( 'upload_mimes', 'cc_mime_types' );      I figured this would also allow me to upload SVG's via the customize theme page (`customize.php`) . This doesn't seem to work. When I upload an svg via the normal media uploader, the file gets uploaded succesfull. When I try to upload an svg via my logo uploader on the customize theme page, nothing happens. Not even an error. My code to enable logo uploading via the customize theme page:               function themeslug_theme_customizer( $wp_customize ) {         $wp_customize->add_section( 'themeslug_logo_section' , array(             'title'       => __( 'Logo', 'themeslug' ),         'priority'    => 30,         'description' => 'Upload a logo to replace the default site name and description     in the header',     ) );     $wp_customize->add_setting( 'themeslug_logo' );     $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize,     'themeslug_logo', array(         'label'    => __( 'Logo', 'themeslug' ),         'section'  => 'themeslug_logo_section',         'settings' => 'themeslug_logo',     ) ) );     }     add_action('customize_register', 'themeslug_theme_customizer');      Does anyone know how to enable SVG upload specificaly for the customize theme page?


wordpress multisite not installing

When trying to install multisite on my wordpress blog, I get a blank page on the 2nd step where I should get the options to choose from subdomain or sub directory. I've tried installing on several occasions and still the same problem persists. All plugins are deactivated. Help plsssss


CSS styling of native (inbuilt) wordpress thumbnails

I really hope someone will be able to help me with this as it should be really simple but I am struggling! I am working on the 'native' or inbuilt wordpress thumbnail gallery (not a plugin). I want to make it responsive. At the moment, on smaller screens, the thumbnails just get smaller... I am trying to have them re-arrange themselves so that for example on screens above 1000px wide there are 5 thumbnails in a row, then between 700and 1000 px it goes down to 3 etc.. So my questions are: -where in the wordpress folder is/are the css file(s) that affects these thumbnails? (they are the native, or inbuilt thumbnails that come with wordpress, regardless of my theme) -How would you go about doing this? I want to set up media queries in the CSS file mentioned above, once I find which one it is... does that sound right? I am thinking of keeping the original styling and adding stuff to it, including the media queries. Is that possible or do I need to unhook the css and thenrewrite it from scratch? If that is the case, how do I unhook? In which file does this happen? Any help at this stage would be most gratefully received... any help, pointers, snippets etc would be a huge help. Thanks in advance, Maya


Add register form inside theme template

Goodafternoon guys, I was wondering how I can add a custom register form inside my wordpress theme. So it will fit the styling of the website and doesn’t redirect to the normal register and login form. I look out for your response. Thank you.


Return code from save_post action?

I'd like to understand what value I should return from a WordPress `save_post` action function. This example from the save_post documentation both explicitly and implicitly returns without a value:               function my_project_updated_send_email( $post_id ) {              // If this is just a revision, don't send the email.         if ( wp_is_post_revision( $post_id ) )             return;              $post_title = get_the_title( $post_id );         $post_url = get_permalink( $post_id );         $subject = 'A post has been updated';              $message = "A post has been updated on your website:\n\n";         $message .= $post_title . ": " . $post_url;              // Send email to admin.         wp_mail( 'admin@example.com', $subject, $message );     }     add_action( 'save_post', 'my_project_updated_send_email' );      However, this example from the add_meta_box documentation very specifically returns the $post_id that was passed in if it returns early, but returns nothing if the function executes to the end.               /**      * When the post is saved, saves our custom data.      *      * @param int $post_id The ID of the post being saved.      */     function myplugin_save_postdata( $post_id ) {            /*        * We need to verify this came from the our screen and with proper authorization,        * because save_post can be triggered at other times.        */            // Check if our nonce is set.       if ( ! isset( $_POST['myplugin_inner_custom_box_nonce'] ) )         return $post_id;            $nonce = $_POST['myplugin_inner_custom_box_nonce'];            // Verify that the nonce is valid.       if ( ! wp_verify_nonce( $nonce, 'myplugin_inner_custom_box' ) )           return $post_id;            // If this is an autosave, our form has not been submitted, so we don't want to do anything.       if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )            return $post_id;            // Check the user's permissions.       if ( 'page' == $_POST['post_type'] ) {              if ( ! current_user_can( 'edit_page', $post_id ) )             return $post_id;            } else {              if ( ! current_user_can( 'edit_post', $post_id ) )             return $post_id;       }            /* OK, its safe for us to save the data now. */            // Sanitize user input.       $mydata = sanitize_text_field( $_POST['myplugin_new_field'] );            // Update the meta field in the database.       update_post_meta( $post_id, '_my_meta_value_key', $mydata );     }     add_action( 'save_post', 'myplugin_save_postdata' );      There's no indication on that page of why it's returning `$post_id` if it returns early. There doesn't seem to be any actual documentation on the save_post Codex page one way or the other. I've seen conflicting advice around the web, too. The example of creating an Action function in the Plugin API documentation looks like it's also a `save_post` action, and returns the `$post_id` passed in on success, though it doesn't say why:               function email_friends($post_ID)  {         $friends = 'bob@example.org,susie@example.org';         mail($friends, "sally's blog updated",            'I just put something on my blog: http://blog.example.com');         return $post_ID;     }      Can anyone tell me what I, if anything, I should be returning from my `save_post` actions, and why, preferably with some kind of official reference?


Wordpress as a Facebook app

I´m setting up a WP based app and due to some limitations on facebook page tabs and mobile phones I´m trying to set up a redirect that directs the pages accourding to device and if its visited through either page_tab, direct url or canvas. ie. The redirect URL is set in a Custom Field for the specific page visited, if that isnt set it suppose to determin what post type it is before redirecting one or the other way. If its visited by cellphone it should redirect at all but run the page as normal. If the page is visited directly though browser it shour redirect to the custom field url set (if posttype is page) and to a specific canvas app if the post type is "course"... If visited (with appdata set / through facebook page tab) it should show as normal... Because of the redirect it needs to be in header before any other headers are sent (?) The question is... How can I on a efficient way - redirect users that visit a URL directly ie. //fu.viralapps.no/tamtamtam to the facebookversion //www.facebook.com/TheTamTampage/App123123123. but only when the site is visited through a desktop/laptop computer. And not through a smartphone/pad. AND the page to redirect to is diffrent for each page (redirect url set as custom field in WP page) //fu.viralapps.no/tamtamtam => //www.facebook.com/TheTamTampage/App123123123 //fu.viralapps.no/tamtamtam2 => //www.facebook.com/TheTamTampage/App232323232 //fu.viralapps.no/tamtamtam3 => //www.facebook.com/TheTamTampage/App3434343434 The facebookpage - tab/app will not redirect its iframed page because it contains a "Signed Request" automaticly through facebook. Here is my code so far... (some echos for debugging added)               <?php     $signed_request = $_REQUEST['signed_request']; // Get the POST signed_request variable.           if(isset($signed_request)) // Determine if signed_request is blank.      {      $pre = explode('.',$signed_request); // Get the part of the signed_request we need.      $json = base64_decode($pre['1']); // Base64 Decode signed_request making it JSON.      $obj = json_decode($json,true); // Split the JSON into arrays.      $page = $obj['page']; // Get the page array. It has a sub array.           echo("Your App Data: " . $obj['app_data']);               // RUN PAGE AS PLANNED!               $geturl = "appdata found";                }      else      {          // NO APP DATA FOUND - CHECK IF WE ARE MOBILE               //detect user agent.     $useragent=$_SERVER['HTTP_USER_AGENT'];     if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4)))          //Mobile detected - Stay on this URL     {          $geturl = "mobile";                         }else          //No mobile - Redirect for Facebook Page Tab / canvas         {                  //get the url for the current page             $isgeturl = get_field('redirect_app_url');                  if(isset($isgeturl)){                 //WE HAVE A SET URL                 $geturl = $isgeturl;             }else{                 //WE DONT HAVE A SET URL                      //What are we dealing with?                 $PostType = get_post_type( get_the_ID() );                      if ($PostType == "course") {                     $geturl = "https://apps.facebook.com/fu-kurs/" . the_slug();                 }else {                     $geturl = "https://fu.viralapps.no/?ref=confused";                 }                            }                 // header('location: '.$geturl);             echo $geturl;         }          // die('No signed request avaliable.'); //If there is no signed_request, stop processing script.      }          ?>


Assign a list of categories with a parent category

I imported hundreds of locations and other categories. Now I have a list of locations in categories to which I would like to assign the "Location" category as its parent. I have tried sql but the structure is a bit too complex. And I looked around for a plugin but with no luck. Thanks a lot for helping.


How to show only text from post in WordPress

How do I retrieve just the text of a post in WordPress not including any pictures?


WP 3.3 > Still no option to enable automatic image overwrites?

I was really excited to see the new functionality with the media manager in WP 3.3 (specifically drag and drop uploads and automatic file type recognition) But I was disheartened to see no relief in terms of the confusing manner in which WP continues to handle image overwrites (by appending a number to the image and creating a duplicate version). Does anyone have a workaround that I can implement in my theme's functions.php to enable automatic image overwrites, replacing the original image with the new one, and without changing the filename?


simply loop through posts

I know this is a really newbie question, but I can't seem to get the loop to pull from the posts. all it is doing is pulling from the page itself. I made a template and added the loop to it.               <?php     if( have_posts() ) {       while( have_posts() ) {         the_post();         ?>
<?php the_title(); ?>
         <?php       }     }     ?>      edit: here is all the code: http://pastebin.com/k2rDu53b


Creating an Events Feed with Sub Pages/Posts for Each Event

I am currently working on creating an events section for a website. My original plan was to create a custom post type for Events and create a new post for each event. Then I would query the top five events on the home page. My problem is that I need to have sub pages/posts for each event. These pages/posts will need to show up in a sidebar when the single event post is viewed. Is that possible? Can I create a parent/child relationship with each event post and its sub posts or would it be better to use custom taxonomies to organize this information? The site will be client updated, so I need to create a system that is straightforward and sustainable with a logical permalink structure. Any help would be greatly appreciated. Thanks!


Post UI Tabs plugin double fade effect

After clicking a tab (any tab), the fade in effect occurs twice. Curious how to only have this occur only once. I disabled every plugin to ensure that this was not a JS conflict elsewhere and it appears to be isolated to this plugin: http://www.ernestsports.com/products/ernest-sports-es12-golf-improvement/ Great plugin. Works like a champ! Thanks in advance ~


Read more doesnt work with query posts

The tite says it all. If I comment out the `query_posts` it works, if I don't it doesn't.               <?php // retrieve one post with an ID of 1     query_posts('p=27');      global $more;     $more = 1;     ?>     <?php while (have_posts()) : the_post(); ?>          <?php the_content('read more'); ?>     <?php endwhile;?>


How to rename theme's root directory?

I want to rename the theme's root folder for security purpose. I put these in `wp-config.php` file: But I want to rename the theme's root directory also:                define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/assets' );      define( 'WP_CONTENT_URL', 'http://www.domain.in/assets');           define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/extension' );      define( 'WP_PLUGIN_URL', 'http://www.domain.in/assets/extension');      So, how to rename the theme's root folder like this way?


What is the proper url for facebook api to work with wordpress?

This may seem silly but after google searching it I was unable to find a solution. I'm using the newest facebook PHP SDK and wordpress. I've tested my code in plain php and it works like a charm. When I convert it into wordpress plugin I am unable to provide the correct facebook url. When I click on the connect button I get the warning: > Given URL is not allowed by the Application configuration.: One or more of > the given URLs is not allowed by the App's settings. It must match the > Website URL or Canvas URL, or the domain must be a subdomain of one of the > App's domains. No matter how I rearrange the urls I continue to receive this error when attempting to connect. Can anyone provide insight on what is the proper way to integrate the two and make the url proper?


Sidebars are no longer working

I am trying to figure out why my sidebar is no longer working. I tried reinstalling my theme, disabling all of my plugins, and uploading a fresh version of widgets.php, with no luck. I am using the Photogram theme, but the problem doesn't go away if I change to a different theme. Here is what I see when I go to my widgets page: ![Widgets page](http://i.stack.imgur.com/7gIpw.png) ![Zoom in of the area](http://i.stack.imgur.com/VLQl6.png)


Prevent certain subscribers from seeing specific taxonomies (changes frequently)

I've created a taxonomy (let's call it `tax`). I need to limit what a user can see. The users can't edit anything, just read the blog. If it was just setting what they could see once, I'd probably just create a new user role, but what they will be viewing will change frequently.   So for an example:                  user1 can view tax1, tax4        user2 can view tax3        user3 can view tax1, tax2      Then next week that all changes (kinda like checking out a movie or a book then returning it).      How can a make sure that the users can't view any other taxonomies than the ones they're assigned?      I'm hoping there is a function that I just haven't found that is something like:               if(!get_taxonomy(ID)){         echo "You're not permitted to view this";     }else{         //Continue with showing page...     }            I already have things set up so that in their user profiles I can assign them their taxonomies. So on the frontend when the page pulls up I can check which taxonomies they can see. But they can still navigate to other taxonomies. If they see that they're on `http://website/tax1/` then they could just type in `http://website/tax2/` and see the other taxonomies.      This has to be done on an individual user basis and not assigned to a role since there will be so many different users and so many different taxonomies.      Sorry I can't provide a live example; it's being developed locally and it contains some sensitive info.      If I need to clarify anything I'm more than happy to.      Thanks for the help!


Buddypress register.php user redirect

In my buddypress I have set the register page as homepage. Now whenever a logged-in user tries to access the register page(homepage), they are redirected to Members directory. I want it to change to, home page. is there any way? I have tried changing the buddypress/bp-members/bp-members-signup.php file this way:               // If the user is logged in, redirect away from here     if ( is_user_logged_in() ) {         if ( bp_is_component_front_page( 'register' ) )             $redirect_to = bp_get_root_domain() . '/' . bp_get_members_root_slug();         else             $redirect_to = bp_get_root_domain();              bp_core_redirect( apply_filters( 'bp_loggedin_register_page_redirect_to', $redirect_to ) );              return;     }      To this:               // If the user is logged in, redirect away from here     if ( is_user_logged_in() ) {         if ( bp_is_component_front_page( 'register' ) )             $redirect_to = bp_get_root_domain() . '/';         else             $redirect_to = bp_get_root_domain();              bp_core_redirect( apply_filters( 'bp_loggedin_register_page_redirect_to', $redirect_to ) );              return;     }      **I am getting this error:** The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. Anyone knows how to fix this?


Is it possible to make the heading on a page different text to the text of the menu item? I have a page with a very long title and I'd like to make the clickable menu text shorter. Site is here: http://richardclunan.com


Best way to sort estates and query them (for rent? yes/no. contains office space? yes/no)?

I´m building a real estate site where Estates is a custom post type. I want to be able to tick a checkbox or something similare on the edit page, where I can choose if the estate is for rent, if it contains office space etc. And then be able to query against this in different templates. I´m wondering what´s the best way to achive this. I´m using 'Advanced Custom Fields' to type in a lot of information about the estates and that is working well. I thought I could just use a custom field checkbox for this aswell but it seems you can´t query against a custom field value if the values are in an array. Should I be using taxonomies instead? I could do that, but it makes less sense for the user and I don´t want them to be able to add terms, which they can. Any suggestions?


Using True Type Fonts (ttf)

I have found some nice True-Type fonts on the web, and I would like to use them for specific roles in a specific theme of my WP blog (e.g., `H2` or post titles). How do I change the theme to use the fonts for these roles?


What file is the standard frontpage that lists all the posts?

I want to edit something in my theme but i can't find the file that lists all the blogposts on the homepage. In the 'Reading' settings i have: Front page displays - your latests posts as the chosen option. When i edit index.php i cannot see the changes so that is not it. So what phpfile does wordpress use to generate 'your latest posts' ? Thanks in advance!


How to display this meta data (an array) in form of a function (created with a custom write panel)?

I'm using the following code to create custom write panels:               <?php          $key = "project";     $meta_boxes = array(         "project_services" => array(             "name" => "project_services",             "title" => "Services",             "description" => "List the services provided for the project."),         "project_name" => array(             "name" => "project_name",             "title" => "Name",             "description" => "Write the name of the project."),         "project_overview" => array(             "name" => "project_overview",             "title" => "Overview",             "description" => "Write an overview of the project.")         );          function create_meta_box() {         global $key;              if( function_exists( 'add_meta_box' ) ) {             add_meta_box( 'new-meta-boxes', ucfirst( $key ) . ' Description', 'display_meta_box', 'post', 'normal', 'high' );         }     }          function display_meta_box() {         global $post, $meta_boxes, $key;     ?>
          <?php         wp_nonce_field( plugin_basename( __FILE__ ), $key . '_wpnonce', false, true );              foreach($meta_boxes as $meta_box) {             $data = get_post_meta($post->ID, $key, true);     ?>
     <label for="<?php echo $meta_box[ 'name' ]; ?>"><?php echo $meta_box[ 'title' ]; ?>     <input type="text" name="<?php echo $meta_box[ 'name' ]; ?>" value="<?php echo htmlspecialchars( $data[ $meta_box[ 'name' ] ] ); ?>" />
<?php echo $meta_box[ 'description' ]; ?>

          <?php } ?>
     <?php     }          function save_meta_box( $post_id ) {         global $post, $meta_boxes, $key;              foreach( $meta_boxes as $meta_box ) {             $data[ $meta_box[ 'name' ] ] = $_POST[ $meta_box[ 'name' ] ];         }              if ( !wp_verify_nonce( $_POST[ $key . '_wpnonce' ], plugin_basename(__FILE__) ) )             return $post_id;              if ( !current_user_can( 'edit_post', $post_id ))             return $post_id;              update_post_meta( $post_id, $key, $data );     }      Now, I can call that metadata in the following way:               <?php $data = get_post_meta( $post->ID, 'project', true ); ?>
<?php echo $data[ 'project_services' ]; ?>
      But I would like to call it in this way:
<?php project_services(); ?>
      Any suggestions?


Is there a way of posting or inserting content directly to the database (without entering the wp-admin)?

Is there a way of for instance, insert a post and assign a category to it, without accessing Wordpress' back-end?


Using Custom Post Meta Values in Shortcode

I'm trying to display meta content from a custom post type in a shortcode. I'd like to simply provide a post_id and be able to display all the meta content.               [my_shortcode post_id=""]      I'm new to PHP and writing shortcodes, this seems as though it should be fairly simple... I know the following is wrong:               function promotion_function($atts) {     extract(shortcode_atts(array(         'promo_id' => '',     ), $atts));     global $post;     $meta_values = get_post_custom($promo_id, 'product_desc');          $output = $meta_values;     return $output;     }     add_shortcode('promotion', 'promotion_function');      The above code gives me the string "Array" in my page. I can't find an example of how to do this, any help would be greatly appreciated.


How to add another user to this remove_menu function?

Pretty self-explanatory. How does one add another user to this function for functions.php, i.e., user2, who will be shown different menu items than user1? I tried adding another `if($current_user->user_login == 'user2')` condition, but no luck. User2 will have different admin rights, if that matters. But basically, I need to be able to show one set of menu items to user1 and another set to user2, so I need to figure out some if else logic. But I tried that, and I get a "can't redeclare a previously declared" error for the menu function.                 function remove_menus()     {         global $menu;         global $current_user;         get_currentuserinfo();              if($current_user->user_login == 'user1')         {             $restricted = array(                                 __('Links'),                                 __('Comments'),                                 __('Appearance'),                                 __('Plugins'),                                 __('Profile'),                                 __('Tools'),                                 __('Settings')             );             end ($menu);             while (prev($menu)){                 $value = explode(' ',$menu[key($menu)][0]);                 if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}             }             }     }          add_action('admin_menu', 'remove_menus');


What is the benefits of the table 'wp_term_taxonomy' in wordpress, why they don't collect all terms data in the table 'wp_terms' like that: id name slug term_group taxonomy description parent count what is the principle they depends on ?


Does using a custom query_var create a security hole?

Say I put the following code in functions.php               function add_my_query_vars($qvars) {       $qvars[] = "new_var";       return $qvars;     }          add_filter('query_vars', 'add_my_query_vars');      If somebody requests `my.site.com/?new_var=[MALICIOUS CODE]`, can they cause any damage? If not, why not? **Edit for clarity** : I know that user input should be considered harmful. My question is whether WP vets the data that makes it into $wp_query.


Force string into signup form

I am running WP multi-site and BP. The plugin in question is Anti-Splog by WPMUDEV. They have advised they do not support customisations. Anti-Splog tries to limit spam blogs from appearing on your multi-site network. I am running a subdomain install. Therefore, on the form where the signup for a subdomain occurs, I want to autofill the value of the form box, and lock it so the user sees the subdomain. However, even by forcing the $string as the value, it will not continue on to create the new subdomain blog. It says, please enter a value. This is the random string code:                  $subdomainhash = array_merge(range(0,9),range('a','z'));        shuffle($subdomainhash);        $newsubdomain = implode('',array_slice($subdomainhash,0,32));        echo $newsubdomain;      Now, to force users to use that string on the select subdomain form I have to edit the following code:                   ' . __('Site Domain:') . '';          if ( $errmsg = $errors->get_error_message('blogname') ) { ?>
<?php echo $errmsg ?>
     <?php }          if ( !is_subdomain_install() )              echo '' . $current_site->domain . $current_site->path . '<input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="60" />';     else         echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" />.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_site->domain ) ) . '';          if ( !is_user_logged_in() ) {         if ( !is_subdomain_install() )          $site = $current_site->domain . $current_site->path . __( 'sitename' );         else             $site = __( 'domain' ) . '.' . $site_domain . $current_site->path;              echo '
(' . sprintf( __('Your address will be %s.'), $site ) . ') ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '
';     }      It doesn't seem to matter if I force $blogname or $site to be $newsubdomain. It does not fill the value of the form, or replace the above strings. I can't get it working? The subdomain box needs to be the random subdomain string above on a new site registration. Can any php guru could help please? Thanks in advance, Johnny


Adding more tabs to horizontal navigation bar

currently i'm using raindrops theme developing my page. Raindrops is using 'menu-header', 'theme_location' => 'primary')); ?> to generate the horizontal navigation bar, which only shows a tab linked to posts->categories. I wish to add more tabs beside the original tab, such as faq, contact us etc. which can be linked to pages, posts or other url's etc, how can it done? thanks


contact 7 plugin stops some pages from working properly

I started to use contact 7 plugin and I'm having a slider and some effects on other images when i activate the plugin they stop working this is the web page               http://www.digitalways.com.sa/       I don't understand what it do! if it stops the javascript or css files but I searched in the files if it has the same names and stopping them from working but it have different names i tried to add this code to function.php so i could add jQuery by the right way but it gave me server error               jQuery(document).ready(function(){     function my_init() {     if (!is_admin()) {         // comment out the next two lines to load the local copy of jQuery         wp_deregister_script('jquery');          wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js', false, '1.3.2');          wp_enqueue_script('jquery');     }      }       add_action('init', 'my_init');       });


wp-e-commerce plugin - Second Test Gateway payment option

How can I add a second Test gateway to wp-e-commerce payment options? I need one for cash-on-delivery and a second for Bank-Transfer. A similar question was asked at wp-e-commerce plugin - custom payment option but the answer does not cover this issue.


How do I get rid of or change the footer in my child theme?

I want to remove the default theme name and "powered by WP" text in the footer of every page. I've created a child theme to hold all my customizations from the original theme so that my customizations won't be obliterated when the original theme is updated. Where can I change the text that is generated into the "colophon" div?


Wordpress where clauses in db select

I'm currently struggling with implementing a feature for wordpress site. I would like to get the count of all users which have the key `pending_approval='true'` and `is_photographer='true'` (located in `wp_usermeta`. How could that be achieved? I've been searching through the documentation, but I couldn't find an proper example. Example code:               $users_sent_to_admin = new WP_User_Query(array(                                                  'meta_query' => array(                                                      array(                                                          'key' => 'pending_approval',                                                          'value' => 'true',                                                          'compare' => '='),                                                      array(                                                          'key' => 'is_photographer',                                                          'value' => 'true',                                                          'compare' => '='                                                      ),                                                  )                                              ));          $users_sent_to_admin = new WP_Query($users_sent_to_admin);


How do I get resized thumbnails?

I'm getting post thumbnails by calling `the_post_thumbnail(array(400,300), true);` However, this displays the fullsize featured image, just resized with the html "height" and "width" tags. This is not good for loading times. I've tried regenerating thumbnails and that doesn't make a difference. Isn't there a way to get thumbnails that have been resized?


Using htaccess and php to protect file, MIME problem

I'm using the method described here: Protecting WordPress Media Uploads Unless User Is Logged In (Based off of How to Protect Uploads, if User is not Logged In?. The redirect is working perfectly, yet when a logged in user does try to access the folder, the file appears corrupt. (PDFs blank gray screen and an error message "this pdf may not be diplaying correctly" and images show a blank screen and an image which displays "The image [image-name] cannot be displayed because it contains error."               `$mime = wp_check_filetype($file);     if( false === $mime[ 'type' ] && function_exists( 'mime_content_type' ) )     $mime[ 'type' ] = mime_content_type( $file );          if( $mime[ 'type' ] )     $mimetype = $mime[ 'type' ];     else     $mimetype = 'image/' . substr( $file, strrpos( $file, '.' ) + 1 );      The culprit is in this segment:               header( 'Content-Type: ' . $mimetype ); // always send this     if ( false === strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) )     header( 'Content-Length: ' . filesize( $file ) );`      When I comment out this section, the errors go away, but the file returns a garbled mess of language instead of the actual rendering of the file. Anyone faced this problem before or have any ideas as to what I could check for? Thanks in advance. UPDATE: The plugin http://omninoggin.com/wordpress- plugins/wp-minify-wordpress-plugin/ is causing the conflict. I will disable it for now.


Display multiple custom post type lists on homepage - multiple loops

I've got to display 6 boxes on the homepage of a site I'm working on and struggling with the code. I've managed to get this far:               <?php      $term = get_term( hotelCategoryID, 'accommodation-category' );     $output = '
 ';     if (function_exists('get_terms_meta'))     {          $category_hotel = get_terms_meta(hotelCategoryID, 'image_taxonomy',true);          }     if($category_hotel ) :      $output .= 'name.'" />';     endif;     $output .= '
                      corner
'.$term->name.'
'.                     $term->description.'
';?>     <?php       $args = array('post_type' => 'accommodation','tax_query' => array( array('taxonomy' => 'accommodation-category','field' => 'id','terms' => hotelCategoryID)));     query_posts($args);?>     <?php if (have_posts()) : $count_post = 0;         $output .= '

';        while (have_posts()) : the_post();      if($count_post==5) $output .='

';      $count_post++;      $output .= '
'.get_the_title().'
';      endwhile;      $output .= '

             +   MORE '.$term->name.'-   LESS '.$term->name.'

';     endif; wp_reset_query();     $output .= '
';?>      But when I copy the code and modify it to get the information from another custom post type it just displays one block on the homepage, I assume it's an issue with the loop in this code. I've tried various other codes but this is the one that I need as it has "5" highlighted posts, and then the rest aren't. Could someone give me an idea on how to edit the loop so I can display 6 of these on one page please? Thanks!


Wordpress function when file is uploaded, deleted or edited

I need to call this bit of PHP when a file is uploaded, deleted or edited. $output = shell_exec("bash ./upload.sh"); echo $output; I can't seem to find the right code to execute this when any of the above happen. Examples and help would be greatly appreciated.


Why doesn't this page query work?

This should be easy. I need to query to display one page in a tab. Just pull one page by one query, but I'm doing something (maybe lots) wrong here: **Edit: Hah. I forgot`the_content` It works now.**               <?php          $the_query = new WP_Query; $the_query->query ('pagename=about' );          while ($the_query->have_posts()) : $the_query->the_post(); ?>          <?php the_content(); ?>  //forgot this          <?php endwhile; ?>


Any insights into Transient API locking, cron and threading?

How does one go about locking down transient API requests for multiple threading? Has anything done some benchmarking, just how much can the transient API handle for multiple concurrent requests? It seems like it might cause some severe bottlenecks if not managed properly. Also how would one go about forcing the transient API using WP's built in cron? For instance I have a transient firing on page load that I gather statistics from ( another seperate function) but if a page isn't visited then the transient is not updated, how would you loop through all the pages/posts using transient API to force an update? The cron might also be effective in dealing with my first question to avoid multiple threading, too many requests and performance. I have been wondering about this and recently a core dev alluded to it on a blog post, the Transient API is so simple to use but seems to lack some documentation for advanced management. Any insights would be really appreciated.


Multi-Site Subfolder User Permission Issue

Currently I have a header file checking to see if users are logged in, and then a "landing" page which allows them to view all the sites they have access to within my multisite network. This functionality is working great - but I can't seem to figure out how to prohibit them from manually entering the path to the subfolder if they do not have access to it (IE: User A has access to Sites A and B but not C - Currently you can still access it by typing in http://www.example.com/Subfolder-C/ path). My code is below for header file, which I'm assuming is where I would be going to input the remaining code to prevent them from accessing the site without being a user on the multisite instance.               <?php      /*     Template Name: Brand Home     */     ?>     <?php     //ini_set('display_errors',1);      //error_reporting(E_ALL);     ?>     <style type="text/css">     body {background-color:black;}      </style>     <?php global $current_user;       get_currentuserinfo();     ?>     <?php     if ( is_user_logged_in() ) {     ?>     <?php brand_login($current_user->ID); ?>      And then this is my functions.php code that deals with logins               add_filter( 'login_url', 'mysite_login_url', 10, 2);     function mysite_login_url( $force_reauth, $redirect ){     $login_url = '/';          if ( !empty($redirect) )         $login_url = add_query_arg( 'redirect_to', urlencode( $redirect ), $login_url );          if ( $force_reauth )         $login_url = add_query_arg( 'reauth', '1', $login_url ) ;          return $login_url ;     }               $sitepath = array();          if(is_user_logged_in()) {     global $current_user;     $blogs = get_blogs_of_user( $current_user->id );      if($blogs) {          foreach ( $blogs as $blog ) {             $blogpath = $blog->path;              if ($blogpath == '/diesel/') {              $sitepath[intval($blog->userblog_id)] = 'href="/diesel/" class="opaque" ';              }              if ($blogpath == '/michael-kors/') {               $sitepath[intval($blog->userblog_id)] = 'href="/michael-kors/" class="opaque" ';              }              if ($blogpath == '/marc-by-marc-jacobs/') {               $sitepath[intval($blog->userblog_id)] = 'href="/marc-by-marc-jacobs/" class="opaque" ';              }          }      }     }


adding a filter to a shortcode?

<?php echo do_shortcode('[mingleforum]'); ?>      inserts the mingle forum into my content! is it possible to use add_filter() on that?


Force index.php have_posts() loop to exit if no sticky posts found

I'm currently using the code below to list sticky posts on my index.php. However, when no sticky posts are present, its loading the latest posts (up to the number specified in "settings > reading > blog posts show at most ___ posts". How can I alter the script so that if there are no sticky posts, it exits out of the while?               query_posts(array('post__in'=>get_option('sticky_posts')));          if (have_posts()) :     while (have_posts()) : the_post();


Cant get theme to change footer color through theme customizer

I am having an issue trying to configure the theme I am working on to allow the footer color to be changed. So far all of my other options work so I am geussing it is an issue with the way I am calling back to the css class. This is the footer class:                .footer {      background: #f7f7f7;      height: 150px;      position: relative;      z-index: 7;      -webkit-box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);      -moz-box-shadow: 0 2px 20px rgba(0,0,0,0.4);      -ms-box-shadow: 0 2px 20px rgba(0,0,0,0.4);      -o-box-shadow: 0 2px 20px rgba(0,0,0,0.4);       box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);      } This is how I am calling it from the theme:                function theme_header_css() {      ?>             <style>                 .footer {             background: <?php echo my_theme_mod( 'hero_footer_color' ); ?>;             }             </style            <?php       }       add_action( 'wp_head', 'theme_header_css' );      I tried calling background-color instead of background but that doesn't seem to work. I am thinking that I am not calling the class right. Can anyone give me a hand? **EDIT:** When I check the page CSS I can see that it is attempting to override the background color, although it is not producing a value and appears like this: .footer { background: ; } After checking through multiple times it is the proper setting, so I am at a loss to what it is, if it is not the CSS. **Here is get_theme_mods()**                function my_get_theme_mods() {     $defaults = array(               'my_hero_title'                 => '',         'my_hero_description'           => '',               'my_hero_background_color'      => '#17649a',         'my_hero_background_image'      => '',         'my_hero_background_repeat'     => 'no-repeat',         'my_hero_background_position'   => 'center',                 'my_footer_color'               => '#f7f7f7',     );          return $defaults;


Wordpress tags select

I want change the default Wordpress tag feature to something different. 1\. Create two types of tags- 'Parent' Tags and 'Child' Tags. To make it clear, Say, the parent tags are Fruits, Animals, asian countries, etc. The child tag will contain apple, cow, mango, nepal, america, lion, and many more.... How can I make a taxonomy to select these tags inside wordpress and create two fields to select the tags- one for the parent tags and the other for the child tags. And, if only one type of 'parent' tag is selected, child tags of only that parent tag could be added.


Wordpress not showing full text in feed

I have been reading around and I cannot figure out why (even with the full text option checked in settings) that my feed will only display excerpts of posts instead of full posts. Any ideas? here is the link - http://lynchbryan.com/feed


Capturing POST data

I am trying to modify the Member Status Plugin so that the status are based on the data saved on a custom database table. Basically I wanted to change the administration menu with a form that can manually update the data saved in the database. I noticed the current form is pointing to /wp-admin/options.php but im very new to WP (2 days) and not sure why it is so. How can I direct the form to pass it to the plugin instead so I can update the data on the table? I am assuming once I can do that I can only use AJAX to do the same thing, am I right on this?


wp-cron: freeze at "now"

sorry for the silly question. Briefly I have a wp (v. 3.5.1) blog using a heavily modified (by myself) theme. Everything works fine except for wp-cron. Listed jobs appears in (for instance) crontrol and time passes until they come to "now" (which means that the job should start). Anyway nothing happens: scheduled post freeze at "now", my custom functions freeze at "now" and so on. Everything works if I manually run it (so no code problems). I tried to disable wp-cron (with `define('DISABLE_WP_CRON', true);` and set up a custom wp-cron (with its crontab entry) but without success. Finally I get the following error message: > There was a problem spawning a call to the WP-Cron system on your site. This > means WP-Cron jobs on your site may not work. The problem was: connect() > timed out! which disappear if I set `define('ALTERNATE_WP_CRON',true);`. Thanks in advance for the help...


wp_commentdata: error in documentation?

The page http://codex.wordpress.org/Database_Description#Table:_wp_commentmeta lists the meta_id field of the `wp_commentdata` table as being both `PRIMARY KEY` and `DEFAULT NULL`. But a primary key cannot be null, not even in MySQL, AFAIK, as running the following code in phpmyadmin confirms:               CREATE TABLE Baz (x bigint unsigned primary key default null);          #1067 - Invalid default value for 'x'       So, is there an error in the documentation? Thanks.


the_content inside my own theme does not retain line breaks / enters like in the admin

Ok, I tried everything. the_content, get_the_content, filters, disabling plugins, Chtulu. Nothing. In my own theme, the content retains the format given in the admin editor (like bold, italic, justify...) but not line breaks. The text is "all together", all "attached". I can't "detach" subtitles from the paragraph, for example. What should I look for?


illegal offset in option add

I downloaded a plugin to dissect that I could use to learn the settings api with. It's a simple background uploader and as you can see fairly straight forward. When trying to recreate it however using my own set of options I almost always run into an illegal offset warning. After reading up on the issue the problem seems to be rooted in the option not being defined as an array and thus not recognizing the 'image' key. My question, with this code working absolutely fine, where within this script does it define the option as a usable array? I write what appears to be exactly the same thing, only changing the option names, and keep getting an illegal offset warning.

Full Screen Background Image
             <?php             if ( ! isset( $_REQUEST['updated'] ) )                 $_REQUEST['updated'] = false;             ?>             <?php if ( false !== $_REQUEST['updated'] ) : ?>}

<?php _e( 'Options saved' ); ?>

             <?php endif; ?>             <form method="post" action="options.php">                      <?php settings_fields( 'fsb_register_settings_4' ); ?>
Choose Your Image

                     <input id="fsb_settings_4[image]" name="fsb_settings_4[image]" type="text" class="upload_field" value="<?php echo $fsb_options['image']; ?>"/>                     <input class="upload_image_button button-secondary" type="button" value="Choose Image"/>                     <?php _e( 'This image will be applied to the background of your website' ); ?>

                     <?php if($fsb_options['image']) { ?>                         <img src="<?php echo $fsb_options['image']; ?>" id="fsb_preview_image" style="padding: 3px; border: 1px solid #f0f0f0; max-width: 600px; overflow: hidden;"/>                     <?php } else { ?>                         <img src="<?php echo plugin_dir_url( __FILE__ ) . 'preview.jpg'; ?>" id="fsb_preview_image" style="padding: 3px; border: 1px solid #f0f0f0; max-width: 600px; overflow: hidden;"/>                     <?php } ?>

                     <input type="submit" class="button-primary" value="<?php _e( 'Save Options' ); ?>" />
<?php echo esc_url( $fsb_options['image'] ) ?>

                       </form>

     <?php                 }     function fsb_init_admin() {     add_menu_page( 'General Settings', 'General Settings', 'administrator',   'display-      settings', 'fsb_admin_page' );     }     add_action('admin_menu', 'fsb_init_admin');          // register the plugin settings     function fsb_register_settings() {     register_setting( 'fsb_register_settings_4', 'fsb_settings_4' );     }     add_action( 'admin_init', 'fsb_register_settings' );


Save Custom Fields

I am working in a new project using WordPress. I have created some Custom Posts and now I have to relate some custom posts like categories. I created a custom dropdown menu inside the custom posts. The dropdown displays the title of the customs post but I don´t know how to save them. Here is my code:               /* add custom field to my customo post */          add_action('admin_menu', 'related_post_options_box');          function related_post_options_box() {     add_meta_box('post_info', 'Related Information', 'related_post_info', 'related', 'side', 'high');     }          function related_post_info() {     global $post;     /* List the posts*/         query_posts( array('post_type' => array( 'related', 'produktkrav', 'filtreringskriterie' )));             echo '<select name="related" id="related" multiple>'.              '<option value="" selected="selected">Select a post</option>';             while ( have_posts() ) : the_post();     echo '<option value="';             the_permalink();             echo '">';             the_title();             echo '</option>';         endwhile;              echo '</select>';     }      I would like to use the function save_post but I don´t know how. Of course, the dropdown has to allow multiple selection.


Get a list of existing transients

I have been using transients a lot in WordPress since I discovered them, however to ensure my sites update properly when a post is edited or created I added a function to delete transients on post save. This works great however I need to keep a list of all the transients I create throughout the site and then mention each one by name in my function. This is especially troublesome when I name the transients automatically, for example some transients are named based on their post title. Is there a way in WordPress to get a list of all the transients currently created on the site? I'd like to clear them all on post save. I'd like to do this whilst avoiding directly deleting the database entries (ie I'd like to use the delete_transient() function rather than just delete all the transients directly in the database).


I'm getting a really cryptic error and I'm not sure where to begin. The site (http://www.petcercise.com/) works fine, but when I attempt to go to /wp-admin/ I get the following error: > Fatal error: Exception thrown without a stack frame in Unknown on line 0 I've googled it and searched the Worpress support site. This error seems to be commonly associated with new plugins, but I have not recently installed any new plugins on this site. I have two questions:   1. How do I go about diagnosing the root cause?   2. How do I go about recovering from this error if I can't diagnose the problem?


Is there a decent private message plugin for Wordpress?

I've tried Private Messages for Wordpress, but are there any alternatives?


Why Better WP security plugin returns 418 I'm a Teapot "error"?

I am working on the Wordpress website and all of a sudden after deploying it on the server, I started seeing a problem where some of the pages on my website return `418 I'm a Teapot` as Response status and error as content. After going through a few posts on **HTCPC Protocol** and blogs on the same problem. I figured that it has something to do with plugin **Better WP Security** , which I recently installed on my Wordpress site also I found following code in `inc/secure.php` file under plugin code, responsible to return that response.               $bwpsmemlimit = (int) ini_get( 'memory_limit' )           //if they're locked out or banned die     if ( ( $bwpsoptions['id_enabled'] == 1 || $bwpsoptions['ll_enabled'] == 1 ) &&           $this->checklock( $current_user->user_login ) ) {          wp_clear_auth_cookie();     @header( 'HTTP/1.0 418 I\'m a teapot' );     @header( 'Cache-Control: no-cache, must-revalidate' );      @header( 'Expires: Thu, 22 Jun 1978 00:28:00 GMT' );     die( __( 'error', $this->hook ) );          }      But as I am new to Wordpress and PHP. So I am Not able to figure out, what exactly is going wrong there. I also checked solution of problem given here, which says "It is mainly because of ftp transfer to server from local network" but I doubt its the case here as I can see that the problem persists even though we access website from different Network IPs, which were Not used in website deployment process. > One **Temporary solution** that I found for the problem was, to delete > lockout entries from Wordpress database table `<wp-prefix>_bwps_lockouts` > (e.g. wp_bwps_lockouts) for your IP-Adress. Using this table, Better WP > Security plugin locks the user IP for some duration (typically 15 mins). It will be very helpful to get an idea on Why **Better WP Security** plugin does this. So that we can take necessary steps to prevent this in future.


Fetch Data from other website in wordpress (screen scraping)

I have 1 really challenging question. I would like to fetch some product info from another website (our sister website) by just inputting product ids in my editor. So for example lets say I enter DR490, DR508 in my post editor and publish the post. Now I would like to fetch data from following URL http://isabellaoliver.com/DR490 and http://isabellaoliver.com/DR508 and I would like to fetch some selected content from those webpage, content such as Product name, Product price, product image etc. and would like to display it on our magazine . I would also like to style the fetched content according to my convinence. Now the Question is "Is it possible ?" if Yes "Than How ? " Thanks a lot in advance !


Favicon storage - which folder should be used?

This question is not technical but rather "ideological" - where in WP should favicon be stored (in "correct" way)? Should it be in the root (where wp- config.php) is stored OR should it be in current theme's folder? Or should 2 copies be kept (which I don't want to do)? I know, either way will work and will result in no errors but I'd like to know better/correct/more semantical, etc. way.


How do I know which plugin uses the most resource?

After installing several new plugins I discovered my site is getting slower. Is there a way to know which plugin utilizes the most resource without using the obvious method of activating/deactivating each plugin one by one?


Comments are assigned to wrong or related post

This issue is driving me nuts since weeks :(( Please help me. The comments are assigned to related posts and are visible on other posts also. For ex. The page redirects to post "Sports" when I post the comment on "Food" But the same comment is visible on all the other posts like "Tours", "News" etc., Most likely, the comment is assigned to the last "related post" To be more clear: Sports Page | V Related Posts - News, Tours, Food Now, the comment goes to the post "Food" here's the code               <?php get_header(); ?>                  <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                  <?php              $image1 = get_post_meta(get_the_ID(), 'tz_upload_image', true);             $image2 = get_post_meta(get_the_ID(), 'tz_upload_image2', true);             $image3 = get_post_meta(get_the_ID(), 'tz_upload_image3', true);             $image4 = get_post_meta(get_the_ID(), 'tz_upload_image4', true);             $image5 = get_post_meta(get_the_ID(), 'tz_upload_image5', true);             $image6 = get_post_meta(get_the_ID(), 'tz_upload_image6', true);             $image7 = get_post_meta(get_the_ID(), 'tz_upload_image7', true);             $image8 = get_post_meta(get_the_ID(), 'tz_upload_image8', true);             $image9 = get_post_meta(get_the_ID(), 'tz_upload_image9', true);             $image10 = get_post_meta(get_the_ID(), 'tz_upload_image10', true);             $folder_name = get_post_meta(get_the_ID(), 'folder_name', true);             $product_name = get_post_meta(get_the_ID(), 'product_name', true);             $product_id = get_post_meta(get_the_ID(), 'product_id', true);                  $comingSoonButton = "";                  $downloadButton = "";                  $buyButtonImage = "http://www.appdesignvault.com/images/site/red-button/buy-this-theme-slash.png";             if($product_id == 22)             {                 $buyButtonImage = "http://www.appdesignvault.com/images/site/buy-now-49.png";             }                  $themeLinkNoMember = '<form name="PaymentForm" method="post" action="http://www.appdesignvault.com/dap/paypalCoupon.php">             <input type="hidden" name="cmd" value="_xclick"/>             <input type="hidden" name="currency_code" value="USD" />             <input type="hidden" name="item_name" value="'.$product_name.'" />
<input class="trans" type="image" src="'. $buyButtonImage. '" border="0" name="submit" alt="Make payments with PayPal - its fast, free and secure!" />
             </form>';                       $themeLink = ''.$downloadButton.'';                       $accessText = 'userhasccess';             $accessShortCode = '[DAP hasAccessTo="'. $product_id .'"]'.$accessText.'[/DAP]';                  $attributes = array('isloggedin' => 'Y', 'errmsgtemplate' => 'Log in or Join');                  if($product_id == 0)             {                 $dlLink = $comingSoonButton;             }             else             {                 $accessContent = dap_shortcode($attributes, $accessShortCode);                      if(strpos($accessContent, $accessText) == true)                 {                     $dlLink = $themeLink;                 }                 else                 {                     $dlLink = $themeLinkNoMember;                            }             }                  ?>

                         <?php                             echo $dlLink;                         ?>
                          <?php $terms = get_the_terms( get_the_ID(), 'skill-type' ); ?>                     <?php $product_price = $product_id == 22 ? '$49' : '$70'; ?>                          <?php if ($product_id == 22){ echo "
Offer ends: 12th Jan 2012.
" ;} ?>

                             <?php echo $product_price; ?>

<?php _e('Features:', 'framework'); ?>

 Sample Project

 Retina (@2x) files

 iOS 5 compatible

 .PSD files

 PNG Artwork

<?php _e('Vault Tags:', 'framework'); ?>

                                 <?php foreach ($terms as $term) :  ?>
<?php echo $term->name; ?>
                                 <?php endforeach; ?>

                         <?php if(0){ ?>                         <?php if(function_exists('dd_digg_generate')){dd_google1_generate('Normal');} ?>                         <?php if(function_exists('dd_digg_generate')){dd_twitter_generate('Normal','emityme');} ?>                         <?php if(function_exists('dd_digg_generate')){dd_fblike_generate('Like Box Count');} ?>                         <?php if(function_exists('dd_digg_generate')){dd_digg_generate('Normal');} ?>                         <?php }?>

                                                       <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">                                  <?php                              $add_info = get_post_meta(get_the_ID(), 'tz_additional_info', true);                              $video_url = get_post_meta(get_the_ID(), 'tz_video_url', true);                             $embeded_code = get_post_meta(get_the_ID(), 'tz_embed_code', true);                             ?>                                  <?php if($video_url !='' || $embeded_code != '') : ?>
                                      <?php if($add_info != '') : ?>
                                     <?php echo stripslashes(htmlspecialchars_decode($add_info)); ?>
                                                                  <?php endif; ?>
                                          <?php tz_video(get_the_ID()); ?>

                                  <?php endif; ?>                                  <?php if(get_post_meta(get_the_ID(), 'tz_portfolio_enable_slider', true) == 'yes') : ?>

                                          <?php                                      if($image1 != '') :                                              $height = get_post_meta(get_the_ID(), 'tz_image1_height', true);                                              if($height == '') :                                                  $height = getimagesize($image1);                                             $height = $height[1];                                              endif;                                          endif;                                     ?>
<img width="696" height="<?php echo $height; ?>" src="<?php echo $image1; ?>" alt="<?php the_title(); ?>">
                                     <?php if($image2 != '') : ?>
<img width="696" src="<?php echo $image2; ?>" alt="<?php the_title(); ?>">
                                     <?php endif; ?>                                     <?php if($image3 != '') : ?>
<img width="696" src="<?php echo $image3; ?>" alt="<?php the_title(); ?>">
                                     <?php endif; ?>                                     <?php if($image4 != '') : ?>
<img width="696" src="<?php echo $image4; ?>" alt="<?php the_title(); ?>">
                                     <?php endif; ?>                                     <?php if($image5 != '') : ?>
<img width="696" src="<?php echo $image5; ?>" alt="<?php the_title(); ?>">
                                     <?php endif; ?>                                     <?php if($image6 != '') : ?>
<img width="696" src="<?php echo $image6; ?>" alt="<?php the_title(); ?>">
                                     <?php endif; ?>                                     <?php if($image7 != '') : ?>
<img width="696" src="<?php echo $image7; ?>" alt="<?php the_title(); ?>">
                                     <?php endif; ?>                                     <?php if($image8 != '') : ?>
<img width="696" src="<?php echo $image8; ?>" alt="<?php the_title(); ?>">
                                     <?php endif; ?>                                     <?php if($image9 != '') : ?>
<img width="696" src="<?php echo $image9; ?>" alt="<?php the_title(); ?>">
                                     <?php endif; ?>                                     <?php if($image10 != '') : ?>
<img width="696" src="<?php echo $image10; ?>" alt="<?php the_title(); ?>">
                                     <?php endif; ?>
                                      <?php if($image2 != '' && get_post_meta(get_the_ID(), 'tz_portfolio_enable_slider', true) == 'yes') : ?>

                                                  <?php if($image2 != '') : ?>

                                             <?php endif; ?>                                             <?php if($image3 != '') : ?>

                                             <?php endif; ?>                                             <?php if($image4 != '') : ?>

                                             <?php endif; ?>                                             <?php if($image5 != '') : ?>

                                             <?php endif; ?>                                             <?php if($image6 != '') : ?>

                                             <?php endif; ?>                                             <?php if($image7 != '') : ?>

                                             <?php endif; ?>                                             <?php if($image8 != '') : ?>

                                             <?php endif; ?>                                             <?php if($image9 != '') : ?>

                                             <?php endif; ?>                                             <?php if($image10 != '') : ?>

                                             <?php endif; ?>

previous

next

                                 <?php endif; ?>
                             <?php else: ?>                                  <?php                              if($image1 != '') : ?>
<img width="696" src="<?php echo $image1; ?>" alt="<?php the_title(); ?>">
                             <?php endif; ?>                             <?php if($image2 != '') : ?>
<img width="696" src="<?php echo $image2; ?>" alt="<?php the_title(); ?>">
                             <?php endif; ?>                             <?php if($image3 != '') : ?>
<img width="696" src="<?php echo $image3; ?>" alt="<?php the_title(); ?>">
                             <?php endif; ?>                             <?php if($image4 != '') : ?>
<img width="696" src="<?php echo $image4; ?>" alt="<?php the_title(); ?>">
                             <?php endif; ?>                             <?php if($image5 != '') : ?>
<img width="696" src="<?php echo $image5; ?>" alt="<?php the_title(); ?>">
                             <?php endif; ?>                             <?php if($image6 != '') : ?>
<img width="696" src="<?php echo $image6; ?>" alt="<?php the_title(); ?>">
                             <?php endif; ?>                             <?php if($image7 != '') : ?>
<img width="696" src="<?php echo $image7; ?>" alt="<?php the_title(); ?>">
                             <?php endif; ?>                             <?php if($image8 != '') : ?>
<img width="696" src="<?php echo $image8; ?>" alt="<?php the_title(); ?>">
                             <?php endif; ?>                             <?php if($image9 != '') : ?>
<img width="696" src="<?php echo $image9; ?>" alt="<?php the_title(); ?>">
                             <?php endif; ?>                             <?php if($image20 != '') : ?>
<img width="696" src="<?php echo $image10; ?>" alt="<?php the_title(); ?>">
                             <?php endif; ?>                                  <?php endif; ?>

                             <?php the_content(); ?>

<?php echo stripslashes(get_option('tz_related_portfolio_title')); ?>

                         <?php echo stripslashes(get_option('tz_related_portfolio_description')); ?>

                              <?php global $post;                                $postId = $post->ID;                               $query = get_posts_related_by_taxonomy($post->ID, 'skill-type');?>                                   <?php if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();                               $terms = get_the_terms( get_the_ID(), 'skill-type' );  ?>                               <?php if(get_the_ID() != $postId) : ?>
                                                               <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">                                         <?php /* if the post has a WP 2.9+ Thumbnail */                                 if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) { ?>
                                     <?php tz_lightbox(get_the_ID(), TRUE); ?>
                                 <?php } ?>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'framework'), get_the_title()); ?>"> <?php the_title(); ?> <?php edit_post_link( __('edit', 'framework'), '[', ']' ); ?>

                                          <?php /*the_excerpt();*/ ?>                                     <a href="<?php the_permalink(); ?>" class="more-link"><?php _e('Read more...', 'framework'); ?>

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

                  <?php comments_template('', true); ?>                  <?php endwhile; endif; ?>             <?php wp_reset_query(); ?>      Thanks a lot in advance :-)


Failed to import media from a local wordpress site to a live one

I've been developing a new blog theme for a client locally on my computer and am now in the process of uploading this to the new live server. I used the wordpress export facility to export all the content from the local site and then went into the live installation and used the import facility - I checked the boxed the referred to file attachments - but no media gets imported onto the live blog. I've got about 255 posts and don't fancy having to go in and set the featured image manually for each and every post. Am I doing something wrong? Is there a way I can upload all the media easily?


calling categories in a custom post type

I'm creating a custom post type by adding the add_action( 'init', 'create_radiotalks' ); text to the functions.php page:               add_action( 'init', 'create_radiotalks' );          function create_radiotalks() {         register_post_type( 'radiotalks',             array(                 'labels' => array(                 'name' => __( 'Radio Talks' ),                 'singular_name' => __( 'Radio Talk' ),                 'add_new' => __( 'Add New' ),                 'add_new_item' => __( 'Add New Radio Talk' ),                 'edit' => __( 'Edit' ),                 'edit_item' => __( 'Edit Radio Talk' ),                 'new_item' => __( 'New Radio Talk' ),                 'view' => __( 'View Radio Talk' ),                 'view_item' => __( 'View Radio Talk' ),                 'search_items' => __( 'Search Radio Talks' ),                 'not_found' => __( 'No radio talks found' ),                 'not_found_in_trash' => __( 'No radio talks found in Trash' ),                 'parent' => __( 'Parent Radio Talk' ),     ),                 'public' => true,             )         );     }      when entering the add new radio talk info, I would like to add the applicable categories and tags, but they do not show up in the admin side bar? How do I make the categories/tags available to my custom post type? thanks for your help. -don


How to split authors?

I have 3 authors, each of us talk about the same subject but in a different mind/opinion. I want to have 3 pages for each of us and show ONLY the posts for each author one them. Like have a page called AuthorOne that has only the first authors posts, etc. How can I do this?


wp-pagenavi only showing first page

I'm trying to get pagination to work, I get the nav tools to show, but when i click to move to the next page it loads the first page every time. Here's the code:               <?php $args = array(                         'post_type' => 'page',                         'orderby' => 'title',                         'order' => 'ASC',                         'posts_per_page' => 5,                         'paged' => get_query_var('page'),                         'post_parent' => $parent                     ); ?>               <?php query_posts($args); ?>                    <?php if ( have_posts() ) : ?>                   <?php while ( have_posts() ) : the_post(); ?>                       //get the desired custom field values                    <?php endwhile; ?>               <?php endif; ?>             </div>                  <!-- navigation goes here -->             <div class="naviButs">                 <?php wp_pagenavi(); ?>             </div>      Please if anyone can assist? Or maybe knows workaround?   Thanks in advance!


Limit a meta box to a specific category

I'm trying to limit a meta_box to posts in a specific category. I'm using this method: http://www.farinspace.com/page-specific-wordpress-meta-box/ and it works rather well But I can't seem to get it to work with categories. Heres' my code:               <?php      // meta box for news category     add_action('admin_init','news_init');          function news_init(){              $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;              $post = get_post($post_id);              if ($post->post_category == '6'){         add_meta_box('news_details', 'News Details', 'news_details', 'post');         }     }     ?>      I feel like I'm missing a step. Thoughts or ideas? Thank you, Nadine


Plugin Handle URL With Custom Theme

I need to develop a plugin in which a special page needs to be created. This page will have a completely separate design from the rest of the website, and will be located at a specific URL. I realize short codes are the "proper" way for a plugin to run itself on a page, but how would I go about actually over-riding the entire theme of the page and replace it with my own content? In this case, since it's a single page, I don't want to actually create an entire Wordpress theme-- I just need to be able to essentially start from a blank slate and I can just use my own HTML from there.


Alternative to simple fields plugin?

I have been building websites with WordPress for a couple years now, and have become very reliant on the Simple Fields Plugin. Essentially this plugin lets me attach extra fields to the bottom of my "edit" pages; for example: repeatable image upload fields, extra text fields, etc... This plugin is currently out-of-date and does not work properly with WP 3.3. I have seen a few other similar plugins - but many aren't free - or don't offer the 'repeatable' aspect I seem to need so often. My _real_ question is how do the big-boys in the field approach this kind of thing. Would you use a plugin, or is this something I should do custom on a per-site basis (like creating custom post-types). Or should I be taking a different approach to the back-end altogether. For example, if I were building a footer 'page' and I wanted the edit page to:   * have a section to upload different images and associate them with links.   * have fields for phone number, fax, address, etc...   * have another 'repeatable' field of links   * other repeatable text fields Sorry for being long-winded, and thank you! **edit** : just checked out Magic Fields - I love it except that it doesn't allow you to choose apply the fields to a specific post-ID - just a specific post type.


Display post from specific date

How do I display posts by a specific date? If it is 15 July today, it'll display posts from about two or three days ago, like the 12th of July's posts. And tomorrow it'll display the 13th of July's post. How can I achieve this?


is_category() in pre_get_posts strange error

I have a function that sets posts_per_page option depending on the category viewed. I discovered and error which I can't really understand: first this is how I get the error:               function custom_posts_per_page($query) {              if ( !is_admin() && is_category(4)) {              // Leaving this empty or with content              }          }          add_filter( 'pre_get_posts', 'custom_posts_per_page' );      So I get an error there if WP_Debug is turn to true and when I access a non- exixting category. So if I enter `http://localhost/zz/category/uncategorized` there is no problem but if I enter for example `http://localhost/zz/category/aaaaaaaa` (Category aaaaaaaa doesn't exist), It gets correctly to the 404 page but throws these errors:               Notice:  Trying to get property of non-object in C:\xampp\htdocs\zz\wp-includes\query.php on line 3420     Notice:  Trying to get property of non-object in C:\xampp\htdocs\zz\wp-includes\query.php on line 3422     Notice:  Trying to get property of non-object in C:\xampp\htdocs\zz\wp-includes\query.php on line 3424      What is wrong?


return custom taxonomy terms in post object

How would I go about returning the custom taxonomies in the post object with WP Query or with get_posts for that matter. yes, I know I can loop over my query and use get_terms or a number of other functions but for what I'm doing, this generates too many queries. I'd rather have all the data stored in one object/array and work with that.


jQuery Autocomplete not working with wp_localize_script

Bit of background: I am building an autocompleting-search box for a list of Trades (a Custom Taxonomy). I asked this question and very helpfully got a much better understanding of how WordPress and AJAX work together (Thanks G.M)! However, he said that I should use `wp_localize_script` so that the PHP isn't accessible on the front-end. I knew about this function but had never used it so with a bit of reluctance I got stuck in. I found this post which also had an incredibly useful explanation of how WordPress and AJAX work together. I implemented that code provided by Stephen Harris, but I've got an error in my console, whenever I search for anything in the search bar: `TypeError: '["Accountants","Electricians","Painters","Plumbers"]' is not a valid argument for 'in' (evaluating 'b-1 in a')` and here is my PHP code:               wp_enqueue_script("autocomplete", get_template_directory_uri() . '/assets/js/autocomplete.js', array( 'jquery', 'jquery-form', 'json2' ), false, true );     wp_localize_script("autocomplete", "MyAjax_object", array(         'ajaxurl' => admin_url( 'admin-ajax.php' ),         'myajax_nonce' => wp_create_nonce( 'myajax_nonce_val' ),         'action' => 'myajax-submit'     ));     function get_my_suggestions() {         // This function should query the database and get results as an array of rows:         // GET the recieved data: 'term' (what has been typed by the user)         $term = $_GET['term'];         $trades = get_terms( 'trade', array( 'fields' => 'names' ) );         $tradesList = '["' . implode( '","', $trades ) . '"]';              // echo JSON to page  and exit.         $response = $_GET["callback"]."(". json_encode($tradesList) .")";           echo $response;           exit;     }     add_action( 'wp_ajax_myajax-submit', 'get_my_suggestions' );      and JavaScript:               $(document).ready(function() {         $(".main-search-field").autocomplete({         source: function( request, response ) {                   jQuery.getJSON( MyAjax_object.ajaxurl + "?callback=?&action=myajax-submit", request, function( data ) {                     response( jQuery.map( data, function( item ) {                         jQuery.each( item, function( i, val ) {                             val.label = val.whatever; // build result for autocomplete from suggestion array data                         } );                         return item;                     } ) );                 } );               },              minLength: 1,             appendTo: ".search-container"         });      });      Does anyone know why I get that error? The JavaScript loads fine - it adds in the markup for the suggestions list, but it's empty. Also, I've noticed that whenever I search for something in the input box, a class, `ui-autocomplete- loading` is added to the input box. Not sure if that's important but it might help someone out. Thanks for any help :)