Showing Author Information and Latest Post by author in lightbox when clicked on the name of the author

I am showing `details of all the authors including the avator, Name, Description in my blog`. When I click on the `OPTIONS TO CONNECT` link a `lightbox` will open and I need to `show those details(which I mentioned above) inside the lightbox including the title of the latest post by the author`. Is there any way to do that? The following is the code that I use to display all the authors list.

     <?php         $authors = get_users('role=author&orderby=post_count&order=DESC');         foreach($authors as $author) {             echo "
";             echo "ID;             echo "\" id=\"bloggers_image\">";             echo get_avatar($author->ID);             echo "";             echo '
';             echo "ID;             echo "\" id=\"blogger_name\">";             echo the_author_meta('display_name', $author->ID);             echo "";             echo "
";             echo "
";             echo the_author_meta('description', $author->ID);             echo "
";             echo "
";             echo "";             echo "Options To Connect";             echo "";             echo "
";             echo "
";         }?>

      **Update:** I have tried the following               jQuery(document).ready(function (){      jQuery('#options_to_connect a').on('click',function(event){              event.preventDefault();     var author_id = jQuery(this).parent().attr('class');      jQuery.ajax({       type: "POST",                       url:  'http://www.myblog.com/wp-admin/admin-ajax.php',          data: 'action=ajaxified_function&post_id='+author_id,            success: function (msg) {                                               jQuery('#cboxLoadedContent').html(msg);     },     error: function () {                         alert('Error');                    }       });                });            });            and this in the functions.php                add_action( 'wp_ajax_ajaxified_function', 'ajaxified_function' );      add_action( 'wp_ajax_nopriv_ajaxified_function', 'ajaxified_function' );      function ajaxified_function()      {          $author = get_the_author_meta($_POST['author_id']);         $auth_name = the_author_meta('display_name', $author->ID);         $avatar= get_avatar($author->ID);         $desc = the_author_meta('description', $author->ID);         echo '
'.$auth_name.'

'.$avatar.'

'.$desc.'
';       die();          }      But this displays just an image which is not clearly seen Please tell me where I have done wrong. Hope I am clear with my question. Thanks in advance for any help. **Update:** I use the following script to register the js Dont know why it is not applying. Eventhough it gets registered the code is not working...               wp_register_script('lightbox',get_template_directory_uri() . '/js/lightbox.js',                            array(   'jquery', 'wp-ajax-response' ) );     wp_enqueue_script( 'lightbox');     wp_localize_script( 'lightbox', 'ajaxurl',                      array(                          'ajaxurl' => admin_url( 'admin-ajax.php' ),                     )             );      It was working fine In the morning..But after sometime dont know why it got crashed and didnt work aferwards.. this is what shows in console                     Someone please help me


Conditional statements based on custom meta value in category archives

Here's what I need to do. Insert a short Javascript in the footer using wp_footer. No problem there for single posts, I have this.               add_action( 'wp_footer', 'prefix_wpfooter' );     function prefix_wpfooter() {         global $post;              if( is_singular() ) {             $hide_page = ( empty( get_post_meta( $post->ID, '_prefix_hide_page', true ) ) ) ? '' : get_post_meta( $post->ID, '_prefix_hide_page', true ) ;         }              if( $hide_page == '1' ) {             ?>             <!-- Output JS here -->             <script>             </script>             <?php         }     }      However, this won't fly for front_page or category archives. I'm having a brain fart and thought I'd seen a solution to this before. Can anybody help start me in the right direction or point me to a solution because I don't think I'm using the right search terms and coming up empty. Many, many thanks!


buddypress bp_core_add_message() doesn't fire why?

Ok I have the following php which work ok as in it run through to the IF but no matter what i do I can't get the bp_core message to fire on screen it just gives me the changes saved message... why what am i doing wrong!                   function valid_postcode ($self) {         $getFieldID = $self->field_id;         $PostCodeFieldID = 23;         $postcodecheck = $_POST['field_23'];      if ( $getFieldID == $PostCodeFieldID || $postcodecheck == ''){                  $GetValuePost = $self->value;                  $regex = '/[a-z][0-9][a-z][- ]?[0-9][a-z][0-9]$/i';                if(!preg_match($regex, $GetValuePost)) {                 bp_core_add_message( __( 'That Postcode  is invalid. Check the formatting and try again.', 'buddypress' ), 'error' );              }elseif (!isset($getFieldID)) {                 bp_core_add_message( __( 'You need to fill out the post code.', 'buddypress' ), 'error' );              }       }          }     add_action( 'xprofile_data_before_save', 'valid_postcode', 1, 1 );


Loading all files within a directory

I've made this little function which I'm wanting to call all the files within a directory. I don't think the `glob() == false` would work though. I'm new to this function so not aware of all possibilities and I find the php.net references unhelpful to some extent. My desired outcome is if glob() fails to load any files an array of the files can be loaded via `require_once()` separately for each file. This would just be more of a fallback, unless there is an easier more efficient option.               if(glob() == false) { echo "0 files found" } else {         foreach( glob(get_stylesheet_directory() . '/postypes/*.php') as $path )             require_once( $path );     }


Pre checking condition before login

I need to check a condition with a web service (via curl) when a user is trying to log in. How do I check this conditions before login and if it throws an error how do I show like an WP error? Thanks


How do I create a drop down menu in a widget?

How do I create a simple dropdown menu with 3 options in a widget? I'm using $instance to do it. How would it look in a barebones widget?


Can Postie be used to submit podcasts via email?

I have a client that wants me to be able to submit (small) podcasts via an email attachment much like the functionality in posterous. Using this site I found such a plugin for Wordpress called Postie. However before I try to install this plugin on his site, I figured I should ask if submission of podcasts is even possible this way. (Of course it's limited by the size of the file you're able to send via email, but that's okay as his podcasts aren't all that big.)


wp_nav_menu() not working on Custom Search Page

I'm using **WP Custom Search** plugin to generate Advanced Search in one of my newly developed WP site. Though the plugin is not completely bug-free, but it's working just fine (excepts some Undefined Offset warnings, I'm ignoring them for its better support in searching). But recently noticed that the `wp_nav_menu()` on the `header.php` is not working when I'm on the search page. It's a simple code as it's used in many of my WP sites:               <?php wp_nav_menu( array( 'theme_location' => 'header_menu', 'menu_class' => 'site-header-menu' ) ); ?>      That's working on all other pages, BUT the `search.php` - a typical search template. I've tried the most-cited solution from:   * this WP Support thread -- failed,   * this SO Thread -- failed, and   * this WPSE thread -- failed Typically the search page contains a `?s=` on the URL, but using this plugin, I'm getting:               http://example.com/?search-class=DB_CustomSearch_Widget-db_customsearch_widget&widget_number=preset-1&[search_queries_and_conditions]=&search=Search      Is that a cause I'm failing echoing the menu? (Live site here, and the Advanced Search is on the left)


WP_Query by just the id?

In the codex for WP_Query I see you can query by 'page_id=7' for pages or by 'p=7' for posts... is there a way to get a 'post of any post type' by ID? like 'id=7'—that will get it no matter if it's a page, post or custom post type? I can only get WP_Query with p=7 to work if I add &post_type=customposttype. Is there a way to get it from the ID regardless of post type?


how to add one more post type ('post_type' => 'wpbdp_listing)to filter by default in frontend

am new to **WordPress** http://wordpress.org/extend/plugins/business- directory-plugin/ and added the plug in my WordPress added some categories, poster in this directory after that i changed admin->setting->permalink Default to Posttype after this no posters i found in myfront end.then i tried solutions from google here i found the by default post_type= something are getting fine `'post_type' => 'wpbdp_listing'` are not getting so i need to to add `'post_type' => 'wpbdp_listing'` also be show in front .. for this what can i do ?? help me


Order custom post by custom post field

I know that question has already be posted, but their anwser doesn't work for me. (or it doesn't work with WP > 3.8)               $args = array('meta_query' => $meta_query , 'post_type' => 'product','post_status' => 'publish','posts_per_page' => 250,'order' => 'DESC', 'meta_key' => 'PRODUCT_new_product_order' , 'orderby' => 'meta_value_num' ,  'post_parent' => 0);          $products = new WP_Query( $args );          if ($products->have_posts()) :              while ($products->have_posts()) : $products->the_post();                               $order =  get_post_meta($post->ID , "PRODUCT_new_product_order");                         echo "Order = " .  $order[0];                      endwhile;           endif;      Thanks :)


How to edit a HTML list in WordPress?

I'm new to WordPress and what I want to do is to edit the HTML of a specific page in WordPress. For example, a page in my website shows in the source code (in Chrome) a list, that I can see in the normal browser view, but when I get to the dashboard and search for the template the specific page uses, I cannot see the list. How can I find the specific part of the page that I need to edit, either using WordPress interface or HTML code done by hand. What I need to do is to modify the HTML page I see on the source code in my browser.


Add pagination to blog

I want to limit 3 blog entry snippets per page and include pagination for additional pages. Here's what I have so far, but pagination isn't working.
          <?php     $args = array( 'posts_per_page' =>3, 'order'=> 'ASC', 'orderby' => 'title' );     $postslist = get_posts( $args );     foreach ( $postslist as $post ) :       setup_postdata( $post ); ?>
                  <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
             <?php the_time('F jS, Y') ?> by <?php the_author(); ?>             <?php the_excerpt(); ?>

     <?php endforeach;      wp_reset_postdata();?>
          <?php posts_nav_link( $sep, $prelabel, $nextlabel ); ?>      <?php posts_nav_link(); ?>

<?php posts_nav_link('','','« Previous Entries') ?>

<?php posts_nav_link('','Next Entries »','') ?>


Bring page from sub menu to admin menu in option tree

When option tree is installed the page "theme options" show under appearance. I want to bring it to top level menu item. i did a deep search and so far I found is:               ot_theme_options_parent_slug      filter to change the parent slug that currently defaults to themes.php. But I dont know how to do this. Any instruction would be nice.


Geo My WP automatically list posts based on visitor's location

Is it possible to affect the WP loop to automatically only list posts based on the visitor's location with the Geo My WP plugin? I'm creating a news site that will serve several towns and I'd like to be able to only list posts that are relevant to the visitor. Example flow:   * Visitor visits site for first, time.   * Determine visitor's location   * Dynamically load posts in the WP loop that match his or her location. I've tried, and I can't get it to work. I was wondering if any of you have had success. Thanks!


How to add classes to images based on their categories?

I need to be able to: 1.) assign categories to images and 2.) add classes to all images that correspond to their assigned categories. I was able to add categories to images with the following:               function ug_add_categories_to_attachments() {         register_taxonomy_for_object_type( 'category', 'attachment' );     }     add_action( 'init' , 'ug_add_categories_to_attachments' );      And I found a function to add a class to images as so:               function add_image_class($class){         $class .= ' additional-class';         return $class;     }     add_filter('get_image_tag_class','add_image_class');      But I'm not advanced enough with php to take it much further. I tried this               function ug_add_image_class($class){         foreach(get_the_category() as $cat) { $class .= ' category-'.$cat->slug; };         return $class;     }     add_filter('get_image_tag_class','ug_add_image_class');      but no love... Help? Ideas? Please? and Happy Friday!


