title: Free shipping for certain items only - or get local pickup as option if item is set to virtual

text: I'm currently setting up a woocommerce driven shop. I use the fedex shipping calc. extension to get the shipping costs calculated. I wanna ship all items that are under 200$ for free. never mind if the cart total is above the 200$. Means you can add 4 or 6 or never mind how much items to the cart if each of the items is below the 200$ the shipping is free. So what I did is I have set all that (below 200$)items up as "virtual" items. That way they skip the fedex shipping calc. The problem is that I also wanna offer LOCAL PICKUP as a shipping option. But customers are not able to select that option if they have virtual items only in their cart. Is there a way to enable the local pickup option anyway? Or is there a smarter solution to get that idea done? EDIT: i have also tried to the following:   1. I have created a special shipping class named it "free shipping".   2. I have disabled the "virtual" option for one of the items wich has a price below the 200$. And i added that "special class "free shipping" to that item.   3. I have then activated the FLAT RATE shipping method and set the shipping cost on that to 0.00    4. I told that FLAT RATE shipping option to be active for my previously generated class (free shipping) only.   5. I renamed the option from FLAT RATE to FREE SHIPPING so that it is listed as FREE SHIPPING on the checkout page   6. So far so good, now if i add that item to the basket i see both options the FREE SHIPPING (the original flat rate i have renamed) and the "LOCAL PICKUP" option. so far so good. that works fine ... the problem is as soon as i add an another item to the cart with an price over 200$ fedex take affect and will calculate the shipping cost and a few fedex options are displayed. i also see the local pickup BUT AND THAT IS THE PROBLEM I ALSO SEE THE FREE SHIPPING OPTION CUZ THE the item i have given the special class is still in the basket. means people are able to select free shipping and that is not what i am looking for. As soon as a item with a price of over 200$ is in the basket the free shipping should be gone. I FOUND THE FOLLOWING SNIPPED HERE ON WPA Here's a snippet colleted from some Gists out of a GitHub issue discussion linked by @Ewout in another answer. I added a var_dump(), so you can uncomment and check what exactly you want to remove.               $available_methods is an array of:          $available_methods as $method_id => $method     Compare against $method_id if you need more specific checks.          // Hide standard shipping option when free shipping is available     add_filter( 'woocommerce_available_shipping_methods',         'wpse90835_hide_standard_shipping_when_free_is_available' );     /**      *  Hide Standard Shipping option when free shipping is available      *       * @param array $available_methods      */     function  wpse90835_hide_standard_shipping_when_free_is_available($available_methods )     {     // Developers!: Dump this to see what you can unset     # var_dump( $available_methods );          // remove standard shipping option     if (          isset( $available_methods['free_shipping'] )          AND isset( $available_methods['flat_rate'] )     )         unset( $available_methods['flat_rate'] );               return $available_methods;     }      can somebody tell me how to use the "Compare against $method_id if you need more specific checks."


title: Admin menu links just refresh the page

text: I'm using add_submenu_page() function to add some options to my plugin. On Linux hosting everything works like it should, on Windows hosting those 5 sub- menus have same link somehow and when I click on them page just reloads. What can be issue? Both hosts are using same PHP version. Here is the code               $this->page_hooks['link1'] = add_submenu_page(__FILE__, __('link1', 'domain'), __('link1', 'domain'), $acl_table['manage_link1'], 'wp-plugin-link1', array($this, 'on_manage_link1'));     $this->page_hooks['link2'] = add_submenu_page(__FILE__, __('link2', 'domain'), __('link2', 'domain'), $acl_table['manage_link2'], 'wp-plugin-link2', array($this, 'on_manage_link2'));     $this->page_hooks['link3'] = add_submenu_page(__FILE__, __('link3', 'domain'), __('link3', 'domain'), $acl_table['manage_link3'], 'wp-plugin-link3', array($this, 'on_manage_link3'));     $this->page_hooks['link4'] = add_submenu_page(__FILE__, __('link4', 'domain'), __('link4', 'domain'), 'manage_options', 'wp-plugin-link4', array($this, 'on_link4'));     $this->page_hooks['link5'] = add_submenu_page(__FILE__, __('link5', 'domain'), __('link5', 'domain'), 'manage_options', 'wp-plugin-link5', array($this, 'on_link5'));


title: Shortcode outputs at the top of the_content

text:
The shortcode produced by this function - a list of all sites in a multisite - outputs above the content in the loop, no matter where it is placed in the editor. I've looked at the other related questions and answers on WPSE and realize that it has to do with the function using `echo` instead of `return`, but it's not as easy as replacing the instances of `echo` with `return` in the function below. Or adding `echo=0` with a WP function like `wp_list_pages()` Any ideas? Where is the function that needs to be returned instead of echoed?               // Output a single menu item     function projects_menu_entry($id, $title, $link_self)     {         global $blog_id;         if ($link_self || $id != $blog_id) {             echo '
';             if ($id == $blog_id) {                 echo '';             }             $url = get_home_url($id);             if (substr($url, -1) != '/') {                 // Note: I added a "/" to the end of the URL because WordPress                 // wasn't doing that automatically in v3.0.4                 $url .= '/';             }             echo '' . $title . '';             if ($id == $blog_id) {                 echo '';             }             echo '
';         }     }          // Output the whole menu     // If $link_self is false, skip the current site - used to display the menu on the homepage     function projects_menu($link_self = true)     {         global $wpdb;              echo '
';              projects_menu_entry(1, 'Home', $link_self);              $blogs = $wpdb->get_results("             SELECT blog_id             FROM {$wpdb->blogs}             WHERE site_id = '{$wpdb->siteid}'             AND spam = '0'             AND deleted = '0'             AND archived = '0'             AND blog_id != 1         ");              $sites = array();         foreach ($blogs as $blog) {             $sites[$blog->blog_id] = get_blog_option($blog->blog_id, 'blogname');         }              natsort($sites);         foreach ($sites as $blog_id => $blog_title) {             projects_menu_entry($blog_id, $blog_title, $link_self);         }         echo '
';     }          // Adds a [bloglist] shortcode          function bloglist_shortcode($atts)     {         projects_menu(false);     }          add_shortcode('bloglist', 'bloglist_shortcode');


title: login with email and no password

text: I am designing a site that the client wants to only have members use their email to login and no password. Here is the old site and they want something like this. Is this possible with wordpress. I'm also using wp-members plugin. http://waiscon.com/planRoom.htm


title: Breadcrumb how i can display page title with parent > child title with permalink ? any Idea

text: function the_breadcrumb() {     global $post;     if (!is_home()) {         echo "";             if(is_single()):             echo 'Main';             else:             echo "Home";             endif;         echo " / ";             if ( is_category() || is_single() ) {                 the_category(', ');                 if ( is_single() ) {                     echo " / ";                     the_title();                 }             } elseif ( is_page() && $post->post_parent ) {                 echo "post_parent)."\">".get_the_title($post->post_parent) . "";                 echo " / ";                 echo the_title();             } elseif (is_page()) {                 echo '';                 echo the_title();                 echo "";             }         }     }


title: Chat support plugin?

text: I've been looking for a chat support plugin for WP and I haven't been able to find one, does anyone know about one? Free or paid doesn't matter. Thanks in advance.


title: Making jQuery-based galleries with Wordpress without a plugin?

text: I've been racking my brains for the best way to create a simple gallery in Wordpress without relying on a plugin like NextGen gallery, and was thinking a shortcode would be a good way combined with the in-built method of 'attaching' images to a post. That way, the user would 'attach' images they've uploaded and the description for the image could be used as a caption. That was, until I realised that there's no easy way to 'unattach' an image from a post unless you delete the image itself (meaning it disappears from other posts/pages you've inserted it into). Plus, it doesn't let you link the images to different parts of your site. So I'm now thinking Custom Fields or some other method involving a shortcode or hardcoding an area in my template might be a good way to do it, but the problem is how to associate the various parts of the gallery for each image:   * the image url   * the image dimensions   * the link wrapping the image   * the order of the images The HTML I'd need to output for each image would be this:                                 And then I'd wrap that in a div like `<div id="osu-gallery">...</div>` so I could do what I wish with it in jQuery. Is that possible in Wordpress without the use of a plugin? I want to do this on a post-by-post basis and without going into the HTML editor and manually writing the code. My clients tend not to be too computer-savvy... Thanks for any pointers, Osu


title: WooCommerce: Disable Taxation for Specific Address

text: I have a WooCommerce site and a specific distributor who will be redirecting products from a taxable region (Germany) to a non-taxable region (Russia). Thanks to various forms, this makes them exclusive of VAT. Through the VAT settings on WooCommerce, I setup an extra rule for the specific postal code with zero tax - unfortunately the result is a line of zero tax, and a line of standard VAT, rather than the desired line of zero tax only. I then tried to setup the standard tax rule in Germany to exclude the single postal code, using 1-xxxxx and xxxxx-99999 where xxxxx is the number below and above the postal code respectively. THis results in a huge tax rule that WooCommerce clearly doesn't like, as it switches off any form of tax for any region at any time. Does anyone have any suggestions as to how I could override the taxation for just this address and force it to zero? I am happy to make a hook to do this, but wouldn't know where to start. Thanks!


title: Using wp_list_pages() after calling query_posts()

text: It's possible that I'm just doing this wrong, so feel free to let me know how you would solve this problem. I have a mostly page-based site, but there are a few "pages" where my content is coming from a custom `query_posts()` call. In all of these pages I want to be able to use `wp_list_pages()` to generate sub-navigation. This works just fine when I'm in a normal page, but when I'm in a "page" with `query_posts()` content, this doesn't work at all. Here's an example of what I mean by a "page". This one is a theme file called `page-media.php`:               <?php get_header(); ?>          <?php query_posts('category_name=in-the-media'); ?>              <?php get_template_part('loop', 'index'); ?>          <?php get_sidebar(); ?>          <?php get_footer(); ?>      The sub-navigation happens in `sidebar.php`, so it's happening post-loop. Here's how I'm generating my menu:               if($post->post_parent)     {         $children = wp_list_pages('title_li=&child_of=' . $post->post_parent . '&echo=0');     }     else     {         $children = wp_list_pages('title_li=&child_of=' . $post->ID . '&echo=0');     }      I then print `$children` later in a `<ul>`. This works perfectly in a page or its sub-page, but displays nothing in a page where I've called `query_posts()`. Am I approaching this correctly? Is there something I'm missing? Thanks!


