title: Applying OO patterns and principles to plugin development

text: I'm busy writing my first plugin, using PHP 5.3.5. I come from a C# environment, and I must say I'm more than happy with the level of support for good, solid OOP techniques in PHP. However, I'm a little uncertain how to structure a plugin using classes. I have a plugin class that takes care of hook registration in its constructor, and some worker classes like a mail queue and mailer, but I have one or two non-class scripts, mostly for forms, that I don't quite know how to neatly fit into classes. What resources are their I can consult for guidance on this aspect of my OO plugin? The plugin is for mass mailing, i.e. mailing to all subscribers, on schedule etc. It registers a custom post type for mail templates, with add new and edit capabilities, and it adds its own menu to the bottom of the admin menu, currently with two submenu pages: 'settings' and 'send mail'. It also adds an 'opt out' option to the user profile page, but that's quite tidy and easy to include the main plugin class.


title: save radio button selection in post-meta on submit

text: Right now I'm reading tags from the tag box, and putting them in a form with radio buttons so the user can choose a "main tag" from the tags they just typed in:               function write_tags(){         var rawtags = $j(".tagchecklist").find("span").text();          var stags = rawtags.split("X");         var ftags = stags.slice(1);              document.getElementById('tag_options').innerHTML = '';              $j.each( ftags, function(i, l){             $j("#tag_options").append('<input type="radio" name="mainTagButtons" value="' + i + '" /> '+ l +'<br />');         });          }       Now that I have these displayed and selectable, I have no idea how to save the selection to post meta, or how to check the value there to see if it's saved. First I tried this:               if (!empty($_POST['mainTagButtons'])) {       $this->data['mainTag'] = $_POST['mainTagButtons']; }               if ( isset($this->data) && $this->data != '' )         update_post_meta($id, 'mainTag', $this->data);      But I'm not sure how to test to see if it worked. Any ideas?


title: How to cause the Wordpress web interface to update via FTP

text: On some installations of Wordpress, all updates performed through the administrative web interface require the FTP username and password to be entered before they take place. Others update and install themes/plugins just fine without needing FTP information. I'd like to test some permissions hunches by forcing the web administrative interface to update via FTP. Is this possible? ( **Note:** Certainly using a regular FTP client would work, but I'd like to keep the client away from as many additional steps and applications as possible. Keeping them to the web interface would make life... simpler.)


title: How can I search an FAQ before a contact form is submitted?

text: I receive many queries via a contact form (Contact Form 7) that are similar in nature. I'm planning to implement an FAQ on my site, so visitors can check for information there. Of course, I still want visitors to be able to contact me, but it would be really useful if I could suggest FAQ articles to visitors before they submit a contact form, based on what they have written. How would I go about implementing something like this for Wordpress 3.x? Could it be done using my existing contact form plugin or must I look at a new approach entirely? I haven't decided on an FAQ plugin yet.


title: Adding specific post category between posts in loop

text: I'm building a site built on a masonry theme and would like to add a specific category of post ('Sponsors' in this case) after every 3rd post. An example would go: Post Post Post   Sponsor Post Post   Post Sponsor Post   Post Post Sponsor I've searched quite abit for a similar problem but the closest I can find is for placing an ad such as below. However I'd like to replace the ad with a category post.               <?php     $count=0;     // Begin loop     while ( have_posts() ) : the_post();     $count++;     get_template_part( 'content', get_post_format() );     if ( $count%3==0 ) {     echo 'AD';     }     endwhile; ?>      I'm still a total beginner in programming (especially php and wp) but I have a few ideas of how it could be accomplished. I've tried many different ways but I'm basically shooting in the dark. This is the basic idea of what I've tried ("Sponsors" is cat=22).               <?php $count=0;     while ( have_posts() ) : the_post();     count++;     if ($count%3==0) {        <?php query_posts($query_string . '&cat=22&posts_per_page=1'); ?>        get_template_part( 'content', get_post_format() );     else        <?php query_posts($query_string . '&cat=-22&posts_per_page=1'); ?>        get_template_part( 'content', get_post_format() );     ?>      This obviously doesn't work (query_posts shouldn't be used in a loop?) but I hope it shows some of my thought process. I haven't been able to find a way to exclude a category from a loop already running. Another idea I had would be 2 loops where the first loop excludes the "Sponsor" category and posts 3 times and then a second loop which only posts 1 post from "Sponsor". However when I do this, I don't know how to make this cycle repeat itself (ie. only 4 posts show up). How would I go about doing this? I appreciate the help!


title: Add code to admin bar only

text: I am trying to add a QR code to the bar and I can do this but it's my first time to make a WordPress plug-in and I'm having trouble. It ends up showing to everyone even if they are not an admin or even not logged in. Any ideas or guidance would be very grateful.               function selfURL() {         $s = empty($_SERVER["HTTPS"]) ? ''             : ($_SERVER["HTTPS"] == "on") ? "s"             : "";         $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;         $port = ($_SERVER["SERVER_PORT"] == "80") ? ""             : (":".$_SERVER["SERVER_PORT"]);         return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];     }     function strleft($s1, $s2) {         return substr($s1, 0, strpos($s1, $s2));     }          $urlToEncode=(selfURL());          generateQRwithGoogle($urlToEncode);     function generateQRwithGoogle($url,$widthHeight ='30',$EC_level='L',$margin='0') {         $url = urlencode($url);          echo '<img src="http://chart.apis.google.com/chart?chs='.$widthHeight.     'x'.$widthHeight.'&cht=qr&chld='.$EC_level.'|'.$margin.     '&chl='.$url.'" alt="QR code" widthHeight="'.$widthHeight.     '" widthHeight="'.$widthHeight.' "/>';     }


title: display public excerpt for private post

text: Thank you in advanced. I know there are plugins that can do this, but I am looking for a simple solution for my function file. I would like to display the excerpt for all posts with the more tag for public visitors, even for private posts.


title: How to Remove all Instances of edit_post_link

text: Can someone please assist with how to remove from my theme, whilst in author mode, the edit_post_link (Edit link), throughout all my pages. Which php files in the Twenty Eleven theme (WordPress v3.2) do I need to comment out to no longer display this edit link? I realise that you only see this during author mode but would like to know how to remove altogether. Thanks.


title: Is it necessary to translate WordPress key terms when localizing a plugin

text: In translating a plugin, how should "WordPress" key terms be handled? For instance, should the following need translations or should they be left as is:   * Taxonomy   * Custom Post Type   * Taxonomy Term   * Plugin Since these terms all have very specific meanings and are documented within the Codex using these English words, would it make more sense to just leave them in English as opposed to translating them? I almost think of these words as proper nouns that would not be changed when translated.


title: Need help fixing sql syntax error after WP 3.2 upgrade

text: I'm using a plugin that failed after upgrade to wp3.2. The error log shows: > WordPress database error You have an error in your SQL syntax; check the > manual that corresponds to your MySQL server version for the right syntax to > use near '' at line 1 for `query SELECT post_id, meta_value, post_status > FROM bxxoai_postmeta LEFT JOIN bxxoai_posts ON post_id=bxxoai_posts.ID WHERE > post_status='publish' AND meta_key='wpfp_favorites' AND meta_value > 0 ORDER > BY ROUND(meta_value) DESC LIMIT 0, made by require, require_once, include, > get_header, locate_template, load_template, require_once, get_sidebar, > locate_template, load_template, require_once, wpfp_widget_view, > wpfp_list_most_favorited` mysql version I used is 5.0.92-community I'm clueless with database, can anyone please teach or help explain to me what needed to be done to fix this?


title: Strange bug on post/page save

text: I have a srtange bug when I try to save/update a post. Every time I got this alert: "Are you sure to live this page?...." I've switched tothe original theme, disabled almost all plugins but nothing work. Any ideas how to fix that?


title: Wordpress 3.2 has broken my TinyMCE code

text:
My code was working up until the 3.2 update, where I noticed that tinyMCE has been updated too. Does anyone have any ideas why this may not work now? I don't get any console errors but I don't get any tinyMCE editors on the page either! **CLARIFICATION: every instance of the TinyMCE editor has disappeared!** **FURTHER CLARIFICATION: this is only occurring on my custom post type pages where I have custom instances of the TinyMCE editor. I still have the default "theEditor" MCE on the default Posts area.**               function meta_genus_species() {         global $post;              $genus = get_post_custom_values( 'genus', $post->ID );         $species = get_post_custom_values( 'species', $post->ID );         $etymology = get_post_custom_values( 'etymology', $post->ID );         $family = get_post_custom_values( 'family', $post->ID );         $common_names = get_post_custom_values( 'common_names', $post->ID );              if (!isset($id)) { $id = "etymology"; }         if (!isset($temp_min)) { $temp_min = plugins_url('images/temp_max.png' , __FILE__); }         if (!isset($temp_max)) { $temp_max = plugins_url('images/temp_min.png' , __FILE__); }         if (!isset($pH_min)) { $pH_min = plugins_url('images/pH_max.png' , __FILE__); }         if (!isset($pH_max)) { $pH_max = plugins_url('images/pH_max.png' , __FILE__); }          $tinyMCE = <<<EOT              EOT;         echo $tinyMCE;              ?>

Description of taxonomy.

             Genus
                 <input name="genus" class="text" value="<?php if(isset($genus[0])) { echo esc_attr( $genus[0] ); } ?>" />                 Testing...

             Species
                 <input name="species" class="text"  value="<?php if(isset($species[0])) { echo esc_attr( $species[0] ); } ?>" />                 Testing...

             Etymology             <textarea cols="50" rows="5" name="etymology" id="etymology"><?php if(isset($etymology[0])) { echo esc_attr( $etymology[0] ); } ?></textarea>             Description

             Family             <input name="family" class="text"  value="<?php if(isset($family[0])) { echo esc_attr( $family[0] ); } ?>" />             Description

             Common Names             <input name="common_names" class="text"  value="<?php if(isset($common_names[0])) { echo esc_attr( $common_names[0] ); } ?>" />             Description

         <?php          }          function meta_authored() {         global $post;              $species_author = get_post_custom_values( 'species_author', $post->ID );         $year_described = get_post_custom_values( 'year_described', $post->ID );              ?>
         Species Author
             <input name="species_author" class="text" value="<?php if(isset($species_author[0])) { echo esc_attr( $species_author[0] ); } ?>" />
         Year Described
             <input name="year_described" class="text" value="<?php if(isset($year_described[0])) { echo esc_attr( $year_described[0] ); } ?>" />

         <?php     }


