title: Print owned created widget

text: Im trying to print my own created widget with the following function:               the_widget();      The widget is defined with the following values:               $this->WP_Widget('openingHours', 'Opening', $widget_ops, $control_ops);      When I try to get the widget I use the following code:               the_widget('openingHours');      Although nothin shows up. I have added info to the widget at the admin panel. And this code also prints the widget the right way.               if ( !function_exists( 'Footer 2' ) || !dynamic_sidebar() ) :                              dynamic_sidebar( 'Footer 2' );                         endif;       What am I doing wrong with "the_widget()" function and how should I do it right?


title: What happened to convertEntities?

text: I was using the javascript function convertEntities in a plugin that worked great until recently and now the function seems to have vanished under 3.3 - Is there a substitute function I should be using? I am tempted to just copy the function into my script - is there a reason that is a bad idea?


title: Get user id from email?

text: I'm working on an email system, and I'm onto the unsubscribing stage. Since most of my users would not know their user ID, I'm asking them to put their email into a text box (definitely preferred, since this IS an email system). In order to change their user meta (their subscribed status), I need to know the users ID. I mean I suppose I could pass it into an email and put it in the unsubscribe link, but I'm planning on sending out emails to people who don't have wordpress accounts. So my main question is this: What logic or functions should I use to determine a users ID from an inputted email address, and if none are found, store them in the wordpress database? Thanks, I appreciate every answer!!


title: How do we remove mystical [X] from text? Image included

text: Wordpress has placed an uncalled for character on one of our page's text. We have a few hundred pages, and this only occurs on one. In the paragraph's text, between the words 'Music' and 'Students', WordPress has placed a [X] character. It is not in the visual or text views, and only appears on the actual page. It cannot be copied nor is there an extra space in the code. In essence there is no extra character between the two words, aside from the space. What caused this and how can it be removed? ![X error in text](http://i.stack.imgur.com/KpAnz.jpg) If permissable, I can provide the URL containing the error.


title: Configure email notifications on new submissions

text: I'm getting notifications to my email whenever a user submits a post. Problem is - I want to change this email notification, and I can't find where to configure this. **Edit** : the subject of this email is - "[sitename] New submission from [user]" Email content: "You have a new story submitted to your [sitename] site. Story: [submission]" Would appreciate your help, thanks! T === Context: I'm completely new to WordPress. The site I now administer used to belong to someone else (who is not available for contact). The only administration UI I used so far is the site online admin page (no command line, no coding). **Edit** : my site is a part of a chain of sites and some of its features are controlled "at the top of the chain". For this reason it is possible that I have no control over this.


title: Updating parent themes vs. updating starter theme

text: # Context: I use framework parent themes (e.g. Thematic) mainly because it ensures that my custom themes inherit cutting-edge and standard compliant code. # Why I'm not yet using starter themes: I'm reluctant to use starter themes (e.g. _s, Bones etc.) because, as I understand it, I'll need to screen for code changes with every version update and then manually apply them to my custom theme. I'd rather # My question: Is my understanding of the process of updating starter themes correct and if so, is it not less work to simply **reverse engineer a parent theme once and have automated version** updates rather than **repeatedly manually (and perhaps tediously) having to update my custom starter theme**?


title: Tax Query trouble

text: I can't seem to figure this out. The following query works:               $xxxx = new WP_Query(array(     'listset' => 'homepage',     'meta_query' => array(         array (             'key' => 'show_home',             'value' => 'true',             'compare' => '='         )     ),     'posts_per_page' => 1,     'post_type' => 'lists',     'post_status' => 'publish',     'orderby' => 'date',     'order' => 'DESC'     ));      The following does not:               $xxxx = new WP_Query(array(     'tax_query' => array(         array (             'taxonomy' => 'listset',             'field' => 'slug',             'terms' => 'homepage'         )     ),     'meta_query' => array(         array (             'key' => 'show_home',             'value' => 'true',             'compare' => '='         )     ),     'posts_per_page' => 1,     'post_type' => 'lists',     'post_status' => 'publish',     'orderby' => 'date',     'order' => 'DESC'     ));      Anyone can help me figure out why the second one doesn't work?


title: Show values of custom field created with ACF on a page

text: Im using **ACF** to create custom fields. One of them is a list of checkboxes that display some options (option1, option2, option3....). and what i need is to show these options on a page in a list like this: Options:   -option 1   -option 2   -option 3  How can i get these values??? thanks :) edit: I need to show the option list on the frontend.