title: Archive in sidebar with dropdown list of Year - Month - Day

text: I want to put a archive into sidebar. I need to select archive from 3 dropdown list with   1. Year    2. Month and    3. Day    4. and Go button. When I select Year-Month-Day from 3 dropdown lists and click on Go button then selected date archive post will show. Please help me how it possible Thanks, amazon


title: Upload file to front-end form and send as email attachment

text: I am trying to create a front-end form that has an option to upload a CV (so pdf or word format) that I would like to be able to send as an email attachment. I've read a few articles and tutorials the most pertinent (link to article) which suggests something like this:               <?php     if ($_FILES) {       foreach ($_FILES as $file => $array) {       $newupload = insert_attachment($file,$post_id);       //in this case ('upload_file', 'null')       }     }     ?>          <form method="post" action="<?php the_permalink(); ?>" enctype="multipart/form-data" >       <input type="file" name="upload_file">       <input type="submit">     <form>      In functions php:               function insert_attachment($file_handler,$post_id, $setthumb='false') {            // check to make sure its a successful upload       if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();            require_once(ABSPATH . "wp-admin" . '/includes/image.php');       require_once(ABSPATH . "wp-admin" . '/includes/file.php');       require_once(ABSPATH . "wp-admin" . '/includes/media.php');            $attach_id = media_handle_upload( $file_handler, $post_id );            return $attach_id;      }      The problem is that this uploads the CV to the media library which I don't really want. I have put the rest of the code concerning the form here How could I take `$newupload` and attach to to an email? (Ideally in the form of an attachment)


title: Is there a user-facing interface to edit an attachment's permalink?

text: If you use the `[gallery]` tag at all you know that permalinks for image attachments end up like `blog.com/2011/03/18/post-permalink/attachment- permalink`. The URL extension from the post permalink appears to be based on the attachment's title on first save. To my knowledge, however, this permalink does not update when the image title is edited in the media tools. I cannot find a way to do edit attachment permalinks at all, actually. Is there a user-facing interface I'm missing that will let users edit an attachment's permalink?


title: Filter CPT based on meta box value using Flexible Posts widget?

text: I'm using the Flexible Posts Widget to display a list of "deals" (a custom post type) in my sidebar. I'm also using that plugin's capacity to use a custom template to control the display of that listing (see details of how this works on the plugin's installation screen). One of the meta boxes available in this CPT is a radio button that identifies if the deal is Active or Inactive. On all the "deals" pages (both individual and listings), I've been able to filter the deals so only the "Active" ones show up (like so. However, I can't figure out how to link up with the query run by this plugin and add the ability to exclude deals marked Inactive. I tried using pre_get_posts to this effect, but no luck. Is it even possible to accomplish this? Or do I need to give up on the plugin and roll my own sidebar query? * * * **In the interim** I've added a new WP_Query to the custom template, but understand this is highly inefficient as it pretty much means the query is being run twice. I just haven't been able to get it to work any other way; no luck so far limiting pre_get_posts to just this one query (i.e., not all queries or the main query) or somehow adding in the metakey args after the fact.               <?php     // Exclude Inactive Offers from queries       $args = array(          'post_type' => 'offers',          'meta_query' => array(             array(                'key' => 'offer-status',                'value' => 'Active'             )          ),          'posts_per_page' => '3'       );       $offers_query = new WP_Query( $args );     ?>     <?php while ( $offers_query->have_posts() ) : $offers_query->the_post(); ?>


title: How to set default status to custom post type

text: When I save my custom post_type 'product', I'd like to set their status to my custom status 'incomplete'.


title: Dynamic page slug for Custom Taxonomies?

text:
I have a custom page "fine-art", which lists the different types of fine art that we produce based on the custom-taxonomy "fine_art_category". Some of the custom taxonomies are wood, metal, Fine Art Editions/Album, Fine Art Editions/Metal. The Fine Art Editions taxonomy doesn't have anything in it, it only has subcategories Album and Metal. Is it possible to create a slug for each of the custom taxonomies, so for example http://www.com/fine-art/wood and http://www.com/fine-art/metal. And in each page lists all of the posts with the custom taxonomy of wood. Or do I need to create a custom page for each category to make this happen? This is my custom page for fine-art, which just lists the last five posts in each custom taxonomy.               <?php     /*     Template Name: Beta Fine Art     */          $terms = get_terms("fine_art_category");     $count = count($terms);     if ( $count > 0 ){     foreach ( $terms as $term ) {     echo "
" . $term->name . "
";                $args = array(         'post_type' => 'fine-art',         'posts_per_page' => 5,         'tax_query' => array(             array(                 'taxonomy' => 'fine_art_category',                 'field' => 'slug',                 'terms' => $term->slug             )         )     );          $wp_fineart_query = new WP_Query( $args );          while( $wp_fineart_query->have_posts() ) : $wp_fineart_query->the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
     <?php     endwhile;     }     }     ?>


title: Select subscriber as author of post in admin panel?

text: I want to be able to select a subscriber an author of a post in the admin so it displays their name as having written the post, but I do not want to give them any additional privileges (if they login the only thing they can access is their profile). Is there a simple way to do this without having to change roles and capabilities? Thanks


title: Send confirmation email when a user's role is upgraded

text: I've been searching around for a solution but am coming up dry. I need to have a confirmation email sent to users when their role is upgraded. By default users are signed up as contributors and make them apply to be upgraded to an author and I want an automated email sent to the user as soon as they are upgraded. Any ideas?


title: How to: CRUD for custom post types in the front end?

text: Is there an easy way to modifying custom post types in the front end? Maybe you can direct me to a plugin? For Example: I have a custom post type called "Product". The examples I see online shows me how I can perform CRUD on products in the dashboard. But, how can I let a user modify a product in the front end? Do I need to write my own crud code for the front end? Thanks in advance.


title: How can I view all WP generated thumbnails in Media Manager?

text: When WP creates thumbnails from the original uploaded image, they are hidden from view inside the Media Manager listing. Can they be made visible, via some filter or action so that you can selectively edit/delete them?


title: Is it possible to determine when user is at "Media > Add New" vs "Post > Add an Image"

text: I want to wrap the filter below in a conditional that tests whether the user is uploading an image from the Media Manager (Admin > Media > Add New) and not from the post editor image upload routine. Is it possible to tell? $pagenow in both cases appears to be the same...               //no extra thumbs     global $pagenow;     if($pagenow=="media-new.php"){     add_filter('intermediate_image_sizes_advanced','ce4_no_thumbs');     }     function ce4_no_thumbs($sizes){return array();}      Update: It does appear that there is a post_id on the querystring when upload is accessed from within a post and not when it is accessed via "media manager > add new", however, the following test passes in either case...               if ( is_admin() && !isset($_GET['post_id']) ) {         /*This should not fire if user is uploading an image into a post,            since post_id is on the querystring. However, in my test           its still getting through.*/          add_filter('intermediate_image_sizes_advanced','ce4_no_thumbs');     }


title: Post Images Size Change in Wordpress

text: I am new to WordPress and have no knowledge about codes. Problem: My website page with the problem is: http://ecurative.com/?p=970 The image size is too big and looks blurry. I need a way out to compress the image into say 250px X 350px. Tried reassigning the large and the medium image size under Settings>Media, but no results.


title: Emails not getting delivered to Hotmail addresses

text: Recently Hotmail users are unable to receive their password email when they register or use the "Forgot my password" link to get a reset link emailed to them. So far this is only a problem for hotmail. My emails are currently getting sent from my server (not an outside SMTP server). I just created an SPF record (but it may not have propagated yet). I do have one plugin that styles the emails called WP Better Emails. Any ideas why this is happening?


title: Replace dash with space in username on login

text: All my users have usernames that follow this pattern: `firstname-lastname` (with a dash between them). However, I would like to allow them to login to WP (multisite) with a space instead of a dash. How would I go about doing this?


title: Problem with is_tax in WP_Query loop

text: The code below is the 2nd of 4 loops in "page-balls.php". Everything else is working correctly. I'm trying to display a tennis ball graphic if the post being retrieved has a the term "tennis-ball" term. It's not working. Is this because the PAGE does not have the term TENNIS-BALL? How can I make this work correctly?               <?php            $args = array (     'post_type' => 'balls',     'orderby' => 'menu_order',     'order' => 'ASC'                     ) ;          $myQuery = new WP_Query( $args ) ;     ?>          <?php if ($myQuery->have_posts()) : while ($myQuery->have_posts()) : $myQuery->the_post(); ?>          <?php if(is_tax( 'ball-types', 'tennis-ball' )) : ?>          SHOW THE TENNIS BALL GRAPHIC     <?php else : ?>         SHOW THE PLACEHOLDER GRAPHIC     <?php endif ; ?>          <?php endif ; ?>          <?php wp_reset_postdata() ; ?>


title: A solution to set metatags with my page generating plugin?

text: I have a plugin which generates a page automatically. Is there a way I can add functionality to this plugin which would allow me to set the meta description, keywords, and title for the page? I've looked into SEO plugins like Yoast and AIOSEO but I cannot seem to achieve the desired goal. Here is the source **(UPDATED)** :               <?php          function wpse_36395_metadesc() {         return 'Your Description';     }          if($city){              $args = array(             'post_title'   => $city . " Electrician",             'post_name'    => $city . "-electrician",             'post_date'    => $_SESSION['cal_startdate'],             'post_content' => $citycontent,             'post_status'  => 'publish',             'post_type'    => 'page',             'post_parent'  => 11192         );              $city_id = wp_insert_post($args);              add_filter( 'wpseo_metadesc', 'wpse_36395_metadesc' );     }     ?>      Kind Regards, Brandon


