Where should I put "run once" plugin pages?

Where should I put an administration page that should only be used once? I am creating a plugin that will index all used HTML tags in your posts, so you can cleanup posts if you change themes and want to replace old incorrect `<font>` tags with headers or other semantic markup. When you install this plugin it should scan your old posts once to fill up the index (custom taxonomy). I don't want to do this on plugin installation because it might take a long time if you have many posts, and thus a separate page with an AJAX-approach to transform batches of posts might be better. It's probably nitpicking, but should I put this extra page in the menu (under _Tools_?) and just leave it there, or should a use a trick to only display it when needed? Via a link in the plugin actions, or maybe a DB setting that you can use to hide the menu item? The plugin should remain installed (because it updates on post inserts and edits), and maybe sometimes you want a rescan (if you did a bulk change via the database). As plugin users, does it bother you to have menu options that you almost never use?


How can I convert everything from category X to have post format Link

My "links" come in from Windows Live Writer, from a perl based delicious sync directly to the database and who knows where from. They all have in common that the category is 'Daily-Links'. So I think I will schedule a cron that every day checks for all posts in the category 'Daily Links' and then adds the post format type 'format-link' to it. (since e.g. WLW does not support 'post formats') Or is there a better approach? I wanted to kick this off by running a SQL query since it are probably hunderds of posts (for each object_id,term_taxonomy_id pair which has not already term_taxonomy_id=(id of format-link) AND which has the term_taxonomy_id of (the specific category) DO add the term_taxonomy_id of the format-link) But... maybe there is already a WP function call for this? Is there?


troubles with get_post_meta (and saving it)

