Apache extensions for WordPress' working without troubles

I have a new web server at the Hetzner EX60. With this new site I have many problems. First of all I need to say that **I have problems with default theme and without any plugins.** I tried to resolve them abuot a month. All of these problems are related to admin area. Fail to load jQuery and the same things. I already added               define('CONCATENATE_SCRIPTS', false);      to config.php file. And now I have problems only with post-new.php and post.php?post=##&action=edit pages. And only when I try to edit or add new post. With adding/editing pages I haven't any problems. What's the problem on those pages? I have missing visual editor. The page isn't loaded to the bottom. 'Upload meadia' button not works. All that is related to js and in particular with jQuery. I resolved a part of this problem with installing W3-Total-Cache. Also I added these lines to config.php               define('AUTOSAVE_INTERVAL', 300 );     define('WP_POST_REVISIONS', false );      Now sometimes I have visual editor and full loaded page and sometimes not. If have problems I purge cache and refresh the page. From 5 page loads I have a case when all is great. It is very uncomfortably and awkward. Because W3-Total-Cache helped me partially to resolve my problem, I make conclusion that I have bad server config and something with cache. But my friends that are also located with me at this server and using other CMS have no problems. **About server:** At the server front-end is nginx and at the backend is Apache. How to make best configuration for it? Currently is installed:               bz2.so     calendar.so     cgi-fcgi.so     соre.so     ctype.so     curl.so     date.so     dcm.so     ereg.so     exif.so     fileinfc.so     filter.so     ftp.so     gd.so     gecip.so     gettext.so     gmp.so     hash.so     iconv.so     imagick.so     json.so     libxml.so     mbstring.so     mcrypt.so     memcached.so     mhash.so     mysql.so     mysqli.so     cpenssl.so     pcntl.so     pcre.so     pdo.so     pdo_mysql.so     pdo_sqlite.so     phar.so     readline.so     reflection.so     session.so     shmcp.so     filter.so     ftp.so     gd.so     gecip.so     gettext.so     gmp.so     hash.so     iconv.so     imagick.so     json.so     libxml.so     mbstring.so     mcrypt.so     memcached.so     mhash.so     mysql.so     mysqli.so     cpenssl.so     pcntl.so     pcre.so     pdo.so     pdo_mysql.so     pdo_sqlite.so     phar.so     readline.so     reflection.so     session.so     shmcp.so     simplexml.so     sockets.so     spl.so     sqlite3.so     standard.so     tokenizer.so     wddx.so     xcache.so     xml.so     xmlreader.so      xmlrpc.so     xmlwriter.so      xsl.so      zip.so      zlib.so


Why does not my metabox save?

I know there are many questions about variants of this, but I have not been able to find an answer. I have a metabox on the post type `page`, containing nothing but a checkbox. It seems like it won't save no matter what I do. Here is all the code for the metabox.               /*--------------------------------------------------------------------------*      * Register metabox     /*--------------------------------------------------------------------------*/     function kasparabi_page_left_menu() {         add_meta_box( 'kasparabi-left-menu-meta', __( 'Left Menu', 'kasparabi' ), 'kasparabi_render_left_menu_meta_box', 'page', 'side' );     }     add_action( 'add_meta_boxes', 'kasparabi_page_left_menu' );          /*--------------------------------------------------------------------------*      * Callbacks     /*--------------------------------------------------------------------------*/     function kasparabi_render_left_menu_meta_box($post) {         wp_nonce_field( basename( __FILE__ ), 'kasparabi-left-menu-meta_nonce' );              ?>             <p>                 <div>                     <label for="left-menu-checkbox">                         <input type="checkbox" name="left-menu-checkbox" <?php (get_post_meta( $post->ID, 'left_menu_checkbox', true) == 'on') ? ' checked="checked"' : ''; ?> />                         <?php _e( 'Display left menu', 'kasparabi' )?>                     </label>                 </div>             </p>         <?php     }          /*--------------------------------------------------------------------------*      * Save functions     /*--------------------------------------------------------------------------*/     function kasparibi_left_menu_meta_save( $post_id, $post ) {              // Checks save status         $is_autosave = wp_is_post_autosave( $post_id );         $is_revision = wp_is_post_revision( $post_id );         $is_valid_nonce = ( isset( $_POST[ 'kasparabi-left-menu-meta_nonce' ] ) && wp_verify_nonce( $_POST[ 'kasparabi-left-menu-meta_nonce' ], basename( __FILE__ ) ) ) ? 'true' : 'false';              // Exits script depending on save status         if ( $is_autosave || $is_revision || !$is_valid_nonce ) {             return $post_id;         }              /* Get the post type object. */         $post_type = get_post_type_object( $post->post_type );              /* Check if the current user has permission to edit the post. */         if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )             return $post_id;              /* Get the posted data and sanitize it for use as an HTML class. */         $new_meta_value = ( isset( $_POST['left-menu-checkbox'] ) ? sanitize_html_class( $_POST['left-menu-checkbox'] ) : '' );              $meta_key = 'left_menu_checkbox';         $meta_value = get_post_meta( $post->ID, $meta_key, true);              /* If a new meta value was added and there was no previous value, add it. */         if ( $new_meta_value && '' == $meta_value )             add_post_meta( $post_id, $meta_key, $new_meta_value, true);              /* If the new meta value does not match the old value, update it. */         elseif ( $new_meta_value && $new_meta_value != $meta_value )             update_post_meta( $post_id, $meta_key, $new_meta_value );              /* If there is no new meta value but an old value exists, delete it. */         elseif ( '' == $new_meta_value && $meta_value )             delete_post_meta( $post_id, $meta_key, $meta_value );     }     add_action( 'save_post', 'kasparibi_left_menu_meta_save' );


How to Set Featured image In Wordpress without Showing it into Post?

I just want to set featured image of my post but don't want to show it in my post. How can I do that? Detailed : I want to post to show its thumbnail in main page but not to show it when we expend the post ie: Not to show that featured image in post when somebody open that post by clicking Read-More Plugin will be great.


How to have post count after each listed category

How can I have a post count after each listed category with the following function? Also, how can I apply this with wp_get_archives and also with the same option as the below function?
     <?php     $args = array(       'orderby' => 'name',       'order' => 'ASC',       'number' => 10, // how many categories            );     $categories = get_categories($args);       foreach($categories as $category) {          echo '
term_id ) . '" title="' . sprintf( __( "View all posts in: %s" ), $category->name ) . '" ' . '>' . $category->name.' ›
';         }           ?>
      Examples: |(get_categories) Category item 1 > ()   Category item 2 > () (wp_get_archives) Archive item 1 > ()   Archive item 2 > ()


How to make a listing of my custom_post_type that the user can dynamically sort from the front-end?

I have a custom_post_type that I want my users to see a list of, which they can dynamically sort by certain attributes. The list would be in a html table format with pagination. Ideally with a "jquery" like dynamic activity, but a "low-tech" version would be nice, too. Could you please point me in the right direction? Maybe there is a plugin that supports custom_post_types?


Not able to override plugin's default css rules

I'm not able to override the "Total Control HTML5 Audio Player Basic" plugin default css file. I've copied the plugin css default content inside `style.css` file in my child theme, and then I've tried to change some stuff, but the new css rule are not displayed. I've checked with Firebug that the custom css file is loaded after the default file, so I don't understand why the new rules are not applied. I've also tried with this suggestion: Override CSS settings of plugins               add_filter( 'style_loader_src', 'wpse106104_replace_stylesheet' );     function wpse106104_replace_stylesheet( $stylesheet_src, $handle ){              if( 'plugin-script-handle' == $handle ){              $stylesheet_src = get_template_directory_uri() . '/css/themes-copy-of-plugin.css';         }         return stylesheet_src;     }      but this only throws these errors:               Warning: Missing argument 2 for wpse106104_replace_stylesheet() in /home/me/MyServer/myproject/wp-content/themes/twentyfourteen-child/functions.php on line 451          Notice: Undefined variable: handle in /home/me/MyServer/myproject/wp-content/themes/twentyfourteen-child/functions.php on line 453          Notice: Use of undefined constant stylesheet_src - assumed 'stylesheet_src' in /home/me/MyServer/myproject/wp-content/themes/twentyfourteen-child/functions.php on line 456          Warning: Missing argument 2 for wpse106104_replace_stylesheet() in /home/me/MyServer/myproject/wp-content/themes/twentyfourteen-child/functions.php on line 451      Any suggestion?


How to get certain part from widget

I want to use only some part of the widget. I have multisite network so to link the posts and pages I am using a plugin called Multilingual Press which also comes with widget to switch sites. Now I have registered a widget area on my header and I want only the part: ENGLISH FINNISH form the widget, but it is coming with all the divs and title and everything how can I get the only link part from the widget and place is on my desired location.


How to use media upload on metabox post page without breaking TinyMCE?

I'm using the following code for upload in multiple mextaboxes in a post or page admin section. Works for metaboxes but breaks the TinyMCE insert image. I want to know please how I can achieve this without breaking the TinyMCE. Off course the issue comes when I overwrite the windows.send_to_editor function.               jQuery(document).ready(function() {         jQuery('.st_upload_button').click(function() {              targetfield = jQuery(this).prev('.upload-url');              tb_show('', 'media-upload.php?type=image&TB_iframe=true');              return false;         });         window.send_to_editor = function(html) {             imgurl = jQuery('img',html).attr('src');             jQuery(targetfield).val(imgurl);             tb_remove();        }     });      A possible solution would be hiding "Insert into post" button which by the way is not to semantic in the metaboxes and put a new button like "Select image" and writing a function with take the img o attach url a assign to the input. How can I do that o something else you recommend? Thanks in advance.


List of users that clicked a 'Join' button at single post

The title might be a bit vague while I'm not quite sure how to describe it. **What I want:** At every single post (in this case of post type 'event') a logged in user must be able to click a 'Join' button (and when clicked a 'Unjoin' button). The admin must be able to see which users have joined an event and which event. It doesn't matter if this must be a custom field at the User profile info or a new list in the admin. **What I already have:** I have made a custom checkbox list of posts at the User profile info. And I do know how to make a button in at a single post. But it must be connected to this list, so when it's clicked the specific post must be checked at the Users profile page. I'm not sure what the easiest method is to make this, any idea? It's actually a quite simple function. Thanks in advance.