title: Using contact form 7 with easy fancybox

text:
RESOLVED - funny how simply writing down a problem can help you think. It was just a setting "close fancybox when content is clicked". So sorry to waste time / space. Please feel free to delete this to save my blushes :) I'm struggling to get contact form 7 work properly with easy fancybox in my custom template. I have read and tried everything I can find on the internet, but the problem remains that while I can get my form to "popup" in fancybox, as soon as you try to type in a field it "pops" back down again - which isn't a lot of use! Here's the code I am using:               Contact Us

     <?php echo do_shortcode('[contact-form-7 id="988" title="Contact"]'); ?>

      The weird thing is that it seems to work OK on regular wp posts, but not with my template. Any ideas on how to fix this would be much appreciated - Thanks


title: remove all submenus from plugin

text: Is there a way to un register all submenus at once instead of using the code below?               remove_submenu_page('myplugin', 'sub-page-1');      remove_submenu_page('myplugin', 'sub-page-2');      remove_submenu_page('myplugin', 'sub-page-3');      remove_submenu_page('myplugin', 'sub-page-4');      remove_submenu_page('myplugin', 'sub-page-5');     ...     ...       The idea is...               remove_submenu_page('myplugin', all);???


title: Advanced Custom Field User Help URL

text: Hi I'm using ACF or Advanced Custom Fields which i saw here a while ago.. What i want is to output a second featured image in the homepage.. Question: 1               <div class="jpl-widgets-d" style="background: url('<?php the_field('featured_home_page_image'); ?>') no-repeat;">     </div>      `<?php the_field('featured_home_page_image'); ?>` = URL OF THE IMAGE The ACF should output the URL of the image i uploaded.. Here's the plugin documentation LINK Field Name: featured_home_page_image Field type: Image Return Value: URL Help. thanks!


title: Custom Fields & Posts

text: I've got one template, which I use on many different pages. The problem is that I want to show different posts according to their "pagename" category. Ex. "About" is going to show "About category" posts etc. So I've made News ID with Advanced Custom Fields, but it doesn't work correctly.               <?php $ID2 =  "the_field('news_id')" ?>     <?php   query_posts(array('category__and'=>array($ID2),'showposts'=>2,'orderby'=>title,'order'=>DESC)); ?>      How should I approach this?


title: Wordpress 3.6 and Accordion UI issues?

text: Anyone else having issues with WordPress 3.6 and the Accordion UI? I have a website that was working just fine till I updated it to WordPress 3.6. The accordion menu stopped working. No errors. Enqueue               wp_register_script('accordion',get_template_directory_uri().'/js/accordion.js', array('jquery', 'jquery-ui-accordion'), 1.0, true);      My JS               jQuery('#accordion').accordion({          heightStyle: 'content',          collapsible: true,          active: false     });      Nothing happens at all when I click on the accordion links. Everything loads, correctly. No errors. I heard about issues with WordPress 3.6 and jQuery UI - but have not been able to find anyone with the same issue.


title: Custom Post Types Not acknowledged for date.php template

text: So my issue is this. I'm building a news site that needs to display several lists of links on the homepage for the current date. I've separated the different sections into custom post types for ease of admin management. This works fine when you visit the homepage as I'm querying each post type for the current date. Now my problem is I want to use the native query vars for year, month and day and display a page set up similar to the homepage but that displays all the different post types from the date set in the url. eg: http://mysite.com/2013/08/13/ I asked the question here already regarding retrieving query vars from the homepage And was pointed in the direction to use the date.php template. At first I thought this was fixed and everything was now working well, no redirects, rewrites or extra query vars needed. The catch is the date.php template is only picked up if I have a regular post published with that date, if not it doesn't register my custom posts and sends me to the 404 page. Does anyone have any idea on how to sort this out so that it'll know to redirect to the date.php as long as one of my custom post types was published on the date specified in the url? That's all I need. I can handle all the rest as long as I can get it directed to that page. I've tried several different filters etc to try and include custom_post types to the archives and I'm always sure to visit the permalinks page after any changes but I just can't seem to get any of my post types' dates to be acknowledged and send me to the date.php. I also tried setting up the archive-custom_post_type_name.php template but it isn't re-directing either. (I think because I'm trying to avoid having the additional slug)


title: Custom post type admin search, keep current URL parameters

text: I have a custom post type I created, and a page that displays each entry. I have an area where I can filter the results through a search form. It works good, except when I press submit, the current parameters get removed, causing me to get a 404 on an incorrect page. Here is what I mean. The page lives on a URL: `/wp-admin/admin.php?page=submissions.php` When I submit the form on the page, the URL gets changed to this: `/wp- admin/admin.php?date=06292013&name=john` As you can see, `?page=submissions.php` gets removed, therefore the page gets changed, into a 404. How do I keep the current page I am on, and the other parameters?


title: Wrapper class: How to get rid of call_user_func_array() warning?

text:
I have several installations of wordpress and now im trying to create my own small framework so I can create and maintain my themes more efficiently. What I would like to do is to have a wrapper for the hooks that wordpress offer. I would like to call hooks like this in my application               $_addThumb = function(){     add_theme_support('post-thumbnails');     };           $core->registerAction(array('tag' => 'after_theme_setup',                                   'callback' => $_redirect                                  ));      In my class I handle the logic like this (this is a snippet, the whole code is below)                   if (!empty($this -> _actions)) {             foreach ($this->_actions as $action) {                 add_action($action[0], array($this, call_user_func($action[1])));             }         }      The problem is that if I add the $this keyword to the add_action call like this …               add_action($tag, array($this, $callback))        … I get this warning: > Warning: call_user_func_array() expects parameter 1 to be a valid callback, > second array member is not a valid method in Z:\Website\wp- > includes\plugin.php And if I don't add it like this …               add_action($tag, $callback)      Then I get this notice: > Undefined offset: 0 in Z:\Website\wp-includes\plugin.php On both scenarios everything works though. I just would like to understand why is this happening and at least get rid of the warning. Here is my complete code:               class Core {          /**      * theme features      */     protected $_features = array();     private $_actions = array();               /**      * register extra functions so you can add actions to the theme      *@param array mixed      */     public function registerAction($args) {              if (!is_array($args)) {             $args = func_get_args();         }         if (count($args) < 2) {             throw new InvalidArgumentException(sprintf('Not enough arguments(registerCallback needs at least two arguments): %s.', print_r($args, true)));         }         $arg_list = array_values($args);              /**          * sets the default priority          */         if (!isset($arg_list[2])) {             $arg_list[2] = 10;         }         /**          * sets default args          */         if (!isset($arg_list[3])) {             $arg_list[3] = 0;         }              if (!is_callable($arg_list[1])) {             throw new Exception("callback not callable : Core:13");         }              $this -> _actions[] = $arg_list;          }          /**      * TODO: development only      */     public function get_actions() {         echo "
";         print_r($this -> _actions);         echo "
";     }          /**      * set theme features      * 'post-formats'      * 'post-thumbnails'      * 'custom-background'      * 'custom-header'      * 'automatic-feed-links'      * 'menus'      * @param string (required) name of the feature to be added      * @param array (optional) optional arguments      */     public function set_feature($feature, $options = array()) {              if (is_array($options) && !empty($options)) {             $this -> _features[]['args'] = array($feature, $options);         } else {             $this -> _features[]['name'] = $feature;         }     }          public function get_features() {         return $this->_features;     }          function __construct() {          }          public function init($tag = '', $function = '') {         add_action('after_setup_theme', array($this, 'initial_setup'));              if (!empty($this -> _actions)) {             foreach ($this->_actions as $action) {                 add_action($action[0], array($this, call_user_func($action[1])), $action[2], $action[3]);             }         }     }          public function initial_setup() {              // check if we have ay features so we can add them to our theme         if (!empty($this -> _features)) {             foreach ($this->_features as $feature) {                 if (isset($feature['args'])) {                     add_theme_support($feature['args'][0], $feature['args'][1]);                 } else {                     add_theme_support($feature['name']);                 }             }         }     }          }      my functions.php               $core = new Core();          $core->set_feature('automatic-feed-links');          $core->set_feature('post-formats', array('aside',                                              'image',                                              'link',                                              'quote',                                              'status',                                              'gallery',                                              'video' ));     $_addThumb = function(){         add_theme_support('post-thumbnails');     };          $_sidebars = function() {         register_sidebar( array(             'name'          => __( 'Main Widget Area', 'twentythirteen' ),             'id'            => 'sidebar-1',             'description'   => __( 'Appears in the footer section of the site.', 'twentythirteen' ),             'before_widget' => '',             'after_widget'  => '',             'before_title'  => '
',             'after_title'   => '
',         ) );              register_sidebar( array(             'name'          => __( 'Secondary Widget Area', 'twentythirteen' ),             'id'            => 'sidebar-2',             'description'   => __( 'Appears on posts and pages in the sidebar.', 'twentythirteen' ),             'before_widget' => '',             'after_widget'  => '',             'before_title'  => '
',             'after_title'   => '
',         ) );     };          $_adminHead = function(){          echo '';          };          /** i don't get a notiche with this **/     $core->registerAction(array('tag' => 'after_theme_setup', 'callback' => $_addThumb));          /** it works but i get this warning       * arning: call_user_func_array() expects parameter 1 to be a valid callback, second array member is not a valid method in Z:\Armen Website\wp-includes\plugin.php on line      */     $core->registerAction(array('tag' =>'admin_head', 'callback' => $_adminHead));     $core->registerAction(array('tag' => 'widgets_init', 'callback' => $_sidebars));     $core->init();


title: What is the canonical way to link to pages?

text: I can easily link to my archives page by creating a link: `<a href="http://server.com/wordpress/archives.php">Archives</a>`. As I was editing my WP template, I noticed that there are a number of functions that WP uses to link to other pages. For example `get_the_category_list` returns a list of links. If I want to make my template more general, it would be nice not to hardcode the URL of my archives page and to use a WP function instead. In general, how should template designers create links to WP generated pages?


