title: Tags Sorted By Characters?

text: If i put multiple tags in a post then after publishing the post all tags are auto arranged by Character Serial, like A B C D... any idea if i wish to have all tags will not sorted or arranged by Character serial.... so, first tag will be first and last tag will be placed at last... though the first tag may be start with Z and the last tag start with A .. So what is the way to keep tag serial static as i have put?


title: Latest 5 posts (custom post type), each post different CSS

text:
While creating our portfolio i'd like to make a dynamic header with the latest 5/6 featured images in a row. All these posts come out of the 'apps' custom post type.

      How would I create something like this? Thanks in advance.


title: Set Featured Image Front Frontend Form

text:
I have been struggling for days to figure this one out. I have successfully implemented a form to submit posts from the front end of my site. ButI can't figure out how to make the image uploads work. I want whatever image the user uploads to automatically attach to the post and become its featured image. Can someone please explain how to do this with my existing code? I have searched through all relevant questions on this forum and none of the solutions work for me.                               <?                      if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['insert_post'] )) { //check that our form was submitted                 //If it has, redirect to the dashboard                 ?> <?php                      $title = $_POST['thread_title']; //set our title                      if ($_POST['thread_description']=="") { // check if a description was entered                 $description = "See thread title..."; // if not, use placeholder                 } else {                 $description = $_POST['thread_description']; //if so, use it                 }                      $tags = $_POST['thread_tags']; //load thread tags (custom tax) into array                      $post = array( //our wp_insert_post args                 'post_title'    => wp_strip_all_tags($title),                 'post_content'  => $description,                 'post_category' => array('0' => $_POST['cat']),                 'tax_input' => array('thread_tag' => $tags),                 'post_status'   => 'publish',                 'post_type' => 'tsv_userpost'                 );                      $my_post_id = wp_insert_post($post); //send our post, save the resulting ID                      $current_user = wp_get_current_user(); //check who is logged in                      add_post_meta($my_post_id, '_your_custom_meta', $var); //add custom meta data, after the post is inserted                           } else {                      if(is_user_logged_in()) { // check that the user is logged in before presenting form                      $current_user = wp_get_current_user();                      ?>
                      <form id="new_thread" name="new_thread" method="post" action="" enctype="multipart/form-data">                      <input class="required" type="text" id="thread_title" value="" tabindex="1" name="thread_title" placeholder="Thread Title" />                      <textarea id="thread_description" name="thread_description" cols="80" rows="20" tabindex="2"></textarea>
                 <select name='cat' id='cat' class='postform required' tabindex="3">                 <option value="" selected="selected">Choose:</option>                 <option class="writing" value="90">Writing</option>                 <option class="image" value="91">Image</option>                 <option class="video" value="92">Video</option>                 <option class="audio" value="94">Audio</option>                 <option class="link" value="95">Link</option>                 </select>
                      <input type="text" value="" tabindex="4" size="16" name="thread_tags" id="thread_tags" placeholder="Tags" />
                                       Featured Image:                 <input type="file" name="user-image-featured" id="user-image-featured" size="20">
                 <input type="submit" value="Save Post" tabindex="5" id="thread_submit" name="thread_submit" class="thread-button" />                      <input type="hidden" name="insert_post" value="post" />                      <?php wp_nonce_field( 'new_thread' ); ?>                      </form>
                      <?php } else { echo 'please login'; } } ?>


title: Load facebook php sdk problem

text: I am trying to load the facebook php sdk in the wordpress template. I've added the code to the header.php file:                   locate_template( 'facebook/facebook.php', true );          $facebook = new Facebook(array(          'appId'  => appid,          'secret' => appsecret     ));          $signedRequest = $facebook->getSignedRequest();          if ( isset($signedRequest['app_data']) )     {         echo $signedRequest['app_data'];         }       But I get get this error:               Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent..      How can I load the facebook sdk before any other file is loaded


title: Repeated nav bar queries failing to be cached

