title: Is it possible to have a network of BuddyPress sites, a-la WordPress MU, with single-sign-on?

text: We're looking to create a network of BuddyPress sites that share a common design, a common theme and some common content, but the same userbase across all network sites. Each user will 'belong' to a network site, so whilst people can browse the London, New York and Sydney editions, they will need to 'belong' to one of these sites:   * ldn.mainsite.com   * nyc.mainsite.com   * syd.mainsite.com Each subdomain-based BuddyPress site will feature different content depending on the location to which the site is based. Logging in to the network will mean they are logged in across all of the sites (SSO). Is this possible with WordPress, BuddyPress and/or WordPress MU, or will this require some significant work on top of the existing code? (Or, would it be better doing this from scratch on top of something else?)


title: Wordpress and simple forums

text: This might be an annoying question, since there are some pretty good answers to this question, but they are 9 months old, so please but bare with me. I would like to have some input to point me to the right direction. I'm looking to integrate a simple forum for a Wordpress project. The forum must haves:   * Simple threads, similar to the WP threaded comments system.   * Ability to display only the forum login page as forum front page.   * Ability to show only the forum the user is registered to, or the forum the admin assigns the user to. In a way the flow is:   Click on forums page > Login > Browse only one specific forum.   * Ability to show some info about each of the users: phone, email, etc.   * Ability to register without going to wp-admin What I need is way less then what vBulletin or phpBB or even SimplePress provide, i just need a place for users to chat on specific topics and get in touch. I've tried to use bbPress, as it is as close as it gets to what I wanted, but they don't have the ability to close forums for specific groups of users, so maybe one can point me to the right software of combination of plugins. Thanks in advance.


title: Custom Post Types, or completely custom?

text: I'm currently in the process of redeveloping my website. I've decided to use WordPress as its CMS, rather than coding everything from scratch. It's a fishkeeping website, consisting of species profiles; plant profiles; fossil species profiles; articles; news posts and blog posts. My original idea was to create plugins for each of those (excluding articles/news posts/blog posts as I can just add post categories), with each plugin creating a new database table and adding the relevant admin menus (create, view/amend). I've stumbled across custom post types today, and I'm now wondering if they'll do the job for me? It would be ideal if they could - save me a lot of time and offer some reasonably useful functionality that I probably won't bother to code if I do it the other way (time constraints). The species profile is the most complex aspect of the site. It will have ~20 fields. A few of the fields will need to be lookup fields, i.e. category which will allow the user to select from a list. A few of the fields will need to be array values, i.e. one textbox called "ph_min" and one called "ph_max" which are stored in the DB as a serialized array. Fields following these array fields will require a custom TinyMCE button to insert BBCode such as [ph_min] (this will allow us to write: "keep these fish at [temp_min] if possible, but don't use water above [temp_max]" whilst having a conversion button at the top of each profile). Are Custom Post Types flexible enough to do all of the above for me, or should I just take it back to basics and write my own admin pages and database tables?


title: Disabled trackbacks in Wordpress but I am still receiving trackbacks

text: I have disabled trackbacks in Wordpress back end discussion panel but I am still receiving trackbacks. How can I ensure that I do not receive any trackbacks?


title: Using media-upload.php to upload mp3 via custom fields

text: I'm trying to use the Thickbox file upload dialogue with a custom field to allow the user to upload an mp3. What I want to do is to grab the URL of the uploaded mp3 and save it as postmeta (saving the data when I've got it isn't a problem, but getting what I need is!). I've got the code to make this work with an image                jQuery(function($){          var formfield = null;          $('#rps_upload_mp3').click(function() {         $('html').addClass('Image');         formfield = $('#rps_mp3_url').attr('name');         tb_show('', 'media-upload.php?type=image&TB_iframe=true');         return false;     });          window.original_send_to_editor = window.send_to_editor;     window.send_to_editor = function(html) {              var fileurl;              if( formfield = !null ) {                  fileurl = $('img', html).attr('src');             $('#rps_mp3_url').val(fileurl);             tb_remove();                  $('html').removeClass('Image');             formfield = null;              } else {                  window.original_send_to_editor(html);              }          }           });      Obviously the line that reads `fileurl = $('img', html).attr('src');` will only get the `src` of an image, not an mp3, but I can't figure out where the script is grabbing the source of this image from and I don't know how to target the uploaded mp3. Thanks in advance!


title: Adjust query on single

text: I am building an event manager. One of the template files I have is events- single.php which displays single events. At the bottom of this I have next and previous events using `next_post_link` and `previous_post_link`. The problem is that those functions proceed through the events in order of **published date** rather than **event date**. (I have a meta key `_fulldate` setup on the CPT for this). When I was building events-archive.php file I overcame a similar problem by doing something like this               $query = new WP_Query( array (      'post_type' => 'events',      'orderby' => 'meta_value',      'meta_key' => '_fulldate',      'order' => 'ASC')     );      However when I try that on events-single.php it makes all the events display on the page. Ultimatly I want events-single.php to behave like a single page but then allow me control over the query as above. Is this possible or will I have to do a second loop for the Previous and Next links


title: WP_Query Pagination on single-custom.php

text:
## What I am looking to do: Setup `WP_Query` pagination in a single-custom-post-type.php template file ## What I have done 1) Created a post type called "authors". Each post within that post type is an individual author. 2) Standard edit post screen pages contain a dropdown which lists all posts (authors) from the authors custom post type. 3) Created a single-authors.php template which query's all posts with the author metadata from the dropdown, so the result is a list of posts that have the same author assigned to them (kind of like an archive):               <?php          // set the "paged" parameter (use 'page' if the query is on a static front page)     global $paged;          /*We need this here to add and maintain Pagination if Template is assigned to Front Page*/     if ( get_query_var( 'paged' ) ) {         $paged = get_query_var('paged');     } elseif ( get_query_var( 'page' ) ) {         $paged = get_query_var( 'page' );     } else {         $paged = 1;     }          $args = array(         'posts_per_page'    =>  10,         'meta_key'          => 'author_select',         'meta_value'        => $author_id,         'paged'             => $paged,     );          $temp = $wp_query;     $wp_query = NULL;          $wp_query = new WP_Query($args);          ?>          <?php if( $wp_query->have_posts() ) : ?>             <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>         <?php // Successfully outputs the results of the above query, so I've omitted the code from this example. ?>              <?php endwhile; ?>
          <?php if( get_adjacent_post( false, '', true ) ) { ?>             <?php previous_post_link( '< %link' ) ?>         <?php } ?>              <?php if( get_adjacent_post( false, '', false ) ) { ?>             <?php next_post_link( '%link >' ) ?>         <?php } ?>
     <?php endif; ?>          <?php         $wp_query = null;         $wp_query = $temp;         wp_reset_query();     ?>      ## What I am stuck on The pagination links do not appear. I have done some research and have found that they use the `$wp_query` variable, however when I changed my query variable to `$wp_query`, the links appeared, but when clicked did nothing. Any idea where I am going wrong? ## Edit: To answer some of your questions, my query successfully outputs the posts that I am querying, $author_id already has a value that I did not include in this code snippet. Similarly, I left out the actual content output within the while loop because that part is not the issue. The issue is that I need to paginate the content that already exists on this single post. The purpose of this functionality was to allow posts to have custom authors (outside of the built in Users system) and this template's purpose is to output all of the posts for a given author (which is already working).


title: Placing auto-complete results Where I want them in my HTML

text: I have some code in my functions.php that creates a list of auto-suggested items based on a form's text:               <?     add_action('wp_enqueue_scripts', 'se_wp_enqueue_scripts');     function se_wp_enqueue_scripts() {         wp_enqueue_script('suggest');     }          add_action('wp_head', 'se_wp_head');     function se_wp_head() {     ?>     <script type="text/javascript">         var se_ajax_url = '<?php echo admin_url('admin-ajax.php'); ?>';          jQuery(document).ready(function() {     jQuery('#love-input').suggest(se_ajax_url + '?action=se_lookup', {         onSelect: function() {             thevalue = this.value;             thevalue = thevalue.split(' (');             jQuery('#love-input').val(thevalue[0]);         }     });     });          </script>     <?php     }          add_action('wp_ajax_se_lookup', 'se_lookup');     add_action('wp_ajax_nopriv_se_lookup', 'se_lookup');          function se_lookup() {         global $wpdb, $wp_query;              $search = like_escape($_REQUEST['q']);              $query = 'SELECT ID,post_title FROM ' . $wpdb->posts . '             WHERE post_title LIKE \'%' . $search . '%\'             AND post_type = \'loves\'             AND post_status = \'publish\'             ORDER BY post_title ASC';         foreach ($wpdb->get_results($query) as $row) {             $post_title = $row->post_title;             $id = $row->ID;          $post_count = $wpdb->get_var("                     SELECT COUNT(*) FROM $wpdb->postmeta                     WHERE post_id = $id                     ");             echo $post_title . ' (' . $post_count . ')' . "\n";         }         die();     }          ?>      I'm trying to place this box under the text field, but the output it always a with a class "ac_results" that appears at the very bottom of the html. Problem is I don't know where this and class are coming from?? It's not in admin- ajax.php, and I'm not calling any other files.. or does wordpress do this automatically? How Can I tell it exactly where to appear in my html?


title: Create a "Dummy" parent page for a hierarchy in page listing?