title: Wordpress editor spacing very unreliable

text: Firstly I apologize for the vague question. But Im wondering can someone help. I have been developing on WordPress for approximately 2 years now, and I have yet to come up with a reliable solid solution for content editing. The editor just seems unreliable and irritating to use. Its fine for me as Im a developer so I can put in whatever html code I like, but once the client takes over the site issues start to arise. My main issue is with spacing, sometimes it decides to save the spacing , sometimes not. I tell the client to put in two spaces to get a line break, and then a gap. This works fine, but then they may go back to it later and make another change and they'll have lost all their original spacing. My other issue is that I dont know how it knows when to put in `<p>` tags. I wish it just left them out entirely, or put them in every time someone pressed return and started a new line. Im wondering can anyone offer their opinion on the above, and/or offer a recommended editor that may be easy to integrate with Wordpress and Ill write a plugin myself. Either that or suggest a very up to date plugin that is a much cleaner editor and that is definitely working on the latest version of WP. (Currently 3.9.1 but that shouldnt matter) Thank you for the help.


title: What is the best practice to style archive page 2,3,etc differently than archive.php?

text: I have a custom post-type 'videos' and on the first page I have the first video styled differently than the next videos on the page. Basically I show the first video in a large format, while the rest of the videos on the page are small. Question: On page 2, 3, etc of the video post-type, I do not want to have a large video on the top of the page, but rather follow my standard styling. What would be the best way to do this? Currently I am using rewrite rules to allow me a second template page for my 'paged' for the post-type. I would rather not use this approach anymore as it is more to maintain. If I used a check like if_paged.. then I find that I have to replicate a ton of code on my template. Hoping there is a simple way to identify the first post in the loop, style that, and then continue... open to any ideas thanks


title: wp-menu 'automatically add custom taxonomy terms' like it does for pages?

text: I've added a new wp_menu to my sidebar on a custom post-type page. The wp_menu displays a list of a custom taxonomies terms. I see that wp_menu has the checkbox to automatically add new top level pages to the menu. Is there a function that I can add to my theme that will allow it to automatically add terms from a specific taxonomy? *second question: this menu is displayed on the sidebar of my custom post-type. When on the post-type-single.php template is there also an easy way to highlight the currently active term/terms? -I found one post on this same question here, but the solution provided was to hardcode all the terms and I do not want to do that. Would rather it be automated. thanks


title: Adding iframe Content to Sidebar Widget

text: I'm trying to add an Amazon advertising widget in a WordPress sidebar widget (self-hosted WordPress, v3.1.3). The widget code is basically an iframe. I've tried using the "Text" widget and pasting the iframe code in there, but when I save the widget, the iframe code disappears. I've come across this problem/limitation before and solved it using the IFrame Widget, but I want to use more than one iFrame in my sidebar, and the IFrame widget only supports one widget at a time. Am I missing something obvious? Is there a setting somewhere to allow iframe code in the widgets? Or is it normally allowed, and I've done something silly to my install? If not, any good workarounds?


title: how to change "published date" format on edit.php (Posts page)?

text: On edit.php, the main content is a list of posts, with columns including the published date. I'd like to change the date format of the published date _just on the admin page_. In this case, I don't want to change what the users see; I want to change what the admin sees. I want to add the day of the week to the published/scheduled date, because I'm planning to publish "Every Tuesday, at least," and want to make sure I've scheduled posts correctly. After searching, the best route seems like it would be to create a custom field, but if there's a more subtle way to do this, I'd prefer to not install the custom field plugin. edit: thanks to Bainternet's comment, I see that I already have custom fields (the option was just hidden by default). And, I see custom fields are _not_ what I want. The data already exists; I just want to format it differently on the screen.


title: Scheduled events disappear from events queue