username_exists() function can't be access without logging in

I'm using the following function in functions.php to check if a username exists in the DB               function check_username() {        $username = $_POST['user'];        if ( username_exists( $username ) ) {            $return['user_exists'] = true;         }        else {            $return['user_exists'] = false;        }        echo json_encode($return);        die();     }     add_action('wp_ajax_check_username', 'check_username');      The problem is that the `username_exists()` function only seems to work if a user is already logged in and checks a username. I tried to check for an existing username without logging in and it just returns `undefined` for me. I have no idea why this is happening and can't find any documentation about this issue. My question is, how do I enable a user to check if a user exists without having to log in? Thanks


Is there any pre-existing plugin to track and block IPs with suspicious activity on my site?

The image below shows a recent (failed) attempt to crack my Wordpress install. It's easy for me to look at that and see what they were doing, but is there a plugin that exists that monitors this data and can catch events like this? Especially for something as blatant as this, I would like to block the IPs, but it's not exactly practical for me to sit watching IP activity 24/7. Thoughts? ![enter image description here](http://i.stack.imgur.com/AH6ia.png)


Get Metabox taxonomy value and create metabox for termmeta

I got a big problem here. What I want to do is: Create Taxonomy meta box in the post edit screen, lets call it "text_from" Then Depending on the value of the "text_from" meta box display a field where i can insert Termmeta into the choosen term My problem is I dont know javascript / very well .. Does anyone know how to get the checked value from the text_from meta box ? I also tried addons like piklist, but It looks like they don't support this kind of fields.. my code so far: create a new metabox               add_action('do_meta_boxes', 'move_meta_box');          function move_meta_box(){                 //remove_meta_box( 'text_fromdiv', 'posti', 'side' );                 add_meta_box('text_fromdiv', __('From Author etc'), 'custom_post_categories_meta_box', 'post', 'normal', 'low', array( 'taxonomy' => 'text_from' ));     }               function author_birthdate_add_meta_box() {         $screens = array( 'post' );              foreach ( $screens as $screen ) {                      add_meta_box(                         'author_birthdate',                         __( 'Authors birthdate', 'author_textdomain' ),                         'author_birthdate_meta_box_callback',                         $screen                 );         }     }     add_action( 'add_meta_boxes', 'author_birthdate_add_meta_box' );               function author_birthdate_meta_box_callback( $post ) {              // Add an nonce field so we can check for it later.         wp_nonce_field( 'author_birthdate_meta_box', 'author_birthdate_meta_box_nonce' );              /*          * Use get_post_meta() to retrieve an existing value          * from the database and use the value for the form.          */         $value = get_post_meta( $post->ID, '_author_birthdate', true );         echo '';         _e( 'Author birthdate:', 'author_textdomain' );         echo ' ';         echo '<input type="text" id="author_birthdate" name="author_birthdate" value="' . esc_attr( $value ) . '" size="25" />';     }          function author_birthdate_save_meta_box_data( $post_id ) {              /*          * We need to verify this came from our screen and with proper authorization,          * because the save_post action can be triggered at other times.          */              // Check if our nonce is set.         if ( ! isset( $_POST['author_birthdate_meta_box_nonce'] ) ) {                 return;         }              // Verify that the nonce is valid.         if ( ! wp_verify_nonce( $_POST['author_birthdate_meta_box_nonce'], 'author_birthdate_meta_box' ) ) {                 return;         }              // If this is an autosave, our form has not been submitted, so we don't want to do anything.         if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {                 return;         }              // Check the user's permissions.         if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {                      if ( ! current_user_can( 'edit_page', $post_id ) ) {                         return;                 }              } else {                      if ( ! current_user_can( 'edit_post', $post_id ) ) {                         return;                 }         }              /* OK, it's safe for us to save the data now. */              // Make sure that it is set.         if ( ! isset( $_POST['author_birthdate'] ) ) {                 return;         }                   // Sanitize user input.         $my_data = sanitize_text_field( $_POST['author_birthdate'] );              // Update the meta field in the database.         update_post_meta( $post_id, '_author_birthdate', $my_data );     }     add_action( 'save_post', 'author_birthdate_save_meta_box_data' );                              unction custom_post_categories_meta_box( $post, $box ) {         $defaults = array('taxonomy' => 'category');         if ( !isset($box['args']) || !is_array($box['args']) )                 $args = array();         else                 $args = $box['args'];         extract( wp_parse_args($args, $defaults), EXTR_SKIP );         $tax = get_taxonomy($taxonomy);              ?>         <div id="taxonomy-<?php echo $taxonomy; ?>" class="categorydiv">                 <ul id="<?php echo $taxonomy; ?>-tabs" class="category-tabs">
<a href="#<?php echo $taxonomy; ?>-all"><?php echo $tax->labels->all_items; ?>

<a href="#<?php echo $taxonomy; ?>-pop"><?php _e( 'Most Used' ); ?>

                      <div id="<?php echo $taxonomy; ?>-pop" class="tabs-panel" style="display: none;">                         <ul id="<?php echo $taxonomy; ?>checklist-pop" class="categorychecklist form-no-clear" >                                 <?php $popular_ids = wp_popular_terms_checklist($taxonomy); ?>

                      <div id="<?php echo $taxonomy; ?>-all" class="tabs-panel">                         <?php             $name = ( $taxonomy == 'category' ) ? 'post_category' : 'tax_input[' . $taxonomy . ']';             echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks.             ?>                         <ul id="<?php echo $taxonomy; ?>checklist" data-wp-lists="list:<?php echo $taxonomy?>" class="categorychecklist form-no-clear">                                 <?php wp_terms_checklist($post->ID, array( 'taxonomy' => $taxonomy, 'popular_cats' => $popular_ids ) ) ?>

         <?php if ( current_user_can($tax->cap->edit_terms) ) : ?>                         <div id="<?php echo $taxonomy; ?>-adder" class="wp-hidden-children">
                                         <a id="<?php echo $taxonomy; ?>-add-toggle" href="#<?php echo $taxonomy; ?>-add" class="hide-if-no-js">                                                 <?php                                                         /* translators: %s: add new taxonomy label */                                                         printf( __( '+ %s' ), $tax->labels->add_new_item );                                                 ?>
                                 <p id="<?php echo $taxonomy; ?>-add" class="category-add wp-hidden-child">                                         <label class="screen-reader-text" for="new<?php echo $taxonomy; ?>"><?php echo $tax->labels->add_new_item; ?>                                         <input type="text" name="new<?php echo $taxonomy; ?>" id="new<?php echo $taxonomy; ?>" class="form-required form-input-tip" value="<?php ec     ho esc_attr( $tax->labels->new_item_name ); ?>" aria-required="true"/>                                         <label class="screen-reader-text" for="new<?php echo $taxonomy; ?>_parent">                                                 <?php echo $tax->labels->parent_item_colon; ?>                                                                                <?php wp_dropdown_categories( array( 'taxonomy' => $taxonomy, 'hide_empty' => 0, 'name' => 'new'.$taxonomy.'_parent', 'orderby' => 'name','hierarchical' => 1, 'show_option_none' => '— ' . $tax->labels->parent_item . ' —' ) ); ?>                                         <input type="button" id="<?php echo $taxonomy; ?>-add-submit" data-wp-lists="add:<?php echo $taxonomy ?>checklist:<?php echo $taxonomy ?>-a     dd" class="button category-add-submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" />                                         <?php wp_nonce_field( 'add-'.$taxonomy, '_ajax_nonce-add-'.$taxonomy, false ); ?>                                         <span id="<?php echo $taxonomy; ?>-ajax-response">

                 <?php endif; ?>
         <?php     }      And I think this is the Javascript function which handles the term_metabox /wp-admin/js/post.js excerpt:                       // categories         $('.categorydiv').each( function(){                 var this_id = $(this).attr('id'), catAddBefore, catAddAfter, taxonomyParts, taxonomy, settingName;                      taxonomyParts = this_id.split('-');                 taxonomyParts.shift();                 taxonomy = taxonomyParts.join('-');                 settingName = taxonomy + '_tab';                 if ( taxonomy == 'category' )                         settingName = 'cats';                      // TODO: move to jQuery 1.3+, support for multiple hierarchical taxonomies, see wp-lists.js                 $('a', '#' + taxonomy + '-tabs').click( function(){                         var t = $(this).attr('href');                         $(this).parent().addClass('tabs').siblings('li').removeClass('tabs');                         $('#' + taxonomy + '-tabs').siblings('.tabs-panel').hide();                         $(t).show();                         if ( '#' + taxonomy + '-all' == t )                                 deleteUserSetting( settingName );                         else                                 setUserSetting( settingName, 'pop' );                         return false;                 });                      if ( getUserSetting( settingName ) )                         $('a[href="#' + taxonomy + '-pop"]', '#' + taxonomy + '-tabs').click();                      // Ajax Cat                 $( '#new' + taxonomy ).one( 'focus', function() { $( this ).val( '' ).removeClass( 'form-input-tip' ); } );                      $('#new' + taxonomy).keypress( function(event){                         if( 13 === event.keyCode ) {                                 event.preventDefault();                                 $('#' + taxonomy + '-add-submit').click();                         }                 });                 $('#' + taxonomy + '-add-submit').click( function(){ $('#new' + taxonomy).focus(); });                      catAddBefore = function( s ) {                         if ( !$('#new'+taxonomy).val() )                                 return false;                         s.data += '&' + $( ':checked', '#'+taxonomy+'checklist' ).serialize();                         $( '#' + taxonomy + '-add-submit' ).prop( 'disabled', true );                         return s;                 };                      catAddAfter = function( r, s ) {                         var sup, drop = $('#new'+taxonomy+'_parent');                              $( '#' + taxonomy + '-add-submit' ).prop( 'disabled', false );                         if ( 'undefined' != s.parsed.responses[0] && (sup = s.parsed.responses[0].supplemental.newcat_parent) ) {                                 drop.before(sup);                                 drop.remove();                         }                 };                      $('#' + taxonomy + 'checklist').wpList({                         alt: '',                         response: taxonomy + '-ajax-response',                         addBefore: catAddBefore,                         addAfter: catAddAfter                 });                      $('#' + taxonomy + '-add-toggle').click( function() {                         $('#' + taxonomy + '-adder').toggleClass( 'wp-hidden-children' );                         $('a[href="#' + taxonomy + '-all"]', '#' + taxonomy + '-tabs').click();                         $('#new'+taxonomy).focus();                         return false;                 });                      $('#' + taxonomy + 'checklist, #' + taxonomy + 'checklist-pop').on( 'click', 'li.popular-category > label input[type="checkbox"]', function() {                         var t = $(this), c = t.is(':checked'), id = t.val();                         if ( id && t.parents('#taxonomy-'+taxonomy).length )                                 $('#in-' + taxonomy + '-' + id + ', #in-popular-' + taxonomy + '-' + id).prop( 'checked', c );                 });              }); // end cats


