Image limit from 1 to 5

I found this code posted by: MikeSchinkel some time ago have a question how to change this code that i will be able to upload max 5 pictures insteed of 1 ? :)                   add_filter('wp_handle_upload_prefilter', 'yoursite_wp_handle_upload_prefilter');     function yoursite_wp_handle_upload_prefilter($file) {       // This bit is for the flash uploader       if ($file['type']=='application/octet-stream' && isset($file['tmp_name'])) {         $file_size = getimagesize($file['tmp_name']);         if (isset($file_size['error']) && $file_size['error']!=0) {           $file['error'] = "Unexpected Error: {$file_size['error']}";           return $file;         } else {           $file['type'] = $file_size['mime'];         }       }       list($category,$type) = explode('/',$file['type']);       if ('image'!=$category || !in_array($type,array('jpg','jpeg','gif','png'))) {         $file['error'] = "Sorry, you can only upload a .GIF, a .JPG, or a .PNG image file.";       } else if ($post_id = (isset($_REQUEST['post_id']) ? $_REQUEST['post_id'] : false)) {         if (count(get_posts("post_type=attachment&post_parent={$post_id}"))>0)           $file['error'] = "Sorry, you cannot upload more than one (1) image.";       }       return $file;     }


Wordpress ping spam issue with Ping services?

My client wants me to install a plugin from here: http://www.maxblogpress.com/plugins/mpo/ that optimizes how WP pings. If you read the article, the version he mentioned were 2.1 and 2.3, if I am not wrong. Does this issue still exist?


using upload image with media_handle_upload .. but !

I'm tring to upload image in wordpress by using some function .. I found the way to upload images but there are one problem .. when the user upload his image , wordpress create more than one image diffrent sizes, this is a problem because I want one image only .. this is wp-conent/uploads/2010/10 folder .. look at the picture (this is one picture but wordpress create same picture but diffrent sizes) . http://i.stack.imgur.com/fn6ab.jpg this is my code               <?php /*     Template Name: Uploading Page          */?>          <?php get_header();     ?>

         <form id="file-form" enctype="multipart/form-data" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="POST">
         upload         <input type="file" id="async-upload" name="async-upload"> <input type="submit" value="Upload" name="html-upload">

         <input type="hidden" name="post_id" id="post_id" value="<?php echo '212';?>" />         <?php wp_nonce_field('client-file-upload'); ?>         <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />

         <input type="submit" value="Save all changes" name="save" style="display: none;">
         </form>          <?php     if ( isset( $_POST['html-upload'] ) && !empty( $_FILES ) ) {         require_once(ABSPATH . 'wp-admin/includes/admin.php');         $id = media_handle_upload('async-upload', 1199); //post id of Client Files page         unset($_FILES);         if ( is_wp_error($id) ) {             $errors['upload_error'] = $id;             $id = false;         }              if ($errors) {             echo "
There was an error uploading your file.
";         } else {             echo "
Your file has been uploaded.
";         }     }          get_sidebar();     get_footer();?>      how can make it one picture? I wish you understand me ^_* because my language >_<


How to import WP XML file automatically on installation?

I'd like the user to install WP and have the default content loaded automatically but i don't want to have to write in in PHP in the wp_install_defaults(); I'd much rather export an xml file each time i make a change to the default and just bundle that with the install. Thanks.


Replacing the default content created while the site creation

How do you replace the default title for first comment? **Mr WordPress on Hello world!** I could not able to locate this in theme's comments.php file I want to edit the title 'Mr wordpress on Hello world' to Admin on -Site Name- * * * How can I replace the default text created with about us page? _This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress._ to It is the page about your self.Feel free to edit the page * * * Some times I cannot able to locate certain content(As I mentioned above comment.php and default about us page) in core files when perforimg search .is there any way to find certain content or code overall? * * *


Problem with viewing single page correctly. (taken half way down the page on click through)

I have a strange situation occurring with a website that I am currently developing. On the main articles page at http://wptest.lancscps.co.uk/articles/ when the user clicks on the continue reading link to view the single page based on the single-article.php, we end up halfway down the page which isnt the desired effect. I would prefer the user to be taken to the top of the page as one would expect. Has this happened to anyone else and are there any known reasons for this?


How do I create a Custom Post Box that Connects Different Posts Together

In WordPress, I'm trying to create a Custom Post Box that will allow one post to be manually connected to another post. The easiest way to illustrate this request was to mockup what I would like the final Post Box to look like. That mockup can be viewed here » http://cl.ly/3hI3 **Requirements:**   * The Post Box needs to resemble the "Categories" Post Box, in that it has tabs at the top and checkboxes.   * Each tab at the top of this Post Box needs to be a Post Category (as illustrated in the mockup.) If I could manually control this so that the tabs were managed by a Custom Menu (ie. "Post Connections Menu"), that would be ideal.   * The checkboxed list of items needs to be posts that have already been categorized to that specific category. Thank you very much for any help / insight you can throw my way!


Changing the comments link produced by the get_comments_link() and get_comments_pagenum_link() functions

Currently my theme calls upon `get_comments_link()` to create the standard anchor **#comments** to link to the comments below the post, as does the `get_comments_pagenum_link()` function on paginated comments. I would like to replace the **#comments** anchor in these functions with any other string, without of course changing WP's core php files. A simple `add_filter` to completely replace core functions (other than in pluggable.php) doesn't seem to be possible. Are there any other ways of achieving this small change to the output of a core function, that use PHP (rather than say Java)? Is there a way here of using an `add_filter` with `str_replace()` perhaps? This will be useful for foreign language sites, and for redirecting comments to another page with a url request, for example.


Custom post type paging 404 error

I've an issue on custom post type, I've create a custom post type called "Agenda" and the rewrite url for http://example.com/agenda it works correctly, it points to the archive-agenda.php template but for http://example.com/agenda/page/2 it shows 404 error, what do you suggest me? The code that I've used to add the custom post type is:                <?php     function create_event_type() {         $event_args = array(             'label' => __('Agenda'),             'singular_label' => __('Evento'),             'public' => true,             'show_ui' => true,             'capability_type' => 'post',             'hierarchical' => false,             'rewrite' => true,             'has_archive' => true,             'publicly_queryable' => true,             'show_in_nav_menus' => true,             'query_var' => true,             'supports' => array(                 'revisions', // (will store revisions)                 //'page-attributes', // (menu order, hierarchical must be true to show Parent option)                 'title',                 'editor')         );         register_post_type('agenda', $event_args);     }     add_action('init', 'create_event_type');     ?>      Thanks in advance!


Count posts within a custom post type and specific category

I'm looking to count how many post live within the custom post type called "videos", but only the ones from the category called "work".               <?php $count_posts = wp_count_posts('videos'); echo $count_posts->publish; // ?>      How can I adjust the above code to accomplish this? Thanks!


Show Post ID in "Find Posts or Pages" box in Media Library?

In the Media Library, when I go in to attach a media item to a post, I know I can use "Attach" to pull up the "Find Posts or Pages" pop up. This brings the following list of post title, date and status.   ![find posts or pages results](http://i.stack.imgur.com/PBtRH.png) I wonder if there is a way to have the results show the post ID as well? It might have something to do with the `find_posts_div` function, but I'm not sure how to apply the proper filters.


the_meta - no get_the_meta query?

I want to use `the_meta` as though it were `get_the_meta`. I want to do this because when i use `the_meta` in my `functions.php` file (I'm using a shortcode to enter data to pages), it posts the meta information to the top of the post as opposed to where I want it. I have tried `get_the_meta`, but it doesn't seem to work and instead, it returns an error because it's obviously not a valid query.


using wp_enqueue_script to attach jquery-ui

I am trying to load jquery-ui using wp_enqueue_script. I can check that jquery is loaded. jquery-ui is registered i.e. output of var_dump( wp_script_is( 'jquery-ui-tabs', 'registered' ) ); is bool(true) which indicates it is registered but it does not get included to the page. I am using wordpress version 3.3.1 What is going wrong? I am attaching the relavant snippet from functions.php from my theme.               <?php     function my_scripts_method() {       wp_register_script('jquery');       wp_register_script('jquery-ui-core');       wp_register_script('jquery-ui-tabs');     }     add_action('wp_enqueue_scripts', 'my_scripts_method');     ?>


Date not displaying in category post

I am not able to get the date to display for posts listed in a category using [catlist] tag. I use the parameter 'date=yes'. The time displays, but not the date. I have checked the list-category-posts/list_cat_posts.php and found the 'get_the_time' function, but cannot figure out how to get the date to display, not the time?? Please help.


How does wordpress link page templates to individual pages

According to the Codex docs, wordpress uses the query string and the template hierarchy to determine which template to use for a certain page. > First, WordPress matches every Query String to query types — i.e. it decides > what type of page (a search page, a category page, the home page etc.) is > being requested. Templates are then chosen — and web page content is > generated — in the order suggested by the WordPress Template hierarchy... However, using Dashboard settings, you can hand pick templates for pages: ![screenshot of dashboard page attributes](http://i.stack.imgur.com/wFw8Z.png) So, in this case, how does the Wordpress engine determine this, and where is the information stored?


Conditional IF statement not returning true even though echo of $user->province is correct

I am having a problem with an if statement which I have now tested many times over.                       $user_query = new WP_User_Query( array( 'role' => 'Subscriber' ) );                  if ( !empty( $user_query->results ) ) {                 foreach ( $user_query->results as $user ) {                          echo $user->province . '
'; // this outputs the province as expected, i.e. Free State                               if ($user->province == 'Free State') { // This does not return true, even though the echo above works                         echo '' . $user->company_name . '
';                         echo $user->town. '
';                         echo $user->province. '
';                     }                       } else {                 echo 'There are currently no photographers for this region.';             }      } I basically only wanting to show photographers in a certain province. Many thanks.


Get search.php results in header.php?

I want one image in header.php to change for different pages. The function in header.php looks like that:               if(is_archive()):       //change image to "Archives"     endif;     if(is_404()):      //change image to "404"     endif;      Now, is it possible to check if page is the search page AND what's the search string AND how many posts were found? So what I want to do is basically:               if(is_search()):      //change image to "Search" AND echo %s     endif;     if(is_search_empty()): //yes I made this up      //change image to "Nothing found" AND echo $     endif;      Is it even possible outside the search.php page loop?


what is the best and safest way to allow users to register to site

I'm wanting to allow users to register to my wordpress site. What is the best and safest way to implement this? The ultimate goal is to give the users the option to subscribe to alerts when updates are made to the site. Thanks,


Individual rss feed entry length for categories?

I know how to retrieve the rss2 feed from a category in wp, namely adding `/feed` behind the category name. However when I do this, not all entries from that feed are included in the rss, this is because I set the feed restriction to be 50 at the admin backend. I would like to know if a feed length could be set indiviually for each category/feed programatically. I could not find any api settings for the size of the feeds ... any help is welcome here. Thanks for your help.


allow previews outside wordpress folder (Outsourcing WP previews)

I am outsourcing the wordpress and I already figured out the external view. I even know how to make a WP query for previews, but when I want to do that I simply cant - wp-load stops all operations and I get something like "You do not have permission to preview drafts" - any idea what might cause that? (Its the same hosting, and I am correctly logged in.) - so my guess is that wordpress checks for some part of REQUEST_URI ? How to fix this ?


How to remove post redirects

I recently installed a plugin called "Q and A FAQ and Knowledge Base for WordPress" Turns out it was lacking in the features I needed so I trashed every faq I had created and then deactivated the plugin. I have since gone and created a post with the same name/url (i.e. /faqs) BUT when I access the /faqs URL is displays all the faq posts that I have previously deleted? How can I make sure that nothing to do with faqs still shows up? How can I permanently remove the redirect to /faqs which displays the old faqs and make it show my new page?


Edit html for menu items in default frontend menu

I am running Multisite, and would like to be able to append menu items to all frontend menus on all sites. This should work for menus saved via the admin interface as well as the default menu that is displayed. This code works for saved menu items, but not the default menu:               add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 );          function your_custom_menu_item ( $items, $args ) {         $items .= '
my menu item
';         return $items;     }      **So my question is, how can I achieve functionality similar to that in the code above for the default front end menu?** Ideally, I would be able to prepend/append the generated html for the menu items **regardless of how they were generated** (saved menu / default menu). **Alternatively** , any information about how WP generates the default menu would be helpful. I can say that the wp_nav_menu_times filter is not even triggered with the default menu. The function `wp_nav_menu` in `wp_includes/nav_menu_template.php` that applys the filter returns early (before most work including the application of filters) if no menu is found by `wp_get_nav_menu_object`.


How to disable Vary cache header on W3Total Cache plugin

I've hired incapsula.com performance services for my wordpress blog, and one of their techs is telling me this about the performance of my website: > On important note, yoursite.org returns the **Vary caching header on User- > Agent**. **This will reduce caching and acceleration performance** > dramatically (!!!). Why are you using Vary on User Agent for images? Is it > possible to disable it? As I use W3 Total Cache, I guess this 'Vary on User Agent for images' was activated by this plugin. My question: How can I deactivate this 'Vary on User Agent for images' from W3TC that this tech is talking about? I tried to find such an option but can't find it inside W3TC menu. I appreciate any light on this. Thanks a lot.


I'm not able to get RSS feed working. I get 'XML parsing failed'

After I updated my site, I'm not able to get the RSS working. I used to get this RSS icon in the address bar in my web browser (opera), but now it's not there any more. I try accessing the following URL: http://www.norwegianfashion.no/feed/ But I only get this error message:               XML parsing failed     XML parsing failed: syntax error (Line: 3, Character: 0)            1:        2:        3: <?xml version="1.0" encoding="UTF-8"?>       4: <rss version="2.0"       5:    xmlns:content="http://purl.org/rss/1.0/modules/content/"       6:    xmlns:wfw="http://wellformedweb.org/CommentAPI/"      Testing it in a feed validator, is says I have a blank line at the start of the file.   Clicling he help link, says that Wordpress has a tendency to create empty spaces :( Does this mean I have to go through each template file, include file and plugins and remove the `?>` at the end? Anything else that could cause my problems?


Why do sticky posts show in this menu?

The code below writes out a list of the most recent posts. However, it does not appear to be skipping over sticky posts although I'm using 'post_not_in' => get_option('sticky_posts'). What am I missing?               <?php     $cat=get_cat_ID('top-menu');      $catHidden=get_cat_ID('hidden');     $myquery = new WP_Query();     $myquery->query(array(         'cat' => "-$cat,-$catHidden",         'post_not_in' => get_option('sticky_posts')     ));     $myrecentpostscount = $myquery->found_posts;          if ($myrecentpostscount > 0)      { ?>

Recent Posts

     <?php     global $post;     $current_page_recent = get_post( $current_page );     $myrecentposts = get_posts(array('post_not_in' => get_option('sticky_posts'), 'cat' => "-$cat,-$catHidden",'numberposts' => $cb2_recent_count));     foreach($myrecentposts as  $idxrecent=>$post) {         ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
     <?php     }     ?>


Programatically creating image attachments from local URLs and setting featured image

I'm currently working on importing an MovableType blog into WordPress. The blog has several thousand posts, and each post has an image associated with it. The export file contains references to each image as follows (and as expected):               <img src="http://domain/path/to/image">       I've got all the images, and have rewritten all the links in the export file to use the new (local) location. However, the WordPress import process doesn't actually create attachments for the post, which I need. So - what's the best way of doing this - right now I'm thinking about iterating through the set of posts, parsing out any image urls, and creating new posts:   * post_parent = the actual post   * post_type = attachment **Questions**   * Is `post_guid` the image location reference? Or is the path to the image stored somewhere else?   * Where is featured image set?   * Is this the best way of doing this? [I've tried using the cache-image plugin, but it borks on the number of posts / images]


Remove the "View" Link in Post Admin

I have a custom post type that I'm just using just to keep data in but I sometimes share it with others, and I don't want any confusion when the "view" link appears in the admin column. Is there a way of removing that? ![http://img.skitch.com/20110421-des28mtj4br3aeyfxnypnkghsy.jpg](http://img.skitch.com/20110421-des28mtj4br3aeyfxnypnkghsy.jpg)


Custom login form

I am very new to WordPress. I am trying to display a login form in the header section of my website. However, when I look at all of the files in my directory it is very overwhelming and I am afraid to touch anything. Does anyone know of any good tutorials on the topic or perhaps shed some light on the issue?


Is a user_meta research case-sensitive or not

I am using the Wordpress get_users() function to search for users with a specific meta_key value.               $wordpress_user = get_users( array('meta_key' => 'unique_id',                                         'meta_value' => 'unique_id_value') );      According to the result of the preceding, I am performing the creation of a new wordpress user, or if the user already exists, I am simply logging in that user. The 'meta_key' is about 10 character's length, with letters and number and i am retrieving it from an external source : for more secure behaviour, I would like to know if the get_users function will use case-sensitive research. (If not I have a potential risk in the future that I retrieve 2 similar meta_key, with an upper case / lower case difference...) In addition I have noticed all wordpress table, including wp_users_meta do have "_ci" so that is an additional reason why I do not feel secure with my present code. Thank you in advance if you can provide me some information about that !


get_next_posts_link() stops displaying at page 4

Please start by taking a look at this quick video: http://www.screenr.com/8vSH **The problem:** `get_next_posts_link()` disappears on page 4. That is, the "go to older posts" link disappears once I am in `&paged=4` of my blog. However, I can manually type eg. `&paged=5` and I do get the fifth page's posts (which means, the posts are there, but the `get_next_posts_link()` is just not showing up). **So..**   * Printing my total posts-number returns the correct amount (33), which tells me that all my posts are being queried properly.   * The posts and blog-pages are working properly (i.e. I can type &paged=5 or 6 or so on), and I do get that specific blog-page with the corresponding posts.   * I have also tried `next_posts_link()` to no avail. **The current code looks like this:**               echo '

'.get_next_posts_link($pagi_older_text, 0).'

'.get_previous_posts_link($pagi_newer_text).'

';      Thank you! **The posts query**               get_header();          $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $blogcats = $era_opts['era_opts_blog_thecats'];     if(!isset($era_opts['era_opts_blog_thecats'])) {         $blogcats = '';     } else {         $blogcats = implode(',', $blogcats);     }          $args = array(         'post_type' => 'post',         'numberposts' => '-1',         'paged' => $paged,         'category' => $blogcats     );     $era_blog_posts = get_posts($args);      **The added pre_get_posts function in functions.php**               function era_blog_cats_wpse_103587($qry) {       if ($qry->is_page(122) && is_main_query()) {         $era_opts = get_option('era_theme_panel');         $blogcats = $era_opts['era_opts_blog_thecats'];              if(!empty($era_opts['era_opts_blog_thecats'])) {           $qry->set('category__in', $blogcats);         }       }     }     add_action('pre_get_posts','era_blog_cats_wpse_103587');


Display user meta data from a textarea as a formated text

With the below two functions I can add a textarea custom user meta field named 'publications' to the user profile and save/update it:               add_action( 'show_user_profile', 'extra_user_profile_fields' );     add_action( 'edit_user_profile', 'extra_user_profile_fields' );          function extra_user_profile_fields( $user ) { ?>       <textarea rows="10" cols="450" name="publications" id="publications"  class="regular-text" />       <?php echo esc_attr( get_the_author_meta( 'publications', $user->ID ) ); ?></textarea>     <?php }               add_action( 'personal_options_update', 'save_extra_user_profile_fields' );     add_action( 'edit_user_profile_update', 'save_extra_user_profile_fields' );          function save_extra_user_profile_fields( $user_id ) {          if ( !current_user_can( 'edit_user', $user_id ) ) { return false; }       update_user_meta( $user_id, 'publications', $_POST['publications'] );     }      With the next function I can display the meta data from the field created above on an user page, with a shortcode `[USER_META user_id=2 meta="publications"]`:               add_shortcode('USER_META', 'user_meta_shortcode_handler');          function user_meta_shortcode_handler($atts,$content=null){         return esc_html(get_user_meta($atts['user_id'], $atts['meta'], true));     }      The problem is that in the textarea I can format the text with simple paragraphs, but when it is displayed on front-end the paragraphs disappear and I see only a simple text flow. How to solve this? I have Wordpress 3.5, Twenty Twelve Theme.


cannot achieve this structure (custom posts VS categories VS ??)

I'm a bit despaired because I cannot figure out how to do what I need (and I worked with WP since a lot of time ..) Basically, I need to show my artistic work. Each work is a post, or a page or a custom types (I still don't know which fits the best) I have 3 categories of work and I won't have more. I have a blog on my website and the custom permalink is: > /blog/%year%/%monthnum%/%day%/%postname%/ So I guess it already removes the post type hypothesis (I don't want an url like : **julienbayle.net/blog** .... I want this: **julienbayle.net/works** shows ALL my works as a portfolio page with only thumbnails as a grid/table and pagination. **julienbayle.net/works/creation** shows only works in category creation as the grid of thumbnails too **julienbayle.net/works/lab** shows only works in category lab as the grid of thumbnails too **julienbayle.net/works/collab** shows only works in category collab as the grid of thumbnails too When you click on thumbnails, you see the work considered, for instance: **julienbayle.net/works/collab/work1** **julienbayle.net/works/collab/work2** etc. I tried with a custom type named "works" but I had some problems with pagination. So I tried by using basic category hierarchy and pages : **works** **\-- creation** **\-- lab** **\-- collab** But I cannot have the good permalink + the link to each work is wrong (contains the structure of a blog post) Anyone here to help me? BIG thanks in advance :)


Strange paginate_links behavior. First page link is always whatever page I'm on, all other links are correct

I'm using the following code to generate some pagination:               $wp_query = new WP_Query();     $wp_query->query('posts_per_page=5'.'&paged='.$paged);     $big = 999999999;     echo '
';     echo paginate_links(array(  'base' => '%_%',                                 'format' => str_replace($big, '%#%', esc_url(get_pagenum_link( $big ))),                                 'current' => max( 1, get_query_var('paged') ),                                 'total' => $wp_query->max_num_pages,                                 'end_size' =>4,                                 'type' => 'list'));              echo '
';      Its generating my links correctly on the first page, but if I go to any other page everything is still correct except the link for page 1 is always the url of whatever page I am on. Seems like I'm missing somthing simple, anyone know a fix?


How to add additional search terms (e.g. synonyms) to the search?

I'm running a blog about different software tools. I frequently use the search to find articles that I wrote for the blog. I also wrote an article about `latexdiff`, but always forget the name and try for example `difftex` which gives no results in the search. I thought, that adding a tag `difftex` might solve the problem, without disturbing the main article by adding e.g. a sentence "I sometimes mix it up with difftex, difflatex,...". But I found out, that tags are not used for the search. What is the **golden way** to add terms to the search?


How can I get a different image size, if all I have is the link?

For various reasons, I can't use Wordpress' built-in Thumbnail functionality. What I want to do instead is to use the first image in the post as the thumbnail. Here's what I found in the codex: Show the first image associated with the post. However, the problem with that is that if the post has multiple images, but the first image in the post is not actually the one that was uploaded first, you'll end up getting the second image instead of the first one. * * * So, I decided to use something similar to this approach, which uses a regex to parse `the_content` to find the first post. This works out fine, but I end up with the image size that was used in the post, and I only want the Thumbnail size. * * * **So, here's the question:** If I have a link to an image, is there any way I can get a different size? Seems what I need is to somehow get the attachment ID, so that I can get the image size with this:               wp_get_attachment_link( $id, 'thumbnail' );      The problem is, **how do I get an ID if all I have is the URL**?


What is a good way to implement photo galleries on Wordpress?

I want to publish about 1GB of photos on my Wordpress-powered website. I want viewers to load the photos quickly, but also tobe able to download high- resolution versions. Here is what I have tried. 1) Using NextGen: This seems great, but when huge photos are uploaded, NextGen does not automatically shrink them, making galleries very slow. 2) Using Flickr: Unfortunately, many of my clients view the photos from China, and Flickr is slow there sometimes. Besides, free Flickr has an upload limit of 300MB/month. 3) Picasa: Same, Google applications are slow in China. I am open to a budget of < $25/year, but would really appreciate free services. Thank you.


Page with Multiple Loops Breaking Pagination

I made a customized index.php so that I have multiple loops on the same page so that the content can be displayed differently. I got this to work, however the pagination is broken. Despite several hours of Googling and trying all sorts of things, I can't get it to work. Subsequent pages just display the same thing as the home page. I'm also using the WP-PageNavi plugin to do the pagination at the bottom. Each subsequent page is correct in the address bar and at the bottom of the page according to the plug-in, but the content is the same on every page. I understand that you cannot have 'paged' and 'offset' at the same time, but I have absolutely no understanding of how to fix it. Here is the code:
             <?php                 $temp = $wp_query;                 $wp_query= null;                 $wp_query = new WP_Query();                 $wp_query->query('showposts=1'.'&paged='.$paged);                  ?>                  <?php $posts = get_posts('numberposts=1&offset=0'); foreach ($posts as $post) : start_wp(); ?>                      <?php static $count1 = 0; if ($count1 == "1") { break; } else { ?>                                                                 <?php $wp_query = null; $wp_query = $temp;?>                  <?php $count1++; } ?>             <?php endforeach; ?>

         <?php                 $temp = $wp_query;                 $wp_query= null;                 $wp_query = new WP_Query();                 $wp_query->query('showposts=4'.'&paged='.$paged);              ?>              <?php $posts = get_posts('numberposts=4&offset=1'); foreach ($posts as $post) : start_wp(); ?>         <?php static $count2 = 0; if ($count2 == "4") { break; } else { ?>

         <?php $count2++; } ?>         <?php endforeach; ?>
          <?php $wp_query = null; $wp_query = $temp;?>
              <?php                 $temp = $wp_query;                 $wp_query= null;                 $wp_query = new WP_Query();                 $wp_query->query('showposts=6'.'&paged='.$paged);                  ?>         <?php $posts = get_posts('numberposts=6&offset=5'); foreach ($posts as $post) : start_wp(); ?>         <?php static $count3 = 0; if ($count3 == "6") { break; } else { ?>

              <?php $count3++; } ?>         <?php endforeach; ?>
               <?php $wp_query = null; $wp_query = $temp;?>


JS.Alescurf notification

I am trying to remove this virus that cause certain browsers like Opera cannot open this website because it detects malware. This is the blog. How to solve this?


Custom loop with conditional statement to separate each terms

Let's say for example: I have a custom taxonomy called "fruit", which has 3 terms "apple", "orange", and "grape". So in order to get all the posts within all these three terms, I would :               $args = array(             'post_per_page' => '-1',         'tax_query' => array(             array(                 'taxonomy' => 'fruit',                 'field' => 'slug',                 'terms' => array('apple','orange','grape')             )         )     );     $query = new WP_Query( $args );          while($query->have_posts()) : $query->the_post();     ... Stuff to display from each post     endwhile;      Now the above loop will display all the post from every terms. My question is, how do I separate each terms so I can display Apples inside a div#apple, orange inside a div#orange, and grape inside a div#grape. I am trying to use conditional statement, but I can't figure out how to... @kaiser - My result of var_dump               object(WP_Query)#300 (45) { ["query_vars"]=> array(58) { ["posts_per_page"]=> int(15) ["tax_query"]=> array(1) { [0]=> array(3) { ["taxonomy"]=> string(12) "psny-contest" ["field"]=> string(4) "slug" ["terms"]=> array(5) { [0]=> string(10) "fall-award" [1]=> string(12) "spring-award" [2]=> string(12) "summer-award" [3]=> string(12) "winter-award" [4]=> string(22) "special-occasion-award" } } } ["error"]=> string(0) "" ["m"]=> int(0) ["p"]=> int(0) ["post_parent"]=> string(0) "" ["subpost"]=> string(0) "" ["subpost_id"]=> string(0) "" ["attachment"]=> string(0) "" ["attachment_id"]=> int(0) ["name"]=> string(0) "" ["static"]=> string(0) "" ["pagename"]=> string(0) "" ["page_id"]=> int(0) ["second"]=> string(0) "" ["minute"]=> string(0) "" ["hour"]=> string(0) "" ["day"]=> int(0) ["monthnum"]=> int(0) ["year"]=> int(0) ["w"]=> int(0) ["category_name"]=> string(0) "" ["tag"]=> string(0) "" ["cat"]=> string(0) "" ["tag_id"]=> string(0) "" ["author_name"]=> string(0) "" ["feed"]=> string(0) "" ["tb"]=> string(0) "" ["paged"]=> int(0) ["comments_popup"]=> string(0) "" ["meta_key"]=> string(0) "" ["meta_value"]=> string(0) "" ["preview"]=> string(0) "" ["s"]=> string(0) "" ["sentence"]=> string(0) "" ["fields"]=> string(0) "" ["category__in"]=> array(0) { } ["category__not_in"]=> array(0) { } ["category__and"]=> array(0) { } ["post__in"]=> array(0) { } ["post__not_in"]=> array(0) { } ["tag__in"]=> array(0) { } ["tag__not_in"]=> array(0) { } ["tag__and"]=> array(0) { } ["tag_slug__in"]=> array(0) { } ["tag_slug__and"]=> array(0) { } ["ignore_sticky_posts"]=> bool(false) ["suppress_filters"]=> bool(false) ["cache_results"]=> bool(true) ["update_post_term_cache"]=> bool(true) ["update_post_meta_cache"]=> bool(true) ["post_type"]=> string(0) "" ["nopaging"]=> bool(false) ["comments_per_page"]=> string(2) "50" ["no_found_rows"]=> bool(false) ["taxonomy"]=> string(12) "psny-contest" ["term"]=> string(10) "fall-award" ["order"]=> string(4) "DESC" } ["tax_query"]=> object(WP_Tax_Query)#298 (2) { ["queries"]=> array(1) { [0]=> array(5) { ["taxonomy"]=> string(12) "psny-contest" ["terms"]=> array(5) { [0]=> string(10) "fall-award" [1]=> string(12) "spring-award" [2]=> string(12) "summer-award" [3]=> string(12) "winter-award" [4]=> string(22) "special-occasion-award" } ["include_children"]=> bool(true) ["field"]=> string(4) "slug" ["operator"]=> string(2) "IN" } } ["relation"]=> string(3) "AND" } ["meta_query"]=> object(WP_Meta_Query)#299 (2) { ["queries"]=> array(0) { } ["relation"]=> NULL } ["post_count"]=> int(15) ["current_post"]=> int(-1) ["in_the_loop"]=> bool(false) ["comment_count"]=> int(0) ["current_comment"]=> int(-1) ["found_posts"]=> string(2) "20" ["max_num_pages"]=> float(2) ["max_num_comment_pages"]=> int(0) ["is_single"]=> bool(false) ["is_preview"]=> bool(false) ["is_page"]=> bool(false) ["is_archive"]=> bool(true) ["is_date"]=> bool(false) ["is_year"]=> bool(false) ["is_month"]=> bool(false) ["is_day"]=> bool(false) ["is_time"]=> bool(false) ["is_author"]=> bool(false) ["is_category"]=> bool(false) ["is_tag"]=> bool(false) ["is_tax"]=> bool(true) ["is_search"]=> bool(false) ["is_feed"]=> bool(false) ["is_comment_feed"]=> bool(false) ["is_trackback"]=> bool(false) ["is_home"]=> bool(false) ["is_404"]=> bool(false) ["is_comments_popup"]=> bool(false) ["is_paged"]=> bool(false) ["is_admin"]=> bool(false) ["is_attachment"]=> bool(false) ["is_singular"]=> bool(false) ["is_robots"]=> bool(false) ["is_posts_page"]=> bool(false) ["is_post_type_archive"]=> bool(false) ["query_vars_hash"]=> string(32) "36947eefd755aba84b755ec8db4398dc" ["query_vars_changed"]=> bool(false) ["thumbnails_cached"]=> bool(false) ["query"]=> array(2) { ["posts_per_page"]=> string(2) "15" ["tax_query"]=> array(1) { [0]=> array(3) { ["taxonomy"]=> string(12) "psny-contest" ["field"]=> string(4) "slug" ["terms"]=> array(5) { [0]=> string(10) "fall-award" [1]=> string(12) "spring-award" [2]=> string(12) "summer-award" [3]=> string(12) "winter-award" [4]=> string(22) "special-occasion-award" } } } } ["request"]=> string(690) " SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) JOIN wp_icl_translations t ON wp_posts.ID = t.element_id AND t.element_type IN ('post_post','post_page','post_picture') JOIN wp_icl_languages l ON t.language_code=l.code AND l.active=1 WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (92,90,91,89,88) ) AND wp_posts.post_type IN ('post', 'page', 'attachment', 'picture') AND (wp_posts.post_status = 'publish' OR wp_posts.post_author = 1 AND wp_posts.post_status = 'private') AND t.language_code='en' GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 15" ["posts"]=> array(15) { [0]=> object(stdClass)#350 (24) { ["ID"]=> int(1086) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2012-01-16 03:59:46" ["post_date_gmt"]=> string(19) "2012-01-16 08:59:46" ["post_content"]=> string(0) "" ["post_title"]=> string(12) "Skating Rink" ["post_excerpt"]=> string(12) "Skating Rink" ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(12) "skating-rink" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2012-01-16 04:01:52" ["post_modified_gmt"]=> string(19) "2012-01-16 09:01:52" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(49) "http://psnyusa.org/?post_type=picture&p=1086" ["menu_order"]=> int(0) ["post_type"]=> string(7) "picture" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [1]=> object(stdClass)#351 (24) { ["ID"]=> int(1083) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2012-01-16 03:58:49" ["post_date_gmt"]=> string(19) "2012-01-16 08:58:49" ["post_content"]=> string(0) "" ["post_title"]=> string(9) "Dirty Boy" ["post_excerpt"]=> string(23) "Profile of a Dirty Boy." ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(9) "dirty-boy" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2012-01-16 04:03:10" ["post_modified_gmt"]=> string(19) "2012-01-16 09:03:10" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(49) "http://psnyusa.org/?post_type=picture&p=1083" ["menu_order"]=> int(0) ["post_type"]=> string(7) "picture" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [2]=> object(stdClass)#352 (24) { ["ID"]=> int(1080) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2012-01-16 03:57:45" ["post_date_gmt"]=> string(19) "2012-01-16 08:57:45" ["post_content"]=> string(0) "" ["post_title"]=> string(10) "Night Glow" ["post_excerpt"]=> string(163) "Just another experiment at capturing the northern lights. 2 exposures here. One for the sky, and a little longer one for the water and foreground. I always forget " ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(10) "night-glow" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2012-01-16 03:57:45" ["post_modified_gmt"]=> string(19) "2012-01-16 08:57:45" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(49) "http://psnyusa.org/?post_type=picture&p=1080" ["menu_order"]=> int(0) ["post_type"]=> string(7) "picture" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [3]=> object(stdClass)#353 (24) { ["ID"]=> int(1077) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2012-01-16 03:56:07" ["post_date_gmt"]=> string(19) "2012-01-16 08:56:07" ["post_content"]=> string(0) "" ["post_title"]=> string(14) "Cool Landscape" ["post_excerpt"]=> string(14) "Cool Landscape" ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(14) "cool-landscape" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2012-01-16 03:56:07" ["post_modified_gmt"]=> string(19) "2012-01-16 08:56:07" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(49) "http://psnyusa.org/?post_type=picture&p=1077" ["menu_order"]=> int(0) ["post_type"]=> string(7) "picture" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [4]=> object(stdClass)#354 (24) { ["ID"]=> int(1074) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2012-01-16 03:54:40" ["post_date_gmt"]=> string(19) "2012-01-16 08:54:40" ["post_content"]=> string(0) "" ["post_title"]=> string(20) "Waterfalls Landscape" ["post_excerpt"]=> string(43) "Waterfalls Landscape and the flowing river." ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(20) "waterfalls-landscape" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2012-01-18 21:54:33" ["post_modified_gmt"]=> string(19) "2012-01-19 02:54:33" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(49) "http://psnyusa.org/?post_type=picture&p=1074" ["menu_order"]=> int(0) ["post_type"]=> string(7) "picture" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [5]=> object(stdClass)#355 (24) { ["ID"]=> int(1071) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2012-01-16 03:52:10" ["post_date_gmt"]=> string(19) "2012-01-16 08:52:10" ["post_content"]=> string(0) "" ["post_title"]=> string(16) "Tajmahal Sunrise" ["post_excerpt"]=> string(33) "Tajmahal Sunrise and morning fog." ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(16) "tajmahal-sunrise" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2012-01-16 03:52:10" ["post_modified_gmt"]=> string(19) "2012-01-16 08:52:10" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(49) "http://psnyusa.org/?post_type=picture&p=1071" ["menu_order"]=> int(0) ["post_type"]=> string(7) "picture" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [6]=> object(stdClass)#356 (24) { ["ID"]=> int(1068) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2012-01-16 03:51:19" ["post_date_gmt"]=> string(19) "2012-01-16 08:51:19" ["post_content"]=> string(0) "" ["post_title"]=> string(19) "Side Road Landscape" ["post_excerpt"]=> string(52) "Side Road Landscape of a beautiful highway in Tiwan." ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(19) "side-road-landscape" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2012-01-16 03:51:19" ["post_modified_gmt"]=> string(19) "2012-01-16 08:51:19" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(49) "http://psnyusa.org/?post_type=picture&p=1068" ["menu_order"]=> int(0) ["post_type"]=> string(7) "picture" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [7]=> object(stdClass)#357 (24) { ["ID"]=> int(1065) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2012-01-16 03:50:16" ["post_date_gmt"]=> string(19) "2012-01-16 08:50:16" ["post_content"]=> string(0) "" ["post_title"]=> string(13) "Beautiful Sky" ["post_excerpt"]=> string(40) "Beautiful Sky and beautiful green grass." ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(13) "beautiful-sky" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2012-01-16 03:50:16" ["post_modified_gmt"]=> string(19) "2012-01-16 08:50:16" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(49) "http://psnyusa.org/?post_type=picture&p=1065" ["menu_order"]=> int(0) ["post_type"]=> string(7) "picture" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [8]=> object(stdClass)#358 (24) { ["ID"]=> int(1062) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2012-01-16 03:48:31" ["post_date_gmt"]=> string(19) "2012-01-16 08:48:31" ["post_content"]=> string(0) "" ["post_title"]=> string(20) "Portrait Photography" ["post_excerpt"]=> string(36) "Portrait Photography of a lonly boy." ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(20) "portrait-photography" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2012-01-16 03:48:31" ["post_modified_gmt"]=> string(19) "2012-01-16 08:48:31" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(49) "http://psnyusa.org/?post_type=picture&p=1062" ["menu_order"]=> int(0) ["post_type"]=> string(7) "picture" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [9]=> object(stdClass)#359 (24) { ["ID"]=> int(1057) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2012-01-16 03:45:55" ["post_date_gmt"]=> string(19) "2012-01-16 08:45:55" ["post_content"]=> string(0) "" ["post_title"]=> string(17) "Paint photography" ["post_excerpt"]=> string(36) "Paint phtography of a wonderful day." ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(16) "paint-phtography" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2012-01-16 03:47:24" ["post_modified_gmt"]=> string(19) "2012-01-16 08:47:24" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(49) "http://psnyusa.org/?post_type=picture&p=1057" ["menu_order"]=> int(0) ["post_type"]=> string(7) "picture" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [10]=> object(stdClass)#360 (24) { ["ID"]=> int(1054) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2012-01-16 03:44:28" ["post_date_gmt"]=> string(19) "2012-01-16 08:44:28" ["post_content"]=> string(0) "" ["post_title"]=> string(17) "Statue of Liberty" ["post_excerpt"]=> string(29) "Statue of Liberty silhouette " ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(17) "statue-of-liberty" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2012-01-16 03:44:28" ["post_modified_gmt"]=> string(19) "2012-01-16 08:44:28" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(49) "http://psnyusa.org/?post_type=picture&p=1054" ["menu_order"]=> int(0) ["post_type"]=> string(7) "picture" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [11]=> object(stdClass)#361 (24) { ["ID"]=> int(1050) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2012-01-16 03:43:20" ["post_date_gmt"]=> string(19) "2012-01-16 08:43:20" ["post_content"]=> string(0) "" ["post_title"]=> string(16) "New York Skyline" ["post_excerpt"]=> string(43) "New York Skyline looking west at night sky." ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(16) "new-york-skyline" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2012-01-16 03:43:20" ["post_modified_gmt"]=> string(19) "2012-01-16 08:43:20" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(49) "http://psnyusa.org/?post_type=picture&p=1050" ["menu_order"]=> int(0) ["post_type"]=> string(7) "picture" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [12]=> object(stdClass)#362 (24) { ["ID"]=> int(1047) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2012-01-16 03:41:16" ["post_date_gmt"]=> string(19) "2012-01-16 08:41:16" ["post_content"]=> string(0) "" ["post_title"]=> string(30) "Infrared Photography Fisherman" ["post_excerpt"]=> string(50) "Infrared Photography Fisherman fishing by himself." ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(30) "infrared-photography-fisherman" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2012-01-16 03:41:16" ["post_modified_gmt"]=> string(19) "2012-01-16 08:41:16" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(49) "http://psnyusa.org/?post_type=picture&p=1047" ["menu_order"]=> int(0) ["post_type"]=> string(7) "picture" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [13]=> object(stdClass)#363 (24) { ["ID"]=> int(1044) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2012-01-16 03:38:14" ["post_date_gmt"]=> string(19) "2012-01-16 08:38:14" ["post_content"]=> string(0) "" ["post_title"]=> string(17) "High Speed Bullet" ["post_excerpt"]=> string(40) "High Speed Bullet going through crayons." ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(17) "high-speed-bullet" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2012-01-16 03:38:14" ["post_modified_gmt"]=> string(19) "2012-01-16 08:38:14" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(49) "http://psnyusa.org/?post_type=picture&p=1044" ["menu_order"]=> int(0) ["post_type"]=> string(7) "picture" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } [14]=> object(stdClass)#364 (24) { ["ID"]=> int(1041) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2012-01-16 03:35:55" ["post_date_gmt"]=> string(19) "2012-01-16 08:35:55" ["post_content"]=> string(0) "" ["post_title"]=> string(22) "Grand Central Entrance" ["post_excerpt"]=> string(30) "Grand Central Entrance statue." ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(22) "grand-central-entrance" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2012-01-17 13:14:52" ["post_modified_gmt"]=> string(19) "2012-01-17 18:14:52" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(49) "http://psnyusa.org/?post_type=picture&p=1041" ["menu_order"]=> int(0) ["post_type"]=> string(7) "picture" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } } ["post"]=> object(stdClass)#350 (24) { ["ID"]=> int(1086) ["post_author"]=> string(1) "1" ["post_date"]=> string(19) "2012-01-16 03:59:46" ["post_date_gmt"]=> string(19) "2012-01-16 08:59:46" ["post_content"]=> string(0) "" ["post_title"]=> string(12) "Skating Rink" ["post_excerpt"]=> string(12) "Skating Rink" ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) "" ["post_name"]=> string(12) "skating-rink" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2012-01-16 04:01:52" ["post_modified_gmt"]=> string(19) "2012-01-16 09:01:52" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(49) "http://psnyusa.org/?post_type=picture&p=1086" ["menu_order"]=> int(0) ["post_type"]=> string(7) "picture" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } }


Javascript WP Object Documentation?

I was working on implementing the media library within one of my plugins/themes. I found a nice tutorial (http://mikejolley.com/2012/12/using- the-new-wordpress-3-5-media-uploader-in-plugins/) that showed me how to do this using the JS object 'wp' I can't seem to find any documentation on this in the codex or when Googling. How does one learn this object and its methods?


"Static" Child Menu with Accordian

I'm looking to create a child menu and none of the examples in the Wordpress codex seem to do what I'm trying to create. I have a main horizontal nav bar, which is fine. When clicking on a top-level page, I want a side-bar menu to show up with an accordion effect to browse through the child pages; however, when visiting a child page, I don't want the sidebar menu to reset to show the next tier as the top page... if that makes sense: Here is a JSFiddle to demonstrate what I mean: http://jsfiddle.net/DY8Fk/ If you were to click main nav link in the top nav bar, it shows that page with a sub-menu. **No matter what page you visit within that sub menu, the sub menu doesn't change.** I would want to use CSS to highlight the current page within the nav menu, and possibly add an accordion effect. Any help would be greatly appreciated!


Can't remove a widget from admin

I've just updated to WP 3.6, and I have also just turned off network mode on a Wordpress website. I cannot remove a widget I created. It is a text widget. I can't remove a search widget either. I am logged into WP with the same username that create the widget. Any ideas?


Blog pagination WITHOUT using max_num_pages

WP 3.2.1 I'm in a bit of a bind. I have to create some pagination for the blog, but I believe I'm running into the bug described here, and I don't have authorization to fiddle with the server's `php.ini` file. So, I need to find a way to create pagination for the blog without having max_num_pages. Is that possible? I don't want to re-engineer the blog loop if I don't have to. EDIT: max_num_pages isn't even in the list of query_vars when I print them with `print_r($wp_query->query_vars);` EDIT 2: Similarly, found_posts isn't in $wp_query, either. If it helps, I'm using a modified version of Avia as the theme.


Changing max number of blog posts per page doesn't work

WP 3.2.1 Changing the max number of posts to show on each page via Settings->Reading isn't working. Could this reported bug be the culprit?


External URL Link as Featured Images

How do set post thumbnail (featured image) from an external URL without uploading the image to WordPress media library.


Set terms programmatically

I would like to use `wp_set_post_terms()` or `wp_set_object_terms()`. I think I read all the codex and all forum post about these functions and I still can't make them work. I've a taxonomy named `store` with a lot of stores (ex : Adobe, Nike, etc.). So, I'm getting the Id with:               $myvar = term_exists( 'Adobe', 'store');      which gives me this result:               array(2) { ["term_id"]=> string(5) "32771" ["term_taxonomy_id"]=> string(5) "32802" }      Now I've tried everything:               wp_set_post_terms($POSTID, 32802, 'store');     wp_set_post_terms($POSTID, 32802, 32771);     wp_set_post_terms($POSTID, 32771, 32802);     wp_set_post_terms($POSTID, 'Amazon', 'store');     wp_set_post_terms($POSTID, 32771, 'store');     wp_set_post_terms($POSTID, array( 32802 ), 'store');     wp_set_post_terms($POSTID, array( 32802 ), array( 32771 ));     wp_set_post_terms($POSTID, array( 32771 ), 'store');     wp_set_post_terms($POSTID, array( 32771 ), array ( 32802 ));      I've tried to put these into variables too, in lowercase, in uppercase, with first letter uppercase … everything keeps returning me "invalid taxonomy".               object(WP_Error)#5342 (2) { ["errors"]=> array(1) { ["invalid_taxonomy"]=> array(1) { [0]=> string(25) "La taxinomie est invalide" } } ["error_data"]=> array(0) { }      What should I do?


WordPress 3.6 generating empty database

I wanted to migrate my local WordPress i use for theme development to 3.6, but the generated tables in the database are empty. WordPress creates all tables, but only `wp_options` is being filled, but not with the content i entered into the setup. When i run the setup, i get a blank screen with just the WordPress-Logo on `/wp-admin/install.php?step=2`. (screenshot) At first i thought this was a problem with the german version, but i get the same error with the "official" version from wordpress.org. I am using PHP 5.5.1 and MySQL 5.6.11.


W3 Total Cache plugin integration

I am working on a plugin (widget) that is using some transients that are updated from time to time. That said, when these transients are updated, I think I will need to flush the cache to display the new data properly. Thus, I wonder if have some way to flush the cache only for widget instead of entire cache. Do you guys have some advice?


Register through url

Im looking for a solution where you can register through an url. Here's the thing, I want send out an email with a Url link. Best case: If the receiver click's on this link, the automaticly will be registered to my wordpress site (and become a subscriber) and be redirected to a page whitin my site. Second: ...or they will be redricted to an registration page where their email id is already has been put in, so they just have to click "accept" on this page to be registered. Is this doable at all?


How to add audio media in a post?

I am **simply trying to add an audio file** in a wordpress blog! I have tried different audio player plugins: the non-existing anymore (?) haiku minimalist player, the jQuery player, the mb.miniAudioPlayer and MediaElement.js. I have had only one player installed in each attempt. And, for each of these, I can see the(ir) _settings_ panel and add the respective code in some post to get the player displayed. So far so good. I can't, however, add any media files in the player(s)! All media files that I have uploaded, are nowhere to be selected. For example, while editing a post, I select _Add Media_ and inside the _Insert Media_ window, I expect at the very least to see the audio files (ogg, mp3 -- previously uploaded) under the _Media Collection_ Tab. This very "Insert Media" window is simply empty! What can I do to trace the "error"? Is it, perhaps, related to any directory/file access permissions where WordPress is installed?


Wp favorites posts by specific category?

Well, let me get to the point, im trying to Display a specific category using the Wp favorites posts plugin this is what im adding `$category_id = get_cat_ID('news');` but it doesn't seem to work it shows all category's on favorite posts instead of a certain specific category. this is what im messing around with and i placed my category               <?php     foreach ( $favorite_post_ids as $o ) :         $category_id = get_cat_ID( 'news' );         $p = get_post( $o );         if ( $p->post_status == 'publish' ) {?>      & this is the whole entire favorite posts box that makes it functional.

<?php _e( 'fav posts', 'bd_lang' ); ?>

                  <?php $favorite_post_ids = wpfp_get_users_favorites();             if ( $favorite_post_ids ) { ?>                      <?php foreach ( $favorite_post_ids as $o ) : $p = get_post( $o );                     if ( $p->post_status == 'publish' ) { ?>
                                                   <?php if ( has_post_thumbnail( $o ) ) { ?>
                                     <a href="<?php get_permalink( $o ); ?>" title="<?php echo $p->post_title; ?>">                     <?php $image = vt_resize( get_post_thumbnail_id( $o ), '', 50, 0, true ); ?>                                         <img src="<?php echo $image[url]; ?>" width="<?php echo $image[width]; ?>" height="<?php echo $image[height]; ?>" alt="<?php if ( get_post_meta( get_post_thumbnail_id( $o ), '_wp_attachment_image_alt', true ) ) {                         echo get_post_meta( get_post_thumbnail_id( $o ), '_wp_attachment_image_alt', true );                     } else {                         echo $p->post_title;                     } ?>" />
                                   <?php } ?>                                                               <a href="<?php echo get_permalink( $o ); ?>" title="<?php echo $p->post_title; ?>"><?php echo $p->post_title; ?>
                  <?php } endforeach; ?>                  <?php } else { ?>
                     <?php _e( 'Your are not currently following any items.', 'bd_lang' ); ?>
          <?php } ?>


How do I query for posts by custom meta and those that have been stickied?

I realize how clumsy and inefficient this query is but SQL is not my strong point. I use the following query to pull the latest 8 events from a custom post type called Event Posts. However, I also need to include in those 8 posts any posts which have been stickied. Because of some very complicated client needs which exceed the capabilities of wp_query I've been forced to craft the query by hand and use wpdb to execute it. Could someone help me add to this query to also grab stickied posts?               SELECT SQL_CALC_FOUND_ROWS *, mt2.meta_value AS start_time, mt3.meta_value AS end_time, mt4.meta_value AS start_date, mt5.meta_value AS event_id, mt6.meta_value AS event_meta, mt7.meta_value AS event_thumb     FROM wp_posts     INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)     INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)     INNER JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id)     INNER JOIN wp_postmeta AS mt2 ON (wp_posts.ID = mt2.post_id AND mt2.meta_key = 'event_start_time')     INNER JOIN wp_postmeta AS mt3 ON (wp_posts.ID = mt3.post_id AND mt3.meta_key = 'event_end_time')     INNER JOIN wp_postmeta AS mt4 ON (wp_posts.ID = mt4.post_id AND mt4.meta_key =      'event_start_date')     INNER JOIN wp_postmeta AS mt5 ON (wp_posts.ID = mt5.post_id AND mt5.meta_key = 'event_id')     INNER JOIN wp_postmeta AS mt6 ON (wp_posts.ID = mt6.post_id AND mt6.meta_key = 'event_meta')     INNER JOIN wp_postmeta AS mt7 ON (wp_posts.ID = mt7.post_id AND mt7.meta_key = 'event_thumbnail_url')     WHERE 1=1     AND ( wp_term_relationships.term_taxonomy_id IN (7) )     AND wp_posts.post_type = 'espresso_event'     AND (wp_posts.post_status = 'publish')     AND (wp_postmeta.meta_key = 'event_start_date'     AND (mt1.meta_key = 'event_start_date'     AND CAST(mt1.meta_value AS DATE) >= '" . date('Y-m-d') . "') )     GROUP BY wp_posts.ID ORDER BY CAST(wp_postmeta.meta_value AS DATE) ASC, CAST(mt2.meta_value AS TIME) ASC     LIMIT 0, 8


Add a captcha form to the woocommerce register form

I am trying to find a way of adding a captcha form on the register form that woocommerce build. I am able to create a template override but if i was to add the recaptcha directly i dont know what to do if it is correct etc. I have tried adding the plugin easy captcha but that didn't show anything. wp version is 3.7 woocommerce version is 2.0.20 Any ideas would be brilliant thanks in advance Alex


How to Display BuddyPress Profile Field Data In Multisite Blogs

I'm trying to display a BuddyPress xprofile field on a WordPress multsite blog. I thought this might do the trick but displayed_user doesn't seem to work outside of BP? Is there an easy way to do this? I know there's an old plugin that does it in a widget but I don't really need all of that and would rather put this directly in the theme. Here's what I've tried within the theme on the multisite blog. This works with loggedin_user->id but of course what I'm shooting for is the profile data for the blog admin. Is that possible to fetch?               <?php      global $bp;     $myfield = xprofile_get_field_data( 'Counties Served', $bp->displayed_user->id, $multi_format = 'comma' );     $data = xprofile_format_profile_field('checkbox', $myfield);     echo $data;     ?>


How to import linked images and make them featured -> automagically

I am using FeedWordPress to syndicate articles from RSS feeds. The plugin does a _beautiful job_ of bringing in the content, preserving original formatting, and assigning metadata to the right places. Images are displayed by linking to source images. What I want to do:   * automatically import all images from syndicated posts, and add them to the media library.      * import to media library should handle image processing to create thumbnails, etc.   * automatically assign image #1 as the featured image, to be used in widgets. The plugin doesn't seem to support these features. Can you suggest another plugin, or configurations that can help to support these features?


Display Sub-categories or Child Pages of Parent Cat/Page?

I am seeking two codes which I haven't been able to find which would allow a child menu to be created in a sidebar. A code to display the sub-categories of the parent category. A code to display the sub-pages of the current page. I remember having a theme that had these codes implemented which also allowed styling to be applied to current categories. Maybe it has since been depreceated and maybe not - but I would sure appreciate if anybody had more information on these codes.


I am building my first Wordpress site, I just downloaded and installed v3.9.1. I bought a theme (rustik3) and I am trying to install it, but I am running into these errors produced by WP_DEBUG:               Notice: Use of undefined constant Redux_TEXT_DOMAIN - assumed 'Redux_TEXT_DOMAIN' in /var/www/wp-content/themes/rustik3/admin/options.php on line 501          Notice: Use of undefined constant Redux_TEXT_DOMAIN - assumed 'Redux_TEXT_DOMAIN' in /var/www/wp-content/themes/rustik3/admin/options.php on line 502          Notice: Use of undefined constant Redux_TEXT_DOMAIN - assumed 'Redux_TEXT_DOMAIN' in /var/www/wp-content/themes/rustik3/admin/options.php on line 503          Notice: Undefined variable: item_info in /var/www/wp-content/themes/rustik3/admin/theme-functions.php on line 23      I have done some googling, and I'm starting to think that the last Wordpress update made it so that the Redux Framework is deprecated and cannot be used. This is just a hunch though. As of right now, the theme installs, but it shows up as completely blank - either when I go to `http://localhost` or when I am trying to customize it in the Wordpress UI. I haven't looked into the last part of the error messages log (line 23 error)...but it is just an undefined variable so I might be able to tackle that one myself. Any ideas? **UPDATE** This is what the chunk of code looks like in `options.php`:               array(                 'id' => 'google_webfonts',                 'type' => 'google_webfonts',                 'title' => __('Enable Google Webfonts', Redux_TEXT_DOMAIN),                  'sub_desc' => __('Pick from over 600 Google Webfonts to use on the site. Then select below which elements you want to apply it to.', Redux_TEXT_DOMAIN),                     'desc' => __('', Redux_TEXT_DOMAIN)           ),      **UPDATE** I did a text search through all of the wordpress files for `Redux_TEXT_DOMAIN` and the only spot it appears is in the above chunk of code... **UPDATE** This code is what loads the text domain in the theme I have...I am not familiar with what a text domain is - but this might be relevant:               public function load_textdomain() {             if ( isset( $this->textdomain_loaded ) )                 return $this->textdomain_loaded;                  $textdomain = $this->get('TextDomain');             if ( ! $textdomain ) {                 $this->textdomain_loaded = false;                 return false;             }                  if ( is_textdomain_loaded( $textdomain ) ) {                 $this->textdomain_loaded = true;                 return true;             }                  $path = $this->get_stylesheet_directory();             if ( $domainpath = $this->get('DomainPath') )                 $path .= $domainpath;             else                 $path .= '/languages';                  $this->textdomain_loaded = load_theme_textdomain( $textdomain, $path );             return $this->textdomain_loaded;         }      Is there something wrong with the above code? Note: I have posted a duplicate question here. I did this before I was aware that there was a Wordpress specific section of Stack Exchange. If you care about stackoverflow.com - you can answer the question there...I have put a 50 point bounty on it :). You should also read the comments on that page...I think I may have found some relevant information. **UPDATE** Thanks to a comment by cybmeta - I got rid of the `Redux_TEXT_DOMAIN` errors...the last one left is this: `Notice: Undefined variable: item_info in /var/www/wp- content/themes/rustik3/admin/theme-functions.php on line 23` Here is the code:               $item_info .= '

             <form action="http://doublerainbowx.us6.list-manage2.com/subscribe/post?u=eac2b83a92633c39dae8a663b&id=334c60b856" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>                 Get e-mails about important updates and helpful tips on how to run your store by joining the Rustik newsletter.                 <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
<input type="text" name="b_eac2b83a92633c39dae8a663b_334c60b856" value="">
                 <input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">                 Hide Notice             </form>

';                  echo $item_info;      The error is thrown on the `echo $item_info` line - so it is as if it isn't being set for some reason...even though it looks like it is above.


creating a custom walker class

I am currently developing a theme for wordpress, and would like to add some data values to the list items that are returned. Here is the basic structure of my nav:

Top Slide

Parallax Scrolling

Grid

Credits

      I have created a walker class which is here (although not 100% how i want it):               class description_walker extends Walker_Nav_Menu     {            function start_el(&$output, $item, $depth, $args)               {               global $wp_query;            $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';                $class_names = $value = '';            $classes = empty( $item->classes ) ? array() : (array) $item->classes;                 $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );            $class_names = ' class="'. esc_attr( $class_names ) . '"';                 $output .= $indent . '
ID . '" id="menu-item-'. $item->ID . '"' . $value .'>';                 $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';            $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';            $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';            $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';                // $prepend = '';           // $append = '';            $description  = ! empty( $item->description ) ? ''.esc_attr( $item->description ).'' : '';                 if($depth != 0)            {                      $description = $append = $prepend = "";            }                  $item_output = $args->before;             $item_output .= '';             $item_output .= $args->link_before .$prepend.apply_filters( 'the_title', $item->title, $item->ID ).$append;             $item_output .= $description.$args->link_after;             $item_output .= '';             $item_output .= $args->after;                  $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );             }      } I am then calling wp_nav_menu like this:               <?php wp_nav_menu( array(      'container' => 'div',      'container_id'    => 'nav',      'container_class' => 'grid_9 omega',      'echo' => true,      'before' => '',      'after' => '',      'link_before' => '',      'link_after' => '',      'depth' => 0,      'walker' => new Walker_Nav_Menu())      );?>      The menu is not outputting correctly, but that is purely because i dont fully understand how the walker class. Can anyone she some light?


Reset password white page

For one of our clients we have the following situation: When using the forgot password option and clicking the 'reset password' link we re getting only white pages. It's not possible to reset the password anymore. Does anyone know what the problem could be? Thanks in advance.


Enclose title within a div?

I'm using this code to display a page within my front page. I would like to learn how to add a div / spacer to isolate the page title... If I try to add a div class within the php code then it throws errors. **Question: How can I add a div to the title within this bit of code?**
     <?php      $page_id = 2945;      $page_data = get_page( $page_id );      echo '
'. $page_data->post_title .'
'; //enclose the title within a div/spacer???     echo apply_filters('the_content', $page_data->post_content);     ?>      Thanks


Skip posts without a thumbnail in loop

I want skip every post that has no thumbnail. The code does not work properly yet. Actually the script doesn't show posts without a thumbnail - that's good, but in the loop the post with no thumbnail is still counted as a post. So when I have for example 10 posts in my database. I want show 5 of them. But only the posts with a thumbnail.
              <?php              $args = array(  'numberposts'  => 5,                           'orderby'      => 'date',                           'order'        => 'DESC',                         'post_type'    => 'post',                         'post_status'  => 'publish'                      );              $my_posts = get_posts( $args );         global $post;         foreach( $my_posts as $post ) : setup_postdata($post);               if ( !has_post_thumbnail() ) {              continue;                      } else {              ?>

<?php the_post_thumbnail('post-image-big'); ?>
                     <a href="<?php the_permalink(); ?>" class="title"><?php the_title(); ?>
<?php the_category(', '); ?>

              <?php } ?>              <?php endforeach; ?>


WP Cron doesn't save <iframe> or <object> in post body

I am using wp_cron to auto grab posts from a remote website and save them in my wp db. **NOTICE! I am executing my code from my plugin, not from my template functions.php or somewhere else. I have my own validation of grabbed content to prevent malicious code etc. so turning off security validation in wordpress is not an issue in my case, but be careful if you don't have your own validation of grabbed content. Always validate grabbed values if possible!** I have in my plugin one button to grab posts manually by clicking on this button and it works perfect. Everything is stored as I want in my database. No problem here. but then I have a wp cron function that runs for testing pursposes every two minutes (if somebody clicks on my page, of course ;) and here is a problem. Notice that the code is identical, just instead of `get_user_id()` I set it manualy to `1`. that's probably the only change between these two codes. And the problem is that everything is stored as expected including time, title, slug, (it even grabs and downnload and set the featured image for the post correctly), tags, categories and additional taxonomy too. So that fine. ONly thing that is missing is the body text (content) of the post. When downloaded from admin manually. It's somethign like:               <iframe width="650" scrolling="no" height="450" frameborder="0" src="http://example.com/embedframe/3843634"></iframe>      or               <object height="450" width="650" ><param name="movie" ... bla bla bla ... shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" height="450" width="650" /></object>       So, it is because it is filtered and striped out, I mean `object` and `iframe` when not logged in as an admin? If so, how can I turn it off in my plugin? Or is it something else? I really think it's only something with WP security issue, because the code works when performed from admin as admin manually. And the code of the function is the same and all variables are passed in as expected. Just content is not saved. **EDIT:** It's definitely **something with the WP security**. When I set in my auto cron function content variable manually to "Testing auto save." is is saved normally. But When I set it to `<iframe>something</iframe>` or `<object>blablabal</object>` it is NOT. **How to turn this "checking" off, so I can save my code with cron?** Any idea?


uploading Attachments with permalinks based on parent file structure

We are rebuilding a public-interest site centered on civil rights research & document archives. The links in years of published info posts must be preserved in WordPress, and future uploaded attachments must be consistent with this 'legacy URL' format - _i.e.,_ appending the "/filename.pdf" to the parent page URL.   This creates a clean intuitive link, showing the locus of each document in the topical hierarchy of the site. This is not exotic, it's the NORM in traditional HTML sites, and how attachment links were made in our prior Plone installation. WordPress should be able to do this... we need the simple solution on creating accurate Permalinks in accord with legacy URL's. It should be an easy manual operation for a single document upload, and allow bulk uploads that assign such links automatically. If this can be done with a good WP Plugin or quick- fix in the Permalink settings, please advise. ### That's What we Need; Here's the Problem: By default in WP, attachments uploaded via [Add Media] go into the root-level "uploads" folder, not to the Page - so the URL's show the path ".../wp- content/uploads/..." in lieu of the parent file hierarchy.   The site rebuild is precise to the original structure & URL's, and the correct document links are carried over in the new pages, but uploaded attachments go somewhere else, get different URL's, and don't connect to the hypertext links. This page in-construction serves as an example:   http://www.free-assembly.org/gather/campaigns/llur/ This is a brief narrative on a policy project in 1993, connecting to the document presented to Congress & Agencies in DC, with this "correct" link in the text:   (( _www.free-assembly.org/gather/campaigns/llur/legal-landuservw-dec93.pdf_ )) ...   ...this link is clear and contextual, but now goes nowhere. At the bottom the uploaded attachment is shown, with this WP link:   (( _www.free-assembly.org/wp-content/uploads/legal-landuservw-dec93.pdf_ )) ...   ...this link brings up the document on-site, but obsoletes all prior info about it. We experimented with the Permalink settings in WP, but they provide no simple way to either lodge the upload under the current Page OR connect the accurate URL of choice to the default link path. We are exploring the "Custom structure" option, htaccess file & other code modifications, and fitting Plugins - but have seen nothing yet addressing this specific problem. We are new to WordPress, able to implement the right solution, but need knowledgeable guidance to find it reliably and waste no time... your help is most appreciated.


Categorie parents and childs displayed

I'm trying to create a menu directly hard-coded, basically I need to display the parent category and below its child categories, however I have to do this several times meaning something like this: Category 1 * category child of 1.1 * category child of 1.2 * category child of 1.3 Category 2 * category child of 2.1 * category child of 2.2 and so on.... I've tried whit different kinds functions like call the category and is subcategory to call its ancestor, however I haven't been able to get the result I'm looking for. Any suggestion??? Thanks in Advanced.


Pause plugin option page until all data manipulation is complete

I have an option on my plugin page where I load content into all the posts in the blog. Now this takes some time, esp when there are a log of posts. Now the way is it set up now, when you press submit, the form success page is already presented, but you can see that the browser is still working. How can I have the plugin wait until the whole loop is finished, and then present the error or success page.


How to add an upload image button (just like the one in the Custom Header) in the Theme Options I just created?

I used the following code in order to add a Theme Options panel in my Wordpress admin:               <?php          $themename = "Nettuts";     $shortname = "nt";          $categories = get_categories('hide_empty=0&orderby=name');     $wp_cats = array();     foreach ($categories as $category_list ) {         $wp_cats[$category_list->cat_ID] = $category_list->cat_name;     }     array_unshift($wp_cats, "Choose a category");          $options = array (         array( "name" => $themename." Options",         "type" => "title"),              array( "name" => "General",         "type" => "section"),         array( "type" => "open"),              array( "name" => "Colour Scheme",         "desc" => "Select the colour scheme for the theme",         "id" => $shortname."_color_scheme",         "type" => "select",         "options" => array("blue", "red", "green"),         "std" => "blue"),              array( "name" => "Logo URL",         "desc" => "Enter the link to your logo image",         "id" => $shortname."_logo",         "type" => "text",         "std" => ""),              array( "name" => "Custom Option",         "desc" => "Enter the link to your logo image",         "id" => $shortname."_custom",         "type" => "text",         "std" => ""),              array( "name" => "Custom CSS",         "desc" => "Want to add any custom CSS code? Put in here, and the rest is taken care of. This overrides any other stylesheets. eg: a.button{color:green}",         "id" => $shortname."_custom_css",         "type" => "textarea",         "std" => ""),              array( "type" => "close"),         array( "name" => "Homepage",         "type" => "section"),         array( "type" => "open"),              array( "name" => "Homepage header image",         "desc" => "Enter the link to an image used for the homepage header.",         "id" => $shortname."_header_img",         "type" => "text",         "std" => ""),              array( "name" => "Homepage featured category",         "desc" => "Choose a category from which featured posts are drawn",         "id" => $shortname."_feat_cat",         "type" => "select",         "options" => $wp_cats,         "std" => "Choose a category"),              array( "type" => "close"),         array( "name" => "Footer",         "type" => "section"),         array( "type" => "open"),              array( "name" => "Footer copyright text",         "desc" => "Enter text used in the right side of the footer. It can be HTML",         "id" => $shortname."_footer_text",         "type" => "text",         "std" => ""),              array( "name" => "Google Analytics Code",         "desc" => "You can paste your Google Analytics or other tracking code in this box. This will be automatically added to the footer.",         "id" => $shortname."_ga_code",         "type" => "textarea",         "std" => ""),              array( "name" => "Custom Favicon",         "desc" => "A favicon is a 16x16 pixel icon that represents your site; paste the URL to a .ico image that you want to use as the image",         "id" => $shortname."_favicon",         "type" => "text",         "std" => get_bloginfo('url') ."/favicon.ico"),              array( "name" => "Feedburner URL",         "desc" => "Feedburner is a Google service that takes care of your RSS feed. Paste your Feedburner URL here to let readers see it in your website",         "id" => $shortname."_feedburner",         "type" => "text",         "std" => get_bloginfo('rss2_url')),              array( "type" => "close")          );          function mytheme_add_admin() {         global $themename, $shortname, $options;              if ( $_GET['page'] == basename(__FILE__) ) {                  if ( 'save' == $_REQUEST['action'] ) {                      foreach ($options as $value) {                     update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }                              foreach ($options as $value) {                             if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ]  ); } else { delete_option( $value['id'] ); } }                                      header("Location: admin.php?page=options.php&saved=true");     die;                  }             else if( 'reset' == $_REQUEST['action'] ) {                      foreach ($options as $value) {                     delete_option( $value['id'] ); }                              header("Location: admin.php?page=options.php&reset=true");     die;                  }              }              add_menu_page($themename, $themename, 'administrator', basename(__FILE__), 'mytheme_admin');     }          function mytheme_add_init() {         $file_dir=get_bloginfo('template_directory');         wp_enqueue_style("functions", $file_dir."/functions/functions.css", false, "1.0", "all");     }          function mytheme_admin() {              global $themename, $shortname, $options;         $i=0;              if ( $_REQUEST['saved'] ) echo '

'.$themename.' settings saved.

';         if ( $_REQUEST['reset'] ) echo '

'.$themename.' settings reset.

';          ?>

<?php echo $themename; ?> Settings

     <form method="post">          <?php foreach ($options as $value) {         switch ( $value['type'] ) {              case "open":     ?>          <?php break;          case "close":     ?>

          <?php break;          case "title":     ?>
To easily use the <?php echo $themename;?> theme, you can use the menu below.
          <?php break;          case 'text':     ?>
         <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?>         <input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(get_settings( $value['id'])  ); } else { echo $value['std']; } ?>" />      <?php echo $value['desc']; ?>

     <?php         break;          case 'textarea':     ?>
         <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?>         <textarea name="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" cols="" rows=""><?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(get_settings( $value['id']) ); } else { echo $value['std']; } ?></textarea>      <?php echo $value['desc']; ?>

          <?php         break;          case 'select':     ?>
         <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?>          <select name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">     <?php foreach ($value['options'] as $option) { ?>             <option <?php if (get_settings( $value['id'] ) == $option) { echo 'selected="selected"'; } ?>><?php echo $option; ?></option><?php } ?>     </select>              <?php echo $value['desc']; ?>

     <?php         break;          case "checkbox":     ?>
         <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?>          <?php if(get_option($value['id'])){ $checked = "checked=\"checked\""; }else{ $checked = "";} ?>     <input type="checkbox" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="true" <?php echo $checked; ?> />              <?php echo $value['desc']; ?>

     <?php break;          case "section":              $i++;          ?>

<?php echo $value['name']; ?>
<input name="save<?php echo $i; ?>" type="submit" value="Save changes" />

          <?php break;              }     }     ?>          <input type="hidden" name="action" value="save" />     </form>     <form method="post">
     <input name="reset" type="submit" value="Reset" />     <input type="hidden" name="action" value="reset" />
     </form>
Icons: WooFunction

          <?php     }          ?>          <?php     add_action('admin_init', 'mytheme_add_init');     add_action('admin_menu', 'mytheme_add_admin');     ?>      I would like to add an upload button like this one: ![enter image description here](http://i.stack.imgur.com/llD03.png) I searched all the Internet and this StackExchange site but didn't find the answer (there is only one but it is for custom write panels in 'Pages'). Any suggestions?


stack-overflow-like content ranking for wordpress?

**drastically EDITed:** What approach would you recommend for **post** ranking in wordpress CMS? should it work with custom fields? something else? i couldn't find a plugin to do it, so i'm going to to write one by myself. i know how to use a database, and i'm a php programmer. but i'd prefer to rely as much as possible on WP existing components or features.


Email friend for each Custom Post Type posts on a page

I have a Custom Post Type called 'Property'. I display a list of CPT properties on a page: 10 per page with pagination. I would like to add an "Email friend" link to every property on the list, so a user can email that property url to multiple email addresses easily. Is there a plugin that can do this? Otherwise, what's the best approach for to do it? Many thanks, Dasha


Redirect single article permalink to paginated category page

Is it possible to redirect from a permalink (a single article) to that same post in a relevant category page, which might be paginated? So when people visit `http://domain/post_number` they get redirected to `http://domain/category/page/2/#post_number`?


Custom taxonomy archive - No posts found

I've created a custom taxonomy 'quote-categories' (a separate category listing for a custom post type) and created a taxonomy-quote-categories.php template that is called successfully when viewing a taxonomy term. However the page returns no matching post despite there being many posts in that category. I've called that content type successfully all around my site. _**FIXED_** The problem was the custom post type did not have the 'public' parameter set to 'true'. Otherwise it is invisible in normal loops and search results.


Add session or cookie to remember last menu location

I have a site that is pretending to be three sites. This is done by a series of conditional statements and page templates to make it look like the user is on a different site depending on their menu choice. The client wants it to remember the last 'site' the user was on so they are taken back there if they come back. For example, the three 'sites' are home, autos, advertising, so if the user was on the 'autos' part of the site, when they come back, they're taken back to autos. The three sites are in a menu that was created by the custom menus option under Appearance > Menus. I _think_ this question is the same thing I'm asking for, but the entire discussion and the tutorials posted are completely over my head. Doe anyone have the actual code I need to input and where? Or can point me to a tutorial to help me understand how to do it myself? Thanks much!


How can I easily reduce the size of WordPress installation from development to production?

Sometimes it happens that cheap but fast/reliable hosting plan has the drawback to have only 50MB/100 MB of local space, for files and database. Now, before going to production, I delete manually some files. For example development version of CSS and javascript, plugin language files that I do not use, etc. Is there a software or a batch script that can help me to reduce the size of my WordPress installation before deploying it to production server?


How Do I Prevent Junk Account Creation?

I want to allow readers of my WordPress-driven sites who comment frequently the ability to sign up and have their own account on the site. However the ratio of actual readers versus spam scripts using the sign-up form is something like 1:100. Is there a reasonable solution for preventing these bogus accounts from being created while still allowing reader sign-ups? Last I looked, I couldn't find anything for account creation like what spam-prevention measures are available for comments.


Automatically set post title to same value as a meta box

I've removed "Title" from a custom post type that I created. Which makes it that all new posts gets the name "Auto Draft". To get around this I want to be able to fetch a value/post name from a meta box and save that as the new title. Is this possible? This is what I'm using, and the value of this meta should be the new title                function save_title_meta($post_id, $post) {          // verify this came from the our screen and with proper authorization,     // because save_post can be triggered at other times     if ( !wp_verify_nonce( $_POST['meta_noncename'], plugin_basename(__FILE__) )) {     return $post->ID;     }          // Is the user allowed to edit the post or page?     if ( !current_user_can( 'edit_post', $post->ID ))         return $post->ID;          // OK, we're authenticated: we need to find and save the data     // We'll put it into an array to make it easier to loop though.          $project_meta['_title'] = $_POST['_title'];          // Add values of $project_meta as custom fields          foreach ($project_meta as $key => $value) { // Cycle through the $project_meta array!         if( $post->post_type == 'revision' ) return; // Don't store custom data twice         $value = implode(',', (array)$value); // If $value is an array, make it a CSV (unlikely)         if(get_post_meta($post->ID, $key, FALSE)) { // If the custom field already has a value             update_post_meta($post->ID, $key, $value);         } else { // If the custom field doesn't have a value             add_post_meta($post->ID, $key, $value);              }         if(!$value) delete_post_meta($post->ID, $key); // Delete if blank     }           }          add_action('save_post', 'save_title_meta', 1, 2); // save the custom fields     ?>                         echo '<input type="hidden" name="meta_noncename" id="meta_noncename" value="' .     wp_create_nonce( plugin_basename(__FILE__) ) . '" />';          // Get the location data if its already been entered     $title = get_post_meta($post->ID, '_title', true);          // Echo out the field     echo '<input type="text" name="_title" value="' . $title  . '" class="widefat" />';     ?>


How to allow <video> html5 tag in Wordpress

Currently I am running a Wordpress MU blog using the Unfiltered MU plugin. However, when I try to insert an HTML5 tag, it gets stripped away. I believe it may be the WYSIWYG editor cleaning the code. Where can I change settings to allow ? Thanks


Permalinks in Custom Post types

Is it possible for a custom post type to have a permalink as `domain.com/custom-slug/` instead of `domain.com/custom/custom-slug/`? I can't seem to achieve it. `rewrite` argument while registering it either defaults to the latter one or a custom one by using `'rewrite' => array( 'slug' => 'blah-blah' )`


Tabbed feeds with ajax vs. without on homepage

I have a tabbed section on my homepage where I call different feeds for new posts by category of my site much like the new youtube layout. I have 10 different feeds so my question is how important is to have those feeds crawled because I'd like to just rotate them with ajax rather than have all of it called and hidden on page load. I looked into the hash tag solution for crawling ajax but that doesn't seem to apply in this situation where the only thing needing crawled is the homepage. The other question is if I let it all load hidden without ajax is that going to dramatically slow down load times or is not so bad because the content isn't actually being shown on load?