Ajax contact form

I have a custom contact form that I am trying to process via Ajax. I am a bit newbie in Ajax and more using it on WordPress. I have built it but it doesn`t send the email and retrieve "0". Php function:               add_action('wp_ajax_ajaxContacForm', 'ajaxContacForm');     add_action('wp_ajax_nopriv_ajaxContacForm', 'ajaxContacForm');          //Ajax contact form filter function     function ajaxContacForm() {              if(!$_POST) exit;              global $t_one_opt;              $name     = $_POST['name'];         $email    = $_POST['email'];         $phone   = $_POST['phone'];         $comments = $_POST['comments'];                   if(trim($name) == '') {             echo '
Please enter your name.
';             exit();         } else if(trim($email) == '') {             echo '
Please enter a valid email address.
';             exit();         } else if(trim($phone) == '') {             echo '
Please enter a valid phone number.
';             exit();         } else if(!is_numeric($phone)) {             echo '
Phone number can only contain digits.
';             exit();         } else if(!isEmail($email)) {             echo '
You have enter an invalid e-mail address,please try again.
';             exit();         }              if(trim($comments) == '') {             echo '
Please enter your message.
';             exit();         }               if(get_magic_quotes_gpc()) {             $comments = stripslashes($comments);         }                   // Configuration option.         // Enter the email address that you want to emails to be sent to.         // Example $address = "joe.doe@yourdomain.com";              //$address = "example@themeforest.net";         //global $t_one_opt;         $address = $t_one_opt['contact_email'];                   // Configuration option.         // i.e. The standard subject will appear as, "You've been contacted by John Doe."              // Example, $e_subject = '$name . ' has contacted you via Your Website.';              $e_subject = 'You\'ve been contacted by ' . $name . '.';                   // Configuration option.         // You can change this if you feel that you need to.         // Developers, you may wish to add more fields to the form, in which case you must be sure to add them here.              $e_body = "You have been contacted by $name with regards to $subject, their additional message is as follows." . PHP_EOL . PHP_EOL;         $e_content = "\"$comments\"" . PHP_EOL . PHP_EOL;         $e_reply = "You can contact $name via email, $email or via phone $phone";              $msg = wordwrap( $e_body . $e_content . $e_reply, 70 );              $headers = "From: $email" . PHP_EOL;         $headers .= "Reply-To: $email" . PHP_EOL;         $headers .= "MIME-Version: 1.0" . PHP_EOL;         $headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL;         $headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL;              if(mail($address, $e_subject, $msg, $headers)) {                  // Email has sent successfully, echo a success page.                  echo "<fieldset>";             echo "
";             echo "
Wohoooo ! Well done
";             echo "
Thank you $name, your message has been submitted to us.
";             echo "
";             echo "</fieldset>";              } else {                  echo 'ERROR!';         }          }      jQuery function:               jQuery(document).ready(function ($) {         // Send email          jQuery('#contactform').submit(function () {                       $("#message").slideUp(750, function () {                 $('#message').hide();                      $('#submit')                     .after('')                     .attr('disabled', 'disabled');                      jQuery.ajax({                 type:"POST",                 url: "http://www.codetocode-developments.com/t-one/wp-admin/admin-ajax.php",                 data: {                          action: ajaxContacForm,                         name: $('#name').val(),                         email: $('#email').val(),                         phone: $('#phone').val(),                         comments: $('#comments').val(),                     },                 success:function (data) {                         document.getElementById('message').innerHTML = data;                         $('#message').slideDown('slow');                         $('#contactform img.loader').fadeOut('slow', function () {                             $(this).remove()                         });                         $('#submit').removeAttr('disabled');                         if (data.match('success') != null) $('#contactform').slideUp('slow');                          }             });                  });                  return false;              });               });      What I am doing bad?


WordPress and template tags for Simple Fields plugin

I'm building a website using the Simple Fields plugin to mark a post as featured and to add a simple slide show. I've read the documentation page and they only explain how to do things on the backend. So I have some fields attached to a post, and now I want to get those values on the front-end. How do I get those values?


What function changes a post's timestamp? I created a post from frontend script, but I need to add a date picker to set the date of the visit.


Contact Form 7 - Send attachment to submitter?

I have installed the Contact Form 7 plugin on my WP 3.2.1 instance. I have setup a contact form for users to request evaluations. This is all working fine, but I was hoping that when they submitted a request, I could ping them an email with an attached product brochure. I have it currently setup like this: ![enter image description here](http://i.stack.imgur.com/i8Uus.png) I have tried using [file-691] where 691 is the id of the uploaded media in the media gallery. Both do not seem to work.   **What is the correct way to achieve this?**


how to identify a multisite installation

I am creating a plugin. I want to add a different options page, based on multisite or single site. I need a code which can identify installation is Multisite or single site.


Plugin to hide image in excerpt

I was looking for a plugin that will enable me to hide an image on the excerpt, but show it on the single post view. Anyone knows if there is any?


How to register child taxonomies?

1. Should I register both parent and child as `'hierarchical' => true`, if there's no grandchild?   2. If "Movie" is the top level taxonomy, when I register a child, is it as simply as: `'parent_item' => __( 'Parent Movie' )`?   3. How to automatically asign a child taxonomy to a post? So far, I figured out how to asign a taxonomy to a post, but, does this work fine with child taxonomy? `wp_set_object_terms($post_ID, $cat, 'category');`   4. If I query a parent taxonomy, will the child be included in the results or not?   5. If the taxonomies are not listed in the `args` of `register_post_type`, will they still work?


How to add equivalent of php include to one page (as plugin?)

I'm new to Wordpress. I have a website that I coded myself. One of the pages has PHP functions that take a google calendar feed (with hard-coded login info) and displays it as needed. I am now building a new site on wordpress where I want to use the same code. My reading says I should handle this as creating a new plugin so that I don't overwrite it with any theme updates. My question: how can I simply copy my PHP code into a file in it's own plugin folder and then use a shortcode to access it like an include? Specifically, I don't understand if I am able to use shortcode as an equivalent of `<php? include="myscript.php"?>`.


Link to all posts page?

So I have my admin bar hidden by default, because it's ugly, instead of writing a bunch of if statements so certain elements to the WP-admin panel only appear for logged in users, so far so good. The one I'm having trouble with is the 'all posts' screen, the url is wp- admin/edit.php, yet that gives me a 404 error. This works, takes the user to the new post screen.               <?php                  global $user_login;                 get_currentuserinfo();                  if ($user_login) :                 ?>

                              Write

                  <?php endif; ?>      This does not work. This only fails to work when on the single.php, since it's an looking for the url sitename.com/single-post-name/wp-admin/edit.php, the other links work fine on single pages.                             <?php              global $user_login;             get_currentuserinfo();              if ($user_login) :         ?>

                          My Posts

          <?php endif; ?>      Is there some php code or something I can use to link to the all posts part of the dashboard?


How to Add a Website Background Image to One Page?

What is the easiest way to add a background image to a single page like tryghost.org? I am currently running under WordPress and was wondering what code I need to add and where. The image is only to be placed on the homepage, and when scrolling down the image should be scrolled down as well. It should also be full width (without destroying image ratio) no matter what the device. Thanks for the input! EDIT: Please give a walkthrough on **exactly** what to do for those new to WordPress. I appreciate everyone's help! _Still Unanswered, will give best answer to Answerer._


Displaying caption with featured image

I'd like to display captions with my featured images. This is another feature that should be available by default but for some reason is not. There are a few routines out there that claim to accomplish the task, but they come up blank for me. Is there any reliable way to display a caption with a featured image?


How to store post meta in an array?

What is the best way to store post meta in an array (using a custom write box, know how to do that) so that all post meta is in a single custom field?


How does WordPress handle permalinks?

WordPress auto corrects the permalinks(URLs) even if it is entered incorrectly. For e.g. WordPress will land you in `example.com/some-post` even if you enter `example.com/idontexist/some-post` or even `example.com/some` It could be that, WordPress uses RegEx like or some matching algorithm that compares from right to left and if it finds a match, it will take you to the page even if there are `/.*/` left on the left. Just a guess! How does WordPress do this? Edit: I also noticed that the .htaccess file checks for virtual file/directories using `!f` and `!d` and redirects the request to index.php on the blog folder.


When generating PDF with dompdf I am having this problem in pdf file when viewing file in notepad > Warning : tempnam() [function.tempnam]: SAFE MODE Restriction in effect. The > script whose uid is 10210 is not allowed to access /tmp owned by uid 0 in > **/var/www/vhosts/www.mysite.com/httpdocs/wp- > content/themes/mysite/dompdf/include/image_cache.cls.php** on line **105 > > Warning**: file_put_contents() [function.file-put-contents]: Filename cannot > be empty in **/var/www/vhosts/www.mysite.com/httpdocs/wp- > content/themes/mysite/dompdf/include/image_cache.cls.php** on line **117** > > Warning: unlink() [function.unlink]: Unable to access in > **/var/www/vhosts/www.mysite.com/httpdocs/wp- > content/themes/mysite/dompdf/include/image_cache.cls.php** on line **153** > Blockquote I have included image in pdf file. Without image this message is not displayed. I have tried with absolute and relative path of the image also but did not work. I have set the folder permission to 777 to dompdf folder. Need help on this matter. Thanks in advance


Custom Post Type's Capabilities map_meta_cap issues

I've created a CPT, added capabilities to it and them to the Subscriber role successfully. However the mapping is clearly not working because I get errors on publish and a Subscriber cannot edit their own posts (which the function below allows if they are the author). Why won't my map_meta_cap function work? I've spent all weekend on this so I have to turn to the community. Thanks in advance.               function lst_map_meta_cap( $caps, $cap, $user_id, $args ) {          /* If editing, deleting, or reading an event, get the post and post type object. */     if ( 'edit_lstpost' == $cap || 'delete_lstpost' == $cap || 'read_lstpost' == $cap ) {     $post = get_post( $args[0] );     $post_type = get_post_type_object( $post->post_type );     $caps = array();          switch( $cap ) {     case 'edit_lstpost':     $caps[] = ( $user_id == $post->post_author ) ? $post_type->cap->edit_posts : $post_type->cap->edit_others_posts;     break;     case 'delete_lstpost':     $caps[] = ( $user_id == $post->post_author ) ? $post_type->cap->delete_posts : $post_type->cap->delete_others_posts;     break;     case 'read_lstpost':     $caps[] = ( 'private' != $post->post_status || $user_id == $post->post_author ) ? $caps[] = 'read' : $post_type->cap->read_private_posts;     break;      }     }          return $caps;     }          add_filter( 'map_meta_cap', 'lst_map_meta_cap', 10, 4 );      EDIT: Also adding all caps to the administrator refuses to work the way I understand it to after reading for 2 days about it. I have played with applying/removing each of the caps to the admin/subscriber role with only the ability to view or create (with an error but still works) Here are the CPT caps:               [edit_post] => edit_lstpost     [read_post] => read_lst     [delete_post] => delete_lstpost     [edit_posts] => edit_lstposts     [edit_others_posts] => edit_lstothers     [publish_posts] => publish_lst     [read_private_posts] => read_privatelst     [delete_posts] => delete_lstposts     [delete_private_posts] => delete_private_lstcapss     [delete_published_posts] => delete_published_lstcapss     [delete_others_posts] => delete_lstothers     [edit_private_posts] => edit_private_lstcapss     [edit_published_posts] => edit_published_lstcapss     [edit_page] => edit_lstpage     [create_posts] => edit_lstposts


Using Underscore Templates in WordPress

I've noticed that since WP 3.5 that we now have the Backbone.js and Underscore.js libraries included. The new Media Modal uses Underscore templates and I was wondering how would I be able to insert them, especially in the admin side of things.Is there a correct way to insert these?


WooCommerce get query string problem with permalink

i using WooeCommerce for my site. This is my custom loop product in woocommerce.php located in my theme folder:               if(isset($_GET['product_cat'])){       // list products by category     }      When permalink set is default it working. When i change the permalink common setting to http://thsvt.esy.es/sample-post/ and Product permalink base to http://thsvt.esy.es/shop/sample-product/ then it not working. Anyone can help me? Thanks.


Building WP Web App: Creating a Feed for post revisions

I'm building a project management web app using WordPress. I want to create a kind of "news feed" on the home page so that everyone can see what the latest posts added/edited were. I need this to work with custom fields too (specifically, I'm using advancedcustomfields). An example of what I'm trying to do:   1. Rick created a new `get_post_type()` called `get_the_title()` on `get_the_time()`   2. Jim changed the Due Date of Client Print Ad from 3/5/13 to 3/2/13 For additions (#1 above), this is really easy. `new WP_Query(array('post_type' => 'any', 'numberposts' => '-1', 'posts_per_page' => '-1', 'orderby' => 'date'))` and then loop through. For edits (#2 above), I'm finding this to be more challenging. Obviously I can see if this is an edit, but I'm having trouble getting the exact edits. I'm thinking of doing `add_action('save_post', 'insert_activity')` and inserting some kind of string to post_meta, but I don't know if that's the best solution or if its redundant with capabilities already built in. Has anyone tried to do this before? I know WordPress has the built in revision manager where you can compare revisions, but what is the best way to compare this on the front end? How does this work with custom fields?


How to display my categories in a list (to a post, not the sidebar)?

i want to display my categories to a post like a list. i have this (parent- and child-) categories:               - Sports         - Football         - Basketball     - Toys         - Dolls         - Lego     - Books      for example one post is archived to the categories "Sports", "Football", and "Books" i want to output the categories like this:

Sports

Football

Books

      …as you can see, the hierarchical order by parent->child is important! thanks, Jochen


Wrap this custom field with hyperlink link

Just created a custom field from scratch by following a tutorial. I have a field for a website link. Currently it outputs only raw text, no linking. So how do I make this code hyperlink:
Website: '.$_imd_portfolio_website_output.'
      Full code:               function imd_portfolio_meta_box() {         global $post;         // get the custom field values as an array         $values = get_post_custom( $post->ID );         // extract the members of the $values array to their own variables (which you can see below, in the HTML code)         extract( $values, EXTR_SKIP );              // escape the output, just in case         $allowed_html = array(             'a' => array(                 'href' => array(),                 'title' => array()             ),             'em' => array(),             'strong' => array()         );         $_imd_portfolio_details_output = wp_kses($_imd_portfolio_details[0], $allowed_html);         $_imd_portfolio_client_output = wp_kses($_imd_portfolio_client[0], $allowed_html);         $_imd_portfolio_website_output = wp_kses($_imd_portfolio_website[0], $allowed_html);         $_imd_portfolio_quote_output = wp_kses($_imd_portfolio_quote[0], $allowed_html);         $output = '

Details: '.$_imd_portfolio_details_output.'

Client: '.$_imd_portfolio_client_output.'

Website: '.$_imd_portfolio_website_output.'

Quote:'.$_imd_portfolio_quote_output.'>

';         return $output;     }      Update: the problem is solved I've edit my code & change this line -
Website: '.$_imd_portfolio_website_output.'
      to this line-
Website:'.$_imd_portfolio_website_output.'
      thanks everybody for help


Adding and removing columns from the admin pages panel

I would like to remove "Comments" and "Author" columns from the list of pages, and add a couple of my own "Permalink" etc. Is this possible? Is there an appropriate hook I could use?


Display email address field next to author in wp_dropdown_users

the post_author_meta_box uses wp_dropdown_users showing the user name of authors. How do I display the email address in brackets next the author's name? Can one filter the wp_dropdown users do to this?


Remove dashboard, use Pages tab as default

Is there a way to have "Pages" set as the default tab when the user logs in to the admin area? I am using a heavily customised set up, where none of the dashboard widgets are useful so they are hidden anyway.


Publish/Update post is changing image links from file url to post url

I've written a filter to wrap images included in posts with figure tags and their captions with figcaption tags. I turned off the visual editor so that it doesn't strip out all the html from the images. That all seems to work fine until I publish or update the post. At this point the link to the full size image gets changed to `/sitename/post-type/post- title/attachment/attachment-title/` where before it was `/sitename/assets/filename.jpg` Can anyone help suggest why this is happening? Here is a link to the filter code on pastebin


Looking for a filter to modify the months

Hi making a simple plugin that replaces the wrong russian month with the right ones. But I can't find any filters that works. I have tried these filters without success: > add_filter('get_the_modified_date', 'russian-month');   >  add_filter('the_modified_date', 'russian-month');   >  add_filter('date_rewrite_rules', 'russian-month');


W3 total cache - white screen of death when trying to show certain taxonomies

I'm using plugin W3 Total cache and it worked excellent -until I added a custom "detail page" of a custom taxonomy (with a file called taxonomy- categorycourses.php) where the categorycourses is the taxonomy. I get the white screen of death-experience. I have turned errors on, but nothing shows up. I just get a blank page. I've google around and cannot find some satisfying answers. (The taxonomies shows up correctly when not cached , for example - when logged in). **UPDATE** I loved w3 total cache until know. This is a bug that shouldn't exist in the plugin, but it apprently does so I deleted it, and installed WP Super Cache and activated and then everything worked as it should.


Which directory should be writable to update wordpress?

I configured file permissions according to here like this. `apache` user runs server and `wordpress` user owns directory, this user is only used for this site.               drwxr-xr-x  5 wordpress wordpress  4096 Apr 12 01:12 .     drwxr-xr-x 10 root      root       4096 Apr 10 16:19 ..     -rw-r--r--  1 wordpress wordpress   418 Sep 25  2013 index.php     -rw-r--r--  1 wordpress wordpress 19929 Jan 18  2013 license.txt     -rw-r--r--  1 wordpress wordpress  3193 Jan 27 20:18 readme-ja.html     -rw-r--r--  1 wordpress wordpress 10156 Jan 27 20:18 readme.html     -rw-r--r--  1 wordpress wordpress  4892 Oct  4  2013 wp-activate.php     drwxr-xr-x  9 wordpress wordpress  4096 Jan 27 20:18 wp-admin     -rw-r--r--  1 wordpress wordpress   271 Jan  9  2012 wp-blog-header.php     -rw-r--r--  1 wordpress wordpress  4795 Sep  6  2013 wp-comments-post.php     -rw-r--r--  1 wordpress wordpress  4255 Jan 27 20:18 wp-config-sample.php     -r--r-----  1 wordpress wordpress  4471 Apr 12 01:12 wp-config.php     drwxrws---  5 wordpress wordpress  4096 Apr 12 11:41 wp-content     -rw-r--r--  1 wordpress wordpress  2932 Sep 25  2013 wp-cron.php     drwxr-xr-x 12 wordpress wordpress  4096 Jan 27 20:18 wp-includes     -rw-r--r--  1 wordpress wordpress  2380 Oct 25 07:58 wp-links-opml.php     -rw-r--r--  1 wordpress wordpress  2359 Oct 25 07:58 wp-load.php     -rw-r--r--  1 wordpress wordpress 31909 Dec  4 05:12 wp-login.php     -rw-r--r--  1 wordpress wordpress  8235 Nov 13 20:58 wp-mail.php     -rw-r--r--  1 wordpress wordpress 10880 Nov  5 09:24 wp-settings.php     -rw-r--r--  1 wordpress wordpress 25665 Nov 13 12:23 wp-signup.php     -rw-r--r--  1 wordpress wordpress  4026 Oct 25 07:58 wp-trackback.php     -rw-r--r--  1 wordpress wordpress  3015 Oct 25 11:29 xmlrpc.php               $ ls -la wp-content/     total 24     drwxrws--- 5 wordpress wordpress 4096 Apr 12 11:41 .     drwxr-xr-x 5 wordpress wordpress 4096 Apr 12 01:12 ..     -rw-rw---- 1 wordpress wordpress   28 Jan  9  2012 index.php     drwxr-xr-x 3 wordpress wordpress 4096 Jan 27 20:18 languages     drwxr-x--- 4 wordpress wordpress 4096 Jan 27 20:18 plugins     drwxrws--- 5 wordpress wordpress 4096 Jan 27 20:18 themes      And add `apache` user to `wordpress` group               $ id apache     uid=48(apache) gid=48(apache) groups=48(apache),503(wordpress)      But with these permissions, I can't update wordpress itself or plugins. Which directory should be writable to update correctly and keep as possible as secure?


Wordpress custom url menu items being overwritten

I am fairly new to Wordpress development. Using a site that runs 3.91 with a custom theme that I have inherited from someone else. My question is fairly simple: I want to add custom menu items that do nothing but point to a specific URL. On the page linked below - you can see that there is a People menu that contains 3 drop downs. I set these up all to be custom URL items in the menu, pointing to: http://instituteforpublicarchitecture.org/people/#board (and #staff and #fellows -- thanks StackExchange for not allowing me to post more links - what a brilliant idea ?!?!) This is all fine - but now after clearing my cache it seems that they are all being overwritten to point (each one) to the same URL: http://instituteforpublicarchitecture.org/?section=people Which obviously is not what I need. Any ideas where I might look to see what is overwriting the menu items? Help is much appreciated! Thank you - J


Redirect url in plugin to somewhere else?

I am using **WP-SNAP Extended! v1.0.0** and I want to use this alphabetical menu as a sub-menu beneath my header. I managed to get the alphabetical menu in place, but now, if I click on a letter, it will show the posts on the page I am looking at and that is not good, because it overlaps the things that are already there. So you get a very chaotic website with many different content.. What I want to do is this: if I click on a letter, I want it to redirect it to a page where I output the posts that are with that letter. Now, it shows: **http://somesite.com/test/?snap=C** if I click on a letter. I want it to show **http://somesite.com/test/?page_id=68&snap=C** How do I pull this off? I am using this function to get it: `<?php if (function_exists('wp_snap')) { echo wp_snap(); } ?>`


How to extract specific image meta for all images?

Been hitting my head against a wall for a couple weeks... I'm working on modifying a geotagging Wordpress plugin called Thesography. I have notified the developer of my past enhancements, and they are OK with it because this plugin is licensed under the terms of the GNU General Public License. Currently the plugin will return a mini popup Google map for a single post, with a single image. I am looking to expand upon it to have another function which will display 1 large Google Map. This larger map will have all my geotagged images as pinpoints Then, using the Google Maps API, also display a thumbnail and post title for the specific image and pinpoint. Onto the code: Here is a snippet of the current code from the plugin. This snippet which retrieves the image data from the database for the specific image. As you can see, this code works for the current post. How can it be modified to include all images from all posts?                   if (is_null($imgID)) {         $images = get_children(array(             'post_parent' => $post->ID,             'post_type' => 'attachment',             'numberposts' => 1,             'post_mime_type' => 'image',             'orderby' => 'ID',             'order' => 'ASC'             ));         if ($images) {             foreach ($images as $image) {                 $imgID = $image->ID;             }         }     }          $imgmeta = wp_get_attachment_metadata($imgID);          if ($imgmeta)     {     if ($imgmeta['image_meta']['latitude'])         $latitude = $imgmeta['image_meta']['latitude'];     if ($imgmeta['image_meta']['longitude'])             $longitude = $imgmeta['image_meta']['longitude'];     if ($imgmeta['image_meta']['latitude_ref'])          $lat_ref = $imgmeta['image_meta']['latitude_ref'];     if ($imgmeta['image_meta']['longitude_ref'])             $lng_ref = $imgmeta['image_meta']['longitude_ref'];          $lat = geo_single_fracs2dec($latitude);     $lng = geo_single_fracs2dec($longitude);     if ($lat_ref == 'S') { $neg_lat = '-'; } else { $neg_lat = ''; }     if ($lng_ref == 'W') { $neg_lng = '-'; } else { $neg_lng = ''; }          $latlng = $neg_lat . number_format($lat,6) . ',' . $neg_lng . number_format($lng, 6);      And here's a sample snippet of the Google Maps API that I need to fit this latitude, longitude into. It will contain the latitude, longitude, the image source URL and the title of the post it displays in. That way someone can hover over a pinpoint, see the image, then click it to read more.                 var point = new GLatLng(43.91892,-78.89231);       var marker = createMarker(point,'The Title of the Page
')       map.addOverlay(marker);      It's a fun one! I have been hitting my head against the wall and have come up blank each time I try.


Best way to programmatically remove a category/term from a post

I am working on a script to convert all posts in a given category to use a postmeta flag instead (testing of MySQL has shown me that on a site as large as mine this will lead to a meaningful decrease in query time). When converting posts I want to just fetch all posts in the category, add the postmeta then remove the category, which will let me just reload that function until there are no more posts in the category. I can't find a good function for removing a term from a post though. I want to give it the post id and the term taxonomy+ID and have it handled for me. I am also interested in plugins that can do the conversion for me if anyone knows of one. I couldn't find any that did cat->postmeta, unlike the opposite which can be handled by Scribu's plugin.


Image caption with apostrophe breaks the text with qTranslate

I created my own theme and I use on two different websites, along with a very few plugins (among them, qTranslate!). I noticed that recently (I don't think it was happening before) that all my image captions containing apostrophes are broken. The text is simply cut starting from the apostrophe when I update the post. Can you confirm that it is a bug with Wordpress 3.3.1? I'm trying to find the culprit here :) If it's indeed a bug (or the normal behavior), is there a way so that I can fix it ? Using a filter would be nice, I really don't like hacking the core code. Thanks a lot :) PS: I noticed that by disabling qTranslate the problem disappears. The problem happens exactly when we EDIT the post, it's at that time that the content is screwed up.


Conditional PNG Overlay in Custom Post Type Loop Depending on Post Type

I have a loop pulling in two different custom post types. I have that loop showing the thumbnails of posts. Each post type used to have its own seperate loop and I had set up some png overlays to sit on top of the thumbnails. I had a play button icon over the thumbnails of the posts in the Video post type, and a stack of pictures icon over the slideshows post type thumbs. Now that I have combined the two loops I need a conditional statement to determine the post type and apply the appropriate overlay. Here is the code I have that puts the play button over every thumb. How do I change this to a conditional that would apply the btn-play.png over video thumbs and `<img src="<?php bloginfo('template_directory'); ?>/images/btn- ss.png" class="play" />` over slideshow thumbs?               <?php $new = new WP_Query(array ('post_type' => array('video', 'slideshow'), 'posts_per_page' => '5')); ?>        <?php while ($new->have_posts()) : $new->the_post(); ?>

 <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'framework'), get_the_title()); ?>">              <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { /* if post has post thumbnail */ ?>              <?php the_post_thumbnail('thumbnail-ws'); ?>              <?php }                  else { ?>              <?php get_the_image( array( 'custom_key' => array( 'Thumbnail' ), 'width' => 100 ) ); ?>              <?php }                      ?>              <img src="<?php bloginfo('template_directory'); ?>/images/btn-play.png" class="play" />              <?php the_title('
', '
'); ?>              <?php the_excerpt(); ?>

        <?php endwhile; ?>      Any help incorporating this conditional statement would be greatly appreciated. _Just in case anyone is wondering about my code, which probably isn't optimal: I have two tiers of thumbnails so all the old posts where I hadn't specified a Thumbnail will use Justin Tadlock's "get the image script". Also, the weird setup with the span tags is because I have the title and excerpt show on mouseover (with css, no js)._


Settings API - easiest way of validating checkboxes?

I'm using Settings API and I can't get checkboxes to work, if they're set to "false" they're not even being $_POST and that's the point. Stephen Harris & Chip Bennett explained it, but I believe their way is not simple enough (especially for me, not PHP-guy at all). Do I REALLY need a few custom PHP functions and custom-named submit buttons for every form just to get this simple thing working? My settings look much like:               register_setting('XX_theme_settings', 'XX_theme_settings', 'setting_validate' );          add_settings_section('theme_options', 'Theme Options', 'theme_options_generate', 'page1' );      add_settings_field( 'XX_Option1', 'Option 1', 'checkbox', 'page1', 'theme_options', 'XX_Option1', $args = array('id' => 'checkbox1', 'type' => 'checkbox') );     add_settings_field( 'XX_Option2', 'Option 2', 'checkbox', 'page1', 'theme_options', 'XX_Option2', $args = array('id' => 'checkbox2', 'type' => 'checkbox') );       Then I generate checkboxes with this callback function:               function checkbox($args) {         $options = get_option('XX_theme_settings');         echo '<input type="checkbox" name="'. $args['id'] .'" value="true"'; if($options[$args['id']]==true) { echo 'checked="checked'; }; echo '/>';         echo $args['type'];       }      Now, everything I need is a good validate callback:               function setting_validate($input) {        // Firstly it should find all fields of type == "checkbox"         // (I'm not sure why should I check which field was just being sent,         // is updating all the checkboxes from different sections a big no-no?        // it is much easier indeed.        // Now set the ones missing to false/0 and the rest to true/1.        // Then merge everything like below:             $options = get_option('XX_theme_settings');        $merged = array_merge($options, $input);          return $merged;       }      So the question is: **how to list all Settings Api checkboxes and then set the right ones to true?** I guess it'd look something like that:               $options = array(             array(                 'id' => 'checkbox1',                 'type' => 'checkbox',                 'page' => 'page1',              ),             array(                 'id' => 'checkbox2',                 'type' => 'checkbox',                 'page' => 'page1',              ),     );          function setting_validate($input) {        foreach($options as $option) {          if($option['type'] == "checkbox") {              //set it to 1 if sent          }        }             $options = get_option('XX_theme_settings');        $merged = array_merge($options, $input);          return $merged;       }      Thanks :) Here's how Chip Bennett does it exactly, but even with all these great comments I can't get how it exactly works.


How to do paging in the loop?

I used `single.php` for this code:               <?php $categories = get_the_category($post->ID);     if ($categories) {         $category_ids = array();         foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;         $args=array(             'category__in' => $category_ids,             'post__not_in' => array($post->ID),             'showposts'=>6, //Gösterilecek yazı adeti             'caller_get_posts'=>1         );         $benzer = new wp_query($args);         if( $benzer->have_posts() ) {             while ($benzer->have_posts()) {                 $benzer->the_post();         ?>
             <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>
           <?php } } wp_reset_query(); }?>      This code working, but I want to use pagination in the loop.


WXR xml files are being imported as a TXT files and showing up under 'Media'

I need to import a whole bunch of non-WordPress posts in to Wordpress. I would hope it would be pretty straight forward as there are no pictures or anything; it's basically just a bunch of text. I'm testing out the WordPress Importer plugin but I'm not having much luck, even just using dummy data. To remove all the variables, here's what I did... I exported all of my WordPress posts to the xml wxr file, removed all but one post with only text, replaced the post data with dummy text, resaved it and imported it. After I click 'Upload Files and Import', the body of the import WordPress turns white and nothing happens. I find that the file has been imported as a txt file with the body of the xml document and is located under Media. Can anyone offer any suggestions as to why this is happening. Update - Debug info: `Class 'DOMDocument' not found in /var/www/html/wp- content/plugins/wordpress-importer/parsers.php on line 61`


Twitter Bootstrap Use Collapse in Custom Post Type

I am using Bootstrap with Wordpress and I want to implement the collapse functionality in the content for single pages of a specific custom post type. I know I could create a shortcode, however, with hundereds of posts shortcodes are not going to be ideal. Is it possible to include collapse in the_content of the custom post type (custom-single.php). So when a user enters an .H2 with text below it .p it uses this for a collapse group. So in the custom-single.php I wrap the_content in a custom div id
<?php the_content(); ?>
      How I can associate the H2 and p with appropriate div classes for bootstrap. Is this possible?

                                        Collapsible Group Item #1

                   Anim pariatur cliche...

                                Collapsible Group Item #2

              Anim pariatur cliche...


Modify users.php query with multiple taxonomies

I've successfully created 3 taxonomies attached to the user object, using the registered_taxonomy and update_count functions of this code - https://gist.github.com/portfola/10750784#file-user-taxonomies-php (I don't need the rest as they're only relevant for taxonomies displaying an admin UI or taxonomy archive which I'm not). These taxonomies store which company, office and teams, each user is assigned to. I know the custom taxonomies are storing the data as I get multiple results back via the `wp_get_object_terms($user->ID,'company')` function. What I need is to be able to filter the users.php results by either one of or multiple of these custom taxonomies. I've created the additional form inputs found at the WP_List_Table and have also added the columns for each taxonomy. The only thing left to do is modify the pre_user_query. I don't think this is the right way to do as it's not having any effect on the results returned at all and I'm only beginner of MySQL. Here's my current code for modifying the query:               function preUserQuery($query) {         global $pagenow, $wpdb;         if(is_admin() && $pagenow == 'users.php') {             $query->query_vars['tax_query'] = array();             foreach(array('userCompany','userOffice','userTeam') as $queryVar) {                 if(isset($_GET[$queryVar]) && is_numeric($_GET[$queryVar])) {                     $query->query_vars['tax_query'][] = array(                         'taxonomy' => get_post_type($_GET[$queryVar]),                         'field' => 'name',                         'terms' => $_GET[$queryVar]                     );                 }             }         }         return $query;     }     add_filter('pre_user_query','preUserQuery',9999);


Host Images from Link

Recently, I imported all my post from Blogger, so all the images showing in the post currently reside on Blogger's server. I want to import/put all those images to my server and automatically change each link for each image. Since there are so many images and so many post I can not go one by one individually. Please guide me on how to do that or redirect me to a plugin that does this job.


Shows site under construction but comes up after I login to admin

I have a strange issue happening with a new site. It keeps going down and shows under construction, but after I login to WP admin, the site comes back up! Any suggestions as to what might be going on here? Thanks!


Last Update time in widget

I have a widget which can be updated every time with few values and admin update it on daily basis now how to get its last update time.


Wrong datatype for second argument error

I am getting a strange error on my Wordpress site. Does anybody know what is going on here? and how to fix this? The Error:               Warning: in_array() [function.in-array]: Wrong datatype for second argument in /biz/sportmedia.fi/html/wp-content/themes/sportmedia/template-artikkelilista.php on line 34          Warning: in_array() [function.in-array]: Wrong datatype for second argument in /biz/sportmedia.fi/html/wp-content/themes/sportmedia/template-artikkelilista.php on line 35          Warning: in_array() [function.in-array]: Wrong datatype for second argument in /biz/sportmedia.fi/html/wp-content/themes/sportmedia/template-artikkelilista.php on line 36          Warning: in_array() [function.in-array]: Wrong datatype for second argument in /biz/sportmedia.fi/html/wp-content/themes/sportmedia/template-artikkelilista.php on line 37      Template Code:               <?php     /*     Template name: Artikkelilista     */     get_header();     ?>

<?php the_title(); ?>
                      <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>                      <?php $kategoria = get_field('kategoria'); ?>                      <?php $args=array(                     'post_type'=>'post',                     'cat' => $kategoria,                     'posts_per_page' => 7,                     'paged'=>$paged                     );                  ?>                      <?php                  $temp = $wp_query;                 $wp_query= null;                 $wp_query = new WP_Query($args);                  ?>                      <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                     <?php $pfx_date = get_the_date( $d ); ?>                             <?php                                  $get_field = get_field( 'artikkeli-sisältaa-naita-medioita' );                                  $image = in_array( 'image', $get_field) ? 'active' : '';                                 $video = in_array( 'video', $get_field) ? 'active' : '';                                 $sound = in_array( 'sound', $get_field) ? 'active' : '';                                 $text = in_array( 'text', $get_field) ? 'active' : '';                             ?>                             <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php the_title(); ?>

                                         <?php if(!empty($sound)): ?>

                                         <?php endif; ?>                                         <?php if(!empty($video)): ?>

                                         <?php endif; ?>                                         <?php if(!empty($text)): ?>

                                         <?php endif; ?>                                         <?php if(!empty($image)): ?>

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

<?php echo get_the_date('d.m.Y'); ?>
                                     <?php edit_post_link(' Muokkaa artikkelia'); ?>

                         <?php endwhile; ?>

                         <?php                              if (($IE6 == 1) || ($IE7 == 1) || ($IE8 == 1)) {                             // Do fallback stuff that old browsers can do here                             posts_nav_link('  ', 'previous page', 'next page');                             } else {                             // do stuff that real browsers can handle here                             if(function_exists('wp_page_numbers')) : wp_page_numbers(); endif;                             }                          ?>

                         <?php else : ?>
Yhtään artikkelia ei ole vielä julkaistu.
                         <?php endif; ?>                         <?php $wp_query = null;                         $wp_query = $temp; ?>                         <?php wp_reset_query(); ?>                         <?php wp_reset_postdata(); ?>

         <?php get_sidebar(); ?>               <?php get_footer(); ?>


How to keep the /blog slug even in single post slug

I have a simple website on wordpress (latest version), assume example.org. I wanna have the user posts at something like example.org/blog/username/posttitle. So I need some levels: 1) example.org/blog (main blog page) 2) example.org/blog/username (username archive page) 3) example.org/blog/username/posttitle (single post page) I've seen a lot of old solutions that are mainly the same, but even if i set the permalink structure as /blog/%author%/%postname% or simply /blog/%postname% it doesn't work. I mean, it works, but when you visit a right generated url I get a 404. Solutions? Cheers,


Static HTML to WordPress migration

I have a static HTML site (about ten years old) which I am going to migrate to a Wordpress site. I have used Wordpress before but never as a migration target. From some initial background reading I have come up with the following process to perform the migration:   1. Check hosting provider/package for Wordpress suitability   2. Generate complete current site map   3. Make a complete backup of current site   4. Install Wordpress in subdirectory   5. Install Maintenance mode plugin and activate   6. Migrate content to Wordpress instance (looks like this could be painstaking..)   7. Install suitable theme   8. Customise selected theme with Logo/fonts/colours etc.   9. Deactivate maintenance mode   10. Make Wordpress site available from domain root   11. Delete old static html site files (The migration may take place over several weeks/months so I need the static HTML site to be available until step 10 is completed) In my naivety are there any pitfalls in the above process, or additional issues I have failed to consider? Are there any other accepted 'best practices' when performing this kind of migration? (I originally asked this question on Stack Overflow but I guess this is a more appropriate place for such a question)


How can I remove unwanted word on my WP site?

As this post will likely show, I am new at working with WordPress. My church website is built in WP. Recently I noticed that there is the word, "Array" that appears in the left upper portion of each web page just below the main banner. This seems to be a recent occurrence. I believe that this is the area where at one time there was an automatically updated date and time display. Here is the url for the site: http://lccut.org How do I remove this? Thank you in advance for your assistance. John


How to create custom WooCommerce 2.0 templates

I'm working on a site for a client who is using version 2.0.1 of WooCommerce plugin and I'm lost as to how I can create new page templates for it. With previous versions of the plugin is was simple, you just copied files from the "templates" folder into your theme folder and boom! But now, that folder is gone. The WooThemes documentation is still being updated to reflect the upgrade to 2.0 so that's no help. Any assistance would be more appreciated.


How to limit displayed posts on wordpress

How would I edit the following code, so that only 2 of the posts are echoed instead of 3                  <?php                                      global $more; $more = false; # some wordpress wtf logic                                      $num_of_posts = $wp_query->post_count;                                      $current = -1;                                          $cat_id = get_cat_ID(single_cat_title('', false));                                     if(!empty($cat_id))                                     {                                         $query_string.= '&cat='.$cat_id;                                     }                                      query_posts($query_string);                                      if (have_posts()) : while (have_posts()) : the_post(); $current++                                       ?>                                       <?php if($current == 0) { ?>


Set up Network Locally on a Flash Drive

I've previously used WAMP for developing WordPress themes locally using a WordPress Network using sub domains. Having to set it all up again every time I want to develop on a new computer is a pain, so I decided i wanted to do a portable installation, this way the only file I have to change when using a different computer is the local HOSTS file. I have Xampp portable running off a flash drive just fine. I also have WordPress 3.5.1 running on said installation just fine. However, when I run through WordPress's install to convert a clean WordPress installation to a WordPress Network (Add WP_Allow_multisite to the config, then run through WP's network set up, copying the required settings to the required files), it just won't take. The dashboard never adds the "My Sites" button to the dashboard, so I never get the ability to add new sites. (Yes, I tried clearing the Cache.) However when I go to Network setup again it does recognize that a network exists. I'm somewhat familiar with WordPress's MySQL tables, having poked through them before and manually edited values when moving installations between local and remote. When I checked the databases on one of these failed installations, it seems to me like some of the necessary tables for a WordPress network aren't being created during the Network installation. I spend around 3 hours double checking my hosts and VHosts, deleting the database, and reinstalling WP form scratch multiple times. As much as I love solving my own problems, it's time to ask others to look over what I have. Here's the files I am working with: ### httpd-vhosts.conf               NameVirtualHost *:80            <VirtualHost *:80>         DocumentRoot "/xampp-portable/htdocs"         ServerName localhost       </VirtualHost>            <VirtualHost *:80>         DocumentRoot "/xampp-portable/htdocs/mysite"         ServerName mysite.loc         ServerAlias *.mysite.loc         <Directory "/xampp-portable/htdocs/mysite">          Options Indexes FollowSymLinks Includes          AllowOverride All          Order allow,deny          Allow from all         </Directory>       </VirtualHost>      ### Windows HOSTS files               127.0.0.1       localhost          127.0.0.1       mysite.loc     127.0.0.1       www.mysite.loc     127.0.0.1       site1.mysite.loc     127.0.0.1       *.mysite.loc      ### wp-config.php               <?php     // ** MySQL settings - You can get this info from your web host ** //     /** The name of the database for WordPress */     define('DB_NAME', 'gmi_main_wp');          /** MySQL database username */     define('DB_USER', 'mysite_admin');          /** MySQL database password */     define('DB_PASSWORD', 'censored');          /** MySQL hostname */     define('DB_HOST', 'localhost');          /** Database Charset to use in creating database tables. */     define('DB_CHARSET', 'utf8');          /** The Database Collate type. Don't change this if in doubt. */     define('DB_COLLATE', '');          /**#@+      * Authentication Unique Keys and Salts.      *      * Change these to different unique phrases!      * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}      * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.      *      * @since 2.6.0      */     define('AUTH_KEY',         'jo`QznTiAC3?a/V($j9]3e){#*-IAK=ifHIOLk$bryzLCMtp@&`&EI@)r-i>$@vW');     define('SECURE_AUTH_KEY',  'HCm0;@[bv0 }tKMR~dtl6fZMQC-T6} k^tyP& nP7%s.ut ]R<:fO5+8jG$BX$6T');     define('LOGGED_IN_KEY',    'hkg@N&?;$}mq>qL`o&0*Ni<:Oc=K#)d:a`.pdareq`n0&;X6/o|6g2aCd#%jee%D');     define('NONCE_KEY',        'BZN6oCg7(.|$,Wsf!+4%KT,Xc=G&yLRE&283[<_;8 ~L9+HQ6?>AD~1O$6@AN1;;');     define('AUTH_SALT',        'y7Xx}F+U8hoMke-y|s!Mqum2GjSGoSi)As$]0%vqpZj/Gmg+-u_K+x6z(@^X@sTB');     define('SECURE_AUTH_SALT', '1(e`{l$EzdRjkQ}s9Z<g:fa|6X$RHz7d?L5r5q#O(EiVi&]03lgl{D~:~lM)jYF-');     define('LOGGED_IN_SALT',   'GhJ)gh7q3Vfl~zL,Ct1AoWt?gj5EhTcxI;:}?V^G#]354SIGg/;8+S=,qC_F%f2V');     define('NONCE_SALT',       'd2ee=WxWsm`^+KO}6$#fQ[S3fTGWy n$5`/0.fpK|nU1dq>e8j(.[7X!wS)[e>e}');          /**#@-*/          /**      * WordPress Database Table prefix.      *      * You can have multiple installations in one database if you give each a unique      * prefix. Only numbers, letters, and underscores please!      */     $table_prefix  = 'main_wp_';          /**      * WordPress Localized Language, defaults to English.      *      * Change this to localize WordPress. A corresponding MO file for the chosen      * language must be installed to wp-content/languages. For example, install      * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German      * language support.      */     define('WPLANG', '');          /**      * For developers: WordPress debugging mode.      *      * Change this to true to enable the display of notices during development.      * It is strongly recommended that plugin and theme developers use WP_DEBUG      * in their development environments.      */     define('WP_DEBUG', false);          /* That's all, stop editing! Happy blogging. */          /** Absolute path to the WordPress directory. */     if ( !defined('ABSPATH') )         define('ABSPATH', dirname(__FILE__) . '/');          /** Sets up WordPress vars and included files. */     require_once(ABSPATH . 'wp-settings.php');          /* Multisite */     //define('WP_SITEURL','http://mysite.loc');     //define('WP_ALLOW_MULTISITE', true);     define('MULTISITE', true);     define('SUBDOMAIN_INSTALL', true);     define('DOMAIN_CURRENT_SITE', 'mysite.loc');     define('PATH_CURRENT_SITE', '/');     define('SITE_ID_CURRENT_SITE', 1);     define('BLOG_ID_CURRENT_SITE', 1);      ### .htaccess               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^wp-admin$ wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^(wp-(content|admin|includes).*) $1 [L]     RewriteRule ^(.*\.php)$ $1 [L]     RewriteRule . index.php [L]      And finally a picture of the db Tables. I feel like some tables that should have been created are missing: ![](http://i.minus.com/i48qe2OEU9A3d.png) ## Edit: I enabled debug and now get the error "Constant MULTISITE already defined" on line 95. Line 95 is the line where I have define('MULTISITE', true). I'm wondering if somehow `is_multisite()` is returning false, causing the wp_settings file to echo define('MULTISITE', false), which causes the error. And THAT leads me to suspect that files like `load.php` and `functions.php` are not working properly… which points to my permissions set in the vhosts file. I'm using relative paths due to this being a flash drive install. And that is something that is different from previous installs.


How to register custom menu widget

I'm trying to register a custom menu widget programmatically with `wp_register_sidebar_widget`, but it doesn't appear in wordpress. I'm using remote call of that method (xml-rpc). Referring to codex I'm passing parametres like that to that method:               wp_register_sidebar_widget(         'custom_menu_widget-1',         'My name',         'WP_Nav_Menu_Widget',         array( 'description' => 'blogroll' )     );      It should create custom menu widget named 'My name', but it registers nothing. I think that third parameter `$output_callback` may be wrong, but I can't find nowhere, what callback should be for custom menus. I've got no output or error from that call, so I can't see what is wrong. Maybe I miss something or there is another way to register custom menu widget? I don`t want to edit function.php, I just want to register standard custom menu widget using wp methods.


Hide prices and checkout functionality in woocommerce

I know this question might be too broad, but I'm looking for a bit of direction. My client has a woocommerce store with 30-40 products. For whatever reason they do not want to sell online anymore, but they want to retain the product pages, information, etc. on their website. Is there a way, using hooks or otherwise, to hide things like prices, add to cart button, etc. in woocommerce? Or should I just edit the php template files?


Add segment to URL in htaccess

I want to edit .WordPress .htaccess file, add a segment to URL in the following fashion: Instead of:               http://www.example.com/mypost/      make it               http://www.example.com/coolstuff/mypost      How can I do that?


how to remove sidebar from particular one page

I am writing this code in page.php for removing the sidebar in one page               <?php if (is_page('x')) : ?>     <?php else : ?>     <?php get_sidebar(); ?>     <?php endif; ?>      ... where `"x"` is the ID of that page. but I am having a bit of trouble though the forum which is the page in question does not stretch across the whole page. how can I solve this problem?


Why are two functions over-riding each other?

I have function in my plugin that is:               add_filter('comment_text', 'commentimage_comment_text');     function commentimage_comment_text($comment = '') {        $options = get_option('commentimage');       $id = get_comment_ID();            $images = $options['images'];       if (!isset($images) || !is_numeric($images)) $images = 1;         $url = get_option('siteurl');         for ($i=0; $i<$images; $i++) {           if (file_exists(ABSPATH . 'wp-content/comment-image/' . $id . ($i==0?'':('-'.$i)) . '-tn.jpg')) {              $comment .= '

';           }         }       return $comment;     }      Now it is showing a successful image uploaded by my viewers. I want my viewers to have the option of rating them, so for that I write in my plugin just below the above line the following code:                add_filter('comment_text', 'commentimage_comment_text2');      function commentimage_comment_text2()      {        $rtt= "
Rating";        return $rtt;      }      Then my pictures are gone and it shows text rating - I will change the text rating to my desired needs once I get the answer on how to overcome over writing.


How to display a link in the footer section

i'm using the BAAP Mobile version plugin and the footer link that switches between desktop and mobile version is being displayed outside of the wrapper>footer divs. Is there a hook or a method to have the switcher link display in the footer section? This is the function that creates and displays the links in the wpmp_switcher.php file.               function wpmp_switcher_wp_footer($force=false) {       if(!$force && (get_option('wpmp_switcher_mode')=='none' || get_option('wpmp_switcher_footer_links')!='true')) {         return;       }       switch (wpmp_switcher_outcome()) {         case WPMP_SWITCHER_MOBILE_PAGE:           print wpmp_switcher_link('desktop', __('Switch 2 our desktop site', 'wpmp'));           break;         case WPMP_SWITCHER_DESKTOP_PAGE:           print "<p>" . wpmp_switcher_link('mobile', __('Switch to our mobile site', 'wpmp')) . "</p>";           break;       }     }


Does codex.wordpress.org use a plugin of some sort? If so what plugin?

I'm attempting to set up a wiki within a Wordpress install and love the way codex.wordpress.org is set up. Are they using a specific plugin to accomplish that or just well structured pages? Is there a similar plugin available to users?


Add/overwrite a parameter on an existing post type/taxonomy

I have several sites with Custom Post Types and Taxonomies registered by different plugins. Is there a way to add or change a parameter like this               "'rewrite' => array( 'hierarchical' => true )"      by adding something to functions.php—without completely re-registering the type/taxonomy? I want to continue to use certain plugins to manage types and taxonomies, but not all parameters are provided.


Set a background color per image added to a post

When using a modal window such as lightbox or shadowbox to display a post's images, client would like to be able to choose the background color that would be used for the modal window according to the image to be shown: color would be either black, white or grey. I'm thinking such hack should be done via a plugin but i didn't find any, so i guess i should do it myself. It scarces me a bit: where should i store the chosen value? What hooks ? Any help would be welcome.


Disabling plugin but wpenqueue is not available

I'm trying to disable a few plugins when my mobile theme is loaded. I read somewhere about using this particular function in my mobile theme functions.php file to remove scripts and css.               //Disable plugins     add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );          function my_deregister_javascript() {         wp_deregister_script( 'smp_common','smp_cookie','smp_colorbox','smp_meerkat','jquery','query-ui-sortable' );     }     //Deregister styles     add_action( 'wp_print_styles', 'my_deregister_styles', 100 );      Going by the above, i've been able to remove a few scripts, but unable to remove the 'share post' plugin as wp_enqueue is not mentioned in the script. Is there an alternative to disable this plugin?


How do I add pricing fields to a Gravity Form?

I need help. I am trying to create an album order form with my gravity form plug in and am looking to add a pricing field. I have googled the heck out of this topic and can't seem to figure out how...even on Gravity Form's blog! Thanks in advance, Jaime


How WordPress converts URL to $query_string

My home.php shows a list of (N) posts and << Previous & Next >> links. When clicked, I want to fetch previous/next list of (N) posts using Ajax. This is: I do NOT want to load the entire page. I just want to get the posts' list and append it to current. For this I make an ajax request and send href (URL) as parameter. The problem is I do not know how WordPress converts a URL to global $query_string. I want to reuse WordPress' tested code instead of writing my own. Please help For example: I want to fill $query_string for this URL: http://example.com/page/2/?location=boston


List categories of a post hierarchically?

Let's say I got the following categories:               Style       |       + Shoes       + Pants      If I make a post and put it in the Style and Shoes category, it will list them alphabetically instead of hierarchically. So it would list it as Shoes, Style instead of Styles, Shoes. How can I do this? I tried using "the_category('> ', 'multiple')" but that outputs "Style, Shoes, Style" Thanks!


Wordpress Ecommerce Chase Paymentech Integration

Just wondering, If any body have integrated Chase Paymentech Payment Gateway with WordPress for Shopping Cart purpose?


Change the author posts link using custom user metadata

I am trying to use a custom value to be used in the author posts URL instead of the `user_nicename` which defaults to `user_login` in the pretty permalink structure. So far I managed to do that but now the new URL `/author/custom_user_nicename` generate a 404 error while the old one `/author/user_login` still works. The code I used in theme `functions.php` file:               add_filter('author_link', 'update_author_link',10,2);     function update_author_link($link,$author_id) {         if (FALSE === strpos($link, '?author=')) { // only if pretty permalinks used             $position = strrpos($link, '/');             if (strlen($link) == $position + 1) { // check and remove trailing slash                 $link = untrailingslashit($link);                 $position = strrpos($link, '/');             }             $link = substr($link, 0, $position+1);             $link = $link . get_the_author_meta('custom_author_nicename', $author_id);             return user_trailingslashit($link);         }         return $link;     }      I tried to flush the rewrite rules by going to settings -> permalinks and save but that did work as well. do I need to update or modify anything else for the new author URL to work? Thanks.


Help with Wp Query

I have a custom post type, and using wp query I am wanting to display posts only by authors with a specific role. How can I go about doing this?


How can I redirect mobile users to diff url, but also allow them to come back to full site

this is pretty straight forward: How do I redirect mobile users to /mobile, but still allow them to click a "Full site" button and see the full site without being redirected again back to the mobile site? I have played with a bunch of the plugins that say they do this, but none seem to handle the second step. They redirect to the /mobile . but if a user wants to go to the full site, it tries then redirects back to mobile. I am running WP3.0.1


How to order images in a post in Wordpress 3.3?

In wordpress 3.2 when uploading images to a post, I would get a Gallery that is linked to the post. That is, I could see in the media uploader of the post a tab that contains only the images of this post, and there would be a place to mark the order of the images I wanted for the post. In wordpress 3.3 I can only see the media library of all the images I have ever uploaded, and I cannot order them in any way. Is there a way to order the images related to a post? Have I somehow managed to upload the images incorrectly so that they are not attached to a post? Any help would be appreciated.


Dropdown primary navigation menu not working

I have installed a theme on WordPress added pages, created a custom menu called Primary Nav. I have then assigned this as my Primary Menu. I have child pages and the menu looks like this. I have looked at the WordPress resources to find a solution but it seems as though I have followed the instructions on creating drop-down menus. ![enter image description here](http://i.stack.imgur.com/xuIM6.png) However when I go to the previewDNS site the drop down doesn't work. The code is below, if another area is required please let me know where on the source page I will find it and I will add here.

About

Portfolio

Packages

Photography Prices

Wedding Albums

Signature Frames

Wedding Stationery

Blog

FAQ’s

Contact


Making the Content Editor Box Bigger in 2013

I know that question have been answer, but answer is no more current with wp 3.5.2 (or 3.6) and many plugin, qtranslate first... i dont have the "size of the post box" in Settings > Writing. Yes i can manually extent the box with the lower right triagle, but when saved, it's back to super small 2-3 line in height So the question, how do i change it PERMANANTLY to 30 line in height ?


a plugin to share a post to social networks via admin?

I'm not looking for a share this post button for the front end. I've seen a couple of similar topics here but not exactly what I'm after. What I would like is a plugin which offers the options in the admin panel to post a link my post to a facebook page, tweets it, perhaps takes the images and sends to flickr and so on. Something which would offer me some controls and configuration to make the oauth connections and then gives me extended sharing features when I make a new post. Has anyone seen anything like this? I'm a bit overwhelmed when I look through the plugin directory searching for social plugins... Thanks for any help whatsoever..


How can I create a smarter .htaccess file that will add a directory?

This is my current .htaccess file:               Options +FollowSymLinks     RewriteEngine on     RewriteRule (.*) /directory/ [R=301,L]      And "directory" is where my wordpress install is. So this simply redirects people from the root domain to the directory. What I would like to do is create it so any information added to the url is passed through when the directory is added. SO `http://yoursite.tld/page` becomes `http://yoursite.tld/directory/page/` I know this is probably a snap for someone with more experience with regular expressions. Unfortunately I haven't been able to track down the info with standard web searches. Appreciate the help...


Change page title from plugin

Is possible to change page title on the fly from plugin? I've try global $post, but seem like plugin runs after. Any Ideas? Edit: Im writting some pages on the fly, based on same page / post, so every page show the same title. Looking a way to do via shortcode or writting my own plugin/function


Exclude custom taxonomy tag from loop

I have the following code at the beginning of a loop:               <?php query_posts('showposts=3&cat=84'); ?>     <?php $posts = get_posts('category=84&numberposts=3&offset=0'); foreach ($posts as $post) : start_wp(); ?>      I have a custom taxonomy called "display," with a tag called "featured- slider." In this loop, I want to include everything from category 84, but I want to exclude everything with a "featured-slider" value in the "display" taxonomy. How would I rewrite the two lines above (query_posts and get_posts) to correctly exclude the custom taxonomy? thank you


Child parent relationship inside WP DB

i am a .net user so i am unfamiliar with not using a foreign key inside of the database. On my WP application, user's are able to create videos on the application, the videos are stored on a different server, and I am just using a simple UI to gather video information such as src value and title of movie, ect... I am adding a custom table to the WP DB, "user_video" it will hold the user's video data. How does Wordpress create a child-parent relationship between tables? (E.g. user & usermeta) I am just wondering how I can create a child table to hold video data for that specific user?


qTranslate conflicts with SEO-plugins

I have an issue with a clients site. I installed the Yoast SEO-plugin (which i find to be great), but when i activate it i get lot's of error messages (See below).               /storage/content/10/104610/mydomain.com/public_html/wp-content/plugins/qtranslate/qtranslate_hooks.php on line 54 Notice: Undefined index: language in /storage/content/10/104610/mydomain.com/public_html/wp-content/plugins/qtranslate/qtranslate_hooks.php on line 55 Notice: Undefined index: language in /storage/content/10/104610/mydomain.com/public_html/wp-content/plugins/qtranslate/qtranslate_hooks.php on line 61 Notice: Undefined index: in /storage/content/10/104610/mydomain.com/public_html/wp-content/plugins/qtranslate/qtranslate_hooks.php on line 61 Notice: Undefined index: language in /storage/content/10/104610/mydomain.com/public_html/wp-content/plugins/qtranslate/qtranslate_hooks.php on line 111 Notice: Undefined index: language in /storage/content/10/104610/mydomain.com/public_html/wp-content/plugins/qtranslate/qtranslate_hooks.php on line 111      This error message appears with every SEO-plugin i've tried What causes this, and how can i solve it?


Email from my theme's contact form doesn't get the reply-to address right

I'm using a theme that has a built in contact form, which has some options (like where the form is sent) set through the OptionTree plugin. What's happening is, the email gets sent, but the reply-to is a made-up server address at the webhost, rather than what the visitor's self-stated email is. This is really weird. When I look at the code, it all seems sound:               //If there is no error, send the email     if(!isset($hasError)) {         $emailTo = get_option_tree( 'contact_page_email' );  /*Put your own email address here*/          $body = "Name: $name \n\nEmail: $email \n\nSubject: $subject \n\nComments:\n $comments";         $headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;              mail($emailTo, $subject, $body, $headers);         $emailSent = true;     }      It looks like the code is supposed to set reply-to to be the person's stated email address. But our mail server, for some reason, wants to set the reply for all form responses to a server-generated address. The reply-to address ends up being clientaccount@s4-vancouver.accountservergroup.com. Does anyone have any ideas why this might be happening? The code looks sound to me -- I just can't figure out why when we receive mail from the server from the contact form, it appears to come from an address that isn't the client's email. Thanks! Rob


How to add a custom page template selector to a custom taxonomy?

I am trying to add the custom page template selector that can be found in the "edit page" screen for pages to a custom taxonomy. The custom taxonomy is product_cat created by WooCommerce. I am using the Tax-meta-class created by Ohad Raz of en.bainternet.info. This allows me to add a meta box to the the "edit product categories" screens. Ohad Raz has also authored a plugin that adds a custom page template selector menu to the "edit category" screens. However it does not show for the custom taxonomy. I can get the selector menu to out put the templates by adding:               <?php page_template_dropdown($template); ?>      to the Tax-meta-class.php. It out puts the proper values that i can use later in a template redirect but it won't save. The built in way to add a drop down selector has you choose the options values and names by adding them to an array like so:               array('selectkey1'=>'Select Value1','selectkey2'=>'Select Value2')      Which outputs this:               <option value='selectkey1'>Select Value1</option>     <option value='selectkey2'>Select Value2</option>      if I use the code:               $templates = get_page_templates();     foreach ( $templates as $template_name => $template_filename ) {        echo $template_name . ' ' . $template_filename . ' ';     }      I can get it to output:               Contact Page contact-page.php EVENT Pageevent-page.php Product     Icon product-icon.php Product SubFeature product-subfeature.php     Lockable Dowel template-lockable-dowel.php      I was hoping there would be a way to store these values in an array that can be used in place of:               array('selectkey1'=>'Select Value1','selectkey2'=>'Select Value2')      This way it will be using the Tax-meta-class how it should be and everything should work fine. I am fairly new and all self taught so please excuse me if I have not asked in the proper way. Thank you for taking the time to rean my question. Sincerely, Leon


Add the custom post term to the custom post title

what I need is this: add a term from a custom post to the post's title. Like this: Custom Post title - term Right now I have:               $terms_of_post = strip_tags (get_the_term_list( $post->ID, 'my-custom-term', '','', '', '' ));          elseif ( is_single() ) { single_post_title(); {echo ' ('; echo $terms_of_post;  echo ')';} ; }             I don't know why it doesn't work, but it seems it should. I have found Copy a Taxonomy Term into the Post Title for a certain Custom Post Type, which could be 90% of the answer, but instead of replacing the post title with the taxonomy title, I need to add it to the title. Thanks a lot!


Subcategory is displayed before Parent Category

I'm current using the following code to echo the categories of my post :               <?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?>       So, for example, I have post with a parent category HOBBIES and a sub category MUSIC. When this code is used, it is displayed as               MUSIC HOBBIES      While I want to display it as,               HOBBIES MUSIC      How can i achieve this? BTW, the cat id for hobbies is 7 and cat id for jazz is 8.


How to sort by most watched in X days/months

So I managed to loop my posts in a page template, ordering the posts by most viewed. The query posts string looks like this               $wplover_home = new WP_Query('posts_per_page=18&v_sortby=views&v_orderby=desc&paged=' . $paged);          while ($wplover_home->have_posts()) : $wplover_home->the_post(); ?>      Now to my question. If I wanted to sort the posts by most viewed in X days or months, how should the string look like then? The documentation for the plugin (wp-postviews) doesn't have anything on this. Thanks in advance :-)


Limit of char count in WP custom fields

does anyone of you know what is the limit of chars count which can be stored in to database via WP custom fields? Let's say that I would want to add to custom field 20 000 chars. Would it be problem?


Filter a pluggable function

The following function is pluggable as it contains a filter :               // Make function pluggable/overwritable     if ( ! function_exists( 'wpsight_layout_images' ) ) {              function wpsight_layout_images() {                  $layout_images = array(                 'show_on_single'         => true,                 'size_archive'           => 'post-thumbnail',                 'align_archive'          => 'left',                 'size_single'            => 'post-thumbnail',                 'align_single'           => 'left',                 'size_widget'            => 'post-thumbnail',                 'align_widget'           => 'left',                 'size_archive_listings'  => 'post-thumbnail',                 'align_archive_listings' => 'right',             );                  return apply_filters( 'wpsight_layout_images', $layout_images );              }          }      My question is the following. Lets say I need to change the value of the two last variables `size_archive_listings` and `align_archive_listings` using the filter. Do I have to copy over the whole function or can some variables be changed independently ? What is the proper of using `add_filter` from a child theme functions file in this situation ?


Protect Uploads in Multisite

I am using WordPress multisite (3.3.1) and am trying to protect uploads from certain blogs from being hotlinked and directly accessed. This is loosely related to How to Protect Uploads, if User is not Logged In?, but I only want the uploads to be accessible through scripts running on the server (IE. the server alone can display/serve uploads), so the content can be protected by WordPress user-rights. For example, I have a filed called _40c.jpg_ located at _localhost/files/2011/07/40c.jpg_ ; I want the file to show up **only** when called by HTML on the local domain (here: _localhost_ ). So **not** on any other site on the WordPress Network, any other domain or when accessed directly (IE. visiting _localhost/files/2011/07/40c.jpg_ ). Preferably, this would be done by using WP_Rewrite within functions.php of the theme for this site; as that would easily limit the impact to just that site. But using the .htaccess in WordPress root also is a viable option, though I assume that would mean that the domain itself would have to be specified there (IE. _localhost_ ). Any suggestions on how to accomplish this? I've had very little luck through searching StackExchange, WordPress.org and Google.


Cannot access non-wordpress subdirectories as wordpress overrides them with a 404 error

I refer to this question previously asked and not suitably answered: Wordpress overriding actual subdirectories and also Non "Wordpress" pages/code getting 404 error. I have the same problem and I have tried nearly everything I found on the net. It's definitely related to having permalinks turned on in the wordpress. However, I have put a new .htaccess file in the subdirectory with: RewriteEngine off and the problem still exists. Even if I completely delete the wordpress .htaccess file the problem still exists. I have also tried some other suggested solutions such as ErrorDocument 401 "Unauthorized access" and ErrorDocument 404 "Unauthorized access" and Redirect 301 /mysubdirectory http://www.mydomain.com/mysubdirectory/index.html in various locations all to no avail. Can someone please offer another solution? The only way I can fix it is to turn permalinks off but we need them to be on. Thanks, Nicole


How to deal with the confliction between PHP-Markdown and MathJax?

I use PHP-Markdown plugin in WordPress. In order to show the formula beautifully, I add some code to use MathJax. Like this:               <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>     <script type="text/x-mathjax-config">     MathJax.Hub.Config({         extensions: ["tex2jax.js"],         jax: ["input/TeX", "output/HTML-CSS"],         tex2jax: {         inlineMath: [ ['$','$'], ["\\(","\\)"] ],         displayMath: [ ['$$','$$'], ["\\[","\\]"] ],         processEscapes: true         },         "HTML-CSS": { availableFonts: ["TeX"] }     });     </script>      But something wrong happens. Once my formula contains at least two underlines, the MathJax doesn't work. Such as `$$P_1, P_2$$`, and the words between the two underlines will be transformed to italic. The formula will be transformed by PHP-Markdown first, and it can't be transformed by MathJax again. Could you help me?


Set Post Thumbnails in Percents

I've built this responsive site on WordPress and got a little curious as to how I can set the post thumbnails in percentages. Any help would be much appreciated.


Where does the 404 redirection happen?

Can someone please tell me where the 404 redirection occurs? I am wanting to redirect to a custom template.php instead of the 404 page. Is this possible to do? If it is can some one provide me with a solution. Thanks Ravi


How to add media from front-end to an existing post and edit file title

with the code from this question: run ok, but I need add one input line to write the title of the file attach and save this title in media when upload this file.


Problem getting current post tags to show in a widget

I have tried tons of examples and suggestion on this topic but I can not get them to work. What I am trying to do is display the tags associated with the current post in a widget. I have built the widget and the widget works fine but I can not write the code to query the posts tags and display them. I understand the basics that needs to be done to get post meta from outside the loop but I can not pull the exact code together. Can someone start me off by showing me a piece of code to get the current post tags and display them from outside the loop? I can handle making the output look fine.


What server settings are required to import WordPress XML file

I am trying to import my site using the WordPress import XML page. My XML file is 7mb so when I try to import it I receive a "500 Internal Server Error" page. I read some other posts and tried using the "WordPress WXR File splitter" and tried to split the files into files only 300kb each. Tried to import again and still receive the 500 error page. I am on a VPS server so can change settings if required. Where would I find the error log to view what is going on and do I need to change any server settings to get WordPress to import my XML file. Thanks.


Page template that uses lightbox to display post images

I have created a page template that displays the featured image for all posts of a certain custom post type. It uses a normal loop that is querying that specific custom post type. The thumbnails are being displayed using `<?php the_post_thumbnail('project- thumb'); ?>` I now want to use a lightbox to display the rest of the images in the post. I believe that I need to use `<?php wp_get_attachment_image_src(); ?>` For some reason I can't quite get my head around it. Can anyone point me in the right direction? Thanks in advance!


Can I start to build a site before choosing/registering its domain?

I am a photographer and want to build a site for a specific part of the photography market. I have not yet decided on the domain name, but would like to start building the site (as I know what content I want on it). Can I build a site before deciding on a domain name for that site? And if so, where can store this site, if not on the net at its (yet unchosen) domain. I realise that ideally I would just choose a domain and get building, but choosing the right domain is taking some time so I want to start building so I can be ready to go once I have settled on the domain. I have a web host who has Fantastico WP installer. Thanks, Cormac


Add a minimum word count to Excerpt (and how to force Excerpt as a rule for WyPiekacz)

How do I add a minimum word count to the Excerpt field before the post can be sent for pending review? I want to require content in the Excerpt field. And also, how do I add the Excerpt field as a condition to the WyPiekacz plugin? WyPiekacz is a plugin that checks if posts that are submitted for review satisfies a set of rules.


Add custom data (field) to sidebar widgets for later display

I am building a theme that allows widgets to be dragged & dropped, essentially turning WP into a desktop-like environment where the admin controls what "apps" are available via the widget panel. This is going reasonably well, except that it would be nice is if there were a way for the admin to store starting locations for all of the widgets (and presumably, more meta-data later) In practical terms, this means I want 2 custom fields to appear on each widget in the admin panel, and then for there to be a hook to spit that data out when the widgets are printed on the page (in my case as some inline style values). I am building this "desktop" using home.php I am not sure if wordpress is actually built to do this, but it seems vaguely plausible. Any thoughts? Thanks!


How to pass a search $_GET parameter to a new custom search page?

So far in my wordpress installation I have a complete wordpress search page that I can call by going to: `/?s=mysearchstring` And this searches through wordpress pages containing the "`mysearchstring`" string. So I have created a new page "Custom Search" (`/custom-search/`) and assigned a template file `custom-search.php` (same code as `search.php`). How can I add a keyword parameter to this? `/custom-search?s=mysearchstring` doesn't quite work, it only shows 404 Page Not Found, while `/custom-search/` displays a search page as an only result. `custom-search.php` **code** :               <?php     /*     Template Name: Custom Search     */     //Post ID         global $wp_query;         $content_array = $wp_query->get_queried_object();         if(isset($content_array->ID)){             $post_id = $content_array->ID;         }         else $post_id=0;          $template_uri = get_template_directory_uri();          //Search         $allsearch = &new WP_Query("s=$s&showposts=-1");         $count = $allsearch->post_count;         wp_reset_query();         $hits = $count == 1 ? $count." ".__("hit for","goodweb") : $count." ".__("hits for","goodweb");          get_header();      ?>      along with the html listout. What can I do to pass the parameter search query to this page?


Timthumb script being compromised - What precautions to take?

Read an article about Timthumb script being compromised making WP installations vulnerable. Source here Taking a look at timthumb.php, There is the following function, which I presume is the culprit.               function checkExternal ($src) {              $allowedSites = array(             'flickr.com',             'picasa.com',             'blogger.com',             'wordpress.com',             'img.youtube.com',         );      Since my site is highly customized (therefore is complicated to update timthumb), would it suffice to delete those external domains as all the images are hosted on my server and hence doesn't require any of the 3rd party domains?


What does making sure "that your theme is Wordpress header and footer tag enabled" mean?

I am trying to get this plugin to work (http://wordpress.org/plugins/prettyphoto/), and there is a reference to: > Make sure that your theme is WordPress header and footer tag enabled > otherwise this plugin won't work. I don't understand what is meant by 'header and footer tag enabled'.


Force WP to use a certain search template

Any way to do this? I'd like for all the search results to be run through wp advanced search ( https://github.com/growthspark/wp-advanced-search ) so they appear on the wp advanced search page template instead of the default way provided by my theme.


Best way to save horoscope data

I'm workin on a website that's goin to have two horoscope sections:   1. The normal zodiac - Updated weekly   2. The chinese horoscope - Updated yearly ### The Normal Zodiac This section will have pages for each sign of the zodiac with informations like **current week forecast** , color, gem, best month day and etc. ### The Chinese Horoscope This section will have pages for each sign of the zodiac with informations that will be updated once a year and will have informations like color, gem and etc. as well # The question Should I create a **custom post-type** for each type of zodiac and create single posts for every sign or maybe I can fit all this information inside a good **Pages** structure? And what about some **custom taxonomies** to hold the color, gem, and extra info of each sign? I don't think it's a good idea because there's no search form, filter or something like that to use these informations as taxonomies. What do you guys think it's a good way to store this data without abusing of the system and - yet - keeping it easly maintanble for the site owner?


Newer/Older posts links display same posts on every page

I am using a plugin called "Types" to generate custom post types for drink/food recipes. I want to show booth drink and food recipes on the same page. The posts are displaying fine, but for some reason, when you click "newer posts" or "older posts" it will bring you to a new page, but the new page will have the same posts as page 1. Anyone have any ideas? Thanks in advance! Here's my loop:

             <?php query_posts( array('post_type' => array( 'recipe', 'drink-recipe' ), 'cat' => array('12','8'), 'showposts' => 5 )); ?>             <?php if( have_posts() ): ?>             <?php while( have_posts() ): the_post(); ?>             <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
                 <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" style="background-image:url('<?php echo $image[0]; ?>')">

<?php the_title(); ?>

<?php the_time('F j, Y') ?>
                         <?php echo the_excerpt(); ?>                         <div href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="button">Read more

             <?php endwhile; ?>

         <?php previous_posts_link(__('Newer Posts »','blog')) ?>         <?php next_posts_link(__('« Older Posts','blog')) ?>
             <?php else: ?>

<?php _e('None found.','404'); ?>

          <?php endif; wp_reset_query(); ?>          <?php get_footer(); ?>


How to set an upload directory for each media type?

Is there a way I can set a custom upload folder for each media type? for example: .PNGs should be saved in uploads/png, .GIFs in upload/gifs


Using a plugin class inside a template

I am writing a plugin to send an invitation to a friend which opens up a form when a link is clicked. I encapsulated all the functions in class by following the code given in the Report Broken Video plugin by @toscho. The relevant code is below:               /*     Plugin Name: Send Invitation     Plugin URI: http://w3boutique.net     Description: Emails a the link of the current page to a friend     Author: Nandakumar Chandrasekhar     Version: 0.1     Author URI: http://w3boutique.net/about-nanda.html     License: GPL2     */          // include() or require() any necessary files here          // Settings and/or Configuration Details go here     define('SEND_INVITATION_MIN_WORDPRESS_VERSION', '3.1.1');          define('SEND_INVITATION_PLUGIN_URL', plugins_url('', __FILE__));          add_action( 'init', array( 'SendInvitation', 'nc_sendinvitation_init' ) );          class SendInvitation {              protected $nonce_name = 'nc_sendinvitation';         protected $post_url = '';              public static function nc_sendinvitation_init() {             new self;         }              public function __construct() {             add_action( 'init', array(&$this, 'nc_sendinvitation_head' ));             add_action( 'init', array(&$this,  'nc_sendinvitation_check_wordpress_version' ));            add_action( 'init', array(&$this, 'nc_sendinvitation_form_action' ));            //$this->post_url = $this->nc_sendinvitation_get_post_url();        }             public function nc_sendinvitation_head() {            wp_enqueue_script( 'jquery' );            wp_enqueue_script( 'send_invitation_js',             plugins_url( 'js/send-invitation.js', __FILE__ ),             array( 'jquery' ) );                 wp_enqueue_style( 'send_invitation_css',             plugins_url( 'css/send-invitation.css', __FILE__ ) );        }             public function nc_sendinvitation_check_wordpress_version() {            global $wp_version;                 $exit_msg = 'Send Invitation requires version '         . SEND_INVITATION_MIN_WORDPRESS_VERSION         . 'or newer Please     update!';                 if ( version_compare( $wp_version, SEND_INVITATION_MIN_WORDPRESS_VERSION, '<') )            {                 exit( $exit_msg );            }        }             public function nc_sendinvitation_form_action() {                  $action = '';             if ( $_SERVER['REQUEST_METHOD'] != 'POST' )             {                  $action = $this->nc_sendinvitation_get_form();             }             else if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {                 $action = $this->nc_sendinvitation_handle_submit();             }             return $action;        }             public function nc_sendinvitation_get_form() {            // Start the output buffer, prevents content being output directly into            // script, instead it is stored in a buffer which can then be flushed            // to allow the include file to be stored in a variable            // See http://www.codingforums.com/showthread.php?t=124537            ob_start();            include('send-invitation-form.php');            $send_invitation_link = ob_get_clean();                 return $send_invitation_link;        }             public function nc_sendinvitation_handle_submit() {              if ( isset( $_POST['form_type'] ) && ( $_POST['form_type'] == 'nc_sendinvitation' ) ) {                 $to = 'navanitachora@gamil.com';                 $subject = 'Invitation to SwanLotus';                 $message = 'Navanitachora invites you to take a look at this link';                 wp_mail($to, $subject, $message);                 $result = 'Email was sent successfully';         }         else {             $result = $this->nc_sendinvitation_get_form();         }         return $result;     }          public function nc_sendinvitation_get_post_url() {         global $post;         $blog_id = get_option('page_for_posts');         $post_id = '';         if (is_home($blog_id)) {             $post_id = $blog_id;         } else {             $post_id = $post->ID;         }              return get_permalink($post_id);     }     }     /* End of File */     ?>      I am at a loss as to how to use this class in my template so that I can display the form. I know that I need to instantiate the class but I am not sure where to put the code and how to access the object so that I can use it in my template. I have knowledge of OOP but have not used it in this context before and require a little bit of step by step instruction. Many Thanks.


Display Gallery Images from Custom Post Type

I want to display all the images added as gallery in a post with prettyphoto class. I am using this code.                   <?php             /* The loop */             while ( have_posts() ) : the_post();                 if ( get_post_gallery() ) :                     $gallery = get_post_gallery( get_the_ID(), false );                       /* Loop through all the image and output them one by one */                     foreach( $gallery['src'] AS $src )                     {                         ?>                           <a href="<?php echo $src; ?>" rel="prettyPhoto[pp_gal]"><img src="<?php echo $src; ?>"  alt="Gallery image"  />                          <?php                     }                 endif;                 endwhile;         ?>      Its is displaying the photos but it is showing only thumbnail as src. I want to display Full Image. How can i display full image instead of thumbnail ?


Disable / Deregister all JS from all plugins

How can i disable all js files from plugins and load one single js file which i have combined and compressed ? Is there any way ?


import (migration) user database to wp-users

I am having hard time for importing to user-meta and post-meta from my non-wp- tables. I am trying to do db migration from user table and post table to WordPress tables. So it might be   * user table to wp-users and wp-usermeta   * post table to wp-posts and wp-postmeta I have been trying to find good plugins but it's all limited. (only basic information) My old user table has all of users information on **only 1 row (1 line)** such as `phone number, mobile, DOB..` etc. These have to be on user-meta table. Old user tables and wp-users are on same database now. How can I insert user information from old user table to wp-user(for basic information) and wp-usermeta (for extra information)? Is it possible to make it with PHP coding? (because it's on same database) I am trying to figure it out how to do with php coding or something else. If anyone knows can you advise me a sample coding? or anybody knows any good plugins? all of them I found are not enough to put all of user information.


Display the first post's comments of category in comments.php template

I want the display the comments from first post of the category only. Example; Category   - Post 1 (2 comments)   - Post 2 (1 comments)   - Post 3 (5 comments)  If I am reading the **Post 2** or **Post 3** , I should see **2 comments** of the first post. How can I code this from template files? Thanks for your helps.