text: Every time a page view occurs, wordpress is sending a complex non-indexed query below. The exact same query is sent over and over and it seems that it is being passed through some "caching" code. But why doesn't the cache actually prevent re-executing the query over and over? The query being caught, which is asked repeatedly on every page view, is:               # Query_time: 0 Lock_time: 0 Rows_sent: 320 Rows_examined: 1608     SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN      (2366,2363,4066,...etc, about 30 entries);      I noticed this using log-queries-not-using-indexes in mysql. The pertinent call stack is:   * wp_get_nav_menu_items(3) in nav-menu.php (around line 495) calls   * get_posts in post.php (around line 1461) calls   * WP-Query->query in query.php (around line 2941) calls   * WP-Query->get_posts in query.php (around line 2767) calls   * update_post_caches in post.php (around line 4454) calls   * update_postmeta_cache in post.php (around line 4474) calls   * update_meta_cache in meta.php (around 560)   * which makes the nasty SELECT statement The SELECT statement is basically getting all the info from wp_postmeta for menu items whose post_id there has term_taxonomy_id = 3 in wp_term_relationships. In other words, it's getting some metadata corresponding to the menu bar. But, why is the cache _updated_ , and db re-queried, on every single page view? I have very little clue how the cache works (I'm just starting to read about it) and that's why I'm writing here. All I can say is that the "cache_results" is automatically turned on inside of the call to WP- Query->get_posts around line 1970. That's great, but why might the cache get refreshed on every single page view? If the cache is operating as I would normally expect a cache to operate, I don't get why it keeps making this query over and over. How can I best fix the lack of effective caching? Or is this the expected behaviour? (xref: http://wordpress.org/support/topic/core-code-caching-issue-w-nav )


title: How can I safely use $_SERVER['REQUEST_URI'] to avoid XSS?

text: I've seen a lot of warnings about using `$_SERVER['REQUEST_URI']` because it can open things up to XSS, but I haven't been able to find anything confirming a safe way to use it. Some people have mentioned using `esc_url()`, but I wasn't able to find anything confirming how to safely use it. This is my best guess, would this safely prevent XSS attacks? `echo esc_url(( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);` If I want to use the URL internally rather than display it, it seems I have to use `esc_url_raw()`. Is this safe as well? `$pageurl = esc_url_raw(( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);`


title: Contact form won't submit

text: I posted this on the Stackoverflow site and haven't received much assistance with the issue. I hope that, by reposting it on here, someone could please offer me any assistance. I am creating a theme in Wordpress, using an Akismet form and a jQuery AJAX script (now using a new script). I have modified all of the relevant areas to integrate into my Wordpress site, even using the Akismet API key that is already there from the Akismet plugin. Here is my code: **Form**               <form method="post" id="contact_form">       <input id="name" type="text" name="name" tabindex="1"/> Name       <input id="email" type="text" name="email" tabindex="2"/> E-mail       <input id="website" type="text" name="website" tabindex="3" value="http://" /> Website       <textarea id="message" tabindex="4" rows="10" cols="60" name="message"></textarea>       <input type="submit" value="Send E-mail" tabindex="5" />     </form>      **jQuery**                     **PHP Script** _(now in 'functions.php', not 'inc/email.php')_               <?php         include (TEMPLATEPATH . 'inc/Akismet.class.php'); // Using require seems to stop the page from loading, but include seems to show the page.         function evetheme_sendmail( $name, $email, $website, $ip, $is_spam, $message) {         $subject = '';         if( $is_spam == true )             $subject = "[SPAM?]";          $subject .= "[Your_site.com] E-mail received from ".$name."//".$email;          //    wp_mail( get_option('admin_email'), '[WP] ' . $subject, $message, 'From: '. $name . ' <' . $email . '>');         mail( get_option('admin_email'), '[PHP]' . $subject, $message, 'From: '. $name . ' <' . $email . '>');     }     function evetheme_subconfor(){         foreach($_POST as $key=>$value)             $key = $value;             $wp_key = get_option( 'wordpress_api_key' );             $our_url = get_bloginfo( 'url' );                  $name = $_POST['name'];             $email = $_POST['email'];             $website = $_POST['website'];             $message = $_POST['message'];             $ip = $_SERVER['REMOTE_ADDR'];                  $akismet = new Akismet($our_url, $wp_key);             $akismet->setCommentAuthor($name);             $akismet->setCommentAuthorEmail($email);             $akismet->setCommentAuthorURL($website);             $akismet->setCommentContent($message);             $akismet->setUserIP($ip);                  evetheme_sendmail( $name, $email, $website, $ip, $akismet->isCommentSpam(), $message);         die();     }          // creating Ajax call for WordPress       add_action('wp_ajax_nopriv_evetheme_subconfor', 'evetheme_subconfor');     add_action('wp_ajax_evetheme_subconfor', 'evetheme_subconfor');      I have tried numerous things to get this to send emails to me. I have tried replacing the `get_option('admin_email')`, `get_option('wordpress_api_key')` and `get_bloginfo('url')` references with their respective values, but I am not receiving any emails from the script. I have tested by adding a new user to the site and the problem seems limited to the script, as I am receiving emails from the `wp_mail` function via Contact Form 7 and the main system. Could someone please help me? I am getting to my wits end here. I have tried including the form submission script on the page itself and calling it, both in the jQuery script and in the form via the `action` attribute, but in both instances it brings back a 400 server error for the permalinked page or a 500 server error on the admin-ajax.php page or with `wp_mail()`. **Note: Since using the new code, I have only had 500 server errors when loading the admin- ajax.php file, regardless of whether I use wp_mail() or mail().** I'm really lost and the only thing that is stopping me from giving up is I'm a stubborn so-and-so.


title: Can't set custom taxonomy terms via custom form

text: ## Question I am creating my first plugin and in it users will be able (among other things) to create new post via custom form from wordpress backend. This post uses custom post type and custom taxonomy. Form creates new post but it fails to set custom taxomony. Creating post regularly (not via my custom form) works fine ie. allows me to add custom taxomony to it. Custom post type and custom taxonomies are registered by the book, terms are already inserted in db. * _taxonomy is not a variable for debugging purposes_                   add_action('plugins_loaded', 'newpost');              function newpost() {             if (isset($_POST['new_post']) == '1') {                 $post_title = $_POST['posttitle'];                 $post_content = $_POST['postcontent'];                 $new_post = array(                     'ID' => '',                     'post_author' => 1,                     'post_type' => 'cars',                     'post_content' => $post_content,                     'post_title' => $post_title,                     'comment_status' => 'closed',                     'ping_status' => 'closed',                     'post_status' => 'publish',                     'tax_input' => array('cars' => array('bmw', 'audi'))                 );                      $post_id = wp_insert_post($new_post);             }         }      I've even tried to remove **'tax_input'** and use **wp_set_post_terms** and **wp_set_object_terms** but results were same. Two days I'm stuck on this, so any help would be greatly appreciated... ## Solution The solution was to change **plugins_loaded** to **init** with low priority.                  add_action( 'init', 'newpost', 200 );      So the issue was that user privileges have not yet been set, upon firing the plugin.


title: LESS compiler for Wordpress

text: can I compile some .less-files automatically by using Wordpress. I found just lessphp Thanks Ogni


title: Count posts for each taxonomy term for each month

text: Cannot figured it out... I need to count how many posts there are for each taxonomy term form each month.


title: WP Rewrite for a custom variable

text: I know there are dozens of posts on this, but (I'm embarassed to say this) I'm having a rough time following them. My goal here is to have `/resources?audience=teachers` become `/resources/audience/teachers` or event `/resources/teachers`. I have 2 custom taxonomies on attachments - Types and Audiences. I then have a page titled Resources which is going to house all of the attachments within these categories. If an audience of type is specified, I will only display that term's attachments. I've tried using the following this within an `init` hook:               add_rewrite_rule(         'resources/([^/]+)/?$',         'index.php?pagename=resources&audience=$matches[1]',         'top' );      With no success. I'm sure it's a no-brainer.


title: Using default wordcount javascript in Wordpress on custom wp_editor() areas

text: I have two `wp_editor()` instances on pages and posts used to populate the sidebars of my three-column website. I would like to use the default wordpress word-count script on the two wp-editor areas to get the word-count of the content within them. I enqueued the script and added the required HTML but the wordcount was always that of the main content editor area. Has anyone managed to use this functionality with custom wp_editor areas and what HTML will I use? I have searched on the web but could not find any examples where the default script is used. Thanks in advance nav


title: How do I correctly transfer my site from one domain to another?

text: I developed our wordpress site on a subdomain, so I did not disrupt our homepage while I got everything up and running with Wordpress (It was originally running under Orchard, and I needed tochange it). After the WP site was ready I changed the Wordpress Address general setting to the correct URL, and copied all the files over. Unfortunately, it seems like this is not all that really needs to be done. Today (quite randomly, since it worked before oddly), images for a part of my site weren't showing up. Long story short it was because all of my WordPress media are pointing to the URL for them on the subdomain, NOT the core domain the site was currently running on. After doing more research in the database, I can see other references to the subdomain still in the database, such as the `posts.guid` field in the database for all posts on the site. What do I have to do to correctly move everything over to my core domain, so when I nuke the subdomain it doesn't affect the main site? I would prefer not having to completely recreate content (like re-upload images) if possible.


title: How to delete posts which have same title?

text: Some of my posts duplicate title. How to delete them ? And keep only one. Example: I have 4 post which have same title. And I want to delete 3 posts and keep one post. How to do this ? Thank you very much ! Sorry for my poor English !


title: What makes a placeholder resizable in Tinymce?

text: It's not that hard to make a plugin to TinyMCE, similar to what the Wordpress gallery is doing in WP 3.5. Unfortunately, these custom placeholders are always non-resizable, although they show the resizer handles. A new image inserted into a post is resizable with the handles, an embedded iframe is resizable, but a new gallery placeholder is not resizable (in this case it doesn't make sense, galleries don't resize). However, I need a custom placeholder that **is** resizable. Is there a special class that turns this on or off, or a function that I need to call to enable resizing on a certain element?


title: the_category() tag not styling HTML or CSS

text:
I am having problems getting my the_category() template tag to style accordingly with the rest of my theme. I believe this is because the HTML isn't output the same way as the the_author() and the_comments() tags. I've looked into my category_template.php file but am having trouble identifying what exactly I need to tweak to get it to style the same. Here is my code for the category post details:                                   <a href="<?php get_category_link( $category_id ); ?>" class="post-item">                                                          <?php the_category( '•' ); ?>                               I am almost certain there is a filter I need to apply in the category_template.php page but am not sure what to change. For a visual demonstration look at http://blog.diginomics.com EDIT: I've used your advice with some success. It is falling in place and styling correctly, but now I have two category links. Take a look at the page. Here is my index.php code:               <?php the_category( '•' ); ?>      And here is my category_template.php:               $categories = get_the_category( $post_id );     foreach ($categories as $category){     echo 'term_id) . '">' . '

 ' . $category->cat_name . '';     }


title: Readonly input text appears unlocked while the page is loading

text: I need help with a code for locking editing an input of type text in the profile page of Wordpress. I added the following code:               (function(){         $("#email").attr("readonly","readonly");     });      But while the page is loading, the field appears unlocked, and if the user press 'Esc', the page loading is stopped and he can edit the field. Is there any way to avoid this?


title: Add classname to the_category() function?

text:
is it possible to use `add_filter` or something similar to add the `slug` of the category as classname to the `the_category()` function? Right now when using `the_category()` the output looks like this …

             News

      Is it possible to somehow get this …

             News

      Or something similar, at least some classname with the `slug` of the category so I can select it via CSS? Thank you in advance, matt.


title: Exclude Child Term Posts from Parent Term Archive

text: I have created a custom hierarchical taxomony and when viewing a taxonomy archive page would like to only display the posts that have been assigned to that term. This works fine on the child term pages, but the parent term pages display posts assigned to them AND any child terms. I found a solution that solves this for categories by inserting the following link after the beginning of the loop:               <? if ((is_category()) && in_category($wp_query->get_queried_object_id())) { ?>      But I haven't been able to find a similar solution that works for custom taxonomies. I also tried:               function exclude_children($wp_query) {         if ( isset ( $wp_query->query_vars['custom_taxomony'] ) ) {             $wp_query->set('tax_query', array('include_children' => false));         }     }       add_filter('pre_get_posts', 'exclude_children');       But that does not seem to have any effect. So the question is, how do I do this?


title: How do I get the custom category URL from the custom post type?

text: I'm using a custom post type "portfolio" to create new posts and categories. I'm trying to retrieve the correct category/taxonomy URL from the post. I'm a couple days in on this and could really use some help. Registering post and tax below:               function portfolioposttype() {          $labels = array(         'name'               => __('Portfolio'),         'singular_name'      => __('Project'),         'add_new'            => __('Add New'),         'add_new_item'       => __('Add New Project'),         'edit_item'          => __('Edit Project'),         'new_item'           => __('New Project'),         'view_item'          => __('View Project'),         'search_items'       => __('Search Projects'),         'not_found'          => __('No projects found'),         'not_found_in_trash' => __('No projects found in Trash'),         'parent_item_colon'  => __('Parent Project:'),         'menu_name'          => __('Portfolio')     );     $args = array(         'labels'                => $labels,         'supports'              => array('title','editor','thumbnail'),         'taxonomies'            => array('portfolio-categories'),         'public'                => true,         'show_ui'               => true,         'show_in_menu'          => true,         'show_in_nav_menus'     => true,         'exclude_from_search'   => true,         'has_archive'           => true,         'rewrite'               => array('slug'=>'case-study'), //singe project slug         'capability_type'       => 'post',         'menu_position'         => 5,         'menu_icon'             => Z_BASE_URL.'functions/assets/img/icon-portfolio.png',         'query_var'             => true     );     register_post_type('portfolio', $args );          $taxonomy_portfolio_category_labels = array(         'name'                       => __('Portfolio Categories'),         'singular_name'              => __('Category'),         'search_items'               => __('Search Categories'),         'popular_items'              => __('Popular Categories'),         'all_items'                  => __('All Categories'),         'parent_item'                => __('Parent Category'),         'parent_item_colon'          => __('Parent Category:'),         'edit_item'                  => __('Edit Category'),         'update_item'                => __('Update Category'),         'add_new_item'               => __('Add New Category'),         'new_item_name'              => __('New Category'),         'separate_items_with_commas' => __('Separate categories with commas'),         'add_or_remove_items'        => __('Add or remove Categories'),         'choose_from_most_used'      => __('Choose from most used Categories'),         'menu_name'                  => __('Categories')     );     $taxonomy_portfolio_category_args = array(         'labels'            => $taxonomy_portfolio_category_labels,         'public'            => true,         'show_in_nav_menus' => true,         'show_ui'           => true,         'show_tagcloud'     => false,         'hierarchical'      => true,         'rewrite'           => array('slug'=>'projects'), //category slug         'query_var'         => true          );     register_taxonomy('portfolio-categories',array('portfolio'),$taxonomy_portfolio_category_args);          }      add_action('init','portfolioposttype');      So, from www.domain.com/case-study/sample-project-1 I need to be able to link it back to the category: www.domain.com/projects/category-1 There could be another www.domain.com/case-study/sample-project-2 that would link to www.domain.com/projects/category-2 I hope this makes sense and really appreciate any advice!


title: Admin menus and submenus

text: I created an options page for admin and displayed it as a top level menu -> `add_menu_page($themename, $themename, 'administrator', basename(__FILE__), 'mytheme_admin');` I want to add a sub menu under the top level menu I created to display exactly the same page (to be displayed as a sub menu but open this page also when user clicks the top level menu). Also I don't know how to add another theme page I created under this top level menu. I have read the wordpress documentation and couldn't make it, before asking here. Many thanks.


title: Gallery Shortcode: using size="full" doesn't call the actual thumbnail image size

text: I have my Media settings set up so that my thumbnail size is 60x60 pixels and the "Crop thumbnail" box is checked. I can see in the /uploads folder that there are in fact perfect square 60x60 thumbnails being generated for all the images are being uploaded. However, when I use the gallery shortcode like this: [gallery size="thumb"] It's not actually calling that image thumbnail file. What it is outputting instead is the originally uploaded image source file and scaling it down using width="" and height="" attributes creating a proportional scale down to 60 pixels in width like this: `<img width="60" height="45" src="/uploads/original-source.jpg" />` But I need it to be doing this: `<img width="60" height="60" src="uploads/original-source-60x60.jpg" />` Has anyone else run into this problem?


title: All pages are redirected to homepage if using Permalink Custom Structure

text: My website http://laptopre.net/ is running on WP 3.4.2. When I changed the Permalinks setting to Custom Structure - /%category%/%postname%/ , all the pages in my site are redirected to homepage. Could anyone guide me to solve this problem please. Here is content of my .htaccess file               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>     # END WordPress          ###Please Don't edit these comments or the content in between. kloxo uses this to recognize the lines it writes to the the file. If the above line is corrupted, it may fail to recognize them, leading to multiple lines.          <Ifmodule mod_php4.c>     php_value error_log "/home/admin/__processed_stats/laptopre.net.phplog"     php_value upload_max_filesize 2M     php_value max_execution_time  30     php_value max_input_time  60     php_value memory_limit  32M     php_value post_max_size  8M     php_flag register_globals  off     php_flag display_errors  off     php_flag file_uploads  on     php_flag log_errors  off     php_flag output_buffering  off     php_flag register_argc_argv  on     php_flag magic_quotes_gpc   off     php_flag magic_quotes_runtime  off     php_flag magic_quotes_sybase  off     php_flag mysql.allow_persistent  off     php_flag register_long_arrays  on     php_flag allow_url_fopen  on     php_flag cgi.force_redirect  on     php_flag enable_dl  on     </Ifmodule>          <Ifmodule mod_php5.c>     php_value error_log "/home/admin/__processed_stats/laptopre.net.phplog"     php_value upload_max_filesize 2M     php_value max_execution_time  30     php_value max_input_time  60     php_value memory_limit  32M     php_value post_max_size  8M     php_flag register_globals  off     php_flag display_errors  off     php_flag file_uploads  on     php_flag log_errors  off     php_flag output_buffering  off     php_flag register_argc_argv  on     php_flag magic_quotes_gpc   off     php_flag magic_quotes_runtime  off     php_flag magic_quotes_sybase  off     php_flag mysql.allow_persistent  off     php_flag register_long_arrays  on     php_flag allow_url_fopen  on     php_flag cgi.force_redirect  on     php_flag enable_dl  on     </Ifmodule>      Thanks, Nghiep


title: Using WP Query to search by multiple meta fields

text:
I made a custom search form with select boxes and text fields. I have a select box with options like "renting" and "selling" (its a real estate site) There are also input fields for minimum and maximum price, for location etc. In the posts I have custom fields for all those filters. I used WP_Query for that. And it should work. Here is the query:               // Define the arguments for the WP query     $args = array(             'post_type' => 'post',             'relation' => 'AND',             'meta_query' => array(                     array(                             'key' => 'ex_lokacija',                             'value' => $grad ,                             'compare' => 'LIKE'                     ),                     array(                             'key' => 'ex_vrsta_oglasa',                             'value' => $adType ,                             'compare' => 'LIKE'                     ),                     array(                             'key' => 'ex_tip_nekretnine',                             'value' => $realEstateType ,                             'compare' => 'LIKE'                     ),                     array(                             'key' => 'ex_dio_pg',                             'value' => $dioGrada ,                             'compare' => 'LIKE'                     ),                     array(                             'key' => 'ex_dio_pg',                             'value' => $dioGrada ,                             'compare' => 'LIKE'                     ),                     array(                             'key' => 'et_square_footage',                             'value' => array( $squareFrom, $squareTo ),                             'type' => 'numeric',                             'compare' => 'BETWEEN'                     ),                     array(                             'key' => 'et_price',                             'value' => array( $priceFrom, $priceTo ),                             'type' => 'numeric',                             'compare' => 'BETWEEN'                     ),                     array(                             'key' => 'et_bedrooms_number',                             'value' => $roomsNum,                             'type' => 'numeric',                             'compare' => 'LIKE'                     )             )     );          $searched_posts = new WP_Query( $args );      I used preg_replace for each of the $_GET vars and assigned them to these you see in 'value'. Now, the problem is that it doesn't show anything, even if there should be results. Also, it won't work without the 's' field - something must be put in it in order to even load the empty results page. **Possible problem #1** I'm guessing there is a problem with the loop, which I created like this:                                   while ($searched_posts->have_posts()) : $searched_posts->the_post(); ?>                                            <?php the_title(); ?>                             <?php the_content(); ?>                                        <?php endwhile; ?>      That is just for testing. **Possible problem #2** I put all of this inside of one file - search.php. Maybe that is causing problems? Here it is: ‚‚               global $wpdb;          $grad           = preg_replace( '/^[0-9a-zA-Z-]/', '', $_GET['grad'] );     $adType         = preg_replace( '/^[0-9a-zA-Z-]/', '', $_GET['adType'] );     $realEstateType = preg_replace( '/^[0-9a-zA-Z-]/', '', $_GET['realEstateType'] );     $dioGrada       = preg_replace( '/^[0-9a-zA-Z-]/', '', $_GET['dioGrada'] );     $squareFrom     = preg_replace( '/[^0-9]/', '', $_GET['squareFrom'] );     $squareTo       = preg_replace( '/[^0-9]/', '', $_GET['squareTo'] );     $priceFrom      = preg_replace( '/[^0-9]/', '', $_GET['priceFrom'] );     $priceTo        = preg_replace( '/[^0-9]/', '', $_GET['priceTo'] );     $roomsNum       = preg_replace( '/[^0-9]/', '', $_GET['roomsNum'] );          // Change the defaults if not chosen     if($squareFrom == '') { $squareFrom = '0'; }     if($squareTo == '') { $squareTo = '10000000'; }          // Define the arguments for the WP query     $args = array(             'post_type' => 'post',             'relation' => 'AND',             'meta_query' => array(                     array(                             'key' => 'ex_lokacija',                             'value' => $grad ,                             'compare' => 'LIKE'                     ),                     array(                             'key' => 'ex_vrsta_oglasa',                             'value' => $adType ,                             'compare' => 'LIKE'                     ),                     array(                             'key' => 'ex_tip_nekretnine',                             'value' => $realEstateType ,                             'compare' => 'LIKE'                     ),                     array(                             'key' => 'ex_dio_pg',                             'value' => $dioGrada ,                             'compare' => 'LIKE'                     ),                     array(                             'key' => 'ex_dio_pg',                             'value' => $dioGrada ,                             'compare' => 'LIKE'                     ),                     array(                             'key' => 'et_square_footage',                             'value' => array( $squareFrom, $squareTo ),                             'type' => 'numeric',                             'compare' => 'BETWEEN'                     ),                     array(                             'key' => 'et_price',                             'value' => array( $priceFrom, $priceTo ),                             'type' => 'numeric',                             'compare' => 'BETWEEN'                     ),                     array(                             'key' => 'et_bedrooms_number',                             'value' => $roomsNum,                             'type' => 'numeric',                             'compare' => 'LIKE'                     )             )     );          $searched_posts = new WP_Query( $args );                     get_header(); ?>

                     <?php get_template_part('includes/breadcrumbs');                               while ($searched_posts->have_posts()) : $searched_posts->the_post(); ?>                                            <?php the_title(); ?>                             <?php the_content(); ?>                                        <?php endwhile; ?>
                       <?php get_sidebar(); ?>          <?php get_footer(); ?>      Thanks for viewing my problem!


title: Get Previous & Next posts by Post ID

text: How can I go about getting the previous and next posts from _outside_ the loop? Everything I try to do aside from the custom SELECT query (using `get_posts` or `WP_Query`) breaks stuff further down the page. I currently have a recursive function which will hopefully find the first "previous" post which satisfies a certain condition. I grab the first value to test from `get_previous_post()` but don't know how to get the `previous_previous_post()`.               add_action( 'wp_ajax_nopriv_myajax-submit', 'ajax_project_load' );     add_action( 'wp_ajax_myajax-submit', 'ajax_project_load' );          function ajax_project_load() {         $the_slug = $_POST['slug'];         $args=array(           'name' => $the_slug,           'post_type' => 'projects',           'post_status' => 'publish',           'showposts' => 1,           'ignore_sticky_posts' => 1         );         $my_posts = get_posts($args);         if( $my_posts ) :                  global $post;             $post = $my_posts[0];              $postCapabilityFilter = $_POST['capFilter']=='undefined' ? $_POST['capFilter'] : substr($_POST['capFilter'], 1);                  $response = json_encode( "Success" );             header( "Content-Type: application/json" );                    $next_post = get_previous_post();     function filtered_next_post($next_post){         if($next_post){             $next_slug = $next_post->post_name;             $next_ID = $next_post->ID;             global $wpdb;             global $postCapabilityFilter;             $querystr = "             SELECT $wpdb->postmeta.*             FROM $wpdb->posts, $wpdb->postmeta             WHERE $wpdb->posts.post_type = 'projects'              AND $wpdb->posts.post_status = 'publish'              AND $wpdb->posts.ID = $next_ID             AND $wpdb->posts.ID = $wpdb->postmeta.post_id             AND $wpdb->postmeta.meta_key = '_slideshow_content'             ORDER BY $wpdb->posts.post_name DESC             ";             $nextProjQuery = $wpdb->get_results($querystr, OBJECT);             foreach($nextProjQuery as $nextProj):                 $nextProjMetaArr = unserialize($nextProj->meta_value);                 foreach ($nextProjMetaArr['slides'] as $npSlideArr){                     echo 'and..';                     if ( !in_array( $postCapabilityFilter, $npSlideArr['slideCap'] ) ){                         echo 'not in it..';                         //$next_post = get_previous_previous_post();                         //filtered_next_post($next_post);                     }                 }             endforeach;                                     return $next_slug;         }     }     $next_slug = filtered_next_post($next_post);


title: How to check if a post is in categories x,y,z inludint their subcategories

text: I am trying to check whether a post is in categories X, Y, Z (including the subcategories within them). This is the piece of code I have tried in my single.php:               if ( in_category(array( '1', '2', '3', ) ) {                         echo "This post is in the selected categories or their subcategories";                                   }                     else {                     echo "this post inst in the categories or the subs.";                               }      I have also tried using the post_is_in_descendant_category (included the function from the codex above my code) but it still wont display true. Including the function This is my code I used on test 2#:                   if ( in_category(array( '1', '2', '3', ) ) || post_is_in_descendant_category( array( '1', '2', '3', ) ) ) {                         echo "This post is in the selected categories or their subcategories";                                   }                     else {                     echo "this post inst in the categories or the subs.";                               }


title: Open external links in a new window

text: Is it possible to make some sort of change or add a plugin that allows me to make every 'external' link open in a new window? Just an example: if my blog was called http//timmy.com/ and I wanted to link to http//tom.com/, it would open a new window instead of the same window, but I wanted to link from http//timmy.com/ to http//timmy.com/somewhere/ in the same window. So I want all external link from my website to another in a new window/tab, but I want every internal link, from my website to somewhere else on my website, to be in the same window/tab. Is this possible?


title: Explanation of the "posts_join" and "posts_fields" filter hooks?

text: I'm new to the "posts_" filter hooks and wanted to know a few things from those in the know:   * In this question, someone posted an answer using posts_join that took a second parameter of $query: add_filter('posts_join',array(&$this,'posts_join'),10,2); ... function posts_join($join,$query) { } Is this an instance of wp_query or something similar?   * -Same example: how would I determine the post type so that I can do custom joins for each custom post type I have on the admin side   * -What does the posts_fields filter hook do? from the example I've seen, it looks like it replaces the columns in the SELECT clause of an SQL call. Am I correct in that assumption? And does it too have more parameters that can be called?? I find some examples but I can't get any solid documentation anywhere. Thank you in advance for all answers given


title: Printing errors during save custom post type

text: I am trying to debug my save_post function and cannot get the $_POST array to print so that I can see what's being posted. Please help!               add_action ('save_post', 'save_events');          function save_events($post_id){         if (('event' == $_POST['post_type']) && ('publish' == $_POST['post_status']) && ( $_POST['original_post_status'] != 'publish' )){                     print_r($_POST);                                 //function code...                 }     }


title: Slider Plugins for header

text: I am new at wordpress. I need one header slider plugins like this Please suggest me plugins. I am use "header-image-slider" but it will not display below slider of main image. Thanks in advance


title: WordPress Pages into Sections edit.php PHP hack

text: Im currently working on a Theme for a WordPress website. The theme affectively splits the website up into three sections.               http://url.com/section1       http://url.com/section2       http://url.com/section3        I need to be able to split up Pages in the backend into these sections. So in the menu it appears:               - Pages         - Section 1         - Section 2         - Section 3      And when you go into the relevant section the "Add New Page" button would set the pages parent to be the corresponding section. I realise this is very complicated,I currently have divided the menu but need to provide functions for each menu item. Is there anyway to do this with action hooks? Or will I have to edit the core files new-post.php and edit.php?


title: Disable the "remember me" to wp-admin

text: I Look long enough to find the solution of my problem. Really, Is there any way to disable the "Remember me" to wp-admin? I want to disable it for safety reasons. Thanks in advance.


title: Restrict editing of a custom post type based on status and user capabilities

text: I have a custom post type `guest_blog` registered with `'capability_type' => 'guest_blog'` and `'map_meta_cap' => true`. I want to restrict users that do not have `publish_guest_blogs` capability from editing a `guest_blog` with `pending` status. Here is the code I was using which did not work:               add_filter( 'user_has_cap', 'wpse_user_has_cap', 100, 3 );     function wpse_user_has_cap( $allcaps, $caps, $args ) {         if( in_array( $args[0], array('edit_guest_blogs', 'delete_guest_blogs') )             && empty( $allcaps['publish_guest_blogs'] ) //user can not publish guest blogs             && ! empty( $allcaps['edit_guest_blogs'] ) ) //user can edit guest blog         {             // Load the post data:             $post = get_post( $args[2] );                  if( $post->post_status == 'pending' )                   $allcaps[$caps[0]] = FALSE;         }              return $allcaps;     }      I wrote this based on the example in Codex (user_has_cap) and some answers here on WPSE (1, 2). Then I found that `$args[0]` is asking for `edit_posts` and not `edit_guest_blogs` although I have `'map_meta_cap' => true` and `$caps[0]` is the one that has the actual required capability (edit_guest_blogs). So I changed the first line to check against `$caps[0]` instead of `$args[0]` and then it worked:               //...     if( in_array( $caps[0], array('edit_guest_blogs', 'delete_guest_blogs') )      The question is if this is the right way to do it or not, and why all the samples are using `$args[0]` and not `$caps[0]`? What is the difference between these two parameters?


title: Plugin: Unable to Save the Image Alignment Option to Display in the Widget in the Sidebar

text: I am trying to add a select option to help user align the gravatar image. The problem is all value are saved except for the Image Alignment. When they select Image Alignment, it will revert back to "None" http://pastebin.com/03fj7tc6 Any help would be highly appreciated


title: Retrieve current post's tags

text: Is it possible to use get_post() to retrieve which tags were selected in the post? I would like a way to store a single post's tags into a variable.


title: Functions.php error - when trying to change the theme

text: After trying to replace the wordpress theme , it says that the functions.php file in the theme catalogue - the last line - is not ok Parse error: syntax error, unexpected $end in ... /themes/themename/functions.php on line 1500 line 1500 is actually only symbol ?> **EDIT** ok, here is the pastebin link of the functions.php file that has error http://pastebin.com/by5TtZq6 p.s. i am wondering - since its supposed to be a ready made template - then how could it be error - its supposed to work p.s. may be its some kind of thing that can be messed up by changing wordpress settings or it uses some bad plugins ? ( like permalinks or some cache plugin etc. ) ...


title: Setting conditional background image from meta value

text:
I am trying to set background image from meta value.I am successful also.But if the meta image is not set the out put

      But I do not want to show `background: url('')` if there is not meta value is set.My code to get image                       $bgimage= get_post_meta( $post->ID, 'settings_image', true );             $img=background-image: url('.wp_get_attachment_url( $bgimage ).');      To display `style="<?php echo $img;?>"` I have tried                   if(isset($bgimage)){         $img=background-image: url('.wp_get_attachment_url( $bgimage ).');         }


title: Pagination of custom mysql in wordpress

text:
I'm a novice with php and mysql so please be kind. The problem is I'm calling a database which has various states open, closed, pending etc, all this works fine. The problem is when I click next on my paging links the page just reloads to the start page with all states visible and the first 6 rows visible. My code seems to work fine as the url of next, prev page as a different start number for the start of the database query eg (http:/wordpress/?page_id=1072?s=6&np=3). I was wondering if this could be to with wordpress? help much appreciated.               $dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) ;     mysql_select_db (DB_NAME) ;          /*state control buttons */          echo "

<form method=\"post\" action=\"".htmlentities($_SERVER['REQUEST_URI'])."\"><INPUT TYPE=\"submit\" name=\"showopen\" VALUE=\"\" class=\"show_open\"></form>
	";     echo "
<form method=\"post\" action=\"".htmlentities($_SERVER['REQUEST_URI'])."\"><INPUT TYPE=\"submit\" name=\"showpending\" VALUE=\"\" class=\"show_pending\"></form>
	";     echo "
<form method=\"post\" action=\"".htmlentities($_SERVER['REQUEST_URI'])."\"><INPUT TYPE=\"submit\" name=\"showclosed\" VALUE=\"\" class=\"show_closed\"></form>
	";     echo "
<form method=\"post\" action=\"".htmlentities($_SERVER['REQUEST_URI'])."\"><INPUT TYPE=\"submit\" name=\"show_all\" VALUE=\"\" class=\"show_all\"></form>

";               $self = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ;     /* Status set code */          if (isset($_POST['close'])) {         $close_row = $_POST['close_row'];         $close = "UPDATE support_users SET status = 'Closed', date_altered = NOW() WHERE ticket_number=$close_row";         $closeresult = @mysql_query ($close);         $viewstate = $_POST['viewstate'];     }          if (isset($_POST['open'])) {         $close_row = $_POST['close_row'];         $close = "UPDATE support_users SET status = 'Open', date_altered = NOW() WHERE ticket_number=$close_row";         $closeresult = @mysql_query ($close);         $viewstate = $_POST['viewstate'];     }          if (isset($_POST['pending'])) {         $close_row = $_POST['close_row'];         $close = "UPDATE support_users SET status = 'Pending', date_altered = NOW() WHERE ticket_number=$close_row";         $closeresult = @mysql_query ($close);         $viewstate = $_POST['viewstate'];     }          if (isset($_POST['pending_ami'])) {         $close_row = $_POST['close_row'];         $close = "UPDATE support_users SET status = 'Pending AMI', date_altered = NOW() WHERE ticket_number=$close_row";         $closeresult = @mysql_query ($close);         $viewstate = $_POST['viewstate'];     }          if (isset($_POST['pending_arp'])) {         $close_row = $_POST['close_row'];         $close = "UPDATE support_users SET status = 'Pending ARP', date_altered = NOW() WHERE ticket_number=$close_row";         $closeresult = @mysql_query ($close);         $viewstate = $_POST['viewstate'];     }          /* View state set code */          if (isset($_POST['showopen'])) {         $viewstate='open';     }          if (isset($_POST['showpending'])) {         $viewstate='pending';     }               if (isset($_POST['showclosed'])) {         $viewstate='closed';     }          if (isset($_POST['show_all'])) {         $viewstate='all';     }               $display = 6;          if (isset($_GET['np'])) {         $num_pages = $_GET['np'];          } else {                  if ($viewstate=='open') {                $query = "SELECT ticket_number, first_name, surname, email, product, retailer, DATE_FORMAT(dop, '%d %M %Y') AS dop, message, address, DATE_FORMAT(created, '%d %M %Y %r') AS created, status FROM support_dev WHERE status='Open' ORDER BY ticket_number ASC";             $query_result = mysql_query ($query);              $num_records = @mysql_num_rows ($query_result);                  if ($num_records > $display) {         $num_pages = ceil ($num_records/$display);     } else {         $num_pages = 1;         }     }                   elseif ($viewstate=='pending') {             $query = "SELECT ticket_number, first_name, surname, email, product, retailer, DATE_FORMAT(dop, '%d %M %Y') AS dop, message, address, DATE_FORMAT(created, '%d %M %Y %r') AS created, status FROM support_dev WHERE status LIKE 'Pending%' ORDER BY ticket_number ASC";             $query_result = mysql_query ($query);              $num_records = @mysql_num_rows ($query_result);                  if ($num_records > $display) {         $num_pages = ceil ($num_records/$display);     } else {         $num_pages = 1;     }         }          elseif ($viewstate=='closed') {             $query = "SELECT ticket_number, first_name, surname, email, product, retailer, DATE_FORMAT(dop, '%d %M %Y') AS dop, message, address, DATE_FORMAT(created, '%d %M %Y %r') AS created, status FROM support_dev WHERE status='Closed' ORDER BY ticket_number ASC";             $query_result = mysql_query ($query);              $num_records = @mysql_num_rows ($query_result);                  if ($num_records > $display) {         $num_pages = ceil ($num_records/$display);     } else {         $num_pages = 1;         }          }     else {             $query = "SELECT ticket_number, first_name, surname, email, product, retailer, DATE_FORMAT(dop, '%d %M %Y') AS dop, message, address, DATE_FORMAT(created, '%d %M %Y %r') AS created, status FROM support_dev ORDER BY ticket_number ASC";             $query_result = mysql_query ($query);              $num_records = @mysql_num_rows ($query_result);                  if ($num_records > $display) {         $num_pages = ceil ($num_records/$display);     } else {         $num_pages = 1;         }     }     }               if (isset($_GET['s'])) {         $start = $_GET['s'];     } else {         $start = 0;     }              $query = "SELECT ticket_number, first_name, surname, email, product, retailer, DATE_FORMAT(dop, '%d %M %Y') AS dop, message, address, DATE_FORMAT(created, '%d %M %Y %r') AS created, status FROM support_dev ORDER BY ticket_number ASC LIMIT $start, $display";         if ($viewstate=='open') {                  $query = "SELECT ticket_number, first_name, surname, email, product, retailer, DATE_FORMAT(dop, '%d %M %Y') AS dop, message, address, DATE_FORMAT(created, '%d %M %Y %r') AS created, status FROM support_dev WHERE status='Open' ORDER BY ticket_number ASC LIMIT $start, $display";             }                 elseif ($viewstate=='pending') {             $query = "SELECT ticket_number, first_name, surname, email, product, retailer, DATE_FORMAT(dop, '%d %M %Y') AS dop, message, address, DATE_FORMAT(created, '%d %M %Y %r') AS created, status FROM support_dev WHERE status LIKE 'Pending%' ORDER BY ticket_number ASC LIMIT $start, $display";             }             elseif ($viewstate=='closed') {             $query = "SELECT ticket_number, first_name, surname, email, product, retailer, DATE_FORMAT(dop, '%d %M %Y') AS dop, message, address, DATE_FORMAT(created, '%d %M %Y %r') AS created, status FROM support_dev WHERE status='Closed' ORDER BY ticket_number ASC LIMIT $start, $display";}             $result = @mysql_query ($query);             $num = mysql_num_rows ($result);              if ($num > 0) {              if ($num_pages > 1) {             echo '
';             $current_page = ($start/$display) + 1;                  if ($current_page != 1) {                 echo 'Previous ';             }             for ($i = 1; $i <= $num_pages; $i++) {                 if ($i != $current_page) {                     echo '' .$i .' ';                 } else {                     echo $i . ' ';                 }             }             if ($current_page !=$num_pages) {                 echo 'Next ';             }             echo '

';               }                    if ($result) {              echo '

Ticket

First Name

Last Name

Email

Product

Retailer

D.O.P.

Message

Address

Date created

Status

         ';              while ($row = mysql_fetch_array($result, MYSQL_NUM)) {             echo "

$row[0]

$row[1]

$row[2]

$row[3]

$row[4]

$row[5]

$row[6]

$row[7]

$row[8]

$row[9]

$row[10]

<form method=\"post\" action=\"".htmlentities($_SERVER['REQUEST_URI'])."#a".$row[0]."\"><input type=\"hidden\" name=\"close_row\" value=\"".($row[0])."\" /><input type=\"hidden\" name=\"viewstate\" value=\"".$viewstate."\" /><INPUT TYPE=\"submit\" name=\"open\" VALUE=\"\" class=\"submit_open\">
<INPUT TYPE=\"submit\" name=\"pending\" VALUE=\"\" class=\"submit_pending\">
<INPUT TYPE=\"submit\" name=\"pending_ami\" VALUE=\"\" class=\"submit_pendingami\">
<INPUT TYPE=\"submit\" name=\"pending_arp\" VALUE=\"\" class=\"submit_pendingarp\">
<INPUT TYPE=\"submit\" name=\"close\" VALUE=\"\" class=\"submit_closed\"></form>

";         }          }         mysql_free_result ($result);               }                 if (is_null($viewstate)) {         $viewstate='all';     }                    ?>


title: How can I delete options with register_uninstall_hook?

text: Right now, I have this code:               function mr_np_activate(){         // hook uninstall         if ( function_exists('register_uninstall_hook') )             register_uninstall_hook(__FILE__,'mr_np_uninstall');             }     register_activation_hook(__FILE__,'mr_np_activate');               /**      * Delete options      *      **/                   function mr_np_uninstall() {         delete_option('my_plugins_options');      }      But when I remove my plugin, all my options are there. (I made another plugin just to show my options). How can I delete options when plugin is removed? []'s Homem Robô


title: updating meta_key from the frontend

text: I am wanting to update the meta_key in the database to reorder postmeta from the frontend. I'm using jQuery UI drag and drop to move items into an order, I can update the values but the meta_key is not so easy. My meta_key and values are like this:   * add_task_0_assigned => value   * add_task_0_complete => value   * add_task_1_assigned => value   * add_task_1_complete => value   * add_task_2_assigned => value   * add_task_2_complete => value   * add_task_3_assigned => value   * add_task_3_complete => value the values I can update from the frontend easily using super globals $_POST or $_GET but, is there a way to modify the meta_key to save and reorder in the database? Any help or guidance would be appreciated.


title: Performance-wise, is it better to enqueue a (small) script on every page or test to see if it's needed?

text: I'm using the FitVids.js script to make YouTube video embeds work with a responsive layout. The script is < 3kb, but only about half of my pages actually have YouTube embeds. In terms of total load-time for a page that doesn't contain a YouTube video, is it more costly to do a `strpos()` on the content or to include the script regardless? I imagine this has a lot to do with the end-user's connection speed vs. the server's resources, and honestly, it's a low-traffic site with undemanding users so it really doesn't matter... I'm mostly asking because I don't have a good grasp of performance optimization and I want to learn.


title: Text under post title on frontpage but don't want it in full post

text: On the frontpage of a blog I want a piece of text (like an excerpt) under the title but I don't want is showing up in the full post. Any ideas how I would go about this? EDIT: Wasn't precise enough in my question. The piece of text under the title will be different for every post and has to be able to be set in the backend by the end user, preferably when typing the post.


title: Video shortcode - autoplay all videos

text: How can I autoplay all videos added by video shortcode?   I can make only one of them autoplay if only one has autoplay attribute set to 1, and others to 0, otherwise all are stopped.


title: Undefined index: b in /path/file.php relating to querystring parameters

text: I am getting errors in the server log for cformsII plugin but don't understand why.               PHP Notice:  Undefined index: b in /var/www/wordpressmu/wp-content/plugins/cforms/cforms-captcha.php on line 12     [Tue Jul 12 15:02:26 2011] [error] [client 172.18.30.81] PHP Notice:  Undefined index: f in /var/www/wordpressmu/wp-content/plugins/cforms/cforms-captcha.php on line 15     [Tue Jul 12 15:02:26 2011] [error] [client 172.18.30.81] PHP Notice:  Undefined index: f1 in /var/www/wordpressmu/wp-content/plugins/cforms/cforms-captcha.php on line 18     [Tue Jul 12 15:02:26 2011] [error] [client 172.18.30.81] PHP Notice:  Undefined index: f2 in /var/www/wordpressmu/wp-content/plugins/cforms/cforms-captcha.php on line 19     [Tue Jul 12 15:02:26 2011] [error] [client 172.18.30.81] PHP Notice:  Undefined index: a1 in /var/www/wordpressmu/wp-content/plugins/cforms/cforms-captcha.php on line 21     [Tue Jul 12 15:02:26 2011] [error] [client 172.18.30.81] PHP Notice:  Undefined index: a2 in /var/www/wordpressmu/wp-content/plugins/cforms/cforms-captcha.php on line 22     [Tue Jul 12 15:02:26 2011] [error] [client 172.18.30.81] PHP Notice:  Undefined index: l in /var/www/wordpressmu/wp-content/plugins/cforms/cforms-captcha.php on line 30      > The url to the captcha image is http://mysite/wp- > content/plugins/cforms/cforms- > captcha.php?ts=3&c1=4&c2=5&ac=abcdefghijkmnpqrstuvwxyz23456789&i=i&w=115&h=25&c=#A6BEA4&l=000066&f=font4.ttf&a1=-20&a2=11&f1=17&f2=19&b=12.gif&rnd=448710 As you can see the variables throwing errors are included in the querystring. The error is happening against this statement (prep being a function which strips slashes):               $im_bg_url      = 'captchabg/' . ( prep($_REQUEST['b'],'1.gif') );


title: Certain actions failing when run through cron

text: I am having a huge argument with Wordpress, and this is my last port of call before I throw the PC out of the window. I have a plugin here that exports an XML feed into Wordpress posts. The posts have an image which is saved locally, the HTML to display the image is then inserted at the beginning of the post content, before being inserted into Wordpress using wp_insert_post. I'm having a slight issue though. The script works fine when it is turned on manually. But as soon as it triggered by cron, the post will import fine, but the image will not save locally, and the HTML for the image is not present in the posts content. I really am at a loose end. I thought it was to do with permissions, and the fact that the posts were being imported with no author. I then changed it so they were marked as written by an admin, but that made no difference. What is the problem of running it via cron vs running it manually when logged in? If anyone can help solve this then I will be eternally grateful!


title: How to extract the variables out from “add_shortcode” function?

text: In Wordpress, lets say i have a custom Shortcode function, like:               function foobar_func( $atts ){         //whatever required processings here...         $foo = "the value is foo!";         $bar = "the value is bar!";     }     add_shortcode( 'myshortcode', 'foobar_func' );     //now .. echo the value of $foo here? <----------      As you can see, how can i get the processed value of a variable out from the function please? (as in the last line) OR How to pass the variable from this Function to the outside, please?


title: simplified explanation on child themes?

text: I'm trying to create child theme for theme i'm using on my site... I read lot's of articles about this, but can't find simple tutorial or simple explanation how to do it... As i understand so far, if i copy (for example) loop.php file to child theme, and change               if(is_home()) {        do something     }       from original loop file to               if(is_home()) {        do something else       and do another more thing     }      my function will be executed and original function will be ignored? Is this right? Thanks in advance


title: How to display multiple $meta_boxes into separate tables

text:
i am writing a plugin inside a class and i have created my $meta_boxes, i am able to retrieve all fields but they are duplicated and in the same table. this is my code for add $meta_boxes               function ri_add_custom_box() {         global $prefix, $meta_box, $meta_boxes;               $prefix = '_ri_custom_meta_'; // a custom prefix to help us avoid pulling data from the wrong meta box     $meta_boxes = array();          $meta_boxes[] = array(       'id' => 'ri_meta_box_panel1', // the id of our meta box     'title' => 'Test1', // the title of the meta box     'page' => 'ri_my_page', // display this meta box on post editing screens     'context' => 'side',     'priority' => 'high', // keep it near the top         'fields' => array( // all of the options inside of our meta box             array(                 'name' => 'Test1:',                 'desc' => 'Test1',                 'id' => $prefix . 'Test1',                 'type' => 'text',                 'std' => ''             ),         )     );          $meta_boxes[] = array(       'id' => 'ri_meta_box_panel2', // the id of our meta box     'title' => 'Test2', // the title of the meta box     'page' => 'ri_my_page', // display this meta box on post editing screens     'context' => 'side',     'priority' => 'high', // keep it near the top         'fields' => array( // all of the options inside of our meta box             array(                 'name' => 'Test2:',                 'desc' => 'Test2',                 'id' => $prefix . 'Test2',                 'type' => 'text',                 'std' => ''             ),         )     );          foreach ($meta_boxes as $meta_box) {         new Ri($meta_box);         add_meta_box($meta_box['id'], $meta_box['title'], array(&$this, 'ri_display_metaboxes'), $meta_box['page'], $meta_box['context'], $meta_box['priority']);     }     }      and this is my code for display $meta_boxes               function ri_display_metaboxes() {         global $meta_box, $meta_boxes, $post;              echo '<input type="hidden" name="ri_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';         echo '
';                  foreach ($meta_boxes as $meta_box) {                 foreach ($meta_box['fields'] as $field) {                      $meta = get_post_meta($post->ID, $field['id'], true);              echo '
', // create a table row for each option                     '', $field['name'], '	',                     '';             switch ($field['type']) {                      case 'text': // the HTML to display for type=text options                     echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:97%" />', '     ', $field['desc'];                     break;                           case 'textarea': // the HTML to display for type=textarea options                     echo '<textarea name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="8" style="width:97%">', $meta ? $meta : $field['std'], '</textarea>', '     ', $field['desc'];                     break;                      case 'select': // the HTML to display for type=select options                     echo '<select name="', $field['id'], '" id="', $field['id'], '">';                     foreach ($field['options'] as $option) {                         echo '<option', $meta == $option ? ' selected="selected"' : '', '>', $option, '</option>';                     }                     echo '</select>';                     break;                      case 'radio': // the HTML to display for type=radio options                     foreach ($field['options'] as $option) {                         echo '<input type="radio" name="', $field['id'], '" value="', $option['value'], '"', $meta == $option['value'] ? ' checked="checked"' : '', ' />', $option['name'];                     }                     break;                      case 'checkbox': // the HTML to display for type=checkbox options                     echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';                     break;                  }             echo     '',                 '
';                     }                 }             echo '
';     }      I want to display in the first metabox Test1 and in second metabox Test2 like this Metabox1 Test1 Metabox2 Test2 but now with this code i have Metabox1 Test1 Test2 Metabox2 Test1 Test2 Sorry for my bad english. Any help is appreciated!


title: action wp_set_comment_status never gets fired when i change the comment status

text: I want to run some code on comment status change so using the action `wp_set_comment_status` but it seem to never fired when comment status gets changed. I am using wordpress 3.3.1. **Here is a simple code which doesn't work for me:**               add_action('wp_set_comment_status ', 'update_business_rating_avg');          function update_business_rating_avg($comment_ID, $status){         update_option( 'business', 'checked' );     }      There was a same bug on the wp version `2.8.2` and it was fixed later on. Not sure if i am doing something wrong or not. http://core.trac.wordpress.org/ticket/8863 The codex says about the action: **wp_set_comment_status:** Runs when the status of a comment changes. Action function arguments: comment ID, status string indicating the new status ("delete", "approve", "spam", "hold").


title: External page integrated into WordPress returns a 404 error

text: I have a script that I'd like to call via AJAX from my WordPress theme, it relies upon some core WordPress functions so I am including WordPress blog header like so:               define( 'WP_USE_THEMES', false );     require( '../../../../wp-blog-header.php' );      Somewhere during the processing of `wp-blog-header.php` WordPress sets a 404 header which causes my AJAX request to fail, even though the script I am calling exists and is returning content. I have since added `status_header( 200 );` after that snippet which changes the status header back to 200 and solves the problem, however it feels very much like a hack, so I was just wondering if there is a _recommended_ solution to this problem?


title: How to order separated Custom Post Search results

text:
I am using the technique described here Seperating Custom Post Search Results and here posts_groupby problem to seperate my search results and group them by post type. This means I have the following code. **In functions.php**               add_filter('posts_orderby', 'group_by_post_type', 10, 2);     function group_by_post_type($orderby, $query) {         global $wpdb;         if ($query->is_search) {             return $wpdb->posts . '.post_type DESC';         }         // provide a default fallback return if the above condition is not true         return $orderby;     }      **In search.php**               <?php $last_type="";     $typecount = 0;     while (have_posts()){         the_post();         if ($last_type != $post->post_type){             $typecount = $typecount + 1;             if ($typecount > 1){                 echo '
'; //close type container             }             // save the post type.             $last_type = $post->post_type;             //open type container             switch ($post->post_type) {                 case 'post':                     echo "
News Articles

";                     break;                 case 'page':                     echo "
Pages

";                     break;                 case 'work':                     echo "
Projects

";                     break;                 case 'bootlegs':                     echo "
Bootlegs

";                     break;                 case 'directors':                     echo "
Directors

";                     break;                 //add as many as you need.             }         } ?>      This works perfectly except I have no control over the order in which the Custom Post Types are displayed. I'm guessing they are being ordered by an internal ID number, but I need to have control over them. How can I achieve this? Thanks!


title: Author bio Social Links

text: I'm using simple code to show user social link in author bio. **in functions.php**               <?php     function add_remove_contactmethods( $contactmethods ) {         // Add Twitter         $contactmethods['twitter'] = 'Twitter';         //Add Facebook         $contactmethods['facebook'] = 'Facebook';      // Remove Contact Methods         unset($contactmethods['aim']);         unset($contactmethods['yim']);         unset($contactmethods['jabber']);              return $contactmethods;     }     add_filter('user_contactmethods','add_remove_contactmethods',10,1);     ?>      **in single.php**                  <a href="<?php the_author_meta('twitter'); ?>" title="Twitter" target="_blank" id="twitter">      so how can i hide social link in author bio when the field is empty in user profile. please help me...


title: Confusing about permalink

text: I'm nubie in WP and I have some problems but the annoying for me is the default permalink. When tried to visit my site from top of the dashboard link, it says "mydomain.com/home" instead mydomain.com. So it directs me to 'NOT FOUND' page. Please help FYI, it's still installed in my dev.domain.com site.


title: WordPress not creating "large" thumbnails

text: I moved my WordPress installation from my local dev environment (MAMP) to a shared hosting server. Since then I have trouble with image uploads not being processes as before, especially with the large size. The large media setting is being ignored as long as I don't set it to quite small sizes. I want it to be at               Max Width: 940  Max Height: 10000 (or 0, I tried both)       Once I go under 1000 with the max height, the large image is being created, if I go higher it skips that. I already added               define( 'WP_MEMORY_LIMIT', '256M' );      in the wp-config.php, and when I run phpinfo on the server is says               memory_limit    256M          Any ideas what to tweak? I searched but coulnd't find something related. Thanks for replies!


title: Breadcrumbs: Search result not displayed when static page is on top

text:
Uhm, this is quite a weird problem and I'm trying to make sure that I explain it well enough so that you understand what I'm talking about. So, I'm using breadcrumbs in my header area. It all works fine. However, when you type in a search, it only SOMETIMES displays the actual search result in the breadcrumbs. It's supposed to look like that: Home » Blog » Search results for "lorem" View it live. However, if the first search result (the one that is being displayed on top of all others) is a static page instead of a blog post, the breadcrumbs display it this way: Home » Blog » Page View it live. It's still shown correctly in the tab of my browser. Only the breadcrumbs seem to get confused. This is the code snippet I use for the breadcrumbs:               function dimox_breadcrumbs() {            $delimiter = '»';       $home = 'Home'; // text for the 'Home' link       $before = ''; // tag before the current crumb       $after = ''; // tag after the current crumb            if ( !is_front_page() || is_paged() ) {              echo '
';          global $post;     $divider = $delimiter;     if (is_home()) $divider = '';     $homeLink = get_bloginfo('url');     echo '' . $home . ' ' . $delimiter . ' Blog ' . $divider . ' ';              if ( is_category() ) {           global $wp_query;           $cat_obj = $wp_query->get_queried_object();           $thisCat = $cat_obj->term_id;           $thisCat = get_category($thisCat);           $parentCat = get_category($thisCat->parent);           if ($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' '));           echo $before . 'Archive by category "' . single_cat_title('', false) . '"' . $after;              } elseif ( is_day() ) {           echo '' . get_the_time('Y') . ' ' . $delimiter . ' ';           echo '' . get_the_time('F') . ' ' . $delimiter . ' ';           echo $before . get_the_time('d') . $after;              } elseif ( is_month() ) {           echo '' . get_the_time('Y') . ' ' . $delimiter . ' ';           echo $before . get_the_time('F') . $after;              } elseif ( is_year() ) {           echo $before . get_the_time('Y') . $after;              } elseif ( is_single() && !is_attachment() ) {           if ( get_post_type() != 'post' ) {             $post_type = get_post_type_object(get_post_type());             $slug = $post_type->rewrite;             echo '' . $post_type->labels->singular_name . ' ' . $delimiter . ' ';             echo $before . get_the_title() . $after;           } else {             $cat = get_the_category(); $cat = $cat[0];             echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');             echo $before . get_the_title() . $after;           }              } elseif ( !is_single() && !is_page() && get_post_type() != 'post' && !is_404() ) {           $post_type = get_post_type_object(get_post_type());           echo $before . $post_type->labels->singular_name . $after;              } elseif ( is_attachment() ) {           $parent = get_post($post->post_parent);           $cat = get_the_category($parent->ID); $cat = $cat[0];           echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');           echo '' . $parent->post_title . ' ' . $delimiter . ' ';           echo $before . get_the_title() . $after;              } elseif ( is_page() && !$post->post_parent ) {           echo $before . get_the_title() . $after;              } elseif ( is_page() && $post->post_parent ) {           $parent_id  = $post->post_parent;           $breadcrumbs = array();           while ($parent_id) {             $page = get_page($parent_id);             $breadcrumbs[] = 'ID) . '">' . get_the_title($page->ID) . '';             $parent_id  = $page->post_parent;           }           $breadcrumbs = array_reverse($breadcrumbs);           foreach ($breadcrumbs as $crumb) echo $crumb . ' ' . $delimiter . ' ';           echo $before . get_the_title() . $after;              } elseif ( is_search() ) {           echo $before . 'Search results for "' . get_search_query() . '"' . $after;              } elseif ( is_tag() ) {           echo $before . 'Posts tagged "' . single_tag_title('', false) . '"' . $after;              } elseif ( is_author() ) {            global $author;           $userdata = get_userdata($author);           echo $before . 'Articles posted by ' . $userdata->display_name . $after;              } elseif ( is_404() ) {           echo $before . 'Error 404' . $after;         }              if ( get_query_var('paged') ) {     if (is_home()) echo ' ' . $delimiter . ' ';           if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' (';           echo __('Page') . ' ' . get_query_var('paged');           if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')';         }              echo '
';            }     } // end dimox_breadcrumbs()      I already talked to the creator of the code, but he also has no clue why this is ocurring. I hope somebody has at least a clue so that I can work on it? Thanks a lot! :)


title: Disable the admin bar

text: I have the WP3.4 and I would like to disable the admin bar. I have tried to do that with many ways, but the admin bar do not display. Is possible to do on this version of WP (3.4) or i make a mistake in the code? Below are the ways that I've tried. Thanks in advance. The 1st :               function my_function_admin_bar(){                 return false;             }             add_filter( 'show_admin_bar' , 'my_function_admin_bar');      The 2nd :               add_action( 'init', 'disable_admin_bar', 1 );     function disable_admin_bar() {         add_filter( 'show_admin_bar', '__return_false' );      The 3rd                   <?php     if (!function_exists('disableAdminBar')) {              function disableAdminBar(){              remove_action( 'admin_footer', 'wp_admin_bar_render', 1000 ); // for the admin page         remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); // for the front end              function remove_admin_bar_style_backend() {  // css override for the admin page           echo '<style>body.admin-bar #wpcontent, body.admin-bar #adminmenu { padding-top: 0px !important; }</style>';         }              add_filter('admin_head','remove_admin_bar_style_backend');              function remove_admin_bar_style_frontend() { // css override for the frontend           echo '<style type="text/css" media="screen">           html { margin-top: 0px !important; }           * html body { margin-top: 0px !important; }           </style>';         }              add_filter('wp_head','remove_admin_bar_style_frontend', 99);            }          }          // add_filter('admin_head','remove_admin_bar_style_backend'); // Original version     add_action('init','disableAdminBar'); // New version                   ?>


title: Can wordpress theme folder name be changed freely and nothing technically happens

text: Can the wordpress theme folder be renamed any time freely and everything works fine after that ,               themes/oldthemename     themes/whatevernewname      or is it so that if you change the folder name that contains theme files - then the theme wont work any more because theme folder name is related to the theme files somehow ...


title: Issue with Multisite and SSL

text: I have a multisite with subdirectories and an SSL. I cjanged the options tables for the main site and one subsite, but the ssl is only registering for the main site. I even checked the "Update siteurl and home as well" option. If it physically type https then the site registers and no insecure flag is shown on the checkout page, but the little lock doesnt display and it says the site isnt totally secure. How can I get it situated? https://www.kickinkaratesystems.com/ https://www.kickinkaratesystems.com/akitournament/


title: require one tag for each post

text: How would I go about requiring each post to have no more than one tag? I would like to require the user to create a tag or choose one previous tag for each post. If you could give me any information, that would be very helpful.


title: How do I search events between two set dates inside WP?

text: I am building a WP site with an events feature. The events page was made with custom post types. I want to make it possible for people to search/ filter events by dates. For example, they can search for all events happening between 2nd December, 2011 and 1st March, 2012 and get results from events that have their dates between the months of December and March (ie. december, january, february and march). I want to know the best way to go about this. Any ideas? You can see an example of what I want to achieve by looking at the "Search events by date" feature on this page http://www.londontown.com/events If that won't be possible, is there any way I can get them to search for events happening between certain months, say December and February(excluding the days)? Thanks in advance.


title: Custom Nested Wordpress Comments with avatar

text: I am developing a theme and has no idea how wordpress handles the comment outputs. I have `wp_list_comments` in my comments.php, but I'm not sure how to customize the output to get the desired output as in the enclosed image. Any suggestions on how to customize the output rendered by `wp_list_comments`? ![enter image description here](http://i.stack.imgur.com/i83iW.png)


title: select to search in category AND custom post type

text: I try to do something but which I block. What I need is simple: a search textbox and a select which allows the user to search either in whole or in custom post types, or in category. Separately, I can do everything, but I blocked to "embed" all this Basically, should give this, but with two more options to select two custom post types. Can you help me?               <form method="get" id="searchformheader" action="<?php echo esc_url( home_url( '/' ) ); ?>">         <input type="text" name="s" id="sheader" placeholder="Recherche" />         <select name="cat" id="searchheaderdropdown">             <option class="level-0" value='0' selected='selected'>Dans ...</option>                <option class="level-0" value="3">Dans les news</option>             <option class="level-0" value="15">Dans les tests</option>             <option class="level-0" value="16">Dans les vidéos</option>             <option class="level-0" value="18">Dans les guides</option>         </select>         <input type="submit" class="submit" name="submit" id="searchsubmitheader" value="" />     </form>      Thank's!


title: How do I implement a .diff changeset from core.trac.wordpress.org locally?

text: I have a local copy of the latest version of wordpress that I set up using               svn co http://core.svn.wordpress.org/trunk/      There is a diff that I want to pull into my local fileset: http://core.trac.wordpress.org/attachment/ticket/19371/19371.diff Is this something that I can do with subversion? What commands do I need to use?


title: Display old posts if no future posts exist

text: I have a loop setup to display future posts but would like to set up an if statement where if there are no future posts, it will show a certain amount of published posts. My current query below:                       <?php                 query_posts('posts_per_page=5&order=ASC&post_status=future');                 if ( have_posts() ) : while ( have_posts() ) : the_post();             ?>      Any ideas?


title: Excerpt Length & List Category Posts Plugin

text: I'm trying to filter out the excerpt by character length for a plugin called "List Category Posts". I've been trying to get the excerpts working for the past week, but nothing is doing the trick. The plugin actually comes with a feature that allows you to post the excerpt or not, then filter it by character length.. by adding "excerpt_size=" in the shortcode. But unfortunately, it doesn't work at this time, and I've tested it with multiple different themes. Anyways, here is the code it uses to get the excerpt:               public function get_excerpt($single){         if (                 $this->params['excerpt']=='yes' &&                 !($this->params['content']=='yes' &&                 $single->post_content) ){             /*              * Strip shortcodes - #5              * http://codex.wordpress.org/Function_Reference/strip_shortcodes             */             if($single->post_excerpt){                 return $single->post_excerpt;             }             $lcp_excerpt = strip_shortcodes(strip_tags($single->post_content));             $exc_lim = intval($this->params['excerpt_size']);             $lcp_excerpt = mb_substr($lcp_excerpt, 0, $exc_lim) . '...';             return $lcp_excerpt;         } else {             return null;         }     }      and the excerts are set by default like so (I've tried changing the 'excerpt_size' default parameter below, and it did not work):               'excerpt' => 'no',     'excerpt_size' => '255',      I don't even need a grand solution to get the whole shortcode excerpt filter to work with any number I enter. If anyone could help me get it to work so all the excerpt character lengths are say, 100. That would be amazing!


title: How can I send an email in my plugin?

text:
I'm making a plugin that emails the site webmaster when I go to the 404 page. The script checks if the referring link is on our site, and then sends an email to the webmaster.               $message = "                           <title>Alton Bible Church - Broken Link</title>
There's a broken link on My Website

                         Broken Link	Referring Link

                         " . $broken . "	" . $referrer . "

              ";     $headers = 'MIME-Version: 1.0' . '\r\n';     $headers .= 'Content-type: text/html; charset=iso-8859-1' . '\r\n';     $headers .= 'From: My Website <no-reply@mysite.net>' . '\r\n';     mail("Webmaster <webmaster@mysite.net>", "My Website - Broken Link", $message, $headers);      The problem is, the email is not being sent. Does WordPress not allow me to use mail()? The problem shouldn't be with the server. Thanks!


title: How to add "supports" parameter for a Custom Post Type?

text: Is there a way to add support for a custom feature for a custom post type, after it has been created? I know how to create a custom post type using register_post_type(), and how to use the supports parameter to specify what the CPT should support;               'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt' ,'headway-seo')       But for the situations when the CPT is being registered by a plugin or theme, is there a way to 'inject' support elements (manipulate the support array) of the CPT after it has been registered, using a WP hook/filter?


title: Can't match title in database

text: This is very perplexing and hope someone can help me. Here is some code I'm using to see if a title exists in wp_posts table               $mypostids = $wpdb->get_results("select ID from $wpdb->posts where   post_title='$thisTitle'");               if(!empty($mypostids)){     echo $thisTitle.' already exists'; }else{         echo $thisTitle.' does not exist';      }      where $thisTitle is simply the title. Here is the output from this Pics: Sarah Michelle Gellar & Freddie Prinze Jr step out post-baby already exists Saturday Night Live lampoons Pandora music channels, but don't expect NBC to stream it online does not exist Report: Adele is a mum! Baby Konecki born Friday already exists As you can see, the output says the title "Saturday Night Live, etc." doesn't exist, but you can see by the image (in the link below) it certainly does exist. I have no idea why this is happening. Am I missing something obvious? Thanks. https://dl.dropbox.com/u/3132388/screenshot_415.jpg


title: Query on custom field count?

text:
I have the following code:

                 <?php                 $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;                 query_posts( array(                             'cat' => '6',                              'posts_per_page' => 5,                             'meta_key' => 'krit_karakter',                             'orderby'=> 'menu_order',                             'order'=> 'DESC',                             'caller_get_posts' => 1,                              'paged' => $paged ) );                         if (have_posts()) : while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>"><img src="<?php bloginfo('url');?>/wp-content/files_mf/<?php get_custom_field('game_poster', TRUE); ?>" width="80" height="110" alt="<?php the_title();?>" />
<?php the_title();?>
                              <?php endwhile; ?>                         <?php else : endif; ?>
                 <?php wp_reset_query(); ?>
      I want to show only posts that have at least 5 entries in the custom field 'krit_karakter'. Is that possible?


title: Exclude the_content (); from page password protection

text:
I use a page template to show custom post type. All content from the custom post type should be password protected. I´d like to use the wordpress editor for some additional public information. Can I exclude `the_content();` from wordpress password protection? ### page-my-custom-post-type.php               // ================ PUBLIC AREA BEGINNS ================
Pubic-Area
          <?php     if (have_posts()) : while (have_posts()) : the_post();     the_content();     endwhile;      endif;     // ================ PUBLIC AREA ENDS ================                            // ================ PROTECTED AREA BEGINNS ================     if ( post_password_required() ) {             echo get_the_password_form();     }     else {               $index = 'A';     $terms = get_terms('marke');          foreach ($terms as $term) {         if($index != strtoupper(substr($term->name, 0, 1))) {             $index = strtoupper(substr($term->name, 0, 1));                  echo '
'. $index . '
';         }              ?>
<?php echo $term->name; ?>
         <?php $args = array( 'post_type' => 'cpt_auto', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC',              'tax_query' => array(                 array(                     'taxonomy' => 'marke',                     'field' => 'slug',                     'terms' => array($term->slug)                 )             )         );              // ============================= OUTPUT ==============================         $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post();             the_title('
', '
');             the_content();              endwhile;          }     ?>               <?php }     // ================ PROTECTED AREA ENDS ================     ?>      Thanks Ogni


title: How modify the comment content persistently based on $wp_query?

text: For a plugin, I need to build my own very early post content and comment content filter. Post content/text changing works, i.e. the modifications end up in the client's browser. But my comment content/text modifications somehow are not persistent, i.e. the client receives the original comment text. The point in time I "hook in" is defined by the template_redirect hook. I then execute something like this:               global $wp_query;          // Iterate over all posts in this query.     foreach ($wp_query->posts as $post) {         // Edit post text         $post->post_content = "foo"; // works: ends up at the client              // Iterate over all approved comments belonging to this post         $comments = get_approved_comments($post->ID);         foreach ($comments as $comment) {             // Edit comment text             $comment->comment_content = "bar"; // this one is lost             }          }      As indicated via the source comments above, `$post->post_content = "foo";` has effect in this context, but `$comment->comment_content = "bar";` doesn't. To track this down at least a bit more, I applied a debug filter to the post content and to the comment content:               add_filter('the_content', 'var_dump');     add_filter('comment_text', 'var_dump');      After the content modification routine above, these filters print "foo" in case of post content, but the comment content is printed unchanged (the original content is printed). Hence, `$comment->comment_content = "bar";` seems to be a local modification, while `$post->post_content = "foo";` works as desired: globally. Or is the database even queried two times for comments so that my modification somehow gets overwritten at some point? I've tried to work with `$wp_query->comments`, too. But this variable is `NULL` at the point in time I want and need to hook in. The final and primary question is: **In my loop above, what do I have to do, to modify the comment content persistently?** FYI: I am using WordPress 3.0.1


What causes this error (generated while uploading any theme to this WP site)               Unpacking the package…          Incompatible Archive. PCLZIP_ERR_BAD_FORMAT (-10) :      Unable to find End of Central Dir Record signature      I've tried to upload several different popular themes to the site.


title: Problem with single posts not showing correct category sidebar

text: I'm looking for something very specific: I'm using a plugin called "Category and Tag Specific Widgets" to create category-specific html in the sidebar of each category. This only works if I click on the category name (`www.myblog.com/category`), but on a single post (`www.myblog.com/category/post`) it doesn't work... Is there a way to modify the single.php file so it ties the single posts to the categories? My permalinks are set to `%category/%postname`


title: Add Div IDs dynamically to CSS

text:
I am trying my best to convert this amazing design in a wordpress plugin, but since I am not a developer and a noob, I can't get my head around it. Background image can be added in the post loop with div style. But what about: \-- Dynamic Ids (HTML & CSS) for each div box? -- Clip path for each image? Is it even possible to do it in wordpress? **EDIT:-** Sorry about not being clear. Below are the codes. Here's the JSfiddle   1. How do I make a sequential loop for the first markup where the post title is so that each post gets an id like box1, box2, box3 and so on.   2. in the second markup where the featured image is going to be a background image, how do I give the same post the id bg1, bg2, bg3 etc.   3. How to do a +240 in the `<x>` origin in the clip-path for each post. HTML

rooftops

streetstyle

citylife

citylife

      CSS                body { background:#ccc; margin:0; }     .container { /*width:1000px; margin:0 auto; position:relative;*/ }           .bg {        position:fixed;        top:0;        left:0;        width:100%;        height:100%;        background-position:50% 50%;       background-size:cover;       z-index:1;     }      .bg.reveal { -webkit-clip-path:none !important; z-index:2; }          .box {        width:200px;       height:200px;       position:relative;       z-index:10;        float:left;       line-height:200px;       text-align:center;       color:#fff;       cursor: pointer;       font-size:20px;       text-transform:uppercase;       font-family:Tahoma;       letter-spacing:1px;       margin:15px 0 0 35px;     }      JS               $('.box').hover(function(){       $($(this).data('bg')).addClass('reveal');     }, function(){       $($(this).data('bg')).removeClass('reveal');     });


title: Clearing cookie on logout and session expiration

text: I would like to clear the session cookie when a user logs out or when their session expires. I understand that `wp_clear_auth_cookie();` clears the cookie but I am struggling to understand how to implement it. I am using the following code to log a user out automatically if they are inactive for 10 minutes. (I think I found that in here too)               function myplugin_cookie_expiration( $expiration, $user_id, $remember ) {         return $remember ? $expiration : 600;     }     add_filter( 'auth_cookie_expiration', 'myplugin_cookie_expiration', 99, 3 );      Could someone kindly direct me to the right direction to achieve this result?


title: Move content between custom post types

text: I am importing a large amount of content from Expression Engine, the content in the other Expression Engine is all grouped together. I have created all the custom post types and taxonomies to organize the content better. However, Once I import the content to WordPress, I need to move the content into the newly created post types. How do I move content from one custom post type to another?


title: URL Redirection From Custom Type to Posts

text: I have a problem with Wordpress. I have custom type "review" and I migrate all its content into posts successfully. But I don't know how to redirect the old URL into new URL. The old URL format: **www.mysite.com/review/this-is-post** The new URL after migration into posts: **www.mysite.com/this-is-post** How to make redirection from old URL into new URL? So, if visitor visit the old URL, they automatically redirect to new URL. Thank you


title: Auto disable comments with custom field

text: i have this code to disable comments after X days based on publish date. How can edit this code to auto close comments based on a specific date using custom field? Thank you.               function close_comments( $posts ) {         if ( !is_single() ) { return $posts; }         if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( 30 * 24 * 60 * 60 ) ) {             $posts[0]->comment_status = 'closed';             $posts[0]->ping_status    = 'closed';         }         return $posts;     }     add_filter( 'the_posts', 'close_comments' );


title: 404 errors when updating options in admin dashboard

text: Whenever I try to update my Permalink settings or use the Theme Editor to modify some file, I am redirected to a 404 page. This also happens when I update the All-In-One SEO Pack plugin's settings. This does **not** happen in the case of other settings pages or plugin options. I have tried re-uploading WordPress from a fresh local copy, and have also tried deactivating all plugins. My hosting provider has given up, blaming WordPress. What is wrong here? Some things I suspect:   * My `.htaccess` file. I am not using anything extra, other than turning off `mod_security`.   * Suhosin. After a recent security breach, my provider recompiled PHP with Suhosin. I have disabled it currently, which solved a lot of compatibility problems with other plugins.   * File/folder permissions.   * PHP memory issues, maybe?


title: What is the best way to enable nested shortcodes?

text: Is this the best way to enable nested shortcodes?: `add_filter( 'the_content', 'do_shortcode' );` I keep finding mixed results and want to be sure I won't break anything else!