order posts by meta value on posts page

I've been reading alot about how to order posts by a `meta_value`, but I can't seem to get it to work for me. My `meta_key` is called `date`, and it is stored as `yyyy-mm-dd`. Here's where I've gotten to so far:               $args = array(         'posts_per_page' => -1,         'meta_key' => 'date',         'orderby' => 'meta_value_num',         'order' => 'DESC',         'post_type' => 'post',         'post_status' => 'publish'              );     query_posts($args);     if (have_posts()) while (have_posts()) : the_post();       As far as I understand, this _should_ give me what I want - but doing this on the index.php page doesn't seem to change the query. The posts seem to still be ordered by `post_date` rather than my `date` meta value, which is different. What I want to do is override or change the query on the posts and archive pages so that it will order by my meta_key. It is present on every post so there is no issue with what to do if it's not there. Have I got the arguments right, and if so, what more do I need to do to get this working? Any help appreciated **Update:** I tried using WP_Query() with these arguments and printed out the object. The `request` method of the object ordered by `menu_order ASC` and completely ignored my meta_value_num argument. So this is why the ordering doesn't work, but the rest of the query was fine. Any ideas why WP is ignoring my order args? **Another Update** OK, narrowing it down. The date is stored as `text` in the postmeta table, so trying to order by it and expecting MySQL to treat it like a date is a bit silly. To that end, I wrote my own query which gets what I need:               SELECT wp_posts.post_title,            m.*,             STR_TO_DATE(m.meta_value, '%Y-%m-%d') AS m_date     FROM wp_posts       LEFT JOIN wp_postmeta m ON ( wp_posts.ID = m.post_id AND m.meta_key = 'date')     WHERE post_status='publish' AND post_type='post'     ORDER BY m_date DESC      Notice the `STR_TO_DATE()` call? This casts the string as a date, allowing MySQL to order by it correctly. Phew. Now to edit my loop.... Alternatively, does anyone know a hook I could use to edit the query in place as it's called? It would be alot more efficient than running two queries.


Load created php file data via ajax

