title: Archives for Custom Post Types (without Pages)

text: I'm basically looking to extend the default archives widget so that it not only displays a {month : year} list of the default Posts but also includes my new custom Post Type. From this example I was able get the new {month : year} items appearing in the archive list but not clicking through to anything. Then this example showed how to include items from Custom Post Types in the loop and allow them to click through and return the actual results. However, the last problem I have is that when clicking on the {month : year} item in the list it also returns results from Page entries too. I need to know how to filter out Pages from my results so it is just Post Types. The code I have in functions.php is:               /**      * Add custom Post Types to the Archives.      */     add_filter( 'getarchives_where' , 'ucc_getarchives_where_filter' , 10 , 2 );     function ucc_getarchives_where_filter( $where , $r ) {       $args = array(         'public' => true ,         '_builtin' => false       );       $output = 'names';       $operator = 'and';            $post_types = get_post_types( $args , $output , $operator );       $post_types = array_merge( $post_types , array( 'post' ) );       $post_types = "'" . implode( "' , '" , $post_types ) . "'";            return str_replace( "post_type = 'post'" , "post_type IN ( $post_types )" , $where );     }          /**      * Add Custom Post Types to The Loop results.      */     add_filter( 'request' , 'ucc_request_filter' );     function ucc_request_filter( $query ) {        // Preview does not like having post_type set; feed is my personal preference.       if ( empty( $query['preview'] ) && empty( $query['feed'] ) ) {         $my_post_type = $query['post_type'];         if ( empty( $my_post_type ) ) {           $query['post_type'] = 'any';         }       }       return $query;     }


title: Delete sites in wordpress multisite (not suspend)

