Auto-suggest to display meta-data, but not to include it upon click

I'm using wordpress' built in suggest scripts to create an auto-suggest form based on custom post titles...               add_action('wp_enqueue_scripts', 'se_wp_enqueue_scripts');     function se_wp_enqueue_scripts() {         wp_enqueue_script('suggest');     }                              add_action('wp_head', 'se_wp_head');     function se_wp_head() {     ?>                             var se_ajax_url = '';              jQuery(document).ready(function() {             jQuery('#stuff-input').suggest(se_ajax_url + '?action=se_lookup');         });                                             add_action('wp_ajax_se_lookup', 'se_lookup');     add_action('wp_ajax_nopriv_se_lookup', 'se_lookup');                              function se_lookup() {         global $wpdb;                    $search = like_escape($_REQUEST['q']);          $query = 'SELECT ID,post_title FROM ' . $wpdb->posts . '         WHERE post_title LIKE \'' . $search . '%\'         AND post_type = \'stuff\'         AND post_status = \'publish\'         ORDER BY post_title ASC';     foreach ($wpdb->get_results($query) as $row) {         $post_title = $row->post_title;         $id = $row->ID;              $meta = get_post_meta($id, 'location', TRUE);              echo $post_title . ' (' . $meta . ')' . "\n";     }     die();      } Currently, it displays meta-data associated with each post in parantheses next to the title in the suggest form. The problem is when the suggested item is clicked, it adds the parantheses to the form, as well as the title. I want the parantheses to be visible when the title is SUGGESTED, but not to appear in the form box when the suggested title is clicked.


Check if Post Title exists, Insert post if doesn't, Add Incremental # to Meta if does

I already have a function where a user submits a form and creates a custom post...               <?php $postTitle = $_POST['post_title'];     $submit = $_POST['submit'];          if(isset($submit)){              global $user_ID;              $new_post = array(             'post_title' => $postTitle,             'post_content' => '',             'post_status' => 'publish',             'post_date' => date('Y-m-d H:i:s'),             'post_author' => '',             'post_type' => 'stuff',             'post_category' => array(0)         );              $post_id = wp_insert_post($new_post);     add_post_meta($post_id, 'times', '1');          }      I want to check if the custom-post title exists, then if it does NOT, to go ahead and create the post with a #1 in the meta field, and if it does exist, to simply add 1 to the meta field


Archiving annual festival site

I have a query regarding managing a wordpress setup, I am sure others have been in a similar situation and was wondering what would be the best solution. I manage an annual festival's website, each year has a different theme / design and event details, this is archived each year [ ie at festival.com/2008/ etc.] Last year we moved to a wordpress platform and all was good, now have a new theme for this years festival and the new event details ready to go but I have a dillema... Is it possible to have one wp blog with an archive of last years festival ie 2010 theme and 2010 events/pages accessed via festival.com/2010/ and this year events/pages and theme show up when visiting the main site [ ie festival.com/ ] so i need one blog with multiple themes and event filtering I can filter event/page by a year category but will this mess the menus etc. or am i best off just moving the existing wp install to the festival.com/2010/ directory and creating a new blog and in the site root [ festival.com] ? any suggestions, advice or pointers would be great, Thanks in advance, Keith


WordPress sitemap with Custom Post Types

This is a really neat idea but I'd like to expand upon it. In his post, David Kennedy writes out some code to allow a basic `wp_list_pages` type feature for Custom Post Types to use as a sitemap. His code is as follows:
My Post Type

         <?php              $terms = get_terms( 'my_taxonomy', 'orderby=name' );             foreach ($terms as $term) {                 echo "

".$term->name."
";                 echo "
";                 $args = array(                     'post_type' => 'my_posttype',                     'posts_per_page' => -1,                     'tax_query' => array(                         array(                             'taxonomy' => 'my_taxonomy',                             'field' => 'slug',                             'terms' => $term->slug                         )                     )                 );                 $new = new WP_Query($args);                     while ($new->have_posts()) {                         $new->the_post();                         echo '
'.get_the_title().'
';                     }                 echo "
";                 echo "
";             } ?>
      I like this idea but am wanting to take it a bit further. It'd be great to add depth, or levels of hierarchy, and to show parent/child relationship results instead of listing Custom Post Types alphabetically. In other words, mimic more of the functions that `wp_list_pages` offers. Is there an easier way to do this or is there functionality in WordPress that already does what I'm looking for?


Comment visibility

There will be many people commenting on a post. So, when a commentator visits the post, he should be able to see 'only' his own comment(s).Post author can see all comments only on his own post. How can I do this in WordPress?


How to call the_excerpt() with tags or the_content() as an excerpt?

Is it possible to call the_excerpt() with tags intact? I'd like to create a excerpted listing of my posts in a specific category, but I'd also like the links and formatting carried over from the post content. I'm currently using the_excerpt() which otherwise works fine, however, the tags are stripped out. I can't find a filter to place on the_excerpt() to do this, so barring that, is it possible to filter the_content() to pull the first 100 words with tags and a read more link at the end?


WordPress Iframe IE8 Javascript problem

In a very edge case scenario, I have a site that has an interactive form that uses javascript in an iframe. It works fine except on a WordPress site using Internet Explorer 8 or less, in which case the javscript does not load. This iframe also lives on Drupal and vanilla html and php pages, and this error does not happen. It is a requirement that it work in IE8 and lower. It's not a wywsiwig editor problem or anything like that, it is something more esoteric happening. Can anyone help?? This problem can viewed at http://813cash.com and IE8 or lower. The exactly error message is User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) Timestamp: Tue, 21 Aug 2012 19:20:26 UTC Message: Permission denied Line: 4 Char: 1 Code: 0 URI: http://lighthousefinance.com/webquote/quote.js IMPORTANT: This error does not occur unless the iframe is embedded in a WordPress page. On a drupal page, no problem, on an html page on the same server, no problem. I am looking for what possible scenario WordPress might be creating. Additional WordPress info: Theme **Please note: I have tried embedding this iframe in two completely unrelated WP sites and gotten the same result in IE, so I do not believe it is theme or plugin related** The site is running a custom theme I built, and iFrame is embeded in two theme templates with the embed code below. Because the site is live I cannot change to default theme and test, at least not without some risk.               <iframe name="cash" scrolling="no" frameborder="0" src="http://lighthousefinance.com/webquote/quote.php" style="width: 550px; height: 400px;" marginwidth="0" marginheight="0" vspace="0" hspace="0">      Active Plugins Antispam Bee Backup Buddy Easy Content Types Google XML Sitemaps Redirection WordPress SEO


When using get_categories or similar, is it possible to filter results that contain certain Tags as well?

`get_categories()` and related functions, by default, don't return empty categories - categories with no posts. I thought that, since there may be some underlying code checking the post counts, is it possible to additionally filter that list to only include categories _that themselves_ contain posts that have a certain, specific Tag associated? Or is there a somewhat simple alternate method of getting that information? For example, if I had some posts with a Tag of "audio", I'd like a way to use `get_categories()` (or similar results) but only retrieve a list of categories that contained posts with that "audio" Tag. I am aware that I may have to use the Tag ID directly. I'm just looking for the "best", or most appropriate way to do this. Thanks!


Broken wordpress permalinks on pages only

Not sure when it happened but the custom permalinks for pages on my client's Wordpress site have broken. I can fix it by reverting back to the default permalinks and then using the custom permalinks, but they break again whenever my clients edits a page. Blog posts, archives, tags, categories, and custom post types permalinks all work fine, it's only pages that 404 when using custom permalinks. The site has an .htaccess file with 666 permissions with the following in the file:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>      It also has mod_rewrite enabled. Using Wordpress 3.1.3 It's not the plugins because I have disabled all of them and the permalinks for pages still don't work. Please help.


Translating (WooCommerce) placeholder text

So, as the title says, I'm trying to translate the output text of WooCommcerce on the "Cart" and "Checkout" pages, it currently says "select a state" where I want "select a province". I was not able to accomplish this with filters & hooks, as it's something they have overlooked. I was hoping somebody here can help me figure out how to translate the text so it displays as I want. I don't mind if this is using a plugin, native wordpress functionality or whatever, as long as I get it done. The site in question can be found here. Thanks in advance, hopefully you guys and gals can give me a hand with this :) Cheers,


get_user_meta() doesn't include user email?

I simply wonder why `<?php var_dump(get_user_meta(4)); ?>` doesn't contain an email address of the user. Instead I have to use `get_userdata(4)->user_email;` to query the email of the user. Why is that or did I miss something? `get_user_meta()` seems to provide all other aspects and informations of a user, however just not the email-address. Matt


pagination with sticky posts

The following code displays 8 posts on the 1st page. On all succeeding pages however, only 7 posts are displayed. I am assuming this is because the 1st page also displays sticky posts (whereelse the succeeding pages do not).   * How can that problem be solved (I need 8 posts an all pages)?   * Alternatively, the sticky posts should be displayed on all pages, not only on the first? _My original code:_               $header_query = new WP_Query(         'orderby=date&posts_per_page=7&paged='.$page_to_load.'&ignore_sticky_posts=0     ');      **EDIT:** _Implementation of Daniel Sachs' suggestion:_               // query db     $header_query1 = new WP_Query(         array('post__in' => get_option('sticky_posts'), 'posts_per_page' => 1));     $header_query2 = new WP_Query(         array( 'post__not_in' => get_option( 'sticky_posts' ), 'posts_per_page' => 7, 'orderby' => date, 'paged' => $page_to_load));          //display     getPostsFromQuery($header_query1);     getPostsFromQuery($header_query2);          function getPostsFromQuery($header_query) {         if ( $header_query->have_posts() ) :          // loop etc.     }      I am still looking for a solution that requires **only one database access**? And for the alternative solution with **sticky posts only on page 1.**


How to filter posts by format and category via url?

I figured out I can filter posts by format just by doing /type/{format} e.g. /type/gallery/ in the url. Looking for a way to filter by categories on top of this, something like /type/gallery/category/installation or /type/gallery/art. I've figured out the query, but I don't know how to handle the url bit:               $galleryquery = wp_parse_args($query_string);     $galleryquery['tax_query'] = array(         array(             'taxonomy' => 'post_format',             'terms' => array('post-format-gallery'),             'field' => 'slug',         ),         array(             'taxonomy' => 'category',             'terms' => array('installation'),             'field' => 'slug',         ),     );     query_posts($galleryquery);      Ideas? I'm guessing I have to intercept the permalink and somehow pass it to my query... Site is reachable here


How to add a page to header that is outside of WordPress?

I have a page on my site that is not a page in WordPress. How can I add it to the header? EDIT: The page is .php. It is outside of the theme structure.


How to Add Additional Search Button?

I have added function to functions.php so authors can search only their published content. I would like to add additional "Search my posts" button to searchform.php so only logged in users would see - have this button for searching posts they published. But I can get it to work. :( When I click on any button "Search All posts" or "Search My Posts" when logged in it searches only logged in author.               function search_author($query) {       if ($query->is_search) {             $query->set('author', get_current_user_id());       }       return $query;     }     add_filter('pre_get_posts','search_author');      searchform.php               <?php if ( is_user_logged_in() ) { ?>     <form action="<?php echo home_url(); ?>/" method="get" id="searchform">         <fieldset>
                 <input class="input" name="s" type="text" id="keywords" value="<?php _e('Search input','mytheme') ?>" onfocus="if (this.value == '<?php _e('Search input','mytheme') ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('Search input','mytheme') ?>';}">

                 <input type="submit" name="search" value="<?php _e('Search All Posts','mytheme') ?> ">

                 <input type="submit" name="author" value="<?php _e('Search My Posts','mytheme') ?> ">

             </fieldset>     </form>     <?php } else { ?>     <form action="<?php echo home_url(); ?>/" method="get" id="searchform">         <fieldset>
                 <input class="input" name="s" type="text" id="keywords" value="<?php _e('Search input','mytheme') ?>" onfocus="if (this.value == '<?php _e('Search input','mytheme') ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('Search input','mytheme') ?>';}">

                 <input type="submit" name="search" value="<?php _e('Search','mytheme') ?> ">
             </fieldset>     </form>     <?php } ?>      Thank you for any suggestions.


Custom image sizes are not used

I recently launched a new theme and regenerated all the thumbnails with AJAX Rebuild. All of these custom image sizes are defined in my `functions.php` as well as the individual template files in which they are used. When I go and view source code my site, I don't see the new image sized appended to the end of the file name. I do however see the class name on the image that WordPress assigns is the new image size. I don't get what's going on! **functions.php**               if (!function_exists('mytheme_setup')) {         function mytheme_setup() {             add_theme_support( 'post-thumbnails' );             add_image_size('homepage', 704, 396, true);             add_image_size('articles', 1174, 660, true);             add_image_size('in-post', 568, 320, true);             add_image_size('featured-post', 1280, 683, true);        }     }          add_action( 'after_setup_theme', 'mytheme_setup' );      **Example of how I call it:**               <article id="post-<?php the_ID(); ?>" <?php post_class('post_content'); ?>>

         <a href="<?php the_permalink(); ?>">             <?php print_meta(); ?>             <?php                  if (has_post_thumbnail()) {                     the_post_thumbnail('in-post');                 } else { ?>                     <img src="<?php bloginfo('template_directory'); ?>/img/in-post-568x30-default.jpg" alt="All Features" />                 <?php } ?>
      **Update** I believe I discovered the issue. I did all of my image resizing on my staging site and then copied the resized images on staging to my production site (where I am currently experiencing these issues.) I have no learned that the DB references these image attachments and because I did not generate the sizes on Production, WordPress is unable to find the proper reference in the DB.


What's the point of using Wordpress's built in admin-ajax.php?

I'm trying to understand why using admin-ajax.php is advantageous over doing something like this:               add_action ('wp_loaded', 'my_ajax');     function my_ajax() {        // Do Ajax, Check $_POST        die();     }      With the JQuery ajax just pointing to the blog's index. admin-ajax.php seems rather convoluted to do something simple, with having to register scripts and add hooks and set up a js variable url to point to the admin-ajax.php and then with wp_ajax_nopriv_ vs wp_ajax_. Not to mention it's kind of weird that back end is being mixed with the front end. I'm pretty sure there's an analogy there. So why use it? Does admin-ajax.php have less overhead? Is it purely a standards thing? Is there something magical about it? What do you miss out by not using it?


Headers already sent on a frontend post form using wp_redirect before get_header

I've gone through the various issues with headers already sent, checking for white space and making sure that the get_header line appears after the wp_redirect but I'm stuck. The code is:               <?php if ( !is_user_logged_in()) {              include (TEMPLATEPATH . '/member.php');          } else { ?>     <?php     if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_post") {         // Do some minor form validation to make sure there is content         if (isset ($_POST['title'])) {             $title =  $_POST['title'];         } else {             echo 'Please enter a title';              $tags = $_POST['post_tags'];              // ADD THE FORM INPUT TO $new_post ARRAY         $new_post = array(         'post_title'    =>  $title,         'post_content'  =>  $description,         'post_category' =>  array($_POST['cat']),  // Usable for custom taxonomies too         'tags_input'    =>  array($tags),         'post_status'   =>  'draft',           // Choose: publish, preview, future, draft, etc.         'post_type' =>  'post',  //'post',page' or use a custom post type if you want to         );              //SAVE THE POST         $pid = wp_insert_post($new_post);              //KEEPS OUR COMMA SEPARATED TAGS AS INDIVIDUAL         wp_set_post_tags($pid, $_POST['post_tags']);              //REDIRECT TO THE NEW POST ON SAVE         $link = include (TEMPLATEPATH . '/thankyou.php');          wp_redirect( $link );              //INSERT OUR MEDIA ATTACHMENTS         if ($_FILES) {             foreach ($_FILES as $file => $array) {             $newupload = insert_attachment($file,$pid);             }              } // END THE IF STATEMENT FOR FILES          } // END THE IF STATEMENT THAT STARTED THE WHOLE FORM          //POST THE POST YO     do_action('wp_insert_post', 'wp_insert_post');          ?>          <?php get_header(); ?>
             <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>                 <div id="post-<?php the_ID(); ?>" class="post">

Post

                     <form id="new_post" name="new_post" method="post" action="" enctype="multipart/form-data">                          <fieldset name="name">                         Title:                         <input type="text" id="title" value="" tabindex="5" name="title" />                     </fieldset>                          <fieldset class="tax">                         Category:                         <?php wp_dropdown_categories( 'tab_index=10&taxonomy=type&hide_empty=0' ); ?>                     </fieldset>                          <fieldset class="content">                         Description:                         <textarea id="description" tabindex="15" name="description" cols="60" rows="10"></textarea>                     </fieldset>                          <fieldset class="images">                         Company Logo                         <input type="file" name="company_logo" id="company_logo" tabindex="25" />                     </fieldset>                          <fieldset class="submit">                         <input type="submit" value="Post It" tabindex="40" id="psubmit" name="submit" />                     </fieldset>                          <input type="hidden" name="action" value="new_post" />                     <?php wp_nonce_field( 'new-post' ); ?>                          </form>

              <?php endwhile; // end of the loop. ?>
          <?php get_sidebar(); ?>     <?php get_footer(); ?>     <?php } ?>       If the post status is set to draft and the redirect to thankyou.php, I get the headers already sent message. The post gets saved and the thankyou.php page is displayed but the headers already sent message appears. If I set the post status to publish and the redirect to something like:               $link = get_permalink( $pid );         wp_redirect( $link );         exit;      Then the form works without a hitch and displays the published post. I want to be able to review the post before it gets published, that's why I want the status sent to draft and a message to appear to the poster. How do I accomplish this? Debugging info:               Notice: Undefined index: post_tags in C:\xampp\htdocs\test\wp-content\themes\testtheme\postform.php on line 31     Notice: Undefined variable: description in C:\xampp\htdocs\test\wp-content\themes\testtheme\postform.php on line 48     Notice: Trying to get property of non-object in C:\xampp\htdocs\test\wp-includes\post.php on line 2915     Notice: Undefined index: mytheme_meta_box_nonce in C:\xampp\htdocs\test\wp-content\themes\testtheme\lib\metabox.php on line 177


Get the number of rows from $wpdb->get_results not working

I want to count the number of rows of this custom wordpress query and it does not work: *PS I am accessing a custom table inside my wordpress database, mabe by myself. The $wpdb->get_results part works.*               $myquery = $wpdb->get_results("SELECT COUNT(*) FROM `$table` WHERE $myconditions");      $nr = $myquery->num_rows;      Any ideas why? Important: using $wpdb->get_results like this:   * Do I need to prepare the query (i read it in the codex)?   * Do I need to somehow reset the query after I have used it? Ty for helping!


Make a magic tag work with Custom Post Types

I have a custom post type:               add_action( 'init', 'register_cpt_foto' );          function register_cpt_foto() {              $labels = array(              'name' => _x( 'Fotoalbums', 'foto' ),             'singular_name' => _x( 'Fotoalbum', 'foto' ),             'add_new' => _x( 'Nieuw fotoalbum', 'foto' ),             'add_new_item' => _x( 'Voeg nieuw fotoalbum toe', 'foto' ),             'edit_item' => _x( 'Bewerk fotoalbum', 'foto' ),             'new_item' => _x( 'Nieuw fotoalbum', 'foto' ),             'view_item' => _x( 'Bekijk fotoalbum', 'foto' ),             'search_items' => _x( 'Zoek in fotoalbums', 'foto' ),             'not_found' => _x( 'Geen fotoalbums gevonden', 'foto' ),             'not_found_in_trash' => _x( 'Geen fotoalbums gevonden in de prullenmand', 'foto' ),             'parent_item_colon' => _x( 'Parent foto:', 'foto' ),             'menu_name' => _x( 'Foto\'s', 'foto' ),         );              $args = array(              'labels' => $labels,             'hierarchical' => true,             'description' => 'Het posttype dat alle fotoalbums verzorgt.',             'supports' => array( 'title', 'editor', 'excerpt', 'comments', 'page-attributes' ),             'taxonomies' => array( 'post_tag' ),             'public' => true,             'show_ui' => true,             'show_in_menu' => true,                       'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'has_archive' => true,             'query_var' => true,             'can_export' => true,             'rewrite' => array(                 'slug' => 'fotos',                 'with_front' => false             ),             'capability_type' => 'post'         );              register_post_type( 'foto', $args );     }      Now, I am using a plugin called Facebook Photo Fetcher. You can _fetch_ FB albums with a _magic tag_. You only have to post this as HTML:               <!--FBGallery 1234567890123456789 cols=4 max=16 swapHead=1 --><!--/FBGallery-->      When you save this post, it is converted to a complete post with all the images inserted etc. The problem is: the plugin doesn't seem to recognise this tag! Or maybe it is disabled for custom post types? I don't know, but it does absolutely nothing and I don't know why!


Where should I host my images?

I just read this article http://codex.wordpress.org/WordPress_Optimization/Offloading on how you can upload your content to external sources to improve speed and save bandwidth. Anyway, my site has lots of images, but all of them are either static content or thumbnails that are placed beside each post (less than 30kb each). As I have no traffic as of now I don't really need to do this, but optimizing wouldn't hurt. Moving my content to another server/hostname is too complicated and not worth it for a small site like mine. Then we have free hosting service like Flickr and Imgur, but I don't think the cons are worth it either. **Now I'm left with these options:   ** Hotlinking with Dropbox/Google Drive   CDN (Cloudflare)   Do nothing (host locally, standard upload through Wordpress) I don't know what to choose as I don't understand what these services really do, other than it's supposed to be "better" to host externally. I tried reading up but all the jargons were overwhelming. Besides, most sources came from the services themselves. **TL:DR**   1. Are there really any noticeable difference between uploading my content/theme images the standard way and using services like Flickr, Picasa, Google Drive, Amazon Cloud, CDN?    2. I found out that CDN is a caching service, which means I still have to host it. And now I'm confused. Am I supposed to combine CDN with external hosting, or is it an alternative to it? Meaning I can reach the same benefits as external hosting when I host locally with CDN.    3. There are popular plugins like W3 Total/Super cache. If I use those, can I ignore the options above (cause it sounds like CDN). I'm sorry for the long post and I'm probably overcomplicating things. It's just that there are so many options, and I can't tell if they are all different methods of achieving the same thing or I'm supposed to use them altogether.


Receiving "This content cannot be displayed in a frame" error on login page

I am using a new domain for my WordPress directory in different server. When I click the meta links such "Login" or "register", I get this page: > This content cannot be displayed in a frame > > To help protect the security of information you enter into this website, the > publisher of this content does not allow it to be displayed in a frame. > > What you can try: Open this content in a new window How can I fix this?


create 2 custom columns in page edit in Admin panel

Hey all i have this code here:               if ( !function_exists('AddThumbColumn') && function_exists('add_theme_support') ) {         // for post and page         add_theme_support('post-thumbnails', array( 'post', 'page' ) );              function AddThumbColumn($cols) {             $cols['thumbnail'] = __('Header Images');             return $cols;         }              function AddThumbValue($column_name, $post_id) {             echo 'Header Image data here';         }              add_filter( 'manage_pages_columns', 'AddThumbColumn' );         add_action( 'manage_pages_custom_column', 'AddThumbValue', 10, 2 );              function AddThumbColumn2($cols) {             $cols['cssColor'] = __('CSS Color');             return $cols;         }              function AddThumbValue2($column_name, $post_id) {             //code goes here for second column               }              add_filter( 'manage_pages_columns', 'AddThumbColumn2' );         add_action( 'manage_pages_custom_column', 'AddThumbValue2', 10, 2 );     }      And that works with creating 2 separate columns (Header Images, CSS Color) but it seems to duplicate the data in Header Images in the CSS color..? What am i missing in order to have each column separate with data for its own?


Help Understanding Template Hierarchy

I must be thick, but I could use some help grasping the way template files are chosen to be used. I noticed loop.php is no longer around, and looking at the file structure for twentytwelve there is now a 'page-templates' directory. As well as content-* files. We have index.php, page.php, content.php which one is used when? I know index.php is the "last resort" choice, however does content or page come first? And what is the difference between them? Thank you.


Strategy for making a mobile version of an existing site?

I have a site setup with content, themes, plugins, and modified code. However, I want a mobile version. I googled this and it looked like there use to be plugins that helped with this, but it seems most have been dis-continued. Is there a strategy for making a site mobile?


How to handle POST reqests the WordPress way without including admin API?

It is all about sending newsletter registration data in forms. AJAX is primary solution, POST is just a fallback. I've planed to do in in wp-admin/admin-post.php as an action but it includes all the admi API: http://wordpress.online1.hu/wp-admin/admin- post.php.source.html               require_once (ABSPATH . 'wp-admin/includes/admin.php');      The line of code above trigger loading of:               wp-admin/includes/bookmark.php     wp-admin/includes/comment.php     wp-admin/includes/file.php     wp-admin/includes/image.php     wp-admin/includes/media.php     wp-admin/includes/import.php     wp-admin/includes/misc.php     wp-admin/includes/plugin.php     wp-admin/includes/post.php     wp-admin/includes/screen.php     wp-admin/includes/taxonomy.php     wp-admin/includes/template.php     wp-admin/includes/class-wp-list-table.php     wp-admin/includes/list-table.php     wp-admin/includes/theme.php     wp-admin/includes/user.php     wp-admin/includes/update.php     wp-admin/includes/deprecated.php      I'd like avoid that. wp-load.php is referenced from 8 places: http://wordpress.online1.hu/wp-load.php.html Is there a WP-way of doing POSTs without these admin API inclusions? Thank you!


Clear Transients

I have build a custom theme for a client of mine, and I am using transients in order to make the site operating faster. After a week, I have see in the wp_options a huge list of transients records (in about 360000 records). This makes me beleave that transients are not removed from the database. How can I remove that records and how ? Is there any good tutorial ? Kind regards


Weird WP situation with source code

Our configuration of WP is a bit different than most and i have had this successfully setup and used with a different site/server. But on a new build/site, i am having some issues with the source code for the site. **Background** : **Configuration** : 1 admin server, 2 web servers, 1 database server. The admin and database server are behind our firewall and inaccessible to the outside world. Our Web servers are in our DMZ and have Read-Only access to the share containing wp- content and the database server. In the general settings portion of the configuration for WP, our Wordpress URL is the admin server that all editing is done from. the site address is the actual URL of the website being presented to the world. Now the issue is that when i view the source for the site in a web browser, all the information is presented correctly as the site address except for 5 items:               script type='text/javascript' src='http://xxxxx.xxxxx.org/wp-includes/js/jquery/jquery.js?ver=1.10.2'/script      And then:               js/jquery/jquery-migrate.min.js?ver=1.2.1          js/comment-reply.min.js?ver=3.7.1          /xmlrpc.php?rsd" />          wp-includes/wlwmanifest.xml      Like i said, those all show the incorrect `http://` address used, while the rest of the source code is correct. Is there a place that the Jquery configuration may be set or the `wp-includes` directory might be incorrectly identified in? This server configuration is working perfectly fine on a different site, administrated by a different user. The new one's admin is doing some "tweaking" of the code and may have inadvertently done something!?!? They are both using the AVADA theme now, unfortunately the current admin tried a "custom" theme previously and i am not sure if he may have done something inadvertently. The only difference is that the "good" site is using the https plugin to secure the site while the new one is not in need of it. Any suggestions or comments would be appreciated. I know this may sound a little vague, but it is a configuration that is not the norm for WP... i can supply additional information if needed.


Change default italic from <i> to <em> in admin editor

I've noticed that the admin editor by default embeds any italic texts with `<i>` which I intend to use for icon styling. I much more prefer to wrap them with an `<em>`. How would I got about changing this?


Custom Taxonomy Page redirect 404

I have a custom post type 'BLOG'. I created archive-blog.php file to display archives. Also I register a taxonomy with it named as 'blog-category' and created a page 'taxonomy-blog-category' while clicking on this taxonomy terms redirects me to the 404 page. Seems permalink problem. I have saved permalinks and rewrite_flush() but that also doesn't work. Any help would be appreciated. Hope I'll get a positive response from your side. Thanx in advance.


Inserting a random number into an array

So what im trying to do is make a random offset for 'top comment', at the moment it's working great(with no offset) but I want to randomise the offset so it displays 1 of the top 5 comments by offsetting it. So I was either going to use a range or an array; whichever works best. Everything is ok on the first two lines - I can print and echo it fine, but when it comes to using the variable within my second array it just defaults back to the 0 offset. Any help or advice would be greatly appreciated - code below.               $numbers = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5);     $random_key = array_rand($numbers, 1);     $comments = get_comments(array('orderby' => 'comment_karma', 'number' => 20, 'status' => 'approve', 'offset' => '.random_key.'));


Customize a WP_Posts_List_Table class

How can I customize output of tables of records in wp-admin/edit.php? What options are available for editing `display_tablenav('top')` and `display_tablenav('bottom')` before outputting in class `WP_Posts_List_Table`? I would like to insert my block between the table where records are displayed and the filters, for example: `<h3>Titlle</h3>`. No matter what. The Codex is written: > This class's access is marked as private. That means it is not intended for > use by plugin and theme developers, but only by other core functions and > classes. Maybe there is some way that does not change the kernel.


how to echo/display the custom field value in specific custom field name?

I have tried this code: > >     <?php query_posts(array( >                 'meta_key' => 'custom_cat', >                 'meta_value' => 'creative', >                 'post_type' => 'page' >             )); >                 echo '
'; >                 if ( have_posts() ) while ( have_posts() ) : the_post(); >                         echo '
';   >                             the_title(); >                             the_content(); >                         echo ' "fa_icon", true ).'">'; >                         echo '
';   >                  endwhile;   >                 echo '
'; >                 wp_reset_query(); ?> >   to display the custom field value as a class name, but the value is not displaying. Please help me find the problem or solution to display the custom field value as class name. I'm having hard time to debug this codes because i'm not a programmer, i'm a designer, still in the process of exploring wordpress.


While Using Static Pages, How Can I Get /blog into the URL of Each Post?

I have Wordpress installed on the root of my website. It is using a static homepage and posts page. As it stands, each post will look like this example.com/blogpostname. I don't want to use category workaround where you set the default post's category to blog, it seems more like a workaround than a solution. Thanks.


Move my theme style.css into a folder

I was wondering if its possible to have my theme `style.css` in a `css` folder rather than in the root? I assume that the Theme Metadata has to be in the theme root, but could the actual styles be moved? Is this a piece of meta data I would add to the theme meta?


Template Hierarchy for get_header()

I'm considering having different headers depending on the area of the site. So thought it might be possible to tap into the template hierarchy (or at the very least, re-use some of the code) and filter the output. Is this something that anyone has tried? Or could anyone point me in the direction of the code which selects the template file in the heirarchy - I've been unable to find it.


Change HTML Output of Wordpress RTE

after I selected some text and clicked the "list"-Button in the RTE, wordpress wraps it with `<ul></ul>` and `<li>'s` of course. Now I need to add a class to the UL. How to do that? This is only one example... I need to change the output really often... Are there ways?


How to interact with another wordpress install on same database?

I am trying to figure out how I can have two WordPress installations on same database with different prefixes ( wp_ and wp2_ ) and I need them to interact with each other. For example I have a Blog on one site and a Directory on another site using same database with two wordpress tables (wp and wp2). How can i pull the classified listings into the blog site.   like the latest directory listings and etc.


Multiple Permalinks for Same Post

I'd like to be able to have multiple permalinks for the same underlying post (for i18n reasons) - eg               http://www.example.com/my-custom-post-type/this-is-a-cool-article     http://www.example.com/mon-type-de-poste-personnalise/cest-un-article-sympa      Both pointing to the same post page. Built in WP i18n functions would deal with the language switching on the post page itself. I'm more concerned with the URL display for both SEO and end user aesthetics. I can't use a 301 redirect as I don't want the browser URL changing. I'm understand how to internationalize the custom post type slug, but not the actual post slug. I'm thinking I can save the secondary post slug in a post meta field, but I'd have to hook on somewhere in the routing to enable it - I haven't had much luck in finding the correct place to hook? Is there a place to hook into or an easier way to deal with this?


W3 Total Cache plugin chronic message

I am currently using Amazons Cloud Front service with the super awesome and easy to use W3 Total Cache wordpress plugin. All appears to be working correctly but I do get a chronic error in the admin panel from W3 Total Cache saying: > Recently an error occurred while creating the CSS / JS minify cache: Some > files were unavailable, please check your settings to ensure your site is > working as intended Does anybody have any thoughts on this? Thanks in advance!


Any easy way to automatically set the first inline image in a post as the thumbnail?

Is there a plugin for this? Has anyone done it before?


How do I view a feed consisting of posts from multiple categories?

By default, my site's RSS feed URLs are in this format:               category/[category-name]/feed/      As far as I can tell, that doesn't allow me to view a feed using multiple categories. Is anyone aware of a simple workaround, or is this something I'll need to write myself?


General plugin customizing question problem

I've already asked this question within the plugin specific forum but I'd thought I would try here as a general question for any plugin. I'm trying to use the WP-MEMBERS plugin and I noticed that in the html a lot of elements are grouped together as one big row and column. I wish the author would have organized by adding and subdividing into more rows and columns so that I could move certain elements around with more control. When I try to move things around now it breaks the layout. Now I'm not the best html/css guy so I could be totally missing something here but is there a way to rememdy this somehow? Can I "add" and more rows and columns via CSS? That probably sounded stupid but I'm really stumped here and unless I can take a plugin and customize to my taste by positioning elements to match my site, then I don't think this Wordpress thing is going to work for me especially since I can't access the html. I've attached a screenshot of the WP-MEMBERS plugin's html. I'm talking about the text titles and input fields located within #wpmem_reg ID div. Any advice would be appreciated.


Replace admin bar logo

WordPress 3.8 is out I have the following code to remove admin bar logo.                function no_wp_logo_admin_bar_remove() {         global $wp_admin_bar;         $wp_admin_bar->remove_menu('wp-logo');     }     add_action('wp_before_admin_bar_render', 'no_wp_logo_admin_bar_remove', 0);      However I would like to know how can I replace it with my own logo (upload) and not a dashicon?


What is best forum script available to integrate with wordpress?

Ok i have a wordpress site network. I would like to setup a support forum for my site. But i don't want users to signup in different pages. I mean i want my users to use the same wordpress login credentials in forum too. Is there any forum plugin available there. Thanks   PS: Is it possible using bbpress?


How do I fix unexpected redirection of visitors after enabling multisite on WP3?

After enabling SuperAdmin and multisite functionality in WP3 many users are getting redirected to a sign-up url. I do not have account sign-up enabled, how do I turn this off? It seems to happen when any invalid subdomain is used including my-domain.com instead of www.my-domain.com. How do I fix?


urlencode error with checkboxes in wp_query using tax_query and taxonomies

I am making a search that taps into `wp_query` and filters thru custom taxonomy terms. It works, but I get a `urlencode` warning when using checkboxes to filter thru taxonomy terms assigned to `POSTS`, but if for example I have the taxonomy terms assigned to `CUSTOM POST TYPE`, I DO NOT get the warning. I installed `Development Debug Backtraces` plugin to get detailed error report, but still can't solve it. this is my code (it assumes taxonomies `location` `location2` `studio` exist and have some terms assigned to them)               <?php              /*         Plugin Name: SS         Plugin URI: http://wordpress.org/plugins/hello-dolly2/         Description: Adds some search filtering         Author: Dzimi         Version: 1.0         Author URI: http://ma.tt/         */              function vss_form() {         $blog_url = get_bloginfo('url');             ?>         <form method="get" action="<?php echo $blog_url; ?>" id="ss-search" name="vkss-config">         <input type="text" value="<?php echo 'welcome'; ?>" name="s" />         <?php              $taxes = array('location', 'location2', 'studio');              foreach ($taxes as $taxonomy) {                  // echo gettype($taxonomy);                  $terms = get_terms($taxonomy, array('orderby' => 'id', 'order' => 'ASC'));             foreach ($terms as $term) {                 //                      //                      $term_name = $term->name;                 echo "
<input type=\"checkbox\" name=\"{$taxonomy}[]\" value=\"$term_name\" id=\"$term_name\" /> $term_name
";             }         }              ?>         <button>SS Submit</button>         </form>         <?php         }              function vss_search($query) {                  // has the form been init?             if (isset($_GET['s'])) {                      //make the query                 $s = filter_input(INPUT_GET, 's', FILTER_SANITIZE_STRING);                 // if ( empty( $s ) ) return;                 $query->is_search = true;                 $query->set( 's', $s );                          $tax_holder = array();                      $all_taxes = array('location', 'location2', 'studio');                      $tax_names_holder = array();                      foreach ($all_taxes as $ind_tax_name) {                          if (isset($_GET[$ind_tax_name])) {                              $cb_tax_name = $_GET[$ind_tax_name];                              $tax_names_holder[$ind_tax_name] = $cb_tax_name;                              // echo '
';                         // print_r($tax_names_holder);                         // echo '
';                     }                      } // end foreach                      foreach ($tax_names_holder as $key => $value) {                          if (isset($_GET[$key])) {                              $get_tax_term = $_GET[$key];                              unset($tax_term);                         foreach ($_GET[$key] as $value) {                             $tax_term .= ','.$value;                         }                              $tax_term = ltrim($tax_term, ',');                              $new_tax_term = explode(',', $tax_term);                              $tax_holder[] = array(                         'taxonomy' => $key,                         'field' => 'slug',                         'operator' => 'AND',                         'terms' => $new_tax_term                         );                               } // end if (isset($_GET[$key])) {                      } // end foreach                 // end get tax checkbox results                      $query->set( 'tax_query', $tax_holder);                  // echo '
';                 // print_r($tax_holder);                 // echo '
';                  } // end has the form been init?              } // end vss_search()         add_action('pre_get_posts', 'vss_search');                   add_shortcode('vss', 'vss_form');         ?>      And this is the detailed error:               #0  error_backtrace(2, urlencode() expects parameter 1 to be string, array given, C:\wamp\www\plugin_tester\wp-includes\formatting.php, 3645, Array ([path] => Array ([0] => bg),[suffix] => ))     #1  urlencode(Array ([0] => bg)) called at [C:\wamp\www\plugin_tester\wp-includes\formatting.php:3645]     #2  wp_basename(Array ([0] => bg)) called at [C:\wamp\www\plugin_tester\wp-includes\query.php:1749]     #3  WP_Query->parse_tax_query(Array ([s] => welcome,[location] => Array ([0] => bg),[error] => ,[m] => ,[p] => 0,[post_parent] => ,[subpost] => ,[subpost_id] => ,[attachment] => ,[attachment_id] => 0,[name] => ,[static] => ,[pagename] => ,[page_id] => 0,[second] => ,[minute] => ,[hour] => ,[day] => 0,[monthnum] => 0,[year] => 0,[w] => 0,[category_name] => ,[tag] => ,[cat] => ,[tag_id] => ,[author] => ,[author_name] => ,[feed] => ,[tb] => ,[paged] => 0,[comments_popup] => ,[meta_key] => ,[meta_value] => ,[preview] => ,[sentence] => ,[fields] => ,[menu_order] => ,[category__in] => Array (),[category__not_in] => Array (),[category__and] => Array (),[post__in] => Array (),[post__not_in] => Array (),[tag__in] => Array (),[tag__not_in] => Array (),[tag__and] => Array (),[tag_slug__in] => Array (),[tag_slug__and] => Array (),[post_parent__in] => Array (),[post_parent__not_in] => Array (),[author__in] => Array (),[author__not_in] => Array ())) called at [C:\wamp\www\plugin_tester\wp-includes\query.php:1577]     #4  WP_Query->parse_query() called at [C:\wamp\www\plugin_tester\wp-includes\query.php:2152]     #5  WP_Query->get_posts() called at [C:\wamp\www\plugin_tester\wp-includes\query.php:3243]     #6  WP_Query->query(Array ([s] => welcome,[location] => Array ([0] => bg))) called at [C:\wamp\www\plugin_tester\wp-includes\class-wp.php:541]     #7  WP->query_posts() called at [C:\wamp\www\plugin_tester\wp-includes\class-wp.php:605]     #8  WP->main() called at [C:\wamp\www\plugin_tester\wp-includes\functions.php:808]     #9  wp() called at [C:\wamp\www\plugin_tester\wp-blog-header.php:14]     #10 require(C:\wamp\www\plugin_tester\wp-blog-header.php) called at [C:\wamp\www\plugin_tester\index.php:17]


create separate page template for wordpress comments

I would like to know how to create separate page for comments with pagination ? like archive page or index page IE: someone is on my blog and wants to see all comments e.g. http://www.wplover.com/comments-central


MapPress Easy Google Map in Jquery Tabs Problem

I am using MapPress Easy Google Map with the following code in my custom theme:               <?php        $mymap = new Mappress_Map(array("width" => 600,"height" => 300));        $mypoi_1 = new Mappress_Poi(array("title" => "DC", "body" => "Beautiful Washington, DC", "point" => array("lat" => 38.90279, "lng" => -77.037849)));         $mypoi_2 = new Mappress_Poi(array("address" => "500 chestnut st, phildelphia"));        $mypoi_2->geocode();        $mymap->pois = array($mypoi_1, $mypoi_2);        echo $mymap->display(array("directions"=>"none"));     ?>      If i put this code anywhere in the theme it shows the map as desired. I am using jquery tabs script:               jQuery("#property-info .tab_content").hide(); //Hide all content     jQuery("#property-info ul.tabs li:first").addClass("active").show(); //Activate first tab     jQuery("#property-info .tab_content:first").show(); //Show first tab content          //On Click Event     jQuery("#property-info ul.tabs li").click(function() {         jQuery("#property-info ul.tabs li").removeClass("active"); //Remove any "active" class         jQuery(this).addClass("active"); //Add "active" class to selected tab         jQuery("#property-info .tab_content").hide(); //Hide all tab content         var activeTab = jQuery(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content         jQuery(activeTab).fadeIn(); //Fade in the active ID content         return false;     });      Tab for the map is the 2nd one. When I click on it following map outputs as shown in the picture. What is the problem? I need it asap. Thanks in advance for any guidance. ![Problem Demonstration](http://i.stack.imgur.com/mpPZQ.jpg)


Separate backend "Widgets" page for each language

Im currently trying to make my backend work with multiple languages. Im using qTranslate as my translation plugin. So far I have accomplished a custom option page with multi-language support. When you click on a different language _(in qTranslate on the sidebar)_ you will get a new options page with prepared option-variables               show(option_textarea) -> 'english backend' -> show(option_textarea_en)     (saving under the same variable possible)      So, if I use one of the options in my template im just accessing the option with the current active language               give(option_logo) -> 'german page viewing' -> return option_logo_de      This also works on the widget-page-side. EXCEPT, when I'm switching my current language in the backend each widget gets the status 'unused' and I have to manually put in the widgets again. They don't exist for the current active language and are not faved. So in general I can only set widgets for one language at a time. The widgets from the other language i have set are dropped then. How can I deactivate this behaviour? What I need is a fixed widget-editing system that works the same way as my options. Maybe there is a workaround for this problem? Thanks in advance.


Show all posts in category

I am trying to show all posts in each category. I've been searching around and it seems I need to have either the category `slug` or `term_id` to do so, like the code below.               <?php query_posts('category_name=MyCategory&showposts=9999'); ?>      I'm currently editing the `archive.php` how to get the `slug` name? Thanks.


User Data Handling between two plugins

I have a facebook authentication plugin installed. I also have a premium content plugin installed. When a user authenticates with facebook they are logged in as a subscriber. When a user signs up for premium content a unique user account is generated, separate from the facebook user account created already. Is there a way to make both plugins share the same information for users? When a user signs up for premium content can they just use the facebook account, or if they are a user with no account just use the facebook authentication. For clarification the reason I am trying to use facebook authentication is because 1:) it is easy for the user, and 2:) my hope is people are not willing to pass on there username and password to others if it is also their facebook login.


do_shortcode() in twentyeleven theme

I observed a difference between `twentyten` and `twentyeleven` themes. Let me explain with an example: `example.com/category/health-beauty/` finds one post containing just a shortcode. If I use `twentyten`, nothing is displayed but in `twentyeleven` the shortcode is expanded. Actually this is what I want `twentyten` to do as well but the problem is I cannot find any `do_shortcode` call in `twentyeleven` code. There has to be one. Right?


Custom taxonomy - custom sortable column

I've created custom taxonomy called 'cities' where you can add cities and added custom field ( radio button ) with 2 options: 'Yes' and 'No' ( never mind what that is ). Everythins is ok, I can get that value and other stuff. Later on I came with idea to add a sortable column ( Like 'Name', 'Slug', 'Posts' etc. ). I've managed to create that column, make it sortable but don't know how to sort those cities by that custom field? Right now it's sorting by name, because I can't get it to work with custom field. Any clues/hints maybe?


Contact Form 7 Not working with WordPress 3.4.1

I am having issues with the Contact Form 7 with it not sending emails using WordPress 3.4.1. I can state that this combination is not working for me, for one of the sites I developed. It also doesn't work for me if I use the WP Mail SMTP plugin. I can also state the the combination of WordPress 3.3.2 with the Contact Form 7 plugin works perfectly. Can someone please assist as this plugin has been working perfectly but since the upgrade to WP 3.4.1, this is no longer the case. My client is asking to resolve asap as if I cannot fix, will need to look at other options. Hopefully someone can assist asap. FYI, I am running PHP v5.2 on GoDaddy.com Thanks. Tony.


Cropping images from top center using Jetpack Photon

I am setting up a website gallery where the uploaded screenshot is 1400px wide and height varies. On my post index page, I need to display a thumbnail of only 900 pixels by 600 pixels. However this is cropped from center/center. Is there a way to crop the image from top center? There is a similar ticket How can I make add_image_size() crop from the top? but am unable to understand it. Also I have activated the plugin Jetpack's Photon module which serves images from the WordPress cloud. It takes the URL and the size and converts it into http://i0.wp.com/flattrendz.com/wp- content/uploads/symbolset.jpg?resize=900,600 and the original image is http://flattrendz.com/wp-content/uploads/symbolset.jpg. Any knows how to make this photon module crop image from top center?


Matching database content types to PHP types

The `$wpdb` query methods return all query results as strings. For example, an 'ID' column would return a string value like `'42'` instead of an integer `42`. Is there a way to configure the WP database class to make the database content types match to PHP types? Or do I need to continue to do this manually like below?               $results = $wpdb->get_results('SELECT * FROM my_table');          foreach ($results as $result)     {         // All integer values         foreach (array('id', 'user_id', 'comment_count') as $field)         {             $result->$field = (int) $result->$field;         }         // All float values         foreach (array('price') as $field)         {             $result->$field = (float) $result->$field;         }         // All boolean values         foreach (array('is_open', 'is_confirmed') as $field)         {             $result->$field = (bool) $result->$field;         }         // Etc.     }      Why bother, you may think? Well, for starters, clean code is fun to work with. Integer values should not be stored as strings. When you create a custom function to look up something, a product, for example, I like to be able to differentiate the field to look up based on the data type of the passed argument:               function load_product($id_or_slug)     {         if (is_int($id_or_slug))         {             // Look up by ID         }         else         {             // Look up by slug         }     }


Wrap php in shortcode

I'm using a plugin that will display content based on user location, and I'm trying to add it to a facebook widget code. The plugin is using a shortcode to wrap content that will be displayed, and here is what I have so far. I know I'm doing something wrong, and would really appreciate it if you can point me to the right direction.               if (($user_id) and ($app_id) and ($secret_code)){         $user_data = get_option('wt_recent_fb_posts_user');              echo do_shortcode ('[wpgc_is_city city="Morrisville"]');              if ((!$user_data) OR ($user_data[0]->id !== $user_id)){             $user_data = $this -> fetch_userdata($user_id);                      }                             $fb_posts = get_transient('wt_recent_fb_posts');                         if (!$fb_posts){ //no messages, fetch from facebook                          $fb_posts = $this->fetch_fbposts($user_id, $post_count, $app_id, $secret_code);                      } else {             $fb_posts = get_transient( 'wt_recent_fb_posts' );                           }              if(isset($user_data[0]->name)){             echo "

url."' target='_blank'>".$user_data[0]->name."

";         } else {             echo "
Facebook
";         }              echo "

";              foreach ($fb_posts as $fb_post) {             echo "
";             echo "
".$fb_post->message."
";             $created_time = $fb_post->created_time;             $time_ago = sprintf(__('%s ago', 'wellthemes'), human_time_diff(strtotime($created_time)));              echo "
".$time_ago."
";                                                echo "
";         }         echo "

";          echo do_shortcode('[/wpgc_is_city]');     }


Add custom column in custom post type edit page

I am using the Content Scheduler plugin to control the post expire. The plugin will add a expiry date column on the wp-admin/edit.php in page and post. However it doesn't show in custom post type page list. So I take a look into plugin codes and found this which believe are the one that control the column in the page list.               add_action ( 'manage_posts_custom_column', array( $this, 'cs_show_expdate' ) );     add_filter ('manage_posts_columns', array( $this, 'cs_add_expdate_column' ) );      Thus, I tried to add another filter for the custom post type in the plugin file, like these:               add_action ( 'manage_cpt_posts_custom_column', array( $this, 'cs_show_expdate' ));     add_filter ('manage_cpt_posts_columns', array( $this, 'cs_add_expdate_column' ) );      where cpt is the custom post type, however this won't work, any idea why? By the way, I know it is not a good approach to alter the plugin core codes, but I don't know if I can hook it in functions.php. Anyone know how to do this? thanks.


custom default avatar showing broken link

I am using the follow function to create a custom default avatar for users who comment and do not have a gravatar setup.                if(!function_exists('custom_avatar')){         function custom_avatar($avatar_defaults){             $new_default_icon = get_bloginfo('template_directory') . '/images/VR-default-avatar.png';             $avatar_defaults[$new_default_icon] = 'VR Custom Avatar';             return $avatar_defaults;         }         add_filter('avatar_defaults','custom_avatar');      }      and when I go to the admin panel under settings --> discussion it shows the new line with the text VR custom avatar, but the link to the image is broken. Also when I select and save and then go to the blog the default image is also a broken image. I went to google chrome and did an inspection on the broken image and it shows:               <img alt="" src="http://0.gravatar.com/avatar/25c562d0eebef3b375ae2d0fea8ad716?s=32&d=http%3A%2F%2Fwww.violet-rain.com%2Fwp-content%2Fthemes%2Fartificer%2Fimages%2FVR-default-avatar.png%3Fs%3D32&r=G&forcedefault=1" class="avatar avatar-32 photo" height="32" width="32">      What am I doing wrong that it is pulling from the gravatar website?


Firebug : Problem with jQuery in WordPress admin panel

I'm trying to make my first plugin and I have a problem with firebug. When I use firebug console in WP Admin Panel doesn´t work correctly. For example when I use the selector $('#wpbody') the console return null value. The WP panel include jQuery library and I don´t know why firebug works wrong. Any advice or sugestion? Tested with WP 3.1.3 and 3.2.1 Thanks, Marcos.


Getting the Posts' permalinks from XLMRPC

I'm new to WP and I must fetch pages/posts from a blog in another subdomain. I'm using ZF to do this. I've recently found out the `getPages` doesn't get me what I want (posts; duh!). I didn't see any "getPosts" rpc methods for WP, so I've tried `blogger.getRecentPosts`. That's better, but now I don't have the permalinks. It would've been nice for it to return the same values as `getPages` does (title, permalink etc.). I'm considering modifying (through filters, ofc) the WP's RPC server to return pages and all the relevant information, but, for now..   Is there a RPC method for WP to get Posts and their permalinks?


File Security Check in wordpress in index.php of theme

if ( ! function_exists( 'wp' ) && ! empty( $_SERVER['SCRIPT_FILENAME'] ) && basename( __FILE__ ) == basename( $_SERVER['SCRIPT_FILENAME'] ) ) {         die ( 'You do not have sufficient permissions to access this page!' );     }      I find these lines of code in _index.php_ of a theme in WordPress.   What is the logic behind these lines?


Disallow second login session

I am trying to find a solution for 2 months now but unfortunately I came up with no results. I have a subscription based website which streams music. What customers basically buy is a "panel" where they are listening to music **_without the need to refresh_** the page. What I need is to disallow their account being logged in if it is already in use. I found many plugins that force the user to log out but this happens only if they refresh the page. It could also work if for example: A logs in. B logs in with the same account and at this time A is being automatically logged out (I guess with the use of Ajax). It's a bit weird that nobody needed this in the past. Anyone could help? Thanks in advance.


wp_list_categories to show list of categories and the description

I have some code in my category.php file to show either pages or categories. Depending if the category has sub categories or not. Is it possible to also show the category description as well? This is the code i'm using to show either the pages or a list of categories in my category.php file.               <?php          if (!category_has_children()) {?>     <?php foreach(get_the_category() as $category) {     $cat = $category->cat_ID; }?>     <?php query_posts('post_type=Product&cat=' .$cat .'&order=ASC'); ?>                 <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?><?php the_post_thumbnail(array(100,100)); ?>                 <?php the_excerpt(); ?>
                         <?php endwhile;?>             <?php endif; ?>      <?php get_template_part('loop', 'index');     } else {?>

     <?php      $cat_id = get_query_var('cat');     $catlist = get_categories('child_of=' . $cat_id);     if ($catlist) {     wp_list_categories('depth=1&hide_empty=0&echo=1&orderby=id&title_li=&child_of=' . $cat_id);     }      }     ?>      I don't think it's important but i've also got this code in my functions.php file.               //Display product categories     function category_has_children() {     global $wpdb;     $term = get_queried_object();     $category_children_check = $wpdb->get_results(" SELECT * FROM wp_term_taxonomy WHERE parent = '$term->term_id' ");          if ($category_children_check) {               return true;          } else {               return false;          }     }      I don't think a lot of the code is important but thought i should show everything. I need to use the wp_list_categories because i have a plugin that displays an image next to category names and that needs to use the wp_list_categories function.


How to add a shortcode that creates an adjacent column of text in the content editor?

I'd like to enable a shortcode toolbar button, similar to the "More" break, that I can click to mark an insertion point where the text should be broken into columns. Do shortcodes have encapsulation or would I need to enter an endpoint? Example:               [column]The column starts here[/column]      Or               [columnBegin]The column starts here[columnEnd]      I'm looking for some examples or plugins that might make this possible.


How to check if a widget has no title

I wanted so that my widget has the following structure:

Foo Bar

Blablablabla blabla

      so I registered my sidebar...               register_sidebar(array(         'name' => 'Sidebar Widget Area',         'id'   => 'sidebar-widget-area',         'description'   => 'Choose Widget(s) to display in this area.',         'before_widget' => '
',         'after_widget'  => '

',         'before_title'  => '
',         'after_title'   => '

'     ));      It looked good at first... but things went awry whenever there's a widget without title. The reason is kinda obvious, without the title, there will be an extra `</div>` in the markup. Question: Is there any good method to achieve my desired markup? ( with/without a widget title ) ========================================== NB: I'm sorry if the thread's title is kinda different from the main question.


Wordpress plugin advice: suggestions for writing a plugin the correct way

I will write my first Wordpress plugin for the local animal shelter. The plugin will make a list of the animals in a category page(or a custom loop if that is a better way to do it) and make a little list with a thumb and some basic info about the animal with an anchor so people do not have to scroll down the entire page to see all animals they would be interested in. I was thinking about what way to realize this. Some options I could think of:   * Look for certain strings in the content and if that one is found create a thumb from the posts image and put the stringline into the list.   * Add some text fields to the form to the new message form and get the data from those.   * Let the person who maintains the website add the listitems in a seperate form and paste a link to the correct animal.  What would be the best way to do it from my list? Or are there any better ways I could do this?


How WordPress autosave can save plugin fields?

**Setup:**   * WordPress Add/Edit Post/Page   * A plugin that have its own postbox with several hidden fields. **Issue:** How these custom hidden fields can be saved along with the other post data within the **Autosave** feature? Thanks


Using custom post types to give Wordpress a more CMS-like look. What to prioritaize? Pages or Content?

I've been adding custom post types in the admin panel and endingup with the following results: **1. Prioritazing content:** Posts (blog entries, news, events...) Pages Static Content (custom post type) -> Sections (custom taxonomy) (Tagline, Slider, Mainbar...) ... In this case, I divided the pages into sections, the problem is that the client can only know where the section is by creating a term like this: Tagline (Front-Page). **2. Prioritizing pages:** Pages Front-Page (custom post type) -> Sections (custom post type) (Tagline, Slider, Mainbar...) News (custom post type) ... Events (custom post type) ... Photos (custom post type) ... About (custom post type) ... Blog (custom post type) ... Contact (custom post type) ... In this case, the client will know to which page the content will go. But if the user will see some pages he or she may never use. Which method is more efficient concerning content managment? Do you have another better alternative? * _Reference Picture of case #1 (the custom post type is called Static Content and the custom taxonomy is called Sections. Posts will be preserved but used in Categories called Events, News, etc...):_. ![enter image description here](http://i.stack.imgur.com/liFaR.png)


Add html to cpt main page / admin edit.php

I want to add some html under the title of a custom post type I created. See area in image here: http://i.stack.imgur.com/rpkV3.png I tried using different methods including post_row_actions (depricated) filter to do this. Does anyone know of a function or a method on how to do this? I was hoping to use an action hook or filter. I want to add a simple with some instructions and maybe an image to that area. Thanks


WordPress display name string manipulation

I have set the display name to show both first name and last name using the function below. How do I manipulate the LAST NAME to only pull the first letter of that string? Example, if you sign up as John Doe (First name= John, Last name= Doe), I want your display name to be John D. Thanks               function force_pretty_displaynames($user_login, $user) {            $outcome = trim(get_user_meta($user->ID, 'first_name', true) . " " . get_user_meta($user->ID, 'last_name', true));       if (!empty($outcome) && ($user->data->display_name!=$outcome)) {         wp_update_user( array ('ID' => $user->ID, 'display_name' => $outcome));           }     }     add_action('wp_login','force_pretty_displaynames',10,2);


Plugins for putting Custom Post Types into the Menu

I have been building a website that has numerous `custom post types`, and I have found one called `WordPress Post Type Archive Links`. This would allow me to add a link to the an archive of registered `post types`. When you are on the archive pages, then the menu item is selected, however, when you go into a `taxonomy` (associated only with that `post type`), the menu is no longer marked as selected. This isn't a major thing, but it makes the website loose some of its coolness. But, does anyone know how to modify that plugin, or a different plugin that would allow for me to put a link to a `custom post type` in the menu, that also remains selected when you are in the category view for that post type?


Showing one post from each category, paged?

I want to display one post from each category per page. So the first page would contain the first post of cat A, the first post of cat B and the first post of cat C. The second page would contain the second post of cat A, the second post of cat B and the second post of cat C. I currently use the following code, but it does not work, I always get the same posts.               $category_ids = get_all_category_ids();     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          foreach($category_ids as $kk=> $cat_id) {         $cat_name= query_posts( 'cat='.$cat_id.'&posts_per_page=1&orderby=date&order=ASC&paged='.$paged);         foreach($cat_name as $post) : setup_postdata($post);             if (have_posts ()) :                 while (have_posts ()) : the_post(); ?>         <?php                         }                         else {                             ?>                             <?php if( get_the_category_list() ) { ?>
<?php the_category( ', ' ) ?>
<?php } ?>                 endwhile;             endif;


Create a custom archive page for a custom post type in a plugin

I'm writing a plugin that creates a custom post type named "my_plugin_lesson":               $args = array (         'public' => true,         'has_archive' => true,         'rewrite' => array('slug' => 'lessons', 'with_front' => false)     );     register_post_type ('my_plugin_lesson', $args);      The custom post type has an archive, and the URL of the archive is: `http://example.com/lessons` I want to customize the look of this archive; I want to list the posts in a table format, rather than the standard WordPress blog post archive. I understand that a custom archive template could be created in the theme by making the `archive-my_plugin_lesson.php` file; however, I would like the plugin to work with any theme. How can I alter the content of the archive page without adding or modifying theme files? **Edit:** I understand that I could use the `archive_template` filter hook. However, all this does is replace the theme template, which still needs to be theme-specific. For example, just about every theme template will need the `get_header`, `get_sidebar`, and `get_footer` functions, but what should the id of the content `<div>` be? This is different in every theme. What I would like to do is to replace the content itself with my own content, and use that in place of the archive page for my custom post type.


Change Width of Featured Image Thumbnail on Add/Edit Post Page

Does anyone know of a way to change the width of the featured image on the edit post/add post page? I want to make it 50px wide. I'm not talking about the front page of the website, but the back end where you've selected the feature image and it sits next to your post as you're typing. Thank you! :)


Show Featured products in product category pages

I would like some help with the following issue with woocommerce. I am using wordpress 3.5.2, woocommerce 2.0.13 and sommerce theme. I have a product category page, in which I display 5 subcategories. **Under** the 5 subcategory images, I would like to have some featured products or random products of these categories. Do you know how I could do that?


Adding my own custom woocommerce shortcode to child theme, how?

So I bought a theme at themeforest.com that has some custom templates to use with the Woocommerce plugin. I made a child theme so I don't have to edit anything in this original theme. What I was able to do so far is overwrite the form-login.php template in my child theme. What I'm trying to do now is add a custom shortcode, similar to the [woocommerce_my_account] one that will call the form-login.php template that I've overwritten. The code that creates the shortcodes in the Woocommerce plugin looks like this: File: /wp-content/plugins/woocommerce/classes/class-wc-shortcodes.php               class WC_Shortcodes {              public function __construct() {             add_shortcode( 'woocommerce_my_account', array( $this, 'my_account' ) );         }              public function my_account( $atts ) {             global $woocommerce;             return $woocommerce->shortcode_wrapper( array( 'WC_Shortcode_My_Account', 'output' ), $atts );         }     }      File: /wp-content/plugins/woocommerce/classes/shortcodes/class-wc-shortcode- my-account.php               class WC_Shortcode_My_Account {              public static function get( $atts ) {             global $woocommerce;             return $woocommerce->shortcode_wrapper( array( __CLASS__, 'output' ), $atts );         }              public static function output( $atts ) {             global $woocommerce;                  if ( ! is_user_logged_in() ) {                      woocommerce_get_template( 'myaccount/form-login.php' );                  } else {                      extract( shortcode_atts( array(                         'order_count' => 5                 ), $atts ) );                      woocommerce_get_template( 'myaccount/my-account.php', array(                     'current_user'  => get_user_by( 'id', get_current_user_id() ),                     'order_count'   => 'all' == $order_count ? -1 : $order_count                 ) );                  }         }     }      How could I add a custom shortcode like that one? Do I put it in my child theme? Can I just copy/paste the code from the output function, put it in my functions.php and do add_shortcode('custom_shortcode', 'function_in_my_functions_php'); ? But what about the global variable $woocommerce? Can I access that variable from within my child theme? Thank you so much if anyone wants to shed some light on this, I'm just starting to learn Wordpress.


Change out put of the_post_thumbnail in PHP

I am brand new to PHP. I've messed with wordpress on it but not really with the code behind it. I am trying to speed up the loading time of our wordpress site but I am having some trouble. PHP uses `the_post_thumbnail` to load the HTML code for some of the posts' images. I have this code to delay loading of the images a little so the page can load first and then the images will load:               jQuery(window).load(function() {     jQuery('img[source]').prepend(function(){         var source = jQuery(this).attr('source');         jQuery(this).attr('src', source);     });     });      This works very well on another site I work on written in coldfusion and normal html. So what I'm trying to do is change the output of `the_post_thumbnail` to have a 'source' attribute that has the actual source path and the initial `src` value will have a default loading gif. My first thought was to build another function or I guess as PHP calls it, add a filter like this:               add_filter('post_thumbnail_html', 'thumbnail_filter');     function thumbail_filter() {     $default_attr = array(         'src'   => $src,         'class' => "attachment-$size",         'alt'   => trim(strip_tags( $wp_postmeta->_wp_attachment_image_alt )),     );     the_post_thumbnail($default_attr);     // you can alter the resulted HTML here     $html = the_post_thumbnail($default_attr);     return $html;     }      This didn't actually broke the page and didn't show any images even when I haven't called the thumbnail_filter function. My next guess as to what to do was this. Can someone who is a little more experienced in PHP and wordpress help me out? Maybe the first one is the right way to go but I'm just doing it wrong.


Wordpress select dropdown list in widget

Ok, I'm developing my own widget and I've a HUGE problem. I don't know how to fetch and eventually save html selects value. Simple example:               /* initialize TITLE */     function widget( $args, $instance ) {             extract( $args );             $title = apply_filters('widget_title', $instance['title'] );          (...)          /* update code for TITLE */         function update( $new_instance, $old_instance ) {             $instance = $old_instance;             $instance['title'] = strip_tags( $new_instance['title'] );          (...)          /* creating TITLE field in widgets admin area */
         <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'hybrid'); ?>         <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" type="text" style="width:100%;" />
          (...)      OK. Now when I type               <?php echo $instance['title'] ?>      It's going to show my title! But I have this list:               <label for="<?php echo $this->get_field_id( 'example' ); ?> "><?php _e('Map type:', 'example'); ?>     <select id="<?php echo $this->get_field_id( 'example' ); ?>" name="<?php echo $this->get_field_id( 'example' ); ?>">          <option value="supervalue" selected="selected">Super Value</option>     </select>      And               <?php echo $instance['example'] ?>      Gives NOTHING. I've been looking everywhere including default-widgets.php but I don't understand a word since all default plugins use mostly dynamically generated option lists. I've used only one item list, but in fact it's longer, I'm not sure how to save the selected element also, since I don't know how to access this element's value. Any ideas? I spent the whole day on this, getting totally mad slowly. [edited] I didn't show you the update function because as I mentioned above I use the same update code for each function.                function update( $new_instance, $old_instance ) {              $instance = $old_instance;         $instance['example'] = strip_tags( $new_instance['example'] );                  return $instance;          }


Find And Add Category to Posts

My WordPress site is a mess. Previously, it had 80+ categories, with 1-2 sub- categories. After creating blueprint for this site (I'm restructuring the site completely), I have new 6 categories and about 40 sub-categories. In total I have over 85+ categories. My next plan is to (executing it as we speak) point posts to new categories/sub-categories. Now, as every post is different, I have to scroll to find out the right category (and untick the previously-assigned category). Assigning categories manually is a painful task. All this is too much of work, even if I use "QUICK EDIT." Is there a plugin that lets me search for the category (in real-time) as I type a few letters in the category box? Or a plugin that makes adding category easier? Appreciate if you can help here.


Save post meta foreach loop

My brain has fallen over. How do I save this post data? Building some key- value pairs in the form.                   for ($i = 1; $i <= 3; $i++) {             $saved = $meta[$i];             //print_r($saved);             //echo $saved['key'];             echo '
';             echo 'Key ',   '<input id="meta_k_'.$i.'" type="text" name="_meta['.$i.'][key]" value="'.$saved['key'].'" />  ';             echo 'Value ', '<input id="meta_v_'.$i.'" type="text" name="_meta['.$i.'][value]" value="'.$saved['value'].'" />';             echo '
';         }      How do I save them???                   foreach ($_POST['_meta'] as $key => $value) {             update_post_meta($post_id, $key, $value);         }


Remove attachment from database

Is there a way to bulk remove attachments from WordPress database but not delete the actual files from the server? Sort of like the opposite of http://wordpress.org/plugins/add-from-server/


Which filters or actions to use after a media upload and delete?

When a media (image) is uploaded and the subsequent images are created (all the different sizes), I would like to perform a few actions. It is simple and I basically need only the new attachment ID, that would be enough. Same during deletion: before or after deletion, I need to know which attachment ID is concerned. Thanks for your help :)


Sorting posts by specific order

I have a custom post type and I want to be able to control the order that the posts are displayed by defining the order in an array, and then checking the posts meta_value against the array to see where it should sit in the order of posts. Using the code below I can get the dealers who's 'Postcode' is one of the values defined in the $target_postcodes array of the 10 closest postcodes to the current users location.               $posts = get_posts(array(             'post_type' => 'dealer',             'meta_key' => 'Postcode',             'meta_value' => $target_postcodes,             'post_status' => 'publish'         ));      Is it possible for me to sort the posts by the order of the values in the 'meta_values' query? For example, if we use the following post values:               [Name]    [Postcode]     Dealer 1  1234     Dealer 2  2345     Dealer 3  3456     Dealer 4  4567      And then the define the $target_postcodes array as               $target_postcodes = 4567,1234,3456,2345      I would then want the loop to display the dealers in the following order               Dealer 4     Dealer 1     Dealer 3     Dealer 2      Thanks, Brad


Changes in a home, two columns

I'm working with this template (this is a demo), I need the post shown on the home to appear in two columns rather smaller in width. Enclosed is my index.php code, I've tried everything by various forums and there is no way, my knowledge is limited if I can say that putting code in index.php and the css then I fix it myself.               <?php get_header(); ?>

                      <?php if ( have_posts() ) : ?>                          <?php while ( have_posts() ) : the_post(); ?>                              <?php                             /* Include the Post-Format-specific template for the content.                              * If you want to overload this in a child theme then include a file                              * called content-___.php (where ___ is the Post Format name) and that will be used instead.                              */                             get_template_part( 'content', get_post_format() );                         ?>                          <?php endwhile; ?>                          <?php athemes_content_nav( 'nav-below' ); ?>                      <?php else : ?>                          <?php get_template_part( 'no-results', 'index' ); ?>                      <?php endif; ?>

      Please help I have to submit the template in two columns and truly I've tried everything and can not do. Many Thanks for your help.!


How to create thumbnails with a fixed width, so all of them will have the same width?

right now, a thumbnail will be _either_ 150px in height _or_ in width, depending if it's landscape or portrait. Is there a way to make them always the same width and scale them in height accordingly, without squaring them? Kind regards


Get custom post type where taxonomy..

I am not sure how to fetch specific custom post type where taxonomy is for example february. Generally I'm trying to have custom data based on months. Registering custom post type               add_action( 'init', 'plants' );     function plants() {         $args = array( labels and etc   );         register_post_type( 'plants' , $args );     }      Registering taxonomy for custom post type               add_action('init', 'months');     function months() {         $args =  array ( labels and etc );       register_taxonomy('months', 'plants', $args);     }      Fetching data               $args = array( 'post_type' => 'plants'  );      $plants= new WP_Query($args);     if ($plants->have_posts()) : while ($plants->have_posts()): $plants->the_post(); ?>                <?php the_title(); ?>         <?php endwhile; ?>     <?php endif; ?>      So everything so far works, I get 3 items. But how do I fetch only items with specific taxonomy? Following doesnt do anything               $args = array(         'post_type' => 'plants',         'months'=>'february'         );


Changing permalinks and redirecting urls

I'm moving a client from Tumblr > WordPress. I can't figure out how to make the new permalinks work. Two issues:   1. The current Tumblr urls look like this: http://blog.example.com/847336253/post-name But when I import the posts to WP, it chops off the end of the urls. I end up with just: http://blog.example.com/847336253/ **So, question 1:** Can I append a slug to the end of that number? I've found a handy script that will rewrite the urls for me, removing the numbers and leaving me just with /post-name. But I'd like to keep that number in there.    2. The url of the site is changing from http://blog.example.com to just http://example.com. **So, question 2:** Can I accomplish a proper redirect with a 301 directive in my htaccess file?


Wordpress 3.9 not using custom template

I upgraded my Wordpress from 3.8.1 to 3.9.1. I am using the magic-fields-2 plugin for custom data, I have created a custom post type and a custom template for displaying single posts of that type. Everything worked fine before the update. After updating, all posts of this type use index.php in my theme directory. I have tried creating single-post.php and the posts still use index. I copied my template to a new file, added a template tag to that file, and selected that custom template for a post, that post was rendered using index.php. I have googled for over an hour without any luck. Any help or suggestions appreciated. -- EDIT 1-- The theme is a custom theme of my own making. It is not very complicated, just some custom css and some custom templates. I created the theme in 3.6.x and it has not changed significantly since then. The template that single posts were using prior to 3.9.1 was single-suites.php (suites is the custom post type). It is still there, but it is being ignored. I copied that file to single-post.php which is supposed to be the next choice in the template hierarchy, but that file is not being used either. I made yet another copy of the same template file, and added a template declaration to it. I edited 3 different posts and selected this template file as the custom template (it was in the template dropdown list), published them and viewed them. All 3 were still using index.php as their template. Finally, I took everything out of the custom template file except the template declaration and an h3 tag just to make sure there were no errors in the template that would cause a problem (my error log was clean, but I was just being cautious). It would still not use the theme. -- Edit 2 -- I am using the plugin magic-fields-2. That is my only plugin. If I disable that plugin then my custom post type goes away and all the posts associated with that custom post type disappear. These are the posts I'm trying to display I appreciate the questions and hope I have provided enough information to define the problem.


How to redirect non existent pages/posts in wordpress using htaccess

How can I redirect non existent pages/posts in WordPress using only .htaccess file? Here is my code:               <IfModule mod_rewrite.c>          Options +FollowSymLinks     RewriteEngine on     RewriteBase /     RewriteRule ^products/cool-tshirt$ /tshirts [R=301,L]          </IfModule>      Thank you in advance.


How does a modified theme show correctly in a Multisite Install?

Using WordPress 3.9.1, I have installed the Pinzolo Theme and modified it. After installing a multisite, my second site uses the Pinzolo theme also, but all the modifications I made in the first install are gone. Does anyone have any idea what might have happened, or how to fix this?


is_front_page breaks with url parameters generated by a plugin

I have a website that displays a specific layout feature only on the homepage, and this is working fine. However, the client has suggested that they would like the website to be bilingual, and so I added a plugin to allow the transition between two languages. Unfortunately, the plugin adds `/?lang=cy` to the URL and I fear it's causing my layout feature to break. The conditional is relatively straight forward:               if (is_front_page()){ ?>         RENDER HOMEPAGE FEATURE     <?php }      When I choose to switch language, the layout feature disappears.


Using DISTINCT in wp_query

I need to create a system where the user first selects the state, then select the city and then see the information of the stores in that city. For this, I created a cpt called store with 2 meta boxes: state and city. For the first drop-down list, I'm using a wp_query with the following args:               $args = array(         'post_type' => 'store',         'posts_per_page' => -1,         'meta_key' => 'state',         'orderby' => 'meta_value',          'order' => ASC,     );      But it is returning repeated states, because there is more than one store in the same state. How can I solve this? I thought about using mysql DISTINCT but do not know if it is possible. **UPDATE** The complete loop:               $args = array(         'post_type' => 'store',         'posts_per_page' => -1,         'meta_key' => 'state',         'orderby' => 'meta_value',          'order' => ASC,     );           function search_distinct() { return "DISTINCT"; }      add_filter('posts_distinct', 'search_distinct');      $the_query = new WP_Query( $args );           if ( $the_query->have_posts() ) {        echo '
';        while ( $the_query->have_posts() ) {           $the_query->the_post();           echo '
' . get_custom_field('estado') . '
';        }        echo '
';      }      wp_reset_postdata();      remove_filter('posts_distinct', 'search_distinct');      But the filter is not taking effect


Custom post types and custom variables -- add_rewrite_tag() question

I'm stuck on this, and have no idea what I'm doing. I have a custom post type called areas, that is hierarchical. We want to pass a variable into the page, and have it be pretty. Currently, it is: http://www.mysite.com/area/alabama/birmingham/?action=places We'd like it to be: http://www.mysite.com/area/alabama/birmingham/places/ I've been mucking around with add_rewrite_tag() now for several hours, and just can't get this to work.               function create_custom_rewrite_rules() {     global $wp_rewrite;          // Define custom rewrite tokens     $rewrite_tag = '%places%';          // Add the rewrite tokens     $wp_rewrite->add_rewrite_tag( $rewrite_tag, 'area/(.+?)/places/', 'action=places' );          // Define the custom permalink structure     $rewrite_keywords_structure = $wp_rewrite->root . "area/%pagename%/$rewrite_tag/";          // Generate the rewrite rules     $new_rule = $wp_rewrite->generate_rewrite_rules( $rewrite_keywords_structure );          $wp_rewrite->rules = $new_rule + $wp_rewrite->rules;          return $wp_rewrite->rules;      } function add_custom_page_variables( $public_query_vars ) { $public_query_vars[] = 'action'; return $public_query_vars; } add_action( 'generate_rewrite_rules', 'create_custom_rewrite_rules' ); add_filter( 'query_vars', 'add_custom_page_variables');


Manually set global $post vars with an ID, in order to use template tags

I have a function retrieving ID's of posts by very specific means. I need to be able to set the `global $post` in order to use functions like `the_content()`, which does not allow an ID as a parameter. How can I achieve this?


Is there a way to have the view link on manage posts page to open in a new window or tab?

Hi I am trying to figure out on how to get the "view" link on the manage posts / custom post types and pages to open in a new tab or window. ![A screenshot of what I am talking about.](http://i.stack.imgur.com/4RAdz.png) I know it is probably possible to do via the functions.php file of the theme and would much rather go that route than using a plugin. Any help with this would be appreciated. Thank you. :)


Outside url for post content

I'm creating a widget to embed from outside of wordpress that will contain the post content. I don't want to use the permalink because that will include the whole page. I'm thinking I can grab the post id, but not sure how to call the url of only the post content from outside of wordpress.


Changing fonts (and related settings) in wordpress theme

I am using wordpress for my blog/site. I am using Freshnews theme from woothemes as the theme for the blog. Here is the link: http://demo.woothemes.com/freshnews/ The font is not that good and it is way too small and the spacing is bad (too congested). How do I change the fonts, size, spacing (line and paragraph) throughout the blog. I know I would have to change it somewhere in the stylesheet. But where exactly and how? And what are the ways to get this done? Should I install a font somewhere? Should I use webfonts (like google webfonts)? What is the advantage in using this? or what are the other ways?


Plugin: Front-end Editor - User role specific editable content?

(using scribu's front-end-editor) Currently I have several custom fields and taxonomies that appear on posts as they are created by users. Each author is able to edit only their own posts. However, there is one taxonomy (or custom field) that needs to only be editable by admins or editors and NOT authors. What would I need to do to disable this particular taxonomy (or custom field)?


Multi Parameter search with custom post type category and tag

i have a custom search which will have 3 inputs (dropdowns) , the html code of the form is ready and will use GET in url , now the remaining part is using values from url to run query. Parameters will be : category, tag and custom field So far i have managed getting the value in url , quering it get post by custom post type category using this code :               $args=array(       'post_type' => 'tyre',       'post_status' => 'publish',       'tax_query' => array(             array(                 'taxonomy' => 'tyre-category',                 'field' => 'ID', //can be set to ID                 'terms' => $catid //if field is ID you can reference by cat/term number             )             )     );      Till here i managed to pull out the items in the category of custom post.   Now the remaining part will be check two custom fields and if the value matches as in parameter in url then display. how will be able to do that i am not sure how to modify the loop for that. EDIT! I have Managed 90% of it by using meta_query code below :               'meta_query' => array(             'relation' => 'AND',             array(                 'key' => 'size',                 'value' => $size,                 'compare' => '='             ),             array(                 'key' => 'terrain',                 'value' => $terrain,                 'compare' => '='             )         )        Now the only problematic part is extracting and check value from a custom field called size, as it can have comma seperated multiple sizes. Help is Appreciated! Thanks and Regards


Is there a way to add flv video to video.js player in Wordpress?

Video.js supports mp4, wemb and ogg formats but i think there is a trick to add flv format example: http://jsfiddle.net/N8Zs5/18/