title: Unable to display the post titles in a drop down

text:
I have post type **Dealers** and a taxonomy **Manufacturer** i have a list of manufacturers and relevant posts. Im trying to display the list of manufacturers in a drop down, when a manufacturer is selected say: Audi and based on the selection i have to populate the post titles related to Audi in another drop down. below is the code                         <form role="search" method="get" id="searchform" action="">
              <?php         function get_terms_dropdown($taxonomies, $args)         {             $myterms = get_terms($taxonomies, $args);             $optionname = "optionname";             $emptyvalue = "";             $output ="<select name='selectTax' onchange='showPost(this.value)'><option selected='".$selected."' value='".$emptyvalue."'>Select a Category</option>'";                  foreach($myterms as $term){                 $term_taxonomy=$term->manufacturer; //CHANGE Here                 $term_slug=$term->slug;                 $term_name =$term->name;                 $link = $term_slug;                 $output .="<option name='".$link."' value='".$link."'>".$term_name."</option>";             }             $output .="</select>";         return $output;         }              $taxonomies = array('manufacturer'); // CHANGE Here         $args = array('order'=>'ASC','hide_empty'=>true);         echo get_terms_dropdown($taxonomies, $args); //call to the function         ?>

         <input type="submit" id="searchsubmit" value="Search" />
     </form>      getpost.php logic               <?php              $term=$_GET['q'];              echo $term;              /*$args=array(             'post_type' => 'dealers',             'taxonomy' =>'manufacturer',             'term'    => $term,             'post_status' => 'publish',             'posts_per_page' => -1,             'caller_get_posts'=> 1,             'orderby' => 'ID',         );         //$my_query = null;         $my_query = new WP_Query($args);         ?>              <select name="menu">             <option name="list">Select a Post</option>             <?php                 while ($my_query->have_posts()) : $my_query->the_post(); ?>                 <option value="<?php the_permalink() ?>"><?php the_title(); ?></option>             <?php                 endwhile;             ?>         </select>         */     ?>      What i am getting is if i un-comment the comment tags in getpost.php file im getting the error as **Fatal error: Class 'WP_Query' not found in C:\xampp\htdocs\cah-new\wp-content\themes\carandhalf\includes\getpost.php on line 14** but im successfully echoing the selected option **echo $term;** if there is still wrong in my logic do pint-it-out, kindly help me....


title: How to show next/prev link, when it's not active?

text: When on the first page of blog wordpress shows only "older posts" link because there are no newer posts, but i would like to show also the "newer posts" link but style it as inactive. i need to do the same thing with page navigation and with single posts navigation. Thanks


title: Getting Custom Field value in WP_Query

text: i am trying to display first post of 3 categs on my index page. so for that i wrote a little function as follows:               function excateg($categ) {     $recent = new WP_Query("cat=$categ&showposts=1");     while($recent->have_posts()) : $recent->the_post();     $imageurl = get_post_meta($post->ID, 'post-img', true);     endwhile;      }?>      Afterwards the Html for showing the image and title and image.. but i am unable to get the custom field as above in $imageurl to get a value.. Help is appreciated!


title: add_rewrite_rule again

text: In general, the code from this question fit to me for 90%. One little change I need - I want all URL like *example.com/snpv/any_text/* direct not to index.php as in original code, but to **my.php** script in root of my **THEME** (not site!). So, I correct the code for my needs:               register_activation_hook(__FILE__, 'make_flush_rules');     function make_flush_rules()     {         add_rewrite_rule('snpv/([^/]+)', '/wp-content/themes/lightsaber/my.php?prm1=$matches[1]', 'top');         flush_rewrite_rules(false);     }          add_filter('query_vars', 'make_query_vars');     function make_query_vars($query_vars)     {         $query_vars[] = 'prm1';         return $query_vars;     }      To make picture clear:   * lightsaber-my Theme   * my.php-just independent script. It is not page (or, to be precise, not WP page) or page template, just php-code to generate some output I create this plugin and activate it. Enter URL example.com/snpv/ABC/ and get 404 page. :( How to correct problem? Thanks!


title: Each user can edit only one page

text: I have website that let the user publish her business.   Each business has a private page with some details and an image gallery.   Each business owner has a user.   I should make, that each user (each business owner) can edit only her page, but to do that from custom designed edit page. It should work like this:   1. Joni has a fruit shop.    2. I will create for Joni a page from admin panel.    3. He will log into the system and will to link for page with fields to fill.    4. After he will fill it, each visitor on the site can see this page.    5. If Joni want, he can login again and change details I think to do that like this:       1. i will create a new user for the business owner.      2. i will create a new page and will insert the user id in a custom field      3. a wp query will such the data for the user edit page (the query will display the page where the custom field 'userID' is the current user id )      4. with xml-rpc to send the data and will update the details  For the gallery, I didn’t find solution yet.   I need that the gallery will be associated to the page (maybe to use custom fields like 'imagegallery1' ,'imagegallery2' etc). Anybody think there is any another way to do this things – the edit page and the gallery? Thank's!


title: Upgraded to 3.3, My Widgets Disappeared

text: I upgraded to 3.3 an my widgets went bye-bye. Here's the code I'm using... anybody else having this problem? This code worked perfectly fine for me before the upgrade.               <!-- Enable Widgets -->     <?php if ( !function_exists('dynamic_sidebar')             || !dynamic_sidebar() ) : ?>     <?php endif; ?>


title: Using tabs in admin widgets

text: Update: I should point out that I tested the method below on Plugin/theme options page and it worked perfectly. In-fact I was also able to include the jQuery cookie Plugin to preserve the current tab selection between page loads (nice!). Been trying to add tabs to an admin widget to reduce the form footprint when you have multiple widget options. I am using the jQuery UI tabs included with WordPress. Here's what I have so far coded into a Plugin. http://pastebin.com/fe4wdBcp When the widget is dragged into a widget area the tabs seem to render OK but you can't click to view the second tab. Worse still if you refresh the widgets page the formatting of the tabs is completely lost, and the tabs still don't respond to click events. Not sure what the problem is here. Any help appreciated.


title: Facebook Registration Tool: how to use in Wordpress?

text: Facebook provides a Tool to let Facebook users register to third party websites: https://developers.facebook.com/docs/plugins/registration/ How to integrate this tool into Wordpress? I would like to facilitate registration and creation of WP users with this tool.


title: Wordpress JSON API Extend to Create Users

text: I have the JSON API Plugin installed on my wordpress blog and it works like a charm. However there is one functionality that i really need. A method called `create_user` which should take parameters like name, email and password and create new user on the wordpress installation if everything goes correct. Can someone please help post the code to extended this functionality for the JSON API plugin.


title: Notifications when someone is on the site

text: Is there anyway to get notified when someone logs on to the site or is even just browsing the site? I would like to receive email notifications when this happens but I cannot seem to find anywhere to activate this feature.


title: post id not displaying

text: I have used this code in header.php               ### get the author info     global $current_user;     get_currentuserinfo();     $authorid = $current_user->ID;     ### get the last post id using author id     $info=mysql_query("SELECT * FROM wp_posts WHERE post_author = $authorid ORDER BY post_date DESC LIMIT 1");     $array_content = mysql_fetch_array( $info );     $postid_profile = $array_content['ID'];      When i print the $postid_profile in header.php it displays correctly. But if i print the `$postid_profile` in single.php it displays nothing. I couldn't track the error. How can i fix this?


title: Stop wordpress to redirecting home page if no page found

text: I don't want to redirect to home page when there is no page or wrong url. I have following in httaccess file               # BEGIN WordPress     RewriteRule ^sitemap.xml sitemap-%{SERVER_NAME}.xml [L]     RewriteRule ^sitemap.xml.gz sitemap-%{SERVER_NAME}.xml.gz [L]     RewriteRule ^index\.php$ - [L]     ErrorDocument 404 /404.php     ErrorDocument 404 /index.php?error=404          # uploaded files     RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]     RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]     RewriteRule . index.php [L]               # END WordPress      I have already 404.php in my theme folder. Let me know what to modify.


title: Add "Select All" to custom taxonomy

text: Is it possible to add a "Select All" to a custom taxonomy for my custom post type? A project I'm working on requires the option to be able to select all of the taxonomy terms. While I could go through and manually click each term, it becomes quite cumbersome when I have several hundred terms. I haven't tried anything yet, as I'm not sure how to go about it....is it something I can add to my `functions.php` or is it something that can be accomplished with javascript?


title: echo statement displayed on front end

text: Good day for all I really searched SE for something like this but found nothing related. It is a noob question really but getting answered will make me comfortable with myself :) After setting the header section of a test plugin file I just put an echo statement. When I activate the plugin the string of the echo gets displayed on the admin dashboard page as well as on the home page. Is this common sense on WP or am I missing something ? thank you a lot.


title: "Database Connection Error" upon install in Apache VirtualHost document root.. Why did this happen?

text: I have apache virtualhosts up and confirmed working. I want to install wordpress for one of the vhosts, so I unpacked all the wordpress files in the document root for that vhost. I proceeded to follow the WordPress installation instructions. Now I am getting a database connection error upon going to to the install.php. I created the DB and WordPress user from phpMyAdmin.Here is my wp-config.php:               <?php     /**      * The base configurations of the WordPress.      *      * This file has the following configurations: MySQL settings, Table Prefix,      * Secret Keys, WordPress Language, and ABSPATH. You can find more information      * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing      * wp-config.php} Codex page. You can get the MySQL settings from your web host.      *      * This file is used by the wp-config.php creation script during the      * installation. You don't have to use the web site, you can just copy this file      * to "wp-config.php" and fill in the values.      *      * @package WordPress      */          // ** MySQL settings - You can get this info from your web host ** //     /** The name of the database for WordPress */     define('DB_NAME', 'notmyrealDBname');          /** MySQL database username */     define('DB_USER', 'l*******e');          /** MySQL database password */     define('DB_PASSWORD', '*********');          /** MySQL hostname */     define('DB_HOST', 'localhost');          /** Database Charset to use in creating database tables. */     define('DB_CHARSET', 'utf8');          /** The Database Collate type. Don't change this if in doubt. */     define('DB_COLLATE', '');          /**#@+      * Authentication Unique Keys and Salts.      *      * Change these to different unique phrases!      * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}      * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.      *      * @since 2.6.0      */     define('AUTH_KEY',         'put your unique phrase here');     define('SECURE_AUTH_KEY',  'put your unique phrase here');     define('LOGGED_IN_KEY',    'put your unique phrase here');     define('NONCE_KEY',        'put your unique phrase here');     define('AUTH_SALT',        'put your unique phrase here');     define('SECURE_AUTH_SALT', 'put your unique phrase here');     define('LOGGED_IN_SALT',   'put your unique phrase here');     define('NONCE_SALT',       'put your unique phrase here');          /**#@-*/          /**      * WordPress Database Table prefix.      *      * You can have multiple installations in one database if you give each a unique      * prefix. Only numbers, letters, and underscores please!      */     $table_prefix  = 'wp_';          /**      * WordPress Localized Language, defaults to English.      *      * Change this to localize WordPress. A corresponding MO file for the chosen      * language must be installed to wp-content/languages. For example, install      * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German      * language support.      */     define('WPLANG', '');          /**      * For developers: WordPress debugging mode.      *      * Change this to true to enable the display of notices during development.      * It is strongly recommended that plugin and theme developers use WP_DEBUG      * in their development environments.      */     define('WP_DEBUG', false);          /* That's all, stop editing! Happy blogging. */          /** Absolute path to the WordPress directory. */     if ( !defined('ABSPATH') )         define('ABSPATH', dirname(__FILE__) . '/');          /** Sets up WordPress vars and included files. */     require_once(ABSPATH . 'wp-settings.php');      So I am new to MySql but I did troubleshoot as much as I could. I used SET to make a new passwd for my Wordpress DB user. Still no dice. I confirmed mysql is running. I double checked passwords and spelling. I tried to login to mysql using the Wordpress DB user, but I got:                ERROR 1045 (28000): Access denied for user 'l********e'@'localhost' (using password: YES)      I think this may be because my Wordpress DB user has no global privileges, but I honestly do not know since today is basically my first day using mysql ever. The only thing I can think of is that 'localhost' isn't the correct DB hostname due to apache vhosts, but everyone says it should still be. Oh and its worth noting that in phpMyAdmin, my Wordpress user's "host" in user overview was '%' until I changed it to 'localhost'(I tried setting the wp- config.php DB host to '%' before changing. Also Tried opening up permissions in /var/www/* where all my sites are, didnt help. chown to www-data also nothing _UPDATE_ I fixed it by starting fresh and doing everything via the command line. But now I would like to know why it was happening.


title: Transposh translation plugin querying wrong database

text: I've noticed my PHP error log growing very quickly, and it all seems to be a similar error:               '[database name].wp_translations' doesn't exist      However, the database it's trying to use is for a system outside of Wordpress, so the wp_translations wouldn't be there. I've tried deactivating and activating the plugin, and I've tried looking through the various options, but there doesn't seem to be a way to make it recognize the correct database. Opening the transposh_db.php file, I see it's using the $GLOBALS['wpdb'] variable to get the working database. It was my understanding that if the Wordpress installation works at all (which it does), that variable would have to be correct. The settings in my wp-config.php file are correct. What do I need to do to get this plugin to point to the correct database?


title: Allow authors to edit only certain users

text: I am trying to give my "authors" (who I have renamed "captains") the ability to access the user profile of their team members and only their team members. The teams are defined by a user-meta box (this works better than a user taxonomy for the rest of the project). Authors have been given the `edit_users` capability. I was thinking I could do something like this:               add_action('user_row_actions','captains_user_row_actions',10,2);          function captains_user_row_actions($actions, $user_object) {  // remove the ability to edit a non-team-member     $current_user = wp_get_current_user();     $cap_team_id = get_user_meta($current_user->ID, 'team-meta', true);     $user_team_id = get_user_meta($user_object->ID, 'team-meta', true);              global $pagenow;     if ($pagenow=='users.php' && isset($user_object->caps['author']) &&  $cap_team_id != $user_team_id )     unset($actions['edit']);          return $actions;     }      Either this is not the way to go. Or I'm missing something.


title: Show that current post is number X out of X

text: Is it possible to echo at the end of a post which number the current post is? For example; Say you're viewing the 4th most recent post out of a total of 10, somewhere at the foot of the post I need it to say **"Post 4/10"**... Is that possible?


title: How to over-ride a file in a plugin?

text: I have a third party plugin that I'm using for a photo gallery (NextGen). However, with my black background, the loader gif animation looks pretty bad. I found a better loader gif and replaced the one from the plugin. I already know this is not ideal because the next update of the plugin will overwrite my custom gif. The gif is located at: `/wp-content/plugins/nextgen-gallery/images/loader.gif` Is there a clever way to leverage my child theme's `functions.php` file to tell this plugin to use a different URL for the gif? As far as using my child theme's CSS to override, that would be easiest if it was a viable option. However, the loader's URL is not coming from the plugin's CSS file.


title: Display an icon with get_post_meta?

text:
I want to display an icon in the post meta data in the loop.php, for each post have a specific meta_value! To be more specific i use this code to display an icon when a new posts has been published and this lasts for 24 hours:               <?php if( date('U') - get_the_time('U', $post->ID) < 24*60*60 ) : ?>          <?php endif; ?>      And here is the code in style.css:               .item-list span.new-post {     padding-left: 20px;     width: 20px;     height: 18px;     background: 0px 0px url(http://www.e-win.gr/wp-content/themes/e-win/images/new-post.png) no-repeat;     }      What exactly i want is display an icon when a post has a specific meta_value. Here is the code i am trying to reach it but with no results:               <?php $icon = get_post_meta(apaitei_logariasmo_facebook); ?>     <?php if( ! $icon == attr_esc(Ναι) ) ?>          <?php endif; ?>      And here is the code i use in style.css to insert the icon:               .item-list span.facebook-badge {     padding-left:20px;     width: 20px;     height: 14px;     background: 0px 0px url(http://www.e-win.gr/wp-content/themes/e-win/images/facebook-badge.png) no-repeat;     }      What do i have to do to make the code work and display the icon for the specific meta_value? P.S. I am using this `attr_esc(Ναι)` because i use Greek chars in the meta_value. Also i am using the "Advanced Custom Fields plugin" to create and manage custom fields. This is the whole loop.php:                   <?php if ( ! have_posts() ) : ?>

<?php _e( 'Not Found', 'tie' ); ?>

<?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'tie' ); ?>
             <?php get_search_form(); ?>

                <?php else : $count = 0;?>           <div class="post-listing <?php if( tie_get_option( 'blog_display' ) == '2col' )  echo"archives_2col" ?>">           <?php while ( have_posts() ) : the_post(); $count++; ?>           <?php if( tie_get_option( 'blog_display' ) != 'full_thumb' ): ?>     <article class="item-list <?php echo'item_'.$count; ?>">
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>

                 <?php                  if( get_field( "hmeromhnia_lhkshs" ) ): ?>                 <?php the_field('hmeromhnia_lhkshs'); ?>                   <?php endif;           ?>               <?php                  if( get_field( "wra_lhkshs" ) ): ?>                 <?php the_field('wra_lhkshs'); ?>               <?php endif;           ?>               <?php tie_get_time() ?>                       <?php         $caturls = array();         foreach( (get_the_category()) as $cat ):         $caturls[] = 'cat_ID  ) . '">' . $cat->cat_name . ' ';         endforeach;         echo implode( ', ', $caturls );        ?>              <?php comments_popup_link( __( '0', 'tie' ), __( '1 Comment', 'tie' ), __( '% Comments', 'tie' ) ); ?>               <?php if( date('U') - get_the_time('U', $post->ID) < 24*60*60 ) : ?>                  <?php endif; ?>                   <?php $icon = get_post_meta( $post->ID, 'apaitei_logariasmo_facebook', true); ?>         <?php  if( !empty($icon) ) : ?>                  <?php endif; ?>
                   <?php if( tie_get_option( 'blog_display' ) == 'content' ): ?>
             <?php the_content( __( 'Read More »', 'tie' ) ); ?>
         <?php else: ?>         <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>
         <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">                 <?php tie_thumb('',200,200); ?>                 <?php tie_get_score( true ); ?>
             <?php endif; ?>

<?php tie_excerpt() ?>
             <a class="more-link" href="<?php the_permalink() ?>"><?php _e( 'Read More »', 'tie' ) ?>
         <?php endif; ?>              <?php tie_include( 'post-share' ); // Get Share Button template ?>

        <?php if( $count == 2 &&  tie_get_option( 'blog_display' ) == '2col' ): $count = 0; ?>

        <?php endif; ?>            <?php else: ?>
         <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>
             <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php tie_thumb('', 620 , 330 ); ?><?php tie_get_score( true ); ?>
         <?php endif; ?>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'tie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>

             <?php tie_get_time() ?>             <?php comments_popup_link( __( '0', 'tie' ), __( '1 Comment', 'tie' ), __( '% Comments', 'tie' ) ); ?>             <?php echo tie_views(); ?>

<?php tie_excerpt() ?>
             <a class="more-link" href="<?php the_permalink() ?>"><?php _e( 'Read More »', 'tie' ) ?>
         <?php tie_include( 'post-share' ); // Get Share Button template ?>

         <?php endif; ?>              <?php endwhile;?>
         <?php endif; ?>


title: Plugin that saves form data

text: My first plugin attempt with basic PHP skills and a bunch of WordPress experience... What I want: User fills out form - form action sends them off to a specialized gateway (got that part ok) Select data from the form is saved to a custom table This is going to probably sound stupid but i think i have all the elements I am just missing how to put them together... This is a very basic example of what I want to expand on later. This is the function (the stuff that makes the table etc already happens earlier)               function rchs_add_donor() {        global $wpdb;        $welcome_name = $_POST['name'];        $welcome_text = $_POST['text'];             $rows_affected = $wpdb->insert( play_donors,              array(                      'time' => current_time('mysql'),                      'name' => $welcome_name,                      'text' => $welcome_text ) );     }      Now the silly part - how/where do i put the form to utilize this function? I tested the above with straightforward data instead of variables from the $_POST and that writes to the new table fine. If anyone could point me in the right direction that would be great! Did more research based on the first answer came up with this: but need to make sure it is 'correct' and 'secure' seems like i should be sanitizing data or something before writing it to the dbase?               add_shortcode('donor_form_sc','donor_form');     function donor_form(){     global $wpdb;          echo '<form method="post" action="' . $this_page .'">       <label for="name" id="name">Name: </label>     <input type="text" name="name" id="name" />     <label for="text" id="text">Text: </label>     <input type="text" name="text" id="text" />          <input type="submit" />       </form>';            };      $welcome_name = $_POST['name'];        $welcome_text = $_POST['text'];         $rows_affected = $wpdb->insert( play_donors,              array(                      'time' => current_time('mysql'),                      'name' => $welcome_name,                      'text' => $welcome_text ) );      It writes to the dbase as expected.


title: Do Child-Themes automatically load the Translation from the Parent-Theme?

text: Is it enough to just create a child-theme - let's say technically without adding anything else but the bare minimum `style.css` - to have the translation of the parent-theme being used automatically for the child-theme as well? _`child-theme/style.css`_               /**      * Theme Name:     Child-Theme Child      * Theme URI:      http://example.com/      * Description:    Child theme for the Twentytwelve theme      * Author:         Theme Author      * Author URI:     http://example.com/      * Template:       twentytwelve      * Version:        0.1.0      */      The _twentytwelve_ theme has the standard language translation files. And if that does not happen automatically on my site, what would be a good place to start trouble-shooting the missing translation?


title: How to insert icon in site title

text: I'm trying to insert an icon using the font awesome icon plugin, via the Customisations > Appearance > Site Title But this just displays the code, not the icon. Anyone know the solution to this? Thanks!


title: Mobile version and URL Rewrite

text: I had created a dedicated mobile version for my website, not responsive theme. I used a `wp_is_mobile` function to change some styles and script, also a template. All working good but I want to add a mobile prefix to all links like:   * `mysite.com/mobile/category/mycategory`   * `mysite.com/mobile/mypost`   * `mysite.com/mobile/tag/mobile` etc. Can you help with my problem?


title: How to create user personal pages with information from their meta profile fields?

text:
I asked here how to create virtual pages with information from the user meta profile fields using an external class. I got a good answer and also I have implemented it successfully (thanks to @g-m!). At the same time, the author of answer suggested me that what I want can be done " _in a lot simpler and more performant way_ ", using the core WP functions, just creating a real post type: registering a CPT, maybe not public (so no UI is showed on dashboard), and on user profile saving/updating just created/updated CPT entry. This is how I created and saved initially some extra user profile fields:               /* Add Extra Fields to the User Profile */     add_action( 'show_user_profile', 'extra_user_profile_fields' );     add_action( 'edit_user_profile', 'extra_user_profile_fields' );          function extra_user_profile_fields( $user ) { ?>
<?php _e("Academic", "blank"); ?>

           <?php _e("Teaching position"); ?>	                      <input type="text" name="teaching_position" id="teaching_position" value="<?php echo esc_attr( get_the_author_meta( 'teaching_position', $user->ID ) ); ?>" class="regular-text" />
           <?php _e("Put here your teaching position"); ?>

     }          /* Save Extra User Profile Fields */     add_action( 'personal_options_update', 'save_extra_user_profile_fields' );     add_action( 'edit_user_profile_update', 'save_extra_user_profile_fields' );          function save_extra_user_profile_fields( $user_id ) {        if ( !current_user_can( 'edit_user', $user_id ) ) { return false; }        update_user_meta( $user_id, 'teaching_position', $_POST['teaching_position'] );     }      What I want, is to put on my site a list of department members with links to their personal pages (e.g. _example.com/users/user_nicename_ ) with some content from their profiles. Pages must be created automatically, so I do not have to create manually a personal page for each new member. How can this be achieved (except the cited solution)?


title: Forcing WordPress to work differently

text: This is kind of an airy-fairy question but it's been causing me grief for weeks and I'd like some outside input. I have a client, a programmer, who wants a site set up so people can post stories, edit them, share the accounts, comment, etc. I have the site working rather well via buddypress and a few other plugins. However, he has spent very little time playing in the admin area and steadfastly refuses to watch and training videos or learn about the system as a whole. The remaining features he wants really seem very far our of the standard WP parameters. It is really beyond me as how to get them to work, but all attempts to dissaude him have failed. They include: -Wanting multiple useres/emails on one account/profile and the ability to share/give access to this account. For instance, the whole family (with multiple emails) is under one profile and can post, edit the stories and comment. -All of these people are supposed to be able to edit Posts off the same, joint account and manage comments.  -having the story posting process divided up into multiple pages with big push-buttons. Right now it is through a BuddyPress simple front end plugin where you can add pics, Post text, add a audio file, choose a category etc. He wants it to be this multi-step process to create one post. There are some other wonky requests too. To me, this sounds like the essential WordPress framework would need to be reworked somehow. I can't get him to understand that this is not how it was built to work and he is just asking for trouble. So far his main test subject has been his elderly non-tech mom, who needless to say doesn't understand any of it. So somehow he thinks he can dumb it down to a level she could get. I might also add, he has rejected including a page with instructions on how to post and comment. I'm ready to throw the towel in on what started out as, and still is, a pretty nice and functional site. But it seems like the "dumber" the front gets the more hideous the backend is. Does anyone have any input on this, even if it is "he's nuts and it would cost a ton?" or "this is not WordPress is for?" Thanks for any comments.


title: how do I get a sidebar's id or number for use with is_active_sidebar()

text:
From the codex               is_active_sidebar( $index ); ?>      Parameters          $index         (mixed) (required) Sidebar name, id or number.       When i try any of my sidebar names it doesnt work; yet when I put in random numbers 1,2 and 3 guessing that my sidebars are numbered that way and it works, but this is not reliable. There is a trac issue about this and I suspect that there may be an issue with the function at the moment ( and also the example from twentyten in the codex seems to use a slug not a name) so what i want is a way of getting the sidebar's name id or number as wordpress understands it. EDIT ( this is the code i used to register the sidebar - i ended up adding the line **'id' => 'right-sidebar',** after 'name' => etc to get the solution described below in the comment )               if ( function_exists('register_sidebar') )     register_sidebar(array(     'name' => 'Right Sidebar',     'before_widget' => '
',     'after_widget' => '
',     'before_title' => '
',     'after_title' => '
',     ));


title: prepopulate form from a hook within wordpress function.php file

text: I have a form that I created by simply using the HTML editor in the wp-admin backend for a page. I have some variables in a hook for that page, I would like to pre-populate some of the form fields with the variables in the hook.               add_action('wp', 'simple_form');          function simple_form(){         $firstname = 'Bob';         //Do something to populate the form field name <fname> with "Bob"     }


title: wp_editor on front end media upload jquery live error

text: I have set up a front end editor for a project I am working on. The editor is inside a div with display set to none. The user will click a button to get the editor div to show up. The issue I am having is that when the Upload/Insert Media button is clicked nothing happens. I have a short bit of code that creates a draft so the post_id argument for the iframe has a valid post id. The admin area is blocked off to users. I thought it may have to do with needing access to the admin- ajax.php script so I set up a method in my functions.php file to account for the "DOING_AJAX" constant. But this did not work either. I am a bit stumped on this one as all the editor buttons (bold, italics) work well - except the link editor button - which I believe may be due to the same problem as the media button. Any help that could be offered is greatly appreciated!


title: Acivate all themes multisite wide automatically

text: I have a multi-site running locally. And it annoys me that I have to activate themes individually until I can use them on the sites. I am super admin, what is the reason WordPress handles plugins differently here? I see all plugin on all sites automatically and can activate them. I like to have themes behave in the same way. Can I do this somehow. Some little tricky powerful function that automatically activates all (new) themes dropped into `/wp-content/themes` network wide automatically? Again in case this words are not clear enough: I want to have all themes inside my themes directory available/enabled for switching on all sites without me doing anything. Exactly like plugins.


title: show shortcodes in editor

text: Is there any way in which i can show custom shortcodes inside the editor panel, I have a bunch that I've created and thought it would be a good idea? Not found anything online other than tutorials on how to create them - which I already know. Thanks


title: wp_nav_menu not highlighting the current category when viewing a single post

text: My WordPress site has a bunch of posts, all filed by a top-level category and a bunch of subcategories therein. I have the main site nav rendering the category pages, which, when clicked, get all posts in that top-level category as an 'archive'. The category highlights as you'd expect when you visit one of these category pages, however, when visiting a single post in this category, no highlighting for me. I'd expect that the top-level category to which this post belongs would be highlighted and it looks as if that is the intended behaviour. So, my question is: What can I do to make the category the post belongs to highlight in the main nav when I'm viewing a single post? The site gets quite a lot of traffic so I am keen to get a solution that scales well.


title: simple category search form returns full text - but I need excerpts

text:
I have member pages. I set their "membership type" as a certain category. I want to search the members now. I use this simple form that does what I need, except that I need the results to display as excerpts. Ideas?               <form method="get" id="search form" action="/">
     <input type="text" value="" name="s" id="s" />     <input type="hidden" value="22" name="cat" id="scat" />     <input type="submit" id="search_submit" name="Search" value="Search"/>
     </form>      UPDATE I dropped into the theme and found search.php and saw:
                     <?php the_content(); ?>
      I changed to:
                     <?php the_excerpt(); ?>
      I think that did the trick! So...I guess I answered my own question! :) || Thanks!


title: get_edit_tag_link does not return anything

text:
I'm trying to pull up a custom page which lists all tags used in my blog that have a description, to build up a glossary. It all works great but i would also like to display an "edit tag" link for each tag, only visible to admins. The built-in edit_tag_link() function is supposed to do just that, as far as i understand the codex, but the edit link does not show up. What is wrong with my code?               $tags = get_tags();     foreach ($tags as $tag){         if(strlen($tag->description)>0){                 $tag_link = get_tag_link($tag->term_id);                 print_r($tag);         echo "
name} Tag' class='{$tag->slug}'>
{$tag->name}
         <pclass='abstract'>{$tag->description}
 ".edit_tag_link('edit tag','
','
',$tag)."
";         }          }


title: If I consider changing my WordPress DB tables to InnoDB, will it have an effect on the way WordPress works?

text: I found a superb post here about optimising WordPress for large installs. One of the steps refers to `lighthttpd` which sounds excellent but isn't currently supported by DirectAdmin. Last time I messed about with a non-DA installation I managed to break my server and had to pay a professional to get it fixed... One of its other steps is to `ALTER` all of my MySQL tables to use the InnoDB engine instead of MyISAM. This appeals to me because it would appear to fix some of the major problems I've been having - i.e. table locks. The following is an example of my MySQL's `SHOW PROCESSLIST;` including SQL statements:               | 17181 | my_db | localhost | my_db | Query   | 35117 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'boraras-brigittae' AND wp_po |     | 17182 | my_db | localhost | my_db | Query   | 35118 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17183 | my_db | localhost | my_db | Query   | 35117 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'boraras-brigittae' AND wp_po |     | 17184 | my_db | localhost | my_db | Query   | 35117 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'boraras-brigittae' AND wp_po |     | 17185 | my_db | localhost | my_db | Query   | 35041 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'akysis-vespa' AND wp_posts.p |     | 17186 | my_db | localhost | my_db | Query   | 35050 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('images','profiledotline-gif') A |     | 17187 | my_db | localhost | my_db | Query   | 35050 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('images','picarrow-gif') AND (po |     | 17188 | my_db | localhost | my_db | Query   | 35043 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17189 | my_db | localhost | my_db | Query   | 35041 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('m','marginal') AND (post_type = |     | 17190 | my_db | localhost | my_db | Query   | 34989 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'piaractus-brachypomus' AND w |     | 17191 | my_db | localhost | my_db | Query   | 34989 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('w','wet-dry-filter') AND (post_ |     | 17192 | my_db | localhost | my_db | Query   | 34990 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17193 | my_db | localhost | my_db | Query   | 34954 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'corydoras-sterbai' AND wp_po |     | 17194 | my_db | localhost | my_db | Query   | 34954 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'piaractus-brachypomus' AND w |     | 17195 | my_db | localhost | my_db | Query   | 34955 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17196 | my_db | localhost | my_db | Query   | 34954 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'piaractus-brachypomus' AND w |     | 17197 | my_db | localhost | my_db | Query   | 34897 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17198 | my_db | localhost | my_db | Query   | 34955 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17199 | my_db | localhost | my_db | Query   | 34898 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17200 | my_db | localhost | my_db | Query   | 34897 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17201 | my_db | localhost | my_db | Query   | 34898 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums','lofiversion','index-ph |     | 17202 | my_db | localhost | my_db | Query   | 34897 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums') AND (post_type = 'page |     | 17204 | my_db | localhost | my_db | Query   | 34897 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17205 | my_db | localhost | my_db | Query   | 34897 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'sawbwa-resplendens' AND wp_p |     | 17206 | my_db | localhost | my_db | Query   | 34897 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'badis-sp-buxar' AND wp_posts |     | 17207 | my_db | localhost | my_db | Query   | 34898 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'melanotaenia-boesemani' AND  |     | 17208 | my_db | localhost | my_db | Query   | 34898 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'betta-prima' AND wp_posts.po |     | 17209 | my_db | localhost | my_db | Query   | 34865 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums') AND (post_type = 'page |     | 17210 | my_db | localhost | my_db | Query   | 34897 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17211 | my_db | localhost | my_db | Query   | 34898 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17213 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'piaractus-brachypomus' AND w |     | 17214 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17215 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('knowledge-base') AND (post_type |     | 17216 | my_db | localhost | my_db | Query   | 34865 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17217 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'piaractus-brachypomus' AND w |     | 17218 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'badis-sp-buxar' AND wp_posts |     | 17219 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums','lofiversion','index-ph |     | 17220 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'betta-prima' AND wp_posts.po |     | 17221 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17222 | my_db | localhost | my_db | Query   | 34865 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'piaractus-brachypomus' AND w |     | 17223 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'piaractus-brachypomus' AND w |     | 17224 | my_db | localhost | my_db | Query   | 34865 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'hemichromis-lifalili' AND wp |     | 17225 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17226 | my_db | localhost | my_db | Query   | 34862 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'apistogramma-borellii' AND w |     | 17227 | my_db | localhost | my_db | Query   | 34863 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'melanotaenia-lacustris' AND  |     | 17228 | my_db | localhost | my_db | Query   | 34862 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'melanotaenia-lacustris' AND  |     | 17229 | my_db | localhost | my_db | Query   | 34861 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'mikrogeophagus-altispinosus' |     | 17230 | my_db | localhost | my_db | Query   | 34861 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.ID = 25503 AND wp_posts.post_type = 'atta |     | 17231 | my_db | localhost | my_db | Query   | 34803 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'piaractus-brachypomus' AND w |     | 17232 | my_db | localhost | my_db | Query   | 34803 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17233 | my_db | localhost | my_db | Query   | 34803 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('knowledge-base') AND (post_type |     | 17234 | my_db | localhost | my_db | Query   | 34803 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17235 | my_db | localhost | my_db | Query   | 34803 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums') AND (post_type = 'page |     | 17236 | my_db | localhost | my_db | Query   | 34803 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17237 | my_db | localhost | my_db | Query   | 34803 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums') AND (post_type = 'page |     | 17238 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('m','migrate') AND (post_type =  |     | 17239 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'hemichromis-lifalili' AND wp |     | 17240 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17241 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums') AND (post_type = 'page |     | 17242 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17243 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17244 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums','lofiversion','index-ph |     | 17245 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17246 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17247 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums') AND (post_type = 'page |     | 17248 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'geophagus-brokopondo' AND wp |     | 17249 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'hyphessobrycon-amandae' AND  |     | 17253 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17255 | my_db | localhost | my_db | Query   | 34786 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('knowledge-base') AND (post_type |     | 17260 | my_db | localhost | my_db | Query   | 34786 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('s','silver-sand') AND (post_typ |     | 17262 | my_db | localhost | my_db | Query   | 34786 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums') AND (post_type = 'page |     | 25505 | root      | localhost | NULL      | Query   |     2 | NULL                         | SHOW PROCESSLIST         I've enabled the `slow-query-log` and the output (having been run through an analysis script) can be found here. However, as I've attempted to `ALTER` my tables, the following error has occurred on `wp_posts`: `ERROR 1214 (HY000) at line 14: The used table type doesn't support FULLTEXT indexes` So, my questions are kinda three-fold, but kinda just one:   * Can I use InnoDB and keep the FULL-TEXT INDEXES that WordPress appears to use?   * Will using InnoDB help to alleviate the problems I've been having with table-locks?   * Can I use InnoDB without having an adverse effect on my WordPress installation?* *I have myriad plugins including W3 Total Cache, Simple Forums, AdRotate and many more.


title: wp_redirect to file:// location results in blank page/cannot be displayed page

text: I have a CPT that is justed used for linking to resources on a local drive. I have this code in single-resource.php:               <?php     global $post;     the_post();     $location = get_post_meta($post->ID, 'sc_stace_resource_location', true);     $count = (int) get_post_meta($post->ID, 'sc_stace_view_count', true);     $count++;     update_post_meta($post->ID, 'sc_stace_view_count', $count);     wp_redirect($location);     die();     ?>      Basically the user clicks the resource, the resource counter is incremented and then the user should get taken to the file location. An example file location is:               file://S:/_%20Transfer/Scott/wfw_christmas_041111.pdf      Now if I put this in the address bar of any browser the file is loaded fine. but when I navigate with the above code I get a blank page on webkit browsers and a page cannot be displayed in IE browsers. Not sure if this is a PHP issue or a WordPress issue. Anyone know why this isn't working? _UPDATE_ It appears that the reason why this isn't working is because of security in the browser. The only solution I can think of is to link directly to the file but if I do this I lose the ability to track the number of downloads. Any solutions?


title: and custom post_types to custom menu

text: managed to create a custom menu area in the admin but now want to place 2 post types to it. They already exist - questions & answers, but can't find a way to put their menu links into the custom menu.               add_action('admin_menu', 'mt_add_pages');          function mt_add_pages() {              add_menu_page(__('Competition','comp'), __('Competition','comp'), 'manage_options', 'mt-top-level-handle', 'test_func', '', 5 );         add_submenu_page('mt-top-level-handle', __('Answers','comp-answers'),  __('Answers','comp-answers'), 'manage_options', 'sub-page', 'test_func2');          }          function test_func(){         echo 1; // question post_type links     }          function test_func2(){         echo 2; // answer post_type links     }      any help appreciated!


title: How to Add a .js file Only in one specific Page Dynamically to Head

text: I need to add some scrips for Google Maps only in my contact page and I do not want to populate it on all pages. I am not willing to create a custom header as well so I was thinking is there any way to populate the js file only on contact page? currently I am using this code to add javascript to theme               //Load Scripts     function load_scripts(){         wp_deregister_script('jquery'); // De-register Existing jquery         wp_enqueue_script('jquery', 'http://code.jquery.com/jquery.js', '', '', true);         wp_enqueue_script('bootstrap-jquery', get_template_directory_uri().'/assets/js/bootstrap.js', '', '', true);     }      but as I said I have another file called **googlemap.js** can you please let me know if I can add it to ONLY contact page from this code? the other Point is Wordpress is adding this code at the end of body (before tag) which honestly **I do not know how and why**! but in my specific case I need to add the code into ! can you please let me know how I can do this Thanks


title: Query posts: how to exclude results if post is in multiple categories

text: Say I have 3 categories: A, B, C, and another category D that posts in A,B,C can also be assigned to. D is to denote the featured post for the category, and theoretically only one post for each (A, B, C) will also be assigned D. I can find the featured post for each category fine using category__and . I have a need to make a list of the rest of the category minus the featured post to the right of the featured post on the home page. So for example I want to get a list of category A but I want to exclude the featured post that would be marked category A and category D. I tried using "category_ _in" followed by "category_ _not_in" thinking it would accomplish this but the "category__not_in" seems to override and just find everything in every category except for the excluded category. If I have things structured wrong please let me know. I am trying to make things simple for the site owner by not having to remember to enter text for a tag (featured post). I'd rather them just check the check boxes in the category list. Summarizing, my code needs to do two things. For example: Find the "featured post": FIND A and D . This is done. Find everything in the category EXCEPT featured post: Find A, exclude (A and D). Any help would be greatly appreciated. I'm new to Wordpress but not coding. Just trying to get acquainted with the functionality.


title: Variables declared in header not available in other includes

text: I have a var set in my header.php file:               $myBool = false;      and in page.php, I try to echo it:               echo $myBool;      But the variable is never set. This doesn't help either:               global $myBool;     echo $myBool;      Does anyone know what the problem is? Note: I'm using a custom theme based on the blank theme ( http://digwp.com/2010/02/blank-wordpress-theme/ ) but the same behaviour is evident when using twentyten / eleven so the theme seems to have nothing to do with this


title: WXR slicing script

text: I have a massive WXR file im trying to import into wordpress. I run out of memory when i try to import as one file, so I'm thinking of how i can split the big file into smaller files programatically and if anyone had a script to do this


title: Multi-language permalink in qtranslate

text: I am using qtranslate plugin for my WordPress site to make it a multi-language site. Now I have got a requirement like For English the url should look like www.sitename.com/contact-en For French the url should look like www.sitename.com/fr/contact-fr How can I accomplish this? (qTranslate is the plugin used) Note: There should not be any post id coming in-between As per the post in Multilingual permalinks (qtranslate) I tried http://www.3dolab.net/en/qtranslateslug-plugin-widget but 'page not found' errors are occurring. It looks like the author has stopped improving that plugin as per the 29th comment in that page.


title: WordPress menu to change page title

text: I am using `wp_list_pages`. I am unable to change page title For eg:- I made a page with name `lorem ipsum` and want to show in content area the same name i.e `lorem ipsum`. But in menu, I want to show the name `lorem`. How to do this.


title: How to display list of results

text: I need to display a list of results which will include a name, time, etc. They will be in this format: results. I have looked at using tables, but short of writing a script to parse the text file, it wouldn't work. I think the best option is to make them appear in a monospaced font but I cannot find a way to do this that would not require code written on each post. Cheers, Will.


title: Automatically Import WordPress Blog to Facebook Page

text: I managed to import wordpress post to Facebook with this: http://www.insidefacebook.com/2009/02/22/how-to-import-your-blog-into- facebook/ When i create new post, Facebook doesn't **show any new posts** after the importation. Anyone have a idea how to keep showing the post created in Wordpress to Facebook after the importation ? Note: Sorry, not pretty good in English :/


title: Is it possible ( or advisable) to allow open access to the new theme customizer for potential clients?

text: I've been using the new theme customizer and it really has me thinking how awesome it would be to allow potential theme buyers/clients etc to play with the customizer for a demo theme (without being logged in). The customizer is located at : `..wp-admin/customize.php`. So what it would take would be to somehow allow open access to this URL **but** nothing else in the back end. I suppose there is probably a security issue with this but I thought I'd get a discussion going on it here in case it's possible to do this safely as I'm sure other people might have the same idea. So the question is : is there any safe way to allow open access to a single page of the admin?


title: Search - Only search for post meta field

text: I know there are a lot of good plugins which extend the wordpress search but I want to do the opposite. I want the search only to return posts which have a certain value in a certain post meta field.   How do I do that?


title: Creating a mobile site by adding a new class to the body tag from functions.php

text: Essentially is there a way to use a function in functions.php to turn the `<body>` tag into `<body class="mobile">`? I have code that recognizes mobile devices but right now it's set up to load a mobile.php page `include(STYLESHEETPATH."/mobile.php");`, which isn't quite what I want. I've tried all sorts of mobile site plugins like WP mobile, mobify, etc. None of them work the way I want and I'd rather not mess with that anymore. Please don't suggest that. I know this is kind of a newbie question but I can't find any info on it anywhere. Thanks for your time.


title: What are the current recommended best-practices for comments.php?

text: I'm getting ready to submit a theme to the .Org repo and wanted to make sure that everything is in ordnung. One of the biggest holes left in my design is the comments template. I've taken a look at comments.php in a few themes, Twenty Ten chief among them and have come away more confused than when I started. It seems as though (based upon tutorials from Otto, WP Engineer, etc.) the comments template has been simplified, yet when I look at the source to most themes' comments.php, they are still as convoluted as in the Christian-Montoya-derived days of old. So help me out -- what's the best way to set up a comments template that will capture the state-of-the art functionality as of WP 3.0/3.1 and yet maintain code simplicity?


title: PHP stylesheet cannot use standard WP functions

text: I am including a particular PHP file as a style sheet using               <link href="<? echo THEME_CSS;?>/styles.php" media="screen" rel="stylesheet" type="text/css">      Recently I reached the point where I needed to use TEMPLATEPATH and various built-in WordPress functions. Alas I am getting > "Warning: require_once(TEMPLATEPATH/framework/theme.php) [function.require- > once]: " and similar errors indicating that this file is not taking > advantage of the WordPress environment in general. If WordPress was even working correctly here, `TEMPLATEPATH` should be the actual template path. In addition, other functions such as `get_bloginfo()`, etc.. are not found. Is there someway I can initialize WordPress explicitly to let me pull options from the admin panels?


title: Updating WordPress

text: I have just update my WordPress page and I can't see it. A lot of plugins are giving errors, so I activate DEBUG. Then I have try to desactivate all plugins in the database. To make this I erase the option_value of active_plugins, but now I can only see a blank page when I enter my website, neither the errors!!


title: Displayling list of Custom Post Type Posts

text: I am creating 2 custom post types, and with the one displaying a list of the posts in #2. I am 90% of the way there, have the select showing but can't get it populated with the custom post types posts from #2. I am using get_posts to create the array, and then echoing into the select.               $option_list = get_pages( array( 'post_type' => 'Partners' ) );     echo '<select name="activitymeta_sel" id="activitymeta_sel">';       foreach ($option_list as $option) {        echo '<option value="' . $option . '">' . $option . '</option>';       }       echo '</select>';      I must be missing something. Can anyone spread some light on my quest. edit: The new code is below but still not getting the list of the post types, I know I am going wrong somewhere but not sure where.               echo '<select name="activitymeta_sel" id="activitymeta_sel">';      echo '<option value="">Select Partners</option> ';       $pages = get_pages('post_type=Partners');        foreach ( $pages as $pagg ) {        $option = '<option value="' . $pagg->post_title . '">';        $option .= $pagg->post_title;        $option .= '</option>';        echo $option;       }      echo '</select>';      Thanks In Advance


title: How do you check if a WordPress template file exist?

text: Is there a native function to check if a theme a template file. For instance, if a theme is not using the 'home.php' file, then execute some code...


title: Network Sites in Word press is missing a site

text: Not not sure if this has been asked before. I inherited a site, and its a WP network site. I change the admin user/password to mine just by using MYSQL update in Linux with id=1. I was then able to lo-gin to the site and see all the sites, i realized as an admin I can't see one out of the 5 sites? did I forgot to grant access or did I do something wrong?


title: Build Array from Input Fields question

text:
I have a series of input fields sets:               <input type="text" name="people[name]" />     <input type="text" name="people[lastname]" />     <input type="text" name="people[email]" />          <input type="text" name="people[name]" />     <input type="text" name="people[lastname]" />     <input type="text" name="people[email]" />          ...      and I am looking for a way of storing the values as an array like the one following               { people: { name: xxx , lastname: yyy, email: zzz },                { name: xxx , lastname: yyy, email: zzz },               { name: xxx , lastname: yyy, email: zzz },               ...     }      I will use update_post_meta(); to save the values. Thank you for your help. EDIT               // CALLBACK     <?php     function show_people_box($post){     $metas = json_decode(get_post_meta($post->ID,'people',true));     ?>     <?php      $hiterms = get_terms('people', array('orderby' => 'slug', 'parent' => 0, 'hide_empty' =>false));           ?>     <?php foreach($hiterms as $key => $hiterm) { ?>
<?php echo $hiterm->name; ?>

     <?php     $args = array(         'post_type'=>'people',         'orderby' => 'menu_order',         'post_parent' => 0,         'tax_query' => array(array(         'taxonomy' => 'people',         'field' => 'id',         'terms' => $hiterm->term_id     )));     ?>     <?php      $query = new WP_Query($args);     while($query->have_posts()){     $query->the_post();     ?>     <?php      $children = get_children(array('post_type' => 'people', 'post_parent' => get_the_ID() ));     if($children) {     ?>
         <input name="people[name]" type="text" />	         <input name="people[lastname]" type="text" />	         <input name="people[email]" type="text" />
     <?php          $args_2 = array( 'post_type'=>'people','post_parent' => get_the_ID() );     $query_2 = new WP_Query($args_2);     while($query_2->have_posts()){     $query_2->the_post();     ?>
         <input name="people[name]" type="text" />	         <input name="people[lastname]" type="text" />	         <input name="people[email]" type="text" />
     <?php     }     } else {          ?>
         <input name="people[name]" type="text" />	         <input name="people[lastname]" type="text" />	         <input name="people[email]" type="text" />
     <?php      }     ?>     <?php     } wp_reset_postdata();      ?>
     <?php } ?>     <?php     }          // SAVE     add_action( 'save_post', 'save_people_box' );     function save_people_box(){          foreach($_POST['people'] as $key => $value){     $peoples[$key] = $value;     }          global $post;     update_post_meta( $post->ID, 'people', json_encode($peoples) );          }      I hope it helps, in my attempt to simplify my question I removed some html tags. Thanks for all your help again.


title: What is the proper way implement a global $wp_rewrite?

text: The below code works correctly, but I don't know if it is proper coding. Can anyone confirm or comment on the code?               add_action('init', 'news_rewrite');     function news_rewrite() {         global $wp_rewrite;         add_permastruct('news', 'news/%year%/%postname%/', true, 1);         add_rewrite_rule('news/([0-9]{4})/(.+)/?$', 'index.php?news=$matches[2]', 'top');         add_rewrite_rule('^news/([0-9]{4})/?','index.php?post_type=news&year=$matches[1]','top');     }


title: Is it possible Embed flexviewer in wordpress and how?

text: I have a flex viewer application and need to embed it in my WordPress site. I try so many ways to make it happen without luck. I try used a plugin called **swfobj** , by put simple code as follow : `[swfobj src= "index.swf" width ="100%" height ="550"]`, but still get an error notification as follow : _WidgetManager #error2036_.. Is it because wordpress prevent to denied flex viewer application or what?


title: Simple form that saves to database

text: I am using a 3rd party service that does a scrub of my database for new entries within a specific table. However I am been unable to find a simple form plugin that submits data to the wordpress database inside of a table that won't affect any of the wordpress functionality. The reason is my hosting provider only allows me one database. I need to use a form in my wordpress that:   1. Captures name, phone, email submitted by end user   2. Save to the database   3. Redirect user to confirmation page.  Nothing elaborate really and although it would be great to see the results in the wordpress administration it is not necessarily required since I can just use myphpadmin. In summary: I need a simple html/php form, where I can just paste the form html onto a page via the wordpress administration via the html/code view for pages. When a user submits the form, it saves it to the wordpress database and then redirects the user to a "thank you" page.


title: Wordpress always display the first menu

text:
I try to display multiple menus but Wordpress keep always display the first one I created... Here is all the code about the menus: **functions.php**               <?php function custom_init(){            register_nav_menus(         array(           'header_quick_links' => __( 'Liens rapides du header' ),           'header_menu'        => __( 'Menu du header' )         )       );          }          add_action('init', 'custom_init');      **header.php**               <?php wp_nav_menu(array(       'menu'       => 'header_quick_links',       'items_wrap' => '
%3$s
',       'container'  => '',       'menu_class' => 'header_quick_list'     )); ?>     ...     <?php wp_nav_menu(array(       'menu'       => 'header_menu',       'items_wrap' => '
%3$s
',       'container'  => '',       'menu_class' => 'header_menu_list'     )); ?>      And in the admin, each menu is correctly assign to the good location... Any idea ?


title: Prevent Duplicate Instagram Posts using Instagram API

text:
Below is the code I am using to fetch every hour (using WP CRON) Instagram posts using the Instagram API, but more often than not I am getting duplicate, triple, and even quadruple identical posts and it's driving me crazy that I can't fix the issue. I thought I was giving plenty of checks on the meta_key and value "instagram_id", but it seems like when finding an Instagram post, it created a WP post, hangs there and creates 4 more before moving on to finding more Instagram post. Ideally I want it to always check if a post with same Instagram ID exists before creating another post! It's very sporadic, sometimes I can run the API 5 times and there are no duplicates, other times all I get are duplicates. HELP!               // Get recent media for the tag going back 20 pages.     $recent_media = $i->tagRecent($tag, 20);          // Loop the recent media.         foreach($recent_media as $media) {             // debug             global $api_debug;             $found = false;             echo "+ Checking Media № {$media->id}.
\n";                  // Query WordPress for the media before doing API calls.             $check = new WP_Query(                     array(                         'post_type' => 'instagram_api_feed',                         'meta_key' => 'instagram_id',                         'meta_value' => $media->id,                         'cache_results' => false,                         'update_post_meta_cache' => false,                         'update_post_term_cache' => false,                         'post_status' => array('pending', 'draft', 'future', 'publish', 'private')                     )                 );                 // log                 if($api_debug) {                 write_log("Number of Posts found: " . $check->found_posts . " for ID " . $media->id);                 }             // If Existing Wordpress Post Not Found, we need to see about adding it.             if(!$check->found_posts) {                 // log                 if($api_debug) {                     write_log("Instagram ID Not Found..." . $media->id);                 }                 echo "+ Likes Check For Media № {$media->id}.
\n";                      // See if any user has liked the media in the limited list of likes.                 foreach($media->likes->data as $like) {                     foreach($cur_users as $user) {                         if($like->username == $user) {                             $found = true;                             break;                         }                     }                 }                      // If we haven't found one yet, we should look deeper.                 if(!$found) {                     // log                     if($api_debug) {                     write_log("Instagram ID Still Not Found, extend the check..." . $media->id);                     }                     echo "+ Extended Likes Check For Media № {$media->id}.
\n";                     foreach($cur_users as $user) {                         set_time_limit(120);                         // See if the user is in the extended list of likes.                         if($i->userHasLikedMediaLight($user, $media->id)) {                             $found = true;                             break;                         }                     }                 }                      // We have a match for this tag...                 if($found) {                     // log                     if($api_debug) {                     write_log("Instagram ID Found but let's double check ID " . $media->id . " for duplicates...");                     }                     // ...but check again for an existing post to avoid duplicates! - JFLAY                     $doubleCheck = new WP_Query(                         array(                             'post_type' => 'instagram_api_feed',                             'meta_key' => 'instagram_id',                             'meta_value' => $media->id                         )                     );                     if(!$doubleCheck->found_posts) {                         // log                         if($api_debug) {                         write_log("No Duplicates! Let's Add " . $media->id);                         }                         echo "+ {$media->user->username}'s photo № {$media->id} has been liked under #{$tag}
\n";                              echo "  + Copying Media № {$media->id}.
\n";                              // Media details.                         $thumb = $media->images->standard_resolution->url;                         $width = $media->images->standard_resolution->width;                         $height = $media->images->standard_resolution->height;                         $media_type = $media->type;                              // Modify some things based on the media type.                         if($media_type === 'video') {                             $media_url = $media->videos->standard_resolution->url;                             $media_poster = $thumb;                         } else {                             $media_url = $thumb;                         }                              // Thumbnail info.                         $thumb_filename = pathinfo($thumb, PATHINFO_BASENAME);                         $tmp_thumb_filename = $thumb_filename;                         $count = 1;                              // Find a unique name for the media.                         while(file_exists($upload_folder . $tmp_thumb_filename)) {                             $tmp_thumb_filename = $count . '-' . $thumb_filename;                             $count++;                         }                         $thumb_filename = $tmp_thumb_filename;                         $copied = copy($thumb, $upload_folder . $thumb_filename);                              if($copied) {                             echo "  + Creating Post.
\n";                                  $post_content = '
' . $media->caption->text;                             // log                             if($api_debug) {                             write_log("Creating Post Content... " . $post_content . ' Line:' . __LINE__);                             }                             // Add the post.                             $ID = wp_insert_post(                                     array(                                         'post_type' => 'instagram_api_feed',                                         'post_title' => $media->user->username,                                         'post_date' => date('Y-m-d H:i:s', $media->created_time),                                         'post_content' => $post_content,                                         'post_status' => 'publish',                                         'post_author' => 1,                                         'guid' => $media->link                                     )                                 );                                  // The post was inserted.                             if($ID) {                                 // log                                 if($api_debug) {                                 write_log("Inserted Post ID $ID Insta_ID: " . $media->id);                                 }                                 // Update various meta info.                                 update_post_meta($ID, 'instagram_media_type', $media_type);                                 update_post_meta($ID, 'instagram_media_url', $media_url);                                 update_post_meta($ID, 'instagram_media_poster', $media_poster);                                 update_post_meta($ID, 'instagram_id', $media->id);                                 update_post_meta($ID, 'instagram_contents', json_encode($media));                                 update_post_meta($ID, 'instagram_link', $media->link);                                 update_post_meta($ID, 'instagram_hashtag', $tag);                                 update_post_meta($ID, 'import_id', $running);                                      echo "  + Attaching image.
\n";                                      // Attach the image.                                 $wp_filetype = wp_check_filetype($thumb_filename, null);                                 $attachment = array(                                             'post_title' => $thumb_filename,                                             'post_content' => '',                                             'post_mime_type' => $wp_filetype['type'],                                             'post_status' => 'inherit'                                         );                                      $attach_id = wp_insert_attachment($attachment, $upload_folder . $thumb_filename, $ID);                                 $attach_data = wp_generate_attachment_metadata($attach_id, $upload_folder . $thumb_filename);                                 wp_update_attachment_metadata( $attach_id,  $attach_data);                                 set_post_thumbnail($ID, $attach_id);                                  } else {                                 echo "  + Failed to Create Post for Media № {$media->id}.
\n";                             }                         } else {                             echo "  + Failed to Copy Media № {$media->id}.
\n";                         }                     } else {                         // log                         if($api_debug) {                         write_log("Ok, there was already a post here, how did this happen?");                         }                     }                    } else {                     echo "+ No likes for  Media № {$media->id}.
\n";                 }                  // Found.  Update comments.             } else {                 $ID = $check->posts[0]->ID;                 echo "+ Already In WP as Post ID $ID.
\n";                 // log                 if($api_debug) {                     write_log("Already In WP as Post ID $ID");                 }             }             // If we have an ID, it's because it was created or found. So, update comments.             if($ID) {                 echo "  + Updating comments.
\n";                 update_post_meta($ID, 'instagram_caption', $media->caption->text);                 update_post_meta($ID, 'instagram_comments', json_encode($i->mediaComments($media->id)));                 wp_set_post_terms($ID, $tag, 'instagram_tags', true);             }                  echo "
\n";         }


title: Rewrite a specific Post Format to URL slug

text: I'll cut to the chase. I am using Post Formats on my WordPress 3.6 site, specifically 'Video', which I want to include in the URL slug. I'm pretty well verse in WordPress plugin writing etc, but cannot seem to find a way to ONLY rewrite URLs for this post format. The rough PSEUDO CODE logic would be               if (post_format == 'Video') {     // DO CLEVER REWRITING STUFF     }      Would greatly appreciate the help/advice anyone can offer.


title: Get posts by term slug only

text: What I'm looking to do is build a shortcode to that will display a list of posts based on the taxonomy slugs passed to it. But as far as I can tell, you can't use just a term's slug to pull posts in without having to also specify the taxonomy it's in. Is it possible to get posts or other taxonomy based data (term meta, name, etc) with just the terms slug, and without the specific taxonomy it's in?


title: How to set where user is redirected to after logging in at wp-login?

text: So i'm fairly certain this probably has something to do with the fact that I'm using a custom role I've set up in my functions.php file with almost 0 permissions. However, I'm still able to access the dashboard, just I get sent to profile.php on login instead of dashboard. I want my user_role to get sent to the dashboard each time as I have a custom widget set up for them there. I can't seem to find the function in the codex and the necessary hook to set this up? It looks like if I was using a custom login form I could use `wp_login_form()` but I just want to use the default login form without hacking the admin file so its not effected by updates. Anyone know the function I'm needing. Cant' seem to feed google the right terminology.


title: WP 3.5 caching problem

text: Ok so ever since I upgraded some of my sites to WP 3.5 recently, it looks like caching of specifically images and css files are screwed. To explain: If I try to update an image, it keeps on showing the old version of the image even after clearing my browser cache. I'm on a Mac, and tried FF and Chrome and cleared cache for both of them, delivering same results. If I add a parameter to the image URL (to bust the cache) it loads the new image, but then if I remove the parameter it reverts back to the old version again. I did notive that cmd+shift+R does some kind of a refresh that forces the new images/changes to display, but any subsequent "normal" refreshes reverts back again. Same thing happens with my CSS files as explained above for images. I even installed and tried W3TC to add expires headers to my assets and do the caching there, but that didn't really fix anything. Can anyone maybe just point me in the right direction to fix this? Thanks in advance!


title: Is there an action that is called when a post is restored from the trash?

text: I'm looking at the wordpress list of actions and trying to find an action that is called when a post is restored from the trash but cannot find one. Does anyone know if it exists?


title: Get users with atleast one post

text: How can I get all users with atleast one post? I don't think it's possible with `get_users` function.


title: Native WordPress Media Uploader on WordPress Frontend

text: I am using a custom template on my site to enable frontend posting. I wanted to add an option to upload media( _such as pictures_ ) on this form exactly the way native WordPress backend has. In short I wanted a button on the frontend form which could look like this : ![WP Add Media Button](http://i.stack.imgur.com/5mkmX.png) When this button is clicked I want a lightbox to open up which looks like : ![Media Upload screen](http://i.stack.imgur.com/Yw5lf.png) In short, I want the entire WP media upload option but in the frontend form. I'm sure there would be some in built functionality in WP for this. I am unable to locate the code to get this and unfortunately no plugin is able to get this result. Help appreciated.


title: wp_list_categories: get latest featured_image of category

text: I was thinking about a nicer way to display the categories in my sidebar. Instead of a plain list style, I'd like to have images / thumbnails show up as well. Currently I'm using the following:               <?php wp_list_categories('show_last_updated=1&show_count=1&title_li='); ?>       Simply displaying the name/link + post count of each category. I want to keep, that but also add a thumbnail to it. I've been browsing through this board for answers and also thought about how to do it, but I couldn't find a solution yet. I guess I have to create a function that gets the featured image of the latest post in that category. If a post has more categories, that also shouldn't cause any problems. Creating a loop with only 1 post in that category and only outputting the thumbnail would be an option, but to set it so that the thumbnail and category match could be a hassle. I'm sure that there must be a better way to do it. I'm not looking for a plugin (as I'm sure there are some), I want to hardcode it. If anybody has a good idea or some advice how to approach this, then please help me out. Thank you very much!


title: Where to put third party PHP library?

text: I'm developing a couple of open-source plugins and a theme (all part of a "suite") that all use the same third party PHP library. I'm wondering what is the best way to include it in Wordpress. Here are some thoughts:   * put it in one of the plugins and require that plugin to be installed and activated   * create a special "core" plugin that does nothing but including it   * put it directly in `wp-content` Any thoughts on that matter?


title: Search Results: Differentiate posts and pages

text:
Currently the search results are all shown in the same way, no matter if it's a post or a static page. As I don't want the comment count and the categories to show up for static pages, I was wondering how to do it. The code: **(Update October 22nd)**               <?php        if(get_post_type() == 'page') : ?>
      <img src="<?php bloginfo('template_directory'); ?>/images/eye.png" alt="Views" title="views" /> <?php print_page_views(get_the_ID('')); ?>
This is a static page!

     <?php endif; ?>
      <img src="<?php bloginfo('template_directory'); ?>/images/eye.png" alt="Views" title="views" /> <?php print_page_views(get_the_ID('')); ?>              <img src="<?php bloginfo('template_directory'); ?>/images/comments2.png" alt="Comments" title="comments" /> <?php comments_popup_link('0', '10', '%'); ?>

<?php the_category(' // ') ?>
      Thanks for your help so far. I updated the code. Now, it only shows up on static pages, but the HTML markup below the conditional tag also shows up and I want that to only show up for posts. I guess I have to put an "else" tag somewhere? I just don't know how to implement it correctly. Thanks a lot in advance!


title: Post-Archive like a page in a specific subdirectory

text: I have a webpage with posts which belong to specific categories (eg _projects_ ). I want to show the archive of a specific category like a page. # Status quo The site structure is similar to this: > /   >  /our-work/   >  **/our-work/projects** <- here I want to have the archive for _projects_   >  /xyz   >  /... I use the following settings:   * `category_base` = _cat_   * `permalink_structure` = _/news/%category%/%postname%/_ I can access the projects-archive via example.com/cat/projects. # What I already tried I tried the following without success: Removing a `page_for_posts` and setting it to a newly created page " _news_ ". Including the following code in the .htaccess file before the wordpress section (with and without an `[L]`: If I use `[L,r=301]` I get a 301-redirect.               <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /         RewriteCond %{REQUEST_FILENAME} !-f         RewriteCond %{REQUEST_FILENAME} !-d         RewriteRule ^/our-work/projects/$ /cat/projects/     </IfModule>      I think there was a time where it worked somehow, but I can not remember how I did it. (Maybe the page only showed all posts, because it had no other info). # My Questions   1. Is there a better way to do this? How? (I think about creating a real page and wring a shortcode, that includes/displays all posts in the projects category)   2. If not - How can I do that?   3. Is it possible to have the posts of this category in this "subdirectory" like _/our-work/projects/acme_?


title: Order posts by category name

text: Is there any way to order posts by category name? I tried               $args = array(         'post_type' => 'dlm_download',         'posts_per_page' => 10,         'paged' => $paged,         'order_by'=> 'cat',          'order' => 'ASC'     );      But it does not really work, could please someone give me a hint?


title: echo vs output variable

text:
Someone once told me, that it is good for performance, not to open and close php tags and use echo all the time, like that:               <hgroup>
<?php echo getHeading1(); ?>

<?php echo getHeading2(); ?>
     </hgroup>      Instead he uses an output variable and echoes it in the end.               $output .= '<hgroup>
' . getHeading1(); . '

' . getHeading2(); . '
     </hgroup>';          echo $output;      Does that really make any difference? When do I use which method?


title: Some images don't get linked when setting link-to to media-image

text: When inserting images into posts I have some images which refuse to recognize their link-to setting. The setting is properly saved and I also tried switching to a none setting and back, but with no effect. This only occurs for some images, regardless of the other settings and the context where it is inserted. Any clues what my cause this? **EDIT:** By some images I mean just random images. There are Jpegs (there might be some png, but this seems not to be related) like the others which work with description or without. They are all uploaded from the media library or directly from the post. Re-uploading seems to fix the issue, but it reoccurs from time to time with new images. To make this issue even more weird: It works when I remove the description- text for those images, but when I add it again (or a single letter for testing purposes), it does not work anymore. **EDIT 2:** Also cropping, flipping or other file-modifications don't affect the described behavior for those images. **EDIT 3:** Probably because of using the custom-upload-dir-extension some of my guids seem to be messed up and some of those files are the ones which are problematic. **EDIT 4:** Even with removing the custom-upload-dir-extension the problem still occurs, for new and old images...


title: Does wp_localize_script Call a Javascript Function or Simply Pass PHP Parameters to It

text: Easy question: I'm trying to understand wp_localize_script. Does wp_localize_script call a javascript function or does it simply pass PHP parameters to javascript? I want to pass php parameters to a javascript function and call the js function.


title: Querying a query

text: Let's say I have a query stored in a array. I want to parse this array, find the first posts inside this array that match a certain value from a certain key, and so extract the whole post. Is there a elegant way to do it ? Or, is it possible to run a query_posts() inside this array ? Thanks ! * * * **Edit:** _Sorry, just learning to use this fantastic website, need to learn correct use._ The purpose is to make a `get_posts()`, and display the posts not in a row, but at different places in the homepage where there is a place for a Beauty category post, a Mode category Post, etc. As any post could be in several categories, I cannot just ask for the last post in the category: a post could be in two places at the same time. My idea is to just make a get_posts query, store the result, and parse it so i could take record of what post are displayed and what are not. So, I make a query with `get_posts()` are store result in a variable. As I don't want certain posts to stay in the query, I use `'post__not_in'`, which is `array` with posts `ID` I don't want.               function request_highlights($exclude_ids) {      /* request that will populate my hightlight feed */     $args = array(     'numberposts'   => 16,     'category'  => null,     'orderby'   => 'post_date',     'order'     => 'DESC',     'post__not_in'  => $exclude_ids,     );          return get_posts( $args );     }          $highlights_posts = request_highlights($slides_id);      So at this point, I have a variable which is a objet, I guess, with all needed data. What I want to do is to get, say, the first post in the objet that has the `cat_ID=5` (for example). What i'm doing right now is :               foreach ($highlights_posts as $highlights_post) {             $fetched_post = get_the_category($highlights_post->ID);                 foreach ( $fetched_post as $fetch_cat) {                     if ($fetch_cat->cat_ID == $cat_sq) {                         $sq_post_id = $fetch_cat->cat_ID;                         break 2;                     }                 }              }     // stuff to do like get_post($sq_post_id);      Now i realise that I would need to remove that post `ID` from my list `$highlights_posts` so I cannot pull it twice. I guess i need to learn more about arrays ?


title: Display all posts starting with given letter?

text: I'm trying to build Wordpress based dictionary, basically it will have 26 pages (one for each letter): > A B C ... X Y Z And every page will display all posts starting with given letter, so after opening the "A" page it should display something like: > aback > > abacus > > abalone > > (...) azure I was thinking about custom post types at first, but creating and maintaining 26 custom post types sounds like an overkill. What will be the most efficient way of sorting posts like that? Database query, splitting loop with PHP? I am aiming for 1000s of posts (yes, it has to be Wordpress :)).


title: Custom tables or custom fields?

text: I'm building blog where users ll have option to download images. I want to display information how many times post have been displayed and how many times the image have been downloaded. Technically I have solved this by using custom fields and it works. In near future I want to add option to sort images based on vies/downloads. Also I have solved this, but what Im thinking now is that maybe I should use custom tables instead of custom fields. I plan to have about thousand of images, and I'm worrying if queries for displaying most downloaded/viewed images will be slow.