title: How to use HyperDB plugin in a existing wpmu

text: I am using wordpress multisite v3.5.1 in a single db called `maindb`. And i have also 5 blog. They are **bazar** (main blog), **demo1** , **demo2** , **demo3** and **demo4**. In future i want add more blog but i want to create a database for each blog and want to use them(but also in a single network). as like **maindb** for **bazar** (main blog) blog, **db1** for **demo1** blog, **db2** for **demo2** blog, **db3** for **demo3** blog, **db4** for **demo4** blog ... How i do that with **hyperdb**? how would `db-config.php` code will be look like for my this condition? please help me.


title: Display custom fields in frontside user profile

text: I installed the `CIMY User Extra Fields` plugin to add new custom fields in theuser profile. I added 1 custom field for gender to the user profile but it displays only in the admin panel user profile. How to display on the front side registered user profile page? Have any one idea.. Please send me step by step because new in WordPress.


title: Mamp pro permalink issues. Pages keep reverting to index.php

text: So I pulled a site down to my local machine to do some work on it. Copied the files, find/replace on the database to update the url, added a host. Everything worked fine until I changed the permalink settings. Now every page uses the index.php template in my theme folder instead of the page.php. Of course it works fine when you use the default settings, but not any others that require htaccess directives. I have tried everything I can think of including changing the AllowOverride None to All in the httpd.conf. Anyone else have any ideas? I am at a complete and frustrated loss. Edit: Here is my htaccess file:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>     # END WordPress


title: override function from my plugin

text: can anyone guide me how can I override following function from my plugin. I know how to use add_action but I didn't found add_action for this function in buddypress plugin. Its using do_action and I am not sure how to get it working               function groups_screen_group_request_membership() {     global $bp;          if ( !is_user_logged_in() )         return false;          $bp = buddypress();          if ( 'private' != $bp->groups->current_group->status )         return false;          // If the user is already invited, accept invitation     if ( groups_check_user_has_invite( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) {         if ( groups_accept_invite( bp_loggedin_user_id(), $bp->groups->current_group->id ) )             bp_core_add_message( __( 'Group invite accepted', 'buddypress' ) );         else             bp_core_add_message( __( 'There was an error accepting the group invitation, please try again.', 'buddypress' ), 'error' );         bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );     }          // If the user has submitted a request, send it.     if ( isset( $_POST['group-request-send']) ) {              // Check the nonce         if ( !check_admin_referer( 'groups_request_membership' ) )             return false;              if ( !groups_send_membership_request( bp_loggedin_user_id(), $bp->groups->current_group->id ) ) {             bp_core_add_message( __( 'There was an error sending your group membership request, please try again.', 'buddypress' ), 'error' );         } else {             bp_core_add_message( __( 'Your membership request was sent to the group administrator successfully. You will be notified when the group administrator responds to your request.', 'buddypress' ) );         }         bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) );     }          do_action( 'groups_screen_group_request_membership', $bp->groups->current_group->id );          bp_core_load_template( apply_filters( 'groups_template_group_request_membership', 'groups/single/home' ) );      }


title: How to set ckeditor to VISUAL mode by default instead of HTML mode in bbpress

text: I've just installed bbpress and ckeditor. I have only these plugins activated and my theme is twenty twelve. So when in the blog part, I mean the main page and such, ckeditor works perfectly. This in the sense that all the editor box is shown in visual mode. In this part there is no button to work with HTML code, which is perfect for my purposes. But then the problem is when I go into the forums part and try to make a comment or to make a new post because it seems that there's no editor there. There's no box, no cursor bar, and no ck editor buttons. I've been looking all over the internet and I just found that I need to add a snipet code to my functions theme. http://codex.bbpress.org/enable-visual-editor/               function bbp_enable_visual_editor( $args = array() ) {     $args['tinymce'] = true;     return $args; }     add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );      The problem now is that I have just two buttons, one for VISUAL mode and the other one for HTML code, but still no buttons, no cursor bar, no anything. When I press the button for visual mode then it appears the editor as it should be. But this is almost the same because we always expect to have visual mode by default, just like the one I'm using right now to make this question. So the problem is that people would always think that there is no editor, or even if they know about it I think it's just wrong. How can I fix this problem? This is how it looks in the blog part, by default and I like to have it also in the forums: ![enter image description here](http://i.stack.imgur.com/WrBD7.jpg) This is how it looks in the forums editor, without the snipet code: ![enter image description here](http://i.stack.imgur.com/9at37.jpg) And this is how it looks after the snipet code. ![enter image description here](http://i.stack.imgur.com/5NVj8.jpg)


title: How to access the actual input html of the login form

text: I'm designing a custom login template and I need a way to access the `<input>` html so I can add a label inside the input. I understand the use of `wp_login_form()` but that only lets me set the default lables outside the input to blank. I need to add the `onfocus` and `onblur` attributes to the html. Any ideas?


title: How to display user's nickname by default instead of username

text: I need to display the user's nickname by default after they are created in the DB, NOT the username. I am creating a user with:                   wp_create_user( $user_name, $random_password, $user_email );      updating the user nickname field directly after user creation:                   update_user_meta($user_id, 'nickname', $user_nickName);      Now i need the "Display name publicly as" to be set to the nickname as default not the username. My WP is automatically defaulting the users display name as the username. How do i put the selected value for the display name(Display name publicly as) as my nickname value programmatically?


title: Importing images from blogspot to wordpress

text: The import process is easy enough and everything is imported correctly. The one thing I can't figure out is how to change what size image gets imported into the posts. The image that gets imported is the right size, but it always selects the smallest size image to insert into the post and I need the largest size (or the size that was selected in blogspot, either would work). I just don't want to go back through hundreds of images and replace them. Does anyone know how to import the images in such a way?


title: Adjust the order for returned posts

text:
I have written a neat responsive slider for my Wordpress featured articles (feel free to use it):               <?php          $responsive = 'on' != get_option('henrik_responsive_layout') ? false : true;         $featured_auto_class = '';         if ( 'on' == get_option('henrik_slider_auto') ) $featured_auto_class .= ' et_slider_auto et_slider_speed_' . get_option('henrik_slider_autospeed');     ?>     <div id="featured" class="<?php if ( $responsive ) echo 'flexslider' . $featured_auto_class; else echo 'et_cycle'; ?>">         <?php esc_html_e('Previous','henrik'); ?>         <?php esc_html_e('Next','henrik'); ?>          <?php if ( $responsive ) { ?>
     <?php } else { ?>
     <?php } ?>             <?php global $ids;             $ids = array();             $arr = array();             $i=0;                  $featured_cat = get_option('henrik_feat_cat');              $featured_num = (int) get_option('henrik_featured_num');                   if (get_option('henrik_use_pages') == 'false') query_posts("showposts=$featured_num&cat=".get_cat_ID($featured_cat));             else {                 global $pages_number;                      if (get_option('henrik_feat_pages') <> '') $featured_num = count(get_option('henrik_feat_pages'));                 else $featured_num = $pages_number;                      query_posts(array                                 ('post_type' => 'page',                                 'orderby' => 'menu_order',                                 'order' => 'ASC',                                 'post__in' => (array) get_option('henrik_feat_pages'),                                 'showposts' => (int) $featured_num                             ));             } ?>             <?php if (have_posts()) : while (have_posts()) : the_post();             global $post; ?>             <?php if ( $responsive ) { ?>
             <?php } else { ?>
             <?php } ?>                     <?php                     $width = $responsive ? 960 : 958;                     $height = 340;                     $small_width = 95;                     $small_height = 54;                     $titletext = get_the_title();                          $thumbnail = get_thumbnail($width,$height,'',$titletext,$titletext,false,'Featured');                          $arr[$i]['thumbnail'] = get_thumbnail($small_width,$small_height,'',$titletext,$titletext,false,'Small');                     $arr[$i]['titletext'] = $titletext;                          $thumb = $thumbnail["thumb"];                     print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, ''); ?>

<?php esc_html_e('Posted','henrik'); ?> <?php esc_html_e('by','henrik'); ?> <?php the_author_posts_link(); ?> <?php esc_html_e('on','henrik'); ?> <?php the_time(esc_attr(get_option('henrik_date_format'))) ?>

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

<?php truncate_post(410); ?>

                         <a href="<?php the_permalink(); ?>" class="readmore"><?php esc_html_e('Read More', 'henrik'); ?>
              <?php if ( $responsive ) { ?>
              <?php } else { ?>
              <?php } ?>             <?php $ids[] = $post->ID; $i++; endwhile; endif; wp_reset_query(); ?>     <?php if ( $responsive ) { ?>
      <?php } else { ?>
      <?php } ?>

             <?php for ($i = 0; $i < $featured_num; $i++) { ?>

                         <a href="#"<?php if ( $i == 0 ) echo ' class="active"'; ?>>                             <?php print_thumbnail( $arr[$i]['thumbnail']['thumb'], $arr[$i]['thumbnail']["use_timthumb"], $arr[$i]['titletext'], $small_width, $small_height ); ?>

             <?php } ?>

       It selects a custom category and returns a custom amount of posts. The problem is that it will display the posts in the order of which they were created. **I want to choose my own order** , so that I can select which posts displays first and so on. **So, is it possible to select which order the returned posts are displayed?** Maybe by targeting specific IDs? Ideally, I would like to set a custom ID (directly in the code) for the first post, and then have the rest display in the returned order as it is. Is that possible? If you choose to reply, please be detailed with code example, thank you for reading.


title: Correctly delete posts with meta and attachments

