Tag pages do not show

## problem: When I request a "tag" page e.g. /tag/whatever no tag page shows up only the frontpage. This also seems to be the case with categories ## what did i do   * I have moved this blog from single site to my WP3 Multisite setup (#21) ## What Did I try already   * The other 20 moved weblogs work OK so it is not "generic" or .htacess or wpconfig   * I have tried other themes like 2010 : the same problem   * Just to be sure I flushed the permalinks   * "if(is_tag()) { echo ""; } else { echo ""; }" always show "no tag"... in other words the page itself does not think it is a tag page   * the table structures and database contents for terms, etc... look ok   * i have a template page "tag.php" with in it "hello tag", this one does not show   * the backend looks completely ok: tags show with posts etc..   * the tags DO appear under the posts   * template_loader-php : the is_tag = false ## Current Hypothesis   * the query parser in query.php shows the correct tag in the array but the new $this->parse_tax_query( $qv ); hmmm maybe returns the wrong thing?   * any leads to give a brain spark? must be something stupid ? COULD it be that in query.php in the function parse_tax_query... there is no check for the "tag" in a query string?? **UPDATE** : I found it! (but it took some time): it is the simple tags plugin (http://redmine.beapi.fr/projects/show/simple-tags) conflicts with the new parse_tax_query .... in 3.1 .... phew!


Creating custom permalink structure for languages

I've written a simple multi-language system, whereby clicking on a flag icon sets a one year cookie containing a two letter language code (e.g. nl, de, etc). I hook into the `wp` action to read the cookie value, then use the `the_title` and `the_content` filters to show the correct language (the different languages are entered via metaboxes on the page/post edit screen). This all works great except I'd also like to have permalinks for each language version whereby the two letter language code is between the domain name and the usual permalink structure. I'm using the `%postname%` permalink structure, so all the following would be valid:               http://example.com/nl/about-us     http://example.com/de     http://example.com/fr/2012/03     http://example.com/es/this-is-a-post-title      If the current language is English, then no two letter code should be used (it will just be the normal permalink). So far I have used the `query_vars` filter to add a query var called `lang`, but that's sa far a I've got, I'm unsure what the next steps are. Any advice much appreciated!


Custom theme template files

Im trying to create a Theme from scratch, its quite challenging, cause im new to WP. I follow this developing process at Teamtreehouse. All is very good, its just, im puzzled with the template file creation. Its all fine with `front-page.php` and `home.php` files, but eventually I want to have as well the: `partnership.php`, `gallery.php`, `contact_us.php`, `prices.php` files too. Anyhow, when I created the `partnership.php` file and linked it to display the Partnership webpage title with testimonials and link to the webpage, I got default `index.php` to display. I understand that WP will display the `index.php` if it does not find any other file in the structure, but the files are all in the `example.com/wp-content/themes` directory. Im working on localhost. It seems that WP did not recognize the custom template files. Share your thoughts on this please. Many Thanks


WP can't send newsletters

I'm using ALO EasyMail Newsletter plugin in order to send newsletters to subscribers. I have setup settings which is mainly the email address and try to send an email for subscribers but it doesn't send anything. Is there any special configuration for wordpress to do? Thanks


Add whitespace between Chinese and other letters

I want to add a space between a Chinese character and a letter or a number to make the article more readable. For example: > Google与Apple展开的专利大战在2天之前结束。 > > Google 与 Apple 展开的专利大战在 2 天之前结束。 But add the space manually is a hard work. How can I do it automatically? Maybe with CSS?


How to include Related Posts in WP RSS feed not use plugin? I have search around on google and stackexchange but have no result about this. Thanks all friends!


How to hide a post from 'Recent Posts' widget?

I'm trying to hide a post from the 'Recent Posts' widget in the sidebar. I know I can do this with the 'Special Recent Posts' plugin, but that plugin really uses up a lot of resources. I've got the 'WP Hide Post' plugin, but that doesn't hide a post from the recent posts widget. So how do I go about doing this? I don't know any coding, so if you do give me any code, you'd have to tell me where to place it. Thanks ;)


Is it possible to call a template file inside wysiwyg editor? And how?

Is it possible to call a template file, say for example **mycustomtemplate.php** inside the default Wordpress WYSIWYG editor? I had this content. My team (This is my content inside the WYSIWYG) then I would like to call a template file. When your inside a template file you would write                   <?php get_template_part('includes/page-team-list'); ?>       So how could I do this on the WYSIWYG editor? Or I have to use some **PHP plugins** for these php codes to work on WYSIWYG?


Custom Form only for admin

I want to add a custom form with some fields such as text,date,dropdown etc only viewable and editable for admin.When I submit the form the data should be displayed in the desired page that I select.Is there any way to do that. I dont have any idea about how to start with this. Can anyone help me with this?


Looking for a Wordpress photo gallery plugin

I'm hoping someone can help me with this. I have looked all over and can't seem to find what I need. I am looking for a WP plugin that will allow my site users to easily create their own photo galleries, without having to put the photos into a specific blog post first. In other words, they should be able to just create and publish their own photo galleries as desired. I'd like something very user-friendly, that I can customize with specific instructions, etc. I've looked at NextGen and have tested that with some users, but they didn't find it to be very intuitive. (Maybe that's on them, but nevertheless...) Thanks to anyone who can help!


A Wordpress site with more than one domain name / Parked domains

i have one WordPress blog/site and want to point/map more than one domain name hosted/parked on my server. How do i do that *** _without** redirecting by .htaccess?_* Edit Im configure the related setting in cpanel or plesk in parked domain but wordpress dont recognized them. I want to know why cant i confure thet easy as config it for first domain name? And also want to how do that?


Add query string variables to all hyperlinks URL matching a specified domain

This is my case. Supposing in my plugin dB table I have the following stored field name and values:               argument_1= 'test'     argument_2= 'test2'      And I want to add a new string query string variables to all links going out to www.example.com such that it will look like this: If homepage is accessed:               www.example.com/?argument_1=test&argument_2=test2      Or any page like this:               www.example.com/anotherpage/?argument_1=test&argument_2=test2      What Wordpress hooks, actions and filters would I be using to retrieve the arguments and values in the database and append it to a hyperlink URL if it matched the domain, e.g. example.com ? I am thinking of using add query arg but I'm confused a bit on how this function relates to this application. Any tips and advices are highly appreciated..Thanks.


Use ColdFusion to pull in WP.com posts?

Is it possible to pull in Wordpress.com posts into an external site, in this instance, ColdFusion? Is there a REST API for it? If not, is there another solution to pull in content? Thanks!


How to change src link in YouTube?

I want to add `html5=1` in YouTube link. How can I do that? I try something like this:               function add_embed_filter($html, $url, $attr) {     $new = str_replace('oembed', 'oembed&html5=1', $html);      return $new;     }          add_filter( 'embed_oembed_html', 'add_embed_filter', 50, 3 );      but in source it look like this: `?feature=oembed&html5=1` :/


Cookie in custom page template

I need to set a cookie on a custom template (page_splash) so that the splash page only shows on the first visit every 24 hours. I have tried lots of variations of code at the top of my custom template but I can't get the cookie to work. My custom template does not contain a header. Please help and thank you.


Contact Form 7: conditional required fields?

I am trying to use Contact Form 7 with conditional fields and required fields. I am able to create the show/hide content based on a selected dropdown value, but I am stuck when required fields are hidden.   These are my problems:   1. The form doesn't validate (as required fields are hidden but need to be validated)   2. Conditional email text based on select dropdown values Or should I just create 4 different CF7 forms?   And how should I create a dropdown which loads the right CF7 form?


Gzip issue with mailchimp and comment-reply.min javascript files

I am testing my site against GTMetrix and in YSLOW, I have the following warnings:               **Compress components with gzip**     There are 2 plain text components that should be sent compressed         http://www.mydomain.com/wp-content/plugins/mailchimp/js/mailchimp.js?ver=1.4.1         http://www.mydomain.com/wp-includes/js/comment-reply.min.js?ver=3.8.1      This is what I have for Gzip compression in the .htaccess               # GZip compress text, html, javascript, css, xml:     AddOutputFilterByType DEFLATE text/plain     AddOutputFilterByType DEFLATE text/html     AddOutputFilterByType DEFLATE text/xml     AddOutputFilterByType DEFLATE text/css     AddOutputFilterByType DEFLATE application/xml     AddOutputFilterByType DEFLATE application/xhtml+xml     AddOutputFilterByType DEFLATE application/rss+xml     AddOutputFilterByType DEFLATE application/javascript     AddOutputFilterByType DEFLATE application/x-javascript     AddType x-font/otf .otf     AddType x-font/ttf .ttf     AddType x-font/eot .eot     AddType x-font/woff .woff     AddType image/x-icon .ico     AddType image/png .png      In the network panel, here is the Requests Headers:               Accept:*/*     Accept-Encoding:gzip,deflate,sdch     Accept-Language:en-US,en;q=0.8,it;q=0.6     Cache-Control:max-age=0     Connection:keep-alive      If anyone have a solution, thanks in advance.


Shortcode and variable

I need some help, this may be a noob question, I am trying to add a string variable into my short code. Here is what I have so far:               $instagram_title = get_post_meta(get_the_ID(), 'instagram_title', true);     if(isset($instagram_title) && $instagram_title != "") :         echo do_shortcode("[easy-instagram limit=2 caption_hashtags=false caption_char_limit=0 author_text='' thumb_click='thickbox' time_text='' thumb_size=220px tag='" .$instagram_title. "']");     endif;      My ultimate goal is to utilize the "$instagram_title" so that I don't have to create a ton of widgets for each page in the site.


How to redirect non-logged in users to a specific page?

How to redirect non-logged users requesting for a specific page/URL to another page/URL and display a message like "for members only". I know its quite easy to code using !is_user_logged_in() function but i don't know how to code it because i am a newbie to WordPress. Care to tell me the file to put the code also.


Show Custom Post Type taxonomy term that matches custom field