title: Find which Permalink structure is the best

text: I have the following permalinks structure in mind for a new blog, now instead getting theoretical answers on which is best, i would like to find myself which is best in terms of speed. How can i find this? I tried using get_num_queries() but i find the results varying each time i access the blog. Note: I am running a local XAMPP installation with WordPress on it and i am new to PHP, so any guidance is much appreciated. /%postname%/ /%post_id%//%postname%/ /%post_id%/%postname%/ /%category%/%postname%/ I am expecting 5000 plus posts but pages wont exceed 10. Thought this might also help someone when replying back to my query. Thank You.


title: Looping Next/Prev Link for custom post type

text: Strange error with custom post type next/prev. Trying to ge tthe first post if youre on the last one and the last post if youre on the first one. The posts per page is set to 100 but it seems to only grab 10. There are 13 posts, if i'm on the first page, the prev page is number 10. Here is the function im using.               function mod_get_adjacent_post($direction = 'prev', $post_types = 'post') {         global $post, $wpdb;              if(empty($post)) return NULL;         if(!$post_types) return NULL;              if(is_array($post_types)){             $txt = '';             for($i = 0; $i <= count($post_types) - 1; $i++){                 $txt .= "'".$post_types[$i]."'";                 if($i != count($post_types) - 1) $txt .= ', ';             }             $post_types = $txt;         }              $current_post_date = $post->post_date;              $join = '';         $in_same_cat = TRUE;         $excluded_categories = 'post';         $adjacent = $direction == 'prev' ? 'previous' : 'next';         $op = $direction == 'prev' ? '<' : '>';         $order = $direction == 'prev' ? 'ASC' : 'DESC';              $join  = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_cat, $excluded_categories );         $where = apply_filters( "get_{$adjacent}_post_where", "WHERE p.post_status = 'publish'" );         $sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.menu_order $order LIMIT 1" );              $query = "SELECT p.* FROM $wpdb->posts AS p $join $where $sort";         $query_key = 'adjacent_post_' . md5($query);         $result = wp_cache_get($query_key, 'counts');         if ( false !== $result )             return $result;              $result = $wpdb->get_row("SELECT p.* FROM $wpdb->posts AS p $join $where $sort");         if ( null === $result )             $result = '';              wp_cache_set($query_key, $result, 'counts');         return $result;     }


title: Remove entry content from homepage index with infinite scroll

text: I have a WP theme (built on top of Genesis) and I'm having a problem with posts that are loaded on the homepage index with infinite scroll. Essentially, I'm only showing the article title, date, author and category in my main feed. So, the function attached below works perfectly to remove the entry content, but it only does so on the **first** page. How can I adapt this function to prevent pages loaded by the infinite scroll from loading excerpts? My temporary fix is to hide via CSS, but infinite scroll paginates HTML so i have to create a long chain of CSS.I've attached screenshots with the css 'display:none' on and off for illustration of the issue.               add_action('genesis_before','remove_some_actitons');          function remove_some_actitons() {            if ( is_home() )  {           remove_action( 'genesis_entry_content', 'genesis_do_post_content' );         }              }      Here is the sample css I'm using (and so on...) :               #infinite-view-2 .entry-content, #infinite-view-3 .entry-content, #infinite-view-4 .entry-content,#infinite-view-5 .entry-content,#infinite-view-6 .entry-content {         display: none;      }      ![enter image description here](http://i.stack.imgur.com/LdN9V.png) ![enter image description here](http://i.stack.imgur.com/39ohd.png)


title: Upload unnattached image from frontend

text: I am using the below function to let users upload files from the front end. It works great except that I would like the file to NOT be attached to any post. Currently, the file is automatically attaching itself to the page that I'm using for uploads (mysite.com/publish). I would like it to just be unattached instead. What should I change below to make that work? Here is the functions:                   // Uploads images from the front-end          function insert_attachment($file_handler,$post_id,$setthumb='false') {          // check to make sure its a successful upload     if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();          require_once(ABSPATH . "wp-admin" . '/includes/image.php');     require_once(ABSPATH . "wp-admin" . '/includes/file.php');     require_once(ABSPATH . "wp-admin" . '/includes/media.php');          $attach_id = media_handle_upload( $file_handler, $post_id );          if ($setthumb) update_post_meta($post_id,'_thumbnail_id',$attach_id);     return $attach_id;     }


title: Admin option sidebar count

text: I need to add a count number to a option menu item in the admin sidebar. How is this done? **I found a similar post:** Modifying admin sidebar contents to show pending posts indicator


title: How to disable fancybox on small screens

text: I'm using the plugin "Fancybox for Wordpress" in WP 3.5.1. On small screens, I want to disable the fancybox-script. So, at top of header-file, I include a check for user agent, and sets global variable `$is_mobile` `true` or `false`. This works. However, depending on this, I would like to add something like this to `functions.php` to disable the script on mobile devices.               $is_mobile;     function is_mobile() {     if ($is_mobile==true) {         remove_action('wp_print_scripts', 'mfbfw_load');         remove_action('wp_print_styles', 'mfbfw_css');         remove_action('wp_head', 'mfbfw_init');          } else {$is_mobile = "false"; }          return $is_mobile;     }          add_action('wp_head', 'is_mobile', 1);      This doesn't work, maybe because `functions.php` is loaded before `header.php`. However, it also doesn't work if I include the check for useragent into the function. Anyway, the variable `$is_mobile` is not recognized as a global in `header.php`.


title: Advanced AND tax_query in sidebar with 2 taxonomies

text: I have two taxonomy : brand and product. In single sidebar I am displaying the brand and product of the post in the sidebar but I would like to display all the other product of the current taxonomy term brand. This is what I'am going to try but I have no error and it return nothing :               <?php     // get current taxonomy product term     $post_product = get_the_term_list($post->ID, 'product', '', ', ');     echo 'Product : '.$post_marque;          // get current taxonomy brand term     $post_brand = get_the_term_list($post->ID, 'brand', '', ', ');      echo 'Brand : '.$post_brand;          // make the custom query       $do_not_duplicate = $post->ID;                 $taxquery = new WP_Query( $taxquery_args ); while($taxquery->have_posts()) : $taxquery->the_post();                       if( $post->ID == $do_not_duplicate ) continue;                      $taxquery_args = array(                          'post_type'      => 'any',                      'posts_per_page' => 10,                          'tax_query' => array(                              'relation' => 'AND',                         array(                             'taxonomy' => 'brand',                             'field' => 'slug',                             'terms' => $post_marque                         )                         ,                         array(                             'taxonomy' => 'product',                             'field' => 'slug',                             'terms' => $post_product                         )                     )                 );                      the_permalink();                 var_dump($taxquery);                      endwhile;  wp_reset_postdata(); ?>      How to return all taxonomy product terms execpt current post term who have current taxonomy brand term of the post ? Is it possible to return term->name and term-slug ? Screenshot This is a screenshot, for exemple current post will have taxonomy term brand = Antec and taxonomy product term = P280 and I would like to have all product terms with brand term 'Antec' by term->name except 'P280', so the result shoud return this terms : iSO, GX700, etc...


title: How to change upload dir for custom plugin?