text: I'm having an issue where events that I have scheduled work for a while then just stop. After looking at the event queue I see that the scheduled events are no longer in the queue. If I deactivate then reactivate the plugin the schedule is back and works for a period of time. I don't know if WordPress has something that removes events if they timeout or anything like that. Here is my code:               register_activation_hook(__FILE__, 'k2_section_featured_ads_setup');     function k2_section_featured_ads_setup() {         wp_schedule_event('1395871200', 'minutely', 'k2_section_featured_ads_hook');     }          register_deactivation_hook(__FILE__, 'k2_section_featured_ads_deactivation');     function k2_section_featured_ads_deactivation() {              $featured_next = wp_next_scheduled('k2_section_featured_ads_hook');         wp_unschedule_event($featured_next, 'k2_section_featured_ads_hook');     }          add_action('k2_section_featured_ads_hook', 'k2_section_featured_ads_check_time');          function k2_section_featured_ads_check_time() {         // function here     }      Here is the filter for my extra cron schedules               function k2_cron_add_schedules( $schedules ) {         $schedules['quarterday'] = array(             'interval' => 14400,             'display' => __('Once every 4 hours')         );         $schedules['minutely'] = array(             'interval' => 60,             'display' => __('Once every 1 minute')         );         return $schedules;     }     add_filter('cron_schedules', 'k2_cron_add_schedules');


title: Loading custom language file for plugin

text: I'm trying to load a custom language file for a plugins to avoid any changes for this file when updating the plugin. I tried several snippets in the functions.php of the theme, but none of them worked.               add_filter('load_textdomain_mofile', 'custom_load_textdomain_mofile', 10, 2);     function custom_load_textdomain_mofile( $mofile, $domain){         if ($domain == 'my-textdomain')             $mofile = 'path to mo. file';         return $mofile;     }      I tried it with relative and absolute paths and with WP_LANG_DIR. Nothing worked. Same here:               add_action('load_textdomain', 'load_custom_language_files_for_my_plugin', 10, 2);          function load_custom_language_files_for_my_plugin($domain, $mofile)     {         if ('all-in-one-event-calendar' === $domain && plugin_dir_path($mofile) === WP_PLUGIN_DIR.'/all-in-one-event-calendar/languages/')         {             load_textdomain('all-in-one-event-calendar', WP_LANG_DIR.'/'.$domain.'-'.get_locale().'.mo');         }     }      Both snipptes seem to be pretty ok. However, the MO file is not loaded. Any help would be appreciated!


title: Custom Post Types in plugins?

text: I've been wondering about this. In most plugins I see now, they look like CPTs but they don't have the 'published' link. They don't serve as post as well. They're just plugins that stays in the dashboard with 'Add New' link in the top of the page and column list and items can be edited when you click 'edit' just like in any other CPT. So I'm wondering if they are CPTs? If so, is there like a tutorial out there about this? I am thinking of creating a plugin for my site and what I want is to build a plugin that I can 'add new items' and the items are saved (and can be edited). And I can call an item via shortcodes. I know how to create CPTs in functions.php and I've been reading about basic plugin creation and stuff. I just can't seem to find a tutorial about what I had just mentioned. Any help would be greatly appreaciated.


title: CPT to installable Plugin

text: I have gotten pretty good at creating CPT's for clients sites, but now would like to take it a step further by making them plugins outside of the theme so when/if they decide to change themes it is one less thing I need to think about. Or maybe it is a really well thought out CPT and want to offer it to others to install on their site through the plugin repo. I was wondering how to do this? I know I need to create the views, but not sure how to register them and make it all come together.


title: How can I remove a site from a network?

text: I have a site inside a multi-site network. I would like to detach it and transform to a separate/independent site. How can I do it?


title: get_terms vs wp_query for pages - results inconsistent

text: I have a situation where a custom post type, with a related custom taxonomy. There are somewhere in the realm of 100 of these posts. The taxonomy associated to it has about 20 terms associated with it. **The goal that lead me to discover this issue was : Get all terms associated with a custom post type, and for each term, produce a list of associated posts. Easy Right?**               $categories = get_terms( 'ourCustomTaxonomy', array('post_type' =>'our_custom_pt', 'posts_per_page' => -1) );      ... then iterate through those terms, and use the term name to run a WP query for posts associated... omits categories / terms entirely in some instances. While something like :               $terms = array();     $allPosts = new Wp_Query(array("post_type" =>"our_custom_pt", "posts_per_page" => -1));     if ($allPosts->have_posts())      {         while ($allPosts->have_posts()) {                 $allPosts->the_post();                 $theseTerms = wp_get_object_terms($post->ID, "custom_tax");                 foreach ($theseTerms as $key => $value) {                         if (is_null($terms[$value->name]))                             {                                 $terms[$value->name] = array();                             }                         array_push($terms[$value->name], $post);                         }                          }             wp_reset_postdata();         }     ksort($terms);      Performs as expected. The Question is This : Why / What Would Cause get_terms() to perform in this manner? Is there a corrupt lookup table or some other missing association? Another way to relate this issue: When you are in the dashboard and select the taxonomy from the Custom Post Type menu interface, wordpress presents a list of terms and a "count" of posts which have the term associated to it. This view will show 0. However, if you goto "view all custom posts", you will see the custom posts in the list, with the terms from the custom taxonomy associated to them. Thanks in advance.


title: Changing max number of blog posts per-page doesn't work

text: I've change my "Setting" > "Posts and comments" > "Show the most" to 20 , but still home page only show 2 posts and go next page's sometimes show 3 or 4 posts , please help. Sorry for bad english !


title: How to change the comment field validation rules

text:
So I've created a comment form and have added my own "Terms and Conditions" field and was hoping you could show me the best way to change the validation rules when submitting a comment as I want to check on the "Terms and Conditions" field.                   comment_form( array(             'label_submit' => __( 'SUBMIT YOUR COMMENT', 'dd_string' ),              'cancel_reply_link' => 'cancel',             'comment_notes_before' => '',             'comment_notes_after' => '',             'title_reply' => __( 'Leave a Comment', 'dd_string' ),             'title_reply_to' => __( 'Reply to %s.', 'dd_string'),             'comment_field' => '
<textarea id="comment" name="comment" placeholder="' . __( 'Comment', 'dd_string' ) . '" aria-required="true"></textarea>
',             'fields' => apply_filters( 'comment_form_default_fields', array(                 'author' => '
<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" placeholder="' . __( 'Name', 'dd_string' ) . ' *" aria-required="true" />
',                 'email' => '
<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30" placeholder="' . __( 'Email', 'dd_string' ) . ' *" aria-required="true" />
',                 'terms' => '
<input id="checkbox" name="checkbox" type="checkbox" />I accept the ' . matthew_the_tac() . '
'              )),         ));


title: Best way to define a database with product codes and back-end support?

text: **First let me explain what my wanted situation is:** I have a WordPress site where I want the Admin to have access to about 10.000 "product keys". These codes will be inserted in a database of some sort (could be the original WP database, however I think a new db would be safer). The user then must be able to go to a specified WP page in the front-end where he can insert the "product key" he got from the package of the item he bought. The "product key" is then checked in the database for previous usage, and if not used before the user van use it to register his purchase. This registration must be done by filling out a couple of fields in the front-end (date of purchase, supplier, etc.) These fields must be updated in the row with the product key. After this is done the admin must be able to search in the back-end for a product key, and can then view the information supplied by the user. **Now my question is, how can I achieve this kind of behaviour in the most convenient way?** I have thought about "Custom Post types", but this feels wrong in this situation. I cannot seem to find the best option for this. Hopefully someone can point me in the right direction!


title: Add item to admin bar as late as possible

text: I have an admin page in my plugin where I want to show a balance figure in the admin bar. This works fine for the most part:               // in the __construct method         add_action('admin_bar_menu', array($this, 'admin_bar_item'), 999);          // the method itself     function admin_bar_item($wp_admin_bar){         $userid = get_current_user_id();         $display = $this->balance($userid);         $args = array(                     'id'    => 'balance',                     'title' => $display,                     'href'  => 'http://mysite.com/my-page/',                     'meta'  => array('class' => 'balance_link')                 );         $wp_admin_bar->add_node($args);     }      The problem comes when the user does something to update their balance on the admin page - using a `<form>` and `$_POST`-ing the update. The admin bar fires too soon meaning that the balance displayed in the admin bar is the balance before the $_POSTed amount is processed. I've tried increasing the priority in the `add_action` hook to 9999999 but it doesn't make any difference. I don't know what else to try. How can I make rendering the admin bar the very last thing to happen?


title: How to remove the Unattached filter on Media Library List?

text: For example, at /wp-admin/upload.php are displayed the following filters by: All (6) | Images (6) | Unattached (6) How can I remove the "Unattached (6)" filter by? Thanks in advance.


title: How to acces the twitter user profile link?

text: I need to access the twitter user profile url, after authentication of each users i wants to take their profile urls. i wants to know that how to do this in wordpress. Is there any plugins available or how to do this feature in wordpress?


title: looping though custom post types and only return results in a given taxonomy

text: I am creating a WordPress theme for a record label. One aspect is the video gallery. I created the gallery using a custom post type called 'videos'. The code below is what I placed in my functions.php file to set up the post type:               add_action( 'init', 'create_my_post_types' );             function create_my_post_types() {          register_post_type( 'videos',             array(                 'labels' => array(                     'name' => __( 'Videos' ),                     'singular_name' => __( 'Video' ),                     'add_new' => 'Add New Video',                     'edit' => 'Edit Video'                 ),                 'public' => true,                 'exclude_from_search' => false,                 'supports' => array( 'title', 'editor', 'thumbnail','page-attributes','excerpt' ),                 'rewrite' => array( 'slug' => 'videos', 'with_front' => false ),                  ));         }      I also created a custom taxonomy called 'artists' so I can assign the artist name to each video I upload.                add_action( 'init', 'create_videos_taxonomies' );              function create_videos_taxonomies() {                  register_taxonomy(                 'artist',                 'videos',                 array(                          'hierarchical' => false,                         'label' => 'Artist',                         'query_var' => true,                         'show_tagcloud' => true,                         'show_ui' => true,                         'rewrite'=>array('slug' => 'artists', 'with_front' => false)                       )                 );             }      At this point, everything works fine on the backend and the video page returns all of the videos successfully. On another area of my website, I have pages for every single artist. On any one of these artist pages, i would like to be able to loop through all of the videos in the custom post type I created, and only return results in a given taxonomy. Below is my code to loop through a custom post type:               <?php $loop = new WP_Query( array( 'post_type' => 'videos', 'post_child' => 0, 'posts_per_page' => 5 ) ); ?>         <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>     <?php the_post_thumbnail( 'video' ); ?>     <?php the_content(); ?>      <?php endwhile; ?>      This successfully loops through the videos, and returns the 5 most recent. I need this to loop through all the videos with a specific taxonomy slug or ID. For instance, I created a taxonomy called 'Smash Palace' and it has a slug of 'smash-palace' and an id of '17'. Any idea how I can loop though this custom post type and only return results in a given taxonomy?


title: Wordpress query by multiple Custom fields and order by date

text: So here is my query:               $args = array(          'post_type' => 'Event',         'posts_per_page' => 1000,         'meta_key' => 'event_informations_show_on_the_homepage',         'meta_value' => 'Show on the homepage',         'meta_compare' => '==',         'meta_key' => 'event_informations_date',         'orderby' => 'meta_value_num',         'order' => 'ASC'     );          $loop = new WP_Query( $args );      I want to select all posts that have the Custom field `event_informations_show_on_the_homepage` and the value of the Custom field `event_informations_show_on_the_homepage` and order by the date Custom field which is stored as a timestamp and is called `event_informations_date`. What am I doing wrong?


title: Show post thumbs in rows instead of columns

text:
I am displaying only thumbs and title on index pages using following code;
         <?php query_posts('cat=22&showposts=2'); ?>     <?php $posts = get_posts('cat=22&numberposts=2&offset=0'); foreach ($posts as $post) : start_wp(); ?>     <?php static $count1 = 0; if ($count1 == "2") { break; } else { ?>     <a href="<?php the_permalink() ?>" rel="<?php _e("bookmark", "solostream"); ?>" title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?>"><?php the_post_thumbnail( 'homepage-thumb' ); ?>
<?php the_title(); ?>
     <?php the_field('price'); ?>

     <?php $count1++; } ?>     <?php endforeach; ?>

             <?php query_posts('cat=22&showposts=2'); ?>     <?php $posts = get_posts('cat=22&numberposts=2&offset=2'); foreach ($posts as $post) : start_wp(); ?>     <?php static $count2 = 0; if ($count2 == "2") { break; } else { ?>     <a href="<?php the_permalink() ?>" rel="<?php _e("bookmark", "solostream"); ?>" title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?>"><?php the_post_thumbnail( 'homepage-thumb' ); ?>
<?php the_title(); ?>
     <?php the_field('price'); ?>

     <?php $count2++; } ?>     <?php endforeach; ?>
      This cause problem when post in some category are less or more than described number of posts in one column. In case of less posts, other columns remain empty so looks odd. I want to show them in rows instead of columns so number of posts should not effect the category pages.


title: wp_query (and post_id) is empty in admin_init

text: I'm developing a plugin and one of the issues I am running into is that I cannot get the post id within a function assigned to the admin_init hook. I tried a few different methods; but, they all seem to use the $wp_query. The ID is not in the URL (SEO URLs). Below is a simple version the code I am using. I implemented the code like this just now and ran it by viewing the "post edit" page               add_action('admin_init','do_optional_featured_article');     function do_optional_featured_article()     {         global $wp_query;         echo "<pre>";         print_r($wp_query);         echo "</pre>";         die();     }      $wp_query is a mostly empty array, notably, the post member is empty Following Webord's advice below, I added this function:               function get_admin_post()     {         if( isset($_GET['post']) )          {             $post_id = absint($_GET['post']); // Always sanitize             $post = get_post( $post_id ); // Post Object, like in the Theme loop             return $post;         }         elseif( isset($_POST['post_ID']) )         {             $post_id = absint($_POST['post_ID']); // Always sanitize             $post = get_post( $post_id ); // Post Object, like in the Theme loop             return $post;         }         else          {             return false;         }     }      Thanks Webord!!


title: How to Create an Image Upload Box for Custom Posts?

text: Is it possible to have an image upload box in a Custom Post Type? I would like the user to be able to upload specific images just for the CPT.


title: Hide main div if wp_nav_menu is empty

text:
I want to hide the div class "navmain2" if the menu is empty. See code below:

                                                <?php wp_nav_menu( array(                 'menu' => 11,                 'container' =>false,                 'menu_class' => 'nav',                 'echo' => true,                 'before' => '',                  'after' => '',                  'link_before' => '',                  'link_after' => '',                  'depth' => 0,                 'walker' => new description_walker())                  );?>
Click here! Click here! Click here

-->      I have a logo and a div with text inside **navmain2** as you can see. _The question is:_ **Is it possible to hide the whole navmain2 div if the wp_nav_menu is empty?**


title: Can't Access Constant from within Included File

text: First of all, I'm completely sure I'm being an idiot on this one - but an hour of scratching my head and searching this site has still left me perplexed. I'm trying to access a constant that's defined within the constructor of my plugin in an included file. The file is included in a function that's hooked to the wp_footer action:               class className {     function className () {         $this->__construct();     }          function __construct() {         DEFINE('IMPACTMENU_IMAGES', WP_PLUGIN_URL . '/impactmenu/images');          DEFINE('IMPACTMENU_TEMPLATES', WP_PLUGIN_URL . '/impactmenu/templates');              add_action('wp_footer', array($this, 'impact_menu_html'));     }           function impact_menu_html() {         ob_start();         include(IMPACTMENU_TEMPLATES . '/template.php');         $im_footer = ob_get_contents();         ob_end_clean();         echo $im_footer;        }     }      And in the template.php file:               echo IMPACTMENU_IMAGES;      I'm expecting the output to be the path to the images directory, but the output is actually simply "IMPACTMENU_IMAGES". Any help on this would be greatly appreciated!


title: highlight parent page menu item when in custom post type

text: in a website that I am building I have a portfolio custom post types (called: "project") to show my portfolio items. The page that holds the loop of the custom post type is a custom page called " **Portfolio** " this page has only thumbnails and each thumbnail is linking to a custom post type: http://www.tipoos.com/new/?page_id=43 notice when inside the portfolio page above the upper menu is highlighting the current page like other pages in the site. when entering a post type (clicking on one of the portfolio items) I would like the upper menu "portfolio" to stay highlighted as we are still in the portfolio section but it doesn't work: http://www.tipoos.com/new/?project=my- babys-beat I understand why it doesn't work but I can't find a solution how to keep it highlighted when inside a custom post type. would love to have a solution Thanks Gil


title: How do I add a new custom post format?

text: How do I add a new custom format while making a post in WordPress?   The default formats are standard, aside, image, gallery... I want to add a new format of 'xyz' name. How can I do it?


title: Shortcode from a widget is wrapped in unwanted <p> element

text:
I'm using Black Studio TinyMCE Widget as a rich text editor widget. In a sidebar I inserted the TinyMCE widget with a `[testimonial]` shortcode and some content after it. For example:               [testimonial]          Read more client testimonials (as a link)      When I switch to the HTML tab of that widget I've got the following:
[testimonial]

Read more client testimonials
      The shorcode simply displaying a random `Testimonial` CPT post:               add_shortcode("testimonial", "dlma_testimonial_shortcode");     function dlma_testimonial_shortcode($atts, $content = null){         $args = array(             'post_type' => 'testimonial',             'post_status' => 'publish',             'posts_per_page' => '1',             'orderby' => 'rand'         );         $testimonial = new WP_Query($args);              if($testimonial){             return apply_filters('the_content', $testimonial->posts[0]->post_content);         }         return "";     }      However, when I view a page, stray `<p>` elements are inserted:   **Edited thanks to Tom J Nowell**

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vestibulum velit convallis sem pulvinar vitae lobortis metus varius.” Person name, Person job

         Read more client testimonials

      The `[testimonial]` shortcode got expanded correctly, however, as it was originally wrapped into `<p>` element in the widget it still appears to be wrapped in it. I have tried deleting the `<p>` element from the widget HTML tab view, however, whenever the Save button is clicked the `<p>` element is inserted again. I've tried to remove unwanted `<p>` element that wraps the shortcode with the `the_content` filter as following:               remove_filter( 'the_content', 'wpautop' );     add_filter( 'the_content', 'wpautop' , 12);      That didn't work. I'm guessing I've got the flow wrong of processing the content of a widget with a shortcode in it. I'm very confused now. How can I remove unwanted `<p>` elements that wrap shortcodes? I would hugely appreciate any help! Many thanks.


title: custom field output after the_content

text:
What I want to do is output a custom field content (which is a button with a dynamic link that's being inserted in the value of the custom field of each posts) right after the_content and before the plugins. This is the code for the custom field:
       <a href="<?php echo get_post_meta($post->ID, 'Button', true); ?>">         <img src="<?php echo get_template_directory_uri() . '/images/button.png'; ?>" alt="link" />
      On wordpress codex I also found this example of how to apply a filter to the_content in order to obtain something similar to what I want. This is the code:               add_filter( 'the_content', 'my_the_content_filter', 20 );          /**     * Add a icon to the beginning of every post page.     *     * @uses is_single()     */     function my_the_content_filter( $content ) {     if ( is_single() )         // Add image to the beginning of each page         $content = sprintf(             '%s',             get_bloginfo( 'stylesheet_directory' ),             $content         );          // Returns the content.     return $content;     }      The problem is I don't know PHP and I have no idea how am I supposed to edit the above code to apply on my specific case.


title: Accessing WordPress MySQL Database via Data Connection in Visual Studio 2010 using C#

text: So I've Googled and followed countless tutorials, read documentation on MySQL, Visual Studio, WordPress, and Plesk. I try to leave posting on this site as the final option and it seems it has come to that. As simply put as possible, I want to display the list of categories from my WordPress blog on another ASP.NET/C# website that I have. There isn't an RSS of the names of the categories specifically otherwise I would have used the XML from the RSS feed with XSLT to display the category list that way. I came to the conclusion that I had to access my WordPress database (where the category names are stored) directly from my other website. To do so, I've downloaded and installed the MySQL Connector Net 6.5.4 on my localmachine (C: Drive) allowing the "MySQL Database" option to be available when adding a Data Connection in Visual Studio. I also, downloaded the 'noinstall' of the MySQL Connector Net 6.5.4 by selecting ".NET & MONO" from the "Select Platform:" dropdown on MySql.com in order to add a reference to the DLL in my C# code. I get the same error when either attempting to run the code or adding a data connection. Adding the data connection was originally to test the actual connection to the database after I got the error from running the code. Error: "Unable to connect to any of the specified MySQL hosts." Below is the code I have in my 'Default.aspx.cs' file:               ...     using MySql.Data.MySqlClient;          public partial class Default : System.Web.UI.Page     {         protected void Page_Load(object sender, EventArgs e)         {     ...             String MyConnectionString = "SERVER=localhost;UID=testusername;PASSWORD=testpassword;DATABASE=testdbname;";             MySqlConnection connection = new MySqlConnection(MyConnectionString);             MySqlCommand command = connection.CreateCommand();             command.CommandText = "SELECT * FROM wp_terms wt " +                           "INNER JOIN wp_term_taxonomy wtt ON wt.term_id=wtt.term_id " +                           "WHERE wtt.taxonomy='category' ORDER BY wt.name";             try             {                 connection.Open();             }             catch (Exception ex)             {                 Console.WriteLine(ex.Message);             }             MySqlDataReader Reader = command.ExecuteReader();             while (Reader.Read())             {                 string thisrow = "";                 for (int i = 0; i < Reader.FieldCount; i++)                 {                     thisrow += Reader.GetValue(i).ToString() + ",";                     Label1.Text += thisrow;                 }             }             connection.Close();         }     }      At this point, I am convinced that the problem lies with the credentials that I am entering in String MyConnectionString = "SERVER=localhost;UID=testusername;PASSWORD=testpassword;DATABASE=testdbname;"; or when attempting to 'Add a Data Connection'. However, I checked the wp- config.php file within my WordPress installation in the blog's root directory and am, therefore, positive that I am providing the correct credentials. The only one I am slightly unsure of is the Database server name [localhost]. Is there something else I am not doing correctly? Is it possible the WordPress databases don't allow for remote access? Any help would be greatly appreciated! Thank you in advance! P.S. I've posted this question on Stack Overflow as well.


title: Allow Administrator role access to custom capabilities

text: I'm currently developing a Wordpress business directory plugin with a 'business' custom post type. I have it creating a custom 'business_author' user role on activation and assigning specific capabilities to that role but it seems to be restricting the 'Administrator' role from accessing the 'business' custom post type. I've tried adding the capabilities to the 'Administrator' role when the plugin is activated but it doesn't seem to work. p.s I'm using the 'map_meta_cap' filter to create custom capabilities for this post type. Code example below...               register_activation_hook( __FILE__, 'tis_business_activation' );     register_deactivation_hook( __FILE__, 'tis_business_deactivation' );          function tis_business_activation() {         add_role('business_author', 'Business Listing Author', array(             'publish_businesses' => false,             'edit_businesses' => true,             'edit_others_busineses' => false,             'delete_businesses' => true,             'delete_others_businesess' => false,             'read_private_businesses' => false,             'edit_business' => true,             'delete_business' => true,             'read_business' => true,             'read' => true,             'upload_files' => true         ));     //Attempting to add above capabilities to administrator role.         $administrator = get_role('administrator');         $administrator->add_cap('publish_business');         $administrator->add_cap('edit_business');         $administrator->add_cap('edit_others_businesses');         $administrator->add_cap('delete_businesses');         $administrator->add_cap('delete_others_businesses');         $administrator->add_cap('read_private_businesses');         $administrator->add_cap('edit_business');         $administrator->add_cap('delete_business');         $administrator->add_cap('read_business');     }          function tis_business_deactivation() {         remove_role('business_author');         global $wp_roles;         $wp_roles->remove_cap('administrator', 'publish_business');         $wp_roles->remove_cap('administrator', 'edit_business');         $wp_roles->remove_cap('administrator', 'edit_others_businesses');         $wp_roles->remove_cap('administrator', 'delete_businesses');         $wp_roles->remove_cap('administrator', 'delete_others_businesses');         $wp_roles->remove_cap('administrator', 'read_private_businesses');         $wp_roles->remove_cap('administrator', 'edit_business');         $wp_roles->remove_cap('administrator', 'delete_business');         $wp_roles->remove_cap('administrator', 'read_business');     }      Any help would be amazing I'm really stuck with this one. Sorry if this has already been answered, I searched high and low for an answer but couldn't find one.


title: My contact form - I've changed the source code but the changes are not being applied

text: I obviously found the file responsible of displaying the contact form with `FireBug`, changed the displayed names in the input area and then re-upload my file, however, nothing was changed. The input value of the first area was `your name`, i changed it to `votre nom`, but still displying me `your name`. You can check it in this url, you can use FireBug to check this. Here is a sceenshot, and I'm use the _Boldy_ theme: ![Screenshot of form and firebug](http://i.stack.imgur.com/kWosF.png)


title: CSS in child theme not overriding the parent theme

text: I am trying to make a child theme for a premium template. My css isn't overriding the parent though. I'm trying to figure out what's going on. Other than important the parent theme's css, is there anything else I need to import into the child theme folder? Right now there is just style.css. The site is http://wpdallas.com/test/


title: How to make 2 tag feeds show up on 1 page?

text: I'm looking to create a page within my site that looks like this: **Tag/Category: News**   News Post a   News Post b   News Post c **Tag/Category: Events**   Event a   Event b   Event c I'm new to Wordpress. I may not have the wordpress jargon to ask this correctly. Thanks for your help.


title: Add_query_arg + two times the same argument?

text: I'am trying to filter my archive page by clicking links. When clicked they execute the add_query_arg command. Everything works fine so far. But now i want to add combinations within the same custom taxonomy. ex: http://url.com/archive/ '?events=test&events=test2' now the question, how to add two times the same argument with add_query_arg without overwriting the first one ? And how to get them again ? Hope someone can help me out here. Best regards


title: Remove wrapping div and ul from output of wp_nav_menu

text:
I am using the new menu system of Wordpress, and here is the result of wp_nav_menu()

Trang nhà

Blog

Giới thiệu

      What I want is only this:
Trang nhà

Blog

Giới thiệu
      No, wrapping div or ul, I have been trying to few ways and google around but no result :(


title: Options for restricting access to wp-admin

text: So i've installed a plug-in which allows me to enable two-factor authentication for my users. The problem is that to enable the plug-in i have to log in as that user and enable it via their profile page (wp-admin). This isn't a problem except for the fact that there's nothing stopping the users from logging in and disabling the two factor authentication which is an issue. I've looked around at a few issues and none have seemed to work, essentially i want restrict backend access to only a select few (myself and few others). I've tried stealth login and a few some htaccess solutions and none have seemed to work. Any ideas?


title: Change ordering of fields of custom post type in admin page

text: I have a custom post type and am placing in custom meta boxes. How do I change the ordering of the fields of a custom page in the admin? For example, I have a custom field called subtitle.   How do I place this between the title and description rich textbox in the admin of the custom post type page?


title: Show tarifs page with menu a or b depending on menu of origin

text: I have a site with three menus, one per main category of the site. I use pages only. Two main categories have one page in common.   * Category A with menu a   * Category B - with menu b - with tarifs page   * Category C - with menu c - with tarifs page That tarifs page has to be shown with the proper menu depending on what menu the tarif page was asked from. I tried giving the page the template for main category A realizing I couldn't do that as it would show the wrong menu when it would be picked from the other main category with the same page - category B. Is there a way to show menu a or b for the tarifs page depending on the menu the user came from? I would be very happy if I could create a tarifs template that could do this. Update: `$_SERVER['HTTP_REFERER']` could be used to determine page / url of origin using HTTP_REFERRER. I found http://stackoverflow.com/questions/4909443/using- php-serverhttp-referer-to-display-custom-welcome-messages-content mentioning using strpos and HTTP_REFERRER to check for url of origin. Only wish there would be a nicer way to check for template chosen (body class) and then echo code x


title: Making a Contact Form 7 calendar entry "required"

text: I'm using the Contact Form 7 Calendar "plugin plugin", but I can't figure out how to make the date field required. The syntax is `[datetimepicker your- label]`, and in the parent plugin (Contact Form 7), you would just put an asterisk in, like `[datetimepicker* your-label]` but this doesn't work with the calendar widget... Of course, I could always style it in CSS to appear as if its required, but I kinda need the validation there. I've looked in the plugin's documentation, but this isn't covered, and the author is not responding on the WP Support Forums. Has anyone used the Calendar add-on and been able to make the date field required? Anything I can do to tweak the javascript or whatever is used for validation -- I'm assuming its javascript (I'm sure js is very easy but I've never managed to find the time to learn it)? Or the php (I'm much more comfortable in php), but without breaking on plugin updates...


title: How to translate a plugin via .po .mo?

text: I want to translate this plugin. This plugin already has translations to some languages, and it has .pot file for adding new languages (as far as I understood from description). Although I never had an experience to work with .po .mo   So I wonder what are the main points. How to create .po .mo files and how to define that the plugin will talk a certain language, I tried to define for examble russian language, but did not find where to do this [I tried to insert `define ('WPLANG', 'ru_RU');` in wp-config.php but it does not help].


title: Wordpress Admin: open popup window on a custom button

text: I am using custom meta box in wordpress post page. this box contains a custom Copy button. Now, I want to open a popup window on clicking 'copy' button. Also I need to show content of parent window in this popup.


title: Listing of all uploaded files in network sites

text: Can I list all files uploaded by users in Network sites? In Multisite each user can manage their files with their own blog but the Super admin can't monitor all the uploaded files...how can i do that?


title: query recent posts from several categories

text: i'd like to list my 10 most recent posts but from certain categories only - anyone can tell me how to do this? thanks


title: creating wp query with posts with specific category

text: Im running a specific wp_query to show the thumbnails in a slider of a specific category.               <?php $the_query = new WP_Query ('showposts=2', 'category_name=Events'); ?>      This doesnt appear to be working, am i missing array at the beginning somewhere               <?php $the_query = new WP_Query array('showposts=2', 'category_name=Events'); ?>      the above seemed to crash it. Any advice would be great.


title: The requested URL was not found on this server

text: I'm running wordpress locally on 127.0.0.1 on mac osx lion. All links work fine. Problem is when I add pages, and set permalinks to the page, and then associate the page with one of my template themes, as shown in this link below: http://i49.tinypic.com/xdfjfp.jpg I get this: Not Found The requested URL /gps-products was not found on this server. Now I have the same code (including the htaccess file) and same database on two different macs running lion, and it works fine on one but not the other, so I believe the issue is related to the apache configuration.


title: Page template across themes

text: Is it possible to make a page template available to multiple or all themes without having to save the page template in every single theme folder? Maybe something like: `themes/globalform.php` instead of doing this for each theme `themes/twentyten/globalform.php`


title: paginate_links() with Custom Taxonomy

text:
I have a custom taxonomy that is pulling in a list of posts assosciated with it. Previously - in the `$posts_args` array, I set the `post_per_page` option to `-1` but realized pagination should be added to do the large amount of media that will be present with each post. I read over paginate_links() (and added their example in my query below), but have not had any luck thus-far parsing out the posts as needed. Right now - `posts_per_page` is set to `2` in the general `WordPress > Reading` settings (which works - only 2 posts are shown on the page) and the `paginate_links()` function call does in-fact generate the amount of pages needed based on the posts per page and the total number of posts, but when I do go to the secondary pages (like /page/2) the same posts are shown that are on the first page. Any suggestions on what I may be missing? Thanks!               $post_args = array(         'post_type' => 'moulding_profiles',         'meta_key' => '_mouldings_dimensions_height',         'orderby' => 'meta_value_num',         'order' => 'ASC',         'tax_query' => array(                 array(                     'taxonomy' => $taxfunc_tax_name,                     'field' => 'id',                     'include_children' => 0,                     'terms' => $term_id                 )             )     );     $posts_query = new WP_Query($post_args);     $i = 0; // count     $total_items = $posts_query->post_count; // total profiles     $number_columns = $mouldings_options['profile_item_columns']; // number of columns     if ($posts_query->have_posts() ) {              // Filter function         mouldings_profile_list_before();              echo '
';         while($posts_query->have_posts() && ($i < $total_items)) { ?>             <?php $posts_query->the_post(); if ($i % $number_columns == 0) echo ($i > 0 ? '

' : '
'); ?>             <div class="<?php echo 'width'.intval(100 / $number_columns); ?> <?php if ($i % $number_columns == 0) echo 'first-item'; ?>">                 <?php                     moulding_profile_teaser($profile_ID = get_the_ID());                 ?>
         <?php $i++;         }         echo '
';         echo '
';              mouldings_profile_list_after();              $big = 999999999; // need an unlikely integer         echo paginate_links( array(             'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),             'format' => '?paged=%#%',             'current' => max( 1, get_query_var('paged') ),             'total' => $posts_query->max_num_pages         ) );     }     wp_reset_query();


title: update_post_meta does not work

text: I have meta box in my custom post type where I receive data from a front end form. The issue is that somewhere in this functions, something goes wrong and the data changed in admin edit panel does not apply to the post (update_post_meta does not get his job done I guess) Here is my code:                  // HANDLER FOR THE FORM AND SAVING THE RIGHT DATA     <?php elseif(isset($_POST['test'])){           $location = $_POST['_location'];          $new_post = array(             'post_title'    =>   $_POST['title'],             'post_content'  =>   $_POST['description'],             'post_status'   =>   'pending',                       'post_type' =>   'eventstest'                    );                  $pid = wp_insert_post($new_post);                  add_post_meta($pid, 'location', $location, true);     }          do_action('save_post', 'eg_save_events_meta', 1, 2); // save the custom fields     do_action('wp_insert_post', 'wp_insert_post');                // ADD THE META BOX     function add_events_metaboxes() {         add_meta_box('wpt_events_location', 'Event Location', 'wpt_events_location', 'eventstest', 'side', 'default');}          //DISPLAING META BOXES     function wpt_events_location() {      global $post;          echo '<input type="hidden" name="eventmeta_noncename" id="eventmeta_noncename" value="' .      wp_create_nonce( plugin_basename(__FILE__) ) . '" />';          $_location = get_post_meta($post->ID, 'location', true);          echo '<input type="text" name="_location" value="' . $_location  . '" />';}               //SAVING AND UPDATE META FIELDS     function eg_save_events_location( $post_id ){          if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )          return;     if ( !wp_verify_nonce( $_POST['myplugin_noncename'], plugin_basename( __FILE__ ) ) )         return;     if ( 'page' == $_POST['post_type'] )      {         if ( !current_user_can( 'edit_page', $post_id ) )         return;     }     else     {         if ( !current_user_can( 'edit_post', $post_id ) )         return;     }          $mydata = $_POST['_location'];     update_post_meta($post->ID, 'location', $mydata);}          add_action('save_post', 'eg_save_events_location', 1, 2); // save the custom fields once again in functions.php too


title: Custom Fields to Category edit page, then displaying them in a template correctly

text:
Seem to be having a few issues with this project lately so sorry for spamming questions! I needed to give the category edit page in the admin a few additional fields to allow my client to manage them better. The extra fields I added are 'Category Features' and 'Category Applications' and the following code seems to be working as expected:               // Add custom fields to category edit pages     // the option name     define('Category_Extras', 'Category_Extras_option');          // your fields (the form)     add_filter('edit_category_form', 'Category_Extras');     function Category_Extras($tag) {         $tag_extra_fields = get_option(Category_Extras);                        ?>

                 Category Features	                 <textarea style="width: 97%;" cols="50" rows="5" name="Category_Extras_Features" id="Category_Extras_Features" class="tinymce"><?php  echo $tag_extra_fields[$tag->term_id]['Category_Extras_Features']; ?></textarea>
This isn't applicable to all categories but allows additional information to be displayed on a category page.

                 Category Applications	                 <textarea style="width: 97%;" cols="50" rows="5" name="Category_Extras_Applications" id="Category_Extras_Applications" class="Category_Extras_Features"><?php  echo $tag_extra_fields[$tag->term_id]['Category_Extras_Applications']; ?></textarea>
This isn't applicable to all categories but allows additional information to be displayed on a category page.

                        <?php     }               // when the form gets submitted, and the category gets updated (in your case the option will get updated with the values of your custom fields above     add_filter('edited_terms', 'update_Category_Extras');     function update_Category_Extras($term_id) {       if($_POST['taxonomy'] == 'category'):         $tag_extra_fields = get_option(Category_Extras);         $tag_extra_fields[$term_id]['Category_Extras_Features'] = strip_tags($_POST['Category_Extras_Features']);         $tag_extra_fields[$term_id]['Category_Extras_Applications'] = strip_tags($_POST['Category_Extras_Applications']);         update_option(Category_Extras, $tag_extra_fields);       endif;     }               // when a category is removed     add_filter('deleted_term_taxonomy', 'remove_Category_Extras');     function remove_Category_Extras($term_id) {       if($_POST['taxonomy'] == 'category'):         $tag_extra_fields = get_option(Category_Extras);         unset($tag_extra_fields[$term_id]);         update_option(Category_Extras, $tag_extra_fields);       endif;     }      I'm echo'ing this out on the page as follows:               <?php $prod_features = get_option(Category_Extras); foreach($prod_features as $feature) { echo $feature['Category_Extras_Features']; } ?>      However, obviously its echoing out all the options for all the categories. Is there a different finction which would allow me to echo out the 'Category Features' for the current category? (this code is being displayed on the category.php page) As always I'd really appreciate your help :-) Thanks Dave


