title: How to set featured image to custom post from outside programmatically

text: I am trying to fetch and insert images outside the wordpress environment to a custom post via PHP. How to move/upload that image to wordpress upload directory year date folder format just like wordpress do and set that image to featured image against the custom post? Also to upload image to custom post gallery? Below is my code               $filename = $image['name'];     $target_path = "../wp-content/uploads/";     $target_path = $target_path . $filename;     $wp_filetype = wp_check_filetype(basename($filename), null );     $wp_upload_dir = wp_upload_dir();     $attachment = array(         'guid' => $wp_upload_dir['baseurl'] . '/' . basename( $filename ),         'post_mime_type' => $wp_filetype['type'],         'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),         'post_content' => '',     'post_status' => 'inherit'     );     $attach_id = wp_insert_attachment( $attachment, $target_path, $post_id );     $attach_data = wp_generate_attachment_metadata( $attach_id, $filename );     wp_update_attachment_metadata( $attach_id, $attach_data );     set_post_thumbnail( $post_id, $attach_id );      i have managed to upload the image to my uploads directory but cannot unable to create the year and date folder . this there any wp function for it ??


title: Why is home page content not displaying with this rewrite rule?

text: I am trying to pass a variable from a URL to PHP using mod_rewrite while maintaining standard WordPress functionality. Here's my mod_rewrite rules:               RewriteEngine On     RewriteBase /     RewriteRule ^(\w+)/$ /index.php?state=$1 [L]     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]      When I go to this URL: http://epiclasers.com/arizona/ It is obviously being handled by index.php (because the theme is being loaded) and the state variable is being passed to PHP. but I am having trouble getting the home page content to be displayed - instead it is showing 404 "page not found" content. Can someone shed some light as to why this is happening? **UPDATE:** When I redirect using the R flag, it works as it should:               RewriteRule ^(\w+)/$ /index.php?state=$1 [R,L]      and the home page is served: http://epiclasers.com/?state=arizona It seems that WP is grabbing the URL using $_SERVER['REQUEST_URI'] to process requests/queries - and WP is getting confused by the /arizona/ in the URL? Let's just assume that mod_rewrite is functioning correctly. Does anyone know how to customize WordPress to ignore "/arizona/" in the URL?


title: display last post modified date in genesis child themes

text: Since I frequently update posts so it’s crucial for me to display last modified date instead of post published date like following image. Its because I want search engine to display my post last modified date not post published date. Can anyone help me regarding this issue any help would be appreciated. ![enter image description here](http://i.stack.imgur.com/ZHvyw.png)


title: Using a pre_get_posts filter to search for multiple strings on all meta values

text: Using a pre_get_posts filter to search a given string on all meta_values:               $query->set('meta_value', 'first string');      debug:               AND ( (CAST(wp_postmeta.meta_value AS CHAR) = 'first string') )      Works Ok :) but how can I search on all meta_values for an array of strings? For example. I need something like:               $query->set('meta_value', array('first string', 'second string'));          AND ( (CAST(wp_postmeta.meta_value AS CHAR) = 'first string') OR (CAST(wp_postmeta.meta_value AS CHAR) = 'second string') )      It is possible using $query->set('meta_value'... or something else? Thanks in advance!


title: How do I profit from a Plugin?

text: While I remain committed to the open source foundation of WordPress, I do prefer to make a living plying my trade as a developer of quality software that fulfils a need of people willing to pay for it. I have developed a plugin for use by mainly business users of WordPress, i.e. cases of people using blogs to market their business, or trying to use WordPress as a CMS as well. I would like to 'sell' a 'pro' version this plugin, while still having a base version freely available. I would also like to avoid asking someone to pay for something they don't feel they have to, like charging a bloated distribution fee or something. I am considering that users of the pro version must be registered members, with a registration fee, and an online registration check when starting the plugin. What other options are available here? **EDIT:** Inspired by Zweiblumen's mention of SAAS, I have envisaged a model where the freely available, no registration, code is more of a skeleton which access the business logic and data through a web service. What do readers think of that?


title: get only 1 wpdb and get taxonomy, post to next page

text:
1st question.                $passport_num="M00093";       $querystr = "     SELECT $wpdb->posts.*      FROM $wpdb->posts, $wpdb->postmeta     WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id      AND $wpdb->postmeta.meta_key = '_Passport'      AND $wpdb->postmeta.meta_value = $passport_num     AND $wpdb->posts.post_status = 'publish'      AND $wpdb->posts.post_type = 'us_visa'     ORDER BY $wpdb->posts.post_date DESC       ";               AND $wpdb->postmeta.meta_value = $passport_num      This part is not working. how can I change it? 2nd question,               <div class="post" id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">       <?php the_title(); ?>
       <?php the_time('F jS, Y') ?>
          <?php the_content('Read the rest of this entry »'); ?>

Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>         <?php comments_popup_link('No Comments', '1 Comment ', '% Comments '); ?>

      NO RESULT I need to get a term from a taxonomy ("visa_processing") how can I get the term which is related with this post? 3rd question. I put like this and got result. but I need to send it to next page as "POST" (we don't want to show them on URL with the taxonomy (term). thanks for your time.


title: Allowing users to view private posts (pending approval)

text: OK so I mostly fixed this myself I went into post.php in wp-includes. Changed the `'protected' => true,` of pending to `'public' => true,` but every time wordpress updates this will reset (I think) so can anybody mention a permanent way to make this change? Previous part of the question is below Basically I want my registered users to be able to view private posts types on the front end just like an admin can when they click view post on a draft/pending approval post. I have this page HERE which loads the pending-approval posts. But when a user clicks one they can't read the post because they don't have the permissions. I've tried the User Role Editor plugin and gave subscribers the permission for `read_private_posts` and `read_private_pages` but that didn't work. (apparently to get it to work they would have also needed edit permissions and I'm not willing to give them permission to edit others posts.) Are there any solutions I could do in the function.php such as               $subRole = get_role( 'subscriber' );     $subRole->add_cap( 'read_private_pages' );     $subRole->add_cap( 'read_private_posts' );      (tried the above, it doesn't work, was just an example)


title: Meta value Array

text: I am hoping someone can help me out. I have created a custom meta box and trying to store an array, but when using `update_post_meta`, it doesn't seem to be storing it as an array. I am getting the info via an api and it seems to be breaking down when going from the textarea to the `update_post_meta`. I have tried `serialize`, `unserialize`, `maybe_serialize`, `maybe_unserialize` etc. Anyway here is my code.               $movieCast(array)            array (       0 =>        array (         'actor' => 'Anthony Hopkins',         'actor_char' => 'Alfred Hitchcock',         'actor_link' => 'anthony-hopkins',         'img_path' => '/oDMLEhFmXLkTlUnErs0RxRua7kN.jpg',       ),       1 =>        array (         'actor' => 'Helen Mirren',         'actor_char' => 'Alma Reville',         'actor_link' => 'helen-mirren',         'img_path' => '/dRYchPNm8WCXxWHcGtUwq9VLra1.jpg',       ),       2 =>        array (         'actor' => 'Scarlett Johansson',         'actor_char' => 'Janet Leigh',         'actor_link' => 'scarlett-johansson',         'img_path' => '/dZ4uNJtLQkGlJ76eePrXYqUDWgn.jpg',       ),...          echo "<textarea id='actors_array' name='actors_array' rows='5' cols='120'>" ?><?php var_export($movieCast); echo "</textarea>";      I have tested that the textarea is an array using `echo is_array($cast) ? 'Array' : 'not an Array';` and it's returning `Array`. So I figure the problem is further down at save function                   $actors_array = $_POST['actors_array'];     update_post_meta( $post_id, 'actors_array', $actors_array );      Once stored and I use `$cast = get_post_meta` it seems it has not been stored correctly. When testing `echo is_array($cast) ? 'Array' : 'not an Array';` it returns `not an array`.               echo"<pre>";print_r($cast);echo"</pre>";      returns                   array (       0 =>        array (         'actor' => 'Anthony Hopkins',         'actor_char' => 'Alfred Hitchcock',         'actor_link' => 'anthony-hopkins',         'img_path' => '/oDMLEhFmXLkTlUnErs0RxRua7kN.jpg',       ),       1 =>        array (         'actor' => 'Helen Mirren',         'actor_char' => 'Alma Reville',         'actor_link' => 'helen-mirren',         'img_path' => '/dRYchPNm8WCXxWHcGtUwq9VLra1.jpg',       ),       2 =>        array (         'actor' => 'Scarlett Johansson',         'actor_char' => 'Janet Leigh',         'actor_link' => 'scarlett-johansson',         'img_path' => '/dZ4uNJtLQkGlJ76eePrXYqUDWgn.jpg',       ),...      So I am really hoping someone can help me out please. Thanks :)


title: Adding an Archive button to posts page for administrators

text: I want to add an Archive button near the `Edit, Quick Edit, Trash and View` buttons in the posts page - http://i.imgur.com/HDZBPCy.png. I've found a nice function that can probably do just that, but I've got no idea how to use it - wp_set_post_categories. What I want is to have a static `Archive` category, that isn't present in any of the menus, but due to the nature of the site (lots of orders, results etc) we have to keep them and I just don't want them to be in the trash or unpublish them after their deadline expires. I've looked through the pages to see how `Delete` button works, but I've found 30+ references to it, and I can't fathom how exactly does that work. Any help would be greatly appreciated.


title: FB - Comment Moderation Tool bug?

text:
I am an admin of this site. This blog uses the FB comments plugin since around 1 year. Since I enabled the July Breaking Changes, I: -am not receiving any more new comments notifications on FB; -New comments are not appearing in the Comments Moderation Tool -However everything in the blog seems to be working fine, people are commenting, admins can reply, etc. This is the code in place:               <div class="fb-comments" data-href="<?php the_permalink() ?>" data-num-posts="6" data-width="580">
      And these are the og tags for the post pages:               <meta property="fb:admins" content="617488311,100000919127291"/>     <meta property="fb:app_id" content="184823298231084"/>     <meta property="og:type" content="article"/>     <meta property="og:url" content="<?php the_permalink() ?>"/>     <meta property="og:image" content="<?php echo wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ) ?>" />     <meta property="og:title" content="<?php single_post_title(''); ?>"/>     <meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />      I hope you can take a look and are able to figure out where the problem is. I'd really appreciate your hints. Do you see any error in the code I used? Thanks


title: Removing h3s in excerpt output?

text:
I have a custom post type and the content looks something like this:
Description
          The Production Assistant works closely with the production team to ensure that our games ship on time and at our very high standards. You will be a part of an international team and gain valuable insight into game development from a management perspective. Aside from production, you will also expand your knowledge of different disciplines such as, engineering, design, art, human resources, administration, and information technology.      The problem now is that the excerpt outputs something like this now:
Description The Production Assistant
      How can I tell WordPress to trim the h3s and the text inside them?


title: Customizing tinyMCE 4 Styles and Format dropdowns

text: As has been pointed out in multiple posts here there are some big problems with tinyMCE 4 formatting for WP 3.9 - this code comes very close: TinyMCE: adding CSS to format dropdown But there are problems - here are the ones that I have discovered:   * 'color' does not work (as I pointed out at the bottom of the question)   * 'block' =>'p' - does not work on its own, but it will if you add a class with 'classes'   * 'lineHeight' - does not work   * There seems to be no way to control the font size and type in the dropdowns Has anyone been able to come up with a solution to any of these?


title: Adding shortcode field to edit gallery / Gallery Settings

text: I want to add a field to the Add Media / Edit Gallery / Gallery Settings column which is able to accept shortcodes. I want to do this so that I can add a Cart66 shortcode which will "render" an add to cart button and price to individual thumbnails in the relevant gallery page. Any help much appreciated.


title: Determine if ID is page or post and query the ID

text: I want to look up a page id and determine if it's a page or post. Then query that id and display stuff like title, featured image, etc. This works for Pages:                   query_posts('page=' . $featured_tab);       This works or Posts:                   query_posts('p=' . $featured_tab);       This will tell me if $featured_tag is a post or page:                   get_post_type( $featured_tab )       But this does not work                   foreach ( $featarr as $featured_tab ) {             if (get_post_type( $featured_tab ) == 'page') {                 $featured_tab_type = 'page=';             } elseif (get_post_type( $featured_tab ) == 'post') {                 $featured_tab_type = 'p=';             }             query_posts($featured_tab_type . $featured_tab);                   while (have_posts()) : the_post();                         Echo 'stuff here';      The problem I am having is this...the $featured_tag variable represents an assigned page/post id that is displayed on a page. So I feed in a string of id's, i.e., 34,543,2432,355... etc then take each id as $featured_tab and query for title, featured page and excerpt. Then I display all the page/post id's in a three column table. This work perfect but only if I query for one or the other but not both as I do in the if statement if post use p= or if page use page=. When I use the if condition is get crazy results here if there are 9 ids, I get 50+ results...duplicates and only post no page are displayed.


title: options.php problem - data not saved

text: I've created a custom menu page with some fields. I want to store these settings to use elsewhere. The form with the fields should save and POST data using `action="options.php"` but every time I hit save on the form it sends me back to the settings page, and does not save the data. I'm registering the settings in my functions.php               function register_settings() {               register_setting('settings-group','phonenumber');             register_setting('settings-group','primaryemail');             register_setting('settings-group','secondemail');         }      This is the form action               <form method="post" action="options.php">      Here is the full code which is in functions.php http://pastebin.com/zVhSLZ9d


title: How can I make my .htaccess file writeable by wp-admin?

text: My ISP changed the hosting for my Wordpress blog and everything stopped working. There was a DNS issue but they resolved that, but then every page apart from the home page returned a 404 error. When I checked the permalinks page (`/wp-admin/options-permalinks.php`) in wp- admin I saw the following: > If your .htaccess file were writable, we could do this automatically, but it > isn’t so these are the mod_rewrite rules you should have in your .htaccess > file. Click in the field and press CTRL + a to select all. Adding what it listed (via my ISP's file manager) fixed the problem but got me wondering. What I'd like is for the `.htaccess` file be writeable for wp-admin. I know that the file should **not** be writable for everyone and I would keep the permissions as restrictive as possible to keep things secure, I'm just interested in making my life easier. However, I note the that the permissions on the file are:               rw-r--r--      So what permissions do I need to set to make the file writeable by wp-admin, but not by anyone and everyone? Or is it some other permissions on the server that need to be set? _I can manually make edits through the ISP's file manager interface so it's not as if I can't update the file at all. It's just that it could get to be a pain if I have to keep doing this._


title: How to make thumbnails of uploaded animated gifs NOT animated

text: I am having an issue where I want the thumbnails of my animated gifs to NOT be animated. I tried to talk to hostgator about helping with this issue and they simply said that I must find a solution through wordpress to make this happen. I run an adult site http://www.azngirls.com (please do not click if adult content is an issue for you) and as you can see, on the front page all the thumbnails of the animated gifs are all animated even after being resized into thumbnails and its creating a lot of lag for people that visit the site. This site shows an example of how an uploaded gif should be shown - http://ipinpro.ericulous.com/pin/category/architecture/ \- on the top right you can see a thumbnail of a GIF that is not animated, but when you click the image to view the original image, you can see that the animation appears. This is basically what I want happening for my site.


title: Checking if $_FILE isset for an array of file upload metaboxes

text:
I have been struggling with this for almost 2 days with no avail. I have a custom post type of `PRODUCTS` that has a group of metaboxes for uploading PDF files in the `wp-admin`. I've created the metaboxes in the admin. Here's the code for my metaboxes:               //PDF upload Meta Boxes     $meta_box_pdf_uploads = array(         'id' => 'products-pdf-meta-boxes',         'title' => "PDFs",         'page' => 'product', //attach to products custom post         'context' => 'normal',         'priority' => 'default',         'fields' => array(             array(                 'name' => $prefix . 'pdf1',                 'desc' => 'Product PDF',                 'id' => $prefix . 'pdf1',                 'type' => 'text'             ),             array(                 'name' => $prefix . 'pdf2',                 'desc' => 'Product PDF',                 'id' => $prefix . 'pdf2',                 'type' => 'text'             )         )     );      For now there are only two pdf's to upload. Here is the code to show my metaboxes in the admin menu:               function products_pdf_uploads_show_meta() {         global $meta_box_pdf_uploads, $post, $prefix;              echo '
';         echo '
Upload your PDFs here
';         foreach ($meta_box_pdf_uploads['fields'] as $field) {             // get current post meta data             $meta = get_post_meta($post->ID, $field['id'], true);                  echo '
',                     '',                              '<input type="file" style="width: 700px;" name="', $field['id'], '" id="', $field['id'], '" />',                     '	',                  '
';         }              echo '
';          }      All of this works until I try to check if the file upload field has a value or not. Here is what I'm working with now as far as the code to save the meta (there's tons of debugging code so you're aware):                //Upload PDF files         foreach ($meta_box_pdf_uploads['fields'] as $pdf_field) {                  //Make sure field isn't emtpy             if(isset($_FILES[$pdf_field['name']]) {                 //var_dump($_FILES);                 print_r ($_FILES[$pdf_field['name']]);  //debugging                 $pdf_type = $_FILES[$pdf_field['name']['tmp_name']];  //debugging, can't get this to return any value                 wp_die('Passed! '. $pdf_type); //debugging                 //Setup File type allowed                      //Get the file type                       } else {                 //var_dump($_FILES);                 print_r ($_FILES[$pdf_field['name']]);                 wp_die('Nothing was passed: ' . $pdf_field['name']);  //debugging             }         }      Now even if I don't add a file to the upload field, my first condition is still met here:               if(isset($_FILES[$pdf_field['name']]) {      I know it's because it's returning an array of the $pdf_field. I've also tried check if the error was 0 using `$_FILES[$pdf_field['name']['error']` but I can't return any of the $_FILE array values. When specify a field to upload and I do a `print_r ($_FILES[$pdf_field['name']])` it returns:               Array ( [name] => 1testpdf.pdf [type] => application/pdf [tmp_name] => /tmp/phpF7HQnJ [error] => 0 [size] => 8278 )       Which is correct, but it also does this when I dont' specify a field, only all the arrays values are empty except for the ERROR which equal 4 (no file specified). I have been pulling my hair out over this. What is the best way to do this? I think if it was a single metabox and i could call it like `$FILE['name_of_file']['error']` it would work. Why is using a `foreach` messing this up? Thank you!


title: I need a Simple image uploader with a simple screen. WP default has too many options.

text: Hi guys I'm looking for a metabox type plugin that can upload ONE image into the post, that works with custom post types. I don't want to use the default WP uploader because it has too many options, like file url, image url, etc. It is too confusing for customers who are not familiar with WP. So I need something simple. A simple metabox. All the plugins I was able to find use the default WP media uploader which as I said has too many options. Anyone know of a plugin I can use for that? Free or paid. The closest one I found was Magic Fields but it doesn't support custom post types AND it uses a custom folder to store files. Thanks.


title: Why does WordPress require a ftp server to be running on the webserver to transfer plugins?

text: I had asked a related question on Super User: > A use case of a system "receiving" files over FTP would be, for example, the > way WordPress plugins are installed via 1-click where WordPress initiates a > file transfer to the local Linux box from the remote WordPress plugin > repository using ftp(s) More specifically this screen: ![WP asking for ftp info during plugin install](http://i.stack.imgur.com/nsEup.png) My initial understanding that WordPress would transfer the files from the WordPress plugin repository, like how a FTP client would do. But further discussions on chat have left me confused as to why would WordPress require the FTP details of the web server? What am I missing here?


title: apply_filters('the_content') - make it ignore shortcodes?

text: I am using `apply_filters('the_content)` so I can see properly formatted content inside my wp editor in the backend. However, this also renders the shortcode that's in the content. I want it to ignore the shortcode and apply filtering to the rest of the content, basically the same thing as when making posts. If you view post content in the backend, you will see the shortcode, but if you view it inside a page on your website, you will see the rendered shortcode (its result). Is this possible?


title: CSV file generation failing

text:
I'm using a plugin for a client (that i modified to some degree) that creates and maintains a database of organization members (using a new wp table to do so). There is a nice feature that does a csv import and insert, that works great. There is also a feature to download the contents of this table as a csv, that works fine on my local system, but fails when running from the server. I'm, frankly, at a loss as to why. The php file that contains the logic is simply linked to. The file:               <?php         //include some files         include('../../../wp-blog-header.php');              //DIAG: phpinfo();                 function fputcsv4($fh, $arr) {             $csv = "";             while (list($key, $val) = each($arr)) {                 $val = str_replace('"', '""', $val);                 $csv .= '"'.$val.'",';             }             $csv = substr($csv, 0, -1);             $csv .= "\n";             if (!@fwrite($fh, $csv))                  return FALSE;         }              //get member info and column data         $table_name = $wpdb->prefix . "member_db";         $year = date ('Y');         $members = $wpdb->get_results("SELECT * FROM ".$table_name, ARRAY_A);         $columns = $wpdb->get_results("SHOW COLUMNS FROM ".$table_name, ARRAY_A);         //DIAG: echo 'SQL: '.$sql.', RESULT: '.$result.'
';              //output headers         header("Content-type: application/octet-stream");         header("Content-Disposition: attachment; filename=\"members.csv\"");              //open output stream         $output = fopen("php://output",'w');               //output column headings         $data[0] = "ID";         $i = 1;         foreach ($columns as $column){             //DIAG: echo '
'; print_r($column); echo '
';             $field_name = '';             $words = explode("_", $column['Field']);             foreach ($words as $word) $field_name .= $word.' ';             if ( $column['Field'] != 'id' && $column['Field'] != 'date_updated' ) {                 $data[$i] = ucwords($field_name);                 $i++;             }         }         $data[$i] = "Date Updated";         fputcsv4($output, $data);              //output data         foreach ($members as $member){             //DIAG: echo '
'; print_r($member); echo '
';             $data[0] = $member['id'];             $i = 1;             foreach ($columns as $column){                 //DIAG: echo '
'; print_r($column); echo '
';                 if ( $column['Field'] != 'id' && $column['Field'] != 'date_updated' ) {                     $data[$i] = $member[$column['Field']];                     $i++;                 }             }             $data[$i] = $member['date_updated'];             //echo '
'; print_r($data); echo '
';             fputcsv4($output, $data);          }         fclose($output);     ?>      So, we have a routine wherein a query is run, `$output` is established with `fopen`, added to via foreach statements, and finally `fclose`d. The error that I'm getting (from the server) is               Error 6 (net::ERR_FILE_NOT_FOUND): The file or directory could not be found.      But it clearly is getting found, its just failing. If I enable `phpinfo()` (PHP Version 5.2.17) at the top of the file, I definitely get a response - notably `Cannot modify header information` (because `phpinfo()` has already generated a header). All the expected data does get printed to the page, however, so that much, at least is working correctly. I am guessing there is something preventing the fopen, fclose functions from working properly, but I don't have enough experience with this to identify exactly what the problem is. I'll note again that this works exactly as expected in my test environment (localhost/XAMPP, netbeans). Any thoughts would be most appreciated.


title: Print Post Parent Title

text:
I'm trying to print the posts' parent title on the page as well as the post title for that page. This is how my content-page.php template currently renders the page title.               the_title( '
', '
' );      I realise I can retrieve the posts' parent title by doing this:               $parent_title = get_the_title($post->post_parent);     echo $parent_title;      Is there anyway I can slip that code in between the_title parameters, so my parent title and my post title are both wrapped by that `h1` element? Any help is appreciated. Thanks in advance!


title: How do I move a subdirectory blog site from one wordpress multisite to another wordpress multisite

text: I have one WordPress multisite instance setup with subdirectories. I have a production environment of a WordPress Multisite setup exactly the same. I need to export only one site from the test instance (Blog Posts, Users, and uploads) and then import into the production instance. I cannot overwrite the main site in the production environment. I just need to copy over the subdirectory site. How would I do this? Would I use the WordPress Importer plugin? How do I export only blog post data from the one test blog site's database and then import that data into the production database? Regards David


title: How can I show wordpress posts based on author?

text: I'm working on a site that will have 6 authors. Each author will have their own page that will only show their posts. what is the best way to handle this? I would like to do by creating a page or using the url such as /?a=username. However, if there is a more standard or a better way feel free to suggest that instead. Thanks!


title: how to add new .webm mime types

text: i tried google but no success yet. I am trying to upload .webm and .ogg video types in wordpress ( for html5 video ofcourse) I am getting error like               Baki fula.webm” has failed to upload due to an error     Sorry, this file type is not permitted for security reasons.      tried plugins like   1. PJW Mime Config   2. AP Extended Mime Types but doesnot seem to work either. I am working locally with easyphp in windows 7 in wordpress 3.4.1. Can anyone plase help me in solving this issue. Any help is appreciated


title: Is it possible to disable certain user roles from creating tags?

text: As a site admin, I'd like to have control over things. I'd like to prevent my contributors and authors ( who generate content for me ) from creating new tags. I don't want that tag taxonomy to turn into a zoo! Especially when you know that wordpress creates separate terms for apple and Apple! I give them a while list ( of 1000 tags that I want them to cover ) and that's it. They cannot come up with the 1001st. How do I achieve that so that my authors just pick from what I give them?


title: Pagination for query_posts();

text: I know there have been many question like this and I've read them, but I still cant get it working... I have this query:               query_posts(array('cat'=>3,'posts_per_page'=>5));      And I simply display the content below in `while (have_posts()) : the_post();` loop How can I add pagination to this? I'm trying with adding `posts_nav_link();` ( I don't know is it the right function to call what I want) and links displayed take me to http://mysite.com/page/2. Since its my index page its ok to not add category name in link (its news page) but after clicking on the link, when I'm on the page/2/ news simply doesn't change. I still see the first page of my news without change... I think I need to add attribute of 'paged' to my query, but how and where? I've tried `'paged'=>'paged'` in array but still nothing


title: Where is the query in wp-login.php

text: I am making a login form in WordPress and i want to have a validation on it, so i tried to look at the wp-login.php to see how they validate things. But i did not find what i am looking for. I would like to know how they validate things or what input do they need to validate things. I tried to search the WordPress forums all i can find is plugin, plugin and more plugin. I don't want a plugin. I want to hard code it. So please help me. I want to know where you can find the part that searches for the user's username and password. Or if not, know what is needed for a successful login. example username or password or others. by the way here is the wp-login.php. Thanks


title: Help me out with this Undefined index ?

text:
I'm working on flickr Wp-widget. Here is code to fetch flickr pics.               class imperia_flickr extends WP_Widget {              function imperia_flickr() {             $widget_ops = array('description' => 'This Flickr widget populates photos from a Flickr ID.' );                  parent::WP_Widget(false, __('imperia - Flickr', 'imperiathemes'),$widget_ops);               }              function widget($args, $instance) {               extract( $args );             $id = $instance['id'];             $number = $instance['number'];                  echo $before_widget;             echo $before_title; ?>

             <?php _e('Photostream'); ?>                 <?php echo $after_title; ?>

            <?php                        echo $after_widget;        }             function update($new_instance, $old_instance) {                            return $new_instance;        }             function form($instance) {                 ******  $id = esc_attr($instance['id']);         ******  $number = esc_attr($instance['number']);             ?>
                 <label for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Flickr ID (idGettr):','imperiathemes'); ?>                 <input type="text" name="<?php echo $this->get_field_name('id'); ?>" value="<?php echo $id; ?>" class="widefat" id="<?php echo $this->get_field_id('id'); ?>" />

                 <label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number:','imperiathemes'); ?>                 <select name="<?php echo $this->get_field_name('number'); ?>" class="widefat" id="<?php echo $this->get_field_id('number'); ?>">                     <?php for ( $i = 1; $i <= 12; $i += 1) { ?>                     <option value="<?php echo $i; ?>" <?php if($number == $i){ echo "selected='selected'";} ?>><?php echo $i; ?></option>                     <?php } ?>                 </select>
             <?php         }     }           register_widget('imperia_flickr');      This widget works fine but gives following error               -- Debug: Undefined index: id on line 54 of /wp-content/themes/imperia/includes/widgets/widget-imperia-flickr.php     -- Debug: Undefined index: number on line 55 of /wp-content/themes/imperia/includes/widgets/widget-imperia-flickr.php      I have marked these lines with ****** above. Where I'm going wrong ? What needs to be fixed ? Thanks


title: Can I query another data table on a multisite with the single.php template?

text: **Here's a quote froma thread on this forum showing exactly what I'm trying to do:** blog 1 gets = wp_post table blog 2 gets = wp_2_post table > Small multisite setup, two very different sites, both need to access an > event custom post type. I don't want to duplicate posts (there are some > plugins that "broadcast" a post to the network). > > switch_to_blog(1) will get me part way there, where blog 1 is the "master" > blog that contains the event data, as far as archive-style pages that list > all the events. But my concern is that the URL/permalink of the event, when > viewed from blog 2 will point to blog 1, and following that permalink will > then take the user to the other blog, confusing the user. > > Is there a solution (possibly using rewrite) that would allow an event post > at //blog1/events/event1 to appear as //blog2/events/event1 when viewed from > blog 2?" **Here's the answer I'm trying to work with:** > Register the CPT on blog 2 with 'show_ui' => FALSE. Hook on blog 1 into > save_post and copy the data to blog 2. > > Pro: You can search in those posts. Correct templates will be used > automatically. Con: Duplicated data are always a little bit … dirty. **So far: I created a custom query using the $wpdb class that queries posts from blog 1 onto blog 2.** The problem I'm having is when I click on the post I get a 404 for every post except the default post which is on both blog 1 and 2. I think because wordpress looks for the data of that post in the wp_2_post table instead of the wp_post in the query in the single.php in blog 2's template. Would it be possible to change the single.php query in the blog 2 theme to point to the wp_post table of blog 1 and trick wordpress into giving me the post from blog 1? ***note** I don't want to duplicate data for multiple reasons this is why I ask instead of using save_post. Thank you for any answer I receive, Corbs


title: Add email to wp_users but leave open for registration

text: Is there a way to enter an email into the wp_users datbase programatically but leave that user profile open for overwriting in case the user goes through a manually registration process?


title: Using custom page templates with plugin

text: I'm developing a plugin. This plugin creating a new post type and displaying these posts in a custom template. For example it's a event calendar plugin. This plugin creating a new post type 'event '. Users adding new events from wp - admin, like normal blog posts. And users creating a new page with 'Event Calendar ' page template. But for enabling Event Calendar page template, users have to copy eventcalendar.php from plugin's dir to their template's dir. Last step (copying file) is really hard for some users. Is it possible to call custom page template from plugin dir?


title: Using the same shortcode to show any table from the database

text:
I have a little question for you. I want to create a shortcode that makes a table with data that I have stored in a database. But i want to send the shortcode an attribute, to specify which table (database) I'd like to show.               add_shortcode("list", "list");          function list($tbl) {         extract(shortcode_atts(array('item' => '')), $tbl);         if($item!="") {             $mydb= new wpdb('root','root','mydb','localhost');             $rows = $mydb->get_results("select * from ".$item);             echo "
";             foreach ($rows as $obj) {                 echo "
";                 //Here I want to put the content of the row                 echo "
";             }             echo "
";         } else {             echo "
Table does not exist
";         }     }      The shortcode would be something like this:               [list item="table1"]      How can I use the same shortcode to show any table of a database? How can I manage each row to show all the fields it has got? Because i have different tables with different number of columns and different column names, and i want to display each cell in a in the table. Thanks!


title: my basic php code producing unexpected results

text:
I am writing a code snippet to display attachments to a post but for each user, he should only be able to see his own attachments and not those of other users                   $current_user=wp_get_current_user();              //display all post attachments. see http://codex.wordpress.org/Template_Tags/get_posts#Show_attachments_for_the_current_post         $args = array(         'post_type' => 'attachment',         'numberposts' => null,         'post_status' => null,         'post_parent' => $post->ID         );     echo "Uploads By me";      echo "
";         $attachments = get_posts($args);         if ($attachments) {                  foreach ($attachments as $attachment) {                 echo "
";                 the_attachment_link($attachment->ID, false);                 echo " by author ".$attachment->post_author ;//debug info                 echo " and Current user is ".$current_user->ID ;//debug info                 if($current_user->ID==$attachment->ID) echo " Matched!! ";//debug info                 echo "
";             }         }     echo "
";     //end attacmnets      I placed the code in my custom page template and as you can see in picture below, the statement `if($current_user->ID==$attachment->ID) echo " Matched!! ";` failed and this is what i wanted to depend on to selectively show attachments.Please help out![enter image description here](http://i.stack.imgur.com/ygDXa.jpg)


title: Cannot Modify Header Info Error on updating User Profile

text: I keep on getting this error on updating a user:               PHP Warning: Cannot modify header information - headers already sent by (output started at /wp-admin/includes/update.php:134) in /wp-includes/pluggable.php on line 866, referer: /wp-admin/user-edit.php?user_id=4&wp_http_referer=%2Fwp-admin%2Fusers.php      Any ideas why? My header.php does not seem to start with an empty space, but just with `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">` And, besides, this seems to be more backend related... **Solution** Somehow `pluggable.php` or `update.php` or one of the user edit files got corrupted. After the upgrade to 3.3.2 all good again. All users can be updated again within getting stuck in error reports.


title: Redirect all multisite uploads to single folder

text: I have a network of multisite blogs which much operate separately for reporting and small functional reasons, but which share a lot of the same data and imagery. I am looking for a way to redirect all requests for files to a single folder in my domain: instead of creating multiple uploads and thumbnails for each site, with a of redundant images and potential URL images when syncing content between sites. I was thinking of using something like this, but it is not working for me. `RedirectMatch 301 /wp-content/uploads/(sites/[0-9]+/)(.*)$ /wp- content/uploads/$2` My other option is this: Shared upload folder in wordpress multisite However I have concerns about making the change to a live environment. Has anyone else successfuly transitioned to a combined uploads folder in a live environment?


I've just received this error/warning after trying to upload an image, any ideas what it means and what I can do to fix it? Warning: Cannot modify header information - headers already sent by (output started at /home/achenn/public_html/wp- content/themes/whskytngfxtrt/functions.php:14) in /home/achenn/public_html/wp- includes/pluggable.php on line 866 Here's my site, live. functions.php:               <?php          // sidebar functions          if(function_exists('register_sidebar'))     {         register_sidebar();     }               ?>               <?php          // portfolio functions              add_action('init', 'create_portfolio');         function create_portfolio() {             $portfolio_args = array(                 'label' => __('Portfolio'),                 'singular_label' => __('Portfolio'),                 'public' => true,                 'show_ui' => true,                 'capability_type' => 'post',                 'hierarchical' => false,                 'rewrite' => true,                 'supports' => array('title', 'editor', 'thumbnail')             );             register_post_type('portfolio',$portfolio_args);         }     ?>          <?php          // custom input- portfolio backend              add_action("admin_init", "add_portfolio");         add_action('save_post', 'update_website_url');         function add_portfolio(){             add_meta_box("portfolio_details", "Portfolio Options", "portfolio_options", "portfolio", "normal", "low");         }         function portfolio_options(){             global $post;             $custom = get_post_custom($post->ID);             $website_url = $custom["website_url"][0];     ?>
             Website URL:<input name="website_url" value="<?php echo $website_url; ?>" />
        <?php         }         function update_website_url(){             global $post;             update_post_meta($post->ID, "website_url", $_POST["website_url"]);         }     ?>          <?php           // detail columns- portfolio backend          add_filter("manage_edit-portfolio_columns", "portfolio_edit_columns");     add_action("manage_posts_custom_column",  "portfolio_columns_display");          function portfolio_edit_columns($portfolio_columns){         $portfolio_columns = array(             "cb" => "<input type=\"checkbox\" />",             "title" => "Project Title",             "description" => "Description",         );         return $portfolio_columns;     }          function portfolio_columns_display($portfolio_columns){         switch ($portfolio_columns)         {             case "description":                 the_excerpt();                 break;                       }     }     ?>      portfolio.php-               <?php     /*     Template Name: Portfolio     */     ?>     <?php get_header(); ?>
         <?php              $loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => 10));          ?>         <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>         <?php                $custom = get_post_custom($post->ID);             $screenshot_url = $custom["screenshot_url"][0];             $website_url = $custom["website_url"][0];         ?>

<?php the_title(); ?>
             <a href="<?=$website_url?>"><?php the_post_thumbnail(); ?>              <?php the_content(); ?>
             <?php endwhile; ?>
     <?php get_footer(); ?>


title: Display info from custom fields in all images' HTML

text: Okay, I've been working on this all day and can't find the solution anywhere. I've created a custom field within the image upload screen (info first found here). The field stores the name of a photographer to give him/her credit. Everything's fine there. What I can't figure out is how to get this information into every image's title data across the site. I want my field for Image Credit to append itself to all image titles across the site, so each image title would read something like "My Title (by Photographer Name)". What I have figured out is close, but not quite good enough. I can get the information from my custom field by using "get_children()" of type "image" on the existing post, and then calling "get_post_meta()" for my custom field name on each result. I can then use this information to add it to the post featured images by altering the title properties within "get_the_post_thumbnail()" when I call it. What I need is to be able to do something like this site-wide on all images, not just the featured ones. I feel like there should be somewhere in the Core that defines how images are displayed. Perhaps I could overwrite this with a same-name file in my own theme, or by declaring a function to override the default behavior. Maybe there's a filter or a hook I could use. However, I can't find any documentation to help me, and I'm about out of ideas. Any and all thoughts would be much appreciated, even if they're just partial ideas. _Note: I tried to link all my functions for easy reference, but spam- prevention wouldn't let me post that many links so I'll list them here instead:_   * codex.wordpress.org/Function_Reference/get_children   * codex.wordpress.org/Function_Reference/get_post_meta   * codex.wordpress.org/Function_Reference/get_the_post_thumbnail


title: Different permalink for CPT and regular Posts/Pages but why?

text: _Permalink structure in Back- end:`http://domain.com/%year%/%category%/%postname%`_ For "regular" Posts/Pages all is okay but as soon a CPT is shown `%year%` is gone?   Url shown for Posts/Pages looks some like: `http://domain.com/2014/category01/regular-post001`   Url shown for CPT looks some like: `http://domain.com/category01/cpt-post002` Most weird (to me) is, when I give in (for that CPT) `http://domain.com/2014/category01/cpt-post002` it shows the CPT BUT then leaves out/redirects to the url without 2014(year). What am I missing/doing wrong?


title: Adding CSS to admin TinyMCE editor for custom button

text: I have created a plugin that adds a new button to the TinyMCE editor in the admin edit pages/posts area. I am trying to apply a font icon to it as per the the other buttons in Wordpress 3.8. I have created a CSS file will the following:               .mce_mybutton::before {         content: '\f459';     }      All I need to do is load the CSS when the editor is loaded... Seemed easy. I tried `add_editor_style()` but apparently it is only for theme development not plugins I found the `mce_css` filter but it didn't work. I think it is for only applying CSS to the content in the editor... Not the buttons. I read the source code for the `edit-from-advanced.php` and `class-wp- editor.php` the files responsible for generating the editor on the admin edit pages/posts. There is a setting within the `_WP_Editors` object that looked promising:               'editor_css' => '', // intended for extra styles for both visual and Text editors buttons, needs to include the <style> tags, can use "scoped".      However I couldn't find a way to hook into it. Any help would be appreciated. Thanks!


title: Is there a plugin for uploading files such as PDF files?

text: I want to put my lecturers for my students as PDF files in my wordpress, is it possible?


title: Will a post object's "post_name" always be equal to the "path" on non-hierarchal custom post types? (using get_page_by_path() function)

text: **The Short:** When feeding the _path_ into get_page_by_path() something like this:               $post_object = get_page_by_path( 'path_of_post', OBJECT, 'my_custom_post_type' )      ... Assuming the custom post type is non-hierarchal, is there any scenario where the _path_ entered into the function would not match a post object's slug? (What I mean by slug is $post_object->post_name) ============================= **The Long:** I'm using custom post types in the background for a couple of plugins I'm creating. The end-user has no access to the actual edit post screens for these custom post types. All of the admin pages the end-user actually sees are custom built. For an example of two things I have going on: I have a plugin that creates slideshows, where each slideshow is a custom post type "slider". I have a layout builder plugin where each custom layout is a custom post type "layout". In this example, the two meet when within a layout, the user could assign a slideshow to the layout. Currently I have this setup where in the post meta for a _layout_ the user can save the post ID of a _slider_. **The problem with using post ID's:** What I would like to do in the end is provide users sample XML files from WordPress's Export tool. So, they could then just import these posts of different post types along with all post meta info, and everything will all running together without me having to build any kind of mod to WordPress's Import/Export tool to accomodate this. But since when you import posts from an Export file, WordPress's built-in tool obviously has to assign new ID's to all of the posts, so if (for example) a _layout_ had a _slider_ assigned to it by the post ID, when the two posts were imported, the ID of the _slider_ would no longer match to what the _layout_ has. **My new plan:** So, I'm trying to figure out a different way to assign everything to each other, so everything will be compatible with WordPress's import/export and I can efficiently grab assigned posts. The best idea I've had is to assign (for example) a _slider_ to a _layout_ by referencing the slider post's slug `$post_object->post_name`. This way, on the front-end of the site, I can use WordPress `get_page_by_path();` function to grab the post's object. So the reason for my question (see top) is just to make sure there isn't something I'm overlooking with using this function and referencing all of these things by their slugs? Also, maybe there's a better way to reference all of my custom post type posts other than this method I've come up with?


title: Unsual behaviour of navigation Menus

text: I deleted all the previous menus which where there in my site. Then I created a new menu called Home and added few pages to it So my menu looks like this![enter image description here](http://i.stack.imgur.com/q4TvW.png) **Problem :** When I click on About us and other links, then that links are not working. Why is this so?? Is it because I deleted all my previous menu? If so then how I can get my deleted menus? Update: Error in firebug![enter image description here](http://i.stack.imgur.com/GYaOX.png)


title: Modify excerpt link

text:
I read the thread about adding a filter on the last line of the code, but am not sure that will work here. http://www.ahy4life.com/resources.php In the middle right column in the Promotions section, the 'Continue reading ->' link is linked to the wrong page. How can I correct this?
       <?php       $featuredPosts = new WP_Query();       $featuredPosts->query('showposts=5&cat=8');       while ($featuredPosts->have_posts()) : $featuredPosts->the_post(); ?>
<?php the_title(); ?>

                           <?php the_excerpt(); ?>                <?php endwhile; ?>

       TIA


title: How to define the template priority between built-in categories and custom taxonomies?

text: Let's say I want to create a custom template for my taxonomy `customtax`. This is pretty simple, I just create a `taxonomy-customtax.php` in my theme directory. Now, I'ld like to query a built-in category with one term of my custom taxonomy, like so:               www.example.com/?customtax=x&category_name=y      The problem here is that Wordpress always uses the `archive.php` (or `category.php` I think) instead of my `taxonomy-customtax.php` template. Is there a way to invert this behaviour?


title: why php notice is not getting ignored?

text: I have been adding at the top of my wp-config.php the following to switch off php logger but won't take any effect on it. Is there something else what I should do?               error_reporting(0);     @ini_set(‘display_errors’, 0);


title: Clean/filter HTML inserted to post content by XML RPC

text: An external service that uses XML RPC to publish some posts on my site adds some unwanted CSS styles and HTML to the post content. I would like to clean it up using a HTML cleaner that I've built based on DOMDocument and DOMXPath. My only question is how can I access the post_content before it is actually saved to the databse so I can run my cleaner on it? Perhaps there is a filter/action that I can use?


title: How to read individual user's directory and display content to that specific user?

text: I am creating a photo plugin for users to view their photos. The plugin works in a way that when I add a new user, a directory is created in the uploads folder inside `wp-content` with the user's username as the name of the folder. This is where that user's images will be stored. Here is the code:               function create_photo_folder() {              $upload = wp_upload_dir();         $upload_dir = $upload['basedir'];         $upload_dir = $upload_dir . '/USER_PHOTOS';         if (! is_dir($upload_dir)) {            mkdir( $upload_dir, 0700 );         }          $blogusers = get_users('blog_id=1&orderby=nicename');         foreach ($blogusers as $user) {             wp_mkdir_p($upload_dir . '/USER_PHOTOS'.$user->user_login);              }     }          register_activation_hook( __FILE__, 'create_photo_folder' );     add_action('user_register','create_photo_folder');      The above code works fine in creating the folders. The problem I am facing is that I want to be able to fetch the contents in the folder of each user and display it to them when they log in. I have already created a menu page called YOUR PHOTOS for all users. Now I would like to be able to retrieve the content in each folder for each user and display it to them there.


title: wp_list_pages: only show subpages on the parent page?

text: I'm using `wp_list_pages('title_li=')` on my site. Some of my pages do have subpages, however I don't want to list them unitl I'm on an actual parent page that has subpages. So imagine my front-page:               — About Us     — Gallery     — Kitchen     — Disclaimer      When clicking on Gallery (and Gallery has two subpages) I want them to be listed as well.               — About Us     — Gallery       — Subpage 1       — Subpage 2     — Kitchen     — Disclaimer      How am I going to do this with the `wp_list_pages()` function?


title: Odd /wp-admin/admin-ajax.php entries showing in Wassup

text: I have an odd issue going on that I'm not sure how to troubleshoot. Ever since I installed a popular post plugin (Wordpress Popular Posts) I have been seeing a strange entry in Wassup real time analytics to a page called /wp-admin/admin-ajax.php over and over again. Before I installed the plugin it would show the page that was being hit but it looks like for whatever reason this page is getting hit instead and I am unable to see what page the user is actually hitting. Here is an example of what I'm talking about: ![enter image description here](http://i.stack.imgur.com/4b4dG.jpg) EDIT: **How do I get the correct page/post to be displayed instead of this?** I have looked throught the settings in Wassup and as far as I can tell there is no way to correct this through the plugin. Is there a better plugin to use for tracking top posts that will alleviate this issue? I have tried a few other plugins but have had no luck correcting the problem. I just want something that I know will work. Thanks,


title: quotes problem in very simple sql

text: I just simply want to execute a SQL sentence inside of a post (i am using EXEC-PHP widget for that). The problem are the quotes when i want to do something like $my_name='hello' "select * from Table where name='$my_name'"; getting wrong quotes.... select * from Table where name=‘hello‘ i have tried streepslashes_deep, addslashes, stripslashes... I think it shouldnt be so difficult... maybe its not my best day any help? thanks!


title: Using WP_Query with multiple loops on one page in search.php

text:
I'm trying to set up a search page that first shows a Loop with all posts with a Custom Field meta_key of 'seek_premium' where it's meta_value is 'yes', and then a second Loop where the meta_value (same meta_key) is empty. I've got it working for the most part, but the way I'm doing it seems to break the default search functionality, in that if I do a search, no matter if a post contains the search query or not, I end up seeing all posts marked as "seek_premium" in the first loop, and all posts where "seek_premium" is empty in the second. Here's my code:               <?php if ( have_posts() ) : ?>
My Heading
         <?php             $premium_query = new WP_Query( array( 'meta_key' => 'seek_premium', 'meta_value' => 'yes' ) );             while ( $premium_query->have_posts() ) : $premium_query->the_post();                  $seekpremium = get_post_meta( $post->ID, 'seek_premium', true );         ?>                 SHOW PREMIUM POSTS                                                                                <?php endwhile; ?>          <?php             $free_query = new WP_Query( 'post_per_page=50' );             while ( $free_query->have_posts() ) : $free_query->the_post();                 $seekpremium = get_post_meta( $post->ID, 'seek_premium', true );                 if ( !empty( $seekpremium ) )                     continue;         ?>                 SHOW FREE POSTS                                                                  <?php endwhile; ?>      <?php else : ?>         <?php include ( TEMPLATEPATH . "/unknown.php" ); ?>     <?php endif; ?>      Anyone have any ideas? I'd seen something about using $is_search as a parameter, but either am not implementing it correctly or something else with my query is wrong...


Is it possible to put a function somewhere other than the functions.php file? I.e directly into a template? I have the following that needs to be called before some code and to make sure this happens I want to place it above everything else in the template:               function set_region_cookie()     {         if(isset($_POST['region']))         {             // Set Cookie             setcookie('region', $_POST['region'], time()+1209600);             // Reload the current page so that the cookie is sent with the request             header('Region: '.$_SERVER['REQUEST_URI']);         }     }     add_action('init', 'set_region_cookie');


title: Why is unfiltered html allowed in custom fields for author / contributor roles?

text: I'm creating a WordPress theme which has a custom textarea metabox for inserting embed codes (soundcloud, bandcamp etc). I feel like I should be adding in some security to stop non-admin/editor users to be able to save potenitally harmful data, but it seem WordPress as standard allows html in custom fields for these lower-capability users. Is there a reason why html is allowed in standard custom fields, yet not in the main edit area, for users without unfiltered_html capability?


title: Correct syntax for database inserts from plugin?

text: I'm testing a script to create a database insert. Is this the correct syntax for the insert or do I need to obtain a reference to global $wpdb and use that?               <?php     /*     Plugin Name: Test Database Insert     */          function test_db_insert()     {     INSERT wp_terms(term_id, 'name', slug) VALUES (1, 'test', 'test');     INSERT wp_term_taxonomy(term_taxonomy_id, term_id, taxonomy, parent) VALUES (1, 1, 'category', 0);     INSERT wp_term_relationships(object_id, term_taxonomy_id, term_order) VALUES (1, 1, 0);     }          register_activation_hook(__FILE__, 'test_db_insert');


title: walker_category doesn't walk?

text:
I'm trying to use the walker_category class in order to modify the HTML output of the `wp_list_categories` for several custom taxonomies, but the walker doesn't seem to 'work the tree'. Here is my current code:               class Custom_Taxonomy_Walker extends Walker_Category {          function start_lvl( &$output, $depth = 0, $args = array() ) {         $class = '"level-' . $depth . '"';         $output .= sprintf( "\n
", $class );     }     function end_lvl( &$output, $depth = 0, $args = array() ) {         $output .= "
\n";     }     function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {         if ($depth <= 1) {             $class = "parent";         }         else {             $class = "enfant";         }         $output .= sprintf( '
', $class );     }     function end_el( &$output, $depth = 0, $args = array() ) {         $output .= "
\n";     }      } and the call to `wp_list_categories`:                           foreach ($post_types as $post_type=>$post_tax) {                     $args = array(                         'show_count'    => 1,                         'hierarchical'  => 1,                         'pad_counts'    => 1,                         'taxonomy'      => $post_tax,                         'walker'        => new Custom_Taxonomy_Walker);                     wp_list_categories ($args);                 }      Could someone provide a hint in the right direction? Thanks a lot for helping.


title: How to relate to 2 taxonomy with category

text: I really need your help my question is this, is it possible to relate to taxonomies? This is My Problem sample: My post type is "show" taxonomies and the categories location (Taxonomy)   Categories   * california    * alaska    * new york  genre (Taxonomy) Categories   * comedy   * broadway   * romance note: each location has 3 genres to choose for example: california (comedy, broadway, romance) alaska (comedy, broadway, romance) newyork (comedy, broadway, romance) my question is how will make a query like: displaying all "comedy" shows on "california" location or something like displaying all "romance" shows on "alaska" location if u can send me codes for this ill be gladly appreciate it, i will try to analyze the stuff again thanks alot


title: MailChimp integration that allows users to select from multiple lists

text: I'm integrating Mailchimp signup into a WP install and I have 2 questions.   1. What is the best way or best plugin to integrate mailchimp signup?   2. Is it possible to allow the user to select from multiple lists to be subscribed to. I realize the latter is more closely related to MailChimp but I'm hoping that someone has an answer for that as well.


title: How to apply action the_post to the post that is only being mainly displayed

text: I'm trying to write an action that will modify some WooCommerce product on its display. This is my simple code               function do_some_modifications($post)     {         if (is_singular('product')) {             // do some action         }         return $post;     }     add_action('the_post', 'do_some_modifications');      But the page contains two related products and "the_post" is called for them as well. How can I avoid running that code for additional products displayed on the main product page? Thank you!


title: Add a <!--more--> tag to a custom post type

text: I'm building a portfolio site for a friend and he's got three seperate photo packages and may want to add more in the future, so I've created a custom post type called Packages so that he can add as many as he likes and they'd all appear on one page. I've created a single-packages.php template so that each package would link to a sinple.php page to show the full content, but when I add the 'more' tag within the editor it doesn't split the content and the packages page spews out everything rather than just showing the content before the 'more' tag. Any help on this much appreciated. note - I'm not a PHP expert and so won't understand complex coding suggestions


title: Exclude function from homepage only?

text:
There is a function in a theme that I am using that does some pagination stuff. I do NOT want that function to show up on my home page (only), so I'm trying to set up an if/else statement but can't for the life of me can't get it to work right. Using the following code, the function shows up not only on the homepage but also on the category pages. I am using this code in my index.php file and my site is setup to show posts from a custom post type.               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
My Loop Stuff Here
     <?php endwhile; ?>          <?php if (!( is_home() || is_front_page() )) : function_to_NOT_show_on_homepage(); endif; ?>          <?php else: ?>         [else stuffs]     <?php endif; ?>          <?php wp_reset_query(); ?>


title: Wordpress upload file action hook

text: I have a custom post type called "Magazine" shown in the admin interface. Everytime a user **uploads** a **file** in the wp-admin to my custom post type "Magazine", I want to fire a hook because I have to process the file. Is there any **action hook** I can use in this case? Hope someone can help me.


title: Trigger Autosave or disable unsaved changes dialog

text: As the title says, I want to trigger the autosave function of wordpress manually or just disable the "unsaved changes" dialog. The reason for this: I'm developing a plugin which reloads the post edit page after doing some stuff and it's just annoying that the "unsaved changes" popup always pops up before reloading.


title: permalink overwriting after save post

text: I'm developing a plugin to sell tickets for live courses. Using a shortcode [ticketform] I show a form that takes customer data and if everything is ok --> go to paypal --> thank you page. Within this (shortcode) form there is a dynamic select that shows only courses I checked in a metabox for the page. This metabox shows a list of checkboxes, one for each live course. Live courses are posts of a custom post type registeres as -> _eventilive_ The problem: I have a page named _"Evento dal vivo"_ whose permalink is _domain.com/evento- dal-vivo_. When I check a course in this page and save, WordPress change the permalink of the page, and that's wrong. I thought the issue is related to rewrite params used when the CPT is registered. At the moment, all my attempts gone bad. Ideas?


title: How can I call plugin function from a custom template?

text: I've just developed a calendar plugin.   To display a calendar in a template, I call `do_shortcode(args...);`. This works fine. But how can I call a function from my plugin that will return data? I don't want to use `include_once` \- I really just want to call a function E.g.               $events = calendar->getEvents(args...)


title: How can I replace the search results displayed by Wordpress?

text: I'm working on a plug-in which will override the search results returned by Wordpress, with results from a custom XML feed. However, I'm not looking to do this on a separate page, but to replace the results Wordpress would normally display on the blogs search page with the results from my XML feed. I have been unable to find a filter or hook which would allow me to intercept or override the results wordpress returns, nor can I find one which allows me to override what is displayed on the page. My first thought was to look for something similar to the_content, but I'm unable to locate anything similar to that for use in this situation. The plug-in is going to be used by sales staff, so the plug-in needs to work in such a way that it requires as little work and technical knowledge as possible on the part of installer. My reasoning for wanting to override the results instead of inserting a new widget is that I want the plug-in to use the same search form the theme uses by default. Is this even possible? If so, how would I go about doing it?


title: How to split test a menu item

text: I have four links in my main navigation menu, which is displayed on every page of my site. `Link 1 | Link 2 | Link 3 | Link 4` I have a form that once completed is a goal/conversion and redirects to a success page. I'd like to split test a different menu where one of the links goes to a different page. Variant A: `Link 1 | Link 2 | Link 3A | Link 4` Variant B: `Link 1 | Link 2 | Link 3B | Link 4` How can I test which link (3A or 3B) leads to more form completions?


title: Create action running on trashed_post hook to modify post_meta value

text: I have a custom post type that always do math operation to its post_meta and other custom post type post_meta. For example:   * post-type 1 = **cpt_product_order**   * post-type 1 post_meta = **cpt_pm_product_order**   * post-type 2 = **cpt_product**   * post-type 2 post_meta = **cpt_pm_product_stock** There's a cpt_product with cpt_pm_product_stock = 100, frontend operation enable specific user made order by inserting new cpt_product with post_meta cpt_product_order of 10 will substract cpt_pm_product_stock to 90 100 **cpt_pm_product_stock** \- 10 **cpt_product_order** = 90 **cpt_pm_product_stock** cancelling order will delete/trash the cpt_product and cpt_product_order, and cpt_pm_product_stock should back to 100. Which action hook should used for this operation? Is it trashed_post? I didn't find any answer on codex, http://codex.wordpress.org/Plugin_API/Action_Reference/trashed_post is empty Thanks in advance for an answer. ;)


title: WP Custom Comment Callback Not Responding

text:
I have a client site that has requested a custom comment format for posts of a specific category. In my loop template, I have this:

               <?php wp_list_comments( 'type=comment&callback=gallery_comment'); ?>

      And in my functions.php file, I have this:               <?php function gallery_comment($comment, $args, $depth) {        $GLOBALS['comment'] = $comment; ?>        <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">          <div id="comment-<?php comment_ID(); ?>">

<?php comment_text() ?>: <?php comment_text() ?>

<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ) ?>"> –              <?php get_comment_date() ?> at <?php get_comment_time() ?><?php edit_comment_link(__('(Edit)'),'  ','') ?>

     <?php }?>      It's not returning any comments, but for the life of me, I can't figure out why. I followed the instructions in the WP codex to the letter. Is there something that I have overlooked? Thanks for any help! ty


title: Is it mandatory to have a link to the theme designer?

text: I just wanted to know if it's ok to modify/remove links pointing to the designer of the theme. In my case I have "theme by" and the site's logotype, would it be ok to remove the logotype and write the site's name? Or remove it altoghether? Does it have to do with the particular designer of the theme? Thanks


title: Crop featured image by default

text: I'm having trouble finding out how to accomplish this - I want to display a cropped version of an image in the post. So when it's uploaded, it would automatically be displayed cropped. Is there any way to do that? For example, this would be the original image uploaded and this is what it would look like in the post Is there a way to set that cropping be default? It would be great if the user would upload the image already cropped, but if they don't, I want to have a fallback.


title: How to Orderby User Role?

text: Im looking to order posts by the users role... I currently have 2 user roles (intending to create more), and they are "Premium User" and "User", and some poss created by "Admin" All of these posts are on one page, and i would like all the posts that are written by the "Premium User" at the top, then the rest underneath. I have currently accomplished this with 2 separate loops, however, as the site grows there will be need for pagination to be added, and with 2 separate loops, this isnt going to work. Any help appreciated! Thanks,


title: Visitors Contacting Authors

text: Is there any way that I can have a website user be able to contact a post author. The website user must not be required to be logged in to the website. I guess a form to email the post author might be the way to go, but it must be simple to use, and avoid spam. Is there such a plugin for wordpress that can handle this?


title: Disable WordPress 3.6 idle logout / login modal window / session expiration

text: I manage a WordPress site hosted at WPEngine that was recently force-upgraded to version 3.6. The upgrade introduced "In-line login following expired sessions", and therein lies the problem. The website is used to manage registrations, room assignments, and other similar functions for a resort. This means that WordPress is often left open, but not actively used, for hours at a time. Before 3.6 everything was fine, but now the client is complaining about the new login modal popping up "often" (every 2-3 minutes or every 20 minutes, depending on who is asked). My question in short: How do you disable or extend the session responsible for this new modal window? I have tried using the `auth_cookie_expiration` filter, but this only seems to effect being logged out between page loads and has no effect on the in-line login window. Full code of what I tried:               function myplugin_cookie_expiration( $expiration, $user_id, $remember ) {     // If the "Remember Me" box is checked, keep the session for 14 days. Otherwise     // only keep the session for 2 hours     return $remember ? 1209600 : 7200;     }     add_filter( 'auth_cookie_expiration', 'myplugin_cookie_expiration', 99, 3 );      There seems to be question similar to this already posted, but there was no response... Thanks in advance for any insight you can offer!


title: Search not displaying results

text:
I can't seem to get any results to show up, even though I know for a fact that the content exists! Here's my code (search.php)                <?php     /* Template Name: Search */               get_template_part('./template/global/header');     ?>

<?php     if (function_exists('bcn_display')) {         bcn_display();     }     ?>
             <?php             $sidebar = get_post_meta($post->ID, 'wpcf-sidebar-template', true);             if ($sidebar == 'disable') {                 ?>                              <?php }             ?>

<?php the_title(); ?>
                 <?php                 get_search_form();                 if (have_posts()) : while (have_posts()) : the_post();                         the_content();                     endwhile;                 else:                     ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
                 <?php endif;                 ?>
                  <?php             if (function_exists('dynamic_sidebar')) {                 if (!($sidebar)) {                     if (is_admin()) {                         echo _e('No sidebar preferences are defined.');                     }                 } else {                          if ($sidebar != 'disable') {                         echo '';                         get_template_part('./template/misc/sidebar-banner');                         dynamic_sidebar('sidebar-' . $sidebar);                         echo '';                     }                 }             }             ?>

                   <?php         get_template_part('./template/global/footer');


title: 2 wordpress blogs with 1 users table and 1 login

text: I have been trying to achieve that and I did without the 1 login part I fallowed this post/tutorial , but no matter what I do I can not get it to login ones for both websites. My set up is `sitename.com/wordpress1/` and `sitename.com/wordpress2/`(in this one I have `BuddyPress` installation) The shared user table work - I can register from wordpress1 site and login with the same username on wordpress2 without any problems, but I need to login for every site separately. I can see that after I login in the two websites they create 2 different cookies for each:               name: wordpress_38f490d1cc4aa19b4d792ab9d875aaeb     name: wordpress_logged_in_38f490d1cc4aa19b4d792ab9d875aaeb          name: wordpress_8c8848dc05bf5a0a44af5ccc0204cd82     name: wordpress_logged_in_8c8848dc05bf5a0a44af5ccc0204cd82          host: sitename.com //for all of the above.      My understanding is that the two should create only one and use it across. What do you thing the problem could be? Am I missing something in the settings? Could the problem be in my HOST provider? What about the `.htaccess`? Any ideas what I am doing wrong? EDIT: From here I read this: > If you plan on creating sites that are strongly interconnected, that share > data, or **share users** , then a multisite network might not be the best > solution. So I chose to use multiple installations instead...


title: How to dynamically insert <a href> in the image caption?

text:
So, below is the Wordpress default generated code for a gallery item:

Caption Text

      What I need, is to surround the caption text with the image url, so when the user clicks on the caption it will open the big image, like this:
Caption Text
      I know I can do this via image gallery with a href in the caption text, but the site is for a client and I want to be done dynamically. I also found that this can be done in media.php (via functions.php), but I don't know how... I hope I've made myself clear :)


title: How to set a fall back template for a custom post type in a plugin?

text: My custom plugin creates a custom post type, and I want to theme my own `"single-my_custom_cpt.php"` file. However, I want to store it in my plugin folder, and allow that it be over-written in the websites' active theme folder. For example, single-my_custom_cpt.php exists in `/plugins/my-plugin/` folder, and someone creates `/themes/site-theme/single-my_custom_cpt.php`. I want the theme file to come up first, and if it's deleted, the plugin file to come up.


title: Make a Custom template for a specific category in wordpress

text: I am having issue with a custom category template. I want to create a new template for my specific category "VIDEOS" so that all posts under this category show in new style. Basically, i want to show posts with videos in a new way as 3 posts in one row with featured images and a featured slider on top of that page showing 4 new posts of that category ? But i am confused... Can i do this in wordpress ? Because my home page also has a featured slider. Can i create a new slider for that page template but one thing is sure. I need to work with only one category for that custom template i.e. videos......... Any help will be appreciated. Thanks in advance ....


title: How do I extract the Alt Text from an image attachment upload via the Wordpress Options Framework Plugin?

text: I'm currently creating a custom WordPress theme and using the WordPress Options Framework plugin to make a custom options page for my client. I'm able to easily create an image upload option and can get that uploaded image to show up where I intend it to within my theme's framework. Within my options file (required for the plugin to work), the array I've created for the image upload functionality is the following code:               $options[] = array(     'name' => __('Header Overlay', 'options_framework_theme'),     'desc' => __('This creates a full size uploader that previews the image.', 'options_framework_theme'),     'id' => 'header_overlay',     'type' => 'upload');      Then, within the theme I call that uploaded image with the following code:               <img src="<?php echo of_get_option('header_overlay', 'no entry'); ?>" />      Like I mentioned this all works perfectly. However, what I cannot figure out is how to extract the Alt Text from the image upload dialogue and including it as an echo within the img src tag in the theme. Is there anything I can add within the array above to create something to echo within the theme? **[update]**   If I do a search for the text `of_get_option` throughout the files, I find one file. This is the code:               if ( ! function_exists( 'of_get_option' ) ) :          function of_get_option( $name, $default = false ) {              $config = get_option( 'optionsframework' );              if ( ! isset( $config['id'] ) ) {                  return $default;              }              $options = get_option( $config['id'] );              if ( isset( $options[$name] ) ) {                  return $options[$name];              }              return $default;          }      endif;


title: show posts in different styling

text: I would like to show `categories` in the front page with different behavior:   * categories to show `posts` in two styles [Three `posts` having the same style and then another two with the same style] ![Three posts having the same style and then another two with the same style](http://i.stack.imgur.com/ekUm7.jpg)   * another `categories` will show `posts` like below image ![enter image description here](http://i.stack.imgur.com/E5nRx.jpg)   * for the `category` page itself, I would like to show the last three `posts` as featured with the same style, then the rest of posts having the same style. This is my first wp `theme`, so how to make this possible?


title: explain why is_single doesn't work

text:
I am playing around with template hierarchy. I have uploaded stock 2012 theme and deleted page.php and single.php. I found that when I visit a blog post and click the the post reply link to leave a comment, the comment form doesn't show. So I copied comments_template() function out of single.php and pasted it into content.php inside the is_single conditional that looks like this                   <?php if ( is_single() ) : ?>
<?php the_title(); ?>
             <?php else : ?>
                 <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?>
      //added the comments template here      comments_template( '', true);             <?php endif; // is_single() ?>      from that, I would expect the comments template to show but it does not. It did however show up when I added the is_single conditional to the index.php loop Why would it not work in the                get_template_part( 'content', get_post_format());


title: How to rewrite custom post type URL for multiple depths instead of one specific depth

text: I got this code that rewrite the url's for custom posttypes. It works but only for a depth where the posttitle is on the 5th segment. How can i adjust it so it accepts multiple depths? e.g.:               http://www.mydomain.com/post_type/category1/postname/     http://www.mydomain.com/post_type/category1/child1/postname/     http://www.mydomain.com/post_type/category1/child1/child2/postname/     http://www.mydomain.com/post_type/category1/child1/child2/child3/postname/      i tried adding:               $newRules['product/(.+)/(.+)/(.+)/?$'] = 'index.php?products=$matches[3]';      But that did not work because it gave a 404 error while browsing the child3 depth in the example structure above. Current code:               function mmp_rewrite_rules($rules) {     $newRules  = array();     $newRules['product/(.+)/(.+)/(.+)/(.+)/?$'] = 'index.php?products=$matches[4]';     // The above structure only works if the postname is the 5th uri segment     // e.g. http://www.mydomain.com/post_type/category1/child1/child2/child3/postname/     $newRules['product/(.+)/?$']                = 'index.php?pcategory=$matches[1]';           return array_merge($newRules, $rules);     }      [UPDATE1] It also won't work if i change the code to if's and elseif's. With `elseif` only the top rule is added and there fore i can only browse products where the posttitle is the 5th segment in the url. With `if` all rules are added but i cannot browse the categories with a depth of 2,3 and 4 but u can browse products in depths where the url is in the 3,4 and 5th segment               function mmp_rewrite_rules($rules) {     $newRules  = array();     if ('index.php?products=$matches[4]'){     $newRules['product/(.+)/(.+)/(.+)/(.+)/?$'] = 'index.php?products=$matches[4]';     }      elseif ('index.php?products=$matches[3]'){     $newRules['product/(.+)/(.+)/(.+)/?$'] = 'index.php?products=$matches[3]';     }     elseif ('index.php?products=$matches[2]'){     $newRules['product/(.+)/(.+)/?$'] = 'index.php?products=$matches[2]';     }     // The above structure only works of the postname is the 5th uri segment     $newRules['product/(.+)/?$']                = 'index.php?pcategory=$matches[1]';           return array_merge($newRules, $rules);     }


title: One WordPress install for main site at domain.com and blog at blog.domain.com?

text: I asked this before over at the WordPress forums some time ago, before WP3 with MU was released and I think it's relevant that I ask it again, here instead, cause of WP3. Basically I want to have my personal website and blog both powered by WordPress, the website should be at www.domain.com (or domain.com) and the blog at blog.domain.com. My first idea is to use 2 WP installations with the same exact theme sharing the same database. This would easily allow me to share content between the two. Like displaying the latest blog posts in the front page of the website, for instance. It would also allow me to easily maintain different content for each site with appropriate links for each page. What I meant is, a blog post should be accessed like `blog.domain.com/article/blog-post-title` and not `www.domain.com/article/blog-post-title`; the same way, a main site page should be accessed like `www.domain.com/about-me` and not `blog.domain.com/about-me`. But two installations come with a few problems too... Double the work for maintaining WP updated to the latest version along with plugins. In case I need user registration for comments, two would be needed and I don't think the users will like that. I'm sure there are more problems, but this is what I can think of right now. So, does WP3 come with any feature, like MU, that could help me achieve what I want or my best and easiest bet is to go the double installation route?


title: Notify admin on new submit

text: With WordPress 3.0 its easy to for users to submit custom content from the front end. They don't even need to be logged in anymore. Is there a functions code (not a plugin) to notify a predefined email, such as the site admin, of new posts in just a certain post type? For example the site admin get notified whenever a new "usernews" post type is posted? Thanks!


title: Advice needed for importing custom field data and database structure

text: Looking for advice for the best method to accomplish the following. I have a custom page template with several custom fields/taxonomy. The data needed for these custom fields actually resides in .txt files that are updated once a week. They are easily converted into .csv files. What would be the best and most secure method in getting this data into a custom page template, I figure I have 3 options. Read the raw .txt or .csv files using custom php? Import the .csv into a separate database and grab the data from it? Import the data into the WordPress database? Option 3 seems to be the best one, but I am completely unfamiliar with the wordpress database structure and the best way to go about this.


title: Creating a "Tags" page with search option, instead of using a widget

text: I've searched for answers on that, not sure I found anything. I have a blog about movies, and I'm using tags for actors (i.e. brad pitt, kevin spacey). I'm interested to create a dedicated "actors" page, which will include:   * a list of all the actors (= tags) alphabetically. So the tags list will be presented from A to Z.   * a search form - so users can search for actors (= search the tag cloud). I'm trying to search for plugins that can help doing this. Only found the nice Custom Tag Configuration plugin, but that's not enough. Any help on this? Maybe the code for creating such a page shouldn't be too difficult - would be glad to get some suggestions on that. In any case, I believe that many blog owners would find such an option quite relevant for their blogs. Thanks.


title: Different permalink structure per category

text: Just for curiosity, is it possible to have a different permalink scheme for different templates or categories? For example, for post "XYZ leach review" in category pets/dogs to have "mysite.com/reviews/pets/dogs/xyz_leach_review.php" and then any post in another category to be "mysite.com/justthecastegory/the_post_name.php"?


title: Update users custom profile fields

text: Ok guys, i have problem when using some trics from here or other sites. I`m trying to use this method of adding custom user fields. But, when i add this, everytime i save it`s all ok, but when i come back to edit something different in user profile, those new fields just goes blank, and if i did not input again my data in those fields and save my profile, those fields goes blank in DB. So, something is not ok that need to show me what i did just saved. As I told, it`s all ok until i open again my profile for editing. Ok, here is code, http://pastebin.com/u9syYRF3


title: Resize uploaded images

text: > **Possible Duplicate:**   >  Resizing all images I have this news portal i built, and the client want a different size of the featured image. I all ready made my first desired size and they have posted around 200+ posts all ready with that image size. Now, if i change the size it only changes on the new posts / or re upload of the current featured images(which is too much to do by hand). My Question is, is there a way to resize the uploaded images?


title: How can i resize/force every uploaded post image width to be 460

text: How do I resize every uploaded post image to be always 460 width by whatever corresponding height?


title: What might cause "junk after document element" error?

text: I have PHP errors redirected to log file. Only for WP installation so this definitely doesn't come from somewhere else. This is what started to come up recently (this is all of them, not cut):               [22-Sep-2010 14:30:41] junk after document element at line 2, column 0     [22-Sep-2010 16:17:08] junk after document element at line 2, column 0     [22-Sep-2010 17:19:42] junk after document element at line 2, column 0     [22-Sep-2010 18:30:19] junk after document element at line 2, column 0     [22-Sep-2010 20:19:23] junk after document element at line 2, column 0     [23-Sep-2010 14:51:40] junk after document element at line 2, column 0     [23-Sep-2010 15:54:33] junk after document element at line 2, column 0     [23-Sep-2010 17:23:02] junk after document element at line 2, column 0      This doesn't really look like PHP error ( _function blah-blah failed at line x_ ), they are very infrequent and don't seem to be tied to page loads (maybe to some cron event?) and there hadn't been any major configuration changes in months other than keeping plugins up to date and one or two new ones (days before this started). Googling results are mostly about XML parsing... Of which WP probably does plenty (feeds, updates, what else?..) but how to pinpoint what is going wrong? This has me really puzzled.


title: Custom login errors and redirect

text:
I am working on a custom login page in Wordpress and found these 2 functions for a redirect back to the custom login pages to show errors there and nog on the Wordpress default login page. The first function checks a correct login combination and the second one checks a blank login. The first function works great, but the second function gives me a ?login=failed always. Even if I fill in the fields right. What am I doing wrong?               add_action( 'wp_login_failed', 'hex_front_end_login_fail' ); // hook failed login     function hex_front_end_login_fail( $user ) {       $referrer = $_SERVER['HTTP_REFERER']; // where did the post submission come from?       // if there’s a valid referrer, and it’s not the default log-in screen       if ( ! empty( $referrer ) && ! strstr( $referrer, 'wp-login' ) && ! strstr( $referrer, 'wp-admin' ) && $user != null ) {         if ( ! strstr( $referrer, '?login=failed' )) { // make sure we don’t append twice           wp_redirect( $referrer . '?login=failed'); // let’s append some information (login=failed) to the URL for the theme to use         } else {           wp_redirect( $referrer );         }         exit;       }     }          add_action( 'authenticate', 'hex_front_end_blank_login');     function hex_front_end_blank_login(){         $referrer = $_SERVER['HTTP_REFERER'];         if ( ! strstr( $referrer, 'wp-login' ) ) { // login is the name of the loginpage.             if ( ! strstr( $referrer, '?login=failed' ) ) { // make sure we don’t append twice                 wp_redirect( $referrer . '?login=failed' ); // let’s append some information (login=failed) to the URL for the theme to use             } else {                 wp_redirect( $referrer );             }         exit;         }     }      My login form:               <form method="post" action="<?php echo network_site_url( '/wp-login.php' ); ?>">
                     <?php echo __( 'Username') . ':'; ?>                     <input type="text" name="log" id="log" />

                     <?php echo __( 'Password') . ':'; ?>                     <input type="password" name="pwd" id="pwd" />
                      <input type="hidden" name="redirect_to" value="<?php echo network_site_url( '/account/company-search' ); ?>" />                      <input type="submit" class="button" name="submit" value="<?php _e( 'Login' ); ?>" />                  </form>


title: Archive not sorting correctly

text: I have a custom post type called "cif-events" and I want to sort by the value in wpcf-start-time. I added the following to my functions.php:               add_filter('pre_get_posts', 'set_order_for_archives');          function set_order_for_archives($q) {       if ($q->is_post_type_archive('cif-groups')) {         $q->set('orderby', 'title');         $q->set('order', 'ASC');         $q->set('posts_per_page', 300);       } elseif ($q->is_post_type_archive('cif-events')) {         $q->set('orderby', 'wpcf-start-time');         $q->set('order', 'ASC');         $q->set('posts_per_page', 300);       } elseif ($q->is_post_type_archive('cif-venues')) {         $q->set('orderby', 'title');         $q->set('order', 'ASC');         $q->set('posts_per_page', 300);       }       return $q;     }      It is not sorting correctly, however. It's sorting by post-date I think instead. post-per-page does seem to be set correctly though.


title: Wordpress Comment Box on woocommerce product page

text: can we activate same comment widget on woo-commerce product page which WordPress gives on post or pages. actually i want other users should be able to comment on others comment which is not allowed in review.


title: Which hook to add action on specific page?

text: I tried to remove action added by a plugin only for specific posts. But I can't find the hook to get the page ID currently edited (wp- admin/post.php?post=112) and add action conditionnally. Here's the code :               // Deactivate plugin Resize at Upload Plus on page id=112     remove_action('wp_handle_upload', 'hz_uploadresize_resize');     add_action('wp_loaded','custom_upload_resize');     function custom_upload_resize(){         $id = get_the_ID();         if (isset($id) && $id !== 112){             add_action('wp_handle_upload', 'hz_uploadresize_resize');         }     }      The plugin resizes images after uploading http://wordpress.org/plugins/resize- at-upload-plus/ Can you help please ?


title: What form element names break wordpress?

text: I know that `<input name="name">` will cause wp to bork and throw a 404. It seems that 'year' is the same. Does there exist a list of input names that wp doesnt like?


title: how to have __() translating in languages different from admin?

text: I use native wordpress multisite for languages (it, en, fr, de, es). I need not to use a plugin. Still, all the admin dashboards will be in italian, because editors are all italian people. I know __() and related functions get the translation language from the WPLANG constant, but WPLANG also affects admin languange. I'd like to get frontend in different languages while admin always italian. Is it possible?