How do I flush the rules after saving settings using the Settings API?

I'm using the Settings API to allow the user to toggle the `has_archive` option on some custom post types. When the user turns archives on or off, I want to flush the rewrite rules. If I had written the saving function myself, I could just call `flush_rewrite_rules()` and be done with it, but the Settings API takes care of the saving for me. Is there a hook somewhere that I can use? ## Chosen Solution @Stephen Harris               add_action('admin_init', 'my_plugin_register_settings');     function my_plugin_register_settings() {         if (delete_transient('my_plugin_flush_rules')) flush_rewrite_rules();         register_setting('my_plugin', 'my_plugin_settings', 'my_plugin_sanitize');         // add_settings_section(), add_settings_field(),...     }          function my_plugin_sanitize($input) {         set_transient('my_plugin_flush_rules');         return $input;     }


localizing variable on front-page.php template fails but succeeds on single page and taxonomy archive

I have the following code in a php include file:               function pass_the_var() {         $video_embed_code = jkaw_oembed_code();         return array(             'embedCode' => $video_embed_code             );     }      earlier in the same file I also enqueue my scripts:               wp_register_script('jkaw-js', get_template_directory_uri() . '/lib/js/jkaw.js', false, '1.0', true);     wp_enqueue_script( 'jkaw-js' );     wp_localize_script( 'jkaw-js', 'phpVars', pass_the_var() );      I am using this code on a custom post type 'portfolio'. `wp_localize_script` successfully returns the array and populates the $video_embed_code variable on `single-portfolio.php` and on `taxonomy-portfolio-cat.php`. However on `front-page.php` template (I am using a static front page with it's own wp_query to list all the 'portfolio' posts), the $video_embed_code is returned as an empty string. `single-portfolio.php`, `taxonomy-portfolio-cat.php` and `front-page.php` all call `get_template_part( 'content', 'portfolio' );` which contains an if.. else.. statement.                   if ( !is_single() ) { ?>                  <a class="wrapper" style="width:100%; padding-bottom: <?php echo $thumb['padding']; ?>%" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
                     <img class="ll" data-original="<?php echo $thumb['src']; ?>" />
                           <?php } else {              // code for a single post          } ?>      If I call `pass_the_var()` inside the `if(!is_single)` statement it returns the correct code but for some reason when it's called via the `wp_localize_script` on `front-page.php` it fails. I guess this has something to do with the loop and the order that things are fired but I cannot work out why it is failing and how to solve the problem. Any suggestions would be gratefully received, thanks.


Hide one admin from another admin

How can I hide one admin from another in the users list? I want to give admin permission to another person without giving him the ability to see/edit my details.


Proper syntax for simple conditional bloginfo language

I need to do something like this:               <?php $bloginfo = get_bloginfo( 'language' );       if($bloginfo->en-US){          the_time('jS F Y');       }else{ the_time('d/m/Y');       };      ?>      I cant find the proper way to wrap en-US. Any ideas? Thank you in advance, people.


including post-specific feed without full wp_head()

I'm not including the wp_head() call in my header.php, but I would like to include the feed links for each post. Is it possible to call wp_head() with arguments only to include specific functionality? Or alternately, can you call specific functionality (admin toolbar css, feed links, etc) directly?


Custom post type Featured Image popup not working

I added a custom post type with thumbnail support. When I navigate to the custom post type in the admin backend and add a new one, I can add a featured image. The problem is, when I click the link to select a featured image, the media library doesn't show in the same window as a popup but is just navigates to the link. (The media library is displayed over the entire screen as a page and not as a popup) I used the following code to add my custom post type:               // Register Custom Post Type     function sponsors_custom_post_type() {          $labels = array(         'name'                => _x( 'Sponsors', 'Post Type General Name', 'bluespeer' ),         'singular_name'       => _x( 'Sponsor', 'Post Type Singular Name', 'bluespeer' ),         'menu_name'           => __( 'Sponsors', 'mycpt' ),         'parent_item_colon'   => __( 'Parent Item:', 'mycpt' ),         'all_items'           => __( 'Alle Sponsors', 'mycpt' ),         'view_item'           => __( 'Bekijk Sponsor', 'mycpt' ),         'add_new_item'        => __( 'Voeg nieuwe Sponsor toe', 'mycpt' ),         'add_new'             => __( 'Voeg toe', 'mycpt' ),         'edit_item'           => __( 'Bewerk Sponsor', 'mycpt' ),         'update_item'         => __( 'Update Sponsor', 'mycpt' ),         'search_items'        => __( 'Zoek Sponsor', 'mycpt' ),         'not_found'           => __( 'Geen Sponsor gevonden', 'mycpt' ),         'not_found_in_trash'  => __( 'Geen Sponsor gevonden in prullemand', 'mycpt' ),     );     $args = array(         'label'               => __( 'post_type_sponsors', 'mycpt' ),         'description'         => __( 'Sponsors', 'mycpt' ),         'labels'              => $labels,         'supports'            => array( 'title', 'thumbnail', ),         'hierarchical'        => false,         'public'              => true,         'show_ui'             => true,         'show_in_menu'        => true,         'show_in_nav_menus'   => true,         'show_in_admin_bar'   => true,         'menu_position'       => 5,         'can_export'          => true,         'has_archive'         => true,         'exclude_from_search' => false,         'publicly_queryable'  => true,         'capability_type'     => 'page',     );     register_post_type( 'post_type_sponsors', $args );          }          // Hook into the 'init' action     add_action( 'init', 'sponsors_custom_post_type', 0 );      EDIT: The following error was in the developer console: `Uncaught TypeError: Object [object Object] has no method 'dialog'` This is causing the problem but I have not found a solution yet...


Installing wp3.2.1 on IIS; getting empty sessions

i have to install wordpress 3.2.1 on IIS 5.0 (yeah, i know...) here. Brand new default wordpress installation, no plugins ore previous versions installed. So, i downloaded the 3.2.1.zip and the 3.2.1-IIS.zip, unzipped everything and set up the database, but i get the same issue every time: everything works, except when i try to login to the admin area it keeps redirecting me back to `wp- login.php?redirect_to=http%3A%2F%2Fmydomain.com%2Fwp-admin%2F&reauth=1` without any error message. config:   1. all requests to http://www.mydomain.com are rewritten to http://mydomain.com   2. tbl wp_options has `siteurl` and `home` set to `http://mydomain.com`   3. i can see 2 cookies: `wordpress_test_cookie=WP+Cookie+check` and `PHPSESSID=617cdf1966c78a56e2dd901942d41124` in my browser   4. there is an empty file `sess_617cdf1966c78a56e2dd901942d41124` in my session folder It looks like a session problem to me. I have a cookie set in my browser, and there is a corresponding session file in my webservers session folder, but it's always empty (0 Bytes). when i create a simple test script in the same folder as my wp-installation and manually add               session_start();     $_SESSION['foo'] = 'bar';      then i can also see those values in my session files. For the last 2 days i tried to figure out whats wrong here. The installed php files and my database are both ok, it works as it should when i moved the installation to a diffent xampp webserver on a different box. Crosschecked my php.ini and the session handling is the same as on xampp. I pretty much tried out any suggestion i found on wordpress.org and other forums for this topic; but nothings seem to work.


Protecting Wordpress login page

How can i do this: Whenever visitors open the login page (wp-login.php), they will be redirected to the mainpage. Only the admin (me) can view the page to login. I am doing this to protect my wp sites. Is there any better way to protect WP login page?


Cleanest Way to Select Every Second Element in a Loop?

What's the quickest and easiest way to select every second element in the loop? At the moment I'm using this strange method:
     <?php $k = 1; ?>       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>         <li class="<?php if($k%2 == 0) echo 'last'; ?>"><?php the_content(); ?>
     <?php $k++; ?>     <?php endwhile; ?>     <?php endif; ?>
      Can't use nth-child since IE doesn't support it and CSS3 PIE isn't playing nice with my site at the moment.


Can't Post to my Wordpress Anymore!

I'm at my rope's end with this whole thing and have tried everything I can to solve it. I have a WordPress site with a SQL database on Azure, but recently all of the users associated with the site lost the ability to post and can only "submit for review" despite maintaining admin status. Attempting to update or reinstall Wordpress versions puts me in a loop of "Database Update Required" and "Update Completed." Looking into the SQL database as outlined in this page: http://www.clickonf5.org/2247/solution-database-upgrade-required/ only lead to the discovery that the main account for the database was also in a read-only mode. We couldn't fix this as we can't even access the website's dashboard on Azure management! Another attempted solution involved following the manual instructions here: http://www.johnpapa.net/azurecleardbmysql/ only to get an access denied message when trying to back-up the database. Exporting through MySQL also failed due to 12 errors. We checked our site size and it's below the limit imposed by ClearDB. Needless to say, any help here would be greatly greatly appreciated. Thanks in advance


Get current category id from post page wordpress

I have a problem to get category id of current post. We are using `<?php get_the_category( $id ) ?>` for finding out category of current post. If a post like 'demo' has 2 category like cat1 and cat2. When i open a cat1 page and then go to demo page, i want different layout.. and when i open a cat2 page and then go to demo page, i want to open this demo page with other layout. It can be only done when i will identify.. from which post has called.. but how??


How to print partial URL after #?

In WordPress, is it possible to retrieve the part of the URL after a `#`? I'm trying `echo the_slug();` but it's showing front slug. But I want after #tag For example: I'm searching and land on this page. And print last anchor text. http://www.mywebsite.com/test/#test1 >> Output: test1 http://www.mywebsite.com/test/#test-test2 >> Output: test-test2


recent posts grid using isotope

I'm trying to match this mockup for recent posts on a home page. ![grid posts mockup](http://i.stack.imgur.com/K6Pw8.png) I've gotten close but the grid items aren't positioning correctly and the bottom one is partially hidden: http://endgenocide.org/ueg2014/ It needs to be filterable so I'm using isotope. Any guidance is appreciated! Here is the jQuery code:               jQuery(function ($) {          var $container = $('#isotope-list'); //The ID for the list with all the blog posts     $container.isotope({ //Isotope options, 'item' matches the class in the PHP         itemSelector : '.item',            layoutMode : 'masonry',           columnWidth: '.grid-sizer'     });          //Add the class selected to the item that is clicked, and remove from the others     var $optionSets = $('#filters'),     $optionLinks = $optionSets.find('a');          $optionLinks.click(function(){     var $this = $(this);     // don't proceed if already selected     if ( $this.hasClass('selected') ) {       return false;     }     var $optionSet = $this.parents('.option-set');     $optionSets.find('.selected').removeClass('selected');     $this.addClass('selected');          //When an item is clicked, sort the items.      var selector = $(this).attr('data-filter');     $container.isotope({ filter: selector });          return false;     });          });      Here is the code in page-frontpage.php
     <div id="content" class="site-content <?php echo $col; ?>" role="main">          <?php if ( have_posts() ) { ?>

         Recent stories

All
         <?php          $terms = get_terms("category"); // get all categories, but you can use any taxonomy         $count = count($terms); //How many are they?         if ( $count > 0 ){  //If there are more than 0 terms             foreach ( $terms as $term ) {  //for each term:                 echo "
slug."'>" . $term->name . "
\n";                 //create a list item with the current term slug for sorting, and name for label                 }             }          ?>

         <?php /* The loop */ ?>         <?php while ( have_posts() ) { the_post(); ?>         <?php get_template_part( 'post-templates/content', get_post_format() ); ?>         <?php } ?>              <?php echo zee_pagination(); ?>              <?php } else { ?>         <?php get_template_part( 'post-templates/content', 'none' ); ?>         <?php } ?>

          <?php the_post(); ?>     <?php the_content(); ?>      And here is the code in content.php               <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>               <?php $the_query = new WP_Query( 'posts_per_page=50' );      //Check the WP_Query docs to see how you can limit which posts to display ?>     <?php if ( $the_query->have_posts() ) : ?>
     <?php while ( $the_query->have_posts() ) : $the_query->the_post();      $termsArray = get_the_terms( $post->ID, "category" );       //Get the terms for this particular item     $termsString = ""; //initialize the string that will contain the terms         foreach ( $termsArray as $term ) { // for each term              $termsString .= $term->slug.' '; //create a string that has all the slugs          }     ?>      <div <?php post_class( $termString . 'item' ); ?>>
         <?php if ( has_post_thumbnail() ) {                        the_post_thumbnail();                 } ?>

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

<?php echo __('posted', ZEETEXTDOMAIN ); ?> <time datetime="<?php the_time( 'c' ); ?>"><?php the_time('F j, Y'); ?></time> <?php echo __('by', ZEETEXTDOMAIN ); ?> <?php the_author_posts_link() ?>

<?php the_category(', ') ?>
         <?php the_content( __( 'Continue reading →', ZEETEXTDOMAIN ) ); ?>

           <?php endwhile;  ?>
      <?php endif; ?>                             <?php zee_link_pages(); ?>
      Here is relevant CSS               .isotope-item {      z-index: 2;     }          .isotope-hidden.isotope-item {     pointer-events: none;     z-index: 1;     }          #iso-container{     padding:0 0 10px;     clear:both;     overflow:hidden;     }     #iso-item{     position:relative;     }          .item{     float:left;     overflow:hidden;     margin: 20px;     }          .format-standard{      width:300px;     }          .format-image{      width:300px;     }          .format-gallery{      width:600px;     }          .relative {position:relative;}          .recent {     background: #1a1a1a;     overflow:hidden;     padding: 0 60px;}


Set user role based on invitation code

I'm working on a site where I'd like anyone to be able to sign up, but people who sign up with an invite code would automatically be promoted to a role with more privileges. I'm aware that there are plugins that handle invite codes, but so far I haven't found any that will do quite this. For my purposes, one invite code used by many people would work best. I'd be sending out the invite code to a mailing list, and I'm not _that_ concerned about limiting access.


Display a list of posts whose meta field values are equal to the ID of the post being viewed?

SOLUTION PASTEBIN LINKS::   * http://pastebin.com/YmXVC1kn \- Author Single Post   * http://pastebin.com/g0xgvxgh \- Book Archive Template Please refer to these files here - solved by storing the post ID in a variable and reworking how I was nesting my loops. * * * I would like to display a single post (from a custom post type "authors") - then immediately underneath this post's content I want to display a list of other posts that I have _assigned_ to this specific post (from a custom post type "books"). For the "books" custom post type I am currently using a custom meta box containing a dropdown (select field) - this field pulls in a list of published posts("authors") and saves the "author" post's ID to the meta field. What I want to do on the single template is only show posts whose meta field value is equal to the ID of the post currently being display. Basically only show the list of "books" for this single "author" ... is this doable? * * * I would need to do the reverse as well ... so when viewing an archive of "book" posts I would like to show the "author" post associated with it underneath... so one loop to pull in the "book" content and nested inside is another loop to pull in the "author" post title, etc... I am assuming by comparing the content of a meta field against the post ID? How do I store the ID of the "author" post to compare across loops? How do I store the meta field value to compare against the ID - again across loops or nested loops? Or If I am totally going the wrong way with this please enlighten me ;) If anyone can point me in the right direction it would be most greatly appreciated!


wp_query for the first sticky, then display the rest of the posts excluding the first sticky

I've been reading this by @nacin and getting to grips with wp_query over query_posts that I used to use. What I want is:   1. to put this in a template file   2. to query all posts of this category, in this case '3'   3. to display, if available, the first result on the page the latest sticky post   4. after the first sticky, if one is set, display the rest of the posts excluding that sticky if it was set Problems I have seen are: \- if I do posts_per_page = 1 on the sticky loop, I can not do posts_per_page = -1 on the rest of the posts loop. To workaround this I've just set the number to 999. I should say now that the code I have **works**. However this is for a very high traffic site, and I want to make sure this is the best way of doing it, and I'm not sure I'm using wp_query right to do this since the original query's are essentially the same as one another just with and without sticky posts.               global $wp_query;     $wp_query = new WP_Query(array(         'post_type' => 'post',         'posts_per_page' => 1,         'category__in' => 3,         'post__in'  => get_option( 'sticky_posts' )     ));     while ($wp_query->have_posts()) : $wp_query->the_post();         $exclude_featured = $post->ID;         echo the_title();         echo '
';     endwhile;           echo '
';     echo '
';          global $wp_query;     $args = array_merge(         $wp_query->query_vars,         array(             'post__in' => null,             'posts_per_page' => 999,             'ignore_sticky_posts' => 1,             'post__not_in' => array($exclude_featured)         )     );     query_posts( $args );     while ($wp_query->have_posts()) : $wp_query->the_post();          if ( $exclude_featured == get_the_ID() )             continue;             echo the_title();             echo '
';     endwhile;       Thanks for any help guys.


Get rid of Wordpress category, tag and author archives?

I have searched the net with no success on what should be an easy thing. I have a highly customized blog with pages, sub pages and posts. While I rely heavily on the use of categories and tags I don't want them to be viewable in a url. The same goes for authors and date categories. Basically I wan't to throw a 404 error if someone tries to access these pages. Can someone point me in the right direction? Thanks! The following should not be accessible: example.net/category/books/ example.net/tag/ebooks/ example.net/author/dickens/ example.net/2012/10/


[Plugin: Posts 2 Posts] How does it work?

I recently discovered Scribu's Posts 2 Posts plugin, which seems to be exactly what I was looking for in order to connect pages and posts for a big editorial website. But I cannot get it to work, which is frustrating because the principle seems really easy. I followed the wiki basic usage example, in my functions.php I have :               function my_connection_types() {     if ( !function_exists( 'p2p_register_connection_type' ) )         return;          p2p_register_connection_type( array(          'from' => 'post',         'to' => 'page'     ) );     }     add_action( 'init', 'my_connection_types', 100 );      And in page.php :               $connected = new WP_Query( array(         'post_type' => 'post',         'connected_from' => get_queried_object_id()     ) );     echo '
Related posts:
';     echo '
';     while( $connected->have_posts() ) : $connected->the_post();         echo '
';         the_title();         echo '
';     endwhile;     echo '
';     wp_reset_postdata();      I have a post called "Tacos", which I connected to the page called "About". When I go to the "About" page, I see "Related posts:", but nothing else after that (ie. where is my Taco ?) a `print_r( $connected )` gives the following :               WP_Query Object ( [query_vars] => Array ( [post_type] => post [connected_from] => 2 [error] => [m] => 0 [p] => 0 [post_parent] => [subpost] => [subpost_id] => [attachment] => [attachment_id] => 0 [name] => [static] => [pagename] => [page_id] => 0 [second] => [minute] => [hour] => [day] => 0 [monthnum] => 0 [year] => 0 [w] => 0 [category_name] => [tag] => [cat] => [tag_id] => [author_name] => [feed] => [tb] => [paged] => 0 [comments_popup] => [meta_key] => [meta_value] => [preview] => [s] => [sentence] => [fields] => [category__in] => Array ( ) [category__not_in] => Array ( ) [category__and] => Array ( ) [post__in] => Array ( ) [post__not_in] => Array ( ) [tag__in] => Array ( ) [tag__not_in] => Array ( ) [tag__and] => Array ( ) [tag_slug__in] => Array ( ) [tag_slug__and] => Array ( ) [meta_query] => Array ( ) [ignore_sticky_posts] => [suppress_filters] => [cache_results] => 1 [update_post_term_cache] => 1 [update_post_meta_cache] => 1 [posts_per_page] => 10 [nopaging] => [comments_per_page] => 50 [no_found_rows] => [order] => DESC [orderby] => il_posts.post_date DESC ) [tax_query] => WP_Tax_Query Object ( [queries] => Array ( ) [relation] => AND ) [post_count] => 0 [current_post] => -1 [in_the_loop] => [comment_count] => 0 [current_comment] => -1 [found_posts] => 0 [max_num_pages] => 0 [max_num_comment_pages] => 0 [is_single] => [is_preview] => [is_page] => [is_archive] => [is_date] => [is_year] => [is_month] => [is_day] => [is_time] => [is_author] => [is_category] => [is_tag] => [is_tax] => [is_search] => [is_feed] => [is_comment_feed] => [is_trackback] => [is_home] => 1 [is_404] => [is_comments_popup] => [is_paged] => [is_admin] => [is_attachment] => [is_singular] => [is_robots] => [is_posts_page] => [is_post_type_archive] => [query_vars_hash] => 90a220b2f180d3ea6ccbd9473e26ec4c [query_vars_changed] => [query] => Array ( [post_type] => post [connected_from] => 2 ) [request] => SELECT SQL_CALC_FOUND_ROWS il_posts.*, il_p2p.* FROM il_posts INNER JOIN il_p2p WHERE 1=1 AND il_posts.post_type = 'post' AND (il_posts.post_status = 'publish' OR il_posts.post_status = 'private') AND il_posts.ID = il_p2p.p2p_to AND il_p2p.p2p_from IN (2) ORDER BY il_posts.post_date DESC LIMIT 0, 10 [posts] => Array ( ) )      What am I missing? ps. Wordpress 3.1.1, Posts 2 Posts 0.7 and PHP 5.3.3


wp theme.. Could not create directory

Could anyone help me with this please? I am trying to install my wp theme Recital (it came out quite recently), but when I upload the zip and press install, it says Could not create directory... What am I supposed to do?


How to solve 500 Error on WordPress Admin Dashboard due to time-out on getdirsize

**problem:** Only some blogs did not show the dashboard (but did show all other admin pages). I have left this problem for some time (months) since Googling did not bring up anything relevant and I was too lazy to investigate (and could work around it by logging in, getting a 500 error and then press back and click comments). In my mind were .htaccess changes it did, plugins that drop bad rss feeds etc...but... it was core. So today I went commenting out all passages in dashboard.php and unfortunately it was Murphy since the problem was with the bottom line...               add_action( 'activity_box_end', 'wp_dashboard_quota' );      In which I commented the line               //$used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024;         // returns: 1418.9275159836     $used=0;      Whereafter my dashboard was so speedy that I got tears in my eyes. I'm logging this here since I hope people searching for the problem now will shortcut time and recognize the reason. Especially with the combo: 500 and admin dashboard. ~~**Question:** I **assume** that the bigger the uploaddir gets, the slower dasboards will load for blogs. I also assume that this happens for every blog out there since this is a line in core. ~~ ~~Am I correct and could I log this as issue or am i stupid - missing something essential that does not cause this to be problem for every multisite blog with large quota after some time?~~ ~~Now I connected 500 and getdirsize I foundhttp://trac.mu.wordpress.org/ticket/1175 and http://trac.mu.wordpress.org/changeset/2027 ...... In there a transient check was implemented by james collins. What happened to the transient check? that would resolve this I think.~~ The transient check as implemented in ticket 2027 is still in place (see Rarst answer below) and disabling the quota completely will also shortcut the 500 error since that is what is checked in wp_dashboard_quota. So: if you do not disable the quota it means you will get a 500 error eventually if you have a large quota limit. IMHO that could be improved / ticketed or not?


Upload post thumbnail from the front end

We would like users to be able to upload the post thumbnail when editing posts. How would this be done. I would imagine it would make use of the ajax functions of wordpress. Any ideas, Marvellous


Problems character encoding for pages in multiple languages

I have a site that is in English but has a lot of German and Spanish names in it. Originally I was using UTF8, but that gave me problems with some of the German special characters. So I switched to: ISO 8859, but then the german characters were fixed but it broke all the Spanish ones. I changed to ISO 8859 in the wp-config file, but it seems like phpmyadmin doesn't even give me the option to choose ISO 8859. This might be tolerable but after fixing all the accents using special characters, if you later change anything on the page all the accents break again and you have to insert all the special characters again! any suggestions? Thanks in advance!!!


Category "same post" retreive and display

I have made a multiple category. Each item belong to one or more category. So when display one item, i like to retreive the category of this item, and display all post that have belong to that category. Example. Chair : cat = sit, leather, one person So when display the chair, i like below to display all item that have : sit leather and one person as category Is there a plugsin that do that ?, or in php it's simple to do ?


WordPress 3.1 removing 'category' from the slug

Is there a way to remove 'category' from the slug when viewing posts in a particular category in WordPress 3.1 without it breaking? My client is asking me to remove it, but it seems necessary - I get a Page Not Found error when using this plugin: http://fortes.com/projects/wordpress/top-level-cats/ He also doesn't want to just change it to another word...very frustrating... Thanks, osu


How to specify a Parent post type for a Child post type?

I want to register a custom post type as child of another custom post type. I have 2 questions--   1. `hierarchical' => true` should be added on the parent or child when register?   2. Codex says "Allows Parent to be specified", how?


Variable from a plugin into a theme

First plugin, basic question... I am trying to print the variable `$xavi` from a **plugin** into a theme like this:               add_action('init', '_load_options');          function _load_options() {       global $xavi;     }      So that I can use it in a **theme** file like this:               <?=$xavi;?>      It doesn't look like `init` is the right action hook for this but the only other one that makes sense is `wp_head` and doesn't work either Any ideas which hook should I use or how should I define variables (maybe through an existing WP function/method instead of creating one from scratch)? Thanks!


How to rewrite custom post type with custom taxonomy urls?

I am working in a WP multisite which runs on a classipress theme and there is a custom post type "`ad_listing`" and custom taxonomy type "`ad_cat`". Now the url is like this > http://www.example.com/ad-category/transport/ I need to rewrite this URL so it looks like > http://www.example.com/new-york-city/transport/ and categories are nested so it can be nth level. Please help me how to do that with wp rewrite rules. Thanks in advance.Any help will be greatly appreciated.


Search Post Title Only

I'm using the standard WordPress search form to search a custom post type. Here is my code:               <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">     <input type="hidden" name="post_type" value="attorney" />     <input type="text" value="" name="s" />     <input type="submit" value="Search" />     </form>      I would like to limit this to ONLY search the post title. Is there a way to do that? Thank you.


Multiple metadata checkbox sorting

I'm searching for a while but cannot figure how to do exactly... I want sorting my custom post type posts with multiple checkboxes metadata in front-end of an archive page. All store in a session. Working, at the moment, just for one checkbox at the time... I'm searching for a way whitout writing code for each possibility (a lot of checkboxes ! ;-) )... you know what I mean ?               <?php      add_action( 'init', 'switch_session' );     function switch_session() {     if( ! session_id() )         session_start();          if( isset( $_POST[ 'post-male' ] ) ) {     $_SESSION[ 'post-male' ] = ( 1 == $_POST[ 'post-male' ] ) ? true : false;     }          if( isset( $_POST[ 'post-femelle' ] ) ) {     $_SESSION[ 'post-femelle' ] = ( 1 == $_POST[ 'post-femelle' ] ) ? true : false;     }          if( ! isset( $_SESSION[ 'post-male' ] ) )     $_SESSION[ 'post-male' ] = false;          if( ! isset( $_SESSION[ 'post-femelle' ] ) )     $_SESSION[ 'post-femelle' ] = false;          <?php     add_action( 'pre_get_posts', 'switch_output_order' );     function switch_output_order( $q ) {     if( ! is_admin() && $q->is_main_query() && is_post_type_archive( 'nos-alpagas' ) ) {          if( false !== $_SESSION[ 'post-femelle' ] ) {             $q->set( 'meta_query', array(         array(             'key' => 'sexe',             'value'    => 'Femelle',             'compare' => '='             )         ) );         }              if( false !== $_SESSION[ 'post-male' ] ) {             $q->set( 'meta_query', array(         array(             'key' => 'sexe',             'value'    => 'Mâle',             'compare' => '='             )         ) );         }          <?php     function switcher_session() {          $femelle = $_SESSION[ 'post-femelle' ];     $male = $_SESSION[ 'post-male' ];     ?>          <form method="post" class="switcher">
Sexe:

     <input type="hidden" value="0" name="post-femelle">     <input type="checkbox" value="1" id="post-femelle" name="post-femelle" <?php checked( true, $femelle ); ?>>     Femelle          <input type="hidden" value="0" name="post-male">     <input type="checkbox" value="1" id="post-male" name="post-male" <?php checked( true, $male ); ?>>     Mâle
     </form>     <?php     }?>


change $src from wp_register_script in plugins/themes

I have a lot of plugins using external scripts from googleapis - these are throttled/blocked in China and it causes a lot of problems. Without rewriting the lines in all the plugins/themes and break my upgrade path, is there a way we can do it in my themes function.php file so I rewrite all the $src urls to local urls?


Two functions utilizing registration_errors filter

I wrote two plugins that utilize the registration_errors filter:               add_filter( 'registration_errors', 'process_payment', 10, 3 );          add_filter( 'registration_errors', 'add_user_to_SF', 10, 3 );      When `add_user_to_SF` returns errors, the `process_payment` function runs successfully (I know this because it processes a payment). How can I set this up so that when one of them returns an error the other doesn't run and user registration doesn't happen?


Wordpress Themes Categories for the Admin pannel

I am working on this project and I'll have 200+ and even more by the end of the project. I need to have all these themes show up in Admin > Appearance ? All themes will be installed on the same wordpress site Is there any way to arrange the themes in Categories (ex. Financial, Arts etc).


Custom wp_list_pages() function

I have following code in my `.php` file:               $my_pages = wp_list_pages("title_li=&child_of=".$my_id."&echo=0");      Then I create an `<ul>`               <ul>       <?php echo $my_pages; ?>     </ul>      Problem is, that I would like to list a **title** in `<h2>` tag, and **excerpt** of the page on the text below. It´s possible to do that using `wp_list_pages`?


Display categories and their IDs

Could anyone please tell me the code to display parent categories and their children along with their IDs? I'd like to, for example, print them in this way: Europe, United Kingdom, London (Europe is parent category, UK is child, London is child of UK)   102, 150, 175 (these are their relevant IDs) Europe, France, Paris 102, 153, 189 Europe, France, Cannes 102, 153, 192 what i want to do is this: The steps I Followed (please check this link) I only want to change this code:               <ul> <?php wp_list_categories('show_count=1&title_li=&hide_empty=0'); ?></ul>      so that the list of of all the categories and their childs will be displayed along with their ids in this format: Example: **Europe,United Kingdom,London, East Ham : 25,28,34,36** this is just one parent category (Europe) and its childs (Uk) the child of UK is London, and the child of london is East Ham. 25 is the id of Europe, 28 is the id of UK, 34 is the id of London, 36 is the id of East Ham Please note: I just want to display this list on a page as described in the link above. Thank you so much


Comments broken. All comments gone & no new comments can be made. Possible jetpack issue?

So, my client has two self hosted wordpress blogs- one long-existing and one new one that she just launched. She clicked on a jetpack activation link- meant to connect her new blog to it's corresponding wp.com account- but she did it while logged into her existing blog. As a result, the wrong wp.com account got connected to her blog. She then asked me to fix it. When I associated her blog back to it's correct wp.com account- all the comments were gone. As was the ability to add new comments. The wp_comments table seems to be empty, save for 3 spam comments. If I log into her wp.com account, I can see all her comments- but sadly, connecting that account does not bring the comments back. With Jetpack on, the comments form seems to submit, but no comments appear. If I shut off Jetpack and try to comment, the normal comment form throws this error: Warning: get_object_vars() expects parameter 1 to be object, null given in insertpathhere/comment.php Warning: Cannot modify header information - headers already sent by (output started at /path/comment.php:158) in /path/wp- includes/pluggable.php Also interesting to note is that I can't delete any of those spam comments either. when I try, it looks like it's doing it, but then they just show up in the backend again. Looks like nothing can write to that table? I've tried all of the following:   * disabling all plugins   * resetting the theme to default   * manually reinstalling Wordpress   * manually deleting and reinstalling jetpack   * disconnecting and reconnecting the wp.com account associated with jetpack   * Repairing wp_comments & wp_commentsmeta in the db   * checking wp-config for whitespace at the top and bottom of the file   * adding the following to my theme's functions.php:              //allow redirection, even if my theme starts to send output to the browser     add_action('init', 'do_output_buffer');     function do_output_buffer() {     ob_start();     }      This last one gets rid of the Cannot modify header information error, but just sends you to the theme's 404 page instead of adding the comment. I would really like to figure out the following, in this order:   1. How to get new comments working again   2. How to get the existing comments (which all appear to be there on wp.com) back on the blog.   3. To know how this got so screwed up from such a seemingly innocuous cause. The blog lives at http://www.nubbytwiglet.com. p.s. Today is my birthday, and all I want is to solve this thing.


Create a body div using CSS

I am trying to add a white background to just the body and header text on my blog, so that I can add a background image behind the whole site. I know I need to create a div that sits behind the body and header, however I'm a beginner with CSS so could do with a few pointers if possible. Blog address is www.astridkearneyblog.com Any help would be greatly received! Thanks.


Hooking into the post editing screen for an existing page only

I am working on a Wordpress theme that hides the default WYSIWYG editor and replaces it with a custom module system which is fine and dandy, but I've come to the realisation if someone were to use the theme on a pre-existing site they wouldn't be able to access their previously entered content which is obviously bad. So basically what I need to do is check if a pre-existing page is loaded (via a hook hopefully) and then move that content over to the newer module system which stores data in custom fields. Is there an easy way of detecting if the post editing screen is being loaded for an already created page? I can't rely on the post_status of "published" because I need to account for drafts and scheduled pages as well. Perhaps simply checking if a page has a title is enough to distinguish a new page from an already created page? The below fictional code describes that I want to be able to do: > if [on page editing screen and page is pre-existing and has content] > > then > > Import the default the_editor content into a custom field


How to show or hide a post based on meta_value selection?

How would I go about hiding a post based on a meta_value selection done on the back end. The usual method is to just change the post status from Publish to Draft however, I want this to work based on a dropdown selection. meta_key being `current_status` and a dropdown box with meta_value of `active` and `leased`. If `active` is selected the post is shown, and `leased` would hide the post. Any ideas on how to do this in a clean way?


Can I seperate comments from post?

I have a type of attachments that need full screen display. So, I need to put the comments form somewhere else. How can I tell WP those comments belongs to a post?


Outputting the blogposts or the_content()

On the dashboard under add pages, I have 3 section of blockquotes, under text
first

second

third
      So, when I try output them in the index.php , I do               <?php while(have_posts() ): the_post() ?>

..

 ..

 ..

          <?php endwhile;?>         How do I output the blockquote id=section1 into div id=first, blockquote id=section2 into div id=second, blockquote id=section3 into div id=third? do we only have the_content() function? Can we break the content into pierce we want?


How to query wp_postmeta table for any specific meta_value?

I am using following code in the theme files to get some output from the DB:               <?php $querystr = "SELECT DISTINCT meta_value FROM $wpdb->wp_postmeta WHERE 'meta_key' LIKE 'movie_name' ORDER BY meta_value ASC";     $movie_names =  $wpdb->get_results($querystr, OBJECT);     echo sizeof($movie_names);     ?>     <ul>     <?php foreach ( $movie_names as $movie_name ){ ?>        <li><?php echo $movie_name->meta_value; ?> </li>     <?php } ?>     </ul>      Above code's result is "0" at the frontend. But when I am running the same query i.e.               SELECT DISTINCT meta_value FROM wp_postmeta WHERE 'meta_key' LIKE 'movie_name' ORDER BY meta_value ASC      in DB then it's returning 6 rows. Please help me in finding the problem in the code.


Shortcode Display From Wordpress Dashboard Page Without Using post_id

I have this code for showing recent posts on my home page custom theme and it works well. functions.php code:               function my_recent_posts_shortcode($atts){         $q = new WP_Query(             array( 'orderby' => 'date','posts_per_page' => '4')         );         $list = "";              while($q->have_posts()) : $q->the_post();                 echo '
';                  $title=get_the_title();                  if ( has_post_thumbnail() ) {                     echo '';                      $list .=the_post_thumbnail(array(300,200),array('alt' =>$title));                         echo '';                }                  echo '
'.$title.'
';               echo '
';                  $list .= wpe_excerpt('wpe_excerptlength_index', '');                  echo 'Read More';             echo '
';             echo '
';                  endwhile;                  return $list;     }          add_shortcode('recent-posts', 'my_recent_posts_shortcode');      This is the shortcode I use on my pages->Home page > [recent-posts] For displaying the shortcode I have to use:               <?php     $post_id = 1746;     $queried_post = get_post($post_id);     $check=$queried_post->post_content;     echo do_shortcode($check);     ?>      For displaying the shortcode, I used $post_id of my home page. I want to display the shortcode content without using post_id. When I use the shorcode on my homepage, it automatically calls that shorcode and displays the result. My theme URL is http://templategraphy.com/wp-demo/businessguru/ Please suggest some solutions.


How to define category ID in an array?

I have the following:               <?php if ( array( 'is_category', 'is_tag' ) ) { ?>      What I want to do is (that doesn't quite work):               <?php if ( array( 'is_category('13')', 'is_tag' ) ) { ?>      So what I'm asking is, how can I include that ID in code that will work? That's how I would do it anywhere outside of an array, so I am unsure exactly how to include it here. Thanks


add_menu_page Callback Function: Skip page content?

I want to have a menu item that will, on-click, add a page with certain arguments. In it's simplicity, I have:               function av_subscribe_create_menu(){     // Create top-level menu     add_menu_page( 'Add Comment Feed', 'Add Comment Feed', 'manage_options', __FILE__,          'av_subscribe_create_feed_page', '' );     }     add_action( 'admin_menu', 'av_subscribe_create_menu' );          function av_subscribe_create_feed_page(){              $page = array(           'post_type' => 'page',           'post_status' => 'publish',           'post_parent' => 13570         );              $new_page_id = wp_insert_post($page, false);          }      This doesn't work and even if it did, I don't believe it would take me to the Edit screen. Is there a way you can use a function to add a post and go directly to the edit screen? Also, bonus question: If you do not specify a title, but you specify the post_status as publish, will this automatically create a slug for you? I don't want an auto-generated slug of some gibberish. Thanks in advance.


Private Buddypress community causes white screen on select pages

I am using Buddypress in conjunction with WordPress, both of which are in their latest versions (1.6.4 and 3.5.1 as of now), and I keep the community aspect of it private with the plugin "Buddypress Private Community." This has been helpful to block pages and redirect registered users on login, but the generated pages for Members and Groups cause a white screen instead of redirecting to `/landing-page?on_login_redir_to="/groups`" as expected. However, this works for the activity stream, which is also dynamically generated. Is it this line of code in `bp-groups/members-loader.php` that is causing the issue? `if ( !defined( 'ABSPATH' ) ) exit;` I haven't the slightest idea what ABSPATH is, knowing that would help.


How do you use do_shortcode via AJAX call?

I'm attempting to call a Contact Form 7 form using AJAX in a Wordpress theme. I'd ideally like to use the Contact Form 7 shortcode to do this, however it doesn't seem as though do_shortcode is an available function when called using AJAX (it was just echoing out the shortcode itself). I stumbled upon this question: Why might a plugin's 'do_shortcode' not work in an AJAX request? which was exactly my problem! However the solution provided didn't work for me, and I'm pretty sure I implemented it the same way the original post did:               add_action( 'init', create_function('',  'register_shortcode_ajax( "cl_contact_us", "cl_contact_us" ); '));          function register_shortcode_ajax( $callable, $action ) {         if ( empty( $_POST['action'] ) || $_POST['action'] != $action )             return;         call_user_func( $callable );     }          function cl_contact_us() {         echo do_shortcode( '[contact-form-7 id="7" title="Contact form 1"]' );         die();      }       The only thing I had to change was how the anonymous function was being called from the add_action function (for some reason using a traditional anonymous function wasn't working, but using the PHP function works fine). Aside from the above, the only thing that's radically different is the jQuery AJAX call, but I believe it's basically the same...               var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';     $(document).ready(function(){         $('a#contact-button').click(event, function() {                 event.preventDefault();                 $.post(                    ajaxurl,                      {                         'action':'cl_contact_us',                     },                  function(response) {                     $('#form').append(response);                 });             });         });      This is successfully performing an AJAX call, but it's still just echoing out the shortcode, not the form. I hope this is enough info, if you need any more I'll be here all day :) Any help is greatly appreciated. Thanks!


Is there a Wordpress core & plugins update action hook?

I would like to run several actions on a website once WP core or any of the plugins have been updated using the built-in update process. Is there a way to do it? I would prefer if I could run commands on 3 different cases:   1. WP core update is finished   2. A single plugin update has been finished   3. A bulk update for plugins has been finished (so that I run the command only after all of them have been finished)


Display custom posts from a custom taxonomy, sorted by another custom taxonomy

I am developing a Nature section on a website. I have a custom post type which contains several custom taxonomies (Group, Order, Family). So I have the following posts categorised like this - Group Order Family * * * Insect Lepidoptera NOCTUIDAE Insect Lepidoptera CRAMBIDAE Bird Galliformes PHASIANIDAE Bird Passeriformes SITTIDAE what I want to be able to do is to display a list of all posts where the Order term is 'Lepidoptera' - I can do that - but then sorted by the Family value. So I would expect 2 records - record 2 followed by record 1. The real scenario has further taxonomies such as Species and Common Name but if I can get a solution for this I could apply across the board where necessary. I have read this is quite tricky to do and can imply the data design is wrong - and to use post meta data instead. However I can't see that in this case, as I need the custom taxonomies to also allow display of all posts where family is whatever. Thanks in advance for any advice on this.


Child theme:Loading js files

I'm creating a twitter bootstrapped child theme based on TwentyEleven.I want to load bootstrap.js so I've written the following line to get the bootstrap.js file but it is not returning correct path.               <script type="text/javascript" src="<?php dirname( bloginfo('stylesheet_url') ) ?>/bootstrap/js/bootstrap.js"></script>      The path I'm getting:               http://localhost/wordpress/wp-content/themes/codemasala/style.css/bootstrap/js/bootstrap.js      The path I should get:               http://localhost/wordpress/wp-content/themes/codemasala/bootstrap/js/bootstrap.js


Modify wording of bulk options

I would like to modify the wording in the bulk actions on the posts screen or custom post types. I am trying to do so using the following code, but it's not working. Any idea why?               add_filter( 'bulk_actions-edit-post', 'my_custom_bulk_actions' );     function my_custom_bulk_actions( $actions ){         $actions['trash'] = 'Just testing';              unset( $actions[ 'edit' ] );         return $actions;     }


Adding footers to posts?

I'm trying to add footers to the end of my posts. I need to be able to assign different footers to different posts (not globally). I tried using WP Post Footer, but it's not working on WP 3.1.2.


Which file do I need to edit the All Posts page in the admin area?

I've never edited admin files before, but I need to edit the table used to list my posts in the admin area (on the All Posts page). Can someone please point me to the right file to edit? I've looked in the wp-admin directory but I haven't found a file with this table in it, so far.


How to add breadcrumbs to any WordPress theme

How can I add a breadcrumb trail to the top of every page of my site? I wait to to look like: "You are here: (page name)"


How to get the permalink of a page when loading my plugin

I'm implementing a web widget and for this reason i'd like my script to respond to the request as soon as possible, to avoid loading unneccessary thing.   I've found out that calling `get_permalink( $page_id )` before the `init` phase return this error > [19-Sep-2012 12:10:12 UTC] PHP Fatal error: Call to a member function > get_page_permastruct() on a non-object in C:\Program Files > (x86)\Zend\Apache2\htdocs\wordpress\wp-includes\link-template.php on line > 276 I was wondering is there a way in which i can retrieve the permalink of the page without waiting for the `init` phase?


Odd functions.php issue in Wordpress

I'm using More Fields plugin, and when I use my functions.php to embed the custom field, I get an odd issue. The field value is followed by a "1" I use this code:               //Address     add_action( 'woo_post_inside_before', 'my_address' );     function my_address() {         global $post;     if ( is_single() && in_category('listings') ) {              echo more_fields('address', '<h1>','</h1>');            }     }      But, if I use the following code - their is no "1"               //Address     add_action( 'woo_post_inside_before', 'my_address' );     function my_address() {         global $post;     if ( is_single() && in_category('listings') ) {              echo meta('address');            }     }      How do I style the above using the echo meta? Or has anyone ever seen the "1" issue?


How come Featured Image isn't showing up in my Custom Post Type?

I have thumbnail support added with the following in my functions.php               // Add Thumbnail Support     add_theme_support('post-thumbnails');     set_post_thumbnail_size( 140, 140, true );      And I create the custom post type with               // Create Custom Post Type for Work     add_action( 'init', 'create_post_type' );     function create_post_type() {     register_post_type( 'custom_post',         array(             'thumbnail',             'labels' => array(                 'name' => __( 'Custom' ),                 'singular_name' => __( 'Custom' )             ),             'public' => true,             'has_archive' => true,             'rewrite' => array('slug' => 'custom'),             'taxonomies' => array('category', 'post_tag')         )       );     }      However, when I create a new post in the Custom Post Type, the Featured Image meta box does not show. I have also tried using an array when declaring the custom post type, as follows but that didn't work either               // Add Thumbnail Support     add_theme_support('post-thumbnails', array ('post','work','custom_post'));     set_post_thumbnail_size( 140, 140, true );      What am I missing?


How to pass code from header.php to footer.php

I'm initializing a variable with a value in the header.php file. I want access to that value in footer.php, but it doesn't exist upon checking. Example: **header.php**               $status = true;      **footer.php**               var_dump( $status ); // is null      What's a best practice for doing something in footer.php, or other files if they have the same behavior.


Infinite-Scroll Plugin and Jetpack Infinite Scroll Plugin - Adding to "Thoughts" Theme

How do I enable infinite scroll (either with the infinite-scroll plugin OR the built in infinite scroll jetpack) on the "Thoughts" Wordpress theme? I'm a total noob at editing this stuff so if you are kind enough to help please keep it very simple as if I do not know anything.


Comments Pagination as an unordered list

I am currently using `<?php paginate_comments_links(); ?>` to display comments pagination. How can I customise this so that it uses a UL and LI? (Such as is possible with custom post pagination). Thanks


Hook for post and page load

I need to run a function when a particular post or page is loaded. Is there any hook that lets me check whether a post is being displayed during page load ?


Wordpress : "link to existing content" not shows custom post types

I've seen many people who write for similar problem, i.e. to remove a custom post type on the search box for "link to existing content" on the tinyMCE editor of Wordpress. I've a reversed problem, I can see ONLY pages and posts. I cannot see custom post types I've created, all with public set to true, publicly_queryable set to true, capability_type set to true, show_in_nav_menus set to true, and so on. I've used the plugin "B09 Link to Existing Content", without results. Why? What can I do? Maybe the problem is on declaration of the custom post type? I've created a php file included into functions.php of my theme. Is this the problem? Does I need to load custom post type in a different manner?


Workflow to allow franchisees to edit one post that only they would have access to and submit for approval - no publishing rights

I need to have a some kind of workflow that allows a franchisee to login to wordpress, only see the one post they are allowed to see as specified by an administrator and be able to modify that post, but they would not be able to publish the content to the site, only submit for review, then a moderator would be notified and approve of their changes and publish the content to the site. Some of the plugins ive looked at like role scoper, and andvanced access manager are just a convoluted mess that client would have no idea how to use. Also if you make someone a contributor they cannot edit the post and if you make them an editor, they have the ability to publish immediately which i do not want. Im looking for the cleanest, easiest way to do that.


Attach an image to new posts

I am trying to attach an image to the body of a post.   * The post is created.   * The image is added to the Media Library.   * The thumbnail is added to the post.   * The images do not get added?               $attachment = array(              'guid' => $image_url,               'post_mime_type' => $wp_filetype['type'],              'post_title' => $c_img . ' - ' . $key,              'post_status' => 'inherit',              'post_date'      => date('Y-m-d H:i:s'),              'post_parent' => $post_id // Does not seem to add it to the parrent???         );          // adding image to media library     $attachment_id = wp_insert_attachment($attachment, $image_path);     $attachment_data = wp_generate_attachment_metadata($attachment_id, $image_path);     wp_update_attachment_metadata($attachment_id, $attachment_data);          // adding thumbnail, works fine?     if ($key == 0) {       add_post_meta($post_id, '_thumbnail_id', $attachment_id, true);     }


ajax request not returning the result

i am using custom plugin to display the values on the wordpress admin side.. My Jquery html file is                     My Plugin File is add_action('wp_ajax_my_action', 'my_action_callback');               function my_action_callback(){                  $name = $_POST['test'];             $city = $_POST['test1'];             $date = $_POST['test2'];                  if ($date != '') {                 $enddate = date("Y-m-t", strtotime($date));                 $dates_sql = " AND start_date <= '$date' ";                 }                 if ($city != '' && $city != -1)                  $destination_sql = "AND venue = '$city'";                 if ($name != '' && $name != -1)                      $origincity_sql = "AND event_name = '$name'";                  $query = " SELECT * FROM
 WHERE event_id!='' " . $dates_sql . " " . $destination_sql . " " . $origincity_sql . " ORDER BY start_date DESC ";                  $results = $wpdb->get_results($query) or die(mysql_error());                      foreach ($results as $row)             {                 $message  = "
".$row->username."	".$row->event_name."	". $row->venue."	".$row->email."	".$row->missed_days."	".$row->payment_mode."	".$row->amount_paid."	".$row->amount_balance."	".$row->mail."
";             }                    echo $message;             exit();         }      i am not getting the response into the jquery html file despite it is returning -1 as response any changes to be done please help.stuck today on this one.


Translating images in Wordpress

I am new to Wordpress but am curious about the translation options. I know there are quite a few translation plugins that can convert the text of a blog to various languages. However, I would like to know if it possible to create an option where a language can be selected from a blog menu and different images be displayed on the blog based on which language was selected?


Load mutiple stylesheets inside one IE condition

I want to load Load mutiple stylesheets inside one condition for Internet Explorer:               wp_enqueue_style('ie-style', get_template_directory_uri() . '/style-ie.css');     wp_enqueue_style('ie', get_template_directory_uri() . '/ie.css'); //     global $wp_styles;     $wp_styles->add_data('ie-style', 'conditional', 'IE 9');         $wp_styles->add_data('ie', 'conditional', 'IE 9');      And the output is like this:               <!--[if IE 9]>         <link rel='stylesheet' id='ie-style'  href='http://localhost/resources/wp-content/themes/style-ie.css' type='text/css' media='all' />     <![endif]-->     <!--[if IE 9]>         <link rel='stylesheet' id='ie'  href='http://localhost/resources/wp-content/themes/ie.css' type='text/css' media='all' />     <![endif]-->      How can I combine them in one condition to be like this:               <!--[if IE 9]>         <link rel='stylesheet' id='ie-style'  href='http://localhost/resources/wp-content/themes/style-ie.css' type='text/css' media='all' />         <link rel='stylesheet' id='ie'  href='http://localhost/resources/wp-content/themes/ie.css' type='text/css' media='all' />     <![endif]-->      Your help is really appreciated. Thank you


How to escape custom css?

I'm creating a WordPress theme in which I've allowed users to add some custom css from the Theme Options. This css code then directly gets echoed out in the head section of the page, with the following code:               add_action('wp_head', 'theme_dynamic_css');     function theme_dynamic_css(){       global $my_theme_options;       $custom_css = '';       if (isset($my_theme_options['custom-css'])) {         $custom_css .= $my_theme_options['custom-css']."\r\n";       }       echo '<style id="my-theme-custom-css">'.$custom_css.'</style>';     }      Should I be using esc_html() here? At first I assumed if the code is between the style tags, then it shouldn't be a problem, but now I'm confused. Please help.


Add topbar to static html page

I have a WordPress blog, but I am also hosting a standalone static HTML page on the same domain/server (LaughingSquid, if it makes a difference). I'm _very_ new to WordPress and PHP, so I am wondering if there is a relatively simple way to use PHP to add the topbar that appears in my WordPress-based pages to the static HTML page. Is this possible and how would you go about doing it? Thanks.


redirect index.html inside folder to wordpress page of same name

i have a wp page called mysite.com/stuff/ i have a subdirectory on my ftp called mysite.com/stuff/index.html with a bunch of files and other subdirectories inside. when i go to mysite.com/stuff/ i want it to show the wp page, but it keeps serving me the contents of mysite.com/stuff/index.html (the subfolder and wp page have the same name) i need to keep all of the files inside the subdirectory mysite.com/stuff/ accessible via direct links, but just need to serve the wp page instead of the index.html i need to keep the wp page name url and subfolder name the same, but only serve the wp page and NOT serve index.html. changing permalink structure is not an option at this point. i tried using the redirection plugin and set source url to /stuff/index.html and target to /stuff/ but it's still serving index.html please let me know if you have any suggestions. i tried renaming index.html to something else, but then it displays the subdirectory contents as a list of links in the browser, and not the wp page. thanks!


Multi-steps WordPress registration : in 4 steps how to?

I saw in several WordPress sites up on registration that the registration process is in 3 or 4 steps. how can i implement such process to my theme? ie:   1. choose your role + fill in register form----> if its ok submit then go to step 2   2. profile details : user pic , some usermeta form ----< if its ok submit then go step 3   3. Preview profile before confirm ---< go to step 4 or back to step 3 to make changes.   4. registration complete success  _**UPDATE_** > hi guys i have figured it out little bit,(i am using jobroller theme which > has a normal a one step registration form, but it has a multiple step forms > for submting jobs listing) submit job form. what i wanted is to use the same > (submit job multi-steps forms) for registration form so users are obliged to > fill in profile details or whatever within the same process. registration. > so i hacked the original registration of jobroller theme (includes/theme- > login.php) and here what it gives. > > theme-login.php here is the function registration steps that replace the original `jr_register_form()`               function jr_registration_steps() {          // Show registration steps forms          ### Prevent Caching     nocache_headers();          jr_load_form_scripts();          //global $post, $posted;     global  $posted;     $submitID = $post->ID;          $posted = array();     $errors = new WP_Error();          if (!is_user_logged_in()) :         $step = 1;      else :         $step = 2;         if (!current_user_can('can_submit_job')) : //can_submit_listing redirect to my listing             redirect_myjobs();         endif;     endif;          if (isset($_POST['register']) && $_POST['register']) {              $result = jr_process_register_form( get_permalink($submitID) );              $errors = $result['errors'];         $posted = $result['posted'];          //}     //elseif (isset($_POST['login']) && $_POST['login']) {              //$errors = jr_process_login_form();          }     elseif (isset($_POST['job_submit']) && $_POST['job_submit']) {                $result = jr_process_submit_job_form();//jr_process_submit_user_registration_form              $errors = $result['errors'];         $posted = $result['posted'];              if ($errors && sizeof($errors)>0 && $errors->get_error_code()) $step = 2; else $step = 3;          }     elseif (isset($_POST['preview_submit']) && $_POST['preview_submit']) {              $step = 4;              $posted = json_decode($_POST['posted']);          }     elseif (isset($_POST['confirm']) && $_POST['confirm']) {              $step = 4;              jr_process_confirm_job_form();//jr_process_confirm_user_registration_form          }     elseif (isset($_POST['goback']) && $_POST['goback']) {         $posted = json_decode(stripslashes($_POST['posted']), true);     }          if( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] )             $message = __('Thank you for registering! An email has been sent to you containing your password.','appthemes');             get_template_part('header'); ?>

<?php _e('create an Account', 'appthemes'); ?>
                  <?php                  echo '
';                 for ($i = 1; $i <= 4; $i++) :                     echo '<li class="';                     if ($step==$i) echo 'current ';                     if (($step-1)==$i) echo 'previous ';                     if ($i<$step) echo 'done';                     echo '">';                     switch ($i) :                         case 1 : _e('Create account', 'appthemes'); break;                         case 2 : _e('Enter Profile Details', 'appthemes'); break;                         case 3 : _e('Preview/Profile Options', 'appthemes'); break;                         case 4 : _e('Confirm', 'appthemes'); break;                     endswitch;                     echo '
';                 endfor;                 echo '

';                      // show the success message usually because a password has been emailed to new user                 if (isset($message) && !empty($message)) echo '
'.$message.'
';                      jr_show_errors( $errors );                       switch ($step) :                          case 1 :                         jr_before_step_one(); // do_action hook                         ?>
<?php _e('You must login or create an account in order to post a job — this will enable you to view, remove, or relist your listing in the future.', 'appthemes'); ?>

                             <?php jr_register_form( get_permalink($submitID), 'job_lister' ); ?>

                                      <?php jr_login_form( get_permalink($submitID), get_permalink($submitID) ); ?>

                         <?php                                                jr_after_step_one(); // do_action hook                                               break;                     case 2 :                             jr_before_step_two(); // do_action hook                         jr_submit_job_form(); //*****jr_submit_user_registration_form();                                         jr_after_step_two(); // do_action hook                           break;                     case 3 :                             jr_before_step_three(); // do_action hook                         jr_preview_job_form();  //*****jr_preview_user_registration_form();                         jr_after_step_three(); // do_action hook                         break;                     case 4 :                         jr_before_step_four(); // do_action hook                         jr_confirm_job_form();  //*****jr_confirm_user_registration_form();                         jr_after_step_four(); // do_action hook                         break;                      endswitch;               ?>

                     <?php if (get_option('jr_show_sidebar')!=='no') get_sidebar('submit'); ?>           <?php              get_template_part('footer');            }      > here what i have in my includes/forms/register/ register-process.php register-process.php please note that i have modified this at the bottom : `// redirect wp_redirect($success_redirect); wp_redirect($success_redirect);// redirect user to dashbord when registred exit(); ` > to this code :               $redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : '?action=register&step=2';                                 wp_safe_redirect( $redirect_to );                                      exit;      > in order to add `&step=2` to the url, i think you can add similar code to > the other form to redirect and show correct step in url after > ?action=register i didn't finish yet hacking the code to suit it to my needs but what i suggested is a beginin and others can help modifyin or presenting better. hope its helps you :)


$wp_query meta_key naming issue

What I am attempting to do is sort posts by custom fields. I have a few custom fields that don't query properly and I get the 404 page. The fields that don't work I used hyphens in the naming convention, i.e. `var- name`. When I switch the hyphens to underscores it works, i.e. `var_name`. Am I overlooking something simple in PHP or Wordpress that causes conflicts when I do this?   * I know I could simply just switch everything to underscores but I like to know the root of issues so I can avoid them in the future. I am using `pre_get_posts` to modify the query being executed:               add_action( 'pre_get_posts', 'my_modify_query' );     function my_modify_query( $wp_query ) {              if ( is_category() ) {                  // Works - underscore             if ( isset( $_REQUEST['var_name'] ) ) {                 $meta_query[] = array( 'key' => 'var_name', 'value' => $_REQUEST['var_name'] );             }                  // Sometimes works - hyphen             if ( isset( $_REQUEST['var-name'] ) ) {                 $meta_query[] = array( 'key' => 'var-name', 'value' => $_REQUEST['var-name'] );             }                  if ( ! empty( $meta_query ) ) {                 $wp_query->set( 'meta_query', $meta_query );             }              }     }      Have additional custom fields I check for, the above example is for brevity and clarification and is the same for additional fields. **EDIT 1** Here are the queries being run by Wordpress: The unsuccessful hyphen               SELECT SQL_CALC_FOUND_ROWS  wp_xxxxx_posts.ID      FROM wp_xxxxx_posts      WHERE 1=1      AND 0 = 1      AND wp_xxxxx_posts.post_type IN ('post')      AND (         wp_xxxxx_posts.post_status = 'publish'          OR          wp_xxxxx_posts.post_author = 1          AND          wp_xxxxx_posts.post_status = 'private')      GROUP BY wp_xxxxx_posts.ID      ORDER BY wp_xxxxx_posts.post_date DESC      LIMIT 0, 10      The successful underscore               SELECT SQL_CALC_FOUND_ROWS wp_xxxxx_posts.ID      FROM wp_xxxxx_posts      INNER JOIN wp_j9L3vi_postmeta ON (wp_xxxxx_posts.ID = wp_xxxxx_postmeta.post_id)      WHERE 1=1      AND wp_xxxxx_posts.post_type IN ('post', 'custom_post_type' )      AND (         wp_xxxxx_posts.post_status = 'publish'          OR          wp_xxxxx_posts.post_author = 1 AND wp_xxxxx_posts.post_status = 'private'     )      AND ( (             wp_xxxxx_postmeta.meta_key = 'var_name'              AND CAST(wp_xxxxx_postmeta.meta_value AS CHAR) = '116'     ) )      GROUP BY wp_xxxxx_posts.ID      ORDER BY wp_xxxxx_posts.post_date DESC      LIMIT 0, 10      If I go into phpMyAdmin and simply switch out `var_name` in the above query to `var-name` it works. **Edit 2** I am passing the custom fields as so:               http://mysite.com/?cat=example&var-name=100


Create a clickable name in WP_List_Table for Plugin Admin

I've been developing a plugin where I wanted to create a table, styled and working just like Wordpress's native Post/Page tables. Following the guide below, I was able to create the table and load my database. The only thing I cannot figure out to do is how to make one of the row contents "clickable". http://wpengineer.com/2426/wp_list_table-a-step-by-step-guide/ IE - making the "name" column clickable. I have the "edit, delete" buttons below the name, but that is not enough. Any and all advice would be greatly appreciated. I looked at another plugin to see how they did this, and it looked like they broke the table apart and hardcoded the html for the table. I hope I don't have to do this. EDIT: ![clickable, linked, name](http://i.stack.imgur.com/SA4FZ.png) The name of the post, Hello world!, as you can see, is a link / clickable. # **SOLUTION** to make this work, I had to remove my custom column functions, which included my row actions. Turns out, you can simply call the row actions div! Here is the function that helped me, thanks to the Milo.               function single_row_columns($item) {            list($columns, $hidden) = $this->get_column_info();                 foreach ($columns as $column_name => $column_display_name) {                        $class = "class='$column_name column-$column_name'";                             $style = '';                        if (in_array($column_name, $hidden))                              $style = ' style="display:none;"';                             $attributes = "$class$style";                             if ('cb' == $column_name) {                        echo  "";                        echo '<input type="checkbox" name="id[]" value="%s" />', $item['ID'];                        echo "	";                             }                    elseif ('galname' == $column_name) {                    echo "";                    echo '', $item['galname'];                    echo "";                             echo "
";                echo sprintf('Edit',$_REQUEST['page'],'edit',$item['id']);                        echo " | ";                echo sprintf('Delete',$_REQUEST['page'],'delete',$item['id']);                echo "
	";                                                         }                 else {                     echo "";                     echo $this->column_default( $item, $column_name );                     echo "	";                 } } }       Thanks so much! Jacob


How to include admin-ajax when loading external javascript

I'm creating a plugin that has some external Javascript and some AJAX calls ... but I don't know the best way to make reference to the `admin-ajax.php` file since the path requires some input from PHP (paths and such). Should I declare a global javascript variable? What is the best way to accomplish this?


Custom strings for translation using Polylang plugin

I'm using **WP 3.5** and **Polylang 0.9.8** plugin to make translations to different languages. All is good, and the plugin works fine, but now I'm facing a problem -- **I need to translate custom strings** , for example, strings inside widgets. What can you recommend me to solve this problem? **ADDED:** For example (I'm taling about text in widgets, but not header), can I add some string constants or so and write them from php-code into my page -- and got them to translate on String translation page of Polylang?


What does do_action('admin_init'); does actually?

What impact does disabling do_action('admin_init'); in admin.php make? I disabled this function because Whenever i was trying to insert featured image, I get 404 error, i.e. media-upload.php and ajax-admin.php was not found in the server. After disabling do_action('admin_init'); , everything worked fine except admin design was gone. I then manually hooked colors-classic.css. Thanks Sabin


How to call WP3.5 Media Library manager?

In the past Media Library window could be called like this:               tb_show("Upload image", "media-upload.php?type=image&TB_iframe=1&width=640&height=520");      This still works in WP3.5. But I'm wondering how to open a new media manager? It's no longer handled by Thickbox - `tb_show()`. Thanks for any advices!


Continue javascript execution when errors occurs

I use the WP native function wp_enqueue_script() for all my JavaScripts loading both in WP front and back-end so it can handle duplicated calls to the same script and so on. One of the issues is that others programmers don't use this function and load their scripts directly from their code, which causes jQuery or jQuery-UI being loaded twice, leading to a bunch of errors. The other issue is that code not owned by my triggers an error and stops the execution of the JavaScript beyond this point. **EDIT:** In short:   1. A javascript error occurs in code not owned by me.   2. My code don't executes due to that f*%@ error.   3. I want that my code bypass that error and still executes. There is a way to handle these issues?


Can I hook into the invite user process to verify their email address is from a certain domain?

I have a site option where users can enter domains to "whitelist" registrations from. What I'd like to do is hook into the invite/create user flow to verify the new user's domain from their email address matches one of the domains in the site options. Does anyone know if this is possible, or how to go about doing that? _Add clarification:_ This would need to look at the email address field within the invite process and I assume strip out everything but the root domain. Then validate the domain is included in an array from blog options. So I guess the start of it would be something like this?               function dwsl_whitelistreg() {             $settings=get_option( 'school_settings');             if (in_array( ENTEREDEMAILADDRESS , $settings[whitelist])) {                 ACTION TO SUBMIT USER             }             else {                 echo "I'm sorry the user's email address does not match a domain given by the school. If you feel this is an error, please email support@dewsly.com";             }         }         add_filter('wpmu_signup_user', 'dwsl_whitelistreg');


Importer fails to import every post

I'm trying to move the content of a wordpress.com blog to a self-hosted one. Right now I'm just trying to set things up on my local environment. I exported the content using the built-in WordPress exporter from the original blog and the file is a little bigger than 2 megabytes. Anyway I managed to increase the upload limit so the import is actually working. The problem is that it imports just the posts of 2010. Is there some other limit set somewhere else?


Is "SELECT TOP 0" a bug with MS SQL database?

I'm having an issue that my posts page displays "no posts found" while right above it, there is "All (1) | Published (1)" (it is a new installation). The post is also invisible on the live site, not only in the administration. I guess it might have something to do with my database which is SQL Server using WP Db Abstraction. So I installed debug bar and found this query:               SELECT TOP 0 * FROM wp_posts WHERE 1=1 AND wp_posts.post_type LIKE 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status LIKE 'future' OR wp_posts.post_status LIKE 'draft' OR wp_posts.post_status LIKE 'pending' OR wp_posts.post_status LIKE 'private') ORDER BY wp_posts.post_date DESC          WP_Posts_List_Table->prepare_items, wp_edit_posts_query, wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, pdo_wpdb->query, pdo_wpdb->_post_query       `SELECT TOP 0` looks suspicious to me, what would you say? If that's indeed a bug, any suggestion on how to fix it?


Many Single Sites, One Plugin directory - adjust plugins_url()

_[this is not a Multisite question]_ > Update: this question is a logical impossibility, or a mind loop if you > will, check update bellow. The technique is laid out here in WPEngineer.   It allows having a single plugins folder to serve many WordPress sites running in the same server. So, all my development sites have this in wp-config.php               define( 'WP_PLUGIN_DIR', '/www_dev/base-site/wp-content/plugins' );     define( 'WP_PLUGIN_URL', 'http://base-site.dev/wp-content/plugins');      Only the base-site has a plugins folder and don't have this constants set in its wp-config. I found a situation where I am in _other-site.dev_ and the plugin tries to call _base-site.dev_ , as follows:   * the plugin in question is Advanced Custom Fields, but I guess it can happen in any other   * the Export XML function of the plugin calls this address `http://base-site.dev/wp-content/plugins/advanced-custom-fields/core/actions/export.php`   * in theory, it should be `http://other-site.dev/wp-content/plugins/advanced-custom-fields/core/actions/export.php`, but this address doesn't exist The plugin builds the form action that executes the export function using this variable `$this->dir = plugins_url('',__FILE__);` **The question is** : could we make an htaccess rule or apply a filter to overcome this issue? # [update] After anmari input and taking a closer look, I think there's no solution for this.   The plugins_url **uses** `WP_PLUGIN_URL`. The plugin is rendering the following html:   `<form action="http://base-site.dev/wp-content/plugins/advanced-custom- fields/core/actions/export.php" method="post">` and there is no, and never will be, anything like:   `<form action="http://other-site.dev/wp-content/plugins/advanced-custom- fields/core/actions/export.php" method="post">`


How to get permalink using get_blog_post function in a multisite?

I'm using code like this               $post = get_blog_post( $blog_id, $data );        echo __('Post on') . ' "guid.'">' . $post->post_title . '"';      But the href link looks like this `mysubdomain.example.com/?p=345` instead of permalink. Can anyone tell me how to get permalink ? Thanks


Get the most popular terms for a custom post type

I’ve hit another small rock in my current project! I’m trying to list (and link) to the archive page for the top 4 most used terms for a custom post type. I have this;               get_terms('trade',array('orderby'=>'count','order'=>'DESC','number'=>4))      ..which is along the right lines but I can’t seem to find a way to pin this down to a specific post type. There is one taxonomy called “trade” across 6 custom post types on the website, I need to find out the top 4 for each one. I started looking through the tables and found I could probably query by the post type, and order by the “count” column in the wp_term_taxonomy table. However, that is really pushing my limits with MySQL because I don’t know an efficient way to write what seems to be such a complex query. I’ve been on this for 4hrs or so now, I don’t think the penny is going to down without some help! Thanks for taking a look...


How to use wordpress default Password Strength Meter script

I have enqueued wordpress default password strength meter but don't know how to use it. Currently the codex page doesn't give any link to its documentation. Does any one have any links to its demo page or documentation? ## Resolved HTML is quite simple. There will be two password box. One div to show the password result and a hidden filed to get the username. And off course you have enqueue `jquery` and `wp_enqueue_script('password-strength-meter');` before the jQuery code. Here is the jQuery code to make it work:                   jQuery(document).ready(function(){           if(jQuery("#pass-strength-result").length > 0){                 jQuery("#pass1").bind("keyup", function(){                 var pass1 = jQuery("#pass1").val();                 var pass2 = jQuery("#pass2").val();                 var username = jQuery("#username").val();                 var strength = passwordStrength(pass1, username, pass2);                 updateStrength(strength);                 });                 jQuery("#pass2").bind("keyup", function(){                 var pass1 = jQuery("#pass1").val();                 var pass2 = jQuery("#pass2").val();                 var username = jQuery("#username").val();                 var strength = passwordStrength(pass1, username, pass2);                 updateStrength(strength);                 });             }         });          function updateStrength(strength){         var status = new Array('short', 'bad', 'good', 'strong', 'mismatch');         var dom = jQuery("#pass-strength-result");         switch(strength){         case 1:           dom.removeClass().addClass(status[0]).text('Too Short');           break;         case 2:           dom.removeClass().addClass(status[1]).text("Bad Password");           break;         case 3:           dom.removeClass().addClass(status[2]).text("Good Password");           break;         case 4:          dom.removeClass().addClass(status[3]).text("Strong Password");           break;         case 5:           dom.removeClass().addClass(status[4]).text("Mismatch");           break;         default:           //alert('something is wrong!');         }     }      Thanks to @krembo99 to send me in right direction. Here is the source code for the strength meter if anyone need to see it. Its inside `wp-admin/js/password- strength-meter.dev.js`.