title: inserting uploads into subdomain

text: I have my wordpress blog in the root of my website (example.org) and would like to store uploaded files in a subdomain depending on type of file, for example I currently have static.example.org/images, static.example.org/video and static.example.org/audio and was trying to find a way to put uploaded files in the subdomain through the Wordpress Interface. I've found a plugin which is quite dynamic in storing files, but it won't pass to subdomians, can anybody help or suggest anything?


title: How to change server name on Wordpress Installation?

text: I am not sure if the title of the question is acurate enough but here it goes. I have set up an Ubuntu server inside a VirtualBox VM, I have enabled port forwarding so when I type on the host `localhost:8888` it gets forwarded to the apache running on the guest. I have also set up port forwarding in my router (BT Home Hub) so when e request on the public IP (81.153.xxx.xxx) comes on port 8888 it gets again forwarded to the apache on the guest. All is fine up to now, but my problem comes when I want to cross-browser test in a service like browseling. It opens the home page fine (sadly all my images and stylesheets are not loaded) but when I click on different links it gives a 404. After investigating this I found that Wordpress uses absolute links that are, in my case, in the format of `http://localhost:8888/category/test- category/`, and of course they would not show up when the request is made from the outside. Now I do not have a domain name because this is a server purely for testing and development purposes but I would really like to be able to use browserling for testing it and thus I need the links to use the public IP. Is this possible?


title: Page and post auto links

text: I dont know how to call it, but can I switch off auto linking in Wordpress? I am creating my 3. theme for client, but I have not manage this problem. For example, if I create a page or post, Wordpress automatically create a permalink on my site, www.mysite.com/posttitle. But if I wanna use this post to display it into the home page, for example it have only few lines, like copyrights or whatever. So I create new page/post and display it into my theme by `query_posts`. And all is fantastic, until I type www.mysite/copyright and there I can see only my copyrights. How do you manage this kind of problem? Of course I can hard code it into my template, but it isnt a solution form me. I hope you get my thought. **UPDATE. Ok I found better example :** If I wanna create portfolio page where will be all my work. So I create new template file, than new page, new category and add new posts to that category. So I have that page mysite.com/portfolio and there is all those posts ( works ). Just title, picture and some small description. But wordpress is automatically creating those links mysite.com/portfolio/work1, but I dont wanna it.


title: post-page: reference to parent page?

text: i'm having a problem with wordpress and the post-page: my web has several pages like: news, projects, links each page is displaying posts of the corresponding category. my question: when clicking on a post's detail, it will execute always the same script (post-detail.php). now i want to implement a "back"-link which jumps page to the referring page. how can this be done? is it possible having several post-pages? thanks


title: Pluggable function and activation check?

text: Plugin is defining pluggable `wp_mail()` function. My idea was to check if function is defined already and throw warning if other plugin beat me to it. However this warning causes issues on activation. As far as I understand during normal operation plugin is loaded **before** `pluggable.php` but for the purpose of activation check it is loaded **after** pluggables. What would be the robust/proper/suggested way to implement such check for pluggable function? There is no obvious (for me) way to distinguish activation and handle it separately.


title: Multiple sites with independent users

text: I've been going round and round with this so I hope someone can help! I've setup about 10 websites, all on Wordpress, for friends. At the moment, each of these sites are on separate wordpress installs. What i'd like to do is get to the stage where I have 1 install that can accomodate the 10 sites, but each site can't see the details/users/themes etc. of the other sites. Here is what i've tried so far:   1. WP-Hive - This appeared to have some potential however it only caters to a single administrator. As i've just done these sites for friends, I generally give them a login to get in and edit the page content/post blogs themselves. So I don't think this will work.    2. Wordpress 3.0.3 Network - I set this up with 2 sites however I had trouble with the domains and redirects as well as the level of access users had to everything (ie. Users can see all of the themes and plugins available, even when they aren't relevant to them).  The last thing i've found to try is this: http://striderweb.com/nerdaphernalia/features/virtual-multiblog/ Does anyone know what I am doing wrong or how I can get this to work?


title: Tag pages do not show

text: ## 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!


title: Creating custom permalink structure for languages

text: 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!


title: Custom theme template files

text: 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