Not sure how well I can explain this but I will try. I have two Custom Post Types. One is "Locations" and one is "Members." I need to show only the members that belong to the location. "Locations" has an Advanced Custom Field of 'city' that would match "Members" taxonomy of 'location.' So, I want to know how I can only show posts if a term matches a field. Here is my WP_Query for "Members" that displays all "Members" separated by 'location' terms:               <?php $loop = new WP_Query( array( 'post_type' => 'member', 'posts_per_page' => -1 ) ); ?>     <?php while ( $loop->have_posts() ) : $loop->the_post(); $do_not_duplicate = $post->ID; ?>         <?php the_post_thumbnail('thumbnail'); ?>

<?php the_title(); ?>

                 <?php                     $term_names = wp_get_post_terms($post->ID, 'location', array ( 'fields' => 'names' ) );                     echo wp_sprintf_l( '%l', $term_names );                 ?>

     <?php endwhile; wp_reset_query(); wp_reset_postdata(); ?>      I also have this:               <?php $city = get_field('city'); ?>      So, what I'm asking is how do get only the posts with taxonomy 'location' term that matches '$city' to display?


How can i add a rewrite rule in wordpress

I want to add following rewrite rule in wordpress .htaccess using add_rewrite_rule() function.               RewriteRule ^admin-panel/(.*) wp-admin/$1?%{QUERY_STRING} [L]      how can i proceed? Thanks advance.


Search wordpress using three different drop down menus

I have three drop down menus that are chained together. Year, Make Model. I need wordpress search results to show their matching results. If I give them all the name="s" then it only searches the final s= in the url. I basically need to know how to make mysite.com/?s=2001&s=Chevrolet&s=Express&Search=Search turn into: mysite.com/?s=2001+Chevrolet+Express&Search=Search or whatever gets the job done. Any suggestions?


Is there any way to add images to the Media Library through a path on the server?

I have 3 folders with images that I want to add to my media library. I do not want to have them uploaded under the default path (i.e. uploads/year/month). I can upload them anywhere in the theme folder. Is there any plugin/method to do that?


Custom domain for sub-section of parent website

While this topic could be considered a general web development item, I'm using WordPress, so I need to find some way to do this within WordPress and without breaking it. I realize this is a deep subject that might apply to other sections of Stack Exchange, but since I'm using WordPress I'll post here. I'm currently representing a larger company who's acquired several smaller brands. We want to setup vanity URLs for print and branding purposes, as not all areas of the US recognize the parent brand (yet), which will take some time to accomplish. Here's the general idea. WordPress is currently our setup with this organization structure:               http://parentcompany.com/     http://parentcompany.com/parentbrand     http://parentcompany.com/secondbrand     http://parentcompany.com/secondbrand/products     http://parentcompany.com/secondbrand/products/some-product     http://parentcompany.com/thirdbrand     http://parentcompany.com/thirdbrand/products     http://parentcompany.com/thirdbrand/products/some-product     http://parentcompany.com/fourthbrand     http://parentcompany.com/fourthbrand/products     http://parentcompany.com/fourthbrand/products/some-product      We would like to purchase and redirect the following domain:               Purchase: secondbrand.com     Simulate: http://secondbrand.com     Simulate: http://secondbrand.com/products     Simulate: http://secondbrand.com/products/some-product        * basically replacing/aliasing "http://parentcompany.com/secondbrand" for a new value. Redirection with 302 or 301 isn't my biggest issue...that's easy. One of the goals/requests from the client (and my higher-up counter parts) is that we have the aliased domain to be the one to rank in the search engines, but for maintenance, they want to maintain a single, larger website. So far I've not been able to make progress in figuring this out, however, I have been given an example of another company doing this online successfully. Check this out...               Google: "storm lures"     Shows:  www.stormlures.com      Go to it, and you'll see it's the exact same content as: http://www.rapala.com/on/demandware.store/Sites-rapala-Site/default/Home- Show?id=4 Somehow, they're doing it to all their products as well (every page on the site for that brand). An SEO professional I'm acquainted with told me this cannot be done without creating a completely separate website for each brand, but they wouldn't rank together as one, cohesive content on the parent website, or that we'd get hit with duplicate content penalties for having the data mirrored on the two websites (from Google's perspective). I think with some method of DNS CNAME + mod_rewrite + meta noindex (on parent), the child brand would somehow be able to fend for itself with its own content, and no duplicate content penalties. As of now, have no idea how to do it on WordPress. Maybe some combination of the "Redirection" plugin with some advanced regex or something.


How to create a 'single' category widget for woocommerce plugin

Woocommerce out of the box provides many widgets, however the category widget for providing a product search, groups ALL the categories into one widget. I want a widget for one category, i.e. 'shop by meaning' and another widget 'shop by letter' etc. I grabbed the widget code for widget-product_categories.php from the woocommerce plugin...thinking I could simple modify the code for the 'size' category I created within the woocommerce plugin. However, I quickly found it's beyond my scope. Since I need to create 4 different widgets with 'shop by xxx' searches, any help would be appreciated. Below is the code from the woo widget that provides ALL the categories in one widget. Is there a way to recode this for a single category return for 'size'?               var $woo_widget_cssclass;     var $woo_widget_description;     var $woo_widget_idbase;     var $woo_widget_name;     var $cat_ancestors;     var $current_cat;          /**      * constructor      *      * @access public      * @return void      */     function WooCommerce_Widget_Product_Categories() {              /* Widget variable settings. */         $this->woo_widget_cssclass = 'widget_product_categories';         $this->woo_widget_description = __( 'A list or dropdown of product categories.', 'woocommerce' );         $this->woo_widget_idbase = 'woocommerce_product_categories';         $this->woo_widget_name = __('WooCommerce Product Categories', 'woocommerce' );              /* Widget settings. */         $widget_ops = array( 'classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description );              /* Create the widget. */         $this->WP_Widget('product_categories', $this->woo_widget_name, $widget_ops);     }               /**      * widget function.      *      * @see WP_Widget      * @access public      * @param array $args      * @param array $instance      * @return void      */     function widget( $args, $instance ) {         extract( $args );              $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Product Categories', 'woocommerce' ) : $instance['title'], $instance, $this->id_base);         $c = $instance['count'] ? '1' : '0';         $h = $instance['hierarchical'] ? true : false;         $s = (isset($instance['show_children_only']) && $instance['show_children_only']) ? '1' : '0';         $d = $instance['dropdown'] ? '1' : '0';         $o = isset($instance['orderby']) ? $instance['orderby'] : 'order';              echo $before_widget;         if ( $title ) echo $before_title . $title . $after_title;              $cat_args = array('show_count' => $c, 'hierarchical' => $h, 'taxonomy' => 'product_cat');              if ( $o == 'order' ) {                  $cat_args['menu_order'] = 'asc';              } else {                  $cat_args['orderby'] = 'title';              }              if ( $d ) {                  // Stuck with this until a fix for http://core.trac.wordpress.org/ticket/13258             woocommerce_product_dropdown_categories( $c, $h, 0 );                  ?>                          <?php              } else {                  global $wp_query, $post, $woocommerce;                  $this->current_cat = false;             $this->cat_ancestors = array();                  if ( is_tax('product_cat') ) :                      $this->current_cat = $wp_query->queried_object;                 $this->cat_ancestors = get_ancestors( $this->current_cat->term_id, 'product_cat' );                  elseif ( is_singular('product') ) :                      $product_category = wp_get_post_terms( $post->ID, 'product_cat' );                      if ($product_category) :                     $this->current_cat = end($product_category);                     $this->cat_ancestors = get_ancestors( $this->current_cat->term_id, 'product_cat' );                 endif;                  endif;                  include_once( $woocommerce->plugin_path() . '/classes/walkers/class-product-cat-list-walker.php' );                  $cat_args['walker']             = new WC_Product_Cat_List_Walker;             $cat_args['title_li']           = '';             $cat_args['show_children_only'] = ( isset( $instance['show_children_only'] ) && $instance['show_children_only'] ) ? 1 : 0;             $cat_args['pad_counts']         = 1;             $cat_args['show_option_none']   = __('No product categories exist.', 'woocommerce');             $cat_args['current_category']   = ( $this->current_cat ) ? $this->current_cat->term_id : '';             $cat_args['current_category_ancestors'] = $this->cat_ancestors;                  echo '
';                  wp_list_categories( apply_filters( 'woocommerce_product_categories_widget_args', $cat_args ) );                  echo '
';              }              echo $after_widget;     }               /**      * update function.      *      * @see WP_Widget->update      * @access public      * @param array $new_instance      * @param array $old_instance      * @return array      */     function update( $new_instance, $old_instance ) {         $instance = $old_instance;         $instance['title'] = strip_tags($new_instance['title']);         $instance['orderby'] = strip_tags($new_instance['orderby']);         $instance['count'] = !empty($new_instance['count']) ? 1 : 0;         $instance['hierarchical'] = !empty($new_instance['hierarchical']) ? true : false;         $instance['dropdown'] = !empty($new_instance['dropdown']) ? 1 : 0;         $instance['show_children_only'] = !empty($new_instance['show_children_only']) ? 1 : 0;              return $instance;     }               /**      * form function.      *      * @see WP_Widget->form      * @access public      * @param array $instance      * @return void      */     function form( $instance ) {         //Defaults         $instance = wp_parse_args( (array) $instance, array( 'title' => '') );         $title = esc_attr( $instance['title'] );         $orderby = isset( $instance['orderby'] ) ? $instance['orderby'] : 'order';         $count = isset($instance['count']) ? (bool) $instance['count'] :false;         $hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false;         $dropdown = isset( $instance['dropdown'] ) ? (bool) $instance['dropdown'] : false;         $show_children_only = isset( $instance['show_children_only'] ) ? (bool) $instance['show_children_only'] : false;      ?> get_field_id('title'); ?>"> get_field_id('title') ); ?>" name="get_field_name('title') ); ?>" type="text" value="" />
<label for="<?php echo $this->get_field_id('orderby'); ?>"><?php _e('Order by:', 'woocommerce') ?>         <select id="<?php echo esc_attr( $this->get_field_id('orderby') ); ?>" name="<?php echo esc_attr( $this->get_field_name('orderby') ); ?>">             <option value="order" <?php selected($orderby, 'order'); ?>><?php _e('Category Order', 'woocommerce'); ?></option>             <option value="name" <?php selected($orderby, 'name'); ?>><?php _e('Name', 'woocommerce'); ?></option>         </select>

<input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id('dropdown') ); ?>" name="<?php echo esc_attr( $this->get_field_name('dropdown') ); ?>"<?php checked( $dropdown ); ?> />         <label for="<?php echo $this->get_field_id('dropdown'); ?>"><?php _e( 'Show as dropdown', 'woocommerce' ); ?>
              <input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id('count') ); ?>" name="<?php echo esc_attr( $this->get_field_name('count') ); ?>"<?php checked( $count ); ?> />         <label for="<?php echo $this->get_field_id('count'); ?>"><?php _e( 'Show post counts', 'woocommerce' ); ?>
              <input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id('hierarchical') ); ?>" name="<?php echo esc_attr( $this->get_field_name('hierarchical') ); ?>"<?php checked( $hierarchical ); ?> />         <label for="<?php echo $this->get_field_id('hierarchical'); ?>"><?php _e( 'Show hierarchy', 'woocommerce' ); ?>
              <input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id('show_children_only') ); ?>" name="<?php echo esc_attr( $this->get_field_name('show_children_only') ); ?>"<?php checked( $show_children_only ); ?> />         <label for="<?php echo $this->get_field_id('show_children_only'); ?>"><?php _e( 'Only show children for the current category', 'woocommerce' ); ?>
      }