text: I like to change the media upload directory for my custom plugin. Now i am testing with this in functions.php                function custom_upload_directory( $args ) {         // Check for our plugin pages         if (($_GET['page']=="contender_add") || ($_GET['page']=="contender_edit")){             $args['path'] = plugin_dir_path(__FILE__) . "uploads/test";             $args['url']  = plugin_dir_url(__FILE__) . "uploads/test";             $args['basedir'] = plugin_dir_path(__FILE__) . "uploads/test";             $args['baseurl'] = plugin_dir_url(__FILE__) . "uploads/test";         }         return $args;     }          add_filter( 'upload_dir', 'custom_upload_directory' );      Also how do add my custom upload folder to the media uploader library tab? Regards


title: How to create category page

text: Anybody could help me to make a category page only. Thank you.


title: Weird Parse Error on Uploaded File

text: so I'm working on this theme on my localhost, and I just uploaded it to see if it'd work and I'm getting a weird parse error for these lines in my functions.php file. It works fine on my localhost though:               $next = isset($_POST['next']) ? $_POST['next'] : false;     $prev = isset($_POST['prev']) ? $_POST['prev'] : false;          $nexp = explode('=', explode('?', $next)[1])[1];     $pexp = explode('=', explode('?', $prev)[1])[1];      It says, unexpected '[' on the line starting with $nexp and $pexp. I'm a bit confused (and tired), and I don't really see what the problem with this line is, and why it would work on localhost but not on the server. Any help would be appreciated.


title: Can i Use own Facebook App ID with this Social Comment Plugin?

text: Is it possible to connect the plugin with an own Facebook App ID? In this way it would be entirely clear that this App belongs to the respective blog. Beyond that, if I have other Facebook stuff on the blog, which requires a Facebook Connect, the user only has to authenticate once with one app. So in this way an app could handle all the Facebook stuff that happend on the blog. To Alex an his Team: Just a great piece of work! This plugin is exactly what I was looking for! Thanks for sharing it. http://wordpress.org/extend/plugins/social/


title: wordpress plugin to add images to main navigation menu

text: Please advise about wordpress plugin to add multi states images to the main navigation menu I need to be able to add images on top of text for normal, hover and current state. Thanks


title: How can I replace my primary url globally with a parked one?

text: Ok so long story short, someone on our team accidentally got the domain we wanted booked on wordpress.com and not with a host for wordpress. ooopssss We've got a slightly inferior domain booked with a host now, and we've got the superior domain parked on that host now. Good, right? you can follow either url to our site and it works. So let's say: Superior domain: example.com Inferior domain: ex-ample.com Get the picture? PROBLEM: all the links in the site still direct to a url with a base of ex- ample.com, even though we want someone visiting the site to only be visiting pages headed with example.com. I hope I'm explaining myself well. once we get to http://ex-ample.com/page/subpage, we can remove the dash and it still works. but aesthetically, it's really unfortunate, and I want clicking the link that leads to /page/subpage to automatically be http://example.com/page/subpage. I feel like we could solve this by changing the home URL. I already followed instructions to change the site URL, but it seems that if we changed the HOME URL to our parked domain, the site breaks and directs to an ad-supported landing page about gardening. I've used FTP a couple times to reset both urls to ex-ample.com and try again, but it turns out it will only let us change the site url and not the home url, which doesn't really help us much anyway. I'm wondering if there's some kind of workaround to make a function that uses an alternate home_url() or something. any ideas? thanks so much Ben


title: add a menu item to navigation menu to link to external url

text: I followed this tutorial to add a menu item to navigation menu to link to external site: http://www.natenewz.com/2009/10/07/hardlink-wordpress-navigation/ I copied the snippet of code to my theme's header.php I created a page with the name having the text that I want to appear in the navigation I added a custom field to the page called redirect and placed the link url into the value field. And then tested and the link never appears in the menu.


title: Using attachment_fields_to_edit filter inside plugin class

text: I'm writing a plugin using OOP. I realise that filters and action hooks need to be placed inside the constructor method in WordPress like so:               add_action('wp_enqueue_scripts', array($this, 'add_js_css'));      As far as I understand, it should be the same for filters:               add_filter('attachment_fields_to_edit', array($this, 'attachment_fields', 15, 2));      The `attachment_fields()` method should return an array (I've tested it outside of the class and it works), but it seems to return `null` when called inside the class. I'm guessing it's because it's called inside of the class, but I'm not sure what to do about it! If it's useful, the method looks like this:               public function attachment_fields($form_fields) {         global $post;         $file = wp_get_attachment_url($post->ID);         unset($form_fields['post_excerpt']);         unset($form_fields['post_content']);         unset($form_fields['url']['helps']);         $form_fields['url']['label'] = 'URL';         $form_fields['url']['html'] = "<input type='text' class='text urlfield' name='attachments[$post->ID][url]' value='" . esc_attr($file) . "' /><br />";         $form_fields['buttons'] = array(         'label' => '',         'value' => '',         'html' => "<input type='submit' class='button' name='send[$post->ID]' value='" . esc_attr__( 'Add MP3' ) . "' />",         'input' => 'html'         );         return $form_fields;     }      Any advice?


title: Get date function not working

text: I have a function to get the date. I have input fields and want the date in this fields. But my code is set a wrong date. I set the date in Wordpress settings and on my server. But it is not working. This is my script:               function get_agenda_item_day() {         global $post;                   $cp_date = get_post_meta($post->ID, 'cp_date_end', true);              $cp_date_arr = explode("-",$cp_date);             $day = $cp_date_arr[2];              return $day;     }      And i use this in my select tag:               <?php $day = get_the_time('j'); ?>      <select name="ad" id="ad" onChange="getNDay()" class="select select-n">                         <option <?php if($day == 1) {echo 'selected="selected"';} ?> value="1">1</option>                         <option <?php if($day == 2) {echo 'selected="selected"';} ?> value="2">2</option>                         <option <?php if($day == 3) {echo 'selected="selected"';} ?> value="3">3</option>                         <option <?php if($day == 4) {echo 'selected="selected"';} ?> value="4">4</option>     etc etc etc     </select>      But, what do i wrong. Always the date is 17 juni in the select box. Because today the date is 5 Juli. Thanks for help


title: How to rewrite AJAX call URL to admin-ajax.php to match REST style URLs

text: Let's say I have an AJAX callback setup using admin-ajax.php that fetches WordPress posts when query parameters are passed in the URL. A typical URL for an AJAX call using the GET method would look like: `http://example.com/wp-admin/admin-ajax.php/?action=get_posts&user_id=1` Now I would like to rewrite this to something like: `http://example.com/rest/posts/1` I'm able to rewrite URL for pages using WordPress native `generate_rewrite_rules` hook. But that doesn't work for admin-ajax.php as Wordress hasn't even loaded when admin-ajax.php is called. Any ideas on how to get this setup?


title: WordPress Cron Schedule the if and else statement

text: I have a custom php loop/function written that works in the following way               $start = strtotime(date("Y-m-d H:i:s", strtotime("+5 hours")));     $end = get_post_meta( $post->ID, '_limited_dates_to', true );     $remaining = $end - $start;      if ($end > $start) {         wp_set_post_terms( $post->ID, 'not active', 'product_tag', false );     } else {         wp_set_post_terms( $post->ID, 'active', 'product_tag', false );     }      Currently the loop works fine but it is attached with a timer as one can see easily in `$start` and `$end`. Now what I am trying to get here is something of a product expiry thing going on. I need the cron to work this if & else loop and automatically set the active or not active tags. How can this be achieved?   Currently I have to manually refresh the page so that the loop runs.


title: Moving variables from one page to another

text: How can I link to another WordPress page but move variables to it as well (preferably not through the address bar)?   For instance, I have on one page a list of shops in which a user should be able to click on a shop, which would then open the shop page with the correct data.   So the shop's id needs to move from the shops list page to the shop page.


title: Why Jetpack is missing the "Feedbacks" menu item?

text: Is there a known issue that would prevent the "Feedbacks" menu item from showing? I have two wordpress installs, one has the menu item the other doesn't. They both have the same plugins, theme, and scripts.


title: Rewrite category slug

text: I have some categories like so:               /europe/postname     /usa/postname      For various reasons I would like to rewrite these to be:               /news/view/postname      I've tried a few re-direct plugins but not had any success. Is this possible?


title: How can I added the post's Categories to the site's top menu (like a page)?

text: Instead of adding pages to the top menu, is there a way to add a dropdown menu with all the categories, or adding individual categories to the top navigation menu? I am using WP 3.9 with Shaken Grid Free theme.


title: how to return the wordpress path to the new site

text: Please how do i return to the default path something like this after working on the wordpress installation                 http://fittergroup.com/blog/   to  http://fittergroup.com/


title: search form leads to 404

text:
I'm using the follow code in my functions.php to add a search box to my primary nav menu -               add_filter('wp_nav_menu_items','add_search_box_to_menu', 10, 2);             function add_search_box_to_menu( $items, $args ) {                 if( $args->theme_location == 'primary' )                     return $items."
<form action='search.php' id='searchform' method='get'><input type='text' name='s' id='s' placeholder='Search'></form>
";                      return $items;             }      The form adds to the nav menu ok, but any search attempt leads to a 404 message. What have I missed?


title: Custom Post Types strange pagination problem

text: Have a strange problem with pagination, the query work fine when I'm in homepage, but if click for the next page I get a `404` error. Disabling permalinks settings, I saw that in the query string (when I move on to the next page), then I have `?paged=2` as query argument, but not `post_type=job_listing` (in this case). Here is my code:               global $wp_query, $paged;          if ( get_query_var( 'paged' ) )         $paged = get_query_var( 'paged' );     else         $paged = 1;          if ( get_query_var( 'post_type' ) )         $post_type = get_query_var( 'post_type' );     else         $post_type = 'job_listing';          $args = array(        'post_type' => $post_type,        'paged'     => $paged,     );          query_posts( $args );      And then I have a normal loop cycle and a `wp_reset_query()` at the end. The problem is that when open a pagination link the url look like `www.example.com/?paged=2` and not `www.example.com/?post_type=job_listing&paged=2` which works if I type it manually. I tried everything to make it work but it keeps ignoring the `post_type` var in all pages.


title: Is there a way to have custom post type and page with the same slug?

text: I have a custom post type registered as follows:               register_post_type( 'news',         array(             'labels' => $labels,             'public' => true,             'show_ui' => true,             'menu_position' => 5,             'capability_type' => 'post',             'has_archive' => false,             'rewrite' => array('slug' => 'news'),             'hierarchical' => false,             'show_in_menu' => true,             'supports' => array( 'title', 'editor', 'thumbnail' )         )     );      My intent is to have the permalink /news/name-of-the-news-item for the post and a /news/ page listing all the news. I created a page with slug "news" and a template page for that but when I use the pagination to reach /news/page/2/ I get a 404, because it seems I cannot have a page and a custom post type with the same slug. Is there a workaround or a strategy to achieve the permalink structure I need? Note that I cannot use archive-news.php for the listing, bacause I also need a text in the page editable in WP admin. Thanks.


title: How do I enforce a specific custom post type on the loop

text: I am developing a blog where the main posts are of a custom post type. Let's assume it is a Book custom post type. I want the /author/admin page to list the books of the author admin, but instead, it goes and searches for Posts of admin, which is the built-in basic post type. How do I make my custom post type Book to be used in all such index queries? (main page, author, search, etc).


title: Using dividers in menu navigation - where to add code?

text: I've identified two methods of separating pages in nav menu on my blog (http://reasonandfolly.com) but cannot figure out what php or css file needs to be modified to achieve the result and will admit to not knowing the difference between "span class" and "span divider." Until I get a better handle on basic WP coding, I'd truly appreciate some help. Either of the below examples would fulfill my needs. The question is, how do I implement?   1. http://www.themezilla.com `< span class = " divider " > / < /span >`   2. http://chimpchomp.us `< span id = " divider " > // < /span >` This is the code currently in my header.php file:                  </div><!-- /logo -->                     <nav>                         <?php wp_nav_menu( array( 'menu' =>  __('Main Menu', 'meanthemes'), 'theme_location' => 'primary', 'container' => false, 'menu_id' => false, 'menu_class' => false ) ); ?>                     </nav><!-- /nav -->                 </div>               </header><!-- /header -->


title: Debug whats going on inside a function called from AJAX

text: I have a link on my post edit page (admin side) that calls up AJAX and jQuery to run a function inside my `functions.php` page. The link is wired up and calling the jQuery but I can't seem to debug whats going on inside my function thats being called from jQuery. I want the clicked link to delete custom metadata for the post (it is a custom post type) and then delete a file. Here's the code with the delete function at the end:               //Add AJAX functionality to post.php to delete files     add_action('admin_enqueue_scripts', 'my_admin_enqueue_scripts');     add_action('wp_ajax_delete_meta', 'delete_pdf_and_metadata');          //Add my custom JS to the header of admin     function my_admin_enqueue_scripts($hook) {         global $current_screen;              if ( 'post.php' != $hook )             return;         wp_register_script('my-scripts', get_template_directory_uri() . '/js/custom/my-scripts.js' );         wp_enqueue_script('my-scripts');         wp_localize_script('my-scripts', 'wp_ajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));     }          function delete_pdf_and_metadata() {              global $post;              //delete metadata         $the_id = intval($_POST['the_id'] );         $the_pdf = get_post_meta($post->ID, $the_id);              delete_post_meta($post->ID, $the_id, $the_pdf['name']);              //TODO Delete PDF      }      Here's the jQuery call:               jQuery(document).ready(function($) {         $('.delete_pdf').each(function(i,e) { //grab the class delete-pdf             var id = $(this).attr('id').replace(/delete-/, '');             var li = $(this).closest('li');                  $(this).click(function(){                      $.post(ajaxurl, { action: 'delete_meta', the_id: id }, function(data){                          return id;                     });             });              });          });      Using FireBug all I see is for a response is 0. What is the best way to debug what is happening inside my function `delete_pdf_and_metadata()` being called via jQuery? Thanks!


title: Creating custom tags

text: Hi there Best Wordpress Gurus, i've a question about using tags to simplify my HTML. For example if i want to ad a block of content lets say a contact form. I don't want to ad all the time my html code can i use a tag something like: `#contact_form` and that this tag output a contactform for me. If this possible can someone please give me a link to tutorial or gives a example. Tnx in advance.


title: Using ajax with paging and a custom sub-query

text: I have a page that uses three queries to retrieve a variety of content. One of those queries grabs posts that are related to the topic of the page. Since these posts can be of all sorts and related through a variety of methods (various magic fields defined values, their category, etc.) I am using a custom query to grab them (something where I build some args and pass them to WP_Query() like so: `$collected_child_posts = new WP_Query($args);` Currently I return 5 results at a time (in my args I have `'posts_per_page' => 5`) and I want to page those results using ajax so that only that block of results updates when you click a `MORE POSTS` link. I implemented this by adding a url to the `MORE POSTS` button that looks like `?paged=n` and then having that retrieved via ajax. Problem is I get the entire page back (including the desired posts) when I only want the posts themselves. Any ideas on the best way to retrieve just those posts from the subquery without returning the entire page? Thanks!


title: How to Control CSS Class Visiblity From WordPress Admin Panel based on Tax Terms

text: Can you please let me know if it is possible to control Visibility of some html elements like and which are loading from an specific taxonomy terms meta data? I For Example I have two metadata as "Make" and "Year" for my custom post and I would like to ONLY hide the meta (Make and Year) for my post with specific Custom Taxonomy term = "Hback" (Not for any other terms) Thanks


title: What's the easiest way to periodically (automatically) read static Markdown content into a WP page?

text: I'd like to sync my theme's README.markdown into a page on my site and would _love_ to be able to only have to update that text a single time -- namely, when I commit my code up to BitBucket. I have my theme doing `hg pull -u` on a regular basis, so the code stays fresh and the README will get updated every time I make a change to the source, but my WordPress page containing the README then needs to get updated by hand. (I'm using Mark Jaquith's Markdown on Save to do the MD->HTML dance.) Any thoughts?


title: All Updated Plugins Disappeared

text: I had 5 plugins with updates. After updating all of them through the Available Updates tool they disappeared from the Network Plugins page. I received errors like this for all plugins:               The plugin custom-post-type-ui/custom-post-type-ui.php has been deactivated due to an error: Plugin file does not exist.      The folders still exist in /wp-content/plugins/ When I deleted the folders and uploaded them through FTP they do not appear on the Plugins page. When I install them through wp-admin I receive this log text:               Downloading install package from http://downloads.wordpress.org/plugin/custom-post-type-ui.zip…     Unpacking the package…     Installing the plugin…     Successfully installed the plugin Custom Post Type UI 0.7.1.     Network Activate | Return to Plugin Installer      But when I click Network Activate, I receive this error:               The plugin does not have a valid header.      This happens for all 5 plugins and only happened beginning today.


title: I've been out of the loop since 2.8. What did I miss?

text: I haven't done any serious WP development since version 2.8, although I fiddled a bit with version 3.0. Short of reading the release notes on each version, what are the major things to take note of as 1) a theme/plugin developer and 2) an administrator? I've already identified three things:   * Custom Post Types and Taxonomies   * Custom Menus   * Post Formats (a la Tumbr) What else do I need to take note of?


title: How to prevent specific plugin files or subfolders from appearing under "plugin files" listing

text: I have a folder inside my plugin that's used to store cached data for the application. There's no need for the user to edit these files so I'd like to remove this folder's files from appearing in the "Plugin files" listing that appears in the right sidebar when editing the plugin files via "Plugins > Editor". Is this possible?


title: Site only for users authenticated by different PHP application

text: I've got custom developed sales system (in PHP, let's say it's domain.com) and I would like to add informational section to it. Instead of developing it from the ground up I thought that it would be better to publish information by Wordpress (for example published on subdomain infos.domain.com). The problem is I would like to make it accessible only for users logged in to domain.com system. So when somebody enters infos.domain.com he sees some text like "Please login to domain.com". When somebody is logged in to domain.com he should be able to read all the pages in infos.domain.com. Commenting them is not necessary (read-only is enough). As I know Wordpress rather from administrator's perspective I tried to find some plugin to solve that, but I failed. Maybe you can advice some ready-made (evan paid) solution? If it does not exist please, advise how it could be solved. Login to domain.com is based on POST form and cookies, passwords in database are hashed with salt. domain.com system can be extended to provide some API.


title: How can i set post_per_page in my taxonamy?

text: <?php     $myquery['tax_query'] = array(         'relation' => 'OR',             array(                 'taxonomy' => 'brands',                 'terms' => array('ALL'),                 'field' => 'slug',                 'operator' => 'NOT_IN'                 ),             array(                 'taxonomy' => 'media',                 'terms' => array('news', 'events'),                 'field' => 'slug',                 'operator' => 'NOT_IN'                 ),             );                                             query_posts($myquery);          if ( have_posts() ) : while ( have_posts() ) : the_post();?>     <div>     <php the-title(); ?>     </div>     <php endwhile; else: endif; ?>


title: For better digital journalism, how to store a second title and excerpt?

text: This is a digital journalism issue. As the technology evolves, digital journalism has found new best practises. One of them is to always write a predictive title, combined with a good excerpt. This predictive title, however, lacks that "x factor" that a non predictive title has. A great example is the news published by Time about Microsoft that will cut 18.000 jobs in the next year. The proper title of the news is "Microsoft to Cut Up to 18,000 Jobs", but on the home page the opening title was "Ctrl-Alt-Del". Simple, catchy. So, we want to be able to create two titles and two excerpts inside a post. What should be the most effective and less resource consuming solution? Two meta values that I use only on the front-page.php? I don't want to add to much weight to the post queries. Any pointers?


title: wp_list_table bulk action button is not working - no submit

text: I have a custom `wp_list_table` to create my own table. Almost everything works perfect, but the bulk action button seems to be not working. It's proper displayed,but on click nothing happens. I think somehow there is a form- wrapper missing or just some javascript? I added the button described on wp- engineeers: http://wpengineer.com/2426/wp_list_table-a-step-by-step- guide/#bulk My Bulk-action functions:               function get_bulk_actions() {         $actions = array(             'activate'    => __('Show'),             'deactivate'  => __('Hide')         );         //Add delete function for admins         if(current_user_can( 'delete_published_posts' )){             $actions['delete'] = __('Delete');         }         return $actions;      }              function process_bulk_action() {                  $action = $this->current_action();             if( 'activate'===$action ) {                    foreach($_GET['wp_list_event'] as $event) {                     echo($event['title']);                 }                  }             if( 'deactivate'===$action ) {               wp_die('Items deactivated (or they would be if we had items to deactivate)!');             }             //Detect when a bulk action is being triggered...             if( 'delete'===$action ) {               wp_die('Items deleted (or they would be if we had items to delete)!');             }         }       The rendered HTML (not wrapped by any `form` tag)               <div class="alignleft actions">       <select name='action'>         <option value='-1' selected='selected'>Aktion wählen</option>         <option value='activate'>Anzeigen</option>         <option value='deactivate'>Verstecken</option>       </select>       <input type="submit" name="" id="doaction" class="button action" value="Übernehmen"  />     </div>


title: plugin shortcode output

text: I have a plugin which uses this shortcode: `[daisy]` And the html output of this shortcode is : `<a class="clickable">Click Here</a> ` Plugin is working perfect if I use the shortcode to trigger the plugin. It works with this also: `<?php echo do_shortcode('[daisy]'); ?>` Normally it should work also with the `<a class="clickable">Click Here</a> ` but it's not working, the link appears but if I click on it nothing happens. I want to use the html output because my website is using a lot of javascript for displaying html content I cannot use php shortcodes inside javascript/jquery functions. So, do you have any suggestions for this issue? Because I think the shortcode should work also with the html output which triggers that plugin (in my case is a contact form popup) Thanks! Later edit: This is the javascript which triggers the plugin:               <script type="text/javascript">     $(document).ready(function(){         // Init Plugin         $(".clickable").contactpopup({             'style' : '<?php echo $wp_cpup_theme; ?>',             'bgcolor' : '<?php echo $wp_cpup_color; ?>',             'formelement' : '#Form_PopContactUs',             'effect' : '<?php echo $wp_cpup_effect; ?>',             'header' : '<?php echo $wp_cpup_popup_title; ?>'         });     });


title: How To Disable Category Hierarchy In Categories Widget?

text: I want to disable all category's hierarchy in default categories widget. With a code in functions.php . But how? Thanks in advance.


title: Breadcrumb ordered wrongly

text:
/*Breadcrumb*/          if ( ! function_exists( 'seobreadcrumbs' ) ) :      function seobreadcrumbs() {     $separator = '›';     $home = 'Home';     echo '
';     global $post;     echo '       You are Here :- Home      ';     $category = get_the_category();     if ($category) {     foreach($category as $category) {     echo $separator . "     term_id)."\" >$category->name     ";     }}     echo '
';}     endif;          function show_crumbs() {     if(is_single() || is_tag() || is_search() || is_404() || is_page() || is_category()) { ?>     <?php seobreadcrumbs(); ?>     <?php }}          add_action('thesis_hook_before_content','show_crumbs');     /* End*/      I use these codes to show breadcrumb trail. The problem I’m having with it is, some times its getting messed up let me clarify suppose I’ve category named Social Media parent category is Facebook When I publish a post under facebook It should show like               # Social Media >> Facebook      But some times facebook is coming 1st then Social Media 2nd like this:               # Facebook >> Social Media      And Google also displaying this way. Can anybody help me regarding this?


title: Changing comment_count to views

text: I have a plugin installed to show the latest popular posts based on number of comments. But comments are disabled on my website. How can I change it to number of views? And do I need to install something else like a plugin to calculate the number of views, or is it not needed? `comment_count` needs to be changed. What should I put there?               WP_Query arguments $args_popular = array ( 'posts_per_page' => '5', 'order' => 'DESC', 'orderby' => 'comment_count', 'day' => '2', 'cache_results' => true,


title: What is the Better way to manage posts in Wordpress?

text: I am looking for a plugin or a "tool" that would mod the administration interface and would allow me to mass edit the posts. Currently the posts are paginated by 20 post per page, if i have to turn 1000 post into drafts or delete them - i have to browse multiple pages. Same for changing categories or making mass changes to posts. This can be quite a pain for big blogs with many posts So i was wondering, is there a "Better" way to manage posts in wordpress ? What would you recommend ? i am poking around the topic of post management and would love to hear from you Thanks in advance


title: Subscribers become Authors after Upgrade? / Mass Update of Users?

text: I have a site with ~30K users, and the vast majority have role `'subscriber'` on the main blog. After upgrading from WPMU 2.9.2 to WordPress 3.0.1 I noticed that all 30,0000 users are appearing in the main blog's _"Author"_ dropdown in `post-new.php`. _(Well, that is if it manages to load without crashing the browser...)_. To clarify: the users all still have subscriber-level access, but are included in _"Author"_ dropdown. Before I go diving down in to the guts of `/wp-admin/`, has anyone else seen this? Does anyone know if this behavior is an intentional change in WordPress? Thanks, Bethany


title: Wordpress installation from live site to localhost

text: I just need to know if this is the only way to install wordpress from live to localhost. I downloaded the files and database from live, then push the files folder to my htdocs folder, and uploaded the db through phpmyadmin and change the config file. Upto this point I think im on correct side. After entering `http://localhost/mylocalsite` URL in web browser site loads in correct way, however link seems to be still pointing the old (live site) URLs. So for this I search my live site URLs in the DB like -- `http://www.mylivesite.com` and replace this with the `http://localhost/mylocalsite` URL. So my question is if this is the correct way i am implementing it on my locals or some more appealing method i am missing.


title: Strip tags from a the terms() function

text: Trying to print my custom post type's taxonomy but without the link. Tried this, but doesn't seem to work, any suggestions?               $text = the_terms($post->ID,'type','','','');      echo strip_tags($text);      Any help would be greatly appreciated... I'm about to start punching babies.


title: Wordpress Settings API: saving multiple rows of similar data

text: I've been experimenting with the plugin options starter kit but can't find a way to save multiple rows of similar data using the Settings API. Example of what I'm trying to save:               _________________________________________     |____Order#____|___Image URL___|_Enabled_|     |      1       |   http://...  |    Y    |     |      2       |   http://...  |    N    |     ........      Can this be generated and saved using just one register_setting? I can't work out how this would be done, especially with the format of the data being saved to the database. Thanks, Alex


title: Downsizing Many Large Images Attached to Posts, in Bulk?

text: _( **Moderator's note:** The original title was: "Shrink full size images in post")_ I built a WordPress site for someone and they entered a ton of posts with images that are wider than the content area. Is there a way to shrink all of the image attachements to use a max width? They are entered as "full size", not as thumbnail, medium, etc.


title: vQmod-like tool for Wordpress?

text: I realize that vQmod works on opencart because it is MVC. Is there any tool out there that would function LIKE vQmod, to inject core hacks into--say, for example--theme files, plugins, et al, without actually modifying the files themselves? Haven't been able to find anything like this out there. Anyone else know of something like this?


title: retrofiting old blog

text: I was asked to program out a blog/site. Everything went smoothly using thematic framework. Then I find out that they actually want to switch out themes and basically keep everything from the old site. The new design is slightly different in look as well as functionality. Thier current blog is pimped out to the max"I has about 20 plugins Has a forum with 6000 users Subscribers/mailers over 800 posts. 60pages. I tried to bring int bits and pieces to the new one, and unless I am doing it wrong, it was pretty cumbersome, mainly in part due to the plugins and all the feautres they had on the pages. There are also alot of users that are aprt of the site, some kind of subscription etc. I am trying this approach, I would love to hear some feedback or guidance. 1.) I moved the site to a new directory keeping the old one intact and running for current users. 2.) I activated the new theme, and basically have had to implement the new widgets etc etc, restyle some things etc. But the idea is to get this new theme working in additions to the bizzilion plugings. 3.) Let the user test this one out alittle and make sure it is all working savy. 4.) Move this one into new directory backing up and replacing current one.


title: jquery plugin only in one page/post

text: Ive seen all the documentation in the codex but I am doing something wrong since it doesnt work! I want to implement this jquery plugin (https://github.com/davidcrawford/typist-jquery) in my welcome page (www.english.intermediavs.com) Ive added this code in my function.php               function my_typist() {         if (!is_admin()) {                  wp_enqueue_script('jquery');                  wp_enqueue_script('jquery.typist', get_bloginfo('template_url') . '/wp-includes/js/jquery.typist.js', array('jquery'), '1.0', true);         }     }     add_action('init', 'my_typist');      And I also introduced this code in "welcome page" by using html raw plugin.               <!--raw-->     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/wp-includes/js/jquery.typist.js">     jQuery(document).ready(function($) {          $('#terminal').typist({       height: 300     });          $('#terminal').typist('prompt')       .wait(1500)       .typist('type', 'greet')       .typist('echo', 'Hello, world!')          });     </script>     <!--/raw-->      PS: I am using the plugin Use Google libraries as well. Thanks in adavance! links: http://codex.wordpress.org/Using_Javascript http://codex.wordpress.org/Function_Reference/wp_enqueue_script


title: Using Conditional Tags to restrict something to 1 user?

text: I am using the following widget http://wordpress.org/plugins/widget-logic/ This allows me to restrict widgets using WP Conditional tags. What I want is to restrict one widget to only 2 users. This works for one user `current_user_can('level_10')` but gives access to all other level_10's (none atm) and not the other user. How can I restrict this to just 2 users? I tried `is_author( '4' )` but didn't seem to pick it up (think it's just for author pages)


title: Custom field for default gallery

text: How I can add custom field in default WordPress gallery? in visual editor and in shortcode. ![enter image description here](http://i.stack.imgur.com/aRkdc.png)


title: Create unique page without header.php for json feed

text: I have two WordPress sites on separate domains. I need to expose the latest posts within a category via a json feed on one site that I have to use for the other site. I'll need to hit a "hidden" url, ex: `/themes/mytheme/json_api.php?cat=news` to get the json response. I'd like this json feed to be a unique page without header.php and only includes the code necessary to output the posts within a specific category. What do I need to import to have access to `WP_Query` in this file?


title: wp_enqueue_script + how to load JS or CSS in one URL merge call?

text: Is there any proper wordpress way of including the JS and CSS through one merged URL? So that instead of loading in x number of separate calls for each JS asset, it can be all merged into one URL? Samething for CSS. I know this is easy enough to do using straight up PHP, but I wanted to check if wordpress has some nifty way of combining requests.


title: Redirect to Post List by Taxonomy on User Selection of Taxonomy Dropdown?

text: > _( **Moderator's note:** The original title was "drop down taxonomy")_ > > I want to add a drop-down box filled with my custom taxonomies, so when > someone selects any value, it redirects to corresponding page. I tried out > this code, which worked > > `<?php wp_dropdown_categories( array( 'taxonomy' => 'name of taxonomy' ) ); > ?>` > > The problem is I want a the page to redirect without the user needing to > press any buttons. How can I do this? this question was resolved but i want to modify further, i want to add a shortcode, so that i can also call drop-down-list into my post, i tried this but not working `add_shortcode('drop','the_taxonomy_dropdown');` but when i call this in my post `[drop="location"]` its not working, whats the problem?


title: How to use remote db tables in current config?

text: > **Possible Duplicate:**   >  Shared Members between two different wordpress installations with different > databases For example I have 2 different wordpress installations with different domains and hosts. Databases are separated too (two different databases). I want to use `www.b.com` mysql db tables on `www.a.com` `wp-config.php`. Is there any way to do that? If I could register tables from a remote database, I could use that in site `b`:               define('CUSTOM_USER_TABLE', 'wpsiteA_users');      Can I the database connection from site A on site B?


What hook is executed just after wp_query has been executed? before template is rendered? I want to change the page title but it depends on what has been queried. I have put it in template_redirect but not sure if it is the right hook


title: Privilege escalation bugs in 2.9?

text: Are there any known privilege escalation bugs in WP 2.9 to be careful for?


title: Moving WP from local server to live, error establishing a db connection

text: Not sure what's going on here 'cos I've done it already a couple of times and it always worked. Basically I'm moving a testing site from my local machine (MAMP) to a live server by:   * zipping the entire WP directory and uploading it to the server   * exporting db from localhost   * creating empty db on the server and importing the sql file   * updating wp-config file with the new credentials When I try to access the site it gives me "Error establishing a database connection". I tripple checked the db details (db name, user, pass) and even log in via terminal using those credentials. What am I doing wrong?


title: WordPress Sitemap for MSSQL

text: Does anyone know a proper sitemap plugin for WordPress that works with MS Sql? Here is the error I get:               Array (          [0] => Array (              [0] => 42000              [SQLSTATE] => 42000              [1] => 402              [code] => 402              [2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]The data types text and varchar are incompatible in the equal to operator.              [message] => [Microsoft][SQL Server Native Client 10.0][SQL Server]The data types text and varchar are incompatible in the equal to operator.          )      )      WordPress database error: [1]     SELECT post_id FROM wp_postmeta, wp_posts WHERE ID = post_id AND meta_key = '_wp_old_slug' AND meta_value='sitemap'      I get this error with Google XML Sitemaps plugin.... any ideas?


title: Why is the visual editor in WordPress limiting the width by wrapping the content?

text: Why is the visual editor in Wordpress is limiting the width by wrapping the content? I found this behavior in the editor at least annoying, it does prevent me from using my screen real estate.


title: WordPress TwentyTen Theme Incompatible with Theme Unit Test

text: I'm trying to test the comments template on a theme that is based on TwentyTen, using the the WP Theme Unit Test XML file, and there is one post that does not display comments properly. The post is called "Comment Test", and it contains 20 comments, including 2 pingbacks. The only thing that displays are the pingbacks. Is that the expected behavior? I can't seem to figure out why it's only displaying the pingbacks. Perhaps there is a setting I missed in the backend. The way to reproduce this, is to create a blog, apply the TwentyTen theme, and import the WP Theme Unit Test file: http://svn.automattic.com/wpcom- themes/demo/test-data.2011-01-17.xml Then visit the post called "Comment Test", published on March 3, 2008. You should see it say "20 Responses to Comment Test", and underneath it you should see 2 pingbacks, no comments. Thanks for you help, Dave


title: Best way to import users, post and categories from an external database

text: I need to migrate an existing website to WordPress. This website already has a basic database containing users and posts (with a category), but it also has a high number of records so it's not possible to do it manually. What is the best way to import them into my WordPress database? Should I try to export the old one into a CVS file or something similar?


title: Custom nav menu is created with default pages, but not hooked to theme's custom menu location

text: The script below creates a nav menu and assigns a page to it. Everything's working perfectly except that the nav menu is not being automatically assigned to my theme's "Header-menu" location. Any ideas why?               //Register menu locations for the theme     add_action( 'init', 'register_my_menus' );     function register_my_menus() {       register_nav_menus(         array('header-menu' => __( 'Header Menu' ), 'footer-menu' => __( 'Footer Menu' ))       );     }          //Create a nav menu, add a page to it and assign it to the theme's "header-menu" location.     $menu_id = wp_create_nav_menu( 'header-menu' );     $menu = array(          'menu-item-type' => 'custom',          'menu-item-url' => get_home_url('/'),         'menu-item-title' => 'Home',          'menu-item-status' => 'publish',          'theme_location' => 'header-menu', //Just a guess but didn't work!!!         );     wp_update_nav_menu_item( $menu_id, 0, $menu );


title: urlencoding of the_title() doesn't work?

text: hey guys, `<?php urlencode(the_title()); ?>`doesn't take effect. this is my entrie line of code: `<li><a href="mailto:?subject=<?php urlencode(the_title()); ?>&body=<?php the_permalink(); ?>">e-mail</a></li>` I don't want to have spaces in the_title(). Why does urlencode not work for me?


title: Create a custom post type based on 'Post'

text: I would like to create a custom post type, but all the tutorials I've found are geared towards making a brand new one and creating meta boxes from scratch. Whereas all I would like to do is copy an existing and add one or two extra entities. I would like to go through the motions of creating a new post type because it'll show up in the admin menu as a separate entity as you would expect, but I would like this custom post type to use pretty much all of the meta boxes associated with a normal 'post' type, plus one or two more I'd add. How could I duplicate the post type for 'post'? How could I go about making these adjustments?


title: advanced paging in wordpress

text: I can create pages in wordpress very simple like               www.mysite.com/profile      Now I have a question how can I make more pages in this page like `www.mysite.com/profile/edit` or maybe more pages like                www.mysite.com/profile/edit/image      Thanks in advance


title: How to display a category from a specific post-type

text: I have a custom post type called "my_people" along with a custom taxonomy named my_people_categories. It is used to display a list of people. I would like to show only the people in the list that are in a specific category in the custom taxonomy. I have tried using the following short code, but it displays all the people and not just the ones in the categories named.               [catlist name=cat1,cat2 post_type=my_people orderby=title order=ASC]      Is there someway I am supposed to mention the taxonomy? Is what I am trying to do even possible using this addon?


title: What is this in my tables

text: Cleaning up my databases and I found this in my main table atpp_options perhaps from a plugin, anyone have any idea what it might be?


title: How to get plugin name from plugin file location

text: I'm running this code to tell me what plugins need updating:               $update_plugins = get_site_transient('update_plugins');      Here is an example return:               Array     (         [login-lockdown/loginlockdown.php] => stdClass Object             (                 [id] => 3760                 [slug] => login-lockdown                 [new_version] => v1.5                 [url] => http://wordpress.org/extend/plugins/login-lockdown/                 [package] => http://downloads.wordpress.org/plugin/login-lockdown.1.5.zip             )          )      From that it doesn't tell me the name of the plugin that needs updating. Is there a WordPress function that you can feed the plugin file name like: `ogin- lockdown/loginlockdown.php` and return the plugin name? In this case I'd want `Login LockDown` to be returned.


title: Custom Scripts per page or Custom Post Type

text: A client has requested some interesting functionality. THey have about 20 different scripts, most of which are needed by one page only. They would like an area within Wordpress's pages and custom post types to add scripts for THAT PAGE ONLY. So when that page loads, the script loads in the header or footer, NOT inline with the body content. I am looking for an idea or a plugin to make this functionality happen. Any ideas?


title: post_author for wp_insert_attachment

text: I am working on a custom theme, in which I need to programmatically inserts posts and attachments. One requirement is those posts belong to users that are not the user who is logged in and running the action. To give you an example, an admin user logs in to WordPress, and runs this custom action. The custom action will create suggested posts for two other users, user1 and user2. Now if user1 logs in, he/she will see a suggested post and he can choose to publish it. Everything is cool and dandy so far, because the function `wp_insert_post` allows for programattic insertion of posts. One of the arguments that this function takes is `post_author` which can be set to the id of either user1 or user2. So far, everything is still great. Now, those post will have attachments (images). My question is, is there a way to add a `post_author` to the `wp_insert_attachment`? I could not find that in the documentation. I need the attachment to have the same author id as that of the post. Currently it takes the id of the the admin. Thanks.


title: Can deactivating a plugin sometimes "reset" settings within that plugin?

text: I need to deactivate a plugin on a client's website to check whether it is causing a certain issue or not. But I'm not 100% sure that after deactivating this plugin, all its settings will necessarily be restored upon re-activating it. Can anyone confirm please?


title: Create a page without adding a page in the Database

text: I am trying to include a special Archive page with my theme, right now I have a PHP file with `Template Name: Archives Template` at the top and I the user must create a blank archive POST PAGE and then select this as the template. The content for creating the page is blank so nothing is added into the database for the page content. Is there anyway to make it where they do not have to do this?


title: Using actions, hooks and filters in a non-WordPress page

text: I have a php script that sits outside of wordpress, but loads WP core with wp- load.php. Here is my basic page:               <?php     define('WP_USE_THEMES', false);     global $wp, $wp_query, $wp_the_query, $wp_did_header;     require_once('wp-load.php');     switch_to_blog(1); //make sure we're on the top level site     $author_id = 77; //admin     ?>      However, this also loads plugins - one of which (FacetWP) is throwing an error. As I don't need it, I thought I'd deactivate it with:               function deactivate_plugin_conditional() {         deactivate_plugins('facetwp/index.php');         }     add_action( 'admin_init', 'deactivate_plugin_conditional' );      However, this didn't appear to work, so I thought I'd try a simple echo:               function myDebug() {         echo "test";     }     add_action( 'init', 'myDebug', 10, 1 );      This didn't work either, so I'm clearly not understanding how to use these API calls. Any help with this problem would be much appreciated.


title: WP_query returns error when used for custom widget

text: I was working on creating my first plugin/widget that should display a really simple loop containing only a custom field (image) I've been testing the loop without any problems in my theme but when I place the loop in my plugin file it generates a fatal error preventing the plugin to b activated. I really don't understand why this happens as the loop works without any problems in the theme. This is the loop that I'm using:               <?php $args = array(         'posts_per_page' => 3,         'post_type' => 'sponsors',         'orderby' => 'rand',     );     $the_query = new WP_Query( $args ); ?>          <?php if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post();  ?>     <li>     <?php      $image = get_field('sponsor');     if( !empty($image) ): ?>     <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />     <?php endif; ?>     </li>     <?php endwhile; ?>     <?php else : ?>     <?php endif; ?>      And this is the fatal error displayed when activating the plugin: > Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting > T_STRING or T_VARIABLE or T_NUM_STRING I've already solved it another way by using the PHP Code Widget plugin but would like to know why I get this error. If I need to place the full plugin code let me know.


title: Post Templates and Post ID's

text:
I am trying to make use of the Single template for single posts ( I have a custom one). But for some reason my posts get overridden instead of displaying new data. This is the setup I have right now
     <?php global $post;      $category_id=get_the_category($post->ID);          $announcements = new WP_Query();      $announcements->query('showposts=1&cat=$category_id');     while ( $announcements->have_posts() ) :  $announcements->the_post(); ?>
Published by:<?php echo      get_post_meta($post->ID, 'Publisher','true');?>
          <?php endwhile;?>


title: is there any limit of length on creating custom taxonomies?

text: I am using custom taxonomy plugin. And I have custom Post type "Product". When I am creating new taxonomy **"home and garder Appliances Washin"** and attaching it to **Post** or **"Product"** it's not registering with these while If I am adding just **"home and garder Appliances Washi"** and attaching with either **Post or Product** it is working fine. Is there any length restriction when Creating Custom Taxonomies?


title: Writing less unnecessary code with WordPress

text:
I've got a simple homepage, that pulls content for 4 different categories. To do this, I'm writing 4 different WP_Query, and only the category name is changing (and as a result, the WP_Query name, etc). Is there a more efficient way to do this? Is it possible to put WP_Query inside a foreach loop — or is there a better way of just renaming variables rather than writing WP_Query 4 times? Here is an example of the code. This is repeated 4 times, with just the 'category_name' changing, along with some variable names:               <?php     $fashion_cat = array(         'category_name' => 'fashion',         'posts_per_page' => 4,         'post_type' => 'post',         'post_status' => 'publish',         'orderby' => 'date',         'order' => 'DESC',         'post__not_in' => $already_posted,         'category__not_in' => $private_categories     );          $fashion_query = new WP_Query( $fashion_cat );     if ( $fashion_query->have_posts() ):         $i = 0;     while ( $fashion_query->have_posts() ):         $fashion_query->the_post();         $images = get_field( 'gallery' );     if ( $images ):     $i++;     ?>          <?php  if ( $i == 1 ): ?>

                         <a href="<?php the_permalink(); ?>"><img src="<?php  echo $images[0]['url'];?>">     <?php top_note(); ?>

          <?php elseif ( $i == 2 || $i == 3 ): ?>
                         <a href="<?php the_permalink(); ?>"><img src="<?php  echo $images[0]['url'];?>">     <?php top_note(); ?>
          <?php elseif ( $i == 4 ): ?>
                         <a href="<?php the_permalink(); ?>"><img src="<?php  echo $images[0]['url'];?>">     <?php top_note(); ?>
          <?php     endif;     endif;     endwhile;     endif;     wp_reset_postdata();          ?>      And this is my attempt at putting it into a foreach loop, but it only calls once:               <?php     $home_cats = array( 'fashion', 'beauty', 'lifestyle' );     foreach ( $home_cats as $key ):         echo $key;          $key_cat = array(         'category_name' => $key,         'posts_per_page' => 4,         'post_type' => 'post',         'post_status' => 'publish',         'orderby' => 'date',         'order' => 'DESC',         'post__not_in' => $already_posted,         'category__not_in' => $private_categories     );          $key_query = new WP_Query( $key_cat );     if ( $key_query->have_posts() ):         $i = 0;     while ( $key_query->have_posts() ):         $key_query->the_post();     $images = get_field( 'gallery' );     if ( $images ):         $i++;     if ( $i == 1 ): ?>

                         <a href="<?php the_permalink(); ?>"><img src="<?php  echo $images[0]['url'];?>">     <?php top_note(); ?>

          <?php elseif ( $i == 2 || $i == 3 ): ?>
                         <a href="<?php the_permalink(); ?>"><img src="<?php  echo $images[0]['url'];?>">     <?php top_note(); ?>
          <?php elseif ( $i == 4 ): ?>
                         <a href="<?php the_permalink(); ?>"><img src="<?php  echo $images[0]['url'];?>">     <?php top_note(); ?>
          <?php     endif;     endif;     endwhile;     endif;     wp_reset_postdata();          endforeach;          ?>


title: Filter on widget-title does not work with custom links

text: I added a filter to my widget titles and it looks like the filter doesn't apply on links, which are created with the links-sidebar. It does work perfectly on the blogroll or search widget Here's a Screenshot, to illustrate what I mean.               add_filter('widget_title', 'new_title', 99);     function new_title($title) {         $title = 'text';         return $title;     }      I disabled all plugins and tried the same the default wordpress themes and got the same results.


title: Display custom taxonomy posts of custom post types

text:
I have created a custom post type "Portfolio" and a custom taxonomy "Kind" which includes "Websites", "Graphics", "Programming". What I want to do is to create 3 different pages "Websites", "Graphics" etc. that will display the appropriate items as a list. This is my code to display "Portfolio" posts :               <?php query_posts( array( 'post_type' => 'portfolio') ); ?>         <?php if( is_tax() ) {             global $wp_query;             $term = $wp_query->get_queried_object();             $title = $term->name;         }  ?>

                         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                         <?php $categories = get_the_category(); ?>                         <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix single-post'); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting">                                                              <?php the_post_thumbnail( 'wpbs-featured' ); ?>

<?php the_title(); ?>

                                 <?php the_content(); ?>

                               <?php endwhile; ?>                                   <?php else : ?>                         <?php endif; ?>

       Unfortunately, I can't manage to display only "graphics" or "websites" posts.


title: How can I prevent wordpress from sending emails

text: I would like to stop all email functionality in my wordpress installation. Is this possible with a global flag? or maybe by forbidding this installation to use the php `mail` function at all in htaccess?


title: Custom taxonomy widget in admin area

text:
I have a custom taxonomy set up on a custom post type and the box it uses is the same as categories, except I wanted to make it easily searchable using a filter script and then also allow the user to only select one and not multiple. I managed to get the search/filter working and to get it to display on the sidebar under the custom post type in the admin area and then I managed to hide the old box, but now I can't seem to get the term that is associated to a specific "post". So none of them is returning as selected once you update the page. Code below:               function my_client_box() {         add_meta_box(             'clients_section',             'The title',             'clients_box',             'cars',             'side'         );     }     add_action( 'add_meta_boxes', 'my_client_box' );          function clients_box() {         echo '
<input id="livefilter-input" type="text" value="" placeholder="Search names" autocomplete="off">';         echo '
';         echo '
';              $terms = get_terms("client", 'orderby=name&order=ASC&hide_empty=0');         $count = count($terms);         if ( $count > 0 ){             foreach ( $terms as $term ) {                 echo '
<input type="radio" name="tax_input[client][]" value="' . $term->term_id . '"> ' . $term->name . '
';             }         }              echo '
';         echo '
';         echo '
';         echo '                                              ';     }      When I `print_r` the `$term` var there doesn't seem to be any indication about if the specific name should be checked or not. How would I go about doing this?


title: Preventing Canonical Redirect for CDN

text: I want to run my entire WordPress site through a CDN to improve performance (HTML, not just static CSS/JS/media). Lets say the origin server is example.com and www.example.com is the URL where traffic will go through the CDN set-up as an origin-pull. The problem is an infinite loop will be created when visiting www.example.com which passes the request to WordPress which will look at the request and say "Actually this should be www.example.com according to the home_url and site_url defined in the Settings" Sooo... 1) Is there an easy way make WordPress stop redirecting to www under a certain condition (like checking for the x-forwarded-for headers which will be added to requests coming through the CDN)? 2) Am I going to have to set a constant to change the site URL for requests from the CDN and then set-up some sort of output buffering callback to replace http://example.com to http://www.example.com ? I know there are plugins out there that handle this. I'm looking to roll my own so I can figure out how this all works. Any guidance would be much appreciated.


title: Video Embed in Sidebar Widget with Links to Others in Category

text: I am trying to re-create the sidebar widget found here: http://www.clinicalforensicpsychology.org/ The links below the shown video are linked to the post category "videos". I have tried most every sidebar widget but I'm unable to find something that does the same thing. Does anyone have a suggestion? Thanks in advance!


title: Wordpress article with 50 000 words loading slow - 100% cpu

text: I have a wordpress article with 50 000 words. After a debug I realised that the CPU is 100% when I read the post / open the category page. I have a quad core server with 8gb ram (the ram level is below 1%), so the problem is the CPU. I opened putty and entered the command: top This is the first line:               20961 zzz  20   0  278m  41m 8712 R  100  0.5   0:05.49 php53.cgi      where 100 is the CPU usage. The page loads after 1 minute. I searched on google for a solution to this problem and I found this solution: http://wordpress.stackexchange.com/a/43830/21370 The accepted solution for the above link was:               Change the recursion limit to 200x normal, that is, set: pcre.recursion_limit=20000000          Change the backtrack limit to 100x normal, that is, set: pcre.backtrack_limit=10000000      The problem is that it's not working. I changed recursion_limit and backtrack_limit to lower and higher values. But I still got the same problem. Please give me a solution to my problem. Thanks.


title: get main product category list woocommerce

text: I am using woo commerce theme for my site. I am trying to display a list of main product category list. I tried this code. But it returns all the main and sub categories.               $product_category = wp_get_post_terms( $post->ID, 'product_cat' );      I need to display just the main product category list. How to do that?


title: How to get a notification when the plugin is installed?

text: I'm making a WordPress plugin to get a notification when the plugin is installed. I'm using `is_plugin_active` but I still do not understand...


title: Can I make my widget of my video only automatic on the homepage?

text: I have a video that is automatic when someone logs onto my website homepage (wordpress). But I only want it to be automatic on the homepage. It is automatic on every page. How can I turn it so that it is only automatic on the home page?


title: User can post only one comment per day on one page

text: This code count comments per day on all pages. I want that will count only on one page for 1 day. So my case: on a page with an ID of `1`, a user can comment with out any limit, but on a page with an ID of `2`, the same user can only comment once per day.               <?php      global $wpdb,$current_user;     $limit = 5; //this is limit per day per user     $comment_count = $wpdb->get_var( $wpdb->prepare("         SELECT count(*)         FROM wp_comments          WHERE comment_author = '%s'             AND comment_date >= DATE_SUB( NOW(), INTERVAL 1 DAY );",             $current_user->user_login     ) );          if ( $comment_count < $limit ) {         comment_form();     }        else {         echo 'exceeded comments limit - '.$limit;     }


title: Having a widget only show up in print

text: I have a Wordpress blog at http://rlc.vlinder.ca on which I show a QR code containing the URL of the current page. I'm using the "QR Code Widget" for that and it works fine, mostly, except that it doesn't show up if the page is printed. I have another QR code plug-in installed on the blog, "WP Page QR", which does show up in print (with a slight change to the CSS), but doesn't look nice at all in the browser. I've tried activating them both, but they both use the same PHP class library to generate the QR image, so activating the second simply crashes (which is caught by WordPress, which promptly deactivates the plug-in again). What I'd like is to show the QR code from the "QR Code Widget" in the browser, and show the one from "WP Page QR" in print, or do something similar to put the QR code on the printed page where it is most useful) -- not necessarily using the two plug-ins. Is there a plug-in that would already allow me to show the QR code in the widget area (on the right) in the browser, and print it somewhere on paper when printing? Is there a plug-in that would allow me to "simply" format the printed version? I am currently planning to edit the "WP QR Code" plug-in to allow me to activate it while "QR Code" is also active, but I'd like to avoid forking off a plug-in if I can..


title: Making plugin output customizable

text: I am writing a plugin that will display a timeline of historic events, and I am looking for ways to make the output customizable. I was considering including a template/example within the plugin folder that can be overridden inside the theme folder. My idea was to make sure WP looked in the theme folder first for a customized template before resorting to the one I create. If this is not good practice, let me know! What functions can I use to do the above functionality?


Are widgets meant to be used outside of sidebars? My case: I have this html block which I want to use every time I display a post with category of "Story". I was going to make a widget to reduce duplicate code. Is there a better way to apply this html block to every displaying of a "Story" post?


title: Trying to get custom js files in my admin header

text: I'm trying to add a java script file to my admin header and use admin-ajax.php to use ajax in my wp-admin (still learning a lot about the process). I've created a custom folder in my theme_directory/js called custom with the file I need to add to the admin header but it doesn't seem to be working. here's the code:               add_action('admin_enqueue_scripts', 'my_admin_enqueue_scripts');          function my_admin_enqueue_scripts() {         global $current_screen;         if ( 'page' != $current_screen->ID )             return;         wp_register_script('my-scripts', get_template_directory_uri() . '/js/custom/my-scripts.js' );         wp_enqueue_script('my-scripts');         wp_localize_script('my-scripts', 'wp_ajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));     }      Despite this I'm not seeing a reference in my header to my custom js file. I've even tried `add_action('admin_header', 'my_admin_enqueue_scripts');` with no avail. I only need this script file in my wp-admin. What am I missing? Thank you!


title: Getting content from a single *page* of a post

text: What function can I use to fetch content of a single page within a post? Let's say I want to split my post into 5 pages - how can I get content of, say, page 3? Can't seem to find this in Codex...


title: create parent post using wp_insert_post

text: how can i create php function where i can create a post in one custom post type also create a child post type, i have already create a parent post type, i.e               post type "a = car"     post type "b = user"      i want to create a post in custom post type `"a = car"` but also add new post in post type `"b = user"` using `wp_insert_post` this is the closest i have found http://wordpress.org/support/topic/setting- post_parent-during-wp_insert_post


title: Fixing YARPP plugin FULLTEXT MySQL indexing

text: I just found out that the Yet Another Related Posts plugin (YARPP) uses FULLTEXT indexes on the wp-posts table, which greatly slows down sites with a large amount of posts. Can I can just delete the plugin, or do I have to clean out the wp-posts table of those indexes in order to fix the issue?


title: How to change attachment data?

text: When i uploading images in wp i change it's name by post name, but in media list image titles still is original. How to change it on upload? I tried `wp_generate_attachment_metadata`, `wp_handle_upload_prefilter`, `sanitize_file_name`


title: Updating seperate database when post attachment is changed

text: I have a seperate database with lists of users, brochures and brochure URL's, and timestamps of when a brochure was ordered, but I want my database to update everytime a brochure (PDF) attachment is updated in the admin back end of wordpress. When a user requests a brochure they receive a reminder after a few days wiuth a link to the PDF they requested. I have most of it figured out I just need to know how this link can constantly link to the latest PDF of the brochure they requested. Thanks :)


title: Moving wordpress from /dir to main folder

text: I have a simple question. I want to move my wordpress installation from www.xclo.co.uk/dir to www.xclo.co.uk Please can someone tell me how to do this.


title: Novice WordPress Installation issues

text: I am trying to install WordPress on www.000webhost.com I have uploaded the most recent version of WordPress to the server and created a MySQL database. However, When I visit my site, I select the WordPress folder and it gives two error messages: > Warning: require_once(/home/username/public_html/wordpress//wp- > includes/class-wp-error.php) [function.require-once]: failed to open stream: > No such file or directory in /home/a5558093/public_html/wordpress/wp- > load.php on line 48 > > Fatal error: require_once() [function.require]: Failed opening required > '/home/username/public_html/wordpress//wp-includes/class-wp-error.php' > (include_path='.:/usr/lib/php:/usr/local/lib/php') in > /home/username/public_html/wordpress/wp-load.php on line 48 What do these mean? How can I solve these issues?


title: How to synchronize The Loop with the max post per page?

text: I know I can use get_posts() and then specify to only get a certain number of posts, but I don't know how to use the value that the site admin has set in his settings.


title: Category pagination not working

text:
My category page navigation doesn't seem to be showing up at all, what am I missing in my coding?               <?php get_header(); ?>

           <?php if ( have_posts() ) : ?>

                 <?php                             printf( __( '%s', 'rsi' ), '' . single_cat_title( '', false ) . '' );                         ?>

             <?php                             $category_description = category_description();                             if ( ! empty( $category_description ) )                                 echo apply_filters( 'category_archive_meta', '
' . $category_description . '
' );                         ?>                            <?php wp_pagenavi() ?>           <?php /* Start the Loop */ ?>           <?php     $args = array( 'category' => 5 );     $lastposts = get_posts( $args );     foreach($lastposts as $post) : setup_postdata($post); ?>
             <?php if (has_post_thumbnail( $post->ID ) ): ?>             <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>             <a href="<?php the_permalink(); ?>">             <div id="custom-bg" style="background-image: url('<?php echo $image[0]; ?>')">
                          <?php endif; ?>

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

               <?php the_excerpt(); ?>

 Posted on:               <?php the_date(); ?>

           <?php endforeach; ?>           <?php else : ?>

                 <?php _e( 'Nothing Found', 'rsi' ); ?>

                 <?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'rsi' ); ?>
               <?php get_search_form(); ?>

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

           <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Right Sidebar')) : ?>           <?php endif; ?>

     <?php get_footer(); ?>


title: Wordpress admin never finishes saving page on site with large page count

text: I have a Wordpress install with a very large amount of pages (a few hundred thousand), and over time it has gotten to the point where editing a page takes an extremely long amount of time. It would take several minutes just to open the edit screen, but I found out that it was wp_pages used in generating the parent page selection dropdown that caused that, so I removed it via a hook in my theme's functions.php and so now the edit screen loads just fine. Now the problem I have is that when updating/editing a page, it never seems to complete whatever it is doing. The page keeps on loading after hitting update, but it does successfully edit the page within a couple of seconds (I can verify that on the frontend), but in the admin it just keeps going until I just manually refresh the page. Any one know what wordpress function might be causing this sort of timeout on saving a page? I have wordpress 3.5.1 and I've tried to disable any running plugins. Any ideas? Just to add, eventually I get a 500 server error after letting it run for about 30 minutes. Here is the server's log:               [Sat Jan 26 13:11:12 2013] [warn] [client 76.189.45.243] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: http://www.server.com/wp-admin/post.php?post=18173&action=edit      [Sat Jan 26 13:11:12 2013] [error] [client 76.189.45.243] Premature end of script headers: post.php, referer: http://www.server.com/wp-admin/post.php?post=18173&action=edit      [Sat Jan 26 13:11:12 2013] [warn] [client 76.189.45.243] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: http://www.server.com/wp-admin/post.php?post=18173&action=edit      [Sat Jan 26 13:11:12 2013] [error] [client 76.189.45.243] Premature end of script headers: admin-ajax.php, referer: http://www.server.com/wp-admin/post.php?post=18173&action=edit


title: How can i list random post from multiple category?

text:
I have an author page, and I want to list posts from current author's categories. e.g. I'm viewing John's page, and John wrote in Sport, Tech, News, Computer categories. Then my code list from this (Sport, Tech, News, Computer) categories list random 10 post. But something is going wrong: Those 4 categories have 25 posts. But my code isn't listing 10 posts, it's just listing 1 post. And i need random post list My code:               <?php global $post, $wpdb;     $author_id = $post->post_author;     $categories = $wpdb->get_results("         SELECT DISTINCT(terms.term_id) as ID, terms.name, terms.slug         FROM $wpdb->posts as posts         LEFT JOIN $wpdb->term_relationships as relationships ON posts.ID = relationships.object_ID         LEFT JOIN $wpdb->term_taxonomy as tax ON relationships.term_taxonomy_id = tax.term_taxonomy_id         LEFT JOIN $wpdb->terms as terms ON tax.term_id = terms.term_id         WHERE 1=1 AND (             posts.post_status = 'publish' AND             posts.post_author = '$author_id' AND             tax.taxonomy = 'category' )         ORDER BY terms.name ASC     ");          foreach($categories as $category) :          $catnumber = $category->ID.',';     endforeach;?>     <?php           $args = array(     'category__and' => array( $catnumber )     , 'showposts'=> '10'     );          $my_query = new WP_Query( $args );     ?>
     <?php while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
             <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
     <?php endwhile; ?>
     <?php wp_reset_postdata(); ?>


title: How to list menu-item- ids in order for wp_nav_menu

text:
I have a nav menu call: 'primary', 'container_class' => 'primary-menu' ) ); ?> The output looks something like this:

RSS

Contacto

Facebook

Twitter

Site Info

      I'm trying to apply a different background color to each menu item, so #1 would get one color, #2 a second color. I would like the theme work for whatever menu items someone wants to set up- so it would be preferable it the #id on each li went in order. Eg:

List item

List item

List item

List item

      Any help would be appreciated.


title: Twitter bootstrap tabs

text: Does some know how to do shortcode for Twitter bootstrap tabs or any other tabs? I found this tutorial http://michaelwender.com/blog/2010/11/01/creating- wordpress-shortcodes-for-jquery-tools-tabs/ but it doesn't work. thx for your time


title: Multisite - big hosting package or several hosting packages?

text: When I want to create a mutlisite on which I can create mutliple sub-sites with different domain names, do I have to buy a hosting package for each of these sub-sites or can I just link the domain name to the corresponding sub- site of Wordpress MU


title: Can i login with only one account to different top leveled domain wordpress web sites?

text: I am using Wordpress 3.3.1. I have 3 different blog. For example www.a.com www.b.com www.c.com Different top level domains. My visitors want to login my blogs with same accounts. Is there a way that users register account only one blog and then they can use same account different blog ? Like a passport ? In this scenario admin and visitor is me. I need to ask my questions different blogs with same account. But i dont want to register same account each blog. Please help! If my question can not understood and then -> Detailed Explanation 1-I have 3 wordpress blog in different top level domains. 2-I want to register myself like a visitor to first site. 3-I want to login with this account to third site Is that possible ? Please help!