title: Create A Metabox For A Custom Field

text: I add videos to my WordPress posts' video format by using custom fields. I was wondering if there is any way to create a meta box in post editor (like excerpt or something) for that specific custom field. Just a text area to add iframe code. For example the custom field is a embed-video.


title: Calling the_excerpt from inside a plugin template file

text:
Im trying to use the_excerpt form inside a plugins template file, plugin is wp-favorite-posts by default the plugin only lists and displays the saved post title, i have manged to get it to show everything, tax terms, image etc but having a heck of a time with the_excerpt, what happens when i add `<?php the_excerpt( $post_id ); ?>` into the code is a continual looping of the favorite post and no excerpt. Im using `global $post` so that i can get all the info (cept the excerpt)               <?php          global $post;          if (!empty($user)):         if (!wpfp_is_user_favlist_public($user)):             echo "$user's Favorite Posts.";         else:             echo "$user's list is not public.";         endif;     endif;          if ($wpfp_before):         echo "
".$wpfp_before."
";     endif;               if ($favorite_post_ids):         foreach ($favorite_post_ids as $post_id) {            $p = get_post($post_id); ?>

                            <?php if (strtotime($post->post_date) > strtotime('-7 days')) { ?>                                <img src="<?php echo get_template_directory_uri(); ?>/images/new.png" alt="latest property listings" />                            <?php } ?>

                                                            <?php                                 if ( 'sales' == get_post_type($post_id) ) {                                     echo 'Property For Sale';                                } elseif ( 'rentals' == get_post_type($post_id) ) {                                     echo 'Property For Rent';                                 } elseif ( 'business' == get_post_type($post_id) ) {                                     echo 'Business For Sale';                                 } elseif ( 'bandb' == get_post_type() ) {                                     echo 'Bed And Breakfast';                                 }                                ?>                                                                                <a href="<?php echo get_permalink($post_id); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'themename' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php echo get_the_title ( $post_id ); ?>

                              <?php                           echo "";                         echo get_the_post_thumbnail ( $post_id, 'medium' );                         echo "";                         ?>

                              <?php                         if ( 'sales' == get_post_type($post_id) ) {                              echo '
' . get_the_term_list( $post_id, 'property_type', 'Property Type: ', ' ', '' ),'   ' . get_the_term_list( $post_id, 'location', 'Location: ', ' ', '' ),'   '.get_the_term_list( $post_id, 'region', 'Region: ', ' ', '' );                         } elseif ( 'rentals' == get_post_type($post_id) ) {                              echo '
' . get_the_term_list( $post_id, 'property_type', 'Property Type: ', ' ', '' ),'   ' . get_the_term_list( $post_id, 'location', 'Location: ', ' ', '' ),'   ' . get_the_term_list( $post_id, 'region', 'Region: ', ' ', '' );                         } elseif ( 'business' == get_post_type($post_id) ) {                              echo '
' . get_the_term_list( $post_id, 'property_type', 'Property Type: ', ' ', '' ),'   ' . get_the_term_list( $post_id, 'location', 'Location: ', ' ', '' ),'   ' . get_the_term_list( $post_id, 'region', 'Region: ', ' ', '' );                          }                          ?>

              <?php         }     else:              echo $wpfp_options['favorites_empty'];          endif; ?>     <?php wpfp_clear_list_link(); ?>     <?php wpfp_cookie_warning(); ?>        First picture is using the_excerpt ![with the_excerpt](http://i.stack.imgur.com/yHO9z.jpg) Second picture is without the_excerpt   ![without the excerpt](http://i.stack.imgur.com/ZHSVr.jpg)


title: Register Template

text:
I created a register template for Wordpress with some ajax so that users can click on the register link in my header and the register form opens up in a lightbox. For some reason on submit, if there is an error or success message my form gets displayed twice. Any help appreciated. I am confused because I have almost identical code for my login page with no issues. Here is the code:               <?php     /**     * Template Name: Register     */          /* Load registration file. */     require_once( ABSPATH . WPINC . '/registration.php' );          /* Check if users can register. */     $registration = get_option( 'users_can_register' );          /* If user registered, input info. */     if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'adduser' ) {     $user_pass = wp_generate_password();     $userdata = array(         'user_pass' => $user_pass,         'user_login' => esc_attr( $_POST['user_name'] ),         'first_name' => esc_attr( $_POST['first_name'] ),         'last_name' => esc_attr( $_POST['last_name'] ),         'nickname' => esc_attr( $_POST['nickname'] ),         'user_email' => esc_attr( $_POST['email'] ),         'user_url' => esc_attr( $_POST['website'] ),         'aim' => esc_attr( $_POST['aim'] ),         'yim' => esc_attr( $_POST['yim'] ),         'jabber' => esc_attr( $_POST['jabber'] ),         'description' => esc_attr( $_POST['description'] ),         'role' => get_option( 'default_role' ),     );          if ( !$userdata['user_login'] )         $error = 'A username is required for registration.';     elseif ( username_exists($userdata['user_login']) )         $error = 'Sorry, that username already exists!';     elseif ( !is_email($userdata['user_email'], true) )         $error = 'You must enter a valid email address.';     elseif ( email_exists($userdata['user_email']) )         $error = 'Sorry, that email is already registered!';     elseif ( !$userdata['first_name'] )         $error = 'Please kindly enter your First Name.';     elseif ( !$userdata['last_name'] )         $error = 'Please kindly enter your Last Name.';          else {         $new_user = wp_insert_user( $userdata );         wp_new_user_notification($new_user, $user_pass);         echo '
Thank you for Registering!
Please check your email address. That\'s where you\'ll recieve your login password.
 (It might go into your spam folder)
';     }           }          ?>                    <?php if (!$new_user) { ?>
<?php echo $error; ?>

                  <form method="post" id="adduser" class="user-forms" action="<?php echo "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>">
                     <?php _e('Email Address *', 'frontendprofile'); ?>                     <input class="text-input" name="user_name" type="text" id="user_name" value="<?php if ( $error ) echo wp_specialchars( $_POST['user_name'], 1 ); ?>" />

                     <?php _e('First Name', 'frontendprofile'); ?>                     <input class="text-input" name="first_name" type="text" id="first_name" value="<?php if ( $error ) echo wp_specialchars( $_POST['first_name'], 1 ); ?>" />

                     <?php _e('Last Name', 'frontendprofile'); ?>                     <input class="text-input" name="last_name" type="text" id="last_name" value="<?php if ( $error ) echo wp_specialchars( $_POST['last_name'], 1 ); ?>" />

                     <?php _e('E-mail *', 'frontendprofile'); ?>                     <input class="text-input" name="email" type="hidden" id="email" value="<?php if ( $error ) echo wp_specialchars( $_POST['email'], 1 ); ?>" />

                     <?php echo $referer; ?>                     <input name="adduser" type="submit" id="addusersub" class="submit button" value="Register" />                     <?php wp_nonce_field( 'add-user' ) ?>                     <input name="action" type="hidden" id="action" value="adduser" />
                  </form>                                 <?php }  ?>


title: Unable to get the upcoming events for custom post

text: I have custom post ='events' and there is custom field 'event-start-date' for each events. I want to show the upcoming events for which I am using the following code.               $date_today = time();                      $meta_query_args=array('key' => 'event-start-date',                                             'value' => $date_today,                                             'compare' => '>',                                            );                          $loop = new WP_Query( array(                                                   'post_type' => 'events',                                                  'posts_per_page' => 5 ,                                                  'meta_key'   =>   'event-start-date',                                                  'orderby' => 'event-start-date',                                                  'order'=>'desc',                                                  'meta_query' => $meta_query_args                                                   )                                         );      But this is giving me all the posts, even those which are not upcoming i.e `'event-start-date' < $date_today`. What is it that I am doing wrong?


title: wp_enqueue & youtube API on different templates

text:
I'm trying to use the youtube API on two of my template pages. Obviously I want to enqueue it correctly. When I put this code in my footer.php page, I got it to work:                                    Seeing that it works, I deleted it and placed the following code in my function.php file. My youtube_js.js file is down below. It's not working, and I'm not sure why, any suggestions? Am I supposed to add anything in my template-name.php files?               add_action ( 'wp_enqueue_scripts', 'dtrou_youtube_api' );          function dtrou_youtube_api() {         wp_register_script( 'dtrou-youtube', get_template_directory_uri() . '/js/youtube_js.js', array('jquery'), '', true );         wp_register_script( 'youtube-subscribe-btn', 'https://apis.google.com/js/plusone.js', array(), '', true );         wp_register_script( 'youtube-subscribe-featured', 'http://gdata.youtube.com/feeds/users/droptroucomedy/uploads?alt=json-in-script&callback=vidinfolist&max-results=1', array(), '', true );         wp_register_script( 'youtube-subscribe-videos', 'http://gdata.youtube.com/feeds/users/droptroucomedy/uploads?alt=json-in-script&callback=vidinfolist&max-results=100', array(), '', true );          if ( is_page_template('t-featured.php') ) {         wp_enqueue_script('dtrou-youtube');         wp_enqueue_script('youtube-subscribe-featured');         wp_enqueue_script('youtube-subscribe-btn');     }          if ( is_page_template('t-videos.php') ) {         wp_enqueue_script('dtrou-youtube');         wp_enqueue_script('youtube-subscribe-videos');         wp_enqueue_script('youtube-subscribe-btn');     }     }      youtube_js.js file.               function vidinfolist(data) {     var dat = data.feed.entry;     var pageOutput = '
';     for (var i=0; i<data.feed.entry.length; i++) {     var datID=dat[i].id.$t.substring(38);     var datTitle=dat[i].title.$t;     var datDescription=dat[i].media$group.media$description.$t;     var datThumbnail=dat[i].media$group.media$thumbnail[0].url;     pageOutput += '

' + datTitle + '
';     pageOutput += '

' + datDescription + '
';     pageOutput += '

';     pageOutput+='
';     }     document.getElementById('videoCode').innerHTML = pageOutput;     pageOutput +='
';     }


title: new multisite, old db

text: I'm trying to get my old posts from a WP install that was in a sub-directory on my site, into a new Multisite install on a new host. The new install is doing what it should. the problem is the posts are in a database with a different table prefix. i'll admit that i didn't think it would be this difficult. but i need it to either pull from the correct prefix `wed_` not `wp_2_` _or_ replace all the data in `wp_2_` with the data from `wed_` thanks. **ANSWER** after some poking around some mysql websites, i found that find/replace isn't really straight forward. lets assume that the database table prefixes in question are `new_` and `old_` and that i want to replace `new` with `old` myphpadmin has an option of **change prefix** , here are the steps i did to correct my issue.   1. export the sql databases to my desktop as a backup.    2. change `new_` to `bak_new_`   3. change `old_` to `new_`     * since nothing else has changed wordpress is still pulling from the `new_` tables, but has `old_`'s data.      * this works! but no images.    4. export the new `new_` to the desktop.    5. open in a text editor and find/replace all the old urls that should point to your images to your new url.      * when using multisite installs the upload folder has new subfolders.        * new path: `http://example.com/wedding/wp-content/uploads/sites/2/2014/06/program03.jpg`       * old path: `http://example.com/wedding/wp-content/uploads/2014/06/program03.jpg`     * note the added `sites/2` in the new path.      * save  In myphpadmin   1. select all the `new_` tables and drop them.      * this deletes them, after giving a warning that asks if you _really_ want to do this. click yes.    2. import the file with the replaced urls with the same `new_` prefix.  **done** upload all the images to the new path of the server and verify that everything works. then delete the `bak_new_` tables since they're useless now. now all the old data from my old/incorrectly install site works on the new multisite install.


title: Custom Blog Loop on Home Page

text:
I wanted to see if it was possible to display the "newest" post from all top level post categories on the home page using args in the loop? See http://blog.reneerouleau.com/dev/ for example of what I currently have set up. I'm running shoestrap wp.               <?php      wp_reset_query();          $cats = get_categories('');     foreach ($cats as $cat) :          if($cat->category_parent)  continue; //this line avoids to show posts of sub categories          $args = array(     'posts_per_page' => 1,     'category_name' => $cat->slug,);          query_posts($args); // reset to original     ?>      **UPDATE** Still not working with below updated code - I think I might need to put that while have post loop in the above new code -- any idea?               <?php get_template_part( 'templates/page', 'header' ); ?>
     <?php do_action( 'shoestrap_index_begin' ); ?>      <?php if ( !have_posts() ) : ?>
         <?php _e( 'Sorry, no results were found.', 'shoestrap' ); ?>
       <?php get_search_form(); ?>     <?php endif; ?>     <?php      $cats = get_categories('parent=0');     foreach ($cats as $cat) :       $args = array(         'posts_per_page' => 1,         'category__in' => array( $cat->term_id ) );       $top_cat_query = new WP_Query($args);       if( $top_cat_query->have_posts() ) while( $top_cat_query->have_posts() ) :           $top_cat_query->the_post();         //output       endwhile; wp_reset_postdata();       //..etc..     endforeach;      ?>     <?php while ( have_posts() ) : the_post(); ?>              <?php do_action( 'shoestrap_in_loop_start_action' ); ?>         <?php get_template_part( 'templates/content', get_post_format() ); ?>          <?php endwhile; ?>

     <?php if ( $wp_query -> max_num_pages > 1 ) : ?>

<?php next_posts_link( __( '← Older posts', 'shoestrap' ) ); ?>

<?php previous_posts_link( __( 'Newer posts →', 'shoestrap' ) ); ?>

            <?php endif; ?>
     <?php do_action( 'shoestrap_index_end' ); ?>'


title: Custom Post Type Taxonomy Term Order by Title

text:
I have a custom post type of Clients. The "Client Categories (taxonomy terms)" are called via taxonomy-client.php. I'm able to get the results to output as expected but I can't figure out how to get them to order by title. Here is the code I'm using:               <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>         <?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>
<?php the_title();?>

<?php the_content(); ?>
     <?php endwhile; ?><?php endif; ?>       Thanks in advance


title: Use same login information on multiple wordpress installations?

text: I am creating a website where there are three modules, and two require the same login information, but they must have different wordpress installations. So, is there any way to implement this.


title: Where these arguments are defined?

text: I want to make 2-line navi, and found this code.               add_filter('walker_nav_menu_start_el', 'description_in_nav_el', 10, 4);          function description_in_nav_el($item_output, $item, $depth, $args)     {         return preg_replace('/(<a.*?>[^<]*?)</', '$1' . "<span>{$item->post_content}</span><", $item_output);     }      http://pastebin.com/Fw3e0wqC Where come from these arguments `$item_output` and `$item`? I know `$item_output` is nav_menu html source and $item is nav_menu, but I don't know in which function the html are generated.


title: Allow only attachment uploaded to current post

text: The "Add Media" button allows any media to be added to current editor. I need the "Uploaded to this page" from the dropdown menu to be the only option available. Some time ago I found a solution somewhere like this:               jQuery(function($){         $(document).on("DOMNodeInserted", function(){             // Lock uploads to "Uploaded to this post"             $('select.attachment-filters [value!="uploaded"]').remove()             $('select.attachment-filters').trigger('change');         });     })      However, this event conflicts with my other plugin because that plugin will insert more than 100 nodes and this code snippet will slow that process down very much: it takes 2 minutes longer to load with this event attached. Therefore, I am looking for a better solution that will save the time and browser's resource here. Any suggestion is welcome!


title: How to make sticky posts for category pages

text: how do I make certain posts to stay at the top for each category page. That is I want sticky posts for category pages. Thanks


title: how to use ajax in plugin admin area?

text:
I tried ajax to get some info a php inside my plugin.but getting error-call to undefined function. **Ajax**               jQuery.ajax({             type: "POST",             url: "<?php echo plugins_url();?>/tester/inc/test.php",             data: { param: 'st1' }           }).done(function( msg ) {                  alert( "Data Saved: " + msg );          });      Error in alert               Data Saved:

( ! ) Fatal error: Call to undefined function add_action() in E:\wamp1\wamp\www\wp_twentythirteen\wp-content\plugins\tester\inc\test.php on line 7

Call Stack

#	Time	Memory	Function	Location

1	0.0007	254944	{main}(  )	..\test.php:0

      test.php               <?php     function aj()     {      echo "hello";     echo plugins_url();     }     add_action('wp_ajax_my_action','aj');      add_action('wp_ajax_nopriv_myFunction','aj');            ?>      i think the error denote like am not inside wordpress. Any idea?


title: Wordpress postmeta: Store data as an array or single item?

text: I know it could be difficult to query a single item that saved in an array in wordpress postmeta table, but I have lots of metadata for a single post which may create too many rows for the postmeta table. So, I guess it might be better to save the meta in an array for each post, then, create an object to query the meta so that I can access the data by `$obj->meta1.` My question is:   1. Will it be really bothering when the postmeta table has too many rows?   2. Does saving data as array really solve my doubts?


title: Manipulating register_post_status() setup on pageload

text: This is a long shot, but I spend hours here to find answers, so I post a question. When register custom post status in my functions.php. Can I provide diffrent parameters for diffrent user views? Will this type of manipulating totally be out of how to? Here is my code:               function my_custom_post_status(){     if(current_user_can( 'update_core')) $p = true;         else $p = false;     register_post_status('archive', array(         'label'                     => _x( 'Archive', 'post' ),         'public'                    => $p,         'exclude_from_search'       => true,         'show_in_admin_all_list'    => true,         'show_in_admin_status_list' => true,         'label_count'               => _n_noop( 'Archive (%s)', 'Archive (%s)' )     ));     }     add_action( 'init', 'my_custom_post_status' );      This actually is working, but do I mess with the database or are this kind of register just a page to page load variables? ( I mean, "register", is it just instructions how to handle the "already stored" and "to be stored" in the database? ) Don ask why Im doing this (!), just if I can do it -or if Im making a mess... Thanks to all of you who contributes on this forum !


title: Modify a parent theme's PHP file, and save in child theme

text: I'm working with a paid theme, and we're using a child theme to display a slightly different design. The parent theme has a file called /includes/forms/register-form.php I'd like to customise this file, and save it in my child theme. How do I tell Wordpress to use my child theme's version of this file, instead of my parent theme's version?


title: Adding custom code into header.php using a plugin

text: I have a bunch of code that I tend to put into the `header.php` of every site I do which are specific to Internet Explorer. I was wondering if there was a way to insert code into a 'standard' `header.php`. Yes, I can simply modify the header. But the idea is to make this a plugin which is generic. Specifically, I'd like to create a plugin to echo the following in the header immediately after the default stylesheet:               <!--[if IE]>       <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/ie.css" type="text/css" />     <![endif]-->


title: Child Theme vs. Jetpack Editor

text: I have read that it is always desirable to create a "child theme" so that any changes I make don't get washed away if the main theme is updated. However, one of Jetpack's features is a CSS editor that lets me override the theme's default style.css. Therefore the original style.css is never edited. Does that provide enough protection against the updating problem so that creating a child theme is no longer necessary?


title: Help debugging PHP filter for wordpress

text: I have a PHP filter for wordpress/gravityforms, that just recently stopped working and I can't figure out why. Can anyone help me? Here's the code:               add_filter('gform_pre_submission_2', 'create_company_full_name', 10, 2, 'input_7', 'input_6', 'input_1');          add_filter('gform_pre_submission_1', 'create_company_full_name', 10, 1, 'input_3', 'input_4', 'input_77');          add_filter('gform_pre_submission_26', 'create_company_full_name', 10, 26, 'input_7', 'input_6', 'input_9');          function create_company_full_name($entry, $form, $first, $last, $company){         $field_we_are_checking = $company;         $name = $_POST[$first].' '.$_POST[$last];         if(empty($_POST[$field_we_are_checking])){             $_POST[$field_we_are_checking] = $name;         }         return;     }      What it does/did is check if the person left the Company field blank, and if so, put the First and Last name in the Company field before submission. It does that for 3 different forms. If I knew how to debug PHP, I would try it myself. But there's nothing like msgboxes or any other way to test things out. Can anyone point me in the right direction? Much appreciated! Updated code:               add_filter('gform_pre_submission_1', 'create_company_full_name', 10, 2);     //      function create_company_full_name($entry, $form){         switch($form){             case 1:                 $field_we_are_checking = $_POST['input_77'];                  $name = $_POST['input_3'].' '.$_POST['input_4'];                  break;             case 2:                 $field_we_are_checking = $_POST['input_1'];                  $name = $_POST['input_7'].' '.$_POST['input_6'];                  break;             case 26:                 $field_we_are_checking = $_POST['input_9'];                  $name = $_POST['input_7'].' '.$_POST['input_6'];                  break;         }               if(empty($_POST[$field_we_are_checking])){               $_POST[$field_we_are_checking] = $name;           }           return;     }


title: How to display 7 most recent days of posts?

text:
I would like to be able to display on my homepage a timeline of posts from 7 of the most recent days. For example, if today is January 1, 2013, I would like my blog feed to display something that looks like the following:   1. January 1, 2013 All the posts from this day   2. December 31, 2012 All the posts from this day   3. December 30, 2012 All the posts from this day   4. December 29, 2012 All the posts from this day   5. December 28, 2012 All the posts from this day   6. December 27, 2012 All the posts from this day   7. December 26, 2012 All the posts from this day Essentially, this feed should always display 7 days worth of posts. In effect, when January 2nd comes, December 26 would be hidden and everything gets bumped by one. This isn't outputting working quite how I would like it as when a new week comes along, it will only show 1 day worth of posts, so basically the only day that shows 7 days worth of posts is the 7th day of that week:
         <?php              $day_check = '';             $today = get_the_date();             $year = date('Y');             $week = date('W');             $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                 $args = array(                     'post_type'=>'post',                     'category_name' => 'whats-happening',                     'year' => $year,                     'w' => $week,                     'paged'=>$paged                 );                 $temp = $wp_query;                 $wp_query = null;                 $wp_query = new WP_Query($args);                  if (function_exists('wp_pagenavi')) { wp_pagenavi(); }             if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post();                 $day = get_the_date('j');                 if ($day == $today) {                     echo "
Today
";                     $counter = 0;                 } elseif ($day != $day_check) {                     echo "
" . get_the_date() . "
";                     $counter = 0;                 }                 if ($counter % 3 == 0) {                     $apply_css_margin = TRUE;                 }                 elseif ($counter % 3 == 1) {                     $apply_css_margin = TRUE;                 } else {                     $apply_css_margin = FALSE;                 }                 $counter++;         ?>         <article id="post-<?php the_ID(); ?>" <?php if($apply_css_margin) { post_class('news-timeline-margin'); } else { post_class(); } ?>>             <a href="<?php the_permalink(); ?>">

By <?php the_author(); ?>

<?php the_title(); ?>

                 <?php the_post_thumbnail('homepage-features-news'); ?>
         <?php $day_check = $day; endwhile; endif; ?>                       <?php if ($wp_query->max_num_pages > 1) : ?>
                 <?php next_posts_link('←previous'); ?>                 <?php previous_posts_link('Newer next'); ?>
         <?php endif; ?>                       <?php             if (function_exists('wp_pagenavi')){wp_pagenavi();}             $wp_query = null;             $wp_query = $temp;             wp_reset_query();         ?>


title: WP Query with multiple tags by get the tags

text: I need to do a wp query that will get any post that has one tag or more. My current code work for one tag, but I've try for multiple with the codex and I can't do... can you help me ? Thank's !               <?php     global $post;     foreach(get_the_tags($post->ID) as $tag) {     }     $recent_posts = new WP_Query(array(     'cat'  => 20,     'tag_slug__in' => $tag->name . ', ',     'showposts' => 2     ));     ?>


title: How to return hook data when multiple parameters are present?

text: What is the proper way of returning data to a hook when there is more than one parameter present? **Example** `apply_filters('image_downsize', false, $attachment->ID, $size)` **Attaching a callback function:**               function wpse_test_hook($param1, $param2, $param3){          }     add_filter('image_downsize', 'wpse_test_hook');      How do I return data from my callback, so that it returns properly for the hook to use?


title: Installing multisite on domain with existing subdirectory wordpress installations

text: I have a domain that already has a number of wordpress installations in existing subdirectories. I would like to activate wordpress multisite to manage so new subdirectory installations with a new template. The concern I have is that on activating multisite it's prompting me to clear all database tables for the existing installation. Will this cause a problem for the 20+ existing installations?


title: How to Retrieve data of Gallery Shortcode and display it above a post

text: I'm trying to style my theme without resorting to custom fields. For gallery posts type, most premium themes are using custom field which is the method I used till now. With it, I could then retrieve the attachment ID's and display the images in a slideshow above the post title & content. However this results in theme lock, and I was wondering if there is any way to do the below:   1. Retrieve the first gallery shortcode used in a post to output the images as slideshow above the Post title and    2. also remove the shortcode from within the post so it is not displayed again in the content.  I understand it would involve lot of code so if anyone could just point me in the right direction would be appreciated. I know bit of PHP and can tweak code but not great with creating something from scratch.


title: Are plugins instantiated on every request to Wordpress?

text: I want to know how wordpress plugins are instantiated, if Wordpress creates a instance of plugins every time that a request is made to wordpress? Example. I open /wp-admin: The plugin is instantiated I open /: The plugin is instantiated ... etc


title: How to total cache a specific PHP file?

text: How do I cache specific file in WordPress? I have a file in a theme in WordPress and W3 Total cache. The file has a `.php` extension and is loading dynamic CSS from database. It takes too much time to load current settings from DB so it's slowing down page significantly. How can I set W3 Total Cache so it caches the file?


title: Query the database after get_header() has been included

text: I'm trying to create a custom template. Iv'e searched a lot but cannot find how to query the database once the get_header() is added to the page. What I am looking for is for PROPER ways to query the database. Thanks Update: basically i added my own tables to the database. Including the header in my template SHOULD automatically include also the necessary database connection used by wordpress. My question i how to use this open database connection to query the database and read data from my custom tables. for instance, how is the mysql-connection object called, and how do i execute a query the proper way. (I know how to make a query in general, but i want to avoid to use unneded code if it is already provided, and i would like to avoid spaghetti- coding.) this is what i have so far:               global $wpdb;     $querystr = "SELECT *FROM mytable WHERE name ='".$name."'";     echo $querystr;     $gmdata = $wpdb->get_results($querystr, OBJECT);          foreach ($gmdata as $gm)     {     echo $gm[1]."<br>";          }      Thanks!


title: How to stop Wordpress creating URLs that dont exisit

text: I have a website that is constantly created URLS that don't exist. For example a category section that only has 2 pages in it, for some reason is allowing the creation of other URLS - see below eg: http://www.exmaple.com/products/page/11142/311355/909238/12807/ There is actually only one url eg: /page/2/ I have no idea why and how it is doing this, and would very much like some help please. Google is also indexing these pages with the made up numerical additions, and I would like to clear asap. Many thanks in advance for any help with this.


title: How to have content scroll over background

text: I'm attempting to modify the latest version of the mystique theme, and would like to have it so when I select a background, the page will lock that background into page, but have the content scroll over top of it. Currently the content scrolls, but the background scrolls with it, leaving an awkward spot where the background no longer exists. Would anyone know how this effect could be done?


title: Using a Multi Site Users Blog ID as a WP Prefix

text: I'm trying to update a plugin so that the prefix for the defined tables is taken from the ID of the posts authors site This is what I am trying to do at the moment               function {     global $authordata, $post, $wpdb;     //Get author id from current post     $wpnewprefix = $authordata->ID;     $prefixids = get_blogs_of_user($wpnewprefix);     //Get second blog id     $wpnewprefix = $prefixids{2}->userblog_id;     //Define tables     define('Settings_table', 'wp_'. $wpnewprefix .'settings');     define('schoolevent_table', 'wp_'. $wpnewprefix .'schoolevent_calendars');     }      At the moment I can't seem to get the author ID to pull on the current post object being viewed. Does anyone have any suggestions?


title: Upload files to wp-content/uploads - What to add in DB?

text: Given that I upload a file to `wp-content/uploads` via FTP, what are the records that I should create in the DB in order for the MediaManager to recognize those new uploads?


title: How to stop WordPress from changing ellipsis into a pre-composed triple-dot glyph?

text: When I type an ellipsis composed of three separate dots `...`, WordPress displays the pre-composed triple-dot glyph `…` instead. Is there any way to prevent WordPress from substitution the three dots?


title: Filter terms bases on multiple taxonomies - operator not in?

text: Building a function for filtered taxonomies. How to use 'operator' => 'NOT IN' or 'operator' => 'IN' inside the query to only show `tax_query` terms that are connected to all taxonomies instead of results that meet only one of multiple taxonomy.               if (!$is_search) {     $filters = explode(',', $filters);     $query_args = array(         'posts_per_page' => 30,         'post_type'      => $post_type,         'post_status'    => 'publish',         'paged'          => $pg      );          $terms = array();     foreach ($filters as $f) {         if (!empty($f) && is_numeric($f) && $f > 0) {         $terms[] = $f;     }}          if (!empty($terms)) {                 if (!is_array($query_args['tax_query'])) $query_args['tax_query'] = array();                 $query_args['tax_query'] = array(                'relation' => 'OR',      array(                     'taxonomy' => $post_type,                     'terms'    => $terms,                     'field'    => 'id',                          ));             }          $queried_items = new WP_Query($query_args);     } else {     global $wp_query;     $queried_items = $wp_query;     }          foreach ($queried_items->posts as $p) {     $taxonomy = str_replace('%#%', $p->post_type);     $p->taxonomy = array();     $pfields = array("fields" => "all");     $terms = wp_get_post_terms($p->ID, $taxonomy, $pfields);     $assgined_terms = array();     if ($terms && is_array($terms) && !empty($terms)) {         foreach ($terms as $term) {     if (!in_array($term->parent, $assgined_terms)) {         $p->taxonomy[] = $term;         array_push($assgined_terms, $term->parent);     }}  }     }}      _This is a related question to a previous one._ The current code shows all the results, as expected. First I tought about the relation OR/ AND for results, but I believe I should work with 'operator' => 'NOT IN' to query the results.


title: Always show same size tags for Tag Cloud in Wordpress Admin

text: I wanted to know if there was a way to modify the back-end of Wordpress to do 2 things:   * Make all tags' font the same size, so none are larger than the others   * Always show the most used tags when creating/editing a post This only applies to the back-end of Wordpress, not calling the tag cloud or any sort of front-end CSS that would be found in the theme.


title: Is it possible to incorporate username in a login redirect?

text: I'm using WP to work as the CMS for a website which will be provided to users of a number of different products. I've successfully created a function which will redirect users based on their role:               add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );     function my_login_redirect( $redirect_to, $request, $user ) {     if ( is_array( $user->roles ) ) {         if ( in_array( 'administrator', $user->roles ) )             return home_url( '/wp-admin/' );         elseif ( in_array( 'editor', $user->roles ) )             return home_url( '/wp-admin/' );         elseif ( in_array( 'subscriber', $user->roles ) )             return home_url();         elseif ( in_array( 'map_user', $user->roles ) )             return home_url( '/mapping/' );         elseif ( in_array( 'news_subscriber', $user->roles ) )             return home_url( '/category/newsletter/' );         else             return home_url();     }      Some users need to be redirected to a specific page which shares their username. How can I retrieve the username and incorporate it into their redirect? So:               ...     elseif ( in_array( 'map_user', $user->roles ) )         return home_url( '/mapping/[username-based-page-goes-here]/' );     ...      [I'm aware of Peter's Redirect plugin, I'd rather make use of Wordpress core functions to save on having to manually tailor each user's access upon creation. I also make use of other plugins which seem to conflict with Peter's.]


title: Search posts by Tag

text: I'd like my search forms to only display results organized by tag. I know you can add `&tag=TAGNAME` to the end of a search results URL, but how do I integrate it into a form so that my site only searches for posts containing tags equal to whatever was entered in the search box? I have two searches on the page, so ideally I'd like to be able to add it via HTML into the forms themselves as opposed to anywhere else, but any answer is fine :) thanks


title: Creating pages and getting their values from the database table

text: I need to make inquries from my new website. I want to know whether Wordpress is capable of this: Say it I have such a table:               CREATE TABLE IF NOT EXISTS `mytable` (       `id` int(11) NOT NULL AUTO_INCREMENT,       `base_id` int(11) NOT NULL,       `page_type` smallint(4) NOT NULL,       `page_title` varchar(50) NOT NULL,       `page_content` text NOT NULL,       `previous_id` int(11) NOT NULL,       `next_positive_id` int(11) NOT NULL,       `next_negative_id` int(11) NOT NULL,       PRIMARY KEY (`id`)     ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;                 id..base_id..page_type..page_title..page_content..previous_id...next_positive_id..next_negative_id     1..1..question...."Character test"..."Do you like cats"....0....2....3     2..1..middle question.."Character test"...."Do you like dogs"....1....4....5      First question is "Do you like cats". This is "page content". Page title is "Character test". If user selects yes, he is redirected to page 4, if no then redirected to page 5. Page titles, questions, next page's links etc. will be taken from the database table. I put a flow example below. Is it possible to make this in Wordpress ? I need to change only database entries and then the site content wil be updated automatically. Thank you ![enter image description here](http://i.stack.imgur.com/Jfxgx.jpg)


title: How to display menu description, but only if there is a sub menu?

text: Today I've written my own custom menu walker. While I am a bit shocked how difficult this is (also because there seem to be some bugs in Wordpress), I am astonished that I could make everything work. There is only one thing I can't figure out: _How do I print the description given to a menu item in the Wordpress backend as first item in a submenu?   Or maybe a bit simpler: How do I display the menu item description, but only if the menu has a submenu?_ In my walker, I tried to modify `start_lvl` like this:               function start_lvl(&$output, $depth, $item) {          $description  =! empty( $item->description ) ? esc_attr( $item->description ) : '';              // $depth > 0 could also work?         $depth === 1 ? $output .= $description : '';              $indent = str_repeat("\t", $depth);         $output .= "\n$indent<ul class=\"navlist__sublist\">\n";     }      That didn't work (but also did not give me an error), probably because I added `$item` as argument. So I guess my approach is wrong, but how to properly do this?


title: Get id of category from drop down menu

text:
Im trying to get the category ID from `wp_dropdown_categories();`and then pass the ID into a loop to have it output posts titles from that particular category. I currently have this:                  <form action="<?php bloginfo('url'); ?>" method="get">             <?php wp_dropdown_categories(); ?>         </form>

                     <?php                      global $post;                     $args = array( 'posts_per_page' => 5, 'category' => $_GET['value']);                     $myposts = get_posts( $args );                     foreach ( $myposts as $post ) :                        setup_postdata( $post ); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                     <?php endforeach;                     wp_reset_postdata(); ?>

      But it's not grabbing the category ID from the `$_GET['value']` and I'm not sure what I need to do to get it to pass that ID to the array. Eventually, I'd like to have it so that when you select a different category that it will show the posts associated with that selected category. But I figured that I'd try to get the select to work first and then move on from there.


title: How to Insert A List of Posts in A Category Written by the Author into the Author Archive

text: What I want: http://i.imgur.com/jH6Dj.png (sorry for linking out, I am a new user here so can't post an image inline) How does one list posts by an author within a category, with a count for each category, on the author archive page?


title: WordPress with PageLines theme: how to change the background color of a page?

text: > **Possible Duplicate:**   >  PageLines theme: how to change the background color of the main content vs. > entire page? I use PageLines free version, with WordPress 3.3.1, for this website: http://new.teleosis.org/?page_id=76 I want the background color of the whole page to be light green, and the background color of my content area to be white (typical design). It seems like a super simple thing to do - or so I expected.   * I configure the overall background color in the PageLines settings as such: screenshot   * But I don't find the setting to change the page-content background color, is it even available in PageLines? I hope I don't have to go into the CSS files for such a simple thing, but if I do, I appreciate any suggestions to do that too.


title: Keep requested/entered url with add_rewrite_rule

text: I've got url-rewriting partially working. I have this rule:               add_rewrite_rule('^somepage/([^/]*)/([^/]*)/([^/]*)/?','index.php?p=27&target=$matches[1]&arrival=$matches[2]&departure=$matches[3]','top');      When I request a page like this:               http://yourpage.com/wp/somepage/florida/02-03-2012/03-03-2012/      The Visitor gets redirected to:               http://yourpage.com/wp/somepage/      But I'd like to keep the additional parameters of the original url. How can I achieve this? And I noticed something else. When I generate a link like above from a form via JavaScript I get "page not found" although the url is correct. Now when I refresh that same page I get redirected to the page mentioned above. Why isn't it working on the first try? I'd appreciate any help. Kind regards, Denyo


title: Add html word before category

text:
I'm trying add "Tuppersex" text before categories but it's impossible! Everyone can help me please? Now, final code is this:

     1
      But i want show:

      Tuppersex 1
      How is possible?               <?php     $get_cats = wp_list_categories( 'echo=0&title_li=&depth=1&hide_empty=0&exclude=1,762,899,951' );     $cat_array = explode('
',$get_cats);     $results_total = count($cat_array);     $cats_per_list = ceil($results_total / 3);     $list_number = 1;     $result_number = 0;     ?>          <ul class="cat_col" id="cat-col-<?php echo $list_number; ?>">          <?php     foreach($cat_array as $category) {     $result_number++;          if($result_number % $cats_per_list == 0) {         $list_number++;         echo $category.'

';     }     else         echo $category.'
';     }     ?>


title: How to have two different versions of a tag/category/taxonomy archive page?

text: I have a site that has two different bodies of content: more formal content (using various different custom post types) and a blog (using a blog post type). These two different bodies of content use the same taxonomies—but I would like to have two different versions of the taxonomy archives: one for the formal content, and one for blog content. For example, for a term **science** in the taxonomy **subjects** I'd like to have both   * **mysite.com/subjects/science** AND   * **mysite.com/blog/subjects/science** (or **mysite.com/subjects/science/blog** ) What's the best way to accomplish this in Wordpress? I don't want to use pages, because terms are being added all the time. I just want some way to be able to provide two archive templates for taxonomy terms.


title: Incrementing a class in a custom walker

text:
I have written a custom walker that I am using with `wp_nav_menu` but I need to iterate through 4 custom classes, and I'm not sure how to do this. Basically, each menu-item `<li>` needs to be given a class of `color1`, `color2`, `color3` or `color4`, cycling back to `color1`, lather, rinse, repeat, in that order. Ordinarily I would do this with a `$i` and a `$i++`, but how do I do this in the Walker class? EDIT: My Walker class code:               class Salamander_Advent_Walker extends Walker_page {     function start_el(&$output, $item, $depth, $args) {         if ( $depth ) {             $indent = str_repeat("\t", $depth);         } else {             $indent = '';         }              $advent_thumbnail = get_post_meta($item->ID, 'advent-thumb', true);         $advent_slug = get_post_meta($item->ID, 'advent-slug', true);         $advent_oneliner = get_post_meta($item->ID, 'advent-oneliner', true);         //$description = get_post_meta($item->ID, 'advent-thumb', true);              $output .= $indent . '
                                                   '. $advent_slug .'                                                                             '. $advent_slug .'                                          '. $advent_oneliner .'                              ';                           }      }


title: Getting a custom post's custom field based on another custom post's custom field select

text: So I'm at my wit's end here. I've done this before plenty of times, but I think I have stared at this so much I am missing something.   * I basically have a custom post called locations. That custom post has a few fields which include address, and latitude and longitude.     * that lat/long are geocoded so they get automatically populated after the user enters in the address (so they can later be dumped into a map): the_field('latitude'); ?> the_name(); ?>" value="the_value(); ?>"/> the_field('longitude'); ?> the_name(); ?>" value="the_value(); ?>"/>   * The second part of this is the people custom field that has a select box that lets the user select the title of each of those locations: the_name(); ?>"> Select Location ID; ?>" the_select_state($office->ID)?>>post_title; ?> The final piece that I am having issues with is tying them together. I have a query displaying the information for the people: Based on the region selection in the people custom post, I want to display the last and long fields in the locations post. I've done something similar before without any issues, but this time around it's not cooperating. I've tried different variations, but here is where I am right now:               <?php              $people = get_posts(array(             'post_type' => 'person',             'nopaging' => 'true',             'order' => 'ASC'             ));               foreach ($people as $person) :             $office = 'office';             $office_id = get_post_meta($person->ID, 'person_location', TRUE);         ?>             <?php get_post_meta($office_id, "latitude", true); ?>', '<?php echo get_the_title($office_id); ?>      I've tried different things including creating a custom query with no avail:               function get_latLong($office_id) {         global $wpdb;                   $mylink = $wpdb->get_row("SELECT * FROM $wpdb->location WHERE id ='" . $office_id . "'");         echo $mylink->latitude;          }      Any insight would be greatly appreciated! Thanks


title: Change admin startpage to Pages-page?

text: When you login to the admin you see the Welcome page by default. A client of mine requested to see the "Pages" page by default, he had seen it somewhere else. Is this possible, and if so, how? Tried searching but found nothing relevant, didn't find it in the settings either.


title: Display trackbacks separately from comments in twentyeleven

text:
How do I display trackbacks (the link and the date) outside of the twentyeleven comment loop? The function below is from the twentyeleven functions.php file. I'm using the standard comments.php file from twentyeleven, and the trackbacks are shown under the comments when using `<?php comments_template( '', true ); ?>` in a template file. I can delete that, **but while keeping the normal comments display, how do I display pings in other areas of a template file all by themselves?** _(Yes, I'm using a child theme.)_               if ( ! function_exists( 'twentyeleven_comment' ) ) :     /**      * Template for comments and pingbacks.      */     function twentyeleven_comment( $comment, $args, $depth ) {         $GLOBALS['comment'] = $comment;         switch ( $comment->comment_type ) :             case 'pingback' :             case 'trackback' :         ?>

<?php _e( 'Pingback:', 'twentyeleven' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( 'Edit', 'twentyeleven' ), '', '' ); ?>
         <?php                 break;             default :         ?>


title: Adding default post content for category

text: I'm trying to add some default content to my posts using this code in my functions.php:               add_filter( 'default_content', 'my_editor_content' );     function my_editor_content( $content ) {     $content = "My html content.";     return $content;     }      It works fine, but I would like to add the content to some categories only. This is tricky because the default content gets added while creating a new post, (so it is without a category). I followed this thread: Force category choice before creating new post? and the author came up with a way of forcing you to choose a category before wp creates the new post, but I don't know how to edit the default content code so it is only applies to some categories?


title: Get Order of Meta Box in a Page/Post

text: I'm using the Posts 2 Posts plugin specifically, but I think this applies to any meta box. I have three Posts 2 Posts metaboxes on the side: "Related Case Studies", "Related White Papers" and "Related Videos". I'd like the client to be able to drag these, and have the metabox order correspond to the order they appear on my sidebar. I can do all the backend code to sort properly on the page, I just need to retrieve the value of the metabox order on a per page basis. Meaning if the client dragged the "Related Videos" metabox above the "Related Case Studies" metabox, I'd be able to grab a value to be aware of that on the page itself and output it exactly like it looks. Is this possible? Thanks.


title: Anonymous Survey

text: I am wondering if there is a survey plugin that guarantees anonymous answers but has at the same time a function to save the participants e-mail-adresses for a kind of lottery? Or: Is there a (medium-hard^^) way to do this on my own? Thanks for helping!


title: Redirect users away from Admin breaks ajax

text: Tried to make a simple redirect for some users I don't want to access the wp- admin/, so I did this code:               function no_admin_access() {         if ( !current_user_can( 'delete_posts' ) ) {             wp_redirect( site_url( '/' ) ); exit;         }     }     add_action('admin_init', 'no_admin_access');      But when I then try to make a ajax request with those users, the that is also redirected so I never get to admin-ajax.php Anybody who has a good work around for this ? Thanks. AJAX Code               $.ajax({         type: 'POST',         url: MyAjax.ajaxurl,         data: {             action: 'mux_ajax_delete_pix',             pid: $this.attr('data-id')         },         success: function(){             $this.parent().fadeOut();         }     });


title: bbpress change the word forum, topic, reply in the forum to another word I choose

text: bbpress I would want to customize my Forum in bbpress. by changing/replacing the words that appear on the forum layout. I would like to change the words (everywhere they appear): Forum, topic, reply. To other words of my choice. Does anyone have any way of doing this? I think I will need to make a child theme? anyone have any experience with such a problem? Does anyone know what files name to edit for theme twenty eleven. and where they files are located?


title: Undefined property: stdClass::$labels in general-template.php post_type_archive_title()

text: I've got a custom post type with a standard tag taxonomy added to it like so: `'taxonomies' => array('post_tag')`. I've added some tags to some posts of this CPT which are display on the front-end with the template tag `the_tags()` and the links it generates have this format `http://local.mysite.dev/tag/tag1/`. When I click such a link a page without any posts is generated using the `tag.php` template, but if I add `?post_type=seron_mycpt` to the end of the URL like so `http://local.mysite.dev/tag/tag1/?post_type=seron_mycpt` a page with the relevant posts is generated using the same template but this time I also get these lines added to `debug.log`:               PHP Notice:  Undefined property: stdClass::$labels in /...sitepath.../wp-includes/general-template.php on line 665     PHP Notice:  Trying to get property of non-object in /...sitepath.../wp-includes/general-template.php on line 665      These notices are produced when `wp_title()` is called in the `header.php` template. According to the rewrite rules the request is transformed into the query `tag=tag1&post_type=seron_mycpt`. For debugging I put `print_r(get_queried_object());` in `header.php` and got this:               MYSITEstdClass Object     (      [term_id] => 27      [name] => tag1      [slug] => tag1      [term_group] => 0      [term_taxonomy_id] => 27      [taxonomy] => post_tag      [description] =>      [parent] => 0      [count] => 2     )      I think WP expects a CPT object with a `labels` property but gets this object instead which doesn't have that property. If I tag an ordinary `post` with the same tag, the same `header.php` and `tag.php` templates are used and that post is displayed when using the `http://local.mysite.dev/tag/tag1/` URL, and in that case no PHP notices are produced in `debug.log`, although `print_r(get_queried_object())` shows a very similar object. Maybe WP never reaches the notice-producing line in `general- template.php`. I don't understand what this object is and why it is passed instead of a CPT object. Could someone explain?


title: permalinks with get variables

text: I'm trying to create my own permalinks with wordpress rewrite API. I have been registering my get variables as it follows               add_filter( 'query_vars','driver_vars' );     function driver_vars( $vars ) {         global $wp_query;         array_push($vars, 'cat_name');         array_push($vars, 'group');         return $vars;     }      and making my own rule as it follows               function drivers_rewrite_rules( $rules ) {         global $wp_rewrite;         $newrules = array(                             'drivers/([^/]+)/([^/]+)/([^/]+)/?$' =>   'index.php?pagename=drivers&cat_name=$matches[1]&group=$matches[2]&product=$matches[3]'                           );         $finalrules = $newrules + $rules;              return $finalrules;     }      my rewrite rule is not getting executed on the second and third variable when I var_dump($wp_query->query_vars) I see just my cat_name variable. if I access with the following url structure than it's okay                ?pagename=drivers&cat_name=Desktops&group=Alienware


title: Plain-text tag list?

text: I'm looking for a way to display a plain-text list of tags to use as classes on my post elements, I've been trying               $tags = get_tags();     $tag_list = "";     foreach($tags as $tag){         $tag_list .= $tag->name . " ";     }     echo "<li class=\"$tag_list\">";      in the loop but it seems to output all the tags instead of just the current post's tags, so if I have tags `x`, `y`, and `z`, and I'm viewing a post with tag `x` I still get `<li class="x y z">` anybody have any ideas as to how to show a plain-text list of tags or what I'm doing wrong?


title: Custom Taxonomy Tag Cloud?

text: I found that I can do `<?php wp_tag_cloud( array( 'taxonomy' => 'name', 'format' => 'list' ) ); ?>` But I want the list to be seperated by the letter. Alphabeticaly is what I want. So it would display the letter A then all names with that letter and the letter B with all of the b's and so on. Any ideas?


title: How to output an image or icon for selected check box in a custom post

text: I have created a custom post type for a property rental site created with WordPress. In it I want to have the input section as checkboxes: ![image one](http://i.stack.imgur.com/leqBP.jpg) and get the output like this: ![image two](http://i.stack.imgur.com/aHNDX.jpg)


title: Custom post type archive pagination query issue

text: I'm using the following query to paginate a custom post type archive. The number of posts on the first page is 11 (due to the page layout) and 12 on the following pages. The problem is that while the posts are displayed correctly as set per page, on the second page the query starts from the 13th post skipping the 12th that should normally appear there first, so it gets skipped. This doesn't happen on the next pages, only on page 2. Any ideas?               <?php              if ( get_query_var('paged') ) {                     $paged = get_query_var('paged');                 } else if ( get_query_var('page') ) {                     $paged = get_query_var('page');                 } else {                     $paged = 1;                 }             if (is_paged()) {                 $offset = ( $paged - 1 ) * 12;                 $no = 12;             }             if (!is_paged()) {                 $offset = ( $paged - 1 ) * 11;                 $no = 11;             }                         $args = array(                             'post_type'=> 'myarchive',                             'orderby' => 'date',                             'order'    => 'DESC',                             'posts_per_page' => $no,                             'meta_key' => 'no_photo',                             'meta_value' => 0,                             'paged' => $paged                     );     ?>


title: Adding SQL source code to comments

text: I was trying to add the following SQL source code to a comment:               DELETE a,b,c FROM wp_posts a     LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)     LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)     WHERE a.post_type = 'revision'      and tried this approaches:   * posted by using the backoffice   * used Source Code in Comments Plugin with the code brackets   * and the `<code>` tags   * through Postable (www.elliotswan.com/postable) first It always redirect to the homepage. Can anyone help me? Thanks in advance.


title: How to track post number on the_loop

text: I have a need to customize some posts from the loop.   Here's the deal: My site is set to 10 posts per page. On post #2,#5, #7 (on every page), I want to display specific background. What's the best solution for this kind of problem?


title: Custom design calendar archive

text: I want to create a archive calendar into sidebar exactly like this site http://www.daily-sun.com/ I don't know they are using plugins or custom coding. please anyone give me suggestion how to create this. Thanks in advance, Sujana


title: How to Show Comment Count on Related Posts?

text:
I am using this code to show related posts without a plugin. Each post shows the title and comment count. The end result is similar to the way Mashable does it: ![alt text](http://i.stack.imgur.com/I3cvI.png) This appears under each post on single.php. My problem is that the comment count shows the same number on each - it shows the number of comments for the current post. I've tried it a couple different ways as you can see below. How can I change it so that it will show the comment number for each post? By the way, this only started happening recently - previously it showed comment count for each. How weird is that?!

You May Also Like ...

          <?php             $this_post = $post;              $total = get_comments_number();             $category = get_the_category(); $category = $category[0]; $category = $category->cat_ID;             $posts = get_posts('numberposts=5&offset=0&orderby=post_date&order=DESC&category='.$category);             $count = 0;             foreach ( $posts as $post ) {             if ( $post->ID == $this_post->ID || $count == 4 ) {                  unset($posts[$count]);             }else{             $count ++;             }                  }             ?>          <?php foreach ( $posts as $post ) :          ?>

<?php get_first_image($post->ID);  ?>

<a href="<?php the_permalink(); ?>" class="purpleLink"><?php the_title(); ?>
     <a href="<?php the_permalink(); ?>"> <?php echo $total; ?>
           <?php endforeach // $posts as $post ?>
          <?php             $post = $this_post;             unset($this_post);             ?>

From the Archives...

     <?php          $rand_posts = get_posts('numberposts=4&orderby=rand');          foreach( $rand_posts as $post ) :          ?>

<?php get_first_image($post->ID);  ?>

<a href="<?php the_permalink(); ?>" class="purpleLink">            <?php the_title(); ?>
          <a href="<?php the_permalink(); ?>"><?php comments_number('0','1','%'); ?>
       <?php endforeach; wp_reset_query(); ?>


title: Sort posts by post views and consider meta key

text: my code should show popular posts where the meta key "slider" isn't empty. Have anyone an idea why it doesn't work? The problem is that this code only shows posts with a slider image. But it ignores the sorting.               $values = array(       'numberposts' => 10,       'orderby' => 'meta_value_num',       'meta_key' => 'count_views',       'meta_query' => array(           array(             'key'     => 'slider',             'compare' => '!=',             'value'   => ''           )       )     );          $my_posts = get_posts( $values );     global $post;     foreach( $my_posts as $post ) : setup_postdata($post);             the_title();          endforeach;     wp_reset_postdata();


title: Including jQuery in Wordpress

text: I am using the code below to include jQuery in my Wordpress installation. I was previous calling the jQuery file using the standard HTML script but this was causing problems with a Wordpress plugin in IE9. When I use the wp_enqueue_script function, it solves the problem but then it breaks my custom Javascript file which I include after wp_head(). What am I doing wrong?               <?php wp_enqueue_script("/wp-content/themes/mytheme/js/jquery-1.5.1.min.js"); ?>     <?php wp_head(); ?>     <script type="text/javascript" src="/wp-content/themes/mytheme/js/custom.js"></script>


title: how can view all three subcategory in same line(found ex: and code)

text:
i use the code to view subcategory on category page               <?php     if(is_category()) {              $breakpoint = 0;         $thiscat = get_term( get_query_var('cat') , 'category' );         $subcategories = get_terms( 'category' , 'parent='.get_query_var('cat') );              $items='';         if(!empty($subcategories)) {             foreach($subcategories as $subcat) {                 if($thiscat->term_id == $subcat->term_id) $current = ' current-cat'; else $current = '';             $items .= '
             term_id ).'" title="">'.$subcat->name.'
';             }             echo "$items";         }         unset($subcategories,$subcat,$thiscat,$items);     }     ?>      the resut of this code subcategory1 subcategory2 subcategory3 subcategory4 subcategory5 subcategory6 subcategory7 subcategory8 subcategory9 i want the result like this               subcategory1 * subcategory2 * subcategory3 (all three in same line)     subcategory4 * subcategory5 * subcategory6     subcategory3 * subcategory8 * subcategory9      how can i do that thanks


title: Updating User Meta from Custom Post Field Upon Publish Not Working

text: I'm trying to get the user_meta to be updated based on the custom post field type. However the information won't transfer if the new post is published by a user through a frontend form. Currently it only works if you update a listing via the front end form, or publish/edit a post via the backend of wordpress.               function update_package_id($post_id) {     $post = get_post($post_id);     $author = get_userdata($post->post_author);     $author_email = $author->user_email;     $package_id = get_post_meta( $post->ID, 'package_pid', true  );     $user_id = $author->ID;     update_user_meta($user_id, 'package_type', $package_id);          if (function_exists( 'AC_OnUpdateUser' )) {     $user = new WP_User( $user_id );     AC_OnUpdateUser( $user->ID, $user, FALSE );     }     }          add_action( 'publish_place', 'update_package_id' );      The second function fires the information into mailchimp. Am I using the wrong action in wordpress?


title: Update permalinks

text: I have added custom "folder" named Srpski to my permalink structure as you can see in .htaccess file below. So in WP Dashboard > Settings > Permalinks my custom permalink structure looks like this:               http://webdizajntest.com/poljoprivredni-fakultet/ **Srpski** /%postname%/ This i working great when i add new post or page. It's displaying their permalinks with **Srpski** in url structure and that is what i need because of maintaining PageRank. Problem is with old pages and posts. Their permalinks do not have this "directory" **Srpski** in url structure because they were saved without it. I have a lot of pages and posts and i can't make them from the beginning, so my question is: **How can I update all existing page and posts permalinks in DB to have this structure with Srpski in URL?**               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /poljoprivredni-fakultet/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /poljoprivredni-fakultet/Srpski/index.php [L]     </IfModule>     # END WordPress


title: Advanced Custom Fields - Storing array value for further usage

text: This might might be more of a PHP question - but does deal with a WordPress plugin, Advanced Custom Fields I am using a global select option to store a specific Location (custom post type) as the headquarters. I am storing the value as such:               function options_headquarters() {         foreach(get_field('option_headquarters','options') as $post_object) {             $options_headquarters = $post_object->ID;             return $options_headquarters;         }     }      What I am fuzzy on is - since my option is only allowed to grab one value -- is there an alternative to using a foreach statement (to grab just a specific array value) and still applying it to the post_object? That function stores the postID of that Location. I am currently outputting this in my template as:               echo get_field('location_phone',options_headquarters());      which grabs a field called `location_phone` (a meta value within the Location custom post type) and specify a specific postID to grab the value from (the headquarters). Is there a better way of handling passing in this headquarters value? Just pulling this out of you know where, but something like `options_headquarters('location_phone');` would be pretty sweet ;) Thanks!


title: How to remove a settings section from the Theme Customization API preview pane?

text: I am currently working on a theme that uses the Wordpress Customization API and I need to remove some pre-existing sections from the customization preview pane. Is there somewhere like a global variable holding an array of the sections perhaps (in true Wordpress style) I can unset the navigation section in particular? Please see attached image for what I am talking about. I've circled it in red. ![enter image description here](http://i.stack.imgur.com/87pbp.png)


title: Old blog/ and blog/feed/ URLs not working after moving blog to top-level via .htaccess

text: For a long time I served my blog from http://www.murrayc.com/blog/, with the wordpress installation in /home/murrayc/murrayc.com/blog/. Now I've moved it to http://www.murrayc.com/, without moving the wordpress installation on the filesystem. I did that by:   * Changing the "Site Address (URL)", in Settings->General, to http://www.murrayc.com. I kept the "WordPress Address (URL)" as http://www.murrayc.com/blog   * Adding a RedirectRule in my top-level .htaccess at /home/murrayc/murrayc.com/, so that, for instance, permalink/something could be used instead of blog/permalink/something. The older blog/permalinks still seem to work too. However, some old links are not working. http://www.murrayc.com/blog/ takes you to a page that happens to mention blogs, presumably via Wordpress's attempt to guess what you want. Likewise, http://www.murrayc.com/blog/feed takes you to the comments feed for one old blog post. With the rules added by Wordpress (after changing the "Site Address URL", I think), this is my .htaccess file:               RewriteEngine On     RewriteBase /     RewriteCond %{REQUEST_URI} !^/temp     RewriteRule ^(.*)$ blog/$1 [L]          # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>     # END WordPress      I'm using Wordpress 3.5.1, the latest release, via Dreamhost's 1-click install, which updates automatically. This feels like a bug in Wordpress. Maybe it's misinterpreting URLs that it gets at some point that contain blog/blog.


title: Permalink Settings: optional settings doesn’t apply to editor

text: In my WordPress 3.8 in my "Permalink Settings" I've chosen the option "Post name". Then I've added "Optional" for "Category" ( `%category%/%postname%` ), the URLs works like I wanted - `http://example.com/categoryname/postname` \- however this rule doesn’t apply to the editor - when I create new post or edit the existing post the URL in editor is still `http://example.com/postname`, so when I click on _View Post_ or _Preview Changes_ it redirects me to this wrong URL which shows Page Not Found. Any help/ideas? what am I doing wrong?


title: Publish a Silent Post without updating Feed

text: Is there a way to publish certain posts, silently without updating the feeds and those posts also should not appear in the home page. Appreciate your help.


title: "GET / HTTP/1.1" 304 186 "-" inside access_log for a WordPress site, but the admin side works

text: I've been struggling with this problem and I hope I posted this question in the correct place. I have a Wordpress site I installed on a dreamhost host, it's a Linux host. I cloned this site over from another host where it works OK. Now, the /wp-admin side works perfectly, I can navigate around and save settings and the like, but when I go to the front side, all I get is a blank page. When I look at the logs, error_log doesn't get anything, but access_log gets this line: > 123.456.789.012 - - [19/Nov/2013:21:07:34 -0800] "GET / HTTP/1.1" 304 186 > "-" "..." Of course the IP is not the one it shows and the "..." part is just the browser information. My Linux box is... well, I have never seen this before, but when I run `uname -a` it returns this: > Linux boxwood 3.2.45-grsec-2.9.1-r3+ #63 SMP Fri May 24 02:11:07 UTC 2013 > x86_64 GNU/Linux Anyway, I'm also able to go directly to any other page in the site, or at least all the pages I have tried, it looks like this only affects the homepage. Does anybody have ever had an issue like this? If so, can you please share how you fixed it? Or anyone who can help me out troubleshoot this, because I ran out of ideas. Don't know if the GET codes I get are the answer, because I looked up the 304 here and it's just not clear what I need to do, it mentions something about the document not being modified, but I can't figure out what to do to fix it. What I have already done:   1. Used a different .htaccess file - or no .htaccess file at all, and no luck.   2. I enabled WP debug mode, page still blanks out.   3. Reset many settings in Wordpress that I thought might be causing this - still no luck.   4. Googled the 304 response code but didn't understand what to do next :S Thank you guys


title: Duplicate content with the same URL, google authorship

text: I have recently added google authorship to my wordpress blog. When I search for specific posts on my blog, they come up with the post with my google+ picture and byline. On the other hand, when I search only for the title of my blog, I get my homepage (with google+ image and byline) and also a few post pages (this time without google+ picture, but with byline). The URL for these posts (with and without googe+ image) is exactly the same, and in any case I have already set my preferred canonical settings using my SEO plugin. I think the problem is that my homepage shows recent posts (full excerpts), and then there is also my individual post pages with the same URL and same content. My guess is that the posts on my homepage are coming up in search results without the google+ picture (but with the author byline in search results). I am not sure how to resolve this issue, without changing the structure of my site. Any ideas?


title: Deep customization of the comment form?

text: I've been handed over a design to translate into WordPress plugin & theme. My question is regarding building a custom comment form. The design used some custom scripts on the comment submit button. It handles 'submitting...' button state, animations, and checks. And it uses an anchor tag `<a>` with jQuery's `.bind` to submit the form. I noticed that the `comment_form` function of WordPress did not offer a solution to change the submit button. I only needed to remove it as I'm handling it myself. What made it worse is that WordPress has hard coded `<input name="submit">` into the button, which made it impossible for jQuery to call `.submit` (more details on this issue here: http://stackoverflow.com/questions/12540953/property-submit-of-object- htmlformelement-is-not-a-function). So just hiding this button with CSS won't work. If I prefer not to use the `<input type="submit">` button of WordPress comment form, do I have any options to build my own button? Thanks.


title: get_header('header2') not working properly in child themes

text: I am trying to replace header-header2.php of my main theme in my child theme and by adding the file in the child theme, but wordpress is loading the file from the main theme itself. Is the second header not supported in a child theme??? In index.php, I am using get_header('header2') to call the file. Anyone knows how to do this. Please help, its urgent!!!


title: upload script in plugin development

text: > **Possible Duplicate:**   >  How can you upload an image from within a settings page? I am developing a plugin. Which has a form. The form contains the following fields.   1. Course Name   2. Course file. The course file field is of type file from where I will upload a file. The name of the file I will store in database and the the uploaded file should save in the wp-content/uploads directory. How will I do this in wordpress. I am new to plugin development so please help me out.


title: Load more posts with multiple queries

text:
I've been developing a theme which uses the load more ajax plugin, everything is setup and working great with the main query. But, once I setup a new query for popular posts, the load more posts navigation for the popular posts loads the next posts of the main query. Any way to make it load the next posts page of the popular posts instead? Here is the index file:               <?php get_header(); ?>

Recent Posts

               <?php $paged = (get_query_var('paged')) ? (int) get_query_var('paged') : 1;               $my_query = new WP_Query( array( 'posts_per_page' => 2, 'paged' => $paged ) );     while ( $my_query->have_posts() ) : $my_query->the_post(); ?>

                     <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('home-thumb'); ?>                       <?php the_category(' ') ?>                       <?php comments_popup_link('0', '1', '%'); ?>

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                       <?php the_time('d,F,Y'); ?>
<?php echo excerpt(40); ?>
                       <a class="read-more" href="<?php the_permalink(); ?>">Read More

                 <?php endwhile;?>                 <?php include( TEMPLATEPATH . '/load-more.php' );?>

Popular Posts

     <?php      $paged = (get_query_var('paged')) ? (int) get_query_var('paged') : 1;     $popularpost = new WP_Query( array( 'posts_per_page' => 3, 'orderby' => 'comment_count', 'paged' => $paged  ) );     while ( $popularpost->have_posts() ) : $popularpost->the_post();  ?>

                           <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('popular-thumb'); ?>                             <?php the_category(' ') ?>                             <?php comments_popup_link('0', '1', '%'); ?>

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                             <?php the_time('d,F,Y'); ?>
<?php echo excerpt(20); ?>
                             <a class="read-more" href="<?php the_permalink(); ?>">Read More

                       <?php endwhile; ?>

         <?php next_posts_link('Older »') ?>

     <?php get_sidebar(); ?>      <?php get_footer(); ?>      And this is the load more posts plugin code:               jQuery(document).ready(function($) {             <?php      $paged = (get_query_var('paged')) ? (int) get_query_var('paged') : 1;     $popularpost = new WP_Query( array( 'posts_per_page' => 3, 'orderby' => 'comment_count', 'paged' => $paged  ) );  ?>     var pbd_alp = {             startPage: "1",             maxPages: "<?php echo $popularpost->max_num_pages; ?>",             nextLink: "<?php bloginfo('url'); ?>/page/2/"     };         var pageNum = parseInt(pbd_alp.startPage) + 1;              // The maximum number of pages the current query can return.         var max = parseInt(pbd_alp.maxPages);              // The link of the next page of posts.         var nextLink = pbd_alp.nextLink;              /**          * Replace the traditional navigation with our own,          * but only if there is at least one page of new posts to load.          */         if(pageNum <= max) {             // Insert the "More Posts" link.             $('.top-home-posts')                 .append('

')                 .append('
Load More Posts
');                  // Remove the traditional navigation.             $('.navigation-top a').remove();         }                   /**          * Load new posts when the link is clicked.          */         $('#load-more-top a').click(function() {                  // Are there more posts to load?             if(pageNum <= max) {                      // Show that we're working.                 $(this).text('Loading posts...');                      $('.more-top-posts-page-'+ pageNum).load(nextLink + ' .post',                     function() {                         // Update page number and nextLink.                         pageNum++;                         nextLink = nextLink.replace(/\/page\/[0-9]?/, '/page/'+ pageNum);                              // Add a new placeholder, for when user clicks again.                         $('#load-more-top')                             .before('

')                              // Update the button message.                         if(pageNum <= max) {                             $('#load-more-top a').text('Load More Posts');                         } else {                             $('#load-more-top a').text('No more posts to load.');                         }                     }                 );             } else {                 $('#load-more-top a').append('.');             }                     return false;         });     });      Any help/advice is appreciated, thank you.


title: How to show an image via shortcode

text: Can anyone tell me,how to show an image via shortcode.I mean when I use my shortcode,an image will displayed.(shortcode example: [smile] and image location mytemplate directory/images/smile.png)Sorry for my week english.


title: Image link issues after importing a database backup to my local web server

text: I am pretty new in WP (I came from Joomla) and I have the following problem trying to import an old WP blog (made using WP 3.5) on my local web server. I have put the old blog foder into my **www** Apache directory and then I have imported the database on my local MySql DB. After, I went into the **wp_options** DB table and I have change the value of the **option_value** field related to the rows **home** and **siteurl** putting in them the correct address (on my localhost web server) Ok, it's seem to work fine: I can see my website and the articles on it but now I have the following problem: if an article contain an immage I can't see this immage and if I open it in the browser appear to me the following error message: **404 Not Found**               Not Found          The requested URL "/it/wp-content/uploads/2012/10/Andrea-Alfieri-chef-bassa3.jpg" was not found on this server.      And in the browser address bar I have the following **wrong URL** :               http://www.myOldWebSite.it/it/wp-content/uploads/2012/10/Andrea-Alfieri-chef-bassa3.jpg      It is wrong because it is related to the old website URL and not to my localhost website. I think that must be some wrong settings on my database and that I have to change it but I don't know what I have to change Can you help me? Some ideas? Tnx Andrea


title: shortcodes inside shortcode to sum values

text: I have statistical shortcodes that return values [stat1 val="usa"] [stat2 val="europe"] [stat3 val="china"] [stat4 val="africa"] I struggle to create the shortcode that can sum the shortcode values so if stat1=1 stat2=2 stat2=3 stat2=4 [sumsc][stat1][stat2][stat3][stat4][/sumsc] it would return the value 10


title: Hook to edit an column on comments screen?

text: At the moment I'm doing               add_filter("manage_edit-comments_columns", function($columns) {             unset($columns["author"]);             $columns_one = array_slice($columns,0,1);             $columns_two = array_slice($columns,1);             $columns_one["user"] = "User";             $columns = $columns_one + $columns_two;             return $columns;         });          add_filter( 'manage_comments_custom_column', function($column, $column_id) {             echo "Test";         },10, 2 );      Is there a way to just edit the author column instead of removing and creating my own?


title: How to make tags show up in search results?

text: Im looking for a way to make tags a searchable object. To clarify, Im NOT trying to make the search engine search posts by looking at its tags, but I want tags to show up in the results just like a post. any help would be much apreciated


title: Query multiple meta key values?

text: How to query for mutiple meta key values with the same key               $querystr = "                   SELECT $wpdb->posts.*                  FROM $wpdb->posts, $wpdb->postmeta                 WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id                       AND $wpdb->postmeta.meta_key = 'key1'                    AND $wpdb->postmeta.meta_value = 'value1'                 // why doesn't this work?                 AND $wpdb->postmeta.meta_value = 'value2'                      AND $wpdb->posts.post_status = 'publish'                  AND $wpdb->posts.post_type = 'post'                 ORDER BY $wpdb->posts.post_date DESC                     ";      next code               <?php      $args = array(         'meta_query' => array(             array(                 'key' => 'key1',                 'value' => 'value1',                 'compare' => '='             ),     // this array results in no return for both arrays             array(                 'key' => 'key1',                 'value' => 'value2',                 'compare' => '='             )         )     );     $the_query  = new WP_Query( $args );      ?>                          <?php /* Start the Loop */ ?>     <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>                              <?php get_template_part( 'content', get_post_format() ); ?>                          <?php endwhile; ?>


title: How can I change plugin to give access to editor user role?

text: I want to give my editors access to a settings page to a plugin I've installed on their website. As of now, it's only visible to Administrators. The plugin I'm using is uTubeVideo Gallery, and there is no option to give users other than administrators access. In his admin.php I found these lines, which I know creates the settings page:               public function addMenus()     {         add_menu_page('uTubeVideo', 'uTubeVideo', 'manage_options', 'utubevideo_settings', array($this, 'option_panel'), plugins_url('utubevideo-gallery/i/utubevideo_icon_16x16.png'));         add_submenu_page('utubevideo_settings', 'uTubeVideo Galleries', __('Galleries', 'utvg'), 'manage_options', 'utubevideo_settings_galleries', array($this, 'gallery_panel'));      }      Is there a way for me to tweak his code so I can give access to editors?


title: Paginated Posts - Social Media Buttons Share First Page URL

text:
I currently have the HTML5 Facebook, Twitter and G+ share buttons inserted into my single.php in WordPress, so it appears on all my post pages. Everything works great until I write a very long article split into multiple pages using the nextpage tag. The problem is if the reader is on page 3, and wanted to share the article, when they click the share button, they are prompted to share the URL of that particular page - nameofsite.com/nameofpost/3 and not of the first/main page of the article - http://www.nameofsite.com/nameofpost, so I am left with many post shares for different pages of the same article! Frown | :-( Is there anyway I can overcome this for all my paginated posts? Thank you, James Edit: I have used the following HTML:

Share This Post

Tweet

<a href="<?php comments_link(); ?>"><?php comments_number('No Comments', 'One Comment', '%' );?>

      I have then entered in the following in .js file called nbzsocial.js:               !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');            (function() {         var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;         po.src = 'https://apis.google.com/js/platform.js';         var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);       })();          (function(d, s, id) {       var js, fjs = d.getElementsByTagName(s)[0];       if (d.getElementById(id)) return;       js = d.createElement(s); js.id = id;       js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=225721797619871";       fjs.parentNode.insertBefore(js, fjs);     }(document, 'script', 'facebook-jssdk'));      Which I have placed in a js folder in my child theme and enqueued in my functions PHP with this:               function wpse_load_scripts() {         wp_enqueue_script( 'nbz-social', get_stylesheet_directory_uri() . '/js/nbzsocial.js', array(), '1.0', true );     }          add_action( 'wp_enqueue_scripts', 'wpse_load_scripts' );      Thank you for getting back to me so quickly, I have had no luck on the WordPress forums and Stack Overflow!


title: You do not have sufficient permissions to access this page while making a plugin

text:
You do not have sufficient permissions to access this page. This is the error i am facing while making my own plugin.Actually, i want to link to another page. Wordpress version is 3.8.1 I made a plugin that shows the following display(the index page of my crud plugin) ![enter image description here](http://i.stack.imgur.com/gwxNL.png) I want the Add New link to redirect to other create.php(which is in the same folder as crud.php the index php file).But it says You do not have sufficient permissions to access this page. Is it correct the way i link to create.php file inside my plugin folder? I tried to read abt cross page call in wordpress but no luck. I tried different plugin video tutorial every video ends in the same page. I want to be redirected to the create.php page with the same sidebar and topbar in crud page. And of course i have nicely embeded the html code and php code it's just i did not know the way to show them nicely here. I want a redirect to prevent from inserting data to my table everytime the page is refreshed. And my folder struncture is as follows ![enter image description here](http://i.stack.imgur.com/ZZLeZ.jpg) The code is as follows               add_action('admin_menu','crudindex');     function crudindex(){         add_options_page('Crud Dashboard', 'Crudboard', 'manage_options', 'crud', 'crudboard');     }          function crudboard()     {

                 Motors                 <a class="add_new-h2" href="<?php bloginfo('url');?>/wp-admin/options-general.php?page=create">Add New

     }      I know this is a repeat question.I post it beacause i didn't find the correct answer. Thanks


title: Plug-in for reserving rooms or equipment via corporate intranet

text: I'm setting up a corporate intranet for a small organization of about 80 employees. I'm using WordPress running on a Linux server internally. I'd like to give users the ability to reserve conference rooms and audiovisual equipment via the intranet. (I don't want to have them go in through the WP Dashboard.) I recently bought the Premium version of http://onlinebookingcalendar.com/ , but I don't think it'll work for us. There are a few issues with it. First of all, it seems like overkill for what we need. But the _main_ problem is that other users can't see the name of the person who reserved the resource. That information is fairly important for the functionality that we need. I've spent some time Googling, and I just don't see anything that would work for this seemingly simple purpose. I would really rather not pay for something that has a monthly subscription fee. And, as I said, I don't want users to log into the dashboard part of WordPress. Any suggestions?


title: all tincymce's switch when updating page after changing from html to text in custom metabox

text: I have a custom metabox which uses wp_editor and when i switch to text editor instead of visual the main content tinymce also changes to text view when i update. I was wondering am i doing something wrong or is that normal behavoir for wordpress when creating a custom metabox and wp_editor? the code i use to set all of this up is:               add_action('add_meta_boxes', 'page_tagline_meta_box');     function page_tagline_meta_box($post) {         global $post;         $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;         $homepage_id = get_option('page_on_front');              $screens = array( 'services', 'page');         if($homepage_id != $post_id) {             foreach ($screens as $screen) {                 add_meta_box('page_tagline_id', 'Tagline text & Telephone number', 'page_tagline_meta_box_cb', $screen, 'normal', 'high');                 add_meta_box('additional_content_id', 'Additional Content', 'additional_content_meta_box_cb', $screen, 'normal', 'high');             }         }     }     function additional_content_meta_box_cb($post) {         global $post;         wp_nonce_field('additional_content_box_nonce', 'additional_content_meta_box_nonce');              $values = get_post_custom($post->ID);              $additionalContent = isset($values['additionalContent']) ? $values['additionalContent'][0]: '';              $settings = array(             'textarea_rows' => 15,             'wpautop' => true         );              wp_editor($additionalContent, 'additionalcontent', $settings);     }      If you would like to see the save function you are welcome to but i know it all saves and i can get the content out in my templates. its just when i switch views on the custom metabox it also switches the view of the main text area for the page when i hit update which i find quite odd. Thanks in advance for your help Alex


title: Facebook OpenGraph error, Call to undefined function wp_get_attachment_src()

text: i have add facebook opengraph tag now it showing error like Call to undefined function wp_get_attachment_src() Object at URL 'http://www.website.com' of type 'article' is invalid because the given value ': Call to undefined function wp_get_attachment_src() in on line Fatal error ...... functions.php123 ' for property 'og:image:url' could not be parsed as type 'url'. using this code in header.php               <meta property="og:image" content="<?php echo get_fbimage(); ?>" />      in function.php               <?php     function get_fbimage() {     $src = wp_get_attachment_src( get_post_thumbnail_id($post->ID), '', '' );     if ( has_post_thumbnail($post->ID) ) {     $fbimage = $src[0];     } else {     global $post, $posts;     $fbimage = '';     $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i',     $post->post_content, $matches);     $fbimage = $matches [1] [0];     }     if(empty($fbimage)) {     $fbimage = "http://www.gogirlfinance.com/wp-content/uploads/2011/03/logo.jpg";     }     return $fbimage;     }     ?>      Note: I am using same code/ function in other website with no issue


title: Where to put archive-{post-type}.php

text: I have a plugin that adds a custom post type for a website I'm building. I am using the_content filters to change how a singular page looks, and it works great, allowing me to keep everything contained in the plugin. However, I want to render a custom archive page using dls and what not, but I have no idea how to do this. This website will probably always use the same theme, but I still want to keep my plugin as separated from the theme as possible.


title: Save custom field types with this function...?

text:
I found this great article ( **right here**) about creating and saving custom fields for user profiles. The problem is that it only saves text fields. I can't save checkboxes, radio, or any other field types. Here is the code I am using in the functions.php of my theme:               <?php          add_action( 'show_user_profile', 'my_show_extra_profile_fields' );     add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );          function my_show_extra_profile_fields( $user ) { ?>
Extra profile information

                                           <input type="text" name="test" id="test" value="<?php echo esc_attr( get_the_author_meta( 'test', $user->ID ) ); ?>" class="regular-text" />

                                           <input type="checkbox" name="test2" id="test2" value="<?php echo esc_attr( get_the_author_meta( 'test2', $user->ID ) ); ?>" class="regular-text" />

               <?php }           add_action( 'personal_options_update', 'my_save_extra_profile_fields' );     add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );          function my_save_extra_profile_fields( $user_id ) {              if ( !current_user_can( 'edit_user', $user_id ) )             return false;              /* Copy and paste this line for additional fields. Make sure to change 'twitter' to the field ID. */         update_usermeta( $user_id, 'test', $_POST['test'] );         update_usermeta( $user_id, 'test2', $_POST['test2'] );     }          ?>      In this sample, the "test" field saves, but the "test2" field doesn't. Does anyone know how to save different field types (checkboxes, radio, dropdown, etc.) using this code? Thanks a lot!


title: Template Tag "template_directory" pulling wrong path

text: I'm working on a theme index.php and it seems that when I use the "template_directory" it is not actually pulling the url path of the file, but instead is just pulling the main domain name. So instead of                http://example.com/wp-content/themes/theme_name/images/pic.jpg      its pulling the domain url and showing this               http://example.com/images/pic.jpg      I don't understand why it's doing this, since the index.php file is actually in the right directory. (which is inside the theme folder). There is the index.php file that is in the wordpress directory... but I don't understand why it would conflict with the themes index.php file.