Target all posts that are NOT aside or link post formats

I want to add a post title to all of my posts apart from those that are marked as "aside" or "link" post formats. I'm currently using this code to hide the post title for aside posts;               <?php if (! has_post_format('aside')) { ?>              <?php the_title();?>          <?php } ?>      How can I target the "link" post format aswell using this method?


Including Javascript options

For a Wordpress Theme I know javascript files (ending in .js) must be included using wp_enqueue_script in functions.php but how do I include additional javascript code, for example say I need to add this:               jQuery(function($){         jQuery.supersized({             slides:             [                  'http://google.com',                  'http://google.co.uk'             ]         });     });      Where would I put this? Do I put it within `<script>` tags in the header.php? Thanks, Ben


Dave's Wordpress Live Search only works when logged in as admin

I am using Dave's Wordpress Live Search on my site www.frome.fm but it only works when logged in as admin. When logged out or browsing as guest the spinning icon shows for a second or two but then no results are displayed. I've tried disabling plugins to no avail. The wp-admin folder is not protected with .htaccess server side nor do I have relevanssi installed.


Trying to post information from a remote database to wordpress page

I'm fairly new to Wordpress and looking for some help. Goal: I would like to stream data from my personal computer's Mysql database and display it on a webpage in my offsite Wordpress hosted site. ie. an updated inventory as items are sold. I am using windows 7 on my personal computer and have already created a user in my database with the appropriate privileges, I also added "%" to allow the connection from any ip. (I understand the security risks, I am just trying to make connection at this time) I am able to connect to my database as this new user locally, and last but not least I have opened firewall and router ports to get this connection working. My problem is that when I try to connect to my pc from my website ie.               $con = mysql_connect( 'my.ip,xx,xxx', 'user_name', 'password' );     $db =  mysql_select_db( 'database_name' ) or die("cannot connect php3");      I get the cannot connect error displayed on my page. I should also mention that I am using a plugin called "Allow PHP in posts" which I use for my code. I have searched the internet to find solutions with no success. I'm guessing there is something special about doing this with wordpress because nothing seems to be working. Any help would be GREATLY appreciated. If it would be easier to Skype me let me know and we can talk. Thanks


What is the correct MIME type for PSD (Photoshop)

I am trying to create an upload area (frontend) for word press users on a site. I've got a lot of types opened up through some function calls, but unable to correctly get PSD support. I'm seeing a lot of different types, and to my knowledge have tried all. I'm not sure if my hosting environment makes any difference. Am on Hostgator VPS. Anyone successfully gotten WP to upload PSDs?


Animated gif for a thumbs

I need to insert an animated gif for a feature image but I don't understand if is possible. Right now when I try to upload a gif, wordpress create automatically a gif single frame. Is it possible to do this and what part of code I have to modify? Thank you so much in advance!


Export SQL query based on custom field?

I'm operating on two WordPress sites and I need to export posts only with a specific custom field from one site and import into the other. I can't do a generic dump of the database because some data would be overridden. My SQL query: > SELECT * FROM wp_posts INNER JOIN wp_postmeta ON wp_postmeta.post_ID = > wp_posts.ID WHERE ( wp_postmeta.meta_key = 'Color' AND > wp_postmeta.meta_value IS NOT NULL ); Now I can export that into a .xml or .csv but I can't import that into the other site. This is because the meta columns are appended to the row of the wp_posts. (Screenshot: http://screencast.com/t/bjogBFYyoL) Is there a work-around?


Manipulating menu HTML

My site's menu uses the built-in menu under Appearance >> Menus. I want to make a very simple change: I want to wrap each of my menu's second-level ULs in a DIV. What's the simplest way to accomplish this?


Add size in Gallery Settings in Media Library

I would like to add the size in the Gallery Settings in the Add Media. I know to add the in the front-end by editing the media.php. However, when I added the the lines in gallery.dev.js, they don't seem to work. Here are the lines I had added in gallery.dev.js Added size                setup : function()           var t = this, a, ed = t.editor, g, columns,size, link, order, orderby; Added galsize in the same setup : function (approx line 128)                if ( getUserSetting('galsize') ) t.I('size').value = getUserSetting('galsize'); Added in setup : function (approx line 141)                size = a.match(/order='"['"]/i); Added in setup : function (approx line 150 )                if ( size && size[1] ) t.I('size').value = size[1]; Added size in update : function (approx line 170)                  all = all.replace(/\s*(order|link|columns|size|orderby)=['"]([^'"]+)['"]/gi, ''); Added in getsettings : function                   if ( I('size').value != 'medium' ) {                 s += ' size="'+I('size').value+'"';                 setUserSetting('galsize', I('size').value);             }


View Achive with Category Filter, but Page per post not working

WordPress Version: 3.3.2 Assumption, My post in category 7 have 9 posts during October 2012. by accessing > www.example.com/2012/10/?cat=7 I am able to view all in one page. No issue, however, I create custom page `category-7.php` in theme folder.               //listed category per page = 6     $query = 'posts_per_page=6&cat=7';     $year = get_query_var('year');     if($year > 0)     {         //build query string         $query .= '&year='.$year;     }     $month = get_query_var('monthnum');     if($month > 0)     {         $query .= '&monthnum='.$month;     }     $paged = get_query_var('paged');     if($paged > 0)     {         $query .= '&paged='.$paged;     }     query_posts($query);      Now I access again > www.example.com/2012/10/?cat=7 The bottom got Next Page option, but when I click it to > www.example.com/2012/10/page/2/?cat=7 I got **_"404 - Page not found!"_** The only solution I can do is go to WP-Admin, **Reading Settings** change the **"Blog pages show at most"** variable to 6, then I got the correct output. However, as I research in the wordpress page, by added `query_posts` parameter, it should be work correctly. Please advise. Thanks!


Limit number of posts in wp loop

I am using this code to get posts of specific taxonomy. It displays 10 posts by default. How can I set my own limit?               <?php          $count = 1;          $the_query = new WP_Query( array( 'brand' => 'sony-vaio' ) );         while ($the_query->have_posts()) : $the_query->the_post();         ?>


Need to add class="lightbox" for every single post image

I got a theme that has lightbox built in, but only for galleries and featured images, not single images. It just needs to have class="lightbox" added to the images source. I'd like a simple function that will include this automatically. Not sure why the author left this out.


How to display a custom post type's media library inline on meta box

I am trying to create a post type which only displays the Media Library Inline. I have got the example from this : https://gist.github.com/897503 However, nothing happens when I click "Insert Gallery". The code is as below. Thanks in advanced!               add_action( 'init', 'create_post_type_gallery' );     function create_post_type_gallery() {      $args = array(       'labels' => post_type_labels( 'Gallery', 'Galleries' ),       'public' => true,       'publicly_queryable' => true,       'register_meta_box_cb' => 'my_gallery_meta_box',       'show_ui' => true,        'show_in_menu' => true,        'query_var' => true,       'rewrite' => true,       'capability_type' => 'post',       'has_archive' => false,        'hierarchical' => false,       'menu_position' => null,       'supports' => array('title','editor' )     );           register_post_type( 'gallery', $args );     }          function my_gallery_meta_box () {       add_meta_box('gallery_details' , 'Media Library',     'my_gallery_meta_box_details', 'gallery', 'normal', 'high' );     }          function my_gallery_meta_box_details () {       global $post;       $post_ID = $post->ID; // global used by get_upload_iframe_src       printf( "<iframe frameborder='0' src=' %s ' style='width: 100%%; height: 500px;'>   </iframe>", get_upload_iframe_src('media') );     }


Accessing /page/2 on WordPress directly breaks infinite-scroll

I added infinite-scroll.js library to Wordpress (manually, not via plugin). On index i have wrote a loop to make the pagination and everything works fine, however then i'm accessing URL/page/2 directly not from index i see that it is broken. Any ideas how to avoid this? Maybe doing some redirect to index when accessing page/x/ or any other way? Or maybe it is possible to preload everything from index (page1) and continue loading on page/2? Also tried if is_paged -> when redirect to index on index.php template file. This method works, but of course infinite-scroll doesn't load any new items. Thanks


How to remove the tripadvisor logo from the wordpress theme?

Tripadvisor offers a free wordpress theme at here If you go on this page, you'll see the free wordpress theme, and on the navigation bar, there is the trip advisor logo on the right, How can I remove this logo because i have many menu items?? By the way can i remove it not specified nothing as rules and regulation??


define multiple post thumbnails

i'm building a page for catalogs which shows all subpages in a grid with their selected post thumbnail. That works without a problem. Now I need a solution how to define 2 more pictures as a special picture. Above a catalog I wan't to display a logo which is linked to an external page. This logo should use a hover effect. So I need to define two more pictures in an article. One hover state picture and one normal state picture. I need to know how I should do this. Should I use a custom post type? If yes, how can i display a "image selector". Is there another way to "define" images for a special task and trigger this task later? Thanks