wordpress reusable content blocks

I am using a custom post type to allow the editor of the site to add a number of blocks of content to the site - infoboxes. Now i would like to give the editor the possibility to choose which boxes appear on which pages. So if i have defined page 1 and page 2 is there a way to allow the user to choose that on page 1 the infoboxes a and b are shows and on page 2 the infoboxes m and n? Thanks.


Pagination in author, category, archive and tags pages does not work

I have implemented a no-plugin pagination taken from here: http://www.kriesi.at/archives/how-to-build-a-wordpress-post-pagination- without-plugin It's works perfecto un normal loop but when I try to use in author pages, categories, archives, tags and search results everything goes bad. The pagination works but when the link it generate load then everything woes wrong. The code:               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $args = array(         'posts_per_page' => '3',         'paged'=>$paged      );          query_posts( $args );      h**p://localhost/?author=1&paged=1 works perfect, load author.php template. h**p://localhost/?author=1&paged=2 redirects me to home page. If I change &paged with &page the it works but the stander loop in index.php used paged by default and I want the same paginator working in the hole website. It's like wordpress do something special with "paged" parameter. ¿Any tip or suggestion? Thanks in advance


Allow users to upload multiple images to their profile

I've asked this before but to no avail. I need the ability for any user (From Contributor up) of my website to upload a minimum of 5 and a maximum of 10 images to their profile and have they displayed immediately I'm sure there's a way to customize the User Photo plugin - http://wordpress.org/extend/plugins/user-photo/ but it's beyond my skillset. Any ideas?


Moving WP install from local to live, what about wp_posts GUID?

Done this before and i am still wondering what to do with the wp_posts => guid content, which has reference to http://localhost But at wordpress.org http://codex.wordpress.org/Changing_The_Site_URL it clearly states: > Never, ever, change the contents of the GUID column, under any > circumstances. But as i understand it is just to unique identify your posts globally. But as more people would have http://localhost in their guid. So can i safely replace http://localhost with http://www.mydomain.com?? regards


Show top commenters without using a plugin

I'm trying to create a small list of top commenters in my sidebar. I don't want to use a plugin, so I was googling for codes. All I could find was the following:               function top_comment_authors($amount = 5){              global $wpdb;              $results = $wpdb->get_results('             SELECT                 COUNT(comment_author_email) AS comments_count, comment_author_email, comment_author, comment_author_url             FROM                 '.$wpdb->comments.'             WHERE                 comment_author_email != "" AND comment_type = "" AND comment_approved = 1             GROUP BY                 comment_author_email             ORDER BY                 comments_count DESC, comment_author ASC             LIMIT '.$amount              );              $output = "
";         foreach($results as $result){             $output .= "
".$result->comment_author."
";         }         $output .= "
";              echo $output;          }      I already modified it because I also want the post count and author url to show up. I also want to add a gravatar later on. However, it just displays everything next to each other: ![enter image description here](http://i.stack.imgur.com/tLRUH.jpg)               $output .= "
".$result->comment_author. $result->comments_count. $result->comment_author_url."
";         }         $output .= "
";              echo $output;          }      Whenever I try to add something, I end up getting an error message. I'm pretty sure I need to modify the little code above if I want to change the way it's displayed, but HOW?! :/ This is how I call the function, so no room for customization other than in the function.php, right?:               <?php top_comment_authors(); ?>      I'm not really good with PHP, so I wonder how I'd do something like this: [gravatar] "commenters-name-as-url-if-available" (comment-count) e.g. "japanworm (45)" If anybody could help me a little, that would be great. Thanks a lot!


How to make WP admin recognize a newly created child theme?

I am having a problem that's very similar to the one described here, except that the solution that worked for him (text encoding) didn't work for me. I even tried applying `unix2dos -o style.css` from the command line (which definitely changed the file from LF to CRLF, as I could see that the file increased slightly in size), but that didn't help. I also tried clicking the button `Search Installed Themes` but that didn't help either. What are the requirements for making a child theme appear in the admin's list of Available Themes?


Format the Layout of Images In The Edit Post Textarea?

The textarea in which posts are written and edited doesn't handle image layout very well. ![edit post textarea with photos](http://i.stack.imgur.com/MGpPL.png) Inserted images seem to be aligned with the left edge of the textarea, or the right edge of the previous image. This is often hard to work with, and users have to understand that this isn't the way they will show up once published. **I'm after a better-looking, and more usable layout.** I'd like to be able to ALWAYS have non-floated images appear left justified and stacked one on top of the other. Is this solved by modifying the admin css, or does the formatting of images in the textarea accomplished another way?


How do I get the Twitter Tools widget to display my tweets?

I'm trying to archive my tweets in Wordpress and display recent ones in my sidebar. I've installed the Twitter Tools plugin, configured it, and added its widget to my sidebar. Twitter Tools is creating blog posts for each of my tweets, so I know it is authorized by Twitter successully. However, the sidebar widget just displays "No tweets available at the moment." I've tried the procedure described here to uninstall and reinstall Twitter Tools to no avail. I'm also using the Ultimate Category Excluder plugin to exclude the tweet posts from my feed and homepage. I'm worried that might be the problem but others seem to be using this setup successfully. Any ideas?


How to add class to anchor using wp_nav_menu

Sorry if my post duplicate but i can't find best solution for my problem. I'm newbie on develop WP theme. Now i'd like to add class to current li and last li, but i don't know how to do? Hope someone help. Here is my HTML code:

Home

About

Contact


Do extra plugin files get deleted during an upgrade?

I learned from a previous question that plugin updates are downloaded as a zip file, and WordPress overwrites every file in the plugin folder whether or not that file actually had a change from one version to the next. My question is, if the user has added extra files to the plugin folder (such as .po/.mo files for language translation), will those files be deleted during a plugin update?


Adding class to last list item? Not WP generated

this one has been getting me for a while. At the moment I have a repeater field with Advanced Custom Fields:
     <?php if(get_field('homepage_service')): ?>             <?php while(the_repeater_field('homepage_service')): ?>
<img src="<?php the_sub_field('service_image'); ?>" />             <?php endwhile; ?>     <?php endif; ?>
      What I'm trying to do is apply a class to the last item generated by this... is there a way (or a function) to give a class to every last list item on a WP site? Thanks


How to test a WordPress plugin on a single post?

I would like to test a plugin on a single post, where the ID = 12546. I tried `is_single('12546')` in plugin.php and `$post->ID` with `global $post;`. Any suggestions to get this working.


Displaying custom post types by category

I have been at this now for about 12 hours I just don't know what I am doing. My theme has a home page post display scroller which shows posts from a selected category. At the moment it is only showing normal posts. Could someone please tell me how to make it show the custom type posts from that category aswell. The code for the scroller is:               <?php     function get_home_scroll( $cat_data ){ ?>          <?php         wp_enqueue_script( 'tie-cycle' );              $Cat_ID = $cat_data['id'];         $Posts = $cat_data['number'];         $Box_Title = $cat_data['title'];              $cat_query = new WP_Query('cat='.$Cat_ID.'&posts_per_page='.$Posts);      ?>

<?php echo $Box_Title ; ?>

                          <?php if($cat_query->have_posts()): ?>                     <div  id="slideshow<?php echo $Cat_ID ?>">                     <?php while ( $cat_query->have_posts() ) : $cat_query->the_post()?>
                             <?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('',272,125); ?>
                             <?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 tie_get_score(); ?>

                     <?php endwhile;?>

                     <div id="nav<?php echo $Cat_ID ?>" class="scroll-nav">
                                   <?php endif; ?>

               <?php } ?>


Wordpress and Unity high scores table

I am trying to figure out what is going to be my best route to go in this choice. I have a Unity game I have integrated with Wordpress but I need to send and receive the high scores of the game in the WP database.   1. Should I create my own table in WP to store my high scores along with the user information of people who have signed up.   2. Should I use Custom Post Types to store this kind of information instead of a my own table in WP? Many thanks


