Does WordPress Offer a Way to Find All of the Categories that Don't Have Children?

**Background** As discussed in Is There a Difference Between Taxonomies and Categories, taxonomies refer to a generalized system of classification and organization of objects or data. In the case of WordPress; Categories, Tags, Post Format(ting), and Link Categories are built in taxonomies used to help classify and organize posts, links, and metadata. Terms are instances of these taxonomies; take for example a WordPress blog about computer software. If one of the taxonomies is a category, then one of the terms would be programming languages, because programming languages is a topic in computer software, and could be considered a categorical taxonomy. Additonally, WordPress developers and Plugin developers may utilize the `register_taxonomy()` function to initialize the built-in taxonomies, as well as _create new taxonomies_ in WordPress. **Working with WordPress Categories** Ok, so WordPress offers up a few interesting functions under the Taxonomy API ( no codex page, links to most recent source code ). If I understand them correctly, some of the promising functions I can use for my purposes are the following:   * `get_terms()`: The codex pretty much says the same thing the source code comments say; that it retrieves the terms in a given taxonomy or list of taxonomies. I can provide an array of arguments to change which terms are returned; for example, to ensure that I include terms that are empty ( that is, are not referred to by any posts in the case of categories or tags ), I can set the _hide empty_ argument to `0` or `false`;   * `get_term_heirarchy()`: Returns all of the term IDs of a given term's children as an array.   * `term_is_ancestor_of()`: Does just what it says; compare two terms, with term one being the term of reference, and term two the term to check for ancestry. **Umm, So What About Descendants** My goal here is to find out which categories don't have any child categories ( or descendant terms, to be more general ). I also don't want to ignore empty categories ( categories that have children but don't have any posts that reference them ). Does WordPress have an easy way to do such a search? If so, are there performance concerns I should be worried about? **Some Edits** : To provide an example for future reference, here is some hard data I am working with... ## WordPress Category Admin View ![Categories](http://i.stack.imgur.com/PIEIH.png) ## Table of WordPress Taxonomy ![Table of WordPress Taxonomy](http://i.stack.imgur.com/YBifQ.png) ## Table of WordPress Terms ![Table of WordPress Terms](http://i.stack.imgur.com/zxeBf.png) ## Table of WordPress Term_Relationships ![Table of WordPress Term_Relationships](http://i.stack.imgur.com/16vMv.png) In my test case, I want to return the following back:   * Uncategorized   * Firmware and Embedded Systems   * Operating Systems   * Web and Internet Based Applications   * Hardware All of these have no children, even though some have an empty count.


make data result from mysql as link

I'm not really a good web programmer but I wanted to try. I want to make my result from database as a link for example I want "click here" as click would redirect to a new page or something. and I think the idea is like.. a href"this.webpage.com">click here /a my code is.               add_filter( 'the_content', 'get_scrapy_scraped' );          function get_scrapy_scraped( $content )     {         global $wpdb;              if ( ! is_page( 'jobs' ) )             return $content;              $table_name    = $wpdb->prefix . "careers";         $retrieve_data = $wpdb->get_results( "SELECT * FROM $table_name" );              if ( ! $retrieve_data )             return $content;              $table = '

         Job Name	         Location/Dept	         Complete Info	         Application Link
';              foreach ( $retrieve_data as $row )         {             $table .= "
                 {$row->Job_Name}	                 {$row->Job_Department}	                 // I want this two results to be links naming Click for Details and Click to Apply respectively                 {$row->Job_Link_Info}	                 {$row->Job_Link_Apply}
";         }              $table .= "
";              return $table . $content;     }


Combine two conditions in one statement syntax

I have two queries that I would like to combine because it becomes a lot of code and I think that's not necessary but I make a mistake with the syntax I want to combine               } elseif (is_category( 'latest-news' )) {      With               } elseif ( is_single() && in_category('latest-news')) {      I tried               elseif (is_category( 'latest-news' )) || ( is_single() && in_category('latest-news')) {       and               elseif (is_category( 'latest-news' )) or ( is_single() && in_category('latest-news')) {       but they both don't work, probably I am doing something wrong. How could I combine these two?


can we add extra table or column in wordpress for adding our data

Just a simple question is it possible if yes what are the requirements of this mean i want to make a table for adding songs information in table like               link | name | date | size | moviename      is it possible if yes any idea or any suggestion thanks


Changing upload dir in a plugin regardless of post type