im having trouble using "add post meta" and "get post meta" : i have a new meta box in my taxonomy : i always have the value "empty meta" inside the input field, even after i enter anything : like 'banana' , i publish the article, and same thing : inside the field there is one more time "empty meta" ... (is it a problem with $post->id? i never really know if $post will be 'understood' depending how it is used)               /* Prints the box content */         function myplugin_inner_custom_box() {             // Use nonce for verification             wp_nonce_field( plugin_basename( __FILE__ ), 'myplugin_noncename' );             $met = get_post_meta($post->ID, 'champ', true)? get_post_meta($post->ID, 'champ', true) : 'empty meta';                  /* input */             echo '';             _e("Description field : ", 'myplugin_textdomain' );             echo ' ';             echo '<input type="text" id="champ" name="champ" value="'.$met.'" />';      also, i tried to make the meta appear in my page, so i put :               <?php     if ( get_post_meta($post->ID, 'champ_key', true) ) {     $meta = get_post_meta($post->ID, "champ_key", true );     } else {     $meta = 'allo';     }     ?>      but nothing appears on the page. Do you know how i could go ahead with those post meta? Thanks **EDIT** here's the complete code : if somebody could try it, i might doing something wrong, but i can't find out what. (the whole code is inside a widget page)               /*      *      * add meta box : habillage      *      */     add_action( 'add_meta_boxes', 'myplugin_add_custom_box' );     add_action( 'save_post', 'myplugin_save_postdata' );          /* Adds a box to the main column on the Post and Page edit screens */     function myplugin_add_custom_box() {     add_meta_box(         'test1',         __( 'My test1', 'myplugin_textdomain' ),         'myplugin_inner_custom_box',         'post'     );     add_meta_box(         'test2',         __( 'My test2', 'myplugin_textdomain' ),         'myplugin_inner_custom_box',         'movies'     );     }               /* Prints the box content */     function myplugin_inner_custom_box() {     global $post;     // Use nonce for verification     wp_nonce_field( plugin_basename( __FILE__ ), 'myplugin_noncename' );     $met = get_post_meta($post->ID, 'champ', true)? get_post_meta($post->ID, 'champ', true) : 'empty meta';              /* input */     echo '';     _e("Description field : ", 'myplugin_textdomain' );     echo ' ';     echo '<input type="text" id="champ" name="champ" value="'.$met.'" />';                         /* select list */     echo '';     _e("Description for this field", 'myplugin_textdomain' );     echo ' ';     echo '<select name="my_list_field" id="my_list_field">';          print_r ($post->ID);          global $post;          $s_query = new WP_Query( array(     'suppress_filters' => false,     'post_type' => 'movies'));     while($s_query->have_posts()):$s_query->the_post();              $sname = $post->post_title;         $s_output2 ='';         $s_output2 .= '<option value="'.$post->ID.'" >';         $s_output2 .= $post->post_title.' : allo';         $s_output2 .= '</option>';         echo $s_output2;          endwhile ;     echo '</select>';     wp_reset_query();     }               /* When the post is saved, saves our custom data */     function myplugin_save_postdata( $post_id ) {       // verify if this is an auto save routine.       // If it is our form has not been submitted, so we dont want to do anything       if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )           return;            // verify this came from the our screen and with proper authorization,       // because save_post can be triggered at other times       if ( !wp_verify_nonce( $_POST['myplugin_noncename'], plugin_basename( __FILE__ ) ) )       return;            // Check permissions       if ( 'page' == $_POST['post_type'] )       {         if ( !current_user_can( 'edit_page', $post_id ) )         return;       }       else       {         if ( !current_user_can( 'edit_post', $post_id ) )             return;       }       // OK, we're authenticated: we need to find and save the data       //$mydata = $_POST['myplugin_new_field'];       // Do something with $mydata       // probably using add_post_meta(), update_post_meta()       add_post_meta($post->ID, "champ_key", 'banana');          return $post_id;     //return $mydata;     }     ?>


how to config the home page locally

I am new to wordpress and apache. Following the introduction i found from google, i installed the apache(2.2.17)+mysql(5.5.11)+php(5.2.17)+wordpress(3.1.1) successfully on my PC. But when I login with the right user name and password, it just go into the wp-admin directory but not the homepage. I guess I missed some configurations of the apache server or something else. Could anyone can help on this, or give a link. thanks for help.


Conditional hook based on the core function that is calling it

In a Multisite, I'm applying the filter `get_blogs_of_user` to sort the "My Sites" admin bar menu, where the sites are listed by **`blogname`** : ![admin bar multisite my-sites](http://i.stack.imgur.com/KCjM1.png) What happens is that I'd like another order elsewhere, where the sites are listed by **`domain`**.   For example, the sites that appear in the Users screen (`/wp- admin/network/users.php`): ![user sites](http://i.stack.imgur.com/K8FOQ.png) The question is: for achieving that, I'm using `debug_backtrace`, but am not sure if this is working by accident or if the logic stands (?!). I found that checking for `debug_trace()->trace[4]['function']` I get to know where in the core the function `get_blogs_of_user` is being called. ## Sample code               add_filter( 'get_blogs_of_user', 'bf_reorder_users_sites' );          function bf_reorder_users_sites( $blogs ) {         $trace = debug_backtrace();         // my_debug_dump();              if( 'initialize' == $trace[4]['function'] )             uasort( $blogs, 'bf_uasort_by_blogname' );         else             uasort( $blogs, 'bf_uasort_by_domain' );              return $blogs;     }          function bf_uasort_by_domain( $a, $b ) {         return strcasecmp( $a->domain, $b->domain );     }          function bf_uasort_by_blogname( $a, $b ) {         return strcasecmp( $a->blogname, $b->blogname );     }      ## Debug `my_debug_dump()` lists `$trace[4]['file']` and `$trace[4]['function']`, and prints:               File:: /wp-path/wp-includes/admin-bar.php     Function:: initialize     --------     File:: /wp-path/wp-includes/class-wp-admin-bar.php     Function:: get_active_blog_for_user     --------     File:: /wp-path/wp-admin/admin-header.php     Function:: wp_user_settings     --------     File:: /wp-path/wp-includes/admin-bar.php     Function:: is_user_member_of_blog     --------     File:: /wp-path/wp-admin/includes/class-wp-list-table.php     Function:: display_rows     --------     File:: /wp-path/wp-admin/includes/class-wp-list-table.php     Function:: display_rows     --------     File:: /wp-path/wp-admin/includes/class-wp-list-table.php     Function:: display_rows


How can I return shortcode output to the top of the content?

I have a shortcode called update which is used as follows               [update title='' date=''] this is some update, etc. etc. 2 paragraphs or more [/update]      This outputs some html that wrap the title, date and content in some html. Along wit this, I would like spit out a single line at the top of the content that outputs just the title and date with an anchor that jumps to the point where the update was created. I've looked high and low, but I cant seem to find a way to position the shortcode just above the content. Any help appreciated! Thank you


Wordpress apply_filters() Arguments Missing

I'm customizing a Woocommerce Wordpress site. In the Woocommerce product class (`class-wc-product.php`) the `get_price` function applies a filter as follows:               function get_price() {         return apply_filters('woocommerce_get_price', $this->price, $this);     }      In my functions.php I want to add a filter as follows:               add_filter('woocommerce_get_price', 'custom_price');          function custom_price($price, $product) {         ...     }      When I call this I get the following PHP warning:               Warning: Missing argument 2 for custom_price()      Why is the second argument missing? Is `$this` not sent to the filter call?


Faceted Navigation in Wordpress

have anyone managed to succesfully implement faceted navigation in wordpress? Using taxonomies and categories I think that it can be done but don't know how to implement the "url" part of faceted navigation and also how to implement the filters. http://experiencinginformation.wordpress.com/2010/09/04/faceted-navigation- seo-and-facets/ Thanks a lot


Exclude Authors based off date of last post

I have several writers that range from frequent to one-time writers for my blog. On my Author page, I would like to separate out writers that have not posted an article in 6 months. It would be nice then to output those writers in a different section like "Previous Writers" or something after the other list of current writers. Right now, the code just loops through all authors and displays them all together so I would like to add in this exclusion based on the last time they posted an article. Specific code help is welcomed as I don't know PHP or Wordpress extremely well. **Example of code:**               $authors = get_users('orderby=post_count&order=DSC&role=contributor'); ?>
Writers
     <?php     // Loop through all the users, printing all of their posts as we go     foreach ( $authors as $author ) { ?>                 <a name="<?php echo $author->user_nicename; ?>">                 <div class="author-posts-wrapper" id="author-<?php echo $author->ID; ?>-posts-wrapper">                     <div class="author-avatar" id="author-<?php echo $author->ID; ?>-avatar">                         <?php echo get_avatar( $author->ID, 96 ); ?>
                     <div class="author-posts" id="author-<?php echo $author->ID; ?>-posts">
<a href="<?php echo get_author_posts_url( $author->ID ); ?>"><?php echo $author->display_name; ?>
         <?php         // Set up a Loop, querying for all of the current user's posts         $args = array( 'author' => $author->ID, 'posts_per_page' => 1 );         $posts = query_posts($args);         // Now that we have the posts, simulate a Loop here         if ( have_posts() ) : ?>                     <ul class="author-post-list" id="author-<?php echo $author->ID; ?>-post-list">             <?php while ( have_posts() ) : the_post(); // Print whatever we want for each post ?>             Output something about each writer here.             <?php endwhile; ?>
         <?php else: ?>
This author has not yet published any posts
         <?php endif; ?>      In case you want to see the full code, the Author page was built using this code.


Call plugin with php function

This plugin only works as widget. I need call this plugin with php function. How to modify this code ?                 <?php      /*      Plugin Name: AJAX Calendar      Plugin URI: http://urbangiraffe.com/plugins/ajax-calendar/      Description: A version of the WordPress calendar that uses AJAX to allow the user to step through the months without updating the page.       Version: 2.5.1      Author: John Godley      Author URI: http://urbangiraffe.com      */           class AJAX_Calendar_Widget extends WP_Widget {     var $category_ids = array();          function AJAX_Calendar_Widget() {         $widget_ops  = array( 'classname' => 'ajax_calendar_widget', 'description' => __( 'AJAX Powered Calendar', 'ajax-calendar' ) );         $control_ops = array( 'width' => 300, 'height' => 300 );              $this->WP_Widget( 'ajax-calendar', __( 'AJAX Calendar', 'ajax-calendar' ), $widget_ops, $control_ops );              add_action( 'template_redirect', array( &$this, 'template_redirect' ) );     }          function template_redirect() {         if ( is_date() && isset( $_GET['ajax'] ) && $_GET['ajax'] == 'true' ) {             $settings = $this->get_settings();             $settings = $settings[$this->number];                  $instance     = wp_parse_args( $settings, array( 'title' => __( 'AJAX Calendar', 'ajax-calendar' ), 'category_id' => '' ) );             $this->category_ids = array_filter( explode( ',', $instance['category_id'] ) );                  echo $this->get_calendar();             die();         }     }          /**      * Display the widget      *      * @param string $args Widget arguments      * @param string $instance Widget instance      * @return void      **/     function widget( $args, $instance ) {         extract( $args );              $instance     = wp_parse_args( (array)$instance, array( 'title' => __( 'AJAX Calendar', 'ajax-calendar' ), 'category_id' => '' ) );         $title        = apply_filters( 'widget_title', $instance['title'] );         $category_id  = $instance['category_id'];              $this->category_ids = array_filter( explode( ',', $category_id ) );              echo $before_widget;              if ( $title )             echo $before_title . stripslashes( $title ) . $after_title;              echo $this->get_calendar();              // MicroAJAX: http://www.blackmac.de/index.php?/archives/31-Smallest-JavaScript-AJAX-library-ever!.html      ?>            <?php         // After         echo $after_widget;     }          function get_calendar() {         global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;              add_filter( 'query', array( &$this, 'modify_calendar_query' ) );              $text = get_calendar( true, false );              remove_filter( 'query', array( &$this, 'modify_calendar_query' ) );              $text = str_replace( '<a', '<a onclick="microAjax(this.href + \'?ajax=true\',show_micro_ajax); return false"', $text );         $text = str_replace( '<a', 'category_ids ) ) {             global $wpdb;                  $query = str_replace( 'WHERE', "LEFT JOIN {$wpdb->prefix}term_relationships ON {$wpdb->prefix}posts.ID = {$wpdb->prefix}term_relationships.object_id INNER JOIN {$wpdb->prefix}term_taxonomy ON ({$wpdb->prefix}term_relationships.term_taxonomy_id = {$wpdb->prefix}term_taxonomy.term_taxonomy_id AND {$wpdb->prefix}term_taxonomy.taxonomy='category') WHERE", $query );             if ( strpos( $query, 'ORDER' ) !== false )                 $query = str_replace( "ORDER", "AND {$wpdb->prefix}term_taxonomy.term_id IN (".implode (',', $this->category_ids ).') ORDER', $query );             else                 $query .= "AND {$wpdb->prefix}term_taxonomy.term_id IN (".implode (',', $this->category_ids ).')';         }              return $query;     }          /**      * Display config interface      *      * @param string $instance Widget instance      * @return void      **/     function form( $instance ) {         $instance = wp_parse_args( (array)$instance, array( 'title' => __( 'AJAX Calendar', 'ajax-calendar' ), 'category_id' => '' ) );              $title        = stripslashes( $instance['title'] );         $category_id  = $instance['category_id'];              ?>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:',      'ajax-calendar' ); ?> <input class="widefat" id="<?php echo      $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>"      type="text" value="<?php echo esc_attr( $title ); ?>" />

<label for="<?php echo $this->get_field_id( 'category_id' ); ?>"><?php _e( 'Category IDs:', 'ajax-calendar' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'category_id' ); ?>" name="<?php echo $this->get_field_name( 'category_id' ); ?>" type="text" value="<?php echo esc_attr( $category_id ); ?>" />
         <?php     }          /**      * Save widget data      *      * @param string $new_instance      * @param string $old_instance      * @return void      **/     function update( $new_instance, $old_instance ) {         $instance     = $old_instance;         $new_instance = wp_parse_args( (array)$new_instance, array( 'title' => __( 'AJAX Calendar', 'ajax-calendar' ), 'category_id' => '' ) );              $instance['title']        = wp_filter_nohtml_kses( $new_instance['title'] );         $instance['category_id']  = implode( ',', array_filter( array_map( 'intval', explode( ',', $new_instance['category_id'] ) ) ) );              return $instance;     }      }           function register_ajax_calendar_widget() {     register_widget( 'AJAX_Calendar_Widget' );      }           add_action( 'widgets_init', 'register_ajax_calendar_widget' );           function ajax_calendar ($categories = '') {     // $calendar = AJAX_Calendar::get ();     // $calendar->show ( $categories );      }


nav_menu: how to force a subpage switching on the parent menu

I've been using the native wp_nav_menu to output my navigational elements. I have also created a subpage that is nested under one of my menu, but when I hit that URL the default custom walker clearly doesn't activate the corresponding item in the menu. E.g.               Home, FAQs           >____Archive      MY question is how can I get the FAQs menu turning on if I'm on the archive URL? Thanks Andrea


404 to 301 - Fixing old links

I have currently updated a site and made many improvements to it. The old site ran off 3 different systems and had wordpress (and the other systems) in the webroot. I have moved wordpress into a subdirectory (wordpress) and I also updated my blog posts to be prefixed with blog/. Pages and the front page are not prefixed with blog/. The issue I am having is that I want to gracefully tell Google and other search engines that these posts are now prefixed with /blog/. I used the following code in my 404 page before I realized that wordpress throws a 404 header. Obviously, this is not the correct way to implement this fix.               // Check if old site URL and redirect if so     if (substr($s, 0, 8) != 'reviews/') {         if (substr($s, 0, 5) != 'blog/' && substr($s, 0, 10) != 'wordpress/' ) {             // Force our 301 redirect so we can keep the new URI: /blog/             header("HTTP/1.1 301 Moved Permanently");             header("Location: /blog/{$s}");             exit();         }     }      What I need to do is find out when wordpress knows this is a 404 and see if it matches my checks (currently what is in the snippet above) and if a match occurs force a 301 redirect to update the crawlers. I am not sure if this information is available on init, as this is my next step to test. I tried playing with `template_redirect` and `redirect_canonical` but they don't seem to be the correct methods to attach to. Any help on this is appreciated. I am still trying to find a solution and will post back when I find one. Thanks in advance.


List users of an array of roles

I'm able to list users by a single role only. When I try and add an array to the code below I just get a list of all authors. I'm sure that it is something straight forward that I'm missing. Thanks Josh                <?php                      $roles = array('guest-teacher', 'president', 'core-faculty');             $args  = array(          'meta_key' => 'last_name',          'role'     => $roles         );              $wp_user_query = new WP_User_Query($args);         $wp_user_query->query_orderby = str_replace( 'user_login', 'lsjs_usermeta.meta_value', $wp_user_query->query_orderby );         $wp_user_query->query();              $authors = $wp_user_query->get_results();                        // Check for results;         if (!empty($authors))         {             echo '
';             // loop trough each author             foreach ($authors as $author)             {                 // get all the user's data                 $author_info = get_userdata($author->ID);                 $url = get_author_posts_url($author->ID);                ?>
<a href="<?php echo $url; ?>"><?php echo $author_info->last_name; ?>
                      <?php             }             echo '
';         } else {              }         ?>


What's the best way to implement AJAX in WordPress?

WordPress has a framework in place for handling AJAX which is well documented here: http://codex.wordpress.org/AJAX_in_Plugins My concern with this is that every time you execute an AJAX query, (even if you want to return a single field from a table) this framework instantiates the whole WordPress stack, including any plugins and theme functions that may exist on your site. This strikes me as a pretty heavy method to perform what may end up being a pretty simple function. Typically a lot of WordPress sites run on shared hosting and don't have a whole lot of processing power, so, based on my experiences, a reponse time of 2 seconds to a WordPress hosted AJAX call is not uncommon. Any recommendations on how to improve on this response time?


flush_rewrite_rules() cancels the effect of add_rewrite_rule()

As one of my plugin's features, I'm trying to define a custom url structure, like `http://www.mysite.tld/foo/{action}`. I'm using `add_rewrite_rule()` along with `flush_rewrite_rules()` on plugin activation, which works as expected. Until `flush_rewrite_rules()` gets called again, during another request, either by hand or by enabling another plugin that does so. When this happens, my rewrite rule suddenly disappears (I'm using Rewrite Rules Inspector to check this). The minimum code needed to reproduce the issue is this:               <?php     /*     Plugin Name: PluginA     */          register_activation_hook(__FILE__,'PluginA_activation');          function PluginA_activation()         {         add_rewrite_tag('%foo%','([^&]+)');          add_rewrite_rule('foo/([^/]+)','index.php?foo=$matches[1]','top');         flush_rewrite_rules();         }      Any idea what I'm doing wrong?


Specific post user permissions

in that gives a specific user the option Edit a specific post I searched and found only plug-in that give the user the option to edit all posts But I did not see anything reference to a specific post I tried to use as a plug-in "user permissions" but unfortunately it does not save my settings Thank you


Problems with installing and deleting plugins

When I want to install a plugin from the web interface, I receive the error > The plugin does not have a valid header. or > Destination folder already exists. after it has been downloaded and I click on "activate". When I delete a plugin, the plugin gets deactivated, but isn't deleted from my FTP server. What's the problem with my WordPress installation? File permissions are OK on my server. I've modified class-wp-upgrader.php so that it always removes old files. P. S.: My plugin directory is empty now, and I still get the message the the folder already exists.


Verify user is Eventbrite attendee when creating new WordPress account

I've created a WordPress site for a ProductCamp. Users register for the event on Eventbrite and then use the WordPress site to vote for breakout sessions. Is there a way to verify that a user is already an attendee in Eventbrite when they are signing up on WordPress?


Use the category name instead of category slug in permalinks

How to create a permalink structure which finish by:               /category-name/post-name/      Instead of:               /category-slug/post-name/      By default, Wordpress is offering `%category%` tag strucure as "A sanitized version of the category name (category slug field on New/Edit Category panel". How can I use the category name instead of category slug in permalinks? **Note** that I dont need the easiest solution of making my slugs equal to my categories names. In fact, customer need to see in the area of edit post : the categories in a specific non-alpahbetical order. So I managed to do this by giving a digital number for the category as a slug and order showing categories by slug in an ASC mode using:               add_filter( 'get_terms_args', 'wpse_53094_sort_get_terms_args', 10, 2 );     function wpse_53094_sort_get_terms_args( $args, $taxonomies )      {         global $pagenow;         if( !is_admin() || ('post.php' != $pagenow && 'post-new.php' != $pagenow) )              return $args;              $args['orderby'] = 'slug';         $args['order'] = 'ASC';              return $args;     }      I think If I dont manage to use `t f` solution, I will look for a code or a plugin that adds meta field for categories and order by this field in ASC mode. Then I will rename my slugs to the same name of categories. What do you think about this approach? Thank you for your comment


How does Wordpress insert Paragraphs in posts

So when looking at the html-view in the editor there is no `<p>` tags, when a view the post every line break is surrounded with a `<p>`. How?


Image menu showing categories in page

I'm trying to display different images in a page that links to categories. Currently i have a page that shows the categories and the pages for the categories but it needs a slight change. I need to display the category name with an image for that category and a background for it. I've attached an image to explain what i mean properly. I think the part i'm having trouble with is the background image and the image for the category. I can get it to display the category name it's just the background image and the image for the category. What's the best way to do this in wordpress? Here's a link to the design. http://img28.imageshack.us/img28/3587/imagecategorymenu.jpg In this design Products is the page title and the four sections are different categories. Clicking on Printers for example will take you to another page show the same thing but with sub categories of printers.


How can I show more than 15 themes at a time in the admin menu?

I have a lot of themes in my test wordpress site. I get a little frustrated that I can't show more than 15 at a time. ![Picture.png](http://img820.imageshack.us/img820/5982/picturef.png) In pages and posts you can click "screen options" to choose the number, but it looks like "Themes" has no such option. ![Picture-1.jpg](http://img853.imageshack.us/img853/9582/picture1bbg.jpg) Is there another way to increase the number?


Can you run Wordpress on a MarketLive/Java EE server?

I am using MarketLive. I want to install Wordpress into a subfolder, but the person I'm speaking with says they can't do it because my site is built in Java. I want to install wordpress on my domain because I want to set up a blog, and it's a quick and way to do so. I don't understand this. All that Wordpress needs to run is PHP. PHP can be installed in a Windows or Linux environment. So, what is stopping this from happening? I'm not sure if what the company is telling me is correct or if they are just trying to get more money from me (installing Wordpress and allowing me to set up my own blog vs them creating a blog for me). Thanks.


Advanced Custom Fields Plugin: Get file URL into Parent

On parent page, I've got a grid of custom field values from child pages. All text fields work fine, but I'm having issues with the file URL fields: instead of the URL it returns attachment ID. Here's the code I'm using to display all the fields:                   <?php         //get children of page 4 and display with custom fields              $args=array(         'post_parent' => 4,         'post_type' => 'page',         );              $my_query = null;         $my_query = new WP_Query($args);         if( $my_query->have_posts() ) {              while ($my_query->have_posts()) : $my_query->the_post(); ?>      Stripped down version, without any formatting:                   <?php $meta_one = get_post_meta($post->ID, 'doors', true); ?>         <?php echo $meta_one; ?>      ACF's developer said I should be using get_field instead, but if I replace get_post_meta with get_field it doesn't even return the ID. I've also tried adding URL parameter like this: `<?php echo $meta_one['url']; ?>` No change.


!is_admin() condition turns true in admin pages

I need users to redirect to login if not logged and once they are, redirect them to backend if they try to see front end pages. This is my code:               add_action( 'template_redirect', function () {         if(is_user_logged_in() ):             bk1_debug('logged in');             if (!is_admin()):                 bk1_debug('not in admin, redirecting...');                 wp_redirect(admin_url());             endif;         else:             bk1_debug('not logged in, redirecting...');             wp_redirect(wp_login_url( admin_url() ));         endif;          }, 10 );      Of course it doesn't work... For some reason 'not in admin, redirecting...' is called also in backend, and even better, in front end nothing happens altogether! Only redirecting for not logged in user goes. Any idea?


Post comments to Facebook

I am using WP's own commenting system, but I also want to add option like checkbox which will provide option to post comment on Facebook may be with post link. Has anyone done something like this or can someone point me in right direction? I searched google but there are plugins to completely replace WP comment system I don't want to do that.


Theme doesn't want to load localization files

Here is my functions.php excerpt:               function get_theme_text_domain()     {         //Same behavior if I return the string as 'return 'whatever'         $theme = wp_get_theme();         return $theme->get('TextDomain');     }          function tamtando_theme_setup()     {         load_textdomain(get_theme_text_domain(), get_template_directory() . '/languages');          [...]          }          add_action('after_setup_theme', 'tamtando_theme_setup');      `$theme` is an array with all theme's properties: as expected. `$theme->get('TextDomain')` returns 'tamtando': as expected. I've noticed that the theme wasn't translating any string when using `__('somestring', get_theme_text_domain())`. I've then tried to see what was going on with the debugger, while executing `load_textdomain(get_theme_text_domain(), get_template_directory() . '/languages');`. Here I've realized that `import_from_reader($reader)`, located on /wp- includes/pomo/mo.php, was returning false, because, I think, `$reader->readint32()` returns false. I suppose, this happens because either the file can't be found, or it has some issue. I've checked: the file appear correct and I've even recreated it a couple of times, using different tools, but the issue is still present. This is not the first theme I'm writing and I mostly use always the same patterns, so I'm really lost on this issue. Anyone knows a possible reason for this behavior?


Ajax pagination works only first and third time

I'm using ajax-based pagination, heres the markup

          HERE GOES MY LOOP AND CONTENT , some LI's with thumbs and stuff

             <?php posts_nav_link(); ?>

      then, i use this jquery so it loads content inside `#portfolio-thumbs` and pagination links inside `#pagi-container`:                 $('#paginar > a').on('click',  function(e){             e.preventDefault();             var link = jQuery(this).attr('href');             jQuery('#portfolio-thumbs').html('Loading...');             jQuery('#portfolio-thumbs').load(link+' #portfolio-destaque');             jQuery('#pagi-container').load(link+' #paginar');              });      Well, when i click `> Next Page` for the first time: * it loads `page/2` ok, inside `#portfolio-thumbs` goes the looped posts and the markup stays the same * except for the `< previous page` link that is added inside `#pagi-container`    If I click again, the jquery/ajax does not work, and loads full `page/3`, reloading browser's window.. If, in `page/3` I click `<previous page` or `> next-page` ajax works ok again.... Any ideas what i'm doing wrong?


Cannot Hide Google Map if custom field is blank

I am using the following to display google maps using hotel_address custom field.               <iframe width="440" height="400" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?q=<?php the_field('hotel_address'); ?>&iwloc=&output=embed">
      And it is working fine, getting hotel address and displaying a map, however I would like to hide this is hotel_address is blank. I have tried the following               <?php     $map = get_post_meta($post->ID, 'hotel_address', true);     if( $map) {     echo '
';     echo '';     }     ?>      And can confirm that $map is picking up the address by using echo $map however it just shows a blank box without any map. Any ideas? Richard


multiple excerpt length and styles

I am working on a site, which have many excerpt like text but with different style of read more or click here to read more with different length. is there a way i can make excerpt length according to what i mentioned above? Thanks in advance


Select event where start date is smaller than current date and end date is greater than current date Suppose an event A start date is 2013-06-12 and end date is 2013-07-30. I've a query where start date is 2013-06-20 and end date is 2013-06-30. So Event A should show in my query result. but I don't get it. This is my query               $query = "     SELECT DISTINCT ID     FROM {$wpdb->prefix}posts     JOIN {$wpdb->prefix}postmeta m1     ON ( {$wpdb->prefix}posts.ID = m1.post_id )     WHERE     {$wpdb->prefix}posts.post_type = 'tribe_events'          AND {$wpdb->prefix}posts.post_status = 'publish'          AND (              ( (m1.meta_key = '_EventStartDate' AND m1.meta_value >= '$start_date') AND ( m1.meta_key = '_EventStartDate' AND m1.meta_value <= '$end_date' ))              OR          ( (m1.meta_key = '_EventEndDate' AND m1.meta_value >= '$start_date') AND ( m1.meta_key = '_EventEndDate' AND m1.meta_value <= '$end_date' ) )              OR         ( (m1.meta_key = '_EventStartDate' AND m1.meta_value < '$start_date') AND ( m1.meta_key = '_EventEndDate' AND m1.meta_value > '$end_date') )              )          ORDER BY {$wpdb->prefix}posts.post_date     DESC;     ";          $result = $wpdb->get_results($query);      Thanks in advance.


wpdb prepare insert table doesn't work

I followed the introduction to use prepare to insert some data to the table. The code is like this:                   $wpdb->query(              $wpdb->prepare(                     "INSERT INTO {$wpdb->prefix}awpcp_adphotos VALUES                     (ad_id, image_name, disabled, isprimary)                     (%d, %s, %d,%d)",                     $ad_id,                     $ad_img,                     0,                     0));      also, disabled and is_primary should be Boolean. But I am not sure what the data type in here. I also tried               $wpdb->insert(     '{$wpdb->prefix}awpcp_adphotos', // Table name     array(         'ad_id' => $ad_id,         'image_name' => $ad_img,         'disabled' => 0,         'is_primary' => 0,     ), // Columns     array(         '%s',         '%d',         '%d',         '%d'     ) // Explicit formatting      ); But I haven't got any luck yet. There is no error message when I run the code. Okay, I found answers in somewhere else. it should be like this:                   $wpdb->insert($wpdb->prefix.'awpcp_adphotos', array(      'ad_id' => $ad_id,      'image_name' => $image_name,      'disabled' => $disabled,      'isprimary' => $isprimary,       ));      I was confused with prefix format.


How to access a variable on all page?

I added a variable to my functions.php file:               $options = get_option( 'simple_options' );      I can access to this variable on every page, but If I call it in the footer.php it's not working. How to fix that?


How to add menu support to a theme?

I tried few tutorials. All i think is i should use `register_nav_menus()` and then add the menu in `header.php` Here is the code i tried in functions.php from this help site itself               function my_cool_menu_function(){       register_nav_menus( array(         'primary' => 'Primary Navigation'       ));     }          add_action( 'after_setup_theme', 'my_cool_menu_function' );      In header.php               <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>      When i tried to check whether any menu is registered with this function `$locations = get_nav_menu_locations();var_dump($locations);` I got array of size zero. i,e no menu registered. Am i missing something? I can able to see few links in frontend which are pages i guess. I see that `Your theme does not natively support menus, but you can use them in sidebars by adding a “Custom Menu” widget on the Widgets screen.` So i think above menu is not registered. What wrong am doing here? I have added `add_theme_support('nav-menus');` too in `functions.php` **Updates** I tried the same above code through plugin then i can able to see the menu. Which mean it is not working with the theme functions.php file. Am not sure why this happens. Do anyone know this?


Settings API store serialized data in the database (The Right Way)

Im trying to learn Settings API and I'd appreciate if someone could clarify this for me. I want to store serialized data in the database. Im using a class to do all the work for me. Heres what I have:               public function admin_init()         {             register_setting('wp_plugin_template-group', 'my_settings', array(&$this,'validate'));                  // add your settings section              add_settings_section(             'wp_plugin_template-section',              'MY Settings',              array(&$this, 'settings_section_wp_plugin_template'),              'wp_plugin_template' );                       // add your setting's fields              add_settings_field(             'wp_plugin_template-setting_a',              'Setting A',              array(&$this, 'settings_field_input_text'),              'wp_plugin_template',              'wp_plugin_template-section',              array( 'field' => 'setting_a' )             );                       add_settings_field(             'wp_plugin_template-setting_b',              'Setting B',              array(&$this, 'settings_field_input_text'),              'wp_plugin_template',              'wp_plugin_template-section',              array( 'field' => 'setting_b' )             );              }      As you can see, Im using validate callback to return an array so it can be serialized and stored in the DB. Heres the Validate function:               public function validate($args)         {             //echo "vali";                        $valid = array();                       //$valid['setting_a'] = sanitize_text_field($args['setting_a']);             //$valid['setting_b'] = sanitize_text_field($args['setting_b']);                       $valid['setting_a'] = $_POST['setting_a'];             $valid['setting_b'] = $args['setting_b'];                       //$valid['setting_a'] = "AAAA";             $valid['setting_b'] = "BBBB";                            return $valid;         }      Please note only one value is now stored in the DB:                $valid['setting_a'] = $_POST['setting_a']; //stored in the DB      $valid['setting_b'] = $args['setting_b']; //Stored as null, in other words it doesnt work      $valid['setting_b'] = "BBBB"; //Works fine, using it, just for testing purposes      This is how the form is built:               public function settings_field_input_text($args)          {                       // Get the field name from the $args array              $field = $args['field'];                   // Get the value of this setting              $value = get_option($field);                  // echo a proper input type="text"             echo sprintf('<input type="text" name="%s" id="%s" value="%s" />', $field, $field, $value);                    }      And Displayed:
        <?php if ( isset( $_GET['settings-updated'] ) ) {                echo "

Settings updated successfully.

";           } ?>     <?php screen_icon(); ?>
WP Plugin Template
          <form method="post" action="options.php">         <?php //Output nonce, action, and option_page fields for a settings page. Please note that this function must be called inside of the form tag for the options page. ?>             <?php @settings_fields('wp_plugin_template-group'); ?>              <?php @do_settings_fields('wp_plugin_template-group'); ?>              <?php @do_settings_sections('wp_plugin_template'); ?>              <?php @submit_button(); ?>          </form>
      HTML Version A:

WP Plugin Template
          <form action="options.php" method="post">                     <input type="hidden" value="wp_plugin_template-group" name="option_page"><input type="hidden" value="update" name="action"><input type="hidden" value="5d72478b96" name="_wpnonce" id="_wpnonce"><input type="hidden" value="/inspired/wp-admin/admin.php?page=usy-settings" name="_wp_http_referer">
MY Settings
      These settings do things for the WP Plugin Template.Setting ASetting B And also I've tried this: HTML Version B:

WP Plugin Template

Settings updated successfully.

          <form action="options.php" method="post">                     <input type="hidden" value="wp_plugin_template-group" name="option_page"><input type="hidden" value="update" name="action"><input type="hidden" value="5d72478b96" name="_wpnonce" id="_wpnonce"><input type="hidden" value="/inspired/wp-admin/admin.php?page=usy-settings&settings-updated=true" name="_wp_http_referer">
MY Settings
      These settings do things for the WP Plugin Template.Setting ASetting B I was wondering if there is a better way of doing this? I was under impression that all the form values will be passed as parameter **$args** But no matter what I try, **$args** always empty:( Can you please help me understand how to get it to work? or is **$_POST['setting_a']** my only option?


How to get a jQuery script to run on a page?

I am having a hard time figuring out how to get a jQuery script to run on a Wordpress page of mine the "correct" way. I have followed this article and implemented what the first answer says to do. There are so many tutorials and articles I've read on how to get jQuery to work on your blog, but I just cannot seem to figure it out. I have a number of questions that I hope to get addressed from others who have had experience in it. First of all, most of the tutorials and things I've read are how to get jQuery **_included_** on your blog. My first question is, shouldn't most themes that you download out there automatically include jQuery in your header anyway? For example, my site has these lines automatically included in every page right off the bat:                          So, jQuery is included, I don't need to worry about that... Okay, it's included, now I need to figure out how to get just a sample page or post to run a jQuery script. I follow the directions on the page I listed above... I first go into the back end of my site, go into my Child Themes folder, and make a new file called "jquery-script.js". In it, I write the following code and save the file:               jQuery(document).ready(function($){       $("button").click(function(){         $("#div1").fadeIn();         $("#div2").fadeIn("slow");         $("#div3").fadeIn(3000);       });     });      Okay... I have my jQuery script file on the back end. Now, I need to reference or enqueue that script. According to the article, it is best to enqueue the script. So I follow the directions and add a new PHP function in my child theme's "functions.php" file. In this file, I add the following:               function add_jquery_script() {       wp_enqueue_script(         'jquery-script', // name your script so that you can attach other scripts and de-register, etc.          get_template_directory_uri() . '/jquery-script.js', // this is the location of your script file          array('jquery') // this array lists the scripts upon which your script depends       );     }      So, that's done. I believe this should work. So, I go and create a "Test Page" on my site (not published or anything). I create the divs, button, and everything I need to get my script to do what I want it to do:
Demonstrate fadeIn() with different parameters.
     <button>Click to fade in boxes</button>

      I preview the page, click the button.... nothing. Nothing happens. Okay... maybe I need to do a little more in my functions.php file. So I go back in there and read on the page I'm following that perhaps you have to add a line to get it to work. So I add the following line after my function:               add_action('wp_enqueue_scripts', 'add_jquery_script');      I save the file. I'm excited. This should work. I go and test my page... nothing at all again. Nothing happens when I click the button. Hmm... So now, I go and do something totally different in my functions.php file. Something that I've done in the past to get certain scripts to work... so I completely remove the function and the "add_action" call and implement the following in my functions.php file:               function add_jquery_script() {         echo '' . "\n";     }     add_action('wp_head', 'add_jquery_script');      I then save the file and go test it. My page WORKS!!! Woohoo! It does what I want it to do. However, I'm not satisfied with that. I've read everywhere that you should always enqueue your scripts using the method that I attempted to use but failed. So a few closing questions that I hope to get answered:   * First, why did it not work when I tried to enqueue my script but did work doing my second method?   * Secondly, the thing is now... that jQuery script I wrote gets included on EVERY single page of my site... every post, page, etc. Is this a problem?? Is there any way to just have it included on the ONE page I want the script to run so that it doesn't affect other pages?    * Third, why can't I include this script within the "text" tab of my TinyMCE Editor that I use while writing a page/post? I tried using `<script>` tags and just putting my tiny script in between those, but that doesn't appear to work.   * Fourth, if I CAN'T get my script to only run for one page and it does have to be included in every single page, then I'll obviously have to specifically target my HTML elements much much better. Obviously I won't be using a script that targets every button by using `$("button")`, so then would I just give my button on that specific page some unique ID such as `<button id="some-unique-id">` and then target it through my jQuery? That way, the script will only work for that button. Sorry for the extremely long post and noob questions... I just have never messed with jQuery that much and I'm trying to wrap my head about how to work Wordpress in order to include my own custom scripts and things that I want to run. If anyone has any feedback on any of my questions, it would be GREATLY appreciated. Thanks so much!


Preventing frontpage to be deleted/moved to trash

I want to prevent my frontpage to be deleted/moved to trash using this:               add_action( 'wp_trash_post',      'tcb_page_delete_check' );     add_action( 'before_delete_post', 'tcb_page_delete_check' );     function tcb_page_delete_check( $post_id ){         $frontpage = get_option( 'page_on_front');         $blogpage = get_option('page_for_posts');            if( $post_id === $frontpage || $post_id === $blogpage ) {             wp_redirect(admin_url('edit.php?post_type=page'));             exit;           }     }      The problem is that option('page_on_front')'s ID get's changed from 7 (which is my desired frontpage ID) to 0 when I click on "Trash" so it never matches the frontpage ID and moves my page to trash. And if I change it to:                   if( $post_id === 7 ...      The page does not get moved to trash but the option('page_on_front')'s ID is changed to 0. How do I prevent option('page_on_front') to get changed to 0 so my frontpage stays the same and can't get trashed?


Reordering content using a meta value

I've got this theme where you can add posts of type "portfolio", and I want to be able to reorder them up. I've added a custom meta field called "position" and I've set already those values. All good. My question is: How can I modify the query to join the wp_postmeta table and order them by the "postion" value? This is the current query:               $loop = new WP_Query( array(         'post_type' => 'portfolio',         'posts_per_page' => $homepagenumber     ) );      I really appreciate any hint on this. Thanks a lot.


Help with Related Posts Function

I'm trying to write a function that will grab all related posts according to the term of a taxonomy. I'm having trouble though trying to query multiple terms. The way I am doing it right now is using whatever the first term is to query related posts. Any idea how to check if it is multiples?               function related_posts($related_type, $related_tax) {              global $wpdb, $post;              // Get The Related Term         $terms = array();         foreach(wp_get_object_terms($post->ID, $related_tax) as $term){             $terms[] = $term->slug;         };              // Grab The First Term From The Array         $related_term = array_shift(array_values($terms));              // Query The Related Posts         $related_posts = $wpdb->get_results(              "             SELECT *              FROM $wpdb->posts             LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id)             LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)             LEFT JOIN $wpdb->terms ON($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id)             WHERE $wpdb->posts.post_type = '$related_type'              AND $wpdb->posts.post_status = 'publish'             AND $wpdb->term_taxonomy.taxonomy = '$related_tax'             AND $wpdb->terms.slug = '$related_term'             AND $wpdb->posts.ID <> $post->ID             ORDER BY $wpdb->posts.post_date DESC             "         );              if($related_posts) {             echo '
';                 foreach ($related_posts as $post):setup_postdata($post);                     echo '
'.get_the_title().'
';                 endforeach;             echo '
';         } else {             echo 'No related posts found';         }          }      I would like something like: if this term OR this term OR this term THEN display all related posts. I had previously used $wpdb->terms.slug IN ('$terms') but this would only show related posts with that exact match.


Taxonomy and Rewrite Structure

I have a custom post type (recipes) and custom taxonomy (r_cat). To be quite honest, I'm a newbie and I've tried different scenarios and options from what I've read in various posts and google searches, but, I can't get it to do what I need. Here is the code:               add_action('init', 'cptui_register_my_cpt_recipes');     function cptui_register_my_cpt_recipes() {     register_post_type('recipes', array(     'label' => 'Healthy Recipes',     'description' => '',     'public' => true,     'show_ui' => true,     'show_in_menu' => true,     'capability_type' => 'post',     'map_meta_cap' => true,     'hierarchical' => false,     'rewrite' => array('slug' => 'healthy-recipes', 'with_front' => true),     'query_var' => true,     'has_archive' => true,     'supports' => array('title','editor','custom-fields','thumbnail','page-attributes','post-formats'),     'taxonomies' => array('post_tag','r_cat'),     'labels' => array (       'name' => 'Healthy Recipes',       'singular_name' => 'Recipe',       'menu_name' => 'Recipes',       'add_new' => 'Add Recipe',       'add_new_item' => 'Add New Recipe',       'edit' => 'Edit',       'edit_item' => 'Edit Recipe',       'new_item' => 'New Recipe',       'view' => 'View Recipe',       'view_item' => 'View Recipe',       'search_items' => 'Search Recipes',       'not_found' => 'No Recipes Found',       'not_found_in_trash' => 'No Recipes Found in Trash',       'parent' => 'Parent Recipe',     )     ) ); }          add_action('init', 'cptui_register_my_taxes_r_cat');     function cptui_register_my_taxes_r_cat() {     register_taxonomy( 'r_cat',array (       0 => 'recipes',     ),     array( 'hierarchical' => true,     'label' => 'Recipe Categories',         'show_ui' => true,         'query_var' => true,         'rewrite' => array( 'slug' => 'healthy-recipes' ),         'show_admin_column' => false,         'labels' => array (       'search_items' => 'Recipe Category',       'popular_items' => '',       'all_items' => '',       'parent_item' => '',       'parent_item_colon' => '',       'edit_item' => '',       'update_item' => '',       'add_new_item' => '',       'new_item_name' => '',       'separate_items_with_commas' => '',       'add_or_remove_items' => '',       'choose_from_most_used' => '',     )     ) );      }      When I just set the taxonomy to: 'rewrite' => array( 'slug' => 'healthy- recipes' ), The result is a 404 page. When I just set it to: 'rewrite' => true, The result is a URL like this: http://website.com/r_cat/gluten-free-recipes/ What I really need is a URL like: http://website.com/gluten-free-recipes/ What do I need to change, or maybe add...to achieve this structure? What else do you need to know? Thanks in advance!


How to disable the "Your site has updated to WordPress x.y.z" admin email?

Using the automatic update of my self-hosted WordPress blogs, I configured automatic updates of both the WordPress core as well as WordPress plugins and themes (through this plugin). Whenever a core update occurs, I get an email like: > _Your site has updated to WordPress 3.9.2_ > > Howdy! Your site at http://example.org has been updated automatically to > WordPress 3.9.2. > > No further action is needed on your part. For more on version 3.9.2, see the > About WordPress screen: http://example.org/wp-admin/about.php > > If you experience any issues or need support, the volunteers in the > WordPress.org support forums may be able to help. > https://wordpress.org/support/ > > The WordPress Team I understand that I can completely disable administrative notification emails but I would prefer to only disable the above notification. **Therefore my question is:** How to disable update notification emails in WordPress?


Adding CSS styles to Admin Area PAGES only (not POSTS or CPT)

I am using this to load css styles in the admin area (for any user who is not an administrator):               function wpse_admin_styles() {         if ( !current_user_can( 'manage_options' ) ) {             echo '<style>                     .fun-stuff-here {color:aqua;}                 </style>             ';         }     }     add_action('admin_head', 'wpse_admin_styles');      But I need to have some styles only load if the admin page being viewed is a **page** (not a post or custom post type post) Is this possible? I think the answer selected in this WPSE question has some potential, but I don't know how to add in the necessary code to what I have: How to add an admin function only to posts, not pages? I also came across this Wordpress Support Forum post. The OP's reply near the bottom (8th post from the top) looked promising, but in use it applies the CSS to all Pages, Posts and Custom Post Type sections: http://wordpress.org/support/topic/add-new-page-button-in-admin-area


How to format the first line of a post differently?

I'd like to have the first paragraph/sentence of my posts in their single.php page styled differently - say... bold. How do I go about doing that in the most efficient way?


How Is Network Activate Different From Activate (by Implementation)?

How is plugin network activate different from normal activation by implementation? What is done/not done in network activation that is done/not done in activation?


Link a custom post type child to a parent using dropdown

I've got a custom post type called wine, this will be the main type, I also have a custom post type called review, I want to be able to associate multiple reviews with a wine and have this controlled in the review edit screen. On the Wine template I need to be able to link to the page listing all the reviews for that wine so the review needs to know the wine's $post->id Thanks, Mark


Trick to get custom post types to show up on a custom taxonomy page?

I've setup a custom post type and a custom taxonomy for that post type, but I'm having one problem - on the custom taxonomy permalink pages, the content of the custom post that should be there is not being displayed. However, looking at the page source, I can see that there is a div that should contain the post content. Any suggestions on how to get the entire content to be displayed? Edit: The Custom Post Types UI plugin was used for the creation of the custom post types and the custom taxonomies. Edit 2: Turns out it was a Thesis problem. Design Options > Display Options > Archives was set to "titles only", which kept the content of the posts from being displayed.


check if registered sidebar is active & has widget content

I'd like to check if a registered sidebar has widget content - but can't seem to find a WP function for this - is_active_widget checks if it has content, but not if it exists or not.               function ql_widget( $widget, $widget_name, $element = 'sider' ){              if ( $widget ) { // widget name passed ##                  // check if widget is active - return html & widget content if true ##             if ( is_active_sidebar( $widget ) ) {                   echo '
';                      dynamic_sidebar( $widget );                   echo '
';                  } else {                      // issue error if requested widget does not exist or is empty ##                 if ( ql_user_is_administator() ) { // user is admin ##                          if ( dynamic_sidebar( $widget ) ) { // empty ##                              $message = 'empty';                          } else { // widget ID or name wrong ##                              $message = 'error';                          }          ?>
Widget <?php echo $message; ?>:                      <?php echo $widget_name ? $widget_name : $widget ; ?>
     <?php                            }             }         }     }      I call this on the page using:               // load widget ##     // widget_id, widget name, class of containing element ##     ql_widget( 'sidebar-general', 'Standard Sidebar', 'sider' );      The sidebars are registered correctly with register_sidebar() and have an unique ID assigned to each. currently this function returns the error to the admin if the widget is missing or empty - I'd like to be able to tailor the error to indicate if it's missing or empty Thanks! **UPDATE** here's the working function: link to pastebin


Paragraphs removed when using get_post_custom()?

I'm using a custom field plugin called Advanced Custom Fields to create custom fields, but i don't think that's what's causing the problem. When i fetch the custom fields from a template using get_post_custom(), the tags in the field is removed. If i view the source, it's written out like a big chunk of text but with "normal" line breaks, but that's not visible unless you view the source ofc. How do fetch the custom fields and keep the tags? I tried adding a tag around some text and that went fine, no issues displaying it. It's just tags, grr. Any ideas?


Rewrite pages and custom post type

I created a post type named soft_drink with a rewrite rule of /my_soft_drinks/%soft_drink%. my_soft_drinks is also a page slug. In my menu structure has the page soft_drinks parent submenu items. When i visit a submenu page, by example domain.com/my_soft_drinks/low_drinks gives a 404 error back. My solution was a rewrite rule in a init filter but this doesnt work:               add_rewrite_rule(        'my_soft_drinks/([^/]+)/?',        'index.php?pagename=$matches[1]',        'top'      );


Loading custom page template on a one page website

For a one page website, I have modified the homepage to index all pages instead of posts. For some of the pages I want to create a custom template (like page-slug.php). But, these template only get loaded when on a singular page, not on index/archive pages. A solution to this problem would be very much appreciated. THX!


Shortcode to get child pages of multiple parents (using parent slug)

I'm using a nice shortcode to get the child pages of a specific page, using just the parent page slug. [getChild name="page-slug"] This is done using this code:               function getChild_function($atts){     extract(shortcode_atts(array(       'name' => '',     ), $atts));          global $post;          $thispage = $post;          $result = new WP_Query('pagename=' . $name);          $lookup = array(          'post_parent' => $result->post->ID,         'post_type'   => 'page',         'order' => 'ASC',         'orderby' => 'menu_order'     );          $childpages = get_children($lookup);          // if the page has children, spit them out.     if(count($childpages) > 0){         $final_html = '';         foreach($childpages as $k => $post){               setup_postdata($post);               $final_html .= '

'. get_the_title() .'

';              }         return $final_html;          }     // if the page has children, spit them out.          $post = $thispage;          }      This is working fine but sometimes I need to get the children of 2 parent pages. I tried using the shortcode 2 times ([getChild name="page-slug"] [getChild name="page-slug2"]) but it doesn't work. So it would be nice to be able to enter two o r more comma separated parent pages and have all the children listed, like this: [getChild name="page- slug,page-slug2"] I know I should explode the $atts as suggested here (passing multiple parents value into a shortcode) but I don't know how to mix the code and make it work.


How to implement a plugin featuring foursquare like check-in

I need to add a check-in feature (very similar to foursquare check-in) in worpress based site. There will be "Check in" button at the top of the web site, and clicking on it the visitor will be presented with a list of places.   1. Can somebody guide me to decide which one is more suitable for wordpress architecture? i. Clicking the "Check-in" button, make an AJAX call and present the list of places as a modal dialog. ii. Clicking the "Check-in" button, present a Worpress page with list of places and a submit button.   2. Where should I host the server side API? Use Wordpress XML RPC or as a separate API application(May be on a different server and cross site AJAX call can be made via php-curl proxy)?


How to add swipe action to wordpress pages

I have a news website. I have the main front-page and also a couple of "sub" front pages (sport, social). The other sections works through category.php. I like to add a touch gesture functionality, like this one http://jedrzejchalubek.com/glide/, but how can I do it? I mean, how can I load different pages, that are always different? What I see is that these kind of script just positions differently content already loaded. Any ideas?


Add Image to the RSS plugin reader from another RSS

Hello there i need help with the "Super RSS Reader". It works great but i need add function to get image thumbnail from RSS description.               foreach ($rss_items as $item){                 // Get the link                 $link = $item->get_link();                 while ( stristr($link, 'http') != $link ){ $link = substr($link, 1); }                 $link = esc_url(strip_tags($link));                      // Get the item title                 $title = esc_attr(strip_tags($item->get_title()));                 if ( empty($title) )                     $title = __('Untitled');                      // Get the date                 $date = $item->get_date('j F Y');                      // Get the description                 $desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option('blog_charset') ) ) ) );                      if($strip_desc != 0){                     $desc = wp_html_excerpt( $desc, $strip_desc );                     if ( '[...]' == substr( $desc, -5 ) )                         $desc = substr( $desc, 0, -5 ) . '[…]';                     elseif ( '[…]' != substr( $desc, -10 ) )                         $desc .= ' […]';                 }                 $desc = esc_html( $desc );                           // Get the author                 $author = $item->get_author();                 if ( is_object($author) ) {                     $author = $author->get_name();                     $author = esc_html(strip_tags($author));                 }                      // Open links in new tab                 $newtab = ($open_newtab) ? ' target="_blank"' : '';                      echo "\n\n\t";                      // Display the feed items                 echo '
';                 echo '' .$title . '';                 if($show_date)      echo '
' . $date . '';                 if($show_author)    echo ' - ' . $author . '';                 if($show_desc)      echo '
' . $desc . '
';                 echo '
';                 // End display                      $j++;             }         }      Simply i need to add "get the image" part. i found some functions but i am not able implement them. I think many other which use the super rss reader will be happy to know how to add images from description and then display it on widgets. I also post question to creator but no answer so far. Thank you for any advice.


ACF Gallery insert from URL

Have built a gallery using Advanced Custom Fields (ACF) and Flexslider. The slider and images display correctly using the ACF code below. As most of the images will be hosted else where (on an other server).   1. Should I still use `the_field('gallery')` ?   2. How do I format the urls for csv import? This is for a gallery `["174591","174592","174593","174594","174595"]`   3. Do I need to adjust the code to include `wp_get_attachment_url()` Please note I'm not super proficient in php, examples will help.                   <?php              /*         *  View array data (for debugging)         */              var_dump( get_field('gallery') );              /*         *  Create the Markup for a slider         *  This example will create the Markup for Flexslider (http://www.woothemes.com/flexslider/)         */              $images = get_field('gallery');              if( $images ): ?>

                     <?php foreach( $images as $image ): ?>
                             <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php echo $image['caption']; ?>

                     <?php endforeach; ?>

             <?php                  /*             *  The following code creates the thumbnail navigation             */                  ?>

                     <?php foreach( $images as $image ): ?>
                             <img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
                     <?php endforeach; ?>

         <?php endif;               ?>


How can I fix my server so core/plugins/theme update don't silently fail?

I run my own server and have a few dozen WordPress sites. Recently, many updates (plugin and core) have been silently failing. If I try to do the update from the updates page, I get a message like this one: > The update process is starting. This process may take a while on some hosts, > so please be patient. > > Enabling Maintenance mode… > > Updating Plugin Jetpack by WordPress.com (1/1) But it never progresses further. If I attempt the update from the plugins page, I get > Downloading update from > http://downloads.wordpress.org/plugin/jetpack.2.3.1.zip… > > Downloading update from > http://downloads.wordpress.org/plugin/jetpack.2.3.1.zip… But nothing more. There is nothing in either the PHP nor apache error logs, even if I set WP_DEBUG to true. To be clear, this is happening for several plugins on all sites on this server, so I presume there's a configuration issue or other problem. But I don't know where to start looking to fix and/or debug the problem. Can anyone advise? PS - The server is running WHM/CPanel, so it's CENTOS 5.8. Apache 2.2, PHP 5.3 (the problem also occurred in 5.2). The problem began when the managed support made some changes that were designed to stop the server overloading.


How to pull a list of posts in a category while exluding posts in subcategories of the category

I'm using a get_posts() call to pull a list of posts in a specific category. However, the recordset also includes posts in subcategories of the target category. How can I exclude subcategories from the query?               $cat = get_query_var( 'cat' );     $catHidden=get_cat_ID('hidden');     $args = array('cat' => "$cat,-$catHidden");     $myposts = get_posts($args);


Show read more link next to last word

I have this excerpt function                    <?php        function pietergoosen_get_the_content_limit_custom_allowedtags() {         // Add custom tags to this string             return ',<title>,<base>,<link>,<meta>,


Pagination for blog posts reloading same page

**Symptoms** Visiting /blog/ loads the first 10 posts, as expected. Visiting /blog/page/2/ (and onward) loads the new URL but with the same 10 posts. Nothing changes but the URL. **Setup Details** Custom Permalink Structure: `/blog/%year%/%monthnum%/%day%/%postname%/` Static Posts Page: "Blog" (slug of 'blog') I'm using `home.php` to displays posts with the following markup:               <?php     /**      * The archive for blog posts      */          get_header(); ?>

                           <?php while ( have_posts() ) : the_post(); ?>                              <?php get_template_part( 'content', 'blog-index' ); ?>                          <?php endwhile; ?>
                      <?php get_sidebar( 'blog' ); ?>
                     <?php wp_pagenavi(); ?>

          <?php get_footer(); ?>      I've checked for plugin conflicts and I am running a relatively minimalistic setup. I'm using **WP-PageNavi** to generate the pagination. I've also tried renaming the /blog/ page to 'blog2' with the thought that there might be a permalink conflict - same result. /blog2/page/2/ loads the same first 10 posts. Any ideas what might be the cause here?


printf, translation and the_author_posts_link()

For some reason the following code is not displaying correctly on the frontend of my site -               <?php printf( esc_attr__( 'About %s', 'textdomain' ), the_author_posts_link() ); ?>      Instead of displaying the translatable string 'About' before the author's name/link, it's displaying it afterwards. I assume this is because I'm using a function in there instead of a variable. Is there a way to make this work or should I completely re-write this?


Error when requesting password reset email - wp authentication

I get the following error whenever a user tries to request a password reset email:               The e-mail could not be sent.     Possible reason: your host may have disabled the mail() function.      As per recommendations I've read across the web, I tried several SMTP plugins. None worked. Finally, I got some debug information from one. First, the SMTP settings I used (for gmail)               server:  smtp.gmail.com     port: 587     Security:  TLS     Require Auth:  Yes     User:  <myuser>@gmail.com     Pass:  mypass      Here was the result:               The result was:          bool(false)     The full debugging output is shown below:          object(PHPMailer)#365 (65) {       ["Priority"]=>       int(3)       ["CharSet"]=>       string(5) "UTF-8"       ["ContentType"]=>       string(10) "text/plain"       ["Encoding"]=>       string(4) "8bit"       ["ErrorInfo"]=>       string(95) "The following From address failed: <myuser>@gmail.com : Called Mail() without being connected"       ["From"]=>       string(20) "<myuser>@gmail.com"       ["FromName"]=>       string(10) "Tim Shutes"       ["Sender"]=>       string(0) ""       ["ReturnPath"]=>       string(0) ""       ["Subject"]=>       string(50) "WP Mail SMTP: Test mail to <myuser>@gmail.com"       ["Body"]=>       string(68) "This is a test email generated by the WP Mail SMTP WordPress plugin."       ["AltBody"]=>       string(0) ""       ["MIMEBody:protected"]=>       string(69) "This is a test email generated by the WP Mail SMTP WordPress plugin.     "       ["MIMEHeader:protected"]=>       string(453) "Date: Wed, 11 Sep 2013 20:33:18 +0000     Return-Path: <myuser>@gmail.com     To: <myuser>@gmail.com     From: Tim Shutes      Subject: WP Mail SMTP: Test mail to <myuser>@gmail.com     Message-ID:      X-Priority: 3     X-Mailer: PHPMailer 5.2.4 (http://code.google.com/a/apache-extras.org/p/phpmailer/)     MIME-Version: 1.0     Content-Transfer-Encoding: 8bit     Content-Type: text/plain; charset=UTF-8          "       ["mailHeader:protected"]=>       string(0) ""       ["WordWrap"]=>       int(0)       ["Mailer"]=>       string(4) "smtp"       ["Sendmail"]=>       string(18) "/usr/sbin/sendmail"       ["UseSendmailOptions"]=>       bool(true)       ["PluginDir"]=>       string(0) ""       ["ConfirmReadingTo"]=>       string(0) ""       ["Hostname"]=>       string(0) ""       ["MessageID"]=>       string(0) ""       ["MessageDate"]=>       string(0) ""       ["Host"]=>       string(14) "smtp.gmail.com"       ["Port"]=>       string(2) "25"       ["Helo"]=>       string(0) ""       ["SMTPSecure"]=>       string(3) "ssl"       ["SMTPAuth"]=>       bool(true)       ["Username"]=>       string(20) "<myuser>@gmail.com"       ["Password"]=>       string(9) "<mypass>"       ["AuthType"]=>       string(0) ""       ["Realm"]=>       string(0) ""       ["Workstation"]=>       string(0) ""       ["Timeout"]=>       int(10)       ["SMTPDebug"]=>       int(2)       ["Debugoutput"]=>       string(4) "echo"       ["SMTPKeepAlive"]=>       bool(false)       ["SingleTo"]=>       bool(false)       ["SingleToArray"]=>       array(0) {       }       ["LE"]=>       string(1) "     "       ["DKIM_selector"]=>       string(0) ""       ["DKIM_identity"]=>       string(0) ""       ["DKIM_passphrase"]=>       string(0) ""       ["DKIM_domain"]=>       string(0) ""       ["DKIM_private"]=>       string(0) ""       ["action_function"]=>       string(0) ""       ["Version"]=>       string(5) "5.2.4"       ["XMailer"]=>       string(0) ""       ["smtp:protected"]=>       object(SMTP)#364 (11) {         ["SMTP_PORT"]=>         int(25)         ["CRLF"]=>         string(2) "     "         ["do_debug"]=>         int(2)         ["Debugoutput"]=>         string(4) "echo"         ["do_verp"]=>         bool(false)         ["Timeout"]=>         int(10)         ["Timelimit"]=>         int(30)         ["Version"]=>         string(5) "5.2.4"         ["smtp_conn:private"]=>         bool(false)         ["error:private"]=>         array(1) {           ["error"]=>           string(37) "Called Mail() without being connected"         }         ["helo_rply:private"]=>         NULL       }       ["to:protected"]=>       array(1) {         [0]=>         array(2) {           [0]=>           string(23) "<myuser>@gmail.com"           [1]=>           string(0) ""         }       }       ["cc:protected"]=>       array(0) {       }       ["bcc:protected"]=>       array(0) {       }       ["ReplyTo:protected"]=>       array(0) {       }       ["all_recipients:protected"]=>       array(1) {         ["<myuser>@gmail.com"]=>         bool(true)       }       ["attachment:protected"]=>       array(0) {       }       ["CustomHeader:protected"]=>       array(0) {       }       ["message_type:protected"]=>       string(5) "plain"       ["boundary:protected"]=>       array(3) {         [1]=>         string(35) "b1_b0121eb40a93fb27be20cbb901b9250f"         [2]=>         string(35) "b2_b0121eb40a93fb27be20cbb901b9250f"         [3]=>         string(35) "b3_b0121eb40a93fb27be20cbb901b9250f"       }       ["language:protected"]=>       array(18) {         ["authenticate"]=>         string(35) "SMTP Error: Could not authenticate."         ["connect_host"]=>         string(43) "SMTP Error: Could not connect to SMTP host."         ["data_not_accepted"]=>         string(30) "SMTP Error: Data not accepted."         ["empty_message"]=>         string(18) "Message body empty"         ["encoding"]=>         string(18) "Unknown encoding: "         ["execute"]=>         string(19) "Could not execute: "         ["file_access"]=>         string(23) "Could not access file: "         ["file_open"]=>         string(33) "File Error: Could not open file: "         ["from_failed"]=>         string(35) "The following From address failed: "         ["instantiate"]=>         string(36) "Could not instantiate mail function."         ["invalid_address"]=>         string(15) "Invalid address"         ["mailer_not_supported"]=>         string(25) " mailer is not supported."         ["provide_address"]=>         string(54) "You must provide at least one recipient email address."         ["recipients_failed"]=>         string(45) "SMTP Error: The following recipients failed: "         ["signing"]=>         string(15) "Signing Error: "         ["smtp_connect_failed"]=>         string(22) "SMTP Connect() failed."         ["smtp_error"]=>         string(19) "SMTP server error: "         ["variable_set"]=>         string(30) "Cannot set or reset variable: "       }       ["error_count:protected"]=>       int(2)       ["sign_cert_file:protected"]=>       string(0) ""       ["sign_key_file:protected"]=>       string(0) ""       ["sign_key_pass:protected"]=>       string(0) ""       ["exceptions:protected"]=>       bool(false)     }     The SMTP debugging output is shown below:          SMTP -> ERROR: Failed to connect to server: Permission denied (13)          The following From address failed: <myuser>@gmail.com : Called Mail() without being connected      This behavior is ONLY present on the remote site. The password recovery emails work just fine on the local build. Additionally, my understanding is, if this was just a webhost issue, that the SMTP plugins would have worked, which they didn't. Can anyone point me in the right direction here? You can see the behavior here: abundancellc.com/wp-admin - try to request password reset and type in "testuser" as the user. Incidentally, I had no problem setting up "testuser" but I never got an email with my password - even though I requested one. What's going on? If it's the rackspace servers, why won't the SMTP plugins work?


how to mage the submenu open on wordpress active page

i have the same problem in my website click here      how i can change the code for when you click on corporate profile you go to the page and the sub menu stay open please some help


WP_Query pulling an extra post per page

I'm querying to get a list of all posts, 20 posts_per_page, but the result shows all posts, but with 21 posts per page. If I change posts_per_page to 19, then 20 show. One post is sticky and shows up twice; not sure if that is causing the problem. Code:               $allposts = array(          'post_type'         =>  'post',         'posts_per_page'    =>  20         );          $wp_query = new WP_Query($allposts); ?>          <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
<?php the_title(); ?>
          <?php foo_pagination(); ?>          <?php endwhile; ?>


Wp query for custom template page

I want to create custom page template, which this custom page I am copy it from index.php. On index.php I have 3 columns ( 2 sidebar and 1 list content column). But on this custom page I plan to create only in 2 columns which mean 1 for side bar and other one for list content column. I hear an issue that if I want this custom page display content like index.php, i have to use wp query. The question,is how to implement this index.php using wp query? thanks

           <?php if(have_posts()): ?><?php while(have_posts()):the_post(); ?>

<?php the_post_thumbnail('slidethumb'); ?>

                 <a href="<?php the_permalink(); ?>">                 <?php if (strlen($post->post_title) > 40) {                 echo substr(the_title($before = '', $after = '', FALSE), 0, 40) . '...'; } else {                 the_title();                 } ?>
                 <?php the_time('F d, Y'); ?> | <?php the_category(' '); ?>
<?php echo get_the_catcharacter_excerpt(); ?>...

           <?php endwhile; ?>           <?php endif; ?>           <?php if (function_exists('wp_corenavi')) wp_corenavi(); ?>
         <?php get_sidebar('right'); ?>

      Thank God, I have 2 days to solved this problem,,uhhh. You can find answer here WP_Query pulling an extra post per page


Change email for update notification

I've recently got the email with the update notification. `[Example.com] Your site has updated to WordPress 3.8.1` `Howdy! Your site at http://www.example.com has been updated automatically to WordPress 3.8.1. [...]` **I want to change the email where this notification goes.** I seems that it's not connected with any user. I've searched all the backend and I can't seem to find the required setting.


Logging out gives 404 error

When I try to log out of my site, I'm taken to a 404 page, and the logout doesn't work. The url looks like this: http://www.mysite.com/wp- login.php?action=logout&_wpnonce=4a09cb2887&redirect_to=http://www.mysite.com Can someone point me in the right direction?


Tax query array terms display out of order

I want my tax_query terms to display posts in the order I have them listed in the array below but it is not following the order listed.               $args = array(         'post_type' => 'staff',         'posts_per_page' => '-1',         'tax_query' => array(                 array(                     'taxonomy' => 'staff-title',                     'field' => 'slug',                     'terms' => array(                                     'editor-in-chief',                                     'managing-editor',                                     'fiction-editor',                                     'poetry-editor',                                     'nonfiction-editor',                                     'production-manager'                                 )                 )             )     );     $my_query = new WP_Query( $args );              if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post();                               echo'
';                         echo'
';                             echo'
'; the_field('staff_title'); echo'
';                             echo'
'; the_field('staff_member_name'); echo'
';                                        echo'
 ';                         echo'
';                             echo'';                         echo'
 ';                     echo'
 ';                   the_content();      endwhile; endif; ?>      instead it displays posts in this order:   Fiction Editor   Fiction Editor   Poetry Editor   Poetry Editor   Nonfiction Editor   Production Manager   Managing Editor   Editor-in-Chief


WP_Query pagination using only numbers instead of /page/1 on URL

I don't get whats happening here. I'm on a child-page template, generating a WP_Query for Custom Post Types on the fly, like this:               $notrel = new WP_Query(array(         'post_type' => $type,         'posts_per_page' => $perpage,         'monthnum' => $mes,         'year' => $ano,         'paged' => $paged     ));      Loops and $_GET filters for `post_type`, `monthnum` and `year`are all working perfectly. But pagination is giving me trouble. A) If i try the URL `http://example.com/parent-page/child-page/page/4/` i get `paged = 1`. B) On the other hand, `http://example.com/parent-page/child-page/4/` correctly gives `paged = 4` but pagination doesn't work since `next_posts_link` automatically shapes URLs like A. I guess `/page/4/` is standard, so why is it not working here? Is it maybe the rewrite parameter on register_post_type? **EDIT:** still not solved, se this -> paginate_links() adds empty href to first page and previous link


How to Add Wrapper to Infinite Scroll Javascript?

I'm using Wordpress and manually adding Infinte Scroll from paulirish on GitHub: https://github.com/paulirish/infinite-scroll/ It loads properly, but how can I add a wrapper around all my posts? Essentially, I'm outputting each post within a `<li>` tag. And I want to add an `<ol>` to surround/wrap the list item of posts. Any thoughts how to do so? For Reference, this is the script I'm using in the functions.php file:                   /**      * Load Javascript for Infinte Scroll      */     function custom_theme_js(){         wp_register_script( 'infinite_scroll',  get_template_directory_uri() . '/js/jquery.infinitescroll.min.js', array('jquery'),null,true );         if( ! is_page_template( 'archive' ) ) {             wp_enqueue_script('infinite_scroll');         }     }     add_action('wp_enqueue_scripts', 'custom_theme_js');               /**      * Infinite Scroll      */     function custom_infinite_scroll_js() {         if( ! is_page_template( 'archive' ) ) { ?>         <script>         var infinite_scroll = {             loading: {                 img: "<?php echo get_template_directory_uri(); ?>/images/ajax-loader.gif",                 msgText: "<?php _e( 'Loading the next set of posts...', 'custom' ); ?>",                 finishedMsg: "<?php _e( 'All posts loaded.', 'custom' ); ?>"             },             "nextSelector":".navigation .nav-next a",             "navSelector":".navigation",             "itemSelector":".archive-image",             "contentSelector":"#archive-content"         };         jQuery( infinite_scroll.contentSelector ).infinitescroll( infinite_scroll );         </script>         <?php         }     }     add_action( 'wp_footer', 'custom_infinite_scroll_js',100 );      Thanks!


Single Sign On or Bridge with in the WordPress WebSites?

I have 5 different Multisite Installations . I want the registration of all the Multi-Site Installations(Not only sub-sites, the entire installations) as single-sign-on . So a user can login to all the sites if he/she register on one Single website. I could use Some OAuth plugins or Single-sign-on plugins. But they still need two steps to register and login on each WordPress Site. So I would like to customize or use any plugin to do so. I know some PHP and will try to do if any body help me. Could anybody let me know if I should do it by coding or using a plugin? Note : I am using WordPress Installation of 3.1.1 and VPS Server of CentOS Update : I heard about a few options like LDAP, Cosign on etc. There are a few plugins like LDAP, CoSign SSO etc . I don't know how to make use of them . Could anybody let me know if they help me in this situation? BTW, I have activated XAuth and I don't know how to get started with it Thanks !


How to instantiate customize_save_after callback function?

I have to do some custom operations after settings are saved in the customizer. It looks like the callback function isn't invoked. What am I doing wrong? Something to do with the Ajax status of the customizer?               add_action('customize_save_after', 'myCustomizeSaveAfter', 99);     function myCustomizeSaveAfter() {        wp_die("Why don't I die?");     }      NOTE: The reason is not the call to `wp_die()`. Other statements also aren't executed.


How do I remove specific styles from the parent theme css using the child theme css?

There are some styles in my parent theme that I would simply remove from the stylesheet if I was not using a child theme. Obviously, I do not want to remove them from the parent css, but is there a way to effectively "remove" the styles using my child theme?


GeoMashup plugin: how to customize cluster markers / icons?

Is there a way to customize the standard cluster icon marker which GeoMashup uses to display nearby posts grouped in a certain area? By default it's a red dot in V2, or a blue dot in V3. I nee to customize its appearance and replace it with a background/image?


Theme has superfish - how to add supersubs?

I'm using a theme that is using Superfish for the navigation menu. The problem is, if the sub item is too long it will drop underneath, i want to keep the individual menu item's text on one line. Now i've found supersubs for the superfish menu but i don't know how to add it to the theme. This is in the functions.php file.               wp_enqueue_script('superfish', get_stylesheet_directory_uri() . '/js/superfish.js');      and this is in the header.php file.               <script type="text/javascript">     jQuery(function($){     $(document).ready(function(){     //Drop Down Menu     $('ul.sf-menu').superfish({          delay: 1000,         animation: {opacity:'show',height:'show'},         speed: 'normal',         autoArrows:  true,         dropShadows: false         });     });     });     </script>      How can i add supersubs to the menu as well to solve the problem i'm having with the sub items. Thanks


How to manually fix the WordPress gallery code using PHP in functions.php?

It's been talked many times that Wordpress outputs some really bad code for the built-in gallery function. This is the core code responsible for the gallery output (in /wp- includes/media.php):               function gallery_shortcode($attr) {         global $post;              static $instance = 0;         $instance++;              // Allow plugins/themes to override the default gallery template.         $output = apply_filters('post_gallery', '', $attr);         if ( $output != '' )             return $output;              // We're trusting author input, so let's at least make sure it looks like a valid orderby statement         if ( isset( $attr['orderby'] ) ) {             $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );             if ( !$attr['orderby'] )                 unset( $attr['orderby'] );         }              extract(shortcode_atts(array(             'order'      => 'ASC',             'orderby'    => 'menu_order ID',             'id'         => $post->ID,             'itemtag'    => 'dl',             'icontag'    => 'dt',             'captiontag' => 'dd',             'columns'    => 3,             'size'       => 'thumbnail',             'include'    => '',             'exclude'    => ''         ), $attr));              $id = intval($id);         if ( 'RAND' == $order )             $orderby = 'none';              if ( !empty($include) ) {             $include = preg_replace( '/[^0-9,]+/', '', $include );             $_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );                  $attachments = array();             foreach ( $_attachments as $key => $val ) {                 $attachments[$val->ID] = $_attachments[$key];             }         } elseif ( !empty($exclude) ) {             $exclude = preg_replace( '/[^0-9,]+/', '', $exclude );             $attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );         } else {             $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );         }              if ( empty($attachments) )             return '';              if ( is_feed() ) {             $output = "\n";             foreach ( $attachments as $att_id => $attachment )                 $output .= wp_get_attachment_link($att_id, $size, true) . "\n";             return $output;         }              $itemtag = tag_escape($itemtag);         $captiontag = tag_escape($captiontag);         $columns = intval($columns);         $itemwidth = $columns > 0 ? floor(100/$columns) : 100;         $float = is_rtl() ? 'right' : 'left';              $selector = "gallery-{$instance}";              $gallery_style = $gallery_div = '';         if ( apply_filters( 'use_default_gallery_style', true ) )             $gallery_style = "                          ";         $size_class = sanitize_html_class( $size );         $gallery_div = "
";         $output = apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );              $i = 0;         foreach ( $attachments as $id => $attachment ) {             $link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);                  $output .= "<{$itemtag} class='gallery-item'>";             $output .= "                 <{$icontag} class='gallery-icon'>                     $link                 </{$icontag}>";             if ( $captiontag && trim($attachment->post_excerpt) ) {                 $output .= "                     <{$captiontag} class='wp-caption-text gallery-caption'>                     " . wptexturize($attachment->post_excerpt) . "                     </{$captiontag}>";             }             $output .= "</{$itemtag}>";             if ( $columns > 0 && ++$i % $columns == 0 )                 $output .= '
';         }              $output .= "

\n";              return $output;     }      # What I would like to fix? **[1]** The above code outputs css style directly into the post. I want to stop that, as I can easily add the same css code in my style.css stylesheet. **[2]** I want to disable the code from outputting captions of images below their thumbnails. I want the captions to be shown only on the attachment pages, and not in the post. **[3]** The aforementioned code adds two `<br style="clear: both;">` elements after the gallery code. I would also like to disable that, since I can use "margin" in the css code for that. I would like to accomplish the above "THREE" things using some PHP code in the `functions.php` file, as editing the core files is not recommended. Hope someone can be of some help. (I don't know how to code, so, please be as much clear as possible.) Thanks! **RELEVANT:** Source file to look at is `/wp-includes/media.php` (here's the trunk version \-- look for `gallery_shortcode` function).


Get coordinates of selected area to use in image maps

I am developing a WordPress plugin that allows a user to insert image maps on the image from the WordPress default image editor. I want some JavaScript for it so that when user selects some area on the image it returns the coordinates of the selected area to use within the area tag.


search and add in wordpress content

I have a wordpress plugin that displays videos through a shortcode. My problem is it assigns the div's with ID's such as video-1-player, video-2-player, etc. I need to create a function that searches my content for `<div id="video-(any number here)-player">` and adds a class inside the div. I found this code which searches for the first image and than you can print it. My PHP isn't good enough for me to edit it for how i need. Maybe this will help you?               function catch_that_image() {       global $post, $posts;       $first_img = '';       ob_start();       ob_end_clean();       $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);       $first_img = $matches [1] [0];            if(empty($first_img)){ //Defines a default image         $first_img = "/images/default.jpg";       }       return $first_img;     }


Will adding & modifying default Wordpress table index break future Wordpress update

I've some specific use case for certain default wordrpess tables, which I need to add a few indexes to certain columns to improve performance. I'm wondering will adding these indexes break future Wordpress update when they choose to add index to the same column?


Windows 7 download WordPress and load into LAMP stack and configure

What's the quickest way to create a Windows instance of an existing WordPress site assuming I've got the backup of the code and DB from the server? I have played around with various LAMP stacks but wonder if there isn't just something simple and light I can do.