text: I am having an overview of custom post types: http://www.citizen-science.at/wordpress/projekte/roadkill/ubersicht/ These have custom tax and also an attachment. In my overview I need to provide links to delete the entries. With that I also need to delete the attachment and the meta data. I was using this:                   if ( !current_user_can( 'delete_bkroadkill', $post->ID ) )             return;              $link = "ID, 'delete-post_' . $post->ID) . "'>".$link."";         echo $before . $link . $after;      I found Delete Post Link to delete post, its meta and attachments but there is no solution provided. Which will not delete anything else than the post. What is the proper way to do this?


title: Paginate product variations during product edit

text: I have a client who has a large number of variation for some products which is causing admin to hang when editing any of the affected products. I have increased max_input_vars to 5000 but this didn't have any effect. I saw this code in github (I have asked Alex but no answer)               $paged = ($_GET['paged']) ? $_GET['paged'] : 1;                 $args = array(                     'orderby'        => 'ID',                     'order'            => 'asc',                     'post_type'        => 'product_variation',                     'post_status'   => array( 'private', 'publish' ),                     'numberposts'   => -1,                     'post_parent'   => $post->ID,                     'posts_per_page'    => 50,                     'paged'            => $paged,                 );                      $variations = get_posts( $args );      https://github.com/woothemes/woocommerce/issues/4907 Does anyone know how to implement this or something similar? Thanks


title: How to Fix an Archive.php That Displays All Posts?

text:
I am currently working on developing my first large-scale WordPress powered site, and I have run into a major problem in my archive.php file. It loads all posts, rather than the categories/tags that I am looking to display. The basic idea is to have an article-showcase bar in which the first 6 posts will be shown as thumnails, while the rest will be displayed in the normal format. The pagination then kicks in, and the user can click to see the next page of results, in which there will be the same article-showcase, but with the next page of standard posts. To do this I am using two loops, where the second one is offset by 6 posts. I had it working until last night, when I changed some things and reloaded only to have the thing start showing all of the posts on the site. I originally thought it was an issue with my query for standard posts, so I changed it, but now I can see no reason why it shouldn't work.               <?php get_header(); ?>

                  <?php //Check to See If We Are Looking for Posts Of A Specific Category ?>             <?php if (is_category()) {             ?>
                                  <?php _e( ' ', 'bonestheme' ); ?> <?php single_cat_title(); ?>
                  <?php //Check to See If We Are Looking for Posts With A Specific Tag ?>             <?php } elseif (is_tag()) { ?>
                                  <?php _e( ' ', 'bonestheme' ); ?> <?php single_tag_title(); ?>
                  <?php //Check to See If We Are Looking for Posts From A Specific Author ?>             <?php } elseif (is_author()) {                     global $post;                     $author_id = $post->post_author;             ?>
                                  <?php _e( 'Posts By ', 'bonestheme' ); ?> <?php the_author_meta('display_name', $author_id); ?>
                  <?php //Check to See If We Are Looking for Posts From A Specific Day ?>             <?php } elseif (is_day()) { ?>
                                  <?php _e( 'Posted Today:', 'bonestheme' ); ?> <?php the_time('l, F j, Y'); ?>
                  <?php //Check to See If We Are Looking for Posts From A Specific Month ?>             <?php } elseif (is_month()) { ?>
                                          <?php _e( 'Posted This Month:', 'bonestheme' ); ?> <?php the_time('F Y'); ?>
                  <?php //Check to See If We Are Looking for Posts From A Specific Year ?>             <?php } elseif (is_year()) { ?>
                                          <?php _e( 'Posts This Year:', 'bonestheme' ); ?> <?php the_time('Y'); ?>
                  <?php } ?>                  <?php //Begin Archive Article Showcase ?>
                           <?php                      $arcshowcaseargs = array(                 'showposts'=> 6,                 'caller_get_posts'=>1                 );                      $my_query1 = new WP_Query($arcshowcaseargs);                 if( $my_query1->have_posts() ) {                 while ($my_query1->have_posts()) : $my_query1->the_post();                 ?>                                <a href="<?php the_permalink() ?>" rel="bookmark" class="archive-article-showcase-thumbnail">                         <?php if (class_exists('MultiPostThumbnails')) :                         MultiPostThumbnails::the_post_thumbnail(get_post_type(),'secondary-image', NULL,'square-icon-large');                     endif; ?>                         LOL                                       <?php                 endwhile;                 }                 wp_reset_query();  // Restore global post data stomped by the_post().                 ?>
         <?php //End Archive Article Showcase ?>              <?php                      $maincaseargs = array(                 'offset = 6',                 'caller_get_posts'=>1                 );                      $my_query3 = new WP_Query($maincaseargs);                 if( $my_query3->have_posts() ) {                 while ($my_query3->have_posts()) : $my_query3->the_post();                 ?>                        <article id="post-<?php the_ID(); ?>" <?php post_class( 'cf' ); ?> role="article" style="position: relative; padding: 5px; border-bottom: 1px dashed #d4d8d8;">

                             <?php echo get_the_post_thumbnail(NULL, 'main-loop') ;?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>

By <?php the_author(); ?>

                                          <?php printf( __( '', 'bonestheme' ) . ' <time class="updated" datetime="%1$s" pubdate>%2$s</time> ' . __(' ', 'bonestheme' ) . ' ', get_the_time('Y-m-j'), get_the_time(get_option('date_format')), get_the_author_link( get_the_author_meta( 'ID' ) )); ?>
                              |
                                     <?php comments_number( __( 'No Comments', 'bonestheme' ), __( 'One Comment', 'bonestheme' ), _n( '% Comments', '% Comments', get_comments_number(), 'bonestheme' ) );?>

                  <?php endwhile; ?>                                  <?php bones_page_navi(); ?>                  <?php else : ?>

<?php _e( 'Sorry, No Results.', 'bonestheme' ); ?>

<?php _e( 'Try your search again.', 'bonestheme' ); ?>

                  <?php endif; ?>

          <?php get_footer(); ?>


title: Add extra fields to Add New Category page

text: I need to add an extra field to the Add New Category page. Currently it only has fields for Name, Slug, and Description. Essentially, I need to have a second description text box. I use the current Description field at the bottom of each category page, but now I need to have additional information specific to the category (and different from the bottom) displayed at the top. How can I add this additional field? Below is what I am trying to achieve: ![http://i.imgur.com/QLNC6.jpg](http://i.stack.imgur.com/j1uR2.jpg)


title: Getting the list of the latests posts and custom type posts in the homepage

text: When I need to get a single post type list I usually use `get_posts`, how can I retrieve multiple `custom posts types` to populate the site homepage? To be more precise, I would like to get the latest mixed posts (so mixed slugs like work, photo, code) and oreder them by date. I could call `get_posts` per each custom post type and then filter them, but I was just wondering if there was a more optimized way to do it, something like:               <?php     $args = array (         'post_type' => array ('work', 'photo', 'code', 'post'),         'numberposts' => 5,         'orderby' => 'post_date',         'order' => 'DESC'     );     $posts_array = get_posts($args);     ?>      So, does exists some way to get a mixed post type list?


title: Remove HTML editor and visual/HTML tabs from TinyMCE

text: Is it possible to remove the `Visual` \ `HTML` tabs from `wp_editor` and display only the TinyMCE editor? Basically, right now, I'm using `wp_editor` to display the smallest possible TinyMCE editor I can - only one button is needed, italics. ![Current TinyMCE instnace](http://i.stack.imgur.com/LH1dD.png) What I'd like to do is make that smaller by removing the `Visual` \ `HTML` tabs. Our authors won't ever need the HTML editor and the custom buttons I'm creating will only be accessible from the visual editor. **NOTE:** For reasons found here, I can't use the `teeny` argument of `wp_editor`. Thanks in advance,


title: Plugin development - loading Javascript and Flash

text: I've been using Wordpress for a while, and I really like it \o/... I've written plugins for the Joomla platform but I'm sort of struggling getting going on the wordpress platform : Here's my plan. I'm in the process of writing a plugin that uses Flash to allow the user to record audio from the soundcard (my idea is to allow the user to record a podcast through the web site). I have a questions (so many questions...) but I'll go with these few : I am using wp-enqueue to load the Javascript libraries into the page or post as it is loaded. Currently I'm using add_action('init', 'register_libraries'); to register the javascript libraries - and I think that works - but it also shows in the administration page (where this plugin won't be used). So I had a look a the codex page and it suggests that I should be using init - it says that init is "Typically used by plugins to initialize". But that also includes the administration side, which I don't want for this plugin. Any suggestions what I should do instead? In addition, and perhaps this should be a separate question - I wanted to load flash during the loading of the plugin - how should I do that - any ideas?... I know... It's a bit noobish...


title: Catagorized hierarchy menu for PAGES!

text: Yes, I am a noob at all this so please excuse my ignorance! So, for the past couple of days, I've been searching for a drop down page menu widget, but I would like to have the pages separated into "labeled" catagories. I don't have pages that require any hierarchy, so I don't have or want a parent page to catagorize by. Basically, I want to be able to enter a label/title for the group that will show on the menu and when you click or hover on the label, the pages designated to that label will drop down. I noticed you can catagorize posts and links, but not pages. Does such a widget exist??


title: How can i customize the comment list

text: I am using **wp_list_comments()** function to draw the comment list.But,I want change many things in the form like class,styles, reply link and etc... so please help me, How can i customize the comment listing function Thanks


title: Cropped featured image replaces original image in gallery

