title: How to get image name, mime type, width, height, file size from post custom field?

text: What I need is some function to echo file name of image used in post like "image-file-name.jpg", or just "image-file-name". Also it would be great to be able to have even more information about image like:   * image width,    * image height,    * image mime type / format,    * image file size,    * image extension. Also this may be helpful, I have custom field named 'image_full_url' which contains full url address of image used in post. For example content of custom field named 'image_full_url' is:               http://www.example.com/wp-content/uploads/2012/12/image-file-name.jpg      I am using that custom field to echo that URL when I need it, and it would be nice to have something similar to echo other data about image.


title: Change permalinks for custom post type based on taxonomy term

text: I have a custom post type 'profile'. Each profile can be one and only one of either student, staff or alumni, which is set through the 'profile_types' custom taxonomy. This gives me permalinks of:               www.mysite.com/profile/arthur-mcmillan.       What I want is:               www.mysite.com/student/arthur-mcmillan      I have actually got it to work using the following technique, but it breaks all my other pages and posts, returning a page not found. In register profile custom post type:               'rewrite' => array('slug' => '%profile_types%', 'with_front' => false)      And I'm filtering it with this function:               function filter_post_type_link($link, $post)     {               if ($post->post_type != 'profile'){             return $link;          }              if ($cats = get_the_terms($post->ID, 'profile_types')){             $link = str_replace('%profile_types%', array_pop($cats)->slug, $link);          }              return $link;     }     add_filter('post_type_link', 'filter_post_type_link', 10, 2);      So that works, but breaks other ordinary pages and posts. Does anyone know a way to fix the posts and pages, or of a better way of changing the permalink? Thanks


title: Wordpress redirection problem after moving to a new server?

text: I've created a site using wordpress and i moved that from localhost to new server. The steps i've followed is just got backup of old db from localhost and uploaded them to the new server. Changed the WordPress address (URL) & Site address (URL) manually from phpmyadmin. Moved all the files from localhost to the server Changed the wp-config with the new server's db details. Now i'm able to visit the admin panel of wordpress but not the site. Its showing the following error, > The page isn't redirecting properly > > Firefox has detected that the server is redirecting the request for this > address in a way that will never complete. > > This problem can sometimes be caused by disabling or refusing to accept > cookies. I think that this must some redirection problem.. My new .htaccess file under new server is               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /veejata/wordpress/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /veejata/wordpress/index.php [L]     </IfModule>


title: List all Posts under heading in wp_list_pages menu

text:
I am currently using the default Page Navigation (wp_list_pages) with wordpress and I have set my homepage to a page called "Home" and my blog to a page called "Events" but I would like to list the 10 most recent posts under the child of "Events". I attempted to hack it in using the following code but it threw up content all over the place and removed tags:               add_filter('wp_list_pages', 'add_forum_link');     function add_forum_link($output) {             $output .= '
Blog
';                  query_posts('showposts=10');             while ( have_posts() ){ the_post();                  $output .= '
'.the_title().'
';             }                  $output .= '

';             echo $output;     }      Plus it involved me creating a new link called "Events" and so it doesn't work very well. Is there an option to just make Wordpress find which page I've set as my Posts and show the last 10 blog posts under that heading? Any help would be great!!


title: Will WordPress become completely OOP?

text: Is there any information about WordPress becoming completely OOP in future versions?


title: How to write an if statement which reads: 'if is this custom post type or a child of it do the following'?

text:
Basically, I would like to activate a CSS class only if the current page is a certain custom post type (e.g. `?bbp_forum=technology`) or if the current page is a child of that custom post type. **EDIT:** The first custom post type is called '`bbp_forum`.' Each '`bbp_forum`' can have a '`bbp_topic`' (which is another custom post type). Like it is described in this picture: ![enter image description here](http://i.stack.imgur.com/5JiAi.png) I used to do the following in order to assign the class `current` to the current '`bbp_forum`'s link:                       <?php                 global $post;                 $the_post_ID = $post->ID;                 $cat_posts = get_posts('post_type=bbp_forum&posts_per_page=-1');                 var_dump($the_post_ID);             ?>             <?php foreach ( $cat_posts as $post ) : ?>                 <li <?php if ( $post->ID == $the_post_ID )  echo 'class="current"'; ?>>                     <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
                  <?php endforeach; ?>      but it doesn't work for a child of the '`bbp_forum`'


title: wp_get_archives for a specific category?

text: I've been pulling my hair out on this one - I need to hard code in `wp_get_archives()` for a specific category into a template. This post was useful: Category Specific Archive but, as with all the plugins I've found so far, they don't work with WP 3.1 (or you need to hack the core files which I obviously don't want to do). Is there another solution I'm not aware of? Maybe a method by creating a separate loop? THanks for any pointers osu


title: show cimy user fields in users.php with manage_users_columns

text: I'm trying to add code to my themes functions.php to display fields created with the Cimy user extra fields plugin in the dashboard users.php. I know that I need to use manage_users_columns, but beyond that I'm stuck. Anyone familiar enough with the plugin to help me get the proper fields to display?


title: Any plugins to help with multilingual content?

text: I'm taking classes in Spanish and would like to keep a blog to track my progress, where I can translate random pieces of text, post pictures and describe them in Spanish etc. Are there any plugins that would help with this? Maybe something that automatically detects the language and colors it a different color?


title: tabbed content box with different tabbed background images

text: I am currently looking for a way to replicate the image I have below. I have come across many tabbed content plugin's and snippets of code, but I cannot figure out how to add different background images to each tab. ![enter image description here](http://i.stack.imgur.com/H9QBw.jpg)


title: Post is in 2 categories - how to see the current active menu element?

text: Ok just imagine you have 3 categories. Projects, newsfeed and notimportant. You add a new project to projects and at the same time, want it to be in the newsfeed as well. Now when you click on the single post project in projects I want the menu to highlight the projects dropdown link. Since the post is in projects and newsfeed I don't know how to do that. It will highlight both. See here: ![enter image description here](http://i.stack.imgur.com/pOl1c.png) both have the classes `current-post-ancestor current-menu-parent current-post-parent` obviously I only want to show the active class when navigating through newsfeed into the post.


title: How to hide or remove unwanted widgets on Multisite installation?

text: I am using Multi-site installation. I don't want all the widgets appear under widgets.php on dashboard .So I tried to find a way to remove or hide unnecessary widgets . SO that the new sub-sites under my Multi-site created won't have much widgets. So the users don't get confuse with lot of widgets . I tried to find the files related to widgets .But I didn't able to find such pages in both wp-admin/includes/widgets.php and wp-admin/widgets.php I also tried to find in themes files .But failed .Could any one help me to find these ? Or Do I have a chance to hide them using functions.php? Thanks in advance !


title: What is the difference between a "tag" and a "category"?

text: I have been using WordPress for several years, but have yet to see a reason to employ tags over categories or tags with categories. What is the thinking behind the two, and when are each appropriate?


title: Script to Automatically Advance to the Next Page of a Paginated Post

text: I have a custom post type that is just a paginated post and acts as a slideshow. How can I make it so that the reader can choose an option to have the slideshow advance automatically to the next page after some preset interval (like 10 seconds)?


title: Remove 'read more' link when post is shorter than excerpt

text: How can I remove the 'read more' link from a post excerpt on a blog/archive page when there is nothing more to read...when the length of the post is shorter than the excerpt?


title: Nav menu separators?

text: Anyone know of a plugin that can, or have an idea how to, allow a user to drop in separators/dividers between certain nav menu items? Google only seems to bring up rookie CSS tips for first/last child selectors, I'm after something very much like Firefox bookmarks ;) **UPDATE:** I _do_ appreciate all input so far, but I'll elaborate to avoid any further confusion;   * I've written many plugins & themes, and have a good understanding of all the basics (hooking into WordPress, implementing extended functionality, handling & saving data etc.)   * I'm specifically after advice on extending the nav menus admin UI, which would allow users to drop in 'separators' (nothing more than markers) between items in the menu, and how best to store that data & then render it in some shape or form on output with `wp_nav_menu` Usually I would delve in & just get to work. But since this is only a _possible_ requirement for an upcoming project, I thought I'd see if anyone's already tried something similar. Plus I thought it might actually be useful for others, and would post my own feedback/results if I proceed with it.


title: Add Custom Profile Field as Notes

text: I would like to add a custom field "NOTES" to the user profile. This custom field should not only be updated,saved and display the current value but be displayed as ongoing (previous and current) notes on the user profile. For example: 1/1/2012 user xx wrote: Lorem ispum ispum 1/2/2012 user xx wrote: Lorem ispum ispum ispum 1/3/2012 user xx wrote: Lorem ispum ispum ispum ispum All "Notes" that the user adds should be displayed on his profile. Any help is highly appreciated! Thank you!


title: Wordpress Delete hook with wp_delete_post function?

text: I have this action/hook:               add_action( 'before_delete_post', 'my_delete_function' );      function my_delete_function($post_id) {          global $wpdb;         $achievement = get_the_category($post_id);          $h = $achievement[0]->cat_ID;          $s = ''.str_replace('"', '', $h);        if ( $s == 6 || $s == 5){             $wpdb->query("DELETE FROM wp_votes WHERE post = ".$post_id) or die(mysql_error());              }     }      The above works great when I am deleting posts from the admin. However, when the wp_delete_post() is called, the action doesnt work. How can I make the action work with the delete function?


title: plugin to hide selection of text from post from frontpage

text: is there any plugin that will add new quicktag, says:               [hidetext]some text to hide[/hidetext]      and any text inside those tag is hidden from frontpage/archive/etc. It only shown on single post page.


title: Make get_permalink() work outside the Loop using filters

text: I am developing a plugin which displays a wordpress post in a lightbox outside the loop. I noticed that some plugin which modify the contents of the post (like Facebook Like button plugin) use the `get_permalink()` function to retrieve post urls. When the post is opened normally (single.php) the plugins work fine. When the post is opened in the lightbox (outside the loop) , the plugins dont work since `get_permalink()` in the plugin does not return anything. however if i can somehow apply filter and return `get_permalink($post_ID)` instead, I can get the job done. I dont know how to hook it properly to get_permalink. I tried this, but this just makes it enter an infinite loop :               add_filter('post_link','cg_post_permalink');     function cg_post_permalink(){ return get_permalink($post_ID); }      here I read that `post_link` was the hook for the get_permalink function PS - please do not suggest using an iframe since it has its own set of complications. :)