title: Creating Custom wp_dropdown_categories

text: I have been working for many days on this. I want to assigned category to author. I have googled, found some tips and plugins but doesn't work with Wordpress 3.1. I just come up with my own idea. I as admin will create a category for an author than define or put category slug name in their respective profile meta field. I am using a Custom Post type name 'networks and taxonomy = blogs Now I am trying to include only the profile meta field value (I said above) in the wp dropdown categories as default and hide it in my custom posting form. The cat ID and Name are correct when I echo it but it does not include in the drop list. Can anyone help me?               <?php     global $current_user;          get_currentuserinfo();          $authorcategory = get_the_author_meta('authorcategory', $current_user->ID);     $myterm = get_term_by( 'slug', $authorcategory, 'blogs');          if ( is_term( $authorcategory, 'blogs' && $authorcategory == $myterm ) ) {         $my_cat_id = get_cat_id($authorcategory);         $my_cat_name = get_cat_name($my_cat_id);         $args = array(             'orderby' => 'name',             'order' => 'ASC',             'show_last_update' => 0,             'style' => 'list',             'show_count' => 0,             'hide_empty' => 0,             'include' => $my_cat_name,             'hierarchical' => true,             'title_li' => __( 'Categories' ),             'show_option_none' => __('No categories'),             'number' => NULL,             'taxonomy' => 'blogs'         );         wp_dropdown_categories($args);      }      ?>