text: When you delete a site in your wordpress network, it apear like suspend: ![Suspend sites](http://i.stack.imgur.com/TqVY3.jpg) For delete a site, user have to click a link that wp send to his email, when he checked the site be suspended, but it doesn't deleted. I want to do that the user can delete his site.


title: Remove 'portfolio' from URL

text: I was trying to remove **portfolio-view** from url and followed instructions to remove its name from highlighted section. This works but has left me with ' **portfolio** ' now even though field is blank. What is wrong with this code or need changing in breadcrumbs please? It is now grabbing 'portfolio' from somewhere and i want this hidden in url. I'm trying to get: `http://www.sitename.com/post` instead of `http//www.sitename.com/portfolio/post`.               /* Portfolio */           function my_post_type_portfolio() {           register_post_type( 'portfolio',           array(           'label' => __('Portfolio'),           'singular_label' => __('Porfolio Item', 'theme'),           '_builtin' => false,           'public' => true,           'show_ui' => true,           'show_in_nav_menus' => true,           'capability_type' => 'page',           'menu_icon' => get_template_directory_uri() . '/includes/images/icon_portfolio.png',          **'rewrite' => array(      'slug' => ' ',      'with_front' =>false,**      ),           'supports' => array(           'title',           'editor',           'thumbnail',           'excerpt',           'custom-fields',           'comments')           )      );      register_taxonomy('portfoliocat', 'portfolio', array('hierarchical' => true, 'label' => 'Portfolio Categories', 'singular_name' => 'Category', "rewrite" => true, "query_var" => true));      }               add_action('init', 'my_post_type_portfolio');       Breadcrumb setting is: `<a title="Go to %title%." href="%link%">%htitle%</a>` Permalinks: `/%postname%/`


title: I'm think I've found a bug with JetPack 1.7

text: There are dozens of other WP installs on the same server, subject to the same ModSec rules, and none of them has a problem. This is the only WP install that has jetpack installed and it only occurs when JetPack is active. The problem is as follows: Some actions on the post/page edit screen (so far it **seems** to be the ones that don't refresh the URL, like UPDATE or configure featured image) show me the following alert: http://i.imgur.com/ULPiX.png The logs show:               Received From: kvm1->/var/log/httpd/error_log     Rule: 1002 fired (level 2) -> "Unknown problem somewhere in the system."     Portion of the log(s):     body.xml:1: parser error : Document is empty          ModSecurity: XML parser error: XML: Failed parsing document. [hostname "www.mydomain.org"] [uri "/wp-admin/admin-ajax.php"] [unique_id "blablah"]          ModSecurity:  [file "/etc/httpd/modsecurity.d/00_asl_z_antievasion.conf"] [line "36"] [id "330791"] [msg "Failed to parse request body.  This may be an impedence mismatch attack, a broken application or a broken connection.  This is not a false positive.  Check your application or client for errors."] [data "XML parser error: XML: Failed parsing document."] [severity "CRITICAL"] Access denied with code 403 (phase 2). Match of "eq 0" against "REQBODY_ERROR" required. [hostname "www.mydomain.org"] [uri "/wp-admin/admin-ajax.php"] [unique_id "blablah"]      Jetpack is 1.7 WP is 3.4.1 Apache 2.2.15 PHP fCGId 5.3.3 Any ideas? The WP forum has been unresponsive so far. I've sent an email to JetPack support.


title: WordPress Search

text: I'm trying to write a search feature on a website of mine, and it seems like it's not pulling in any of the pages, only posts. Below is the code. Search Form:                         <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">                     <input type="text" value="Search" onblur="if (this.value == '') {this.value = 'Search';}" onfocus="if (this.value == 'Search') {this.value = '';}" name="s" id="messagesSearch" />                     <input type="hidden" name="post_type" value="postpage" />                     <img src="<?php bloginfo('template_directory'); ?>/includes/images/icons/search-light.svg" alt="">               </form>      Search:                 <?php            if(isset($_GET['post_type'])) {                $type = $_GET['post_type'];                if($type == 'postpage') {?>                      <?php if (have_posts()) : ?>                         <?php /* Start the Loop */ ?>                         <?php while ( have_posts() ) : the_post(); ?>                 <?php if ((get_post_type( $post ) == 'post') || (get_post_type( $post ) == 'page')) : ?>                      <?php the_title(); ?>                      <?php endwhile; endif; ?>                  <?php } } ?>      Thanks!


title: Wordpress query string rewrite .htaccess

text: At the minute my .htaccess looks like:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /testdirectory/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>     # END WordPress      I want to be able to turn this page:               /car-details/?make=Ford&model=Focus      in to:               /car-details/car-info/Ford/Focus      including the extra "/car-info/". I've tried quite a few combinations but I'm getting nowhere... any ideas? Thank you!


title: Blog posts are not appearing as subs of Blog Page

text: I'm trying to set up a new blog on my company website and blog posts are not showing up as subpages to the blog page. I would like for the url to all blog posts to read: techmdinc.com/blog/post-title How do I go about making this happen? Do I need to do it manually?


title: Archive-custome_post.php template not working

text: I have a site on WordPress 3.6.1 and I created a custom post type for recipes with the code:                add_action( 'init', 'register_cpt_my_recipes' );         function register_cpt_my_recipes() {         $args = array(         'hierarchical' => false,         'supports' => array( 'title', 'editor', 'custom-fields' ,'tag' , 'excerpt', 'thumbnail'),         'public' => true,         'show_ui' => true,         'show_in_menu' => true,         'menu_position' => 5,         'show_in_nav_menus' => false,         'publicly_queryable' => true,         'exclude_from_search' => false,         'has_archive' => true,         'query_var' => true,         'can_export' => true,          /* Not necessary but added as a solution */         'rewrite'=> array( 'slug' => 'my_recipes', 'with_front' => true ),         'capability_type' => 'post'         );         register_post_type( 'my_recipes', $args );         /* Not necessary but added as a solution */         flush_rewrite_rules( false );         }       I created `archive-my_recipes.php` custom template file but whenever I navigate to `mysite/my_recipes/` I end up with code from `archive.php` with all my posts not just posts form my custom post type. I tried `taxonomy- my_recipes.php` but also didn't work . also `single-my_recipes.php` is working fine. I read about the subject on the WordPress documentation site here and here This is the `body_class` output:               [ archive post-type-archive post-type-archive-Array logged-in admin-bar custom-font-enabled single-author customize-support ]       I added :               add_action( 'pre_get_posts', 'add_my_post_types_to_query' );          function add_my_post_types_to_query( $query ) {         if ( !is_admin() && $query->is_main_query() )             $query->set( 'post_type', array( 'post', 'page', 'recipes' ) );         return $query;     }      to function.php to include my custom post types in the main query.


title: wordpress register nav menu not showing in admin

text: I am using the following code to register a menu for my theme. In functions.php I have written the following:               register_nav_menu( 'header-menu', __( 'Header Menu' ) );      When going into wp-admin >appearance > menus, the menu is not showing up. Can anyone telll me what I am doing wrong?


title: Theme: Twenty Thirteen Mobile Sliding Menu Doesn't Bump Content Down

text: I have created a child theme for Twenty-Thirteen and somewhere while editing it I broke the mobile menu slider as it no longer pushes the content down and instead displays behind the content. I've changed the CSS in someway to cause this issue but I cannot find what has caused it. I am hoping that the cause will be more apparent to someone more familiar with CSS than I. To view this issue you must resize your browser to width of less than 700px or so and click the menu button revealing the slider menu and the content overlap issue. Note how the H1 tag "Quad Cities, Chicago, Des Moines Photographer Brian Barkley" is over top menu. Here is a link to the site: http://barkleyphoto.com/_wedding/ and here's a copy of the stock twenty thirteen to help compare http://twentythirteendemo.wordpress.com/ Here's an image to see for yourself what I am speaking of. ![enter image description here](http://i.stack.imgur.com/cE3jB.png)


title: Split loop into columns

text:
I'm trying to split my loop into 4 columns. My logic is very flawed here and my layout is breaking. Such a simple problem, but I'm struggling with it. I essentially need each group of four posts to be wrapped in a container "row" div. And, of course, whatever remaining posts are left over, even if less than four, to be wrapped as well.
             <?php           $i = 0;           if (have_posts() ) : while ( have_posts() ) : the_post();              if ($i == 0) { echo '
'; }             if ($i%4== 0) { echo '

'; } ?>
                 <?php the_post_thumbnail(); ?>
Title

                  <?php               if ( $i%4 == 0) {                 echo '
';               }               $i++;                   endwhile; endif; ?>
      I posted this over at stackoverflow as well, but no replies. Any suggestions to solve my problem here?


title: How to keep track of user logins?

text: I have a client with a private Wordpress blog - that is to say, you need to log in to read it. We are using Counterize to keep track of visits to the site and to find the most popular pages. But now he wants to know which users are logging in, and perhaps how often they are logging in to read this blog. I checked to see if there was any info in wp_usermeta ( like last-login-date ) but there doesn't seem to be. Any suggestions how to keep track of user's activities? Thanks


title: Get Widget Instance inside Widget

text: I'm trying to access the $instance variable from a custom function I've written inside my Widget, but I keep getting a "variable is undefined" error. How can I re-create the $instance variable?               public function __construct() {              parent::__construct(             'cst_twitter_widget',             __( 'CST Twitter Tweets', 'chicagosuntimes' ),             array(                 'description' => __( 'Displays Tweets from a given list url.', 'mythemename' ),             )         );              add_action( 'wp_head', array( $this, 'cst_twitter_feed_ajaxurl' ) );         add_action( 'wp_ajax_refresh_tweets', array( $this, 'refresh_tweets' ) );          }          /**      * Set the AJAX URL for the Twitter Feed Widget      */     public function cst_twitter_feed_ajaxurl() {     ?>         <script type="text/javascript">         var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';         </script>     <?php     }          /**      * Display the updated Twitter Feed      */     public function refresh_tweets() {              //my custom function, where i'm trying to re-create the $instance and access the values         $instance = self::$instance;         echo $instance['cst_twitter_screen_name']; //the variable i'm trying to access         die();     }          public function widget( $args, $instance ) {         //the widget instance     }          public function form( $instance ) {              //the form     }          public function update( $new_instance, $old_instance ) {              $instance = $old_instance;         $instance['cst_twitter_screen_name'] = $new_instance['cst_twitter_screen_name'];              return $instance;          }


title: Get Terms from Custom Taxonomy and Current Post

text:
I'm working with the WooCommerce plugin. I've got three products (called "Kits") and each kit contains several items. The "items" are a custom post type which are linked to each kit via a relationship field. Each item has a custom taxonomy attached to it ("departments"). The departments have no direct link to the products (or "kits"), except via the items. When I display the products, I want them to show a `<ul>` that loops through each term found in "departments". Then within that `<li>`, have a nested `<ul>` that lists each item that is found in the current department AND in the current product. I've got a loop that's working to display the items associated with each product:               <a href="#details<?php the_ID(); ?>" class="details button" data-id = "<?php the_ID() ?>">Details     <div class="items" id="details<?php the_ID(); ?>">       <?php  $items = get_field('kit_items');?>     <?php if( $items ): ?>
         <?php foreach( $items as $item ): ?>             <?php $ident = $item->ID ?>
                 <a href="#overlay<?php echo $ident ?>" class="item item<?php echo $ident ?>" data-id ="<?php echo $ident ?>">                     <?php echo get_the_title( $item->ID ); ?>
         <?php endforeach; ?>
     <?php endif; ?>      But I'm not sure how to query the custom taxonomy, print out the terms and then print the items that are associated with the department and the current product.


title: Advanced Custom Fields - Relationship post foreach query

text:
I've created a post type, called Package (for news packages), and want to be able to link to specific blog posts and display them on the single-package.php page. I'm using ACF relationship fields, and using the post ID (tried with post object as well, but had the same problem) The issue is that the title and permalink calls within my foreach statement aren't working. They're using the Package's title and permalink, instead of the posts title and permalink, despite using $item->ID in each call. Here's the code:               <?php while (have_posts()) : the_post(); ?>

Package: <?php the_title(); ?>

         <?php the_content(); ?>
         <?php              $items = get_field('package_items');             ?>             <?php if( $items ): ?>
                 <?php foreach( $items as $item ): ?>                 <?php setup_postdata($item); ?>
                         <a href="<?php echo get_permalink( $item->ID ); ?>">                             <?php echo get_the_title( $item->ID ); ?>
                 <?php endforeach; ?>
             <?php endif; ?>              <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>     <?php endwhile; ?>      You can see the resulting output of the above code here. Any thoughts?


title: Echo out element to another page.

text: I have a small plugin that displays how many submissions are left on current ninja form. And writes it out as so               <p id="submissions-left">hurry only 25 submission left. <\p>      And tacks it onto the end of the form. How can I get that p tag to another page? Anyway to target the id and echo it out on another page? Say have a shortcode to use? Thanks


title: wp_list_categories output /defaultcategory+category2/

text: I need output this /default_category+ and add after that comes all site categories and then list those. I need to list this so I can make ready list, so user can search post that are in under default category. Example: www.mydomain.com/categories/defaultcategory+category1/ www.mydomain.com/categories/defaultcategory+category2/


title: filter title from shortcode

text: Just wondering how to filter to change the current page title from a shortcode, Since shortocodes are rendering after $post. any idea to archieve something like : `do_shortcode(['mytitle="newtitle"']);`


title: Wordpress to use Drupal users' credentials

text: I have both Wordpress and Drupal installed on two domains. I want the users that register via Wordpress to be stored in Drupal's user table. Also, any login attempts should be checked against Drupal's database. I don't have a lot of experience with either (though I'm fairly confident in my PHP skills). I am not looking for a way to mirror the users, but to actually tell Wordpress to use Drupal's database. I think I have to rewrite the login and register methods on Wordpress. Am I wrong? And what's the best way to do this? (what files do I need to go into)?


title: Using in_category for non standard loops

text:
Im using wp favorite posts to show a list of favorited post by a user on a page. It creates a loop of posts but I can't figure out how to use conditional tags for posts in the loop. Specifically for posts in a certain category I need to show the image inside the loop below. So in the regular loop on my index page I just use `in_category'. But that isn't working with how the favorites loop is setup. Any suggestions on how to do this? Here's the loop.               <?php     echo "
";     if (!empty($user)):         if (!wpfp_is_user_favlist_public($user)):             echo "$user's Favorite Posts.";         else:             echo "$user's list is not public.";         endif;     endif;          if ($wpfp_before):         echo "
".$wpfp_before."
";     endif;          if ($favorite_post_ids):         $favorite_post_ids = array_reverse($favorite_post_ids);         foreach ($favorite_post_ids as $post_id) {             $p = get_post($post_id);             $video_code = get_post_meta($post_id,'video_code',true);             ?>

              <a href="<?php echo get_permalink($post_id); ?>" rel="<?php echo $post_id; ?>" class="postpopup">               //HERE I NEED TO USE IN_CATEGORY TO ONLY SHOW THIS IMAGE WHEN THE  POST IS IN CATEGORY "8".//               <img src="<?php $thumb = get_youtube_screen_link( $video_code, 'default' ); ?>" width="176" height="126">               <?php echo get_the_title($post_id); ?>               <?php wpfp_remove_favorite_link($post_id); ?>

        <?php }     else:         echo "
";         echo $wpfp_options['favorites_empty'];         echo "
";     endif;     wpfp_clear_list_link();     echo "
";     wpfp_cookie_warning();     ?>


title: Front-end image upload from TinyME

text: I'm trying to edit the Q&A Plugin (which for those of you that don't know it is a StackExchange-style plugin with Custom Post Types of Questions and Answers) to incorporate image uploads. It seems to use the built-in TinyMCE editor that came bundled with recent versions of WP. This comes with the "Media Library" buttons. Unfortunately, these only appear to be accessible to users with author privileges. If I can, I'd like to open this up to registered users. I can use the answer provided here to limit this to "upload" rather than for users to be able to access the Media Library, but **I can't find what to change in the Q &A plugin to allow this**. Alternatively, I'd be happy to install a TinyMCE plugin to allow basic image uploads. I tried the jbimages plugin for TinyMCE and wrote my own simple function to incorporate it with WordPress. The icon displayed, but the plugin itself seemed broken - it was listing strings like `{variables}` instead of the actual variables. Does anyone have a viable solution for this?


title: Is it possible to run javascript on plugin deactivated?

text: Is it possible to run javascript on plugin deactivated and if yes then, how should I achieve that. I have developing one plugin in which two new tables are created in wp database and on deactivation I want to confirm from users if he/she wants to delete those table before deactivating.


title: cutsom posts 404ing

text: I can't stop my custom post types from sporadically 404ing. It doesn't always happen and I can't predictably replicate the problem - as in sometimes it happens, sometimes it doesn't. However, once I clear the cache, the 404 always goes away and the URL works. I have tried resetting and re-saving the permalinks, which are currently category/postname. I have also tried playing around with the flush rewrite rules, setting them to blank and false, but nothing seems to cure the issue. Here is my current code:               add_action('init', 'create_raceresults_post_type');           function create_raceresults_post_type() {      register_post_type('raceresults', array(          'labels' => array(              'name' => 'Race Results',              'singular_name' => 'Race Results',              'add_new' => 'Add New Race Result',          'add_new_item' => 'Add New Race Result',          'edit' => 'Edit Race Result',              'edit_item' => 'Edit Race Result',              'new_item' => 'New Race Result',              'view_item' => 'View Race Result',              'search_items' => 'Search Race Result',              'not_found' => 'No Race Result found',              'not_found_in_trash' => 'No Race Result found in Trash'          ),          'public' => true,      'exclude_from_search'=> false,      'rewrite' => array('slug' => 'best-running-training-program', 'with_front' => true),      'supports' => array(              'title',              'excerpt',              'title',              'excerpt',          'editor',          'custom-fields',          'revisions',          'thumbnail',          'author',          'page-attributes'               ),          'taxonomies' => array('category', 'post_tag') // this is IMPORTANT      ));      flush_rewrite_rules();      }       Is there something I am missing or not trying? Here is an example of that custom post: http://runnersconnect.net/best-running-training-program/race- results-march-24-march-25/. I just tried it and it worked when I first published 60 minutes ago but just 404ed when I tried to check it. Thanks in advance!


title: Get value in custom field with taxonomy

text: I have custom field `my_cf` for Taxonomy/Term. How can I get and output value with custom field for taxonomy/term? I've tried using:               $variable = get_field('my_cf', 'basic');        echo $variable;       where basic - name for my taxonomy. But this doesn't work. Any suggestions?


title: I am officially missing something about transient posts

text: I have no issue creating transients. What I have an issue with is pagination - and I have made posts on it before and every one sates that the query must look like, for example:                       $queried_post = array(                 'post_type' => 'post',                 'paged' => get_query_var( 'paged' )             );       Which is then:               $query = new WP_Query($queried_post);      and stored:               set_transient('posts', $query, 60); // For testing purposes, we reset every 60 seconds.      So then I do:                   gloabl $wp_query;              $original = $wp_query;         // Obviously you would do checks to see if the transient         // exists. But lets assume it always exists.         $wp_query = get_transient('posts');              if($wp_query->have_posts()){             while ($wp_query->have_posts()) {                 $wp_query->the_post();                 // display content ...              }                  var_dump($wp_query->max_num_pages); // Shows me: float 4             echo get_next_posts_link( __( 'Next', 'textdomain'), $wp_query->max_num_pages );             echo get_previous_posts_link( __( 'Previous', 'textdomain'), $wp_query->max_num_pages );         }              $wp_query = $original;      I have even attempted everything I know, including testing the original query and the pagination on that works just fine, I can paginated back to 4 pages and forward to the latest. So the query **not set in a transient** works. But setting it up in a transient causes pagination to fail... Why? I cant figure out. Can some one tell me?


title: Filter to remove the default password on "Your Profile" page

text: Whenever I go to my "Your Profile" page to edit any of the settings other than the password, I have to manually empty out the password field to avoid errors/nags. Is there a filter I can place in functions.php that will empty the password field by default?


title: using wp_query to return posts w/ comment count > 0

text: I've looked at numerous examples of wp_query and can't figure this out. If the thing I was comparing were a meta value then I could to a meta query, but apparently you can't do a compare with a non-meta value? This is what I thought it would work:               $commentpost = new WP_Query( array( 'key' => 'comment_count',                                     'value' => '0',                                     'compare' => '>',                                                                                'orderby' => 'comment_count',                                     'order' => 'DESC',                                     ) );      Any help would be appreciated.


title: Login to wp-admin "redirect_to" points to wrong URL after migration

text: I have a WordPress site hosted on GoDaddy, it's a Windows server, (i have the `web.config` set up). and `.htaccess` correctly configured. The site was working on `example.com/wordpress` , as it was a development test. I moved the site to `example.com` . I changed the site url and wordpress URL to `example.com` on the database through PhpMyAdmin, and updated the permalink structure. I also updated all the wp_post 'content' field to change the URL's. ## Issue When I try to Log In to the admin panel through `example.com/wp-admin`, the URL shows as               example.com/wp-login.php?redirect_to=http://example.com/wordpress/wp-admin/reauth=1      Why could this be happening if both the site url and wordpress url match, and match with the database. ## Additional Notes This isn't a cache issue (At least not on the browser's side), I have tried different browsers, and I do most of the testing on incognito chrome windows. I have tried setting `update_option`for both `siteurl` and `home` in `functions.php` and:               //wp-config.php     define('WP_HOME','http://example.com');     define('WP_SITEURL','http://example.com');      I also tried the Relocate Method explained on the Codex http://codex.wordpress.org/Changing_The_Site_URL


title: How To Make Iris Color Picker Showed Up Over Form and Text?

text: Is there a way to make wordpress default color picker (iris) showed up over form and text using wordpress api? Its inline display messing up the administration page of my plugin each time the color picker box showed up.


title: Excerpt filter is adding '</p>' in incorrect place

text:
I'm using the following code from this question in order to limit the excerpt length to 2 paragraphs.               if ( ! function_exists( 'wpse0001_custom_wp_trim_excerpt' ) ) :           function wpse0001_custom_wp_trim_excerpt($wpse0001_excerpt) {     global $post;     $raw_excerpt = $wpse0001_excerpt;     if ( '' == $wpse0001_excerpt ) {          $wpse0001_excerpt = get_the_content('');     $wpse0001_excerpt = strip_shortcodes( $wpse0001_excerpt );     $wpse0001_excerpt = apply_filters('the_content', $wpse0001_excerpt);     // Here we choose how many paragraphs do we want to cutthe excerpt at, This part thanks to Clément Malet     $wpse0001_excerpt = "
$wpse0001_excerpt
";         $wanted_number_of_paragraph = 1;         $tmp = explode ('
', $wpse0001_excerpt);         for ($i = 0; $i < $wanted_number_of_paragraph; ++$i) {            if (isset($tmp[$i]) && $tmp[$i] != '') {                $tmp_to_add[$i] = $tmp[$i];            }         }     $wpse0001_excerpt = implode('
', $tmp_to_add) . '
';          $wpse0001_excerpt = str_replace(']]>', ']]>', $wpse0001_excerpt);          $excerpt_end = ' ' . ' » ' . sprintf(__( 'Read more about: %s  »', 'pietergoosen' ), get_the_title()) . '';      $excerpt_more = apply_filters('excerpt_more', ' ' . $excerpt_end);           //$pos = strrpos($wpse0001_excerpt, '</');     //if ($pos !== false)     // Inside last HTML tag     //$wpse0001_excerpt = substr_replace($wpse0001_excerpt, $excerpt_end, $pos, 0);     //else     // After the content     $wpse0001_excerpt .= $excerpt_end;          return $wpse0001_excerpt;          }     return apply_filters('wpse0001_custom_wp_trim_excerpt', $wpse0001_excerpt, $raw_excerpt);     }          endif;           remove_filter('get_the_excerpt', 'wp_trim_excerpt');     add_filter('get_the_excerpt', 'wpse0001_custom_wp_trim_excerpt');      I have set `$wanted_number_of_paragraph` to `2`. If found more than one paragraph in a post the result is correct:

Text

Text

      If found only one paragraph in a post the result is incorrect:

Text

      I tried to modify a bit the above code but none of my modifications works. Any ideas why this happens?


title: save_post action not firing due to old page_template meta data

text: I have some functionality hooked to the save_post action that wasn't working for a user on a particular WordPress Page. After some digging I found that wp_insert_post() was returning before getting to do_action( 'save_post'.... because of the following logic: (wp-includes/post.php line 3187...)               if ( !empty($page_template) && 'page' == $data['post_type'] ) {         $post->page_template = $page_template;         $page_templates = wp_get_theme()->get_page_templates( $post );         if ( 'default' != $page_template && ! isset( $page_templates[ $page_template ] ) ) {             if ( $wp_error )                 return new WP_Error('invalid_page_template', __('The page template is invalid.'));             else                 return 0;         }         update_post_meta($post_ID, '_wp_page_template',  $page_template);     }      Turns out the user had assigned a page template to the page when using a previous theme, but my theme doesn't support page templates. In this case, the $page_template variable above is set to 'template-grid-gallery.php', which is not a template file in the current theme. Consequently, the function returns zero and never reaches the save_post action (several lines below). Is there some way to explicitly turn off page template support in a theme so that WordPress doesn't ever check for a page template. Otherwise it seems like the save_post action would never fire if the page has a page template assigned, but is using a theme without page template support. Obviously I could just delete the _wp_page_template meta data for that page, but I'd like to protect against this kind of problem for other users in the future.


title: Menu Items Disappearing

text: I'm running WP 3.5.1 and I've a menu with about 100 items. When I add new items to the menu older ones disappear. I'm not running Suhosin or similar stuff. What can be the cause? Note: I'm on a dedicated server.


title: Sorting a list of users by a user taxonomy with Pods

text: I’m trying to use user taxonomies to sort my userbase into categories and then show a list of taxonomies in the sidebar that on click expands to show the users within each taxonomy. I’m struggling a bit with this as get_users() doesn’t allow you to query by taxonomy as they aren’t stored in the usermeta table. So I thought a relational field with pods might allow me to do this, but I’m having a hard time wrapping my head around pods and pulling data out. So here is the original code: https://gist.github.com/mrpritchett/ee86154f32aac7a31b36 And here is my attempt to echo any data from my pods attempt (it fails with the error Fatal error: Call to a member function find() on a non-object in…): https://gist.github.com/mrpritchett/16687da67735c01b02ed An explanation on what I’m doing wrong with pods would be greatly appreciated and any ideas/help with the greater problem would be icing on the cake! :)


title: Plugin dont Work Inside AJAX Call

text:
I'm doing a Progress Bar Shopping Experience (in my WooCommerce site). First the user select the plan (demo, home, business, premium), then select the products he wants, and finally I've to show them the cart table. I use the following code to send the items using AJAX (In the same template):               <?php         if(isset($_POST['action']))          {           global $woocommerce;           $woocommerce->cart->empty_cart(true);                            $woocommerce->cart->add_to_cart( 2932, 30 );                echo do_shortcode('[woocommerce_cart]');           die();         }     ?>     <?php get_header(); ?>

     <?php echo do_shortcode('[woocommerce_cart]');?>          <?php get_footer(); ?>     <?php get_sidebar(); ?>      My problem is that the table (the first one) that return the AJAX is WITHOUT the price discounts of the plugin "woocommerce dynamic pricing discounts". But if inside any template i use:                 <? echo do_shortcode('[woocommerce_cart]'); ?>      Its return the table (second table) WITH the price discounts... You can see the example here: http://cl.galyleo.net/prueba-carro/ of the code with the 2 cases. Any ideas?


title: Can't update multiple rows with $wpdb query

text: it seems that I cannot update multiple rows to change the post_type of posts having a specific tag. I follow different method, even if it seems the good one is this one :               global $wpdb;     $result = $wpdb->query("UPDATE $wpdb->posts SET $wpdb->posts.post_type = 'editorial_post' WHERE $wpdb->posts.post_type = post AND $wpdb->postmeta.meta_key = 'tag'      AND $wpdb->postmeta.meta_value = 'editorial'");     var_dump($result);      `Var_dump()` always returns a null result. Can someone tell me where I'm wrong ? Thank you very much.


title: Displaying custom filed content instead of post content

text: Plugin allow to add a custom field in post/page. In post/page, i create a custom field, so user can input content on this field. And i want if user input to this field, the post/page will display this content on screen, instead the main content that input via post/page editor. Anybody can let me know how to do this ? It is a plugin, so i can not edit template. I have tried with add_filter -> the_content , but it seems only apply for post type, how to make it works with both post/page type ?               add_meta_box(                 'st-page-builder',          // Unique ID                 esc_html__( 'Page Builder', 'page-builder' ),       // Title                 'pageBuilderCallBack',      // Callback function                 'post',                 // Admin page (or post type)                 'advanced',                 // Context                 'default'                   // Priority             );          function pageBuilderCallBack($object, $box) {         wp_nonce_field( basename( __FILE__ ), 'page-builder-nonce' );         $page = get_post_meta($object->ID, 'page_builder', true);         require_once 'form-input.php';     }          function displayCustomContent() {         // how to replace main post content with custom content ?         if (is_page() || is_single())          {               global $post;                    $pageBuilderContent = trim(get_post_meta($post->ID, 'page_builder', TRUE));                    if ($pageBuilderContent) {                    return $pageBuilderContent;               }          }               return $content;     }           add_filter('the_content', 'displayCustomContent');


title: jQuery .load and WP function

text: I am attempting to get the Quick Chat WordPress plugin to load only if you click on a button. I'm currently using this code:               $('#chat').load('path to my wp template/quick-chat.php');      ... where the file 'quick-chat.php' has a WordPress function that calls Quick Chat. When the file loads, however, it's not recognizing the function. It's acting like it was outside of WordPress. Any ideas?


title: Display check marked taxonomies as drop down menu

text: I've built a hierarchical taxonomy that displays a master list of available fragrances in the admin. When you create a page, you checkmark the fragrances that are available for that particular post. I used this code to functions.php and it seems to work in the admin:               add_action( 'init', 'build_taxonomies', 0 );          function build_taxonomies() {     register_taxonomy(     'scents',     'page',     array( 'hierarchical' => true,     'label' => 'Scents',     'query_var' => true,     'rewrite' => true ) );     }      Now I need to output the checkmarked items so they display on the post in the form of a drop down menu. The problem is that it outputs ALL scents that have been check marked across ALL pages. I just need it to output the ones that have been check marked on the page you're on. Here's the code I used:               <?php wp_dropdown_categories('taxonomy=scents'); ?>      How to edit this so that it only shows the fragrances for the page I'm on? Thanks.


title: How to check if a shortcode exists?

text: I'm using `do_shortcode` function to add shortcode in my template. But i would like to check if that shortcode exists before display them. I mean like this               If (shortcode_gallery_exists) {       echo do_shortcode('[gallery]');     }      Can anyone help me? Thanks


title: Multi language site

text: I found that two most popular plugins for multi language sites are WMPL and qTranslate. First one is commercial, so this is not option, and second doesn't have ability to translate widgets in sidebars, or I don't know how to do it. Can you suggest me which plugin to use or what trick to do to have multi language widgets?


title: Followers for WordPress

text: I'm seeking a system for following (like used on Twitter.com) with the following parameters, or close to them, and I'm curious if anybody has a solution. I would like to avoid BuddyPress. **Basic PHP Code for Follow/Unfollow Links in WordPress Templates** A PHP code which generates a link that can be inserted on author pages to Follow/Unfollow a user. If the logged-in user is already following the author they are viewing, then the link will say "Unfollow". If the logged-in user is not following the author they are viewing, then the link will say "Follow" and allow them to follow the user. **A PHP Code Which Produces a List of All Authors Being Followed by Logged-in User** This would be useful to create a "Following" list so users have an easy place to view their author pages and un-follow them. Must be able to insert it on a page. **A PHP Code Which Produces a List of Users Following Logged-in User** This would be useful to create a list of "followers." Must be able to insert it on a page. **The Followed Authors Being Incorporated Into The Loop** I bet this would be the most practical way to incorporate posts from those being followed into a "stream," or loop of posts. I assume some function which pulled posts from followed authors may need to be created. Then posts could be grabbed in the normal fashion and the posts from authors being followed would be mixed in via the same method as all the other posts (for example, by date published). **Capacity/Scalability Concerns** I do not just want a comma separated list of user_id fields in a wp_usermetavalue to be created as this would only work up to a certain number of followers - think scalability.


title: Admin ajax request return 0 with die()

text: So i'm using this configuration for an AJAX call in the administrative area (like this):               add_action( 'admin_head', 'ajaxPerNgg' );          function ajaxPerNgg(){ ?>     <script type="text/javascript" >     jQuery(document).ready(function() {         jQuery("#message").remove();         jQuery("#errore a#attivo").click(             function(){                 var data = {                     action: 'my_action'                 };                 jQuery.post(ajaxurl, data, function(response) {                     if(response == "attivato")                         jQuery("#errore a#inattivo").attr("id","completato").html("Attivato");                     else                         jQuery("#errore a#inattivo").attr("id","attivo").html("Attivalo ora");                 });             }         );     });     </script>     <?php }          add_action('wp_ajax_my_action', 'my_action_callback');          function my_action_callback() {         echo 'attivato';         die();     }      It's just a test code, but it always return 0 instead of the string "attivato". It also find the ajax url correctly, without a 404 error.   What is the problem?


title: Custom Permalink with Dynamic Taxonomy for Custom Post Type - Works, but breaks other permalinks

text: My custom permalink with dynamic taxonomy is working for my custom post type. However, it breaks all my other permalinks. They display a 404 error in the content area (header and sidebar still display). I used the following code to create the dynamic permalinks for the custom post type:               /*Adds Custom Permalinks for Course Segments*/     function custom_post_link($post_link, $id = 0)     {       $post = get_post($id);            if(!is_object($post) || $post->post_type != 'course-segment')       {         return $post_link;       }       $course = 'course-segment';            if($terms = wp_get_object_terms($post->ID, 'course'))       {         $course = $terms[0]->slug;       }       return str_replace('%course%', $course, $post_link);            return $post_link;     }          add_filter('post_type_link', 'custom_post_link', 1, 3);      I also added the following to my `create_post_type()` function:               'rewrite' => array('slug' => '%course%')      I got the code to do this from: http://stackoverflow.com/questions/7723457/wordpress-custom-type-permalink- containing-taxonomy-slug. By simply commenting out the following two lines of code my old permalinks work, but of course my dynamic permalinks don't:               //add_filter('post_type_link', 'custom_post_link', 1, 3);               //'rewrite' => array('slug' => '%course%')      In `Settings` my permalinks are set to `%postname%`. Any thoughts or insights on how I can get both my normal permalinks and my dynamic custom post type permalinks working would be most appreciated! -Mark


title: Change meta box when the page's template is changed

text: For my WordPress theme I have a custom portfolio post type and a portfolio page template to display them. What I want to do is add a meta box to the edit page area, but only when the page has the portfolio template. Thanks.


title: W3 Total Cache can't create files

text: I want to use W3 Total Cache plugin. Installed plugin succesfully but i'm trying to enable Page Caching and i'm getting this error : > Page caching is not available: advanced-cache.php is not installed. Either > the /home/content/92/7450992/html/wp-content directory is not write-able or > you have another caching plugin installed. This error message will > automatically disappear once the change is successfully made. Plugin can't create advanced-cache.php to wp-content. wp-content's CHMOD is 777 but still same error. Do you have any idea ?


title: How can I make my posts on my home page just show summaries?

text: My home page lists all my recent posts, however it displays each post in its entirety. Is there any way I can force it to just show a preview, such as the first 10 lines? This would enable views to quickly scroll through and see the topics recently blogged, rather than having to scroll through a recent post which is incredibly large. (this also helps with more Ad impressions I believe) Under Settings > Reading, there is the following option `For each article in a feed, show ...Full Text / Summary` but I think this is only for feeds (RSS). Thanks * * *


title: Grouping posts by a custom meta value

text: I'm trying to output a list of dates that are held in a meta key called event_dates without duplicates. I've also tried a `wp_query` with a `meta_compare` but I'm not able to make that work either. Any help would be greatly appreciated. Thanks!               <?php          $args1 = array(             'post_type'=>'cw_events',             'showposts'=>-1,             'order'=>'ASC',                         );               $archive = get_posts( $args1 );               foreach( $archive as $post ) :              setup_postdata($post);             global $wpdb;                  $metatable = $wpdb->prefix."postmeta";                $post_id = $post->ID;                 $cal_dates = $wpdb->get_results(                 $wpdb->prepare(                     "SELECT meta_value                      FROM $metatable                      WHERE post_id=%d                      AND meta_key='event_date'",$post_id             ) );                  //output posts -- trying to use array_unique(), but it's not working                 $cal_dates = array_unique($cal_dates);               foreach ($cal_dates as $cal_date) {                       echo var_dump($cal_date);                 echo $cal_date->meta_value.'<br />';                      }          endforeach;      ?>      I saw this post, but the method does not seem to work. There's no such function as `get()` in wp.... Group posts by meta_key PS sorry for the messy code, SE seems to be having some trouble dealing with returns...


title: What is the most comprehensive backup plugin for WordPress (it does not have to be free)?

text: Related to this question I am currently using Automatic WP backup. It works ok. Now I am looking for something more comprehensive and granular. A plugin that let's me choose the sites to backup inside my network, the type of content, the granularity on restores. ETC. Examples of things that I will like to do:   * Schedule a backup, with notification to owners (site owners)   * Verification of the backup (that it will work once I need it).   * That I can change variables important to restore in different webhost


title: Transferring standalone wordpress blog to the one under **.wordpress.com

text: I have a blog that is working on wordpress installation and now I want to transfer it to the my new blog under WordPress.com domain name. Is it possible to carry all the content to new WordPress blog?


title: Contact information footer

text: I am new to Wordpress but forced to create a website as a Wordpress template for my current employee (I am a front end developer, mostly build new systems/apps etc from scratch). Creating the template is no issue, but how do I go about making everything fully editable? For example the footer: it contains contact information and I would like information to be fully editable from within the Wordpress admin. Everything however seems to resolve around posts and articles... so, my first idea was to simply make posts and categorize those as "Footer" and then filter the displayed posts on the loop in footer.php by that category but that doesn't seem very logical. What is a more common approach? Widgets? If widgets is the answer, how exactly do those present themselves in the admin section? Sorry for the long question :)


title: Finding the category id's on category intersection pages

text: I'm using category intersection pages for users to be able to filter posts by categories. E.g. http://freemapsalgarve.com/category/destinations/alvor+bars-pubs/ Here the user is filtering on the "alvor" AND "bars-pubs" child categories of "destinations". I want to be able to get the id's of the categories that are being filtered on the page so I can display them to the user but I am only able to get the first category. `$this_cat = get_category(get_query_var('cat'));` ...returns the first category "alvor" in this example. Does anyone know how I could find the both categories being filtered on here?


title: Theme URLs problem

text: I programmed a theme post (edit: probably that's the `single.php` template) which uses the function `get_userdata( $_GET['p'] )`. But the main admin reformatted urls to this: `~/author/gamelaster` (default is `?author=1`) and now this is not working correctly. > How do I get the id of Author in this URL format? Or > how do I get user slug + get id from database? But, I cannot use the standard author functions/post functions(get_ID etc).


title: How to link to a alternative page in CSS

text: I have a wordpress site and I want to be able to completely change a page that is displayed based on the browser size in my Custom CSS, so that if it is over 1500 pixels it loads a completely different page. Don't ask why it has to be this way, CSS syling does not do what I need as it's a complicated gallery that required a whole new template and new page, so now I want to be able to swtch between the 2 pages based on the browser size. I know I need to use this code - @media only screen and (min-width: 1500px) { but then I have not found what the code is to replace the page is that follows it. the Page id in wordpress is 164 and I want to replace it with 3902. If this is not possible what about changing the nav link in CSS instead so depending on the browser size it links to a different page? Thanks Jason


title: Limited excerpt with readmore

text: I wanted limited excerpt (40 words) with readmore link...I used this code below:               <?php echo apply_filters('the_excerpt',get_the_excerpt().'<a href="'.get_permalink().'"> read more </a>'); ?>      any help appreciated.


title: how can i add an array of post types to this query?

text: `$pp = new WP_Query('orderby=comment_count&posts_per_page=4'); ?>`


title: Comment moderation with disqus comments

text: Comment moderation on custom post types this answer shows moderation on custom posts. Is this possible with disqus?


title: How to set default metaboxes on user creation?

text: Just for repetition's sake, I want to do the following: I need to set custom fields and the excerpt metaboxes for WP default Posts post type when a new user is created. I know that by default WP doesn't show them but would like it to. I will be removing the Screen Options tab so the user won't be able to disable them. I know this question has been asked for different scenarios and I have tried using and changing the code that I found here and on the web that help manipulate this but without much luck (eg: How to set default screen options?). Obviously I've tried on different installs but it doesn't work. Is there another way of doing this?


title: How can I develop a plugin that generates a page dynamically

text: I want to develop a plugin that generates a page and embeds the page link in pages menu in the client part at the time of plugin activation. Please help me with this.


title: Filter query_posts by tag slug on "Tag Archive" page (when tag is 2 or more words)

text: I'm using the following to bring up a tag archive page:               <?php query_posts( "tag=". '' . single_tag_title( '', false ) . '' ); ?>      This works perfectly for all tags of one word only, but any tags of more than one word (eg: "tag one", slug: "tag-one") do not display. Is it possible to query_posts by tag slug, rather than single_tag_title? Thanks!


title: How do I define post titles as images using Custom Fields?

text:
I've tried to follow a guide that explain how to do so but failed and I don't know why it doesn't work. The guide: http://wordpress.org/support/topic/unique-header-image-for-each- post   1. In my posts (WP GUI), I've added a custom field named 'PostTitle'. The value of these Posts are 153 & 156 as the post IDs numbers. Furthermore, I've uploaded two title pictures to my theme images directory:     * http://letthemstare.com/wp-content/themes/manifest_v1.1/images/153.jpg     * http://letthemstare.com/wp-content/themes/manifest_v1.1/images/156.jpg   2. Under header.php , I've added the following: ID, $myfield, true); ?>              .entry-title {         border:none;         color:black;       <?php       if($postimage) {        ?>         background-image: url('http://letthemstare.com/wp-content/themes/manifest_v1.1/images/<?php echo $postimage; ?>.jpg');       <?php       } elseif(!$postimage) {        ?>         background-image: none;       <?php       }       ?>     }        3. Post titles images load to each post title individually but: a. Images doesn't replace original text title b. Images are shown only within posts and not on the main page c. I'm not sure that the images will function as a link on the main page I choose entry-title according to the following code in index.php:               <?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?>
      When I mask this line, the post titles on the main page disappear. Furthermore, on style.css h3 represents the post titles:               h3 {       margin-bottom: 5px;       font-size: 2.3em;       font-weight: bold;       text-align: left;     }      I'm afraid that I have a mistake in the title class but I don't know what it is and how to fix it. Kindly assist me in fixing the issues above. Your support would be most appreciated. Thanks in advance!


title: All in One Calendar Plugin Custom Post Type Query

text:
Hi I'm trying to write a query which will pull the events out from the All in One Calendar Plugin. This is what I have so far:               <?php  query_posts('post_type=ai1ec_event');?>     <?php while ( have_posts() ) : the_post(); ?>     <?php echo '
'.get_the_title().'
'; ?>     <?php endwhile; ?>      This works well to get the event titles and their respective content, but I need to get the event details out as well. eg. event dates, venue, location. Thanks


title: Wp Remote get with manual redirect

text: I set                add_filter( 'http_request_redirection_count', array($instance,'SetDirectionCount'));      to 0 I try to get 'http://boards.ign.com/The_Vestibule/b5296/' or 'http://www.informationweek.com/story/' but that gives me:                WP_Error Object ( [errors] => Array ( [http_request_failed]       => Array ( [0] => Maximum (0) redirects followed ) ) [error_data] => Array ( ) )      The head does not show me a redirection:               Array ( [headers] => Array ( [connection] => close [date] =>      Mon, 14 Mar 2011 01:40:19 GMT [server] => Microsoft-IIS/6.0 [p3p] => Array ( [0] =>       CP='NOI ADMa OUR STP' [1] => CP="TST" ) [x-powered-by] => ASP.NET [cluster-server] => \      ignprdappw64212 [x-aspnet-version] => 2.0.50727 [pragma] => no-cache [x-aspnetmvc-version]      => 1.0 [set-cookie] => BoardCookieV3%5Fboards%2Eign%2Ecom=dc=no&ra=False; expires=Wed,     14-Mar-2012 01:40:19 GMT; path=/; HttpOnly [cache-control] => private [expires] => Wed, 14          Mar 2001 01:40:19 GMT [content-type] => text/html; charset=utf-8 ) [body] => [response]   =>        Array ( [code] => 200 [message] => OK ) [cookies] => Array ( [0] => WP_Http_Cookie      Object ( [name] => BoardCookieV3%5Fboards%2Eign%2Ecom [value] => dc=no&ra=False        [expires] => 1331689219 [path] => / [domain] => [httponly] => ) ) )      Now... what I would have liked is information back from the head request that a 301 or 302 would be happening or even a 404, so that I could wp_remote_get that one instead. Am I doing something wrong? FYI: I need to manually redirect because I need to determine the base_href of an image if none is given in the HTML source (code: http://plugins.trac.wordpress.org/browser/wp-favicons/trunk/includes/class- http.php ) or some more background: http://wp.leau.co/2011/03/18/handling- redirects-for-wp-favicons-with-redirects-set-to-0-with-wordpress- wp_remote_get/


title: Running hundreds of WP in multisite

text: We are starting to rack up the number of WP websites and we're looking to have a bit more control over all of them, would multi site be the correct way to go? All the sites are running on different domains, different versions of WP and different plugins (with different versions of those). I don't want to blanket update all of the versions because I don't want to risk things breaking. So with that in mind would the only benefit be that I would have a super admin access and be able to switch between the sites quickly?


title: Is there a need to do apply_filter('widget_title', $instance['title']) or any other 'widget_xxx' filters?

text: I am reading the book Professional Wordpress, and have code like               $title = apply_filters('widget_title', $instance['title']);     $name = apply_filters('widget_name', $instance['name']);     ...      I wonder if there really are filters like `widget_xxx`? What do they do?


title: Sorting Posts Based On Meta Value Using AJAX

text: I am trying to short posts on frontpage/archive pages using AJAX. The AJAX call seems okay but nothing displaying. Here is the JS:               jQuery( document ).ready(function() {         jQuery( ".sbyp" ).click(function() {             jQuery("#list-items-review").empty();             jQuery(".ajaxloader").show();                  jQuery.ajax({                 type: 'POST',                 url: SHTR.ajaxurl,                 data: {"action": "priceshortaction" },                 success: function(response) {                     jQuery("#list-items-review").html(response);                     jQuery(".ajaxloader").hide();                     return false;                 }             });         });     });      And, here is the function:               function price_shorter_callback() {         $query = new WP_Query( array ( 'post_type' => 'smr_product', 'meta_key' => '_productprice' ) );         ob_start ();                 if ( $query->have_posts() ):                          while( $query->have_posts() ): $query->the_post();                          smr_product_the_frontend_item();                     endwhile;                      endif;             wp_reset_postdata();             $response = ob_get_contents();            ob_end_clean();            echo $response;            die(1);     }     add_action( 'wp_ajax_priceshortaction', 'price_shorter_callback' );     add_action( 'wp_ajax_nopriv_priceshortaction', 'price_shorter_callback' );      The function `smr_product_the_frontend_item();` is just a callback to display the posts. Here it is at pastebin. Where I am doing wrong?


title: How do i make this Taxonomy term code work?

text:
Hi i have this code below in my header file               <?php     if ( ! is_home() ) {          if ( get_post_type() == 'pretty-little-liars' ) {         echo '

';     }     if ( get_post_type() == 'revenge' ) {         echo '

';     }     if ( is_tax( 'series', 'pretty-little-liars' ) ) $stylesheet_uri = $stylesheet_dir_uri . 'http://www.tv-cafe.com/wp-content/themes/tvcafe/posttypecss/style-pll.css';     }     ?>      The first three "if" lines calls for a different header image which works properly, but the fourth "if" line i was trying to call for a different stylesheet for a Taxonomy term. I have a post type entitled gallery, and under the gallery post type i have the Taxonomy "Series" and one of the terms happens to be "pretty-little- liars". Here is what i want. Whenever a user click on a gallery post and it's under the Taxonomy Term "pretty-little-liars" I want it to have a different background image. The above code doesn't work for the taxonomy so what am i doing wrong or how do i fix this, suggestions anyone? I would really appreciate the help :)


title: Create template for taxonomy results limited by Custom Post Type

text: I've got a Custom Post Type with a Custom Taxonomy set up. So how do I create an archive template to display posts from that CPT, limited by taxonomy? Here's the deal: The CPT is called Shows. Each post represents an upcoming concert. Its archive page lives at mysite.com/shows. The taxonomy is called Bands. Each Show post is tagged with the Band performing the concert. What I want is to create an archive page to display all Show posts tagged with a certain band. For example, I want the visitor to be able to open mysite.com/shows/radiohead, and see all of the Shows posts tagged with "Radiohead" in the Bands taxonomy. How do I publish a template that will support that URL structure? Thanks for any help you can provide.


title: How to detect shortcode usage, submit a form from widget to that page?

text: I've created a plugin and now want to create a widget containing a form that will submit to the page where my plugin shortcode is embedded from any wordpress page on the front end. I assume that within my widget code I need to detect the page/post or permalink containing the shortcode and make that the action="" of my form. Does anyone know how to do this? I found this code for conditionally loading js/css based on found shortcode but not sure how to adapt to be used in my widget.               add_filter('the_posts', 'conditionally_add_scripts_and_styles'); // the_posts gets triggered before wp_head     function conditionally_add_scripts_and_styles($posts){     if (empty($posts)) return $posts;          $shortcode_found = false; // use this flag to see if styles and scripts need to be enqueued     foreach ($posts as $post) {         if (stripos($post->post_content, '[code]') !== false) {             $shortcode_found = true; // bingo!         break;     }     }          if ($shortcode_found) {     // enqueue here     wp_enqueue_style('my-style', '/style.css');     wp_enqueue_script('my-script', '/script.js');     }          return $posts;     }      Original post found here: http://beerpla.net/2010/01/13/wordpress-plugin- development-how-to-include-css-and-javascript-conditionally-and-only-when- needed-by-the-posts/ Any help is greatly appreciated. Thanks, Russ


title: Using Wordpress Redirection plugin to strip URL parameters via regex

text: I'm using WooCommerce on Wordpress to run a small online shop and Google is crawling loads of page variations such as:               http://domain/brand/brandname?orderby=rating&view=grid     http://domain/brand/brandname?orderby=price&view=list     http://domain/brand/brandname?orderby=date      As it stands there are more pages like this than products and it's likely that Google will consider some of them to be duplicate content. I'm planning on using the Wordpress Redirection plugin to create some regexp rules so that I can redirect each of these variations to the main product page. In other words, redirect:               http://domain/brand/brandname?orderby=rating&view=grid     http://domain/brand/brandname?orderby=rating&view=list               to:          http://domain/brand/brandname      To do this I just need to split the URL at the whilst keeping the page part - I think ?. How do I do this ? I've searched around on the web but haven't found a specific example and I'm hopeless with regular expressions !


title: Could not add 'LoginLogout' link using BAW login logout plugin

text: I installed and activated the 'BAW login/logout' plugin to bring login or logout link in my screen. but this is not working for me. can some one help me steps I followed: 1) Installed and activated'BAW Login/logout'plugin 2) In Menu panel I selected the value 'Login/Logout' and clicked on 'Add to Menu' 3) The 'Login/Logout' option is added to Menu structure 4) I saved the menu 5) I refreshed the website. But could not find the link 'Login' or 'Logout'


title: Most recent post from every category/taxonomy but sorted by date

text:
I am trying to get a list of the most recent post from every category/taxonomy. I have found a solution for this, but I want the overall list to be **sorted by post date**. At the moment it is sorted by category/taxonomy name. So if I post in cat A, then in Cat B and last in cat C: the post would be ordered: C, B, A (latest first). If I then post in cat B the order should change to: B, C, A Really would like it to work with custom taxonomy but default categories could work for me too. The code I have so far is from this site: http://wptheming.com/2012/08/display-the-most-recent-post-in-each-category/               //Retrieves all the terms from the taxonomy portfolio_category     //http://codex.wordpress.org/Function_Reference/get_categories     $cat_args = array(         'type' => 'post',         'orderby' => 'name',         'order' => 'ASC',         'taxonomy' => 'tax_name');     $categories = get_categories( $cat_args );              // Pulls the first post from each of the individual portfolio categories         foreach( $categories as $category ) {             $args = array(                 'posts_per_page' => 1,                 'post_type' => 'post',                 'tax_name' => $category->slug,                 'no_found_rows' => true,                 'update_post_meta_cache' => false,                 'update_post_term_cache' => false             );             $the_query = new WP_Query( $args );                  // The Loop             while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
                     <?php the_title(); ?>                     <?php the_content(); ?>
             <?php endwhile;             }         // Reset Post Data         wp_reset_postdata();         ?>      EDIT: I tried editing the first part of the code to:               $cat_args = array(         'type' => 'post',         'orderby' => 'date',         'order' => 'DESC',         'taxonomy' => 'tax_name');     $categories = get_categories( $cat_args );      But it still shows the posts in order of taxonomy name?