text: _Firstly, I have done my research as thoroughly as I possibly can. Searches have been made, but I have not found any advice or solution as to my exact issue._ Ok, time to explain. Currently I am working on a gallery theme for a client (I am not the original developer of this theme, it was created by another developer in the office). The theme is rather simple, the home page displays 220x170 thumbnails of each post containing an image. Click on the image, page with full size image comes up. Simple enough. Now my trouble starts. The client would like to define which area of the image is displayed in the 220x170 thumbnail as currently WordPress just centers the image. My process to do this has been to upload the image to the gallery, insert into post and save. I will then click on **Set Featured image**. The main problems begins here. There's 2 ways I can go about this, both causing issues. If I crop the image, select **Apply Changes to: Thumbnail** , save it and then select **Use as featured image** , the featured image remains the full sized image, just resized to fit the 220x170 size. At first I thought I figured out a solution, but I'd call it more of a band- aid fix and my client would rather avoid this next way. If I crop the image, instead now using **All image sizes** , this will now set the correctly cropped image as the thumnbnail, but will obviously overwrite ... all the image sizes. So if I got back into my post (let's say I accidentally deleted the image from the post) and I wanted to insert it back in, the image now inside of the gallery is the cropped image. I'm trying to look for some guidance as to how I can fix the first issue, where the cropped thumbnail does not display in the featured image section, but rather just the full sized image. Thank you,


title: How to Add Author Editing Capability to Existing Post by Admin

text: I apologize if this is mentioned on here but I can't find any information! Anyway, I am building a WordPress site where I created the content with my administrator account. However, once the site is launched there are going to be 10-15+ Author accounts in order to manage a single custom post each. Is there any way that I can create a new account, and add author capability to a post which already exists but is not created by them? Or is there a way I can change the author on an existing post from the admin account to the newly created one?


title: Wordpress plugin Post Creation

text: Does someone know any plugin available that can allow any users to create a post and publish it without even registering?? In fact, I want to use it with wp-ecommerce wordpress plugin found here


title: Can't get drafts with WP_Query using post_status parameter

text: I can't seem to get drafts to show up with WP_Query, even when post_status is set to 'any' or 'draft'                       $args = array(                         'p' => 1234,                          'post_type' => 'any',                         'post_status' => 'any'                         );             $query = new WP_Query( $args );                  while ( $query->have_posts() ) : $query->the_post();                 // display the post             endwhile;                  wp_reset_postdata();      If I go back and Publish post 1234, WP_Query grabs it just fine. But when it is a draft, neither `any` nor `draft` grabs it. I read that the `exclude_from_search` parameter in `register_post_type()` prevents posts from showing up with WP_Query, so I set it to false in the post_type I am grabbing from, like so:               $args = array(         'labels' => $labels,         'description' => '',         'public' => true,         'publicly_queryable' => true,         'exclude_from_search' => false,         'show_ui' => true,         'menu_position' => 60,         'menu_icon' => null,         'capability_type' => post,         'hierarchical' => false,         'supports' => array('title', 'editor', 'author', 'excerpt', 'trackbacks', 'custom-fields', 'revisions'),         'rewrite' => true,         'query_var' => true,         'can_export' => true,         'show_in_nav_menus' => true,     );          register_post_type('chart', $args);      Is there something I'm overlooking here? I don't see why a draft post in this post type wouldn't show up in the query above.


title: Add class to every other posts using get_posts

text:
I am currently using this little loop to display a list of posts using the "events" custom post type               <?php global $post; // required         $args = array('post_type' => 'events');         $custom_posts = get_posts($args);         foreach($custom_posts as $post) : setup_postdata($post);     ?>

Content goes here

          <?php endforeach; ?>      What I want to do is add a class to every other list item so that I can style them alternatively (One white, one black, one white, one black, for example) I've done this before with a standard loop but I'm only just converting over to get_posts so I'm a bit stuck. Any help would be great. Thanks in advance


title: Permalinks for custom post-types within custom taxonomies not found

text: I have tried to apply the advice offered by TheDeadMedic in this post to achieve the following URL structure: example.com/activities = a WP page   example.com/activities/type-term = a custom archive   example.com/activities/type-term/activity-post = a custom post All URL's work until the lowest one which returns a Wordpress "not found" error. I don't know whether I need to filter the rewrite rules to make this work. The post I linked above suggests that I have done everything needed. Any help would be greatly appreciated, thanks. Here's my code:               /*      * Register custom content objects on initiation      */     add_action('init', 'register_type'); // Type taxonomy (activities)     add_action('init', 'register_activity'); // Activity post-type     add_filter('post_type_link', 'filter_activity_link', 10, 2); // Filter permalinks for activity post-type          /*      * Register Type custom taxonomy for activities      */     function register_type() {              $labels = array(             'name'                  => ('Types'),             'singular_name'         => ('Type'),             'add_new'               => ('Add New Type'),             'add_new_item'          => ('Add New Type'),             'edit_item'             => ('Edit Type'),             'new_item'              => ('New Type'),             'view_item'             => ('View Type'),             'search_items'          => ('Search Type'),         );              $args = array(             'labels'                => $labels,             'public'                => true,             'query_var'             => true,             'rewrite'               => array( 'slug' => 'activities', 'with_front' => false ),              );         register_taxonomy( 'type', 'activity', $args );     }          /*      * Register Activity custom post-type      */     function register_activity() {              $labels = array(             'name'                  => ('Activities'),             'singular_name'         => ('Activity'),             'all_items'             => ('All Activities'),             'add_new_item'          => ('Add New Activity'),             'edit_item'             => ('Edit Activity'),             'new_item'              => ('New Activity'),             'view_item'             => ('View Activity'),             'search_items'          => ('Search Activities')         );              $args = array(             'labels'                => $labels,             'public'                => true,             'show_in_nav_menus'     => false, // Do not appear directly in navigation             'menu_position'         => 5,             'hierarchical'          => false,             'query_var'             => true,             'supports'              => array( 'title', 'editor', 'type', 'revisions', 'comments' ),             'rewrite'               => array( 'slug' => 'activities/%tax_type%', 'with_front' => false )         );              register_post_type( 'activity', $args );     }          /*      * Update Type rewrite slug with applicable terms      */     function filter_activity_link($link, $post) {         if ($post->post_type != 'activity')         return $link;          if ($cats = get_the_terms($post->ID, 'type'))         $link = str_replace('%tax_type%', array_pop($cats)->slug, $link);     return $link;     }      * * * # UPDATE OK, it turns out you will always need to add rewrite rules to finish this process. The URL's may appear correctly but the database doesn't understand them. This post helped me enormously, along with this reference information on regex. I just needed to add the code               add_rewrite_rule('^activities/([^/]*)/([^/]*)/?$' ,'index.php?activity=$matches[2]','top';      Hope this helps someone.


title: Customise the appearance of 4 specific post ID's within the loop?

text:
I am using Isotope and I currently have each post rendering as a box on my homepage. I am currently trying to edit my (working) query that currently displays all posts with the category slug of 'static'. Within that query i'd like to target 4 specific post ID's and customise the appearance of each of those 4 posts. So each of those 4 posts will have different content to one another. How can I adjust this working loop so that I can add/remove content for 4 different post ID's? Just to note as well, in my template file, I have another query below this query that displays posts from 6 other categories. The code is the same but I've just changed a link position. I hope that all makes sense!               <?php                 // Query just the category static and make the link manually editable through the 'URL' custom field                 $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                 $args= array(                     'category_name' => 'static',                     'paged' => $paged                 );                 query_posts($args);                 if( have_posts() ) :?>                      <?php while (have_posts()) : the_post(); ?>                        <?php foreach( get_the_category() as $cat ) echo '
slug . '" data-category="' . $cat->slug . '" >'; ?>                            <a href="<?php echo get_post_meta($post->ID, 'URL', true); ?>" title="<?php the_title(); ?>">

                             <?php the_post_thumbnail(); ?>

<?php the_title(); ?> / Explode here
                       <?php                       // Call in the contents of a custom field called Excerpt and if custom field in admin panel is empty don't display
 tags otherwise wrap contents in
 tags                       $excerpt=get_post_meta($post->ID,'Excerpt',true);                       if($excerpt != '') {                       echo '
'. $excerpt .'
';                       } else {                       echo ' ';                       }                       ?>
<?php the_time('Ydm') ?>

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


title: 3 blogs on one site with the same header menu?

text: Person X has default SITE with an integral blog. Person X also has SITE 2 with Blog 2 and also SITE 3 with Blog 3. Is it possible to have on the DEFAULT SITE HEADER MENU something like this:               HOME BLOG1 BLOG2 BLOG3 CONTACTUS      BLOG1 is a integral blog of that DEFAULT SITE. Blog 2 tab would link to the blog 2 of the site 2. Blog 3 tab would link to the site 3 with blog 3. The point is when user clicks at the BLOG2 and BLOG3 tabs to get content from these blogs, the HEADERMENU of default site always stays on the top and it is always the same. Is that possible? (categories of a single blog as a solution excluded). Possible solution is to mimic BLOG 2 and BLOG 3 with exactly the same header (with linked tabs) that could give a simulation of the same page all the way, but that would be cheating and it is hard to update all these blogs-sites like that (especially if new tab appears in the future). Is there any other more logical-better solution?


title: is there a plugin that allow editing pages from within pages without entering admin panel?

text: Is there a plugin that allows editing pages/posts without going to admin panel? I've a specific need to disallow access for users to admin panel of wordpress/multisite users. But I want them to be able to change contents of pre-structured pages. is this possible? anyone already thought of this before me??


title: Remove Featured Image from posts in specific category?

text: I am building a theme that includes the featured image as a navigation feature outside the single post, but once the user gets to the post in category "Specials", I'd like to take that image away. None of the other category posts require this lack of Featured Images. Theirs can be intact. I can do it with JavaScript easily enough, targeting the div, but I'd like to do it server-side. How can I isolate and remove a featured image from a specific category's posts?


title: Delete old post with new post

text: Hope you can point me in the right direction, with a plugin or function. With "Contact Form 7" logged in users post their info with "Form to Post" plugin. Everything is front end. It is a big form that uses custom fields to display posts. I need a way to automatically delete posts, so every time a new post by user is created the last one is deleted in that category. I found a way I can do it by date, by that will not work. Thanks.


title: Adding attributes to <a> link in wp_nav_menu using custom Walker function

text:
I am trying to generate a menu using wp_nav_menu. My expected output is this:

                             Dashboard

Dashboard #2

Dashboard #1

Photo Gallery

                             Site Pages

View pages

Add page

                             eCommerce

Catalog

Categories

Products

Add product

Orders

                             Members

Clients

Edit account

                             Other

Charts

                             Documentation

Overview

Features

Getting Started

Customization Guide

Powered by

Credits

           So far I am able to use a custom walker function to wp_nav_menu and achieved to generate almost all the html as above but I am unable to insert **class="dropdown-toggle" data-toggle="dropdown"** inside the tag. This will allow me to toggle the dropdown I guess (currently I am able to generate only the top menu. The submenu's appear in html but they are not visible in browser.). Here is my effort so far:

                                                                                <?php class My_Walker_Nav_Menu extends Walker_Nav_Menu {     function start_lvl(&$output, $depth) {     $indent = str_repeat("\t", $depth);     $output .= "\n$indent
\n";     }     }     $defaults = array(     'theme_location'  => '',     'menu'            => '',     'container'       => 'div',     'container_class' => 'nav-collapse collapse',     'container_id'    => '',     'menu_class'      => 'nav',     'menu_id'         => '',     'echo'            => true,     'fallback_cb'     => 'wp_page_menu',     'before'          => '',     'after'           => '',     'link_before'     => '',     'link_after'      => '',     'items_wrap'      => '

%3$s
',     'depth'           => 0,     'walker'          => new My_Walker_Nav_Menu          );               wp_nav_menu( $defaults );                ?>

           Can somebody help me to modify my custom walker function so as to get the desired html output given above. Thanks in advance.


title: Can I run a second wordpress site as a subdomain without using multisite?

text: I have an two wordpress sites that I would like to host on the same domain. One is already up and running, the other is sitting in waiting. Can I get the second as a subdomain, or simple within a folder, to run on the same domain (different DB) without converting to multisite?


title: Where have the Privacy Settings gone in WordPress 3.5?

text: I moved a WordPress site to another server and everything is working well, minus the fact that I can't seem to change the settings in Privacy. When I click on "allow search engines to index this site", the radio button automatically switches back to "ask search engines not to index this site". Also, the Privacy Settings menu itself is gone from the Settings menu. I have to manually type in `/wp-admin/options-privacy.php` to access the page. Can anyone tell me what is going on?


title: How to show a custom notification to a specific user?

text: I am new here, I found this spot interesting and very special. I've already found useful information through your discussions. My first question is about user management. As Admin, I would need to display some text or notification on the dashboard of a specific user. For a "specific" user name, for example.


title: Does an activated plugin automatically mean its methods are available to other WP functions?

text: I made a WordPress plugin like this:               Class MY_CLASS {     //codes     }     Global $myclass;     $myclass = New MY_CLASS ();      After installed and activated the plugin, can I use this class in other plugins without including the myclass.php file? For example, in another plugin:               Global $myclass;     $myclass->a = 'dog';


title: Problem running Ajax in Wordpress

text: **FIXED** I changed this:               wp_enqueue_script( 'pfxconversion', plugin_dir_url( __FILE__ ) . 'function.js', array( 'jquery' ) );         wp_localize_script( 'pfxconversion', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );              add_action( 'wp_ajax_nopriv_pfxconversion', 'pfxconversion_callback' );         add_action( 'wp_ajax_pfxconversion', 'pfxconversion_callback' );      to this:               add_action ('wp_print_scripts', 'widget_logic_js_fx', 1);          function widget_logic_js_fx() {         wp_enqueue_script( 'purefx-currency-converter', plugin_dir_url( __FILE__ ) . 'function.js', array( 'jquery' ) );         wp_localize_script( 'purefx-currency-converter', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );     }          add_action( 'wp_ajax_nopriv_pfxconversion', 'pfxconversion' );     add_action( 'wp_ajax_pfxconversion', 'pfxconversion' );      wp_print_scripts is what we we're missing :-)


title: one category template for multiple categories

text: i have category-events.php to list my posts tagged 'events' but it wont work for 'events' child categories. ie i have some posts tagged 'events' and one of events' children 'exhibition'. I thought it would use category-events.php automatically but it doesn't. Is this possible as i want to user category-events.php for several of 'events' child categories. hope that makes sense and any pointers welcome. dan.


title: How to query WordPress from another application?

text: We're building an iOS app for BarbadosPropertyList.com. The iOS app needs to query the website and download recent listings data, including titles, datestamps, thumbnails and custom fields. We would like to know the best practice for querying WordPress data from an external app?


title: 404 redirection and Google's index

text: I have several dead pages, which are annoyingly still indexed in Google. I've set my 404.php to redirect to my homepage using wp_redirect, however I'm worried that this will prevent Google from unindexing those dead pages? I've tried setting the status code in the redirect to 404, but this results in no redirection.


title: Display Custom Field in Sidebar if Value is Present

text:
I'm trying to use 'if' 'else' to display a link button if I have a value in the 'TourURL' custom field, and if not, nothing will display but can't seem to get the if code to work:               <?php if(global $wp_query;         $postid = $wp_query->post->ID;         echo get_post_meta($postid, 'TourURL', true);         wp_reset_query();     ): ?>
Show Link
          <?php else : ?>
No Link
          <?php endif; ?>      Thanks!


title: Upload image from other server without resize?

text: For image upload in my plugin i am using `media_handle_sideload` function. Is it possible to disable image resizing on this function?


title: Getting the Current User

text: I am trying to use information about the current user in a plugin that I am designing and I have seen people go about it in several different ways. ## My Way This way seems to work, but am I missing something?               global $current_user;          // Use information     echo "User ID: " . $current_user->user_id;     echo "User First Name: " . $current_user->first_name;      I have seen some people call the function **get_currentuserinfo()** on the next line after declaring the global variable $current_user. However, this seems to work without that call - so is it necessary? Also, there is the function **wp_get_current_user()** - what is the difference between this and **get_currentuserinfo()**? I have also seen people use a global variable called **$profileuser** and use **get_user_to_edit()** in order to set it to the user object. Is there some benefit to this? I have also seen people refer directly to the **$user_ID** global variable in addition to using the **$current_user**. Why wouldn't they just use **$current_user->ID**? Thanks, William


title: Some widgets on Multisite not showing up in template for particular theme

text:
I have a load of custom widgets that all look pretty much the same. I have a multisite blog with 3 blogs. The widgets are configured individually to show up on all 3 blogs with their own settings in Appearance -> Widgets. All widgets show normally on the first, main blog. On the other blogs, **some** of the widgets don't appear. I've given a sample of two widgets below - `gem_countryFilter_Widget()` shows up everywhere like it should, but `gem_joinConversation_Widget()` only appears on the main blog, even though it's configured on all of them and is part of the same sidebar as the other widget that _does_ work. I can't see any difference between the two, so I'm baffled as to what the problem is. The widgets are also used in a previous custom theme, and have not been modified. In the previous theme, the widgets appeared on all blogs as expected. I've tried copying the functions.php file (where the widgets are declared) from the old theme directly into the new one and it's had no effect - some of the widgets just disappear on the non-main blogs. It seems logical that the theme is the problem, but I'm drawing a blank over where to look to diagnose it. Has anybody encountered a similar problem before? **sample code:**               /**join conversation**/     class gem_joinConversation_Widget extends WP_Widget {         function gem_joinConversation_Widget() {             parent::WP_Widget(false, 'Join the Conversation');         }     function form($instance) {             // outputs the options form on admin             echo '
Displays the social and sharing icons in the sidebar. There are no options for this widget.
';         }     function update($new_instance, $old_instance) {             // processes widget options to be saved             return $new_instance;         }     function widget($args, $instance) {             // outputs the content of the widget             gem_joinConversation();         }     }     register_widget('gem_joinConversation_Widget');     function gem_joinConversation($args = array()){         ?>

Join the conversation

                    <?php     }          /**Country filter**/     class gem_countryFilter_Widget extends WP_Widget {         function gem_countryFilter_Widget() {             parent::WP_Widget(false, 'Country filter');         }     function form($instance) {             // outputs the options form on admin             echo '
Displays a dropdown list of blogs. There are no options for this widget.
';         }     function update($new_instance, $old_instance) {             // processes widget options to be saved             return $new_instance;         }     function widget($args, $instance) {             // outputs the content of the widget             gem_countryFilter();         }     }     register_widget('gem_countryFilter_Widget');     function gem_countryFilter($args = array()){         ?>

Filter by country

Brazil

China

France

                <?php     }


title: Query posts based on parents attribute

text: This is the scenario: I have multiple pages that all have a custom field named "Location" Those pages all have child-pages with the custom field of "size_m2". What I want is to do a normal meta_query to list all pages with let say "size_m2 >= 55", but only if the parent page have "Location == Stockholm". Do i need to use a custom SQL query for this? Or can I query for the parent_pages children, and when filter and "query" that query?


title: Apply function on all action hooks?

text: Is there an easy way to apply a function on all action hooks? > I want to apply `esc_attr()` to every action hook (in a way that would work > from functions.php or a plugin). I figure I would need to filter `do_action` and `do_action_ref_array` except that those functions don't use `apply_filters`. Is there any way to do this?


title: IE7 compatible twentyeleven

text: I installed a site with the stock twentyeleven theme but it looks terrible in IE6 and has many small problems in IE7. I am ready to give up on IE6 but not on IE7 yet but wouldn't like to rewrite a whole theme from scratch just to fix IE7. Is there a port of twentyeleven that supports these 2 browsers.


title: Adding featured image to posts created by a plugin

text:
The below code is part of Keyring Social Importer, and it imports my Tweets from Twitter and posts them as individual blog posts on my Wordpress.org install. I was wondering how I could make it set the featured image of all of the blog posts it creates to something. Currently it just imports my Tweets as publishes them as blog posts... no images whatsoever, but my theme relies heavily on featured images and thumbnails so if I could set one in this code it would be really handy. So something like, the_post_thumbnail=imgID for all posts. Let me know your thoughts. Many thanks, HT               <?php          function Keyring_Twitter_Importer() {          class Keyring_Twitter_Importer extends Keyring_Importer_Base {         const SLUG              = 'twitter';    // e.g. 'twitter' (should match a service in Keyring)         const LABEL             = 'Twitter';    // e.g. 'Twitter'         const KEYRING_SERVICE   = 'Keyring_Service_Twitter';    // Full class name of the Keyring_Service this importer requires         const REQUESTS_PER_LOAD = 3;     // How many remote requests should be made before reloading the page?              var $auto_import = false;              function __construct() {             parent::__construct();             add_action( 'keyring_importer_twitter_custom_options', array( $this, 'custom_options' ) );         }              function custom_options() {             ?>
                                      <?php _e( 'Import retweets', 'keyring' ); ?>                 	                                      <input type="checkbox" value="1" name="include_rts" id="include_rts"<?php echo checked( $this->get_option( 'include_rts', true ) ); ?> />

                                      <?php _e( 'Import @replies', 'keyring' ); ?>                 	                                      <input type="checkbox" value="1" name="include_replies" id="include_replies"<?php echo checked( $this->get_option( 'include_replies', true ) ); ?> />
<?php         }              function handle_request_options() {             // Validate options and store them so they can be used in auto-imports             if ( empty( $_POST['category'] ) || !ctype_digit( $_POST['category'] ) )                 $this->error( __( "Make sure you select a valid category to import your checkins into." ) );                  if ( empty( $_POST['author'] ) || !ctype_digit( $_POST['author'] ) )                 $this->error( __( "You must select an author to assign to all checkins." ) );                  if ( isset( $_POST['auto_import'] ) )                 $_POST['auto_import'] = true;             else                 $_POST['auto_import'] = false;                  if ( isset( $_POST['include_rts'] ) )                 $_POST['include_rts'] = true;             else                 $_POST['include_rts'] = false;                  if ( isset( $_POST['include_replies'] ) )                 $_POST['include_replies'] = true;             else                 $_POST['include_replies'] = false;                  // If there were errors, output them, otherwise store options and start importing             if ( count( $this->errors ) ) {                 $this->step = 'greet';             } else {                 $this->set_option( array(                     'category'        => (int) $_POST['category'],                     'tags'            => explode( ',', $_POST['tags'] ),                     'author'          => (int) $_POST['author'],                     'include_replies' => (bool) $_POST['include_replies'],                     'include_rts'     => (bool) $_POST['include_rts'],                     'auto_import'     => (bool) $_POST['auto_import'],                     'user_id'         => $this->service->get_token()->get_meta( 'user_id' ),                 ) );                      $this->step = 'import';             }         }              function build_request_url() {             // Base request URL             $url = "http://api.twitter.com/1/statuses/user_timeline.json?";             $params = array(                 'user_id' => $this->get_option( 'user_id' ),                 'trim_user' => 'true',                 'count' => 75, // More than this and Twitter seems to get flaky                 'include_entities' => 'true',             );             if ( false == $this->get_option( 'include_replies' ) )                 $params['exclude_replies'] = 'true';             if ( true == $this->get_option( 'include_rts' ) )                 $params['include_rts'] = 'true';             $url = $url . http_build_query( $params );                       if ( $this->auto_import ) {                 // Locate our most recently imported Tweet, and get ones since then                 $latest = get_posts( array(                     'numberposts' => 1,                     'orderby' => 'date',                     'order' => 'DESC',                     'meta_key'    => 'keyring_service', // In case there are other asides                     'meta_value'  => 'twitter',                     'tax_query' => array( array(                         'taxonomy' => 'post_format',                         'field' => 'slug',                         'terms' => array( 'post-format-standard' ), // Tweets stored as asides                         'operator' => 'IN',                     ) ),                 ) );                      // If we have already imported some, then start since the most recent                 if ( $latest ) {                     $max = get_post_meta( $latest[0]->ID, 'twitter_id', true );                     $url = add_query_arg( 'since_id', $max, $url );                 }             } else {                 // Handle page offsets (only for non-auto-import requests)                 $url = add_query_arg( 'page', $this->get_option( 'page', 0 ), $url );             }                  return $url;         }              function extract_posts_from_data( $raw ) {             global $wpdb;                  $importdata = $raw;                  if ( null === $importdata ) {                 $this->finished = true;                 return new Keyring_Error( 'keyring-twitter-importer-failed-download', __( 'Failed to download your tweets from Twitter. Please wait a few minutes and try again.', 'keyring' ) );             }                  // Check for API overage/errors             if ( !empty( $importdata->error ) ) {                 $this->finished = true;                 return new Keyring_Error( 'keyring-twitter-importer-throttled', __( 'You have made too many requests to Twitter and have been temporarily blocked. Please try again in 1 hour (duplicate tweets will be skipped).', 'keyring' ) );             }                  // Make sure we have some tweets to parse             if ( !is_array( $importdata ) || !count( $importdata ) ) {                 $this->finished = true;                 return;             }                  // Get the total number of tweets we're importing             if ( !empty( $importdata[0]->user->statuses_count ) )                 $this->set_option( 'total', $importdata[0]->user->statuses_count );                  // Parse/convert everything to WP post structs             foreach ( $importdata as $post ) {                 // Double-check for @replies, which shouldn't be included at all if we chose to skip them                 if ( true == $this->get_option( 'exclude_replies' ) && null != $post->in_reply_to_screen_name )                     continue;                      // Post title can be empty for Asides, but it makes them easier to manage if they have *something*                 $title_words = explode( ' ', strip_tags( $post->text ) );                 $post_title  = implode( ' ', array_slice( $title_words, 0, 15 ) );     // Use the first 15 words                 if ( count( $title_words ) > 15 )                     $post_title .= '…';                            // Parse/adjust dates                 $post_date_gmt = strtotime( $post->created_at );                 $post_date_gmt = gmdate( 'Y-m-d H:i:s', $post_date_gmt );                 $post_date     = get_date_from_gmt( $post_date_gmt );                      // Apply selected category                 $post_category = array( $this->get_option( 'category' ) );                      // Clean up content a bit                 $post_content = $post->text;                 $post_content = $wpdb->escape( html_entity_decode( trim( $post_content ) ) );                      // Handle entities supplied by Twitter                 if ( count( $post->entities->urls ) ) {                     foreach ( $post->entities->urls as $url ) {                         $post_content = str_replace( $url->url, $url->expanded_url, $post_content );                     }                 }                      // Any hashtags used in a tweet will be applied to the Post as tags in WP                 $tags = $this->get_option( 'tags' );                 if ( preg_match_all( '/(^|[(\[\s])#(\w+)/', $post_content, $tag ) )                     $tags = array_merge( $tags, $tag[2] );                      // Add HTML links to URLs, usernames and hashtags                 $post_content = make_clickable( esc_html( $post_content ) );                      // Include geo Data (if provided by Twitter)                 if ( !empty( $post->geo ) && 'point' == strtolower( $post->geo->type ) )                     $geo = array(                         'lat' => $post->geo->coordinates[0],                         'long' => $post->geo->coordinates[1]                     );                 else                     $geo = array();                      // Get a GUID from Twitter, plus other important IDs to store in postmeta later                 $user = $this->service->get_token()->get_meta( 'username' );                 $twitter_id              = $post->id_str;                 $twitter_permalink       = "https://twitter.com/{$user}/status/{$twitter_id}";                 $in_reply_to_user_id     = $post->in_reply_to_user_id;                 $in_reply_to_screen_name = $post->in_reply_to_screen_name;                 $in_reply_to_status_id   = $post->in_reply_to_status_id;                 $post_author             = $this->get_option( 'author' );                 $post_status             = 'publish';                 $twitter_raw             = $post;                      // Build the post array, and hang onto it along with the others                 $this->posts[] = compact(                     'post_author',                     'post_date',                     'post_date_gmt',                     'post_content',                     'post_title',                     'post_status',                     'post_category',                     'tags',                     'twitter_id',                     'twitter_permalink',                     'geo',                     'in_reply_to_user_id',                     'in_reply_to_screen_name',                     'in_reply_to_status_id',                     'twitter_raw'                 );             }         }              function insert_posts() {             global $wpdb;             $imported = 0;             $skipped  = 0;             foreach ( $this->posts as $post ) {                 extract( $post );                 if (                     $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM {$wpdb->postmeta} WHERE meta_key = 'twitter_id' AND meta_value = %s", $twitter_id ) )                 ||                     $post_id = post_exists( $post_title, $post_content, $post_date )                 ) {                     // Looks like a duplicate                     $skipped++;                 } else {                     $post_id = wp_insert_post( $post );                          if ( is_wp_error( $post_id ) )                         return $post_id;                          if ( !$post_id )                         continue;                               // Track which Keyring service was used                     add_post_meta( $post_id, 'keyring_service', $this->service->get_name() );                          // Store the twitter id, reply ids etc                     add_post_meta( $post_id, 'twitter_id', $twitter_id );                     add_post_meta( $post_id, 'twitter_permalink', $twitter_permalink );                     if ( !empty( $in_reply_to_user_id ) )                         add_post_meta( $post_id, 'twitter_in_reply_to_user_id', $in_reply_to_user_id );                     if ( !empty( $in_reply_to_screen_name ) )                         add_post_meta( $post_id, 'twitter_in_reply_to_screen_name', $in_reply_to_screen_name );                     if ( !empty( $in_reply_to_status_id ) )                         add_post_meta( $post_id, 'twitter_in_reply_to_status_id', $in_reply_to_status_id );                          // Update Category and Tags                     wp_set_post_categories( $post_id, $post_category );                     if ( count( $tags ) )                         wp_set_post_terms( $post_id, implode( ',', $tags ) );                          // Store geodata if it's available                     if ( !empty( $geo ) ) {                         add_post_meta( $post_id, 'geo_latitude', $geo['lat'] );                         add_post_meta( $post_id, 'geo_longitude', $geo['long'] );                         add_post_meta( $post_id, 'geo_public', 1 );                     }                          add_post_meta( $post_id, 'raw_import_data', json_encode( $twitter_raw ) );                          $imported++;                 }             }             $this->posts = array();                  // Return, so that the handler can output info (or update DB, or whatever)             return array( 'imported' => $imported, 'skipped' => $skipped );         }     }          } // end function Keyring_Twitter_Importer               add_action( 'init', function() {         Keyring_Twitter_Importer(); // Load the class code from above         keyring_register_importer(             'twitter',             'Keyring_Twitter_Importer',             plugin_basename( __FILE__ ),             __( 'Import all of your tweets from Twitter as Posts (marked as "asides") in WordPress.', 'keyring' )         );     } );


title: Alternative to esc_textarea

text: I need an alternative function to use with textareas in meta boxes instead of esc_textarea. The problem is that when I use this function with textarea's it removes line breaks and paragraphs. Is there an alternative function that will keep the line breaks and paragraphs. I have tried the validation reference page in the Codex but had no luck finding a function.


title: How to do a custom bookmarks post type?

text: ## Let me first explain what I am wanting to do... I am wanting to add all my hundreds of website bookmarks that I have now in my browser, into wordpress for the following reasons.   * Can search my bookmarks by tags   * Can search my bookmarks by description and/or name   * Can access my bookmarks from anywhere   * Can add a description to all my bookmarks   * Can add a screenshot image of website (optional)   * Will have a custom template for viewing the bookmarks which will look different from a regular blog post/list ## And what I have done so far...   * Created a new post type **"Website Bookmarks"** with the code below functions.php               <?php     /*     *  Add custom post type     *  name: website_bookmarks     */          function bookmark_post_type()     {         // Set some labels for our bookmarks post type         $bookmark_labels = array(             'name' => _x('Website Bookmark', 'post type general name'),             'singular_name' => _x('Websiteite Bookmark', 'post type singular name'),             'add_new' => _x('Add New', 'Websiteite Bookmark'),             'add_new_item' => __('Add New Website Bookmark'),             'edit_item' => __('Edit Website Bookmark'),             'new_item' => __('New Website Bookmark'),             'all_items' => __('All Website Bookmarks'),             'view_item' => __('View Website Bookmark'),             'search_items' => __('Search Website Bookmarks'),'not_found' => __('No website Bookmarks found'),             'not_found_in_trash' => __('No Website Bookmarks found in Trash'),             'parent_item_colon' => '',             'menu_name' => 'Website Bookmarks'             );              $bookmark_args = array(             'labels' => $bookmark_labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'show_in_menu' => true,             'query_var' => true,             'rewrite' => array(                 'slug' => 'bookmark',                 'with_front' => false),             'taxonomies' => array('post_tag', 'category'),             'capability_type' => 'post',             'has_archive' => true,             'hierarchical' => false,             'menu_position' => null,             'can_export' => true,             'supports' => array(                 'post-thumbnails',                 'thumbnail',                 'excerpt',                 'custom-fields',                 'editor',                 'title'             )         );              register_post_type('website_bookmarks', $bookmark_args);     }          add_action('init', 'bookmark_post_type');      * * * ## And then what I need help/ideas with... I basically need the following...   * Website Title   * Website URL   * Website Description   * Bookmark Tags (can be more then 1) This will be done with a custom taxonomy   * Screenshot image (can be optional) So... I can use the built in **post title** for the **website title** , Website URL ? Should I use custom fields for this? Website description ? Again custom fields or something else like the content input box? Bookmark tags, done with custon taxonomy Screenshot image ? should I just use the post thumbnail for this? Please help, this will be my first time using wordpress do do any kind of custom stuff.


title: Pagination is not working wp_query custom fields values

text:
All I want those post having post_type == profile And wpcf-gender == 1 (male). I tried this code                           $wp_query = new WP_Query( array( 'meta_key' => 'wpcf-gender', 'meta_value' => '1', 'meta_compare' => '==', 'post_type' => 'profile','posts_per_page' => 2 ) );      Results which I am getting is perfect but pagination is not working. Can you please help me to find what is the issue in below code ?               <?php                               $temp = $wp_query;                     $wp_query = null;                          $wp_query = new WP_Query( array( 'meta_key' => 'wpcf-gender', 'meta_value' => '1', 'meta_compare' => '==', 'post_type' => 'profile','posts_per_page' => 2 ) );                     ?>                     <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>                          <div class="post" id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink();?>"><?php the_title(); ?>

                                                          <?php                                       if(has_post_thumbnail()) {                                     the_post_thumbnail();                                 } else {                                      echo '';                                 }                             ?>

                                     First Name: <?php echo do_shortcode('[types field="first-name" class="" style=""]'); ?>	                                     Last Name: <?php echo do_shortcode('[types field="last-name" class="" style=""]'); ?>

                                     Gender: <?php echo do_shortcode('[types field="gender"][/types]'); ?>	                                     DOB: <?php echo do_shortcode('[types field="dob" style="text" format="F j, Y"][/types]'); ?>

                                     City: <?php echo do_shortcode('[types field="city"]'); ?>	                                     State: <?php echo do_shortcode('[types field="state"]'); ?>

                             <?php the_excerpt(); ?>                              <input type="button" value="Read more..." id="searchsubmit" class="readmore" onClick="javascript:location.href = '<?php the_permalink();?>';" >

                          <?php endwhile; ?>                     <?php                       global $wp_query;                      $big = 999999999; // need an unlikely integer                      echo paginate_links( array(                     'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),                     'format' => '?paged=%#%',                     'current' => max( 1, get_query_var('paged') ),                     'total' => $wp_query->max_num_pages                 ));?>


title: how to download all media files into my computer

text: How do I "download" all my photos from my media library to my local computer? I can do this one at a time, but is there a way to grab them all at one time? Sort of like a "download all" process.


title: Multiple level category drop-down

text: I'm using WordPress as a CMS and would like to have categories selectable from multiple selections i.e `<option>`. ![enter image description here](http://i.stack.imgur.com/b97Wg.jpg)![enter image description here](http://i.stack.imgur.com/KrA6n.png) As a usage example, The first dropdown would contain parent categories. Then after selecting the parent a second select drop-down would appear with the child categories. There are a few plugins available on Wordpress.org but they all seem to be broken or out of date. Any help would be appreciated. Broken plugin http://wordpress.org/extend/plugins/ajax-category-dropdown/ The code I'm using from wordpress.org               <form action="<?php bloginfo('url'); ?>/" method="get">         <?php         $select = wp_dropdown_categories('orderby=name&echo=0&depth=0&hierarchical=1&exclude=5,4');         $select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);         echo $select;         ?>         <noscript><input type="submit" value="View" /></noscript>     </form>


title: Displaying a checkbox array from advanced custom field

text: I'm using the advanced custom field plugin for wordpress and wondering if I'm able to do the following: If checkbox ticked = web and it equals the page title echo this. Does anyone know what code to use for this? UPDATE: The closest I've got is this:               <?php $fields = get_acf(); print_r ($fields->categories); ?>       But that is printing out this:               Array ( [0] => option_1 [1] => option_2 [2] => option_9 )      1. How can I print out the real names (without it saying array)? 2 Also say if it = web and matches the page title then echo something?


title: Trimming a custom field to a length

text: I have a custom field added through the Advanced Custom Fields Plugin. I am trying to trim the content of the field down to a set number of words. I have tried to use the excerpt filter and setting a custom length see code bellow but It's not working, thought?               // set the length of the excerpt     function custom_excerpt_length( $length )          {         return 20;         }          add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );          // apply the filter and strip crap from 'description'     // http://codex.wordpress.org/Function_Reference/the_content     $content = apply_filters('the_excerpt', get_field('description'));     $content = str_replace(']]>', ']]>', $content);          echo $content;          //echo wp_trim_excerpt($content);      I also tried the wp_trim_except() function but it isn't doing anything either. The whole length of the text is being echoed.


title: how can i use custom field in query post

text: I want to get all featured items using query post. featured is meta_key using custom field plugin. I tried bellow,but it failed               $featured_item = new WP_Query('posts_per_page=-1&cat=3&meta_key=>Featured List&meta_value=>Yes');      my wp version is 3.1.3 **EDIT:**               $arg2 = array(         'posts_per_page'=>'5',         'cat'=>'3',         'orderby'=>'rand',         'meta_query'=> array(             'key'=>'Featured List',             'value'=>'Yes',             'compare'=>'LIKE'         )     );          $featured_random_item = new WP_Query($arg2);      This query also failed. How can i do this Thanks in advance !


title: link posts to custom post type

text: I have a custom post type 'books' which I store different custom fields of information about books. I want to use posts and link the posts I write (in categories such as news, or offers) to the books. For example, when the user is viewing the book information page, I want to be able to display all the posts in news category related to that book. I was able to do this using a custom field and assigning the book id to the news. But what if I have a news that's related to a lot of books? Is there any way to file all the Custom Post titles to a taxonomy? What's the best way to do this?


title: Showing current taxonomy terms

text:
I've created a custom post type called "References" and a custom taxonomy "Genre". I have 2 terms : Applications and Games. My problem is that I'd like to show posts associated in Applications on a page (and the same for the games). I believe WordPress do this like doing the same for tags.... In fact, I just need to make a query and getting the current term of the page. Here is what I tried but I get the same list for each terms page (Applications and Games) :               <?php get_header(); ?>

<?php single_cat_title(); ?>

         <?php              $loop = new WP_Query( array( 'post_type' => 'references' , 'genre' => '') ); ?>         <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>                  <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php the_title(); ?>

<?php the_content(); ?>

                  <?php the_post_thumbnail();?>              <?php endwhile; // end of the loop. ?>

          <?php get_footer(); ?>      Hope someone can help me. I've Googled for a week now...


title: WP_Query based on a custom field result

text:
I would like to know if there's a way to do a query filtered by a custom field result. In this case, I have 6 posts I would like to retrieve, but only if they have "true" selected in a custom field I've previously created. The name of the custom field is called "featured". Here's my code               <?php     $recentPosts = new WP_Query();     $recentPosts->query('showposts=6');     ?>     <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
             <?php if ( has_post_thumbnail() ) {?>
                 <a href="<?php the_permalink() ?>"><?php the_post_thumbnail( 'post-thumb-140' ); ?>
              <?php } ?>                  <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?>
     <?php endwhile; ?>      I've checked WordPress documentation on possible WP_Query arguments, but there are no filters based on a custom field. Any ideas?


title: Elements floating on top of each other when Resizing or checking site on mobile. Twenty Twelve

text: I'm using WP Twenty Twelve theme for my blog: Glory and Honor and have followed the Replace #site-title with resizable image in Twenty Twelve Post to fix my logo not displaying when visiting via my mobile. (This is my first isssue) I've been struggling with having my blog layout and site-logo display properly on my iPhone and iPad. The @media CSS (from the posting I have been following) disappears my site-logo altogether. Also, I have been working on the CSS for the actual site-logo but noticed that when I remove the margins from the site-logo CSS, the logo does display on my mobile and the layout looks fine. The problem is, I do need the margins because the logo displays exactly how I want it to - centered in the header - for the desktop version. Another issue is the sign up form, search form, and shop image-button/ link I have added. They float all over the place on the desktop site (when resizing the browser) and when visiting the site via my mobile. I absolutely would like to keep the site responsive.


title: How do I insert a custom field in a user submitted post?

text: Please help! I have a form for users to submit posts, and I want them to be able to choose photos already in the media gallery based on category selected. I want to include radio buttons to choose between a few images that will attach to the post, become the featured image, or just echo out in a template file in this manner                   <?php $custommeta = get_post_meta($post->ID, "CategoryImage", true); ?>       The value of the selected image will be the image url to echo out into the custom field. I can not figure out the code to get the custom field in the form and get the value into the custom field. I think I should use add_post_meta but I am not completely sure how to incorporate it. Any help would be greatly appreciated. I am using the plugin User Submitted Posts but I would take a general answer as well.


title: How can i count the post added in relationship field, theme display

text:
How can i count the post added in relationship field. The relationship field is a plugin (http://www.advancedcustomfields.com/docs/field- types/relationship/) In my admin i have a MetaBox i create to link the post from another post type to my posts. please see picture below in the link http://i.imgur.com/PFFY8.jpg Subtitle and Trailers How can i get the number of post attach to the relationship field. Ex: If the relationship field has 4 articles added in site in tabs i want to be able to get the number of articles Ex: Trailers(1) - that are display in Front-end. Something like this ( cinemagia.ro/filme/avatar-2-578279/ ) To retrive the post and display into my theme i use               <?php if(get_field('trailere_filme') != ""){foreach(get_field('trailere_filme') as $post_object): ?>

     <a href="<?php echo get_permalink($post_object->ID); ?>" rel="bookmark" title="<?php printf(__('Trailer film %s', 'kubrick'), the_title_attribute('echo=0')); ?>">     <?php echo get_field( 'tip', $post_object->ID ); ?>          <img src="http://img.youtube.com/vi/<?php echo get_field( 'trailer', $post_object->ID ); ?>/<?php echo get_field( 'img_trailer', $post_object->ID ); ?>" alt="Trailer <?php echo get_the_title($post_object->ID) ?>" title="Trailer <?php echo get_the_title($post_object->ID) ?>">     <?php echo get_field( 'time', $post_object->ID ); ?>
     <a href="<?php echo get_permalink($post_object->ID); ?>" title="Trailer <?php echo get_the_title($post_object->ID) ?>"><?php echo get_the_title($post_object->ID) ?>
        <?php endforeach;}else{?>
Acest film nu are trailer.
     <?php } ?>      And for tags related to post in my hteme i use:               <?php     $orig_post = $post;             global $post;             $tags = wp_get_post_tags($post->ID);                  if ($tags) {                 $tag_ids = array();                 foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;                 $args=array(                     'tag__in' => $tag_ids,                     'post__not_in' => array($post->ID),                     'post_type'=> 'stiri',                     'posts_per_page'=>1, // Number of related videos that will be shown.                     'caller_get_posts'=>1                      );}     $recentPosts = new WP_Query($args);     ?>     <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?>

     <img src="/scripts/timthumb.php?src=<?php the_field('imagine_stire'); ?>&h=60&w=90&zc=1" alt="" title="<?php the_title(); ?>" />     <?php $excerpt = get_the_excerpt();echo string_limit_words($excerpt,30);?><a class="detalii" href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'kubrick'), the_title_attribute('echo=0')); ?>">...detalii

     <?php endwhile; ?>      Thanks


title: Exclude Taxonomy Terms from Template Via Back End?

text: I'm wondering if you can help me work through an issue or provide alt ideas. I have an archive displaying a list of custom tax terms in a grid view. My client needs to be able to turn on/off the terms from displaying in the grid. If these were posts this would be easy because I could simply have him check/uncheck a category for the post. However, taxonomies don't have that feature out of the box. Does anyone know how I might accomplish this?


title: How to print (or echo) name of parent category of a product?

text: I have parent categories for New and Used with sub-categories for the product type. How do I display only the parent category for the product. I would like a meta section "Condition: X" where X is the parent category name.


title: How and when to include shortcode source files

text: I am Writing a plugin, with many shortcodes. Now I do not want to include all shortcodes source files to every page. So my questions are:   1. Where should I include the source? Is it back-end or front-end   2. How to add it on that specific page? thanks HoGo


title: One page - Multiple parents?

text: I'd like to have the same pages assigned to two different parent pages, to save me making separate pages for two sections that contain mostly the same info. I'm using the WenderHost Subpages widget to generate the side menus.


title: Only homepage working correctly, 404 error on everything else

text: I've been developing wordpress based websites for some time now, and i built one for my company's own brand, it worked with no problem at all for ages, but now for some reason, i can only get the homepage properly, for startesr, this is my setup:   1. Wordpress freshly updated to 3.7.1 (although problem existed before update and i hoped the update would fix whatever was causing before i had a clue of what's going on)   2. Gantry Framework and Theme updated to the most recent   3. Several plugins, not worth enumerating because it shouldnt be a plugin problem, i tried deactivating every single one and it returned nothing new.   4. NO ACCESS TO .htaccess !!! (this is where i think the problem lies...) I believe im getting a permalink error, and i've been seeing everywhere on the internet i whould go to the permalink page and just save without making changes to flush the rewrite engine rules (sorry if this is not said the right way, im new to it), the problem is my host is not accepting my request for permissions to change the .htaccess files, for security reasons, they say... is there any way i can achieve this flush without having permissions to write on .htaccess? i have sent them the rules wordpress tells me to write on .htaccess:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>      But after writing these, nothing changes, i still dont know what happened, i dont know if they changed something server-side (probably they changed permissions, because i had no problems before some weeks ago)... Is there anyway to solve this problem on my side or do i have to just keep nagging the guys at the hosting company until they give me permission to write on .htaccess? What valid arguments could i point to them so they dont find me a threat to their servers? Thank you for your time and answers :)


title: Users - remove 'send password' checkbox

text: Is there a recommended method for removing the 'Send password' checkbox when managing users in WordPress admin? Or alternatively a way of alterting users to changes that doesn't involve mailing the password in plain text? Thanks, Toby


title: Save number of Facebook likes to database

text: I have a custom post type called Neighborhoods, which stores information about various neighborhoods of a city. Each neighborhood also has a Facebook page. What I'd like to do is for each neighborhood, use the Facebook Graph to grab the number of likes of the page and save them in the WordPress database to display in various parts of my website. I don't know exactly what code to use, but here is the basic outline:               Run this once a day:         Query neighborhood post type in the database         For each neighborhood:             $data = json_decode(file_get_contents('https://graph.facebook.com/neighborhoodURL'));             $numberOfLikes = $data->likes;             Save $numberOfLikes in it's own field in the database      And once that's set, I should be able to call the number of likes field in the loop. Anyone know the best way to do this?


title: Integrating CSS Into a WP Function Call

text: Below is a code I use to display post views. It is integrated with an options panel which allows users to choose whether to display it. I would like to integrate the div class .postviews directly into the code. I would like to do this because it incorporates a blue background and if the views are not displayed, that blue background still gets displayed.               <div class="postviews">     <?php $options = get_option('to_post_views');     if( $options == 'Yes' ) { echo getPostViews( get_the_ID() );     } ?>     </div>      If you view this page, views are currently being displayed where it says "58 views."


title: Why is the post title and content automatically being displayed in the post thumbnail (Featured image)?

text:
I use the following code to show the post thumbnail (only):                   <?php // Create and run custom loop             $custom_posts = new WP_Query();             $custom_posts->query('post_type=page_content&sections=ThemeCL');             while ($custom_posts->have_posts()) : $custom_posts->the_post();         ?>
                 <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_post_thumbnail(); ?>
         <?php endwhile; ?>      But for some reason the title and content of the post is being shown (inside tags!):

Mainbar

Hello this is the title Hello this is the post content

      I only want the post thumbnail (Featured Image) to be shown. Any suggestions?


title: Letting the user define the arguments in a custom loop? (the "$custom_posts->query(...)" part)

text:
I use the following to retrieve a post from a custom post type and custom taxonomies:               <?php // Create and run custom loop         $custom_posts = new WP_Query();         $custom_posts->query('post_type=blocks&location=Front Page&section=Mainbar');         while ($custom_posts->have_posts()) : $custom_posts->the_post();     ?>

<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
     <?php endwhile; ?>      In the Page, I want to create fields that will let the user customize the loop arguments like this:               $custom_posts->query('post_type=blocks&location=<Enter Location>&section=<Enter Section>');      What's the easiest way of doing this? How would that code look like?


title: TinyMCE 4 & wp_editor multiple editor issue

text: Just updated WordPress to new 3.9, new features are great, love them. Only got some issues with tinyMCE 4. I use `wp_editor` to create multiple tinyMCE editors with custom field. Here is the code:               $tinymce_opt = array(      'height'    => "250",      'plugins'  => "nz_button, line, gap, slider_colorbox, icon_list, icons, font_size",      'toolbar1' => "formatselect,fontselect, styleselect,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,|,forecolor,removeformat,charmap,undo,redo",      'toolbar2' => "nz_button, line, gap, slider_colorbox, icon_list, icons, font_size",      'toolbar3' => ""     );           $settings = array (         'tinymce'       => $tinymce_opt        );       wp_editor( ${"layer_$i"}, "layer_$i", $settings);      Everything is fine. The problem is that it does not understand plugins (my custom shortcodes, that i created). Custom shortcodes work fine in regular wp editor, but in multiple wp_editor, it just does not find them. In colsole i get error 404 can’t find for example “line” shortcode http://mywebsite.com/wp-includes/js/tinymce/plugins/line/plugin.min.js 404 (Not Found) All my custom shortcodes are ignored, not found. Does anyone know, how to tell tinyMCE + wp_editor to use custom shortcodes? My custom shortcodes are located in my theme P.S. It worked fine with old tinyMCE.


title: “Custom Field” to Excerpt field" for pages?

text: In the question "Copy SEO Meta Desc “Custom Field” to Excerpt field?" The plugin posted as a part of brasofilo's answer works great but, I would like to alter the excerpt for Pages of my WordPress site instead of or in addition to posts. How would I accomplish this?


title: Custom Post Type not working with Capabilities

text: I have the following custom post type that I am using on one of my sites:               function careers_post_type() {              $labels = array(             'name'                => _x( 'Careers', 'Post Type General Name', 'text_domain' ),             'singular_name'       => _x( 'Career', 'Post Type Singular Name', 'text_domain' ),             'menu_name'           => __( 'Careers', 'text_domain' ),             'parent_item_colon'   => __( 'Parent career:', 'text_domain' ),             'all_items'           => __( 'All careers', 'text_domain' ),             'view_item'           => __( 'View career', 'text_domain' ),             'add_new_item'        => __( 'Add New career', 'text_domain' ),             'add_new'             => __( 'New career', 'text_domain' ),             'edit_item'           => __( 'Edit career', 'text_domain' ),             'update_item'         => __( 'Update career', 'text_domain' ),             'search_items'        => __( 'Search careers', 'text_domain' ),             'not_found'           => __( 'No careers found', 'text_domain' ),             'not_found_in_trash'  => __( 'No careers found in Trash', 'text_domain' ),         );         $args = array(             'label'               => __( 'career', 'text_domain' ),             'description'         => __( 'career information pages', 'text_domain' ),             'labels'              => $labels,             'supports'            => array( ),             'taxonomies'          => array( ),             'hierarchical'        => false,             'public'              => true,             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_nav_menus'   => true,             'show_in_admin_bar'   => true,             'menu_position'       => 5,             'can_export'          => true,             'has_archive'         => true,             'exclude_from_search' => false,             'publicly_queryable'  => true,             'capability_type' => 'post',         );         register_post_type( 'career', $args );          }      The sucker works beautifully. However I want to add a custom capability to it. I used this tutorial: http://justintadlock.com/archives/2010/07/10/meta- capabilities-for-custom-post-types Once I make the code this, it stops working:               // Register Custom Post Type     function careers_post_type() {              $labels = array(             'name'                => _x( 'Careers', 'Post Type General Name', 'text_domain' ),             'singular_name'       => _x( 'Career', 'Post Type Singular Name', 'text_domain' ),             'menu_name'           => __( 'Careers', 'text_domain' ),             'parent_item_colon'   => __( 'Parent career:', 'text_domain' ),             'all_items'           => __( 'All careers', 'text_domain' ),             'view_item'           => __( 'View career', 'text_domain' ),             'add_new_item'        => __( 'Add New career', 'text_domain' ),             'add_new'             => __( 'New career', 'text_domain' ),             'edit_item'           => __( 'Edit career', 'text_domain' ),             'update_item'         => __( 'Update career', 'text_domain' ),             'search_items'        => __( 'Search careers', 'text_domain' ),             'not_found'           => __( 'No careers found', 'text_domain' ),             'not_found_in_trash'  => __( 'No careers found in Trash', 'text_domain' ),         );         $args = array(             'label'               => __( 'career', 'text_domain' ),             'description'         => __( 'career information pages', 'text_domain' ),             'labels'              => $labels,             'supports'            => array( ),             'taxonomies'          => array( ),             'hierarchical'        => false,             'public'              => true,             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_nav_menus'   => true,             'show_in_admin_bar'   => true,             'menu_position'       => 5,             'can_export'          => true,             'has_archive'         => true,             'exclude_from_search' => false,             'publicly_queryable'  => true,             'capability_type' => 'career_editor',             'capabilities' => array(                 'publish_posts' => 'publish_career',                 'edit_posts' => 'edit_career',                 'edit_others_posts' => 'edit_others_career',                 'delete_posts' => 'delete_career',                 'delete_others_posts' => 'delete_others_career',                 'read_private_posts' => 'read_private_career',                 'edit_post' => 'edit_career',                 'delete_post' => 'delete_career',                 'read_post' => 'read_career',             ),         );         register_post_type( 'career', $args );          }      I even tried taking the capabilities array out and the content type still vanishes. What am I doing wrong?


title: How to get attachments for a specific post type?

text:
I have this page where I am showing all post's attachments. This is the code:               <?php     $args = array(         'post_type' => 'attachment',         'post_status' => 'published',         'posts_per_page' =>25,         'post_parent' => null, // Post-> ID;         'numberposts' => null,     );          $attachments = get_posts($args);          $post_count = count ($attachments);          if ($attachments) {         foreach ($attachments as $attachment) {         echo "
";             $url = get_attachment_link($attachment->ID);// extraigo la _posturl del attachmnet                   $img = wp_get_attachment_url($attachment->ID);             $title = get_the_title($attachment->post_parent);//extraigo titulo             echo '';             echo "
";         }        }     ?>      Now, I have the 'post', 'page' and 'videos' post_types. I am getting all of them but I want to display 'post' post_type only. How do I exclude 'video' post_type? Thanks!


title: How to display milliseconds instead of seconds using timer_stop function?

text: I'm trying to display milliseconds instead of seconds using timer_stop wordpress function. Currently I have               $sbp_speed = timer_stop(0,2);      That display the time like `1.56` s and I need to display the time like `455.1 ms` Thank you!


title: How can i remove the posts category class names from body_class

text: I have 2 categories, just to make an easy example, Cars and Bikes. I have a post that fits both of the category. If i visit the Cars category, the body_class looks like this: "archive category category-cars category-1 category-cars category-bikes" The problem is that somehow the post category is visible in the body_class after the category-1 classname. How can i avoid this? I need to use different colors for different categories, but right now the category-bikes class overwrites the category-cars class.


title: mysql custom wp query

text: this code is designed to select posts with selected meta value in wordpress query               <?php $values = $wpdb->get_results("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key  = 'wpcf-scr'",ARRAY_A);?>     <select name="wpcf-scr">     <option value="">default</option>     <?php foreach ($values as $value):?>     <?php if($value['meta_value']):?>         <option value="<?php echo $value['meta_value']?>"><?php echo $value['meta_value']?></option>     <?php endif;?>     <?php endforeach;?>     </select>      I need to re use the code but with selecting posts with tags(manual assigned) not meta values... something like this below just for explanation (it's wrong)               <?php $values = $wpdb->get_results("SELECT DISTINCT post_tags FROM $wpdb->tags ",ARRAY_A);?>     <select name="tags">     <option value="">default</option>     <option value="tag1">tag1</option>     <option value="tag1">tag2</option>     <option value="tag1">tag3</option>     <option value="tag1">tag4</option>     </select>      How to make the second example correctly ? thanks


title: Is There a Plugin Life Cycle Documentation?

text: Is there some documentation somewhere that explains what is the life cycle of the plugins? I'm starting a new plugin with OOP style, and I just found out that my main class is being instanciated **a lot** (thanks to Xdebug and Netbeans).   I wonder why, and it annoys me because I'm instanciating a Dropbox-API object, and I really didn't think WordPress would just instanciate my main class that much. I haven't found anything related to the plugins life cycle in the Codex nor on Google.


title: Designing a member area on my site

text: I am new to wordpress and I have a website I inherited and I have never even heard of wordpress. My first mini project is to create a page with my members that can then be linked to a personal page that has information about them. Is there anything I should look into?