I read this post and found it really interesting. I tried to modify it a little to make it work if you have a custom db table and not really a post type to rely on. So I tried to figure that out using get_current_screen() instead of get_post_type(). In this example I did a little plugin to register members of some kind (just for the idea of using this in any kind of plugin that doesn't use post types) and have the profile photos upload to the plugin dir just like in the original code. Although this doesn’t seem to work, the files are still saved in the regular "wp-content/uploads/" dir. Any ideas? The plugin itself uses a simple form to save data to db and I also hooked the wp-uploader to upload and send the image url with the rest of the data.               function custom_upload_directory( $args ) {          $screen = get_current_screen();          // If the parent_base is members, upload to plugin directory     if ( $screen->parent_base == ‘members’ ) {         $args['path'] = plugin_dir_path(__FILE__) . “uploads”;         $args['url'] = plugin_dir_url(__FILE__) . “uploads”;         $args['basedir'] = plugin_dir_path(__FILE__) . “uploads”;         $args['baseurl'] = plugin_dir_url(__FILE__) . “uploads”;     }     return $args;     }     add_filter( ‘upload_dir’, ‘custom_upload_directory’ );


Is there a plugin which allows me to save additional, invisible content per post?

For a blog project, I need to be able to attach content to each blog post which isn't visible to the casual reader but to all editors. Think of it as a collection of reference materials, comments and ideas which I'd like to keep. If possible, then I'd like to see this section along with the normal blog editor (so I can edit both at the same time). Note that I'd like to create a multilingual blog, but it would be alright if this additional information would show up only in the main language (English) instead of being translated. But it should show up in all language versions.


How to make my Home button on the menu redirect to my root page

When i create a new page, a permalink is created: `www.example.com?page_id=29`. This page is always pointing to the page which `id` is `29`. Now, i want to point it to the root page in my website: `www.example.com`. I think it has to do with the permalink, but i can't change it. can you help me there please.


Add multiple images to a page sidebar

What I am trying to achieve is this: I have a simple page and I want to dynamically add multiple images to it on the sidebar one underneath another. I was thinking about either using meta boxes, post thumbnail or custom field. I am looking for a nice and simple method to do that. Here is a screenshot that better explain what I am looking for: ![](http://bit.ly/y4Vi19) Notice that adding images to the post itself must be differ than add images to the sidebar. any help will be appreciated Thanks, Gil


want to create a subcategory.php to manage subcats

is it possible to create a subcategory.php and use it to manage subcats. or is there a way to get around this. if it is not possible.. is there something like this               <?php if(is_subcategory() || child() ) {     //do stuff     } else {     // do else     } ?>


Why 'C++' tag is converted to 'C# '?

If I add the C++ tag, when updating the post it gets converted to C#. If I add the ++ tag, there's no conversion. Encoding for pages and feeds is UTF-8. Wordpress version 3.0.1


Mobilepress fails to translate short codes

I launched mobile version of my site some days ago. It was looking fine. I used `mobilepress` for the same. But i found that `shortcodes` are being displayed as simple text. is there any other plugin to build efficient mobile version including short code translation


Char limit on custom blog-post form?

I want to setup a simple custom form for users to post, which will automatically:   * Subscribe user to updates (i.e. moderation approved, comment posted)   * Enable DISQUS xor IntenseDebate comments   * Publish to `/users-articles/`. The form should look something like this: > Title: > > Rich-text post (with char-limit): > > Tags: > > `Submit (goto login/register if unauthed)` **Which plugin can I use to create this form?**


How do I turn off self-closing tags for markup in WordPress (for HTML5, or HTML4, for example)?

I want to use HTML5 in my WordPress theme, how do I turn off wptexturize? I don't mind WP adding breaks, but I want them to be `<br>` and not `<br />`. How do I get control over how those breaks show up in my code? **EDIT:** I only really care about the `<br>` tag issue, I don't mind the typographic changes it makes. **EDIT2:** Actually, I guess `<img>` tags matter too. Any self-closing standalone tags will matter here. So, `<hr>` might be an issue as well. Not to mention such `wp_head()` items as `<link>` and various `<meta>` tags.


Default table collation on plugin activation?

I'm following **this** to make my plugin auto-create a table when the plugin is activated, but what happens is that while all the tables (the whole db) are utf8_general_ci, the newly created table is latin1_swedish_ci... Why isn't it also utf8? I thought it would also be utf8 by default since I have:               define('DB_COLLATE', 'utf8_general_ci');      in my wp-config.php... I have everything exactly the same like in the link provided, except the function name, and I have different SQL fields... How to make the newly created table utf8 by default? this is my function:               function duende_install() {     global $wpdb;     global $duende_db_version;          $table_name = $wpdb->prefix . "duendes";     if($wpdb->get_var("show tables like '$table_name'") != $table_name) {         $sql = "CREATE TABLE " . $table_name . " (             id mediumint(9) NOT NULL AUTO_INCREMENT,             shape tinytext NOT NULL,             integrity tinytext NOT NULL,             length tinytext NOT NULL,             drone tinytext NOT NULL,             wood tinytext NOT NULL,             mouth tinytext NOT NULL,                         rim tinytext NOT NULL,             bell tinytext NOT NULL,                                  loud tinytext NOT NULL,                                  mass tinytext NOT NULL,                                  finish tinytext NOT NULL,                inlay tinytext NOT NULL,                                 price smallint DEFAULT '0' NOT NULL,             sold tinytext NOT NULL,                                                          UNIQUE KEY id (id)         );";              require_once(ABSPATH . 'wp-admin/includes/upgrade.php');         dbDelta($sql);              add_option("duende_db_version", $duende_db_version);     }     }      Thank you


What may be causing failure of auto-install features in Wordpress (v3.0.3)?

What may be causing the installation errors I continue to get when trying to auto update anything in Wordpress? I've been manually upgrading everything for quite some time, and I've tried all sorts of permissioning schemes. Here's a sample error: ` Installing Theme: Indore 1.0.1 Downloading install package from http://wordpress.org/extend/themes/download/indore.1.0.1.zip… Unpacking the package… Could not create directory. /public_html ` Thanks!


Post to category based on email domain, for a post-by-email plugin

I have a wordpress plugin installed called Postie - it enables me to post to my wordpress by sending an email to a specific email address. I need help with some coding in order to make it so it will post to a specific category depending on the sender's @domain address from their email. so if the email is from `XXX.com`, post all of their posts to X category, but if its from `ZZZ.com`, post it to Z category. --- this is the sample filter file ----               <?php     /*     Plugin Name: Postie Filter     Plugin URI: http://blog.robfelty.com/plugins/postie     Description: Adds my own custom filter to messages posted by postie     Version: 1.4     Author: Robert Felty     Author URI: http://blog.robfelty.com/     */          /*      * Any filter function you write should accept one argument, which is the post     array, which contains the following fields:     'post_author'      'comment_author'      'comment_author_url'      'user_ID'      'email_author'      'post_date'      'post_date_gmt'      'post_content'      'post_title'      'post_modified'      'post_modified_gmt'      'ping_status'      'post_category'      'tags_input'      'comment_status'      'post_name'      'post_excerpt'      'ID'      'customImages'      'post_status'           Your function can modify any of these fields. It should then return the array     back.          Two example functions are provided here     */          function filter_content($post) {       //this function prepends a link to bookmark the category of the post       $this_cat = get_the_category($post['ID']);       //var_dump($this_cat);       $link = 'term_id) .        '">Bookmark this category' . "\n";       $post['post_content'] = $link . $post['post_content'];       return ($post);     }          function filter_title($post) {       //this function appends "(via postie)" to the title (subject)       $post['post_title']= $post['post_title'] . ' (via postie)';       return ($post);     }          function auto_tag($post) {       // this function automatically inserts tags for a post       $my_tags=array('cooking', 'latex', 'wordpress');       foreach ($my_tags as $my_tag) {         if (stripos($post['post_content'], $my_tag)!==false)           array_push($post['tags_input'], $my_tag);       }       return ($post);     }          function add_custom_field($post) {       //this function appends "(via postie)" to the title (subject)       add_post_meta($post['ID'], 'postie', 'postie');       return ($post);     }          add_filter('postie_post', 'filter_title');     add_filter('postie_post', 'filter_content');     add_filter('postie_post', 'add_custom_field');     add_filter('postie_post', 'auto_tag');


encounter server issues while uploading files into meta-slider

good day errors i encounter while tryin to upload files into this slider my system: wp 3.9.1 fresh install meta slider - Example-file 170 kb errors a. Unable to create directory wp-content/uploads/2014/06. Is its parent directory writable by the server? b. HTTP error. permissions wp main installation root 777 wp-content folder and all sub folders 777 here the data to the slider - metaslider Easy to use slideshow plugin. Create SEO optimised responsive slideshows with Nivo Slider, Flex Slider, Coin Slider and Responsive Slides. Version 2.8.1 | By Matcha Labs | by the way: can i create the directory with the ftp-client. Can i do the uploads with the ftp-client !? Is this possible?


using add_role function to make some users to create a selected type post

how are you ? I have in my site (post_type called = books).. I need to make some users for example (Library) to create a books (post_type = books) .. this is the code to add rols (called = library) ..               $library = add_role('library', 'library', array(         'read' => true,          'edit_posts' => true,         'delete_posts' => false,      ));      The library Role can create (any type of post) , I want it to create books (post_type) .. I wish you understand me .. thank you very much ^_^


How to determine which capability to use?

For example, I want to use add_menu_page() function to add a menu item to the dashboard. To control which users will be able to access it, I'm supposed to use capabilities...               <?php add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position ); ?>       So, if I want to grant access to that menu page to - superadmin, admin, editor and author so that all users with one of these roles could access it, what am I supposed to put as $capability? I'm looking at **this** table and as far as I figure, I should put one of these four as $capability:   * edit_published_posts    * upload_files   * publish_posts    * delete_published_posts So if roles&capabilities haven't been altered via some plugin, picking one of these four should grant access to all the four roles just like I want it? Is this the usual practise, or am I supposed to do it in some other way? Am I supposed to somehow add more than one capability into $capability, or is just one enough? If only one is enough, which one of these four would be the best choice, or it does not matter as long as roles are not altered to be different than default? thank you


Link to a User's Forum Profile From Their Comment

How do I link a user's forum profile from their name in their comment. So far I've got this code in functions.php but it doesn't seem to work:               function force_comment_author_url($comment)     {     // does the comment have a valid author URL?     $no_url = !$comment->comment_author_url || $comment->comment_author_url == 'http://';          if ($comment->user_id && $no_url) {     // comment was written by a registered user but with no author URL     $comment->comment_author_url = 'http://www.examplesite.co.uk/forums/users/=' . $comment->username;     }     return $comment;     }     add_filter('get_comment', 'force_comment_author_url');      Please can somebody tell me where I'm going wrong?


Convert textarea into TinyMCE

This code converts the textarea into the TinyMCE editor:                 $('.text_editor').each(function(){           var textfield_id = $(this).attr("id");         window.tinyMCE.init({               mode : "none",             theme: 'advanced',             skin : 'wp_theme',             width: "600px",             height: "300px",             theme_advanced_blockformats: 'p,address,pre,h1,h2,h3,h4,h5,h6',             theme_advanced_buttons1: 'formatselect,|,bold,italic,underline,removeformat,|,link,unlink,anchor',             theme_advanced_buttons2: '',             theme_advanced_buttons3: '',             theme_advanced_toolbar_location: 'top',             theme_advanced_statusbar_location: 'bottom',             theme_advanced_resizing: true,             theme_advanced_resize_horizontal: false,                         });           window.tinyMCE.execCommand("mceAddControl", true, textfield_id);            });
         HTML         Visual

         <textarea id="text_editor" name="text_editor" class="text_editor"></textarea>         $(this).prev('.tfuse-tinymce-tabs').find('.html').click(function() {             window.switchEditors.go(textfield_id, 'html');         });         $(this).prev('.tfuse-tinymce-tabs').find('.visual').click(function() {             window.switchEditors.go(textfield_id, 'tmce');         });          .tinymce-tabs {         height: 30px;         width:600px;     }          .tinymce-tabs .html, .tfuse-tinymce-tabs .visual {         background-color: #f1f1f1;         border-color: #dfdfdf #dfdfdf #dfdfdf;         color: #999999;         border-style: solid;         border-width: 1px 1px 0px 1px;         cursor: pointer;         float: right;         height: 24px;         margin: 5px 5px -2px 0px;         padding: 4px 5px 2px;         border-top-left-radius: 3px;         border-top-right-radius: 3px;         -moz-border-radius-topleft: 3px;         -moz-border-radius-topright: 3px;         -webkit-border-top-left-radius: 3px;         -webkit-border-top-right-radius: 3px;         line-height:15px;           }          .tinymce-tabs .active {         background-color: #e9e9e9;         border-color: #cccccc #cccccc #e9e9e9;         color: #333333;     }      Not able to switch the editor and show the quicktags. I have seen some plugin creates the editor dynamically.


WordPress .htaccess to consider blog as directory

I redesigned an old (static) website to WordPress CMS. Now that site is WordPress based with 'blog' as a page displaying all posts. On previous (static) version, they already had a separate WP blog inside /blog directory. I imported all old blog posts to our new WP setup but problem is with images. On old blog, images inside posts had source like `http://www.example.com/blog/wp-content/uploads/../x.jpg` But once all posts were imported to new site, these image paths didn't change in imported posts and now are all broken links. I tried fixing this issue by creating an empty folder `blog` on root, with only `wp-content/uploads` folder in it so paths to old images keep working. But now my new blog page is not working. Instead of showing `/blog` posts, it shows contents of `blog` directory. This is because of .htaccess which knows that `/blog` is an existing directory which exists and doesn't pass request to index.php. Now the only solution is to tell .htaccess to consider only those '/blog' directory requests which are image URLs and the file exists. And pass rest of requests to index.php. Default .htaccess content looks like:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>      How do I achieve this? Thanks.


How do I remove certain fields from the forum edit my profile page?

My users are able to click on their forum profile and edit things like their password and picture but I don't want some fields to appear. How can I get rid of: First Name, Last Name, Contact Info, Website, Blog Role and Forum Role?


redirect attachment page to category page

I'd like to prevent google from indexing my attachment/image pages. So for the images I placed in my posts that's no problem - I just redirect the attachment page to the post parent by creating a new file "image.php" with this code `<?php wp_redirect(get_permalink($post->post_parent)); ?>` The problem is though that I got images in my category descriptions, which don't even have a post parent, so the redirect doesn't work. Is there a way that I can redirect the attachment page to the category page that has the picture in its description? Or maybe a way I can put all my attachmentpages on noindex?


how to create wordpress network with multiple wordpress installations

i want know it is possible to have 2 or 3 wordpress installations ,get together create ,and create a network .,which will share user data across the network, if there any reference that will be great,


change the Dashboard menu items label wp

I need to change this word "Dashboard" in the top menu in wp-admin If anyone can supply the code for the functions.php file or point me in the direction I would greatly appreciate it!


How to transfer changes to a child theme?

I'm using a Template called D5 Design. They have an update, and I've made changes to a few of the PHP files in the Theme files. (changes to text on certain pages mostly) When I do the update, I realize now that I'm going to lose those changes. My question is - when I create a child-theme, if I want to have those changes from the certain PHP files not get lost, how, where, in what way to put those changes in the child-theme? Do I copy the folder into the child theme? do I copy just the code from the folder? I'm completely at a basic mode on this and I just really need someone to explain it. Every post I've read so far, makes the assumption that one already knows how the Child-Theme works (even the Codex on Child-Themes.) I'm hoping something can help make this clear to me. For example I changed a portion of the comments.php file so that the text for comments is no longer generic. the code looks like this:                  $defaults = array('fields' => apply_filters('comment_form_default_fields', $fields),                  'title_reply' => __( '(You must register before you can post anything. Please read our Terms Of Service [bottom of the page]. <p> We hold true to them.) <p> <p>State Your Intention for Your Meditation <p> Then Come Back and Share Your Experience' )     );      If I want to have this change be part of the child-theme so it doesn't get lost, do I:   1. Copy the comments.php folder to the child-theme?   2. paste the above code into the child -theme?    3. paste all of the code in the comment.php folder in the child-theme?   4. so far off base, here's what you need to do...


show number of open comments on custom dashboard

On my custom dashboard, I want to **show the number of total new comments** (somehow like "right now"). Just like "You have ... open comments to take care of". So all I want is the total number not a list for each post or so. But I can't get this right. Any help out there? In the meantime I got some info (from wpmudev) on this, telling me that this is heavy stuff and not a very basic question: > This is less basic than you might think. > > You need to: > >   * Register a new meta box to the WP admin >   * Query the database for the total new comments since the currently logged > in user's last visit >   * Set the visit timeout (so changing page doesn't just set them to 0 right > away, that would be frustrating) >   * Write the CSS to make the display pretty >   * You'll find hints as to what to do if you examine the WordPress core in > the "Right Now" widget but that's probably going to be over your head. > > > At that point, you may as well publish it as a plugin. It's possible and as > far as plugins go, it's barely intermediate, but it's still very advanced > for this forum.* ### UPDATE This is what finally made me happy, thanks again to @toscho. It is showing the number of comments, that are waiting for moderation. It can be placed everywhere you want it to show up.               <?php     function t5_count_new_comments()     {     global $wpdb;          // last user access     $last_access   = get_user_meta( get_current_user_id(), 'last_access', TRUE );          // comment query     $where = $wpdb->prepare( "WHERE comment_date > %s AND comment_approved='0'",   $last_access );     $comment_query = $wpdb->get_results(         "SELECT comment_ID,         COUNT( comment_ID ) AS new_comments         FROM {$wpdb->comments} $where",         OBJECT         );          if ( ! isset ( $comment_query[0]->new_comments ) )         return 0;          return $comment_query[0]->new_comments;          }          $new_comments = t5_count_new_comments();     echo "There are $new_comments new comments.";     ?>


Language placeholders in wordpress?

My site use qtranslate to translate content, now i have a few static words, where can i put and translate this words and how can i get it in my file? For example: English: Product, Italian: Prodotto


How to show widget in frontend?

**I'm sorry about my english. I'm newbie in wordpress. I try to create a small widget for embed video from youtube or others video hosting. Everything is going well in backend (Wordpress adminsitrator). This is the print screen >> http://i.imgur.com/jfedV4R.gif When i publish the widget in my sidebar, the widget does not appear anything. But work fine in my backend. This is my widget code:               <?php           /**      * Today Video Widget Class      *      */          class Today_video extends WP_Widget {              /**          * Widget setup.          */         function Today_video    () {             /* Widget settings. */             $widget_ops = array( 'classname' => 'tm_widget_today_video', 'description' => __('Display today video on your site', 'today_video') );                  /* Widget control settings. */             $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'today_video' );                  /* Create the widget. */             $this->WP_Widget( 'today_video' , __( 'Today Video' , 'today_video' ), $widget_ops, $control_ops );         }              /**          * The frontend function          */         function widget( $args, $instance ) {             extract( $args );                  /* Our variables from the widget settings. */             if(isset($instance))             {                 if( isset( $instance[ 'title' ] ) ) {                     $title =                apply_filters( 'widget_title', $instance[ 'title' ] );                 }                      if( isset( $instance[ 'template' ] ) ) {                     $template =             htmlspecialchars_decode( $instance[ 'template' ] );                 }             }         }         /**          * Backend widget settings          */         function update( $new_instance, $old_instance ) {             $instance = $old_instance;                  /* Strip tags for title and name to remove HTML (important for text inputs). */             $instance['title'] =            strip_tags( $new_instance['title'] );                  // htmlspecialchars to save html markup in database, at frontend we use htmlspecialchars_decode             $instance['template'] =         htmlspecialchars($new_instance['template']);                  return $instance;         }              /**          * Displays the widget settings controls on the widget panel.          *          * Backend widget options form          */         function form( $instance ) {             $defaults = array(                  'title' => __(  'Today Video', 'today_video'),                                  'template' => __('', 'today_video'),                             );                  $instance = wp_parse_args( (array) $instance, $defaults ); ?>
                 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'hybrid'); ?>                 <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:96%;float:right;" />

                 <textarea id="<?php echo $this->get_field_id( 'template' ); ?>" name="<?php echo $this->get_field_name( 'template' ); ?>"  style="width:100%;height:100px;"><?php echo $instance['template']; ?></textarea>
              <?php         }     } //Add function to widgets_init that'll load today_video     add_action( 'widgets_init', create_function( '', 'register_widget( "Today_video" );' ) );     ?>      Can someone help me, Please!


Which jQueryUI handles are predefined in wordpress?

In section 4 of this blog entry jQueryUI is loaded by               wp_enqueue_script('jquery');     wp_enqueue_script('jquery-ui-core');     wp_enqueue_script('jquery-ui-datepicker', $pluginfolder . '/jquery.ui.datepicker.min.js', array('jquery', 'jquery-ui-core') );      The first two lines indicate, that jquery UI handles are predefined. The third line loads the datepicker from a custom file whereas the datepicker seems to be onboard with concurrent Wordpress. Since I don't want to join the cargo cult, how can I load as much jQueryUI as possible from onboard hence avoiding custum overloading?


Using a page template without a page

Does anyone know if it's possible to use a page template on a URL, even if a page doesn't exist for that page? When building sites, I create the relevant pages to ensure use of the templates, but then if the site admins later delete that page, it breaks the site. I'v read that it's possible to add custom URL rewrites, but is there a way to create a custom URL, but use a regular page template to render up the content (using get_header/footer() & other functions within the page)?


How to display posts from specific category using get_option function?

I try to display posts from specific category only in a author page, using get_option function like in the code below but it does not work:               <?php query_posts('cat='.get_option('admin_cat')); ?>      However, if using the id number, works perfect.               <?php query_posts( 'cat=6' ); ?>       How can I use get_option function instead of ID number? Later edit: I apologize, it was my mistake that I wrote in admin option the category name instead of its id. However a code would be helpful to read both variants, like:               if admin option the category is an id     display its id     if in admin option category is a name     display its name      Thanks


Check if current page is wp-admin

I have created a common custom dashboard for my users located at "http://website.com/login/dashboard/" I'm trying to redirect users to that custom dashboard only if they are NOT admins & if the page IS http://www.website.com/login/wp-admin/ The redirection function I have is:               add_action( 'admin_init', 'redirect_so_15396771' );          function redirect_so_15396771()     {            if ( defined( 'DOING_AJAX' ) && DOING_AJAX )               return;              if ( current_page('is_admin()') & !current_user_can('delete_users') ) {                 wp_redirect( site_url( '/login/dashboard/' ) );                 exit();         }     }


Contact Form 7 being hijacked to send spam?

My system emails on my linux server have been getting "message undelivered" emails which appear to be sent from the Contact Form 7 widget I have on my website. The odd thing is, there is no "to:" field in the widget - just "from" and "message". And yet the "undelivered messages" include random to:addresses. I have Akismet set up, and I have tested that it works successfully (I get the spam failure message when I test with their test-spam-email address). Clearly, they are somehow highjacking some sort of php mailer (don't know what contact form 7 uses - built in wp_mail?). How do I stop it? I've contacted my host but they are unable to help me, other than to say "Disable Contact Form 7". Email message below. The bottom bits were bits I added to my contact form in my WordPress installation, which is the only reason I figured out it was coming from my Contact Form 7 widget:               From: Mail Delivery System      To: mysystemusername@constantine.dreamhost.com     Subject: Undelivered Mail Returned to Sender     Date: Sun, 16 Jan 2011 02:13:01 -0800 (PST)     Message-Id:           [-- Attachment #1: Notification --]     [-- Type: text/plain, Encoding: 7bit, Size: 0.6K --]          This is the Postfix program at host pants.dreamhost.com.          I'm sorry to have to inform you that your message could not be     be delivered to one or more recipients. It's attached below.          For further assistance, please send mail to           If you do so, please include this problem report. You can     delete your own text from the attached returned message.                                  The Postfix program          : host e.mx.mail.yahoo.com[67.195.168.230] said: 554         delivery error: dd This user doesn't have a yahoo.com account         (esysdsq3614@yahoo.com) [-5] - mta1038.mail.ac4.yahoo.com (in reply to end         of DATA command)          [-- Attachment #2: Delivery report --]     [-- Type: message/delivery-status, Encoding: 7bit, Size: 0.5K --]          Reporting-MTA: dns; pants.dreamhost.com     X-Postfix-Queue-ID: DBA1514C005     X-Postfix-Sender: rfc822; mysystemusername@constantine.dreamhost.com     Arrival-Date: Sun, 16 Jan 2011 02:12:56 -0800 (PST)          Final-Recipient: rfc822; esysdsq3614@yahoo.com     Action: failed     Status: 5.0.0     Diagnostic-Code: X-Postfix; host e.mx.mail.yahoo.com[67.195.168.230] said: 554         delivery error: dd This user doesn't have a yahoo.com account         (esysdsq3614@yahoo.com) [-5] - mta1038.mail.ac4.yahoo.com (in reply to end         of DATA command)          [-- Attachment #3: Undelivered Message --]     [-- Type: message/rfc822, Encoding: 8bit, Size: 1.5K --]          From: floppyk2011      To: esysdsq3614@yahoo.com     Subject: [Out In Africa]     Date: Sun, 16 Jan 2011 10:12:57 +0000     Message-ID:      X-Mailer: PHPMailer (phpmailer.sourceforge.net) [version 2.0.4]          Message body:     �èñòåìà àêòèâíîé ðåêëàìû.  �àðàáîòàòü â ñåòè. �ïëàòà çà ÷òåíèå ïèñåì è êëèêè. �àñêðóòêà ñàéòîâ - óâåëè÷åíèå ïîñåùàåìîñòè, íèçêèå öåíû äëÿ ðåêëàìîäàòåëåé!he system of active advertising. Earn online. Payment     +for reading emails and clicks. Site promotion - increase attendance, lower prices for advertisers!ôëóïèê.ðô          --     This mail is sent via contact form on Out In Africa (www.oia.co.za), from IP address: 80.58.205.99


How to fix/improve this 'bad coded' function that sort posts by votes (for the Vote it Up plugin)?

The following is a tutorial to Sort Posts by Vote (for the Vote it Up plugin): I haven't found it anywhere so i put it here. This is a new function which add posibilities to sort post on index page by vote. Add this in **votingfunctions.php** :               function ShowPostByVotes() {         global $wpdb, $voteiu_databasetable;              mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die(mysql_error());         mysql_select_db(DB_NAME) or die(mysql_error());         //Set a limit to reduce time taken for script to run         $upperlimit = get_option('voteiu_limit');         if ($upperlimit == '') {             $upperlimit = 100;         }         $lowerlimit = 0;              $votesarray = array();             $querystr = "                 SELECT *                 FROM $wpdb->posts                 WHERE post_status = 'publish'                 AND post_type = 'post'                 ORDER BY post_date DESC              ";             $pageposts = $wpdb->get_results($querystr, OBJECT);         //Use wordpress posts table         //For posts to be available for vote editing, they must be published posts.         mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die(mysql_error());         mysql_select_db(DB_NAME) or die(mysql_error());         //Sorts by date instead of ID for more accurate representation         $posttablecontents = mysql_query("SELECT ID FROM ".$wpdb->prefix."posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT ".$lowerlimit.", ".$upperlimit."") or die(mysql_error());              $returnarray = array();         while ($row = mysql_fetch_array($posttablecontents)) {             $post_id = $row['ID'];             $vote_array = GetVotes($post_id, "array");             array_push($votesarray, array(GetVotes($post_id)));         }         array_multisort($votesarray, SORT_DESC, $pageposts);         $output = $pageposts;         return $output;          }      and in your **index.php** page add:               <?php          $pageposts = ShowPostByVotes();          ?>      <?php if ($pageposts): ?>       <?php foreach ($pageposts as $post): ?>         <?php setup_postdata($post); ?>      Attention! Code above is something like:               <?php if (have_posts()) : ?>                  <?php while (have_posts()) : the_post(); ?>      so in foreach loop you can use statements like in standard "The Loop" for example the_content, the_time(). To end this add:                 <?php else : ?>
Not Found

Sorry, but you are looking for something that isn't here.
         <?php include (TEMPLATEPATH . "/searchform.php"); ?>      <?php endif; ?>      The guy who wrote the code went directly to the MySQL, so this code may break in future Worpdress releases. How to make this code to follow better Wordpress practices? **EDIT:** GetVotes function:               //Returns the vote count     function GetVotes($post_ID, $percent = false) {         global $wpdb;              //prevents SQL injection         $p_ID = $wpdb->escape($post_ID);              //Create entries if not existant         SetPost($p_ID);              //Gets the votes         $votes_raw = $wpdb->get_var("SELECT votes FROM  ".$wpdb->prefix."votes WHERE post='".$p_ID."'");         $sinks_raw = $wpdb->get_var("SELECT usersinks FROM  ".$wpdb->prefix."votes WHERE post='".$p_ID."'");         $guestvotes_raw = $wpdb->get_var("SELECT guests FROM  ".$wpdb->prefix."votes WHERE post='".$p_ID."'");         $guestsinks_raw = $wpdb->get_var("SELECT guestsinks FROM  ".$wpdb->prefix."votes WHERE post='".$p_ID."'");     /* Deprecated         $uservotes_raw = $wpdb->get_var("SELECT votes FROM ".$wpdb->prefix."votes_users WHERE user='".$u_ID."'");         $usersinks_raw = $wpdb->get_var("SELECT sinks FROM ".$wpdb->prefix."votes_users WHERE user='".$u_ID."'");     */              //Put it in array form         $votes = explode(",", $votes_raw);         $sinks = explode(",", $sinks_raw);         $guestvotes = explode(",", $guestvotes_raw);         $guestsinks = explode(",", $guestsinks_raw);     /* Deprecated         $uservotes = explode(",", $uservotes_raw);         $usersinks = explode(",", $usersinks_raw);     */         $uservotes = 0;         $usersinks = 0;              $initial = 0; //Initial no. of votes [will be placed at -1 when all posts receive votes]                        //The mathematics         if ($percent == true) {             // make $votecount into a percent             $totalcount = count($votes) + count($sinks) + count($guestvotes) + count($guestsinks) + count($uservotes) + count($usersinks) + get_option('voteiu_initialoffset') - 6;             // the -6 is because count('') returns 1, so if there is no votes at all, 1 is returned.  -6 offsets that             $forcount = count($votes) + count($guestvotes) + count($uservotes) + get_option('voteiu_initialoffset') - 3;             $againstcount = count($sinks) + count($guestsinks) + count($usersinks) - 3;             if ($totalcount > 0) {                 $votecount = number_format(100*($forcount / $totalcount), 0) . "%";             } else {                 return false;             }             return $votecount;             // uncomment this line below if you want to test             //return count($votes) . " " . count($sinks) . " " . count($guestvotes) . " " . count($guestsinks) . " " . count($uservotes) . " " . count($usersinks) . " " . get_option('voteiu_initialoffset') . " " . $p_ID;         } else {             // wihtout percent mode, $votecount is number of total positive votes (votes minus sinks)             $votecount = count($votes) - count($sinks) + count($guestvotes) - count($guestsinks) + count($uservotes) - count($usersinks) + $initial;             return $votecount + get_option('voteiu_initialoffset');         }     }          function GetPostVotes($post_ID) {         global $wpdb;              //prevents SQL injection         $p_ID = $wpdb->escape($post_ID);              //Create entries if not existant         SetPost($p_ID);              //Gets the votes         $votes_raw = $wpdb->get_var("SELECT votes FROM  ".$wpdb->prefix."votes WHERE post='".$p_ID."'");              //Put it in array form         $votes = explode(",", $votes_raw);         return $votes + get_option('voteiu_initialoffset');     }


WordPress multisite installation broke menu links

I am using the Thesis theme with my WordPress multisite installation. I also changed the permalink settings from the Super Admin settings to remove **/blog/** from the path. But now my menu links are broken. The permalink structure now is **/%postname%/** and my pages have the links mydomain.com/about/, mydomain.com/contact/ etc. When I try and navigate to these pages, it gives me a 404 error. Can someone please help me out on how to resolve this issue? Thanks. **Some additional info** I checked the error logs and don't understand why the following log statements show up when I try to access the pages (if this helps in resolving the issue)               [Thu Mar 10 12:29:18 2011] [error] [client xxx.xxx.71.55] File does not exist: /var/www/html/about, referer: http://mydomain.com/     [Thu Mar 10 12:32:44 2011] [error] [client xxx.xxx.71.55] File does not exist: /var/www/html/contact, referer: http://mydomain.com/      Shouldn't it be looking for the files in the wp-content/themes/thesis folder? **ADDITIONAL INFO** The content of the .htaccess is here (is the same as that in Network Settings)               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]     RewriteRule . index.php [L]      Also, I am using the steps here for using Thesis with multisite installation


Best portfolio/gallery/carousel slideshow plugin with thickbox?

I'm creating a web portfolio, and would like somethnig with carousel and thickbox/lightbox fuctionality? Basically, I'd like something to show a certain part of the image in a slideshow carousel, and when you click on it, it'll show the full image in like a lightbox, with a description (the title?) below. I've tried 10+ plugins now and had no joy, apart from a few paid ones which I'd rather avoid if possible Cheers.


Why can't I edit certain images from the WordPress Media library?

I've noticed some bizarre behaviour in my WordPress installation. For some photos, when I click "Edit Image", the full image is not displayed to me - just the area visible in the thumbnail. And yet, if you click "View Image", you can see the full image is actually there. ![Clearly needs some fixing](http://i.stack.imgur.com/kAjHR.jpg) Clearly, some manual intervention is required for this pic's thumbnail. ![Edit Image shows same weird crop](http://i.stack.imgur.com/5ZLDq.jpg) Click on edit image, only to find the whole image is not presented to me for cropping/editing. Has the image been cropped on upload, maybe? ![The whole image is there](http://i.stack.imgur.com/yOdeQ.jpg) View attachment shows that no, the whole image is actually there - its just not available to me in the image editor. What's going on? This is only an issue for certain photos, and I can't see any difference between them - they are all JPGs, and there is no weird EXIF data that I can see... and yet some photos I can crop, and others not...


Is there a plugin to turn comments into structured reviews

I am looking for a plugin that adds a star rating to a comment, transforming the comment into a user review. Here is an example. I have bought this theme but it is a theme, not a plugin and really limits the use case of wordpress. I have also looked at GD Star Rating, but it is designed to let user review comments and posts, what I am looking for is turning comments into reviews, where the review include both some text and a rating. IE. The comment is a review of a product (Amazon style) not the comment can be reviewed by readers (GD Star Rating style). Is it possible to do this? * * * Update: the review-it theme which is using GD star is really close to what I want, but it doesn't show the reviews with the comments, it only shows the aggregate of the user reviews. Example here: http://botchweed.com/review/call- of-duty-modern-warfare-3-review/ * * * Upage: It turns out that review-it theme does support this, but only if you have one set of reviews. They have an option on the review page called "Show user reviews" or something liek that. You can see it here:


Custom Post Type with metaboxes (no content) only?

I have a Custom Post Type called "cities". Each city has: Name, Population, Coordinates and so forth. I don't want users to be able to add their custom content there (using wp-content editor, HTML or the Visual one). What's the best approach to this? Should I hide the text editor in CSS and then place (around 30) metaboxes on each page? Would 30 metaboxes hit theme's performance hard compared to normal posts? I'm aiming for tens of thousands of posts, 30 metaboxes each. Any hints?


Problems with creating hook that updates XML

I have been working on a plugin for Wordpress, that updates an XML file with elements from the post. I have used a third party plugin to create the field for the XML, and so far that is working. I am having a lot of trouble with the XML and the hook itself. I am using a DomDocument example from php4every1.com, and that works whenever I run it seperately in a php-file. However, if I include it within a function, that is hooked to the publishing of a post in wordpress, I get the following error: "The plugin generated 1 characters of unexpected output during activation. If you notice “ _headers already sent_ ” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin." and nothing more happens. The function including the XML will not run at all, and I have no idea why. Here is my code:               <?php          add_action('publish_post','update_xml');          function update_xml(){            $xml = new DOMDocument('1.0', 'utf-8');        $xml->formatOutput = true;        $xml->preserveWhiteSpace = false;        $xml->load('fruits.xml');            //Get item Element        $element = $xml->getElementsByTagName('item')->item(0);            //Load child elements        $name = $element->getElementsByTagName('name')->item(0);        $price = $element->getElementsByTagName('price')->item(0);        $count = $element->getElementsByTagName('count')->item(0);            //Change values        $name->nodeValue = 'Orange';        $price->nodeValue = 14.33;            //Create new element        $newCount = $xml->createElement('count', 10);            //Replace old elements with new        $element->replaceChild($name, $name);        $element->replaceChild($price, $price);        $element->replaceChild($newCount, $count);            //Create one new item element        $newItem = $xml->createElement('item');        $newItem->appendChild($xml->createElement('name', 'hest'));        $newItem->appendChild($xml->createElement('price', 10.59));        $newItem->appendChild($xml->createElement('count', 131));            //Add it to fruits element        $xml->getElementsByTagName('fruits')->item(0)->appendChild($newItem);        $xml->save('fruits.xml');          }          ?>      and the xml file:               <?xml version="1.0" encoding="UTF-8"?> <fruits>          <item>         <name>Apple</name>         <price>10.25</price>         <count>15</count>     </item>          </fruits>      As I said, the above works whenever I am running it in a seperate php-file without the hook and the function, but inside the hook in the plugin, it breaks. I am pretty new at programming, php and wordpress, so I bet I am overlooking something silly, but what? Thanks in advance. Edit: I get this error when activating the plugin: "The plugin generated 1 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin."


Best Wordpress Slider Plugin for HTML and Images

I want a simple to use slider for the home page of the website I have played around with a bunch of plugins and nothing was really suiting my needs or easy to deal with. I would rather not spend the time to build my own. Here are the requirements I need   1. Allows More than one slider with different image sizes(sized to background image)   2. Must be able to handle html and images so it can be linkable to posts Basically I want the slider to take all the posts marked in a certain category say "featured" then display the title and featured image on the home page. Any Suggestions. I can get the info I need already through the query function. If I must build my own this is the format I would like the code to be in

          Title          Featured Image
        ......        ......

1
        .......

      If No plugin can make multiple versions of something like this can any provide some javascript to create a slider out of this Thank you


How do I allow users to supply a photo/image to be used instead of the grey/white silhouette?

I am sure I am missing something very straightforward, but there seems to be no way for me to upload a photo for my profile or for a user profile the will be used in place of the placeholder white on grey silhouette that my theme displays. I did Google for this, and I seem to get a bewildering array of possible plugins, but I would have thought that there was an easier way of doing this? If I must install a plugin, what is the best one? (I realize that is a difficult question, but even getting it down to a shortlist would be nice!) I am using Wordpress version 3.1.2 with the Twenty Ten theme version 1.2 I have the following plugins active: Google Analytics for WordPress version 4.1 SyntaxHighlighter version 3.1.1 Thank you in advance.


How can i create a newsletter for my wp blog?

I own a blog and finally wants that my users should be able to get a weekly newsletter on the blog. Basically I am a new user of wordpress and not sure how i can do that. I got some material on internet how can i create a weekly newsletter but all are paid services and right now I wont be able to afford them. Can anyone help me out???


How to get the theme index.php listed in appearance editor

When viewing my theme files via "Appearance > Editor", the index.php file that's listed there is an index.php that's inside a subfolder of my theme directory, not the main index.php file that resides in the root of my theme folder. How can I tell WP to list my theme's index.php there?


Automating the Backup Process (30+ websites)

I run an increasing number of WordPress sites, as well as several for clients - and logging in to perform upgrades is becoming tiresome. I'm looking for a means of automating the process, preferably from a single command line script - and upgrading all the sites in one fell swoop. My ideal would be to hook into the very good automatic backup that's built into WordPress, and trigger it from the server for all 30 sites. That would cover file updating and then the database. All the websites I have backup every 24 hours so backing up before the upgrade starts isn't a priority (but you can never have too many backups!) however, a means to determine whether a site has broken would be another interesting feature. Assuming that I can't hook directly into the built in backup, I found this which more or less operates in the way I was thinking, but doesn't perform the database upgrades. I understand that this could potentially leave the website vulnerable until an administrator logs in and performs the update (which could be up to 72 hours). I'm also familiar with the concept of using SVN and GIT to perform the updates, but if I were to move down this route I need to find a reliable way of ensuring that a) /wp-content files aren't damaged and b) file permissions for the whole site are conserved (if the script is run as the root user).


Fast publishing in wordpress

Wodpress editor is too slow. How to create other faster interface or how to fast publish posts. I just need fileds for author, category and subtitle. Is there any way instead of default wordpress editor ?


Change get_current_user_id code to the author's profile

I've been modifying a long abandoned plugin project that provides a Stackoverflow inspired badge system for Wordpress. I have upgraded some of its code so it functions with the new Wordpress version. You can view the entire code here if you are interested: http://pastebin.com/kCWWLPL2 I want to add a code to the author.php page to list the author's awarded badges. So far, I have only managed to display the logged in user's badges with this working code:               <?php     $user_id = get_current_user_id();     if ($user_id != 0) {       rhb_list_badges(array('user_ID' => $user_id));     }     ?>      I was told to use this code to display the author's badges:               <?php     $author = get_user_by( 'slug', get_query_var( 'author_name' ) );      if ($author->ID > 0) {       rhb_list_badges(array('user_ID' => $author->ID));     }     ?>      But it does not return anything on the page. Why? What am I doing wrong here? How can I alter the working get_current_user_id code example so that it will **display the author's badges and not the logged in user's one**?


Is dynamic URL possible in Wordpress

I know the title seems little bit confusing, but what I am looking for is something possible in symfony or ror. I have a page with this URL: `http://mydomain.com/job/`. Now I want this URL structure `http://mydomain.com/job/php-developer/45`, `http://mydomain.com/job/java- developer/46`. Now the parameters after `/job/` are dynamic, and they are not any page or post, they fall under a page `job` Is this possible in Wordpress? **UPDATED QUESTION:** Ok as per @Gioia's answer I updated my code. Below is my code:               add_filter('query_vars', 'add_query_vars');     function add_query_vars($aVars) {         $aVars[] = "job_title";          $aVars[] = "job_id";          return $aVars;     }          add_action( 'init', 'add_rules' );       function add_rules() {         add_rewrite_rule('^/job/([^/]*)/([^/]*)/?','index.php?page_id=13338&job_title=$matches[1]&job_id=$matches[2]','top');     }      So now this is throwing me 404 page when I try this URL `http://mydomain.com/job/php-dev/45`. But when I try this URL `http://mydomain.com/index.php?page_id=13338&job_title=php-dev&job_id=45` it works.


which is the best way to customize nav-menu-template.php?

I have modified the function `start_el` in `nav-menu-template.php` substituting `$item->ID` with `$item->title` so that the html `li` elements in menu have a more readable class names. In detail, I have changed the line               $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );      to               $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->title, $item, $args );      This makes the editing of the `style.css` file for a theme easier. I wonder if it is possible to "transfer" the change from `nav-menu-template.php` to the theme (maybe `functions.php`?), so that I will not be forced to modify the file every time I upgrade WP version.


Removing side bar widgets from GovPress theme

![enter image description here](http://i.stack.imgur.com/mBTkh.jpg) I'm using the GovPress theme, I've created a child theme. I now want to remove the sidebar widgets, as they are no use to me. I've read multiple articles online, but none of them work. I believe I need to create a functions.php in my child theme, but what needs to go into this file?


When importing a database any page with a wp_query in doesn't work

I've noticed this a lot, when I export a database from a test site and import it into a live site, any (or most) page with a wp_query in it doesn't show up correctly (It shows the theme, but as though I'm viewing a page with no content in) But if I create another page, using the same template as the one with the wp_query in it works just fine (As long as I don't give it the same slug). It also works correctly if I simply rename the page slug Does anyone know why this might be? This is a sample wp_query that I use;               <?php         $args = array(             'post_type' => 'offers',             'posts_per_page' => -1,             'order' => 'asc'         );         $offer_query = new WP_Query( $args );         while ( $offer_query->have_posts() ) : $offer_query->the_post();     ?>              <!-- SOME FANCY CONTENT HERE -->          <?php endif; wp_reset_postdata();?>


User registration add user ID?

I have created a custom user registration template for my WP website, based on this code: http://www.tutorialstag.com/create-custom-wordpress-registration- page.html. Now I was wondering if it is possible to add the user ID to the username. The reason I want this is that when a user registers, the (new) user is never a duplicate. So when a new user has the same username as an already registered user, no errors are shown, but the new user is created normally by adding the user ID / or maybe some other random number? Anyone who can help me further? Thanks.


Multiple Wordpress Pages

Not sure how to approach this one. I have a wordpress page that uses a mysql query to grab info from a database based on the page title. I basically want to replicate that page to 50 or so different pages all with different titles but the same page code. What would be the best option for doing something like this?


How to have multiple archive pages?

I am building a site that needs pages such as News, Events, Projects and People. My question is, how should I achieve this in WordPress? Do I use custom post types? And if so, how do I have a page for each?


How to remove title (home) from static page skeleton template

I am trying to remove the page title (home) from my index page. I made my home page my static page. I am using the skeleton theme https://github.com/simplethemes/skeleton_wp I'm new to wordpress so I hope I'm explaining this right.


How can i display 3 post types in same page?

How can i display 3 post types in same page search results. http://cinema.trancelevel.com/ For example i have post_type1-Movies post_type2-Trailers post_type3-Subtitrari Wen i search i want to display the search results.. Ex: i Search for Battleship Movie. I want the search results to display somting like this 1.)The movie: Battleship 2.)The Trailers: - Battleship HD - Battleship Trailer Oficial 3.)The News All the news that contain the word Battleship. Or.. how can i display for each post_type diferent themplate... EX: For Movies it show fine: -http://cinema.trancelevel.com/?s=Battleship&post_type=post For Trailers it show the teme of movies: -http://cinema.trancelevel.com/?s=Battleship&post_type=trailers Wath i use in Search               <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">     <input class="search_input" type="text" name="s" id="s" value="Cauta filme, subtitrari, trailere, stiri" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;"/>         <select name="post_type" class="search_select">             <option value="post">Alege:</option>             <option value="post">Filme</option>             <option value="persoane">Actori</option>             <option value="trailers">Trailere</option>         </select>         <input type="submit" id="searchsubmit" class="search_buton" value="Cauta" />     </form>


Best way to handle a form post in plugin

I'm doing a plugin that needs to be able to post data to a third party API. Users will fill out a form and press submit. The form itself - would it be "correct" to simply append html to a page content with a the_content() filter? I'm adding the form based on a bunch of settings saves as meta for each page or post. I'd like to avoid tampering with templates... With other words; if some meta is set for the page - append some html (the form that users will input data to). Also - when users press "submit" in that form - how should I handle the request? Right now I'm thinking that I will load wordpress in a totally separate php-file (in order to get my hand on all those funky wp-functions and constants) - but that feels kind of wrong... Is there a build-in way to both display the form and then handle the request? Thank you very much!


Style wp_list_categories

I think this is a fairly simple question and im sorry if it is but how would I add a `<div>` to each individual category within this code:                   <?php     $taxonomy = 'category';     // get the term IDs assigned to post.     $post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );     // separator between links     $separator = ',';          if ( !empty( $post_terms ) && !is_wp_error( $post_terms ) ) {              $term_ids = implode( ',' , $post_terms );         $terms = wp_list_categories( 'title_li=&style=none&echo=0&taxonomy=' . $taxonomy . '&include=' . $term_ids );         $terms = rtrim( trim( str_replace( '<br />',  $separator, $terms ) ), $separator );              // display post categories         echo  $terms;     }        ?>      I want to add `<div class="btn-standard">` to each category. Please note that I only want to display the categories relavent to the post.


Thickbox hacking - removing fields

## Default (big and ugly) Thickbox I don't like how this Thickbox's page looks at all, I almost never use all these settings fields so decided to get rid off them, at least on pages where I'm uploading images as theme options. ![enter image description here](http://i.stack.imgur.com/rREMu.png) ## A (very) simple Thickbox Using attachment_fields_to_edit & media_upload_tabs filters I made it look much simpler: ![enter image description here](http://i.stack.imgur.com/UV6c5.png) If you're wondering how to do that (these filters/hooks are poorly explained), here's the code:               function thickbox_fields($form_fields, $post){         unset(            $form_fields['post_title'], //disables "Title" field and so forth...            $form_fields['url'] );            $form_fields['image_alt'],             $form_fields['post_excerpt'],             $form_fields['post_content'],             $form_fields['align'],             $form_fields['image-size'],          );              return $form_fields;     }          function thickbox_upload_init(){         add_filter('attachment_fields_to_edit', 'thickbox_fields', 10, 2);     }          add_action('admin_init', 'thickbox_upload_init');      ## The trouble Unfortunately after deleting image-size and url fields I'm not sure how to overwrite its values with desired content (in this case the url and image-size set to "full", always). I'm uploading things based on this simple yet powerful tutorial using this code on admin page:               jQuery(document).ready(function() {          jQuery('#upload_image_button').click(function() {      formfield = jQuery('#upload_image').attr('name');      tb_show('', 'media-upload.php?type=image&TB_iframe=true');      return false;     });          window.send_to_editor = function(html) {      imgurl = jQuery('img',html).attr('src'); //imgurl is always empty after deleting url field      jQuery('#upload_image').val(imgurl);      tb_remove();     }          });      And as comment states `imgurl = jQuery('img',html).attr('src')` is just empty, in addtion when I disable just image-size and leave url alone - its size is always set to "medium", any ideas how to fix that? I was trying to pass URL and image-size like this:                function thickbox_fields($form_fields, $post){             unset(                $form_fields['post_title'], //disables "Title" field and so forth...                $form_fields['url'] );                $form_fields['image_alt'],                 $form_fields['post_excerpt'],                 $form_fields['post_content'],                 $form_fields['align'],                 $form_fields['image-size'],              );                  $form_fields['url'] = 'not sure how to get the url here, but this doesnt work anyways';             $form_fields['image-size'] = 'full'; //yup, this also doesn't work at all                  return $form_fields;         }      I know these fields are arrays, but `$form_fields['image-size'] = array('size' => 'full')`, doesn't work either. Any hints? **TL;DR** - how to hide url and image-size fields from Thickbox and then send value of url field's to front-end? Also, how to force Thickbox to upload files as "full", because with image-size unset it returns links to medium-sized uploads all the time. I guess image_size_input_fields filter could be helpful.


Why does WP load so many files in the head of source code? How do I optimize it?

I have noticed that wordpress loads a bunch of files into the head of a site. This looks really sloppy and discloses vital information about the file structure of a website. Depending how many plugins are installed a site can easily have 10+ `<link>` and `<script>` tags. I understand how these files may work together, but it _does_ look excessive and unorganized. That said, is there a way to optimize this and somehow combine certain files to reduce the number of files loaded? There are benefits that can be gained from this, such as improved performance and security. If anyone has any suggestions please let me know.


Dynamically Populating Image/Excerpt/LInks from Pages in WordPress

I am after some guidance with the following HTML to WordPress conversion. Based on the linked image (see HTML Divs screen image), which has the following three divs, which will be individual pages within my WordPress site, after conversion, i.e.: see:> html Divs               1) Solar Pool Heating     2) Domestic Hot Water &     3) Solar Electric      Can somebody please let me know how through the use of the WordPress loop and built in functions, I can obtain the image for each div from the main page as well as an excerpt of the page content for each of the divs together with the "Read More" which would then take me to the actual page to read all of the page? I'm not sure if this is possible but I have always wanted to know how this can be done as this would assist my understanding of this area. Hopefully someone can assist. Thanks.


How to use the thumbnail size with catch_that_image

Im using `catch_that_image()` to grab the first image of posts and use that as a thumb in a loop but the thumb is only 40px/40px and the image has to be scaled dramatically so I'd like to figure out how to use the thumbnail size image that gets stored to reduce scale size. Here's the function.               function catch_that_image() {     global $post, $posts;     $first_img = '';     ob_start();     ob_end_clean();     $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content,   $matches);     $first_img = $matches [1] [0];          return $first_img;     }


How to debug 'Notice: Undefined index' on a Request['action']

I use the next code in order to save the options of my theme (by using the Wp Settings API), but when I debug it, I get the **'Notice: Undefined index: action'** error/notification. In order to fix it, I added "isset()" before the first $_REQUEST. Now the notification is not apperaring, but the options are not saved when I click the 'SAVE' button. What I'm doing wrong? How can I fix it? Thank you in advance.               function mytheme_add_admin() {     global $themename, $options;     if ( isset( $_GET['page'] ) && $_GET['page'] === basename(__FILE__) ) {         if(isset( $_REQUEST["action"] ) && $_REQUEST["action"] === 'save') {                 foreach ($options as $value) {                     update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }                 foreach ($options as $value) {                     if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ]  ); } else { delete_option( $value['id'] ); } }                 header("Location: themes.php?page=theme-options.php&saved=true");                 die;         } else if(isset( $_REQUEST["action"] ) && $_REQUEST["action"] === 'reset') {             foreach ($options as $value) {                 delete_option( $value['id'] ); }             header("Location: themes.php?page=theme-options.php&reset=true");             die;         }     }     add_theme_page($themename." Options", "".$themename." Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');     }


querying a custom field

I'm trying to hack a plugin to show the contents of a custom field where its currently showing the title. how would I get this to show a custom field called restaurants instead? Thanks,                           $pois = $map->pois;                 foreach ($pois as $poi) {                     if ($marker_title == 'post')                         $poi->title = $query_post->post_title;


Strip Twitter Username from Profile Field with URL and Save to New Profile Field

Let me start by saying, I am not a coder, but enjoy learning. Here is the situation. I have many custom profile fields for social media added to my user profiles. The user enters the full URL of their profile, then their information is displayed on their author page with their bio, profile image, all posts, etc. I also want to use ONLY the Twitter username so that when a user makes a post, the post will be automatically tweeted with their username using YOURLS: WordPress to Twitter plugin. This is a feature of YOURLS and I have no issue setting it up. I do not want to ask the user to enter their username in a separate field and I do not want to go in and manually edit each user. As well, I do now want this field to be visible to the user. From experience, I have found that many people are unclear as to their actual Twitter username. A lot of times they enter @Username or #Username or their complete profile URL or their profile URL without http:// instead of simply, Username. This is the main reason I changed the profile fields to require the full URL instead of simply the username. Ok, that's what I want. Here is what I believe I need and have done:   1. Create the custom field for user to enter their Twitter profile URL   2. Create the custom field to place the Twitter username once it has been stripped from URL   3. Strip the URL (using regex, I imagine)    4. Add the stripped username to the new field    5. Hide the field from the user   6. Add new field to YOURLS tweet template 1 - The custom profile fields were were created using (also removed other fields):               // Contact Info fields in profile     add_filter('user_contactmethods','new_contactmethods',10,1);     function new_contactmethods( $contactmethods ) {     $contactmethods['twitter'] = 'Twitter (Full URL)';     $contactmethods['facebook'] = 'Facebook (Full URL)';     $contactmethods['googleplus'] = 'Google+ (Full URL)';     $contactmethods['linkedin'] = 'LinkedIn (Full URL)';     $contactmethods['delicious'] = 'Delicious (Full URL)';     $contactmethods['flickr'] = 'Flickr (Full URL)';     $contactmethods['picasa'] = 'Picasa (Full URL)';     $contactmethods['Vimeo'] = 'Vimeo (Full URL)';     $contactmethods['youtube'] = 'YouTube (Full URL)';     $contactmethods['reddit'] = 'Reddit (Full URL)';        unset($contactmethods['yim']); // Remove YIM        unset($contactmethods['aim']); // Remove AIM        unset($contactmethods['jabber']); // Remove Jabber        unset($contactmethods['msn']); //Remove Messenger             return $contactmethods;     }      2 - The new custom field was created using:               add_action( 'show_user_profile', 'my_show_extra_profile_fields' );     add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );          function my_show_extra_profile_fields( $user ) { ?>

                 Twitter Username	                                  <input type="text" name="twitter_username" id="twitter_username" value="<?php echo esc_attr( get_the_author_meta( 'twitter_username', $user->ID ) ); ?>" class="regular-text" />

     <?php }      3 - Strip the Twitter username from the Twitter URL. This is where I have no idea what I am doing. I found this thread, but I am unfamiliar with regex. Regex - Extract Twitter Username from URL 4 - As well, once getting the Twitter username, I do not know how to add it to a separate field. I suppose this would also need to update whenever the Twitter URL field is changed as well... 5 - And I have used the following method to hide the field from all users who are not Admins (I have also hidden the entire "Personal Options" section)               //Hide Profile Page Options from all except Administrator     if (!current_user_can('administrator')){     function hide_profile_page_options() {     global $user;     $hide_profile_options = "";     print($hide_profile_options);     }     add_action( 'admin_head', 'hide_profile_page_options'  );     }       6 - twitter_username has been added to the YOURLS tweet template I hope everything is clear. If not, let me know and I will try to go more in- depth.


Displaying a full post instead of a slug per category?

I have a single category on my blog that I want to display full posts in when looking at the category instead of just slugs. The category is for Podcasts, and presently it displays slugs which:   * Do not display links to mp3 files   * Do not display the Google Reader Media Player I'm using Wordpress 3.0.4 with the Hybrid News theme.


How do I query multiple specific posts from a custom taxonomy?

WordPress 3.2.1. I want to query several specific posts that are part of a custom taxonomy. This is what my query looks like for retrieving one post, using the id for that post.               $args = array(         'post_type'=> 'portfolio',         'skill-type'    => 'the-letter-d, food, kids-meal',         'p' => 56     );     query_posts( $args );      This works for just getting one post, but I'm looking to get multiple posts. I've tried using 'post_in' => array(56,40,7...etc) in place of 'p'=> 56 and it didn't work. I'm assuming that doesn't work with custom post taxonomies or else I am just doing it wrong? I've also tried using the following, removing the terms list since it's not really needed.               $args = array(         'post_type'=> 'portfolio',         'post_in' => array(56,40,7)     );     query_posts( $args );


Change permalinks on move from one site to another

I'm in the finishing stages of moving a site from Wordpress.com to a privately hosted .org installation. I've purchased the site-redirect upgrade and this is working fine, however on the new installation I have (and would _like_ to have) a different permalink structure to the one offered on .com. I need to find a way to redirect on the new site, from the old permalink structure to the new (/%postname%-%post_id%.html). To make things more difficult, I'm running on IIS6 (sorry) and using the Helicon ISAPI_Rewrite plugin to use .htaccess - which has a different syntax to mod_rewrite. Docs are here: http://www.helicontech.com/isapi_rewrite/doc/ Can anyone help?


Category 'pad_counts' &  'parent' conflict

Below is the current loop I have setup:                   <?php             //start products category loop             $args = array(                 'hide_empty'  => 0,                   'parent'      => 0,                 'orderby'     => 'name',                 'order'       => 'ASC',                 'taxonomy'    => 'profile_categories',                 'pad_counts'  => 1             );                  $categories = get_categories($args);             foreach($categories as $category) { ?>                 <?php                  // setup the category ID                 $cat_id = $category->term_id;                 // Get category name                 $cat_name = $category->name;                 // Get category count                 $cat_count = $category->count;                      //get the category url                 $cat_url = get_term_link( $category->slug, 'profile_categories' );                      echo "
";                 echo $cat_name;                 $subcat_args = array(                     'hide_empty'  => 0,                       'orderby'     => 'name',                     'child_of'    => $cat_id,                     'order'       => 'ASC',                     'taxonomy'    => 'profile_categories',                     'pad_counts'  => 1                 );                 $subcategories = get_categories($subcat_args);                 $subcat_count = count($subcategories);                 if ($subcat_count > 0) { echo ' ('.$subcat_count.' Subcategories)'; }                 echo "
";                      echo '';                 echo __('View all','roots');                 echo "";                      // Get posts belonging to current category                 $post_args = array(                     'posts_per_page' => 4,                     'post_type' => 'moulding_profiles',                     'tax_query' => array(                         array(                             'taxonomy' => 'profile_categories',                             'field' => 'id',                             'parent' => 0,                             'terms' => $cat_id                         )                     )                 );                 $posts_query = new WP_Query($post_args);                 if ($posts_query->have_posts() ) {                     echo '
';                         while ($posts_query->have_posts()) : $posts_query->the_post(); ?>
<a href="<?php the_permalink();?>"><?php the_title(); ?> -> Width: <?php the_field('mp_profile_dimensions_width',get_the_ID()); ?> Height: <?php the_field('mp_profile_dimensions_height',get_the_ID()); ?>
                         <?php endwhile;                      echo '
';                 } // done our wordpress loop. Will start again for each category                 wp_reset_query(); // reset the query ?>             <?php } // done the foreach statement ?>      What this does is list categories within a taxonomy called `profile_categories`, and then lists `4` items that are within each category. The category argument is using `parent => 0` so that only top-level categories are shown. What I'd like to do is also use `pad_counts => 1` to grab the count of not only the category, but all subcategories within that. So - if I'm thinking of this correctly, `parents` conflicts with `pad_counts`. I've looked through the codex about this and am stuck in the mud on if this is even possible - or if I'm that clueless and am missing something obvious. Any help would be greatly appreciated. Thanks! **Update** : Using http://codex.wordpress.org/Function_Reference/get_categories as a reference, when `parent` is set to `0` (to only show top-level categories), the `$category->count` and `$category->category_count` does not include the count of the sub-categories - still thinking this is a bug unless someone knows of a workaround.


How to load WP functions?

I have a `mymail.php` script which sends a email (I managed to do it using `require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/class-phpmailer.php' );`.) and outputs a plain text string (Such as "Email is sent successfully.") I want to use the functions defined in WP in this my script. The particular function I want to call is `get_option()` in order to retrieve the email user of the site owner. Which file to import for the particular `get_option()` function and which to import the entire WP core (like the context available for theme's .php files?


URL rewrite( I think? )

I have a URL: www.example.com/my_cool_pancakes. When a User goes to this URL, I would like the URL to instead be www.example.com/pancakes. How do I do this? Is this URL rewriting? I have studied URL rewriting, but I am still not sure about how it works, or even if it is the method I should use to do this. If it is, could you show me how? Thank you :) PS: www.example.com/my_cool_pancakes is an archive page template for a custom post type if that makes any difference.


Display Taxonomy Terms in an option tag with value being the slug

I have a custom taxonomy filled with terms that I wish to display in a fashion such as below.               <option value="[SLUG]">[TERM]</option>     <option value="[SLUG]">[TERM]</option>     <option value="[SLUG]">[TERM]</option>     ...      I have attempted to use "wp_dropdown_categories" but I was unable to find a way to change the value="[TERM_ID]" to value="[SLUG]" I also tried to use "wp_list_categories" and have it display with out the li's hoping there was a tag like "wp_nav_menu" has with 'before'=>'','after'=>'' but the documentation for "wp_list_categories" doesn't seem to support that. If you have any ideas on how to accomplish this it would be much appreciated.


Getting undefined index id error in theme

I am getting Notice: Undefined index: id on the line $id = $option['id'];   in my wordpress theme adminfunctions.php file Can you please help.               function of_option_setup(){             //Update EMPTY options             $of_array = array();             add_option('of_options',$of_array);             $template = businessgrow_get_option('of_template');             $saved_options = businessgrow_get_option('of_options');             $std = '';             foreach($template as $option) {                 if($option['type'] != 'heading'){                     $id = $option['id'];                     if (isset($option['std'])) {                     $std = $option['std'];                     }                     $db_option = businessgrow_get_option($id);                     if(empty($db_option)){                         if(is_array($option['type'])) {                             foreach($option['type'] as $child){                                 $c_id = $child['id'];                                 $c_std = $child['std'];                                 businessgrow_update_option($c_id,$c_std);                                 $of_array[$c_id] = $c_std;                              }                         } else {                             businessgrow_update_option($id,$std);                             $of_array[$id] = $std;                         }                     }                     else { //So just store the old values over again.                         $of_array[$id] = $db_option;                     }                 }             }             businessgrow_update_option('of_options',$of_array);         }


Wordpress Comment. Need some details of wp_comments DB table

Today I was doing some research on wordpress comments. **I am looking for making a Comment Type** which I can use as a review on wordpress custom post type which I use for business directory listings. Looking at the wp_comments table of wordpress Here is the table fields. Please fill me up for the purpose of each table field (looks at 10, 12, 13):   1. **comment_ID:** ID for the comment   2. **comment_post_ID:** The post for which the comment is posted   3. **comment_author:** Comment author name   4. **comment_author_email:** Author name for the comment   5. **comment_author_url:** Author url   6. **comment_author_IP:** Author IP address   7. **comment_date:** Comment Date   8. **comment_date_gmt:** GMT time of the comment   9. **comment_content:** Contents of the comment (comment body)   10. **comment_karma:** What is this? Does wordpress have any default karma calculation? or its placed for plugin authors   11. **comment_approved:** Flag for the comment status.   12. **comment_agent:** Not sure what it is?   13. **comment_type:** What is it? Can wordpress have a default comment_type functionality like custom post type?   14. **comment_parent:** For threaded comment   15. **user_id:** user id if comment author is a registered user of the site. I was wondering if i can use wordpress comment table and comment meta table to make the total review system working. The reviewer have to be registered before send review. So that will save lots of work. Also i need to know how the wordpress current comment functions will work with this method. As every comments has its own post id so it think that will not be a problem. And also when I import the CPT I will also able to import all the comments and fields (if i add some comment meta fields) right? So, if i sum up my questions are:   1. what is 10, 12 and 13 db table field for comments? Does wordpress uses it or I can use it for saving extra information. And How do i use wordpress comment meta table. **Any codex page link will be greatly appreciated.**   2. when I import the CPT I will also able to import all the comments and fields (if i add some comment meta fields)?


Adding Sidebars in WordPress Theme

Can anyone help me on how to add two sidebars on the main page of my WordPress site. I need one on the left and the right. I'm new to WordPress and don't know much about the code, even when I tried reading the codex. My website is here I am using a Ready To be theme, with Ready E-Commerce plugin


how to transfer wordpress sql/database from local to live

So for backing up any/all my wordpress sites i use a tool called "BACKUP BUDDY" and its a great tool and all but lately its been really buggy and today finally it went kaboom! Usually my workflow is that i develop the site on my local machine using WAMP/MAMP. when done and ready for testing, i use the tool to backup/transfer to real server etc. Since my tool stopped working(uploads half the content) i decided to just do it manually by installing Wordpress first on the real webserver(done), Applying my theme(done), then exporting the database sql from the local server(done), and thereafter importing it to the real server(done) and the 2xs that ive done it the site comes up blank.(outcome equals fail) im assuming that something has to be changed/done in order for it to work but not sure what. Any ideas as to what im doing wrong? because as of now, if i cant do it like this, id have to manually create ALL the pages etc and its not alot but would like to know the proper method in how to do this. Thanks in advanced.


Basic Multisite Question - Managing Content Centrally

Is it possible to manage content on multisite installations centrally? If I have a network of 20 sites, is it possible to change the content on one site and have it update across the network, or will I have to make the change on each site one at a time? More specific case, If I have a Terms and Conditions page that must appear on each site, that requires periodic changes can I make the change once and have it replicate. Any suggestions/directions/resources for managing this process effectively would be appreciated.


Using plugin_dir_path() with WordPress on MAMP

I have the following directory structure: Root Install: /Users/philipdowner/Sites/montanaliving Within the root installation I have the following plugin structure: /wp-content/plugins/manifest-rets/ Then, within the plugin folder I have 2 php files manifest-rets.php phrets.php In the main plugin file, I have the following code:               <?php     /*     Plugin Name: Manifest RETS     Plugin URI: http://manifestbozeman.com     Description: Uses the phRETS library to connect to a RETS server     Version: 1.0b     Author: Philip Downer     Author URI:http://philipdowner.com     License: GPL2     */          define('MR_PLUGIN_PATH', plugin_dir_path(__FILE__));              //echo MR_PLUGIN_PATH;     include_once(MR_PLUGIN_PATH.'phprets.php');           ?>      However, when running the plugin I get the following error stating that the phrets.php file could not be found. It's driving me batty! Any suggestions? Am I overlooking something obvious? > Warning: include_once(/Users/philipdowner/Sites/montanaliving/wp- > content/plugins/manifest-rets/phprets.php) [function.include-once]: failed > to open stream: No such file or directory in > /Users/philipdowner/Sites/montanaliving/wp-content/plugins/manifest- > rets/manifest-rets.php on line 15 > > Warning: include_once() [function.include]: Failed opening > '/Users/philipdowner/Sites/montanaliving/wp-content/plugins/manifest- > rets/phprets.php' for inclusion > (include_path='.:/Applications/MAMP/bin/php/php5.3.6/lib/php') in > /Users/philipdowner/Sites/montanaliving/wp-content/plugins/manifest- > rets/manifest-rets.php on line 15 I've tried passing in the ABSPATH constant, and using PHP's set_include_path() function to no avail.


Is it possible to cancel a post status transition?

# Question I want to cancel `pending_to_published` actions: Posts that match certain criteria should that go from `pending` to `published` should stay pending. (Alternatively, I need a to make add an "Approve" button to posts of a certain taxonomy, if that's easier) # Context A WP installation has a portfolio tax, of which posts are automatically created using a Gravity Form. These posts are saved with the status of "pending". These posts have a ZIP file associated with them. When a user submission (portfolio post) is approved (published), the ZIP is unpacked and processed. Doing this on the main HTTP server makes it lag or crash if multiple submissions are approved in a short period of time. To fix this, the ZIP processing script has been rewritten and moved to another EC2 instance (the site is on AWS). The idea is to have a WP plugin that would move the ZIP file to a `queue` directory, and use sockets to tell the other server to start processing it's queue. There are two ways to go about this:   * Hook onto the `pending_to_published` action and cancel the change.   * Add a button just for this ...which brings me to my initial question.


How to make a newly registered site on multisite network "live" only when the user is ready

By default, a new site created on a multisite installation is "live" and viewable by everyone (if they know the address) right after the user creates it. What is the best approach to changing this so that the site they register is only live when they are ready? By ready, I mean they have chosen a theme, uploaded a logo, entered their content etc and are ready for it to be publicly viewable. My initial thoughts are to create an option in the database for each new site that by default is set to '0'. The new site would just display a "coming soon" page to someone that isn't logged in. Then in the site's theme options panel or similar, there would be a "make my site live" button which updates the option in the database and shows the correct theme. Can anyone think of a better way?


Limiting the number of posts in WP_Query leads to unexpected result

The following is supposed to display 10 posts. Sometimes it displays 11, sometimes 12, and sometimes the desired 10 posts. It behaves the same if I swap `posts_per_page` for `showposts` or `numberposts` . Where do I need to search for the problem?               <ul>         <? wp_reset_query(); ?>          <?  $args = array(             'orderby'           => 'rand',             'posts_per_page'    => '10',         );         $query_footerFavorite = new WP_Query($args);              while ($query_footerFavorite->have_posts()) : $query_footerFavorite->the_post(); ?>                  <li>                 <a href="<? the_permalink(); ?>" title="<? the_title_attribute(); ?>">                     <? the_title(); ?>                 </a>             </li>              <? endwhile; ?>         <? wp_reset_query(); ?>                      </ul>      Edit: It seams there is a problem with the posts_per_page, see `print_r($query_footerFavorite)`:               WP_Query Object ( [query_vars] => Array ( [orderby] => rand [posts_per_page] => 10 [error]


Create HTML newsletter source from Wordpress

Is there a way to export certain posts into an HTML newsletter format that is suitable to email to subscribers? I am thinking of something that allows me to select a certain amount of posts, etc and that then generates in-line HTML content with those posts in them in a format I can copy and paste into a newsletter management tool (i.e. mailchimp, campaigner, etc). I've noticed that some mail providers like mailchimp, aweber, etc offers RSS to email, which looks pretty handy and might work - unfortunately my client is using campaigner.com which does not appear to offer this. Perhaps there is another straight forward way to generate an HTML email?


Can I create multiple instances of the BuddyPress Activity Stream with separate themes?

I'm trying to take advantage of BuddyPress 1.7's new theme independence to effectively create different pages and instances of the Activity Stream with different themes. I can use HeadSpace (an options plugin) to change the theme for a specific page and one "Template" under Page Attributes is BuddyPress - Activity Directory. ![enter image description here](http://i.stack.imgur.com/fuFCK.png) ![enter image description here](http://i.stack.imgur.com/AXQ5h.png) I use both in conjunction (as shown above), but setting HeadSpace to use a child theme returns the BuddyPress Default Theme (but correctly returning another instance of the Activity Stream, proving that it can be done) and trying to use a normal WordPress theme (i.e. Twenty Twelve) returns an HTTP 500 error. Is this possible, and how?


Join new table with SQL query

I created a plugin with a new table (`wp_soundcloud`) and I need to retrieve the data from that new table along with the post data. Here is my query:                $querystr = "         SELECT $wpdb->posts.*,          FROM $wpdb->posts          LEFT JOIN $wpdb->soundcloud ON($wpdb->posts.ID = $wpdb->soundcloud.idpost)         WHERE $wpdb->posts.post_type = 'soundcloud'         AND $wpdb->posts.post_name = '$name'         ";      $pageposts = $wpdb->get_results($querystr, OBJECT);      …and here is debug:                 ["last_query"]=>       string(176) "         SELECT wp_posts.*, .*         FROM wp_posts          LEFT JOIN  ON(wp_posts.ID = .idpost)         WHERE wp_posts.post_type = 'soundcloud'         AND wp_posts.post_name = 'test-demo'         "      …and the error:                 ["last_error"]=>       string(226) "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 'FROM wp_posts          LEFT JOIN  ON(wp_posts.ID = .idpost)         WHERE wp_posts.post_' at line 2"      The problem is the `LEFT JOIN ON(wp_posts.ID = .idpost)`. But why did the query not `JOIN` the table?


How to display category specific post content on a page

Hi I need to display posts in a category on my page template. How can I do this? Thanks


Force user to login in home page

I have a custom login form working properly on my home view. Nice. But what I want is when user try to view some page, be redirected to my home view instead of wp-login. Im trying to do this way:               add_action('template_redirect', 'redirect_to_login');          function redirect_to_login(){      if(!is_user_logged_in()){        wp_redirect(home_url()); exit;      }     }      It's not working. Browser says it has too many redirects. What can I do? Thanks!


home_url(); showing current page instead of site address

Does anyone have an idea why my home_url() function gets the URL of the current page instead of the site address? (The site runs locally using MAMP.)