Change from all posts to specific categories post on main page?

How do I change my index.php to display only the desired categories posts in the main page ? I tought that changing this would workout but instead it just print nothing:                           query_posts( array(                 'post_type' => array(                             'post',                             $include_reviews,                             $include_screenshots,                             $include_videos                         ),                         'paged' => $paged )                     );      Change from `'post',` to `'cat=10',` not very sure how to do this. This is my index.php file:               <?php get_header(); ?>              <?php         $slider_number = get_option('lp_slides_number');         $args = array( 'post_type' => 'slider', 'showposts' => $slider_number );         $slider_loop = new WP_Query( $args );         if ($slider_loop->have_posts()) : ?>

                  <?php while ( $slider_loop->have_posts() ) : $slider_loop->the_post(); $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), false, '' ); ?>                 <div class="featured-item" style="background:<?php echo get_post_meta($post->ID, 'feature_bg', true); ?> url(<?php echo $src[0]; ?>) no-repeat center; height:280px;">

<a href="<?php echo get_post_meta($post->ID, 'feature_url', true); ?>" rel="bookmark" title="Link Permanente: <?php the_title(); ?>"><?php the_title(); ?>

Por <?php the_author(); ?>, <?php the_time( get_option('date_format') ); ?>

             <?php endwhile;             wp_reset_query(); ?>

                  <?php endif; ?>

Last News
                                               <?php                          if(get_option('lp_include_reviews') == "true") { $include_reviews = "'reviews',"; }                     if(get_option('lp_include_videos') == "true") { $include_videos = "'videos',"; }                     if(get_option('lp_include_screenshots') == "true") { $include_screenshots = "'screenshots',"; }                          query_posts( array(                     'post_type' => array(                                 'post',                                 $include_reviews,                                 $include_screenshots,                                 $include_videos                             ),                             'paged' => $paged )                         );                     ?>                     <?php if (have_posts()) : ?>                     <?php while (have_posts()) : the_post(); ?>                              <?php                              if ( get_post_type() == 'reviews' ) : ?>                                  <?php include( TEMPLATEPATH . '/includes/show-reviews-frontpage.php' ); ?>                              <?php elseif ( get_post_type() == 'videos' ) : ?>                                  <?php include( TEMPLATEPATH . '/includes/show-videos-frontpage.php' ); ?>                              <?php elseif ( get_post_type() == 'screenshots' ) : ?>                                  <?php include( TEMPLATEPATH . '/includes/show-screenshots-frontpage.php' ); ?>                              <?php else: ?>                                  <?php include( TEMPLATEPATH . '/includes/show-posts.php' ); ?>                              <?php endif; ?>                          <?php endwhile; ?>                     <?php kriesi_pagination(); ?>                     <?php wp_reset_query(); ?>                          <?php endif; ?>

                       <?php get_sidebar(); ?>          <?php get_footer(); ?>


Best Way to Create Multi Level Categories/Taxonomies

I am looking for experience on the best way to create multi level categories. I am building a WordPress site for an organization that sells plant seeds. They have five levels of organizing their seeds. EX:   Seeds (Custom Post Type) > Grains > Rye > Secale Cerale > White Rye It would be the same structure as: Computers > Mac > iMac > 27" Because the organization has 500+ seeds available, we want to organize them by their categories. What is the best way to do this - simply using WordPress built in categories feature? I have heard that it is bad practice to assign one post to more than one category. I prefer to write as much custom code as possible and would like to stay away from widgets (unless they are really good) :)


WordPress 3.2 - Problem with WYSIWYG editors in a custom post type?

I'm using this class http://www.deluxeblogtips.com/p/meta-box-script-for- wordpress.html to create custom meta-box in which it contains some WYSIWYG editors. It works fine until I upgraded my WP to 3.2. The WYSIWYG editors are now have white text background and all tinyMCE buttons are gone! I guess they've changed quite a lot of things in TinyMCE editor in this 3.2 version to accommodate the "full screen editing" stuff. Bad for me though, it destroys my custom metabox... And there is no documents about this change, at all


Taxonomy for costum post type not found

I'm trying to use taxonomies to create categories for my costum post type. I registered the necesary components:               add_action( 'init', 'create_post_type' );     function create_post_type() {         register_post_type( 'bkroadkill',             array(                     'labels'        => array(                     'name'          => __( 'Roadkills' ),                     'singular_name' => __( 'Roadkill' )                 ),             'public'      => true,             'has_archive' => true,             'supports'    => array( 'title', 'custom-fields', 'author', 'thumbnail', 'comments' )             )         );     }          function roadkill_categories_init() {         $labels = array(             'name'              => _x( 'Roadkill Categories', 'taxonomy general name' ),             'singular_name'     => _x( 'Roadkill Category', 'taxonomy singular name' ),             'search_items'      => __( 'Search Roadkill Categories' ),             'all_items'         => __( 'All Roadkill Categories' ),             'parent_item'       => __( 'Parent Roadkill Category' ),             'parent_item_colon' => __( 'Parent Roadkill Category:' ),             'edit_item'         => __( 'Edit Roadkill Category' ),              'update_item'       => __( 'Update Roadkill Category' ),             'add_new_item'      => __( 'Add New Roadkill Category' ),             'new_item_name'     => __( 'New Roadkill Category' ),             'menu_name'         => __( 'Roadkill Categories' ),         );         $args = array(             'labels' => $labels,             'hierarchical' => true,             'rewrite' => true,             'name'  => 'roadkill_category',             'id'  => 'roadkill_category',         );         register_taxonomy( 'roadkill_category', 'bkroadkill', $args );     }     add_action( 'init', 'roadkill_categories_init' );      And I was able to create some roadkill categories in the wp-admin backend. But as I click on view I will result in annot found page. Also I am not able to fetch my categories to use them in my dropdown of my form (it will be empty).                       <?php $args = array(                     'name'               => 'roadkill_category',                     'taxonomy'           => 'roadkill_category',                     'hide_if_empty'      => false,                 ); ?>                      <?php wp_dropdown_categories( $args ); ?>       What did I miss here? EDIT: There are two different not foudn pages (the one when permalink is not working (404) and another one when content is not found I guess. The title is set correctly then


Add Link Category on Activation?

Is it possible to add a link category on plugin activation? What I mean is the Links section, as you know by default it has the Blogroll link category. I want to add a new link category when my plugin is activated, is there a quick and easy way to do this? What is the best method to use? Thanks.


twenty eleven single.php

I am using twenty-eleven theme for my site, I just saw that in single posts page, .i.e single.php, the sidebar is absent, which means no widgets in single.php page How do I bring it back


Different thumbnails for index and article page

For my aricles (wp7app.de) I'd like to use two different thumbnails, one which is displayed only on the index page (150x150) and one for the article page (600x400). However, I don't want to use a cropped version of the big image for the index. Is this something that can be done easily without an extra plugin or can you recommend a good / simple one? Cheers


$wpdb prepare issue with mysql DATE_FORMAT

Today, I have a issue in $wpdb. I used               $result = $wpdb->get_var(        $wpdb->prepare(         "SELECT DATE_FORMAT(report_date, '%d-%m-%Y') FROM table WHERE report_id = %d",          $report_id         )     );      The above code not works because of %d in DATE_FORMAT. How i solved this issue in wordpress


Detect Page Template inside Loop possible?

I'm a bit stuck with my actual theme development. I'm using different Blog Templates to choose from. Now each of those Blog Page Templates has a custom loop to pull the posts. Inside that loop I use the get_template_part() function to pull the right post format template. `<?php get_template_part( 'framework/inc/post-format/entry', get_post_format() ); ?>` Now one thing: Inside the post format templates (entry.php) I want to check which blog page template is used to set a thumbnail size according to the template. As we are in the loop now, the is_page_template() function doesn't work. Can anybody help me here? Maybe it's just too late, but actually I don't see a solution. And: I don't want to use the include(locate_template()) workaround to pass variables to the entry.php template. Thanks in advance, Phil


categories on attachment page

I am using this function to display categories specified to a post having gallery on the image attachment page.
CATEGORY: <?php the_category(', '); ?>
      The problem is that this function doesn't return anything. I have also used this way to display categories but no success:                   <?php $categories = get_the_category();               $separator = ', ';               $output = '';                if($categories){ ?>               CATERGORY:         <?php foreach($categories as $category) {         $output .= 'term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '">'.$category->cat_name.''.$separator;             }         echo trim($output, $separator);             }             ?>      Can anyone tell where problem lies??? Thanks


Retreaving all images attached to current post

I am trying to retrieve attachments that are attached to my current post. This is the code that I am trying to use. What I'm attempting to do is query all of my posts that are of custom post type business-manager. From within that loop I am starting another query to retrieve the attachments associated with that post. If I var dump the $attachment variable I get an empty array. If I pass the array for attachment variable into get_posts($args) then do a var dump I can retrieve all of the images. How can I do this using a new WP_Query object?               $my_query = new WP_Query( array(                'post_type'         =>  'business-manager',                'posts_per_page'    =>  1,                'tax_query'         =>  array(                    'taxonomy'      =>  'business-type',                    'field'         =>  'slug',                    'terms'         =>  'featured'                )         ) );               $attachment = new WP_Query( array(         'post_type' => 'attachment',         'numberposts' => -1,         'post_status' => null,         'post_parent' => $my_query->post->ID     ) );


Removing parent slug from URL on custom post type

As the title states, I'd like to remove parent slugs from URLs for a particular post type: services. Something that would change this:               http://demo.com/parent-service/child-service-1     http://demo.com/grand-parent-service/parent-service/child-service-2     http://demo.com/great-grand-parent-service/grand-parent-service/parent-service/child-service-3     etc      To something like this:               http://demo.com/child-service-1     http://demo.com/child-service-2     http://demo.com/child-service-3     etc      I'd rather not use an additional plugins to accomplish this. I'm currently delivering the CPT via a plugin, which also registers a custom taxonomy.


Dynamic menu links after header title