Submit custom form from post content and execute in plugin

I have prepared custom form (quiz plugin) with embedding in custom posts via {{QUIZ_ID}} placeholder. My form is displayed in post correctly but bigger problem is what form action should I create (and how to create that) to save all of data posted from this form to save in database (first) and display results (second) to user who submitted form?


Custom page in plugin visible in menu

I'm trying to understand creating custom plugin pages and menus in admin panel, but I get what I don't need. I've got:               function my_plugin_add_pages() {        add_menu_page(__('Custom quiz', 'custom-quiz'), __('Custom quiz', 'custom-quiz'), 5, 'custom-quiz-listing-page', 'custom_quiz_list_page');        add_submenu_page('custom-quiz-listing-page', __('Add quiz'), __('Add quiz'), 6, 'custom_quiz_add_quiz', 'custom_quiz_add_quiz');        add_submenu_page('custom-quiz-listing-page', __('Edit quiz'), __('Edit quiz'), 6, 'custom_quiz_edit_quiz', 'custom_quiz_edit_quiz');     }          function custom_quiz_list_page() {         require_once('includes/quiz-listing.php');     }          function custom_quiz_add_quiz() {        if (!empty($_POST)) {           CreateQuiz($_POST);           echo '<meta http-equiv="refresh" content="0;url=?page=custom-quiz-listing-page" />';        }        require_once('includes/add-quiz.php');     }          function custom_quiz_edit_quiz() {        if (!empty($_GET['quiz_id']) && !empty($_POST))           UpdateQuiz($_POST);        require_once('includes/edit-quiz.php');     }      And the problem is that all these pages (even subpages) are created in menu sidebar in admin panel. How to create page correctly without sticking it into admin menu?


Transient unique names

What would be the correct way to assign a different name to each transient for each instance of a plugin used as a widget or shortcode?


WP Multisite: Do a function after blog is activated

I wanted to add an action on when a user activated the blog through standard signup process, all my custom meta on the registration will be inserted on my modified `wp_blogs` table. Here is my code for the custom signup meta.               add_filter( 'add_signup_meta', 'custom_add_signup_meta' );          function custom_add_signup_meta ( $blogmeta = array() ) {                  $the_country = $_POST['country-origin'];             $d_currency = $_POST['user_currency'];             $d_zone = $_POST['state-origin'];                  $blogmeta['countries_id'] = $the_country;             $blogmeta['default_currency'] = $d_currency;             $blogmeta['zone_id'] = $d_zone;              return $blogmeta;          }      Now I want to hook the function below somewhere applicable which has arguments of `$blog_id` and my custom meta `$blogmeta`               function insert_custom_datas1($blog_id, $blogmeta) {             global $wpdb;             $wp_blogs = $wpdb->base_prefix . "blogs";                  $wpdb->query("UPDATE `" . $wp_blogs . "` SET `countries_id`='".$wpdb->escape($blogmeta['countries_id'])."', `default_currency`='".$wpdb->escape($blogmeta['default_currency'])."', `zone_id`='".$wpdb->escape($blogmeta['zone_id'])."' where `blog_id` = '" . (int)$blog_id . "'");          }      Please help in accomplishing this.


Is it possible to add a custom tab to the Featured Image Modal and if so how?

I tried using the media_upload_tabs filter but that didn't work. This question looks very similar to this Adding A Custom Tab To The Insert Media / Add Featured Image Modal but there that wasn't really specific. Anyone have tried with this situation. Please share me your thoughts guys. Thanks.


Is there a WordPress equivalent to MediaWiki templates

I'm new to WordPress and already in dire need of a way to reuse common page content. For example we have 10+ product pages and in different areas of each product's page I want to include a textual statement. In MediaWIKI they have a system of Templates which area awesome! You define a template with the content you want included and then include the template in pages. It's like a pre- processor merge system and will dump the contents of the template into the page where it's called for. The following topics seem to be close to what I want but not exactly   * Text snippets shared across posts   * Turn a snippet of HTML and PHP into a shortcode I found the Post Snippets plugin and it sounds like it could be a good fit but I wanted to ask here if anyone familiar with MediaWIKI knew of a more appropriate option?


How to delete cached transients from a widget instance properly?