title: How to get comments other than using wp_list_comments?

text: I'm sure you guys are wondering, "why the hell?" - basically it is because it does not work with a plugin by NextSCRIPTS that pulls comments from facebook. When I'm in the admin panel I see the comments properly, but on the blog posts it just keeps showing the admin instead of the users. This happened after updating to 3.6, NextSCRIPTS told me they are aware of this issue but it has been one month and we have over 8,000 comments and I'd like to find a work around. So really, you don't need any code from me, just please if anyone knows, can you share how to grab the comments without using wp_list_comments? there has to be another way. Thanks, Matt


title: How to display a sidebar only for blog?

text: I have 2 sidebars(primary and secondary). I want the secondary sidebar to display only on the blog page and primary sidebar to display everywhere else except for the blog page. What have I tried: In functions.php :               if (is_page('blog-35')) {         get_sidebar('secondary');     } else {         get_sidebar('primary');     }      Unfortunately this doesn't work. Any hints on how to debug this? I don't understand what am I doing wrong in the code above.(blog-35 is the body class of the page I want to display only the secondary sidebar)


title: Problem with Comment link in Blog

text:
I have all the settings setup to allow comments on my Blog postings. However, when you click on the link to post a comment nothing happens. Attached is my comments.php file Also the site is www.djjigs.com Thanks in Advance!               <?php if ( have_comments() ) : ?>
             <?php comments_number(__('No Comments', 'stylico'), __('1 Comment', 'stylico'), __('% Comments', 'stylico')); ?>
         <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
