title: Make Categories and Tags required in admin

text: Hello i started from Bainternet solution in this post: don't publish custom post type post if a meta data field isn't valid I made a plugin to make categories and tags required. The validation works great and the popup appear correctly, but when the categories and tags are selected, the post is not published...just nothing happen.               /* set category and tag as required fields */          add_action('admin_head','my_publish_admin_hook');          function my_publish_admin_hook(){     if(is_admin())     {         echo"                        <script language=\"javascript\" type=\"text/javascript\">             jQuery(document).ready(function() {                 jQuery('#post').submit(function() {                          var form_data = jQuery('#post').serializeArray();                     form_data = jQuery.param(form_data);                     var data = {                         action: 'my_pre_submit_validation',                         security: '";echo wp_create_nonce( 'pre_publish_validation' ); echo"',                         form_data: form_data                     };                     jQuery.post(ajaxurl, data, function(response) {                         if (response=='true') {                             jQuery('#ajax-loading').hide();                             jQuery('#publish').removeClass('button-primary-disabled');                             return true;                         }else{                             alert('Correggi i seguenti errori: ' + response);                             jQuery('#ajax-loading').hide();                             jQuery('#publish').removeClass('button-primary-disabled');                             return false;                         }                     });                     return false;                 });             });         </script>         ";         }     }          add_action('wp_ajax_my_pre_submit_validation', 'pre_submit_validation');          function pre_submit_validation(){     //simple Security check     check_ajax_referer( 'pre_publish_validation', 'security' );          $error=null;          /* check categories */              $post_data=str_replace("%5D","]",$_POST['form_data']);     $post_data=str_replace("%5B","[",$post_data);          $post_data=substr($post_data,strpos($post_data,"&post_category")+18);        $post_data=substr($post_data,0,strpos($post_data,"&newcategory"));            $categories_array=array();     if(strlen($post_data)>0)     {         $categories_array=explode("&post_category[]=",$post_data);     }        if(count($categories_array)>0)     {         // categories setted     }     else $error="you must select categories";          /* check tag */               $post_data=str_replace("%2C",",",$_POST['form_data']);     $post_data=str_replace("%5D","]", $post_data);     $post_data=str_replace("%5B","[",$post_data);                   $post_data=substr($post_data,strpos($post_data,"tax_input[post_tag]=")+20);        $post_data=substr($post_data,0,strpos($post_data,"&"));          if(strlen($post_data)==0) $error="you must select tags";             //print validation response                if($error==null)        {             echo'true';          die();        }        else        {         echo $error;          die();        }     }


title: Making a particular kind of search engine with Wordpress?

text: I would appreciate if I get to know details and how-to make a particular type of search engine with Wordpress,where users can submit/showcase their product and submit their listings of products.It would be a user submitting site.


title: Using Magic Fields Image-Uploader with Thumbnails

text: I use Magic Fields a lot to give my clients and users the ability to upload specific content to their websites. Is there a way to call images by their size? At the moment I just put out the images, the persons uploads. But right now I need a solution that gets a specific size from the uploaded picture. I know that Magic Fields uses the default Image-Uploader by wordpress which creates predefined sizes by default. Is there a way to get those sizes while calling the magic field with the uploaded image?


title: Complex Slider Shortcode Help

text:
I have a PHP-Code for Slider which I found. Now I want to transform it into a Wordpress shortcode. Here's the Code:
                 <div class="big-slider" id="big-slider"<?php echo ($timeout?' data-timeout="'.$timeout.'"':'')?>>

                              <?php                             $i=1;                             $checkerboard=get_option('homepage_slider_checkerboard');                             foreach($slider as $slide) {                                 if($checkerboard == 'true')                                     $flip=!($i%2);                                 else                                     $flip=false;                                      if(@$slide['link'])                                     echo '';                                 else                                     echo '
';                                      $pic='';                                     if(@$slide['video_embed'])                                         $pic.=''.$slide['video_embed'].'';                                     elseif($slide['bgimage'])                                         $pic.='';                                 $pic.='';                                      $text='                                                                                '.$slide['title'].'                                                 '.$slide['description'].'                                                                                ';                                      if($flip)                                     echo $text.$pic;                                 else                                     echo $pic.$text;                                      if(@$slide['link'])                                     echo '';                                 else                                     echo '
';                                      $i++;                             }                         ?>

                   I already started with, first I've created the container which looks like this:               function shortcode_slider($atts, $content = null) {     $str = '';     $str .= '
';     $str .= '
';     $str .= '
';     $str .= '
';     $str .= do_shortcode($content);     $str .= '
';     $str .= '
';     $str .= '
';     $str .= '
';     $str .= '
';     $str .= '';     $str .= '
';     $str .= '

';     $str .= '
';     $str .= '';     $str .= '

';     $str .= '
';          return $str;      }               add_shortcode('slider', 'shortcode_slider');      But now I am hanging with the nested shortcode to create, since I am not experienced PHP or WordPress coder.


title: How to display 2 equal columns of li based on the count of items in wp_nav_menu divided by 2?

text: I would like to display a custom 3.0 menu in my sidebar. I want the list to be in order of name, and the list to be sequential down the list of the left column and flow down, then into the right column. ![enter image description here](http://i.stack.imgur.com/Frnz2.png) I currently am using css and floating the li's but the problem is the list goes back and forth from left to right column, rather than down the list sequentially. I am using               <?php wp_nav_menu('menu=canon-camcorders'); ?> in my sidebar.php      Then, #sidebar ul#menu-canon-camcorders li.menu-item {width:89px; float:left; margin-right:18px;} What I would like to do is count how many list items there are, then divide it into two and create two ul's from that. My php abilities are sort of patched together without any formal training, so I am kind of lost. I know some jquery, but don't know how to do this in either way. I read this post: How to count nav menu items? But, I couldn't figure it out for my needs. Any help is greatly appreciated. Thank you, Larry


title: CPT Parent as a page and CPT Child as a posts

text: I have one CPT page named as books and one CPT post named as chapters, I am trying to achive this permalink structure here               book1->chapter11     book1->chapter12          book2->chapter21     book2->chapter22      and so on. Here is my code for books cpt               register_post_type(              'books',             $labels             ,                 'public'                =>  true,                 'exclude_from_search'   =>  false,                 'publicly_queryable'    =>  true,                 'show_ui'               =>  true,                 'show_in_nav_menus'     =>  true,                 'show_in_menu'          =>  true,                 'show_in_admin_bar'     =>  true,                 'menu_position'         =>  100,                 'capability_type'       =>  'page',                 'map_meta_cap'          =>  true,                 'hierarchical'          =>  true,                 'supports'              =>  array(                         'title',                         'editor',                         'author',                         'thumbnail',                         'comments',                         'page-attributes',                           ),                 'has_archive'           =>  true,                 'rewrite'               =>  array(                         'slug'          =>  'book',                         'with_front'    =>  true,                         'feeds'         =>  true,                         'pages'         =>  true                 ),                 'query_var'             =>  true,                 'can_export'            =>  true,              )               );      and for chapters cpt               register_post_type(              'chapters',     $labels     ,                 'public'                =>  true,                 'exclude_from_search'   =>  false,                 'publicly_queryable'    =>  true,                 'show_ui'               =>  true,                 'show_in_nav_menus'     =>  true,                 'show_in_menu'          =>  'edit.php?post_type=book',                 'show_in_admin_bar'     =>  true,                 'menu_position'         =>  100,                 'capability_type'       =>  'post',                 'map_meta_cap'          =>  true,                 'hierarchical'          =>  true,                 'supports'              =>  array(                         'title',                         'editor',                         'author',                         'thumbnail',                         'comments',                         'page-attributes',                         'post-formats'                                     ),                 'has_archive'           =>  true,                 'rewrite'               =>  array(                         'slug'          =>  'book/chapter',                         'with_front'    =>  true,                         'feeds'         =>  true,                         'pages'         =>  true                 ),                 'query_var'             =>  true,                 'can_export'            =>  true,                        )               );      these url's are working fine               localhost/library/book/html     localhost/library/chapter/preface      individually, but when I try this url               localhost/library/book/chapter/preface      currently as per my cpt settings, its gives me 404 error, I tried template redirect and rewrite flush also, but nothing works, now my question are   1. is it possible Parent as a page and Children as a posts?   2. if yes what's wrong with this code, am I am missing here?   3. my main concern is here url rewriting, it should be localhost/library/html/preface where html is the name of the book and preface is the chapter. I searched lot here but didn't get the solution it might look similar question to you, but really I need help. thanks. ## Did some changes like changed parent slug to books and child slug to book/chapters and query_var to chapter so working fine for my question 1 and 2 now looking for 3 question url_rewriting. thanks.


title: Cannot get Child Theme to load latest version of style.css

text: I'm using a Child theme set up correctly. But I just cannot get changes in the Child theme style.css to be reflected in the site. Tried emptying the browser cache a million times and it doesn't work! I'v created child template files and they overide the parent ones fine. I have noticed in view sourse it puts a version number on the end of the style sheet like this:- style.css?ver=3.9.1 even though I have created no version! In another site I created there is no versioning of the style sheet, so why is it being put in automatically when I don't want it set. How can I force it to use the most up to date version of the Child style.css file and not version it? Here's my site url:- http://www.peterswebservices.co.uk/


title: How can I create more "create attachment" custom field - any idea?

text: define('MY_POST_TYPE', 'myslider');       define('MY_POST_SLUG', 'myslider');            function my_register_post_type () {         $args = array (             'label' => 'Gallery',             'supports' => array( 'title', 'excerpt' ),             'register_meta_box_cb' => 'my_meta_box_cb',             'show_ui' => true,             'orderby' => 'meta_value_num',             'query_var' => true,             'order'    => 'ASC',             'public' => true,             'publicly_queryable' => false,             'show_in_menu' => true,              'capability_type' => 'post',             'has_archive' => true,              'hierarchical' => true,             'menu_position' => null,         );         register_post_type( MY_POST_TYPE , $args );       }       add_action( 'init', 'my_register_post_type' );            function my_meta_box_cb () {         add_meta_box( MY_POST_TYPE . '_details' , 'Media Library', 'my_meta_box_details', MY_POST_TYPE, 'normal', 'high' );       }            function my_meta_box_details () {         global $post;         $post_ID = $post->ID; // global used by get_upload_iframe_src         printf( "<iframe frameborder='0' src=' %s ' style='width: 100%%; height: 400px;'> </iframe>", get_upload_iframe_src('media') );       }


title: Adding search box for admin on custom admin page

text: I have fetched some rows on my custom admin page (using hook for adding admin menus). Now I want to add a search box on that page to display only those rows with the 'title' column containing searched string in that column. I'm trying with               SELECT * FROM Table WHERE Column LIKE %      to get the data. Please give me some idea. How to do this stuff?


title: What Is My Fault With This WP_QUERY ? [ Pagination Problem ]

text:
I did a photo gallery with custom post type. The pagination works correct but, if I click to a category, then it must show all photos of the category with pagination, but page 2 not found. You can test it. http://test.onurunwebsitesi.com Click to Tümünü Göster (Show All) button, and click to deneme (try) category button and click Daha Eski Fotoğraflar (Previous Photos), there are 3 photos (I didn't add the photos, just added photo titles), I'm listing photos posts_per_page=2, but page 2 not found. Sorry for my bad English. I need your help. I'm working with it for a long time. Thanks in advance. My codes: archive-fotograf.php               <?php /** * Displays the Pagination in Custom loop * */?>      <?php get_header(); ?>      <?php $aranan= $_GET['s'];       $kategorim = get_query_var('cat');      $catName = strtolower(get_cat_name($kategorim));      $myterm = get_term( $kategorim, 'fgaleri' );       $myslug = $myterm->slug; ?>
      <?php      $temp = $wp_query; //save old query      $wp_query= null; //clear $wp_query      $rakam= 0;      $wp_query = new WP_Query();      //The query      global $query_string;       parse_str( $query_string, $my_query_array );       $paged = ( isset( $my_query_array['paged'] ) && !empty( $my_query_array['paged'] ) ) ? $my_query_array['paged'] : 1;       $wp_query->query('posts_per_page=2&post_type=fotograf&s=' . $aranan . '&paged=' .     $paged . '&taxonomy=fgaleri&fgaleri=' . $myslug );      ?>

Fotoğraf Galerisi       <form action="<?php echo get_bloginfo('wpurl'); ?>" id="searchformfoto" method="get" name="searchform">      <?php $args = array( 'taxonomy' => 'fgaleri', 'show_option_none' => 'Kategori Seç ve Ara', 'hierarchical' => 1 ); wp_dropdown_categories($args); ?>
      <input name="s" id="sfoto" type="text" value=""/>      <input type="hidden" name="post_type" value="fotograf" />      <input id="searchsubmitfoto" type="submit" value="Ara"/>
      </form>

<?php while ($wp_query->have_posts()): $wp_query->the_post(); $rakam++;       //The loop      ?>      <div class="FGaleriItem2" style="<?php if ($rakam % 5 == 0 ) { ?>margin-right: 2px;<?php } ?>">      <?php      $termargs=array('orderby' => 'count', 'order' => 'desc');      $terms = wp_get_post_terms( $post->ID , 'fgaleri', $termargs );      $t = count($terms);      if ($t>0) { ?>
      <?php $c = 0;      foreach($terms as $term) {      $c++;      if ($c==$t)       {       echo 'term_id . '&s=' . $query_vars['s'] . '&post_type=fotograf" title="' . $term->name . '" ' . '>' . $term->name.' ';      }      } ?>
      <?php } ?>
      <?php if (has_post_thumbnail()) { ?>      <a href="<?php the_permalink() ?>">      <?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );      $url2 = get_bloginfo('template_directory') . "/timthumb.php?src=" . $url . "&w=100&h=100&zc=1"; ?>      <img src="<?php if(get_option('of_timthumb')=="true") { echo $url2; } else { echo $url; } ?>" alt="" title="" width="100" height="100" />            <?php } ?>

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

      <?php if (($rakam % 5 == 0 ) && ($rakam > 4)) { ?>

<?php } ?>      <?php endwhile; ?>

      <?php if(function_exists('wp_pagenavi') ) {           wp_pagenavi(); //function call for plugin pagination( wp pagenavi plugin)      }else{ ?>
            <?php next_posts_link('« Daha Eski Fotoğraflar'); ?>      <?php previous_posts_link('Daha Yeni Fotoğraflar »'); ?>
<?php } //endif      $wp_query = null; //Reset the normal query      $wp_query = $temp; //Restore the query      ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>       functions.php               <?php     add_action( 'init', 'register_cpt_fotograf' );      function register_cpt_fotograf() {      $labels = array(      'name' => _x( 'Fotoğraflar', 'fotograf' ),      'singular_name' => _x( 'Fotoğraf', 'fotograf' ),      'add_new' => _x( 'Yeni Ekle', 'fotograf' ),      'add_new_item' => _x( 'Yeni Fotoğraf Ekle', 'fotograf' ),      'edit_item' => _x( 'Fotoğrafı Düzenle', 'fotograf' ),      'new_item' => _x( 'Yeni Fotoğraf', 'fotograf' ),      'view_item' => _x( 'Fotoğrafı Önizle', 'fotograf' ),      'search_items' => _x( 'Fotoğraf Ara', 'fotograf' ),      'not_found' => _x( 'Fotoğraf Bulunamadı', 'fotograf' ),      'not_found_in_trash' => _x( 'Çöpte Fotoğraf Bulunamadı', 'fotograf' ),      'parent_item_colon' => _x( 'Ana Fotoğraf:', 'fotograf' ),      'menu_name' => _x( 'Fotoğraflar', 'fotograf' ),      );      $args = array(      'labels' => $labels,      'hierarchical' => false,      'supports' => array( 'title', 'author', 'thumbnail', 'custom-fields', 'comments' ),     'public' => true,      'show_ui' => true,      'show_in_menu' => true,      'show_in_nav_menus' => false,      'publicly_queryable' => true,      'exclude_from_search' => false,      'has_archive' => true,      'query_var' => true,      'can_export' => true,      'rewrite' => array('slug' => 'fotograflar'),     'capability_type' => 'post'      );      register_post_type( 'fotograf', $args );      }      register_taxonomy("fgaleri", "fotograf", array("hierarchical" => true, "label" => "Fotoğraf Kategorileri", "singular_label" => "Fotoğraf Kategorisi", 'show_ui' => true, 'show_tagcloud' => false, "rewrite" => array('slug'=>'fkat')));          add_filter( 'request', 'my_request_filter' );     function my_request_filter( $query_vars ) {     if( isset( $_GET['s'] ) && empty( $_GET['s'] ) ) {     $query_vars['s'] = " ";         }     return $query_vars;     }          function limit_posts_per_archive_page() {        if (is_post_type_archive()) { $limit = 2; } else { $limit = get_option('posts_per_page'); }          set_query_var('posts_per_archive_page', $limit);     }     add_filter('pre_get_posts', 'limit_posts_per_archive_page');          ?>


title: Custom Text in Media Uploader in a Theme Options Page

text: I want to replace the media uploader thickbox text only if it's used in the theme options page. If it is used in the Post then I don't want to make any changes. I am trying the following code, but this will change media uploader text in the post as well.   How can I make it to change text only in the theme options page?               add_filter("attribute_escape", "myfunction", 10, 2);     function myfunction($safe_text, $text) {         return str_replace("Insert into Post", "Use this image", $text);     }


title: Wordpress Customizer: custom redirection after closing

text: Someone knows if is there a way to customize the redirection after a user click "close" in the Wordpress Customizer" live editor? It would be very useful. Thank you very much.


title: When taxes are country specific they don't show in the cart totals

text: If the tax you're adding is country specific (EU countries for example) the tax estimate is not shown in the cart totals (although I'm logged in with user specified its EU billing address). But it is shown in the checkout page. I would like to ask if there is any way the tax is shown in the cart page just like it is when it isn't country specific tax. I mean this: when the taxes country code is left blank (meaning it applies to all) this is the message and screen you get ![enter image description here](http://i.stack.imgur.com/Ez2Fq.png) which is pretty awesome and works for me. But when you add a country specific code in my case DE, I don't get it in my cart page although I'm logged in with user with billing address Germany. ![enter image description here](http://i.stack.imgur.com/BuMpw.png) I get the tax in my checkout, but not in the cart which I think might be quite misleading. I hope theres a solution for this ![enter image description here](http://i.stack.imgur.com/7VUAH.png)


title: Unfortunately removed myself as plugin committer

text: Unfortunately I removed myself as plugin committer. I was only committer of my plugin. So that, I couldn't find any options to add me back again. What can I do now? Please Help.


title: WordPress category not found page prints multiple <h1> tags

text:
I use Yoast and a premium theme, everything, including "normal" 404 page prints valid html, but when I click a link like               mysite.com/categories/a_category      and if there are no posts with that category, the resulting html includes both

      and
Not Found
      I need to change Not Found to an `<h2>` tag, but how? I tried changing `wp-content/themes/mytheme/404.php` but it is already h2, and my changes does not apply for **category 404** page. So I guess it loads the content from another file, but from where ?


title: Grabbing how many posts by month for a dashboard widget

text:
I am trying to develop a dashboard widget that counts posts or post types by month. I am really not sure how to go about doing this. I know how to create a dashboard widget and all that with post counts, post type counts. I even have a custom one that lists the most recent post types i have. But I have yet to create one with just counting how many posts or post types there are in a month and I am just not sure how to do it. Any ideas and help on this would be awesome. Thank you. :) I would like it to be similar to something like this: ![This is how i would like it to look like.](http://i.stack.imgur.com/xgig2.jpg) This is an update with the script below. However I cannot get it to work.               add_action('wp_dashboard_setup', 'dashboard_test');          function dashboard_test() {     global $wp_meta_boxes;          wp_add_dashboard_widget('month_dashboard', 'Reports Submitted for the Year',   'custom_test');     }          function custom_test() {     global $wpdb;     $years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE   post_status = 'publish' AND post_type = 'report' ORDER BY post_date DESC");          foreach($years as $year)               $months = $wpdb->get_col("SELECT DISTINCT MONTH(post_date) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'report' AND YEAR(post_date) = '".$year."' ORDER BY post_date DESC");              foreach($months as $month)                        if ($month < 10)                 {                     $month = '0' . $month;                  }                       $theids = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'report' AND MONTH(post_date)= '".$month."' AND YEAR(post_date) = '".$year."' ORDER BY post_date ASC");                      echo '
';                                  echo '
' . date( 'F', mktime(0, 0, 0, $month) ). ' (' . count($theids) . ')
' ;                          echo '
';          }      I get this error: Call to a member function get_col() on a non-object in /var/www/vhosts/hibsterlite.com/httpdocs/wp- content/themes/hibsterlite/functions.php on line 209 **Ok I no longer get the error above however I only get one month listed atm. Any ideas guys? :)**


title: using .htaccess only for wordpress security no plugins

text: Right now I am using bulletproof wordpress security for my websites, but when i am installing W3 Total Cache plugin it gives me some errors related to .htaccess file and bulletproof wordpress security warns me again to proceed with clicking on create .htaccess file again. NOW, my question is.. Is it okay to use ONLY .htaccess file with complete security measures in it. And use NO security plugin with that.? I have already found some strict measures which i can put in .htaccess file and will enable directory protect in cpanel for wp-admin and wp-login.php So, am i going right.?


title: Strange error from functions.php files (wp_register_script)

text: I'm trying to migrate a wordpress site, and I'm receiving this error when debugging on the new server: > Notice: wp_register_script was called incorrectly. Scripts and styles should > not be registered or enqueued until the wp_enqueue_scripts, > admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging > in WordPress for more information. (This message was added in version 3.3.) > in /home/binaryop/public_html/wp-includes/functions.php on line 3049 Line 3049 looks like this (the one beginning with trigger_error)               function _doing_it_wrong( $function, $message, $version ) {          do_action( 'doing_it_wrong_run', $function, $message, $version );          // Allow plugin to filter the output error trigger     if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true ) ) {         if ( function_exists( '__' ) ) {             $version = is_null( $version ) ? '' : sprintf( __( '(This message was added in version %s.)' ), $version );             $message .= ' ' . __( 'Please see Debugging in WordPress for more information.' );             trigger_error( sprintf( __( '%1$s was called incorrectly. %2$s %3$s' ), $function, $message, $version ) );         } else {             $version = is_null( $version ) ? '' : sprintf( '(This message was added in version %s.)', $version );             $message .= ' Please see Debugging in WordPress for more information.';             trigger_error( sprintf( '%1$s was called incorrectly. %2$s %3$s', $function, $message, $version ) );         }     }     }      However, I can't see any use of `wp_register_script` in the functions.php, so I'm confused by what's causing this. Any ideas?


title: Copy site on same server?

text: I have a wordpress installation running in my root folder, and I want a copy in /en (including theme, posts and pages). I want a bilingual site and found the plugins too complicated for me - so I decided to simply run a duplicate in /en. I've created the /en folder and download all the wp files from my original install - i've also copied the database. Where do I go from now? Do I need to install wordpress again, or can I just move all the files to my new folder, make a new database based on the old one, and change the settings in wp-config? Thanks!


title: wp_kses ignore allowed and allow everything

text:
Here is an example:               $allowedPart = "";     $unsafePart = "
A title
";     $unsafePart .= "";          $unsafeString = $allowedPart . $unsafePart;          $allowed = array("a"=>array(                         "href"=>array()                ));          $sanitizedString = wp_kses($unsafeString, $allowed);      `$sanitizedString` should be equals to `$allowedPart`, but something goes wrong and `$sanitizedString` remains the same as `$unsafeString`. What's wrong? ========================== Sorry, after saving to the database, I did `location.reload()`, and consequently in the textarea was maintained the original content, but in database the value is **almost** correct. This secondary issue was solved using: `window.location.href = window.location.href;` However there is a problem, **'href' disappears too** , why? For example `<a href='http://alink.com'>Link</a>` becomes `<a>Link</a>` Trying something like: `$allowed = array( 'img'=>array( 'src'=>array(), ));` `<img src='img.png' />` becomes `<img />` It's as if wp_kses() recognize as unallowed all the attributes in sub-array (like href or src), filtering them and their content. ========================== Using double quotes instead of single ones seems to solve. `$allowed = array( 'img'=>array( 'src'=>array(), ));` `<img src="img.png" />`


title: Using multiple settings_fields() on 1 settings page

text:
I have been struggling with this one for about a week now. I would like to have 2 variables available on a settings page, but I cannot figure out how to do this using the Settings API. Perhaps there is a better way to do this. What I am trying to do is have one variable that stores a list of sortable values which I am outputting in a table and using jQuery sortable to allow the user to sort. But I also have some related options (such as title for the section) that are not sortable, so I want to store them in a separate variable and output them normally using add_settings_field which is where things break down. The minute I add a second settings_fields() call in the callback function below, it will allow me to set the options covered by the last settings_fields() call. Obviously since the settings_fields() adds the nonce, action, and option_page fields tot he page the second one is overriding the first call. So how do I include a second options variable on a settings page? Here is my code so far: Adding the submenu page:                   add_submenu_page(             'crest_feed_admin',             'Gallery View Options',             'Gallery View',             'manage_options',             'crest_feed_admin_gallery_view',             'crest_feed_menu_gallery_view_page'         );      Register the settings variable:               register_setting( 'crest-feed-gallery-group', 'crest_gv_options' );  // need to add validation!      Callback function for submenu page creation:               function crest_feed_menu_gallery_view_page() {              $options = get_option('crest_gv_options');         ?>

                 <img src="<?php echo CREST_PLUGIN_DIR . '/images/admin-icon-large.png'; ?>" height=32 width=32 />

<?php _e('Gallery List Items & Options'); ?>
             <form method="post" action="options.php">                   <?php             submit_button('Save Gallery View Options');              settings_fields( 'crest-feed-gallery-group' );                   crest_drag_and_drop($options, 'gv');  // this function creates the table of sortable values                  submit_button('Save Gallery View Options');                   ?>             </form>
         <?php        }


title: Using Apply Filters in the-bootstrap parent theme

text: In the-bootstrap parent theme there is the following function:               function the_bootstrap_custom_background_setup() {          $args = apply_filters( 'the_bootstrap_custom_background_args',  array(         'default-color' =>  'efefef',     ) );          add_theme_support( 'custom-background', $args );          if ( ! function_exists( 'wp_get_theme' ) ) {         // Compat: Versions of WordPress prior to 3.4.         define( 'BACKGROUND_COLOR', $args['default-color'] );         add_custom_background();     }     }     add_action( 'after_setup_theme', 'the_bootstrap_custom_background_setup' );      I would like to change default-color and add additional defaults including: 'default-image', 'wp-head-callback', 'admin-head-callback', 'admin-preview- callback'. I've read the Codex and some tutorials, but I am having difficulties understanding how to make use of apply_filters to change the defaults. Any guidance would be greatly appreciated! Thank you


title: Display posts of child category in template

text:
I have a custom post type called freebies. I want to use the archive- freebies.php for the child categories also. I have added in my functions.php the following:               function inherit_template() {         if (is_category()) {             $catid = get_query_var('cat');             $cat = &get_category($catid);             $parent = $cat->category_parent;             $cat = &get_category($parent);             if ($cat->cat_ID == 45){                 include (TEMPLATEPATH . '/archive-freebies.php');                 exit;             }         }     }     add_action('template_redirect', 'inherit_template', 1);      It's working fine so far, it loads the correct archive template, but shows me that there are no posts. What do I have to change? I'd like the template also to display the category name. I looked in the conditional tags, but there are none for custom post types? This is my achive-freebies.php               <?php get_header(); ?>
         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>" data-lightbox-type="ajax"><?php the_title(); ?>

                     <?php the_content(); ?>
                 <?php do_quickshare_output(); ?>
         <?php endwhile; ?>
<?php next_posts_link( 'Older posts' ); ?>

<?php previous_posts_link( 'Newer posts' ); ?>
              <?php else : ?>
<?php _e('Sorry, no posts matched your criteria in freebies.'); ?>
              <?php endif; ?>
         <?php get_sidebar('2'); ?>
     <?php get_footer(); ?>      I tried also another template loading function               add_filter( 'template_include', 'freebie_page_template', 99 );          function freebie_page_template( $template ) {              if ( is_post_type_archive( 'freebies' )  ) {             $new_template = locate_template( array( 'archive-freebies.php' ) );             if ( '' != $new_template ) {                 return $new_template ;             }         }              return $template;     }      But this is not working at all


title: Customizing Home Page with Pagelines Platform

text: I am finding someone who is familiar with Pagelines and could give me a little help in locating the file to edit. I am running my Word Press blog with Pagelines Platform Free Version and have encountered some difficulties in customizing my home page and the search results page. By default, Platform shows 30 most recent posts in the first page of the home page and 30 search results as well in the first page of search results. However, the page is too long and I would like to cut the page to only showing 10 results / posts per page. There isn't a home.php for me to edit and I have found postloop.php but no luck. Does anyone knows how to customize the home page and search results page? Thanks in advance.


title: Add page-link after post content. Before plugin

text:
I want to add page-link before Facebook Comment plugin. Currently the sequence is:   1. Post content,    2. Facebook Comment,    3. Page link In my `single.php`:               the_content();     wp_link_pages( array(          'before' => '
'.__( 'Pages:', 'themejunkie' ),         'after' => '
'     ) );      In my plugin:                  add_filter ( 'the_content', 'fbcommentbox', 100 );      How to get the following order                1. Post content,      2. Page link,      3. Facebook Comment


title: Issue with recent custom post type permalink

text:
I'm using the following code in my footer to get the latest posts from specific custom post type.               <?php     //WordPress loop for custom post type with taxonomy      $my_query = new WP_Query('post_type=res&registered_taxonomy=res-cl&posts_per_page=3');           while ($my_query->have_posts()) : $my_query->the_post(); ?>                      <?php the_title( '
', '
' ); ?>               <?php endwhile;  wp_reset_query(); ?>      But whenever I go to any page, the result is different. When I go to another custom post, the footer gets the current page posts, although the number of post is totally different. Any idea what is wrong with my code? PS: I've used reset query at the beginning of the above code.


title: How to get custom metabox image field?

text: i have custom metabox with the image field, i can upload image from wp-admin to this metabox, metabox code               array(                 'name' => 'Burst Image',                 'desc' => 'Crop your image to exact dimension before upload!',                 'id' => 'burst_img',                 'type' => 'image'             )      i have code like `$burst_img= get_post_meta( $post->ID, 'burst_img', true );` to get the metabox , but it doesn't work, how can i get the metabox image ?


title: Wordpress post search shows not related results for search query

text: First, sorry I cannot show any code because I do not know where the actual problem is. I did not modify anything nor install any plugins, but when I search for a post globally with the default search, I am getting a few correct results back, but the problem is it shows a lot of posts results what are actually not related to the search query. So if I search for example 'Hello World'. I get the Hello World post back and under it I get results like: Football, Basketball related posts and neither the content or title contains Hello World for example. I searched a lot did not find any solution, did anyone else have this problem? Is there a fix for it?


title: Unable to manipulate rewrite rules without calling flush_rewrite_rules() each time

text: I am trying to make a small portfolio website in multiple languages. Just a few pages (the actual blog doesn't need to be in multiple languages), mainly pages that are generated by a own-made plugin. (Using template_redirect, couldn't find a cleaner way?) Using this SO post about rewriting rules, I am trying to append /%lang%/ to my urls. Everything works fine while having flush_rewrite_rules() in my init, but as soon as I remove it $wp_rewrite->rules is completely empty. I have the following filters in init:               // Register multilanguage urls     add_rewrite_tag('%lang%', '(nl|en)');          // Filters for url rewriting     add_filter('root_rewrite_rules', array(&$this, 'root_rewrite_rules'));     add_filter('page_rewrite_rules', array(&$this, 'page_rewrite_rules'));     add_filter('rewrite_rules_array', array(&$this, 'final_rules_correction'), PHP_INT_MAX, 1);          add_filter('page_link', array(&$this, 'rewrite_lang_in_permalink'), 11, 3);     add_filter('request', array(&$this, 'default_language'), 9);      All these methods basically do the same thing as from the SO post. I know doing flush_rewrite_rules() every time is bad practice, so I would love to avoid that. On a small related note, is it possible to rewrite custom urls in the menu that point to the website? (some sort of str_replace(base_url, base_url/%lang%/) way?) **EDIT: Added the methods just in case**               public function root_rewrite_rules($rules)     {         global $wp_rewrite;              $struct = ltrim($wp_rewrite->get_date_permastruct(), '/');         $struct = preg_replace('#^%lang%/?#', '', $struct);              $root_structure = '/%lang%/'.$struct;              return $wp_rewrite->generate_rewrite_rules($root_structure, EP_DATE) + $rules;     }          public function page_rewrite_rules($rules)     {         global $wp_rewrite;              if (empty($wp_rewrite->permalink_structure))         {             $wp_rewrite->page_structure = '';             $page_structure = false;         }         else         {             $struct = ltrim($wp_rewrite->root.'%pagename%', '/');             $struct = preg_replace('#^%lang%/?#', '', $struct);                  $wp_rewrite->page_structure = '/%lang%/'.$struct;             $page_structure = $wp_rewrite->page_structure;         }              return $wp_rewrite->generate_rewrite_rules($page_structure, EP_PAGES, true, true, false, false) + $rules;     }          public function final_rules_correction($rules)     {         global $wp_rewrite;              $new_rules = array();         $find = "nl|en";         $find_find = '#(?<!\()('.preg_quote($find, '#').')#';         $preg_node = str_replace('%%%', '(\d+)', preg_quote($wp_rewrite->preg_index('%%%'), '#'));              foreach ($rules as $k => $v)         {             if (preg_match($find_find, $k))             {                 $nk = preg_replace($find_find, '('.$find.')', $k);                 $parts = explode('?', $v);                 $index = array_shift($parts);                 $pv = implode('?', $parts);                 $pv = preg_replace_callback('#'.$preg_node.'#', function ($matches) use ($wp_rewrite) {                     return $wp_rewrite->preg_index($matches[1]+1);                 }, $pv);                 $nv = $index.'?lang='.$wp_rewrite->preg_index(1).(!empty($pv) ? '&'.$pv : '');                 $new_rules[$nk] = $nv;             }             else             {                 $new_rules[$k] = $v;             }         }              return $new_rules;     }          public function rewrite_lang_in_permalink($permalink, $post = 0, $leavename = false)     {         return str_replace('%lang%', DatabaseHelper::get_active_language(), $permalink);     }          public function default_language($vars)     {         if (array_diff(array_keys($vars), array('preview', 'page', 'paged', 'cpage')))             $vars['lang'] = !empty($vars['lang']) ? $vars['lang'] : DatabaseHelper::Dutch;              return $vars;     }


title: wp_localize_script, variable is not defined in jquery

text: I try to load a post with Ajax. `functions.php`:               function my_action_callback() {             wp_localize_script('jscustom', 'ajax_custom', array(                 'ajaxurl' => admin_url('admin-ajax.php')             ));             wp_enqueue_script('jscustom');     }     add_action('wp_ajax_my_action', 'my_action_callback');      jQuery code in `custom.js`:               jQuery(window).load(function() {         var morebutton = jQuery('#load-more'),             archive = morebutton.rel,             deftext = morebutton.text(),             page = 1;              morebutton.click(function(e){             e.preventDefault();             page++;               morebutton.text(ajax_custom.loading);         jQuery.post(ajax_custom.ajaxurl, {action:'load_more', page:page, archive:archive}, function(data){...      When I press the "load more" button, I get an error: > ReferenceError: ajax_custom is not defined What is wrong?


title: Register scripts located in child theme?

text: I'm having a lot of trouble registering scripts located in a child theme folder: This works fine:               function register_scripts() {         wp_register_script( 'newsletter', get_template_directory_uri() . '/scripts/scripts.js', array( 'jquery-migrate' ), null );     }     add_action( 'init', 'register_scripts' );      However it points to the parent theme folder and not the child, when I try to point to the child theme folder, nothing at all happens:               function register_scripts() {         wp_register_script( 'newsletter', get_stylesheet_directory_uri() . '/scripts/scripts.js', array( 'jquery-migrate' ), null );     }     add_action( 'init', 'register_scripts' );      What am I doing wrong?


title: Save checkbox value in metabox

text:
I created metabox for specific page template. Now I need to save checked or unchecked value of my checkbox. How can I do that? This is my code:                   add_action('add_meta_boxes', 'add_home_meta');     function add_home_meta()     {         global $post;              if(!empty($post))         {             $pageTemplate = get_post_meta($post->ID, '_wp_page_template', true);                  if($pageTemplate == 'template-home.php' )             {                 add_meta_box(                     'home_meta', // $id                     'Homepage Options', // $title                     'display_home_meta', // $callback                     'page', // $page                     'normal', // $context                     'high'); // $priority             }         }     }          function display_home_meta() {       global $post;         // Add the HTML for the post meta     wp_nonce_field( 'avt_homepage_meta_box', 'avt_homepage_meta_box_nonce' );                /*            * Use get_post_meta() to retrieve an existing value            * from the database and use the value for the form.            */           $value = get_post_meta( $post->ID, 'home_slider_display', true );            ?>
                              <?php _e( 'Display slider on homepage:', 'avt' ); ?>                          <input type="checkbox" name="home_slider_display" value="true" />
     <?php    }          function avt_homepage_save_meta_box_data( $post_id ) {                // Check if our nonce is set.           if ( ! isset( $_POST['avt_homepage_meta_box_nonce'] ) ) {             return;           }                // Verify that the nonce is valid.           if ( ! wp_verify_nonce( $_POST['avt_homepage_meta_box_nonce'], 'avt_homepage_meta_box' ) ) {             return;           }                // If this is an autosave, our form has not been submitted, so we don't want to do anything.           if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {             return;           }                // Check the user's permissions.           if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {                  if ( ! current_user_can( 'edit_page', $post_id ) ) {               return;             }                } else {                  if ( ! current_user_can( 'edit_post', $post_id ) ) {               return;             }           }                /* OK, its safe for us to save the data now. */                // Make sure that it is set.           if ( ! isset( $_POST['home_slider_display'] ) ) {             return;           }                // Sanitize user input.           $my_data = sanitize_text_field( $_POST['home_slider_display'] );                // Update the meta field in the database.           update_post_meta( $post_id, 'home_slider_display', $my_data );         }         add_action( 'save_post', 'avt_homepage_save_meta_box_data' );


title: Google map that plot's several markers - each one with custom data

text: I'm looking to create a custom Google map that plots several markers on it that then shows custom data in the popup when the marker is clicked. I've setup the pages in WP in this manner: Map (parent page)   * Company one (child)   * Company two (child)   * Company three (child) ...and so on. I want the map to be on the map page and each marker to be of the child pages. I use this plugin to create custom fields as it allows me to easily create the 20 or so fields (each one consists of various checkboxes, drop downs, image fields etc etc) per page. **How would I loop through each child page and plot the marker based on their post code?**


title: Redux framework wordpress calling variable [echo]

text: Can anyone who successfully used this framework help me? Redux states that it utilizes a global variable for referencing all of the saved options in the database. My goal is to access these stored options, so I can figure out how to call them.                array(                         'id' => 'logo',                         'type' => 'media',                         'url' => true,                         'title' => __('Logo w/ URL', 'redux-framework-demo'),                         'compiler' => 'true',                         //'mode' => false, // Can be set to false to allow any media type, or can also be set to any mime type.                         'desc' => __('Basic media uploader with disabled URL input field.', 'redux-framework-demo'),                         'subtitle' => __('Upload any media using the WordPress native uploader', 'redux-framework-demo'),                         'default' => array('url' => 'http://s.wordpress.org/style/images/codeispoetry.png'),                         'hint' => array(                             'title'     => 'Hint Title',                             'content'   => 'This is a <b>hint</b> for the media field with a Title.',                         )                     ),


title: Pulling in content from another page

text: I'm using advanced custom fields and Im trying to pull content from sub pages onto the homepage The below works but I was wondering whether it was possible to do this automatically and not write static ids on the fields?               <ul>         <li>             <?php the_field('content', 5); ?>         </li>              <li>             <?php the_field('content', 6); ?>         </li>     </ul>      The page setup is like: home -parent page --sub page --sub page Any ideas would be much appreciated


title: How to display custom post types using single-[post_type] and archive-[post-type]?

text: I'm having a bit of a problem with my custom post types... My post type is called 'videos'. I have all of the posts showing on their single page using the 'single.php' template. But when I take the post name out of the url and keep /videos/, I get a 404 - but I want to list all of the 'videos' here. I tried using archive-videos.php file as the codex reccomends: http://codex.wordpress.org/Post_Types, still with no luck. It also says you can do single-videos.php for custom post types, but this doesn't work either. I'll display the code I use to register my post type below, am I doing something wrong?               add_action('init', 'videos_register');     function videos_register() {         $labels = array(             'name' => _x('Videos', 'post type general name'),             'singular_name' => _x('Video', 'post type singular name'),             'add_new' => _x('Add New', 'question'),             'add_new_item' => __('Add New Video'),             'edit_item' => __('Edit Video'),             'new_item' => __('New Video'),             'view_item' => __('View Video'),             'search_items' => __('Search Videos'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );         $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','thumbnail')           );          register_post_type( 'videos' , $args );         flush_rewrite_rules();     }


title: How to set a custom path, for ajax image upload folder in admin?

text: I am coding my first Wordpress plugin that handles some data for a custom (shop-like) post type. It also has an image uploader within a metabox, where you simply drag in your images and it automatically handles the uploads, filename and media-library integration without reloading the page. (AJAX) To do this I use Javascript for drag and drop and an AJAX submit to send the images to a wp-function in the backend. I use the `media_handle_upload()` that wordpress offers. It creates my thumbnails and does the upload process using `wp_handle_upload()` it also does the db-part for me which is pretty comfortable. **Code for this Part:**               //// WP AJAX: UPLOAD FILES ////     add_action('wp_ajax_save_attachments', function ($post) {         $file = $_FILES['file'];              if(!empty($file) && $file['size'] > 0) {                  if(isset($_POST['apt_post_id'])) {                 $post_id = $_POST['apt_post_id'];                 // retrieve the filetype & check if is allowed for upload                 $filetype = wp_check_filetype(basename($file['name']));                 $allowed_filetypes = array(                     'image/jpeg',                     'image/png',                     'image/gif',                 );                 if(in_array($filetype['type'], $allowed_filetypes)) {                     // Set up options array to add this file as an attachment                     $post_data = array(                         "post_title"        => 'Testimage',                         "post_content"      => "",                         "post_status"       => "inherit",                     );                     $overrides = array( 'test_form' => false );                          if( $attachment_id = media_handle_upload('file', $post_id, $post_data, $overrides) ) {                         $attachments = get_attached_media('image', $post_id);                         $attachment = get_object_vars($attachments[$attachment_id]);                         $data = array(                             'ID'        => $attachment['ID'],                             'thumbnail' => wp_get_attachment_thumb_url($attachment['ID']),                             'name'      => $attachment['post_title'],                         );                         echo json_encode(array(                             'success'       => true,                             'message'       => 'Image successfully uploaded!',                             'attachment'    => $data,                         ));                         die;                     }                 } else {                     // errorhandling                 }             } else {                     // errorhandling         } else {                     // errorhandling         }     });      Now I want to upload the images to a specific folder like `/wp-root/wp- content/uploads/apartments/` to do this I found out that one can set a filter: `add_filter( 'upload_dir', array($this, 'wpUploadDir') );`which I did and tested with the "normal" (non-ajax) upload and it worked fine. But doing the same with an AJAX upload has no effect at all. It always loads the images to the `../2014/07/` folder. Is there any way to change this? I tried to put the filter-call in the 'admin_init' or 'init' or even before, but nothing seems to work. I can't find anything on google that could solve my question, so I am here. Thank you for any hint and solution! **EDIT: The way how I integrated the filter call:** At this state my class is pretty chaotic, but works fine so far... (the cleanup will follow). I try to only show necessary code because it would be more than 1000 lines of code if I'd post it all. As I already mentioned, I tried 3 calls of the filter. Here you can see them all as comments.               new Zap('zap_apartments');               class Zap     {         // some privates...              /**          *  Stores the upload folder for this post type          */         private $_upload_dir = '/apartments';              public function __construct($post_type_id)         {             // set post_type_id by argument             $this->post_type_id = $post_type_id;                  // set post_type as a new object from Fixture             $this->post_type = new wpObjectsData($this->post_type_id);                  // ONE TRY TO ADD THE FILTER CALL:             //add_filter( 'upload_dir', array($this, 'wpUploadDir') );                  // runs on plugin activation             $this->wpPluginActivation();                  // run global wp init             $this->wpInit();                  // run wp admin init             $this->wpAdminInit();         }                   public function wpInit($post)         {                    add_action('init', function($post) {                      // register post-type to wordpress                 $this->post_type->registerPostType();                      // register taxonomies to wordpress                 $this->post_type->registerAllTaxonomies();                      // ANOTHER TRY TO ADD THE FILTER CALL:                 //add_filter( 'upload_dir', array($this, 'wpUploadDir') );             });         }                   public function wpAdminInit()         {             add_action('admin_init', function() {                      // ANOTHER TRY TO ADD THE FILTER CALL:                 //add_filter( 'upload_dir', array($this, 'wpUploadDir') );                      // register wp scripts                 add_action( 'admin_enqueue_scripts', array($this, 'wpRegisterScripts') );                      // call the metaboxes                 $this->metaboxes();             });         }                   /**          *  Set new wp upload directory for custom post type          *            *  @param  []  (required) array with _FILE structure          *  @return []  array with new _FILE structure          */         public function wpUploadDir($param)         {             global $post;                  if($post->post_type == $this->post_type_id) {                 $param['path'] = $param['basedir'] . $this->_upload_dir;                 $param['url']  = $param['baseurl'] . $this->_upload_dir;             }                  return $param;         }                   /**          *  Register all metaboxes for the plugin          */         public function metaboxes()         {             add_action('add_meta_boxes', function() {                         //   $id (css),      $title,        $callback,              $post_type,         $context,   $priority,  $callback_args                 add_meta_box('zap_coredata', 'Stammdaten',  'apt_coredata',         'zap_apartments',   'normal',   'high');                 add_meta_box('zap_features', 'Merkmale',    'apartment_features',   'zap_apartments',   'normal',   'high');                 add_meta_box('zap_images',   'Bilder',      'apt_images',           'zap_apartments',   'normal',   'high');             });                  // tons of code here                  //// WP AJAX: UPLOAD FILES             add_action('wp_ajax_save_attachments', function () {                      // THE CODE YOU CAN INSPECT ABOVE                  });                  // tons of code here... yes i need to clean up soon, I know! ;-)         }     }      ![Here's a Picture of the callback right after the dropped image has uploaded](http://i.stack.imgur.com/mSzsx.png)


title: Capabilities don't add

text: I've wrote this code.               function wpo_install() {         update_option( 'wpo_version', WPO_VERSION );              wpo_add_caps();         wpo_add_roles();              set_transient( '_wpo_activation_redirect', true );     }     register_activation_hook( WPO_ROOT, 'wpo_install' );      In another file:               global $wpo_shared_caps;     $wpo_shared_caps = array(         'edit_wp_orders',         'edit_wp_order',         'edit_others_wp_orders',         'read_wp_order',         'read_private_wp_orders',         'delete_wp_order'     );          function wpo_add_caps() {         global $wpo_shared_caps;              $admin_caps = array(             'backup_settings',             'view_full_reports',             'get_report_output'         );         $admin_caps = array_merge( $admin_caps, $wpo_shared_caps );         $admin = get_role( 'administrator' );              foreach( $admin_caps as $admin_cap )              $admin->add_cap( 'administrator', $admin_cap );          }          function wpo_add_roles() {         remove_role( 'accountant' );         remove_role( 'employer' );              global $wpo_shared_caps;              $read_caps = array(             'read_wp_order'              => true,             'read_private_wp_orders'     => true         );              $acc_caps = array();         foreach( $wpo_shared_caps as $cap )             $acc_caps[ $cap ] = true;              add_role( 'accountant', __( 'Accountant', 'wpo' ), $acc_caps );         add_role( 'employer', __( 'Employer', 'wpo' ), $read_caps );     }      But these aren't working. Please help me. I've confused!


title: Processing form post data using database queries to construct custom query string

text: I have a form on my wordpress site. On form submission I want to: 1) Capture the form data 2) Run database queries using these data 3) Process the results and use these to construct a query string 4) Redirect user to site root + query string Outside wordpress, I'd solve this by making the form action="my_query_string_constructor.php" and just do all the necessary processing of the post data there. I considered doing something analogous in wordpress by making the form action some like "single- my_query_string_constructor_posts.php" but this feels very hacky and I'd much rather have a solution which fits with best practice. I want to make sure that my solution is secure but I'm unsure of the best way to use the nonce system here. I'm also unsure whether I should put my database queries and query string construction code in the page itself, or in functions.php, or indeed somewhere else. Would really appreciate your advice on the best approach to take (I'm not asking you to write the code for me!)


title: Use is_category(), is_tag(), ... in functions.php

text: I want to check in `functions.php` if actual page is a category page, tag page, ... but the functions to check it (`is_category()`, `is_tag()`, ...) doesn't seem to work, as this condition:               if(is_category() || is_tag() || is_home())      never pass. E.g. is_category() doesn't seem to need to be called on the loop. Any idea of why it's not working and how to solve it? **Edit:** The complete example for my case is: _inside functions.php_               /* Add hentry class to body */           if(! function_exists( 'one_function' )) {         function one_function( $classes ) {             $classes[] = get_classes(); //this is a custom theme function which put the classes into an array.             $classes[] = 'hentry';                   return $classes;         }         if(is_category() || is_tag() || is_home())             add_filter( 'body_class', 'one_function' );  //this is executed if removing the "if" condition          }


title: 'Trying to get property of non-object' when using WP_Query with 'fields' => 'ids'

text: In an attempt to speed up my query, I'm using the following arguments:               $args = array(         'post_type' => 'product',         'fields' => 'ids',     );          $query = new WP_Query($args);      While this does return an array of IDs as expected, I keep getting multiple `Trying to get property of non-object in /wp-includes/query.php` notices. This happens even when I have nothing inside my `while` other than `the_post()`:               if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();     endwhile;     endif;      Is `the_post()` causing this? Any idea why I'm getting these notices?


title: Optimised Code for Pulling Taxonomy Posts

text: I have created a CPT called 'stores', each store has a taxonomy registered to it called 'store-type' (i.e. whether it's a fashion store, or kids etc). There is a third taxonomy 'floor'. A store can be on multiple floors like a large department store. I have been asked by the client to list all the 'stores' by 'store type' and on each floor. So far I have an idea to create a horrible loop like: (only pseudo-code at the moment)               foreach storeLevel as level     {        foreach storeType as type        {           get_posts_by_store_type() /* Note this would be a new WP_Query() */           list_stores();        }     }      As you can imagine, this would create hundreds of queries. There is also some custom fields on each post I need to pull through. Could anyone point me in the direction of a better method to list posts by taxonomy? edit: I have tested a similar bit of code on just listing the stores without going through each level and it's created around 80 queries and only a 5th of the stores have been added. :/


title: Site migration - some images not displaying in Media Library

text: After migrating a site from the live server to my test server (different URL), some of the images (not all) are not displaying. The src is correct, image is in the uploads folder, and everything looks good in the database. However, the image does not appear. Again it's only "some" of the images and not all. Other images within the same folders, e.g. wp-content/uploads/2013/09/, are being loaded correctly. Ideas? P.S. And the rest of the content is correct. UPDATE: Found out that all images that are affected include é within the image's filename. Once I copied the filename into the post and meta tables, it worked. Not sure why?


title: "Print to printer" functionality in a plugin

text: I want to add "print" button to print simple reports in a plugin. The basic idea I have is to generate a printer friendly html page and redirect user to that page where he/she can use browser's print functionality. How good is that solution? Is there any other alternative?


title: Add Element as a Filter to the_content

text:
Can I and How would I add a filter in the function.php that would add a HTML element around the content when the_content is used? This would be similar to what you can do with the_title. i.e:               the_title( '
', '
' );      What I need is to add a section element around the content containing a class similar to:               the_content('
', '
');      I know I can:
         <?php the_content ?>
      But if I can filter it in, it would GREATLY reduce the number of php open and close tags by minimizing a lot of the code in the template files [and also i can mindlessly code more w/o having to remember to add the tags - LOL]. Any help will be greatly appreciated. Thnx! EDIT This is what i needed:               function content_filter($content) {         return '
' . $content . '
';     }     add_filter( 'the_content', 'content_filter', 6);


title: How to make changes to style.php

text: I am working from a Wordpress theme called Dynamix. The site is located here... If you scroll down to the post with a comment, you'll see a comment bubble, with a solid black background. If you hover over it, you'll notice it turns red. **In Chrome's debugger, I found this line of code...** (It's long, but it starts with this) `#content ul li.socialinit, #content` **and it ends with this background tag...** `background-color: #252525;` (in the debugger). In style.php, which is **here** , I found the code, but I have no idea how to change it. Looks like this: `background-color:#<?php echo $linkcol; ?>;` I don't want the black background. I want it to say `background: none;`, which should fix my issues. **I'm lost on what to do here...**


title: query post limits

text: function posts_limit_fn($limit, $query, $custom_limit = ''){         if($custom_limit !== ''){             return $custom_limit;         }         return $limit;     }      this piece of code is executed into an AJAX function `add_action('wp_ajax_search_query', 'search_query');`               $queryString = array( 's' => $searchTerm, 'cat' => $categoriesIDs, 'post__not_in' => array($excludedPost));          if($queryString != ''){         add_filter('post_limits', 'posts_limit_fn',10, 3);         $custom_limit = 'LIMIT 0,4';         apply_filters('post_limits', '', '', $custom_limit);              $query = new WP_Query($queryString);     }      For some kinda of reasons the `apply_filters` doesn't work so the query is returning all posts. What would be the problem ? UPDATE: Seems that If I have something like this :               function posts_limit_fn($limit,$query,$custom_limit = ''){         echo $custom_limit.">>>>>>>";         if($custom_limit !== ''){             return 'LIMIT 0,3';         }         return $limit;     }      the output is `LIMIT 0,4>>>>>>>>>LIMIT 0,10>>>>>>>>>post1,post2,post3`


title: Display and Update User Custom Meta via user-edit.php

text: Is there a For/Loop available to display all the available WordPress User Custom Meta Data so that when on the user.edit.php screen you can see and update all custom metadata? I understand methods exist on a per item basis.


title: Custom Type add Transitions

text: I have created a custom post type for a slider (namely Piecemaker). I can add posts with featured images and descriptions, that can be used with the slider. Also, I have added a taxonomy for actually creating the sliders(sort of like a category that represents the slider ID, used for creating multiple sliders). My problem is setting the transitions, though. The slider transitions are separate from a slider image, so they cannot be specified as meta values of posts. So, I am thinking, what is the best way to do that. Can I somehow add the ability to specify transitions ? Notice that i don't really want to create a new custom post type to do that. It would be great to have the ability to easily add/remove and edit transitions in the same context of the custom guest post, without them being actual posts (there is no need for that really, they are just simple options). How would you go about that ? Is there a resource that can help me with that, or a Wordpress preferred way of doing something similar ? I know that i can always write my own implementation, like a settings panel, but apart from being an overkill, it will be kinda separated from the custom post type. I would really like a way to connect those.


title: Plugin option default value

text: Hi I am making plugin default option sets.I put my code like this.Basically I want to give an image path in plugin folder.I did this .               function add_scroll_default() {     $tmp = get_option('scroll_options');     if((!is_array($tmp))) {         $arr = array("top_image"=>"echo'plugins_url( '/image/top.png', __FILE__ )'");         update_option('scroll_options', $arr);     }      } Upon inspection on database I found that the value stored               echo'plugins_url( '/image/top.png', __FILE__ )'      But I want to put the image url? Thanks


title: Image still linked as attachment to page even though it has been deleted

text: I have been working on an image gallery feature where I grab images which are attached to pages and display them in various places via the `get_posts()` function. However, I am finding that when I remove images from the page that they have been placed that they still seem to be set as attachments. I'm just wondering if there's something I'm mis-understanding about attachments or if this is buggy behaviour? It may be worth me adding that I am getting images as attachments of pages because I need to be able to categorise the images and display them via categories in different places on the site. If I was able to categorise images directly I realise I wouldn't need to worry about this problem I'm encountering!


title: Wordpress use of @ in core files

text: I am studying twenty_eleven theme and have some quesions. What is                * @package WordPress      * @subpackage Twenty_Eleven      * @since Twenty Eleven 1.0      */      What is the use of @ mean. And again.                * @uses load_theme_textdomain() For translation/localization support.      * @uses add_editor_style() To style the visual editor.      * @uses add_theme_support() To add support for post thumbnails, automatic feed links, custom headers      *  and backgrounds, and post formats.      * @uses register_nav_menus() To add support for navigation menus.      * @uses register_default_headers() To register the default custom header images provided with the theme.      * @uses set_post_thumbnail_size() To set a custom post thumbnail size.      *      * @since Twenty Eleven 1.0      */


title: Depth > 2 possible with multisite?

text: Is there anyway to create blogs with 2 depths using multisite? I want to have an installation in root and blogs with 2 depths. Something like:               /         - WP installation: root aggregate      /foo      - WP installation: aggregate for a topic     /foo/item - WP installation: blog for an item      Trouble is that multisite only goes in one level. Other problem is that if I install in root, then I'm afraid that this blog takes everything bellow. So my questions are:   * Is it possible to do an installation of a blog inside another blog? or   * Is it possible to get multisite to allow for 2 depth levels?  Thank you.


title: Natural URL Design and static front page

text: A static front page and other pages which are children of it are used on a blog. To give an example: www.example.com The slug for that page shows up in the permalink for sub pages like www.example.com/long-slug-from-static-front-page/sub-page-slug.html. The question now is how to make the URL Design more natural? Since the parent page is the frontpage, it's slug should be the sites homepage-URL (e.g. none as in http://www.example.com/) but the static pages slug is added instead. I smell that this is a shortcoming in WordPress, any ideas? I was asked to make the scenario more concrete by an Illustration because it was quite akward describben. Sorry. Aim is to use WordPress as a CMS to reflect the following structure (please not the other way round): **Illustration:** _Logical Data and it's Structure:_   * Start      * Blue     * Red        * Dark Red       * Light Red       * Burned Red     * Yellow _Mapping of Data to Pages:_   * Start: Home-Page      * Blue: Blue-Page     * Red: Red-Page        * Dark Red: Dark Red-Page       * Light Red: Light Red-Page       * Burned Red: Burned Red-Page     * Yellow: Yellow-Page _URL Layout:_   * Home-Page: http://example.com/     * Blue-Page: http://example.com/blue/     * Red-Page: http://example.com/red/       * Dark Red-Page: http://example.com/red/dark/       * Light Red-Page: http://example.com/red/light/       * Burned Red-Page: http://example.com/red/burned/     * Yellow-Page: http://example.com/yellow/ Is WordPress the tool for the job? Or does using page hierarchy and static front-page contradicts the URL layout?


title: Wordpress image width top banner background

text: In http://chuaquanam.ca/wordpress/, would anyone know how to make the image banner in the top of the screen to cover the whole width of the screen which is 1350px (and not 920 px) ? I would like to make it become like this http://chuaquanam.ca/ When I put 1350 as width in the .css file, the image becomes repeatable which is not good. Thanks, Vinh


title: Can I use a number for a post/page slug?

text: Is it possible to use a number for a post/page slug? I have tried to use e.g. '123' for my page slug, but each time WordPress converts it to '123-2'. I'm guessing that any number is perhaps interpreted by WP as an ID. The number I want to use has nothing to do with post/page IDs. Can I get around this? And yes, I have a good reason for using a number in stead of text in this case :-) Edit: On a related, more general note, what restrictions are there on what you can put in a slug? I have found that I also can't use the + sign, though I've had that character in file names working just fine.


title: How to add anchor tag at the top of posts, past the header and nav bar?

text:
my site is here: http://wedding.chloe-nguyen.com/ I am using the default Twenty Fourteen theme, modifying in a child theme (my first). Scroll down and click one of the featured posts. You get taken to the single post page at the top of the page. I would like it to scroll down past the castle, past the nav bar, to the top of the title of the post. I would like my readers to get to the content while keeping the full-screen announcement on every page. I'll add a secondary nav in the right sidebar via a widget. I found this: http://wordpress.org/support/topic/automatically-scroll-down-to- content?replies=6 but I don't know JS and the OP's site is no longer a header followed by the post(s). On my site, the div that holds the content is `<div id="main" class="site- main">` (I did not change this; it is the default code in the Twenty Fourteen theme) Therefore, I think the answer is to make the links that go to posts have #main at the end, but I don't know how. Here's the featured-content.php code:               <?php     /**      * The template for displaying featured content      *      * @package WordPress      * @subpackage Twenty_Fourteen      * @since Twenty Fourteen 1.0      */     ?>

         <?php             /**              * Fires before the Twenty Fourteen featured content.              *              * @since Twenty Fourteen 1.0              */             do_action( 'twentyfourteen_featured_posts_before' );                  $featured_posts = twentyfourteen_get_featured_posts();             foreach ( (array) $featured_posts as $order => $post ) :                 setup_postdata( $post );                       // Include the featured content template.                 get_template_part( 'content', 'featured-post' );             endforeach;                  /**              * Fires after the Twenty Fourteen featured content.              *              * @since Twenty Fourteen 1.0              */             do_action( 'twentyfourteen_featured_posts_after' );                  wp_reset_postdata();         ?>

      Of course, this doesn't include the next post / previous post links, links to posts from the calendar, etc. I just thought I would start with the ft posts. How do I say, "on every post link, add #main at the end"? Am I looking in the wrong place? I saw this: Appending anchor tag to next post which is the closest discussion thread I can find to what I need. I found the add_filter function in the WP Codex but I am unsure about what to put in the parentheses and single quote marks. Thank you in advance. Sincerely, Chloe


title: Get array value

text: I want to get a custom post value from post ID PHP code :               $custom_field = get_post_meta(2055, the_field('titdesc'));     var_dump($custom_field);`      Output :               array(6) {       ["_edit_last"]=>       array(1) {         [0]=>         string(1) "1"       }       ["_edit_lock"]=>       array(1) {         [0]=>         string(12) "1373450528:1"       }       ["_wp_page_template"]=>       array(1) {         [0]=>         string(8) "work.php"       }       ["titdesc"]=>       array(1) {         [0]=>         string(34) "and some experience, coffee & fun."       }       ["_titdesc"]=>       array(1) {         [0]=>         string(19) "field_51baf57155c20"       }       ["dsq_thread_id"]=>       array(1) {         [0]=>         string(0) ""       }     }      I want `["titdesc"]` value but not able to get what to write in PHP to get `["titdesc"]`'s value.


title: display posts from category within a custom taxonomy

text: I am trying to listing posts from a single category of my custom taxonomy. I have created a custom post type called "news" and a custom taxonomy called "instituteName". I then created a number of categories using the "instituteName" taxonomy. I would now like to display the posts from only a single category. e.g. i have created a category "businessSchool" underneath "instituteName" taxonomy. Now I want to display the four latest post the "businessSchool" category only. ![screenshot](http://i.stack.imgur.com/zlzbw.jpg) Any help would be greatly appreciated!


title: wordpress plugin to manage the layout/design of a theme

text: I want to use a plugin that will allow me to manage the layout/design of a wordpress site. Is there such a plugin?


title: Theme and Plugins sharing common libraries

text: I have seen a number of similar questions here on WP_SE but I believe my situation is a little different because the common libraries I'm creating are frameworks that I'd certainly like to be able to update and maintain, but are not decorations - ie: I can't author a theme that depends on the library and then degrade the theme nicely if the library isn't found. **Common Libraries** I have a set of utility functions and some classes that I have developed to really speed up certain aspects of WordPress customization. I have been using them extensively in custom themes, and they are then usually bundled in some subdirectory of the theme. Now I'm writing a plugin and I want to use those libraries in the plugin. The logical place for them in the case of plugins would be inside some kind of lib/ or include/ folder inside my plugin's directory structure. The problem of course is that if I'm using both the plugin and the theme, the functions and classes are all being declared twice and that throws an error. Require_once doesn't realize these are the same codebase because of the different paths. One solution would be to bundle all these libs into a separate plugin, and have the theme and the plugin leverage this utility plugin. But because these libs are **essential** to the theme/plugin's operation, the plugin **must** be installed when the theme/plugin is in use. Thinking forward, I don't want someone to have to download and install my theme and then download and install a plugin so that the theme will work. So that solution seems out of the question for me. Can a theme or plugin go and fetch another plugin and install it? Can the theme installation process write to a directory other than `wp- content/themes`? same with the plugin activation process?


title: Can I create my own "Recent Posts" widget or customize the existing one?

text: I'd like to enable the Recent posts widget with the ability to show a "View All" link when there are more posts than I've currently got the widget set to show. I'd also like to be able to exclude certain categories or posts from it. Is it possible to do either via my theme's functions.php? (1) Customize the existing widget or (2) Create a copy of it that I can customize?


title: Change image name during uploading sequentially

text: Is there any way to change the image name during uploading in Wordpress, but with one requirement - the new file names should be going sequentially, not in hash? There was a very similar question with a fine answer here, but the new characters are going in hash there, not in order. Thank you for any help!


title: Make three menus with three category levels

text: I want to have 3 menus of categories, and each menu with diferent level of categories. First menu with First level categories:   * category 1   * category 2    * category 3 If I go to the first category, I want to show a second menu under de first one with child categories of current category:   * subcategory 1.1    * subcategory 1.2    * subcategory 1.3 And finally, if I go to subcategory 1.1, I want to show a new menu with child categories of current subcategory:   * subsubcategory 1.1.1    * subsubcategory 1.1.2    * subsubcategory 1.1.3


title: How can I reuse the code to capture a param in a URL and place in a value in a hidden form?

text: I have a form that will be re-used in different posts. I also have php code that will be reused to populate the form with the value in the URL. I tried to use php shortcode and wp php exec, but it doesn't appear to work:                  value = "[exec]echo htmlentities($_GET['source'])[/exec]"      I basically want a simple, reusable way to grab parameters and have it as the value in a hidden field on a form.


title: Modifying admin sidebar contents to show pending posts indicator

text: Hey, I've been trying to get a pending count to appear on the admin sidebar, for pending posts, like the little bubble that appears for pending comments: ![Comments pending bubble](http://i.stack.imgur.com/XKhzj.jpg) _Offtopic_ : Am I the only one that thinks this should be core behaviour? Where should I suggest this feature? Anyhow, I found this plugin, but I noticed it didn't always worked. Sometimes the notifier appears on Pages or other item. The code it uses to add the pending count goes something like this:               $menu[5][0] .= " " . number_format_i18n($pending_count) . '';      So, clearly the problem is the hard-coded 5 there, but how can I update it so it always points to Posts? I'll be glad to commit this change to the plugin if we know the answer. Thanks!


title: Is there plugin to show recent posts from one website in the widget area of another?

text: I would like to take the titles of recent posts or content related posts from one website and display them in the widget area of another website. I'm sure there must be a way to do this, perhaps some adaptation to the standard 'recent posts' widget? I did something similar before using an rss feed from one site and displaying their titles in a module on another. However this was in a non-wordpress site and I am not quite sure how to achieve the same result here. Ideally I would like to do it without using an rss feed and also be able to control specifically which posts are shown, perhaps being able to define them manually or by other criteria than just 'recent'.


title: How to add a post from a custom post type as the static page?

text: I have created a custom post type and added some custom metaboxes to the page edit screen. My objective was to provide specific metaboxes which a user can edit which in turn would allow a user to modify specific content areas of a websites homepage. Everything described above works perfectly except that I seem to be unable to set the page created from this custom post type as the "static page" within the wordpress admin "settings" area. It seems the dropdown which lets your select a static page only shows pages located within the default wordpress "page" post_type. How would I be able to change these settings to achieve my goal?


title: Synchronize WordPress user accounts across multiple domains and installations without using WordPress MU

text: As the title suggests, If you had to synchronize WordPress user accounts across multiple domains and installations without using WordPress MU how would you do it?


title: wp_insert_post not working for custom post type?

text: For whatever reason `wp_insert_post` doesn't work for a custom post type. Here's the code snippet I'm using.               $new_post = array(         'post_type' => 'rsp_synonym',         'post_title' => wp_strip_all_tags( $row['word'] ),         'post_date' => date('Y-m-d H:i:s'),         'post_author' => 2,         'post_content' => '',         'post_status' => 'publish',         'comment_status' => 'open',         'ping_status' => 'open'     );          $post_id = wp_insert_post( $new_post );          if (is_wp_error($post_id)) {         $errors = $post_id->get_error_messages();         foreach ($errors as $error) {             echo "- " . $error . "<br />";         }     }      Strange enough, it doesn't even return a WP_Error using the `if (is_wp_error($post_id))` conditional. But still, no posts are being added. The custom post type named as `rsp_synonym` has been registered before using this call.


title: How to add a "policy text" just before the comments?

text: Is there any plugin that can do that?


title: Can you have a single set of "canonical" categories shared by all blogs?

text: When a site gets to a certain scale, storing categories on a per-blog basis starts to get a little messy. Assuming someone would want all WPMU blogs to share a single set of categories, how might one go about that? My gut it so store a set of "cannonical" categories in the root blog. Is there a more elegant or standardized solution?


title: Sorting get_post_ancestors array

text:
I have written this code for my breadcrumbs (i'll give only the part that I have problem with):               } elseif (is_page()) {         if($post->post_parent){             $anc = get_post_ancestors( $post->ID );                  foreach ( $anc as $ancestor ) {                 $output = '
'.get_the_title($ancestor).'

';                 echo $output;             }      So for a page I'm getting the array of ancestors and it works fine if I have single ancestor. When I have two of them or more then (by default as the codex states): `The direct parent is returned as the first value in the array. The highest level ancestor is returned as the last value in the array.` And that echoes out `HOME > PARENT 2 > PARENT 1 > PAGE TITLE` How can I sort the $anc array so I could reverse it?


title: How do I paginate a custom post type listing on a custom template page?

text:
I've got a page template called tpl-memos.php which is attached to a page called 'Memos' with a parent page called 'About', the permalink for the page therefor is example.com/about/memos. On this page a custom post type called 'info' is listing its posts, and this custom post type has a rewrite of '/about/memos' – the same as the page structure. This is working pretty good: the posts from the CPT is listed and they get the correct URL, example.com/about/memos/%post_name% and of course it's a single- info.php file that is used to output the posts. My only problem is that I can't seem to get the pagination correct, when clicking 'Previous posts' all I get is a 404 error. Here's some code from tpl-memos.php, nothing special:               <?php     query_posts(array('post_type' => 'info', 'posts_per_page' => 10, 'paged' => $paged));          if (have_posts()):         while (have_posts()): the_post();             // Some content         endwhile; ?>
             <?php previous_posts_link(); ?>             <?php next_posts_link(); ?>
     <?php endif; ?>


title: Saving checkbox/option list status?

text: my self-made admin panel works just fine, but it doesn't save values of form inputs. When I type something into textbox and click "save" it is still there after refreshing, thanks to PHP:               <input type="text" name="header" value="<?php echo get_option('header'); ?>" />       So the PHP echoes its own value to a input and everything is just fine. But what to do when I have list of 10 radio buttons or just a checkbox? For now I have a checkbox like this:               <input type="checkbox" name="showS" value="true">      And after clicking on it and saving - it's still "unclicked". Any helping had?


title: Home page: using custom fields for posts and pages

text: in my home page I'd like to display some pages and posts title using the custom fields. Unfortunately my code prints only posts title. If there is a key "highlights" print the title. Here my code:               <?php while (have_posts()) : the_post(); ?>              <?php if ( get_post_meta($post->ID, 'highlights', true)) { ?>                  <?php the_title() . "<br>"; ?>              <?php } ?>          <?php endwhile; ?>      How can I print both? Posts and pages title? Thank you


title: How can I use a file in my plugin as a replacement for single.php on custom-post-type query?

text: I am creating a Custom Post Type using a custom plugin. One of the requirement of the custom post type is to be presented in a table layout for print / email purpose. It seems that the logical solution for this situation is to include a specific template file in the plugin which will be used on single Custom Post Type query instead of the single.php / index.php provided in the theme. How can I use a file in my plugin as a replacement for single.php / index.php on single custom-post-type query? Thank you in advance.


title: Get wp_logout_url function to work on external (non-Wordpress) page

text: I have blog and forum, and I need to put wordpress external logout link. What files do I need to add to make wp_logout_url(); work? Thank you.


title: WXR XML import is stripping php tags that I need to keep

text: When I import my `WXR XML` file it appears that wp_insert_post (or another function) is applying filters to strip php tags that I need to keep in my content. I have searched the various wp-include php files to locate: `wp_insert_post`, `sanitize_post`, `wp_strip_all_tags` But I have no clue as to what files to edit and what edits to make to keep from stripping the php tags. Advice and assistance greatly appreciated. Thanks in advance.


title: finding sidebar content in wordpress

text:
Hey all i have been trying to find the content that loads up for a page for a few days now and can not seem to find where its located. This is the WP code that seems to populate the content:               if ( function_exists('register_sidebar') ) {       register_sidebar(array(         'id' => 'home-top-sidebar',         'name' => 'Home Top Sidebar',         'before_widget' => '

',         'after_widget' => '

',         'before_title' => '
',         'after_title' => '
'     ));      However, like i stated above, i am unable to find where its pulling that data from?!!? The content doesn't seem to be located in any page on the site nor is it in the database? The content that i am interested in goes inbetween the **before_widget** and the **after_widget** The html code when rendered on the page that loads up looks like this (the part where i am trying to find the content from):

State-of-the-art technologies

in the most experienced hands.

      Could anyone point me to the area where this is being pulled from??


title: meta_query results not the same with and without spaces

text: I have a meta_query that gets all the items with a price range between 2 variables. My problem is that 10 000 is not the same as 10000. How can I fix this? I have been googling but I'n not sure what to google so I'm not really getting anywhere. Help would be appreciated Thanks Hanè Edit - Code Added                   $kw_min = mysql_real_escape_string($_GET['kw_min']);         $kw_max = mysql_real_escape_string($_GET['kw_max']);         $pr_min = mysql_real_escape_string($_GET['pr_min']);         $pr_max = mysql_real_escape_string($_GET['pr_max']);         if ( !empty( $kw_min ) && !empty( $kw_max ) && !empty( $pr_min ) && !empty( $pr_max ) ) {             $args = array(                 'post_type' => 'exc_agriq_equipment',                  'exc_equipment_cat' => $term->slug,                 'order' => 'DESC',                 'posts_per_page' => 12,                  'paged'=>$paged,                 'meta_query' => array(                     array(                         'key' => 'exc_agriq_equipment_kw',                         'value' => array( $kw_min, $kw_max ),                         'type' => 'numeric',                         'compare' => 'BETWEEN'                     ),                     array(                         'key' => 'exc_agriq_equipment_price',                         'value' => array( $pr_min, $pr_max ),                         'type' => 'numeric',                         'compare' => 'BETWEEN'                     ),                   ),              );         }


title: Making the wordpress login form a jQuery dropdown

text: I'm using a plugin called `sidebar-login` to display a wordpress login form (it uses `wp_login_form`) in my sidebar. However, I feel like it the actual form (textboxes and labels) take up too much space and I'd like to hide it all in a slide-down jQuery div. Basically, the user would click on a link called `"Login"`, which would make the login form fade in and slide down for the user to use. The problem is I need to add that link and wrap up the whole form in a div that I can apply a jQuery rule to. What is the recommended way of doing this so I don't break any existing login procedures?


title: Query all posts which do not have tags assigned to them

text: Is there a way to query posts which **do not** have tags assigned to them?               query_posts('tag='tag_exmaple'&posts_per_page=-1');            Ty very much!


title: posts_where Fails with More than One Custom Field in Query

text: Querying either of the 2 fields individually gives the expected result (posts are displayed). But, when both fields are included in the query (ex = 'foo' and 'bar' shown in below example), then no posts are displayed.               function do_stuff( ) {         global $wpdb;         return "         AND ($wpdb->postmeta.meta_key = 'foo'          AND $wpdb->postmeta.meta_value = '1')          AND ($wpdb->postmeta.meta_key = 'bar'          AND $wpdb->postmeta.meta_value = '1')";     }          add_filter( 'posts_where', 'do_stuff' );      Here is a print_r of the WP_Query:               [query] => Array         (             [post_type] => testPostType             [pagination] => 1             [posts_per_page] => 10             [paged] => 1         )          [request] => SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  LEFT JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id  WHERE 1=1      AND (wp_postmeta.meta_key = 'foo'     AND wp_postmeta.meta_value = '1')     AND (wp_postmeta.meta_key = 'bar'     AND wp_postmeta.meta_value = '1')  ORDER BY wp_posts.post_date DESC LIMIT 0, 10     [posts] => Array         (         )      ) Have I made a logic error in the sql? How can I get the posts to display as expected?


title: Post list display year wise

text: It's possible wordpress single category post display year wise   for example: **2014**   Post1   Post2   Post3   **2013**   Post4   post5   **2012**   Post6   Post7   Thanks


title: Using media files from RSS feed

text: I am using the stock "feed" widget to draw an RSS feed from the following adress : http://mouvementdemocrate.fr/rubrique/actualites/feed.xml As you will notice, the feed contains "Media files". These are images to illustrate each post. These do not display in the stock "feed" widget, or in any of the various plugins which I have tried. Is there an easy way to add this image to my widget ? Or, alternatively : Could I create / edit a php function to draw all the elements from the RSS feed and build my own reader to include the image ?


title: Turning on output buffering in a wordpress plugin

text: My wordpress plugin uses sessions for handling various things, and on the production site I'm testing it on output buffering is not on by default so I'm getting a lot of messages such as these:               Warning: session_start() [function.session-start]:      Cannot send session cookie -      headers already sent by      (output started at /blah/wp-content/themes/Starkers/header.php:12)      in /blah/wp-content/plugins/rsq/store.php on line 4      Is there a hook or something I can latch on to in order to turn on output buffering? Am I going about this in entirely the wrong way? Thanks, John.