So I have created this widget which pulls a number of posts. And the query is being cached via transients. But I need the transient to be deleted whenever a post is saved so the query can be refreshed. Have a look at this code snippet.               add_action( 'save_post', 'delete_transient' );          function delete_transient() {          if ( $_POST['post_type'] === 'post' ) {               // this is a hack around to delete widget transients               $max = 20;                    for( $i = 1; $i <= $max; $i++ ) {                 delete_transient( 'my-posts-widget-' . $i );               }                    }     }      Ok so everything setup and working however because a widget can have multiple instances, deleting the transient is becoming an issue. Here is why. Every time you put a widget into the sidebar, the unique number WP assigns is incremented. So if someone happened to drag the widget out and then put it back again, it will increment the number again. So my $max = 20 will soon not be valid anymore as the id could then be 30... I could set the $max to 100000+ but that is not practical. So with that in mind, you can see this is not a fully working solution. So my question is how are you guys handling this or have an idea of a work around? Thanks for looking.


How can I prevent my plugin's next version from updating one of the files?

I read in another question that all the files in the directory are deleted during an update and this is bad design. Got it. Prevent plugin from deleting important directories Is it possible to not modify one of my plugin's files during an update? I have a text file in the plugin directory into which the user has entered data. The reason my users have edited one of the files is twofold:   * I don't like admin pages for simple plugins   * The plugin editor makes it easy for users to make text file edits Can I get the file contents before the file is deleted? Can I preserve that file in any way with an update by checking it's modified date and copying it before it dies?


Using FirePHP with WordPress

I am trying to make it so that I can output to the console in PHP. I have already installed FireFox with the FireBug and FirePHP addons. I downloaded the 'FirePHPCore Server Library' from here and I uploaded it into 'wp-content/themes/Jupiter/includes' (my theme is called Jupiter). Then, from within the loop of a template page, I wrote the following code:               <?php     include_once('includes/FirePHPCore/FirePHP.class.php');     include_once('includes/FirePHPCore/fb.php');          ob_start();     FB::warn("Warning message!");     ?>      I have tried to put the includes in functions.php and I have tried using the OO/Procedural calls and nothing seems to be working. What am I missing? Is there an easier way of doing this? ### Warning Information I turned wp_debug on in order to get the following output when attempting to add a debug line: Fatal error: Uncaught exception 'Exception' with message 'Headers already sent in /home5/alumnicl/public_html/beta/main/wp-content/plugins/jupiter- framework/jupiter-framework.php on line 32. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.' in /home5/alumnicl/public_html/beta/main/wp- content/themes/Jupiter/includes/FirePHPCore/FirePHP.class.php:1178 Stack trace: #0 /home5/alumnicl/public_html/beta/main/wp- content/themes/Jupiter/includes/FirePHPCore/FirePHP.class.php(757): FirePHP->newException('Headers already...') #1 /home5/alumnicl/public_html/beta/main/wp- content/themes/Jupiter/includes/FirePHPCore/fb.php(64): FirePHP->fb('hello world', 'Message Title') #2 /home5/alumnicl/public_html/beta/main/wp- content/themes/Jupiter/control-display.php(28): fb(Array, Array) #3 /home5/alumnicl/public_html/beta/main/wp-includes/template-loader.php(47): include('/home5/alumnicl...') #4 /home5/alumnicl/public_html/beta/main/wp- blog-header.php(16): require_once('/ho in /home5/alumnicl/public_html/beta/main/wp- content/themes/Jupiter/includes/FirePHPCore/FirePHP.class.php on line 1178 I have already included ob_start() directly before the require statement - should I be putting it somewhere else?


How to add taxonomy into URL of single custom post type

I have the following url of each custom post type               Portfolio/titleofcustomposttype     Portfolio/othertitleofcustomposttype      But, i have already taxonomy for each post, and i want it to be displayed in the URL, like :               Portfolio/technology/titleofcustomposttype     Portfolio/math/othertitleofcustomposttype     Portfolio/science/othertitleofcustomposttype      here **technology** in the name of my taxonomy How can I do that? i did `'rewrite' => array( 'slug' => 'Portfolio/%course%' ),` and i added this code in functions.php               function wpa_course_post_link( $post_link, $id = 0 ){              $post = get_post($id);                if ( is_object( $post ) ){                  $terms = wp_get_object_terms( $post->ID, 'competence' );                  if( $terms ){                      return str_replace( '%course%' , $terms[0]->slug , $post_link );                  }              }              return $post_link;            }     add_filter( 'post_type_link', 'wpa_course_post_link', 1, 3 );      like that, the urls are good, but i get a 404 error page !


Is there a limit to hook priority?

When I wish my filter or action hook to override all others, I will assign it a priority of `999`. However, lately I have been seeing some people use extreme values for the priority, such as `20000`, and even `99999` Besides the fact that using priorities this high is ridiculous, will they actually work? Is there a limit to hook priority? What will happen if the limit is exceeded? Is there a performance difference when using extreme priorities? **Update:** @harke suggests on Stack Overflow that the number is limited by `PHP_MAX_INT`


Migrated from localhost to server and cannot get custom_fields content anymore

So i migrated from localhost to my server, everything is working but my plugin cannot get the custom fields data anymore. I get my custom fields this way:               $customs = get_post_custom($nodeid);     $customs['concertname'][0];      Then i tried get post meta and this also returns an empty string... The plugin i use is advanced custom fields, i use my own plugin to get the custom post data and put it in an xml. Local, everything is working like a charm. Plz help, this is for my finals :)


Import Attachments - not attaching to post_parent

I've set up a dev site for a client, for who we're overhauling their existing site. One thing I wanted to do is import all their existing news posts, and carry over any images attached to those. I've managed to export the attachments WP Attachment Export plugin. The xml file appears to be all fine, and the correct values for post_parent are included. When I try to import the xml file using the standard Wordpress Importer - the images are imported into the media library, and the various data that goes with it _except_ all the post_parent values are reset to 0, meaning that they're no longer attached to anything. What's going on here, and is there a work around to have the post_parent imported properly? The existing site has over a thousand media files, so clearly I don't want to have to re-attach them manually. Edit. Here is a sample of one of the attachments in the xml. I've xxxx out some of filename/titles.               <item>         <title>XXXXXXXXXX</title>         <link>http://www.xxxxxxx.com/news/xxxxxxx/attachment/xxxxxxx/</link>         <pubDate>Wed, 18 Sep 2013 04:00:21 +0000</pubDate>         <dc:creator>Emma</dc:creator>         <guid isPermaLink="false">http://www.xxxxxxx.com/wp-content/uploads/2013/09/xxxxxxx.jpg</guid>         <description></description>         <content:encoded><![CDATA[]]></content:encoded>         <excerpt:encoded><![CDATA[]]></excerpt:encoded>         <wp:post_id>3880</wp:post_id>         <wp:post_date>2013-09-18 13:30:21</wp:post_date>         <wp:post_date_gmt>2013-09-18 04:00:21</wp:post_date_gmt>         <wp:comment_status>closed</wp:comment_status>         <wp:ping_status>closed</wp:ping_status>         <wp:post_name>xxxxxxx</wp:post_name>         <wp:status>inherit</wp:status>         <wp:post_parent>3874</wp:post_parent>         <wp:menu_order>0</wp:menu_order>         <wp:post_type>attachment</wp:post_type>         <wp:post_password></wp:post_password>         <wp:is_sticky>0</wp:is_sticky>         <wp:attachment_url>http://www.xxxxxxx.com/wp-content/uploads/2013/09/xxxxxxx.jpg</wp:attachment_url>         <wp:postmeta>             <wp:meta_key>_wp_attached_file</wp:meta_key>             <wp:meta_value><![CDATA[2013/09/xxxxxxx.jpg]]></wp:meta_value>         </wp:postmeta>         <wp:postmeta>             <wp:meta_key>_wp_attachment_metadata</wp:meta_key>             <wp:meta_value><![CDATA[a:5:{s:5:"width";i:500;s:6:"height";i:435;s:4:"file";s:30:"2013/09/xxxxxxx.jpg";s:5:"sizes";a:3:{s:9:"thumbnail";a:4:{s:4:"file";s:30:"xxxxxxx.jpg";s:5:"width";i:220;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:30:"xxxxxxx.jpg";s:5:"width";i:340;s:6:"height";i:295;s:9:"mime-type";s:10:"image/jpeg";}s:5:"large";a:4:{s:4:"file";s:30:"xxxxxxx.jpg";s:5:"width";i:402;s:6:"height";i:350;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:10:{s:8:"aperture";i:0;s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";i:0;s:9:"copyright";s:0:"";s:12:"focal_length";i:0;s:3:"iso";i:0;s:13:"shutter_speed";i:0;s:5:"title";s:0:"";}}]]></wp:meta_value>         </wp:postmeta>     </item>       Cheers.


Getting author URL outside the loop

I am trying to get author information in my `header.php`. This is what I use to display the name and it works like a charm:               <?php $author_id=$post->post_author; ?><?php echo the_author_meta( 'display_name' , $author_id ); ?>      I also wanted to get the author's URL so I changed the code to               <?php $author_id=$post->post_author; ?><?php echo the_author_meta( 'user_url' , $author_id ); ?>      but this doesn't work.


Buggy wp_nav_menu?

I hope somebody can show me some light on this. I am working on a site that has a 3 level menu which loads calling 3 different wp menus (let's say "main- menu", "projects-submenu", "2nd-level-projects-submenu", where "projects- submenu" are categories and "2nd-level-projects-submenu" are subcategories of one category in "projects-submenu". But came across one annoying bug (or one error by myself I don't seem to identify) regarding wp adding a current-menu class to the wrong menu item. This is, instead of activating the corresponding "projects" item menu when visiting one of its submenus, it activates the wrong menu item "news" adding the class current-menu-item to it wrongly. I have checked the wp menus on the admin panel several times and also deleted and rebuilt them again but nothing seems to fix this. Here is a link to the temporary site: http://bruto.se/wp/proyectos/equipamientos/ Code example that loads a menu:               <?php get_header(); ?>          <?php wp_nav_menu( array('menu' => 'proyectos' )); ?>               <?php     if ( is_category_or_sub(4) ) {     wp_nav_menu( array('menu' => 'proyectos-2level' ));     }     else {}     ?>      Screenshots: http://min.us/mbjE27te3W


Custom image size vs CSS sizing

I am developing a theme which will have 2 configuration options for the slideshow in the header; a full width version and a half width version. The theme is also responsive and so I am trying to optimize it as much as possible from a speed point of view. I am trying to decide which approach is best.   1. Use `add_image_size()` to create a new image size to use for when the user selects the half width configuration   2. Use the full width images and re-size them using CSS The advantage the new image size is that the slider images would be smaller, this is positive since the theme is to be responsive, however it means that every image in the library now will have an extra image created, even though only a small few of these images will actually be used in the slider. Which would be the best approach, or is there anything else to consider?


Template redirect is_tax() not working

I'm trying to do a template redirect in my wordpress but with partial success                 function ahaali_qa_theme_redirect(){         global $wp;         $plugindir = dirname(__FILE__);              if(is_archive()){             $tname = 'archive-question.php';             if(file_exists(TEMPLATEPATH.'/'.$tname)){                 $returntemplate = TEMPLATEPATH.'/'.$tname;             }else{                 $returntemplate = $plugindir.'/default-template/'.$tname;             }             ahaali_do_theme_redirect($returntemplate);         }elseif(is_single()){             $tname = 'single-question.php';             if(file_exists(TEMPLATEPATH.'/'.$tname)){                 $returntemplate = TEMPLATEPATH.'/'.$tname;             }else{                 $returntemplate = $plugindir.'/default-template/'.$tname;             }             ahaali_do_theme_redirect($returntemplate);         }elseif(is_archive() && is_tax('question_category')){             $tname = 'taxonomy-question_category.php';             if(file_exists(TEMPLATEPATH.'/'.$tname)){                 $returntemplate = TEMPLATEPATH.'/'.$tname;             }else{                 $returntemplate = $plugindir.'/default-template/'.$tname;             }             ahaali_do_theme_redirect($returntemplate);         }     }      everything works except the is_tax() , can somebody explain me how to do this or what I'm doing wrong ? Thank you !


How to use JSONP to make AJAX request to different site on network

I am trying to get buddypress avatars on a network's main site from a sub- site. The way buddypress does avatars is really involved with loops and fallbacks etc and doesn't consist of any database calls, which would have been straightforward. Instead I thought maybe I will create a function on my main site to output the user's avatar and then grab it with AJAX. But the cross-domain policy is in effect and I'm having difficulty understanding how to implement JSONP to get around it. My javascript looks like this:               $('.external-avatar').each(function(){                 var user_id = $(this).data('user_id');                 $.ajax({                     type: 'POST',                     url: vars.rootAjaxurl,                         data: {                         action: 'bp_cross_site_avatar',                         user_id: user_id,                     },                     success: function(data, textStatus, XMLHttpRequest, user_id){                         $(".external-avatar.user-"+user_id).attr('src', data);                     },                     error: function(MLHttpRequest, textStatus, errorThrown){                       // alert(errorThrown);                     }                   });               });      Is there a way to get a request like this to work?


How can the temporary update directory be changed?

When a plugin, theme, or even WordPress itself are updated, it downloads and saves the files (`.zip`, extracted files, etc.) to `wp-content\upgrade`. This is not always desirable. For example, I run a portable version of WordPress from a flash-drive, so I don’t want it using the flash-drive for temp files. I would prefer it to put temporary files in the system’s temporary directory. I already changed the temporary (upload) directory in `php.ini` as so:               upload_tmp_dir = ${Temp}      This works for regular PHP scripts, and while I’ve seen a couple of pages which seem to indicate that WordPress (3.0+) should use the default (upload? download?) temporary directory, it is ignoring it and still putting the temporary files in `wp-content\upgrade`. How can this be changed?


wp_schedule_event will it run if timestamp has passed?

I've been told by my clients that scheduled jobs are not run some times as expected. I never questioned myself about how wp_cron actually works, I thought it was kinda self-explanatory. But now I doubt it. Codex says that timestamp argument is: > the first time that you want the event to occur. This must be in a UNIX > timestamp format. I know that wp_cron triggers events when someone visits the site. But what if the visit happens little bit after the time hardcoded in timestamp? Will that event still trigger? Or pass?


Tracing dashboard publish settings from input form in WordPress

I need to replicate a plugin's input form from the dashboard and make it available to the public so that they can enter data directly to the DB rather than using a form that is emailed and then copying and pasting it manually. Once submitted, rather than publish, I need the entry to sit in draft mode rather than being published as we need final control over what is published. What is the best way to trace the submission of a plugin's publish settings back to the DB? Is there a standard function every post entry hits to submit to the DB in WordPress or is it different for every plugin. Many thanks.


making images scalable for responsive designs

Working on first responsive website template; layout is part fluid, with fixed sidebars, using media queries. I want to have some of my images be scalable. Per this article http://www.blissfulinterfaces.com/making-wordpress-images- responsive/ it should be very simple, at least for manually loaded images. Add this to stylesheet:               img{max-width: 100%;}     img{ -ms-interpolation-mode: bicubic; }      and manually remove width and heights that wp automatically adds. Have done both and not a thing happens. See images in the main areas (not sidebars) on these 2 pages: http://66.147.244.110/~rdbikeco/wheelbuilding.html and http://66.147.244.110/~rdbikeco/aboutus.html I haven't added code to functions for thumbnails yet -- wanted to get the basics working first. What am I missing? Thanks!!


How to get the theme directory URI?

I want to get the theme root URL with PHP. What would be the best way to do that? There is a function called `get_theme_root()` which gives me the path but not the URL. Maybe just get the current themes or parent themes URL and cut the theme directory off? How do I do that?


Why do I lose the content of meta boxes when I leave the page?

So I've been coding a theme and I'm working on a custom post type. When I edit a custom post and save the changes (click Update) everything is ok. But - I noticed that when I leave the Edit page open for a while and come back to it a few minutes later and try to refresh, that dialog "Stay On Page/Leave Page" pops up and if I choose "leave page" all of the content from the custom meta boxes is lost. Only the title remains. I'm guessing this has something to do with the way that I'm saving the data from the custom meta boxes, so here it is:               add_action('admin_init', 'init_portfolio_meta_boxes');          function init_portfolio_meta_boxes() {         add_meta_box('short_description', 'Short Description', 'short_description_meta', 'portfolio', 'normal');     }          function short_description_meta() {         global $post;         $custom = get_post_custom($post->ID);         $short_description = $custom['short_description'][0];         ?>             <textarea name="short_description" style="width: 200px; height: 100px;"><?php echo $short_description; ?></textarea>         <?php     }          add_action('save_post', 'save_details');     function save_details() {         global $post;         update_post_meta($post->ID, 'short_description', $_POST['short_description']);     }      That's the entire code for one of the meta boxes, I followed a tutorial to get to it.


Custom Taxonomies but with Icons associated?

Can I have custom taxonomies but with icons associated with them? Example: I want a list of skills I used for my portfolio item (eg. PHP, MySQL, CSS etc).   Instead of text, I thought of displaying icons. So I needto somehow set icons for my taxonomies. How might I do it?   Is it very complex? How might it look or whats it like to build it?   the steps?


WordPress Posts By Date/Day?

I want to output on the homepage the posts from the lastest 3 days. Like this: > 30/03/12                   post 1         post 2         post 3      > 29/03/12                   post 1         post 2         post 3      > 28/03/12                   post 1         post 2         post 3      I tried: > On 30/03/12 I have 5 posts > > On 29/03/12 I have 4 posts > > On 28/03/12 I have 3 posts So the 3rd day is missing now 2 posts. Also I want to use this on the archive page. 3 days a page. On page 2 the next 3 days. Here is my loops file               <div id="post-<?php the_ID(); ?>" class="entry-box">     <?php $embed = get_post_meta(get_the_ID(), 'tj_video_embed', TRUE); ?>     <?php if($embed && (get_option('videoplus_fancybox_enable') == 'on')){         $embed_url = '';         $mode = '~http://[\d\w\s:/.]*~iS';         preg_match($mode,$embed,$embed_url);     ?>     <a href="<?php echo $embed_url[0];?>" rel="bookmark" class="various fancybox.iframe">     <?php } else { ?>         <a href="<?php the_permalink(); ?>" rel="bookmark">     <?php } ?>         <?php if(has_post_thumbnail()){?>             <?php the_post_thumbnail('entry-thumb', array('class' => 'entry-thumb')); ?>         <?php } else { ?>         <?php $img_url = get_post_meta(get_the_ID(), 'tj_video_img_url', TRUE); ?>             <?php if($img_url != null) { ?><img src="<?php echo $img_url; ?>" alt="<?php the_title(); ?>" class="entry-thumb"/><?php } ?>         <?php } ?>              <?php if($embed) { ?>

         <?php }?>
         <?php the_time('M j, Y'); ?> · by <?php the_author_posts_link(); ?>                      <?php comments_popup_link( __( '0', 'theme junkie' ), __( '1', 'theme junkie' ), __( '%', 'theme junkie' ) ); ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

<?php the_excerpt(); ?>


How to show single post page as home page

I want to start a funny images website but I have come across a dilemma. I want the website to display 1 post ( not the thumbnail) but the full post on the home page. (the most recent post). Similar to jokideo can anyone please direct me to a `theme` or provide some code that I need to edit in the wp theme files. Thanks :)


Shortcode But Without The Equals Sign?

I am aware of creating a shortcode this way:               function font_fam($atts, $content = null){      extract(shortcode_atts(array(       'f' => '',         ), $atts ));          return ''.$content.'';          }     add_shortcode ('f','font_fam');      And to use it would be like this right:               [f f="Arial"] Text Text [/f]      But is there a way so that it will be used like this:               [f Arial] Text Text[/f]     [f Tahoma] Text Text [/f]      (skipping the "f=") Thanks!


Plugin Repostitory Questions

Hei, i've been developing a few plugins over the last few weeks that i want to share, soon, such as:   * a 'helper'-plugin, that eases the creation of standard option pages   * a photo contest manager   * a subcription signup manager (a rewrite of 'user role subscriptions' by Byrd)   * a basic affiliate ad campain manager with referral tracking Since im a lazy c*** i'm wondering if there's a necessity to setup my own site properly (which i have, but it still shows the ads from the hosting company ;-) ) or if using the SVN hosting offered by Wordpress Plugins gives me all i need? Also, what are the licensing policies when hosting on Wordpress Plugins? Thanks.


highslide is overlapped

I just integrated High Slide to my wordpress site, which I found over here http://highslide.com/editor/ I am displaying a form in this high slide window, but the problem is, I have youtube video on my every post and it is overlapping the form and the window, Check this image ![enter image description here](http://i.stack.imgur.com/AChDe.jpg) I dont want this overlapping, and also when I click on the Inline HTML link(which will popup the form) I want that the background should be in dim black color How can that be done?


Delete Post From Front-End and attachment permanently

Is there a way to delete a Post From Front-End and it's attachments permanently? This is a snippet that moves the post to the trash can, but it doesn't remove attached images (they remain on the server) and it doesn't remove the post permanently? Could someone please help?               <?php      $url = get_bloginfo('url');     if (current_user_can('edit_post', $post->ID)){     echo 'ID);     echo '">Delete post';     }     ?>


wp_update_post post_content not being updated accordingly

I have a function that is hooked into save_post, which updates / creates a product in Woo Commerce according to the creation / updating of a custom post type (video). The creation works fine and so does the update except that the update does not change the post content to the content that I want. (I do not want to update the post content in the product) but even when I explicitly set the post_content, it still gets updated with the custom post type content.               $my_post = array();                      $my_post['ID'] = $checkProduct;     $my_post['post_content'] = "post content";     $my_post['post_title'] = "post title";     // Update the post into the database     remove_action('save_post', 'save_video');     wp_update_post( $my_post );     add_action('save_post', 'save_video');        So the above code works for the post title but does not work for the post content. Any ideas?


get_query_var returns null

My pretty permalink clearly shows the query_var:               localhost/site/?tree=312      Yet when I run               var_dump(get_query_var('tree'));      I get NULL returned. Any reason why? Also when I print_r($wp_query), I can't find 'tree' anywhere.


WordPress database scalability from the code perspective

I have read through multiple questions here on StackExchange that concern WordPress scaling and the common opinion is that WordPress is indeed highly scalable provided you have the infrastructure to support it. However, all opinions point and talk about the database scaling. However, I must ask out of curiosity as to how scalable is the WordPress code? I find numerous places within the code where User IDs or Post IDs are cast as integers. Now, PHP puts limitation on range of integers to `-2147483648 to 2147483647`(signed) for 32 bit and `9223372036854775807` for 64 bit. Thus limiting the code to work in that range. So if you happen to have a Post ID or a User ID of `100000000000000` it shall be converted to `2147483647` on 32 bit systems. And a similarly on 64 bit. Effectively, limiting the system. So, though the database allows for scaling, the code limits the same. I may be entirely wrong with my assumptions, if so I'd like to be educated on the same. And if otherwise, how do we scale the code? Or are claims of WordPress scalability false? Also what are other possibilities where the code could be limiting the scalability?


navigation doesn't work in custom header.php

I've made a custom `header-blog.php`(for blog page/`home.php`) in addition to `header.php`, both of which use the exact same `<nav>` code. On the pages that use `header.php`, the navigation works perfectly. However, on the blog page(`home.php`), which uses `header-blog.php`, the navigation doesn't work- all links lead to "Nothing found." What could be the cause of this? How can I fix it? This is my first time with something like this, so any insight and ideas are greatly appreciated. header-blog.php               <!DOCTYPE html>                        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />         <meta name="generator" content="Wordpress <?php bloginfo('version'); ?>" />         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />         <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title>         <link rel="pingback" href="<?php bloginfo('pingback url'); ?>" />         <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />         <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" />         <link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/img/favicon.ico" />         <?php wp_head(); ?>

                 <a href="<?php bloginfo('url'); ?>"><img src="<?php echo get_template_directory_uri(); ?>/img/logo.png" alt="Urban Palate logo" id="logo" />

<img src="<?php echo get_template_directory_uri(); ?>/img/about.png" alt="Urban Palate intro" />

<img src="<?php echo get_template_directory_uri(); ?>/img/portfolio.png" alt="Urban Palate portfolio" />

<img src="<?php echo get_template_directory_uri(); ?>/img/blog.png" alt="Urban Palate blog" />

<img src="<?php echo get_template_directory_uri(); ?>/img/contact.png" alt="Urban Palate contact" />


Wildcard subdomain for the same site

Is there any way to make all requests to any subdomain load the same Wordpress website e.g. user1.example.com, user2.example.com and user3.example.com all load the same website, but with the links pointing to the current subdomain? I'd like to keep mostly the same content across the different websites. The only difference is that by reading the subdomain I can offer customized content (website title, etc) specifically to that user, or add a hook to display an error message if the user doesn't exist. At the moment the network install requires me to manually define every website, with different contents across them.


Related Posts: Notice: Undefined offset: 0

I get an undefined Offset message with this Query. Can anyone Help?               $terms = get_the_terms( $post->ID , 'filters', 'string');             $term_ids = wp_list_pluck($terms,'term_id');             $second_query = new WP_Query( array(                   'post_type' => 'portfolio',                   'tax_query' => array(                                 array(                                     'taxonomy' => 'filters',                                     'field' => 'id',                                     'terms' => $term_ids,                                     'operator'=> 'IN' //Or 'AND' or 'NOT IN'                                  )),                   'posts_per_page' => 4,                   'ignore_sticky_posts' => 1,                   'orderby' => 'date',  // 'rand' for random order                   'post__not_in'=>array($post->ID)                ) );


How to change order of posts in admin?

How can I change the order of posts in the admin dashboard, so they display alphabetically according to title, rather than latest first?


Possible to use conditionals within add_feed() callback?

I'm using `add_feed()` to create some custom feeds but calls to `is_singular()`, `is_home()` etc... just don't seem to work within the callback. Is there a workaround for this? Example code:               add_action( 'init', 'my_init' );     function my_init() {             add_feed( 'new_feed', 'feed_output' );     }          function feed_output() {         if ( is_home() )             load_template( '/path/to/feed/home/template.php' );         else             load_template( '/path/to/feed/template.php' );     }      I've added a trac ticket for this too.


Use get variable when rewritten url in wordpress

I have many pages which have a lot in common. They are supposed to display the same things but according to their own categories. The logical way to implement this would be to pass a variable through the url and display the info according to it. The only problem is that my wordpress urls are rewritten... I search this site before asking and I know there are posts around here related to that matter but they don't help me as they refer to some obscure regex I just can't associate to my own case. Not to mention some unexplained references to "tags" and "rules" which are quite beyond me. I reallly tried to learn from theses posts but I couldn't make use of them. Basically, my urls are rewritten and I need to add a single variable to this: "http://www.mysite/(mycategory) I don't know how to send the "mycategory" variable AND I don't know how to retrieve it. Any help would be appreciated.


Creating shortcodes with user created forms

I am creating a plugin. That enables users to create forms, & display these with shortcodes on a site. When creating a form (using custom post types), users will be able to add additional form fields with meta boxes. My question: When a user creates a form (via custom post type), how do I store the field type so the shortcode knows which type to display for the form?


WordPress keeps fetching the archive page instead of the template page

I have a template set up and I've created a page in WordPress and have chosen the corresponding template in the drop down. I have created templates for several pages of this site and they've all worked fine; however, this one template is causing problems. WordPress keeps fetching the archive page for some reason. The exact body class is this: `archive post-type-archive post- type-archive-teams logged-in` Here is the template I've created.                       <?php get_header();?>
                          <?php                         $temp = $wp_query;                         $wp_query = null;                         $wp_query = new WP_Query();                         $wp_query->query('post_type=teams&posts_per_page=7');                              while ( $wp_query->have_posts() ) : $wp_query->the_post();                          ?>                          <article class="post team" id="post-<?php the_ID(); ?>">
<?php the_title(); ?>

                                           content here

                          <?php                         endwhile;                          $wp_query = null;                         $wp_query = $temp;                         wp_reset_query();                     ?>
                  <?php get_sidebar(); ?>                  <?php get_footer(); ?>      Can someone help me out in figuring out why this isn't working?


Only display a certain number of posts, dependent on how many posts there are available in a query

I am trying to write some code for a slider of posts, at the moment my code involves two `WP_Query`s, one inside the other, but I can't help feeling there may be a more efficient way of doing what I'm trying to achieve. Steps are:   1. Check how many published posts there are of a certain post type, using a WP_Query.   2. If there are >= 4, I want to add a slider to the page, so I start printing out slider container.   3. Then within the slider HTML, I use the count of posts from the first WP_Query (`$num_posts`) to work out how many posts I want to print out in the next query. If there are >= 12 available, I want to print all 12. If there are between 8 and 11 available, I want to print out only 8. If there are between 4 and 7 available, I want to print out only 4.   4. I feed the number I want to print out (`$postsToPrint`) into `showposts` as an argument for the second WP_Query. Is there any way of doing this without having two `WP_Query`s? It seems inefficient. Explanation of code here:                   // Initial query which only exists so I can count available posts              $args = array (             'post_type'              => 'mytheme_posttype',             'post_status'            => 'publish',             'showposts' => 12         );              $sliderQuery = new WP_Query( $args );                   // Count how many available posts there are for my slider         $num_posts = $sliderQuery->post_count;              if ($num_posts >=4) : ?>              // Want to add a slider if posts >= 4, so start printing out slider container HTML here.              // I then want to check how many posts were collected in the above query, and only print out a certain number depending on how many there are available                  // if there are 12 available posts, print out all 12             if ($num_posts >= 12) {                 $postsToPrint = 12;             }                  //  else if there are between 8 and 11 available posts, only print out 8             elseif ($num_posts >=8) {                 $postsToPrint = 8;             }                  // if there are between 4 and 7 available posts, only print out 4             else {                 $postsToPrint = 4;             }                  // Second query for actually printing out posts.                  $args = array (                 'post_type'              => 'mytheme_posttype',                 'post_status'            => 'publish',                 'showposts' => $postsToPrint             );                  $loop = new WP_Query( $args );                  while ( $loop->have_posts() ) : $loop->the_post();                      // print out post thumbnail and some other post data in slider                  endwhile;                  // close slider container HTML              endif;      Thanks!


Ajax request with jQuery without WP_ajax

I try to made a website in full ajax (a html5 website). I use jquery and innerShiv (for ie). For exemple I want to load all the content of the "section" tag of a page. When I use that script, it works perfectly :               var link = 'http://ajax.wuiwui.net';     $('#new').load(link + ' #contenu');      But when i use this one, I can't find element which aren't into the wordpress loop...               $.ajax({       url: link,       processData: false,       success: function(data){         data = innerShiv(data,false);         var truc = $(data).find('#contenu');         $('#new').append(truc);       }     });      For my project I want to load some elements with only one ajax request, so the second script is more intersting. But it dont work... Do you know why ? My project : http:/ajax.wuiwui.net Thanks a lot for your help !


How to change the way wp_embed handles only youtube videos?

What i'm trying to do is have youtube videos show a div when they stop playing. Wordpress replaces youtube links automatically with embed code. Instead I'd like to replace it with something like:               function custom_ytube_embed ($content) {         if (strstr($content,'http://www.youtube.com/embed/')) // see if any youtube embeds available         {             $pattern = "/version=3&rel=1&(.*?)&wmode=transparent'/s"; //param pattern             $count = preg_match_all($pattern, $content, $matches); //find pattern and count matches                  foreach ($matches[0] as $match) {             // replace matched params with new params                      if (is_single()) { //autoplay only on single pages                 $new_param = "autoplay=1&enablejsapi=1&modestbranding=1&rel=0&showinfo=0&iv_load_policy=3&wmode=transparent' id='vidID" . $count . "'";             }             else { //all other pages no auto play                 $new_param = "autoplay=0&enablejsapi=1&modestbranding=1&rel=0&showinfo=0&iv_load_policy=3&wmode=transparent' id='vidID" . $count . "'";             }                  //replace params iframe with new params             $content = str_replace($match, $new_param, $content);             $count--;         }         return $content;          }          else {             return $content; // if not found return it anyway         }     }          function div_wrapper($content) {         // match any iframes         $pattern = '~<iframe.*|<embed.*</embed>~';         preg_match_all($pattern, $content, $matches);              foreach ($matches[0] as $match) {             // wrap matched iframe with div             $wrappedframe = '
' . $match . '
';                  //replace original iframe with new in content             $content = str_replace($match, $wrappedframe, $content);         }              return $content;         }          add_filter('the_content', 'custom_ytube_embed');     add_filter('the_content', 'div_wrapper');      This way i could rely on the youtube api to make the player and i can call a funtion when the player is done playing. Also I need to pull the video id from the post as well. At first I tried remove_filter from the_content of the wpembed all together and then using add_filter to the_content to strip the original post of the youtube link and replace it but that isn't ideal if someone was to post something besides a youtube video and my results didn't go as well as I expected. I know my approach probably isn't ideal as I don't have much experience with wordpress. Any help is gladly appreciated.


wp-comment-post.php and header already sent issues

I'm new here and I really hope somebody can help me. I've tried alone for many days, found a lot of solutions that worked for others, but that didn't work for me and so I really hope somebody here can help me figure it out. I have the "Guan Image Notes" Plugin installed. I finally got it to work (it seems to interfer with other plugins, especially OpenID and Captcha plugins). However I can't seem to get rid of this error message when somebody sends a comment:               Warning: Cannot modify header information - headers already sent by (output started at /hermes/bos.../wp-content/plugins/guan-image-notes/imageannotation.php:178) in /hermes/bos.../wp-comments-post.php on line 95          Warning: Cannot modify header information - headers already sent by (output started at /hermes/bos.../wp-content/plugins/guan-image-notes/imageannotation.php:178) in /hermes/bos.../wp-comments-post.php on line 96          Warning: Cannot modify header information - headers already sent by (output started at /hermes/bos.../wp-content/plugins/guan-image-notes/imageannotation.php:178) in /hermes/bos.../wp-comments-post.php on line 97          Warning: Cannot modify header information - headers already sent by (output started at /hermes/bos.../wp-content/plugins/guan-image-notes/imageannotation.php:178) in /hermes/bos.../wp-includes/pluggable.php on line 934      The comment is still being sent, though! I tried to modify that line. Wrapping it. The content of that line is:               echo " ";        Here*s the whole code: http://pastebin.com/pu86tyn5 I really hope somebody can help me figure this out. I'm a total beginner when it comes to coding. My website looks horrible right now as I'm still trying out things. If you need to check my website, here it is: click Thanks so much in advance.


Nested custom post types with permalinks

I am trying to set up a multi-level custom post type structure with permalinks that look like `authors/books/chapters`, with authors, books, and chapters all set up as their own custom post type. For example, a typical URL on this site might look like `example.com/authors/stephen-king/the-shining/chapter-3/` Each chapter can only belong to one book, and each book can only belong to one author. I've considered using taxonomies instead of CPTs for authors and books, but I need to associate metadata with each item and I prefer the post interface for this. I'm most of the way there by simply setting up each custom post as a child of an entry in the CPT one level up. For example, I create "Chapter 3" and assign "The Shining" as a parent using a custom meta-box. "The Shining" in turn has "Stephen King" as a parent. I haven't had any trouble creating these relationships. I'm using rewrite tags in the CPT slugs and the permalinks want to work, but they're not quite right. Using a re-write analyzer, I can see that the rewrite rules are actually generated, but they don't seem to be in the right order and so other rules are processed first. ![Here's a screenshot of my rewrite analyzer.](http://i.stack.imgur.com/1pcbA.png) Here's how I've registered my CPTs:               function cpt_init() {            $labels = array(         'name' => 'Authors'        );            $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,          'show_in_menu' => true,          'query_var' => true,         'rewrite' => array(             'slug' => 'author',             'with_front' => FALSE,         ),         'with_front' => false,         'capability_type' => 'post',         'has_archive' => false,          'hierarchical' => true,         'menu_position' => null,         'supports' => array( 'title', 'editor' )       );             register_post_type('authors',$args);            $labels = array(         'name' => 'Books'       );            $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,          'show_in_menu' => true,          'query_var' => true,         'rewrite' => array(             'slug' => 'author/%authors%',             'with_front' => FALSE,         ),         'with_front' => false,         'capability_type' => 'post',         'has_archive' => false,          'hierarchical' => true,         'menu_position' => null,         'supports' => array( 'title', 'editor' )       );             register_post_type('books',$args);                 $labels = array(         'name' => 'Chapters'        );            $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,          'show_in_menu' => true,          'query_var' => true,         'rewrite' => array(             'slug' => 'author/%authors%/%books%',             'with_front' => FALSE,         ),         'with_front' => FALSE,         'capability_type' => 'post',         'has_archive' => false,          'hierarchical' => true,         'menu_position' => null,         'supports' => array( 'title', 'editor' )       );             register_post_type('chapters',$args);          }          add_action( 'init', 'cpt_init' );      So is there any way to change the priority of my rewrite rules so that authors, books, and chapters are all matched first? I also know that I'm going to have to add a `post_type_link` filter, but that seems secondary to getting the permalinks right in the first place. If anyone knows where I can find a comprehensive overview of how that filter works, it would be appreciated.


Grab the first paragraph of each post

I have some code that uses preg_match to grab the first paragraph, and then spit it out in the loop:               function first_paragraph() {       global $post, $posts;       $first_para = '';       ob_start();       ob_end_clean();       $output = preg_match_all('%(
]*>.*?
)%i', $post->post_content, $matches);       $first_para = $matches [1] [0];       echo $first_para;     }      However, there is a little problem with this. It only works when I manually wrap text in `<p> </p>` tags in the editor, and not otherwise. Regular expressions are certainly not my forté, so any help or further understanding would be great. And this works, also wraps the images/iframes in p tags:               function first_paragraph() {       global $post, $posts;       $first_para = '';       ob_start();       ob_end_clean();       $post_content = $post->post_content;       $post_content = apply_filters('the_content', $post_content);       $output = preg_match_all('%(
]*>.*?
)%i', $post_content, $matches);       $first_para = $matches [1] [0];       echo $first_para;     }


Sorting by date not working?

I have a blog which has worked as normal. I recently moved it to another server by cloning the database and copying all the files. Now my posts are ordered randomly. Where do I start troubleshooting?


Show the categories the current post has

I have a custom post type; posts of this type can have either one or two categories associated with them. I need to display the names of the categories that are associated with each of these custom posts within the loop. Is there a way to do this?


Wordpress as CMS: How to manage/handle images assigned to a post as full-sized background images in a slideshow?

I wonder if Wordpress is the best CMS or solution for what I wannt to do? I need to find some way to upload images to a post that I can loop as background images. Just like I can upload multiple images and Wordpress automatically creates a `gallery` I don't want that to happen, but use those images directly (without any thumbnails or whatsoever) and be able to create a javascript slideshow that loops through those images. So actually I probably need some way of creating a javascript array within php when I upload images to a post. And when viewing the post I can then loop through this array with javascript. Any idea how to write a function that does that? However I might need single images inside the post - just no galleries. Ideas on that? Tipps or tricks? Is there probably a plugin out there that does that?


Edit Comment_Field while using T5 Comment Textarea On Top-Plugin

I’m using the _T5 Comment Textarea On Top_ -Plugin for the comment_field. I’m a newbie to wordpress. So I don’t know, how can i edit the Style of the comment_field or edit the Label? Usually I would put in the array of comment_form in my comments.php like this:                  'comment_field'        => '
...',      But this only adds another textarea. And then I tried to add a new filter like this:               add_filter( 'comment_form_field_comment', 'my_comment_form_field_comment' );          function my_comment_form_field_comment( $comment_field ) {              $comment_field = '
' . $comment_field . '
';              return $comment_field;     }      ...no changes. Sorry, seems a little bit like Trial’n’Error. Maybe you can help me out. Would be great!


Trying to edit a WP site locally using MAMP

I'm new to WordPress. A friend asked me to redesign his WP blog and I've installed it on my Mac using MAMP. I went through the database setup and imported the site's existing DB and added the tables. It all looks good, as far as I can tell, on the phpMyAdmin site. When I go to url "localhost" in Chrome (and other browsers) I see the blog's front page, which is definitely local, but if I try to login, I'm sent back online. This also happens if I click on any of the links in the blog. I've check that wp-config.php DB_NAME matches the name of the DB I downloaded. Anyone got any ideas what's going on? Thanks Gavin


is_page() conditional not working inside an AJAX function

I have a jQuery ui tabs that load posts via ajax on sidebar. Now in a specific page i want to filter the query post via `is_page();` conditional. But in my case its not working.               function load_home_classifieds($type){              $query = array(             'post_type' => 'classified',             'posts_per_page' => 5         );              if(is_page('real-estate')){                 //echo 'ok';                 $query['tax_query'] = array(                                                 array(                                                  'taxonomy' => 'classified-category',                                                  'field' => 'slug',                                                  'terms' => array( 'real-estate' ),                                                 'operator' => 'NOT IN'                                                 )                                        );             }              if($type == 'latest'){                  query_posts($query);             get_template_part('loop', 'cfhome');          }         elseif($type == 'random'){             $query['orderby'] =  'rand';             query_posts($query);             get_template_part('loop', 'cfhome');          }         else{             echo 'Invalid request!';                 }     }      Now, my question is how to get the conditional working inside an ajax function?


How to Save Different Usermeta Fields According to User Role?

I have created some custom roles using a plugin and I have also created custom user meta fields that are show in the Profile pages of each user (/wp- admin/profile.php) I have a problem with saving the custom fields, I can save the fields ok if I don't change the users' role. So, to give an example:   * User 1 has fields a, b, and c and they have a user role of Pending.   * If I change their user role to Owner, the fields they have are a and b   * If I then change their user role to Pending the details that were in field C disappear It seems that WP is removing it from the database. I want to be able to change the roles and fields without losing the data that is stored in the usermeta database table. I think my problem is with the update_usermeta function.               //saving the user fields     add_action( 'personal_options_update', 'save_user_fields' );     add_action( 'edit_user_profile_update', 'save_user_fields' );          function save_user_fields( $user_id ) {     if ( !current_user_can( 'edit_user', $user_id ) )         return false;     update_usermeta( $user_id, 'unit_type', $_POST['unit_type'] );     update_usermeta( $user_id, 'registered_as', $_POST['registered_as'] );     update_usermeta( $user_id, 'date_registered', $_POST['date_registered'] );     update_usermeta( $user_id, 'unit_number', $_POST['unit_number'] );     update_usermeta( $user_id, 'first_name', $_POST['first_name'] );     update_usermeta( $user_id, 'last_name', $_POST['last_name'] );     update_usermeta( $user_id, 'owner1_address', $_POST['owner1_address'] );     update_usermeta( $user_id, 'owner1_tel_day', $_POST['owner1_tel_day'] );     update_usermeta( $user_id, 'owner1_tel_night', $_POST['owner1_tel_night'] );     update_usermeta( $user_id, 'emergency_contact_name', $_POST['emergency_contact_name'] );     update_usermeta( $user_id, 'emergency_contact_tel_day',     $_POST['emergency_contact_tel_day'] );     update_usermeta( $user_id, 'emergency_contact_tel_night',     $_POST['emergency_contact_tel_night'] );     }


how to create a folder in wordpress

This is the dilema: I want to install wordpress in the root (regular installation for a wordpress site). Although, I want to have different cities to be available for the user to view the content depending on their choice. Example: 1. I have 2 cities (New York and Miami) 2. User chooses Miami 3. URL path should be: http://www.domain.com/miami/ 4. All information about Miami should be displayed (nothing about New York) When creating pages or post ( I would like to have the choice as an admin to put it on the folder(city) I choose to. Hope I am clear on my dilema. Thank you.


What 'function' will 'update' a post?

I am using a script to import my vbulletin forum posts into wordpress as posts. One quick issue I ran into is there are numerous forum posts with the same title 'please help me'. When I go into the post edit screen the permalink will show 'please-help-me-2' for the second one, and 'please-help-me-3' for the third one. That is exactly what I expect. However, when you go to **view the second one on the front end of the website** , instead of having the -2 appended to the end of the url, it simply says 'please-help-me'. If I 'update' the post, then the permalink saves properly and the front end link changes like it should. **What I need:** Is there a function that I can use to go through the posts database and have it automatically 'update' all the posts so that the permalinks will change properly on the front end? *we're talking 1.25million posts here, so automation is important. thanks


get_post_meta returns 0

I am trying to get metadata for a post (of custom post type). I had a look in the database, and the table "wp_postmeta" holds a row with "post_id" = 65, "meta_key" = "name_text" and "meta_value" = "Lars Åkerkvist". I am trying to fetch that value, Lars Åkerkvist, using get_post_meta as below               get_post_meta(65,"name_text",true)      But it always returns a 0. What am i doing wrong here?