<?php _e( 'Comment navigation', 'stylico' ); ?>

<?php previous_comments_link( __( '← Older Comments', 'stylico') ); ?>

<?php next_comments_link( __( 'Newer Comments →', 'stylico') ); ?>
                  <?php endif; ?>
             <?php wp_list_comments( 'callback=stylico_comment' ); ?>
              <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
<?php _e( 'Comment navigation', 'stylico'); ?>

<?php previous_comments_link( __( '← Older Comments', 'stylico') ); ?>

<?php next_comments_link( __( 'Newer Comments →', 'stylico') ); ?>
                  <?php endif; ?>          <?php         elseif ( ! comments_open() && ! is_page() && post_type_supports( get_post_type(), 'comments' ) ) :     ?>
<?php _e( 'Comments are closed.', 'stylico'); ?>
          <?php endif; ?>          <?php comment_form( array( 'comment_notes_after'  => '', 'label_submit' => __('Send Comment', 'stylico') ) ); ?>


title: Do we have In_category like function for tags?

text: I have been using "if (is_single() && in_category('keyword') )" to display custom links on the sidebar. I was wondering if we have in_tag or any similar function for tags?


title: Changes in widget customizer not triggering 'save and publish'

text:
I'm making some of our widgets customiser friendly, so they work on the customise page and support widget previews. Usually when you update a widget the save button becomes usable and changes to 'save and publish'. However, I'm using some javascript (token input http://loopj.com/jquery- tokeninput/) on the widget text input, so people can select from a list of options in a nice way. The problem is updates to this field don't trigger the option to save and publish, so there's no way of saving the changes. Does anyone have any ideas? The basic form field is:               <input name="the_token_input" id="" class="the_token_input" value="This will be the token input" />       Once you intialise the javascript token input on it a completely new element is created that takes on the input's role, something like this:

Choice 1

Choice 2

Choice 3

      Once you make a change it doesn't affect the original input field, so I'm guessing that's why the page doesn't think anything's been changed...


title: find a random blogid across my multisite network that has at least one post published

text:
I need to find a random blog across my multisite network that has at least one post published of a certain post_type, and return its blogid as a variable so I can use it in a `switch_to_blog()` call. I need to figure out how to build the $randomblog variable in this scenario (I know the current SQL query is bogus):               // Find a random blog that has at least one post of post_type published and return its blogid as $randomblog     $randomblog = $wpdb->get_results($wpdb->prepare("SELECT (1 random blogid) FROM $wpdb->blogs WHERE at least 1 of post_type = 'special' exists "));          // Switch to the random blog         switch_to_blog($randomblog);                  (do some fun stuff)              // Switch back to the current blog         restore_current_blog();      I'm not sure, but I believe this bit of code I found could possibly be altered to do what I need. Just not sure how:               global $wpdb;     global $table_prefix;          // get an array of the table names that our posts will be in     // we do this by first getting all of our blog ids and then forming the name of the      // table and putting it into an array     $rows = $wpdb->get_results( "SELECT blog_id from $wpdb->blogs WHERE         public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0';" );     if ( $rows ) :     $blogPostTableNames = array();     foreach ( $rows as $row ) :         $blogPostTableNames[$row->blog_id] = $wpdb->get_blog_prefix( $row->blog_id ) . 'posts';     endforeach;          // now we need to do a query to get all the posts from all our blogs     // ordered by the number of comments and with limits applied     if ( count( $blogPostTableNames ) > 0 ) :         $query = '';         $i = 0;         foreach ( $blogPostTableNames as $blogId => $tableName ) :             if ( $i > 0 ) :                 $query.= ' UNION ';             endif;             $query.= " SELECT ID, post_type, $blogId as `blog_id` FROM $tableName WHERE post_type = 'prompt' AND post_status = 'publish' ";             $i++;         endforeach;              $rows = $wpdb->get_results( $query );              // now we need to get each of our posts into an array and return them         if ( $rows ) :             $posts = array();             foreach ( $rows as $row ) :                 $posts[] = get_blog_post( $row->blog_id, $row->ID );             endforeach;             print_r($posts);             return $posts;             echo ('

');         endif;     endif;     endif;


title: How to feed custom post type to a facebook page?

text: I built my portfolio using custom post type. Later I created a Facebook page for my website under my FB account. Please advice how I can push from WP my work to FB.   * Image   * project description No One of plugins helped me to push custom posts to FB page. The plugins I tried:   * Facebook - http://wordpress.org/extend/plugins/facebook/   * Facebook Page Publish - http://wordpress.org/extend/plugins/facebook-page-publish/   * WPBook I followed the developers instructions. The plugins seems to work on WordPress side only. Thanks in advance, Marc


title: Keep HTML format when switching from Visual to HTML editor

text: I've been looking around for a solution that will allow me to edit HTML code and have it remain after a switch to the Visual editor and back. I've tried a bunch of things with no luck:   * the wp-no-format plugin   * the Raw HTML plugin   * entering all my HTML on one line If it were just me managing the content, I would disable the Visual editor. But as I have a number of content managers, and pages on which there is HTML (forms, for example) and content that they need to edit, that's no an option. Any suggestions will be greatly appreciated.