title: WP can't send newsletters

text: 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


title: Add whitespace between Chinese and other letters

text: 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!


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

text: 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 ;)


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

text: 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?


title: Custom Form only for admin

text: 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?


title: Looking for a Wordpress photo gallery plugin

text: 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!


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

text: 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?


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

text: 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.


title: Use ColdFusion to pull in WP.com posts?

text: 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!


title: How to change src link in YouTube?

text: 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` :/


title: Cookie in custom page template

text: 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.


title: Contact Form 7: conditional required fields?

text: 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?


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

text: 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.


title: Shortcode and variable

text: 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.


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

text: 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.


title: Show Custom Post Type taxonomy term that matches custom field

text:
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?


title: How can i add a rewrite rule in wordpress

text: 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.


title: Search wordpress using three different drop down menus

text: 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?


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

text: 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?


title: Custom domain for sub-section of parent website

text: 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.


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

text:
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' ); ?>
      }


title: Target all posts that are NOT aside or link post formats

text: 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?


title: Including Javascript options

text: 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


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

text: 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.


title: Trying to post information from a remote database to wordpress page

text: 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


title: What is the correct MIME type for PSD (Photoshop)

text: 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?


title: Animated gif for a thumbs

text: 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!


title: Export SQL query based on custom field?

text: 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?


title: Manipulating menu HTML

text: 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?


title: Add size in Gallery Settings in Media Library

text: 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);             }


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

text: 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!


title: Limit number of posts in wp loop

text: 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();         ?>


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

text: 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.


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

text: 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') );     }


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

text: 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


title: How to remove the tripadvisor logo from the wordpress theme?

text: 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??


title: define multiple post thumbnails

text: 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


title: wp_insert_post not working

text: 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?


title: Limit image upload

text: 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.


title: wordpress plugin is not activating from widget

text:
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


title: How can I add @anywhere to my blog?

text: 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?


title: wp_nav_menu and its fallback

text:
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?


title: Show nav link highlighted

text: 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


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

text: 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?


title: ignore_sticky_posts in WordPress 3.0.3?

text: 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);


title: get values from contact form 7 wp plugin

text: 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


title: Create a page for a theme only

text: 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.?


title: wordpress site validation errors

text: 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?


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

text: 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


title: APC 500 Internal server error

text: 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


title: Grab 5 latest posts from custom post type 'announcements'

text:
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!


title: Featured image/thumbnail fallback placeholder image

text: 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?


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

text: 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?


title: How do I echo the post type?

text: `<?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.


title: Which function(s) to build a paged HTML table

text: 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.


title: WooCommerce shop page to use my custom template

text:
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.


title: Including a custom post type in the Archives widget

text: 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?


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

text: 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' );`


title: query posts in wordpress

text: 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?


title: Strip Image Classes from HTML Output

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


title: Specific php document for a page

text: 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.


title: Password Protect Custom Page

text:
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.


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

text: 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.**


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

text: 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?


title: Force RTL styles in admin panel

text: 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.


title: Adding comments to my custom theme

text: 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?


title: Reference product SKU on WooCommerce confirmation page

text: 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.


title: Redirection error after posting a comment on a custom type post

text: 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');


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

text:
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 .


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

text: 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.


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

text: `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.


title: Proper method to restrict non logged users into certain pages

text: 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?


title: Any dummy content I can use for development?

text: 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


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

text: 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


title: add_action insert html

text: 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.


title: output specific location in the header

text: 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).


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

text: 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?


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

text: 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?


title: Session is not starting

text: 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?


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

text: 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


title: add_feed failed to open stream

text: 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`


title: Programatically inserting terms doesn't update the Taxonomy admin UI

text: 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


title: How would I leverage custom Taxonomies in this scenario?

text: ## 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.


title: Read More is not working in query posts

text: 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..');?>`


title: One time username change from frontend?

text: 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


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

text: 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.


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

text: 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.


title: show a little contact form in homepage without plugin

text: 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.


title: Woocommerce slider for related products based on category

text: 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!


title: Height and width attribute not setting by the_post_thumbnail

text: 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.


title: Wordpress for app, hide certain elements

text: 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!


title: Preventing role reading others posts

text: 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?


title: Multisite - How to structure the URL for a country subdirectory

text: 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.


title: When logging out i get some weird redirect loop?

text: 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 ?