wp_insert_post not working

I'm using WP 3.8.3 + Yoast for SEO + custom fields. Trying to do `wp_insert_post` due to post migration using the               $my_post = array(       'post_title'    => $post_tit ,       'post_content'  => $link,       'post_status'   => 'publish',       'post_author'   => 1       ...     )      I get post inserted. Additionally I use custom fields, that are updated after insert `update_field( "body_text", $text, $post_id );` All information is saved, status is good looking from WP part, however the posts are not presented correctly in the page. To fix this showing issue I have to go into a post and do update (without changing anything). Such update fixes the problem, however with a higher number of posts it is not an option. To solve this problem I tried putting in the code `wp_update_post(post_id)`, however it did not help. What fixes would you suggest?


Limit image upload

I'm trying to limit the amount of files a user can upload through the wp gallery, and i've found the following filter from this link Limit image upload to one and disable audio, video and other document file types to upload               add_filter('wp_handle_upload_prefilter', 'yoursite_wp_handle_upload_prefilter');     function yoursite_wp_handle_upload_prefilter($file) {       list($category,$type) = explode('/',$file['type']);       if ('image'!=$category || !in_array($type,array('jpg','jpeg','gif','png'))) {         $file['error'] = "Sorry, you can only upload a .GIF, a .JPG, or a .PNG image file.";       } else if ($post_id = (isset($_REQUEST['post_id']) ? $_REQUEST['post_id'] : false)) {         if (count(get_posts("post_type=attachment&post_parent={$post_id}"))>0)           $file['error'] = "Sorry, you cannot upload more than one (1) image.";       }       return $file;     }      However this filter works only on the current post, what i'm trying to achieve is to limit the upload only on that instance when the user opens the uploader, is it possible ? The reason for this is that i'm using the advancedcustomfields plugin to post from the frontend and with that code the uploader thinks the user is trying to upload on the same post/page which but he's not. Thank you.


wordpress plugin is not activating from widget