title: Avoid too long words in a post title, post content or comment but only if its not a url

text: I want to prevent users from posting things like "aaaadfgdfgsdfgdaaaadsfgsdfgaaasdfgdfaaadfgsdfgaaaaaaaajahkjhkahkkjkjhaa..." which would not only be annoying but would certainly break the content div when the word is longer than the div itself. I found a neat regex which solved the problem:               $thecontent = preg_replace('/\w{40}(?=\w)/', "$0-", get_the_content());      This would place hyphens inside any word having more than 40 characters in order to force a line-break if necessary and keep the layout unharmed. The thing is I would like to apply this only when the word is plain text but certainly not when it's a url (or an email address perhaps). Ultimately, a url like "http://www.aaaa.com/sdfsdfdfg/sdfsdsdfs/dsdsdfs.php?var1=dfsdfsdfvar2=sdfsdf&var3=dsfsfds" should remain as it is as I believe it's automatically taken care of by wordpress (I tried and created a long url and it displayed correctly in two lines so it seems to be ok). With the regex here above, even the url is processed which is a problem. How can I avoid to apply that regex to (email addresses and) standard transfer protocol urls such as http, https, ftp, ftps? PS: I tried some client-side hyphenator plugins but they just don't fit my needs. Thank you for your help.


title: How to edit background color of only one sidebar?

text: I'm using Oulipo theme on this site, which has two sidebars. > **I'd like to ask how can I change the background color of only the left > sidebar?** Also, how to change the text, hyperlink, hover and background colors for   1. Front menu located in left sidebar.   2. Search field located at upper right corner. Thanks a lot for your help and time.


title: Custom Post Types, Custom Taxonomies and Permalinks ?

text: So let's say i register a custom taxonomy called:               Clients      With a few terms such as: `Microsoft, IBM, Apple` Under a CPT (custom post type) called `projects`: # Permalinks `/%year%/%monthnum%/%taxonomy%/%postname%/` this is the structure i am using; http://www.example.com/projects/ \- Displays All posts under 'projects' http://www.example.com/projects/clients/ Displays a 404 http://www.example.com/projects/clients/ibm/ displays all posts under `projects` with the term `ibm` How can i get Wordpress to display an Index of all the posts under Clients? so for example if the user visited /projects/clients/ all the posts with Microsoft, Apple and IBM would be displayed. I know a method is to use a page and then query into the page, but in essence of SEO, and relevance, i can not name the page-slug something else. Thanks in advance.


title: Adding another arg to comments_popup_link

text: what WordPress core functions do I have to modify to change               comments_popup_link('Ni komentarjev', '1 komentar','% komentarjev')       to               comments_popup_link('Ni komentarjev', '1 komentar', **'2 komentarja',** '% komentarjev')      I'd like to add an argument for 2 comments. And what lines to add to this functions? The reason why would I want to do that is simply the fact that in my home language we start plural by 3. I want it to be spelled correctly.


title: Random HTTP 500 error in WordPress

text: I'm running WordPress 3.2.1 on a CentOS box and I'm getting reports from my writers saying they get HTTP 500 errors when they try to update an exciting post. I've tried the same and have similar problems (although the HTTP 500 only shows in Chrome, Safari and Firefox simply give me a blank window). I've increased my log level on my httpd install to debug but I still can't find any errors in the logs.... The same box is running another website as well, also using WordPress (same version) and this site is not displaying these symptoms. All suggestions on how to resolve this are more than welcome! EDIT: I should also add that I've already tried increasing the PHP Memory in wp-config.php (up the 64MB) but the problem still occurs) (I'm double-posting this between here and serverfault as I'm not sure wether the problem is related to the server itself or to wordpress...)


title: query posts with custom field meta value

text: <?php          query_posts(             array(                 'showposts'   => -1,                  'post_parent' => $post->ID,                  'post_type'   => 'page',                  'orderby'     => 'title',                 'order'       => 'ASC',                  'meta_key'    => 'featured_product',                  'meta_value'  => 1             )         );     ?>      For featured products.               <?php          query_posts(             array(                 'showposts'    => -1,                  'post_parent'  => $post->ID,                  'post_type'    => 'page',                  'orderby'      => 'title',                  'order'        => 'ASC',                  'meta_key'     => 'featured_product',                  'meta_compare' => '!=',                  'meta_value'   => 1             )         );     ?>      For normal product. What I want is:   * If the child page has 'featured_product' and value equals "1" then it's featured. It works!   * If the child page has 'featured_product' and value not equal "1" OR it doesn't even have the field 'featured_product' then it's not featured product (this doesn't work at the moment). Anyone? Thanks!


title: Post will not load via ajax

text: I have inherited a WP 3.2.1 site which uses prettyPhoto to load content via ajax. This was working before I enabled permalinks on the site. The Custom Post Type UI plugin is installed. I can browse to my custom post type at mysite.com/story/name-of-story but loading via ajax results in a 404. The links which trigger the $.get code in prettyPhoto look like this:               <a href="<?php echo get_permalink(); ?>&ajax=true&count=<?php echo $count ?>" rel="story[ajax]"><?php echo wp_get_attachment_image($attachment->ID, array(75, 75));?>      If I change the permalink settings back to 'default'. the post content is loaded into the popup. The hrefs being called via XHR while it is working look like this: http://mysite.com/?story=name-of-story&ajax=true&count=37 I've tried removing all query parameters from the permalink URLS and this did not resolve the problem. Can anyone shed any light on what might be going on here?


title: How to Create RSS Feeds for categories in Wordpress?

text: I want to create RSS feed for categories in WordPress.Is this possible? How could I do it? Thanks


title: Plugin to book course and pay online for it

text: I got a request from a client. He need to manage a school with courses 2-3 day a month. He have to open-close date and manage it easily. Then when a person choose a date, he need to register, and pay with paypal, get a confirmation and email send to the customer and the teacher.... Question, do you know 1 or 2 plugin that can help me get this done in WP ? thanks in advance


Can WordPress be installed at the root level, if a homepage called index.php already exists?


title: 14,000 Wordpress Users. How did they get there?

text: Somehow my Wordpress site has over 14,000 users. I know from looking at the records that these are "spam users"...               Spam User              Email     martin28651162   martin28651162@promatekng.com     martin322929651  martin322929651@playgirlgalleries.co.cc     martin443534673  martin443534673@wirelessnetworkcentral.com     martin640363627  martin640363627@bestcamcorderguide.com      Is there an easy way to remove all of these users without removing my actual "Real Users"?               Real User              Email     yyyy            yyy@email.com     zzzz            zzz@email.com      How can I prevent these users from being created automatically?


title: Display Parent and child taxonomies in seperate drop downs

text: > **Possible Duplicate:**   >  How can I display parent and child taxonomies in separate drop downs? does anyone have solution for the requirement where i have a taxonomy State which is the parent and it has a child sub-taxonomy called City, Need to display the state as a drop down, when i select the state tax i have to display the city tax in the second drop down.....kindly help me..


title: Getting metabox value within a shortcode?

text: Is it possible to get page's metabox value within shortcode that is executed on that page? Scenario:   * I have a sidebar metabox for every page.    * I have some kind of custom gallery shortcode. My gallery shortcode outputs 600x200 images (I'm using timthumb here). BUT I want it to display 900x300 if there's no sidebar. Normally I'd use:               $sidebar = get_post_meta($post->ID, 'metabox_sidebar', true);        if($sidebar == "true") { do something }        else { do something else }      But get_post_meta returns nothing within the shortcode body.


title: Help with a get_categories () drop down menu - I want it to show in heirachial form

text: I have a drop down menu that displays all of the terms for one of my custom taxonomies using get_categories (). It displays fine in alphabetical form. However, what i want to know is how can i have the terms listed in a hierarchial form in a drop down menu, so they appear like this - Parent Category 1   * Child One   * Child Two Parent Category 2   * Child One Here is my code for the drop down menu:               </select>           <span>By Category: </span>     <select name="category">      <option name="all" value="">All Categories</option>     <?php $categories_filter = get_categories( 'taxonomy=tshirt_categories' );          foreach( $categories_filter as $category_option ) {               echo '<option name=' . $category_option->slug . ' value="' .  $category_option->slug . '" /> ' . $category_option->name . '</option>' . "\n";         }     ?>      </select>        Once again thanks for any advice you guys may have! Mike


title: Is there a limit on the size of a WP page?

text: I have a plugin that generates a gallery of user photos. Currently, it works using `img` tags pointing to the user photo image. It attaches to the `the_content` filter. I'm experimenting with converting to using data URLs. I'm able to generate them with no difficulty, but when I change the code to insert them into the page, requests _to_ that page come back with zero content (i.e. zero length). However, I still get a 200 status code and I don't see any errors in my logs. So, I'm wondering if WP has a limit on the size of page it will send. The data URLs add up to around 1MB, so I was wondering if that tripped it over some limit.   * Gallery generation code   * User Photo code Any suggestions? The salient code is:               $file = trailingslashit($upload_dir['basedir']) . 'userphoto/' . $image_file;     $fileContents = base64_encode(file_get_contents($file));     error_log($fileContents);     $src = "data:image/jpg;base64,$fileContents";     ...     ...     $img .= '<img src="' . htmlspecialchars($src) . '"';     ...     $img .= ' />';      In case it's relevant, the content is in a page not a post and it would go here: http://nerdnite.com/nerds/ So, that page, but with data URLs instead of image source files. ## EDIT What I _do_ now know is that it's not the generation of the content string by the filter. I can generate the string (which is of length 1229923), but if I pass a dummy string back, everything works well. My memory usage is negligible and I'm nowhere near my PHP limit... so it seems to be something to do with WordPress trying to handle that huge string.


