title: Problems character encoding for pages in multiple languages

text: 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!!!


title: Category "same post" retreive and display

text: 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 ?


title: WordPress 3.1 removing 'category' from the slug

text: 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


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

text: 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?


title: Variable from a plugin into a theme

text: 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!


title: How to rewrite custom post type with custom taxonomy urls?

text: 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.


title: Search Post Title Only

text: 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.


title: Multiple metadata checkbox sorting

text:
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     }?>


title: change $src from wp_register_script in plugins/themes

text: 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?


title: Two functions utilizing registration_errors filter

text: 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?


title: Wordpress Themes Categories for the Admin pannel

text: 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).


title: Custom wp_list_pages() function

text: 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`?


title: Display categories and their IDs

text: 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


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

text: 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.


title: Create a body div using CSS

text: 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.


title: Hooking into the post editing screen for an existing page only

text: 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


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

text: 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?


title: Can I seperate comments from post?

text: 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?


title: Outputting the blogposts or the_content()

text:
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?


title: How to query wp_postmeta table for any specific meta_value?

text: 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.


title: Shortcode Display From Wordpress Dashboard Page Without Using post_id

text:
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.


title: How to define category ID in an array?

text: 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


title: add_menu_page Callback Function: Skip page content?

text: 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.


title: Private Buddypress community causes white screen on select pages

text: 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.


title: How do you use do_shortcode via AJAX call?

text: 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!


title: Is there a Wordpress core & plugins update action hook?

text: 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)


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

text: 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.


title: Child theme:Loading js files

text: 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


title: Modify wording of bulk options

text: 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;     }


title: Adding footers to posts?

text: 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.


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

text: 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.


title: How to add breadcrumbs to any WordPress theme

text: 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)"


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

text: 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?


title: Odd functions.php issue in Wordpress

text: 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?


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

text: 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?


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

text: 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.


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

text: 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.


title: Comments Pagination as an unordered list

text: 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


title: Hook for post and page load

text: 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 ?


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

text: 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?


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

text: 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.


title: Attach an image to new posts

text: 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);     }


title: ajax request not returning the result

text:
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.


title: Translating images in Wordpress

text: 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?


title: Load mutiple stylesheets inside one IE condition

text: 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


title: How to escape custom css?

text: 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.


title: Add topbar to static html page

text: 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.


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

text: 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!


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

text:
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 :)


title: $wp_query meta_key naming issue

text: 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


title: Create a clickable name in WP_List_Table for Plugin Admin

text:
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


title: How to include admin-ajax when loading external javascript

text: 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?


title: Custom strings for translation using Polylang plugin

text: 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?


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

text: 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


title: How to call WP3.5 Media Library manager?

text: 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!


title: Continue javascript execution when errors occurs

text: 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?


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

text: 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');


title: Importer fails to import every post

text: 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?


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

text: 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?


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

text: _[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">`


title: How to get permalink using get_blog_post function in a multisite?

text: 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


title: Get the most popular terms for a custom post type

text: 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...


title: How to use wordpress default Password Strength Meter script