title: after logout, get_current_user_id still holds value

text:
I added a login, logout menu item to a menu with the following code in `functions.php`. After logout it redirects to the current page. But surprisingly enough, the `get_current_user_id` method still holds the value of the previously logged in user.               add_filter( 'wp_nav_menu_items', 'asv_add_usermenu_student', 10, 2 );               function asv_add_usermenu_student( $items, $args ) {                        if (is_user_logged_in() && $args->theme_location == 'top_student_menu') {                          $items .= "
Log Out
";                      } elseif (!is_user_logged_in() && $args->theme_location == 'top_student_menu') {                         $items .= '
 LOG IN
';                   }                   return $items;                 }      How to grt rid of it ?


title: How to install wpengine hosted multisite locally

text: Does anyone have any insight into how to install a copy of a wpengine hosted site locally? You can assume Wordpress migration knowledge i.e. I have a copy of the files and have imported the DB locally. I am getting 'Error establishing a database connection' even though I am 100% sure that I have edited the wp-config DB connection details correctly. This is a **multisite** install. **UPDATE** From wpengine : "You will need to remove our platform specific files found in the mu-plugins folder and the object-cache.php found in the wp-content folder...Outside of changing all of the subsite urls and the primary domain, there shouldn't be anything specific to our platform."


title: XML-RPC detailed author info for wp.getPosts

text: I'm working with XML-RCP since a few days. I recognized that the posts only contain the ID of the author of a post. I tried to get the specified user using `wp.getUser` but the XML-RPC user does not have the necessary rights to read the user list. I don't want to use an admin account for my iOS app just to display some posts… Now I found that I can pass a `fields` parameter with a list of fields I want to have in the response. Is there a possibility that I can use these parameters to display detailed informations on the author of a post?


title: Switched from query_posts to wp_query, pagination no longer working

text:
Switching a loop on a static front page from query_posts to wp_query. All is working other than the pagination link (which used to work). Example can be seen live here in "work" section. Here is my loop:                   <?php          $paged = (get_query_var('page')) ? get_query_var('page') : 1;          $args = array('category_name'=>'portfolio','posts_per_page'=>4,'paged'=>$paged);          $work_posts = new WP_Query($args);               if($work_posts->have_posts()) :              while($work_posts->have_posts()) :                 $work_posts->the_post();         ?>

                 <a href="<?php the_permalink(); ?>">                 <?php                     if ( has_post_thumbnail() ) {                     the_post_thumbnail();                     }                    ?>

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

              <?php endwhile; ?>

           <?php next_posts_link('load more'); ?>

            <?php wp_reset_postdata(); ?>              <?php else : ?>
Sorry, there are no posts to display
         <?php endif; ?>


title: Is it necessary to reset the query after using get_posts()?

text: Is it necessary to reset the query after using `get_posts()` ? I have been looking at this page and I don't see any reference to `get_posts()` ... I can't make it out for sure from this page either. I can't see why it wouldn't be necessary ( though on my test page it doesnt cause any problems without `wp_reset_postsdata()` `wp_reset_query()' or ''rewind_posts()' ) but if it is which is the right function(s) to use.


title: How to Loop within a Loop (Display Children and then Grandchildren)

text:
I am trying to develop a query for WordPress that will allow me to display a list of child pages with titles only, and then under each child page title, a list of grandchilden (children of the child) page titles AND their content. So for example, the output should be something like this:

Page 1

Child Page 1

Child Page 2

Grandchild

Hello, welcome to this grandchild page

Grandchild #2

Hello, welcome to this grandchild page

Child Page 3

Page 2

      It needs to be done dynamically, meaning I do not want to specify the post ID number as part of the query. I have tried using a standard WordPress Query and then nesting a second query within the first one - this failed. In addition, I also tried modifying the code seen here: http://wordpress.org/support/topic/query-child-pages-of-a-current-page-and- loop-through-each-child-page Finally, I also tried to modify this code:               <?php if ( have_posts() ) {  while ( have_posts() ) { the_post(); $thispage=$post->ID; }} ?>     <?php $childpages = query_posts('post_per_page=3&orderby=menu_order&order=asc&post_type=' . get_post_type( $post->ID ) . '&post_parent='.$thispage);         if($childpages){ /* display the children content  */                 foreach ($childpages as $post) :                 setup_postdata($post); ?>
<a class="" href="#<?php echo($post->post_name) ?>">                 <?php the_title(); ?>
               <?php           endforeach;          } ?>      I've been trying to get this working for more than a day now and i'm just going around in circles really. Would very much appreciate help in getting this working.


title: custom post type breadcrumb error when has_archive = false

text: I have a custom post type (team) and I do not use archive page (has_archive => false), when I visit single team post the breadcrumb contains inactive text "TeamSingleTitle". I would like to know how I can modify the breadcrumb function to remove this "Team" custom post name from the breadcrumb. I can't hide it using CSS as it's appended directly in front of the SingleTitle without even a space. If I change has_archive to true then it all works correctly and Team is created as a link and spaced accordingly.


title: WordPress save thumbnail but don't show it

text: WordPress don't show image thumbnail but save them. I have all version of image (eg. image.jpg, image-300x250.jpg) but WordPress don't detect them. Anybody got same problem as here?


title: Default PHP document / names needed for a Wordpress theme?

text: I am hosting my own version of Wordpress, and I'd like to do a custom theme for it to suit my website. However, with so many bits and pieces of examples on the Internet, I'm not really sure how many PHP documents I should have, and what names are they given inside a theme. So far, i only understand that there are the following PHP documents inside a Wordpress Theme itself :               404.php     comments.php     footer.php     functions.php     header.php     index.php     page.php     sidebar.php     single.php     style.php      Are there anymore? Is there a full list that I can refer to (like a cheat sheet)?


title: Is there any way to dynamically alter widget titles?

text: I have a case where that are a lot of widgets in several custom sidebars. I am wondering if there is a simple way to alter the titles of each widget dynamically. Typically a widget has a title field you can set manually or on the plugin itself. I wish to add something like a meta field value per post to each widget title. The logic would be something like:               $dynamic_title = get_the_title();     // add a filter to change the widget titles per post value     //     // The widget title would be something like "Recent Posts for $dynamic_title"      I know there is a `widget_title` filter but how do you target specific widgets? ps. I cannot use the regular `register_sidebar` parameters due to having many widgets needing specific titles.


title: Set Featured Image programmatically (in admin) with JavaScript?

text: I'm trying to set the post thumbnail (featured image) with javascript from an existing image in the media gallery. I would consider a php-based option too I suppose (one that would require clicking update before the images show up). **Some Background** I'm building a site for a music venue with a custom "event" post-type. Most of the time these events are unique, but there are some recurring ideas (for example, open mic night most tuesdays). I was thinking I'd like to put in a dropdown with some "presets" to populate the `add new event` form fields in the backend. It's a cinch (I think) to do this with the the tinymce, and my custom meta fields. The tough part is how to to put an (already uploaded to media library) image into the featured image box programmaticly. I know I can do make something work on the template end of things, but it would be nice to see that thumbnail pop up in the `add new/edit` view. Thanks!


title: Walker to add Bootstrap markup for wp_list_pages

text:
I'm using `wp_list_pages()` to create a nav of the pages in my site. Some pages have children so I need a dropdown menu in the nav to show the child pages and the Bootstrap markup for dropdown menus. To use Bootstrap I need to add class names to the corresponding `<ul>`, `<li>`, and `<a>` elements. I think the best way to add these classes is using a custom walker. How do I write this custom class to add the classes I need? The current html:

Home

Profile

         Products & Services

Buying

Selling

Managing

      The HTML I need:

Home

Profile

         Products & Services

Buying

Selling

Managing

      I've tried extending the walker class but I can't figure out how to determine whether the page has children and apply a class if needed. Here is my walker:               class My_Walker extends Walker_page     {       function start_el(&$output, $page, $depth, $args, $current_page) {         if($depth) {           $indent = str_repeat("\t", $depth);         } else {           $indent = '';         }              extract($args, EXTR_SKIP);         $css_class = array('page_item', 'page-item-'.$page->ID);         $attributes = [];         $children = get_pages('child_of='.$post->ID);              if(!empty($current_page)) {           $_current_page = get_page($current_page);           _get_post_ancestors($_current_page);                if(isset($_current_page->ancestors) && in_array($page->ID, (array) $_current_page->ancestors)) {             $css_class[] = 'current_page_ancestor';           }           if($page->ID == $current_page) {             $css_class[] = 'current_page_item';           } elseif($_current_page && $page->ID == $_current_page->post_parent) {             $css_class[] = 'current_page_parent';           }         } elseif($page->ID == get_option('page_for_posts')) {           $css_class[] = 'current_page_parent';         }              $css_class = implode(' ', apply_filters('page_css_class', $css_class, $page, $depth, $args, $current_page));              $output .= $indent . '
ID) . '">' . $page->post_title  .'';              if(!empty($show_date)) {           if('modified' == $show_date) {             $time = $page->post_modified;           } else {             $time = $page->post_date;           }           $output .= " " . mysql2date($date_format, $time);         }       }     }


title: Rewwrite rule for mapping plugin static file

text: I am thinking to move my static data to Amazon cloudefront and i am able to map all static data with the URL from the cloudefront except Plugins i have installed. I do not want to use any plugin to do this mapping as was thinking of writing some kind of rewrite rule to handle this. for e.g all the URL related to plugin static data (js/css etc) have this URL:               http://mysite.com/wp-content/plugins/rest_of_the_url      I want to replace this URL with                http://cdn.mysite.com/wp-content/plugins/rest_of_the_url


title: How to display Parent categories and Child Categories?

text:
I struggleing to find the best way to develop the below. Basically my website will have a landing page on the site ( **Sports Landing Page** ) and when the user clicks on a category on that page eg "Football" they will view another page with sub categories of the item they have just clicked on eg) Football clubs. Then once the user clicks on that football club they will be taken to a **Blog article page** about the subject. **Sports landing page**   * Football   * Rugby   * Swimming   * Running **Football**   * Manchester United   * Liverpool   * Blackburn Rovers   * Chelsea **Manchester United Blog Article** I've had a play around with categories but can't seem to figure out the best way to achieve this. Would you display all parent categories on page on the first landing page, then all child categories on the 2nd landing page and then have a specially designed post page for the blog article? I've tried to only show the parent blog categories but can seem to get the code to work:               <?php query_posts('cat=11&depth=0'); if (have_posts()) : while (have_posts()) : the_post(); ?>                <?php endwhile; ?>               <?php else : ?>
Not Found
          <?php endif; ?>      and then here is the code I have been using for the sub categories:                   <?php query_posts('cat=11&depth=1'); if (have_posts()) : while (have_posts()) : the_post(); ?>                <?php endwhile; ?>               <?php else : ?>
Not Found
          <?php endif; ?>      If anyone can help, it would be greatly appreciated. Thanks Paul


title: sort post types by amount of views

text: I have a custom post type that I want to do a type of news feed for, but I only want to show the ones with the most views. I know I can do a query for an "archive" of my post types, but my question is "how to sort the query by views"?


title: Twenty Eleven child theme anchor top menu not clickable

text:
I am working on child twentyeleven theme. I have to do three things to my child theme. 1-Using page.php coping in my child theme.I added the code in page.php at top of the code                <?php if (is_front_page()){             get_header( 'home' );         }           else {             get_header();     }?>      2-header-home.php created in child theme using header.php. 3-In header-home.php i did one replacement that nave section from bottom of header.php and put at top but inside as               <body <?php body_class(); ?>>

<?php _e( 'Main menu', 'twentyeleven' ); ?>
                     <?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff. */ ?>
<a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to primary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to primary content', 'twentyeleven' ); ?>

<a class="assistive-text" href="#secondary" title="<?php esc_attr_e( 'Skip to secondary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to secondary content', 'twentyeleven' ); ?>
                     <?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assigned to the primary location is the one used. If one isn't assigned, the menu with the lowest ID is used. */ ?>                          <?php wp_nav_menu( array( 'theme_location' => 'home-menu','fallback_cb' => '') );?>                       4-At my home page,menu appeared but not clicking. 5-Then I created my child functions.php.register home-menu and iteme taken from my catogry section. Any one there have answer. muneeb


title: How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?

text:
I am pretty new in WordPress theme development and I have the following doubt about how show posts into a page. I have this page belonging to an old custom legacy blog that I am build again using WordPress: http://www.asper-eritrea.com/comunicati.asp As you can see in this page are presented some posts using the following structure: **date** followed by the **post title** followed by a **short summary** What I want to do in WordPress is something like it. So I have create this page that show the posts lists: http://lnx.asper- eritrea.com/category/legacyposts/ As you can see in this page are shown the posts (the formattation is horrible because I imported the post from the old website but I will work on it in a second time). The main problem is that if the post is very long it is shows all of its contents. This is the code of this page ( **category.php** ) is:               <?php get_header(); ?>

Associazione per la Tutela dei Diritti Umani del Popolo Eritreo

Association in Defense of the Human Rights of the Eritrean People

Ultimi Articoli
                       <?         // get the term using the slug and the tag taxonomy         $term = get_term_by( 'slug', 'featured', 'post_tag' );         // pass the term_id to tag__not_in         query_posts( array( 'tag__not_in' => array ( $term->term_id )));         ?>              <?php             if (have_posts()) :                 // Start the Loop.                 while (have_posts()) : the_post();                          /*                      * Include the post format-specific template for the content. If you want to                      * use this in a child theme, then include a file called called content-___.php                      * (where ___ is the post format) and that will be used instead.                      */                     get_template_part('content', get_post_format());                      endwhile;             else :                 // If no content, include the "No posts found" template.                 get_template_part('content', 'none');                  endif;             ?>

          <?php get_footer(); ?>      So what I want to do is that, for each post, the loop show only the date, the title and the beginning of my post (for example a specific number of character). What can I do to obtain this result? Tnx


title: Is it acceptable to build functionality into a theme built for a client?

text: I know it's now the common wisdom to not build functionality into themes, as advised by WordPress, Envato, and others. This includes the likes of content types, taxonomies, sliders, shortcodes etc, to make themes as flexible as possible when used for different applications. I know I don't like downloading themes which have more functionality built-in than I need. Suppose that a theme has been purpose-built for a client with specific needs. As much functionality as possible has been delegated to plugins, however this does create a dependency on plugins when such functionality can be part of the theme itself. For example, I've used Pods to establish custom content types and custom taxonomies; it's been great for quickly building up these content types and their fields, but creates a dependency on Pods where it is not really needed. These ends can readily be achieved through the theme itself. It's normally advised to not include custom types or taxonomies in themes as the themes will be less useful to other users, and would not be accepted by the WordPress theme repository. However, in my case, this theme is custom built for this client and the client's needs, and it is not intended to be used elsewhere. I also have an ongoing relationship with the client to support the site and make revisions to the theme. In such a scenario, would it be acceptable to include the custom types, taxonomies, and fields into the theme? Is the no-functionality-in-themes more a guideline than a rule, applied more heavily on distributable rather than custom work?


title: photo gallery implementation like tmz

text: ** REVISED POST ** I have a **custom post type** called `photo_group` that allows you to input an _array_ of photos. I also have a single post called "photos" which is **re- written** to be my-website.com/photos When a user goes to the photos page I want the _first_ (and only **one** ) `photo_group` to display it's content in a **photo gallery** (I'll take recommendations here, but I can simply drop in a JS photo gallery as needed). I was going to build something _custom_ for this, but I don't know that that is _necessary_. I don't want to build this with custom code and then find out I could have used nextgen or something like it. The goal is to have something similar to TMZ's photo page. Thanks. ** ORIGNAL POST ** I'm thinking I'm probably going to have to do this by finagling my php to output some javascript, but I don't want to be in the middle of doing that and find out there was an easier way. I have a custom post type called `photo_group` and I'm trying to use it to accomplish something like TMZ's photo page. Thanks. PS- I don't do celebrity gossip so rest assure this isn't for me! ** ANSWER ** I ended up doing a custom php implementation with using a jQuery slideViewer for the front end.


title: How to display product categories and number of sales on WooCommerce

text: I am currently working on a WooCommerce site.I managed to set it up,do some configuration according to my plan.Now i want to display product categories alongside each products in product catalog,and also want to display how many time the product has been sold too. I have done some searching and found this code,which displays product categories,but i want to display category with link to it.                <?php      $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );      $parents = get_the_terms($term->parent, get_query_var('taxonomy') );           echo "<div class='product-cat'>";      echo "In"." "." ";      foreach( $parents as $parent ) {      echo $parent->name;      }     ?>       Please help out on this.Thanks in advance.


title: I need to create a page or post hierarchy

text: I am currently stuck and I need some advice ASAP. I am making a site for a client on which they need to have a sort of hierarchy like this               Carriers (Main Category or page)     -Level 1        -Level 2           -Level 3 (sometimes needed)        -Level 2        -Level 2     -Level 1        -Level 2        -Level 2     -Level 1        -Level 2     -Level 1      I was thinking about doing it through parent and child apges but that would create a ton on empty pages which purpose would only be to hold the children. I also though about doing it through post categories but I am not sure how to do that since the hierarchy isnt always consistent, some have 3 levels and others only one. Can you please help? Thanks!


title: Attach time/date stamp on add_post_meta

text: we have an image viewer on our website where admins can tag images thought ajax (new feature on Wordpress 3.0). We are tagging just fine, but we need to filter when they were tagged. We are using normal add_post_meta to update the tagging for the images but I would like to know what's best way to attach time/date on it. this is our ajax format               $imgID = (!empty($_POST['imgID'])) ? (int) $_POST['imgID'] : '';                 $value = (!empty($_POST['value'])) ? trim(stripslashes($_POST['value'])) : '';                 $action = (!empty($_POST['act']) && in_array($_POST['act'], array('add', 'remove'))) ? $_POST['act'] : 'add';                 if (!empty($imgID) && !empty($value))                 {                     if ('remove' == $action)                         delete_post_meta($imgID, 'image_tag', $value);                     else if ('add' == $action)                     {                         $ctags = get_post_meta($imgID, 'image_tag');                         if ((is_array($ctags) && !in_array($value, $ctags)) || !is_array($ctags) || !$ctags)                             add_post_meta($imgID, 'image_tag', $value);                     }                 }                      exit;      My first thought is to create new db table. but if there is something easier that I am missing on WP it would be awesome to know. thanks in advance


title: meta_box or custom_field as a second tinymce post-instance?

text: probably a rather weird question but I have no idea if this is possible or not!? I created a `custom-post-type` to handle events. An event always has a future date but once this date is over I want to be able to write a review of the event and add this to the post itself. So imagine an event as a kind of group of two posts. The first post is the one when it get's published. With a description of the event, a date of the event, etc. Once the event is over I somehow would like to write a "recap" of the event - how it was, some photos, etc. Do you generally have any idea how I could solve this? So that the same event- post suddenly has a kind of "subpost" with a review in it? I was wondering if I could solve this via a `custom-field` that adds a completely new instance of the TinyMCE editor underneath the already existing one. So that I could write two posts inside of one post? Sounds silly I know. But then I would have one event-link that (if the date of the event is over) would have a somehow differently formatted second post-item with the review of the event in it! Any ideas on that? How could I solve such a thing? Thank you!


title: How do I authenticate/turn off a plugin remotely for plugin SaaS like functionality?

text: I have a client whom we created a custom plugin for. We are charging monthly for access to this plugin but the only way we have to disable it is manually in the Wordpress admin. How would I go about authenticating access remotely like WPMU does? I would like to be able to disable the plugin functionality via an Amazon database or similar.


title: Wordpress error on saving administration settings with IDN domains

text: I have created a new wordpress site on Azure Web Sites, this time using IDN Domain. I configured the domain in the administrator page using its punycode representation: Wordpress URL: http://xn--sandraeiaki-8db.com Site URL: http://xn-- sandraeiaki-8db.com Everything works fine, except saving settings from the worpress settings page inside the administration. After successfully saving settings wordpress tries to redirect back to the settings page, however somehow that redirect changes the domain, instead of redirecting back to http://xn--sandraeiaki-8db.com it redirects to http://xn--sandraeiaki-bra36d.com/ The only clue I got is that, http://xn--sandraeiaki-bra36d.com/ is the punycode representation of http://sandraeiã±aki.com/, so it seems like wordpress is using an invalid encoding here instead of UTF-8 for redirecting back to the settings page. Update I can see in wordpress options.php file that it tries to redirect using, after succesfully saving changes:               /**     * Redirect back to the settings page that was submitted     */     $goback = add_query_arg( 'settings-updated', 'true',  wp_get_referer() );     wp_redirect( $goback );     exit;      **Update 2** After a chat session with **soulseekah** we have traced back the issue to be in the location value set by IIS on Azure, creating a simple php page, that changes the location header, the redirection fails: `<?php header( 'Location: /' ); exit; ?>` Examining the location header value, shows that it is encoded in ASCII instead of UTF-8: > Location: sandraeiÃ±aki.com **Update 3** After some testing it only happens when the header() php function is passed a relative location url value, setting the location value to an absolute uri resolves without problems , either by using the punycode domain encoding or utf-8 encoding. I made a temporaly fix by changing wordpress redirect function, now it sets only absolute uris, and seems to be working. However, how I can fix that behaviour permanently?


title: Formatting Multiple add_theme_support Arguments

text: In my `functions.php` I have the following: `add_theme_support( 'post-thumbnails', 'html5', array( 'comment-list', 'comment-form', 'search-form' ) );` …which in WP 3.8.1 disables e.g. featured image (i.e. `post-thumbnails`). My question is how to properly format all these support items in the `add_theme_support` function; is adding two separate function calls right or 'wrong'? `add_theme_support( 'post-thumbnails' ); add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form' ) );`


title: Displaying $_FILES data (simlar to $_POST)

text:
I'm trying to display $_FILES in wp-admin, and I've been using add_filter and apply_filter, but it does not seem to show the $_FILES array values. My goal is to show the values in $_FILES so I can upload it to a specified directory (But this is going to be in the future). **Upload Screen Meta Box**               function upload_screen() {        print_r(apply_filters('demo_fileupload',$_FILES));       echo "
";       echo 'Upload Files<input type="file" name="" />
';     }      The next function should return the file array (this is where the problem lies). So I tried using `add_filter`, but does not seem to work. **File Upload Function** but return `$file array` for now.               function demo_fileupload($file) {       return $file;     }      **Add Filter**               add_filter('save_post','demo_fileupload',10,1);


title: Generated URLs don't reflect accurate URLs.

text: Evening, I'm getting some incorrect links generated by my theme. `WordPress Address (URL): http://localhost/newgameplus/wordpress` `Site Address (URL): http://localhost/newgameplus` Clicking on something like `preview post` Generates a URL like this: `http://localhost/newgameplus/?p=34` The correct URL is: `http://localhost/newgameplus/wordpress/?p=34` How can I make it reflect this? (Also, I cannot change site Address because my site is in a different subdomain)


title: How to use custom database tables for custom post types?

text: I need to use an existing database table as a Custom Post Type (CPT) to integrate it with wordpress. I've considered @boone-gorges thoughts here (should I?) and have decided, Yes, I need to use a custom table (mostly for indexing of the 20+ "custom meta" fields that would get bogged in wordpress' native handling of custom meta.) Aside from home-grown display and usage of data, I need tight integration with Wordpress (acts and behaves like CPT) so that I can:   * Call the CPT via the loop   * Utilize custom taxonomies   * Integrate with Posts to Posts   * Use various other plugins (bbPress Topics for Posts, Popularity plugins, etc... ) on that CPT Editing / Updating through WP would be a bonus - though not necessary (the table will be edited mostly via external programs, which is another reason it needs to be separate). Is there a slick way to make this happen? Perhaps implementing hooks that hijacks calls to that CPT and directs them to the other table? I'm looking at Pods \- but this seems like overkill.


title: Show only preview of posts on the homepage?

text: Is it possible to only have a couple lines shown per post (or even 0 lines) on the homepage? Instead of dumping the whole article on the page?


title: Getting selected (highlighted) html from the Visual Editor on Edit Post page?

text: So I understand that the visual editor uses something called TinyMCE. How do I retrieve the html that the user selects from the visual editor? I am basically trying to create a button that gets the selected html and replaces it.


title: How to customize the gallery shortcode in WordPress?

text: I want to change WordPress's main gallery shortcode style to something like the picture below! ![sample slide show](http://i.stack.imgur.com/FkmQM.png) Any idea ?