title: How to publish a Page and Posts using single template

text:
Does anyone know how to structure a WP template in the loop by: Publishing the page content on top, immediate followed by certain category posts underneath the page content? Seems like it should be straight forward. I have not been able to locate any help on it. Thank you. **Here's what I pulled together so far:**               <?php     /**      * Template Name: Page & Posts      */     ?>     <?php get_header(); ?>

                 <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>                     <div id="post-<?php the_ID(); ?>" <?php post_class('g post'); ?>>
                             <?php if ($options['mts_breadcrumb'] == '1') { ?>
<?php the_breadcrumb(); ?>
                             <?php } ?>
<?php the_title(); ?>

                                 <?php the_content(); ?>

                     <?php comments_template( '', true ); ?>                 <?php endwhile; ?>                     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<a href="<?php comments_link(); ?>"> <?php comments_number('0','1','%'); ?>

                                     <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?>
                                 <?php if($options['mts_headline_meta'] == '1') { ?>
                                          <?php _e('Written on ',''); the_time('F j, Y'); ?>                                         <?php _e('by ',''); the_author_posts_link(); ?>                                         <?php _e(' in ',''); the_category(', ') ?>
                                 <?php } ?>                                                          <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="nofollow" id="featured-thumbnail">                                 <?php if ( has_post_thumbnail() ) { ?>                                      <?php echo '
'; the_post_thumbnail('featured',array('title' => '')); echo '
'; ?>                                 <?php } ?>
                                 <?php echo excerpt(53);?>

<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="bookmark"><?php _e('Read More',''); ?>

                     <?php endwhile; endif; ?>                        <?php if ($options['mts_pagenavigation'] == '1') { ?>                         <?php pagination($additional_loop->max_num_pages); ?>                     <?php } else { ?>

<?php next_posts_link( __( '← '.'Older posts', '' ) ); ?>

<?php previous_posts_link( __( 'Newer posts'.' →', '' ) ); ?>

                     <?php } ?>

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


title: Extend walker class with custom post types

text:
I'm using the walker class below, but I can't make it work with custom posts.                class Zwp_Walker_Nav_Menu_Dynamic extends Walker_Nav_Menu {         function end_el(&$output, $item, $depth) {             global $wp_query;             global $post;             $thePostID = $post->ID;                  $subposts = get_posts( 'numberposts=10&cat=' . $item->object_id );                  if ( $subposts ) {                      $output .= '
object_id == $post->ID && 100 == 101) { $output .= ' sub-menu-current'; } else { $output .= ' sub-menu'; }                 $output .=  ' sub-menu-item-'.$item->object_id.'">                 ';                 foreach( $subposts as $post ) :                     setup_postdata( $post );                     $output .= '
post->ID == $post->ID ) {                          $output .= ' class="current"';                      }                     $output .= '>ID ) .'">' . get_the_title( $post->ID ) . '
                     ';                 endforeach;                 $output .= '
                 ';                  }              }     }         I tried to change the get_posts query, but I get strange results. (Probably because the ID is missing)               $subposts = get_posts( 'numberposts=10&post_type=portfolio_work' );      The result:               Design »         Project 1         Project 2     Photography »         Project 1         Project 2     About »         Project 1         Project 2      This is how it should look like:               Design »         Project 1     Photography »         Project 2     About


title: Display Admin Bar on "Non-WordPress" PHP Page

text: On my WordPress multisite, I am generating a page directly from a .php file (http://example.com/sort.php) and would like to display the admin bar across the top of the page. While I am able to display the site's main navigation menu, I've been unable to call the admin bar successfully despite many attempts. The .php file - which is located in the root directory - starts with the following:               require_once( './wp-blog-header.php' );          get_header();      Then follows a div and the php code that creates the page. In this file, I am calling the footer using `get_footer()` as I've read that displaying the admin bar requires both the header and footer to be called. Any guidance about how to proceed would be most appreciated!


title: update_options and unique filenames

text: I was able to temporarily disable an automatic task of wordpress during a specific file type upload which is nice. For instance, I changed the usual upload path for the pdf uploads by doing this:               //change the normal path     update_option('upload_path','wp-content/uploads/attachments/'.$id);     //upload the file     $upload = wp_upload_bits($pdffile,null,file_get_contents($pdffile_temp));     //get the standard path back     update_option('upload_path','');      Now I would like to do the same with the "wp unique filename" function that is automatically called by wordpress. The same way I changed temporarily the path for this specific upload routine, I would like not to rename the file if another one has the same name inside the target folder (I would rather overwrite the old file with the new one instead). How could I do that? Thank you.


title: Error with Custom Admin Screen in iframe Thickbox

text: I have a plugin that adds a new admin screen in an iframe. I created a PHP file in my plugin, and I put a link with a class of Thickbox to that. Everything works just fine, but it produces a PHP error when WP_DEBUG is set to true. Looking at the WordPress source code, there's no way around the error if I put a PHP from outside /wp-admin/ directly in an iframe. > Notice: Undefined offset: 1 in .../wp-includes/vars.php on line 28 It happens because WordPress is running regex on the web address to extract the file name to set the $pagenow variable, but it assumes the file will be in /wp-admin/. Since it's not, there are no matches. Here is the plugin. The file is children.php. Is there a better way to create a custom admin screen that can be included in an iframe Thickbox that runs through a /wp-admin/ file?


title: Force WP to ignore multiple whitespaces

text: Is it possible to force WP to ignore multiple whitespaces so in the frontend so there’s only one visible? It’s because when my client writes something in the editor sometimes he enters two spaces instead of one and doesn’t notice that. I was quite confused about the fact that multiple whitespaces aren’t ignored automatically because in the source code there is a double whitespace `" "` which to my mind is ignored by all browsers, not `"  "` or `  `.


title: Which Details Are Required For Style.css File Header?

text: Which theme details are absolutely required for your style.css file header? I'm developing my first theme for personal use, so do I really have to include things like a license, license uri, author, author uri, etc. WordPress Docs just give an example, but they don't reference what's required. Does anyone know?               /*     Theme Name: Twenty Thirteen     Theme URI: http://wordpress.org/themes/twentythirteen     Author: the WordPress team     Author URI: http://wordpress.org/     Description: The 2013 theme for WordPress takes us back to the blog, featuring a full range of post formats, each displayed beautifully in their own unique way. Design details abound, starting with a vibrant color scheme and matching header images, beautiful typography and icons, and a flexible layout that looks great on any device, big or small.     Version: 1.0     License: GNU General Public License v2 or later     License URI: http://www.gnu.org/licenses/gpl-2.0.html     Tags: black, brown, orange, tan, white, yellow, light, one-column, two-columns, right-sidebar, flexible-width, custom-header, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, translation-ready     Text Domain: twentythirteen          This theme, like WordPress, is licensed under the GPL.     Use it to make something cool, have fun, and share what you've learned with others.     */


title: Prevent from deleting any user role but subscriber

text: In the administration of my blog, I would like to prevent anyone (admin included) from deleting any user unless it is a simple subscriber. Basicaly, in the "users" section of the administration, I would like the option "delete" to only be visible under the subscribers, not under the administrators, editors, authors or contributors. How can I do that in my functions.php file (I'm not interested in a plugin)? I tried the "remove_cap ('delete_users')" function but it has a too large scope as it prevents from deleting any user while I would like to prevent deleting any user BUT the subscribers. Thank you for your help.


title: bloginfo() vs get_option?

text: What's the difference between: `bloginfo('name');` vs `get_option('blogname');` The parameter is just an example, but I see no differences in terms displaying what I want. Are there any particular differences? Or are they just for semantic reasons. Thanks in advance.


title: Dealing with a looping input form

text:
I'm learning php, don't yet have javascript/jquery skills. If I have 10 posts with 8 marked as status="Approved" and 2 marked as status="Draft", I'm trying to use radio buttons to change "Draft" status to "Approved" for selected items. My code is displaying both "Draft" posts each with a radio button/submit button, and when I submit I get one action that applies to both posts. How do I get the code to process each iteration independently, or is there a more elegant approach?

                 <?php while ( $wp_query->have_posts() ) : $wp_query->the_post();                    $metastatus = get_field("rdc_appstatus");                 $metafile   = get_field("rdc_filename");                 $posttitle  = get_the_title(); ?>                 <?php if ( $metastatus == "Draft")  :                  $draftcount++;  ?>

 <?php echo $posttitle; ?>

<?php echo $metastatus; ?>

                             <?php echo "";?>

                              <form action="#" method="post">

<input type="radio" name="status" value="draft" checked="checked"/>Draft

<input type="radio" name="status" value="approved" />Approved

<input type="submit" name="submit" value="Update"                                     />

                              </form>
                          <?php $status = ($_POST['status']); echo 'Status:'.$status; ?>

                       <?php                  endif;                  endwhile;                  if ($draftcount == 0) : echo '
No Draft Items Found
';                  else :                 echo '
 '.$draftcount.' Draft Items Found
';             endif;             ?>


title: Getting parent category hierarchy as objects from category template

text: What is the best way to get the hierarchy of parent **category objects** from the `category.php` template, when there is no post as such. The function `get_category_parents()` returns a string not the objects. The function `get_categories()` seems to be intended for pages where there is a post because the `type` argument can take either `post` or `link`. Is there any other function I am missing? I would need something that behaves exactly like `get_category_parents()` but I need the category objects not just a string of all of the names.


title: Remove Items from Template Homepage

text: I've never used Wordpress but am considering it for a responsive church website. BEFORE I purchase space froom a webhost here's my question preceded by a scenario I want: Scenario: I want my landing page to be very simple. A header, horizontal links below the header, a horizontal slide show beneath the links and then a very simple statement about the church then a footer. That's it. I want the visitor to see everything without scrolling down that particular page (inside pages don't matter). Question: If I use a responsive Wordpress template, can I delete the items from the landing page I don't want on it? Thanks


title: show User Registration Date in Wordpress

text: i want to show user registration date like **Member since** : 15,dec 2012. I have a code `<?php echo date("M Y", strtotime(get_userdata(get_current_user_id( ))->user_registered)); ?>` but it show same date in all users profiles. Can some one please tell me how i fix that.


title: Get the latest comment from a custom post type where depth = 1?

text: Happy new year everyone. I've been struggling with this one for a while. I need to get the latest comment from a custom post type, but ignore any child comments i.e. only look at comments with a depth of 1. I can get the latest comment from a custom post type using:               $args = array(         'post_type' => 'custom-post-type',         'number' => '1',         'orderby' => 'date',         'order' => 'DESC'       );          $comments = get_comments($args);     foreach($comments as $comment) :         echo($comment->comment_author . '<br />' . $comment->comment_content);     endforeach;      However, it doesn't take into account the depth requirement. Any ideas how I can achieve this?


title: Fix incorrect related posts code snippet

text:
Can anybody fix this incorrect related posts codes snippet?               function related_posts() {     if (is_single()) {         global $post;         $current_post = $post->ID;         $categories = get_the_category();     foreach ($categories as $category) :         ?>

Related Posts

         <?php         $posts = get_posts('numberposts=5&category='. $category->term_id . '&exclude=' . $current_post);     foreach($posts as $post) :         ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
         <?php endforeach; ?><?php endforeach; ?>

         <?php             }         wp_reset_query();     }     add_action( 'genesis_after_post_content', 'related_posts' );      This snippet works fine to display related posts specifically for parent category. Problem is happening after publishing a post under child category (like under “Social Media -> **Facebook** ”. # Related posts being displayed twice one for parent and other for child category. Which i don't want. ![enter image description here](http://i.stack.imgur.com/F7tuS.png) Related posts should specifically show based on that particular category, that under the post is published no matter whether it's parent or child category. Can anybody help me regarding this ? Any help would be appreciated :)


title: Multiple images in one attachment page

text: I want multiple images for one post attachment page, but there is no option for that. How can I do that? ![enter image description here](http://i.stack.imgur.com/9EZfml.jpg)


title: Restrict Author to pick from media library, but not upload media

text: I have a multisite network where the super admins will be creating the individual sites. An important role we need to enable, for compliance reasons, is to restrict "Authors" to not be able to upload media, but be able to access the media library to choose from media that is uploaded by the super admin. I have downloaded the User Role Editor plugin, which is a great plugin btw, but the only option it gives is to turn off the "upload_files" function. That takes away all ability to access the media library. No bueno. Anyone wanna take a stab at this??


title: How can I show recent posts from same taxonomy as the post currently being viewed?

text:
I'm wondering how I can show recent posts from the same taxonomy as the post that's currently being viewed (working with custom post types and custom taxonomies). If it was simply a category of a regular post, it would look like this:               <?php global $post;     $categories = get_the_category();     foreach ($categories as $category) :     ?>
More News From This Category

     <?php     $posts = get_posts('numberposts=20&category='. $category->term_id);     foreach($posts as $post) :     ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
     <?php endforeach; ?>
<a href="<?php echo get_category_link($category->term_id);?>" title="View all posts filed under <?php echo $category->name; ?>">ARCHIVE FOR '<?php echo $category->name; ?>' CATEGORY »
     <?php endforeach; ?>
      But with custom posts/taxonomies, there has to be a different sort of solution. Couldn't find anything useful so far in the wordpress codex.


title: Add Rewrite Rule for custom page

text: Was trying to create author specific page with author specific URL and it was working fine,but when i created this URL did not taken in to account following 2 factors   1. Author Name Conflict (similar name).   2. Paging option to be added to author page (for his published posts) here is my initial rule               function add_my_rule() {             global $wp;          $wp->add_query_var('args');            add_rewrite_rule('writer\/(.*)','index.php?pagename=writer&args=$matches[1]','top');          /*global $wp_rewrite;         $wp_rewrite->flush_rules();*/     }     add_action('init', 'add_my_rule');       This was working file for a URL say               www.myblog.com/writer/umesh-awasthi ,      but there can be more author with same name and this will create a issue.So i was planning to have Blog author URL like SO have `www.myblog.com/writer/001/umesh-awasthi` where `001` is user id which will always be unique. second issue is with paging, as i am able to create paging on the author page but when user is clicking second page the URL is coming as `http://localhost/blog/wordpress/writer/umesh-awasthi/page/2/` so as per my URL-Rewrite rule i will get following data as parameter `umesh-awasthi/page/2` which means that now my query will not work as it will expect the author name as `umesh-awasthi` and will get it as `umesh-awasthi/page/2` My Question is can i rewrite the rule so that i should get data in following way in three different variables   1. userid   2. author name   3. page number (if it exits) being new to the WP and rewrite i am not sure how i can achieve this thanks in advance


title: Need Comment Link Help

text: I am interested in adding a comment form at the end of my posts from the home page. I use Disqus and the comment form shows up when you click onto the actual post itself but not after a post on the home page. At the very least, moving the comment link from the title area to the end of each post (on the home page) would be great, as it's currently hard for people to find where to comment. I'm using the free platform theme by pagelines. My url is www.trinketsofthought.com. I'm not the most techinal/code-y type of person, so help in the form of dummed down terms would be fabulous. I greatly appreciate your time!


title: Disable dashboard drag&drop

text: I need to disable drag&drop functionality for dashboard widgets. This should be realized with jquery, just as it is for the dashboard_browser_nag. I'm no jquery expert - so can anybody tell me how to find and modify my widgets with jquery? So far, I know that I have to do some .sortable("cancel"), but how exactly? Thanks!


title: Building theme so user can change header image

text: My Google-Fu is letting me down so I'm trying it here. I'm building a theme and I want the customer to be able to change the header image him/herself in the wp-admin. How do I go about this? As I said my Google-Fu has been embarrasingly lacking on this one so even a link to where to start would be fantastic. Thanks!


title: WordPress admin screen very slow / timing out when editing or adding a new page/custom post

text: I'm new to the site but appreciate any help you can give. I have a WordPress set-up which (rightly or wrongly) has hundreds of pages and thousands of another custom post type which is also based on a page (ie hierarchical). When attempting to add a new page or custom post type (or edit an existing one) in the admin, the edit page screen loads extremely slowly if at all. Usually timing out around the Attributes Box mark (sometimes it will load the entire page, sometimes not, but basically it's either extremely unusable or not usable at all). My assumption is that because there is so many items to be loaded on the hierarchy menu (within the Attributes Box) it's causing the time out. I understand that perhaps using so many pages in this way is perhaps not optimal for WP, but this is the situation the site is in now and I cannot easily change it (and unfortunately the ability to put a page within a certain hierarchy is needed so I can't just hide the Attributes box from the admin). In the long run maybe the site needs to be rebuilt to use only posts however is there anything I can do for now to either help WordPress load the edit page fully and/or speed it up. Any htaccess/php.ini hacks (I've tried a couple, like increasing memory size/execution time but didn't seem to help) or anything else you think I can try (I am open to nearly any idea), something in MYSQL to cache it maybe (I'm not an expert on this unfortunately) Really appreciate any help you can give Thanks, Nick PS It's WordPress 3.2.1 PPS I also tried editing the permalink structure so it doesn't include %post-name but that didn't help PPPS I also tried duplicating the site and upgrading to WordPress 3.3 latest beta but still the same PPPPS The site is on a Rackspace Sites Cloud Server Also... I tried disabling the Attributes box and just trying to use the Quick Edit function on the Pages listing part of the admin to control hierarchy but this is not responsive presumably because it is 'timing out' because of the same issue, so unfortunately my temporary workaround idea doesn't really do it either, cheers.


title: Wordpress create new <section> on site when a new page is added

text:
I'm trying to create a single page wordpress theme. Whenever I add a new page, I want a new to be added to my Single page theme. I'm currently using this code:               $pages = get_pages( array ( 'sort_order' => 'asc', 'sort_column' => 'menu_order', 'depth' => 1));                  foreach ( $pages as $page ) {               $page_section = str_replace( " ", "", strtolower( $page->post_name ) );                  echo '

';             }             ?>      What I want is for it to create a new with an ID and Dataslug that match the page name (which is also the label on the link in the Menu). For example, say I insert a page called about, The menu item will read "about" and this code will be added to the page


title: Adding Menu & Sub Menu In Wordpress Not Working

text: i have added the below function in my **_functions.php_** in theme folder.. and i refreshed my **_wp-admin_** page.. but the sub-menu is not coming               add_action('admin_menu', 'register_custom_menu_page');          function register_custom_menu_page()     {        add_menu_page('View Orders', 'View Orders', '', 'orders/vieworder.php', '', plugins_url('orders/small_cart_icon_20.gif'), 100);        add_submenu_page( 'orders/vieworder.php', 'My Custom Submenu Page', 'My Custom Submenu Page', 'manage_options', 'orders/vieworder.php' );      }


title: wp_login_form redirect

text: Is there a way to redirect a user who logs in using wp_login_form to a custom page that is created automatically on signup It seems like the URL needs to be absolute and obviously the end of the URL would change with each user. Please see the function used to create the page on signup               function create_user_page($user_id) {         if ( $user = get_userdata($user_id) ) {             // Create a new user-specific page             $page = array(                     'comment_status' => 'closed',                     'ping_status' => 'closed',                     'post_name' => $user->user_login,                     'post_status' => 'publish',                     'post_title' => $user->user_login,                     'post_type' => 'page'                 );      So, when a user logs in via the page that includes wp_login_form they need to be redirected to http://www.websiteurl.com/user1 etc. where user1 is the page that has been created. I hope that made sense.


title: How to get a value from PHP in Jquery through Ajax

text: **I'm trying to get a value from a PHP function through Ajax and save it in a variable in jquery.** The PHP;               add_action( 'wp_ajax_mark_as_read', array( &$this, 'readen_color' ) );          public function readen_color() {        if( isset( $_POST['post_id'] ) && is_numeric( $_POST['post_id'] ) ) {           echo 'hello';        }     }      The Jquery:               $(document).ready(function(){     alert ('Test');     var sArticleId, iPostId;          // Get the article ID and split it -      sArticleId = $("article").attr('id');     iPostId = parseInt(sArticleId.split('-')[1]);          $.post(ajaxurl, {      action:'readen_color',      post_id: iPostId     }, function (response) {     console.log(response);          var response = parseInt(response);     alert('value of response: ' + response);                 });     });      Any ideas what i'm doing wrong? Could not answer the my own question but Now it works with:               var responsevar = response;     alert('The Server Responses: ' + responsevar);      Instead of:               var response = parseInt(response);     alert('value of response: ' + response);


title: Permalink Settings

text: I have a `.htaccess` problem what buggs me out for couple of hours already. I have updated the file as it should be:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /zootaxi.lv/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /zootaxi.lv/index.php [L]     </IfModule>     # END WordPress      and Im working on localhost. I've tried both paths:               C:\wamp\www\zootaxi.lv      and               C:\wamp\www\zootaxi.lv\wp-content\themes\zootaxi      Advice much appreciated, Thanks


title: how to extract the username of the wordpress user?

text: I am designing a code that uses that involves a pluggin. I need to extract the current wordpress users username to fetch him special authorities. This extraction of the username is being done in a php file of the pluggin.


title: Set WordPress Default Template

text: I'm using the _Options Framework Theme_ to put together my options page and would just like to know how would I set up/call the _Default Template_ \- for whichever one the user has selected. For example, on my _Theme Options_ page, you can choose from the following:   1. Full Page   2. Side Bar Left   3. Side Bar Right Which looks something like this: ![enter image description here](http://i.stack.imgur.com/mjQSI.png) Once the user has selected one of these options, when they go to create a _New Page_ , in the _Page Attributes > Template_ drop-down menu, the " _Default Template_ " should be the one that they chose from before... ![enter image description here](http://i.stack.imgur.com/MCyXo.png) In my `options.php` file:               $options[] = array(             'name' => "Default Template",             'desc' => "The default layout when a new page is created.",             'id' => "layout_options",             'std' => "2c-r-fixed",             'type' => "images",             'options' => array(                 '1col-fixed' => $imagepath . '1col.png',                 '2c-l-fixed' => $imagepath . '2cl.png',                 '2c-r-fixed' => $imagepath . '2cr.png')         );      To call the output:               <?php echo of_get_option('layout_options', 'no entry' ); ?>      Where/what would I need to paste in throughout my theme files to grab the users selection and point it towards the _Default Template_ , as currently it may only be saving the selected image?


title: How to add_filter/action to comment out CSS generated by admin function?

text: So in wp-includes/admin-bar.php there is a function that adds CSS styling to the page:                   function _admin_bar_bump_cb() { ?>         <style type="text/css" media="screen">             html { margin-top: 28px !important; }             * html body { margin-top: 28px !important; }         </style>         <?php         }      I want to comment this out properly (either the function or the contents of the function, either one is fine) but not touch the core code. How would I do this?


title: how to use a single checkbox with wpalchemy?

text: I can find some little example on using multiple checkboxes, but no one about using a single checkbox in a wpalchemy metabox. Anyone can help me please? No docs about this topic on the wpalchemy site.. Thank you


title: how can i display taxonomy instead of category on my web page?

text: I want to display taxonomies instead of categories on the homepage of my blog. What can I do to achieve this?


title: Allow admin login at /admin

text: I am interested in:   1. how can we change the default login url `/wp-admin` to `/login`   2. how can we add another url for login so that both `/wp-admin` and `/login` would work I tried to use a custom filter and .htaccess as in the following example but without success. functions.php               add_filter('admin_url', 'my_new_admin_url');          function my_new_admin_url()     {         return '/login/';     }      .htaccess               Redirect permanent /wp-admin/ /login/


title: Show 10 newest post for each value of a custom taxonomy

text: I am working on a theme that has a custom post type called `Languages` and it will have a custom taxonomy called `Language` which will act as a category. Now let's assume my `Language` taxonomy has these 4 values for now, `English`, `French`, `German`, `Spanish`. I would like to have something like this with this custom taxonomy/category on my sidebar... **English**   \- link to newest post   \- link to 2nd newest post   \- link to 3rd newest post   \- link to 4th newest post   \- All the way to the 10th post   **\- then a link to View all** **French**   \- link to newest post   \- link to 2nd newest post   \- link to 3rd newest post   \- link to 4th newest post \- All the way to the 10th post   **\- then a link to View all** **German**   \- link to newest post   \- link to 2nd newest post   \- link to 3rd newest post   \- link to 4th newest post \- All the way to the 10th post   **\- then a link to View all** **Spanish**   \- link to newest post   \- link to 2nd newest post   \- link to 3rd newest post   \- link to 4th newest post \- All the way to the 10th post   **\- then a link to View all** So as you can see, I just need to list all of a certain taxonomy, then under each one show the 10 newest post under that category ande provide a link to the view all page Please help me do this someone I know how to set up the taxonomy and custom post type, I just need help getting it to show each one and the 10 newest post for each one in a list like that


title: Extremely slow Wordpress website with 6000 posts

text: I have a website with 6000 posts and it is extremely slow. Sometimes I get this error in my browser:               Service Temporarily Unavailable          The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.          Error: 503 Service Temporarily Unavailable      I have turned almost all plugins off and it is slow in frontend and in backend too, so I guess it is not because of the template. Could it be because of WP_navigation plugin? I have est. 600 pages with ten posts or WP navigation plugin, could this be the problem?


title: How can I override one post and make it display content for another post?

text: I have two pages on my Wordpress site:               mysite.com/?p=100     mysite.com/?p=200      I think I should be able to hook into Wordpress' actions somewhere and re- query the post, so that content for `mysite.com/?p=200` would be displayed on the page `mysite.com/?p=100` Based on feedback from the first answer, I think it would need to look something like this:               add_action( 'pre_get_posts', 'wpse35832_pre_get_posts' );             function wpse35832_pre_get_posts( $query ){              $pid = '';              if( ! empty( $query->query_vars['page_id'] ) )         {             $pid = $query->query_vars['page_id'];         }         elseif( ! empty( $query->queried_object->ID ))         {             $pid = $query->queried_object->ID;         }              if($pid == '100'){             $query->query_vars['page_id'] = 200;         }              return $query;          }      And actually that function does work - but with one caveat: If I use pretty permalinks (`mysite.com/name-of-page/`), the title of the page is for the original post. However if permalinks are in the query variable style, everything seems to work fine. **What am I doing wrong, and how can I fix it?** I tried `unset($query->queried_object` so that it would need to be re-queried, and doing that causes a redirect back to the original page. Basically I'd like the whole webpage that is rendered to be exactly the same as it would be for the other post, including title tag, post title, and post content, and so I'm trying to hook in early enough to make that happen. I realize I could create a custom page template, something like `post-200.php` and inside that use the `query_posts` function and display content. This is not what I'm trying to do though. I admit this would serve no practical purpose on most blogs, but I think it is possible and I hope you guys can give me some help with doing it.


title: the_post_thumbnail hard cropping not working no matter what

text: No matter what I do - I can't get the hard cropping mode in the_post_thumbnail to work. Here's what I have:               add_image_size( 'Blog', 300, 300, true );      the_post_thumbnail('Blog');      I've also tried:               set_post_thumbnail_size( 300, 300, true );     the_post_thumbnail();      I've tried uploading new images, and using the "Regenerate Thumbnails" plugin, but still no luck. It completely ignores the "true", and acts as if it's "false". For example, instead of the image being 300x300, it'll be 300x238 or something. Has anyone else experienced this? My GD Library is enabled.. Thanks for any input anyone can offer =)


title: extract shortcodes from string

text: i need a little help to with this issue: I have a string wich contains shortcodes like `[shortcode data="1" data2="2"]` How I can extract with regex? without wordpress system? Thanks in advance.


title: redirect does not work in ajax function

text: I'm using ajax to post the form data. In the end I want to redirect to homepage. I'm trying following code, it does not work. It returns error 302. How can I redirect in the following function? Thanks.               add_action('wp_ajax_nopriv_custom_register', 'custom_register');     add_action('wp_ajax_custom_register', 'custom_register');          function custom_register(){              //process              wp_redirect( home_url() );         exit;     }


title: Help me add Taxonomy to byline

text:
The following is my code for adding a byline to a post. Can you please explain how I can get my taxonomy onto this. The taxonomy is destination.               /*********************     CLEAN BYLINE     *********************/     if ( ! function_exists( 'cb_byline' ) ) {           function cb_byline($cb_cat = true, $cb_post_id = NULL, $cb_short_comment_line = false, $cb_posts_on = false) {              $cb_meta_onoff = ot_get_option('cb_meta_onoff', 'on');          $cb_disqus_code = ot_get_option('cb_disqus_shortname', NULL);         $cb_byline = $cb_cat_output = $cb_comments = NULL;         $cb_cats = get_the_category($cb_post_id);              if ( isset( $cb_cats ) && ( $cb_cat == true ) ) {             $cb_cat_output = '
 ';             $i = 1;             foreach($cb_cats as $category) {                 if ( $i != 1 ) { $cb_cat_output .= ', '; }                  $cb_cat_output .= ' term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s", "cubell" ), $category->name ) ) . '">'.$category->cat_name.'';                  $i++;             }             $cb_cat_output .= '
';         }         if ( $cb_disqus_code == NULL ) {              if ( get_comments_number( $cb_post_id ) > 0) {                 if ( $cb_short_comment_line == true ) {                     $cb_comments = '
' . get_comments_number( $cb_post_id ) . '
';                 } else {                          if ( get_comments_number( $cb_post_id ) == 1) {                              $cb_comment_line = __('Comment', 'cubell');                      } else {                             $cb_comment_line =  __('Comments', 'cubell');                     }                     $cb_comments = '
'. get_comments_number( $cb_post_id ) . ' '. $cb_comment_line .'
';                      }             }         } else {                  $cb_comments = '

';              }              $cb_date = '
 <time class="updated" datetime="'. get_the_time('Y-m-d', $cb_post_id).'">'. date_i18n( get_option('date_format'), strtotime(get_the_time("Y-m-d", $cb_post_id )) ) .'</time>
';              if ( ( $cb_meta_onoff == 'on' ) || ( $cb_posts_on == true ) ) {             $cb_byline = '
' . $cb_author . $cb_date . $cb_cat_output . $cb_comments . '
';         }              return $cb_byline;               }     }


title: Edit a different page in WP Customizer

text: I'm working with Customizer's incredible options, and so far so good, it's really powerful and does everything I want. However, I'd like to extend it, so instead of editing only the main page, I want to allow editing of inner pages. While I achieved this (saving the changes and navigating to the edited page), I can't make it work in live Customizer. I mean, even if I navigate to that page inside Customizer, it isn't grabbing the live changes at all. I've added the JS bind for live preview so that isn't the problem (plus, it works if I save, it just doesn't show in LIVE mode). Is there a way to achieve this, or is it just that live Customizer works only for the main page? Another related question: I have these inner page sections apart of the main page section. Is it possible to make the preview window load the page I want to edit when I click the accordion tab for that section? I'm thinking that maybe that's the issue. Just to be clear: site title, background, header, etc ----> main page in preview window   portfolio items ----> load portfolio page in preview window   store items ----> load store page in preview window Any help appreciated, I was searching on Google and here, but couldn't find anything so far.


title: 'Archive' folder for posts and pages

text: Of course there is a Drafts section in Post and Pages, but how would I make an Archive section - which would contain previously published posts and page?


title: feedburner email notification when post is updated

text: I usually need to update my posts when there have new information. As default feedburner don't send email notification when the post is update but I check another site (using custom template), he create an update page and each time he post on it, reader will get feedburner email notiication, but it's not new post. It's old post (the post that just has been updating) and the information that just has been updated. News page: http://www.ptc-investigation.com/news.aspx Homepage: http://www.ptc-investigation.com/default.aspx \- "News & Updates" section. Can I create something like that in wordpress? Thank you.


title: Metadata for a taxonomy - is there any WordPress way of doing this?

text: If I have a CPT "movies" I know I can have various taxonomies eg "Director", but how can I store further information such as "director's nationality" for any one particular director ... or is this possible using WordPress?


title: Filter image and text from post format

text:
I have a site that requires a lot of styling for post formats, I have never dealt with formats before but essentially what I want is : if post format is image... do this loop, if format is standard show The problem is that I am using a filter in the loop on single.php to pick out the image posted and show it as a header. This seems to be getting in the way of the showing standard content mark up if the format is 'standard' function Here is the single.php                               <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting">
                                       <?php                             preg_match_all("/(]*>)/",get_the_content(),$matches,PREG_PATTERN_ORDER);                             for( $i=0; isset($matches[1]) && $i < count($matches[1]); $i++ ) {                             echo $beforeEachImage . $matches[1][$i] . $afterEachImage;}?>

                             <?php                                ob_start();                                the_content('Read the full post',true);                                $postOutput = preg_replace('/]+./','', ob_get_contents());                                ob_end_clean();                                echo $postOutput;                             ?>

<?php get_sidebar(); // sidebar 1 ?>

                                                                                <?php else : ?>                            <?php the_content(); ?>                          <?php endif; ?>


title: Display future single post 404 error

text: I have a custom post type `kalender`, a template which displays all of the posts in this custom post type and a `single-kalender.php`. Everything works fine when the user is logged in but when logged out the single pages return a `404 error`. I'm assuming I get the `404` because I'm trying to display future posts when not logged in. How would I go ahead and solve this issue? **EDIT 1**               $labels = array(       'name' => __('Events'),       'singular_name' => __('Event'),       'add_new' => __('Nieuw event'),       'add_new_item' => __('Nieuw event'),       'edit_item' => __('Event bewerken'),       'new_item' => __('Nieuw event'),       'view_item' => __('Bekijk event'),       'search_items' => __('Doorzoek Events'),       'not_found' =>  __('Niets gevonden'),       'not_found_in_trash' => __('Niets gevonden in de prullenbak'),       'parent_item_colon' => ''     );          $args = array(       'labels' => $labels,       'public' => true,       'query_var' => true,       'menu_icon' => get_stylesheet_directory_uri() . '/img/events.png',       'hierarchical' => false,       'menu_position' => null,       'rewrite' => array( 'with_front' => false ),       'supports' => array('title','editor','thumbnail')       );           register_post_type( 'kalender' , $args );     flush_rewrite_rules();      **EDIT 2** I've added some code in the `404.php` template which would detect if the page which is trying to load is in the custom post type `kalender`. This works:               <?php          global $wp_query;              if ('kalender' == $wp_query->query_vars["post_type"]) {             include 'single-kalender.php';         }         else{ ?>             </div><!-- .menu-container -->             <h1>Error 404</h1     <?php } ?>      Now I'm trying to query that specific single custom post type in the `single- kalender.php` template but I can't get it to work. The following query outputs no posts, even though the `found_posts` variable is 1 (works as expected) but the `posts` array remains empty unfortunately.               global $wp_query;     $name = $wp_query->query_vars["name"];          add_filter( 'posts_where', 'my_posts_where_from_today' );          $query = new WP_Query(array('post_status' => array( 'publish', 'future' ), 'post_type' => 'kalender', 'order' => 'ASC', 'name' => $name ));      When I use the generated query on my database it selects the single custom post type as expected, the generated query is the following:               SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'slug-of-the-post' AND wp_posts.post_type = 'kalender' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'future') AND post_date > '2013-04-11'  ORDER BY wp_posts.post_date ASC       If you want to check the whole `print_r($query)` see here: **http://pastebin.com/cSzmXDVb**


title: Login from third-party application with WordPress credentials

text: I've made a web app with WordPress and it works great. Recently I started developing for Android. So far I've made an app with some webviews to load the correct web apps URL:S, and a menu. But now I've started thinking about doing a native android login activity instead of just using the standard WordPress login page. So my question is: Does WordPress support this kind of user authentication? If not, would it be possible if I changed the WordPress login to something like Google+ Sign in, Oauth or OpenID+ I don't have any experience with this things, so I don't really understand the texts that I've been reading about this.


title: Mail sending randomly fails

text: I'm having a troublesome problem here. I set up a event subscription plugin that should send a confirmation mail at the end of the subcription process. Here's the code:               wp_mail( $data['email'], $settings->field('confirmation_mail_subject'), $mail_body, array("Content-type: text/html"));      I get recognize a pattern for this problem. Any idea?


title: How can I manage my multiple wordpress websites from main website?

text: Can this solution be used for multiple WP installations on the same site? For example, I have multiple blogs (multiple subdirectories), i.e. mysite.com/blog1, mysite.com/blog2, mysite.com/blog3, etc. on the same site. But, I want to combine the subdirectories to use one database (and theme, and plugins, etc.) Will this solution work? How can I read my all databases my all subdirectories from main website. I have already created WP Network and I have multiple WordPress website. I am trying to how can read all database from main website. For example: I have "watches.website.com" sub-domain and I have here some products. I want to try to call that's products from "website.com" with search. Can I do that like this? But it's not only one sub-domain. I have more sub-domains. I am trying to like pricegrabber.com or ebay.com They have sub-domains too. But they are managing all sub-domains from main website.


title: Permalinks that go to a specific template

text: This is actually my first question here, so hello to everybody in this community! I have developed a theme with a custom post type and a template (lets call it "my_template.php") that shows posts of this custom post type in an archive- like fashion. What I'm trying to achieve is to make a permalink in the navigation of the site that goes to a specific template (like "my_template.php") and ignoring the wp template hierarchy. How could one do that? Note: I've already checked out This answer, but that one didn't really help and provided only a workaround. Thanks!


title: Thumbnail remove width & height function

text: I wish that when the browser was resized to below 980px, my images were width 100%. The container of the images already have 100%, the problem is that I'm using wordpress size code for thumbnails:               add_theme_support ('post-thumbnails');     add_image_size ('portfolio1', 600, 344, true);      So I thought to use this code to remove the image sizes:               jQuery (document). ready (function ($) {          $ ('img'). RemoveProp ('width'). RemoveProp ('height');     });      The problem is that I do not know how it would look for smaller sizes that 980px browser. I do not know if this is the best way. I Would like some help Thank you


title: custom user meta query

text: I've been trying to get this query to work but it keeps failing to return any rows               SELECT a.ID        FROM wp_users a, wp_usermeta b      WHERE b.user_id=a.ID      AND (       (b.meta_key='firstname-groom' AND b.meta_value LIKE 'Darren')        OR (b.meta_key='firstname-bride' AND b.meta_value LIKE 'Someone')        OR (b.meta_key='lastname-bride' AND b.meta_value LIKE 'Cool')     )      AND (b.meta_key='weddingdate' AND b.meta_value='12/14/2014')      GROUP BY a.ID      The query return rows if I remove this part `AND (b.meta_key='weddingdate' AND b.meta_value='12/14/2014')` but I need to be able to make it work with that requirement (weddingdate=12/14/2014)


title: Too many connections to server

text: I'm facing a really weird problem with my wordpress/server. Sometimes when I add media (images) to a new post, and then try to submit this post, instead of my website I got the information in browser:               connection rejected by server      I contacted my hosting provider to solve this problem and they claim that my wordpress is generating too many simultaneous connections to server and that's why my IP is being blocked (usually for about 48 hours). For everyone else the site is working perfectly fine. Is it possible that adding images/submitting the post is generating more than 18 connections to server (that's the limit that my hosting provider has on its servers)? And if yes, how to solve this problem? I'm using wordpress always updated to the newest version.


title: Adding first and last class to Menu on top level only

text: I'm using a WordPress Menu to create a navigation structured like this:   * Home   * About   * Contact      * Sub Page Using this code from kuroi's response here I'm able to add `first-menu-item` and `last-menu-item` classes to the list items above:               function add_first_and_last($output) {         $output = preg_replace('/class="menu-item/', 'class="first-menu-item menu-item', $output, 1);         $output = substr_replace($output, 'class="last-menu-item menu-item', strripos($output, 'class="menu-item'), strlen('class="menu-item'));         return $output;     }     add_filter('wp_nav_menu', 'add_first_and_last');      However the `last-menu-item` class is being added to the Sub Page list item (because it's the last) rather than to the Contact list item. Question: How can I make this function apply only to the top level items of a menu? Thanks!


title: How to get rid of extra Untitled Article in html5 document outline when using new WP_Query?

text:
Here is a simplified version of the code I'm using on a static homepage template made for a child theme of TwentyTwelve. I simplified some of the divs used for styling and just focused on the problem area. The problem is when I view this using the Chrome extension to see the html5 outline, everything looks fine except the Featured Comic section has 2 articles underneath it (should only show 1). One article for the sticky post it's supposed to pull in and one labeled 'Untitled Article' (which when clicked gives me the post ID of the next post after the sticky one but isn't showing any content) and then another entry for the h3 'Subheading'. I would like to keep the multiple loops on the page so the user can update the static homepage content. Is there something I'm missing to get rid of this phantom Untitled Article?               <?php get_header(); ?>
     <?php while ( have_posts() ) : the_post();         get_template_part( 'content', 'page' );     endwhile; // end of the loop. ?>
<!—-for styling only-—>

Featured Comic
     <?php $featured_comic = new WP_Query( array( 'posts_per_page' => 1 ) );     if ( $featured_comic->have_posts() ) : while ( $featured_comic->have_posts() ) :              $featured_comic->the_post();         get_template_part( 'content-homefeatured', get_post_format() );     endwhile; endif;     wp_reset_postdata(); ?>

Subheading

<!—-for styling only-—>

     $recent_posts = new WP_Query( array( 'posts_per_page' => 4 ) );     if ( $recent_posts->have_posts() ) : while ( $recent_posts->have_posts() ) :              $recent_posts->the_post(); ?>         <div class="box<?php if($count%2 == 0 ) {echo '-1'; }; $count++; ?>">         <?php get_template_part( 'content-homerecent', get_post_format() ); ?>
<!—-for styling only-—>            <?php endwhile; endif;     wp_reset_postdata(); ?>
      content-page:               <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>          <?php if ( ! is_page_template( 'page-templates/front-page.php' ) ) :         the_post_thumbnail();     endif; ?>
<?php the_title(); ?>

     <?php the_content();     wp_link_pages( array(          'before' => '
' . __( 'Pages:', 'twentytwelve' ),          'after' => '
' ) ); ?>
          <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '', '' ); ?>
      content-homefeatured:               <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>     <?php if ( is_sticky() ) : ?>                  <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >         <?php the_post_thumbnail(); ?>                  <?php echo do_shortcode('[shareaholic app="share_buttons" id="12345"]'); ?>

         <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?>
         <?php the_excerpt(); ?>
     <?php endif; // is_sticky() ?>
      content-homerecent:               <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >     <?php the_post_thumbnail('homepage-thumb'); ?>

     <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?>
     <?php the_excerpt(); ?>
     <?php echo do_shortcode('[shareaholic app="share_buttons" id="12345"]'); ?>


title: Display post format post in the sidebar

text:
I am trying to pull posts with the post-format of "quote" on my sidebar. I'm getting the code to spit out the else statement but that's about it so far. I am working in the roots theme if that helps at all. Let me know if I can show anymore code that might help you help me :). Thanks.
            <?php            $quote = array(                 'posts_per_page' => 1,                 'post_type' => 'post',                 'tax_query' => array(                     array(                         'taxonomy' => 'post-format',                         'field' => 'slug',                         'terms' => array( 'post-format-quote' )                     )                 )             );        ?>            <?php       $the_query = new WP_Query( $quote ); ?>            <?php if ( $the_query->have_posts() ) : ?>            <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>            <?php get_template_part('templates/content', 'quote'); ?>           <?php endwhile; ?>           <?php wp_reset_postdata(); ?>          <?php else:  ?>
<?php _e( 'Sorry, no posts matched your criteria.' ); ?>
     <?php endif; ?>


title: Query Custom Post Type and Output to timeline

text:
I have a wordpress query that outputs posts that contain the following info: - year - link to a pdf-file - title - post image so its essentially an archive for yearly reports dating back to the 1860's until today. For the early days there arn't pdf-files/posts for every year. in the newer days in some years there are multiple files per year. i would need the query to output an UL with the following configuration:

1860
Image, Title, PDF Link in Post

1861
Image, Title, PDF Link in Post

1862

      so the class should contain info if its "decimal" year like 1860, 1870, 1880, etc. or a year inbetween like 1861, 1862, 1863, etc. Then there needs to be a class noting if theres a corresponding yearly post or not. (the links will be displayed on a visual timeline) so even if there is no yearly output, there still needs to be a li element. if there are multiple files in a year there should be another ul in the div containing the data. thats quite a query i know! heres the query so far:               // set the query             $query = array (                  'post_type' => 'jahresberichtpdf',             'orderby' => 'jahresberichtjahr'             );             // loops             $queryObject = new WP_Query($query);             if ($queryObject->have_posts()) : ?>             <?php while ($queryObject->have_posts()) : ?>             <?php $queryObject->the_post(); ?>
             Title:<?php the_title(); ?>             Thumbnail:<?php the_post_thumbnail('thumbnail'); ?>                   PDF: <?php print_custom_field('jahresberichtfile:to_link'); ?>             Year: <?php print_custom_field('jahresberichtjahr'); ?>
             <?php endwhile; ?>             <?php endif; ?>      has anybody done a query like this or would be up for the challenge? if someone is willing to put some effort in, i would show my appreciation in form of a paypal donation! thanks, mark


title: WP_Cron script not updating all posts in loop

text: I've had an issue with this piece of script for a month now http://pastebin.com/f6LqgqQS. What the script is supposed to do is loop through all my posts, pull the like count from the facebook graph and update the post's meta with it.      **Now the issue I've had for so long is that not all of my posts were updated**. It worked fine when I had 5 posts or so but once I reached 60+, the older posts were left unaffected. They did update after a while though, but it could take over 4 days even though **wp_cron** is set to hourly (and I know it needs visitors to run).      Now I always thought that **graph api** was the culprit and that facebook limited my number of requests, but after some testing with running the script on init instead, it seems that **wp_cron** was causing the problem. I even disabled wp_cron now and I'm running it from the Cpanel with cronjob and so far it has worked great.      But the problem right now is that I don't really have a way to confirm that the script does indeed work correctly and if **wp_cron** was the culprit after all, as my searches turned up nothing. So I'm wondering if someone more experienced here could take a look at the script and figure out if indeed **wp_cron** was the problem after all.


title: Image thumbnails slider

text:
`js-image-slider.js`               var sliderOptions=     {         sliderId: "slider",         effect: "13,17,13,13,5",         effectRandom: true,         pauseTime: 2600,         transitionTime: 500,         slices: 12,         boxes: 9,         hoverPause: 1,         autoAdvance: true,         captionOpacity: 1,         captionEffect: "fade",         thumbnailsWrapperId: "thumbs",         m: false,         license: "mylicense"     };          var imageSlider=new mcImgSlider(sliderOptions);     .......      `single-photos.php`               <div <?php post_class() ?> id="post-<?php the_ID(); ?>=">

                   <?php the_content (); ?>

         `slider.css`               #sliderFrame      {         width:680px;         margin:20px auto;         padding:20px;         background:#fafafa;         border:1px solid #666;         border-radius:1px;     }          #slider {         width:533px;height:400px;         background:black url(loading.gif) no-repeat 50% 50%;         position:relative;         margin:0 auto;     }     #slider img {         position:absolute;         border:none;         visibility:hidden;     }          #slider a.imgLink {         z-index:2;         display:none;position:absolute;         top:0px;left:0px;border:0;padding:0;margin:0;         width:100%;height:100%;     }          div.navBulletsWrapper  {         display:none;     }          #thumbs      {         margin-top:50px;         text-align:center;         font-size:0;     }     #thumbs .thumb      {         display:inline-block;         *display:inline;zoom:1;         margin:0 1px;         border:1px solid #333;         padding:4px;         background:black;     }          #thumbs .thumb img{border:1px solid #555; cursor:pointer; width:70px; height:44px; opacity:0.5;filter:alpha(opacity:50);}     #thumbs .thumb img{ opacity:0.6;filter:alpha(opacity:60); } #thumbs .thumb-on img{ opacity:1;filter:alpha(opacity:100);}     #thumbs .thumb-on img{border:1px solid #999; opacity:1;filter:alpha(opacity:100);}      The images :                               For this, the slider didn't work. It's show me only one image, but when i put the images (`<img class="alignnone />`) into the `single-photos.php`, the slider works. What i am doing wrong? **Update / edit :** I use another method, without thumbnails.But, why show me only the same image in slider? I have 5. `header.php`                     `script: easySlider1.7.js` `single-photos.php`

         <?php the_content (); ?>

      `style.css`               #slider     {         margin-left:85px;             position:relative;             text-align:left;             width:533px;             background:#fff;                     margin-bottom:2em;          }          #slider ul, #slider li,         #slider2 ul, #slider2 li{             margin:0;             padding:0;             list-style:none;             }         #slider2{margin-top:1em;}         #slider li, #slider2 li{              width:533px;             height:400px;             overflow:hidden;              }            #prevBtn, #nextBtn,         #slider1next, #slider1prev{              display:block;             width:30px;             height:77px;             position: relative;             left:-40px;             bottom:471px;             z-index:1000;             }            #nextBtn, #slider1next{               left: 596px;             }                                                                #prevBtn a, #nextBtn a,         #slider1next a, #slider1prev a{               display:block;             position:relative;             width:30px;             height:77px;             background:url(../images/btn_prev.gif) no-repeat 0 0;                }            #nextBtn a, #slider1next a{              background:url(../images/btn_next.gif) no-repeat 0 0;                }                 /* numeric controls */                ul#controls{             margin:1em 0;             padding:0;             height:28px;                 }         ul#controls li{             margin:0 10px 0 0;              padding:0;             float:left;             list-style:none;             height:28px;             line-height:28px;             }         ul#controls li a{             float:left;             height:28px;             line-height:28px;             border:1px solid #ccc;             background:#DAF3F8;             color:#555;             padding:0 10px;             text-decoration:none;             }         ul#controls li.current a{             background:#5DC9E1;             color:#fff;             }         ul#controls li a:focus, #prevBtn a:focus, #nextBtn a:focus{outline:none;}


title: Is there a maximum slug length?

text: A client just created a post with a really long slug (90 characters), no special characters (other than hyphens) etc. Whenever the link to that post was clicked, including the "Preview" or "View this Post" links from the Admin back end, a 404 was generated. Once we manually trimmed the slug, everything worked as expected. Is this a "feature" or a "bug"? EDIT: a Note for all those talking about DB limits. > If I were hitting the DB field limit, then the slug itself would be > truncated. Think about it for a second. In the case of most WP > installations, wp_posts.post_name is VARCHAR(200). So, let's say that > someone types in a title with > 200 chars. What happens? The slug gets > truncated to 200 chars and stored in wp_posts.post_name. It's not like > someone is going in and typing the full title of the post in the browser > address bar, substituting the spaces with dashes right? The URL is being > generated by WordPress, and it's getting the URL from the wp_posts.post_name > table and just putting that in the href attribute of the anchor tag. So > there's not going to be a disparity there. The whole DB thing is a red > herring. In any case, the slug in question is only 90 chars, so it has nothing to do with DB limits. Are there any known limitations around rewrite?


title: framework for plugin/theme options panel?

text: I found that the longest part of a plugin or theme development is creating the options panel, at least in my case. So i like to know what's your take on that. Do you use a ready made framework or class? And if so witch one? Or do you write it up from scratch? Use the settings API or plain options? Thanks.


title: Plugin has a cron job, but the function doesn't actually run

text: I've been working on a Wordpress plugin, and it requires a cron job to do some work. I've got the job setup and scheduled and I can see it in the cron using one of the plugins which lets you see the cron file. However the function doesn't appear to actually ever get called. The function that setup the cron is below. My code is within a class, so I'm not sure if I'm doing this correctly as none of the examples that I've found talk about if your code is within a class.               function schedule_archiving() {         if ( ! wp_next_scheduled( 'redirection_reporting_archive_data') ) {             $time=time();             $time=$time+60;             wp_schedule_event($time, 'daily', 'redirection_reporting_archive_data');         }     }      I know that the WordPress function "archive_data" works correctly because if I call it manually from WordPress the data in the database is archived correctly, so the problem has to be my cron config (I think). EDIT1: The code which calls schedule_archiving as requested.               if ($input['archive_enabled'] == 'true') {                 $archive = new redirector_reporting_class_archive();                 $archive->create_db_objects();                 $archive->schedule_archiving();             } else {                 $archive = new redirector_reporting_class_archive();                 $archive->unscheduled_archiving();                 $archive->put_archive_back();                 $input['archive_enabled'] = 'false';             }      This code is within the settings validate function of my settings class. Below is my archive_data function which the cron job would be calling.               function archive_data() {             write_log('redirection-reporting.archive.archive_data starting');                  global $wpdb;             $options = get_option('redirection_reporting');             $days_to_keep = $options['days_to_keep'];             if ($days_to_keep != 0) {                 $days_to_keep = $days_to_keep*-1;             }                  $sql = "CALL `{$wpdb->prefix}ArchiveRedirectionData` ($days_to_keep)";                  $wpdb->query( $sql );         }      EDIT2: I've added the following to the where I've got the rest of the add_action and add_filter calls.               $archive = new redirector_reporting_class_archive();     add_action('redirection_reporting_archive_data', array($this, 'archive_data')); // Adds hook for cron job      I've put the full code for the class at http://pastebin.com/Vd5UhZLD


title: How do I delete all comments from a specific old blog post?

text: I'm cleaning up an old, controversial blog entry and I need to remove all the comments from the post. Surprisingly, I can't find a way to do this within the existing WordPress (3.0.4) UI. I can certainly go through and click "trash" on all 200+ comments, but that seems.. excessive. Is there another way to do this that I am missing?


title: Correctly implementing the Facebook Like button

text: As per documentation I satisfied all the requirements of the like button by using the meta-tags, however I still don't get the image I would like linked by Facebook: it always goes fishing for another image in the sidebar. Now, of course I could solve this by being explicit about which image I really want but I do I get that image from Wordpress? Is there a function like post_image() that would print its URL like there is for the permalink? Thanks


title: How to handle the Plugin Version on Update using Tortoise SVN and the worpdress.org Plugin Repository?

text: Recently I tried to update my plugin to WP server. The update to trunk folder went fine, but when I created a folder with a new version under tags folder and tried to upload it, only the immediate children files of this folder where uploaded successfully and the sub folders weren't. Eventually I figured out that the svn info file "thinks" that this sub folder already exists in the server even though it doesn't, so I used Tortoise delete function and a few times and then added it and click commit. Finally after more than an hour of trial and error, I succeeded. That was really frustrating because I know that people already received an update notification and some of them might have updated and received an error message that crashed their admin! My questions are:   1. Should I switch to working with command line instead of Tortoise? will it be safer?   2. Is there a way to postpone the version update notification until I confirm somehow that I have completed the upload of the new version successfully?


title: Is there a WordPress plugin that registers a plugin file as a custom page template?

text: I need to create a plugin that makes custom page templates available in wp- admin. I'm wondering if someone has tackled this already, as it seems like a pretty typical process?


title: Multisite add existing user to site per site register

text: I've set up a few sites in a multisite network. On every site there are register fields: Username and E-mail. If a user registers on site A he is registered as a global user on the network. So far so good. However if the same user wants to register again on site B, he will recieve the message that his usernamen and email already exists, which is right. What I want is the following: If a user tries to register on site A and B with the same name and email he/she must be added to that site. So in simple terms: if !user already_registered { register user } else { add user to site } Is this possible? Thanks.


title: iframe not being displayed in a widget

text: I'm trying to write my first widget so i'm not that expert with the code. I have the following code in my function.php but the iframe is not being displayed:               class account_internet extends WP_Widget {         public function __construct() {             parent::WP_Widget( 'account_internet', 'Account internet', array('description' => 'Widget description goes here'));         }              public function form( $instance ) {                  $defaults = array(                  'title' => 'Creazione account internet'             );                  $instance = wp_parse_args( (array) $instance, $defaults ); ?>                  <p>                 <label for="<?php echo $this->get_field_id( 'title' ); ?>">                     Title:                 </label>                 <input class="widefat" type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />                  </p>                       <?php         }              public function widget( $args, $instance ) {                  extract( $args );                  $title = apply_filters('widget_title', $instance['title'] );                  echo $before_widget;             echo $before_title . $title . $after_title;             ?>                 <iframe height="300px" width="150px" src="http://www.google.com"></iframe>             <?php             echo $after_widget;         }              public function update( $new_instance, $old_instance ) {             $instance = $old_instance;                  $instance['title'] = strip_tags( $new_instance['title'] );                  return $instance;         }                          }          function account_internet_register_widgets() {         register_widget( 'account_internet' );     }          add_action( 'widgets_init', 'account_internet_register_widgets' );      is there something that i miss?


title: Custom Permalinks Structure with particular word

text: I have some headache trying to customizing my permalinks... So here is what I need : 1) "mysite.com/news/" has to display all the posts. 2) "mysite.com/news/firstcat/" has to display all the posts of the "firstcat" category. 3) "mysite.com/news/firstcat/myposttitle" has to display the single post "myposttitle", which is in the "firstcat" category. So here's what I've done :   * I have a page called "News", with "news" as slug. In the settings, I've set this page to be the blog page. So When I go to "mysite.com/news/", I have the listing of all my posts.   * In the "Permalinks" settings page, I have changed "category prefix" to "news". Now if I go to "mysite.com/news/firstcat/", I have the listing of all the posts that belong to the "firstcat" category.   * In the "Permalinks" settings page, I have changed the settings to "custom permalinks" and type "%category/%postname%". Now the permalink of my single post is "mysite.com/firstcat/myposttitle" but I want it to be "mysite.com/news/firstcat/myposttitle"... with "news" ... How could I do that ? Thanks !


title: Checking for custom field in admin pages

text:
I am loading some scripts conditionally for the admin section with :               if (is_admin()) {         wp_register_style('admin_js', get_bloginfo('template_directory') . '/admin.js');         wp_enqueue_script('admin_js');     }      The script gets elements with:               theID = document.getElementById('bar').value;       The missing element exists on custom meta boxes               <?php function my_meta() {       global $post;       $custom = get_post_custom($post->ID);       $uniqueInput = $custom["uniqueInput "][0];       ?>
Input:
       <input id="bar"  name="bar" value="<?php echo $uniqueInput; ?>"></input>
      <?php } ?>      I am generating the custom meta boxes only in my custom post type :               register_post_type( 'customType' , $args );      I tried to add another condition in the enqueue :               if (is_admin()) {         if(get_post_meta($post->ID, 'uniqueInput', true)):             wp_register_style('admin_js', get_bloginfo('template_directory') . '/admin.js');             wp_enqueue_script('admin_js');         endif;      and this :               if (is_admin()) {         $foo = get_post_meta($post->ID, 'uniqueInput', true);         if ($foo) {            wp_register_style('admin_js', get_bloginfo('template_directory') . '/admin.js');            wp_enqueue_script('admin_js');     }      But this doesnt work for me. The script is suppressed so I no longer get a missing element error... however this condition is never met, the js never loaded. Now I realize it is because I was making the wrong checks, looking to see if that input has a value entered, not for the input field itself which is what I need. What would be the best way to do this check? Would I look for the custom post type?


title: Wordpress Post Deletion Issue

text: I have installed wordpress on one membership site and found that whenever editor writes post on wordpress and attempts to post it, deletes the half of post randomly. I don't know what could be the problem. I have already did my search within community forums here and here. These two threads explain the same problem that i'm having but none of the solutions are working for me. I also tried post revision plugins, sql query (for deletion of revisions), wp- config file modification and everything i could find on google. WP is just on spree of eating half the post no matter what. Is there any solution for this ?


title: How can I detect if the current post is in this loop?

text: My featured articles have been built with the following query:               $featured_posts = new WP_Query(  array(  'post__not_in' =--> get_option( 'sticky_posts' ),      'meta_key' => is_featured',      'meta_value' => 1      ) );      How can I detect if my current (singlepage) article is featured or not? I obviously need to query whether it has `is_featured` flag, but how do I build this query? Many thanks.


title: Is Wordpress vulnerable to "comment posting forgery"?

text: I recently scanned my Wordpress site using 6scan's security scanning service. It reported a high severity vulnerability: "Wordpress comment posting forgery". Technical details from 6scan:   * The 6scan report says "CSRF vulnerability in allows malicious users to make fake posts". It says the affected URL is /wp-comments-post.php.   * When I click the 6scan report's link for more technical details, it directs me to this page, which is a generic page that refers to zero-day vulnerabilities (i.e., vulnerabilities disclosed to the Wordpress team but not publicly known). However, that page hasn't been updated since July 17, 2012 (almost a year ago), and it has no specific mention of this CSRF vulnerability.   * The 6scan report also suggests a way to manually fix the problem: it suggests manually editing wp-comments-post.php to add some code that basically checks to make sure `$_SERVER[ "HTTP_REFERER" ]` matches `$_SERVER[ "HTTP_HOST" ]`. I am running Wordpress 3.5.1 (currently the most recent version). Is Wordpress really vulnerable to a "comment posting forgery" vulnerability? Or is the 6scan report bogus? I know that older versions of Wordpress had some CSRF vulnerabilities, but I believe those have been fixed. Personally, I find the claim of a vulnerability pretty dubious -- but I thought I would check with others.


title: Nested Pagination

text: Is this possible for wordpress? Something like, > [A] [B] [C]...[X] [Y] [ **Z** ] > > ...... > > posts with title starting 'z' > > ....... > > **1** 2 3 4 next>> Can someone point me to the right direction on how to achieve this type of pagination? It's an A-Z pagination which uses the post title as the basis. And for example page `Z` has entries greater than 10, make a pagination too.


title: Login Button CSS

text: I'm trying to find the Login button CSS code. I tryed this topic, but i think the path has changed after wordpress updated: http://wordpress.org/support/topic/how-to-change-the-login-button-color Any can show me where is it? Thank you


title: WordPress Plugin Development from Scratch. How?

text: I would like to learn how to create a plugin from scratch, there are tons of tutorials out there on the internet, but they are either premium or not a reliable resource. would like to know which are the best resources available on the internet.


title: sort child pages on admin

text: I have a hierarchical CPT with the following structure:               - parent item 1        - child item 1        - child item 2        - child item 3        - child item 4        - child item 5     - parent item 2        - child item 1        - child item 2        - child item 3        - child item 4        - child item 5      each child item has a meta key called "section_id" which is numeric and corresponds to it's order within the parent. The date stamps are approx 5 minutes apart from each other. what I want to accomplish is sorting each parent item in descending date order, THEN the child items in either ascending date order or by the meta section_id (either will work, since they will product the same results) running a `pre_get_posts` or `parse_query` allow me to do one or the other, but not both. is it possible to do this? **note** this is only for the admin post table, not the front end.


title: How can I migrate a super old version (2.0) of my blog to 3.1?

text: I can't use any of the import plugins because of the older version -- so it's kind of a pain, plus the URL permalinks arent very optimal. Any ideas on how to do this? I'm afraid I'd have to do this manually! import plugin I mean. the xml import file format changed so I can use it to upload content =/ –


title: Inserting JS snippet in the footer if there is no wp_footer?

text: I wrote a plugin which uses `wp_enqueue_script()` which will include the snippet in either the header or footer depending on the parameters you pass it. The `in_footer` parameter works great - if the theme utilizes the `wp_footer()` hook. What are my options if I want to include the JS snippet directly before the `</body>`tag if a theme is not using `wp_footer()` hook?


title: If I change permalink structures, can I use htaccess to permanantly redirect links?

text: Ive got some super old links that have a lot of SEO juice and I dont want to lose that if I change permalink structure. This is partly due to the older version of WP i have (2.1) I want to use post ids in the structure now, and not the slug name or maybe both myblog.com/post/12121/slug-name If i use htaccess for this will Google and other search engines update their links without penalizing me?


title: Hide categories from frontend, but not admin / post editor

text: I'm using the following code, placed in the functions.php of my theme, to hide certain categories used to organise posts and populate sliders from the posts themselves and their category listings:               function the_category_filter($thelist,$separator=' ') {      // list the IDs of the categories to exclude      $exclude = array(1,32,42,4);      // create an empty array      $exclude2 = array();           // loop through the excluded IDs and get their actual names      foreach($exclude as $c) {           // store the names in the second array           $exclude2[] = get_cat_name($c);      }           // get the list of categories for the current post           $cats = explode($separator,$thelist);      // create another empty array            $newlist = array();           foreach($cats as $cat) {           // remove the tags from each category           $catname = trim(strip_tags($cat));                // check against the excluded categories           if(!in_array($catname,$exclude2))                // if not in that list, add to the new array           $newlist[] = $cat;      }      // return the new, shortened list      return implode($separator,$newlist);     }          // add the filter to 'the_category' tag     add_filter('the_category','the_category_filter', 1, 32, 42, 4);      This works well, but it also hides the categories in the post edit backend. I can see the tick box, but the name of the category is hidden. Can someone suggest a tweak to the above code that preserves its function of hiding categories on the frontend, but keeps categories visible in the post edit window / the WP backend?


title: How to correctly add JQuery in a WP theme?

text: I am pretty new in WordPress and I have the following doubt: I have to include **JQuery** into a theme and I am doing in this way: I create the following function into **functions.php** theme file and I add it as action:               function load_java_scripts() {         // Load FlexSlider JavaScript that handle the SlideShow:         wp_enqueue_script('jQuery-js', 'http://code.jquery.com/jquery.js', array(), '1.0', true);     }     add_action('wp_enqueue_scripts', 'load_java_scripts');      So I think that I can add it as some other javascript or CSS local resources but I am not sure about this method because in this case the **jquery.js** is not a local resource but is an online resource (is the same thing?) And I also have some doubts because searching online I have found some differents method to add JQuery to my theme, like this one: http://css- tricks.com/snippets/wordpress/include-jquery-in-wordpress-theme/ Can you give me some more precise information about how to correctly complete this task? Tnx Andrea


title: How to add class on term link?

text: I am looking for a way to add tag slug as a class. I can't figure out how to achieve this... Here is how I display the products tags   `<?php echo get_the_term_list( $post->id, 'product_tag'); ?>` The output is   `<a href="http://myurl.com" rel="tag">My tag</a>` And I want   `<a href="http://myurl.com" class="Tag_Slug" rel="tag">My tag</a>`


title: Front End Post Submit Form

text: I'm working on a site that is going to be community powered. It's going to have the form for registered users to submit draft posts, which will then be approved or deleted by the site's editors. The way I'm trying to implement it is with a custom page template, which includes a form that will allow people to submit draft posts for review. I was wondering if anyone could point me to some code that does this and that works. I have tried searching, but so far the code I'm finding isn't working. I'm using wordpress 3.1 Thanks :)


title: Remove Page Title from Static Frontpage

text: I'd like to remove the post title from my static frontpage. Just that page. I've created a child theme from a free Press75 theme. So I'd like to make this change in my child theme's function.php. I used this code but it removes the title from all pages, posts and my navigation:               add_filter( 'the_title', 'remove_page_title' );          function remove_page_title() {         if(is_page('138')) {         }         return '';     }      I thought it would just remove the title from the page with ID 138. What am I doing wrong? Thanks!


title: Why did this wp_query stop working in 3.7?

text: The wp_query below stopped working upon an upgrade to 3.7. I rolled the site back to 3.6.2 and it's working fine. Anyone aware which code here might have changed? There's a lot going on, but briefly, it accomplishes a number of things: 1) loops through the 'course-subject' taxonomy to cluster results by taxonomy result, with a new wp_query for each. 2) sorts results within the query by title, and then end_date mate key 3) filters out results where the end date is more than a week ago ($week_ago previously defined)               $list_terms = get_terms( 'course-subject' , array('orderby' => 'slug') );     foreach ( $list_terms as $list_term ) {          $crs_query = new WP_Query( array(         'post_type' => 'sat',         'course-subject' => $list_term->slug,                                                'posts_per_page' => -1,         'meta_key' => 'start_date',         'orderby' => 'title meta_value',         'order' => 'ASC', //sort in ascending order          'meta_query' => array(             array(             'key' => 'end_date',             'meta-value' => $value,              'value' => $week_ago,              'compare' => '>=',              'type' => 'CHAR'             )             )                                    )   );


title: How to hook up search results page to a back-end page?

text: On my site, editors can upload "banner" images to every page on the site. However, I'm having trouble figuring out how to link the search results page to a back-end page (ie the page that appears at example.com/?s=searchterm). Does anyone have any tips on making a page in the back-end "link up" to the search results page so a user could upload a banner to a page in the back-end admin and have it appear on the search results page? I did some googling and found this page on Wordpress' codex: http://codex.wordpress.org/Creating_a_Search_Page however the methods described there don't seem to be working. Any help would be appreciated.


title: How to force attachment size for every post

text: I created a custom size like this :               add_image_size( 'my-size', 615, 9999 );      Is there anyway i can force the ATTACHMENT DISPLAY SETTINGS SIZE to be always ('my-size') for every attachment?


title: Frontend Post Form Validation

text: OK, there have been several posts on here about frontend posting forms. I've read them all, which got me to where I am. Now every form I come across has some form of validation which seems to check for a value for the fields you want to make required. I've tried them, and I can't get anything to work. I just can't make any fields required. Everything else about the form is perfect. But I would love to enforce my required fields (bonus for appropriate error messages). I've tried looking around on the google, I don't really think JS is what I want to use for this. And any other php validation I can't seem to make work either. I'm sure I'm incorporating them wrong somehow. Here's what I have: http://pastebin.com/rw4c6jZQ (full template lines 9-19 are supposed to be validation) MY processing script at the to of the template:                   <?php      if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_post") {               // Do some minor form validation to make sure there is content          if (isset ($_POST['title'])) {              $title =  $_POST['title'];          } else {              echo 'Please enter the wine name';          }          if (isset ($_POST['description'])) {              $description = $_POST['description'];          } else {              echo 'Please enter some notes';          }               $tags = $_POST['post_tags'];          $winerating = $_POST['winerating'];               // ADD THE FORM INPUT TO $new_post ARRAY          $new_post = array(          'post_title'    =>   $title,          'post_content'  =>   $description,          'post_category' =>   array($_POST['cat']),  // Usable for custom taxonomies too          'tags_input'    =>   array($tags),          'post_status'   =>   'publish',           // Choose: publish, preview, future, draft, etc.          'post_type' =>   'post',  //'post',page' or use a custom post type if you want to          'winerating'    =>   $winerating         );               //SAVE THE POST          $pid = wp_insert_post($new_post);                        //KEEPS OUR COMMA SEPARATED TAGS AS INDIVIDUAL          wp_set_post_tags($pid, $_POST['post_tags']);               //REDIRECT TO THE NEW POST ON SAVE          $link = get_permalink( $pid );          wp_redirect( $link );               //ADD OUR CUSTOM FIELDS          add_post_meta($pid, 'rating', $winerating, true);                //INSERT OUR MEDIA ATTACHMENTS          if ($_FILES) {              foreach ($_FILES as $file => $array) {              $newupload = insert_attachment($file,$pid);              // $newupload returns the attachment id of the file that              // was just uploaded. Do whatever you want with that now.              }               } // END THE IF STATEMENT FOR FILES           } // END THE IF STATEMENT THAT STARTED THE WHOLE FORM           //POST THE POST YO      do_action('wp_insert_post', 'wp_insert_post');       The form and everything else can be seen in the pastebin to see it all in context. Thanks much!


title: jQuery does not enqueue for my purpose... (before an inline script in the footer)

text: Following How to add a javascript snippet to the footer that requires jQuery I am trying to load jQuery before my script does stuff but it's not working. This is it working when I include jQuery manually This is it not working when I do it the right way. In that previous question, the answerer says I should put my script material inside an `if( wp_script_is( 'jquery', 'done' ) ) {`, and I tried that too but the part within the `if` never gets executed.


title: Sitemap generation

text: I have have a few pages on my site that walk through a process of querying a custom post type (services) with it's taxonomies (locations) -- example of custom post type (services) and example of taxonomy terms (locations). I'm currently using the Google XML Sitemaps plugin. I created a sitemap and I was anticipating to see several thousands of links based on the queryable links found in my examples. However, I essentially had one link for each of my taxonomy terms and one link for each of my custom post types. Since the structure of my custom post type URLs will be standardized as `http://domain.com/%service%/%location%`, is there a way that i can generate a sitemap that will list all the variations? For example, if I had 2 services and 3 taxonomy terms my generated sitemap would be something like:               http://domain.com/service-1/location-1     http://domain.com/service-1/location-2     http://domain.com/service-1/location-3     http://domain.com/service-2/location-1     http://domain.com/service-2/location-2     http://domain.com/service-2/location-3      AFAIK, nothing will do this out of the box, hence me trying to do this on my own. Maybe I'm wrong. Or maybe unnecessary. The end result is for Google to index all variations of the services and locations, as `http://domain.com/service-1/location-1` serves unique content that differs from `http://domain.com/service-1/location-2` Any advise or information would be greatly appreciated. ** I realize that my examples will show links that have extra terminology in the URL, I'm in the process to remove those and the end result will ultimately be the format of `http://domain.com/%service%/%location%` **


title: get_adjacent_post alternative on a very large db

text: I'm using `get_next_post` and `get_previous_post` (from the same category) to show the thumbnail and link to the respectives posts in my single template, but it's in a very large db that is giving my server a hard time. There are 49, 984 posts in the site, between published posts, drafts and attachments:               mysql> select post_status, count(1) from wp_posts group by post_status;     +-------------+----------+     | post_status | count(1) |     +-------------+----------+     | auto-draft  |        1 |     | draft       |      269 |     | inherit     |    38656 |     | private     |        5 |     | publish     |    11053 |     +-------------+----------+     5 rows in set (0,07 sec)      I can understand why `get_previous_post` takes so much resources to run, after all, it has to compare all matching posts by date to determine the next or previous: From `$wdbp->queries`, just to fetch the previous post: Query:               SELECT p.id     FROM wp_posts AS p        INNER JOIN wp_term_relationships AS tr ON p.ID = tr.object_id        INNER JOIN wp_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id          AND tt.taxonomy = 'category' AND tt.term_id IN (5,7,14474)      WHERE       p.post_date < '2013-04-11 12:15:30' AND p.post_type = 'post' AND       p.post_status = 'publish' AND tt.taxonomy = 'category'          ORDER BY p.post_date DESC LIMIT 1      From:                 require('wp-blog-header.php'),       require_once('wp-includes/template-loader.php'),       include('/themes/extra/single.php'),       get_previous_post, get_adjacent_post      Taking:               111.7ms      I know doing that it's not usually a hard job, but in my case it is. Is there any other way to get the previous and next post? **Edit:** As s_ha_dum points out, including the condition `$in_same_cat` it's the source of the problem, by doing two very heavy joins with `wp_term_relationships` and `wp_term_taxonomy`. The solution would be to not search for posts in the same category, unfortunately I do need to use that condition. ## Solution edit: Here is a gist with toscho's solution plus a minor fix and two new functions: `get_fast_previous_post` and `get_fast_next_post` to get the post objects.


title: How to override the user dashboard

text: I wanted to know if it is possible to completely override wordpress user dashboard.   1. I want to delete the upper bar when logging in ("the grey bar at the top"), and only take user to the original dashboard when they press "create post"(I'll create a button for that").   2. Another functionality that I want to achieve is to "pull" notifications from original dashboard (i.e. when someone comments to a user's post), I want the user to see it, but displaying it in a "facebook like" notification icons. I'm not expecting anyone to tell me exactly how do it, just direct me to the files of WordPress that are responsible for these features or maybe show me some guides.


title: Get search results on a specific page

text: I need to display the search results obtained using default search widget on some page other than the front page. I tried the option mentioned here. But could not get the results. I also tried to get the results by changing the `action` url of default search form from `esc_url(home_url('/'))` to `esc_url(home_url('/').$pagename.'/')`; But after getting redirected to `$pagename`, I get no search results. Can anyone tell me what else is missing?


title: Active Directory and group permissions

text: I'm trying to modify WordPress to have the following features:   1. Users are created in Active Directory and assigned to groups. Users can login to WordPress via Active Directory.   2. Pages can be locked down to only be visible to members of certain Active Directory groups.   3. A "Downloads" page can be seen by members of any of several groups but each group can only see downloads that they have been given permission to see (I'm flexible to how this could be represented in WordPress). Can anyone suggest a plugin that could help? Or a list of plugins and how they could be integrated to do the above? I've been playing with the following so far but was hoping there would be a simpler approach:   1. wordpress.org/plugins/active-directory-integration/ for logging in.   2. wordpress.org/plugins/user-access-manager for locking down pages to groups. I could modify this to automatically add users to groups that match their Active Directory groups when they login.   3. wordpress.org/plugins/wp-better-attachments/ for attaching downloads to a page. I could modify this to hide downloads from users based on their group but how would I associate groups to media files?


title: how to extend a WP_widget twice

text: Has someone ever tried to extend calss WP_Widget, then extend it again ? Having to related widgets, I tried to create the first extending WP_Widget, :               class FirstWidget  extends WP_Widget {       public function __construct(){         parent::__construct(      etc and then extending the First to create the second one :               class SecondWidget  extends FirstWidget  {       public function __construct(){         parent::__construct(      this works well, except that the second widget isn't available in the drag and drop widgets area. I can explicitly use it in my code :               the_widget('SecondWidget', array('title'=> "New title")      and it shows well, but I can't drag'n'drop it. Someone knows why ?