text: **Is it possible to set up a "dummy" page - just a page title that appears in the page listing, and a page that is not editable and doesn't have a slug?** This is more of a hypothetical question, as I don't know where to start with code or determine the best way to go. I'd like to have the option to set up such a parent/child hierarchy in the page listing so that the child pages fall under the parent, but the parent page is just a placeholder and not a real page. The reason: for users without lots of experience in WordPress, it's helpful to organize pages in a parent/child hierarchy - especially if there are lots of pages - so that that related pages are more organized in the page listing. Users can also visualize building a menu, too, if child pages are organized under a parent. The problem is the parent page can be editable and not part of the established page content, and in my experience, this leads to user confusion. I can use a function to remove the editor for a specific page and use entires in robots.txt to not index the dummy parent, but that means changing those for a new parent. And that parent page still has a slug, even if blocked wit _So is there a way to create a function that creates a page title and with the ability to assign child pages, but have the parent page unopenable, uneditable and not have a slug?_ ![enter image description here](http://i.stack.imgur.com/hAlh5.png)


title: How to check if a categoryID exists in a theme options page

text: I have tried to make a theme options page (starting with a sample theme options page from themeshaper) and I want to check if a comma separated list of categories is valid. Remove duplicates, remove non-existing categories, but it doesn't work. :( It is deleting the last value if I check with empty():               function theme_options_validate( $input ) {         if ($input['slidercats'] != '') {               $slidercats = $input['slidercats'];             $slidercats_array = explode( ',', $slidercats );             $slidercats_array = array_unique( $slidercats_array );             $slidercats_array = array_map('intval', $slidercats_array );                  foreach($slidercats_array AS $i => $value)               {                   $cat = get_category($i); // cat_ID                 if ( empty( $cat ) )                     unset($slidercats_array[$i]);             }                    $input['slidercats'] = implode(",", $slidercats_array);                   }              return $input;     }      http://pastebin.com/xR1aq6mD And it is deleting all values but one with `term_exists(id, 'category');`               function theme_options_validate( $input ) {         // global $select_options, $radio_options;              // Change to integer         $input['slidercount'] = (int)$input['slidercount'];         if ($input['slidercount'] < 1 || $input['slidercount'] > 50)             $input['slidercount'] = 10;              // Make array from string, remove duplicates, change all values to integer, remove non existing categories, make string from array         if ($input['slidercats'] != '') {               $slidercats = $input['slidercats'];             $slidercats_array = explode( ',', $slidercats );             $slidercats_array = array_unique( $slidercats_array );             $slidercats_array = array_map('intval', $slidercats_array );                  foreach($slidercats_array AS $i => $value)               {                   $cat = term_exists($i, 'category'); // cat_ID                 if ( ! $cat )                     unset($slidercats_array[$i]);             }                   $input['slidercats'] = implode(",", $slidercats_array);                   }              return $input;     }      http://pastebin.com/edx8F1YZ The problem is the `foreach`, but I'm stuck and no php guru. Maybe someone could give me a hint how to solve this ...


title: username in rewritten URL, howto use it in a template

text: on my site user profiles can be accessed on /user/xxx. Now i created a rewrite rule and all user links are handled on the template page. But how can i access the xxx(user) in the template file? The page should display the profile of xxx. Rewite rules:               add_filter( 'query_vars', 'wpleet_rewrite_add_var' );     function wpleet_rewrite_add_var( $vars )     {     $vars[] = 'user';     return $vars;     }     add_rewrite_tag( '%user%', '([^&]+)' );     add_rewrite_rule(     '^user/([^/]*)/?',     'index.php?user=$matches[1]',     'top'      );      add_action( 'template_redirect', 'wpleet_rewrite_catch' );      function wpleet_rewrite_catch()      {      global $wp_query;           if ( array_key_exists( 'user', $wp_query->query_vars ) ) {         include (TEMPLATEPATH . '/user-profile.php');         exit;     }     }


title: Category count inside the link

text: Is it possible using `wp_list_categories` set count of post in category in the `href`?


title: How to include a file for admin and 2 pages without being loaded on other parts of the site?

text: I need to include a file twice. once in admin, another in its component.               if( is_admin() || is_the_component() ) require...       But, there's a big function in the class for registering stuffs is only needed at plugin activation. What's more, I want to make the class a super GLOBAL.               $GLOBALS['user_data'] = new My_Class();      This makes me feel it's a bit too heavy to carry the big registering function all over the site. Should I re-arrange the class to exclude the function?


title: List the authors that have written posts in a category

text: How can I list the authors of posts in a category in WordPress? On my blog have three authors and I want to list who written the posts in a category. For example:               CAT NAME: INTERNET     AUTHOR: JOHN, DOE, ALEX     CAT NAME: TECH         AUTHOR: JOHN     CAT NAME: CODE         AUTHOR: ALEX


title: Display commenter's registration date on comments?

text: Is there any way to display a user's (registered) registration date on the comment. Lets say i have a written an article, registered users A, B, C and D left a comment on my article. I can display comment date, commenter's name and email by default . I want to display the commenter's registration date also. How can this be done?


title: How to list posts that appear in two categories

text: I would like to list all posts that appear in the current category being viewed that are also posted to a second category. Example Pictures : LINK For instance, a listing of the common posts between the Headline category and the Media category if Media is currently being viewed.


title: Need help "sanitizing" a custom function that pulls category slug into body class

text: Not sure if "sanitizing" is really the correct phrase to use for this but it was the best one I could think of...anyways, here is the problem: My function works great like so...               // add category id to body & post classes      function category_id_class($classes) {         global $post;         foreach((get_the_category($post->ID)) as $category)             $classes [] = $category->cat_name;             return $classes;     }     add_filter('post_class', 'category_id_class');     add_filter('body_class', 'category_id_class');      That works great until the user inputs a category such as "Category 1" with a _space_. Spaces are obviously not desirable as CSS classes so if we could maybe just have a dash added to replace the space that would be perfect - just not sure how to accomplish that? Thanks!


title: Using a portfolio_category slug in wordpress URL

text: I won't lie - I don't know php but I enjoy digging around trying to find ways to customize themes so that they behave how I want them to. Any help would be very much appreciated. What I am trying to do: There is a section in a wordpress theme I am using which allows you to publish portfolios. The URL for any portfolio page would be: **mysite.com/portfolio/example-portfolio** When creating a new portfolio, you are given the option to assign a portfolio category, much in the same way as when you create a new post. I would like to be able to have my portfolio URL's appear like this: **mysite.com/portfolio-category/example-portfolio** I have highlighted an area of code I suspect might be editable to allow for this, but that is where my adventure sadly ends :( Here is the code:               function mysite_post_types() {         register_post_type('portfolio', array(             'labels' => array(                 'name' => _x('Portfolios', 'post type general name', MYSITE_ADMIN_TEXTDOMAIN ),                 'singular_name' => _x('Portfolio', 'post type singular name', MYSITE_ADMIN_TEXTDOMAIN ),                 'add_new' => _x('Add New', 'portfolio', MYSITE_ADMIN_TEXTDOMAIN ),                 'add_new_item' => __('Add New Portfolio', MYSITE_ADMIN_TEXTDOMAIN ),                 'edit_item' => __('Edit Portfolio', MYSITE_ADMIN_TEXTDOMAIN ),                 'new_item' => __('New Portfolio', MYSITE_ADMIN_TEXTDOMAIN ),                 'view_item' => __('View Portfolio', MYSITE_ADMIN_TEXTDOMAIN ),                 'search_items' => __('Search Portfolios', MYSITE_ADMIN_TEXTDOMAIN ),                 'not_found' =>  __('No portfolios found', MYSITE_ADMIN_TEXTDOMAIN ),                 'not_found_in_trash' => __('No portfolios found in Trash', MYSITE_ADMIN_TEXTDOMAIN ),                  'parent_item_colon' => ''             ),             'singular_label' => __('Portfolio', MYSITE_ADMIN_TEXTDOMAIN ),             'public' => true,             'exclude_from_search' => false,             'show_ui' => true,             'capability_type' => 'post',             'hierarchical' => true,             'rewrite' => array( 'with_front' => false, 'slug' => 'products' ),      I have worked out how to change 'mysite.com/ **portfolio** /example-portfolio' to 'mysite.com/ **products** /example-portfolio' (on the last line in the example) but I don't want to stop there! Since you can categorize the portfolios I would like to take advantage of this in the URLs which are generated. This is surely possible with not too much work involved, and I would be very grateful if somebody with more php knowledge than myself (which doesn't take much!) could let me lean on them for a solution thanks


title: Creating a better multi-site search experience

text: We have a multi-site wordpress blog with the following characteristics:   1. "home" site [site #1] with dozens of pages, some custom post types, our own blog, etc.   2. custom partner sites [site 2-N] each with their own customized blog and (at least) an "about us" page. Mostly a simple set of pages & posts. I'd like to build a good search experience for users who are trying to find a particular partner's pages:   * search for site 1 content has high quality (default wordpress search doesn't seem to be very good)   * search also returns pages from sites 2-N, only for blogs that are public   * specific custom fields of posts on sites 2-N are indexed   * if content is found on site 2-N's about page, the site's home page is suggested in a separate area. ie. this is "partner results" rather than "content results"   * we don't need to index tags, categories, etc. in fact based on how we are (ab)using them they might get in the way of good search I am technical and can build something using whatever APIs are available, for instance Google custom search, etc. But I'd love it if there is already a network-wide search plugin that will let me configure this (or at least give me a head start and APIs.) Commercial plugins are okay. Are there any good solutions or is custom development the best option?


title: Slideshow with thumbnails

text: I have a simple demo here to illustrate my problem. http://www.ttmt.org.uk/wordpress/ It's a slideshow of images that is using the cycle plugin - http://jquery.malsup.com/cycle/ The images are added directly to the content of the page and the div containing the content is passed to the cycle function. My problem is I would like to have thumbnails of the images underneath. I have seen a few WordPress plugins that do this but they ALL need the images to be the same dimensions for it to work. My images have the same height but the width are different. Is there a plugin thats can do this with images that are different widths. If not can anyone recommend how I might do this. I really hope this is at least possible - it seems so simple but i can't find a solution anywhere.


title: Create a dashboard-style site (not Wordpress dashboard) - is there a theme?

text: Trying to figure out if there are any themes out there I could use to create a dashboard web site. (basically want to create something to point to all the ancillary services I use - backup, analytics, stock images, web host, etc.) It is practically impossible to Google an answer - because once you use the term dashboard along with Wordpress every result refers to the Wordpress admin dashboard (whereas I'm just looking to create a site/page) Anyone know of a dashboard-style theme?


title: Next and previous link in custom post type in the same taxonomy term

text: I have a custom post type `name->('portfolio')`, with a taxonomy name `'portfolio_category'`. What I want is to add next and previous links on its single page file which is single-portfolio.php. When I click either of the links, it should redirect to the next or previous post in the same post type and in the same taxonomy term. I used `next_post_link()` and `previous_post_link()` but it seems that it only works in single post but not in single custom post type.. Any suggestions will greatly be appreciated.


title: Cannot login to Wordpress site after changing .htaccess for security purposes

text: This is the original .htaccess on my local computer                   # Block the include-only files.         RewriteEngine On         RewriteBase /         RewriteRule ^wp-admin/includes/ - [F,L]         RewriteRule !^wp-includes/ - [S=3]         RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]         RewriteRule ^wp-includes/theme-compat/ - [F,L]              # BEGIN WordPress         <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /         RewriteRule ^index\.php$ - [L]              # uploaded files         RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]              # add a trailing slash to /wp-admin         RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]              RewriteCond %{REQUEST_FILENAME} -f [OR]         RewriteCond %{REQUEST_FILENAME} -d         RewriteRule ^ - [L]         RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]         RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]         RewriteRule . index.php [L]         </IfModule>              # END WordPress      This is the new setting for online site on server. Please help me out as I know nothing about these .htaccess code. Which part do I have to take it off and which part should I keep in order to make the site running again just like on local but of course including well-protected security line of code as well?                   # Block the include-only files.         RewriteEngine On         RewriteBase /         RewriteRule ^wp-admin/includes/ - [F,L]         RewriteRule !^wp-includes/ - [S=3]         RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]         RewriteRule ^wp-includes/theme-compat/ - [F,L]              #disable hotlinking of images with forbidden or custom image option         RewriteEngine on         RewriteCond %{HTTP_REFERER} !^$         RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC]         #RewriteRule \.(gif|jpg)$ – [F]         RewriteRule \.(gif|jpg)$ http://www.yourdomain.com/stealingisbad.gif [R,L]              RewriteEngine On         RewriteCond %{REQUEST_METHOD} POST         RewriteCond %{REQUEST_URI} .wp-comments-post\.php*         RewriteCond %{HTTP_REFERER} !.*yourblog.com.* [OR]         RewriteCond %{HTTP_USER_AGENT} ^$         RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]              # protect wpconfig.php         <Files wp-config.php>         order allow,deny         deny from all         </Files>              # disable directory browsing         Options All -Indexes              <Files ~ “^.*\.([Hh][Tt][Aa])”>         order allow,deny         deny from all         satisfy all         </Files>              Order deny,allow         Deny from all         <Files ~ ".(xml|css|jpe?g|png|gif|js)$">         Allow from all         </Files>              # Protect the .htaccess         <files .htaccess="">         order allow,deny         deny from all         </files>              # BEGIN WordPress         <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /         RewriteRule ^index\.php$ - [L]              # uploaded files         RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]              # add a trailing slash to /wp-admin         RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]              RewriteCond %{REQUEST_FILENAME} -f [OR]         RewriteCond %{REQUEST_FILENAME} -d         RewriteRule ^ - [L]         RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]         RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]         RewriteRule . index.php [L]         </IfModule>              # END WordPress


title: How to Import Categories with Descriptions from a CSV File?

text: How could I import a list of new categories and category descriptions from a file of Comma Separated Values?


title: Automatically delete default posts and pages on theme install?

text: Is there a way to automatically delete the default wordpress posts and pages when activating theme theme?


title: How to redirect a URL with parameters?

text: My redirection are working until parameters are added to the end of the source URL. What will be the proper way of implementing a redirect were the target will be a different URL but I want to pass the parameters untouched. Post with Parameters goes to 404 page Same post without parameters redirects properly I am using the following pluging for the redirects: http://wordpress.org/extend/plugins/redirection/


title: How to display a post's Featured Image with this code?

text: so this is sort of a continuation of another question that I had to ask recently. I wanted to start another conversation, since technically my last question was answered. The last question is here: Display Post Thumbnail Without Being Featured Image if you would like to get caught up on where I was, and where I'm at now. I used to call the post's thumbnail with this:               if ( has_post_thumbnail() ) {                   the_post_thumbnail();      With no issues. Then I started to think that I would need it so that my client didn't always have to set a featured image for every post. Well, with no featured image, there was so post thumbnail being shown in the post's excerpt. So, because of the answer that I was given in the last question(link posted above), I am now using the Get The Image plugin along with this:                                                                    if (      has_post_thumbnail() ) {                   the_post_thumbnail();                    }                    else                    {                     get_the_image( array('size' => 'thumbnail', 'image_class' =>     'wp-post-image'));                       }        Now, if there is no Featured Image chosen for a post, it picks the first image of the post's gallery, since there will always be a gallery for each post. The problem now is that on the actual post, I have had it set so that the Featured Image is shown in full size right in the middle of the page. Thanks to this in my functions.php file:               // This theme displays full size featured image on the Post's page     function InsertFeaturedImage($content) {                    global $post;          $original_content = $content;          if ( current_theme_supports( 'post-thumbnails' ) ) {              if ((is_page()) || (is_single())) {             $content = the_post_thumbnail('page-single');             $content .= $original_content;              }           }      return $content;     }          add_filter( 'the_content', 'InsertFeaturedImage' );       Before I added in the                              else                    {                     get_the_image( array('size' => 'thumbnail', 'image_class' =>      'wp-post-image'));                       }      It has worked fine. Now, it's just displaying the small thumbnail there right in the top middle of post's page. It should be displaying a full size image. So all this has brought me to the main two problems I'm now facing. 1) Can I edit that code in the functions.php file to still display the featured image in full size. And 2) What if there is no Featured Image chosen for a post, can I also make the functions.php code display the first image of the post's gallery, in full size? I really hope this isn't too confusing. Please see http://dependablecarcompany.com and see the post excerpt titled, "1991 GMC Sierra". This post has no Featured Image, but a thumb is still being output, thanks to the Get The Image plugin. But when you actually click through to the actual post, you'll see that the top, center image is showing the thumb. It should be the full size image. Thank you so much for anyone who can get through all this, and share some tips for me!


title: is_home, and is_front_page conditional problem

text:
I have this snippet in a "portfolio-loop.php" file. I'm using get_template_part to display the loop on the front page and on other pages. I have this within the loop:               <?php if( !is_home() || !is_front_page() ) { ?>
<?php the_time('F Y'); ?>
     <?php endif } ?>      I can't seem to get it to exclude the front page. Could it because it's in it's own template? **edit** Ok I fixed some of my semantic errors thanks to s_ha_dum and Tom Nowell. I've tried the following variations:               <?php if ( !is_home() && !is_front_page() ) { ?>               <?php } else { ?>
<?php the_time('F j, Y'); ?>
     <?php } ?>                    //dropping is_home() and trying to keep it as simple as possible     <?php if(!is_front_page()) { ?>
<?php the_time('F j, Y'); ?>
     <?php } ?>      I still can't hide the time on the front page. At best '<--nada-->' will appear on both my home page (home.php) and on my archive (category-blog.php). Is my custom category page seen as a front page as well? **edit 2** What I'm trying to do in plain english: I have a loop on my front page (static, home.php) displaying three of my latest blog posts via get_template_part. The same loop is used for my category-blog.php/archive listing but shows the last 10 posts. I do not want to show the date/time on the front page to keep the layout cleaner, only on the other pages that this loop is displayed on.


title: Multiple Loops on a Custom Homepage

text:
I have read many posts here and across web. I can't see why my loops return nothing (or the right query). Here is my code for multiple loops on a custom home page. Anyone know why my loops are not working - any help would be much appreciated. Also goal for the loop is to return one article from pages (1st loop with a slug of feature 1 and in 2nd loop slug of feature2)page should be published, and it should be the most recent (in case the client adds duplicate slugs - is this possible).
                                      <?php                                      // The First Query                                 $first_feature = new WP_Query(array(                                     'post_status' => 'publish',                                     'post_type' => 'page',                                     'order' => 'DESC',                                     'posts_per_page' => '1',                                     'pagename' => 'feature1'                                                                     ));                                      // The Loop                                 while($first_feature->have_posts()) : $first_feature->the_post(); ?>

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

                                                                                <?php if ( has_post_thumbnail()) : ?>
                                                                                <a href="<?php the_permalink(); ?>" class="icons">                                                                           <?php the_post_thumbnail('medium', array('class' => 'border')); ?>
                                     <?php endif; ?>

<?php mwwp_excerpt('feature1_custom_post'); ?>

                                     <a href="<?php the_permalink(); ?>" class="reading">Read Full Article
                                                                                <?php endwhile; ?>                                 <?php wp_reset_postdata(); // reset the query ?>

                                      <?php                                      // The Second Query                                 $second_feature = new WP_Query(array(                                     'post_status' => 'publish',                                     'post_type' => 'page',                                     'order' => 'DESC',                                     'posts_per_page' => '1',                                     'pagename' => 'feature2'                                                                     ));                                      // The Loop                                 while($second_feature->have_posts()) : $second_feature->the_post(); ?>

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

                                                                                <?php if ( has_post_thumbnail()) : ?>
                                                                                <a href="<?php the_permalink(); ?>" class="icons">                                                                           <?php the_post_thumbnail('medium', array('class' => 'border')); ?>
                                     <?php endif; ?>

<?php mwwp_excerpt('feature2_custom_post'); ?>

                                     <a href="<?php the_permalink(); ?>" class="reading">Read Full Article
                                                                                <?php endwhile; ?>                                 <?php wp_reset_postdata(); // reset the query ?>


title: Including an External File in a Post (and Using Processed Paths)

text:
I have a post that includes a relatively large table that gets updated frequently. Instead of using the (slower) web interface to update the post each time, I installed one of the “run PHP” plugins and put a short bit of PHP code in the table body that opens an external file on the server and puts that in the table in the post. This way, I can edit the file locally in a responsive text-editor as needed and the change is reflected immediately when the the page is served (and without requiring any changes to any of the WordPress tables). This works pretty well and I am generally satisfied with it, but there is a small catch in that the path to the external text-file is relative to the store on the server (I used the media-library manager to store it, and because I’m using the multi-site feature and PHP is server-side, the path is of the form `"wp-content/blogs.dir/1/files/2011/02/foobar.txt"`). The paths to other files like images that client-side code like JavaScript uses is relative to the URL. This is obviously not ideal for several reasons. So I’ve got two questions:   1. Is there a better way to include external content in a post than using PHP?   2. (well, 1b.) If not, is there a better—ie, more consistent—way of accessing the files? (That is, a way to have PHP use URL-relative paths instead of server-relative paths?)       **Clarification:** In the post, I have something like this (code is off the top of my head, so ignore any errors):               …

foo	bar

           <?php            $fn  ="wp-content/blogs.dir/1/files/2011/02/foobar.txt";            $fh  =fopen($fn, "r");            $data=fread($fh, filesize($fn)); //no clearstatcache; TXT file is not updated *that* often            print($data);            fclose($fh);           ?>

     …      Where the text file contains something like this:
Blah	123

Foobar	asd

Test	555
     …      When the page is served, the PHP in the post is executed and pulls in the table rows from the external file, picking up any changes I made externally to it without having to go through WordPress to do so. There is also some JavaScript before the table that deals sets some images according to a switch statement—the images were imported with the media library—something like this:               case 'a': element.style.backgroundImage='url(/blogs/foobar/files/2011/02/A.png)'; break;     case 'b': element.style.backgroundImage='url(/blogs/foobar/files/2011/02/B.png)'; break;     …


title: JQuery Wordpress gallery

text: I would like to know if it's possible to create a gallery like that one using WordPress: http://jfdelsalle.com/naaman.swf Is there any plugin close to that?


title: Using jQuery .after inside loop

text:
I have a bit of javascript that will dynamically add a static post to a loop. The script uses the jQuery 'after' method and on a static page it works beautifully but when inside the loop I don't get any results. Can anyone see what i'm doing wrong here? Does WP not allow DOM insertion within a loop?               function newTile(){       var adTile = "

 this is a test

";       var adLoc = 5;       var tiles = $('#article-tile:nth-child('+adLoc+')');       $(tiles).after(adTile);     }


title: query_vars in plugin when using custom permalinks

text: I am trying to do the following I need to get the category of the current page at the plugin level so before it goes to `archive.php` or`single.php` so i have a plugin to do this and based upon category it switches themes .. however i am stuggling to get the category at the plugin level when i am using custom permalinks which do not have a query string (ie seo friendly urls) So if i go to the default permalinks , I can get the category within the plugin using               $wp_query->query_vars['cat'];      However with the custom permalinks that returns null and I have not been able to think of another way of doing this , Please can anyone help ? Thanks a lot Waseem


title: Use plugin or custom post type for game score functionality

text: The last couple of days I've been working on a plug-in that adds the functionality of keeping scores from a paintball game. When I manage to finish it I want to present players with a form so they can add in stuff like: hits, deaths, wins, losses, location, role and date. That goes to a custom table in the WP database. They will also get a profile page that shows the last 5 records, win/lose ratio's and the likes. The admin also has a menu that shows this table, and should be able to manipulate the date (incase of abuse). I've got further with the plugin then I thought. Admin screen is present and loading the info from the table (sorting some columns). But I haven't yet got the edit or delete functionality to work. Which got me thinking. I've worked with custom post types before. Wont it be easier to make this plug-in in to a custom post type? Can users send data to it from the front-end? Can I query the data and do some simple math with it? Admins can change the data fairly easy with a custom post type if I'm not mistaken. Only downsides I can think of now is theme problems. I think its easier to show the data from the custom table with a plug-in via short codes then integrate custom-posts in a theme? Can I create short code's for the custom post type? So should I drop the plug-in way and go for a custom post type? I'd like to be able to share this plug-in eventually, so if I go with the custom-type I'll probably end up making it in to a plug-in that enables the custom-post-type.


title: paginate_comments_links() not working

text:
I'm using paginate_comments_links() to get all the comments by the current user:               <?php     global $current_user;     get_currentuserinfo();     $userid = $current_user->ID;          $args = array(         'user_id' => $userid,        'number' => 2,     );     $comments = get_comments($args);     foreach($comments as $comment) :         echo('
' . $comment->comment_date . '
' . $comment->comment_content);     endforeach;          paginate_comments_links();     ?>      However, the pagination is not showing up. I have posted 7 comments, so I expected to see 2 comments per page, 4 pages in total. However, no pagination is showing up at all. Turning on errors in php reveals: Notice: Undefined property: WP_Query::$comments in /wp-includes/comment.php on line 788 Where am I going wrong?


title: How to get posts which must match both custom taxonomies?

text: I have searched in the stackexchange site for an answer for this question. However, I did not find any posts can help me solve the following problem: I have 2 custom taxonomies named **tax1** and **tax2** I want to create a args for WP_Query which must meet the following conditions: - The posts must be in both **tax2** and **tax2** - The posts are in the custom post_type **posttype1** I have tried to create the following args to get the posts but it did not work as I expected:               $query_args = array(             'post_type' => 'posttype1',             'ignore_sticky_posts' => 1,             'posts_per_page' => 10,             'offset' => 0,             'orderby' => date,             'order' => ASC,             'post__not_in' => array( get_the_ID() ),             'tax_query' => array(                 'relation' => 'AND',                 array(                     'taxonomy' => 'tax1',                     'field' => 'id',                     'terms' => array ( ... ), // an array of term                     'operator' => 'IN'                 ),                 array(                     'taxonomy' => 'tax2',                     'field' => 'id',                     'terms' => array ( ... ), // an array of term                     'operator' => 'IN'                 )             )         );      Could anyone help me to solve this problem please? Thanks


title: Benefits of storing uploads in an assets folder?

text: I'm trying to get up to speed with responsive theme development in Wordpress and have been looking at Bootstrap and combining it with HTML5 boilerplate. I came across this skeleton framework which combines both of them: http://www.rootstheme.com/ However, it sets up the uploads folder to be /assets/ in the root of my site. Is there any benefit to doing that? This theme looks like it's doing a load of good stuff, so I'm assuming there's a benefit to do so? Thanks Osu


title: Show plugin only on a specific page

text: I am using the plugin Connections in my website. Now I created a page exclusively for this, so the directory listing has to be only shown if the page is "Directory" and it has to be shown in center. Currently the plugin is shown in sidebar. How can I solve this issue?


title: API to trigger prompt on leaving page

text: I have a proprietary plugin that creates a metabox on the edit-post page. When the data managed by the plugin is edited and the user navigates away then we would like the user to be prompted as Wordpress (or is it TinyMCE?) does now when the body of the article is edited. Ideally, if the user modifies the metabox and the post content they would be prompted once. **Is there an API which allows us to activate Wordpress' (or is it TinyMCE's?) dirty flag?** I am aware of this similar question and the answer whcih suggests proxying the beforeunload event.


title: Remove site name from <title> tag

text: My current `<title>` tags are like this: > Blog post title | Site name How do I remove "Site name" so that the `<title>` tags will be like this: > Blog post title Except, of course, on the front page, where the `<title>` tag should be: > Site name Please take into account that I'm a complete Wordpress newbie. * * * Edit: Here's my current `<title>` tag from `header.php`:               <title>     <?php     if ( defined( 'WPSEO_VERSION' ) ) {         // WordPress SEO is activated             wp_title();          } else {              // WordPress SEO is not activated         wp_title( '|', true, 'right' );     }     ?>     </title>


title: Custom query variable - get wordpress to redirect to nice permalink url

text: I have been looking for an answer for the last couple of hours but could not find anything pointing me in the right direction. Some advice would be very much appreciated!   * What I already have:      * A custom post type `'stores'`     * A public query var using the `'query_vars'` filter hook: `'state'`.     * Added the according rewrite rule:        * Pattern: `stores/state/([^/]+)/?$`       * Match: `index.php?post_type=stores&state=$matches[1]`     * As `'state'` is a custom meta field, I added a function hooking into `pre_get_posts` action hook doing all the query magic (creating `meta_query` etc) to display only the matching `stores` in the archive page. That's all working quite well: So if I enter `www.myurl.com/stores/state/austria` my archive page is only showing Austrian stores. To filter the stores not only by url, the archive page includes a form to filter them. This is where I run into my problem: the form obviously only passes POST or GET data, e.g. like the following:               www.myurl.com/stores/?state=austria      I can deal with this by adding a check in my `pre_get_posts` filter function:               if( isset( $_REQUEST['state'] ) || $query->get('state') != "" ) {      However, this is a little dirty as I would like wordpress to automatically redirect to the rewritten URL:               www.myurl.com/stores/?state=austria      should be redirected to               www.myurl.com/stores/state/austria      the same way it is done if I enter a page or post ID and it redirects to the permalink. Is there another action hook I have not discovered yet? How would I get wordpress to automatically redirect to the pretty permalink? Thank you for every hint.


title: How to order adjacent posts (prev / next) by custom field value?

text: I am using the More Fields and More Types plugins to create a custom post type called `product`. This custom type is based on the **Post** type. One of the fields is named `lot` which is an integer representing a Lot # for an auction. I created a custom category page which generates a list of links for each Lot, ordered by the `lot` field. This works great.               $args = array(       'post_type' => array('product'),        'cat' => 3,       'meta_key' => 'lot',       'orderby' => 'meta_value_num',       'order' => 'ASC'     );      **However...** when you click on one of the lots, the Previous & Next post links aren't ordered by the `lot` field anymore, they are ordered by publish date (which is the WP default). I am trying to figure out how I can change this default sort order for `previous_post_link()` and `next_post_link()` to use custom field `lot` instead of Publish date.


title: What is the best way to sort posts by a custom algorithm?

text: I'm wondering what is the best way to sort posts on homepage using a small algorithm like `custom_field_votes / ( post_hours_old + 2 ) ^ 1.8` I have tried creating a new custom field with the result but updating all posts at once or even hourly with a cron doesn't sound very good (performance). Any opinions?


title: Image Attachment Url Rewrite

text: I'm having an issue with url rewriting for a theme I'm making, which is basically a gallery theme based on the roots theme. Here's how the site navigation works:   * Home Page (With Tiled Image Gallery) (Images link to parent pages) Current URL - `domain.com`   * Parent Page (With Tiled Image Gallery) (Images link to attachment page along with #id to link to the clicked image ). Current URL - `domain.com/landscapes`   * Attachment Page (With ALL full size images attached to the parent post). Current URL - `domain.com/landscapes/image-title/#id` What I would like to do is to remove the image title from the attachment page URL and replace it with gallery so that the URL reads `domain.com/landscapes/gallery/#id` My content-image.php uses `wp_get_attachment_image_src()` to get the image urls. With pretty permalinks disabled i get an image URL like `domain.com/index.php?attachment_id=205` When checking with pretty URL with the Rewrite Rules Inspector Plugin, that URL (`domain.com/landscapes/image-title/#id`) gets 2 matches which are as follows: RULE 1: `(.?.+?)(/[0-9]+)?/?$` Rewrite 1: `index.php?pagename=$matches[1]&page=$matches[2]` RULE 2: `[^/]+/([^/]+)/?$` Rewrite 2: `index.php?attachment=$matches[1]` From what I understand, The second rule is the one that is being applied in this case, but I have no clue what to change it to. Any idea on how to do this?


title: Run "get_the_post_thumbnail" with a different table prefix?

text: I have this site were I run two Wordpress sites on the same database (with different prefixes), on one domain. What I want is to get the post thumbnail from the second Wordpress installation, by running the function `get_the_post_thumbnail` (with a different table prefix), on the first Wordpress installation. Simplified: Two Wordpress sites, One database, Wordpress site "a" want to get a post thumbnail from Wordpress site "b" through the function `get_the_post_thumbnail` I really hope this makes sense!


title: How to test a WordPress plugin through the upgrade automatically feature

text: Last week I had released a version of a WordPress plugin that works if the user was doing a fresh install, however if they already had the plugin and upgraded it using the WordPress upgrade automatically feature, problems occurred and some of the database elements were erased. So I had to revert back immediately. I was wondering if there was a way to test the plugin through the upgrade automatically functionality before hand instead of having to release it and hoping you get it right the first time. Thanks in advance, Omar


title: Wordpress homepage hangs in IE browsers

text: Anyone has any insight why http://www.quantnet.com loads fine in FF, Chrome but hangs in IE for 20 seconds or more? I have been hunting down the problem but reach an end.


title: How do you properly prepare a %LIKE% SQL statement?

text: I'd like to use a LIKE %text% statement while still using the WordPress $wpdb class to sanitize and prepare input.               SELECT column_1 from `prefix_my_table` WHERE column_2 LIKE '%something%';      I've tried something like this to no avail:               $wpdb->prepare( "SELECT column_1 from `{$wpdb->base_prefix}my_table` WHERE column_2 LIKE %s;", like_escape($number_to_put_in_like));      How do you properly prepare a %LIKE% SQL statement using the WordPress database class?


title: where to find on backend to amend and edit title tage for each page on website?

text: I need to put a title tag on each page of my website but I can only seem to be able to do it for the home page, where can i set and edit the title tags for the other pages?


title: Create a constant download link that always points to latest attachment

text: I plan to have one attachment per post and the attachments will often be receiving updated versions with different file names. I have an issue where users copy and paste the file url and send it via email. Is there a way I can provide a constant URL for example http://domainname.org/218/?download-attachment that will always point to the attachment currently uploaded to the post?


title: Prevent five different copies of jquery from being included on every page

text: Many wordpress theme, plugin, and widget developers seem to think that the only way to use jquery on the page is to include their own copy. On some pages of the site I'm developing, there are as many as _six_ different places where I see various different copies of jquery included. **This is ridiculous.** It increases loading time, and is totally redundant. Is there any easy way, either through a plugin or a bit of my own coding, to force only _one_ copy of jquery to be included on each page? There's already a `jquery.js` in the `/wp-includes/js/jquery/` directory, which should suffice for any plugin that needs it. How can I automatically remove all of the other references to it on the page?


title: How do I show google ads between post content?

text: I want to show ads by Google between text content, like show 3 ads one after 1st para second after 3rd para and one at end of last para. I know i have to modify in `single.php` but being novice in php I am unable to do this. Would be real helpful if someone could help me do this. Thanks.


title: Function to return custom post type titles from blog id 1

text: I'm trying to create a function to retrieve all titles from a custom post type located on blog id=1. I tried to use foreach but I cannot get it to work. The closest I have been was using this:               function getctas() {         switch_to_blog(1);                  $args =  array(                 'post_type' => 'location_icons',              );                  $ctas = new WP_Query($args);             while ($ctas -> have_posts()) {             $ctas -> the_post();             $titles = get_the_title($post->ID);             restore_current_blog();             return $titles;             }          }      The issue I'm facing with this is that the function is returning only 1 post title and not all as I intend to.


title: Alphanumeric usernames and error message for it

text: I'm facing a problem where I haven't seen proper answer anywhere. What I need help with is this: How can I prevent my users registering non-alphanumeric usernames? To be exact, I could prevent it by using something like:               function validate_alphanumeric_underscore($string?) { return preg_match('/^[A-Za-z][A-Za-z0-9]*(?:_[A-Za-z0-9]+)*$/',$str); }      But what is the string I should/could use and how can I echo error message saying that the username inputted had invalid characters? Cheers!


title: How to use a custom post type as front page?

text: I would like to set a site's front page to be a single post from a custom post type. I have been able to alter the request for my front page to a Custom Post Type _archive_ with the following code (originally posted here):               function custom_front_page($wp_query){         if($wp_query->get('page_id')==get_option('page_on_front')){             $wp_query->set('post_type','album');             $wp_query->set('page_id',''); // empty             // fix conditional functions             $wp_query->is_page = false;             $wp_query->is_archive = true;             $wp_query->is_post_type_archive = true;         }     }     add_action('pre_get_posts','custom_front_page');      Replacing               $wp_query->is_archive = true;     $wp_query->is_post_type_archive = true;       with               $wp_query->is_single = true;      calls the `single-album.php` template as I'd like to, but it still returns ALL the posts in the "Albums" category, instead of only one. Adding               $wp_query->set('posts_per_page',1);      has no effect. What should I be doing instead? _Bonus question: is there a good reference somewhere about how to manipulate the`query` this way?_


title: Display Widgets Horizontally in Area

text:
I am building a custom bootstrap 3 theme. I have created a new widget area for my header and am trying to get the widgets there to display horizontally, in line. I've looked up several tutorials, but none seem to be working. Can anyone help?               **Here is my CSS for the list:**          #top-widget-container ul {      list-style-type: none;      }          #top-widget-container ul li {     display: inline;     }          **And my functions.php widget insert**          add_action( 'widgets_init', 'add_header_widget' );     function add_header_widget() {              register_sidebar( array(             'name' => 'Header Widget Area',             'id' => 'header_widget',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ) );     }


title: How to prevent parent admin page from appearring as a child admin page

text: I am using this code:               add_menu_page($page_title, $menu_title, $this->capability, $menu_slug, $function);      Which is adding top level admin page. When I add:               add_submenu_page( $menu_slug, 'sub menu 1', 'sub menu 1', $this->capability, $menu_slug . '_sub_menu_page_1', $function );      I get not only the desired child page, but also the parent page moves to become a child page of itself.


title: How can I include PHP-Code to my post?

text: I would like to use PHP in some posts. These posts should look like normal posts, be in the archive and categories like normal posts an have tags. I don't need PHP in every post, but it would be great if I could use it in some. I saw that it is possible to create custom page templates which seems to be almost what I want, but I want it for posts. How can I get it?


title: WYSIWYG editor with image upload for "Normal Users"

text: Can someone tell me is there a plugin doing this?(This has been asked over 6 years from bbpress.org) I have tried lots of plugins but no one does exactly what I need,      1) A WYSIWYG editor in bbpress for normal users(frontend).   2) With an image “upload” feature, but is not working like an attachment like “GD bbPress Attachments”.   3) All the uploaded images will be separated by folder(user name or individual name for an user).This is to avoid user use images from other users.      I am also happy to know the reason if this is impossible this meanwhile, like wordpress official has a consideration on it’s risks.


title: Check if empty or not

text: How can check if a custom user profile field [ name and age and email] is empty? If is empty display a message else display the comment form. How can i do that?


title: Access WordPress Tag Function From Modal

text: I am currently working on a plugin that will require the use of the Tag library inside the given WordPress installation. From a page, the user can click a button from the editor, which then opens a modal. In this modal I would like to have the Tags listed using the same function that one could use to select tags on a post or similar to adding it to a custom post type using 'post_tag' in the taxonomy definition. Is it possible to access these types of functions from outside a post or page? I am calling the modal from my TinyMCE button and am using SimpleModal. The modal is stored in a separate PHP file. My shortcode button and call onclick to my modal:               (function() {     tinymce.PluginManager.add('om_sc_button', function( editor, url ) {         var newurl = url.substring(0, url.length -3);              editor.addButton( 'om_sc_button', {             title: 'Insert New Searchable Media Manager Gallery',             image: newurl + '/images/source_code_32.png',             onclick: function() {                     jQuery('#popup-content').load(newurl+"/includes/shortcodebuilder.php");                     jQuery('#popup-content').modal({                         containerCss: {                             backgroundColor: "#fff",                             borderColor: "#000000",                             height: 400,                             padding: 10,                             margin: 10,                             width: 800                         },                         overlayClose: false,                         overlayId: 'popup-overlay',                         containerId: 'popup-container',                         onClose: function() {                             editor.insertContent('[MyShortcode]');                             jQuery.modal.close();                         }                     });             }         });     });     })();      The file shortcodebuilder.php has a form with a few input boxes and on THAT page I'd like to have the tag builder just like you see in a post. I apologize for not posting this but the work is for a client and is proprietary. It's also why I didn't post the code earlier. ![WordPress Tag Builder](http://i.stack.imgur.com/Tpis9.png)


title: How to display posts under a specific subcategory of a given category

text: after a long search online I have decided to post my problem here in the hope of getting a solution to this issue. Well, I have a custom post with various categories (novels, books, magazines etc..) and each of these categories have many subcategories (2002, 2004, 2005, 2006 etc) the year of publication. Basically what I need is to show a filtering menu based only on the relevent subcategories of the selected category. And when the user clicks on a subcategory menu item he will be able to get all the posts under that specific category. this is what I have done so far, but I could no find out how filter by subcategory while in a given category.                       if (isset($_GET['cat'])){         $subcat = $_GET['cat'];         query_posts( 'posts_per_page=10&paged='.$paged.'&post_type=publication&publication_category='.$maincat.**'&category__in='**.$subcat );             }else{         query_posts( 'posts_per_page=10&paged='.$paged.'&post_type=publication&publication_category='.$maincat );            }      I be so thankful to anyone who could give me a bit of his time to solve this problem.


title: Suspicious mesage appears instead of images

text: My installation is of Multisite setup . when I upload an image and try to view it, getting a message 'go home baby!!' instead of image Actually the specific sub-site is also mapped with a custom domain. I thought that it is breaking the link. So removed the mapped domain and still having the same issue Tried uploading multiple images and almost every image gives the message. Is that kind of some fraudulent activity or my files were hacked? I don't think so . I have checked the installation files and nothing suspicious found Could any one help me with this?


title: WordPress Attachments vs Post Meta

text: Apologies if this is not a _question_ and belongs more in discussion, but In dealing with image attachments for a portfolio site, what is the benefit to having images be "attached" to a post versus saving the image IDs as an array in a post_meta field?


title: should i be checking for jquery before enqueing it in a plugin

text: At the start of a typical plugin which uses jquery I have something like the following               wp_deregister_script('jquery');     wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', false, '1.3.2');     wp_enqueue_script('jquery');      Which as I understand it deregisters and re-enqueues jquery ( from google in this example but that's irrelevant here ) My question is this: is there not some way of checking to see whether the library is already enqueued ( by another plugin or the theme) to save needless deregister/register and enqueue ( or is this not very expensive in reality )


title: How does WordPress update plugins, without running into permissions issues?

text: I am developing a plugin for PrestaShop, it works but the issue is with its autoupdate. Sometimes it fails on customers server due to permissions issues. How exactly does WordPress handle plugin updates without running into permissions issues? And can they be replicated for something like a PrestaShop module?


title: enqueue_style is not working

text: I try to load the main stylesheet with enqueue_style - but it isn't working. Here is my code from functions.php:               function my_scripts() {           wp_enqueue_style( 'main-style', get_template_directory_uri() . '/style.css', false, '1.0', 'all' );           }     add_action( 'wp_enqueue_scripts', 'my_scripts' );      Loading the stylesheet in the header.php by using a link-tag works fine. I can't find the error - it seems that code is ignored - but function.php is loading. I also tried to use `get_template_directory_uri()` instead of `get_template_directory_uri()`. Because it is the recommended way to link to styles and scripts I want to get this work. I also want to use enqueue_scripts for some js and jQuery scripts. Thanks for any hint or advice The solution: I forgot to call wp_head() in the header.php - added and everything works :-)


title: Re-ordering images in existing post in wordpress 3.6.1

text: I hope someone can help me. I cannot see how to re-order images once loaded to the media gallery. WordPress used to have a list view of all images in a post with a box you could enter the running order numerically or descending/ ascending etc... Now I can only see all my images in the main media library and cannot see anyway or re-numbering or moving them.


title: How to enqueue default scripts with dependency?

text: I'm developing a plugin and for that I need jQuery and jQuery datepicker. I's taught that WordPress already enqueued some scripts, and I found 'jquery' and 'jquery-ui-datepicker' there. Where the datepicker is said to be dependent to jQuery. In that codex page it's also mentioned that, we can call a dependent script like the following:               function my_scripts_method() {         wp_enqueue_script( 'custom-script', plugins_url( '/js/custom_script.js' , __FILE__ ), array( 'jquery' ) );     }         add_action( 'wp_enqueue_scripts', 'my_scripts_method' );      I got the point is right for any custom script. But what about the default scripts?   **What to put on the source (`$src`) then?**               wp_enqueue_script( 'jquery-ui-datepicker', $src, array( 'jquery' ) );      I can't put a null string (`''`) or a variable, anything, theoretically, and practically.


title: Contact form 7 Adding data automatically

text: How do i grab data from a post and insert it into the form, So when the form is sent it will have that post name and image from that page that the form was sent on? Basicly I have a get a quote button and i want them to click that and ask about the product by inputting field by contact form 7, but I want the name of the product and image of the product to be automatically inserted in to the contact form so they just needs to fill out name and email and message field and the name of the product any image of the product is already set up to be sent.


title: Update post meta without deleting the old entries

text: $old = get_post_meta($post_id, 'figure_sugsubject_repeatable_fields', true);     $new = array();          $figuresugsubjectpositions = $_POST['figuresugsubjectposition'];     $figuresugsubjectworkplaces = $_POST['figuresugsubjectworkplace'];     $figuresugsubjectlocations = $_POST['figuresugsubjectlocation'];     $figuresugsubjectfroms = $_POST['figuresugsubjectfrom'];     $figuresugsubjectstatuss = $_POST['figuresugsubjectstatus'];               $count = count( $figuresugsubjectpositions );          for ( $i = 0; $i < $count; $i++ ) {         if ( $figuresugsubjectpositions[$i] != '' ) :             $new[$i]['figuresugsubjectposition'] = stripslashes( strip_tags( $figuresugsubjectpositions[$i] ) );                  $new[$i]['figuresugsubjectworkplace'] = $figuresugsubjectworkplaces[$i];             $new[$i]['figuresugsubjectlocation'] = $figuresugsubjectlocations[$i];             $new[$i]['figuresugsubjectfrom'] = $figuresugsubjectfroms[$i];             $new[$i]['figuresugsubjectstatus'] = $figuresugsubjectstatuss[$i];              endif;     }          if ( !empty( $new ) && $new != $old )         update_post_meta( $post_id, 'figure_sugsubject_repeatable_fields', $new );     elseif ( empty($new) && $old )         delete_post_meta( $post_id, 'figure_sugsubject_repeatable_fields', $old );      I have a frontend form for post submission. I want the new entries in the form not to replace the old ones, instead I want it to be added. I guess the problem is with the update_post_meta thing. I saves the new entries over the old. Is there anyway I keep the old ones and put the new ones with new keys?


title: Need to create admin user without capability to create user

text: I need to remove user related capabilities(such as 'create_users', 'add_user', 'list_users', etc...) of an admin user. I tested the code below in an 'init' method.               global $current_user;     get_currentuserinfo();     $current_user->remove_cap('create_users');     $current_user->remove_cap('add_user');     $current_user->remove_cap('list_users');      But I found that still user is able to access interface for managing user(even after refreshing many times). Is there any solution other than creating new role for this?


title: Private WordPress blog, requires user registration approval, and allowing users to login with OpenID

text: I have the following scenario:   1. I have a private blog, running WordPress (self-hosted, not WordPress.com hosted), and I am using the jonradio Private Site to allow only logged-in users to see the site.   2. I want to approve all users prior to their gaining access to the blog, so I'm using the New User Approve plugin to leave new user registrations in a "Pending" state. According to this documentation, "Until a user is approved, the user will not be able to login to the site." Perfect, that's exactly what I want.   3. I'm using Social Connect to allow users to login with OpenID. This will result in a WordPress user being created that is linked to their OpenID identity, and (as expected) this WordPress is in a "pending" state until I approve it. However, apparently there is some miscommunication between these these three plugins, because even though an OpenID login results in a new user being created, with a "pending" state, they are still able to see the site. Going through the "regular" WordPress account registration results in the expected behavior: user created in pending state, but unable to login until approved by an admin. In summary, what I am aiming for is:   * Private blog, that only approved users can view   * OpenID login as an option. Actually, I don't mind if OpenID is a requirement--between Google, Facebook, Microsoft, LinkedIn, and Yahoo, 100% of our blog readers will have an account elsewhere. But I'm ok with users creating a WordPress user account if they really want to. Is there some combination of WordPress plugins that supports this? I see many plugins similar to jonradio Private Site, many more similar to New User Approve, and still more similar to Social Connect. The possible permutations are overwhelming... I don't think I could possibly try them all. But, perhaps one of them works? This is for a personal, non-money-making blog, but if I knew it was going to work I'd be willing to pay a small one-time fee for a commercial plugin.


title: How to Set a Custom Template for Blog Posts

text: I am trying to set a custom template for my blog posts page using the Template box on the Page Attributes section of the page. However, the template does not get used on the site. Is there a certain reason why or maybe a special process I need to go through to get a custom template to be used for the blog posts? Could it be the theme is overriding the custom page somehow? Structurally the template is fine and appears as one of the template selections in the pulldown box. Here are screen shots: **This is from Settings** ![enter image description here](http://i.stack.imgur.com/MDGld.jpg) **This is from the "Blog" Page Attributes:** ![enter image description here](http://i.stack.imgur.com/wCZK1.jpg)


title: Export links of custom created admin page

text: All right so i have created a page in the wordpress admin called Theme Options.When i export my files the links of these pages are not exported.I want the links that i have included in this page to be also exported using the export plugin. How can this be done ? Here is a screenshot: ![enter image description here](http://i.stack.imgur.com/PlWEC.png)


title: Embed a Reveal.js presentation in Wordpress page

text: How can I embed a revealjs presentation on a wordpress page without using a plugin solution, like WPPresent? Thanks,


title: Query Posts in a Predefined Order

text: I am using the query_posts function to list a 10 specific posts which lookup by post id. I have an array which looks like this..               Array     (         [0] => 17983         [1] => 17932         [2] => 18030         [3] => 18016         [4] => 17972         [5] => 18013         [6] => 18035         [7] => 17959         [8] => 18020         [9] => 18039     )      I would like to query posts showing it in that specific order, however with my code it shows them in a random order of its own. Here is the argument I use for query posts:               $args = array(         'post_type' => 'post',         'post__in' => $post_ids,         'numberposts'     => 10,     );      $post_ids is the array which I have posted above. How can I alter my code to query the posts and show them in the order of the array?


title: $post->id vs $post->ID problem after using Wordpress config bootstrap

text:
I'm developing with Wordpress in a multi environment scenario. I develop on my local machine, test on a server and so on. I was using the "trick" of having a `local-config.php` file to have different configurations based on the environment. Today I discovered this: Wordpress config bootstrap. It's just a simple improvement of the default wp-config.php file. It's working fine, but on my local environment appeared this error:               Notice: Undefined property: stdClass::$id in /home/carlo/public_html/altrababele/wp-content/themes/wp-foundation/index.php on line 21      The code generating the error is this:               <?php echo get_the_post_thumbnail( $post->id); ?>
<time datetime="<?php echo the_time('y-m-j'); ?>" pubdate><?php the_time('j'); ?>
<?php the_time('M'); ?>
<?php the_time('y'); ?></time>
      I set the debug option to `false`, but nothing changes. The problem appears to be that `id` is lowercase, so writing `$post->ID` actually solves the issue. It's strange because if I use the `local-config.php` it works just fine, but all the options are the same. any suggestions?


title: Serve a different theme based on window size

text: What do you think it is the best approach to load a theme based on current window size of the client? I am not necessarily talking about resizing, but only about the size at the first load time. I made an attempt here but it is not working. I am not able to deal with the fact that the function responsible of changing the theme is also hooked to 3 filters, in addition to the async type of AJAX. Maybe if you look at the code and tell me where I can improve. It might be a hot topic to find a solution for, especially now for mobile fist approach. Thanks.


title: How to get tagged pages to show up with tagged posts?

text:
I'm trying to implement tags on my pages, so pages show up in the tag clouds I have printing in various places on the site. The problem? If I tag a page, it doesn't show up in the list. Only posts do. I'm using the following in my functions.php to enable page tags:               // add tag support to pages     function tags_support_all() {     register_taxonomy_for_object_type('post_tag', 'page');     }          // ensure all tags are included in queries     function tags_support_query($wp_query) {     if ($wp_query->get('tag')) $wp_query->set('page_type', 'any');     }          // tag hooks     add_action('init', 'tags_support_all');     add_action('pre_get_posts', 'tags_support_query');      My tag.php page has the following:               <?php while (have_posts()) : the_post(); ?>          <h2 class="category-title" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?    >" rel="bookmark" title="Permanent Link to <?php the_title(); ?>" style="color:#000;"><?php     the_title(); ?>
      <?php the_excerpt(); ?>          <?php if ($wp_query->max_num_pages > 15) : ?>

<?php next_posts_link(__('← Older posts', 'roots')); ?>

<?php previous_posts_link(__('Newer posts →', 'roots')); ?>


title: How to rapidly create a dummy menu?

text: I want to create a dummy menu with 1 or 2 level of depth. I know I can create the menu via the administration module, but I want to know if there is something I can use to generate fast a dummy menu. I have a file with the sitemap indented by spaces that look as follow:               Home     Foo         Foo 1         Foo 2         Foo 3     Bar     Baz         Baz 1         Baz 2             Baz 2.1             Baz 2.3      Is there something to rapidly create the menu hierarchy into WordPress 3.6?


title: Advanced Custom Field - displaying only 1 post- how to get all posts displayed

text:
I have two post types:   1. post type = stores   which has a title and custom field (by ACF) `storeurl`.   2. I have another post type called books with just title and custom field `bookcode` (by ACF). I assigned the post type stores as "post object" to books....the code below get the concerned fields but displays the last post only... how do i get it to loop and display all the posts ?
             <?php $storelist = get_field('storelist');               $bookcode = get_field('bookcode');                     //var_dump($storelist);              foreach ($storelist as $post) :  setup_postdata($post);              ?>
              <?php echo get_the_title($post->id);?>

                     <a href="<?php echo get_field('storeurl',$post->id); ?>">                         <?php echo $bookcode;?>
           <?php endforeach; wp_reset_postdata(); ?>
       I tried the code below, it does display the posts but the bookinfo and linkbtn get repeated more than once within the bookdetails.
     <?php      while (have_posts()): the_post();?>

             <?php                    $bookcode = get_field('bookcode',$post->id);             $bookinfo = get_field('bookinfo',$post->id);                  $storelist = get_field('storelist');                               foreach ($storelist as $post) :  setup_postdata($post);                      ?>
                 <?php echo get_the_title($post->id);?>

                 <?php echo $bookinfo; ?>

                      <a href="<?php echo strip_tags(get_field('storelink',$post->id)); ?>">                             <?php echo $bookcode; ?>
                  <?php endforeach; wp_reset_postdata();?>

       <?php endwhile; ?>


title: Child theme does not appear in theme selection

text: I'm trying to add a child theme to my wordpress installation. The theme the child should be based upon a theme called "nostalgia-landing" which is installed and works properly. I created a new folder called "nostalgia-custom" and added the the _style.css_ with the following content:               /*     Theme Name: Nostalgia Custom     Description: Nostalgia Custom is a responsive WordPress landing page.     Author: QuanticaLabs and Christoph Halang     Author URI: http://themeforest.net/user/QuanticaLabs?ref=QuanticaLabs     License: GNU General Public License version 3.0     License URI: http://www.gnu.org/licenses/gpl-3.0.html     Version: 2.0.2     Template: nostalgia-landing     */     @import url("../nostalgia-landing/style.css");      However, the theme selection in admin panel does not show my child theme and says "You only have one theme installed right now.". This is not true since there are the default themes. When I delete the child theme folder the default themes appear again in the selection. Did I miss anything? Any ideas guys? Regards, Chris


title: Plugins won't recognize my plugin's hidden custom fields

text: In a plugin i developed i created metaboxes in the new/update post page in the admin area that save data into custom fields. In order to prevent confusion or any kind of issues i created those custom fields hidden by adding "_"(underscore) to the beginning of it. Now i realize that other plugins will not recognize those custom fields and not just Wordpress so i am looking for a way to fix that as i want my plugin to be able to work together with other plugins. Obviously just removing the "_" from the name would be the fast and easy way to go. However, users that will do an update to the plugin will have issues since all their data is already saved in the old custom fields. One way i was thinking of is adding another set of non hidden custom fields that will hold the same data as the hidden custom fields. so for example if now i have "_address" i will add another fields "address" and whenever the post being saved the data will be saved in both custom fields. This way, users that already have data in the database won't have any problems using it. However, for the same users ( who updating) the data will not be exist in the new custom fields until the post will be saved again. Means that plugins will recognize the new fields but nothing will be there. So my first question is , does anyone know on of a better way i can archive that? and if not , how about a function i can add to the plugin that once a user do an update it will automatically run "save" through all the posts in his database so then i guess the data will be saved in the new custom fields ? Or maybe a function that will duplicate all the hidden custom fields in the user's database begins with underscore to custom fields with the same name just without underscore? _**[Update - pulled from a Comment]_** > Well, a quick look into the "post widget" code i found this line "`HAVING > meta_key NOT LIKE '_%'`" which hide hidden custom fields. i guess plugin > developers hide it by default.


title: How to change "Draft" string for status of custom post type to "Unavailable"?

text: **ANSWER MOD** : just an important mod to the chosen answer:               // check if you actually have drafts; also avoids extra '|' separator     if (isset($views['draft'])) {         // 'Drafts' should be added (and come first) if you don't want to end up with 'Unavailables'         $views['draft'] = str_replace(array('Drafts','Draft'), 'Unavailable', $views['draft']);     }      and the mentioned caveat is not showing up for me on 3.4. :D * * * Only for one particular custom post type `employee`, I want to change the name/string "Draft" (which stands for the `'draft'` status) to "Unavailable" for any `employee` post that has a `'draft'` status, anywhere the name shows up on the admin screens and basically throughout the entire site, i.e. ![enter image description here](http://i.stack.imgur.com/rQzvo.png) Is there a hook for this? Or is there a better way to do this?


title: Create widget that filters posts on current page based on entered value

text: Can somebody point me in the right direction wouldnt have a clue how to start programming this. I want to filter post based on price (custom value) thru a widget. So lets say you click on a post category you get a list of all the posts in that category, but then I want to give the user the option to filter on price. Been searching for a widget that does this but havent found one.


title: How do I remove the page listing menu in the header in the Twenty Ten Theme?

text: How do I remove the page listing menu in the header? I would like just the choosen header picture to show up without a listing of all of the pages on the site listed underneath. Also at the very top or the page it displays the domain and title above the header. What is the best way to eliminate that and just have the header picture hug the top of the screen? I and using the free theme Twenty Ten. Thank you in advance.


title: Add an image box besides featured image?

text: When you want to associate an image to a post which already has its own featured image, you have to use a custom field : you upload an image just as if you wanted to add an image inside your post, but then you just copy the image URL, click cancel, and put the image URL in the custom field value : burdensome. Is it possible to do that automatically without any need to copy and paste any URL, like having another featured image, but with a specific name and having the properties of a custom field ? I hope my question is understandable.


title: Using one slug/post-name for multiple pages

text: I'm creating a website and I'd like to be able to reuse the same slug/post name in the page's url. ex using `/%category%/%postname%`               foo.com/bar/page     foo.com/barz/page // Will not work. Instead it will use page-2.      I've done some research and it doesn't look like it's possible to do what I want. Before I give up on trying to get the url structure to work like I would like, I figured I would reach out to the WordPress community to see if anything has changed in a newer release to allow this behavior. I'd really like to avoid using `%post_id%` at all costs because I don't think it looks very nice in the url.


title: trim custom field text value and show (...)

text: I am using this code here:               <?php     $trim_length = 25;  //desired length of text to display     $custom_field = 'my-custom-field-name';     $value = get_post_meta($post->ID, $custom_field, true);     if ($value) {      echo rtrim(substr($value,0,$trim_length));     }     ?>      It works - but I would like to have a "(...)" at the end of the trimmed text. And _only_ if the value really was trimmed. I used `if ($value) { echo rtrim(substr($value,0,$trim_length)) . '(...)'; } ?>` But this makes the "(...)" at the end of every text from custom field.. Thank you! AD


title: Add Permalink to Post Thumbnail, syntax code issues

text: I´d like to link `the_post_thumbnail` by using the `the_permalink`. I do this ( **It Works without link** )               <?php $args = array( 'post_type' => 'xyz', 'posts_per_page' => -1, 'orderby' => 'rand' );     $loop = new WP_Query( $args );          while ( $loop->have_posts() ) : $loop->the_post();             the_post_thumbnail('wine-flow', array('class' => 'item'));          endwhile; ?>      And I´d like to do further this: ( **Syntax Error** )               <?php $args = array( 'post_type' => 'xyz', 'posts_per_page' => -1, 'orderby' => 'rand' );     $loop = new WP_Query( $args );          while ( $loop->have_posts() ) : $loop->the_post();             <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >        <?php the_post_thumbnail('wine-flow', array('class' => 'item')); ?>        </a>          endwhile; ?>      Thanks   ogni


title: Wordpress Custom Post Type and sort by Tags

text:
I am currently making a custom Wordpress theme, but so far I am stuck at this little problem. I have created this custom post type. And in that page _(media.php)_ I want to be able to click on the tags, which will take me to the tag page _(tag.php)_ and from there it will only show the post under that tag I clicked on, but right now if I click on tag 1, it will take me to **tag.php** , but will show **ALL** media post, instead of the page with clicked tag. I have made a Custom Post type in **functions.php** **_add Custom Post Type (functions.php)_**               add_action( 'init', 'media_' );     function media_() {     register_post_type( 'media', array(       'labels' => array(         'name' => 'Media Post',         'singular_name' => 'Media',        ),       'description' => 'The Media.',       'public' => true,       'menu_position' => 21,       'supports' => array( 'title', 'editor'),       'taxonomies' => array('post_tag')          ));     }      and then my page custom page template will loop the tags like this **_loop the tags in custom page template (media.php)_**
         <?php            $archive_tags = post_type_tags( 'media' );              foreach( $archive_tags as $tag )              {                     echo '
<ahref="'                                . get_tag_link( $tag->term_id )                               . '">'                                . esc_html( $tag->name )                                . '
';             }        ?>
      and then I will loop through all the custom post with the post_type name _'Media'_ **_Loop the post (media.php)_**               <?php            $args = array( 'post_type' => 'Media');         $loop = new WP_Query( $args );     ?>     <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>         <?php the_content(); ?>                                  <?php endwhile; ?>      this work, I can see all the different tags, and the post in media.php. But the thing is when I go to tag.php. It just shows all the post in media.php with that post_type name. What should I write in **tag.php**? For reference, my code in tag.php look like this so far. and it looks just like media.php. **_looping the post, dosn't work (tag.php)_**                 <?php                  $args = array( 'post_type' => 'Media');             $loop = new WP_Query( $args );         ?>         <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>             <?php the_content(); ?>                                      <?php endwhile; ?>       _Example_ **Media.php**   1. Post 1, _tag: **a** , **b_**   2. Post 2, _tag: **a_**   3. Post 3, _tag: **b_** _then there is this list with all the tags available_   * tag **a**   * tag **b** _so lets say I click on tag **a_**. _It will rederict me to **tag.php_** But instead of showing me all the post like this   1. Post 1, _tag: a, **b_**   2. Post 3, _tag: **b_** it is showing all the post from **media.php**.  _NOTE_ ** I only want it to display the post from my custom-post-type: **Media**


title: Action hook for editing post

text: I'm looking for the add_action() hook for when a current post is edited and saved. I know there's `edit_post` and `save_post`, but I'm looking for something that ONLY fires when a current post is edited, not created or altered in any other way.


title: Is that worth it to find a designer for creating a WordPress theme for selling on ThemeForest?

text: I am skilled enough in WordPress and frontend development - CSS3/HTML5/JS. But I am not sure I can get approved quickly by ThemeForest team from design point of view. So I am wondering, do you think it's worth it to find some great designer, pay for PSD design that is done right way, turn it into HTML then into WordPress theme and try to publish on ThemeForest? What could you advise to do in my situation? Thanks!


title: Dynamic Image Links Depending on Excerpt/'Single Post' View

text: I'm working on a new Wordpress theme; the default index view displays the excerpts of recent posts. Some posts will be regarding file downloads, and include an image, description, and link to the location where the described files are hosted. The images for these types of posts will be anchored with links(other types of posts may contain images that are not linked). For these types of posts, I would like the images to link to their entry's full post views(single.php) when displayed in excerpts, but for the same images to link to an external download link when displayed as part of the full post view.(The links that point to an external url point to another page that hosts the files, and not to the actual files directly.) I'm not sure how exactly I would accomplish that. Any help would be greatly appreciated!


title: How to count the number of monthly archive?

text: <?PHP     $num_cats  = wp_count_terms('category');      echo $num_cats. '<br/>';         ?>      I get the number of total categories from the above code. How can I get the total categories based monthly archive? following code is not echoing the number of monthly archive:               <?php      $num_month_cats  = wp_count_terms (get_archives('monthly'));      echo $num_month_cats;     ?>       Any suggestion?


title: Custom Taxonomy Query

text:
I have setup two custom taxonomies for a custom post type that I have created. The post type is called beer, and the two taxonomies are country and brewers. I would like to list them like this.                Country      -->Brewers      ----->Beers      I can pull the countries using this code.                   $terms_country = get_terms('country');         foreach ($terms_country as $term_country) {         echo "
slug."\">";         echo 'name . '">' . $term_country->name       . '';         echo "
";      I need to query the country term to list the Brewers that have that taxonomy attached to the post as well.


title: How can I display all the blogs where this user is editor in Wordpress Multisite?

text: Very similar question with correct answer I guess my question is simple, I run multisite and on some blog I want to display <> thing The link I posted does not work for me, but it is marked as correct, what's the problem?               if ( ! function_exists( 'get_user_blogs_by_role' ) ) {     /**      * Get all blog IDs where the user has the given role.      *      * @param  int $user_id      * @param  string $role      * @return array      */     function get_user_blogs_by_role( $user_id, $role )     {         $blogs = array ();         $regex = '~' . $GLOBALS['wpdb']->base_prefix . '(\d+)_capabilities~';         $meta  = get_user_meta( $user_id );              if ( ! $meta )             return array ();              foreach ( $meta as $key => $value )         {             if ( preg_match( $regex, $key, $matches ) )             {                 $roles = maybe_unserialize( $meta[$key][0] );                      // the number is a string                 if ( isset( $roles[$role] ) and '1' === $roles[$role] )                     $out[] = $matches[1];             }         }              return $out;     }     }     $blogs = get_user_blogs_by_role( 1, 'administrator' );     var_dump( $blogs ); // Array ( 2, 14, 90 )      the code returns **NULL**


title: count results in search page based on custom category

text:
I have a seach page in which am showing results based on keyword and custom category search. Issue i am facing is that, I need to display the count of results. I had referred the wordpress documentation and found some codes, for eg :
Search Result for <?php          /* Search Count */          $allsearch = &new WP_Query("s=$s&showposts=-1");          $key = wp_specialchars($s, 1);          $count = $allsearch->post_count;          _e('');          _e('');          echo $key;          _e('');          _e(' — ');          echo $count . ' ';          _e('articles');          wp_reset_query();      ?>
      But this displays the total search results and I need results count filtered by found in the specified category