title: How can the_excerpt (or equivalent) be called on a category description?

text:
In the code below, rather than writing out the entire description field ($category->description), how can I call the equivalent of the_excerpt? I'm placing the "more" tag after the first paragraph of the category description and using a visual editor to edit my category descriptions.               function show_category_index($content){         $categories=get_categories('exclude=1&exclude_tree=1');         echo $content;         echo '
';         foreach($categories as $category) {             echo '
'.get_category_thumbnail($category->term_id, 'thumbnail').'term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'';             echo $category->description . '
';             }          echo '
';     }


title: Missing "category_children" option when dynamically creating categories via a plugin

text: I've isolated the source of a fatal error that's been occurring when a brand new site is previewed just after installing and activating the plugin I'm working on. The problem appears to be that the "category_children" item in the options table is not being created. Interestingly, it appears that two actions trigger WP to create the category_children option. They are: (1) Activating a theme that contains code to create categories and (2) Simply accessing the category manager. If I do either of those, after activating the plugin, the category_children option is being created (presumably due to checks in the theme activation or the edit-tags.php load) and the error goes away. Here's the code I'm using in my plugin to create the categories (executes on plugin activation only):                       if(!get_cat_ID('nofollow')){wp_create_category('nofollow',1);}             if(!get_cat_ID('noindex')){wp_create_category('noindex',1);}      What am I missing? Do I need to explicitly call a method to have WordPress generate the category_children options array for these items? UPDATE: Thanks to scribu's help below on the reason for this bug, I've found that the PARTIAL fix for this bug is to place this line just after my wp_create_category() calls are complete:               clean_term_cache('','category');       However, this does not work when called in the same plugin that creates the categories. I had to place it in a standalone plugin that's activated separately from the plugin that creates my categories.


title: 404 error after publishing a post

text: My issue is prety much what the title indicates. Whenever I publish a new post, everything works fine - the post is listed in my WP dashboard and all looks good. However, if I try to 'view post' to view it live on my website, I've searched for this issue throughout the net, and all point into editing the .htaccess file. However, this issue is more likely related to a theme I've developed (why? because several buyers have reported this issue, so I need to find a fix for the theme itself). That said, editing or manipulating the root .htaccess file is not really an option as the issue is originated in my theme. Best,   Chris


title: Print page content with formatting when doing custom SQL query

text:
I guess there's a simple solution for this but couldn't find any. I'm trying to fetch 3 pages and show them on footer. The problem is that **_every page is shown as text without formatting_** which means that **_shortcodes are printed as text as well_**. Here's the code I'm using:               global $wpdb;     $sql            = "SELECT post_title, post_content FROM ...";     $footerElements = $wpdb->get_results( $sql );          foreach ( $footerElements as $footerElement ) {         echo '
';         echo '
' . $footerElement->post_title . '
';         echo $footerElement->post_content;         echo '
';           }      The reason I'm using `SQL` and not `WP_Query` is I have a plugin with `pre_get_posts` which is explicitly setting `post_types` (excluding `page`) when in category or tag page is shown. So I can't use `WP_Query` for that.


title: How do you seamlessly switch hosting?

text: I recently switched a WP site from shared hosting to a VPS and would like to document the process here.


title: How to display second and third level menus

text: I am using the Arcade Theme and I have built a 3 level deep navigation menu as it is shown in the image below taken from the the Appearance > Menus section but then I do not see sub-menus. How can I display them? I am new of WP. Thanks ![enter image description here](http://i.stack.imgur.com/RbhtK.png)


title: Adding a post to a page

text: I would like to know how I can add a specific post to a specific page? It would be great if anyone can suggest a reference to this problem. Do I need to create a post category to relate with a page? Or should I add a category on menu widgets rather than page?


title: How do I query a table?

text: I am using Contact form 7 and the database extension, the db extension creates a table called wp_CF7DBPlugin_SUBMITS. I have 2 forms on my site, I need to know if the user has completed the 2nd form, so when they return they can skip the 1st form. I don't even know where to start with this, any help will be much appreciated.


title: How to display an archive with multiple authors

text:
I have this coding challenge that's beating my head I built a site for an academic magazine, where some of the articles are written by two or more authors. This was easily acheived using either Co- Author or Co-Author Plus plugin, as shown in the following image. ![Multiple authors in a single post](http://i.stack.imgur.com/8GtFo.png) Then, using this code, I built an authors archive where I display all wordpress authors with posts published.               <?php     $authors = $wpdb->get_results('SELECT DISTINCT post_author FROM '.$wpdb->posts.' JOIN wp_usermeta ON user_id = post_author WHERE meta_key=\'last_name\' ORDER BY meta_value');          if($authors):     foreach($authors as $author):     ?>     <div class="author" id="author-<?php the_author_meta('user_login', $author->post_author); ?>">          <?php if(get_the_author_meta('description', $author->post_author)): ?>

<a href="<?php bloginfo('url'); ?>/author/<?php the_author_meta('user_nicename', $author->post_author); ?>"><?php the_author_meta('last_name', $author->post_author); ?>, <?php the_author_meta('first_name', $author->post_author); ?>

<?php the_author_meta('description', $author->post_author); ?>

     <?php else : ?>          <?php endif; ?>
     <?php endforeach; endif; ?>      But the code only displays "first" authors. i.e the first author assigned to a post, and not the second nor third. So, if the second or third author hasn't published another different post by himself, he won't appear on the authors list. So, the question is, how can I modify this code to show all authors associated with a post? Maybe a string where author_has_post >= 0, and then how to prevent the admin author from appearing on the list


title: Limit upload file type on one custom post type

text: Is there any way to limit the filetypes allowed for upload based on the current post type? For example, I have a custom post type called `documents`. I have a `File upload` custom field which calls the Media Uploader (media-upload.php) and I have the possibility to upload a file. I want to restrict the file to `pdf`, `doc` and `xls`. However, I also have a post type called `illustrations` in which I want to limit the upload file types to `jpeg`, `png` or `gif`. I am currently trying Mike Schinkel's answer from Limit image upload to one and disable audio, video and other document file types to upload to restrict the file types, but I don't know how to vary the array of permitted filetypes based on the current post type.                if ('image'!=$category || !in_array($type,array('jpg','jpeg','gif','png'))) {         $file['error'] = "Sorry, you can only upload a .GIF, a .JPG, or a .PNG image file.";     }      I tried using `get_current_screen()` but it returns the id of the media uploader itself. I also tried using `global $post` but I didn't get anything. Or would it be simpler to add a filter to `upload_mimes` based on the current post type? Any suggestions? **Answer:**               if( isset( $_REQUEST['post_id'] ) && $post_type = get_post_type( absint( $_REQUEST['post_id'] ) ) ) {              if( 'illustrations' === $post_type ){          $filetype = array('png', 'jpeg', 'gif', 'jpg');          $message = 'Only PNG, JPEG, JPG, and GIF allowed.';         }               elseif( 'documents' === $post_type ){           $filetype = array('doc','docx','pdf','xls', 'xlsx', 'zip');           $message = 'Only PDF, DOC, DOCX, XLS, XLSX, and ZIP allowed. ';         }            }


title: Upgrade Wordpress multisite to 3.5.1 problems

text: I'm upgrading multisite to 3.5.1 and it did not allow me to do automatic upgrading I see this message: > "To perform the requested action, WordPress needs to access your web server. > Please enter your FTP credentials to proceed. If you do not remember your > credentials, you should contact your web host." So I add the FTP credentials in `wp-config.php` but still does not work. I investigate and found out that Wordpress core files are owned by the root and not by my ssh username. Example of these files are the files in the `wp- includes` and `wp-admin`. Is there a way to perform automatic upgrade of Wordpress multisite without having a root access?


title: WooCommerce custom payment gateway