text: 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`.


title: Custom WP_Query for WordPress Search Results with meta_query

text: I am using a custom query to generate my search results. The code I am using works perfectly without the meta_query variables in my arguments array. I am trying to compare multiple custom fields with 'LIKE'. References to `$per_page` & `$sort_by`               $paged = (get_query_var('page')) ? get_query_var('page') : 1;          $per_page = ($_REQUEST['per_page']) ? $_REQUEST['per_page'] : 15;     $sort_by = ($_REQUEST['sort_by']) ? $_REQUEST['sort_by'] : 'best';      Array for query arguments:               $default = array(         's' =>  $search,                 'paged'     =>  $paged,         'post_type' =>  'page',         'suppress_filters' => false,         'posts_per_page'    =>  $per_page,         'meta_key'  =>  '_wp_page_template',         'meta_value'    =>  'lois_product.php',         'meta_query'    =>  array(             'relation'  =>  'OR',             array(                 'key'       =>  'lois_prodpage_colour',                 'value'     =>  $search,                 'compare'   =>  'LIKE'             ),             array(                 'key'       =>  'lois_prodpage_brand',                 'value'     =>  $search,                 'compare'   =>  'LIKE'             )                                        )     );      Then I just call the arguments as you would expect..               $products = new WP_Query($default);      Loop through etc... So as you can see... pretty simple stuff to be honest. I just cannot work out why it is returning 0 results as I know I have data to match specific terms or a combination.. This is for a custom WP ecommerce website which is integrated with an external EPoS System (I know) Any help/pointers would be great!


title: Different views/roles for administrator

text: I know there are plugins that manage user roles. Is there any plugin that manage user roles/view for the administrators in Wordpress? There are some third party plugins that sometimes have their own menu. What i want to do is i want certain administrators cannot see these 3rd party menus. Is there such plugins?


title: write a post on user registration

text: Looking for a way to automatically write a new post everytime a new user is registered. For example if when user B completes a registration form then a new post is automatically submitted (either by them or by admin) with "User B has joined [site-name]". Is there a way to make a user account automatically post a post when the user registers?


title: Adding paged query to custom URL rewrite

text:
I have set up the following to create 'pretty' post type and category permalinks:               function kdev_add_category_rules() {              $post_types = array(             'kdev_photos',             'kdev_videos',             'kdev_articles'           );              foreach($post_types as $post_type) {             $pt_obj = get_post_type_object($post_type);             $pt_rewrite = $pt_obj->rewrite;             $pt_slug = $pt_rewrite['slug'];                  add_rewrite_rule('^'.$pt_slug.'/category/([^/]*)/?','index.php?post_type='.$post_type.'&category_name=$matches[1]','top');              }          }          add_action( "init", "kdev_add_category_rules" );      This works great. When I visit sitename.com/photos/category/landscape/ I get all the 'photos' in the 'landscape' category. Unfortunately, my pagination on these pages is broken. I would like sitename.com/photos/category/landscape/page/2 to show the second page in this query. Currently it just refreshes the same page. On inspection of the query paged=1. I've tried the following, but my knowledge of regex is poor.               add_rewrite_rule('^'.$pt_slug.'/category/([^/]*)/page/([^/]*)/?','index.php?post_type='.$post_type.'&category_name=$matches[1]&paged=$matches[2]','top');      What is the correct rewrite rule? # Progress Interestingly, removing the first 'add_rewrite_rule' allows the new one to work (but obviuosly breaks all the other rewrites). I.e. /photos/category/test-category/page/2/ will work, but /photos/category/test- category/ won't. # EDIT: Additional info I have refreshed the permalinks loads! On sitename.com/photos/category/landscape/page/2/, `get_query_var('paged')` is returning `1`. /category/test-category/page/2/ and /photos/page/2/ both work. Post types being created using:               // Register Custom Post Type     function custom_post_type() {     $labels = array(         'name'                => _x( 'Photos', 'Post Type General Name', 'text_domain' ),         'singular_name'       => _x( 'Photo', 'Post Type Singular Name', 'text_domain' ),         'menu_name'           => __( 'Photos', 'text_domain' ),         'parent_item_colon'   => __( 'Parent Photo:', 'text_domain' ),         'all_items'           => __( 'All Photos', 'text_domain' ),         'view_item'           => __( 'View Photos', 'text_domain' ),         'add_new_item'        => __( 'Add New Photo', 'text_domain' ),         'add_new'             => __( 'New Photo', 'text_domain' ),         'edit_item'           => __( 'Edit Photo', 'text_domain' ),         'update_item'         => __( 'Update Photo', 'text_domain' ),         'search_items'        => __( 'Search photos', 'text_domain' ),         'not_found'           => __( 'No photos found', 'text_domain' ),         'not_found_in_trash'  => __( 'No photos found in Trash', 'text_domain' ),     );          $args = array(         'label'               => __( 'kdev_photos', 'text_domain' ),         'description'         => __( 'Shared photos', 'text_domain' ),         'labels'              => $labels,         'supports'            => array( 'title' ),         'taxonomies'          => array( 'category', 'post_tag' ),         'hierarchical'        => false,         'public'              => true,         'show_ui'             => true,         'show_in_menu'        => true,         'show_in_nav_menus'   => true,         'show_in_admin_bar'   => true,         'menu_position'       => 5,         'menu_icon'           => '',         'can_export'          => true,         'has_archive'         => true,         'rewrite' => array( 'slug' => 'photos' ),         'exclude_from_search' => false,         'publicly_queryable'  => true,         'capability_type'     => 'page',     );          register_post_type( 'kdev_photos', $args );     }      The site is using the Roots theme which uses Scribu's theme wrapper technique. The first template called is base.php:               <?php if(is_front_page()) {     wp_redirect( get_bloginfo('url').'/photos/', 302 );     exit;     } ?>     <?php get_template_part('templates/head'); ?>     <?php     $post_type_query = get_query_var( 'post_type' );     if(!is_array($post_type_query)) $post_type = $post_type_query;     ?>     <body <?php body_class($post_type); ?>>            <?php         do_action('get_header');         // Use Bootstrap's navbar if enabled in config.php         if (current_theme_supports('bootstrap-top-navbar')) {           get_template_part('templates/header-top-navbar');         } else {           get_template_part('templates/header');         }       ?>

           <div class="main <?php echo roots_main_class(); ?>" role="main">             <?php include roots_template_path(); ?>
           <?php if (roots_display_sidebar()) : ?>           <aside class="sidebar <?php echo roots_sidebar_class(); ?>" role="complementary">
                 <?php include roots_sidebar_path(); ?>
                      <?php endif; ?>

            <?php get_template_part('templates/footer'); ?>                     Which then calls index.php:               <?php get_template_part('templates/page', 'header'); ?>          <?php  $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;  ?>
Currently Browsing Page <?php echo $paged; ?>
          <?php if (!have_posts()) : ?>
         <?php _e('Sorry, no results were found.', 'roots'); ?>
       <?php get_search_form(); ?>     <?php endif; ?>     <?php      $post_type_query = get_query_var( 'post_type' );     if($post_type_query == 'kdev_photos') $use_grid = TRUE; else $use_grid = FALSE; ?>          <?php     if($use_grid) echo '
';      while (have_posts()) : the_post();       if($use_grid) get_template_part('templates/content', 'photo');       else get_template_part('templates/content', get_post_format());       endwhile;       if($use_grid) echo '
'; ?>          <?php     global $wp_query;          $big = 999999999; // need an unlikely integer          $pag_links = paginate_links( array(         'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),         'format' => '?paged=%#%',         'end_size' => 1,         'mid_size' => 1,         'current' => max( 1, get_query_var('paged') ),         'total' => $wp_query->max_num_pages,     ) );          echo '
'.$pag_links.'
';          ?>


title: Different Template based on HTTP Referer

text: He Guys, i've been looking for a way to show a different Page-Template based on HTTP Referer or maybe the User Agent or what ever. I'm planning an Image-Gallery which should be shown in a Fancybox. My Idea is to use a template which contains only the `loop` and all the stuff i need to build the gallery correctly (without any Header and Footer files) and load it in my Fancybox. But what about the Search Engines und Users with disabled JavaScript. They don't see anything or only a page without the Pagecontext like Navi etc. How can i prevent this issue? Any ideas


title: Remove password protection from all posts

text: So I messed up my blog (QBobble). I had an SQL backup, fortunately, so I reinstalled Wordpress, and imported my SQL database. Unfortunately, it password protected all of my posts. I know that I can manually unpassword protect them by going to Posts < Edit and edit the visibility to "public", but I don't want to do that to all of my posts, I want to do it to all of them at once. How can I do that? Someone said that you can do it in Bulk Actions > Edit, BUT changing the status to "public" in bulk actions doesn't work. Any ideas? It also got rid of the excerpts for each post. They now just read NULL. Is there a way that I can get it to add those back automatically? I'm running 3.3.1, by the way. Thanks all!


title: Millions of Rows -- Possible Solutions?

text: I have a custom CMS, that we're looking to port over into Wordpress. (I can see you asking yourself, why not just stick with the custom CMS? Well, it's outdated, clunky, and getting to be too much of a hassle to maintain; there are also many features of WP that we would really like to take advantage of). So here's the issue -- We have a main type of content (let's call them Tours). Each Tour has about 30 pieces of meta data associated with it (all currently different columns on the Tours table). We currently have about 600,000 Tours. Each Tour has several different types of images associated to it, from Interior Images, to Exterior, to Floor Plans, etc. Each Image has about 10 pieces of meta data associated with it (again, all currently columns on the Images table). We currently have about 7 million Images in our system. You can likely see our problem -- if we put all Tours and Images into the default wp_posts and wp_postmeta table, we're going to end up with millions of rows in wp_posts, and far more than that in the wp_postmeta table. I'm not sure how much mySQL can handle as far as numbers of rows, but it seems likely that we will reach a slowdown point, especially when querying the wp_postmeta table. My questions: 1) One possibility we've discussed is only holding "active" Tours in the wp_posts and archiving older Tours to a separate table. Is anyone aware of any plugins that do anything like this? 2) Another possibility is putting the Tours into the wp_posts table, and keeping the Images separate from that. One thing we would really like to use, though, is the Wordpress image uploader. Is there anyway to override where the image data is saved? 3) Any other suggestions of how we might best implement this much data into Wordpress?


title: rating articles for internal purposes

text: We have started with a lot of users who writes articles for the site. We want now rate every article internally for haveing an overview of the users with the best articles. Does someone know a plugin to rate articles internally, so they will not show up on the site, only in the dashboard of WP. Thanks, Tom


title: Static front page as parent of with child pages?

text: I am trying to produce a static front page that has child pages, so that the menu looks like the following: * * * About (static front page, parent page of "CV" and "Address")   -CV (child of "About")   -Address (child of "About")   Other page 1   Other page 2 (parent of "sub 1" and "sub 2")   -sub 1 (child of "Other page 2")   -sub 2 (child of "Other page 2") * * * What works is to use "About" as the parent. My problem is, that "CV" and "Address" are shown in the menu as separate items, not as children of "About", even though their parent-entry correctly says "About". Here's the menu: * * * About (static front page)   Other page 1   Other page 2 (parent of "sub 1" and "sub 2")   -sub 1 (child of "Other page 2")   -sub 2 (child of "Other page 2")   CV   Address * * * What am I overlooking here? Thanks ab bunch!   tef


title: Adding post_type to the query via pre_get_posts, with infinite scroll

text: I'm doing something wrong here. I'm trying to add a custom post type, external-videos, to the main blog query in all instances. It's working in the main blog page _for the first load of posts_ but the custom post type is ignored in subsequent posts loaded by infinite scroll. Only "regular" posts are loaded thereafter. I'm using the wp plugin version of infinite scroll. Here's my function:               // add external-videos to the loop          function add_external_videos_to_query( $query ) {              if ( is_main_query() && is_home() )             set_query_var ( 'post_type', array('post','external-videos') );     }     add_action( 'pre_get_posts', 'add_external_videos_to_query' );      Also, seemingly related - the custom post_type is being ignored by infinite scroll even on the archive page for that custom post type. In other words, on the archive page for "external videos," the first page of "external videos" posts loads, but no further posts of that type load via infinite scroll. Infinite scroll is working correctly for all other archives I've tested. Incidentally I've read Mike Schinkel's reply here and I think i'm using a similar technique, but I'm not sure if i need **`global $wp_the_query`** or not. For another situation, but also trying to get pre_get_posts to fire every query, he said: > Basically what you are looking for is the global $wp_the_query variable > which is set to the value of the main query. It may not be a perfect fit for > 100% of cases but will probably work fine in 99% of cases: >   >   >     add_action( 'pre_get_posts', 'custom_post_count' ); >     function custom_post_count( $query ){ >       global $wp_the_query; >       if ( $wp_the_query === $query ) { >         $query->set( 'posts_per_page', 5 ); >       } >       return $query; >     }; >


title: Combining post categories and link categories?

text: So as to get a single index of both internal posts and external links on the same or related topic/subject matter, is it possible to combine post categories and link categories? I would like to be able to drill down through a single hierarchy, and find all collected information on the topic, whether external or internal to the site. Thanks.


title: wp custom field date format compare

text: How do I possible to work with this code to work with date format Y-n-j Value               start_date = 2011-1-20     end_date   = 2011-1-30      Here are the original function came from this Query between two meta values?               function date_check_join( $join ) {         global $wpdb;         $join .= " JOIN ".$wpdb->postmeta." AS startdate ON              (".$wpdb->posts.".ID = startdate.post_id AND             startdate.meta_key = 'start_date')             JOIN ".$wpdb->postmeta." AS enddate ON              (".$wpdb->posts.".ID = enddate.post_id AND             enddate.meta_key = 'end_date')";         return $join;         }          function date_check_where( $where ) {         $today = date('Y-n-j'); /* I change this format to date('Y-n-j')*/         $where .= " AND startdate.meta_value <= $today         AND enddate.meta_value >= $today";         return $where;         }      This function is working with `UNIX TIME STAMP date('Ymd')` and when I change date format it doesn't work with `date('Y-n-j')` credit @goldenapples


title: Multiple auto-generated image slideshows/sliders on each (custom) post?

text: I'm working on a site for a client, which will have a custom post type (homes). I'd like the client to be able to add new posts, which would ideally include multiple pictures, in different 'categories', for each home (i.e. initial construction, finish work, completed home). Each different category would then get its own slider on that 'post'. I've considered using something like the Premium Slider plugin, which offers multiple sliders, and includes a metabox on each post, but it would definitely need to be modified to fit my requirements. Any ideas on the best way to go about doing this?


title: Display thumbnail only if requested size exists

text: When I use the functions that get and output the post thumbnail, they will display the requested thumbnail in the size you specify, but if this size doesn't exist they will display the thumbnail in the original size and force the browser to resize it. How can I force them to display a placeholder like "no image" in case the requested size doesn't exist?


title: Comment formatting with comment_content

text: I'm displaying a comment outside the comment template, getting it with `get_comments()` and echoing the `comment_content`. My problem is that the comment loses the formatting (paragraphs, line breaks, etc...). In my template I'm using TinyMCEComments (TinyMCE on comment form). Someone pointed me to this solution, but is not working for me.               <?php echo wpautop($comment->comment_content);?>


title: Custom Taxonomy as Dropdown in admin

text: I’ve created a custom post type (called Sponsors) with an additional taxonomy connected to it, called “Type”. Everything is essentially working perfectly but I would very much like to have my taxonomy “Type” to be a dropdown menu instead of the usual “type and search or create a new”. The reason is, that I’ve created six different “Types” in the taxonomy and the people which are going to create new “sponsors” should only need to select one of those six for each new Sponsor post. I’ve tried some tutorials and some guides found by Google but none which has yet to work. The custom post type and the custom taxonomy is created by the plugin “Custom Post Type UI”. What I tried so far is this:               add_action('restrict_manage_posts','my_restrict_manage_posts');                  function my_restrict_manage_posts() {                 global $typenow;                      if ($typenow=='sponsors'){                              $args = array(                                  'show_option_all' => "Show All Categories",                                  'taxonomy'        => 'type',                                  'name'               => 'type'                                   );                     wp_dropdown_categories($args);                             }             }     add_action( 'request', 'my_request' );     function my_request($request) {         if (is_admin() && $GLOBALS['PHP_SELF'] == '/wp-admin/edit.php' && isset($request['post_type']) && $request['post_type']=='sponsors') {             $request['term'] = get_term($request['type'],'type')->name;              }         return $request;     }       And this               add_action( 'restrict_manage_posts', 'my_restrict_manage_posts' );     function my_restrict_manage_posts() {              // only display these taxonomy filters on desired custom post_type listings         global $typenow;         if ($typenow == 'sponsors' || $typenow == 'type') {                  // create an array of taxonomy slugs you want to filter by - if you want to retrieve all taxonomies, could use get_taxonomies() to build the list             $filters = array('title_sponsor', 'platin-sponsor', 'guld-sponsor', 'diamant-sponsor');                  foreach ($filters as $tax_slug) {                 // retrieve the taxonomy object                 $tax_obj = get_taxonomy($tax_slug);                 $tax_name = $tax_obj->labels->name;                 // retrieve array of term objects per taxonomy                 $terms = get_terms($tax_slug);                      // output html for taxonomy dropdown filter                 echo "<select name='$tax_slug' id='$tax_slug' class='postform'>";                 echo "<option value=''>Show All $tax_name</option>";                 foreach ($terms as $term) {                     // output each select option line, check against the last $_GET to show the current option selected                     echo '<option value='. $term->slug, $_GET[$tax_slug] == $term->slug ? ' selected="selected"' : '','>' . $term->name .' (' . $term->count .')</option>';                 }                 echo "</select>";             }         }     }      But as I said, none which has worked. Any help or suggestions would be very much appreciated. Thanks   Sincere   \- Mestika


title: Custom loop off by one post

text:
Within my loop I want to display 9 posts that exclude categories X, Y, Z and all sticky posts. Between post 3 and 5 I would like to place a sticky post with a custom template. The below works except that it treats the sticky post as the 4 post from the first loop which results in one regular post missing. I have to use WP 3.0.3               <?php if (have_posts()) : ?>         <?php $count = 0;?>         <?php           $sticky_posts = get_option('sticky_posts');           $arguments = array(               'posts_per_page' => 9,               'post__not_in'  => $sticky_posts,               'category__in'  => array(1,2,3,4,5)           );         ?>         <?php query_posts( $arguments );?>              <?php while (have_posts()) : the_post(); ?>                  <?php $count++; ?>                  <?php if ($count == 4) : ?>                      <?php                   $sticky = get_option('sticky_posts');                   $args = array(                       'posts_per_page' => 1,                       'post__in'  => $sticky                   );                   ?>                   <?php query_posts( $args );?>                        <?php while (have_posts()) : the_post(); ?>
Latest Sticky Post
                   <a href="<?php the_permalink(); ?>"><?php the_title(); ?>                   <?php the_excerpt(); ?>                        <?php endwhile; ?>                   <?php wp_reset_postdata(); ?>                  <?php else : ?>
Regular Post
                 <a href="<?php the_permalink(); ?>"><?php the_title(); ?>                 <?php the_excerpt(); ?>                  <?php endif; ?>         <?php endwhile;  ?>     <?php endif; ?>


title: Show Message By Tag ID for custom post types

text: In single.php i need to have some conditionals that ask what Tag the post is in so i can display a message, not sure how to do this, but this is the idea: if post related to tag ID '2' say "hello dude elseif in Tag ID '3' say "proper bo" or else "nothing to say" **taxonomy = my_entries** **post_type= myposts** I need to check if post related to TAG ID "2" Then it show a certain message If post in TAG ID "3" then it show another certain message else Nothing


title: Change permalink based on post category

text: I am looking for a way to change the permalink structure based on the category a post is in. If the post is in the "blog" category I would like the permalink to be /blog/%postname%/ and if it is any other category just /%postname%/. There used to be a plugin called Advanced Permalinks that could do all of this for you but it is no longer supported. I have researched the topic and can't seem to find a good way to code this myself or any plugins that get the job done. Any help or suggestions would be appreciated.


title: Get threaded comments number

text:
I'm using Greg's Threaded Comment Numbering plugin to number the comments. Actually I'm displaying a number beside of each parent comment (no threaded comments numbers). I have 2 problems that I have already tried to solve, but without results:   * I am displaying the top comment with a different layout, I need to start the numbering from #2. seems an easy task but I didn't find the way modifying the plugin code.   * Display the total number of threaded comments for each comment that has threads.  Example: COMMENT 1 \------------1.1 \------------1.2 \------------1.3 total threaded comments = 3 COMMENT 2 \------------2.1 \------------2.2 total threaded comments = 2 etc..... I am already using the code below to get the total number of parents. I can also get the children but it is the total, I need to display the number of each comment children as in the example               $number_of_parents = c_parent_comment_counter($post->ID);     $number_of_children = $post->comment_count - $number_of_parents;      Thanks! EDIT: as requested here is the wp_list_comments callback function. Sorry for the mess, I am not a programmer, will clean the code when the work is finished :)               ## Function: Basic Callback Function From WP Codex (http://codex.wordpress.org/Template_Tags/wp_list_comments), January 2009     function gtcn_basic_callback($comment, $args, $depth) {     // no changes here except that we have added in the call to gtcn_comment_numbering        $GLOBALS['comment'] = $comment;                   ?>        <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">        <?php   if( empty( $comment->comment_parent ) ) { //if the comment does not have a parent, then it is L1?>
<?php  echo gtcn_comment_numbering($comment->comment_ID, $args);                       ?>
                             <?php   }              ?>               <div id="comment-<?php comment_ID(); ?>">

                 <?php if( empty( $comment->comment_parent ) ) { ?><?php echo get_avatar($comment,$size='60'); ?><?php } else { ?><?php echo get_avatar($comment,$size='30'); ?><?php } ?>

<?php printf(('%s '), get_comment_author_link()) ?>
                     <?php if( empty( $comment->comment_parent ) ) { ?>

<img src="<?php bloginfo('template_url'); ?>/images/ico-points.png" />3333

<img src="<?php bloginfo('template_url'); ?>/images/ico-level.png" />livello

      <?php } else { ?><?php } ?>
                 <?php if ( is_user_logged_in() ) { if( empty( $comment->comment_parent ) ) {?>

Vota la risposta:
                      <?php    { //if the comment does not have a parent, then it is L1                         if(function_exists(ckrating_display_karma)) { ckrating_display_karma(); }                         }              ?>
                 <?php }} else {                           if( empty( $comment->comment_parent ) ) { ?>

Registrati per votare

                 <?php }}  ?>

           <?php if ($comment->comment_approved == '0') : ?>              <?php _e('Your comment is awaiting moderation.') ?>
           <?php endif; ?>                     <?php comment_text() ?>
              <?php comment_reply_link(array_merge( $args, array('reply_text' => 'COMMENTA LA RISPOSTA', 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>

<?php if( empty( $comment->comment_parent ) ) { ?>Risposta inserita<?php } else { ?> Commento inserito <?php } ?>                 <?php echo time_ago_comment(); ?><?php edit_comment_link(('- modifica'),'  ','') ?>

          <?php     } // end basic callback function


title: CPT Main Loop Pagination in single.php

text:
I have a CPT single template (single-work.php) where I need to repeat the loop of posts found in the main loop (archive-work.php). I am using the same loop code in both templates (as well as front-page.php, all working except for single-work.php):               <?php              if ( get_query_var('paged') ) {             $paged = get_query_var('paged');         } else if ( get_query_var('page') ) {             $paged = get_query_var('page');         } else {             $paged = 1;         }              $args = array(             'post_type' => 'work',             'posts_per_page' => 8,             'paged' => $paged,             'orderby' => 'menu_order',             'order' => 'ASC'         );              $wp_query = new WP_Query($args);              if( $wp_query->have_posts() ) :                  while( $wp_query->have_posts() ) :                      $wp_query->the_post();                      get_template_part('assets/loops/loop', 'work');                  endwhile; // end while posts                  echo '
';                 next_posts_link('Older');             echo '
';              endif; // end if posts              wp_reset_query();          ?>      The reason for only a next_posts_link(); is because I'm intending to use infinite scroll to pull in the posts, eliminating the need for a previous_posts_link(); For testing purposes however, infinite scroll is disabled. The href for the "Older" link shows "http://example.com/work/the-newest- post/page/2/", but clicking the "Older" link simply refreshes the page. With infinite scroll enabled, the same 8 posts just keep getting repeated over and over. Is there any way that I can achieve proper pagination in a single template? Thanks, **Update:** I should also note that I have tried using:               $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;      but, sadly, this too does not work :(


title: Responsive Theme Design: how have slideshow on desktops/tablets and static photo on mobile using same template?

text: I am building my first responsive WP site with my own custom WP Theme. The primary templates are part fluid, part fixed. This enabled me to create only 3 "versions", a desktop, tablet and mobile version. All changes happen due to media queries. (Sizes are 768 to 1200 px for desktop, 530 to 767 for tablet, 300 to 529 for mobile.) The homepage (which has it's own template) will show a slideshow. The slideshow claims to be responsive (I haven't set it up yet) and I am anticipating it working through the tablet sizes. But when I get to the mobile size I just want to have a static photo. I don't want to just use "display:none" for the slideshow as it will still eat up space/power for the mobiles. I DO want to keep all the versions on the same templates, so I'm thinking I'm going to need some php or javascript to make this happen. (Unless there's some other way, which I'd be thrilled to hear about!) Can anyone help with the code? I have a slideshow div in the CSS:               #slideshow {      height: 296px;      margin: 20px 20px 10px 20px;      padding: 0;     background-color: #f00;     }/*by not setting a width the sshow box fills the space minus the margins*/      and in the template the slideshow shortcode or template code will go between the open and close slideshow div tags. But I would also want to place a photo there for the mobile version. So I think I would need some kind of "if 529px or more, get slideshow; if less, get photo" right? I'm not a php or javascript programmer, tho I'm great at cutting and pasting! The site is viewable at http://66.147.244.110/~rdbikeco/ \-- we are now at the stage of adding page content and the blog needs attention and the sidebars need work, etc. But shell pages are up and content is getting loaded as I write. Help greatly appreciated!


title: Cron jobs repeating themselves

text: If I have a function set to run every 5 minutes via a WP cron job, and I have only one visitor during a day, does his visit trigger just one run of that function or all the runs that have been amassed since the last visit? The cron job I have runs a function that fetches feeds from another site.


title: I have a custom post type with many posts. How do I split the list into multiple pages?

text: I have about 100 posts, and I want to create pages that only show 10 on each. How would I go about this?


title: Responsive Images - Generating multiple images from Theme Customizer control upload?

text: So, after poking around in the code it looks like the filter `image_make_intermediate_size` is not called by the various `WP_Customize_Control()` classes at either `WP_Customize_Image_Control()` or it's parent `WP_Customize_Upload_Control()`. I'm looking to auto-generate images of various sizes, for responsive image serving and I need to execute the `image_make_intermediate_size()` function with some custom sizes that are specific to my extended custom control. Just not sure how to ensure that the uploaded images call this function mainly because I haven't been able to track down where or how the upload functionality of `WP_Customize_Control()` is "unhooked" from the default upload behavior where the function is normally executed. Note that the way it works is obviously the best option, don't want every image uploaded through the theme customizer to auto-generate all the default image sizes, but for my use case, I prefer to use native functionality and just pass some unique size paramters to `image_make_intermediate_size()`.


title: load more posts by category

text: Well as you can see here im doing a load by category in every tab i have and show a total posts of 10 by each tab i want to setup once the 10 posts are done. i want to add a load more button to the bottom of the 10 posts i have done that but the viewer has to see the rest of the posts else where for a specific category so i want to show more posts by that category by staying in that same page loading more posts in that tab. this is what i do to display each tab by category & by total posts                <?php      $rightbox = get_posts('&cat=8&showposts=10');      foreach($rightbox as $post) :         setup_postdata($post); ?>      i hope someone can help me out Here's the entire code from a tab http://pastie.org/7731669 thanks


title: Post not showing up sometimes on website

text: I have a weird problem. A particular post is not showing up on my website sometimes. So If I clear cache then it shows up. It is happening only to one particular post. I am not able to figure out what the problem can be. **Off-topic** : That particular post is kind of controversial too. So I have a feeling that someone is trying to bring it down. Any help would be highly appreciated.


title: How to Separate CPT From Regular Posts?

text: I'm just starting to populate my CPT. I want to keep it separate from regular posts. But when I go look at regular posts (in the `single.php` template), the Prev/Next nav includes CPT posts. Interestingly, CPT posts do _not_ appear on the home page list. UPDATE: I'm using the `get_previous_post_join`, `get_previous_post_where`, `get_previous_post_sort` filters, and their next counterparts. These seem to be affecting all navigation. How do I constrain them to only affect the desired pages? UPDATE 2: So made code changes as described in my own answer below (encapsulated the get_previous/next_post_* filters in a function, which I called from the CPT single template, before the loop. This is the code in the plugin:                    function aaaConsultant_set_nav_filters() {             add_filter('get_previous_post_join', 'aaaConsultant_get_previous_post_join_custom_sort');             add_filter('get_previous_post_where', 'aaaConsultant_get_previous_post_where_custom_sort');             add_filter('get_previous_post_sort', 'aaaConsultant_get_previous_post_sort_custom_sort');                  add_filter('get_next_post_join', 'aaaConsultant_get_next_post_join_custom_sort');             add_filter('get_next_post_where', 'aaaConsultant_get_next_post_where_custom_sort');             add_filter('get_next_post_sort', 'aaaConsultant_get_next_post_sort_custom_sort');         }              function aaaConsultant_get_previous_post_join_custom_sort($join) {             global $wpdb;             return "INNER JOIN {$wpdb->prefix}postmeta ON (p.ID = {$wpdb->prefix}postmeta.post_id)";         }         function aaaConsultant_get_previous_post_where_custom_sort($where) {             global $wpdb, $post;             $meta_value = get_post_meta($post->ID, 'aaaConsultant_dateofletter', true);             return "WHERE 1=1  AND p.post_type = 'refletter' AND p.post_status = 'publish' AND {$wpdb->prefix}postmeta.meta_key = 'aaaConsultant_dateofletter' AND {$wpdb->prefix}postmeta.meta_value < '{$meta_value}'";         }         function aaaConsultant_get_previous_post_sort_custom_sort($sort) {             global $wpdb;             return "ORDER BY {$wpdb->prefix}postmeta.meta_value DESC LIMIT 1";         }              function aaaConsultant_get_next_post_join_custom_sort($join) {             global $wpdb;             return "INNER JOIN {$wpdb->prefix}postmeta ON (p.ID = {$wpdb->prefix}postmeta.post_id)";         }         function aaaConsultant_get_next_post_where_custom_sort($where) {             global $wpdb, $post;             $meta_value = get_post_meta($post->ID, 'aaaConsultant_dateofletter', true);             return "WHERE 1=1  AND p.post_type = 'refletter' AND p.post_status = 'publish' AND {$wpdb->prefix}postmeta.meta_key = 'aaaConsultant_dateofletter' AND {$wpdb->prefix}postmeta.meta_value > '{$meta_value}'";         }         function aaaConsultant_get_next_post_sort_custom_sort($sort) {             global $wpdb;             return "ORDER BY {$wpdb->prefix}postmeta.meta_value ASC LIMIT 1";         }      And this is the code in the template:               <?php      aaaConsultant_set_nav_filters();     if (have_posts()) : while (have_posts()) : the_post(); ?>      The problem is that regular posts show up in single.php, but the nav goes back to the beginning of the list of posts, and does not traverse the entire list. Not sure what this is caused by. Will try to deactivate plugin and see what gives. Also, in a quandary as to whether this should go in a new question, or get added to this one, as it's clearly an effect of the nav changes. (Well, "clearly" is yet to be proven, I suppose.) UPDATE 3: So, deactivated plugin, and still having issues with nav in regular posts. These were just generated through the Demo Data Creator. But then I made some manual changes to the wp_posts and wp_postmeta tables when I decided to rename the CPT. So these issues may be a result of that messing about. I'm thinking I'll strip out the generated posts and regenerate. UPDATE 4: Yes, regenerating the posts seems to have fixed the issue. We'll put it down to my own awkward database manipulations. Not sure whether we want to strip out updates 3 and 4 (and perhaps a bit off Update 2, as well). I'll leave that to the StackExchange sages.