I am using Parabola theme of Wordpress, and i would like to display few dynamic menu links for logged in users, just at the right of the header title. As shown in the below image, Menu 1 and Menu 2 links should be placed at the right of header title. ![enter image description here](http://i.stack.imgur.com/QcSUM.png) What would be the best approach for this? I don't prefer a plugin, but instead like to use theme hooks, because when the theme changes, i can just write a hook for achieving the same functionality. Please suggest where should i modify code, or what new functions i have to write. **EDIT:** I would like to keep the main menu as it is. I only want custom menu links after header title.


More Fields: Input "Values (if applicable)" is disabled

I have create a box and some fields in it. One of them is of type select. In the field `Values (if applicable)` I cannot change the content anymore. The field is disabled. I tried to delete all posts which where using this fields but still the field is disabled. Is the only way to completely delete the field and add a new one?


How to Add jQuery Infinite Scroll to My Custom Archive Page

I currently have a custom archive page that displays my current post at the top and then links to all of my older posts below that. However, I need to break up the page so that it displays the current post and then below that just the current months posts. I want to use the jQuery infinite scroll plugin to display older posts month by month as they scroll down the page it automatically loads the next month's posts. Here is my code that I have to display the current post:               <?php get_header(); ?>

                 <?php                 global $post;                 $tmp_post = $post;                 $args = array( 'numberposts' => 1, 'category' => 6 );                 $myposts = get_posts( $args );                 foreach( $myposts as $post ) : setup_postdata($post); ?>                     <a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
                     <?/* <?php the_excerpt(); ?> */?>                     <?php the_content();?>                 <?php endforeach; ?>

                         <?php                          $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID );                          $attachments = get_posts($args);                         if ($attachments) {                             foreach ( $attachments as $attachment ) {                                 echo '
';                                 the_attachment_link( $attachment->ID , 'full' );                                 echo '
';                             }                         }                         ?>
                                 <?php $post = $tmp_post; ?>

      Here is the code I have to display my older posts:

Browse Our Archives

         <?php          global $post;          $tmp_post = $post;          $myposts = get_posts('numberposts=-1&category=6&orderby=date&order=DESC');          foreach($myposts as $post) :         ?>         <?php              setup_postdata($post);                     $size = 'thumb';                     $images = get_children(array(                     'post_type' => 'attachment',                     'numberposts' => 1,                     'post_status' => null,                     'post_parent' => $post->ID));                     foreach($images as $image){                     $attachment = wp_get_attachment_image_src($image->ID, $size);                     ?>                     <div class="rea-con" style="background: url(<?php echo        $attachment[0]; ?>) no-repeat center center;">
<a href="<?php the_permalink(); ?>" title="<?php the_title();?>"><?php the_title(); ?>

                    <?php } ?>             <?php endforeach; ?>         <?php $post = $tmp_post; ?>

        How can I break up the section of older posts code so that by default it only pulls back the current months posts and then as they scroll down it will automatically display the previous months posts and then when they scroll down more it will automatically display the month before that's posts? I want to use the jQuery infinite scroll plugin to do this. Any help is appreciated. Thanks!


Remove updates text on plugin or themes list page

I seen update messages as like " **There is a new version of BLAH PLUGIN available on BLAH SITE. View version 3.1.3 details or automatically update** " on plugin list page and themes listing page before install the **Disable WordPress Updates** plugin. I thought after installed the plugin these lines will be removed. But it was not. **How can i remove these updates text from plugin list or themes list page?**


Using setup_postdata() with multi-dimensional array

I feel like this is going to be one of those _slap yourself on the head_ questions, but here it goes anyway: I have a multi-dimensional array of data:               Array     (         [0] => Array             (                 [id] => 1033                 [zip] => 27604                 [distance] => 0             )              [1] => Array             (                 [id] => 1024                 [zip] => 27615                 [distance] => 6             )          )      The `id` field in each is the `post ID` and what I'm really after. What I've tried thusfar is something like:               foreach( $locations as $post ) {         setup_postdata($post['id']);              echo get_the_title();          }     wp_reset_postdata();      with no luck. Am I approaching this all wrong - what's the best way to get that darned ID value to run through `setup_postdata()`? I still need to reference the other data in the multi-dimensional array (`zip` and `distance`).


Using locate-template & shortcodes doesn't appear to work

For organisation, I'm trying to split up the functions.php file into separate files. In particular the functions for shortcodes in a separate file, with the shortcodes being defined in functions.php. Here's the code in the functions.php:-               locate_template( array( 'inc/shortcode-functions.php' ), true, true );      add_shortcode( 'abc-row', 'echo_abc_row' );     add_shortcode( 'abc-span', 'echo_abc_span' );      I have taken the code out of inc/shortcode-functions.php into the functions.php, so does appear to work, and no error is coming up in debug mode, so I'm a bit stumped. Any ideas?


Pagination for Pages and Posts

I want to use Pagination throughout a new theme but am having trouble getting it to work correctly. I am using some code within my functions.php file and then calling that function. It works on the 'blog' page but not on paginated posts or pages. Here is my code:               // Pagination for paged posts, Page 1, Page 2, Page 3, with Next and Previous Links, No plugin     function canvas_pagination()     {         global $wp_query;         $big = 999999999;         echo paginate_links(array(             'base' => str_replace($big, '%#%', get_pagenum_link($big)),             'format' => '?paged=%#%',             'current' => max(1, get_query_var('paged')),             'total' => $wp_query->max_num_pages,             'type' => 'list'         ));     }          add_action('init', 'canvas_pagination'); // Add our Pagination      And call the funtion: `<?php get_template_part('pagination'); ?>` This code works great within the index.php file. See here: http://website- test-lab.com/sites/blank_canvas/blog/ But not within single.php and page.php:   * SITE URL + /paginated/   * SITE URL + /page-pagination/ ( _Can't add more than 2x links here_ ) Can someone explain why this doesn't work and what needs to be amended to fix it. I have tried using wp_link_pages but it's not giving me the ability to customise the output I require. Thanks in advance


Is there a standard for naming plugin versions

My business partner and I are developing several plugins and we want to know if there is a standard for the version number of a plugin when there are updates, i.e., version 1.0, version 1.2, version 1.2.3, etc? Thanks for any advise.


Saving (Updating) Post / Page Edits With AJAX

One of the major frustrations while editing posts/pages is that after saving, two things happen:   * The admin page is reloaded, which takes time   * More importantly, the cursor position is lost If you're working on longer posts — especially when copy-editing, or if working in HTML mode and making small adjustments where frequent previews are needed — losing the current position, then finding the point where you left off is unnecessarily frustrating and time-consuming. An elegant solution to this problem would be if the updates would be done over AJAX. Actually there used to be a plugin for this, but it hasn't been updated in over 5 years and it doesn't work with current WP versions anymore. Is there an (easy) way to either:   * Fix that plugin, or   * Hack `post.php` to add a working "AJAX Save" button? Interestingly, WordPress already has an AJAX update functionality which it uses when Auto-Saving. Perhaps that could be starting point? I truly believe this is an important UX issue and would greatly appreciate your help. Thank you!


Show editor widgets only on pages that use a specific template?

I am utilizing the following code to add an additional three Featured Images to homepages in a multisite installation:               if (class_exists('MultiPostThumbnails')) {         new MultiPostThumbnails(             array(                 'label' => 'Core Home Image 1',                 'id' => 'core-home-1',                 'post_type' => 'page'             )         );         new MultiPostThumbnails(             array(                 'label' => 'Core Home Image 2',                 'id' => 'core-home-2',                 'post_type' => 'page'             )         );         new MultiPostThumbnails(             array(                 'label' => 'Core Home Image 3',                 'id' => 'core-home-3',                 'post_type' => 'page'             )         );     }      The new edit page widgets are displaying and functioning as they should, however, they are appearing on all edit pages. How do I force WordPress to only display them on the pages that use a specific template, i.e. Core Front Page Template (wp-content/themes/mytheme/templates/core-front-page.php)? Thanks in advance for your help.


Displaying Custom Fields on Post with Genesis Child Theme

I have tried everything to get Custom Fields to display on my posts using a Child Theme of the Genesis theme framework. I have tried to follow every tutorial I could find relating to it but still I can't get my Custom Fields to show on my posts! The simplest looking solution I have been trying is using Brad Daltons instructions (I have tried many other methods) and adding the following to my functions file:               add_action( 'genesis_after_post_title', 'custom_field_before_content' );     /**     * @author Brad Dalton - WP Sites     * @link http://wp.me/p1lTu0-9WF     */     function custom_field_before_content() {     if(is_page() || is_single() ) {     genesis_custom_field('instrument');     }     }      I have then added the custom field in my posts. I have tried adding the custom field with Advanced Custom Fields which shows perfectly in the admin but not on the post on my site. Does anyone know what I am doing wrong to get this to output or a different method that might work for me. I done this no problem with different themes but using the Genesis theme framework I can't get this to work - have been at it for two days! Thanks, Ciarán


Can't preview custom post - Redirected to home page

When I click on preview in custom post types I get redirected to home page. But when I visit or view the page that have all the Custom posts in I can see all of them. I cant figure out what or why. **NOTE** I allready tried all the Settings -> Permalinks options. **Update #1 CTP registration**               function register_cpt_cars() {         $labels = array(              'name' => _x( 'Cars', 'cars' ),             'singular_name' => _x( 'Cars', 'cars' ),             'add_new' => _x( 'Add new', 'cars' ),             'add_new_item' => _x( 'Add new Car', 'cars' ),             'edit_item' => _x( 'Edit Cars', 'cars' ),             'new_item' => _x( 'New Car', 'cars' ),             'view_item' => _x( 'Show cars', 'cars' ),             'search_items' => _x( 'Search Car', 'cars' ),             'not_found' => _x( 'No car found', 'cars' ),             'not_found_in_trash' => _x( 'No cars found in the trash', 'cars' ),             'parent_item_colon' => _x( 'Parent cars:', 'cars' ),             'menu_name' => _x( 'Cars', 'cars' ),         );              $args = array(              'labels' => $labels,             'hierarchical' => false,             'description' => 'New Cars',             'supports' => array( 'title', 'editor', 'thumbnail' ),             'taxonomies' => array( 'category'),             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'menu_position' => 20,             'menu_icon' => get_stylesheet_directory_uri() . '/img/icons/53-house.png',             'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'has_archive' => true,             'query_var' => true,             'can_export' => true,             'rewrite' => true,             'capability_type' => 'post'         );              register_post_type( 'cars', $args );     }      **Update #2** Tried removing **rewrite** and **capability** _type from CTP registrations. Still dont work. I get to my homepage but the URL changes.


How to add set featured image button in wp_editor()?

I am working in a plugin and in that plugin adding wordpress default editor(wp_editor)and adding functionality to save post with add media features. Add media features is working absolutely fine and adding media to respective post, but i want to add image as a thumbnail but i am not able to add set featured image button to the add media button. This is the code i am writing to add WordPress default editor:               wp_editor( $post_content , 'productinfoeditor', array(     'media_uploads'=>true,     'textarea_name' => 'product_info_content',      'editor_class' => 'requiredField',      'teeny' => true,      'textarea_rows' => 14     ) );      In `function.php` file               add_theme_support( 'post-thumbnails', array('post','page', 'product' ) );      And saving post with:               $post = array();     $post['post_type'] = 'product';     $post['post_content'] = $product_info_content;     $post['post_author'] = $user_ID;     $post['post_status'] = 'publish';     $post['post_title'] = $product_title;     $post_id = wp_insert_post( $post );


Bulk Edit Tags in WordPress?

I would like to have the ability to bulk edit post tags in WordPress. I found an article here which uses a very old version of WordPress (the article published in 2011) and it appears that back then you could bulk edit tags. However, I have just installed a clean install of WordPress 3.9.1 to ensure no plugins were interfering with Bulk Edit, and when I choose multiple posts with the same or different tags, nothing shows up in the Tags textarea! Is this a bug? I've searched around for plugins which may enable this feature but I have not found anything that works. Screenshots: ![Tags - Quick Edit](http://i.stack.imgur.com/JQLtL.png) Quick Edit - works fine. ![Tags - Bulk Edit](http://i.stack.imgur.com/JIGrU.png) Bulk Edit - nothing here. Screenshot from version of WordPress from 2011 (from above URL): ![Working in old version](http://i.stack.imgur.com/xR54N.png) Shows that tags used to appear in the Bulk Edit screen. Any ideas? Thanks


wp_mail very slow

I have a question about the wp_mail() function. Right now I'm having the following button to send e-mail with:               echo '<input type="submit" name="send_button" value="verzenden" id="'.$post_id.'" class="send_post">';      which triggers a jQuery request:               jQuery(document).ready(function() {          jQuery(".send_post").click(function() {              var post_id = $(this).attr('id');              jQuery.ajax({             async: false,             type: 'get',             url: nieuwsbrief.sendmail_url,             data: 'postid=' + post_id,                 success: function(data) {                     alert(data);                     return false;                 }         });     });          });      jQuery sends the request to `sendmail.php`. Which includes the following:               <?php      include_once $_SERVER['DOCUMENT_ROOT'] . '/www/wordpress/wp-config.php';      include_once $_SERVER['DOCUMENT_ROOT'] . '/www/wordpress/wp-load.php';      include_once $_SERVER['DOCUMENT_ROOT'] . '/www/wordpress/wp-includes/wp-db.php';           global $wpdb;          $subscribers = $wpdb->get_results(      $wpdb->prepare(          "SELECT * FROM                  wp_nwsbrf_subscribers                      INNER JOIN                          wp_nwsbrf_couple                             INNER JOIN                                  wp_nwsbrf_categories                                     INNER JOIN                                         wp_posts                                         WHERE                                              wp_nwsbrf_subscribers.category_id = wp_nwsbrf_categories.category_id                                             AND                                              wp_nwsbrf_couple.category_id = wp_nwsbrf_categories.category_id                                             AND                                              wp_nwsbrf_subscribers.category_id = wp_nwsbrf_couple.category_id                                             AND                                             wp_posts.ID = wp_nwsbrf_couple.ID                                             AND                                             wp_nwsbrf_couple.ID = %d", $_GET['postid']) );               foreach ($subscribers as $subscriber) {              $to = $subscriber->subscriber_mail.",";         $title = $subscriber->post_title;         $message = $subscriber->post_content;              wp_mail($to, $title, $message);     }          ?>      As you can see, the mail has to be sent in `sendmail.php` (url: `nieuwsbrief.sendmail_url`). But when I click on the send_button it takes minutes (3 or 4) to send the e-mail!? What am I doing wrong here? Thanks for helping me out!


How can I make Capital letter ( upper-case ) permalinks?

How can I make a link like this? `http://www.lifecellskin.us/Dev/About` the "Using_Permalinks" part, A is Capital letters. But WP automatically convert upper case to lower case. I'm trying to convert an old site that made by only html to a WP platform site. Some links to the site look like this: `http://www.lifecellskin.us/About` The site is already indexed by SEO. so I don't want to lose SE rankings. Thanks for reading this, and hope somebody will be able to shed some light on it...


Need correct results from 6 rss (fetch_feed)

I Just need some correct results from 6 rss feed I am fetching 6 feeds and maked a news ticker bar at `http://thehoopdoctors.com/online2/newfeed/` I am getting results from 6 rss feeds like First getting all posts from `http://thehoopdoctors.com/online2/newfeed/",` Then All `"http://thepigskindoctors.com/newfeed/",` Then All `"http://thepuckdoctors.com/newfeed/",` Then All `"http://thecagedoctors.com/newfeed/",` Then All `"http://thedugoutdoctors.com/newfeed/",` Then All `"http://videogoneviral.com/newfeed/"` I just need get one by one. I just need to get post from all urls one bye one like `"http://thepigskindoctors.com/newfeed/",` first post `"http://thepuckdoctors.com/newfeed/",` first post and so on. my code is               <?php          $rsslist=array(     "http://thehoopdoctors.com/online2/newfeed/",     "http://thepigskindoctors.com/newfeed/",     "http://thepuckdoctors.com/newfeed/",     "http://thecagedoctors.com/newfeed/",     "http://thedugoutdoctors.com/newfeed/",     "http://videogoneviral.com/newfeed/"     );     $feed = fetch_feed($rsslist);     ?>
     <?php     foreach($feed->get_items() as $item) {?>
<a style="color:white !important;" href="<?php echo $item->get_permalink();?>"><?php echo $item->get_title();?>
     <?php }?>


How to attach images that I "insert from url" into the post?

I'm trying to get the list of images in my post, to display them in the front page... the problem is that when I add a new picture from a URL, it doesn't seem to attach it.               $images =& get_children( 'post_type=attachment&post_mime_type=image' );      This returns an empty array... how can I solve this so I can actually use these images and create thumbnails to display them on the front?


How to replace post image url before posting using api?

I am currently writing phpNuke import Wrdpress plug-in. I have a problem with importing posts with images: \+ I already had written a routine which extracts image tag text and images from source post HTML \- I need to **replace** `img` tags with the ones imported to wordpress media library. Example: phpNuke post content:                ...bla bla...              bla bla...      should be translated to wordpress into something like this:                ...bla bla...              bla bla...      I had found a wordpress function media_sideload_image which according to description imports image from given URL into a library and attaches it to the post with given id... But to **replace** image tag with new I need to:   1. insert post with wp_insert_post and save post id   2. use media_sideload_image to import and receive image tag   3. extract `src` attribute from `img` tag    4. replace `src` in post html    5. update post with wp_update_post This leads to duplicating post data (adding extra revision). **My questions are:**   * Is there any way to add image to Wordpress post in more straightforward way? (without double posting)   * Is the linkage of image to post obligatory?


Why my plugins are updating automatically?

I have a wordpress site with a few plugins. I had to make some custom changes on a plugin (not a best practice), and of course I don't want to update that plugin. But for some reason all my plugins have been updating themselves automatically without asking. ( Is that even possible ?!!). I have never had this behavior before. I know that some plugins will show a notification whenever a new version is available and then I must click to update it. My question is: **Is it possible that my plugins are updating without asking?** or perhaps this could be a security issue and I might have an unwanted admin updating the plugins ? \-- Edit -- I think I found my problem. I posted the answer. Thanks for all the others answers, they helped me to rule out other possibilities.


Inconsistent server code response using HTTP API

I'm using Wordpress http api to get a server response code from youtube api so I check the validity of a video. I do this in a function from my functions.php which processes my post form where I collect the url of the youtube video. The issue is I'm getting inconsistent responses as where videos that are valid are returning 403's occasionally. Now I also check the validity on the front end using jquery .ajax() using the same youtube api request and that works correctly 100% of the time. So a video will validate using youtube api and jquery and then sometimes return a 403 using the php method. So what is the issue here? This is my processing function for the form. You'll notice I'm printing out the $video_id every time to make sure it's correct and it is.               function video_process_form( $query ) {       global $error_output;        if ( $query->is_page( 'submit-video' ) && isset( $_POST['title'] )) {              $output = null;               if ( ! function_exists( 'wp_handle_upload' )) {             require_once(ABSPATH . "wp-admin" . '/includes/image.php');             require_once(ABSPATH . "wp-admin" . '/includes/file.php');             require_once(ABSPATH . "wp-admin" . '/includes/media.php');         }              $file = $_FILES;              // Do some minor form validation to make sure there is content         if ($_POST['title'] != null && $_POST['title'] != 'Video Title') {             $title =  $_POST['title'];         } else {             $error_output .= 'Please enter a video  title
';         }              if ($_POST['description'] != null && $_POST['description'] != 'Video Description') {             $description = $_POST['description'];         }              if ($_POST['video_url'] != null && $_POST['video_url'] != 'Youtube URL') {             $vid_url = $_POST['video_url'];             $video_id = getVideoId($vid_url);             if ($video_id) {               printf($video_id);               $video_response =    wp_remote_retrieve_response_code(wp_remote_get('http://gdata.youtube.com/feeds/api/videos/' .                     $video_id));               printf($video_response);               if ($video_response == 200) {                   $video_url = $vid_url;               } else {                   $error_output .= 'This is not an existing youtube video
';               }             } else {               $error_output .= 'This is not an existing youtube video
';             }         } else {               $error_output .= 'This is not an existing youtube video
';         }         $tags = $_POST['post_tags'];              // Add the content of the form to $post as an array         $new_post = array(             'post_title'    => $title,             'post_content'  => $description,             'tags_input'    => array($tags),             'post_category' => array(12),             'post_status'   => 'publish',           // Choose: publish, preview, future, draft, etc.             'post_type' => fod_videos  // Use a custom post type if you want to         );              // If No Errors, Save Post and Redirect //         if ($error_output == null) {             $pid = wp_insert_post($new_post);             update_post_meta($pid,'video_code',$video_url);             wp_redirect( get_permalink($pid));          // If Errors, Return Errors for Display in Template //         }      }      do_action('wp_insert_post', 'wp_insert_post');     }     add_action( 'pre_get_posts', 'video_process_form' );


Approach to creating a site with this structure

I'm tasked with making a site that has 'families'. Each family has a gallery, a 'region', and a 'name', both of which are searchable upon. My initial thoughts about this were to create a template for a child page of 'Families' that contains 2 custom fields (name and region), and just use some gallery plugin on each page. My question: Is there a better mechanic in Wordpress to solve the problem I'm presenting? I'm a developer, so I see this readily as several tables in a custom CMS that I'd just whip up over the weekend ("6 hours tops, promise!") that would quickly get out of hand, so I'd love to leverage my knowledge of WP to get this done more efficiently.


Wordpress cracked? Posts not found in dashboard

I just came back to my site from dinner and was unable to find any posts listed in the dashboard. After snooping around, I found that my .htaccess file was modified, and some new files were added to my home directory. I deleted the .htaccess code, and the files (they all started with PE). I see that in the last hour a few posts regarding this have been posted on the wp.org forum site. Is anyone else having trouble with this? Is there any more code for me to delete? thanks.


How to exclude "uncategorized" from custom categories widget?

The code below if from my WP plugin which gives a filtered listing of categories excluding the "uncategorized" category from display. However, when the user chooses "Show Hierarchy" from the widget setup options, the resulting display includes "uncategorized". Given that I've placed 'exclude_tree' => 1 into the $cat_args array. What am I missing?               class My_Widget_Categories extends WP_Widget {              function My_Widget_Categories() {             $widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "filters out uncategorized categories" ) );             $this->WP_Widget('my_categories', __('my Categories'), $widget_ops);         }              function widget( $args, $instance ) {             extract( $args );             $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title']);             $c = $instance['count'] ? '1' : '0';             $h = $instance['hierarchical'] ? '1' : '0';             $d = $instance['dropdown'] ? '1' : '0';                  echo $before_widget;             if ( $title )                 echo $before_title . $title . $after_title;                 $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h, 'exclude_tree' => 1);             if ( $d ) {                 $cat_args['show_option_none'] = __('Select Category');                 wp_dropdown_categories(apply_filters('widget_categories_dropdown_args', $cat_args));


Page with posts from category doesn't work

I'm working on my wordpress site, and I want to have a page that shows all posts from the category 'portfolio' on a separate site. I'm using the following technique: http://codex.wordpress.org/Pages#A_Page_of_Posts However, on my testblog this works fine ( http://dev.litso.com/portfolio-2/ ) but on my live blog it doesn't seem to load the custom pagetemplate portfolio.php ( http://www.stephanmuller.nl/portfolio-2/ ). Instead, it uses the regular page.php template. Both are pages (not posts), use the exact same theme (not even a copy, the same physical theme in a multisite installation), the same custom field 'category' with a value of 'portfolio' and both blogs have at least one entry with the 'portfolio' category. The only difference between the two is that the dev blog does _not_ have the option to choose the page's template (yet it does use the custom Portfolio template). The live site does have this option and it's set to Portfolio of course but when I view the page it uses Page. I can't find out why this is either. Anyone who can help?


Site Live Database Operations issues

I have a working site on a staging server. The live site is working perfectly, but none of the database operations is working. It doesn't even fire the select query. I have pages in wp_posts tabel and they display as such, but I'm not able to see any pages in wordpress admin panel under "All Pages..." I can't even fetch the menu that I have created. It still shows me the old menu. Does anyone have a suggestion to which the problem might be??


get_adjacent_post() function no longer working

I have a theme I'm building using _s (underscores.me). It has several Custom Post Types. _s has a next/prev function built into it that returns links for the next and previous posts if any such posts exist. So far, it's been working great. However, I installed a plugin called 'Post Types Order' to re-order posts. When I installed it, the next/prev links went away in the custom post type and was replaced with only a 'next' post link that links to the most recent blog post, no matter what Post Type you're in. It's really strange. The bit of code that works from this is here, starting at line 40: https://github.com/Automattic/_s/blob/master/inc/template-tags.php \- Doing var dump of hte $previous variable outputs bool(false). That's it. I'm at my wits end and any help is appreciated.


Apply Classes to post text inside editor

I am using a theme that comes with several different font stylings for headers and text. However there is no simple way to apply these classes inside the editor. How can I enable a drop down similar to TinyMCE that allows me to select text and apply a class/style to it in order to have my marketing and sales department style their posts.


Get comment content by comment ID

So I've been trying for a hour or so now to list comment by it's ID. I've tried the `get_comment($id, $output)` function but it didn't work well, so I went back to whatever is shown below, but it just shows all comments. I want it to show just one comment by it's ID. I can't figure out a way to do it. What am I doing wrong?               $args = array(         'id' => 1,     );          // The Query     $comments_query = new WP_Comment_Query;     $comments = $comments_query->query( $args );          // Comment Loop     if ( $comments ) {         foreach ( $comments as $comment ) {             echo '<p>'.$comment->comment_content.'</p>';         }     }


admin-ajax.php nulls all php variables

I have a problem in a custom function. The function which adds to the WHERE clause in Store Locator Pro works correctly on its own, but I only want it to only work on a certain page, not on all my other Store Locator pages. Should be simple, get the ID of the page I want it to work on and wrap the filter in a condition               function slp_country_filter($where){         if( $_COOKIE["location_country"] != NULL ) {           $SLPcountry = $_COOKIE["location_country"];           $SLPcountryQuery = "AND (  sl_country = '" . $SLPcountry . "')";         }         else {           $SLPcountryQuery = "AND (  sl_country = 'canada' or sl_country = 'usa' )";         }            return $where . $SLPcountryQuery;     }          $id=get_the_ID();     if($id==613){         add_filter( 'slp_ajaxsql_where' , 'slp_country_filter', 90 );     }      However this doesn't work, and after much investigation it seems that **the variable $id is now NULL**. Even though I can print it out in the header, the variable is reset to NULL by Store Locator Pro's call to admin-ajax.php. I determined this by changing the condition to `if($id==NULL)` and the conditional works. I tried also to store the variable $id in a $_SESSION['SLP_ID'] variable and still the same thing happens. The moment the ajax call is made the variables are all returned as NULL and so the condition is false. Appreciate any ideas on how to work around this. Thanks.


Changing stylesheet depending on custom taxonomy terms

> My client would like the background & header colors to switch depending on > terms within the custom taxonomy 'Grades'. These terms are kindergarten, > first grade, second grade, etc... (all through twelfth grade) and are > associated with a custom post type 'projects'. > > I've set up the menu so that each term in 'grades' has it's own page. These > are not actual pages that you'd find in the dashboard. These pages are just > an archive-type pages specific to each grade. > > I found a great blogpost regarding contextually changing the stylesheet > depending on the page name ( > http://justintadlock.com/archives/2009/07/27/contextually-changing-your- > themes-stylesheet ). My php understanding is a bit limited and I can't > figure out how to edit this code so that instead of switching stylesheets > because of a page's name, it is triggered by an array of terms within the > custom taxonomy 'grades.' > > I want to switch stylesheets on archive pages for custom taxonomies. The > switch should be triggered by a custom taxonomy's terms. IE: The > Kindergarten page is actually an archive page for 'kindergarten' in the the > custom taxonomy 'grades' I have 13 terms associated with 'grades' > > kindergarten, first grade, second grade, third grade, etc... > > IE: I would like the background image and heading colors to change. Green > for kindergarten, first grade, second grade, third grade... Orange for sixth > grade, seventh grade, eighth grade... Purple for ninth grade, tenth grade, > etc... I found a solution that works only for archive pages and taxonomies: is_tax function.               add_filter( 'stylesheet_uri', 'my_stylesheet', 10, 2 );      function my_stylesheet( $stylesheet_uri, $stylesheet_dir_uri ) {               if ( is_tax( 'grades', array('term_name' => 'Kindergarten', 'First Grade', 'Second Grade', 'Third Grade', 'Fourth Grade', 'Fifth Grade' ) ))         $stylesheet_uri = $stylesheet_dir_uri . '/style-elemen.css';     elseif ( is_tax( 'grades', array('term_name' => 'Sixth Grade', 'Seventh Grade', 'Eighth Grade' ) ))         $stylesheet_uri = $stylesheet_dir_uri . '/style-elemen.css';          return $stylesheet_uri;      }


Create child page within custom post type

I want to be able to have a link like this, **site.com/my-custom-type- slug/single-custom-post-name/stats/** , where **/stats** should contain the **/my-custom-type-slug** page content and when I add content to the **/stats** page, it should be added after the parent's content. The **/stats** page should be available for every page created within my CPT, for example **/my-custom-type-slug2** , **/my-custom-type-slug3** , and so on, to have the **/stats**. I'm thinking that a solution can be to create a page named **stats** and assign a custom template, but the problem is how can I create the additional content for every new post which I'm creating? This would be easy if I didn't need the comments to be activated because I was doing it like this: Add a custom WYSIWYG field inside my posts with ACF plugin, then create an endpoint:               function wpa121567_rewrite_endpoints(){         add_rewrite_endpoint( 'stats', EP_PERMALINK );     }     add_action( 'init', 'wpa121567_rewrite_endpoints' );      After this my URL would look like this:   `site.com/your-custom-type-slug/single-custom-post-name/stats/` Then in my `single-{cpt}.php` template I can check if the request is for **stats** , and include or output the desired data:               if( array_key_exists( 'stats', $wp_query->query_vars ) ){         // the request is for the comments page     }      else {         // the request is for the main post     }      This solution is not working for me because I can't activate comments on **/stats** because I'm using an endpoint to create it. As a conclusion, what I need is two separate sets of comments for both the parent and "/stats" page. Any suggestions on how to achieve this?


Set a default page template to load for multi-site

I'm modifying the `install.php` (coping in from `upgrade.php`) file to load default pages that get created with a new blog is registered. Im trying to find out how i can specify the page template that the new page will be assigned. is there anything like `page_template =>?` Ive searched the codex but dont seem to find anything, or i have the wrong syntax idea. current page code by default is:                 $first_page = sprintf( __( "This is an example page. As a new WordPress user, you should go to your dashboard to delete this page and create new pages for your content. Have fun!" ), admin_url() );            if ( is_multisite() )             $first_page = get_site_option( 'first_page', $first_page );            $first_post_guid = get_option('home') . '/?page_id=2';         $wpdb->insert( $wpdb->posts, array(                                     'post_author' => $user_id,                                     'post_date' => $now,                                     'post_date_gmt' => $now_gmt,                                     'post_content' => $first_page,                                     'post_excerpt' => '',                                     'post_title' => __( 'Sample Page' ),                                     /* translators: Default page slug */                                     'post_name' => __( 'sample-page' ),                                     'post_modified' => $now,                                     'post_modified_gmt' => $now_gmt,                                     'guid' => $first_post_guid,                                     'post_type' => 'page',                                     'to_ping' => '',                                     'pinged' => '',                                     'post_content_filtered' => ''                                     ));         $wpdb->insert( $wpdb->postmeta, array( 'post_id' => 2, 'meta_key' => '_wp_page_template', 'meta_value' => 'default' ) );


remove WYSIWYG editor but keep media button

i need to remove the deafault TinyMCE editor from pages, i used this:               remove_post_type_support( 'page', 'editor' );      But it removes also the media button that i need


Static raw HTML page

On the server there is a static HTML page `example.html` in my root folder of the WordPress install. Now when a user types `www.example.com/example.html` I want WordPress to be smart and bypass all normal routing behavior and instead just display that static `exmaple.html` page. This looks so easy to me concept-wise but I can't find a solution since hours. What exactly do I need to change in my `.htaccess` file? Is it even that `.httaccess` file or do I need to make such a change in the site available file? Sorry for being a WordPress newbie :(


Genesis loading of html5shiv for IE8

Genesis Framework 2 has built-in support for loading the html5shiv.js, with the _**genesis_html5_ie_fix**_ function (/lib/js/load-scripts.php).   I post the function below. It supposed to print a conditional comment in the head of the document, targeting IE 8 and lower versions.      Loading the website with any other browser, the comment exist in document's head. When I try to load it with IE8, the whole extra block is disappearing, and as a result, IE8 cannot understand the HTML5 tags. If I remove the conditional comment and just leave the script tag, then it works okay, but the extra script is downloading for all browsers. It looks like there must be something with IE8 having problem to parse the comment, or what? *I have to say however that I am only checking IE8 through IE11 simulator (not sure if this is affecting the situation and how).               add_action( 'wp_head', 'genesis_html5_ie_fix' );          function genesis_html5_ie_fix() {          if ( ! genesis_html5() )         return;          echo '<!--[if lt IE 9]><script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->' . "\n";          }


How to Display HTML Site Images in Directory Above WordPress Installation

I have WP in a subdirectory of its own. I have two .htaccess files. The first is in the domain root:               RewriteEngine on     RewriteCond %{HTTP_HOST} ^automaticallynow\.com$ [OR]     RewriteCond %{HTTP_HOST} ^www\.automaticallynow\.com$     RewriteRule ^/?$ "http\:\/\/www\.automaticallynow\.com\/make\-money\-online\/" [R=301,L]      The Second is in the WP install directory:               # BEGIN WordPress     RewriteEngine On     RewriteBase /make-money-online/     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]     RewriteRule . index.php [L]          # END WordPress      Within that WP install directory root/wp/ is a multisite network. So the problem is that when I upload html to the root directory, nothing show up right. The links in the files aren't working. Example: http://automaticallynow.com/Offers/WP-Optins-Plugin/index.htm shows text and image placement, but the image links are all broken. The images file folder is here: http://automaticallynow.com/Offers/WP-Optins-Plugin/images/ If you click that link^ and see the image directory listing it lists them all automatically, but clicking them results in broken images. Permissions for the folders are 755 permissions for the images (files) and .htm file are 644.


What is the purpose of storing `siteurl` in database?

Why does WordPress store 'siteurl' and 'home' in the database? It's driving me crazy because I develop locally, deploy to a staging site, AND to a production site, so that's two-three times I have to go through the database to replace all those values. It seems kind of backwards to store this value, when you can just get it from the URL the site is running from, so I must be missing some context or something. I'd love some solutions where I don't have to search and replace every single time I deploy changes. I want to be able to just copy files and the database and have it work, like literally every other system I use. (Drupal, Laravel, Rails)


Post Image not displaying in category view

I tried adding an thumbnail sized image in the very first line of the post so that I want my category list search should display with this thumbnail and some text with "read more" button but this image is not displaying in the category list view but its displaying when I click on the post. Is there any way to fix it? I tried many plugins but none worked for me. `add_theme_support( 'post-thumbnails' );` The above line is already active in my site. Thanks.


Remove specific category from a post

I have enabled categories on attachments, and I am trying to implement the logic to automatically handle the "Uncategorized" category, like this: 1) If the attachment has no categories, set it to "Uncategorized" 2) If the attachment has some category besides "Uncategorized", remove "Uncategorized" from the post's category list I have tackled most of the logic, except that now I dont know how to remove the category from the Attachment. This is my code:               <?php          // Enable categories with attachments     register_taxonomy_for_object_type( 'category', 'attachment' );          if( is_admin() ) {              add_action('add_attachment', 'emt_set_attachment_category');         add_action('edit_attachment', 'emt_set_attachment_category');         function emt_set_attachment_category( $post_ID ) {                  $attachmentCategories =  wp_get_object_terms( $post_ID, 'category' );                  // if attachment has many categories, remove the default category             if (count($attachmentCategories) > 1) {                 foreach ($attachmentCategories as $key => $category)                     if ($category->name == "Uncategorized")                         // How to delete it??                      return;             }                  // if attachment already have categories, stop here             if (count($attachmentCategories) == 1)                 return;                  // if attachment has no categories, set default category             wp_set_post_categories( $post_ID, array( get_option('default_category') ) );         }     }


why quotes shown in Wordpress?

I have written a function to register a script in the admin interface.               function custom_admin_js() {         $url = get_bloginfo('template_directory') . '/admin/admin.js';         echo '<script type="text/javascript" src="'. $url . '"></script>';     }     add_action('admin_footer', 'custom_admin_js');      For some - for me unknown reason - this creates additional quotes surrounding the script.               "<script type="text/javascript" src="http://test121.uphero.com/wp-content/themes/news/admin/admin.js"></script>"      How do I remove the surrounding quotes?


Subdomain Wp-Admin Not Found

I enabled the MultiSite option using the instructions on the WordPress site (``mandeltech.com), and now I am trying to create a subsdomain for WooCommerce (`shop.mandeltech.com`). I created the subdomain with cPanel, and then added it to my site through My Sites --> Network Admin --> Sites --> Add Site menu. All of the settings worked, except I can't access the dashboard. Using the dashboard link from the My Sites menu, I go to `http://shop.mandeltech.com/wp-admin/`. This gives me a 404 Error, because that page does not exist. Through the cPanel file manager, the `shop` directory under `public_html` only has a `cgi-bin` folder. This makes sense, as I haven't specifically added anything. However, I'm not sure where to go from here. I want both `shop.mandeltech.com` and `mandeltech.com` to share the same WP installation and database, but I can't access the WP-Admin page yet. Do I have to install WordPress for this subdirectory? This would create another installation, so it doesn't seem like the correct way to go. So, how can I allow this subdomain to have the same WP installation but also access its dashboard? Thanks!


How to arrange different post categories in template

I'm playing with WordPress for sometime. In my website, there will be 3 possible categories for posts, like: 'offer', 'news' and 'about' (each category with individual content). My attempt is to create header navigation, providing liks for each category, and within category some custom sidebars. Currently, I'm working on news category, where sidebar should contain months and year, and content itself. I based my template pages on slug, therefore I have `category-news.php` and `sidebar-news.php`. Everything looks great, navigation menu has link to `/category/news-page`, where my sidebar works: **sidebar-news.php**

<?php _e( "AktualnościNews" );?>
                  <?php wp_get_archives( array(             "type" => "monthly",             "echo" => 1,             "order" => "DESC"         ) ); ?>

      **category-news.php**               <?php get_header(); ?>

<?php _e( "AktualnościNews" );?>

         <?php get_sidebar("news"); ?>

                 <?php while ( have_posts() ) : the_post() ?>                 <?php endwhile; ?>

     <?php get_footer(); ?>      My problem is that links generated by code above `wp_get_archives` points to pages like `/2013/12` etc., while I'd like then to have `/category/news- prefix`, so that they'd be under one template. How can I achieved that? How can I then highlight currently selected month?


Display tags & categories seperatly

When I called `the_taxonomies()` function it shows me both tags and categories. I need tags to show from `the_tags()` function. At the moment I haven't included `the_tags()` but shows me the tags through `the_taxonomies()`. Because of this I'm unable to style them separately. ![image showing my problem in detail](http://i.stack.imgur.com/dRWnS.jpg)               <?php query_posts( 'post_type=blog'); ?>      <?php while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
         <?php the_content("Read more"); ?>
Date: <?php the_date();?> <?php the_taxonomies(); ?>
         ...     <?php endwhile; ?>


Can I add a blog subfolder to my website and use a different theme

I asked this question over at WebMasters, and was directed to this stack exchange, I might add I had no idea this even existed! I was wondering if I am able to create a new subfolder named blog on my site, and use a different theme on the blog than my site.


Screenshot are not showing up on plugin page

I know its quite common now, But I cant find out where I am doing wrong. I have screenshot placed at the right place (both trunk and tag/1.0 ) and used the same tag i.e 1.0 in readmen.txt but still they are not showing up on plugin's screenshots tab. Read me file http://plugins.svn.wordpress.org/nextgen-3d-flux-slider- template/tags/1.0/readme.txt Plugin page. http://wordpress.org/extend/plugins/nextgen-3d-flux-slider- template/screenshots Can anyone notice a problem somewhere?


WordPress Backup

I'm learning how to backup right now and I'd like some validation. From what I understood, to fully backup my Wordpress I need two things. One backup for my database and another for theme files. The database contains all my blog posts and uploads. Theme files include plugins and theme settings. Which means if I update my plugins or restore those files my configurations will stay. So yeah, my question is simply: is this correct?


remove other tabs in new wordpress media gallery

I recently updated my WordPress site into the latest WordPress version, and i added a code to my `functions.php` that would add a capability to subscriber to upload using WordPress media upload. I successfully remove the media library tabs on the later version of WordPress but when I updated the version it seems like the code does not work anymore. Any ideas how to fix this? This is the previous code which I googled before:               function remove_medialibrary_tab($tabs){       if ( !current_user_can( 'administrator' ) || !current_user_can( 'editor' ) || !current_user_can( 'contibutor' ) || !current_user_can( 'author' ) ) {         unset($tabs['library']);         return $tabs;       } else {         return $tabs;       }     }     add_filter('media_upload_tabs','remove_medialibrary_tab');          if ( !current_user_can('upload_files') ){         add_action('init', 'allow_user_to_upload');     }          function allow_user_to_upload() {         $subscriber = get_role('subscriber');         $subscriber->add_cap('upload_files');     }


Does page.php need the loop?

Simple question. Does page.php need the loop? The Loop 'loops' through several pages/posts/content. However the page.php template only has 1 page. There's nothing to loop through. I noticed that simple functions such as the_title() and the_content() work outside the loop inside page.php. So... Does page.php need the loop? If so, why?


order by meta_value serialized array

Hi I'm trying to pull posts using the wp query. Just one problem--I am trying to sort the posts alphabetically by a certain meta_value. Thing is that this meta_value is a serialized array. Is there an easy way to do this without having to unserialize it? Thanks!               a:1:{i:0;a:1:{s:7:"people";s:16:"Tanya Garca";}}      Btw, I cannot change the way the meta_value is being saved because I am using this plugin which automatically saves it serialized.


include w_thumbnail_src in function?

I got a function that automatically creates a custom field in the post. I have this located in my functions.php. `Image` is the name of the custom field and `HERE` is the value. How can I put the function `w_thumbnail_src` as the variable?               add_action('wp_insert_post', 'mk_set_default_custom_fields');         function mk_set_default_custom_fields($post_id)              {             if ( $_GET['post_type'] != 'post' ) {                 add_post_meta($post_id, 'Image','HERE', true);             }             return true;         }      And let me add that `w_thumbnail_src` is a function in the same file that looks like this               function w_thumbnail_src() {         if (has_post_thumbnail()) {             $thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), 'emphasis');            echo $thumb[0]; // thumbnail url         }     }      EDIT : Here is the final code that adds the thumbnail url to a custom field named Image.               function w_thumbnail_src() {         if (has_post_thumbnail()) {             $thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), 'emphasis');             return $thumb[0]; // thumbnail url         } else {             return '';  // or a default thumbnail url         }     }               add_action('publish_page', 'add_custom_field_automatically', 'w_thumbnail_src');     add_action('publish_post', 'add_custom_field_automatically');     function add_custom_field_automatically($post_id) {     global $wpdb;     if(!wp_is_post_revision($post_id)) {     add_post_meta($post_id, 'Image', w_thumbnail_src(), true);     }     }


How to get popular post from across a network?

I have a multisite network on WP 3.3.1. I now need to get all popular posts from across this network (preferably based on the amount of views). Is this possible, and how do I do that?


Moving online website to MAMP or dumb idea?

I was thinking of doing some major design (incl child theme and plugin stuff) on an existing site which is rather large. I'm thinking it would be good to do my trial and errors offline and having a MAC thought that it would be good to do this with MAMP. For those from WordCamp, I'm a designer with developer aspirations having only minimal programing experience but want to learn and try some of the cool stuff I learned from WC ATL. Is this a good idea? If so, how do I get my DB files into MAMP? TIA for your time and help. Cindy


Insert custom ID into wp_get_attachment_link

I'm working on this function of WordPress.               function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) {         $id = intval( $id );         $_post = get_post( $id );              if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) )             return __( 'Missing Attachment' );              if ( $permalink )             $url = get_attachment_link( $_post->ID );              $post_title = esc_attr( $_post->post_title );              if ( $text )             $link_text = $text;         elseif ( $size && 'none' != $size )             $link_text = wp_get_attachment_image( $id, $size, $icon );         else             $link_text = '';              if ( trim( $link_text ) == '' )             $link_text = $_post->post_title;              return apply_filters( 'wp_get_attachment_link', "$link_text", $id, $size, $permalink, $icon, $text );     }      And I want to modify this line:               return apply_filters( 'wp_get_attachment_link', "$link_text", $id, $size, $permalink, $icon, $text );      I want that link can output like this:               $link_text      Because, default it print out like this:                     I want it print out like this:                     My wished attachment ID could be the same with 'post-title-example'. I have tried many ways and searched Google a lot. But it doesn't work. Can you help me? Thank you.


How to control WordPress Search Behavior?

I'm developing a website using WordPress and I need to make a totally customized theme. Everything seem to work well until I found something wrong at search result which doesn't match with customer requirements. I have no experience with PHP and WordPress. So let me ask two questions.   1. How can I validate the WordPress Search Box when **users do not enter any words and make search**? I don't want any searching process at above case.   2. How can I **exclude Home Page from any search results**? Thanks in advance!


Action hook 'wp' firing twice... why?

I noticed that when I hook into 'wp' it seems to be firing twice -- for example               add_action('wp', 'just_testing');     function just_testing(){         global $post;         error_log($post->ID);     }      returns into my error_log the following two entries:               [01-Feb-2013 13:06:58 UTC] 1120     [01-Feb-2013 13:06:58 UTC]       I searched google and stackexchange and the thread "What would cause the 'wp' action to fire twice per page (but only once per post) in Firefox only?" does not apply because I am getting the two firings in all browsers. Thanks for any help!


Roll my own theme or customize an existing one

I just want to know whether I should roll my own theme from scratch or I should customize an existing one like twenty twelve. Reason I ask is I wanted to know whether there are any best practises I may be missing if may be missing from these themes ir I roll my own. Also I find that there is a lot of bloat even for a theme as simple as twenty twelve and hence ind myself removing a lot of it as I'm building my theme. The site I am currently building is www.laminsanneh.com Thanks in nadvance


Is it possible to get all term items from a custom taxonomy regardless of post attachment status?

Essentially, I build web sites with galleries, for photographers. Up until now, gallery images have all been attached to posts and I've just pulled from the category taxonomy. This is messy if it's also to be used as a regular blog. So I've been poking around and I discovered things like if an attachment item isn't assigned to a post, it has a `parent_post ID` of **0**. If I could, how would I go about simply getting all items with a term in my custom taxonomy, ignoring their `parent_post IDs`? I'm getting the feeling Wordpress just isn't quite there yet, for what I would like to do...


Add separator to admin submenu

I would like to add a **separator** to the **admin submenu** section, **NOT in the top level section**. ![enter image description here](http://i.stack.imgur.com/0OL8S.jpg) I'm thinking of using javascript and styling to do the job, but I was wondering if there's a more straightforward method such as that when adding a separator to the top level menu section. I'm still experimenting on this. I will provide my method once I get it working. [UPDATED]


Wordpress Super Admin

I'm trying to block any admin of a Wordpress install from being able to modify certain pages, the sort of stuff detailed here: http://wackao.com/be-a- wordpress-super-administrator/ . Is this even possible? Thank you. I would like to do this by modifying the core word press files.


What does multi-site WordPress application mean?

I have a WordPress application. I have been added as administrator in that blog application. I haven't access on the application server. After login to admin section, I am not able to see any post or page? But, on the homepage ( **blogs.xyz.com** ), I can see that there are multiple links like   * blogs.xyz.com/hospitality    * blogs.xyz.com/healthcare   * blogs.xyz.com/insurance I am very new in WordPress and don't know about this behavior of WordPress.   * How can I get access on all these sites?   * Has Multiple been installed for all these sites or a single WordPress is enough for this?   * Why should we do this?


How to search my posts based on tags or keywords?

I am developing one wp site, in which I have to insert some tags and keywords and tags to my posts. I want those posts get filtered based on the keywords, for e.g. when I click on the link [Fresher Jobs], it should give me the posts that contain [Fresher Jobs] as a keyword.


Adding Action Hooks In Parent Theme For Easier Child Theme Customization

I was wondering why isn't anyone (haven't be able to find one with it) adding custom hooks an the beginning and at the end of the theme's `function.php` for theme development. The reason I'm asking this is while making a child theme, I had to overwrite some default setups like image sizes set in the parent theme's main `function.php` (no `!function_exists` to overwrite on). So anything I write in my child's `function.php`will be overwritten. Aside from of course adding the `function_exists` wrapper, the solution I had in mind was just adding a `do_action()` at the beginning and at the end of the function.php. But is this a bad practice? If so, why? I am unable to find any answers or anyone asking this anywhere.


Learning rewrite rules and custom permalinks. Paging not working

I am just starting to learn rewrite rules and custom wordpress permalinks. I have made a custom endpoint called autor with the following code:               function my_query_vars($vars) {       $vars[] = "autor";       return $vars;     }     add_filter('query_vars', 'my_query_vars');     function my_rewrite_endpoint(){       // Use EP_PERMALINK | EP_PAGES for pages and posts both       add_rewrite_endpoint( 'autor', EP_PERMALINK | EP_PAGES );          global $wp_rewrite;     }     add_filter('init','my_rewrite_endpoint');      I am using this custom page for displaying some information about the author in a custom page template a made. So now, I am trying to accomplish the following: ## First, Everything works for the first page; however, when I go to the second page, I get an error: `Notice: Trying to get property of non-object in --source-- on line 16` On that line I have:               $user_id = get_user_by('login',get_query_var('autor'));     $user_id = $user_id->ID;      This is how my first and second page links look like: `http://mysite.com/custom_page/autor/author_login` -WORKS `http://mysite.com/custom_page/autor/author_login/page/2` -BROKEN   * **custom_page** is a page for displaying info about the author   * **autor** is a custom endpoint   * **author_login** is the nickname for the user: ## Second, How can I use the default author tag used by wordpress? So my custom permalink looks like this: `http://mysite.com/custom_page/author/author_login` `http://mysite.com/custom_page/author/author_login/page/2` ## And third, How can I change that permalink structure to the following: (while using the default author tag) `http://mysite.com/author/author_login/custom_page` `http://mysite.com/author/author_login/custom_page/page/2` Or better yet like this: `http://mysite.com/author_login/custom_page` `http://mysite.com/author_login/custom_page/page/2` I hope I am making myself clear enough, if not, let me know and I will try to elaborate some more my question.


Custom post type support for get_users('orderby=post_count');

The default WordPress function `get_users('orderby=post_count');` only orders users with the count of the _posts_ they've made. Any idea how to modify this to support custom post types as well? **UPDATE:** I only want to query posts of type "company-item". Currently, this snippet is in my functions.php:                function user_query_count_post_type($args) {        $args->query_from = str_replace("post_type = post AND", "post_type IN ('company-item') AND ", $args->query_from);       }      And this is in my page template:
       <?php       add_action('pre_user_query','user_query_count_post_type');       $showrooms = get_users('orderby=post_count&role=company&order=desc');       remove_action('pre_user_query','user_query_count_post_type');            foreach ($showrooms as $showroom) : ?>
             <a href="<?php echo get_author_posts_url( $showroom->id ); ?>" ><img src="<?php echo $showroom->company_logo; ?>" title="<?php echo $showroom->company_name; ?>" />
            <?php endforeach; ?>


TGM-Plugin-Activation does not work

When I try to install **a lot of** plugins using TGM-Plugin-Activation I got an ocurrent error: > An error occurred while installing : Download failed. A valid URL was not > provided.. and in the end > All installations have been completed. > > All plugins installed and activated successfully Despite these messages, none of the plugins is installed.


Add an attribute to attachments

Currently attachments have   * title   * caption   * alt text   * description I would like to add another attribute to that list (e.g source). How can I do this ?


Why is group ownership with rwx permissions not enough?

Running PHP 5.4 and Apache2 on Debian 7, with apache configured to use user `www-data`. I'm trying to figure out why Wordpress cannot modify files in its directory when it has group ownership with full permissions, and seems to only work if it has user ownership. Allow me to illustrate : * * * # Case 1   * Set User to `root` and Group to `www-data`: `chown -R root:www-data /var/www/site-dir/wordpress-dir/`   * Set Permissions to read, write and execute for both user and group. `chmod -R u=rwx,g=rwx /var/www/site-dir/wordpress-dir/`   * Current `ls -l` output of the Wordpress directory: `drwxrwsr-x 5 root www-data 4096 Jul 11 15:20`   * **Outcome** : When trying to delete a plugin, Wordpress claims it does not have access: ![enter image description here](http://i.stack.imgur.com/Jl9Rt.png) # Case 2   * Permissions are identical to 1, but user is set to `www-data`:  `chown -R www-data:www-data /var/www/site-dir/wordpress-dir/`   * **Outcome** : Wordpress is now able to delete the plugin: ![enter image description here](http://i.stack.imgur.com/i1WWg.png) * * * # Question I'm trying to understand what's going on here. Why does the user _have_ to be `www-data`, even when using `www-data` as group it has full permissions? With my (limited) understanding of linux permissions I would assume that, since the apache process running Wordpress is using the `www-data` user, it would have complete access to do whatever it needs to in case 1, because the group is recursively set as `www-data`, and group permissions are recursively set to read, write and execute. Why does the user need to be `www-data` for this to work?


How can I input a single right-to-left paragraph (Hebrew) into an English page/post?

I have an English blog. In one of the pages I want to include a Hebrew paragraph between two English paragraphs (I expect the English text to be left-aligned and the Hebrew text to be right-aligned). I can get the Hebrew text to be right aligned, but not in a right-to-left way (e.g. the period at the end of the sentence appears to it's right instead of its left). I tried pasting formatted text from Microsoft Word, but it doesn't work (the pasted text changes from right-to-left as it was in Word to the screwed-up form I get on WordPress if I type it myself). I do not want the admin interface to change, I do not want my entire blog to change to right-to-left. Only a paragraph. How can I achieve that? The site is http://roee.co


How do I tell what plugins are used on my multisite install?

I have a bunch of plugins I have installed but never use, others I am not sure if they are used or not. Is there a way to tell what plugins are not active on any site?


Displaying URL Based on User Input from a Form W/in a Dashboard Widget

First question and first commercial plugin. Woohoo! I'm trying to create a dashboard widget that leverages user input and a predefined URL structure to create an outbound link that sends the user to his/her desired destination. This is basically a hack created so that users on a blogging network can query another Wordpress site that holds all the content from the bloggers in that network. So if the user enters "pretty cats" and click on the search button, a link appears taking the user to the search page for the aggregating website i.e. http://wordpressag.com/?s=pretty+cats So far I have the dashboard widget being created and displaying a text field and "search" button, but I'm stumped on the other functions I need to create a link based on the user input. The variable for the user input is $wpag_search, so the desired URL structure would be something akin to http://wordpressag.com?s=($wpag_search) , only with the user input instead of the variable. Here's what I have, any suggestions?               // Function for displaying text input fields and search button           function wpag_search_forms() {         ?>         <input id="search_terms" type="text" size="50" name="wpag_search" value="<?php echo esc_attr($wpag_search);?>" />         <input id="search_button" type="button" value="Search WPAG" class="button-secondary"/>         <?php     }           //Other function for utilizing user input     //Has to follow http://wordpressag.com/?s=(user input) structure          // Create the function use in the action hook          function wpag_plugin_init () {         wp_add_dashboard_widget('example_dashboard_widget', 'Search The WP Ag Network', 'wpag_search_forms');        }           // Hook into the 'wp_dashboard_setup' action to register our other functions          add_action('wp_dashboard_setup', 'wpag_plugin_init' );          ?>


Get shortcode name from within it's callback function?

> **Possible Duplicate:**   >  current_shortcode() - detect currently used shortcode I'm dynamically generating shortcodes with my plugin like this:               foreach ($options['grids'] as $grid) {         add_shortcode($grid['shortcode'], array($this, 'print_shortcode'));     }      But the problem is, in the callback function I need to print different content, based on the shortcode's name. My question is - how would I get the shortcode's name from within print_shortcode() ? Thank you!


Is it safe to use PUT and DELETE requests

I am building my new shiny plugin and since I've read about REST etc.I wanted to do things right and implement PUT and DELETE requests, and not just use POST and GET like I did until now. But now I am wondering is it safe to use those. And by safe, I mean, are those requests supported by all servers in general. I don't want to implement everything now only to figure out later that just because of my wish to follow semantics my product is unusable for half of my customers. Thank you


How To Remove The "+ Add New Category" Link From A Category Metabox

Inside of a Wordpress category metabox or any custom taxonomy box for that matter there is a link with the text "+ Add New Category" is there a way this link can be removed preferably without resorting to JS or CSS hacks to hide it? A way to hide it using some kind of filter or action hook would be best. If no action hook or filter method exists to remove it, I would be open to JS and CSS solutions as a last resort. The reason I am doing this is because I have a Wordpress installation integrated with Magento and I am creating and populating a custom taxonomy called "brands" with a list of brands from the Magento database so a post can be assigned to a brand. Obviously this means I don't want users to be able to add in their own terms and only be able to choose the brands added in dynamically to keep it in-sync with Magento. Thank you.


Add_image_size not cropping

I want to make a crop on the images of my blog page that have more than 443px adjust it to 645x443 size, exactly. I used this code:               add_theme_support ('post-thumbnails');     add_image_size ('blog-page', 645, 445, true);      However, the image is resized instead of making the crop. Exemples: Original image: http://img843.imageshack.us/img843/6444/56004879.jpg How is: http://imageshack.us/scaled/landing/809/53926495.png How i want: http://imageshack.us/scaled/landing/823/32122755.png How do I do this?


Recent post on single page from specyfic category

i have problem. I use this code before comment form.               <?php          global $post;          $args = array( 'posts_per_page' => 5, 'offset'=> 1, 'category' => 1 );          $myposts = get_posts( $args );          foreach ( $myposts as $post ) : setup_postdata( $post ); ?>                  <?php the_permalink(); ?><?php the_title(); ?>          <?php endforeach; ?>      I have in `single.php`: 1 -- post content 2 -- recent post 3 -- form comment But when i comment something my comment is not on post but was added to last **recent post**. How can i do this? I tried to use this:               <?php     $args = array(         'posts_per_page'   => 1,         'category__not_in' => array( 23, 24 )     );          $recent_posts = get_posts( $args );          foreach ( $recent_posts as $recent ) {         echo 'Latest Post';     }     ?>


Super slow admin panel

My admin panel in wordpress is super slow. I disabled all the plugins, I changed the theme to "Twenty Eleven" and I updated Wordpress. Still, the admin panel is very slow. I have 2008 posts and 6 pages. My front end though is not slow, even though I disabled cache. Does anybody have an idea of what can I do about that?! Thank you very much!


Genesis page template with Powerpress

I want to create a template that will display podcasts in a archive page with the powerpress player and links. Powerpess talks about this on this page http://help.blubrry.com/blubrry- powerpress/customizing-with-your-wordpress-theme/ and I have looked at the various pages taht talk about building a genesis template. When it comes down to it, though, I don't know enough php to get this working (after trying many times) Can someone show me how to incorporate the powerpress player and links into the template?


Overwrite textdomain of plugins by default - Lost Translation

Wordpress is awesome, but there is something that is driving me crazy. Whenever a plugin or a theme is updated, all files are deleted and replaced. So if I have custom code or a translation in one plugin, it will get lost! I've seen some solutions suggesting to change the textdomain of the plugin to load language files from wp-content/languages, but if I write a custom function to load the *.po and *.mo from wp-content, directly in the plugin code, it will get overwritten too. So I was wondering how I can update my plugins, without losing the translation or the custom code. I ended up with WPML strings that do the job, by saving translation in DB, ( I'm not sure if is the way) but WPML is a very heavy plugin, and I will have to install it in all sites, which makes it difficult to maintain. Is there any function to overwrite all textdomains of a plugin, so I can have all of the translations in wp-content/languages, without changing plugin code?


Passing query variables to a custom page template

On my website I have a custom post type called 'theme'. I wanted the homepage to display an archive of themes. For this the only approach that I could think of was to create a page template with a custom wp_query and loop in it. Here's the code:               <?php global $wp_query; $wp_query = new WP_Query( array('post_type' => 'theme','post_status' => 'publish', 'paged' => get_query_var('page') ) ); ?>             <?php if ( $wp_query->have_posts() ) : ?>                 <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>                              <?php get_template_part( 'content', 'theme-widget' ); ?>                 <?php endwhile; ?>                 <?php wptrc_paging_nav(); ?>             <?php else : ?>                 <?php get_template_part( 'no-results', 'index' ); ?>             <?php endif; ?>      I have a page created with this template as my homepage. I also wanted my users to be able to change the order of items with query variables so I used this code:               function wptrc_filter_query( $query ) {         if( is_main_query() && (get_query_var('post_type') == 'theme' || is_tax('theme_cat')) && !is_admin() ) {             $order = get_query_var('theme_order');             $query->set('order', $order);         }     }     add_action('pre_get_posts', 'wptrc_filter_query', 9999);          function wptrc_query_vars( $query_vars ) {         $query_vars[] = 'theme_order';         $query_vars[] = 'theme_orderby';         return $query_vars;     }     add_filter( 'query_vars', 'wptrc_query_vars' );      **The problem:** Whenever I try passing the query variables to my homepage like this: http://mydomain.com/?theme_order=ASC my blog page shows up instead of the theme archive. For some reason when I use the query variables WordPress loads up the index.php file instead of the page template I created. This is not limited to custom query variables. order and orderby also give the same result. Any help would be appreciated. Thanks in advance.


Dropdown list of taxonomies won't display selected

I used the answer in this question to show a dropdown list of my taxonomies and it works great. But when I save the post/update and the page refreshes/loads the taxonomy I selected reverts back to the last taxonomy on the list. I checked the database and it does save the chosen taxonomy correctly so it's obviously how I echo the data right? How can I fix this so that it stays on the selected taxonomy?               $term = isset( $values['meta-box-events_select'] ) ? esc_attr( $values['meta-box-events_select'][0] ) : '';      THIS IS THE CODE I USED TO SHOW THE DROPDOWN                       <?php $tax = get_object_taxonomies('activities');             $taxterms = get_terms( $tax, 'orderby=count&offset=1&hide_empty=0&fields=all' );         ?>         <select name='meta-box-events_select' id='meta-box-events_select'>             <option value='' <?php if (!count( $names )) echo "selected";?>>Select Term</option>             <?php              foreach ( $taxterms as $term ) {                  echo '<option value="' . $term->slug . '" selected>' . $term->name . '</option>',"\n";              } ?>         </select>


User access control in sidebar archive and categorires

Could someone please help me solve my problem which is: I want content restrictions based on user roles and a sidebar category based on user roles. I have three type of user roles: Beginner, Intermediate and Advanced. Beginner Role: can read only self blog Intermediate Role: can read self and beginner blog Advanced Role: full read access to all levels of the blog The same case is with sidebar archives and categories if user is logged in. With beginner role (like demo/demo), user could only view beginner member area and limited sidebar categories and archives. case 2: if user is logged in with intermediate role (inter/inter), user could view intermediate area and would be able to see beginner, self category and archives. case 3: advanaced user login with (adv/adv) could view advanced member area and would be able to see all level categories. please help me


New categories are now going to 404s

I have a WPMU site with hundreds of blogs on it. We are on 3.4.2 and this is the first time I'm seeing this issue within a few of my sites. Basically, what happens is that I'll create a new category and then when I click on it from the sidebar where all the categories appear, it 404's. Also, this happens when I add a new article to the new category. This is happening on a few of my sites now. What's interesting to note is I cannot reproduce the issue on test even though test is more of less a direct clone of my live envrionment. The only difference between live and test is that I use a domain mapping plugin on live. Also, I have 6 memcached nodes/servers (AWS) whereas my test area only has one. My live area has 5 app servers and my test area has one. We have the multi-DB plugin installed in both environments. Aside from those differences, the plugins are exactly the same as is the code base. The issue happens: \--> Regardless of category slug \--> Regardless of # posts assigned to the category \--> Only on newly created categories (we noticed it about a month ago and it's still happening -- and seems to be spreading across our network) \--> On the front end -- you can browse categories just fine on the back end. \--> Regardless of how many times I flush the rewrite rules by changing permalink settings \--> On any permalink setting other than default. If I go to default permalink structure, it works fine. \--> Only on categories -- tags work fine.


List Child Pages of Parent Parent Page (Child pages from Grand Parent)

OK I'm doing a a menu (sidebar menu) that will display this all child pages of parent page (currently open)   Parent   |-Child 1   |-Child 2   | _Child 3      but in same time when someone is in bolded page (child) will see the same thing   Parent   |-Child 1   __ _|-Child 1   _ _| **-Child 2**   _ _|- Child 3   |-Child 2   |-Child 3      currently I use next code which do first job well but not the second one with child of child I tried several things but nothing worked                <?php if ( is_page() ) {      if($post->post_parent)     $children = wp_list_pages('title_li=&child_of='.$post->post_parent.'&echo=0&sort_column=post_date&sort_order=DESC'); else     $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0&sort_column=post_date&sort_order=DESC');     if ($children) { ?> .......      Thanks in advance * * * ## Edit As Simon answered it worked but not for all cases and I edited so now final code is:               <?php if ( is_page() ) {         $stats = count($post->ancestors);     if($post->post_parent){        if($stats == 2){         $children = wp_list_pages('title_li=&child_of='.get_post( $post->post_parent )->post_parent.'&echo=0&sort_column=post_date&sort_order=DESC&depth=1');        }else{         $children = wp_list_pages('title_li=&child_of='.$post->post_parent.'&echo=0&sort_column=post_date&sort_order=DESC&depth=1');       }}     else{       $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0&sort_column=post_date&sort_order=DESC&depth=1');     }     if ($children) { ?> ....      That's in case if somebody else need this stuff, Cheers and thanks for fast help


Using get_template_part to retrieve a template file based on current post type

I'm trying to use get_template_part to retrieve a template file based on the current post type (slug) the user is in. The template file just includes an image that is used specific to specific post types.               <?php get_template_part('parts/get_post_type( $post )') ?>
<?php $post_type = get_post_type_object( get_post_type($post) ); echo $post_type->labels->singular_name ; ?>
      The above doesn't blow up the page, but nothing seems to get output. Not sure what I'm doing wrong here.


allow only lowercase user registrations

I'm trying to get allow only lowercase usernames are valid usernames in my wordpress blog. I managed to write a function but it does not seem to work.               add_filter('validate_username' , 'simple_user', 1, 2);         function simple_user($valid, $username ) {                 if (preg_match("/[a-z0-9]+/", $username)) {                     // there are spaces                     return $valid=false;                 }             return $valid;         }      Any ideas with getting this to work ? i tried this but it never worked. I will be very appreciative if someone could help me with this one. Thank you


How to disable saving/changing update date for certain admin users?

I have an admin user who is only for correcting the spelling errors and grammar stuff, however, when he corrects some post that is several hours or days old and just changes "People are gready" to "People are greedy" in the title or makes some other changes in the content, the update date is changed and I don't want that to happen. Is there any build-in WP function that I can use that for some users e.g. for user with ID 14 and 19. Any idea how to do that?


Does WordPress Change the .htaccess File When Updating?

I've just implemented a new WP website, replacing an older hardcoded HTML site. I will be adding 301 redirects in the `.htaccess` file to point the old URIs to the new WP Permalinks. My questions is, as WP generates the `.htaccess` file initially (at least on my install it did) will WP overrite the `.htaccess` file when I update WP in the future? Further to the above, is there any time, including the update as mentioned above, that WP may overwrite this file and if so is there a way to prevent that? I've searched high and low and can't seem to find a straight answer. Any help would be appreciated. Thanks!


Template for slug

I am using the "Edit Author Slug" plugin to provide public profile pages on my site using the following structure: **mysite.com/users/username**. Now, I want to show a list of all users on **mysite.com/users/**. But this returns a 404 because the "users" path is only a slug created by the plugin. Does WP provide the possibility to create slug templates (just like tag templates)? Or is there another way to accomplish this? Thanks for your help :-)