Ive been trying to do this for a long time here... First of all, im working with Buddypress latest ver. under WP latest ver. What i want to do, is i want to understand how to call content within a php file via ajax. I know php is server side, so doing something like this:               $(#handle).click( function(){     $(#box).load('help.php' #content);     });      will only bring forth html within the document.But I have functions I need within, like let's say for example a user's avatar:               <?php bp_loggedin_user_avatar()?>      The returned content will stop at the function called. Will I have to create pages for all of the php files that I want to call content from? Or, `require` the file to retrieve the content? I've looked at some of the `$ajax` Jquery uses around here, but I 'm not sure which one to implement. I want to load certain content wrapped in specific divs in that php file. Basically, I just need help retrieving content that contains php lol. Any ideas?


Making permalinks to /%postname%/ by default in installation

I am making a custom wordpress distribution I will use for my own sites including my language and a child theme. But, I want the permalinks to be /%postname%/ by default so that I don't need to change this in the setting after installation. How can I do this?


How can you limit the number of images / videos that can be uploaded to a WordPress post

there will be lot of users on my site who will be author uploading their posts. right now, they can upload as many images / videos per post as they want. i want to restrict them to upload maximum 4 images / videos per post. can anybody help me please ?


Activate Akismet on installation with akismet key

I want Akismet to be activated by default on installation with my Akismet API key. I am making my own distribution that I will use on my own sites and I want the plugin and key to already be activated when installing a new wordpress site.


WordPress "include TEMPLATEPATH" or?

I built something like this: **Index Container Widgets Area** and I created a widget for that - **Categories Widget - Index Container .php** with this in:               <?php include (TEMPLATEPATH . '/includes/containers/container-grid-categories.php'); ?>     <?php ///include (TEMPLATEPATH . '/includes/containers/container-list-categories.php'); ?>      and for example in the /includes/containers/ **container-grid-categories.php** is this:               <?php   //include (TEMPLATEPATH . '/includes/containers/container-grid-categories/grid-thumbs.php'); ?>     <?php  include (TEMPLATEPATH . '/includes/containers/container-grid-categories/grid-tumbs-details.php'); ?>      So, my questions, with this everything is working fine, the question is this a good way to make what I did (include TEMPLATEPATH)? Or use another way, and if that what way? Thanks


Importing posts from XML into custom post type

I need to be able to create posts in a custom post type with custom taxonomies from an XML file. It is from a job feed so when a job is added I need to be able to import it into wordpress. Do I just use wp_insert_post() ?


How to restrict posts only from a certain category

I'm making use of this custom code to my loop.php file to restrict non- registered members access to posts from a certain category (cat 1)               <?php if (is_user_logged_in() && $cat == '1') { ?>      <?php the_content(); ?>      <?php } else { ?>      <?php the_excerpt(); ?>     <?php } ?>       However this piece of code doesn't help much as it restricts all posts from other categories as well. Any suggestions?


Looking for the code in twentyten that allows users to select images for the header/banner

I am looking for the code that renders the below page. Where can I find it, it does not appear to be in functions.php? ![](http://i.stack.imgur.com/PGyNO.png) I want to learn how they allow users to upload images


Cannot save Custom Post Type meta data

I've created a custom post type with one meta box. I've already tried everything, but its still not saving the value. Please help.                add_action('init', 'create_post_type');           function create_post_type() {      register_post_type('jh_dedications',             array(                     'labels' => array (                                         'name' => __('Dedications'),                                         'singular_name' => __('Dedication')                                         ),                                         'public' => true,                                         'has_archive' => true,                                         'supports' => array('title','editor','thumbnail'),                                         'show_ui' => true                                         )                         );      }           add_action ("add_meta_boxes", "add_dedications_jh");           function add_dedications_jh() {     add_meta_box('jh_datepicker', 'Select Date', 'jh_datepicker', 'jh_dedications', 'side', 'default');      }           function jh_datepicker() {     global $post;     $custom = get_post_custom($post->ID);     $dedicationDate = $custom["dedicationDate"][0];          ?>     <input type="text" name="dedicationDate" value="<?php echo $dedicationDate; ?>" />      <?php       }           add_action('wp_insert_post_data', 'jh_save_dedication');           function jh_save_dedication() {     global $post;          if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )         return $post->ID;          update_post_meta($post->ID, "dedicationDate", $POST["dedicationDate"]);       }


store/cache ajax sent data to avoid repeated request

I developed a widget that offer a full blown archive search tool, where the user can select various options that are joined into an objects to be passed to WP_Query in an ajax action that returns the results data via JSON. 10 results are sent back to the page so pagination is needed. A new request is sent every time the page is turned. More here. My question is: to decrease the request payload, I want that if the action is called after a page turn the information about the query is not sent but just the change page order is sent. To achieve this i suppose the solution is to store the already sent query. How is possible to do this? thanks!


how to put functions inside of widgets

I'm trying to put my own function in a widget but it doesn't run. I want to use it everywhere within the widget. If I could see an example,that'd be great.


Where does WordPress default SimplePie save cache data? I could only find relevant info about cache durations but not the location. SimplePie has a method called `set_cache_location()` but I cannot find it being used in WordPress. I'm writing a plugin and if a cache folder is available already by default, I'd like to use it rather than creating for my plugin. Does anybody know it?


using new WP_Query in save_post function alters $post

I'm trying to include a WP_Query in a save_post function for a custom post type. The query is used to check all the other posts for a custom field `bh_shortcode` to make sure the content of the field is not duplicated. However, when I create and loop through the wp_query, the value of `$post` changes, and one of the post entires that appears in the results of the wp_query is then set to `$post`, and as a result, all the fields are then saved to the wrong post (rather than the one I have open). The `wp_reset_query()` doesn't appear to have any effect. How can I correct this?               function save_bhour_details(){         global $post;              if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){             return;         }              if ( get_post_type($post) != 'bhours'){             return;         }              //validate shortcode         $bh_shortcode='';         $error_shortcode_empty=false;         $error_shortcode_duplicate=false;                   if(isset($_POST['bh_shortcode']) && !empty($_POST['bh_shortcode'])){             $bh_shortcode=bh_strip_special_chars($_POST['bh_shortcode']);                  if(empty($bh_shortcode)){                 $error_shortcode_empty=true;             }             else{                      $query_validate = new WP_Query(array(                     'post_type'=>'bhours',                 ));                      while($query_validate->have_posts()){                     $query_validate->the_post();                     $bh_post_shortcode=array_shift(get_post_custom_values('bh_shortcode'));                          if($bh_post_shortcode==$bh_shortcode){                         $error_shortcode_duplicate=true;                         break;                     }                 }                 wp_reset_query();                        }              }         else{             $error_shortcode_empty=true;         }              if(!$error_shortcode_empty && !$error_shortcode_duplicate){             update_post_meta($post->ID, 'bh_shortcode', $bh_shortcode);         }         else{             update_post_meta($post->ID, 'bh_shortcode', '');         }          }     add_action('save_post', 'save_bhour_details');


How to display numbered pages in a category

How in category.php to output a numbered list of links to pages like: 1 2 3 4 5 when the number of posts in the category exceeds the number of posts to display?


How to force Wordpress to add new images at the beginning of the gallery?

I have the standard gallery embedded in the page and want to add new images to it. When I select images and click `Add to gallery` button Wordpress adds them at the end. How to force it to add images at the beginning (top)?


Returning the entire line of a custom search result filter

I have the below code which filters search results to only return those of a specific parent page:               function SearchFilter($query) {     if ($query->is_search) {         //$query->set('post_type', 'page');         global $post;         $query->set( 'post_parent', '1548' );     }     return $query;     }     add_filter('pre_get_posts','SearchFilter');      What I am looking to do instead of return the entire list of posts, is to return only the line in which the results were found, and display those in an unordered list. So, say I search for "nott" It would not list all the posts which contain "nott", but instead return the lines, eg:   * Nottingham   * Notting Hill   * Nottoway Any idea how that might be possible?


Linking wordpress plugin page with another in the same directory

I am making a plugin page on wordpress admin, that I have connected it using the `add_menu_page()` command. This page displays a list of custom post type using wp_query. I am trying to link each title of the custom post to a seperate page that can edit the post (actually only two bits of information, title and featured image), without the use of edit.php. For that, I have created a separate php file inside the plugin dir called myedit.php which takes only one parameter "pid" (the post id) along the page parameter that is needed to load the page from the plugin dir. Is there a way to convert myedit.php automatically to the link that wordpress makes when it is added to a menu page, like: `[domain]/wp-admin/admin.php?page=[plugin_name]/myedit.php&pid=1234` without making it hardcoded, especially the [plugin_name] parameter on the page? When I tried the hardcoded and not included to the menu way, it says "You do not have sufficient permissions to access this page."


Sort posts by custom taxonomy name

Is it possible to **sort posts (custom post type) by category / taxonomy** (name, desc)? For example my categories would be   * Season 2012      * some post      * some post      * some post    * Season 2011      * some post      * some post      * some post    * Season 2010    * etc..


How to allow -- in category name

How allowed "--", "---" or any other symbol in terms(category) **URL**. Now WordPress replace from "--" to "-" ps.I`m using to Subdomain plugin. And IDN subdomain Example: xn--...site.com/ There xn-- is category (url)


Send reset password link to user from custom lost password form

I've been struggling searching through a bunch of tutorials with no luck. I have a custom login page and am just replacing the login form with the forgot password form on click. My issue is how to get the form to send the user a reset password link if the correct username or email is entered and return an error if not. I'm trying to do this from a plugin I'm making to handle the login. Here's my simple form. How do I make this work?                 <form id="wp_pass_reset" action="" method="post">         <input type="text" id="email-field" name="user_input" value="Username or Email" /><br />         <input type="submit" id="submitbtn" name="submit" value="Reset" />       </form>


How to get child taxonomies

This is the custom post type structure I have: Custom Post Type   * Custom Taxonomy     * Sub Taxonomy 1     * Sub Taxonomy 2     * Sub Taxonomy 3 On the current Custom Post Type post/page, I need the code that finds the Sub Taxonomy (or Sub Taxonomies) of that post and output it as a link to other posts with the same sub taxonomy (separated by a comma, if it has more than one Sub Taxonomy). The following code is close to what I'm looking for but I need it for the current post, I don't want it as a list and there has to be a comma separating them if there's more than one               <?php     $term_id = 10;     $taxonomy_name = 'products';     $termchildren = get_term_children( $term_id, $taxonomy_name );          echo '
';     foreach ( $termchildren as $child ) {         $term = get_term_by( 'id', $child, $taxonomy_name );         echo '
name, $taxonomy_name ) . '">' . $term->name . '
';     }     echo '
';     ?>


modrewrite not working on my Apache setup

Not sure if this is webmaster or a WordPress question, it's a bit half and half, sorry if I'm posting in the wrong place. Without using Multi-Site or installing new WordPress CMS' in second-level domains, what's the best way to get multiple WordPress installs running on my VPS (running Linux powered CentOS 6 with WHM and cPanel)? It's currently working but only by setting the permalinks option to the default setting, so the URLs aren't human-friendly. I have come across something called WPSiteStack, though I'd really rather not go down this route. Long story short, I need the following:   * Seperate installs so one core / theme / plugin update doesn't affect all sites and increases security of all sites;   * 'Pretty' permalinks;   * Each WordPress install must be in the root of it's own domain to ensure that I can accurately measure my clients' quotas; It may also be worth noting that some functions within each install use the $_SERVER['DOCUMENT_ROOT'] and $_SERVER['HOST'] variables. I have already edited the httpd-vhosts.conf, httpd.conf and .htaccess files but this hasn't made any changes. So any ideas what I'm missing or doing wrong? Any help is much appreciated. **UPDATE:** mod_rewrite is definitely included and has been all along, though it's not working with custom post types on one install and not working at all on all other installs. So /%year%/%monthnum%/%day%/%postname%/ is only working for standard 'post' and 'page' post types on one install while on other installs, which don't use custom post types, it's not working at all so only default permalink setting works for them.


Rewrite rules for subterms in custom taxonomies

I am using a large number of custom taxonomies. My post type is called "location" and there is a parent term "Asia" and a subterm "Thailand". Now I created the taxonomy archive template files according to the Wordpress Codex, which is working in the following format: **taxonomy-location-Thailand.php** (see codex for taxonomy-$taxonomy-$term.php) After that my permalinks will look like following:   * www.mysite.com/location/thailand As Thailand is a subterm of Asia, I need the parent term also included, like following:   * www.mysite.com/location/ **asia** /thailand Anybody knows how to include a redirect for all subterms to have their parent terms included in the permalinks? As I am having a large number of taxonomies, I need this working in one function, and not seperated for each single term.


Set a maximum upload count for users on a specific user role

For users with the `Contributor` user role, I want to restrict the total amount of images that they are allowed to upload. I found this code posted on an answer here:               add_filter( 'wp_handle_upload', 'wpse47580_update_upload_stats' );     function wpse47580_update_upload_stats( $args ) {              $user_id = get_current_user_id();              $upload_count = get_user_meta( $user_id, 'upload_count', $single = true );              update_user_meta( $user_id, 'upload_count', $upload_count + 1 );     }          add_filter( 'wp_handle_upload_prefilter', 'wpse47580_check_upload_limits' );     function wpse47580_check_upload_limits( $file ) {         $user_id = get_current_user_id();              $upload_count = get_user_meta( $user_id, 'upload_count', $single = true );              $upload_count_limit_reached = apply_filters( 'wpse47580_upload_count_limit_reached', 10 ) > ( $upload_count + 1 );              if ( $upload_count_limit_reached  )             $file['error'] = 'Upload limit has been reached for this account!';              return $file;     }      There are two problems. Firstly, the above code does not function properly, it is supposed to allow 10 uploads but the upload limit message is displayed no matter what. Secondly, it applies to _all_ user roles. Upon further research, I found this working answer, but the solution applies for total uploads per post, not user. How can I set an upload count limit for users on a specific user role? Ideally with a solution that deducts the count if user permanently removes an uploaded image.


grouping my widgets wordpress

In the widgets page, there are two boxes "Available Widgets" and "Inactive Widgets". How can I add a new boxe with my custom name where I can group all my widgets.


NextGen gallery 2.0: How to display image title & description

I was trying to display image title & description below to the image while viewing **full-size** image but it fails! when i call `title`, it returns `description` of the image. I'm not either using any `LightBox` effects. any idea why this happening? I'm using: **Wordpress 3.7.1** , **NextGEN Gallery by Photocrati 2.0.30** Thanks in advance!


Relative path in wp_register_style not working

I have this function:               function test_add_my_stylesheet() {         wp_register_style( 'test-admin-style', plugins_url('../css/style.css', __FILE__) );         wp_enqueue_style( 'test-admin-style' );     }      but the css is not loaded in my admin area. Why? In the html source code from the browser it looks like this:               <link rel='stylesheet' id='test-admin-style-css'  href='http://www.******.com/wp-content/plugins/******/includes/../css/style.css?ver=3.6.1' type='text/css' media='all' />      instead of:               <link rel='stylesheet' id='test-admin-style-css'  href='http://www.******.com/wp-content/plugins/******/css/style.css?ver=3.6.1' type='text/css' media='all' />      Why is that? how can I fix this part:               /plugins/*******/includes/../css/style.css      to the correct one:               /plugins/*******/css/style.css


Upon registration, redirect new user to Dashboard

How could I redirect someone to the dashboard rather than the front end once they have registered on my site? **EDIT:** What I would like to do is to redirect someone to the Dashboard once they have signed in with their username and password. Many thanks.


How to make a template for a specific post of a custom post type?

For the `Page` post type: I can create a `logout` page in the CMS and create a `page-logout.php` for its template. I created an `Account` post type but I can't use `account-user- registration.php` for a `User Registration` post under `Account` post type.


Setting WPLANG from a plugin

For a single site wordpress, the language must be set from `wp-config.php`'s `WPLANG`, but is it possible to set from my plugin which override the default value?


Comments RSS Feed showing repeating title

## functions.php I added a filter in the functions.php file to grab the do_feed_rss2 and the do_feed_atom with my own RSS function with just a simple a simple text replacement "Answers" instead of "Comments". I'm definitely not trying to use stacks as my own debugger, please let me know if that's how this comes across, just completely stooped on this one. Any help would be muchly appreciated.               <?php      function answersrss2( $for_comments ) {         if ( $for_comments ) {             header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);                  echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';             ?>             <rss version="2.0"                 xmlns:content="http://purl.org/rss/1.0/modules/content/"                 xmlns:dc="http://purl.org/dc/elements/1.1/"                 xmlns:atom="http://www.w3.org/2005/Atom"                 xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"                 <?php do_action('rss2_ns'); do_action('rss2_comments_ns'); ?>                 >             <channel>                 <title><?php                     if ( is_singular() )                         printf(ent2ncr(__('Answers on: %s')), get_the_title_rss());                     elseif ( is_search() )                         printf(ent2ncr(__('Answers for %s searching on %s')), get_bloginfo_rss( 'name' ), esc_attr($wp_query->query_vars['s']));                     else                         printf(ent2ncr(__('Answers for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss());                 ?></title>                 <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />                 <link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>                 <description><?php bloginfo_rss("description") ?></description>                 <lastBuildDate><?php echo mysql2date('r', get_lastcommentmodified('GMT')); ?></lastBuildDate>                 <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>                 <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>                 <?php do_action('commentsrss2_head'); ?>             <?php             if ( have_comments() ) : while ( have_comments() ) : the_comment();                 $comment_post = get_post($comment->comment_post_ID);                 get_post_custom($comment_post->ID);             ?>                 <item>                     <title><?php                         if ( !is_singular() ) {                             $title = get_the_title($comment_post->ID);                             $title = apply_filters('the_title_rss', $title);                             printf(ent2ncr(__('Answers on %1$s by %2$s')), $title, get_comment_author_rss());                         } else {                             printf(ent2ncr(__('By: %s')), get_comment_author_rss());                         }                     ?></title>                     <link><?php comment_link() ?></link>                     <dc:creator><?php echo get_comment_author_rss() ?></dc:creator>                     <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true, false), false); ?></pubDate>                     <guid isPermaLink="false"><?php comment_guid() ?></guid>             <?php if ( post_password_required($comment_post) ) : ?>                     <description><?php echo ent2ncr(__('Protected Comments: Please enter your password to view comments.')); ?></description>                     <content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded>             <?php else : // post pass ?>                     <description><?php comment_text_rss() ?></description>                     <content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded>             <?php endif; // post pass                 do_action('commentrss2_item', $comment->comment_ID, $comment_post->ID);             ?>                 </item>             <?php endwhile; endif; ?>             </channel>             </rss>     <?php         } else             load_template( ABSPATH . WPINC . '/feed-rss2.php' );     }               function answersatom( $for_comments ) {         if ($for_comments)             { ?>                 <?php                 header('Content-Type: ' . feed_content_type('atom') . '; charset=' . get_option('blog_charset'), true);                 echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>';                 ?>                 <feed                     xmlns="http://www.w3.org/2005/Atom"                     xml:lang="<?php echo get_option('rss_language'); ?>"                     xmlns:thr="http://purl.org/syndication/thread/1.0"                     <?php do_action('atom_ns'); do_action('atom_comments_ns'); ?>                 >                     <title type="text"><?php                         if ( is_singular() )                             printf(ent2ncr(__('Comments on %s')), get_the_title_rss());                         elseif ( is_search() )                             printf(ent2ncr(__('Comments for %1$s searching on %2$s')), get_bloginfo_rss( 'name' ), get_search_query() );                         else                             printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss());                     ?></title>                     <subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>                          <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT'), false); ?></updated>                      <?php if ( is_singular() ) { ?>                     <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php comments_link_feed(); ?>" />                     <link rel="self" type="application/atom+xml" href="<?php echo get_post_comments_feed_link('', 'atom'); ?>" />                     <id><?php echo get_post_comments_feed_link('', 'atom'); ?></id>                 <?php } elseif(is_search()) { ?>                     <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo home_url() . '?s=' . get_search_query(); ?>" />                     <link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" />                     <id><?php echo get_search_comments_feed_link('', 'atom'); ?></id>                 <?php } else { ?>                     <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('url'); ?>" />                     <link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" />                     <id><?php bloginfo_rss('comments_atom_url'); ?></id>                 <?php } ?>                 <?php do_action('comments_atom_head'); ?>                 <?php                 if ( have_comments() ) : while ( have_comments() ) : the_comment();                     $comment_post = get_post($comment->comment_post_ID);                     get_post_custom($comment_post->ID);                 ?>                     <entry>                         <title><?php                             if ( !is_singular() ) {                                 $title = get_the_title($comment_post->ID);                                 $title = apply_filters('the_title_rss', $title);                                 printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss());                             } else {                                 printf(ent2ncr(__('By: %s')), get_comment_author_rss());                             }                         ?></title>                         <link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss('html_type'); ?>" />                              <author>                             <name><?php comment_author_rss(); ?></name>                             <?php if (get_comment_author_url()) echo '<uri>' . get_comment_author_url() . '</uri>'; ?>                              </author>                              <id><?php comment_guid(); ?></id>                         <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_comment_time('Y-m-d H:i:s', true, false), false); ?></updated>                         <published><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_comment_time('Y-m-d H:i:s', true, false), false); ?></published>                 <?php if ( post_password_required($comment_post) ) : ?>                         <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php echo get_the_password_form(); ?>]]></content>                 <?php else : // post pass ?>                         <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php comment_text(); ?>]]></content>                 <?php endif; // post pass                     // Return comment threading information (http://www.ietf.org/rfc/rfc4685.txt)                     if ( $comment->comment_parent == 0 ) : // This comment is top level ?>                         <thr:in-reply-to ref="<?php the_guid(); ?>" href="<?php the_permalink_rss() ?>" type="<?php bloginfo_rss('html_type'); ?>" />                 <?php else : // This comment is in reply to another comment                     $parent_comment = get_comment($comment->comment_parent);                     // The rel attribute below and the id tag above should be GUIDs, but WP doesn't create them for comments (unlike posts). Either way, its more important that they both use the same system                 ?>                         <thr:in-reply-to ref="<?php comment_guid($parent_comment) ?>" href="<?php echo get_comment_link($parent_comment) ?>" type="<?php bloginfo_rss('html_type'); ?>" />                 <?php endif;                     do_action('comment_atom_entry', $comment->comment_ID, $comment_post->ID);                 ?>                     </entry>                 <?php endwhile; endif; ?>                 </feed>             <?php }         else             load_template( ABSPATH . WPINC . '/feed-atom.php' );     }          add_filter('do_feed_rss2', 'answersrss2', 1, 1);     add_filter('do_feed_atom', 'answersatom', 1, 1);     ?>


WordPress.com vs WordPress.org

This question might seem a little silly but I was wondering what is the differences between WP.com and WP.org? I know the main differences like you can't edit a them file without paying for it, you might get some ads and you get a youname.wordpress.com domain but what are the little features that make the difference.


Get the post children count of a post

Is there a fast way to get the count (number) of post children of a certain post? (The post has a custom post type) I don't want to use WP_Query for this because I don't need all the extra data... **LE:** based on wyrfel's answer I ended up using:               function reply_count($topic, $type = 'topic-reply'){       global $wpdb;       $cache_key = "{$type}_{$topic}_counts";       $count = wp_cache_get($cache_key, 'counts');       if(false !== $count) return $count;       $query = "SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_parent = %d AND post_type = %s";       $count = $wpdb->get_var($wpdb->prepare($query, $topic, $type));       wp_cache_set($cache_key, $count, 'counts');       return $count;     }


Migrating problem from Joomla to WP

My summer job is to migrate blog and web site from Joomla CMS to Wordpress and have no Wordpress installed on server and have no PHP in use. Cause of PHP is in no use, that excluses using Plugin -tools like CMS2CMS. Is there any way to do that in a clever way and in an automated way? Automated way would be better alternative than manual way. I used Joomla Backup -extensions and now I have my whole site backuped as a JPA -file. Is it possible to convert it to Wordpress import -file in some way without having Wordpress server -installation ? I haven't found a tool for that yet, and been looking for couple of hours with Google.


Deleting Custom Posts & Meta Data on Uninstall

My uninstall.php file won't delete my custom posts and the meta data related to them on uninstall. The plugin files get deleted, but nothing from the database. If anyone is able to have a look at this and see if I've got something wrong or I'm missing something, I'd greatly appreciate it. Thanks!               // If uninstall is not called from WordPress, or the current user doesn't have the capability to delete plugins     if ( !defined( 'WP_UNINSTALL_PLUGIN' ) || !current_user_can_for_blog( $GLOBALS['blog_id'], 'delete_plugins' ) ) {         exit();     }          // Remove posts of the 'mrlpt_client' type from DB and the post meta          function mrlpt_delete_plugin() {              $mrlpt_client_posts = get_posts( array(             'numberposts' => -1,             'post_type' => 'mrlpt_client',             'post_status' => 'any' ) );              foreach ( $mrlpt_client_posts as $mrlpt_client_post ) {             delete_post_meta( $mrlpt_client_post->ID, '_mrlpt_client_email' );             delete_post_meta( $mrlpt_client_post->ID, '_mrlpt_client_phone_num' );             wp_delete_post( $mrlpt_client_post->ID, true );         }          }          mrlpt_delete_plugin();      **Edit:** I have tried using sql queries instead, and again it's not working quite right. I'm working in a multisite set-up, and the posts and post meta data ARE deleted on the MAIN site (wp_). However, the second site (wp_4_) is not working, nothing is deleted. What am I missing to get this working in multisite? It's very odd because I have another sql query in my main plugin file to dynamically populate a drop- down field in a form and it works fine.               global $wpdb; // Must have this or else!          $postmeta_table = $wpdb->postmeta;     $posts_table = $wpdb->posts;          $wpdb->query("DELETE FROM " . $postmeta_table . " WHERE meta_key = '_mrlpt_client_email'");     $wpdb->query("DELETE FROM " . $postmeta_table . " WHERE meta_key = '_mrlpt_client_phone_num'");     $wpdb->query("DELETE FROM " . $posts_table . " WHERE post_type = 'mrlpt_client'");      **Edit 2:** Hard-coding in the prefix of the second site (wp_4_) instead of using $wpdb, it then DOES delete the posts and meta data in the database. But, obviously I can't be hard-coding that in. Any ideas as to what's going on here? I'm truly stumped.


Output comment_author in array

In functions.php for part of custom comments, I have the following echoed array as the link to respond to a previous comment:               <?php echo comment_reply_link(array(     "before" => " ",      "after" => "",      "reply_text" => "Reply to this comment",      "depth" => $depth,      "max_depth" => $args["max_depth"]      ));       ?>      I am trying to get the link to replace the word "this" with the `comment_author()`. I am a novice at php, and have tried every syntax I can think of but have failed. I would appreciate if someone can help me with this. To be clear, I'm looking for a way to make the following work.               <?php echo comment_reply_link(array(     "before" => " ",      "after" => "",      "reply_text" => "Reply to " . echo comment_author() here . "'s comment",      "depth" => $depth,      "max_depth" => $args["max_depth"]      ));       ?>


Showing as logged in after logout (W3 Total Cache issue)

I've got a login/logout link using wp_loginout(). After a user logs out their user info is still being shown by get_currentuserinfo(), only after they visit a second page does it revert to not showing any user info. They are, however actually, logged out after the initial logout (as they can't access any protected pages). If I disable the plugin I don't experience this issue. How can I ensure that when a user logs out the change is reflected without having to visit a second page? http://wordpress.org/extend/plugins/w3-total-cache/


How do I write this SQL statement for Posts written in last 24 hours?

Someone gave me this SQL code to count the number of posts (of post_type 'mixtapes') in the last 7 days. I tried to convert it to 'in the last 24 hours' as well, but it's giving the wrong number. Here's his code which works for 7 day period:               $querystr = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'mixtapes' AND post_date >= DATE_SUB(CURRENT_DATE, INTERVAL 7 DAY) LIMIT 0, 30");     if (0 < $querystr) $querystr = number_format($querystr);      Here's my code for 1 day period which gives wrong answer               $querystr = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'mixtapes' AND post_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 DAY) LIMIT 0, 30");     if (0 < $querystr) $querystr = number_format($querystr);


Customized Comment Form Issues

I'm developing a Wordpress theme and I faced a problem while customizing a comment form. What I wanted is to eliminate URL field and put my own classes for name and email fields. I'm doing it like this:                   $commenter = wp_get_current_commenter();         $req = get_option( 'require_name_email' );         $aria_req = ( $req ? " aria-required='true'" : '' );         $fields =  array(             'author' => '
' . __( 'Name' ) . '<input type="text" id="post-comment-name" name="post-comment-name" placeholder="Write your name" value="' . esc_attr( $commenter['comment_author'] ) . '" ' . $aria_req . ' />
',             'email' => '
' . __( 'Email' ) . '<input type="text" id="post-comment-email" name="post-comment-email" placeholder="Your email to reply" value="' . esc_attr( $commenter['comment_email'] ) . '" ' . $aria_req . ' />
',             'url' => ''         );         $comments_args = array(             'title_reply' => '',             'comment_notes_before' => '',             'id_submit' => 'post-comment-submit',             'fields' =>  $fields         );              comment_form($comments_args);      After all visually I've got what I wanted. I've got form with all the styles I wanted and with no URL field whatsoever. **The problem** is when I try to submit the comment form with all the data filled in I get the message: "Fields name and email are required" and comment submission fails. Tried almost everything, nothing helped. Please assist!


Custom post type conditional in loop

I need multiple loops on a page and have created them as such               global $post;     $args = array( 'numberposts' => 3, 'category' => 10 );     $myposts = get_posts( $args );     foreach( $myposts as $post ) :  setup_postdata($post); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?> "><?php the_title();?>
     <?php endforeach; ?>      I have a custom post type (foo_post_type) which should be used as a conditional while the loop runs. For example, for each post in this loop:               if ('foo_post_type' == 'xyz' || 'foo_post_type' == '0' && 'category' => 10) {      ...then display in the loop.....     }      But I am able to grab the custom post type for each post in the loop before the loop runs. And if I grab the custom post type during the loop it returns the same (usually incorrect) value. Where can I stick this foo_post_type in the loop shown at the top so it displays and evaluates each post bringing back the latest 3 which adhere to each condition? (Unfortunately, I do not have a public link to the site.)


Echo all API Settings sections?

Is there a WordPress function displaying all sections registered with add_settings_section()? I was thinking about SQL query maybe, but have absolutely no idea how and where these are stored, couldn't find them in my database.


How to parse this shortcode?

I have a shortcode like this `[soundcloud url="http://api.soundcloud.com/tracks/67658191" params="" width=" 100%" height="166" iframe="true" /]` How can I get the content of the URL part or extract the whole shortcode in a post and then display it? `do_shortcode` doesn't help a lot. I want to use that shortcode in my theme and since the URL part is dynamic I have difficulty of having it display dynamically.


How to get the permanent link in a plugin?

I'm writing a plugin to add some extra contents that contain the permanent link to the (single) post.               function abcd_add_contents($content) {         $extra_content = the_permalink();              if (is_single()) {              $content .= $extra_content;         }         return $content;     }          add_filter('the_content', 'abcd_add_contents');      `the_permalink()` does not work. How can I obtain the permanent link information of the current post in this plugin function?


List Category Posts plugin - underline links

I want to underline links in the default template for the List Category Posts plugin. I can't find where to do this in the template & styles. Any assistance would be gratefully accepted.


Page template not registering on theme

I have the following code for a page. When I select the template Home Page from the drop down menu in the page edit, it doesn't work on my web host, but locally it works fine, so I don't think it is my code. I don't know why its not working though.               <?php     /*     Template Name:Home Page     */     ?>     <?php get_header(); ?>     test

         <?php              $page_id = 2;              $page_data = get_page( $page_id );             $content = apply_filters('the_content', $page_data->post_content);             echo $content;              ?>

     <?php get_footer(); ?>


mamp pro virtual hosts with wordpress

So I'm using MAMP PRO, to have a better vhost utility. Ok. I've got serious problems with wordpress. I successfully done this:   1. pointed a vhost reghellin.unbit.it to: /Users/stratboy2/Documents/01-LAVORI/perbacco/XHTML/SITO-PERBACCO/   2. Installed wp 3.3.1 multisite here: /Users/stratboy2/Documents/01-LAVORI/perbacco/XHTML/SITO-PERBACCO/giboperbacco ok? I then:   1. setted up another vhost www.giboperbacco.com to: /Users/stratboy2/Documents/01-LAVORI/perbacco/XHTML/test_multisite   2. installed there a normal (for now..) fresh version of wp. Can't really install it. Every time I go to www.giboperbacco.com, I get redirected to test.unbit.it/giboperbacco Why? 1 IMPORTAT NOTE: this issue happens only with wordpress. If I substitute wp's index.php under [path]/test_multisite with another index.html or even another .php with no wordpress code, the vhost WORKS FINE. So I guess it's not really a vhost problem, maybe some kind of wp problem. 2 IMPORTANT NOTE I also tried to create and point some more vhosts to [path]/test_multisite, but all keep redirecting to test.unbit.it/giboperbacco Any idea?


Pagination for custom query on single.php

I'm building a site and the basic structure on most pages is as follows:               <!-- content query -->     <!-- recent posts preview query (paginated) -->     <!-- related posts preview query (paginated) -->      The paginated content is loading on the same page using jQuery, so just that specific section updates when the user navigates to the next page or a section. Most of my pages are literally pages with custom templates on which I run custom queries (WP_query) for each thing. This works really well on the custom pages, but I am trying to implement it similarly on single.php. The structure I want on single.php is:               <!-- post content -->     <!-- recent posts preview query (paginated) -->     <!-- related posts preview query (paginated) -->      However, my code that works perfectly fine on custom pages has broken pagination on single.php. Researching this, it seems it may be conflicting with the fact that posts themselves can be paginated. I've not been able to find much more info than that. Does anyone know if it's possible to achieve my goal here? Is there any workaround, in any capacity that would make it happen? Thank you very much for any insight you might be able to offer!


What is the structure for a one-page layout?

I have a html template and I'd like to convert it to wp. I have a basic question regarding to the wp structure: my template is a one-page layout like this http://eriktailor.com/showcase/flatbook_preview_1.0/ebook-landing- page.html How should I structure the different sections? I mean these would become pages or posts? I think pages would be a more relevant solution, but how can I get more different pages (instead of one) to my index.php? I know it's a complex question what can't be answered in a few words, I was just hoping to get a point for how should I start. Actually I searched a lot for a one-page template wp convertion tutorial, but haven't found anything useful, that's why I'm asking here. Thanks for your time.


How do I make a meta_query OR relation work?

Here's are wp_query args:               $args = array(         'post_type' => 'sportpages'         ,'post_status' => 'publish'         ,'posts_per_page' => 1000         ,'post_parent' => 4738         ,'meta_query' => array(             'relation' => 'OR'             ,array(                 'key' => 'ecpt_sportgender_2'                 ,'value' => 'Boys'                 ,'compare' => 'LIKE'             )             ,array(                 'key' => 'ecpt_sportgender_2'                 ,'value' => 'Both'                 ,'compare' => 'LIKE'             )         )     );      My results are odd. I'm getting only the posts for Boys unless I swap Boys for Girls, in which case I get Girls. The only way to get "Both" is to make it get ONLY Both, and not do the relationship. The order in which I put them in there makes no difference. What am I missing?


solved - wp-admin/index.php gives a "500 Internal Server Error

experts, UPDATE: hello dear experts **UPDATE.** many many thanks for the great ideas and tipps. overwhelming - really your are overwhelming!!! i have done as adviced and this method made it clear. i created a folder which i called plugins-deactivated... into this folder i copied / or let me say moved all the modules a the end i had left an empty folder called wp-plugins:-) and now i was able to login and see the dashboad... ;<) some / one of the following ones sure cauese the troubles...               The plugin amazon-einzeltitelv1.2/amazon-einzeltitellinksv1.2.php has been deactivated due to an error: Plugin file does not exist.     The plugin amazon-link/amazon.php has been deactivated due to an error: Plugin file does not exist.     The plugin amazon-product-in-a-post-plugin/amazon-product-in-a-post.php has been deactivated due to an error: Plugin file does not exist.     The plugin amazon-scraper/amazon-plugin.php has been deactivated due to an error: Plugin file does not exist.     The plugin amazonsimpleadmin/amazonsimpleadmin.php has been deactivated due to an error: Plugin file does not exist.     http://literaturen.org/wp-admin/plugins.php      end of update: afters installation and a few configuration-tasks i cannot login any more; http://www.my-page.org/wp-login.php - this can be reached http://www.my-page.org/wp-admin/ - this only shows a blank page well - what happened, /wp-admin/install.php works as it should. /wp-admin/index.php gives a "500 Internal Server Error" i ve checked permissions and ownership. I seem to be able to access .css files and images located inside the /wp-admin folder with no problem, but the index.php file causes a 500 error.


Filter posts by specific custom category and current tag

I have set up a custom post type (buyers_club) with a custom category (buyers- club) and custom tags (country). I'd like to show a list of related posts by specific category, FEATURED, and by the current tag. So far I have this but it isn't working:
     <?php     $country_name = strip_tags( get_the_term_list( $wp_query->post->ID, 'country' ) );     query_posts('post_type=buyers_club&buyers-club=featured&country= .$country_name . &showposts=5');     while ( have_posts() ) : the_post();     ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
     <?php endwhile; ?>     <?php wp_reset_query(); ?>
         Can anybody help? UPDATE I have changed it to this with mixed results. I have one query that gets the posts of a specified category and current tag. This works except that it does not exclude the current post from the list:                <?php             $country_name = strip_tags( get_the_term_list( $wp_query->post->ID, 'country' ) );             $args = array(             'post_type'=> 'buyers_club',             'buyers-club'    => 'Featured',             'country' => $country_name,             'order'    => 'ASC',             'exclude' => $post->ID,             'posts_per_page' => 5                  );             query_posts( $args );                  while ( have_posts() ) : the_post();             echo '
';             the_title();             echo '
';             endwhile;          // Reset Query     wp_reset_query();     ?>      Then I have a query that gets related posts from the current category AND current tag. This does not work:               <?php             $country_name = strip_tags( get_the_term_list( $wp_query->post->ID, 'country' ) );             $category_name = strip_tags( get_the_term_list( $wp_query->post->ID, 'buyers-club' ) );             $args = array(             'post_type'=> 'buyers_club',             'buyers-club'    => $category_name,             'country' => $country_name,              'order'    => 'rand',         'exclude' => $post->ID,             'posts_per_page' => 5             );             query_posts( $args );                  while ( have_posts() ) : the_post();             echo '
';             the_title();             echo '
';             endwhile;          // Reset Query     wp_reset_query();     ?>


Default Plugin Settings Not Writing to Database

I have my plugin setup as such: Main plugin file `mouldings.php`               <?php          /*     Plugin Name: Moulding Profiles     Plugin URI:      Description: Creates a 'Moulding Profiles' and 'Idea Gallery' custom post type, creates a 'Wood Types' and 'Categories' taxonomy for 'Moulding Profiles'     Version: 0.1     Author:      Author URI:      License: GPL2     */          // Global Variables     $mouldings_prefix = 'mouldings_';     $mouldings_name = 'Mouldings';               // plugin folder url     if(!defined('MOULDINGS_BASE_URL')) {         define('MOULDINGS_BASE_URL', plugin_dir_url(__FILE__));     }     // plugin folder path     if(!defined('MOULDINGS_BASE_DIR')) {         define('MOULDINGS_BASE_DIR', plugin_dir_path( __FILE__ ));     }     // plugin root file     if(!defined('MOULDINGS_PLUGIN_FILE')) {         define('MOULDINGS_PLUGIN_FILE', __FILE__);     }          // Includes     include('includes/register-settings.php'); // Register          // Retrieve settings from the options page     $mouldings_options = get_option('mouldings_settings');          include('includes/install.php'); // Sets default plugin settings on activation     include('includes/plugin-settings.php'); // Plugin options page HTML/Save functions     include('includes/scripts.php'); // Conrols JS/CSS     include('includes/admin-post-types.php'); // Sets up post types/taxonomies     include('includes/helper-functions.php'); // Functions that extend functionality of Mouldings     include('includes/admin-metaboxes.php'); // Metaboxes that appear in the admin (non-ACF)     include('includes/display-functions.php'); // Holds filters/actions for output          ?>      In `register_settings.php` I have setup the options:               <?php          function mouldings_register_settings_initial() {              if( false == get_option( 'mouldings_settings' ) ) {               add_option( 'mouldings_settings' );           }              register_setting('mouldings_settings_group', 'idea_gallery_thumb_height');         register_setting('mouldings_settings_group', 'idea_gallery_thumb_width');         register_setting('mouldings_settings_group', 'collection_thumb_height');         register_setting('mouldings_settings_group', 'collection_thumb_width');         register_setting('mouldings_settings_group', 'profile_item_columns');         register_setting('mouldings_settings_group', 'idea_item_columns');         register_setting('mouldings_settings_group', 'collections_item_columns');         register_setting('mouldings_settings_group', 'combinations_item_columns');          }     add_action('admin_init', 'mouldings_register_settings_initial');      and then in `install.php`               <?php          function mouldings_activate() {         global $wpdb, $mouldings_options;         if ($mouldings_options === false){             $mouldings_options = array(                 'idea_item_columns' => '4'             );             update_option( 'mouldings_settings', $mouldings_options );         }     }     register_activation_hook( MOULDINGS_PLUGIN_FILE, 'mouldings_activate' );      So, what I'm trying to do is setup the options table entry, `moulding_settings`, register the settings and then on activation, set the test value, `idea_item_colummns` to `4`. On activation currently, the options table entry is created, but without any settings and the default `idea_item_columns` is not set/created either. Once I visit my settings page and save the values, they pop-up in that table as need - but something just doesn't seem to be clicking on activation. Here is my settings page if that helps at all:               <?php          function mouldings_options_page() {              global $mouldings_options;              ob_start(); ?>

<?php _e('Mouldings Options','roots'); ?>
                  <form method="post" action="options.php" id="mouldings_options">                      <?php settings_fields('mouldings_settings_group'); ?>
<?php _e('Image Sizes','roots'); ?>

<?php _e('The options below are used to resize the various images that appear throughout Moulding Profiles, Idea Galleries, Moulding Combinations and Moulding Collections. If any values are left blank, they are assumed to be un-restricted. If you put anything other than a number in those boxes, I\'ll take out the screws in your office chair.','roots'); ?>

                     <?php _e('Idea Gallery Thumbnail Size','roots'); ?>                     <input id="mouldings_settings[idea_gallery_thumb_height]" name="mouldings_settings[idea_gallery_thumb_height]" type="text" value="<?php echo (isset($mouldings_options['idea_gallery_thumb_height'])) ? $mouldings_options['idea_gallery_thumb_height'] : ''; ?>">                     <?php _e('height (pixels)','roots'); ?>                     <input id="mouldings_settings[idea_gallery_thumb_width]" name="mouldings_settings[idea_gallery_thumb_width]" type="text" value="<?php echo (isset($mouldings_options['idea_gallery_thumb_width'])) ? $mouldings_options['idea_gallery_thumb_width'] : ''; ?>">                     <?php _e('width (pixels)','roots'); ?>

                     <?php _e('Moulding Collection Thumbnail Size','roots'); ?>                     <input id="mouldings_settings[collection_thumb_height]" name="mouldings_settings[collection_thumb_height]" type="text" value="<?php echo (isset($mouldings_options['collection_thumb_height'])) ? $mouldings_options['collection_thumb_height'] : ''; ?>">                     <?php _e('height (pixels)','roots'); ?>                     <input id="mouldings_settings[collection_thumb_width]" name="mouldings_settings[collection_thumb_width]" type="text" value="<?php echo (isset($mouldings_options['collection_thumb_width'])) ? $mouldings_options['collection_thumb_width'] : ''; ?>">                     <?php _e('width (pixels)','roots'); ?>

<?php _e('Column Settings','roots'); ?>

<?php _e('The options below are used to set a column count for each row.','roots'); ?>
                 <?php $item_columns = array('1','2','3','4','5','6','7','8','9','10'); ?>
                     <?php _e('Moulding Profile Item Columns','roots'); ?>                     <?php $profile_item_columns = $item_columns ?>                     <select name="mouldings_settings[profile_item_columns]" id="mouldings_settings[profile_item_columns]">                         <?php foreach($profile_item_columns as $profile_item_column) { ?>                         <?php if($mouldings_options['profile_item_columns'] == $profile_item_column) { $selected = 'selected="selected"'; } else { $selected = ''; } ?>                             <option value="<?php echo $profile_item_column; ?>" <?php echo $selected; ?>><?php echo $profile_item_column; ?></option>                         <?php } ?>                     </select>

                     <?php _e('Idea Gallery Item Columns','roots'); ?>                     <?php $idea_item_columns = $item_columns ?>                     <select name="mouldings_settings[idea_item_columns]" id="mouldings_settings[idea_item_columns]">                         <?php foreach($idea_item_columns as $idea_item_column) { ?>                         <?php if($mouldings_options['idea_item_columns'] == $idea_item_column) { $selected = 'selected="selected"'; } else { $selected = ''; } ?>                             <option value="<?php echo $idea_item_column; ?>" <?php echo $selected; ?>><?php echo $idea_item_column; ?></option>                         <?php } ?>                     </select>

                     <?php _e('Moulding Collections Item Columns','roots'); ?>                     <?php $collections_item_columns = $item_columns ?>                     <select name="mouldings_settings[collections_item_columns]" id="mouldings_settings[collections_item_columns]">                         <?php foreach($collections_item_columns as $collections_item_column) { ?>                         <?php if($mouldings_options['collections_item_columns'] == $collections_item_column) { $selected = 'selected="selected"'; } else { $selected = ''; } ?>                             <option value="<?php echo $collections_item_column; ?>" <?php echo $selected; ?>><?php echo $collections_item_column; ?></option>                         <?php } ?>                     </select>

                     <?php _e('Moulding Combinations Item Columns','roots'); ?>                     <?php $combinations_item_columns = $item_columns ?>                     <select name="mouldings_settings[combinations_item_columns]" id="mouldings_settings[combinations_item_columns]">                         <?php foreach($combinations_item_columns as $combinations_item_column) { ?>                         <?php if($mouldings_options['combinations_item_columns'] == $combinations_item_column) { $selected = 'selected="selected"'; } else { $selected = ''; } ?>                             <option value="<?php echo $combinations_item_column; ?>" <?php echo $selected; ?>><?php echo $combinations_item_column; ?></option>                         <?php } ?>                     </select>

                     <input type="submit" class="button-primary" value="<?php _e('Save Options','roots'); ?>">
                      <?php                      if(function_exists('RegenerateThumbnails')) {                     ob_start(); ?>

Notice: If you are altering the thumbnail sizes, remember to <a href="<?php echo admin_url('tools.php?page=regenerate-thumbnails'); ?>">Regenerate Thumbnails

                     <?php echo ob_get_clean();                 }                 else {                     ob_start(); ?>

Notice: You do not have <a href="<?php echo admin_url('plugin-install.php?tab=search&type=term&s=regenerate+thumbnails&plugin-search-input=Search+Plugins'); ?>">Regenerate Thumbnails installed. It is recommended to use this plugin - as this is the tool used to re-sample your images based on your preferences.

                     <?php echo ob_get_clean();                 }                      ?>                  </form>
              <?php         echo ob_get_clean();     }          function mouldings_add_options_link() {         add_options_page(__('Mouldings Options','roots'),__('Mouldings','roots'),'manage_options','mouldings-options','mouldings_options_page');     }     add_action('admin_menu','mouldings_add_options_link');          function mouldings_register_settings() {         register_setting('mouldings_settings_group','mouldings_settings');     }     add_action('admin_init','mouldings_register_settings');          ?>      I've been at this for a few hours and am hoping it's something small (well, if it's too small, I may loose my sanity, but any help would really be appreciated). Thanks.


Difference between do_action('admin_enqueue_scripts', $hook_suffix) and do_action("admin_print_styles-$hook_suffix") syntax

Source ref:               do_action('admin_enqueue_scripts', $hook_suffix);     do_action("admin_print_styles-$hook_suffix");      Laying aside the obvious difference in base action ( `admin_enqueue_scripts` vs `admin_print_scripts` ), what is the _syntactical_ difference between these two? I know that for the second, the corresponding `add_action()` call is like so:               function wpse99999_enqueue_admin_scripts( 'appearance_page_pagename' ) {         // wp_enqueue_script() call here     }     add_action( 'admin_print_styles-appearance_page_pagename', wpse99999_enqueue_admin_scripts );      But how would the first look? How is the `$hook_suffix` passed here? Perhaps it is passed as a parameter to the callback?               function wpse99999_enqueue_admin_scripts( 'appearance_page_pagename' ) {         // wp_enqueue_script() call here     }     add_action( 'admin_enqueue_scripts', 'wpse99999_enqueue_admin_scripts' );      Or is it _returned_ by the callback?               function wpse99999_enqueue_admin_scripts() {         // wp_enqueue_script() call here         return 'appearance_page_pagename';     }     add_action( 'admin_enqueue_scripts', 'wpse99999_enqueue_admin_scripts' );      Or is it something else entirely?


Facebook share functionality in wordpress loop

I am trying to add `facebook share` functionality to my `wordpress` posts. in my `wp loop` i have a share button                share this      i am not getting `post title ,post thumpnail` etc. what is wrong with my code. and before starting loop i have javascript code like


disable WP automatically inserted line breaks after an image

I've set medium sized images to a custom size which should allow for both of the images to align horizontally within the post. (The full post width is 880px, medium images are set to 413px.) My challenge is that the images are not evenly aligned - the image on the right is always a little lower UNLESS there is another group of medium images immediately below, in which case that second group will be aligned evenly. I think this may be something to do with WP automatically inserting line breaks after an image, but the few ways I've tried to disable this haven't been successful.. What I've put in the post:                          What is read by the browser:

      Attempted (unsuccessful) solutions - 1 How do I disable linebreaks after images? 2 Why is Wordpress adding a linebreak after my floated image? Site link. ![enter image description here](http://i.stack.imgur.com/FoSr1.png)


wordpress query from multiple post id

I am getting array of post id from custom metabox.I tried                           $urls= get_post_meta( get_the_ID(), 'videos', false );                  foreach ( $urls as $url ) {                    foreach ( $url['link'] as $u ) {                       $posts[] = $u;                          }     $my_query = new WP_Query( array( 'post_type' => 'slider', 'post__in' => $posts ) );          if ( $my_query->have_posts() ) {        while ( $my_query->have_posts() ) {             $my_query->the_post();             the_title();        }     }          wp_reset_postdata();     }      This loop query the selected post ids but they are not in id order.They are in default ASC order.Other approach that I have tried               $a=explode(" ",$u);     //$posts[]=$u;     $my_query = new WP_Query( array( 'post_type' => 'slider', 'post__in' => $a ) );      This shows only last post in the array.On var dump               string(2) "67" string(2) "77" //$u


Some posts returning 404 instead of displaying post

I'm having a problem with my Wordpress install. All of a sudden some of my posts return 404 errors when I try to go to their permalink. My post names are all numbers and this started happening when my numbered posts went over 1000. So for example, this post works correctly: http://kidlolly.com/post/999/ But this one returns a 404: http://kidlolly.com/post/1000/ Any clue what might be the root of the problem? I am suspect maybe my .htaccess file but I admit I am not super savvy on .htaccess so I'm not quite sure what to look for. I am running a few "security" plugins that affect the .htaccess but since it isn't a problem for posts 1-999 I am not sure what to look for. Here's where I think the problem might be in .htaccess file (if that is indeed the case), anyone able to help me interpret it?                   RewriteCond %{QUERY_STRING} \.\.\/ [NC,OR]         RewriteCond %{QUERY_STRING} ^.*(bash|git|hg|log|svn|swp|cvs) [NC,OR]         RewriteCond %{QUERY_STRING} etc/passwd [NC,OR]         RewriteCond %{QUERY_STRING} boot\.ini [NC,OR]         RewriteCond %{QUERY_STRING} ftp\:  [NC,OR]         RewriteCond %{QUERY_STRING} http\:  [NC,OR]         RewriteCond %{QUERY_STRING} https\:  [NC,OR]         RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]         RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|%3D) [NC,OR]         RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [NC,OR]         RewriteCond %{QUERY_STRING} ^.*(\[|\]|\(|\)|<|>|ê|"|;|\?|\*|=$).* [NC,OR]         RewriteCond %{QUERY_STRING} ^.*("|'|<|>|\|{||).* [NC,OR]         RewriteCond %{QUERY_STRING} ^.*(%24&x).* [NC,OR]         RewriteCond %{QUERY_STRING} ^.*(%0|%A|%B|%C|%D|%E|%F|127\.0).* [NC,OR]         RewriteCond %{QUERY_STRING} ^.*(globals|encode|localhost|loopback).* [NC,OR]         RewriteCond %{QUERY_STRING} ^.*(request|select|concat|insert|union|declare).* [NC]         RewriteCond %{QUERY_STRING} !^loggedout=true         RewriteCond %{QUERY_STRING} !^action=rp         RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in_.*$         RewriteCond %{HTTP_REFERER} !^http://maps\.googleapis\.com(.*)$         RewriteRule ^(.*)$ - [F,L]      Thanks in advance!


Filter next_post_link() and previous_post_link() by meta_key?

I have a page with two sections, each uses a different `WP_Query()` to pull in `events`, which are a custom post type. Each `WP_Query()` queries a `meta_key` for the event date so that Section 1 only displays upcoming `events` and Section 2 displays past `events`. The upcoming `events` in Section 1 display all relevant information on my page, so clicking them is not possible. The past `events` in Section 2 only display the `event` title and are clickable. When users click a past `event` they link to a custom `single- event.php` template for the past `event`. I want to display Previous/Next navigation in the `single-event.php` template, but the navigation should only point to past `events`. I tried using `next_post_link()` and `previous_post_link()` but these will link to upcoming `events` too, which I do not want. I can probably setup a new `WP_Query()` on my `single-event.php` and loop through it to get the Prev/Next IDs, but repeating the query seems like a drastic step. I would really appreciate some insight on a way to filter out upcoming `events` from my Previous/Next post links. I've seen this question but I would prefer not to use a plugin.


wp_nav_menu doesn't add current-menu-item when there is an url parameter

`wp_nav_menu` doesn't add the `current-menu-item` CSS class when there is an url parameter in the url. Is there a way to ignore the url parameter?


Meta query for comparing two dates

I want to list all users who registered in between the $start_date and $end_date.I have written a metaquery,but it returns empty.Please help.               $start_date        =  2014-08-16 09:28:17     $end_date          =  2015-08-16 09:28:17     $current_user_id   =  get_current_user_id();     $args = array(     'meta_query' => array(         'relation' => 'AND',             array(                 'key' => 'user_registered',                 'value' => $start_date,                 'compare' => '>',                 'type' => 'NUMERIC'             ),             array(                 'key' => 'user_registered',                 'value' => $end_date,                 'compare' => '<=',                 'type' => 'NUMERIC'             ),             array(                 'key'  => 'referral_id',                 'value' => 'current_user_id',                 'compare'=> '=',                 'type' => 'NUMERIC'             )         ),          );     $users = get_users($args);


Custom theme - pages in menu

I am glad for the opportunity to be a member of this community. Lately I decide to start learning wordpress and theme building so this is my first post here. I read some tutorials around the net about how to construct a custom theme. My question is, how can I build my custom menu? For example I have the template on psd, I slice it and then I want to integrate it on wordpress. I support that first I build pages. Then how can I build a menu with custom css/xhtml which every link point to the pages I created? Maybe the description it's not clear but I suppose you understand what I mean. Thanks in advanced.


Menu with Automatic Pages Included from Custom Post Type

Question - How can one utilize the wordpress 3.0 Menu system to automatically have new pages from a custom post type included within the menu (I am referring to the Menu Management area of wordpress for the public website). I believe this currently works for the regular "pages" if you check the automatically incude box but is there a way to also hard code it to work for pages from a custom post type?


Have the plugin completely render a page

I'm working on a plugin that uses pretty links by using rewrite rules like so:               add_rewrite_rule(       $slug . '/email/([^/]*)/?',       'index.php?pagename=' . $slug . '&page_type=email&id=$matches[1]',       'top'       );      This works fine and I am able to modify `the_content` and anything else I would normally hook onto. However, I need this specific pretty link to render a completely custom page for this type of request -- complete with custom CSS and HTML. I'm wondering what the best practice for this is. I've thought about making a custom template for just this type of request, but that CSS of this page depends on the parameters passed in through the URL. I can simply change the rewrite rule to redirect to a php file in my plugin that will generate the custom view:               add_rewrite_rule(       $slug . '/email/([^/]*)/?',       'wp-content/plugins/myPluginName/view.php?id=$matches[1]',       'top'       );      But is there a more "Wordpress" way of doing it? Is there an action I can hook onto to tell Wordpress that I will be generating the entire page?


Specific mail notification

I have a sport site, where every user who registers is a collaborator by default, and when he writes an article, the people I want can approve it.   This is what I want:   If someone writes an article about soccer (which is a category), only the editors that I want (so every editor which is subscribed in soccer) will receive an email with a link to approve and publish the article.   Is there a plugin for it? I'm using Email Alerts, which do the job, but send to everyone the mail.


Custom Post Type Causing Admin Sidebar UI Issue

I created custom type plugin, that if it is activated will make admin sidebar scroll follow along the admin screen height, instead of let it stuck. What makes it doing like that?


Theme options save routine clashes with plugin save

I've got an issue in which my theme's save options routine is being called when a plugin options page (contact form 7) is being saved. This throws an error that points to my "for each" loop inside my theme options save. Am I doing something wrong here?               add_action('admin_menu', 'mytheme_admin');          /* ADMIN PANEL     **********************************/     function mytheme_admin()     {         global $themename, $shortname, $options;               if (isset($_REQUEST['action']) && 'save' == $_REQUEST['action'])              {                 foreach ($options as $value)                  {                     if( isset( $value['id'] ) && isset( $_REQUEST[$value['id']] ) )                      {                         update_option( $value['id'], stripslashes($_REQUEST[$value['id']])  );                      }                     else                     {                         if(isset($value['id'])) {update_option( $value['id'], "");}                     }                 }             }     }


User "none" role

Can someone explain what does the "none" user role mean in WordPress? Which capabilities has this user role? Is it a good practise to use that role for a basic user registration? Thank you.


Widget Development - Displaying dropdown content

I'm using the following code to create a widget to select a post from a dropdown - which works fine in the backend, but I can't figure out how to display this on the frontend...               <?php           class RandomPostWidget extends WP_Widget     {       function RandomPostWidget()       {         $widget_ops = array('classname' => 'RandomPostWidget', 'description' => 'Displays a featured post' );         $this->WP_Widget('RandomPostWidget', 'Featured Homepage Post', $widget_ops);       }            function form($instance)       {         $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );         $title = $instance['title'];     ?>
<label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" />
            <select name="page_id" id="page_id">      <?php      global $post;      $args = array( 'numberposts' => -1,'category' => 5);      $posts = get_posts($args);      foreach( $posts as $post ) : setup_postdata($post); ?>                     <option value="<? echo $post->ID; ?>"><?php the_title(); ?></option>      <?php endforeach; ?>      </select>          <?php       }            function update($new_instance, $old_instance)       {         $instance = $old_instance;         $instance['title'] = $new_instance['title'];         return $instance;       }            function widget($args, $instance)       {         extract($args, EXTR_SKIP);              echo $before_widget;         $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);                 if (!empty($title))           echo $before_title . $title . $after_title;;              // WIDGET CODE GOES HERE         echo "

";              echo $after_widget;       }          }     add_action( 'widgets_init', create_function('', 'return register_widget("RandomPostWidget");') );               ?>      I'm probably overlooking something simple - but any help would be greatly appreciated. Thanks


query_post by title?

is it possible to create a loop of posts using WP_Query or query_posts using the title? ie               $args = array('post_title'='LIKE '.$str.'% ');          $res = WP_Query($arg);          // the loop...               // trying this now...     $mypostids = $wpdb->get_col("select ID from $wpdb->posts where post_title like 'Abb%' ");          echo count($mypostids).", ";    // works but can't echo out array of IDs for the next args?          $args = array(         'post__in'=> $mypostids     );          $res = WP_Query($args);          while( $res->have_posts() ) : $res->the_post(); ...


Memory size exhausted when extending WP_Query

I tried to create a class that extends WP_Query, but I got this error: ` Allowed memory size of 1073741824 bytes exhausted ` I've increased the memory size in wp-config.php but that doesn't affect. Here is my code:               class WPO_Query extends WP_Query {         var $post_type = 'wp_order';              public function __construct( $args = array() ) {         }              public function query( $data = array() ) {             return parent::__construct( $data );         }     }      and               $queries = new WPO_Query();     $orders = $queries->query( array( 'some' => 'data' ) );      But I won't get a error, when I use parent::__construct inside class __construct. I hope you guys answer me instead vote me down.


Intermittently missing pages and posts in WordPress

Every now and then some of my Wordpress pages (and posts) seems to be missing, I get the 404 page (although the HTTP response code is 200). A couple of hours later the page is back, with no changes in the backend The only thing that I can think of that might cause this is the W3 Total Cache Plugin, but I can't figure out how. Has anyone seen this behaviour before? 3.1 multisite, nginx and w3tc.


insert data in database table from plugin with WP3.1

I am quite new in WP Plugin World. I am trying to develop a plugin in WP 3.1 when I am trying to insert data into my table named "`wp_enam`" in the following way:               $wpdb->insert($wpdb->enam, array('username' => "enam" ,                                      'useremail' => "myemail@somedomain.com"));      it is not working. I try to debug it in following way:               $wpdb->show_errors();     $wpdb->insert($wpdb->enam, array('username' => "enam" ,                                      'useremail' => "myemail@somedomain.com"));     $wpdb->print_error();       Now I am getting following message from MR.WP               WordPress database error: [Incorrect table name '']     INSERT INTO `` (`username`,`useremail`) VALUES ('enam','myemail@somedomain.com')          WordPress database error: [Incorrect table name '']     INSERT INTO `` (`username`,`useremail`) VALUES ('enam','myemail@somedomain.com')      As you can see the table name is not showing in the mysql query. Is this a correct way to access a table name with `$wpdb->my_table`? **I am using mysql**. Thanks in advance. **Edit 1:** Looks like `$wpdb->tblname`do not add the table prefix anymore! As per _"Professional WordPress Wrox" by Hal Stern, David Damstra and Brad Williams"_ (which is a great book ) it should work. The above functionality is explained at this book in the following way:               $wpdb->my_custom_table to reference the table in WordPress.      This translates to wp_my_custom_table if wp_ is the table prefix.      This is the proper way to determine the correct table prefix when working with tables in the WordPress database.      ( _Page:107_ )


Moving/dragging a metabox removes TinyMCE's content

I added a TinyMCE editor to my plugin settings page, but once I move (drag) the metabox, editor's content get lost. (the TinyMCE editor is completely not editable until refresh) Here is how I added TinyMCE editor:               add_action( 'admin_head', 'add_tinymce_editor' );          function add_tinymce_editor() {         if ( function_exists( 'wp_tiny_mce' ) ) {             add_filter('teeny_mce_before_init', create_function( '$a', '                 $a["mode"] = "textareas";                 $a["editor_selector"] = "";                 $a["plugins"] = "safari,inlinepopups,spellchecker";                 return $a;')             );                  wp_tiny_mce( true );         }     }      Any ideas what can cause this bug and how to prevent/fix it? Thanks.


Wordpress - Public side and Private side

I'm wanting to setup a Wordpress site which has posts for public view and some which are only seen by people that are logged in (authors etc). I dont want the public people to see "Restricted Content" message or anything, just they cant see the posts and if the go to a post direct it'll push them back to the home page. How can I achvied this so that its easy to select which posts can/can't be viewed by public users? help please


How to show customized activity for custom post types in buddypress activity loop?

I'm building a city portal/ social business directory with buddypress and wordpress. All business listings are stored as a custom post type called 'business'. I'm using the following code to show the activity related to business listings in the activity stream               function bbg_record_my_custom_post_type_comments( $post_types ) {           $post_types[] = 'business';           return $post_types;       }     add_filter( 'bp_blogs_record_comment_post_types', 'bbg_record_my_custom_post_type_comments' );      this is the result http://i.stack.imgur.com/Poaay.png Right now it says > user commented on the post 'postname' While I need it to say > user wrote a review on 'postname' for the business post type, and > user commented on 'postname' for other post types. Any help is greatly appreciated.


What is the plugin to import image from URL?

How can i import image from specific URL to image gallery in Wordpress so that i can use it as a thumbnail for post? I search for a plugin.


How do i code exit popup plugin?

I need to code a exit popup plugin with jquery . It should be similar as this one http://kbeezie.com/view/cross-browser-exit-pop/ the demonstration is here http://kbeezie.com/exitpop.html Can anyone please help me how to code this so it display on all pages and posts. Any type of help/tip will be appreciated. THanks


Is the content of a Wordpress blog GPL?

I would like to ask if the content of a wordpress blog--not the theme, but the actual entries--are GPL? I would like to be doubly sure before I create a wordpress account. Please note: I have no beef with GPL, and respect that some people like it. I simply prefer things that aren't put under this license. Cheers! Fiton


Has anyone used require.js for handling plugin scripts?

I'm starting to refactor the code of my plugin and I'm thinking about using require.js to handle the scripts so that i have a codebase which is more modular and testable. And I'm also planning to load by myself all the required dependencies (jQuery included) so that I'm not hindered by WordPress versions. Has anyone ever done anything similar?


Single database for multiple instances

I would like to create two instances of WP on a single domain. For example, I would like wp1.domain.com and wp2.domain.com to use a single database (same comments/posts). One for production and one for development. Is this possible, and if so, how?


Redirect back to origin page after using get_delete_post_link()

I need to implement frontend and backend redirection after delete specific post using get_delete_post_link(). Which hook i can use? Any advice would be appreciated. Something similar to :               <?php echo wp_login_url( $redirect ); ?>      I need to redirect to front-end page after post deleted, similar to wp_login_url can do. As Barry said my code might look like below:               add_filter( 'get_delete_post_link', 'some_function', 20 );     function some_function() {       wp_redirect( get_permalink() );       exit;     }      Assume get_permalink will get current page where get_delete_post_link called. Any better way for this?


Jquery UI Datepicker via Ajax call, issue in hiding weekdays dynamically

This is my code:               var hideweek;     var day;     var cloDays = new Array();     function initdatepicker(hideweek){              var splitWeek = hideweek.split("&&");              $.each( splitWeek, function( skey, svalue ) {             cloDays[skey] = svalue;         });              $("#datepicker").datepicker({             dateFormat: 'mm-dd-yy',             showOn: "button",             buttonImage: "<? bloginfo('template_directory') ?>/images/cal.png",             buttonImageOnly: true,             minDate: 0,             beforeShowDay: function(date) {                 day = date.getDay();<br/>                 return [(day !=1 && day !=2)];             }         });     }      On ajax response I called this function 'initdatepicker' with parameter (1&&3&&5). Here 1, 3 and 5 are week days number which I don't want to show. So I split the string (hideweek) and stored in array (cloDays). Now I need to make this portion of code dynamic.               ##     return [(day !=1 && day !=2)];


Apostrophes showing up as ΓÇÖ after converting from Windows to Linux

I'm trying to move my WordPress blog from Windows to Linux, but I'm seeing a weird character encoding problem in the Linux version that I'm not seeing on Windows. (I had thought it was an issue with the way I used `mysqldump` to export the data, but after upgrading mysql, dumping, checking, etc., I'm pretty sure I did that part OK). The data in the database on Windows is exactly the same as it is on Linux. Here's what apostrophe's look like on my Windows blog: ![enter image description here](http://i.stack.imgur.com/4NkLG.png) And here's how it appears on the Linux blog: ![enter image description here](http://i.stack.imgur.com/9DF63.png) As you can see, there's a weird `ΓÇÖ` series of characters instead of an apostrophe. Is there a setting in WordPress that I need to change to get it to render it correctly? More details: Windows, I'm getting back in the response the following bytes for the single apostrophe:               E2 80 99      Linux, I'm getting back bytes for `ΓÇÖ`:               CE 93 C3 87 C3 96


Converting timestamps to local time with date_l18n()

I've got a WordPress cron job that sends an email periodically and saves the timestamp when it was sent as an option, and I'd like to display a date on a settings page. Something like, "The last email was sent on 'x'". I'm on the west coast of the US, so our time is currently seven hours off of UTC. My expected output from date_i18n(), passing it the timestamp, would be a locally formatted date with a seven hour adjustment from UTC. However, it returns the time in UTC. Even trying to get the current time doesn't return what I would think would be the expected output. For example: `echo date_i18n('F d, Y H:i');` outputs April 05, 2013 11:36 as expected, but `echo date_i18n('F d, Y H:i',time());` outputs April 05, 2013 18:36. Is this intentional? How can I return a locally formatted date from a preexisting time stamp? Thanks for any help.


Adding (blog-specific) links to “My Sites” admin page

The _My Sites_ admin page only has links to the sites’ dashboards and production pages which is of limited value. I am trying to figure out a way to add a more useful links to them like _New Post_ , _Drafts_ , and _Comments_ in order to make the page a practical central administration location (that way, I don’t have to use a page that I cobbled together with IFrames several years ago for this). Obviously I will have to write a plugin, but I’m having trouble finding good examples of modifying the admin pages, especially in this specific manner (adding blog-specific information to multiple items on an admin page). The closest thing I could find was right here; a question about sorting the items, but the accepted solution simply adds a filter to sort the list of blogs and doesn’t help with this. The file `/wp-admin/my-sites.php` creates the blog list on the _My Sites_ page with the following code:               foreach ( $row as $user_blog ) {         $s = $i == 3 ? '' : 'border-right: 1px solid #ccc;';         echo "";         echo "
{$user_blog->blogname}
";              /* CREATE LINKS HERE: */         echo "
" . apply_filters( 'myblogs_blog_actions', "userblog_id ) ). "'>" . __( 'Visit' ) . " | userblog_id ) ) . "'>" . __( 'Dashboard' ) . "", $user_blog ) . "
";              echo apply_filters( 'myblogs_options', '', $user_blog );         echo "	";         $i++;     }      There are two problems:   1. I can find no information on chaining a modification to the `myblogs_blog_actions` filter. The best I can accomplish is to append some text to the HTML containing the links, but without information on the specific blog being processed, I cannot provide blog-specific links, at least not without first parsing the links already provided which seems like the wrong way to be doing this.   2. I cannot find any information on a function that returns the URL of the comments, post-new, or drafts (or other admin) pages. Obviously I could append a hard-coded string to the blog root URL (e.g., `post-new.php`) but that seems kludgy; surely there is a proper built-in way to get them. I made a test plugin which can modify the links, but it has no way of accessing the blog id to provide blog-specific links because no additional parameters are provided. I suppose I could parse the existing links in the string passed to the filter, but that is as inelegant as it gets:               add_filter('myblogs_blog_actions', 'my_sites_links');     function my_sites_links($links, $a, $b, $c) {     return                 "\n"       . var_dump($links) . "\n"       . var_dump($a)     . "\n"       . var_dump($b)     . "\n"       . var_dump($c)     . "\n";      Does anyone have any suggestions on accomplishing this?


Problem adding MP3 attachments to a jPlayer playlist

I'm trying to get a post's mp3 attachments working with the jplayer plugin (with playlist addon). I have it working for a set number of attachments, but am failing to find a dynamic solution for any number of attachments. Currently, the mp3 attachment urls and titles are fetched and added as attributes to the '.jp-playlist' div. This is so the data can be accessed via jquery to set up a playlist for the jplayer. (this may not be the most elegant solution, so any feedback on a better method appreciated) Code to setup jPlayer in single.php:

previous

play

pause

next

       jQuery code to initialise jPlayer and set up the playlist:               jQuery(document).ready(function($) {            var myPlaylist = new jPlayerPlaylist({         jPlayer: "#jquery_jplayer_1",         cssSelectorAncestor: "#jp_container_1"         }, [           {              title: $(".jp-playlist").attr("data-title-1"),              mp3: $(".jp-playlist").attr("data-track-1")            },           {              title: $(".jp-playlist").attr("data-title-2"),              mp3: $(".jp-playlist").attr("data-track-2")            },           {              title: $(".jp-playlist").attr("data-title-3"),              mp3: $(".jp-playlist").attr("data-track-3")            }         ], {         swfPath: "Jplayer.swf",         supplied: "mp3"       });     });                                            This works fine if there are three mp3 attachments, but I need to make it adaptable for any number of attachments. I guess the solution is to have a javascript loop to get all the data-track/title attributes, and outputting them into an array for the playlist object, but I'm not having much success. Any help much appreciated!


How is the " wp_get_update_data " function used?

i need to list user **updates** from a word press powered site, like how we get list of comments and posts using `wp.getComments` and `wp.getPosts`, and i came across `wp_get_update_data` can we list user updates using this wp_get_update_data, and is there any chance to list updates using **rss**?


add button to tinymce

i have the following method to insert a button in Tinymce editor: in funcitons.php:               class myclaff          {             function __construct() {             add_action( 'admin_init', array($this, 'load_tinymceee') );             }                  function load_tinymceee() {                  if ( current_user_can( 'edit_posts' ) &&  current_user_can( 'edit_pages' ) ) {                  //i have done as one plugin has only 1 button                      add_filter('mce_external_plugins', array($this, 'add_myplugin_first'));                 add_filter('mce_buttons_3', array($this,'register_mybutton_first') );                      add_filter('mce_external_plugins', array($this, 'add_myplugin_second'));                             add_filter('mce_buttons_3', array($this,'register_mybutton_second') );                 }               }               //register first plugin,             function register_mybutton_first($buttons) {                  array_push($buttons, '|', "UniqueButtonName1" );                  return $buttons;                 }             function add_myplugin_first($plugin_array) {                  $plugin_array['firstplugin'] = plugins_url('mypluginfolder/js/mybutton1.php');                                       //or  plugin_dir_url( __FILE__ ) . 'js/mybutton1.php';                return $plugin_array;                 }                       //register second plugin,             function register_mybutton_second($buttons) {                  array_push($buttons, '-',  "UniqueButtonName2" );                  return $buttons;                   }             function add_myplugin_second($plugin_array) {                   $plugin_array['secondplugin'] = plugins_url('mypluginfolder/js/mybutton2.php');                return $plugin_array;                   }                   } // class ends          //load class     $blablaa = new myclaff();      then inside "mypluginfolder/js/" i have such mybutton1.php _(and mybutton2.php, with the similar code)_ _(i know that i need to enter the correct url of my tinymce button's image)_ :               <?php      header("Content-type: application/x-javascript");     error_reporting(0);     define('WP_USE_THEMES', false);     require('../../../../wp-blog-header.php');      ?>     (function() {         // START my customs         tinymce.create('tinymce.plugins.firstplugin', {                         init : function(ed, url)         {                 // ---------- start adding buttons section---------------             ed.addButton('UniqueButtonName1', {                   title : 'the title of the button',                   image : url+'/images/mybuttonimage.png',                   onclick : function()                  {                          // here starts the output                     txt1 : //just a txt1 labeled block of code                     {                      var mynam = prompt("<?php echo "Please type your name";?>", "Something Default Name");                      ed.selection.setContent('<center>' + mynam + '</center>');                      }                 }                                });                     },                   // end of the buttons section             createControl : function(n, cm) {                   return null;               },           });           tinymce.PluginManager.add('firstplugin', tinymce.plugins.firstplugin);       })();      But when i click on button, i get only javascript popup box, where i can enter only one field. what is the code, to achieve to have multiple fields, boxes, dropdown menus and etc.. after the button click?


Wordpress themes under GPL license

On a themes site they stipulate, in the terms and conditions, that their themes inherit the GNU general public license from WordPress. I believe that this means that they can be copied and modified. However the themes are being sold. Shouldn't they be free? Could someone enlighten me.