I am just creating a plugin in wordpress. In this plugin I am trying to create a widget, In that widget it will show a title, input text and text area in the widget section and when the values will be entered it will show to the site frontend. For that my code is like this               <?php     /*     Plugin Name: WP Simple Plugin     Plugin URI: http://www.wordpress.org     Description: A Plugin to show simple text in widget     Version: 0.1     Author:      */          class wp_my_plugin extends WP_Widget {     // constructor         function wp_my_plugin() {             parent::WP_Widget(false, $name = __('My Widget', 'wp_widget_plugin') );         }             function form($instance) {         if($instance) {           $title = esc_attr($instance['title']);           $text = esc_attr($instance['text']);           $textarea = esc_attr($instance['textarea']);         } else {           $title = '';           $text = '';           $textarea = '';         }         ?>
           <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title', 'wp_widget_plugin'); ?>           <input class="widefat" type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title');?>" value="<?php echo $title; ?>"/>

           <label for="<?php echo $this->get_field_id('text')?>"><?php _e('Text', 'wp_widget_plugin');?>           <input type="text" class="widefat" name="<?php echo $this->get_field_name('text');?>" id="<?php echo get_field_id('text');?>" value="<?php echo $text; ?>" />

           <label for="<?php echo $this->get_field_id('textarea');?>"><?php _e('Textarea','wp_widget_plugin'); ?>           <textarea name="<?php echo $this->get_field_name('textarea'); ?>" id="<?php echo $this->get_field_id('textarea'); ?>" class="widefat"  /><?php echo $textarea; ?></textarea>
            <?php       }            function update($new_instance, $old_instance) {         $instance = $old_instance;         //Fields         $instance['title'] = strip_tags($new_instance['title']);         $instance['text'] = strip_tags($new_instance['text']);         $instance['textarea'] = strip_tags($new_instance['textarea']);         return $instance;         /* */       }            function widget($args, $instance) {         extract ($args);         //The widget Options         $title = apply_filters('widget_title' , $instance['title']);         $text = $instance['text'];         $textarea = $instance['textarea'];         echo $before_widget;         //Display Widget         echo '
';              //Check If Title Is Set         if($title) {           echo $before_title.$title.$after_title;         }              //check if text is set         if($text) {           echo '
'.$text.'
';         }              //check if texrarea is set         if($textarea) {           echo '
'.$textarea.'
';         }         echo '
';         echo $after_widget;       }     }          // register widget     add_action('widgets_init', 'wp_my_plugin');          ?>      But when I am trying activate the plugin from dashboard it is showing error like               Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'wp_my_plugin' not found or invalid function name in /wordpress/wp-includes/plugin.php on line 406       and the plugin is not activating So can someone kindly tell me how to solve this. Any help will be really appreciable. Thanks


How can I add @anywhere to my blog?

I would really like to add @anywhere support to my blog, as my posts usually mention two or three Twitter users. I'm not much of a code monkey though, and so I'm looking for something that adds @anywhere without me having to do too much configuration. Is there a plugin available where I can add @anywhere and configure it through the WordPress administration panel?


wp_nav_menu and its fallback

When I use               wp_nav_menu(array(         'theme_location' => 'mainnav',         'container' => 'nav',         'container_id' => 'mainnav',         'container_class' => 'clearfix',         'depth' => 4     ));       If the user hasn't set a nav menu under Appearance menu, I notice theres a fallback like

Sample Page

      How can I have the fallback use whats specified in `wp_nav_menu`? How can I check if theres a menu to display then display it, else show nothing?


Show nav link highlighted

OK so i have a main menu and a sub-menu How can i make a menu item active when viewing a single post. The sub-menu uses taxonomies so i know i need to make the taxonomy active when one of the posts has the taxonomy in use


Extend the wp_get_archives output with '?post_type=foo'?

I've gotten my custom post types to display as it should in date based archives; the structure example.com/year/month/day (and above) works properly as long as it's extended with '?post_type=post_type_name'. With Bainternets solution I've also gotten wp_get_archives to properly list archives based on whether or not they contain my CPT. The problem is that wp_get_archives still returns the default archive permalinks, like this: > example.com/year/month/day but as I mentioned earlier, I need: > example.com/year/month/day?post_type=post_type_name Any suggestions on how to achieve this?


ignore_sticky_posts in WordPress 3.0.3?

I am using WP 3.0.3 and I would like to exclude sticky posts from my query: This doesn't seem to work:               <?php query_posts( 'posts_per_page=9&cat=-1,-2&ignore_sticky_posts=1' );?>      To get JUST the sticky post I use the following:               $sticky = get_option('sticky_posts');     $args = array(         'posts_per_page' => 1,         'post__in'  => $sticky     );     query_posts($args);


get values from contact form 7 wp plugin

I am using contact form 7 plugin in my blog.I am having donate option in the form with price option in radio button. user can select and submit.After submitting the form it should redirect to the paypal. with selected price . i tried > on_sent_ok: "location = 'https://www.sandbox.paypal.com/us/cgi- > bin/webscr?cmd=_xclick&business=xxxx@india.com&currency_code=USD&amount=100&return=http://http://cratecreative.com/norpac&item_name=contribution';" in additional option in form management. But here value of price is static . I need to change that value what user selects. Thanks in advance


Create a page for a theme only

I am in the process of creating a wordpress mobile theme for one of my wpmu networks. I have created 2 + pages that show our other sites and a custom login form. Right now i have labeled them page-other-sites.php and page- login.php and created 2 pages in the backend. When you click on the link it loads the page-(slugs).php Now instead of having to create a page every time is there a way to have my themes function.php file create a set of default pages.?


wordpress site validation errors

when I made my wordpress site validate I got some strange errors like               Error Line 6, Column 52: Bad value profile for attribute rel on element link: Keyword profile is not registered.          Error Line 12, Column 128: Bad value EditURI for attribute rel on element link: Keyword edituri is not registered.          Line 14, Column 91: Bad value index for attribute rel on element link: Keyword index is not registered.          Line 89, Column 208: Bad value category for attribute rel on element a: Keyword category is not registered.          Line 111, Column 208: Bad value category for attribute rel on element a: Keyword category is not registered.      I searched over Google but not found any solutions. Can any one help me out?


Get the term id belonging to custom taxonomy on a custom single-post-type.php template page

I have custom post-type 'sermon' with custom taxonomy 'speaker' attached to it. I wanted to assign custom meta values to the speaker taxonomy, so I am using the taxonomy meta class from Rilwis: http://www.deluxeblogtips.com/p/taxonomy-meta-script-for-wordpress.html I have used the class to add a metabox with the id of 'bio'. According to his directions, I need to use the following code in order to output the value of the 'bio' meta into my template:               $meta = get_option('meta_id');     if (empty($meta)) $meta = array();     if (!is_array($meta)) $meta = (array) $meta;          $meta = isset($meta['term_id']) ? $meta['term_id'] : array();          $value = $meta['field_id'];          echo $value; // if you want to show      **Here is what ended up working for me:**               $taxmeta = get_option('speaker_meta');     if (empty($taxmeta)) $taxmeta = array();     if (!is_array($taxmeta)) $taxmeta = (array) $meta;          $taxmeta = isset($taxmeta['221']) ? $taxmeta['221'] : array();          $value = $taxmeta['bio'];          echo $value; // if you want to show      **Question** In the above code you see the number '221'. That is the actual term-id of the taxonomy assigned to the post in question (hardcoded to test it out). What I don't understand is how to populate the term_id dynamically. I can't query the url because this is simply being used on a custom post-type single page, so the term-id is not available there. How would I modify that snippet to put in the proper term-id belonging to the 'sermon' that I am looking at? thanks **edit** This function does return the proper term_id for me:               $terms = wp_get_post_terms($post->ID, "speaker");     foreach ($terms as $termid) {       echo $termid->term_id;     }       Using that snippet within my loop on my example page returns the value of '221'. If I manually put 221 in place of term_id in the function then it does pull the term meta 'bio' just perfectly. **Where I am still stuck** Now that I have that little snippet above which works, how do I get that to output to the term_id so the primary function will work?               $meta = isset($meta['term_id']) ? $meta['term_id'] : array();      thanks again


APC 500 Internal server error

I have a blog running on a FreeBSD 8.1 system with PHP 5.3.5 and APC 3.1.6. At first everything seemes fine, but after a while (about 18-24 hours) all pages are served blank, and with a status code of 500. There is nothing in either the vhost, or the global Apache error logs, and PHP doesn't log anything either. The requests are only logged in the access log, with a 500 code. All the other vhosts on the server run fine while the blog is down. An Apache restart fixes the problem. PHP error logging is enabled (the deprecated functions are logged) while the site is working. Disabling APC for this vhost solved the issue, but that is not a long term solution, because the CPU load is roughly doubled this way. Is this a WP issue, or an APC bug? **EDIT** Forgot to add WP version, it is version 3.1.3


Grab 5 latest posts from custom post type 'announcements'

I have a custom post type `announcements` which obviously holds posts with weekly announcements. In my theme's header, I want to create a box which has the following semantics:

Announcements

Title

Title

Title

Title

Title

View More

      I know I want to use `wp_query()` and I've found that I should do something similar to `ann-query = wp_query('post_type=announcements&posts_per_page=5');` I know I need to do a foreach, but I haven't dived deep enough into wordpress to know what to do after the query. Any help? Thanks!


Featured image/thumbnail fallback placeholder image

I'm currently using the_post_thumbnail(); to display featured images in my pages. Is it possible to set a fallback placeholder image in the event a featured image hasn't been set?


How can I fix the Insert/Edit link button in the Visual Editor in WordPress 3.9.1

I recently upgraded to WordPress 3.9.1 and now the "Insert/Edit" link button in the visual editor does not work when adding or editing a post. There is no error in the javascript console and nothing actually happens when the button is pushed. I have downgraded the site a version and still it does not work. Does anyone have any ideas of what it can be?


How do I echo the post type?

`<?php $post_type = get_post_type( $post->ID ); if $post_type == 'project' : echo 'Work'; ?>` How can I make the above work? I want it so that if the post type is 'projects', then it echoes 'Work'. Also, I want to add another `if post type is 'movies' then it echoes 'Film'` on top of that.


Which function(s) to build a paged HTML table

are there built-in functions to build a modern HTML grid (as in grid control, not css grid layout) in WordPress? for example, one that is page-able and sortable.


WooCommerce shop page to use my custom template

Before asking the question I want to tell you that I have already asked the question in http://stackoverflow.com/questions/15025213/wordpress-woocommerce- template-file-overiding I am using the WooCommerce plugin to develop a website. Everything is fine with WooCommerce. As per my requirement, I have configured my home page as a shop base page from the WooCommerce dashboard to make my home page the shop page. Now my requirement is to place some images which should be uploaded from the admin side and to show some text over the images. For that feature, I searched over Google and some people suggested that I use WordPress Advanced Custom Fields. I just installed it. Now I saw that WooCommerce is not using my custom theme. It is using its own custom theme. Since I want to show images and text using the Advanced Custom Fields plugin, I really need my own custom template to use the queries for images and text. Then I again searched over the Google for a solution and I got the suggestion to just make a copy of the theme's `page.php` into `woocommerce.php` and then just replace the code:                    <?php while ( have_posts() ) : the_post(); ?>                <?php get_template_part( 'content', 'page' ); ?>                <?php comments_template( '', true ); ?>              <?php endwhile; // end of the loop. ?>      with               <?php woocommerce_content(); ?>      I did that but still I am not getting my custom fields from Advanced Custom Fields. So kindly help me. Any suggestions and help will be appreciable. Thanks. My code to show the Advanced Custom Fields for image and text is like this:               <?php $product_tab_banner = get_field('product_tab_banner');         if($product_tab_banner): ?>        <?php var_dump($product_tab_banner); ?>
         <img src="<?php echo $product_tab_banner['url']; ?>" alt="<?php echo $product_tab_banner['alt']; ?>"  width="<?php echo $product_tab_banner['sizes']['featured_product-width'];?>" height="<?php echo $product_tab_banner['sizes']['featured_product-height'];?>" title="<?php echo $product_tab_banner['title']; ?>" />
       <?php endif; ?>      I am using the WordPress TwentyEleven theme.


Including a custom post type in the Archives widget

I have a custom post type called "videos" that I want to include in the Archives widget (stock widget in the TwentyTwelve theme). It DOES already appear on the archives page, but just not in the widget. I already have               add_action( 'pre_get_posts', 'add_my_post_types_to_query' );     function add_my_post_types_to_query( $query ) {     if ( $query->is_main_query() )         $query->set( 'post_type', array( 'post', 'videos' ) );     return $query;     }      in functions.php - can I modify the IF statement to be something like "if main query OR archive widget query"? How can I do this?


Can't seem to get [shortcode]s to work

function register_shortcodes(){         add_shortcode( 'my_shortcode', 'my_shortcode' );         }     add_action( 'init', 'register_shortcodes');      function my_shortcode( $atts ) {         return "--my_shortcode--";         }      Adding this code to a plugin I've been making (specifically for this) doesn't do anything. I don't think the function `my_shortcode( $atts )` is even called. I've tried putting "`[my_shortcode]`" in posts, comments, template(s).php. `return "--my_shortcode--";` never executes. I've also put the above piece of code in `functions.php` which gives me error               Fatal error: Call to undefined function add_shortcode() in C:\localhost\~\wp-includes\functions.php on line 17      line 17 : `add_shortcode( 'my_shortcode', 'my_shortcode' );`


query posts in wordpress

I want to filter my query results just before the_loop starts in word press. I only want the results having term_id or term_taxonomy_id equal to 1.               query_posts('post_type=my_post&term_id=1&posts_per_page=6');      This is returning all rows, I am new to word press so I am not sure that we can use term_id in query_posts. Is there any other way to do it?


Strip Image Classes from HTML Output

Does anyone know how to remove all of this from the image HTML?               class="aligncenter size-full wp-image-31053"


Specific php document for a page

I'm Doing a site with some content that can be updated by Wordpress, but, It would be a lot times if I could write a php document for one page and other php document for another page, Like front-page.php. Is it somehow possible? Thanks a lot in advance.


Password Protect Custom Page

I try to password protect my custom page such that before any content is shown the user must enter a password. More specific, in my code below, anything inside the content-div-container should be password protected:               <?php     /*     Template Name: custom_page     */     ?>          <?php get_header(); ?>

LATEST POSTS
      <?php         $args = array('category' => 5, 'post_type' =>  'post');         $postslist = get_posts( $args );             foreach ($postslist as $post) :  setup_postdata($post);          ?>          <li id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
          <?php the_excerpt(); ?>
         <?php endforeach; ?>

     <?php get_sidebar(); ?>     <?php get_footer(); ?>      I tried to use the approach explained here Password protecting a page but cannot make it work, since I do not know how to wrap my php code into the suggested solution.


Modifying and Displaying URL's in a Post Template using parse_url

I have a Custom Post Type with a template named `single-posttype.php`. I'm using the Advanced Custom Fields plugin to display certain information (price and links to the actual product). All that is working good. However, I want to take the links that I input in the Custom Fields and modify them to remove any query strings and append my affiliate code. I have a function that uses `parse_url()` and works fine for my purposes. The problem is it's not showing the string when I try to display it in other parts of the page. Here's the full code of my template: http://pastebin.com/SrWrQ15L Here's the function in question and how I call it:                       $theme_link_raw = get_field('theme_link');             $preview_link_raw = get_field('theme_preview_link');             $author_link_raw = get_field('author_link');                  $theme_parts = parse_url("$theme_link_raw");             $preview_parts = parse_url("$preview_link_raw");             $author_parts = parse_url("$author_link_raw");                  $theme_link = $theme_parts['scheme'] . "://" . $theme_parts['host'] . $theme_parts['path'];             $preview_link = $preview_parts['scheme'] . "://" . $preview_parts['host'] . $preview_parts['path'];             $author_link = $author_parts['scheme'] . "://" . $author_parts['host'] . $author_parts['path'];                  function affiliatize($link, $parts) {                    switch ($parts['host']) {                 case "themeforest.net":                   echo $link . "?ref=gorrillamcd";                   break;                 case "www.elegantthemes.com":                   echo "http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=22953" . "&" . $link;                   break;                 case "themefuse.com":                   echo $link . "?r=42892";                   break;                 default:                   echo $link;                   break;               }             }                       $theme_affiliate = affiliatize($theme_link_raw, $theme_parts);             $theme_affiliate_preview = affiliatize($preview_link_raw, $preview_parts);             $theme_author = affiliatize($author_link_raw, $author_parts);      I know it's probably not perfect, but I'm not very familiar with PHP (I'm a ruby guy myself), so I'm thinking there is a simple problem I'm not seeing. **Notice also this is a temporary hack. I plan to make it into a plugin, but that will take more time and learning and I'd like to go ahead and get it working now.**


How do I reference the front page's parent Page object?

I have created a "News" Page and have switched my posts-page to that Page. Now Posts show up under that Page, as desired. The problem is I'm trying to access the core Page to pull out some information. On any other Page I could look to `$post` but in this setup, with blog posts being present, that variable is otherwise taken. How do I reference the underlying Page object?


Force RTL styles in admin panel

I wanted to have a multi-language site. I installed qTranslate plugin.   It messed my admin panel even after deactivating qtranslate admin panel shows up in ltr. The admin language is unchanged though, it's Persian. So I dug into problem and I found this stylesheet link in admin pages:               <link rel="stylesheet" href="http://www.example.com/wp-admin/load-styles.php?c=1&dir=ltr&load=admin-bar,wp-admin,buttons&ver=3.5.1" type="text/css" media="all">      As you can see the dir variable is ltr but it should be rtl. I edited the load-styles.php like this:               $rtl = 1; //( isset($_GET['dir']) && 'rtl' == $_GET['dir'] )      It solved the problem. But it's a hack not a fix. So I want to know is there a way to use rtl styles without this kind of hacking.   The odd thing is that I can't reproduce this problem with my local wp install.


Adding comments to my custom theme

I would like to add comments to my single.php file. My custom theme is "hand built" and I haven't found the proper code needed to add this functionality. Anyone have the quick and dirty on how to add such a thing?


Reference product SKU on WooCommerce confirmation page

Good morning/afternoon Stackexchange! Today I've got what is more of a PHP than a WordPress question. A client of mine is working with eBay's enterprise program and they sent along a "pixel test" full of pretty ancient (non-functional) code. I've modified it to output the result that they are looking for with one exception: the code is grabbing the Product ID number instead of the SKU. We'll start with the current code: http://pastebin.com/zNeUH8a9 After line 36, the way I figure things, I need to instantiate a new WC_Product class ($productmeta) using the ID passed from the conditional on line 28. I would then do a foreach loop ($productmeta as $product) in order to gain access to $product->sku and assign it to $sku. I'm assuming I'll need to declare $sku as a global variable so that it can be accessed by the output in the next line. Oh great oracle of wisdom... is there a faster way to access the SKU without instantiating the product class? Note - this code goes inside of the order test conditional on thankyou.php in WooCommerce The solution was simple, in the end. After grabbing the item ID, I had to query the product class:               $productmeta = new WC_Product($id);     $sku = $productmeta->post->sku;      Then insert $sku instead of $id on the output. It took me about 30min to figure that out. Perhaps it'll be useful to someone else in the future.


Redirection error after posting a comment on a custom type post

I have created a custom post type called portfolio so the permalink structure for this type of posts is like this: mydomain.com/portfolio/post-name/ My issue is that after posting a comment on one of these posts i am redirected to mydomain.com//post-name#comment-id (notice how the word "portfolio" is missing) which causes a redirection loop error. I dont know whats the reason and i dont understand why is this happening. I double checked my permlink structure and is set as mydomain.com/sample-post/ (post name) and I havent made any changes to the htaccess or whatsoever so what could be happening? Please help. EDIT: This is my custom post type code               function my_post_type_portfolio() {         register_post_type( 'portfolio',                     array(                               'label' => __('portfolio'),                      'singular_label' => __('portfolio', 'theme1418'),                     '_builtin' => false,                     'public' => true,                      'show_ui' => true,                     'show_in_nav_menus' => true,                     'hierarchical' => true,                     'capability_type' => 'page',                     'menu_icon' => get_template_directory_uri() . '/includes/images/icon_portfolio.png',                     'rewrite' => array(                         'slug' => 'portfolio',                         'with_front' => FALSE,                     ),                     'supports' => array(                             'title',                             'editor',                             'thumbnail',                             'excerpt',                             'custom-fields',                             'comments')                         )                      );                  register_taxonomy('portfolio_category', 'portfolio', array('hierarchical' => true, 'label' => 'portfolio', 'singular_name' => 'portfolio', "rewrite" => false, "query_var" => true));     }          add_action('init', 'my_post_type_portfolio');


Ajax +wordpress onClick link redirect to new page and create html content

i have two pages in my wordpress plugin   * index.php   * charts.php in index.php i have some content and some link..                Trend      while clicking this link ,i have an ajax function to create content in charts.php(i dont know if it is correct way)               function show_trend() {      var data ="action=render_admin_charts_page";        jQuery.ajax({                         type: "POST",                         url: "../wp-admin/admin-ajax.php",                         data: data,                         dataType: 'json',                         success: function(data) {                                alert(data);                          //here i want to create html content                              }                     });          }      andfollowing is my php function and hook               function render_admin_charts_page() {         ?>

         <?php          die();     }     add_action( 'wp_ajax_render_admin_charts_page', 'render_admin_charts_page' );      now i am getting 0 as alert .


How do i validate data entered in a meta box so that only floats can be entered in a field?

We have a custom post type in our plugin and now i must provide the user a meta box where he enters latitude and longitude. I want them to be floats, i have no problems in doing the validation client side, but i don't know how i should handle server side validation in wordpress. I thought that there was some API for doing this, but this is not the case, so i was just wandering how should i handle things inside my save function.


How to get the result of comments_number() as a string instead of printing it out?

`comments_number()` is quite useful: It takes the result of `get_comments_number()` and prepares the output with some localization magic. Unfortunately, it prints the result out when it is done, it doesn’t offer an option to just _return_ the string. How can I get the string without printing it? I want to use it as a variable value.


Proper method to restrict non logged users into certain pages

I was wondering which is the correct method to do this and which action hook should i use. I have custom login/register pages so if the user try to go to a forbidden page and its not logged in i will redirect him to a login page. Currently on my functions.php i got the following:               /*     *   Restrict non logged users to certain pages     */          add_action('template_redirect','my_non_logged_redirect');     function my_non_logged_redirect()     {          if ((is_page('mi-perfil') || is_page('agregar-empresa')) && !is_user_logged_in() )         {             wp_redirect( home_url() );             die();         }     }         Im using the right method/hook or should i use another one or a easier one?


Any dummy content I can use for development?

I tried using http://wordpress.org/extend/plugins/wp-dummy-content/ but when I try using it, I get something like > An error occurred: Field 'to_ping' doesn't have a default valueAn error > occurred: Field 'to_ping' doesn't have a default valueAn error occurred: > Field 'to_ping' doesn't have a default valueAn error occurred: Field > 'to_ping' doesn't have a default valueAn error occurred: Field 'to_ping' > doesn't have a default value Is it the plugin or is it my WordPress (which is new? 3.0.5 just downloaded) Perhaps there are other Dummy content available


Create "static" textareas controlled from admin section, how?

I'm putting to getter a landing page theme in WP. On the start page of the theme there should be three different boxes of text, where I can describe the product. The thing is that this boxes should be static and not be included in a blog role. So the most common scenario is that I only add the text once to this three different boxes. Maybe you think now:   * Why don't you just hard code the information in a templete file and add this as the standard showing up when surfing to the site? And thats a good question, but I wan't to make it more fancy, being able to add OR edit the information in this three boxes from the admin section. So I thought this could be easily made by "Custom post types". But with this it is just posts/pages under another name, like Movies. And you can add a lot of different movies. I'm looking for a clean page with three different textareas which control the three different boxes of text on my start page, all done from the admin area. With the ability to edit the text from the same view in the admin section. How can I accomplish this? / Fredrik


add_action insert html

I know I am missing something simple. I am trying to use html to log to footer to learn wp. In theme functions.php:               function myLog() {         echo 'test';         }      In theme footer within the .siteInfo div:               <?php add_action( 'wpmu_new_blog', 'myLog' );?>      when a new user creates a new site myLog should output html 'test'? Please help, save me many more hours of reading and trials.


output specific location in the header

Is there a way in which I can output some code in the header and choose it's location? some where like wp function add_admin_menu (where you can choose the placement).


Passing .pem and .key files in cURL doesn't work in WordPress

I'm building a payment gateway plugin for _woocommerce_ which requires sending an XML request via `cURL`, encrypted with private key. I'm using the following code:               $xml_request    ='<?xml version="1.0" encoding="utf-8"?>';          $test_URL       = 'https://my-gateway.com';     // Here is where I change the file paths     $certfile       = '/clientcert.pem';     $keyfile        = '/clientkey.key';          $ch = curl_init();          curl_setopt( $ch, CURLOPT_URL, $test_URL );     curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );      curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);     curl_setopt( $ch, CURLOPT_SSLCERT, getcwd() . $certfile );     curl_setopt( $ch, CURLOPT_SSLKEY, getcwd() . $keyfile );     curl_setopt( $ch, CURLOPT_POST, 1 );     curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: text/xml' ) );     curl_setopt( $ch, CURLOPT_POSTFIELDS, $xml_request );     $ch_result = curl_exec( $ch );               // Check for errors     if ( curl_errno($ch) ) {         $ch_result = 'cURL ERROR -> ' . curl_errno($ch) . ': ' . curl_error($ch);     } else {         $returnCode = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);         switch($returnCode){             case 200:                 break;             default:                 $ch_result = 'HTTP ERROR -> ' . $returnCode;                 break;         }     }          curl_close( $ch );          echo $ch_result;      The problem is that `curl` can't find the certificate or key files no matter what path I use - I've tried absolute, and relative paths.   I've changed the `.pem` and `.key` file locations (tried theme directory, plugin directory, and root).   I've changed permissions to full. But still I get the error   `58: unable to use client certificate (no key found or wrong pass phrase?)` Which means the file is not found or corrupt, while I'm sure it isn't, since **when I copy this code to a php file outside WordPress and run it, it works**. I can overcome this issue by redirecting the user to a page outside WordPress, but I'd prefer to run it all from one place.   How can this be done?


How to enable custom fields for pages (if not a bad practice)?

My main page has a intro image beside the main content. I would like to add that image using custom fields. I've noticed that pages don't have. I would like to enable them. Is it a bad practice?


Session is not starting

I've read the usage of `session()` in WordPress from here and here. And I placed the following code into the very starting of my `functions.php`:               /**     *   ENABLING SESSION TO THE SITE     *   Thanks: Shazzad     *   Source: http://stackoverflow.com/a/16119876/1743124     */          function register_session() {              if ( ! session_id() ) {             session_start();         }     }          add_action( 'init', 'register_session' );      But I can't work with session because that code is failing to start the session. Finally I placed only               session_start();      at the very beginning of my `functions.php` and it's working fine. I'm using WP 3.9.1. Is there can be anything wrong, if I proceed with my project running the session start barely at the very beginning?


A way to change image urls in post to cdn image url?

due to some reason my hosting company isn't able to fix if i use w3 total cache or w3 super cache for caching my site's sql usage keeps on peaking.... and on high spikes servers gets laggy and down sometimes. For that i have to use hyper cache plugin for cache as it works perfect, but this plugin doesn't support cdn .. i have bought a cdn service from maxcdn but for that i wud have to use w3 total cache or super cache... So i am looking for a way to automatically change the post images url from for example : http://www.sitename.com/wp-content/uploads..... to http://cdn.sitename.com/wp-content/uploads... is it possible ? if yes please help. Thanks in advance


add_feed failed to open stream

Trying to add a new feed with:               function events_feed() {     include(TEMPLATEPATH . '/events.php/');     }     add_feed('gpevent','events_feed');      And I'm getting a failed to open stream directory not found error. 1.events.php lives in the root of my theme folder. 2.I added the function to my functions.php file. Saved & uploaded. 3.Resaved permalinks. 4.Visited `http://example.com/feed/gpevents`


Programatically inserting terms doesn't update the Taxonomy admin UI

On one of the projects I'm working on, we have a feed which is being aggregated into WordPress. The feed items are being assigned ot a custom post type and a custom taxonomy. New terms are created and assigned to posts succesfully, and show on the frontend and in the post edit screens. **However** if I go to the taxonomies page in the backend, it lists only the terms that were present prior. If I create a new term e.g. 'Bob' and then refresh the page, all the terms appear as expected. Clearly there is a cache or transient of some kind or a hook that needs to be fired, something that is not happening when I create the taxonomy terms programatically, but IS happening when I do it via the backend. Any clues? edit: Here's the code:               $product_group = ! empty( $custom_meta[ 'product_group' ] ) ? $custom_meta[ 'product_group' ] : false;     $product_type  = ! empty( $custom_meta[ 'product_type' ]  ) ? $custom_meta[ 'product_type' ]  : false;          if ( $product_group && $product_type ) {         $tax = strtolower( $product_group ) == 'opinion' ? 'category' : 'product_categories';              if ( ! ( $group = term_exists( $product_group, $tax ) ) )             $group = wp_insert_term( $product_group, $tax, array( 'description' => $product_group ) );              $group_id = ! is_wp_error( $group ) && isset( $group[ 'term_id' ] ) ? $group[ 'term_id' ] : 0;              if ( ! ( $type = term_exists( $product_type, $tax ) ) )             $type = wp_insert_term( $product_type, $tax, array( 'description' => $product_type, 'parent' => $group_id ) );              $type_id = ! is_wp_error( $type ) && isset( $type[ 'term_id' ] ) ? $type[ 'term_id' ] : 0;              $the_term = get_term_by( 'id', $type_id, $tax );         $taxonomies = array( $tax => array( $the_term->slug ) );     }      It seems to be only the children that don't show up


How would I leverage custom Taxonomies in this scenario?

## 2 Tier research: I am building a site for a client that specializes in research travel. They offer 2 tiers of research assistance, "Standard" and "Premium". Each of those levels of service have occupancy variations, such as Single or Double. Although these features share names and other attributes, they are specific in price per trip. ## Custom Post Type w/o taxonomy I've made a custom post type for "`Trip`" and Trip has child post types called "`Packages`". I'm not looking for a magical solution to sort it all out; I don't mind (nor does the user) adding each combination as a line item. I can create `Trip`s and `Package`s this way just fine and relate them accordingly. However, out of the box (not using taxonomy), the URLs are something like this:   * `http://exmple.com/trips/fall-2012/` - this displays the details of the trip. I have a custom content template to display its child packages defined above accordingly.   * `http://exmple.com/packages/` - this lists out ALL packages that I've created for all my trips. Packages with the same name (i.e. Single Registration) end up like `/packages/single-registration-2/` and `/single-registration-3/` ## The needed combinations This is not helpful because I am not interested in seeing all 8 different combinations of packages. A combination would be:   * _`trip` - `service level` - `occupancy`_ ## Examples What I'd really like to see is:   * `http://exmple.com/trips/` - this would display all top level trips, such as Fall 2012, Spring 2013, Fall 2013   * `http://exmple.com/trips/fall-2012/` - this would display all packages for that trip. All combinations of service level and occupancy. **This is really as far as I would need to go. I plan on offering a list of all packages here and allowing the user to choose one.** Just logically speaking, the rest of the URLs would look like this (although I dont plan on needing to navigate this deep)   * `http://exmple.com/trips/fall-2012/standard/`   * `http://exmple.com/trips/fall-2012/standard/single-occupancy/`   * `http://exmple.com/trips/fall-2012/standard/double-occupancy/`   * `http://exmple.com/trips/fall-2012/premium/`   * `http://exmple.com/trips/fall-2012/premium/single-occupancy/`   * `http://exmple.com/trips/fall-2012/premium/double-occupancy/` * * * I really hope I made some sense.


Read More is not working in query posts

I have Query_posts in my page. the posts have tags to separate for read more, But while doing query posts it is pulling all content for `<?php the_content('read more..');?>`


One time username change from frontend?

I'm using facebook connect plugin. Usernames generated by that plugin look like firstname_lastname. I mean it looks ugly. I would like to give the privilege to my users to change the username **BUT ONCE**. I hope its like changing the password. Here is my change password function. Can anyone help me to modify it? Thanks


In what sequence are the hooks fired when a post is "published"?

I would be grateful if someone could point out a link. I understand this may have a very lengthy answer but I searched and couldn't find any resource. Alternatively, it would also be nice if someone can just state the order in which hooks are fired. I'm sure there wont be many since I am only concerned about the "published" posts. Thanks in advance.


how to both crop (with tool) and resize thumbnails having only a max width constrain?

I can't found my very problem in other threads. I'll try to explain:   * want to use thumbnails MAX 400px width. That means that CAN be 400px, but not always they should be 400px width. They can be even less. So, say, in the same page, one thumb 400px, one 320px and one 350px.   * want to crop them using the wordpress crop tool. Till now, I've been able to get the thumbs both correctly cropped and 400px. What I can't get is a thumb less than 400px (I've setted that width in the media options). In other words, wordpress always set the thumb to 400px, despite of how I edited the images. I would like it to consider 400px only the max width instead, so I can edit and image to to have the thumb cropped (I mean with the edit tool) and resized say, to 320px. Another way to say it: I want wordpress to serve the thumbs 400px width only if I didn't resized them less than 400px. Is there any way to do it? I'm a programmer, and I can eventually use code to filter out content, but still I can't figure out the exact way of doing it.


show a little contact form in homepage without plugin

I need to create a very simple contact form in the homepage with just 3 fields.Is there a way for showing the contact form without a plugin? I dont want to create a page with a contact form template for that. thk.


Woocommerce slider for related products based on category

I'm using the theme scrollider on a Woocommerce site. I want to display a slider with related products at the top of each category page, before the content. At the moment I've done it manually by inserting the slider shortcode into the category description. [wooslider category="live-a-little" slider_type="products" overlay="none" limit="10" link_title_to_product="true" carousel="true"] It means I have to specify which category to display products from each time. Also, it sits in the content div, and I'd like it above. Not to mention, the client is going to add categories in time, and they will flip out inserting this shortcode. Can anyone explain to me how I could use a conditional function to insert this automatically? Thanks!


Height and width attribute not setting by the_post_thumbnail

I am using following code to display images in home page:               if ( has_post_thumbnail() ) {the_post_thumbnail('postbox-thumb')      But the output of the above code does not have height and width of the img tag. Please help me in solving this problem. Current sample output:               <img alt="Kiran inspects coal mine" class="attachment-postbox-thumb wp-post-image" src="http://i0.wp.com/www.indiahelpdesk.in/wp-content/uploads/2012/08/HY09-KIRAN_1170869f.jpg?resize=229%2C150">      img height and width attributes are missing.


Wordpress for app, hide certain elements

I am working on transferring a non wordpress website to wordpress and have come across a problem that I thought would be simple but turned out it's not.   The website has an android app which per webview displays the web pages. These are served from an app.domain.com subdomain which doesn't show the navbar and adsense ads.   I figured I would handle it the same way on wordpress but it seems to be quite tricky to have a subdomain that serves the exact same content as the main domain and just does not display certain elements. The problem is that there can be absolutely no link which point to the main domain as the navbar would be displayed and ruin the layout and more importantly the adsense ads will show violating Google terms as the app is monetized with admob.   Sadly I can not just hide the elements on mobile neither as they are required on the normal mobile website.   If anybody could help me out with this it would be awesome!   I am also open to another solution without the subdomain if there is one.   Thank you!


Preventing role reading others posts

I've got a custom post type that I want to allow a specific user role to add posts to, however they must not be able to read posts from others. Here's my custom post type code:               register_post_type('product', array(         'labels'                => create_post_type_labels('Product'),         'public'                => TRUE,         'query_var'             => TRUE,         'rewrite'               => array('slug' => 'products', 'with_front' => FALSE),         'capability_type'       => 'directory',         'capabilities'          => array(             'edit_post'         => "edit_directory",             'read_post'         => "read_directory",             'delete_post'       => "delete_directory",             'edit_posts'        => "edit_directorys",             'edit_others_posts'     => "edit_others_directorys",             'publish_posts'       => "publish_directorys",             'read_private_posts'    => "read_private_directorys",             'delete_posts'        => "delete_directorys",             'delete_private_posts'    => "delete_private_directorys",             'delete_published_posts'  => "delete_published_directorys",             'delete_others_posts'   => "delete_others_directorys",             'edit_private_posts'    => "edit_private_directorys",             'edit_published_posts'    => "edit_published_directorys"         ),         'supports'              => array('title', 'author'),         'has_archive'           => TRUE     ));      And here's a screenshot of the role permissions: ![enter image description here](http://i.stack.imgur.com/mjlqF.png) The problem I'm having is my `directory contributor` user can still see the posts from the other users. Can anyone spot an error in the way I am doing things here?


Multisite - How to structure the URL for a country subdirectory

To geotarget a country, is it best to use the country `tld` or language code (or maybe both) in the subdirectory? Say using WP multisite with a `.com` and another subdirectory for a country..in my case Israel. Should I use `www.example.com/il` or `www.example.com/he_IL` or `www.example.com/il/he_IL` (may be `.com/il-he_IL`)...which way would be the right URL structure and be SEO friendly too? By the way I am planning to use mapping between this sub-directory and full domain.


When logging out i get some weird redirect loop?

i was trying to customize my loging page. by using `wp_login_form()`. after i did that when i logged in with wrong username/password i got redirected to the ugly normal page at domain.com/wp-login.php...... so i looked around for a fix and this is what i found:                 add_action( 'wp_login_failed', array($this, 'custom_login_fail') );       add_action( 'authenticate', array($this, 'custom_login_empty'));         /*          * @ changing how login works and making it so it wont redirect to(wp_login) if login fail          * */         public function custom_login_fail( $username ) {             $referrer = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : "";             if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) {                 if ( !strstr($referrer,'?login=failed') ) {                     wp_redirect( $referrer . '?login=failed' );                 } else {                     wp_redirect( $referrer );                 }                 exit;             }         }                   /*          * @ changing how login works and making it so it wont redirect to(wp_login) if login fail          * */         public function custom_login_empty(){             $referrer = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : "";             if ( strstr($referrer,get_home_url()) && $user==null ) {                 if ( !strstr($referrer,'?login=empty') ) {                     wp_redirect( $referrer . '?login=empty' );                 } else {                     wp_redirect( $referrer );                 }             }         }      However the above also create a weird redirecting loop when looking out from admin.. Any ideas ?


Making that Admin Bar transparent or a blue color

The question title is pretty self-explanatory - I don't really like the new Admin's bar's colour but I find it useful and want to keep it so I would like to change the colour of it. However, I'm not the best at web scripting, let alone CSS so I wondered if anybody here would help me to make the Admin Bar the following sort of HEX color: #62BACE. If that color isn't really possible, or it is easier - I wouldn't mind having a transparent admin bar! Any assistance would be very kind and grately appreciated! Thanks in advance PS If there's a plugin that does this for me I wouldn't mind using it - I just don't know of any and can't code in CSS...


How to load WordPress on non WP page?

I want to use the `get_option()` function of wordpress in one of my theme's files, which is not related to WP, it is just located in the same directory of the other theme files. I need this file because of some extra IPN paypal related actions, but I need some values from the options table that exists in WP to be called in this page in order for it to work. I know I can't just use `get_option()` as this file is overlooked by wordpress. Is there any approach by including some parts of wordpress in my theme to make this functionality only work?


Best practices for user registration with Wordpress from an MVC background

Ok so I used to develop in Wordpress a lot but in the last year have been using Codeigniter instead. Obviously there are times when Codeigniter is more applicable to a situation than Wordpress and vice versa, but I've had to come back to use Wordpress for my next project. With MVC it makes so much sense to have all the "echoing" in the views and haver all the processing in the controllers etc.. but now coming back to Wordpress I feel odd echoing inside a function. I am making a registration page (most of the code is from here but I am yet to change it to my custom fields etc) where the HTML is in the template page with a `do_action ('process_customer_registration_form');` and all the processing AND ECHOING is done in function.php:                   function registration_process_hook() {         if (isset($_POST['adduser']) && isset($_POST['add-nonce']) && wp_verify_nonce($_POST['add-nonce'], 'add-user')) {                  // die if the nonce fails             if ( !wp_verify_nonce($_POST['add-nonce'],'add-user') ) {                 wp_die('Sorry! That was secure, guess you\'re cheatin huh!');             } else {                 // auto generate a password                 $user_pass = wp_generate_password();                 // setup new user                 $userdata = array(                     'user_pass' => $user_pass,                     'user_login' => esc_attr( $_POST['user_name'] ),                     'user_email' => esc_attr( $_POST['email'] ),                     'role' => get_option( 'default_role' ),                 );                 // setup some error checks                 if ( !$userdata['user_login'] )                     $error = 'A username is required for registration.';                 elseif ( username_exists($userdata['user_login']) )                     $error = 'Sorry, that username already exists!';                 elseif ( !is_email($userdata['user_email'], true) )                     $error = 'You must enter a valid email address.';                 elseif ( email_exists($userdata['user_email']) )                     $error = 'Sorry, that email address is already used!';                 // setup new users and send notification                 else{                     $new_user = wp_insert_user( $userdata );                     wp_new_user_notification($new_user, $user_pass);                 }             }         }              if ( $new_user ) : ?>
         <?php             $user = get_user_by('id',$new_user);             echo 'Thank you for registering ' . $user->user_login;             echo '
Please check your email address. That\'s where you\'ll recieve your login password.
 (Be sure to check your spam folder)';         ?>
         <?php else : ?>                  <?php if ( $error ) : ?>
                     <?php echo $error; ?>
             <?php endif; ?>              <?php endif;          }     add_action('process_customer_registration_form', 'registration_process_hook');      My question is... is it best practice in WP to have content echoed within an action function like it is at the end if this one? Why not just have a standard if(isset(submit)) situation and process the form in the same page? I know thatby moving it to the functions its seperating the logic, but it's also echoing a response within the function.. Doesn't seem right. Thanks


Advanced Custom fields not available yet during publish_page action

I have a function that I use that ties into the publish_page action that I use to create multiple pages on my site. This function worked perfectly for a while, but ceased to function correctly after a recent update. Unfortunately I didn't notice it at the time, nor did the client, so I'm not sure exactly which update killed it. The issue is that if I try and get the pages custom fields using the post id that is passed into the function, they are not saved to the database yet. For instance:               function tk_publish_pub($post_id) {          if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;          $slug = 'pubs';          //get all the pages to copy     while(the_repeater_field('default_pub_pages','options')):         $post_object = get_sub_field('page_template');          $pages_to_copy[] = $post_object->ID;     endwhile;          $admin_user = get_field("admin_user", $post_id);     $allpages = implode(", ", $pages_to_copy);          mail("tomyemail@gmail.com", "test data", "Post ID: $post_id \n Admin user for post: $admin_user \n Pages to copy: $allpages \n Post_name: " . get_field('subdomain_id', $post_id));     return;     }      ACF works correctly at this stage (I get my list of 'pages to copy') so I know its not that. However, where I try and get the admin user, it and any other ACF field from the published page are not saved to the database yet. Anyone ran into this before?


Remove 'Check Compatibility' from Plugins menu

Is there a way to remove the 'Check Compatibility' link that appears under plugins in the plugin menu? If so, how can I remove the link from a given set of plugins, and alternatively from all plugins at once?


update_post_meta() not working in bulk option

I am following this https://gist.github.com/michael-cannon/5820098 to update bulk values but its not working. I tried to debug each and every step but can't get the exact error. I have the following codes of js:               $( '#bulk_edit' ).on( 'click', function() {         // define the bulk edit row         var $bulk_row = $( '#bulk-edit' );              // get the selected post ids that are being edited         var $post_ids = new Array();         var $langs = {};              $bulk_row.find( '#bulk-titles' ).children().each( function() {             $post_ids.push( $( this ).attr( 'id' ).replace( /^(ttle)/i, '' ) );         });              // get the data         $('.uni_lng-checklist li input[type="checkbox"]:checked', $bulk_row).each(function(){             var k = $(this).attr('name').replace('wpcf[languages-kerk][', '').replace(']', '');             var v = $(this).attr('value');             $langs[k] = v;         });                   // save the data         $.ajax({             url: ajaxurl, // this is a variable that WordPress has already defined for us             type: 'POST',             async: false,             cache: false,             data: {                 action: 'save_bulk_custom_language', // this is the name of our WP AJAX function that we'll set up next                 post_ids: $post_ids, // and these are the 2 parameters we're passing to our function                 wpcf: $langs,             }         });          });      and the ajax action hook is :               add_action( 'wp_ajax_save_bulk_custom_language', 'uni_save_bulk_custom_language' );     function uni_save_bulk_custom_language() {            $post_ids = ( ! empty( $_POST[ 'post_ids' ] ) ) ? $_POST[ 'post_ids' ] : array();       $languages = ( ! empty( $_POST['wpcf'] ) ) ? $_POST['wpcf'] : null;            if ( ! empty( $post_ids ) && is_array( $post_ids ) ) {         foreach ( $post_ids as $post_id ) {             update_post_meta( $post_id, 'wpcf-languages-kerk', $languages );         }       }            die();     }      I tried to check the `update_post_meta` function which return true every time, means its updating the value. but when i try to check in the database or when the page refresh on bulk update its displaying blank even in the database. Can anyone please help me to detect the exact problem?


Weird characters being added to my link

I created a simple image link that's linking to a page within my Wordpress website and for some reason weird characters are being appended to in which is not allowing the user to get the the page destination. Please help! This is the website: http://bit.ly/1ko2xwM its the link under "click here to preview". I'm just doing a simple anchor tag.                <img src="<?php bloginfo( 'template_url' ); ?>/images/Book-Preview-CTA.png" alt="Look Inside Book">


Connecting to a 2nd DB gives me no results when querying

I'm trying to access a different DB on the same localhost as my wp db is and I did this like so: functions.php:               add_action('init','my_new_db');     function my_new_db(){      $newdb = new wpdb( 'test', 'test',  'test',  'localhost');      $newdb->show_errors();     }      Following this in page.php:                 <?php       global $newdb;            $test = $newdb->prepare( "SELECT `...`, `...` FROM ..." );       $result = $newdb->get_results($test);            return($result);             ?>      The dots are correctly filled in don't worry about that, though this is the message I query and I get no error or no result.


I'm getting a '500 Internal Server Error' when I try adding menu items

For some reason, I suddenly get `500 Internal Server Error` when I try to add menu item to a menu and I can't figure out why. I'm running Apache2 with Centos 6 OS on a VPS.   I have PHP 5.8 and MySQL 5.1 This is the error message: > Internal Server Error > > The server encountered an internal error or misconfiguration and was unable > to complete your request. (...)   * My error_log file shows nothing.    * I can create new menus   * I can not add pages or custom links to menu items   * I've deleted the .htacess file and get the same error   * I can add new pages and posts Can anyone help me to figure out what may cause this weird problem?


List Users alphabetically with heading

How can I show a list of Users with alphabetical headings? For example: **A**   Adam   Alan **B**   Bill   Bob I've found examples that do it with Posts, but I can't figure out how to make it work with `WP_User_query()` :(


Drop-Down Menu of Current Child Pages

Sorry if my question title didn't make much sense. I'll try and explain. I am using the 'Contact Form 7' plugin on a WordPress site and would like to display the child pages of the current page in a select menu, I.E. =>               <select><option>This is a child page</option><option>This is another child page</option></select>      Of course, the option markup would be the dynamic function; markup that says basically that we want to display the child pages of the current page wrapped in an option field for each one. The result should be a drop-down menu that someone could select the child pages title and submit it with the form. The reason being, the child pages are tours and all I need is the title to be passed to a select field so we know that' the tour they're interested in.