text: I'm trying to write a WooCommerce plugin for a client's website that they're going to be selling subscriptions to customers. I've been exploring my options and the best one I can come up with is to roll my own payment gateway module to handle this. (Other advice appreciated if anyone's ever tackled something like this). However, I'm trying to add a custom payment gateway, but it doesn't seem to be working up. It's not showing up under `WooCommerce -> Settings -> Payment Gateways`. The plugin is installed and activated in WordPress, and I've followed a couple guides from their docs pages.   * WooCommerce version: 2.0.18 (via plugin installer)   * gist code I really don't know why or what would cause my payment gateway isn't showing up. Thanks for the future help.


title: Animate like Stack exchange frequently asked questions

text: http://graphicdesign.stackexchange.com/about As you scroll down the page, images and text slowly fading. Is there a plug-in origin jquery like string that I should be looking for?


title: How do I get a post (page or CPT) ID from a title or slug?

text: I've scoured the Codex, failed to get get_page_by_title() to work and am quite surprised that there doesn't seem to be a standard WP function for this task. I need to get the ID of any given post/ cpt or page using either the slug of the post/ page title. Ideally I'm looking for the following: `get_post_ID_by_title('My post title', 'customposttype');` What should I be doing?


title: Exact image sizes

text: I am trying to define an image size of exactly 290 height x 180 width for all images uploaded to my WP site. I tried updating image sizes under Settings->Media->Image Sizes but these are only max values and some images end up coming out at 290 x 155 etc, is there a way to force WP to create an image at my desired size? I am not using post thumbnails, I have built a plugin that uses wp_get_attachment_image() to retrieve images.


title: What does Wordpress media uploader do to image files on upload?

text: This question is specifically for images and what optimisation happens to these files when they are uploaded via Wordpress Media Library?                   Images         .jpg         .jpeg         .png         .gif      And how is it possible to change these settings? I also know you can change the image sizes in `Settings > Media`


title: Add Category Descriptions to Montezuma Theme

text: Ok, a Quick Question: I´m using the montezuma theme and would like to add category descriptions above my category pages. How can I do that? I found descriptions on how to do that with other themes but not with Montezuma because it doesn´t use archive.php or category.php. If you know how, let me know.


title: Multisite plugin development and wp_enqueue_script

text: I have a plugin I'm developing. It works fine on a single site version of WordPress. It installs on a multisite version of WordPress, it appears to work on the admin pages, but when the plugin attempts to add javascript and css, it's not added. The display portion of the code is as follows...                  add_action('init', array(&$this, 'init'));             function init() {             // Gather gallery and template variables             $url = explode('?', 'http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);             $ID = url_to_postid($url[0]);             load_plugin_textdomain('ngTemplateCreator', ngTemplateCreator_DIR . '/lang', basename(dirname(__FILE__)) . '/lang');             $t = get_post($ID);             $c = 0;             $regex_pattern = get_shortcode_regex();             preg_match_all('/' . $regex_pattern . '/s', $t->post_content, $regex_matches);                  // loop thru shortcode             foreach ($regex_matches[3] as $key => $value) {                 if ($regex_matches[2][$key] == 'nggtc') {                     $c = $c + 1;                     //  Found a NextGEN gallery find out what ID                     //  Turn the attributes into a URL parm string                     $attribureStr = str_replace(" ", "&", trim($value));                     $attribureStr = str_replace('"', '', $attribureStr);                          //  Parse the attributes                     $defaults = array(                         'id' => 0,                         'template' => ''                     );                     $attributes = wp_parse_args($attribureStr, $defaults);                          if (isset($attributes["id"])) {                         $this->gid = $attributes["id"];                     }                     if (isset($attributes["template"])) {                         $this->tcname = $attributes["template"];                     }                          $wrapper = "nggtc_gallery_" . $this->gid . "_" . $c;                          if (!empty($this->gid) && !empty($this->tcname)) {                         $images = get_ngg_gallery($this->gid);                         $templates = get_custom_template($this->tcname);                              if ($templates && $images) {                             foreach ($templates as $template) {                                 if ($template->bottom_javascript) {                                     $this->bottom_javascript = $this->bottom_javascript . process_script_shortcode($template->bottom_javascript, $wrapper, $panelid, $panelcss, $filmstripid, $filmstripcss) . "\r\n\r\n";                                 }                             }                         }                     }                 }             }             $this->count = $c;             if ($this->bottom_javascript) {                 add_action('wp_footer', array(&$this, 'footerScripts'), 200);             }             wp_reset_query();         }              function process_script_shortcode($script, $wrapper, $panelid, $panelcss, $filmstripid, $filmstripcss) {             $out = remove_php($script);                  // Swap shortcode             if($out) {                 // strip html from filmstrip variables                 $filmstripi = str_replace(" id=\"", "", $filmstripid);                 $filmstrip = str_replace("\"", "", $filmstripi);                 $filmstripcs = str_replace(" class=\"", "", $filmstripcss);                 $filmstripc = str_replace("\"", "", $filmstripcs);                 $out = str_replace("[wrapper]", $wrapper, $out);                 $out = str_replace("[panel_id]", $panelid, $out);                 $out = str_replace("[panel_css]", $panelcss, $out);                 $out = str_replace("[filmstrip_id]", $filmstrip, $out);                 $out = str_replace("[filmstrip_css]", $filmstripc, $out);             }             return $out;         }              function footerScripts() {             if (wp_script_is('jquery', 'done')) {                 echo "<script type=\"text/javascript\" defer=\"defer\">" . $this->bottom_javascript . "</script>";             }         }      I'm only showing the function for my footer scripts, but none of the scripts and css are being shown, so I'm fairly certain the source of the error is the same. Can anyone tell me where I'm going wrong here?


title: Why Can't wp_editor Be Used in a Custom Widget?

text: I've been working on developing a plugin that adds a widget that allows you to edit the content with a wysiwyg editor. I want to use the default wordpress editor by calling `wp_editor()`. I've seen people say you can't do this, and sure enough, it crashes when you try to update the widget content. Can anyone explain why `wp_editor()` can't be used in widgets? I'm hoping to figure out how to get around that once I know why it doesn't work. However, Chrome doesn't spit out any errors in the console, so I'm not sure what's happening that it bugs out. Thanks, goldentoa11


title: AJAX request not routing through proxy

text: I've built a plugin that uses AJAX to post a URL to the URL2PNG API and bring back a screenshot into WordPress via wp_remote_get. It works beautifully in my development environment. In production, though, it needs to go through a proxy. Here's where it got sticky. We defined the proxy via wp-config and it worked beautifully. In my testing I was able to successfully connect to the URL2PNG API via the proxy and return results.. ..but.. When the request originated via AJAX, no success. I've gone through extensive testing and here's what I've found:   * Requests originating directly in plugin (e.g. on page load) are routed properly through the proxy without trouble.   * Requests that start in the browser (e.g. via AJAX) fail to connect.   * Closer inspection by server support showed that the request was attempting to go direct and _not_ making use of the proxy.  Have any of you run into this before? Any ideas what may be going on?


title: Disable sticky option for specific categories

text: Is there a way to disable the sticky option on posts in specific categories?


title: Appropriate hook for filtering the posts from the admin page

text: I am currently developing a custom post type and I would like to know which hook I should use in order to filter posts by category. ![The filter selection box](http://i.stack.imgur.com/ixQu9.png) Can anyone please tell me how to do this?


title: What are "best practices" for wp-config.php

text: Just started reading _Professional WordPress®: Design and Development_ I'm reading the section on **"Advanced wp-config Options"**. I see many options which I think are pretty cool/useful, but before I **_go crazy_** using "Advanced wp-config Options" I thought I'd **inquire about "Best Practices"** from the veterans in this area. I'm still a noob and a little knowledge is a _"dangerous thing"_ :-} For example book states: > To set your WordPress address and blog address, use the following two > options: > > define('WP_SITEURL', ‘http://example.com/wordpress'); > > define('WP_HOME', ‘http://example.com/wordpress'); > > The WP_SITEURL option allows you to temporarily change the WordPress site > URL.... I read this and think, **best use** is for taking site offline temporarily (for maintentance, etc.). Otherwise, why use this? But there are some options which read like they **SHOULD** be used (at least as a best practice). So I thought I would ask how the vets approach these config options (or for general advice to noobs). I know what these options (below) do, question is should I (do you) use them and why/not?   * WP_POST_REVISIONS   * AUTOSAVE_INTERVAL   * WP_DEBUG SAVEQUERIES   * WP_MEMORY_LIMIT    * FTP_USER    * FTP_PASS    * FTP_HOST    * WP_CACHE    * FORCE_SSL_LOGIN    * FORCE_SSL_ADMIN Thanks In Advance! sleeper


title: How to save multiple metaboxes?

text: I read a tutorial about metaboxes, most of things are clear but I have a question about multiple metaboxes. My question is about saving, in the tutorial:               <?php       add_action( 'save_post', 'cd_meta_box_save' );       function cd_meta_box_save( $post_id )       {           // Bail if we're doing an auto save           if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;               // if our nonce isn't there, or we can't verify it, bail          if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;               // if our current user can't edit this post, bail           if( !current_user_can( 'edit_post' ) ) return;       }       ?>       Do I need to make for example two save functions if I have 2 metaboxes, or can I put the values in same save function? What is the best method? If I render the fields with two different function how to deal with the `wp_nonce_field` ? What is the best method?


title: Weird html output of single_cat_title - is not inside of the html element?

text:
I'm displaying a single "featured" post at the top of the blog index page, and category pages. I'm using this conditional to display the category name of the category page if it is a category page, or to display one category title of the featured post if it is on the blog index page:               if( is_category() ):         $category = strip_tags( single_cat_title() );       echo '
' . $category .'
';     else:         $category = get_the_category();       echo '
' . $category[0]->cat_name .'
';     endif;      This conditional works fine for the blog index page. However, when on a category page, the html result places the category title outside of the `<div class="title main fs-45"></div>`. For example, on "My Current Category" category page the html result looks like:
     My Current Category

                  ... some other html …

      And on the blog index page, the html result is correct like this:

Featured Post Category Name

                  ... some other html …

      Any ideas why this would be happening? Thanks for any help with this!


title: What kind of object type is WP_Query?

text: I am getting this error when I try to return the post_title value from my WP_Query:               **Fatal error:** Cannot use object of type WP_Query as array      Here is the code:               $query = new WP_Query( array( 'meta_key' => 'Old ID', 'meta_value' => $atts['oldid'] ) );     return $query['post_title'];      How can I show the elements of the post after this query? I am using WP_Query because I am making a shortcode to be used within Posts and Pages.


title: How to create a custom WordPress navigation menu?

text: I hired a designer to create a custom website for my startup home business. Two years later the site is uploaded onto WP but I can't do a thing with it. The site is password protected as it is still not completed. I would want to add new pages (and tabs) to the site, however after reading up on WP I've learned that in order to this I would need to add a "Menu" to the "Appearance" option on my dashboard, further reading suggest that I may need to know HTML. Needless to say I am very frustrated as I do not know the first thing about WP let alone HTML. The site is utilizing wordpress 3.4.2. Can someone please help me with this issue. Thank you Maria


title: Enabling Default Widgets in a Custom Theme

text:
In custom theme development, how does one enable default built-in widgets? Note I mean default built-in widgets, not custom ones. I tried the following example for a WP 3.12 blog by placing it in my theme's functions.php file, trying to activate Pages by default. It didn't work, but I don't know why.               function mytheme_widget_init(){       $asOps = array(         'classname' => 'widget_pages',         'description' => __( "")       );       wp_register_sidebar_widget('pages', __('Pages'), 'wp_widget_pages', $asOps);     }          add_action('widgets_init','mytheme_widget_init');      What am I doing wrong? **EDIT: THE SOLUTION** In my theme, I needed to re-edit sidebar.php and use this markup instead.               <?php ?>

          <?php if ( !dynamic_sidebar(1) ) : ?>     <?php endif; ?>          <?php if ( !is_active_sidebar(1) ) : ?>
             <?php get_search_form(); ?>

             <?php wp_list_categories('show_option_none=&title_li=
' . __('Categories') . '
' ); ?>

Archives

                 <?php wp_get_archives( 'type=monthly' ); ?>

                 <?php wp_list_pages('title_li=
' . __('Pages') . '
'); ?>

          <?php endif; ?>


title: How do I remove featured images and captions from a wordpress RSS feed?

text: I'm trying to remove featured images and captions from my feed and struggling to do it. As another question has identified it is very difficult to format captions and so as a newsletter feed I want to remove them. I have added the below to functions.php having found it on WordPress forums but it dosn't seem to change anything               /** removes caption from RSS feed Denis 15/08/2014 */     function notags_content_rss($content='')     {      $content = preg_replace("/\[caption.*\[\/caption\]/", '',$content);      $content = preg_replace("/\[googlevideo.*\[\/googlevideo\]/", '',$content);      return $content;     }     add_filter('the_content_rss', 'notags_content_rss');      I have also added the following code to remove the featured image as we use the featured image as the main blog images and this means that we have a duplicate image in the feed.               /** removes featured image from RSS feed Denis 25/08/2014 */     remove_filter('the_content', 'featureimage_for_feeds');      Never touched any PHP before so would appreciate any help or advice that can be given. Finally I am not 100% sure that I am refreshing the feed correctly after each change to the code. This is what I am doing:   * Clearing website page cache, CDN etc   * Changing the number of feed items on settings/Reading to force feed refresh   * Clearing browser cache   * Going back to campaign monitor with a new email campaign and reloading the template (which calls the feed) to check results


title: Fantastico pros and cons

text: I am working with someone that has a host (internetplanners.com) that uses fantastico to install WordPress. Basically, my question is has anyone had bad experiences with fantastico or webhost internetplanners.com? _Note, I have installed Wordpress on my local machine (Windows) and didn't have any trouble. I don't have experience installing on a hosting service manually but think I could do it needed._ Since I wasn't familiar with fantastico one-click install, I did a search and found 2 links about reasons not to use fantastico: http://www.howtospoter.com/web-20/wordpress/3-reasons-not-to-use-fantastico- for-wordpress 1) simplicity = false security (if upgrade breaks, it can be difficult to fix); 2) upgrade doesn't put in maintenance mode or back up database, 3) upgrade doesn't deactivate plug ins. from http://wordpress.org/support/topic/installing-from-justhost : I agree with ZGani. Fantastico doesn't upgrade the third party scripts version frequently. So you have to wait for Fantastico upgrade to get latest version of WordPress. Thanks.


title: How to rearrange a pool of posts joined using two queries?

text: I need to select posts for two different months (current, past). As far as i know, it is not possible to pass `m` date parameter as an array of integer instead of an integer, so I am performing two different queries and getting all posts returned into the same array. The question is, how do i reorder the result pool of posts? Just pushing the second pool into the array returned by the first query isn't enough, as the `orderby` argument finds a _discontinuity_ in the joint of the two arrays. I tried using `usort` but I get an error saying that `You can't use WP_Post object as an array`. Any ideas? Thanks,


title: How much will mounting wp-content on a separate NFS server impact performance?

text: I'm thinking of using multiple web servers with a load balancer in a big WP install. The database will be on a separate server and that's the easy part. Trickier is files in blogs.dir, and to a lesser extent, the themes and plugins folders. So I plan to use a separate NFS server, either for all of wp_content or just for blogs.dir. But I'm worried about the performance impact of having these files available over the local network. If you have done this I would love to hear your thoughts on...   * Is it wise to share all of wp-content in this way? If not, how about just blogs.dir?   * How much of a performance trade-off was it?    * Do you have any suggestions based on your experience? Thanks.


title: Display agents (custom post type) alphabetically, except one who always shows last

text:
I would like to display all agents a-z, except there is one agent who should always show up last. Ideally I'd like the ordering to be done from the value of a custom field, dName. I was looking around it seemed that meta_query was the new best way to do this but haven't figured it out yet. Current code that shows 10 last agents created.               <?php $loop = new WP_Query( array( 'post_type' => 'agents', 'posts_per_page' => 10 ) ); ?>      Thanks for looking. edit 3/27/2011, working code               <?php      $loop = new WP_Query( array(          'post_type' => 'agents',         'orderby' => 'meta_value',     'meta_key' => 'rw_dname',         'order'=>'ASC',         'meta_query' => array(             array( 'key' => 'rw_dName' )             ),         'post__not_in' => array( '98' ),         'posts_per_page' => -1 ) );          $loop2 = new WP_Query( array(          'post_type' => 'agents',         'post__in' => array( '98' ) ) );?>     <?php     if($loop->have_posts() || $loop2->have_posts()) {          if($loop->have_posts()) { while($loop->have_posts()) { $loop->the_post();?>

             <?php              if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.             the_post_thumbnail();     }?>

              <?php     $meta = get_post_meta(get_the_ID(), 'rw_dname', true);     echo $meta; // if you want to show     ?>

     <?php             } //endwhile         }     ?>     <?php     if($loop2->have_posts()) { while($loop2->have_posts()) { $loop2->the_post();?>

         <?php      if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.     the_post_thumbnail();     }      ?>

          <?php     $meta = get_post_meta(get_the_ID(), 'rw_dname', true);     echo $meta; // if you want to show     ?>

     <?php             } //endwhile         }     ?>     <?php     } else {         echo 'No Agents.';     }     ?>


title: Why is ?doing_wp_cron being appended to my URLs

text: I'm finding this string appended to the end of my URLs sometimes:               /?doing_wp_cron      Does anyone know what it for? How can I remove it?


title: Hide reply button after moveForm is called

text: When user clicks on Reply button for a specific comment, how can I then hide the reply button under said comment? Do I have any access to the javascript onclick function that it calls?


title: Creating Job Tickets

text: I work in a small print shop and I want to digitize our workflow. I have found many plugins that are for support tickets, but I want to be able to create job tickets for printing jobs. I have found several of form plugins (Gravity, Formidable Pro) that make the form portion easy, but I need a way to create reports and view the data that is being stored in the db. I need the ability to create relational databases. Is this possible within wordpress?


title: How do I create a page for users to invite their facebook friends?

text: Do I need to use the Simple Facebook Connect plugin? or can I just use some facebook api code? Any help appreciated. The example i'm trying to replicate is the interface at lookbook.nu. Once you login with facebook, there is a nice page to invite your FB friends.


title: Export entries and multiple custom field meta to .csv?

text: First time poster. I'm trying to export a bunch of custom posts out to a csv file so I can easily import them into a new database. I've ran the native export to xml, but it's not the correct format I need. I need a column based format (ie. name, height, weight, etc.). I have a custom post that has several custom fields. I'm having issues combining them all down to one single row, rather than a new row for each meta type. Is there a way to write a sql query that has numerous selects for each meta type and combines them into one row with multiple columns? Here is what I have so far, which gives me one column and a new row for each meta type for the same Name               SELECT p.post_title AS Name     FROM wp_posts AS p     INNER JOIN wp_postmeta AS pm      ON p.ID = pm.post_id     WHERE p.post_type = 'prospects'     ORDER BY p.post_date DESC      Now how would I start adding columns (selects) for each meta type and combine them on one row:               AND (       SELECT m1.meta_value AS Height       WHERE m1.meta_key = '_height'     )     AND (       SELECT m2.meta_value AS Weight       WHERE m2.meta_key = '_weight'     )


title: How to change the Admin-bar's link target?

text: I'd like to change the admin bar's link target to "_blank". where what should I do? thanks.


title: How to attach Links into page/post or custom post type?

text: I need to create or use an existing 3rd party plugin to attach any links (one or more) to a page, post or post-type from the WP link manager:   **`http://example.com/wp-admin/link-manager.php`** I need a metabox with a dropdown or multiple select form element, and I have to link that Blogroll-Link with postmeta or something similar. Is there any plugin, snippet or solution for my task?


title: Alternate loop output every three posts (within the same original loop)

text:
I have a (relatively) tricky situation where my code requires changing the loop output every three posts, and within those three posts there are divs around two of the posts. The code below displays 6 posts and I would want to loop though a total of 24 posts, repeating this four times. Can anyone help? Thanks! **FIRST THREE**

         <?php the_title(); ?>         <?php the_content(); ?>

         <?php the_title(); ?>         <?php the_content(); ?>

         <?php the_title(); ?>         <?php the_content(); ?>

      **SECOND THREE**

         <?php the_title(); ?>         <?php the_content(); ?>

         <?php the_title(); ?>         <?php the_content(); ?>

         <?php the_title(); ?>         <?php the_content(); ?>


title: Dynamic Menu drops pages?

text: I've created a Dynamic Menu that highlights the selected page and colors for example the blog page "red" while the other links (home, about, contanct) remain white. My question is how can I make the Dynamic Menu work when say the blog goes to /blog/page/2/ and have the blog remain red instead of dropping the highlight? Here's the code for my menu.               < nav id="menu" class="mid" role="navigation">       < ?php wp_nav_menu( array( 'theme_location' => 'primary-menu' ) ); ?>     < /nav>      ` Then, I register the menu inside the functions.php               add_action( 'init', 'register_my_menu' );         function register_my_menu() {             register_nav_menu( 'primary-menu', __( 'Primary Menu' ) );         }      ` Here's the CSS that highlights the .current-menu-item ` #menu .current-menu-item a { opacity: 1.0; } ` This is when the Menu is Active on example.com/work ![menu active](http://f.cl.ly/items/2U3g1m141x09151F3V2K/menu-active.png) This is when the Menu is Active on the example.com/blog *just the first blog page though ![menu active blog](http://f.cl.ly/items/0X0g3c3I0n0K3V1H0Z1u/menu-active-blog.png) This is the menu when it switches to example.com/blog/page/2, example.com/work/showcase/website1337 ![menu not active](http://f.cl.ly/items/2N3j3R0K2d1e2g042B2P/menu-notactive.png) How, can I make it so that the Dynamic Menu detects that /page/2 is still associated with the parent page "/blog/, /work/" and is still highlighted like images 1 and 2? Thanks :3


title: How to reverse pagination for archive pages?

text: I would like to reverse the pagination order for the category archives and am wondering if anyone can offer any help. Basically what I am looking for is pagination to start with the oldest post first, but browsing to start with the newest post, in effect reverse pagination and then browsing starting with the highest numbered page first. I have tried reversing the sort order but does not work for 2 reasons   1. Displays page 1 first.   2. The posts _in_ the pages are in reverse order as well, oldest first. I tried the code offered here: Help With A Reverse Pagination Plugin I don't know if I was missing something but it appeared to just give the same results as reversing sort order. I also tried messing with modifying the `get_next_posts_link()` function, but came to the realization that would just effect browsing, not the actual pagination. A similar question is outlined here: How to implement pagination in backward way eg. first - 20 - 19 - 18 - ... - 3 - 2 - 1 - last This thread in a Drupal forum seems to illustrate additional reasons why this would be useful: http://drupal.org/node/143719 Another reason why I thought this would be useful would be because it would allow the user to see how much content is available without having to find the end, like having a reverse counter on a video so you know how long it is before beginning to watch. Does the solution to the problem require messing with rewrite rules? Any input would be appreciated.


title: What is user_trailingslashit() for?

text: What does the `user_trailingslashit()` function do, and when should I use it? How is it different from the `trailingslashit()` function?


title: Paginated WP_Query doesn't return 404's, even when posts don't exist

text:
I'm currently building a theme for a client, and one of their requirements is endless scrolling on a "Charts" page. They want this to be paginated, and the endless scroll to load the next page below the first, displaying the most popular 40 tracks posted on the site. To achieve this, I used a new WP_Query, which is running inside a custom page template. The endless scroll works by fetching the next page, and ending when it hits a 404. The problem is, extra pages continue to be loaded, even when there are no posts to display. The script never hits a 404 so it continues to load. Here is my query:               <?php     $temp = $wp_query;     $wp_query= null;     $wp_query = new WP_Query();      $wp_query->query('posts_per_page=8&meta_key=_count-views_all&orderby=meta_value_num&order=DESC'.'&paged='.$paged);           $count = 1; while ($wp_query->have_posts()) : $wp_query->the_post();      ?>
<?php echo $count; ?>
          //loop here          <?php $count++; endwhile; ?>               <?php content_nav( 'nav-below' ); ?>          <?php else : ?>          <?php get_template_part( 'no-results' ); ?>          <?php endif; ?>          <?php $wp_query = null; $wp_query = $temp;?>      The exact same query works without any issue on the index page and archive pages. It only seems to happen when its in a page template. I've been stumped by this for the last day or so, and I'm not sure as to why it's happening. Any ideas would be greatly appreciated :)


title: Adding Second Plugin Author

text: **Background:** I have a few plugins in the WordPress directory and have recently made the decision to team up with another individual to grow one plugin faster. I'm planning on adding him as a plugin author, but I want to be sure that if I do so there's no risk of me "losing control" of my plugin. **Question:** If I add another author, is there any way that the new author can remove me as plugin author? Can they upload the plugin with their username and password, or am I still the only one that can upload changes? I couldn't find anything on this topic, and I'd really hate to have my plugin stolen as I've become somewhat attached to it.


title: CPT's archive and single page not working

text:
I created a custom post type               function faq_func() {          $labels = array(         'name'                => _x( 'FAQs', 'Post Type General Name', 'rrrrr' ),         'singular_name'       => _x( 'FAQ', 'Post Type Singular Name', 'rrrrr' ),         'menu_name'           => __( 'FAQ', 'rrrrr' ),         'parent_item_colon'   => __( 'Parent Item:', 'rrrrr' ),         'all_items'           => __( 'All Items', 'rrrrr' ),         'view_item'           => __( 'View Items', 'rrrrr' ),         'add_new_item'        => __( 'Add New', 'rrrrr' ),         'add_new'             => __( 'New Item', 'rrrrr' ),         'edit_item'           => __( 'Edit Item', 'rrrrr' ),         'update_item'         => __( 'Update Item', 'rrrrr' ),         'search_items'        => __( 'Search Item', 'rrrrr' ),         'not_found'           => __( 'No items found', 'rrrrr' ),         'not_found_in_trash'  => __( 'No items found in Trash', 'rrrrr' ),     );     $rewrite = array(         'slug'                => 'faq',         'with_front'          => true,         'pages'               => false,         'feeds'               => false,     );     $args = array(         'label'               => __( 'faqs', 'rrrrr' ),         'description'         => __( 'FAQ Page', 'rrrrr' ),         'labels'              => $labels,         'supports'            => array( 'title', 'editor', ),         'hierarchical'        => false,         'public'              => true,         'show_ui'             => true,         'show_in_menu'        => true,         'show_in_nav_menus'   => true,         'show_in_admin_bar'   => true,         'menu_position'       => 5,         'menu_icon'           => get_bloginfo('template_directory').'/images/faq-icon.png',         'can_export'          => true,         'has_archive'         => true,         'exclude_from_search' => true,         'publicly_queryable'  => true,         'query_var'           => 'faq',         'rewrite'             => $rewrite,         'capability_type'     => 'page',     );     register_post_type( 'faqs', $args );          }          add_action( 'init', 'faq_func', 0 );      And a archive-faqs.php file:               <?php get_header(); ?>          <?php     $args = array( 'post_type' => 'faqs' );     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post();         the_title();         echo '
';         the_content();         echo '
';     endwhile;     ?>          <?php get_footer(); ?>      The problem is that my items not visible on the page. Where is the problem? UPDATE: I found the solution on wordpress.org: Note: In some cases, the permalink structure must be updated in order for the new template files to be accessed when viewing posts of a custom post type. To do this, go to Administration Panels > Settings > Permalinks, change the permalink structure to a different structure, save the changes, and change it back to the desired structure.


title: Frontend Image Upload

text:
I have the following code used at the top of my front end user profile page, everything works and displays fine except for the following problem .... If I upload an image and submit the form usermeta 'profile-image' updates correctly, however if I update the form without uploading this meta is deleted and looks like the update_usermeta call is still firing and making empty. Not sure what I am doing quite wrong, driving me nuts                               <?php                 global $current_user, $wp_roles;                 get_currentuserinfo();                      require_once( ABSPATH . WPINC . '/registration.php' );                 $error = array();                          if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'update-user' ) {                          if ( !empty($_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) {                         if ( $_POST['pass1'] == $_POST['pass2'] )                             wp_update_user( array( 'ID' => $current_user->ID, 'user_pass' => esc_attr( $_POST['pass1'] ) ) );                         else                             $error[] = __('The passwords you entered do not match.  Your password was not updated.', 'profile');                     }                          update_usermeta( $current_user->ID, $_POST['country'] );                     update_usermeta( $current_user->ID, $_POST['identity'] );                     update_usermeta( $current_user->ID, $_POST['workplace'] );                     update_usermeta( $current_user->ID, $_POST['public_email'] );                          $bio_summary = sanitize_text_field($_POST['bio-summary']);                     update_usermeta( $current_user->ID, 'bio_summary', $bio_summary );                          $web_link = esc_url_raw($_POST['web-link'], array('http', 'https'));                     update_usermeta( $current_user->ID, 'web_link', $web_link );                          $bio_longer = sanitize_text_field($_POST['bio-longer']);                     update_usermeta( $current_user->ID, 'bio_longer', $bio_longer );                          if ( count($error) == 0 ) {                         do_action('edit_user_profile_update', $current_user->ID);                         //wp_redirect( get_permalink() );                     }                 }                                    ?>                 <?php                  if ($_FILES['profile-image']['error'] ==0 ){                     $attach_id = ap_apply_online_image_handler();                     $attach_url = wp_get_attachment_url( $attach_id );                     update_usermeta( $current_user->ID, 'profile_image', $attach_url );                 } else {                     echo 'Upload error';                 }                 ?>      This the form ....                                               <form action="" method="post" enctype="multipart/form-data" >

                                             Profile Image:	                                                                               <input type="file" id="profile-image" name="profile-image" />                                                 <input type="text" id="profile-image-set" name="profile-image-set" value="<?php echo esc_url( get_the_author_meta( 'profile_image', $current_user->ID ) ); ?>" class="regular-text" />

                                             Country	                                                                               <?php $country = get_the_author_meta( 'country', $current_user->ID ); ?>                                             <select name="country" id="country">                                                 <option value="not specified" <?php echo ($country == "not specified")?  'selected="selected"' : '' ?>>Not Specified</option>                                                 <option value="australia" <?php echo ($country == "australia")?  'selected="selected"' : '' ?>>Australia</option>                                                 <option value="bangladesh" <?php echo ($country == "bangladesh")?  'selected="selected"' : '' ?>>Bangladesh</option>                                                 <option value="bhutan" <?php echo ($country == "bhutan")?  'selected="selected"' : '' ?>>Bhutan</option>                                                 <option value="brunei" <?php echo ($country == "brunei")?  'selected="selected"' : '' ?>>Brunei</option>                                                 <option value="cambodia" <?php echo ($country == "cambodia")?  'selected="selected"' : '' ?>>Cambodia</option>                                                 <option value="canada" <?php echo ($country == "canada")?  'selected="selected"' : '' ?>>Canada</option>                                                 <option value="china" <?php echo ($country == "china")?  'selected="selected"' : '' ?>>China</option>                                                 <option value="fiji" <?php echo ($country == "fiji")?  'selected="selected"' : '' ?>>Fiji</option>                                                 <option value="hong kong" <?php echo ($country == "hong kong")?  'selected="selected"' : '' ?>>Hong Kong</option>                                                 <option value="india" <?php echo ($country == "india")?  'selected="selected"' : '' ?>>India</option>                                                 <option value="indonesia" <?php echo ($country == "indonesia")?  'selected="selected"' : '' ?>>Indonesia</option>                                                 <option value="japan" <?php echo ($country == "japan")?  'selected="selected"' : '' ?>>Japan</option>                                                 <option value="korea" <?php echo ($country == "korea")?  'selected="selected"' : '' ?>>Korea</option>                                                 <option value="laos" <?php echo ($country == "laos")?  'selected="selected"' : '' ?>>Laos</option>                                                 <option value="malaysia" <?php echo ($country == "malaysia")?  'selected="selected"' : '' ?>>Malaysia</option>                                                 <option value="nepal" <?php echo ($country == "nepal")?  'selected="selected"' : '' ?>>Nepal</option>                                                 <option value="new zealand" <?php echo ($country == "new zealand")?  'selected="selected"' : '' ?>>New Zealand</option>                                                 <option value="myanmar" <?php echo ($country == "myanmar")?  'selected="selected"' : '' ?>>Myanmar</option>                                                 <option value="singapore" <?php echo ($country == "singapore")?  'selected="selected"' : '' ?>>Singapore</option>                                                 <option value="philippines" <?php echo ($country == "philippines")?  'selected="selected"' : '' ?>>Philippines</option>                                                 <option value="sri lanka" <?php echo ($country == "sri lanka")?  'selected="selected"' : '' ?>>Sri Lanka</option>                                                 <option value="taiwan" <?php echo ($country == "taiwan")?  'selected="selected"' : '' ?>>Taiwan</option>                                                 <option value="thailand" <?php echo ($country == "thailand")?  'selected="selected"' : '' ?>>Thailand</option>                                                 <option value="tibet" <?php echo ($country == "tibet")?  'selected="selected"' : '' ?>>Tibet</option>                                                 <option value="vietnam" <?php echo ($country == "vietnam")?  'selected="selected"' : '' ?>>Vietnam</option>                                                 <option value="united kingdom" <?php echo ($country == "united kingdom")?  'selected="selected"' : '' ?>>United Kingdom</option>                                                 <option value="united states" <?php echo ($country == "united states")?  'selected="selected"' : '' ?>>United States</option>                                                 <option value="other" <?php echo ($country == "other")?  'selected="selected"' : '' ?>>Other</option>                                             </select>

                                             How do you identify yourself?:	                                                                               <?php $identity = get_the_author_meta( 'identity', $current_user->ID ); ?>                                             <select name="identity" id="identity">                                                 <option value="not specified" <?php echo ($identity == "not specified")?  'selected="selected"' : '' ?>>Not Specified</option>                                                 <option value="writer" <?php echo ($identity == "writer")?  'selected="selected"' : '' ?>>Writer</option>                                                 <option value="translator" <?php echo ($identity == "translator")?  'selected="selected"' : '' ?>>Translator</option>                                                 <option value="publisher" <?php echo ($identity == "publisher")?  'selected="selected"' : '' ?>>Publisher</option>                                                 <option value="festival organiser" <?php echo ($identity == "festival organiser")?  'selected="selected"' : '' ?>>Festival Organiser</option>                                                 <option value="student" <?php echo ($identity == "student")?  'selected="selected"' : '' ?>>Student</option>                                                 <option value="literary agent" <?php echo ($identity == "literary agent")?  'selected="selected"' : '' ?>>Literary Agent</option>                                                 <option value="academic" <?php echo ($identity == "academic")?  'selected="selected"' : '' ?>>Academic</option>                                                 <option value="other" <?php echo ($identity == "other")?  'selected="selected"' : '' ?>>Other</option>                                             </select>

                                             Workplace:	                                                                               <?php $workplace = get_the_author_meta( 'workplace', $current_user->ID ); ?>                                             <select name="workplace" id="workplace">                                                 <option value="not specified" <?php echo ($workplace == "not specified")?  'selected="selected"' : '' ?>>Not Specified</option>                                                 <option value="university" <?php echo ($workplace == "university")?  'selected="selected"' : '' ?>>University</option>                                                 <option value="school" <?php echo ($workplace == "school")?  'selected="selected"' : '' ?>>School</option>                                                 <option value="literary organisation" <?php echo ($workplace == "literary organisation")?  'selected="selected"' : '' ?>>Literary Organisation</option>                                                 <option value="writers circle" <?php echo ($workplace == "writers circle")?  'selected="selected"' : '' ?>>Writers' Circle</option>                                                 <option value="other" <?php echo ($workplace == "other")?  'selected="selected"' : '' ?>>Other</option>                                             </select>

                                             BIO Summary (circa 300 words):	                                                                               <textarea name="bio-summary" id="bio-summary" rows="5" cols="30"><?php echo esc_textarea( get_the_author_meta( 'bio_summary', $current_user->ID ) ); ?></textarea>

                                             Your Web Link:	                                                                               <input type="text" name="web-link" id="web-link" value="<?php echo esc_url( get_the_author_meta( 'web_link', $current_user->ID ) ); ?>" class="regular-text" />

                                             Longer BIO CV including publications
(optional):	                                                                               <textarea name="bio-longer" id="bio-longer" rows="5" cols="30"><?php echo esc_textarea( get_the_author_meta( 'bio_longer', $current_user->ID ) ); ?></textarea>

                                             Email Display:	                                             <?php $public_email = get_the_author_meta( 'public_email', $current_user->ID ); ?>                                                                                <input type="checkbox" name="public_email" id="public_email" value="yes" <?php echo ($public_email == "yes") ? 'checked="checked"' : '' ?> /><?php _e(' I agree to my email being publically displayed.') ?>

                                          <?php //do_action('edit_user_profile',$current_user); ?>
                                         <?php echo $referer; ?>                                         <input name="updateuser" type="submit" id="updateuser" class="submit button" value="<?php _e('Update', 'profile'); ?>" />                                         <?php wp_nonce_field( 'update-user' ) ?>                                         <input name="action" type="hidden" id="action" value="update-user" />
                                      </form>      Thanks John


title: How to automatically add and show(open) all the product attributes?

text: Is there a way when adding a new product that all available Attributes would automatically be added to this product and oppened/expanded so that when I'm adding new product I don't have to first add them and then click on the headers to expand them? Hope this image clears what I want to achieve: ![enter image description here](http://i.stack.imgur.com/D0W4I.jpg) Sure, I can manually trigger the click on "Expand all" button with jQuery, but am having trouble finding the place where to add this piece of jQ code. More important to me is the former question though, so any push in the right direction is much appreciated. **edit:** I managed to do the open(show) part of the problem by adding the line:               jQuery('.expand_all').trigger("click");      in the themes/mytheme/admin/admin-functions.php file in siteoptions_admin_head function. But the first qq still remains. I did find a work around though - I could first add one product and add every existing attribute to it, and when making new products I would make a copy of this product and them add/remove attributes I don't need. This however would not work dynamically if attributes change, so its not much of an improvement.


title: Define WP_DEBUG conditionally / for admins only / log errors (append query arg for all links?)

text: I'm developing a site on a server that the client has access to as well and what I'd like to do is show `WP_DEBUG` only for administrators. Referencing Yoast's article on a way around this:               if ( isset($_GET['debug']) && $_GET['debug'] == 'true')         define('WP_DEBUG', true);      would show `WP_DEBUG` only for URLs that have `?debug=true` attached to them, like `http://domain.com/?debug=true` I was thinking that the Debug Bar might hold some of this information in there by default (whether or not `WP_DEBUG` is turned on), but I was thinkin craziness as I don't believe that is the case. So, what I was thinking would be useful, would be a check for the current user (having the `manage_options` capability and then run links through `add_query_arg()`:               function zs_admin_debug() {         if (!current_user_can('manage_options')) {             add_query_arg('debug','true');         }     }      but what I'm unsure about is - is there a hook I can use to effect all links on a site with this? This way, admins always see debug which I thought would be extremely useful. Thanks for any help as always!


title: Automatic connect wordpress to facebook with featured image?

text: i want when i publish any post then it show my facebook with feature image. because most of plugin don't show feature image. it's show other image. please tell me how i can do it except - simple connect facebook and add link to facebook.plugin.i already use sample connect facebook plugin but it's not publish automatically. i also use dlvr.it and twitterfeed.com . it's post automatically but don't show featured image. it's show previous post featured image. how i can solve this problem. my site http://www.desyfun.tk


title: avatar displays outside of targeted area

text:
I use this micro message system script and I want to add an avatar to it, however, my lack of PHP knowledge is making this difficult. The code I use to display an avatar is:               userphoto_thumbnail($user_info, $before = '', $after = '', $attributes = array(width => '40', height => '40'), $default_src = '')      And I want to inject this avatar to this part of the message script (inside a loop):               $r = $r . '
post_ID . '-' . $count . '" ' . $style . '>';     $r = $r . 'display_name . ' (' . $user_info->user_login . ')">' . userphoto_thumbnail($user_info, $before = '', $after = '', $attributes = array(width => '40', height => '40'), $default_src = '') . '	';     $r = $r . '' . wpam_get_message($reply, $user_info, $options, 2) . '	';     $r = $r . '
';      If you look at the second line, you will see how I added it there. However, this does not return the avatar where it should be. It appears outside everything else. Maybe because it returns a string rather than data? I am not sure as I am only just familiarising myself with PHP terminology. **EDIT:** Just to clarify, on the HTML output, the avatar images appear outside of the table, when they should be inside the `<td style="padding:10px 0 10px 10px; width:40px;">` tag. **EDIT 2:** Someone pointed out that `userphoto_thumbnails prints out the image, while I am trying to concatenate it. Its being printed out when I'm creating the string, so it's appearing in the wrong place. So I tested:               echo '
post_ID . '-' . $count . '" ' . $style . '>';     echo 'display_name . ' (' . $user_info->user_login . ')">' . userphoto_thumbnail($user_info, $before = '', $after = '', $attributes = array(width => '40', height => '40'), $default_src = '') . '	';     echo '' . wpam_get_message($reply, $user_info, $options, 2) . '	';     echo '
';      But this did not work either. I am certain that I have not added the avatar code to the script correctly, can you assist?


title: slideshow is not showing in a post call with ajax

text:
this is the code I use to call ajax posts in the same page. It's works fine but when the post is load the slideshow in the post (add via short code) is not showing.... the ajax call                 jQuery('#menu-profilo > li > a').click(function(event){                      //This keeps the href from reloading the page                 event.preventDefault();                      //grab the page link                      var page = jQuery(this).attr('href');                      jQuery('#slideshow').html ('

loading

')                 //use the grabbed link in the load function                 .load(page+' .post_content').fadeIn(2000)                         });      This is the post load in ajax : https://www.dropbox.com/s/za0jwx7sdm2z6zx/post.jpg the post load normally (no ajax call) works fine. The problem is the jquery plugin royalslider ( or other plugin, is the same) that seems not working. here firebug image: https://www.dropbox.com/s/iui14sxqm4xwa1d/post2.jpg the white space is the the royal slider section.... How Can I fix this? I mean when I load a post via ajax call to show the post and the jquery plugin...


title: Searching Custom Fields

text:
I would like to know how I can set up a form (separate from the normal search form), that will allow me to search through a particular custom post type. Within my defined custom post type I have 2 fields. In the search the user should be able to fill in any of them, in order to narrow down his search. Any examples of code that could accomplish this? This is what I've tried to do till now. The house name is stored as the custom post's title, while city and state are two custom fields. This search form is not working as it is.

                  <?php                  global $wp_query;                  $housename=mysql_real_escape_string($_GET['housename']);                  $city=mysql_real_escape_string($_GET['city']);                  $state=mysql_real_escape_string($_GET['state']);                          $args = array(                     'post_type' => 'house',                     'post_title' => $housename,                     'meta_query' => array(                             array(                                 'key' => 'house_city',                                                   'value' => $city                                                         ),                             array(                                 'key' => 'house_state',                                                   'value' => $state                                                        )                       )                                   );                  $houses_found = new WP_Query( $args );                    if ( $houses_found->have_posts() ) :                 while ( $houses_found->have_posts() ) : $houses_found->the_post();                     echo '
'.get_the_title().'
';                      endwhile;             endif;                  wp_reset_postdata();                  ?>                  <form method="get" id="searchform" >                 <?php _e( 'Name' ); ?>                 <input type="text" class="field" name="housename" id="housename" />                 <?php _e( 'City' ); ?>                 <input type="text" class="field" name="city" id="city" />                 <?php _e( 'State' ); ?>                 <input type="text" class="field" name="state" id="state" />                              <input type="submit" class="submit-2" name="submit" id="searchsubmit-2" value="<?php esc_attr_e( 'Search' ); ?>" />             </form>                           <?php while ( have_posts() ) : the_post(); ?>                          <?php get_template_part( 'content', 'page' ); ?>                      <?php endwhile; // end of the loop. ?>


title: How can I remove <br /> line breaks from manually formatted HTML?

text:
I see a lot of posts here and elsewhere having trouble adding line breaks for some reason, but I'm trying to remove them. I'm new to WP, and I see that when editing in "HTML" mode the text is rendered in paragraph tags for double line breaks, and `<br>` for single line breaks, without the need to write the HTML. This is nice, but when I format the code manually by adding the `<p>` tags myself, I still get `<br>`s in the output. Example input in the editor:
     I don't want     HTML line breaks.
      My output:
     I don’t want
     HTML line breaks.
      I could remove all the line breaks in the source input, but that's really quite tedious and makes things harder to read in the editor. Is there any way to make WP ignore line breaks (not create `<br>`) when the content is already wrapped in `<p>` tags? I'm using the defaults for everything on a new installation.


title: wpdb prepare sql problem

text: I have problem with wpdb prepare and sql query. If i run the query directly thru wpdb->get_results it's working fine. Here it is:               $alabala_sql = $wpdb->prepare(         "         SELECT *          FROM $wpdb->posts p          INNER JOIN $wpdb->term_relationships tr            ON p.ID = tr.object_id         INNER JOIN $wpdb->term_taxonomy tt            ON tr.term_taxonomy_id=tt.term_taxonomy_id          inner join  $wpdb->terms t            on t.term_id=tt.term_id and t.slug='$curPageId'         WHERE            p.post_title LIKE '$getChar%'                   AND p.post_type = 'filmi-i-serialii'            AND p.post_status = 'publish';         "     );     /*Make sql query to take posts*/     $eventsPosts = $wpdb->get_results($alabala_sql);      But it doesn't work. Also i tried that way:               $alabala_sql = $wpdb->prepare(         "         SELECT *          FROM $wpdb->posts p          INNER JOIN $wpdb->term_relationships tr            ON p.ID = tr.object_id         INNER JOIN $wpdb->term_taxonomy tt            ON tr.term_taxonomy_id=tt.term_taxonomy_id          inner join  $wpdb->terms t            on t.term_id=tt.term_id and t.slug=$s         WHERE            p.post_title LIKE $s%                   AND p.post_type = 'filmi-i-serialii'            AND p.post_status = 'publish';         ", $curPageId, $getChar     );     /*Make sql query to take posts*/     $eventsPosts = $wpdb->get_results($alabala_sql);      But again it didn't worked. Please tell me where is my mistake ? Both vars are strings. Regards.


title: How to use search_columns in WP_User_Query?

text: I am using `WP_User_Query` to search use by name, ID, email etc... In that case I need to use `search_columns` field to pass ID or email of user. What i am doing is               $my_users = new WP_User_Query(                          array(                              'role' => $role,                             'offset' => $offset ,                             'number' => $number,                             'fields' => 'all',                             'search_columns'=> array( '5','', 'johndoe_dd@yahoo1.com','',''),                             //'search_columns'=> $search_columns_array,                             'meta_query' => $meta_query_array,                         ));      For reference http://wpsmith.net/2012/wp/an-introduction-to-wp_user_query- class/


title: How to get a localized version of WordPress from a repository?

text: I'm setting up my basic skeleton / boilerplate I want to use for all wordpress projects. I follow Mark Jaquiths approach and include WP as a submodule. He gets it from https://github.com/WordPress/WordPress. Many of my clients are from Germany and require German language files for administration. Is there a way I can include the localized files into my skeleton git repository?


title: get_the_post_thumbnail() doesn't taking style attribute

text: This seems to be an easy one but its giving me quite a hard time. get_the_post_thumbnail() suppose to take attribute as an array. Well, everything working right but when i pass style attr its doesn't work.               $attr = array(                                     'title' => get_the_title(),                                     'alt' => get_the_title(),                                     'style' => 'float:left'                                 );          $thumb = get_the_post_thumbnail($post->ID, 'large-thumb', $attr);      The title and the alt attribute is set up nicely though but style attribute is missing in images. FYI: I am showing the thumbnail in rss feed.


title: How to order posts in wp_query by the user role (2 roles in array)

text: I'm using the following code from this answer: How can I get the last posts by user role ?               <?php     $friends = get_users( array( 'role' => 'friends' ) );     $friend_ids = array();          foreach( $friends as $friend )          $friend_ids[] = $friend->ID;          $news = new WP_Query( array( 'author' => implode( ',', $friend_ids ), 'post_type' => 'news', 'paged' => get_query_var('paged') ) ); ?>      I've added another WP role to the array so it grabs both. For example:               $friends = get_users( array( 'role' => 'friends, enemies' ) );      Is it possible to now order the posts somehow by the role? so it displays all the friends first, followed by all the enemies etc. At the moment, it lists them all mumbo jumbo as expected. EDIT: sorry, probably shouldn't have set up another question, not sure why I did that. Is it possible to do this without using custom fields? The problem I've found with custom fields is that If a user changed roles (due to membership levels) then the posts would not be ordered correctly until the post (from the author who changed) was saved with it's new custom field value.


title: When would you use $_post instead of $post?

text: I've seen some examples that use $_post instead of $post. What's the difference and when would you use $_post instead of $post? Example:               if (have_posts()) :     while (have_posts()) : the_post();     if(!in_category("some-category", $_post )) { do_something(); }


title: plugin suggestion for barcode

text: I am having vendor address field for each post using custom field plugin. In single post page.I want to generate bar code.When its scanned by mobile phone.It should display the address of the vendor in text format. Is there any existing plugin.Or any gold suggestions are appreciated. Thanks in advance !


title: 4 single sites VS multisite wordpress

text: We're currently running a multisite wordpress install for 4 sites. Running into problems with pretty much every plugin ever made (mostly issues with user account creation etc), I'd really like to switch over to 4 single installs. However, I'm wondering if the server resource usage will be significantly affected. As far as I see it, the overhead of running the multisite management on top of these blogs outweighs any losses we would see from running them separately, especially when we're only talking about 4 sites. Can anyone offer some more insight here? Thanks in advance