title: Converting a working AJAX form to work with Wordpress

text:
I have a working html form with jQuery validation and have been submitting the data with AJAX, I am now trying to copy this form in to my own Wordpress theme, but I can't see where I am going wrong in using AJAX in Wordpress. I am referencing subscribe.js in my headerand this is my form:
         <input type="text" id="emailsub" class="text-input" name="email" placeholder="your email address" />         <input type="submit" src="<?php bloginfo('template_directory'); ?>/images/send.jpg" alt="Send" width="37" height="27" name="#" id="submitsub" class="contactbutton" />

      I am using some jQuery validation, but here is the AJAX:               $.ajax({             type: "POST",             url: "http://mywebsite.co.uk/wp/wp-admin/admin-ajax.php",             data: {                 action: 'ajaxfunction',                 email: email,             }   ,             success: function(msg) {                      //alert(msg);                      // Check to see if the mail was successfully sent                 if(msg=='Mail sent') {                     // Update the progress bar                     $('.email_wrap #formSubProgress').html(' Thankyou!').delay(2000).fadeOut(400);                          // Clear the subject field and message textbox                 //  $('.email_wrap #subject').val('');                 //  $('.email_wrap #message').val('');                 } else {                     $('.email_wrap #formSubProgress').html('');                     alert('There was an error sending your email. Please try again.');                 }                      // Activate the submit button                 $('.email_wrap #submitsub').attr("disabled", "");             },             error: function(ob,errStr) {                 $('.email_wrap #formSubProgress').html('');                 alert('There was an error sending your email. Please try again.');                      // Activate the submit button                 $('.email_wrap #submitsub').attr("disabled", "");             }         });      And my functions.php:               add_action('init', 'add_contact_script');     function add_contact_script() {     wp_register_script('contact', get_bloginfo('template_directory') . '/subscribe.js', array('jquery'), '1.0' );     wp_enqueue_script('contact');     }     function ajax_contact() {     if(!isset($_POST['email'])        ) {      die('Error: aaaa Missing variables');     }     }          function ajaxfunction() {     //  die("ajaxfunction is called");     if(!isset($_POST['email'])  ) {         die('Error: Missing variables');     } else {          $email=$_POST['email'];          $to='you@email.com';          $headers = 'The following person has registered to be notified when your webite launches: '."\r\n" ."\r\n" .         'Email: '.$email."\r\n";          $subject = 'A new person has registered to be updated when you go live';              if(mail($to, $subject,          $headers)) {         die('Mail sent');     } else {         die('Error: Mail failed');     }     }       }         add_action( 'wp_ajax_nopriv_ajaxfunction', 'ajaxfunction' );          add_action( 'wp_ajax_ ajaxfunction', 'ajaxfunction' );


title: How to query posts with featured images

text: I basically want to use WP_Query to select 3 latest posts which have featured images and this is the only way I can think of. regards **edit** tried               $query = new WP_Query( array( "post_type" => 'case-study', 'meta_key' => '_thumbnail_id', "posts_per_page" => '10', 'orderby' => 'menu_order' ) );      which doesn't work I'm trying to add a custom field to add a hidden custom field to a post when there is a featured image attached (either true or false). I've tried hooking into updated_post_meta, update_post_meta, wp_insert_post but I cant seem to match the $meta_key to "_thumbnail_id". **edit**               function get_latest_with_featured_image( $args = array() ) {         $args = array_merge( array( "post_type" => 'post', "meta_key" => "_thumbnail_id", "posts_per_page" => '10', 'orderby' => 'menu_order' ), $args );         $query = new WP_Query( $args );         return $query->posts;     }          $posts = get_latest_with_featured_image( array(  "post_type" => "case-studies",  "posts_per_page" => 10 ) );


title: Adding custom input for data attribute in insert media modal

text: I'm trying to add a text input to the "Insert Media" modal in the hopes of being able to add an html5 `data-` attribute to the images' parent anchor. `<a class="fancybox" href="..." data-fancybox-group=" ">` <-- This part   `<img class="wp-image-871" src="..." alt="..." width="245" height="333" />`   `</a>` So far I've been able to add the input to the modal: ![enter image description here](http://i.stack.imgur.com/fjonB.png) Using the code below in my functions.php file:               function add_fancybox_input( $form_fields, $post ) {     $form_fields['fancyboxGroup'] = array(     'label' => 'fancybox group',     'input' => 'text',     'value' => 'testing',     'helps' => 'use this to group images in fancybox',     );     return $form_fields;     }          add_filter( 'attachment_fields_to_edit', 'add_fancybox_input', 10, 2 );      And I've added the `data-fancybox-group=""` to the anchor using:               function give_linked_images_class($html, $id, $caption, $title, $align, $url, $size, $alt = '' ){       $classes = 'fancybox'; // separated by spaces, e.g. 'img image-link'            // check if there are already classes assigned to the anchor       if ( preg_match('/<a.*? class=".*?">/', $html) ) {         $html = preg_replace('/(<a.*? class=".*?)(".*?>)/', '$1 ' . $classes . '$2', $html);       } else {         $html = preg_replace('/(<a.*?)>/', '$1 class="' . $classes . '" data-fancybox-group="" >', $html);       }       return $html;     }     add_filter('image_send_to_editor','give_linked_images_class',10,8);      This is where I'm stuck... I've got a place to enter the data and I've got a place for the data to go, but I'm not sure how to get the data from the input to the data-fancybox-group attribute.


title: How to change the file upload directory on version 3.5?

text: The option to change the upload folder for images is gone on version 3.5, any way to make it visible again or a workaround ? From this core ticket: > Changing the `upload_path` and `upload_url_path` options are pretty > dangerous. They have the potential to break quite a bit of things, not to > mention they have the potential of simply not working.   >  [...]   >  There's really no good reason to show `upload_path` or `upload_url_path` in > the UI unless the values are other than the default (`wp-content/uploads` or > '' for `upload_path`, and '' for `upload_url_path`). With that, most of a > section disappears, leaving just _year/month_ folder organization.


title: How to tell whether a user meta value has increased or decreased

text: I store a custom user meta value for my users that is stored as a number like a score. I need a way of telling whether it has decreased or increased from its last value. So when I display it I can show an arrow to show which it's trending. Any ideas? Here is how I get the score and update the user meta.               add_filter('the_content','update_user_score');     function update_user_score($content){         global $post;         $author_id = $post->post_author;         $author_posts = get_posts( array(         'author' => $author_id,         'posts_per_page' => -1       ) );         $counter = 0;         foreach ( $author_posts as $author_post )       {         $score = get_post_meta( $author_post->ID, 'ratings_score', true );         $counter += $score;       }         update_user_meta( $author_post->post_author, 'score', $counter);         return $content;     }


title: Wordpress code editor messed up my code!

text: I just spend a few hours trying to make my code look better. In the past, I did some changes using Wordpress code editor and after downloading these files yesterday, I noticed that code is totally messed up. This is how code looks in the editor: ![enter image description here](http://i.stack.imgur.com/9dOty.jpg) And this is how it looks in browser: ![enter image description here](http://i.stack.imgur.com/Hv9Q7.jpg) Needless to say, it's very annoying. Now I can't inspect given element in Chrome because it's giving mi false line number in code. Any ideas what can I do with this?


title: xmlrpc_enabled filter not called

text: Since WordPress 3.5, the core developers have decided to keep xml rpc enabled by default and there are no options in the Admin to disable it. This blog post explains how to disable it by modifying the xmlrpc_enabled filter               add_filter('xmlrpc_enabled', '__return_false');      But this doesn't seem to work, I still get the following on the generated HTML               <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://domain.com/xmlrpc.php?rsd" />      and WordPress still generates the `http://example.com/xmlrpc.php?rsd` page I'm putting the filter in the `functions.php` file of my theme.


title: Passing additional variables to a query

text: How can we add more arguments to an existing query? Suppose I have in my theme               if (!$blog_query) $blog_query = $wp_query;          while( $blog_query->have_posts() ) : $blog_query->the_post();      AND I want to add two arguments to the existing query before passing, say:               'orderby' => 'post-title',     'order' => 'ASC',      How can I add these to the existing $blog_query?


title: How do I make Contact Form 7 pop up in thickbox?

text: I am trying to make contact form 7 pop up in a thickbox modal window. I can either use `do_shortcode` or the shortcode but I'm not sure how to set it up. Can someone push me in the right direction? From the Thickbox page, it looks like I should be using either inline Content, iFramed Content, or AJAX Content, but I'm not sure which one.


title: Can custom taxonomies items have attached properties?

text: Let's say for (a classic) example that I want to create an **event** custom **post type** , which will have assigned some specific fields/properties. One of them: **location venue**. Location venue, which I'm thinking should be a tag in a custom taxonomy, would have, besides the title, also an **url** and a pair of **coordinates** , for example. So, questions are:   1. Would this be a sensible approach?    2. How would I go implementing it?


title: WordPress For Urdu Language

text: Can I use WordPress for Urdu Language? I want entire site to be toggled- translated in Urdu Language with one click... Is it possible to do it with some plugin or do i have to write manual codes for every component? Thanks


title: Syntax Highlighter XML striping

text: I am really frustrated with availible Syntax Highlighter's on the market it seems that no matter which one I use, after pressing "Save Draft" or "Publish" and after I change from Visual to Html or reverse I am loosing the xml snippet code. Also, other code (C#, PHP) just loosing their style, especially break lines making code unreadable. My configuration is   * WordPress 3.2.1.    * Easy Google Syntax Highlighter,    * SyntaxHighlighter TinyMCE Button,    * SyntaxHighlighter I really like WordPress however writing and espessially editing posts in admin panel, which is very handfull, make it impossible because it just looses and stripping code formating. So, the question is which plugins do you use or do you write posts through admin panel?


title: Contact Form 7 form is working on local wordpress install but fails on production server

text: I've created a Contact Us page (my-site.com/contact-us/) using contact-form-7 which works fine on my local WordPress install. However, when I try the same form on the online version of the site, it simply hangs. I checked the http headers using Fiddler and saw that the url being used by the ajax submit is **/contact-us/#wpcf7-f1-p15-o1**. The error shown by Fiddler is HTTP 400 "Bad Request". There's no server information, so I'm assuming the request doesn't even make it to the server. Local setup: XAMPP on Windows XP Online setup: IIS 6.0 on Windows 2003 WordPress version: 2.9.2 Browser: Opera 10.61 Update: I'm using gmail as my smtp server via the WP-Mail-SMTP plugin.


title: How to share specific data contained in repeated fields across multiple pages

text:
I have been using the advanced custom fields plugin and very much appreciate its abilities. I have a page on the website i'm working on called About Us and within that page, there is contained, a list of staff members (4 in total). I built this list of staff members using the add on repeater field in the advanced custom field plugin. I am also developing a single page template devoted to information about the specialist industry area called "treatments", data is output from the main custom post loop of the same name. There are 4 individual custom post types containing this information. Each member of staff is solely responsible for one of the four treatments. Therefore when a single page view of a specific treatment custom post data is output, I would like to append that information with the relevant staff member in charge of that treatment. This code below grabs everything from the about us page template in this case using the page id of 89. Not quite what I am after as I need to take a particular row in page id 89 and see if that is a matching pair for the page being fed into the single-treatments.php page The code is along the right lines however.               <?php     $other_page = 89;     ?>     <?php if(get_field('about_the_practioner' , $other_page )): ?>     <?php while(the_repeater_field('about_the_practioner' , $other_page)): ?>
<?php the_sub_field('header' )?><?php the_sub_field('title' )?>
     <?php endwhile; ?>     <?php endif; ?>      Is there a way of grabbing the relevant row data from the staff member repeater field depending on what treatment custom post has been fed into the single page template?


title: Thumbnails from video posts not working after upgrading to WP 3.4

text: I'm using Auto Featured Image plugin to generate thumbnails for my posts. After upgrading to WP 3.4 all the posts that had videos and thumbnails generated from youtube disappeared. I found another plugin called Video Thumbnails which created the thumbnails for all video posts but now the thumbnails are not showing on the home page. Does anybody know why this is happening? The below code was used for the thumbnails:               <?php         if ( has_post_thumbnail() ) { ?>         <?php         $imgsrcparam = array(         'alt'   => trim(strip_tags( $post->post_title )),         'title' => trim(strip_tags( $post->post_title )),);                         $thumbID = get_the_post_thumbnail( $post->ID, array(235,235), $imgsrcparam ); ?>                         <a>" class="preview"><?php echo $thumbID; ?></a>         <?php } ?>


title: Hook 'wp_enqueue_scripts' priority has no effect

text: In a theme I am working there are up to 3 Stylesheets. I am using the hook 'wp_enqueue_scripts'. The order of the stylesheets is important for overwriting styles. I have a code like this:               add_action('wp_enqueue_scripts', 'add_stylesheet_one', 10);     add_action('wp_enqueue_scripts', 'add_stylesheet_two', 14);     add_action('wp_enqueue_scripts', 'add_stylesheet_three', 12);      With this priorities the stylesheet order should be 'stylesheet_one', 'stylesheet_three' and 'stylesheet_two'. But the priority doesn't have any effect. I've tried different numbers but the order does not change. Am I missing something? Thx for Help!!!


title: Error after moving WordPress installation

text: I am trying to move a WordPress site to a new server, but I cannot get it up and running on my local server (running XAMPP). The site is running perfectly fine, but when I download the files, export the database and then hook everything up on my local copy, I get the following error message:               Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'twentyten_widgets_init' not found or invalid function name in /Users/Tim/Sites/coachhousetimbers.com.au/old/wp-includes/plugin.php on line 405      And the following when I try to access the site's dashboard:               Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'twentyten_widgets_init' not found or invalid function name in /Users/Tim/Sites/coachhousetimbers.com.au/old/wp-includes/plugin.php on line 405     Warning: Cannot modify header information - headers already sent by (output started at /Users/Tim/Sites/coachhousetimbers.com.au/old/wp-includes/plugin.php:405) in /Users/Tim/Sites/coachhousetimbers.com.au/old/wp-includes/pluggable.php on line 934      Any ideas and/or suggestions? I have moved many WordPress websites in the past and this is the first time I've seen this error. I am running WordPress 3.2.1. Thanks!


title: WP_Query with tax_query not working

text: I tried to create a custom query, but no results, it throws me an error.               $args = array(                     'post_type' => 'product',                     'posts_per_page' => 1,                     'tax_query' => array(                     array(                         'taxonomy' => 'product_cat',                         'field' => 'term_id',                         'terms' => 23,                                 )                     )                 );                 $query = new WP_Query( $args );                 var_dump($query->have_posts());                 if ( $query->have_posts() ) {                     while ( $query->have_posts() ) {                         $query->the_post();                         echo the_title();                     }                 } else {                     echo 'error';                 }                      wp_reset_query();      I checked the documentation, but I don't know where's the problem. The problem is the $query->have_posts() always returns false. The code is works in the header.php, but not works in functions php. I would like to know that, how to improve the code to use it in the functions.php


title: Cannot pull up posts of category on category page!

text: I have an extremely simple loop which I've placed in header.php:               $my_query = new WP_Query('category_name=home');     while ($my_query->have_posts()) : $my_query->the_post();     whatever();     endwhile;      The loop works on every page -- except for a category page! I can intuitively understand why, but I cannot figure a way to get it to work. This is one of the many things I can't stand about wordpress: their documentation does not note exceptions like this, and I constantly have to spend a ton of time getting not such esoteric things to work.


title: Users can only view their content from the front end

text: There was a great answer to how users can manage their posts only from the back-end. What I am wondering, is how to allow users to only see their posts, pages, etc, which have their user id attached to it. I'm applying this to custom post types where the users manage their uploaded media.


title: Using wp_parse_args to set up Plugin Default Settings

text: So I want to have defaults set up for each of my plugins settings, and I'm using wp_parse_args to do so which I believe is the correct way, but I'm hitting a roadblock. Here's my code at the moment:               function eddslider_options_each( $edd_slider_options ) {          $edd_slider_options = get_option( 'eddslider_options' );          /**      * Define the array of defaults      */      $defaults = array(         'slider_insert'     => 0,         'slider_arrows'     => 0,         'slider_bullets'    => 0,         'slider_effect'     => 'fade',         'slider_theme'      => 'default'     );     /**      *  Parse incomming $args into an array and merge it with $defaults      */      $edd_slider_options = wp_parse_args( $edd_slider_options, $defaults );          /**      * OPTIONAL: Declare each item in $args as its own variable i.e. $type, $before.      */      extract( $edd_slider_options, EXTR_SKIP );          }      Now if I add something like:               $output = $slider_insert;     return $output;      I'm able to use `<?php echo eddslider_options_each('slider_insert'); ?>` and it will have the defined default set and work well. **How do I do this for every option though?** Thank you.


title: Where does the Media Library live in the database?

text: I'm exporting a Wordpress site from localhost to a web host, and I am unable to import the Media Library, as the web host is unable to contact localhost. I've uploaded all of the localhost files from /wp-content/uploads/..., and I'm thinking I just need to isolate the part of the MySQL database which contains the Media Library, and adjust the URL, then import the SQL into the web host database. Can you tell me where the Media Library lives in the MySQL database please?


title: How to force redirect visitors to login/register page in buddypress

text: I have redirect script               function login_redirect() {          global $pagenow;          // Check to see if user in not logged in and not on the login page     if(!is_user_logged_in() && $pagenow != 'wp-login.php')         // If user is, Redirect to Login form.         auth_redirect();     }          add_action( 'wp', 'login_redirect' );`      It works good, however when I click register, I'm redirected to login. How I can redirect users to wp-login.php or wp-register.php. P.S wp-register.php is a site of buddypress.


title: Need to display custom taxonomy on single page - not working

text: I've looked at several posts on here trying to crack this. I think it's simple for someone who knows more. The details: Theme: Custom theme built on Roots starter   WP: 3.8.1   Custom Post Type: pre_owned_cars My custom post types work well - I'm used to doing those. The taxonomy however is tripping me up. I have it working with the code in my functions.php file, but I can't figure out how to display a taxonomy. I've created taxonomy.php and updated permalinks. Here's my functions.php code for the taxonomy - I'm trying to name the taxonomy "type":               // add tags to pages     add_action( 'init', 'register_taxonomy_types' );          function register_taxonomy_types() {          $labels = array(          'name' => _x( 'Types', 'types' ),         'singular_name' => _x( 'Type', 'types' ),         'search_items' => _x( 'Search Types', 'types' ),         'popular_items' => _x( 'Popular Types', 'types' ),         'all_items' => _x( 'All Types', 'types' ),         'parent_item' => _x( 'Parent Type', 'types' ),         'parent_item_colon' => _x( 'Parent Type:', 'types' ),         'edit_item' => _x( 'Edit Type', 'types' ),         'update_item' => _x( 'Update Type', 'types' ),         'add_new_item' => _x( 'Add New Type', 'types' ),         'new_item_name' => _x( 'New Type', 'types' ),         'separate_items_with_commas' => _x( 'Separate types with commas', 'types' ),         'add_or_remove_items' => _x( 'Add or remove Types', 'types' ),         'choose_from_most_used' => _x( 'Choose from most used Types', 'types' ),         'menu_name' => _x( 'Types', 'types' ),     );          $args = array(          'labels' => $labels,         'public' => true,         'show_in_nav_menus' => true,         'show_ui' => true,         'show_tagcloud' => true,         'show_admin_column' => false,         'hierarchical' => true,              'rewrite' => array(              'slug' => 'used-cars',              'with_front' => true,             'hierarchical' => true         ),         'query_var' => true     );          register_taxonomy( 'types', array('pre-owned-cars'), $args );     }      Any help GREATLY appreciated!


title: Multiple thumbnails and one gallery

text: I'm looking for solution for a gallery on a WP page that shows multiple thumbnails of images in that gallery, **but not all thumbnails in gallery** (like default Galleries in WP works). I want (i.e.)certain 3 thumbnail images to show up on page, which (each one of them) leads to the same gallery with more than 3 images (i.e. 7 images). Additionally (it would be uber-fantastic), if it would throw in description how many images there are in the gallery (some WP function, you know?). It should work like from the shortcode with images with such (fabricated) property : "show-thumbnails"               [gallery ids="152,153,103,104,102,64,60" show-thumbnails="152,153,103"]      Is it possible in WordPress? Perhaps you know some plugin that has such options ? Or know how to pass some additional params to WP ? Thanks!


title: The effect of spam comments on hosting resource usage (CPU)

text: One of my WP sites is using a lot of CPU, and I am wondering if this is caused because of the high number of spam comments it is getting. Can that be the case? Is there an easy way of checking that? Thank you.


title: pagination in author.php template returns 404 error

text: Hi to the community!!! I need some help with pagination in author.php template.   I have pagination working in all my loops except in authors.php that i get a 404 error.   In my settings/reading i have set blog posts to show as 1. The first step was the author rewrite from author to artist,               function set_new_author_base() {         global $wp_rewrite;         $author_slug = 'artist';         $wp_rewrite->author_base = $author_slug;     }     add_action('init', 'set_new_author_base');      In the author.php template i query the $author-ID posts in the custom post type 'ideas':               <?php      $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;     query_posts('post_type=ideas&author='.$curauth->ID.'&posts_per_page=1&paged='.$paged);     if(have_posts()) : while(have_posts()) : the_post(); ?>         <a href="<?php the_permalink(); ?>"><?php the_title(); ?>     <?php endwhile;     previous_posts_link('newer');     next_posts_link('older');     endif;     ?>      for some reason i get a 404, in the other side, i can run queries in taxonomy.php, home.php, index.php... with pagination also and it works fine. i see the next and previous links that point me here: `http://domain.dev/artist/philip/page/2/` but i get the 404 error, the query in home.php template:               <?php //*The Query*//     query_posts($query_string . '&post_type=ideas&posts_per_page=1&offset=0&paged='.$paged);     if(have_posts()) : while(have_posts()) : the_post();     ?>      here i correctly get next and previous posts http://domain.dev/ideas/page/2/ the query in index.php template:               <?php //*The Query*//     query_posts($query_string . '&posts_per_page=1&offset=0&paged='.$paged);     if(have_posts()) : while(have_posts()) : the_post();     ?>      here i correctly get next and previous posts http://domain.dev/ideas/page/2/ do you understand what is going on here???   i'm sure that the author have some posts, i have flush the rules... thanks a lot!


title: Combine existing meta fields into meta data stored as an array

text: I'm trying to clean up a site of mine that has quite a few meta data fields for my posts and custom post types. I'd like to group these fields into meta data DB entries as arrays. For Example: I have address meta fields, i.e. address, city, state, postal and country. I'd like to take these fields and combine them into a single meta data DB entry as an array. I'm not sure where to begin in breaking this down. Or how to approach this. Any and all help is greatly appreciated


title: what could cause get_stylesheet_directory_uri() to fail?

text: On my new worpress install, I have code that reads `<img src="<?php get_stylesheet_directory_uri(); ?>/images/logo.jpg" />` This code worked, untill I started using a subdomain (went from example.com/dev to dev.example.com) and changed these urls in my general settings. Now the `get_stylesheet_directory_uri()` does not output anything: `<img src="/images/logo.jpg" />` I swapped it with the following: `bloginfo(stylesheet_directory)` which seems to work fine, but I am used to `get_stylesheet_directory_uri()` and it seems like this is the reccomended approach.


title: How do I combine wp_redirect and add_filter?

text: I have a multisite, where I would like any subsites to share the same login, register and lost password page. Those pages are custom pages and located on the main site. So far so good. The problem I have now, is that when a user want to submit contents to any of the subsites it should be directed to the common login page then after login send back to the form submission page. I have tried following codes which did not provide the desired result: It sends the user to the login page, but is missing the url to get back to                   add_action('init','possibly_redirect');     function possibly_redirect(){         global $pagenow;         if( 'wp-login.php' == $pagenow ) {         wp_redirect( network_site_url( 'login' ) );         exit();         }     }      Then I found this code, but it does not alter the login url:               add_filter( 'login_url', 'mysite_login_url', 10, 2);     function mysite_login_url( $force_reauth, $redirect ){         $login_url = 'yoursite_login_url';              if ( !empty($redirect) )             $login_url = add_query_arg( 'redirect_to', urlencode( $redirect ), $login_url );              if ( $force_reauth )             $login_url = add_query_arg( 'reauth', '1', $login_url ) ;              return $login_url ;     }      Is there a way I can combine or use side by side to reach a solution. Being a newbie, I have tried every combination I came accross. I also tried rewriting rule in .htaccess, but it did not work. Thanks


title: Display Editable Text Above CPT Archive Listings

text: I have two custom post types (Authors and Partners). I display their archive page's in the main navigation and use archive-authors.php and archive- partners.php to make a couple small tweaks to the display of posts in each. Now, my client would like to display some text before the archive's post listing. So far I can think of the following ways to do that:   1. Save the text as the post type's description and display that.   2. Create a separate page and hard code a custom `WP_Query()` loop for just that page (by ID) above the archive.   3. Write a custom loop with `WP_Query()` to produce the CPT archive for each CPT and setup "Author Archive" and "Partner Archive" templates that can be used on static, editable pages. However, all of these solutions seem suboptimal for one or more of the following reasons:   * They require technical knowledge to update (#1, #2)   * It's not abstracted (e.g. the solution has to be custom-coded for each archive) (#2, #3)   * Updating the text requires technical knowledge (#1)   * The solution essentially duplicates the template hierarchy (#3). I'm looking for a solution that's WordPress friendly, abstracted, and easy-to- update for the client.


title: Multiple WordPress sites eat up alot of RAM

text: I have a VPS with 30 WordPress sites. I am running nginx & APC and notice it eats up my RAM up to 1GB and it increases each time I add another site. I notice APC is the one that's causing the increasing of ram usage. Is there a way to optimize this?


title: Ordering Subcategories

text:
I'm using the following code to display data from subcategories. The subcategories are 'United kingdom', 'England Only', 'Northern Ireland Only', 'Scotland Only', 'Wales Only'. Ordering by date or asc/desc puts the UK subcategory somewhere in the middle with either Wales or England at the top. I need the UK subcategory to be at the top. It holds the most posts - so is it possible to use an orderby in the query to fix this? Or do you think I need to create its own loop for the UK subcategory only?               $parentCatID = get_cat_ID('Grants and Incentives');     $childCats = get_categories( 'child_of='.$parentCatID.'&orderby=date&order=asc' );     if(is_array($childCats)):     foreach($childCats as $child){ ?>     <h2 class="experts <?php echo $child->name; ?>"><?php echo $child->name; ?> Grants and Incentives
     <?php query_posts('cat='.$child->term_id.'&post_type=grants-and-incentive');     while(have_posts()): the_post(); $do_not_duplicate = $post->ID;      Edit: I'm now using the Category Order and Taxonomy Terms Order Plugin and **orderby=term_order**. Which works great. It would be good to know how this works without using a plugin though, if anyone could explain it!


title: Unable to reorder the calendar using the WP Calendar plugin

text: This question is particular to the plugin "WP Calendar". The events are outputted in ascending order rather than descending which would make more sense since the newest should appear first. See the code I'm using is here. The instructions on how to customize the output are only viewable in the plugin admin, so I have pasted them into a pastie. In the instructions it says: orderby => datefrom An array of fields to be sorted. This parameter is not available for the function fse_print_events_list, when grouping is active. orderdir => ASC An array of sort directions (asc or desc). Use the same key as in the array orderby to join the right field. The functionality definitely exists and involves `'orderdir' => 'DESC'` I imagine but everything I try doesn't change the order. The developer has not responded in weeks. Maybe the orderby and order dir do not go in the array. Please help =)


title: Display page content AFTER a loop of posts

text:
This is probably easy once you know but I'm having trouble getting the static page content to appear AFTER a list of posts. I'm using a named page template which displays posts as a slider and I want to display the static content of the page underneath this slider. To display the static content I've got this in my template:                                <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                      <div <?php post_class(); ?>>
<?php the_title(); ?>

                     <?php the_content(); ?>

                 <?php endwhile; endif; ?>           If I use this bit of code BEFORE the slider query/loop then my static content displays fine with the slider displaying the posts after. However if I use this snippet AFTER the slider posts then I just get a list of the slider posts - because of the query set up for the list of posts. Basically, to show the static content after the slider posts I need to reset the query back to the current static page content somehow.


title: Page stuttering on load

text: My theme is using `nprogress.js` and `scrollreveal.js`. When you click to a new page in the website the page shows for a split second before fading in. Its as if the page is loading ahead of my scripts, causing a very unpolished stutter in the site. **EDIT:** Is this an enqueue issue? **My nprogress.js script:**               // nprogress.js     jQuery(document).ready(function () {          NProgress.start();     setTimeout(function () {         NProgress.done();         jQuery('.fade').removeClass('out');     }, 1000);          });      **My scrollreveal.js script:**               // scrollreveal.js     (function (jQuery) {          window.scrollReveal = new scrollReveal({         reset: false,         move: '50px',         init: false     });          // Now check for new elements in the DOM…     scrollReveal.init();          })();      **My enqueue.php:**               function foundationEnqueue() {       if (!is_admin()) {          // deregister core jquery     wp_deregister_script('jquery');     // reregister jquery 2.1.0     wp_register_script('jquery', get_template_directory_uri()."/js/vendor/jquery.js", array(),'2.1.0',false);     // reregister jquery 2.1.0     wp_register_script('jquery110', "http://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js", array(),'1.1.0',true);     // register modernizr     wp_register_script('modernizer', get_template_directory_uri()."/js/vendor/modernizr.js",array(jquery),'2.1.0', false);     // register nprogress     wp_register_script('nprogress', get_template_directory_uri()."/js/nprogress/nprogress.js",array(jquery110),'1.1.0', true);     // register scrollreveal     wp_register_script('scrollreveal', get_template_directory_uri()."/js/scrollreveal/scrollreveal.js",array(jquery),'2.1.0', false);     // register slick     wp_register_script('slick', get_template_directory_uri()."/js/slick/slick.min.js",array(jquery),'2.1.0', false);     // register foundation.min     wp_register_script('foundation', get_template_directory_uri()."/js/foundation.min.js", array('jquery'),'2.1.0',true);      // register foundation.theme     wp_register_script('theme', get_template_directory_uri()."/js/foundation.theme.js", array('jquery'),'2.1.0',false);     // register foundation.particles     wp_register_script('particles', get_template_directory_uri()."/js/foundation.particles.js", array('jquery'),'2.1.0',true);          wp_enqueue_script(array('jquery','jquery110','modernizer','nprogress','scrollreveal','slick','foundation','theme','particles'));            }     }      The entire website is wrapped into a `.container` with the settings `data- scroll-reveal="enter from the top over 1.0s no reset" data-sr- initialized="true" data-sr-complete="true"` Does anyone know why my site might be stuttering on load like this? I cannot find any documentation to fix it. Thanks in advance!


title: Enable Media Replace Plugin - Add additional link to replace attachment page

text:
I am trying to Add the to the attachments uploaded to this post screen when viewing attachments. I've been playing around with this in my themes functions.php, the below adds the text on the screen but it generates the incorrect noonce and I am unable to redirect successfully to the media replace screen. Any idea what I am doing wrong?               add_action( 'init', 'hhs_init' );     function hhs_init() {             register_taxonomy_for_object_type( 'category', 'attachment' );     }          add_filter( 'attachment_fields_to_edit', 'hhs_attachment_fields_to_edit', 10, 2 );     function hhs_attachment_fields_to_edit( $fields, $post ) {             if ( isset( $fields['category'] ) )                     $fields['category']['show_in_modal'] = false;     $url = admin_url( "upload.php?page=enable-media-replace/enable-media-replace.php&noheader=true&action=media_replace_upload&attachment_id=".$post->ID);     $action = "media_replace_upload";       $formurl = wp_nonce_url( $url, $action );     if (FORCE_SSL_ADMIN) {             $formurl = str_replace("http:", "https:", $formurl);         }              $fields['test-media-item'] = array(                 'label' => 'Upload a New Version of this document, the file name of the document being uploaded will be modified to that of the original document file name.',                 'input' => 'html',         //'html' => '
'.add_media_action( '', $post->ID),                 'html' => 'Replace / Upload
',                 'show_in_edit' => false,         );             return $fields;     }      https://wordpress.org/plugins/enable-media-replace/


title: Inserting Taxonomy Terms During a Plugin Activation?

text: I've been trying various ways of doing this. Basically, I've been trying to make it so that a plugin of mine populates the terms of a taxonomy only once during the plugin's activation. The term populating is done in a function via the wp_insert_terms function. Calling the function straight inside the register_activation_hook doesn't seem to work and neither does hooking to the init hook using the register_activation_hook. Anyone have any ideas? Here is a version of my code               //version 1     class vsetup {          function __construct() {               register_activation_hook(__FILE__,array($this,'activate'));               $this->create_taxonomies();          }           function activate() {               wp_insert_term('Action','genre');               wp_insert_term('Adventure','genre');          }          function create_taxonomies() {                $genre_args = array(                  'hierarchical' => true,                       'labels' => array(                 'name'=> _x('Genres', 'taxonomy general name' ),                 'singular_name' => _x('Genre', 'taxonomy singular name'),                 'search_items' => __('Search Genres'),                 'popular_items' => __('Popular Genres'),                 'all_items' => __('All Genres'),                 'edit_item' => __('Edit Genre'),                 'edit_item' => __('Edit Genre'),                 'update_item' => __('Update Genre'),                 'add_new_item' => __('Add New Genre'),                 'new_item_name' => __('New Genre Name'),                 'separate_items_with_commas' => __('Seperate Genres with Commas'),                 'add_or_remove_items' => __('Add or Remove Genres'),                 'choose_from_most_used' => __('Choose from Most Used Genres')                 ),                       'query_var' => true,                   'rewrite' => array('slug' =>'genre')                        );                register_taxonomy('genre', 'post',$genre_args);          }     }      When that didn't work, I tried doing this:                //version 2         class vsetup {              function __construct() {                   register_activation_hook(__FILE__,array($this,'activate'));                   $this->create_taxonomies();              }               function activate() {                   add_action('init', array($this,'populate_taxonomies'));              }               function create_taxonomies() {                    $genre_args = array(                      'hierarchical' => true,                           'labels' => array(                     'name'=> _x('Genres', 'taxonomy general name' ),                     'singular_name' => _x('Genre', 'taxonomy singular name'),                     'search_items' => __('Search Genres'),                     'popular_items' => __('Popular Genres'),                     'all_items' => __('All Genres'),                     'edit_item' => __('Edit Genre'),                     'edit_item' => __('Edit Genre'),                     'update_item' => __('Update Genre'),                     'add_new_item' => __('Add New Genre'),                     'new_item_name' => __('New Genre Name'),                     'separate_items_with_commas' => __('Seperate Genres with Commas'),                     'add_or_remove_items' => __('Add or Remove Genres'),                     'choose_from_most_used' => __('Choose from Most Used Genres')                     ),                           'query_var' => true,                       'rewrite' => array('slug' =>'genre')                            );                    register_taxonomy('genre', 'post',$genre_args);              }              function populate_taxonomies() {                   wp_insert_term('Action','genre');                   wp_insert_term('Adventure','genre');              }         }      Neither idea worked for me so far.


title: insert image alongwith with custom data via a frontend form

text: I use wordpress as a cms. I wanted to insert custom data via a form from the frontend in my wordpress site and then echo it on a page somewhere. After learning from here and there I am able to put together a codes below which works. Here is a code of what my form looks like currently.               <form id="costing_submit_form" action="http://somesite.com/..../process-costing.php" method="post">     <input type="hidden" name="costing_submit_date" value="<?php echo $costing_submit_date;?>"/>             <input type="text" id="costing_submit_title" name="costing_submit_title" size="90%" maxlength="150" /><br>     <textarea id="costing_submit_description" name="costing_submit_description" size="90%" cols="60" rows="10 tabindex="15" maxlength="2000" rows="20" required="" /></textarea>         <input type="submit" class="costing_submit_button" name="costing_submit_button" value="SUBMIT COSTING" />     </form>      At this point I am able to insert the data and also display it in the frontend using $wpdb. This part of the code is in `process-costing.php` which inserts the data in the database table.               global $wpdb;          require_once('../../../wp-load.php');         $costing_submit_date        = strip_tags($_POST['costing_submit_date']);         $costing_submit_title       = strip_tags($_POST['costing_submit_title']);         $costing_submit_description = strip_tags($_POST['costing_submit_description']);         $table_name = $wpdb->prefix . "costing";         $wpdb->insert( $table_name, array(         'costing_date' => $costing_submit_date,         'costing_title' => $costing_submit_title,         'costing_description' => $costing_submit_description,         ));      Now, I would like to **add an image to every entry made** , so how do I go about it. If not a complete solution kindly give me a road-map as to what I should be doing or following, what specific functions should I be using ? Even if I am able to upload the image. My main concern is how do I `associate the uploaded image to that particular entry`...something like post-thumbnail perhaps ? If possible I would also like to `assign a particular folder` to these images. Thanks in advance.


title: How to call ajax in plugin file

text: I am very new to ajax with wordpress . Here i am getting a selected option value in `var test` using bellow function when i alert it its showing a right value. This `var test` value i have to send using ajax and i want GET this value in PHP variable. So what i required to call ajax and get script variable value of `var test` in php in plugin file where i have both bellow function and select box. JQuery Funtion.               jQuery("#time_slot").change(function()     {          var test= time_slot.value;     alert(test);          });      Select Box               <select name="time_slot" id="time_slot" class="time_slot">     <option value="">Choose a Time</option>     <option value="1:00 - 3:00">01:00 AM-03:00 AM</option>     <option value="3:00 - 5:00">03:00 AM-05:00 AM</option>     </select>


title: wp-includes does not contain a feed template

text: Using Wordpress 3.9, I'm trying to create a custom feed template for a custom post type, which will include some custom fields. Idea is to use this feed to to send out a "newsletter" type email once a month, with updates on newly added products. The problem is that when I wanted to copy the code from the current feeds as a starting point for my custom feed, I couldn't find these pages anywhere. According to the wordpress codex, these should be found within wp-includes. But they are not there. I checked a couple more folders... nothing. Within wp-includes I do have a file called class.feed.php. But opening that really didn't give me any pointers. I would need to remove the current custom post title from the field, as this is an empty field, and to add about 10 custom fields. So a completely new template seemed the easiest option.


title: how to sort results by last day update at search result in plugin installer?

text: Is there any way to sort the results of plugin search result, by last update or whatever?


title: Display Posts by modifying the where clause only for my query

text: I am trying to display posts that are 7 days old. For that i need to modify the 'where' clause as in code               //Hack found on the bottom of http://codex.wordpress.org/Template_Tags/query_posts        function filter_where($where = '') {             //posts in the last 7 days         $where .= " AND post_date > '" . date('Y-m-d', strtotime('-7 days')) . "'";         }          ('posts_where', 'filter_where');        query_posts($query_string);        if ( have_posts() ) : while ( have_posts() ) : the_post();           ... and the usual      But doing this will modify all the queries, i just want to use this for one query in my plugin and i dont want to change any other query on my site. How can i do that?


title: Looking for a plugin which could publish my site rss to facebook timeline automaticlly

text: I am looking for a plugin which could publish my site rss to facebook timeline automaticlly. The function like `rssgraffiti.com`. For explain, if my wordpress site's rss (blog, post, bb press, buddypress stream, etc) updated, it will automaticlly publish to my facebook timeline. (Or if there is not a plugin like this, any other php script also good) Thanks.


title: Get entered value of customiser field for live preview

text: As per the codex, this question an probably any tutorial on the theme customiser out there, you get the value of a customiser field with the following code:               ( function( $ ) {              //Update site background color...         wp.customize( 'background_color', function( value ) {             value.bind( function( newval ) {                 $('body').css('background-color', newval );             } );         } );          } )( jQuery );      The problem is you can get that value, when its changed. My question, is how (in a sane way) can you retrieve the value of _another_ field in that same callback. E.g.               ( function( $ ) {              //Update site background color...         wp.customize( 'background_color', function( value ) {             value.bind( function( newval ) {                 //Get value of field 'text_colour'                 //var text_colour = ??                 $('body').css('background-color', newval );             } );         } );          } )( jQuery );


title: I am unable to save my data from a form

text:
For some reason I am unable to save the data from my form:               add_action( 'admin_menu', 'example_menu_settings' );          /** Step 1. */     function example_menu_settings() {         add_options_page( 'example Plugin Options', 'example', 'manage_options', 'example-settings', 'example_plugin_options' );         add_action( 'admin_init', 'register_example_settings' );     }          /** Step 3. */     function example_plugin_options() {         if ( !current_user_can( 'manage_options' ) )  {             wp_die( __( 'You do not have sufficient permissions to access this page.' ) );         }              $client_id = get_option('example_client_id', '');         $secret = get_option('example_secret', '');              echo '

example Plugin Settings

             <form method="post" action="options.php">';             settings_fields( 'example-settings-group' );             do_settings_sections( 'example-settings-group' );             echo '<input type="hidden" name="option_page" value="general"><input type="hidden" name="action" value="update"><input type="hidden" id="_wpnonce" name="_wpnonce" value="103f63adef"><input type="hidden" name="_wp_http_referer" value="/example-Blog/wp-admin/options-general.php">

                 Client ID	                 <input name="example_client_id" type="text" id="example_client_id" value="' . $client_id . '" class="regular-text">

                 Secret	                 <input name="example_secret" type="text" id="example_secret" value="' . $secret . '" class="regular-text">

Your keys is found inside your example account settings.

                 <button id="example-test-connection" class="button">Test connection</button>';                 echo submit_button();             echo '</form>
';     }          function register_example_settings() { // whitelist options       register_setting( 'example-settings-group', 'example_client_id' );       register_setting( 'example-settings-group', 'example_secret' );     }      Here is the error I get:               Are you sure you want to do this?          Please try again.      This is the /wp-admin/options.php page. What am I doing wrong?


title: SQL to update custom post taxonomies

text: I have a custom post "review". It uses the same categories and tags from default posts, so they share "category" and "tag" taxonomies. But later I changed the "review" register to have their own taxonomies, "review-category", and "review-tag". Of course all tags and categories previously assigned on reviews was unbind from them. So the question: how can I (if possible) convert all tags and categories only in reviews to the new taxonomies? If I wasn't clear enough:               UPDATE wp_term_taxonomy SET taxonomy='post-tag', parent=0 WHERE taxonomy='tag';      This can convert all "category" to "post-tag", but I need to do it only for reviews. Something like (it doesn't work):               SELECT FROM wp_posts WHERE post_type='review'(     UPDATE wp_term_taxonomy SET taxonomy='post-tag', parent=0 WHERE taxonomy='tag';      ) Thank you!


title: Getting attachment images is cloning some of them

text: So, i got this code to retrieve the images inserted in a gallery within a post:               <?php     $args = array(         'post_type' => 'attachment',         'numberposts' => -1,         'post_status'=>'inherit',         'post_mime_type' => 'image',         'post_parent' => $post->ID,         'orderby' => 'menu_order',         'order' => 'ASC'     );     $attachments = get_posts($args);     if ($attachments) {         foreach ($attachments as $attachment) {             $image_attributes = wp_get_attachment_image_src( $attachment->ID, 'full' );             ?><img title="<?php echo $attachment->post_title; ?>" src="<?php echo $image_attributes[0] ?>" /><?php         }     }     ?>      and the output if fine, except that some pictures are duplicated and given a `class="cloned"` attribute. This code is running within a basic loop:               <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>      with no extra special things before and after. This is happening locally and online as i wanted to be sure about this weird thing; here's the demo. If you inspect the code you'll see this:                                         But if you check the source code you wont see the `class="cloned"` i'm speaking of (devil inside!). It's driving me a bit crazy cos it's messing up with the pictures order in some cases and this one has to be respected from the order decided in the gallery's options. I checked with Opera, Chrome and Firefox, and all show me the same thing. Any clue?


title: White screen and can't activate themes and plugins

text: I have a newly installed Wordpress website. The problem is the front end is just showing a white blank screen. I can access the admin dashboard, and when I went to Themes I got this error. > ERROR: The theme directory "twentyfourteen" does not exist. ![enter image description here](http://i.stack.imgur.com/vJBBA.png) I can install a theme, but I can't activate them and everytime I try I always get this message. > Cheatin uh Same thing for plugins, I can install a plugin but I can't activate them and I always get this message... > The plugin does not have a valid header. Any help would be appreciated.


title: WordPress plugins not showing after switching servers

text: So I recently moved my site to a new server, and now some of my plugins will show only if you are logged in as admin, but will not show to the regular user. However, some plugins still show and work fine. I have already reinstalled and that hasn't done anything. Any ideas? Thanks!


title: To whom do emails get sent via the Wordpress comments form?

text: I am working on a Wordpress 3.9.1 site, specifically the comments form. I have a copy of the site on my server and I want to test the form in the following three ways:   * Adding a new comment   * Replying to a comment   * Replying to a reply of a comment To do so, I want to be careful not to send many emails out to the site owner, and I want to be **very** careful not to send any out any email to site users. I see under site > admin that there are options to "E-mail me whenever":   * Anyone posts a comment   * A comment is held for moderation  These are both unchecked. My question is whether there is anywhere else I should worry about emails being sent (eg if someone replies to a user, does the user get sent an email?)


title: How to change title tags on paginated posts?

text: I've created many post with multiple pages with the nextpage-tag. The problem is that these show up as errors in "Google Webmaster Tools" because of duplicate title tags and meta descriptions. The urls are like this:               http://mypage.com/mypost/     http://mypage.com/mypost/2     http://mypage.com/mypost/3      all of which have the same title and meta tags. Is it somehow possible to include the page number to the meta tags? I'm using the "WP SEO" which surprisingly doesn't have this feature.


title: A carousel slideshow plugin in JavaScript

text: Am looking for carousel slideshow plugin that is similar to the one implemented here. Any JavaScript slideshow that closely resembles that one would do. It does not even have to be a WordPress plugin, any standalone JavaScript library would also be very useful.


title: Pull a post based on a meta value in a custom post type

text: I'm trying to display a post, from a custom post type based on a meta value in that post type, in this case a checkbox that says "if this is checked show it on the front page. Usually I write a query using meta_key = > front_event value => true. But this does not work for custom post types. So I have this:               <?php          $event =array(         'post_type' => 'Events',         'posts_per_page' => 1,         'order' =>'DESC',         'meta_query' => array( array(                 'key' => 'front_event',                 'value' => true ))         );?>      This also does not work. Can anyone tell me what I should be doing differently? Thank you! Nadine.


title: Wordpress adds extra width to post images container boxes

text: when I insert an image into a post, the `<div>` that contains that image (and thus any caption) is set to be wider that the image itself. For example, I have added an image that is 211px wide. The `<div>` that houses the image has an element style of 221px. Is there a way, other than using javascript, to remove that, and have the box of equal width to the containing image?


title: Thumbnails appear to be zoomed

text:
Im using a theme which has my thumbnais set to 150x150px. But after installing plugin (just too check it out) I noticed it displays them correctly, but the default thumbnails are zoomed in. Can anybody give me a clue on where I should be looking? This is the css for the thumbs:               #content .featured_box { width: 150px; float: left; margin-right: 14px; color:#afafaf; }     #content .featured_box img { width: 150px; height: 150px; }     #content .featured_box p { font-size: 11px; color:#afafaf; }     #content .last { margin-right: 1px; }     #content .first { margin-left: 1px; }          .recent_box { width: 150px; float: left; margin-bottom: 15px; }     .recent_box img { width: 150px; height: 150px; }     .recent_box h3 a { font-size: 13px; color: #000; text-decoration: none; }     .recent_right { float: right !important; }      Edit: Im still no further forward with this, can anybody else think of anything else why/how this would be happening? Could it be down to the video thumbnail is 16:9 and the thumbail is 4:3? Here is the php stuff also:               <a href="<?php the_permalink(); ?>"class="img_hover_trans"><?php the_post_thumbnail('featured-small'); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
      edit 2: I found this in my functions.php               if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9       add_theme_support( 'post-thumbnails' );       add_image_size('featured-big',335,338,true);       add_image_size('featured-medium',284,176,true);       add_image_size('featured-small',150,150,true);       add_image_size('featured-sidebar',58,58,true);       add_image_size('featured-blog',336,157,true);       add_image_size('recent-sidebar',150,150,true);     }      edit 3: Strange on this, but if I change one of the above lines to:                 add_image_size('featured-small',200,150,true);      It displays in the correct aspect ratio (even though its set to 150x150 everywhere else). I dont know why that works, but it does.


title: Phantom page can't get rid of/can't get at to change

text: Hi: I need to add a page to my very first WP site, which, at present, only has 4 pages on it (though one page has photo albums on it, which generate their own pages). I built the theme, the site is very simple, and up until now, has been fine. But now I seem to have a phantom page I can't find, can't delete, and can't change. The site is at http://www.twistintomradio.com If you type in another nonexistent page url in a browser, such as: http://www.twistintomradio.com/about.html, you get a 404 page, as is proper. But if you type in: http://www.twistintomradio.com/mountainrose.html, you get a page with the mountain rose logo that I placed on the homepage. I don't remember creating this page, but if I did, I deleted it as it does not come up when I go to "ALL Pages" in the Admin. But I want to build that page now. But when I "ADD NEW" page and name it mountainrose.html, the page with the logo appears in my browser, no matter what I do. I've cleared the caches in different browsers, on different computers, etc. I've cleared the WP cache (using Quick Cache plugin.) That page still comes up. I've trashed and permanently deleted this attempt to build the page now, it isn't in my list of pages, it isn't in the trash, but still the page comes up in browsers. I've looked on the server in the wp-content directory - no such page there. Where is this page coming from? How can I get rid of it? Thanks for any assistance!


title: How to show wp.me shortlink underneath each post?

text: What is the variable that holds the wp.me url? / What is the webservice / call that provides me the wp.me url? / What is the workaround to read that rel tag from the dynamic generator header (on a self hosted domain). ... to show it beneath each post.


title: Custom Post Type archive-{post-type}.php not working

text: My permalink is set to a custom structure: /blog/%year%/%monthnum%/%day%/%postname%/ I have a custom post type we'll call "post-type". I also have an archive page named archive-post-type.php Accessing domain.com/post-type/ though is defaulting to archive.php and skipping archive-post-type.php My register_post_type looks like this:                   register_post_type( 'ch_post_type',         array(             'labels' => array(                 .......             ),         'public' => true,         'has_archive' => 'post-type',         'show_in_nav_menus' => false,         'menu_position' => 100,         'menu_icon' => 'dashicons-category',         'supports' => array('title','editor','custom-fields'),         'rewrite' => array( 'slug' => 'post-type', 'with_front' => false ),         'hierarchical' => true         )     );      Under Settings > Reading, I have a Page set up for Home and Blog. I've flushed my permalinks as well. I know others have had this problem and I have not yet seen an answer that solves it. I'm on version 3.9 Thank you in advance!


title: Display Registered Taxonomies

text: Another question. I have a custom post type called "Articles" Within that I have registered some taxonomies using register_taxonomy called "Article Topics" So my client would pop over to Articles, put in a new article, fill out the publisher, and link to where its published, choose the topic its about...all good. Except: How do i get those "topics" to display in the sidebar. How do i make a sub-nav out of registered taxonomies? Something like this:               <?php wp_list_categories($args); ?>       Is this even a good idea? Or should I just say to hell with it, and go back to categories, and ditch the custom post type? Thanks. Nadine


I just move my server to Mac server before I use to be with GOdaddy was no problem updating framework of my theme now I'm getting this error `Failed: Filesystem preventing downloads. ( ftpext)` not sure why but I've put this code in wp-config.php already               putenv('TMPDIR=' . ini_get('upload_tmp_dir'));          define('FS_METHOD', 'ftpext');          define('FTP_BASE', 'wpdirectory');          define('FTP_USER', 'myuser');          define('FTP_PASS', 'mypassword');          define('FTP_HOST', 'myftphost');          define('FTP_SSL', false);


title: How can I migrate to worpress using my last blog's rss

text: I have all of the my blog's posts in a rss file and I want to copy them in my blog.How can I do this?!?


title: Append Second Link to Read More

text: I'm looking for a way to filter the "Read More" link so I can append a second link and text. I know how to filter the text but not the entire output, eg: * * * Standard post excerpt before the more quicktag.... Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ut auctor ligula. Vestibulum ac lectus quis nisl tempor fermentum. Maecenas urna erat, convallis eu. Read More | Add a Comment * * * Thank you for any links / advice!


title: How to selected value default in option list?

text: I researched but did not find right answer to my question I have custom post type for states, cities and countries and would like to set the default value in the country list for "Argentina", but do not know how to solve it. see my code:                       <select name="pais" class="pais-select">                              <option value="">País</option>                         <?php                             $pais = diretorio_request('pais');                             foreach(diretorio_countries() as $country) {                         ?>                         <option value="<?php echo $country; ?>"<?php echo ($pais == $country) ? ' selected="1"' : ''; ?>><?php echo $country; ?></option>                         <?php                             }                         ?>                     </select>       I tried something like "selected = selected" but does not mark Argentina scored Zimbábue (rsrs)


title: Listing future posts together with normal posts

text:
In my blog I'm displaying lists of posts from every category I have in the homepage. I have a column for each category. The code is this:               <?php     $categories = array('3', '4', '5');          foreach ($categories as $category):     ?>

<?php echo  get_the_category_by_ID($category); ?>

     <?php      global $post;     $args = array('numberposts' => '3', 'category' => $category, 'post_status' => array('publish', 'future' ));     $myposts = get_posts($args);      Now I'd need to display also posts occurring in the future. They are called events, I guess. I know I cannot use the wordpress status flag of the posts, because it has another purpose. I also tried the Event Manager plugin, but I can't find any way to mix these custom posts with the normal ones. Any suggestion?


title: WP native tag suggest metabox. How does it process tag id?

text: As you know, there is a metabox that suggests tags as you type to input box. Is anyone knows how this function gets the tag's ID (term_id) which is selected? I have looked at some of the core files but it seems only the tag name is retrieved and the ajax response returns only the name, no sign of id. But it's just impossible as the tag is updated **by the tag's ID but not it's name** upon submitting or updating the post The core files i've looked at:               wp-admin/includes/meta-boxes.php     wp-admin/js/post.dev.js     wp-admin/admin-ajax.php     wp-includes/post.php     wp-includes/js/jquery/suggest.dev.js     wp-includes/taxonomy.php


title: referencing the current user in a page i created in wordpress

text: I created a page in wordpress and i tried to access the current logged in user via wp_get_current_user() and am getting error "function undefined". please how do I make this function available in my page.


title: SSL Breaks Wordpress CSS

text: We purchased an SSL certificat from network solutions (would never recommend them to my worst enemy, btw). Apparently it's activated... did a few checks that says it's activated for our domain. But when I put in https://www.texasshredderclassic.com the entire site breaks. To be more specific, by "breaks," I mean it completely disables the CSS, and my login User+Password no longer work (seems like this might be a clue?) You can see it by going here: https://www.texasshredderclassic.com I've tried downloading Wordpress HTTPS, but that kicks me out of the admin page and also mangles the CSS. I don't care if it works on the entire site, just need it working for our form page (texasshredderclassic.com/registration) – using gravity forms and connecting to authorize.net! I'm tearing my hair out here because I don't have a clue where to go next. Seems like we have the SSL cert... just can't get the damn thing to work! Any help is GREATLY appreciated!


title: Category page for custom-taxonomy shows 404 when using custom permalink structure

text: I'm having a small issue with category pages for a custom taxonomy when custom permalinks are used, and I was wondering if someone might be able to help out and point out where I'm going wrong. I've created a taxonomy "Brands" for use with a custom post type (in this case, Products), using the code below place in the functions.php file of the theme. I've created a page template for the Brands page, which lists all the brands using the wp_list_categories($args) template tag, and that's all fine. Now, if I use Wordpress' default permalink settings (where you get urls ending with ?page_id=7 and similar), clicking on any of those brands in the list, takes you to a category page which lists all the products for that brand - which is exactly the intent. If however, I set any other custom permalink structure (say /xyz/%postname%/ ), when you click on the brand name I get the 404 page instead of the category page (the same also happens when clicking view on a Brand when viewing the list within the Wordpress admin). With the custom permalink structure, when clicking on the brand it appears to be using the correct url structure (http://www.siteroot.com/brands/brandname/) when showing the 404 page. With the default permalink setting it goes to http://www.siteroot.com/?brand=brandname, which works correctly. I've checked various guides on making custom taxonomies, and have tried to be very careful with setting the rewrite for the taxonomy, and now I'm at a loss as to what the issue is. Any help will be much appreciated.               add_action( 'init', 'build_taxonomies', 0 );          function build_taxonomies() {            register_taxonomy(         'brand',         'products',         array(         'labels' => array(             'name' => 'Brands',             'singular_name' => 'Brand',             'search_items' => 'Search Brands',             'popular_items' => 'Popular Brands',             'all_items' => 'All Brands',             'parent_item' => 'Parent Brand',             'parent_item_colon' => 'Parent Brand:',             'edit_item' => 'Edit Brand',             'update_item' => 'Update Brand',             'add_new_item' => 'Add New Brand',             'new_item_name' => 'New Brand Name'             ),             'hierarchical' => true,              'public' => true,             'show_ui' => true,             'sort' => true,             'query_var' => true,               'args' => array('orderby' => 'term_order'),             'rewrite' => array('slug' => 'brands', 'with_front' => false)         )     );      }


title: Sidebar "Wrapper" Plugin/Widget?

text: I'm coming from a Joomla background and I'm setting up a Wordpress installation for a friend's Shoutcast station. I would have done the setup in Joomla, as I'm more familiar with it, but I wanted to be able to hand administration of the WP install over to my friend once it's going, and I feel Joomla is a bit over her head. We're using the shout-stream plugin for providing a sidebar stream player. We don't care for the stats display of shout-stream, so I was attempting to use a custom PHP **what's playing now** script I wrote for another station page I did in Joomla. Joomla has a component/plugin that can encapsulate a PHP script and display it in the sidebar. ## My question is: Is there a similar plugin for Wordpress? I searched the plugin repository and found one which, at first glance, looked like it might work **(wp-wrapper)** , but further checking indicates it has to be used only on a post or a page. We want the PHP script to run/display in the sidebar. Is there such a plugin for WP or am I stuck going back to Joomla? Thanks   Dave


title: The best way to protect uploaded media in WordPress?

text: I'm new to WordPress as I normally code my stuff by hand, I've been uploading some media to display links to within protected pages, which is great, however, anyone can access the direct url of the media. Does anybody have a suggestion how to stop this? I'm reluctant to just go hacking into .htaccess.


title: Post X of Y in single.php / sidebar.php

text: Is there a way of putting "Post X of Y" into my sidebar? I think I can only show it when it is a single blog post (something like checking if the content is_single) but I want to be able to see which post I am viewing. Googling "wordpress post x of y" for the last 20 minutes has given me a lot about category x in page y or something similar, so I thought to ask here.


title: the category city made as a subdomain

text: i'm looking for a solution wherein the category city will be made as a subdomain. For example, when a user search for a certain thing in the main domain and under a certain city, the user will be directed to the subdomain "city.domain.com". same to a user who uploaded a product, for example, under a city - the product will be automatically be under the city category, which could then be viewed in the subdomain. thanks a lot.


title: how to allow all users who register to a main domain be automatically be registered to all subdomains

text: i'm looking for how to let those users who registered on a subdomain be automatically be registered in all my subdomains. in this case, the users don't need to register again to the subdomains, when already registered to one. this means that they have a single account on all subdomains. thank you.


title: Get fields from metabox array

text: In my functions I'm registering multiple metaboxes with custom fields. A single metabox array for instance, looks like this: In functions.php               $meta_boxes[] = array(         'id' => 'general_info',         'title' => 'General Information',         'pages' => array('post', 'page', 'link'), // multiple post types, accept custom post types         'context' => 'normal', // normal, advanced, side (optional)         'priority' => 'high', // high, low (optional)         'fields' => array(             array(                 'name' => 'Asking Price',                 'id' => $prefix . 'asking_price',                 'type' => 'text',                 'std' => ''             ),             array(                 'name' => 'Currency',                 'id' => $prefix . 'currency',                 'type' => 'text',                 'std' => 'USD'             ),             array(                 'name' => 'Salesman',                 'id' => $prefix . 'salesman',                 'type' => 'text',                 'std' => 'Your Name'             )         )     );      In my theme, how can get all the field names (and even values if possible) from metabox `general_info` ? I'm trying to retrieve data from each metabox separately.


title: How to inject content after <body>

text: I would like to inject some elements directly after the `<body>` tag. Is that possible using only WordPress hooks?


title: Adding vkontakte social "like" button to posts results in multiple buttons on first post only

text: I'm trying to add a VKontakte (pretty much the russian version of Facebook) "like" button to wordpress posts by placing it within the loop along with Twitter/Facebook "like/share" buttons. While this works fine on single posts, on the news overview with excerpt poss the button displays repeatedly on the first post and not on ANY other post. I'm following these instructions: http://vk.com/developers.php?o=-17680044&p=Like&s=0 I know the issue has to be with something in the javascript messing with the loop and repeating it in one post instead of beneath EVERY post but no idea how to fix it. Oddly enough their "share" button works absolutely fine. Any help appreciated as all I so far was able to find about it was in russian...which I don't speak :/


title: Meta Boxes causing Header errors

text:
I'm attempting to move some meta boxes and custom post types to a plugin file (to survive future theme updates). One issue is that now, all my wp_nonce values are returning an "undefined index" notice (I realize that this isn't a huge issue, but I'd like my code to be working in the cleanest possible manner). The main issue, however, is that the $_POST in the save function causes a warning error of "headers already sent" with conflict from the pluggables.php file (line 876). Here's the code that I'm attempting to use:               // Add and Save Meta Boxes for Congregation Post Type     add_action( 'add_meta_boxes', 'add_congregation_metaboxes', 1 );     add_action('save_post', 'save_address_meta', 1, 2); // save the Address field          function add_congregation_metaboxes() {         add_meta_box('congregation_address', 'Congregation Address', 'congregation_address', 'congregation', 'side', 'default');     }          // The Congregation Address Metabox      function congregation_address() {         global $post;         // Noncename field          wp_nonce_field( plugin_basename( __FILE__ ), 'address_noncename' );         // Get the first line of the address         $address_line1 = get_post_meta($post->ID, '_address_line1', true);         // Get second line of the address         $address_line2 = get_post_meta($post->ID, '_address_line2', true);         echo '
Address
';         echo '<input type="text" name="_address_line1" value="' . $address_line1  . '" class="widefat" />';         echo '<input type="text" name="_address_line2" value="' . $address_line2  . '" class="widefat" />';         }          // Save the Metabox Data !! The error is in the wp_verify_nonce     function save_address_meta($post_id, $post) {         // Verify Nonce           if ( !wp_verify_nonce( $_POST['address_noncename'], plugin_basename(__FILE__) )) {           return $post->ID;           }         // Check permissions         if ( !current_user_can( 'edit_post', $post->ID ))             return $post->ID;         // Cycle through array         $address_meta['_address_line1'] = $_POST['_address_line1']; //This is the line that explodes         $address_meta['_address_line2'] = $_POST['_address_line2'];         // Add values of custom fields         foreach ($address_meta as $key => $value) { // Cycle array!             if( $post->post_type == 'revision' ) return;              $value = implode(',', (array)$value);              if(get_post_meta($post->ID, $key, FALSE)) {                  update_post_meta($post->ID, $key, $value);             } else {                  add_post_meta($post->ID, $key, $value);             }             if(!$value) delete_post_meta($post->ID, $key);          }     }      Any help is appreciated!


title: Tricky URL rewrite with custom values in url

text: We have custom post type as `user_images` and each of these post has a image attached with image name is 3 digit number followed by extension. When the url               http://mysite.com/wp_username/3digitnumber      is accessed, we want to use a custom template inside theme to show the image Tricky part is the url should remain same for visitor but internally should call the custom template with the `wp_username` and `3digitnumber` as query variable. `wp_username` is valid WordPress user nicename. Couldn't get a clue so made a minor compromise to url format               http://mysite.com/image/wp_username/3digitnumber      Tried creating a page using the custom template and used the following htaccess rule               RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{QUERY_STRING} !^iuser=.*     RewriteCond %{REQUEST_URI} !^/wp-content/(.*)$ [NC]     RewriteRule ^image/(.*)/([0-9]+)$ /index.php?post_type=page&p=564&iuser=$1&iname=$2 [L]      where 564 is the page id with custom template. However the url changes to               http://mysite.com/custompage/?iuser=myuser&iname=001      Also tried               function add_rewrite_rules($rules) {         $newrules['image/([^/]+)/?([0-9]{1,})/?$'] = 'index.php?post_type=page&p=564&iuser=$matches[1]&iname=$matches[2]';              $rules = $newrules + $rules;         return $rules;     }     add_filter('rewrite_rules_array', 'add_rewrite_rules');      (called `$wp_rewrite->flush_rules();` once after adding this.) But again the url changes to               http://mysite.com/custompage/?iuser=myuser&iname=001      **Answer:** Solution provided by @Milo works perfectly. The url changed to one with query string because of Browser Cache


title: Missing argument 2

text: Hi just looking for help with this cant solve this Thanks Missing argument 2 for t2t_homepage_slide()XXXXXXX/index.php on line 41 and defined in/xxxxxxx/ten.php on line 94               <?php                         $slide1 = get_option($shortname.'_slide_1');                          $slide2 = get_option($shortname.'_slide_2');                          $slide3 = get_option($shortname.'_slide_3');                          $slide4 = get_option($shortname.'_slide_4');                          $slide5 = get_option($shortname.'_slide_5');                      ?>                     <?php if($slide1 != '') : ?>                         <?php t2t_homepage_slide($shortname.'_slide_1'); ?>   <--line 41                     <?php endif; ?>                     <?php if($slide2 != '') : ?>                         <?php t2t_homepage_slide($shortname.'_slide_2'); ?>                     <?php endif; ?>                     <?php if($slide3 != '') : ?>                         <?php t2t_homepage_slide($shortname.'_slide_3'); ?>                     <?php endif; ?>                     <?php if($slide4 != '') : ?>                         <?php t2t_homepage_slide($shortname.'_slide_4'); ?>                     <?php endif; ?>                     <?php if($slide5 != '') : ?>                         <?php t2t_homepage_slide($shortname.'_slide_5'); ?>      ##               function t2t_homepage_slide($slide,$size) {     <--- line 94         global $wpdb;              $image = get_option($slide);         $caption = get_option($slide.'_caption');         $price = get_option($slide.'_price');         $url = get_option($slide.'_url');


title: Simplify the admin end

text: I'm thinking about using WordPress as a content management system for a school. The frontend of WordPress itself would never be seen by the students, but the admin interface would be used by teachers to post bulletins and other messages and news items. Wordpress would then provide an RSS feed to integrate with the schools existing systems. My question is how can the WordPress backend be simplified for use by people with very little technical knowledge. All the is really needed for most users is the ability to view previous posts, and write posts. Can this be easily achieved using some themes or plugins? Or am I better off using another system for this, if so what? Thanks.


title: How can I improve the performance of this query_posts loop?

text: I created a WordPress page template to build a customised XML feed for certain WordPress posts on my site. Specifically, the page template renders XML and only includes certain custom post types and only if these posts contain specific meta data. I'm using the data to feed WordPress content to an iOS application. It seems to work great; however, the response times from the server vary and often fail. My hosting company ( MediaTemple ) has suggested I could improve performance by making the database query more efficient. Are there any standard optimisation tips for this kind of query?               <?php     $numposts = -1;     $posts = query_posts( '&showposts=' . $numposts . '&post_type=listings' );     header("Content-Type: application/rss+xml; charset=UTF-8");     echo '<?xml version="1.0"?>';     ?>     <rss version="2.0">     <channel>         <title>My custom feed</title>         <?php foreach ($posts as $post) { if ( get_post_meta($post->ID, 'mymeta', true) ) { ?>             <item>                 <various item elements...>             </item>         <?php } ?>         </channel>     </rss>


title: Get logged in username in wordpress url

text: I want to get the username of the logged in users in the URL of my wordpress site. Like if user: **arvind** is logged in, I want to get the url as **'www.wp.com/arvind'** or **'www.wp.com?user=arvind'**. Is there any solution for that?


title: Migrating database / content of non-CMS site to Wordpress

text: I have a non-CMS website which is fully build with PHP with a lot of content in it. I don't want to add my posts manually in Wordpress, because that's a pain in the ass (I am talking about 5000 posts)... So my question would be: how do I do this? Is it even possible to clone something like this?


title: Dynamically add more fields/remove last field in a form

text: What I want to achieve is to build a form, which contains buttons "add one more field" and "remove last field" that would do exactly this - add a field dynamically to my form or remove the last one. I have done this in Drupal, but am not sure how exactly to achieve this in WordPress. My basic logic is to use ajax to insert new fields dynamically or remove the last one. Is there something like Form API in Wordpress (I tried to search but without success) that will me my task easier to achieve?


title: Unexpected results with conditionals inside template part

text:
**Scenario:** I have a template part `loop-product.php` which i am calling from `home.php`, `taxonomy.php` and a page template `template-products.php`. Inside that template part `loop-product.php` file i am setting the number of columns by checking `is_home()` conditionals. **Problem:** The conditional works fine for homepage, taxonomy page but its still set on the page template. On the product item i have added a class `columns-$cols` so you can check it on the site. Its showing `columns-4` on the product template page where it suppose to show `columns-3`.               <?php         $j = 1;         if(is_home()){             $cols = 4;         }else{             $cols = 3;         }         if(have_posts()):while(have_posts()):the_post();                  // getting thumbnail image here          ?>                      <div class="product-item <?php echo 'columns-'.$cols ?>" <?php if($j%$cols == 0){ echo 'style="margin-right:0;"'; } ?>>                   <a href="<?php the_permalink(); ?>">                                              <img src="<?php echo $img[0]; ?>" width="100" height="75" alt="<?php the_title(); ?>">
<?php the_title(); ?>
                     <?php                         if($price): ?>                         Price: <?php echo $price; ?> BDT                     <?php endif; ?>
                  <?php if($j%$cols == 0){ echo '

'; } ?>                       <?php $j++; endwhile; endif; ?>

      Check the site here http://computercarebd.com/ Appreciate your time. Thanks! Page template code: http://pastebin.com/CzRgzzVF


title: How to access function from outside of a class within this class in WP plugin?

text: I am developing a WP plugin called e.g. **DD_Awesome_Plugin** and this is my code so far (simplified version without additional code logic within class functions):               class DD_Awesome_PLugin {              public function __construct()         {              }              public function add_menu_page()         {             add_options_page('DD Awesome PLugin', 'DD Awesome PLugin', 'administrator', __FILE__, array('DD_Awesome_PLugin', 'display_options_page'));         }              public function display_options_page()         {             $plugin_options = get_option('dd_my_awesome_plugin');             echo "Here we go admin!";                  /* and after echo I need to triger a function "trigger_me_from_class()" that is located outside of the class. */         }          }               add_action('admin_menu', function() {         DD_Awesome_PLugin::add_menu_page();     });          add_action('admin_init', function() {         new DD_Awesome_PLugin();         include_once dirname(__FILE__) . ('/simple_html_dom.php');     });                /* just trigger this function "trigger_me_from_class" from "display_options_page" function (situated in DD_Awesome_plugin class above) */     public function trigger_me_from_class()     {         $str = date('Y-m-d H:i:s', time());         wp_mail('info@example.com', 'DD success message', "Success at $str." );     }


title: Users Can Only Post Reviews When Logged In?

text: I use the plugin WP Customer Reviews on my site but to leave a review you must fill out a form even if you are logged in. I would like to make it so that if a non logged in user goes to submit a review red writing appears explaining that you must be logged in to post a review. I would also like to remove some fields on the login form. Does anyone know how I can modify the plugin to do this? I don't know where to start and I don't want to damage any core files. I've also contacted the plugin developers and asked this same question on their forums but got no response.


title: WP_Query Limit Data_Query last 90 days

text: I want to perform a `WP_Query` that finds all posts limited to the last 90 days. From my understanding, WP_Query accepts numerical values for months, years, days, etc, but I'm not sure I understand how to pass an argument that says "get all posts from 90 days ago until today." I'm guessing I have to get the current time and then subtract 90 days from that, but it looks like the "day" argument is relative to the month (i.e. 1-31). There is no way to compare timestamps? This is sort of what I have so far -               $today = getdate();      'date_query' => array(                         array(                             'day' => array( $today["day"], $today["day"] - 90 ),                             'compare'   => 'BETWEEN',                         )                     )


title: Why $ for jquery doesn't work?

text: I used the following to enqueue jquery plugins:               <?php         function my_scripts_method() {             wp_enqueue_script(                 'custom functions',                 get_template_directory_uri() . '/js/main.js',                 array('jquery'),                 '1',                 true             );             wp_enqueue_script(                 'dotdotdot & lightbox',                 get_template_directory_uri() . '/js/plugins.js',                 array('jquery'),                 '1',                 true             );         }         add_action('wp_enqueue_scripts', 'my_scripts_method');      And I don't know it it's related but jquery only responds to calling `jquery(...` and not `$(...`. Why is that?


title: How do I reclaim either deleted pages or their permalinks?

text: A client deleted the the main administrator account. All the site’s core pages linked to the account, so they disappeared as well. The last known backup was in February, so can’t roll the database back to the backup without loosing new users and posts. The client has started rebuilding the core pages by copying and pasting content from Google cached pages into new pages on a new administrator account. **The permalinks cannot be set to the deleted pages permalink and an increment (-2) is always placed at the end of the link.** **Is there a way to:**   1. Attach the old pages to a new user account. Do they still exist in the database? How would I find them?   2. Or, how do I scrape the record of the original pages out of the database so that the permalinks can be used for the new reconstructed pages?


title: How to prevent tinymce macro from inserting nbsp;?

text: I've got the following macro button defined to wrap a selection in a shortcode in the wp_editor visual editor:               (function() {     tinymce.create('tinymce.plugins.ingredient_name', {              init : function(ed, url){             ed.addButton('ingredient_name', {             title : 'Tag ingredient',             onclick : function() {                 var text=ed.selection.getContent({'format':'text'});                 ed.execCommand('mceInsertContent',false,'[ingredient_name]' + text + '[/ingredient_name]');             },                 image: url + "/name.png"             });         }     });          tinymce.PluginManager.add('ingredient_name', tinymce.plugins.ingredient_name);          })();      The macro works as intended, except that tinymce is also inserting &nbsp in front of the resulting shortcode. So, instead of this result:               1 [ingredient_name]pound[/ingredient_name] salami      I get this:               1 [ingredient_name]pound[/ingredient_name] salami      this then somehow gets mangled when inserting to the DB, and rendered to the template, I get '1Â pound salami'. I can go back and remove the offending &nbsp's, but I'd prefer tinyMCE not insert that entity in the first place. Any ideas?


title: How to display comments by logged in user and responses

text:
I want to create a profile page and display the logged in persons comments, AND also responses to his/her comment. Like this: > **Post title** > > Comment (by logged in user) > > --->Responses(replies) to his/her comment Any ideas how to do this? EDIT: This is what I got right now, I get the logged in persons comments with use of a shortcode on a page that I have. **What I want to get is also the responses for each comment made by this logged in user.**               <?php     /*     Plugin Name: Show Recent Comments by a particular user     Plugin URI: http://blog.ashfame.com/?p=876     Description: Provides a shortcode which you can use to show recent comments by a particular user     Author: Ashfame     Author URI: http://blog.ashfame.com/     License: GPL     Usage:      */          add_shortcode ( 'show_recent_comments', 'show_recent_comments_handler' );          function show_recent_comments_handler( $atts, $content = null )     {         extract( shortcode_atts( array(              "count" => 10,             "pretty_permalink" => 0             ), $atts ));              $output = ''; // this holds the output              if ( is_user_logged_in() )         {             global $current_user;             get_currentuserinfo();                  $args = array(                 'user_id' => $current_user->ID,                 'number' => $count, // how many comments to retrieve                 'status' => 'approve'                 );                  $comments = get_comments( $args );             if ( $comments )             {                 $output.= "
\n";                 foreach ( $comments as $c )                 {                 $output.= '
';                 if ( $pretty_permalink ) // uses a lot more queries (not recommended)                     $output.= 'comment_ID ).'">';                 else                     $output.= 'comment_post_ID.'#comment-'.$c->comment_ID.'">';                            $output.= $c->comment_content;                 $output.= '';                 $output.= "
\n";                 }                 $output.= '
';             }         }         else         {             $output.= "
You should be logged in to see your comments. Make sense?
";             $output.= '
Login Now →
';         }         return $output;     }     ?>


title: Can't access WP site over WiFi network

text: I'm making a mobile site and I'm using the main computers IP adress to connect to it from the iphone `10.0.0.1/wp` With normal sites it works fine, but the WP site I get is stripped from CSS, JS, and images, only plain text. on the mac and the iphone-simulator it works fine. Is it something known and configurable?


title: How to export all content with feature images?

text: I want to export all content with featured images from my localhost WordPress site to the production blog,but when I tried using the default WordPress export-import plugins ,all content get exported (including post images) except for featured images. As you can see here ,this problem is been faced by many others also .So how to export and import all content including featured images.I am using WordPress 3.4.1.


title: How to Add Custom Fields to Custom Taxonomies in Wordpress CLEANLY

text: Saving extra fields that were added to a taxonomy. I want the most proper & efficient way of doing so. **Where should I save the new fields?** 2 possible solutions are to 1) Use the Wordpress options table as described here... Add Custom Fields to Custom Taxonomies. This is admittedly "not clean" and assumed not to be the correct answer.               // A callback function to save our extra taxonomy field(s)     function save_taxonomy_custom_fields( $term_id ) {     if ( isset( $_POST['term_meta'] ) ) {         $t_id = $term_id;         $term_meta = get_option( "taxonomy_term_$t_id" );         $cat_keys = array_keys( $_POST['term_meta'] );             foreach ( $cat_keys as $key ){             if ( isset( $_POST['term_meta'][$key] ) ){                 $term_meta[$key] = $_POST['term_meta'][$key];             }         }         //save the option array         update_option( "taxonomy_term_$t_id", $term_meta );     }     }      2) Add a new table as described here Custom Taxonomies in Wordpress which follows the naming convention of 'wp_' + customtaxonomykey + 'meta'. 3) Some other option


title: Visual editor in comments with custom buttons

text: I have loaded WP visual editor in comments using `wp_editor` function and I want to customize the height and buttons of the editor, also it would be much better to show Text mode/tab only and disable the Visual mode/tab. Here my code:               <?PHP         $settings = array(                           false,        // wpautop                           false,        // media_buttons                           'comment',    // textarea_name                           5,            // textarea_rows                           'None',       // tabindex                           'None',       // editor_css                           'test',       // editor_class                           true,         // teeny                           false,                           true,         // tinymce                           true          // quicktags                          )          ?>     <?php wp_editor( 'Enter your comments here', get_the_ID(), $settings); ?>       Thanks