Modifying WP_LIST_AUTHOR Functions to output all users in a grid (and Paginate)

The title says it all. I've been taking WP_LIST_AUTHOR and modifying it to create more of a member directory than just a list of authors while leaving a lot of the original options intact (and I am going to add more down the line). My first task was to build pagination into it, which I managed to do successfully (code below) [although it's not very pretty yet]. I now want it to build this information into tables (probably 15 results per page, in a 3x5 grid. Row - cell cell cell Row - cell cell cell etc). I am not really sure on the best way to do this, or if this can even be done with the current way the code is constructed, any advice or linked resources would be greatly appreciated! I'm really just hacking things together ;) Also note; the site uses s2member plugin and any code will need to not mess with that functionality.               <?php          ///////////////////////     /////  SEXY TIME  /////     ///////////////////////          /**       * CUSTOM FUNCTIONS BY DUIWEL      * We are taking the regular wp_list_authors and forcing it to always display all      * the authors, as well as have pagination and a better format      *      * This is my first attempt at a Wordpress Hack such as this      *       * 5/28/2011      *      * I have left most of the original function text intact, including the comments below      *      * I used a lot of code from Crayon Violent at PHPFREAKS      * http://www.phpfreaks.com/tutorial/basic-pagination      * Most of his/her comments also remain intact      *      */               //ORIGINAL WP COMMENTS for wp_list_authors     /**      * List all the authors of the blog, with several options available.      *      *
      *
optioncount (boolean) (false): Show the count in parenthesis next to the      * author's name.
      *
exclude_admin (boolean) (true): Exclude the 'admin' user that is      * installed bydefault.
      *
show_fullname (boolean) (false): Show their full names.
      *
hide_empty (boolean) (true): Don't show authors without any posts.
      *
feed (string) (''): If isn't empty, show links to author's feeds.
      *
feed_image (string) (''): If isn't empty, use this image to link to      * feeds.
      *
echo (boolean) (true): Set to false to return the output, instead of      * echoing.
      *
style (string) ('list'): Whether to display list of authors in list form      * or as a string.
      *
html (bool) (true): Whether to list the items in html form or plaintext.      *
      *
      *      * @link http://codex.wordpress.org/Template_Tags/wp_list_authors      * @since 1.2.0      * @param array $args The argument array.      * @return null|string The output, if echo is set to false.      */           //THE FUNCTION          function duiwel_custom_list_users($args = '') {         global $wpdb;                        // HIDE_EMPTY ORIGINALLY TRUE, now FALSE         $defaults = array(             'orderby' => 'name', 'order' => 'ASC', 'number' => '',             'optioncount' => false, 'exclude_admin' => true,             'show_fullname' => false, 'hide_empty' => false,             'feed' => 'feed', 'feed_image' => '', 'feed_type' => 'rss2', 'echo' => true,             'style' => 'list', 'html' => true         );              $args = wp_parse_args( $args, $defaults );         extract( $args, EXTR_SKIP );              $return = '';              $query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number' ) );         $query_args['fields'] = 'ids';         $authors = get_users( $query_args );              // FYI This is the post count of each author, not the total count of authors         $author_count = array();         foreach ( (array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author") as $row )             $author_count[$row->post_author] = $row->count;                  // need to count 'authors' here             $totalusers = count($authors);                  //////////////////////////////             ////// PAGINATION ////////////             //////////////////////////////                  $numrows = $totalusers;                  // number of rows to show per page             $rowsperpage = 10;             // find out total pages             $totalpages = ceil($numrows / $rowsperpage);                  // get the current page or set a default             if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {             // cast var as int             $currentpage = (int) $_GET['currentpage'];             } else {             // default page num             $currentpage = 1;             } // end if                       // if current page is greater than total pages...             if ($currentpage > $totalpages) {             // set current page to last page             $currentpage = $totalpages;             } // end if             // if current page is less than first page...             if ($currentpage < 1) {             // set current page to first page             $currentpage = 1;             } // end if                  // the offset of the list, based on current page              $offset = ($currentpage - 1) * $rowsperpage;                            //////////////////////////////             ////// END PAGINATION ////////             //////////////////////////////                       //////////////////////////////////////////             ////// PAGINATION TO FOLLOW ARRAY  ///////             //////////////////////////////////////////                       //I need to take the SQL LIMIT function from the pagination code I found             //and incorporate it into the arrays I'm using, cause I'm not actually             //querying a SQL table, I'm querying an array                  $pagination_user_table = $authors;                  $paged_authors = array_slice( $pagination_user_table , $offset , $rowsperpage );                  //////////////////////////////////////////             ////// START NORMAL WP_LIST_AUTHOR  ////////             //////////////////////////////////////////                   foreach ( $paged_authors as $author_id ) {             $author = get_userdata( $author_id );                  if ( $exclude_admin && 'admin' == $author->display_name )                 continue;                  $posts = isset( $author_count[$author->ID] ) ? $author_count[$author->ID] : 0;                  if ( !$posts && $hide_empty )                 continue;                  $link = '';                  if ( $show_fullname && $author->first_name && $author->last_name )                 $name = "$author->first_name $author->last_name";             else                 $name = $author->display_name;                  if ( !$html ) {                 $return .= $name . ', ';                      continue; // No need to go further to process HTML.             }                  if ( 'list' == $style ) {                 $return .= '
';             }                  //some extra Avatar stuff                  $avatar = 'wavatar';             $link = get_avatar($author->user_email, '80', $avatar);                            $link .= '
' . ' ID, $author->user_nicename ) . '" title="' . esc_attr( sprintf(__("Posts by %s"), $author->display_name) ) . '">' . $name . '';                  if ( !empty( $feed_image ) || !empty( $feed ) ) {                 $link .= ' ';                 if ( empty( $feed_image ) ) {                 //Line breaking for RSS formatting (testing mostly)                     $link .= '
(';                 }                      $link .= 'ID ) . '"';                      $alt = $title = '';                 if ( !empty( $feed ) ) {                     $title = ' title="' . esc_attr( $feed ) . '"';                     $alt = ' alt="' . esc_attr( $feed ) . '"';                     $name = $feed;                     $link .= $title;                 }                      $link .= '>';                      if ( !empty( $feed_image ) )                     $link .= '';                 else                     $link .= $name;                      $link .= '';                      if ( empty( $feed_image ) )                     $link .= ')';             }                  if ( $optioncount )                 $link .= ' ('. $posts . ')';                  $return .= $link;             $return .= ( 'list' == $style ) ? '
' : ', ';         }                                       $return = rtrim($return, ', ');              if ( !$echo )             return $return;              echo $return;                  /////////////////////////////////////////             ////// END WP_LIST_AUTHOR NORMALCY //////             /////////////////////////////////////////              // little spacer         echo "

";             //////////////////////////////             ////// PAGINATION LINKS //////             //////////////////////////////                    /******  build the pagination links ******/     // range of num links to show     $range = 3;          // if not on page 1, don't show back links     if ($currentpage > 1) {        // show << link to go back to page 1             echo " << ";             // get previous page num        $prevpage = $currentpage - 1;        // show < link to go back to 1 page                echo " < ";                    } // end if           // loop to show links to range of pages around current page     for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {        // if it's a valid page number...        if (($x > 0) && ($x <= $totalpages)) {           // if we're on current page...           if ($x == $currentpage) {              // 'highlight' it but don't make a link              echo " [$x] ";           // if not current page...           } else {              // make it a link             echo " $x ";                     } // end else        } // end if      } // end for          // if not on last page, show forward and last page links             if ($currentpage != $totalpages) {        // get next page        $nextpage = $currentpage + 1;         // echo forward link for next page                       echo " > ";             // echo forward link for lastpage                      echo " >> ";               } // end if     /****** end build pagination links ******/                       //////////////////////////////////             ////// END PAGINATION LINKS //////             //////////////////////////////////               }                              ///////////////////////////     /////  END SEXY TIME  /////     ///////////////////////////                    ?>

     <?php duiwel_custom_list_users() ?>


Need a theme that let the posted content stretched maximum width

(Please note I'm NOT asking about wordpress.org but about **wordpress.com** ) I just posted a new entry but my current theme has a fixed width which makes my post become _buggy_ and surely myself and the readers won't like it very much! So, I'm looking for another theme that has the content width maximized. If you know ones, please share! Thank you!


Does WP Super Cache really compress my pages?

I enabled the compression option on WP Super Cache (off by default!) on my blog. After that, Website Optimization started identifying my pages as being compressed (before, it didn't). All seemed well with the world, but then I double checked with Page Speed Firefox plugin, and and sniffed the traffic with Wireshark, and according to both these measures my page is not compressed. Are my pages being compressed or not? Could it be some proxy my ISP is running, that does not support compression? (that would explain some of the horrible internet experience I'm getting). Here are the HTTP headers I'm seeing with wireshark.


Is there a built in function to see if a URLis oEmbed Compatible?

I want to be able to take a url and see if the domain is one of the ones Wordpress supports to add embeds via oEmbed. Is there a built in function that does this in WordPress or would I need to create my own? Example: if I have a url from a video site I want to be able to examine the url and be able to tell if the domain is supported by WordPress for use to embed as a video.


Is there an easy way to move the wp_admin_bar to my own location?

I want to remove the admin bar from the top of the page and actually place it into a custom location within my theme. Question:   1. How would I call wp_admin_bar() inside a custom div.  I would also need to remove the built in css, so that I can apply my own. *I already have a filter to do this part. Reasons: My theme is being built to be ipad/iphone friendly. I want the admin bar to be 'fixed' to the top of the screen. The problem is that mobile safari does not accept position:fixed, which requires a js workaround, which I have already solved. My theme already has a fixed header which is ipad ready. If I can call the wp_admin_bar() and place that within this 'special' div, then the problem is solved. *thanks to other people helping me on this forum, I have managed to place the built in wp_menu() into the admin bar, which is really cool. With that functionality added to the admin bar, I now have a really awesome nav bar by combining its built in functionality with custom menus.


How do I associate a custom post type with another through a taxonomy or storing an ID in a custom field?

I'm working this problem discussed here: Custom Comment Types, but I need more clues to map out the process. I want to create custom post types and associations between Questions & Answers, and Pin-ups & Critiques. I think that I want to do this because I want to be able to archive and create feeds for Answers and Critiques separate from Post Comments For example, for a given author/user home page, I want to be able to list Questions posed, Answers given, work Pinned-up for comment, and Critiques made. An Answer would include the title of the Question it refers to. This is more of an aside, but I am imagining a role/capability to comment on each custom post type (Question, Answer, etc. ala Quora and Stack Exchange). The comment referenced 2 options: using a custom taxonomy and storing an ID in a custom field. I'm self- learning, so any additional help is appreciated.


How to get custom post type menu_name?

I'd like to show the post type of a post, you can do that with get_post_type(), but in my case the names are not pretty (for ex : p_project_plans). So instead I thought I'd show the asociated "menu_name" (as declared with register_post_type), which looks much nicer (for ex : Project plans). Is there a way to do that ?


hooks & filters and variables

I was updating the codex page example for action hooks, while playing around to get some reuseable functions done (originally for some Q over here @WA). But then i ran into a problem i wasn't aware of before: After hooking into a function to modify the output of a variable, i can't anymore decide if i want to echo the output or just return it. **The Problem:** I can modify variables that i pass to a `do_action` hook with a callback function. Everything i modify/add with the variable is only available inside the callback function, but not after the `do_action` call inside the original function. _FOR YOUR PLEASURE:_ I reworked it to an working example, so you can just copy/paste it in some `functions.php` file and see/test the problem without any efforts. ## Example: ### Handle data function This is the handle_data_fn. A little over documented as it should serve as a guide on how to parse and merge default with other arguments.   You can see the problem at the end of the function right after the do_action() call.               /**      * The "global" data handle function      *       * This function can serve a lot of different purposes.      * Incl. merging db values from an options entry with input arguments.      *       * Throws a fully translateable Error if no database option name was specified.      * Tells you from which file the Error was triggered and in which line you should search it.      * Also tells you the "hook_data_handle_$args['UID']" name of the action hook where the Error occured.       *       * Uses of external function calls in order of their appearance inside the function:      * @uses:   isset()         - @link: http://php.net/manual/en/function.isset.php      * @uses:   wp_die()        - @link: http://codex.wordpress.org/Function_Reference/wp_die      * @uses:   printf()        - @link: http://php.net/manual/en/function.printf.php      * @uses:   _e()            - @link: http://codex.wordpress.org/Function_Reference/_e (i18n function)      * @uses:   apply_filters() - @link: http://codex.wordpress.org/Function_Reference/apply_filters      * @uses:   wp_parse_args() - @link: http://codex.wordpress.org/Function_Reference/wp_parse_args      * @uses:   extract()       - @link: http://php.net/manual/en/function.extract.php      * @uses:   get_option()    - @link: http://codex.wordpress.org/Function_Reference/get_option      * @uses:   do_action()     - @link: http://codex.wordpress.org/Function_Reference/do_action      * @uses:   return          - @link: http://php.net/manual/en/function.return.php      *       * @param:  (array) mixed $args | array of arguments - `$args['UID']` is always a must have      * @param:  $database           | true if you want to get and modify some db-option - `$args['name']` then is a must have      * @param:  $output             | result from the function - @internal: should not get set      */         function handle_data_fn( $args = array() )         {             // abort if we ain't got some unique identifier as argument             if ( !isset( $args['UID']) )                 return;                  // Trigger Error if an option should get retrieved from the database,              // but no option name was specified             if ( !isset( $args['name'] ) )                 wp_die(                      printf(                         _e(                             'You have to specify the "name" of a db-entry as argument inside a handle_data_fn at for the action hook: %1$s.'."\n".                             'Error triggered inside: file name %2$s (line number %3$s)'                          )                         ,'some_textdomain'                      )                     ,'hook_data_handle_'.$args['UID'].'`'                     ,__FILE__                     ,__LINE__                 );                       // setup default arguments             $defaults = (                  array(                      'UID'      => null     // DB/css: #id | used to identify the data inside your database - $name[$ID] - can be used as css #id too                     ,'name'     => null     // name of DB field, should be a constant when fn get's triggered - just here for completeness, not needed                     ,'args'     => array(   // $arguments the function can handle - put default arguments in here as array data                         // 'classes'    => null     // css: .class - example                      )                     ,'output'   => ''                     ,'echo'     => false    // if you want to echo the output or just save it in a var for later modifying                 )              );             // filter defaults             $defaults = apply_filters( 'filter_defaults_'.$args['UID'], $defaults );                   // merge defaults with input arguments             $args = wp_parse_args( $args, $defaults );             extract( $args, EXTR_SKIP );                  // in case you want to call the global function again,              // but for some reason need to modify the merged result of defaults & arguments             $args = apply_filters( 'filter_args_'.$args['UID'], $args );                  // retrieve the database option             if ( isset( $args['name'] ) )                 $options = get_option( $args['name'] );                       # >>> start building $output                      // if true, echo the $output                 if ( isset( $args['echo'] ) )                 {                     if ( $args['echo'] === true )                     {                         // do stuff here - your argument is the initial array                         do_action( 'hook_data_handle_'.$args['UID'], $args, $options );                              // Test output inside handle_fn:                          echo '
From inside handle_fn: ';                             print_r($args);                         echo '
';                              return;                     }                      }                      // else just return the $output                 // HOW CAN I NOT ECHO THE DATA HERE.                  // STORING THE do_action return VALUE DOESN'T WORK.                 // NEITHER DOES JUST returnING IT INSIDE THE CALLBACK FN 'modify_args_fn' BELOW                 do_action( 'hook_data_handle_'.$args['UID'], $args, $options );                 return;                  # <<< end building $output         }      ### Callback functions Those are used to a) build the initial array and b) modify the output.               /**      * EXAMPLE for how to add initial data to the handle_data_fn function.      *       * @param (array) mixed $args      */         function build_args_fn ( $args ) {             // build initial array             $args = array(                  'UID'      => 'whatever_UID'                 ,'name'     => 'some_options_name'                 ,'args'     => array(                     'class' => 'example-wrap'                  )                 ,'echo'     => true             );                  handle_data_fn( $args );         }         // 'some_hook' is some hook in a template file where the output should get echoed.         add_action( 'some_hook', 'build_args_fn', 0, 1 );          /**      * EXAMPLE for how to add content and modify the options from the DB inside a handle_data_fn function.      *       * @param (array) mixed $args      * @param (array) mixed $options    | db-options retrieved inside the oxo_parse function      */         function modify_args_fn ( $args, $options )         {             $args['output'] .= '
';             $args['output'] .= '
';             $args['output'] .= $options;             $args['output'] .= '
';             $args['output'] .= '
';                  // Test output inside callback fn             echo '
From inside callback: ';                 print_r($args);             echo '
';                  // HERE'S THE PROBLEM. I CAN'T SIMPLE return IT, BECAUSE IT WOULDN'T BE AVAILABLE INSIDE MY 'data_handle_fn'.             # return $args['output'];             // I HAVE TO PRINT IT TO GET SOME OUTPUT. THE $args['output'] IS NOT AVAILABLE INSIDE THE 'handle_data_fn' AFTER THE do_action CALL.             return print $args['output'];         }         // Name of the hook comes from 'UID' argument in 'build_args_fn' combined with 'hook_data_handle_'         add_action ( 'hook_data_handle_whatever_UID', 'modify_args_fn', 10, 2 );      Thanks for any info & help about this issue.


Making a new post visible on a specific page

I am creating a wordpress site which will have different sections , which will essentially be pages which can be accessed through a top level menu. Now when I make a post, I dont necessarily want all the posts to appear on the front page but instead while making the post want to choose which page it should be shown in. I cannot find a way to do this in wordpress 3.x. Any help is greatly appreciated.


Custom form values without plugin

I just started working on wordpress. Now i have created custom form and that form data I want to save in database and mail also. For that form creation, I have one php file which i have used as template on one page. and then that form submit, i have given action to another page [ which also made by custom template]. I am having problem, like on form submit, the action page is opening but i am not able to get data. form is like same..               <form action="/submit-idea" method="post" name="idea">     Idea Outline
Brief description of the product or service idea
     <textarea id="idea-outline" cols="10" rows="3" placeholder="" required></textarea>      and on submit-idea page, I am trying to get values like,               $idea_outline = $_POST['idea-outline'];      But their is no values, in that variable ? and BTW, that submit-idea is php page which i have used as template on page.


GET the excerpt by ID

Why is it that one cannot get the excerpt by ID like with the title and most other elements. eg. get_the_excerpt(ID). I know how to use it with the $post->post_excerpt function but that does not return part of the content if no excerpt was entered it simple returns nothing. So what I am trying to do is get the excerpt by ID if there is an excerpt, and if there isn't an excerpt with that ID but there is some content, to get some of the content instead. How would one do that. Any ideas, Marvellous ... EDIT -- Loop Source Code as Requested.               <?php $stories = get_posts('category_name=feedback&numberposts=4');                  foreach ($stories as $post) :                 $title = $post->post_title;                 $excerpt = get_the_excerpt_id($post->ID);                 $thumb = get_the_post_thumbnail($post->ID,array(60, 60, true));?>
<a href="<?php echo get_permalink($post->ID);?>"><?php echo $title;?>

<div id="stars<?php echo $post->ID;?>" align="left" style="height:18px; background:url(http://www.divethegap.com/update/z-images/structure/icons/stars_glow.png) left top no-repeat;">

<a href="<?php echo get_permalink($post->ID);?>"><?php echo $thumb;?>

                    <?php echo $excerpt;?>
                   <?php endforeach;?>


Can WordPress Read Its Own RSS Feed?

I am using a static front page for my blog to which I have added a widgetized sidebar area to hold an RSS feed widget. I want to show summaries of the latest two or three blog posts on the front page, but I am having problems with the RSS widget not updating. For example, within the RSS widget set-up field, the RSS field is similar to "http://exampleblog.com/feed/". The RSS feed will publish on the first refresh after activating the widget, but will not publish with subsequent newer posts. It doesn't update with new posts. One of the questions of this site attributed a similar problem to caching, and I am using WP Cache on the web server. De-activating WP Cache does not help. I feel like I am missing some simple procedure, but find no mention in the Codex or this site.


Test for IP in Array Always Fails on First IP

I'm working on a IP restriction plugin but having a strange problem. I have a textarea in the settings page where each of the IP addresses that should be allowed are entered, one per line. I'm then parsing the IPs into an array like this:               $ips = trim($cmm_options['ips']);        $ips = array_filter(explode("\n", $ips), 'trim');      This results in array that looks like this:               Array     (         [0] => 67.6.134.102         [1] => 97.118.69.236     )      When the page loads, the visitors IP address is checked against this array like this:               function cmm_ip_test($ips){              //testing that correct IP address used         for($i = 0, $cnt = count($ips); $i<$cnt; $i++) {             $ipregex = preg_replace('/\./', '\.', $ips[$i]);             $ipregex = preg_replace('/\*/', '.*', $ipregex);                  if(preg_match('/'.$ipregex.'/', $_SERVER['REMOTE_ADDR'])){                 // apply filter                 return true;             }             //do not apply filter         }         return false;     }      All of this works perfectly fine, with the exception of the first IP in the array. So for example, let's say my IP is 67.6.134.102 and it is the first one enter in the textarea (and so the first one in the array), like this the cmm_ip_test() function will return false. If I then move my IP to the second line (or any other but the first) of the textarea and load the page, cmm_ip_test() returns true. From all that I can tell, there is absolutely no difference between the first index of the array and any past. Any ideas why the first index position won't validate, even if it is a valid array? Thanks!


Why is inline CSS added to images automatically?

I have placed images on Wordpress page templates without any inline style attribute but it seem Wordpress automatically add style tag with `width` and `height` set to zero.               <img src="wp-content/themes/ecoblog/images/hiw-image-1.png" style="width: 0px; height: 0px;">      Sometimes height is set to its original dimentsions and sometimes after complete refresh its values are zero. What is causing this?


Any high quality form plugins?

There are so many, and I've literally tried at least 10. None are quite right. I don't want one with all this "ajax" stuff. I just want something that validates the input server side, can handle multiple forms, and allows the fields to be customized. All the plugins that I've tried thus far require way too much hacking and styling to get them to look alright. They try to be "cool" by saying "oh look this plugin has ajax". I honestly wouldn't mind ajax in the plugin if it is progressively enhanced and not too styled already. *preferably free of course


Recent post display using shortcode

I am trying to display recent post in static page home-content.php. I've added this code in function.php                function my_recent_posts_shortcode($atts){          $q = new WP_Query(            array( 'orderby' => 'date', 'posts_per_page' => '4')          );         $list ="";        while($q->have_posts()) : $q->the_post();        echo '
';        $title=get_the_title();        if ( has_post_thumbnail() ) {        echo '';        $list .=the_post_thumbnail(array(300,200),array('alt' =>$title));            echo '';        }       echo '
'.$title.'
';       echo '
';       $list .= wpe_excerpt('wpe_excerptlength_index', '');       echo 'Read More';       echo '
';             echo '
';       endwhile;              wp_reset_query();              return $list ;              }                 add_shortcode('recent-posts', 'my_recent_posts_shortcode');      `[recent-posts]` this is a shortcode for display recent post and home-content.php for showing post               <?php      $post_id = 7;     $queried_post = get_post($post_id);     ?>
<?php  $check=$queried_post->post_content; ?>
     <?php  echo do_shortcode('["'.$check.'"]');?>      All the recent post display on home page of my custom theme http://templategraphy.com/wp-demo/businessguru/ but the problem theme structure is not properly shown. I want this type of structure http://templategraphy.com/demo/businessguru/ Suggest some solution to where I am doing wrong.


apply_filter('{$field_no_prefix}_save_pre', $value) function clipping HTML

In `wp-include/post.php` there is a function named `sanitize_post_field($field, $value, $post_id, $context)`. In this, the `apply_filter('{$field_no_prefix}_save_pre', $value)` function clips the form type elements such as `<input />` and `<select></select>` when I am logged in from user other than superadmin. I am working on **multisite**. Please explain me reason of clipping HTML if any one have been through this issue earlier


Replace core wordpress file with my own

**Editing core files is never an option.** - the question is NOT to edit core files, but rather find a way to replace certain files using a plugin or other built in function. I require more control over what is being displayed by a core wordpress file and the file contains no hooks I can use. Is it possible to use my own version of a wordpress core file instead? **EDIT** **Issue:** Media Library requiring and additional click to get the full URL of the file uploaded. **Files in question:** wp-admin/async-upload.php **Detail:** Newer versions of wordpress have removed the ability to simply drag an image to the media uploader (under Media > Add New >) and get the filename. This should be default behaviour and Im not sure why it was removed. Now, one uploads a file and has to click "edit" to open a new page just to get the filename. **Original Code - starting on line 54:**               case 3 :             if ( $thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true ) )                 echo '';             echo '' . _x( 'Edit', 'media item' ) . '';             $title = $post->post_title ? $post->post_title : wp_basename( $post->guid ); // title shouldn't ever be empty, but use filename just in cas.e             echo '
' . esc_html( wp_html_excerpt( $title, 60, '…' ) ) . '
';             break;      **Code Addition - starting on line 54:**               case 3 :             if ( $thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true ) )         $image_url = wp_get_attachment_image_src( $id, 'full', true );                 echo '';                      echo '' . _x( 'Edit', 'media item' ) . '';         $title = $post->post_title ? $post->post_title : wp_basename( $post->guid ); // title shouldn't ever be empty, but use filename just in cas.e         echo '
' . esc_html( wp_html_excerpt( $title, 60, '…' ) ) . '
';         echo '<input type="text" value="'.esc_url( $image_url[0] ).'" disabled="disabled" size="100">';         break;      **Result:** All I've added is the URL of the full image that has just been uploaded. While it is great to see a little thumbnail as a result of uploading media, the URL of the full image is required - especially when uploading multiple files. My additional code just adds an input with the URL of the full image so I can copy and paste it elsewhere. Initially I was hoping there was a simple function to tell wordpress: dont use this file, use another.


Adding pagination to the WooCommerce [sale_products] short_code

I'm using the builtin WooCommerce [sale_items] shortcode to display sale items on my site. Whilst you can control how many items appear on a page it doesn't include pagination so if you've got a lot of items on sale you'll end up with a large and unwieldy page. So I've taken the code for that short_code and have modified it slightly to add pagination support and I've got it working. I can now specify the number of items per page and can page between pages by typing in the url /page/2, page/3 etc but I can't figure out how to put the pagination on the page so that the user can simply click the page that they want to go to. Here's my code:               function pjl_sale_products( $atts ){     global $woocommerce_loop, $woocommerce;          // Get page number from query (if set)     $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;     $offset = ( 12* $paged ) - 12;          extract( shortcode_atts( array(         'per_page'      => '12',         'columns'       => '4',         'orderby'       => 'title',         'order'         => 'asc'         ), $atts ) );          // Get products on sale     $product_ids_on_sale = woocommerce_get_product_ids_on_sale();          $meta_query = array();     $meta_query[] = $woocommerce->query->visibility_meta_query();     $meta_query[] = $woocommerce->query->stock_status_meta_query();     $meta_query   = array_filter( $meta_query );          $args = array(         'paged'         => $paged, // Pass in page number from query         'offset'        => $offset, // Pass in starting number         'posts_per_page'=> $per_page,         'orderby'         => $orderby,         'order'         => $order,         'no_found_rows' => 1,         'post_status'     => 'publish',         'post_type'     => 'product',         'meta_query'     => $meta_query,         'post__in'        => array_merge( array( 0 ), $product_ids_on_sale )     );            ob_start();          $products = new WP_Query( $args );          $woocommerce_loop['columns'] = $columns;          if ( $products->have_posts() ) : ?>              <?php woocommerce_product_loop_start(); ?>                  <?php while ( $products->have_posts() ) : $products->the_post(); ?>                      <?php woocommerce_get_template_part( 'content', 'product' ); ?>                  <?php endwhile; // end of the loop. ?>              <?php woocommerce_product_loop_end(); ?>          <?php endif;          do_action('woocommerce_pagination');          wp_reset_postdata();          return '
' . ob_get_clean() . '
';     }      Where am I going wrong ? From what I've read on the web, just including do_action('woocommerce_pagination'); in the function is enough to trigger the pagination to work ? Thanks in advance Phil


Get Posts by IDs (optionally)

I want to check if a variable contains list of post IDs, then I want to query the posts of those IDs only, but if that variable is empty then I want to display all posts. Problem: If I supply IDs to `post__in`, then it gets the posts with those IDs, but if it is empty then it should return **all posts** but it returns no any post. For example, the following code will get the posts with IDs 1,2,3. However this will return no any post if the $`ids` is empty. Shouldn't it return ALL posts in that case? How can I get all posts if `$ids` is empty ie. `$ids = "";` ?               $ids = '1,2,3';     $arr = explode("," ,$ids);          $args = array(         'posts_per_page' => $number,             'post__in' => $arr,      );


Display Post by menu order

I want to display posts on my homepage. But I like to manage the posts using Wordpress Menu, so I can easily add, delete, and re-arrange the ordering of posts displayed in the homepage. For Example: I have 5 posts, POST1, POST2, POST3 and so on. I want to show POST4 and POST1 on my homepage. Instead of creating a custom loop, I want to use the Wordpress Menu, so all I have to do is to check POST4 and POST1 then add to menu, if I want the POST1 to be the first post in homepage all I have to do is to drag the POST1 above the POST4 then save, and that should do it. In my homepage, there should be POST1 and POST4 displayed. This what I want to achieve. Sorry if I don't have the code because I don't have an idea how to do this. Thanks.


Integrate Wordpress Importer into Option Tree

I read here : One Click demo content installation feature in WordPress theme options panel Very good tutorial. I've followed what was written in the article. My question is, how to integrate Wordpress Importer into Option Tree? Thank you


Conditional permalink structure

I want a function to apply multiple permalink structure for posts under certain conditions. For example, if post date is before 2014, I want the permalink structure to be:               /%category%/%post_id%/      And when the post date is after 2014, I want the permalink structure to be:               /%post_id%/


Automatically Populate Post Taxonomy Data Based on Post Author Meta Data?

I'm trying to use author meta data to automatically populate a custom taxonomy on a given author's post(s). Currently, the taxonomy is visible on the post page, but I intend on hiding it from the front end to avoid accidental user selections. (Also the reason for pre-population) Note: The associated taxonomy terms and the author meta data are **identical** (the author meta data options are pulled dynamically from existing taxonomy terms). For some reason - this is NOT working. I'm scratching my head trying to figure out why - I think the logic is correct. Am I missing something/can anyone help? Thanks in advance.               function update_school($post_id) {            $post_author_id = get_post_field( 'post_author', $post_id ); // get the post author ID       $school_title = get_the_author_meta( 'school2', $post_author_id ); // from the post author ID, get the author meta       $school_slug = get_the_author_meta( 'school', $post_author_id ); // from the post author ID, get the author meta            $school_term = get_term_by('slug', $school_slug, 'school'); // get term by the author meta called "school"       $school_term_name = $school_term->name; // from the slug, get the school term name                 // update the post taxonomy "school" with author meta school variables above         wp_set_post_terms( $post_id, $school_term_name, 'school' );          }           // run function on post save     add_action('save_post', 'update_school');


echo do_shortcode for Contact Form 7 from within dynamically loaded php file

I am loading a php file containing `echo do_shortcode('[contact-form-7 id="568"]');` using jQuery `.load()` but the shortcode returns nothing. I have seen this question and answer and understand that `do_shortcode()` isn't available: Why might a plugin's 'do_shortcode' not work in an AJAX request? But I'm afraid I can't for the life of me figure out if the solution is relevant to my setup. Hoping someone can help shed some light. Thank you. script.js               $.post(themeurl+ 'save_image.php', { base64_image: ProductDataURL }, function(data) {         if(data) {             $( '#popup-download div' ).load( themeurl+ 'downloadform.php' );         }     });      downloadform.php               <?php     if ( function_exists( 'do_shortcode ' ) )  {             echo "do_shortcode exists";     } else {             echo "do_shortcode doesn't exist";  // this gets echoed     };     echo do_shortcode('[contact-form-7 id="568"]'); // nothing     ?>


How do I use Mac Keyboard Icons in WordPress

This is a dumb question all right, but everytime I search for the answer I'm just getting results for keyboard shortcuts to control wordpress. In my blog I need to include the images for key combinations for a mac keyboard. How can I do this? If there's a plugin, it'd be really nice to show the keystroke combinations as little key icons - if it supports windows icons to then even better! Thanks in advance!


Adding Dynamic Stylesheet

I have added my dynamically generated stylesheet by this way.               add_action( 'parse_request', 'my_custom_wp_request' );     function my_custom_wp_request( $wp ) {         if (             !empty( $_GET['my-custom-content'] )             && $_GET['my-custom-content'] == 'css'         ) {             # get theme options             header( 'Content-Type: text/css' );             require dirname( __FILE__ ) . '/css/style-options.php';             exit;         }     }      And to hook into theme I did               function my_login_css() {     ?>     <link rel='stylesheet' type='text/css' href="<?php bloginfo( 'url' ); ?>/?my-custom-content=css" />     <?     }          add_action('wp_footer', 'my_login_css');      My question: Is there any way to hook stylesheet other than this old fashioned way, like `wp_register_style` or `wp_enqueue_style`?


Including template in shortcodes

I am creating plugin that display a quotation From.               public function qt_shortcodez() {                  $QT_Options = get_option("qt_settings");                  $Form = '

                                     Company Name *	                                     <input type="text" name="username" id="username" />

                                     Phone *	                                     <input type="text" name="username" id="phone" />

                                     Email	                                     <input type="text" name="username" id="email" />

';                  return $Form;           }      But it is more bigger form then this(`$Form`), Is there a way to use the template into the shortcodes? Like               public function qt_shortcodez() {                  $QT_Options = get_option("qt_settings");                  // I tried but it is not working :(             include( sprintf('%s/template/shortcode.php', dirname(__FILE__)) );                  }


How to authenticate wp User though JSON?

I am developing an android application that is using wordpress as the base for its user management, now I want the users to be authenticated against the wordpress database through JSON. I am trying to use JSON-API as the base for this development. Also, found the authentication plugin wp-json-api-auth but not sure how to use this for user login authentication through an android application. Can someone help how to use the authentication plugin or the best approach to authenticate a user through JSON from a mobile device.


can not create new wp_query

I have made new PAGE for handling queries from custom search form:               <form id="search_form" action="'.site_url().'/search_page">      file page-search_page.php :               $query = new WP_query(array('post_type' => 'office'));          if ( ( $query->have_posts() ) ) {                   while ( $query->have_posts() ) : $query->the_post();                       get_template_part( 'content', 'thumb' );                   endwhile;     }      ` but var_dump($query) shows post_type=page, result is incorrect. Where is bug?


Return selected categories only in custom page meta box?

I have a custom meta box added to the Page edit screen. I also have categories turned on for Pages. I'm using `get_categories($post->ID);` to retrieve a list of categories, as you would in a page template, but it returns a list of all categories instead of just the ones selected. Is it possible to only return selected categories? Thank you.


Allowing users to edit their comments

How can I allow users to edit only their comments? I tried some plugins like "WP Ajax Edit Comments" but users could edit all comments.


Memory usage for scalable usermeta queries

## Problem Some time ago I posted a question about the **scalability of`wp_usermeta` architecture**: my concern, as my client's database of users is growing fast, is now the **memory usage** of querying the `wp_usermeta` table. In my situation, I am managing a CRM with thousands of users, each of which with around 15 _meta fields_. As I am getting this informations out of the database, the memory usage is exponentially growing, as much that now the `96M` I set as a limit is not enough. ## Data I collected (testing, profiling) I have tried **profiling** and **refactoring** my code, by narrowing down exactly what I have to do, and I indeed optimized my queries as much as I could, depending on the situations:   1. In most situations, I have to get the _metadata_ associated to one user only. In this case, both running `get_user_meta` and `get_userdata` work fine.    2. In some situations, I have to get the _some metadata_ (~5 fields) associated to _some users_ : using `get_userdata` exhausts my memory after ~2000 users; using `get_user_meta` with no `$key` (hence getting all the user associated metadata) exhausts my memory after ~3500 users; getting only the `$keys` I need actually exhausts the memory after ~3000 users.   3. In a few situations, I have to get _some metadata_ (~5 fields) associated to _all users_ : this is where, obviously, I feel the problem the most. I have tried several options: using the **Wordpress APIs** is apparently highly inefficient for this kind of situation, as I pointed out above. Examining the _saved queries_ on `$wpdb->queries` also gives me a huge amount of unnecessary queries (I guess this is why getting all metas above is more efficient than getting a few metas). It must be noted that, I also have to run a preliminary `get_users` to get the IDs to run the above mentioned functions on. Since all those APIs also **cache** the results, I thought it might be a good idea to run my own DB queries, and indeed I save up loads of memory, using just around a total of `40M` for around ~6000 users (my total now) with this query:               $wpdb->get_results(          "SELECT user_id, meta_value          FROM $wpdb->usermeta          WHERE meta_key='a' OR meta_key='b' OR meta_key='c' OR meta_key='d'"     );      ## Questions   1. Am I doing **something wrong** in the approach?   2. I have never worked with this amount of data, **what is the memory usage I should expect** for this kind of situation? (In order to understand my hosting needs)   3. Would I be better off making a **new database table**? (The only thing that came to my mind, but I didn't try yet).   4. If the custom DB query is a viable approach, how should I organize the data collected by that query in some WP_User-like object structure?


Wordpress Errors in generated by theme check plugin

Please help me in solving these warnings, in order to submit the theme for submission. Thanks in Advance. I have found many warnings and have solved many of them thanks to wordpress.stackexchange.com but still unable to solve the below arors, please help me.               WARNING: Found base64_encode in the file twitteroauth.php. base64_encode() is not allowed.     Line 123: return base64_encode(hash_hmac('sha1', $base_string, $key, true));     Line 203: return base64_encode($signature);          WARNING: Found base64_decode in the file twitteroauth.php. base64_decode() is not allowed.     Line 207: $decoded_sig = base64_decode($signature);          WARNING: file_get_contents was found in the file twitteroauth.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.     Line 277: file_get_contents(self::$POST_INPUT)          WARNING: curl_init was found in the file twitteroauth.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.     Line 1084: $ci = curl_init();          WARNING: curl_exec was found in the file twitteroauth.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.     Line 1110: $response = curl_exec($ci);          REQUIRED: plugin-activation.php. Themes should use add_theme_page() for adding admin pages.     Line 335: add_submenu_page(          REQUIRED: innovative_panel_functions.php. Themes should use add_theme_page() for adding admin pages.     Line 143: add_menu_page(theme_name.' Settings', theme_name ,'install_themes', 'panel'          RECOMMENDED: Possible variable $instance found in translation function in plugin-activation.php. Translation function calls must NOT contain PHP variables.     Line 2043: echo '
menu, admin_url( TGM_Plugin_Activation::$instance->parent_url_slug ) ) . '' title='' . esc_attr( TGM_Plugin_Activation::$instance->strings['return'] ) . '' target='_parent'>' . __( TGM_Plugin_Activation::$instance->strings['return'], 'tgmpa' ) . '<


Adding custom classes in WP 3.8 stop working in previous versions worked ok

This code wa working great in previous versions of WP. However, after the upgrade it stops working. Why?               //Add extra css classes to menu items     function mytheme_nav_menu_css_class( $classes = array(), $item, $args ) {         $location_name = 'header';              if($args->theme_location== $location_name){//Limit to this menu location only                  if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $location_name ] ) ) {                 $main_nav = wp_get_nav_menu_object( $locations[ $location_name ] );                      if ($item->menu_order == 1) {                     $classes[] = 'first'; //First menu item                 }                 if ($item->menu_order >= $main_nav->count) {                     $classes[] = 'last'; //Overall last menu item                 }             }         }         return $classes;     }     add_filter( 'nav_menu_css_class', 'mytheme_nav_menu_css_class', 10, 3 );


Conditional Tag for Wishlist membership. If the user is added to two levels show particular content

I am currently using a plug-in called Wishlist member. It allows you to create membership levels in WordPress. I want to be able to display different content on a page depending on if the user is added to two levels. Am using the code of "Bainternet": // get the current user level from WP more important is global $user. $user = wp_get_current_user(); // Get user levels from WishlistMembers $levels = WLMAPI::GetUserLevels($user->ID); //then run the check for the level you want like this: if(in_array('silver', $levels)){ // PRINT OUT THE silver LEVEL stuff here } elseif (in_array('gold', $levels)){ // PRINT OUT THE gold LEVEL stuff here } which works perfectly if the user is one level. If the user is added to two levels then how to use the above code? Please assist. Regards, Raghav.


When I write posts I usually have to use non breaking space element in order to keep margins in between the sentences. why?

When I write posts I usually have to use non breaking space element in order to keep margins in between the sentences. In other words - the text looks good in my editor, it is with spaces, but when I save it and preview it - it is all together, without spaces. Why it is like this?


Right Facebook Open Graph Protocol into WordPress theme?

I used this code before the in my wp theme this before the `<head>`:               <html xmlns="http://www.w3.org/1999/xhtml"           xmlns:og="http://ogp.me/ns#"           xmlns:fb="http://www.facebook.com/2008/fbml">      after `<head>` this:                <meta property="og:title" content="<?php the_title() ?>"/>         <meta property="og:fb:app_id" content="1111111111"/>         <meta property="og:type" content="article"/>         <meta property="og:url" content="<?php the_permalink() ?>"/>         <meta property="og:image" content="<?php echo catch_that_image() ?>"/>         <meta property="og:site_name" content="<?php bloginfo('name') ?>"/>         <meta property="fb:admins" content="USER_ID"/>             <meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>"          <?php function og_meta_desc() {     global $post;     $meta = strip_tags($post->post_content);     $meta = str_replace(array("\n", "\r", "\t"), ' ', $meta);     $meta = substr($meta, 0, 200);     echo "<meta property=\"og:description\" content=\"$meta\"/>";     }     og_meta_desc();     ?>       and in function.php this:               function catch_that_image() {      global $post, $posts;      $first_img = '';      ob_start();      ob_end_clean();      $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);      $first_img = $matches [1] [0];           if(empty($first_img)){ //Defines a default image      $first_img = "/images/default.jpg";      }      return $first_img;     }      but get the first image, how i get the "featured image" of each of post? And in developers.facebook.com/tools/debug/ it gives me these messages: Scrape Information Response Code: 502 Fetched URL: www.mysite.com/post-1 Canonical URL: www.mysite.com/post-1 Critical Errors That Must Be Fixed Error Scraping Page: Bad Response Code Open Graph Warnings That Should Be Fixed Inferred Property: The og:url property should be explicitly provided, even if a value can be inferred from other tags. Inferred Property: The og:title property should be explicitly provided, even if a value can be inferred from other tags. Have I done something wrong, is there another "correct" way for wordpress site? If I did how can I fix it?


Removing posts by sql

Often i build a site and we have test posts. I was wondering if there's a way via sql to drop all the blog posts with a simple sql query. Obviously, I would have backed up my previous database before truncating these tables. I would like to leave the pages alone if possible.


wp_dropdown_pages auto submit

What I have below currently works fine except for one issue: When a select item is chosen, it will correctly go to the subpage - however, if on a sub- page of the main site already, and a item is selected from the drop-down, the selection url is appended to the the existing page url, instead of passed as the full url. for example... if on site.com and choice1 is selected, we navigate to site.com/choice1/ - if we're on site.com/choice1 and choice2 is selected, it attempts to direct us to site.com/choice1/choice2 - I'm not sure how to adjust the code below to pass the full URL. Any help would be greatly appreciated.               <?php     $select = wp_dropdown_pages(         array(             'post_type'         => 'ce_artists',             'show_option_none'  => 'Select Artist',             'echo'              => 0         )     );     $select = preg_replace( "#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select );     echo $select;     ?>     <noscript><input type="submit" name="submit" value="view" /></noscript>


Prevent Company Name From Translating

How do you prevent WordPress from localizing a company name when using the localization functions? In the following snippet will "Company Name" be translated?               <?php printf(__('Here is some text about %s', 'my_theme'), 'Company Name'); ?>      Is it best practice to not translate a company name and the name of individuals? Thanks!


Post author for revision not being set on update/insert

I'm trying to programmatically update a custom-type post with revisions enabled via form, and everything seems to be working fine except the post_author field for the revision is being set to 0 instead of the ID I'm passing in my array. All of the revisions get a 0, but the post itself gets the correct author ID. I'm not getting a WP_Error thrown either. It's just ignoring the input. I've tried both wp_insert_post and wp_update_post with the same data, same results. The revisions and main post all save/create fine except for the post_author field in the revisions. Relevant function code:               function yq_process_answer_submission_callback() {     // first check if data is being sent and that it is the data we want     if ( isset( $_POST["post_var"] ) ) {             $params = array();             parse_str($_POST["post_var"], $params);             $name = get_userdata( $params['yq_author_id'] )->display_name;             $posessive_name = $name.'\''.($name[strlen($name) - 1] != 's' ? 's' : '');             $title = $posessive_name . ' Response to Question: ' . get_the_title( $params['yq_question_id'] );             $post = array(                 'ID'                        => $params['yq_answer_id'],                 'post_title'        => $title,                 'post_name'         => sanitize_title_with_dashes($title, '', 'save'),                 'post_content'  => $params['yq_body'],                 'post_type'         => 'yq_answer',                 'post_author'       => $params['yq_author_id'],                 'post_status'       => 'private',                 'post_parent'       => $params['yq_question_id'],                 'comment_status'=> 'open',                 'ping_status'       => 'closed',             );             if ($params['yq_answer_id'] == "") {                 $the_post = wp_insert_post( $post, true );             } else {                 $the_post = wp_update_post( $post, true );             }             if (is_wp_error($the_post)) {                 echo "There was an error. Please try submitting again.\rError message: ".print_r($the_post->get_error_message());             } else {                 add_post_meta($the_post, 'to_instructor', $params['yq_send_to'], true);                 add_post_meta($the_post, 'instructor_notified', false, true);                 update_post_meta($the_post, 'to_instructor', $params['yq_send_to']);                 update_post_meta($the_post, 'instructor_notified', false);                 $response = array('question_id'=> get_post($the_post)->post_parent,                                                     'answer_id' => $the_post,                                                     'message'=>"Your response has been saved. It will be emailed to your instructor shortly."                                                     );                 echo json_encode($response);             }         die();     }     }      And also the init code for "answer" post type:               function create_yq_answers_post_type() {     register_post_type( 'yq_answer',          array(             'labels' => array(                 'name' => 'Answers',                 'singular_name' => 'Answer',                 'menu_name' => 'Answers',                 'add_new' => 'Add Answer',                 'add_new_item' => 'Add New Answers',                 'edit' => 'Edit',                 'edit_item' => 'Edit Answers',                 'new_item' => 'New Answers',                 'view' => 'View Answers',                 'view_item' > 'View Answers',                 'search_items' > 'Search Answers',                 'not_found' => 'No Answers Found',                 'not_found_in_trash' => 'No Answers Found in Trash',             ),             'description' => 'Answers type for questions.',             'capability_type' => 'answer',             'hierarchical' => false,             'supports' => array('title','author','editor','comments','revisions'),             'public' => false,             'has_archive' => true,             'show_ui' => true,             'show_in_menu' => true,             'menu_position' => 25,             'rewrite' => array('slug' => 'answers')         )     );     }


Translation of this theme not showing up in the real host. why?

i translate many wp themes until now and i don't see this problem yet. I make mo and po files for this theme and in the function i put this code               load_theme_textdomain( 'rokesh', get_template_directory() .'/lang/');      and i change all theme textdomains to **rokesh** and also translate all texts in poedit and it work correctly in the localhost. but when i move this theme to the real host the translated texts not working. What's the problem? you can downlod the translated theme here : http://persianupload.com/kleeja/do.php?filename=139403225540321.zip and it's all content of the function file of this theme:               <?php     /**      * web2feel functions and definitions      *      * @package web2feel      */          load_theme_textdomain( 'rokesh', get_template_directory() .'/lang/');          $locale = get_locale();     $locale_file = get_template_directory() . "/languages/$locale.php";     if ( is_readable( $locale_file ) ) {         require_once( $locale_file );     }          include ( 'getplugins.php' );     include ( 'aq_resizer.php' );     include ( 'guide.php' );               /* Custom style */          function custom_style() {          $main_color  = of_get_option('w2f_primary_color');         $link_color  = of_get_option('w2f_link_color');         $hover_color = of_get_option('w2f_hover_color');     ?>              <?php }          add_action( 'wp_footer', 'custom_style' );               /* Theme updater */     require 'updater.php';     $example_update_checker = new ThemeUpdateChecker(         'Yegor',                                            //Theme folder name, AKA "slug".          'http://www.fabthemes.com/versions/yegor.json' //URL of the metadata file.     );                /**      * Set the content width based on the theme's design and stylesheet.      */     if ( ! isset( $content_width ) )         $content_width = 640; /* pixels */          if ( ! function_exists( 'web2feel_setup' ) ) :     /**      * Sets up theme defaults and registers support for various WordPress features.      *      * Note that this function is hooked into the after_setup_theme hook, which runs      * before the init hook. The init hook is too late for some features, such as indicating      * support post thumbnails.      */     function web2feel_setup() {              /**          * Make theme available for translation          * Translations can be filed in the /languages/ directory          * If you're building a theme based on web2feel, use a find and replace          * to change 'rokesh' to the name of your theme in all the template files          */         /**                    * Add default posts and comments RSS feed links to head          */         add_theme_support( 'automatic-feed-links' );              /**          * Enable support for Post Thumbnails on posts and pages          *          * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails          */         add_theme_support( 'post-thumbnails' );              /**          * This theme uses wp_nav_menu() in one location.          */         register_nav_menus( array(             'primary' => __( 'Primary Menu', 'rokesh' ),         ) );              /**          * Enable support for Post Formats          */         //add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) );              /**          * Setup the WordPress core custom background feature.          */     /*         add_theme_support( 'custom-background', apply_filters( 'web2feel_custom_background_args', array(             'default-color' => 'ffffff',             'default-image' => '',         ) ) );     */     }     endif; // web2feel_setup     add_action( 'after_setup_theme', 'web2feel_setup' );          /**      * Register widgetized area and update sidebar with default widgets      */     function web2feel_widgets_init() {         register_sidebar( array(             'name'          => __( 'Sidebar', 'rokesh' ),             'id'            => 'sidebar-1',             'before_widget' => '',             'after_widget'  => '',             'before_title'  => '
',             'after_title'   => '
',         ));              register_sidebar(array(             'name' => 'Footer',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ));      }     add_action( 'widgets_init', 'web2feel_widgets_init' );          /**      * Enqueue scripts and styles      */     function web2feel_scripts() {         wp_enqueue_style( 'web2feel-style', get_stylesheet_uri() );         wp_enqueue_style( 'flexslider', get_template_directory_uri() . '/css/flexslider.css');         wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/bootstrap/bootstrap.css');         wp_enqueue_style( 'bootstrap-glyphicons', get_template_directory_uri() . '/css/bootstrap-glyphicons.css');         wp_enqueue_style( 'theme', get_template_directory_uri() . '/css/theme.css');              wp_enqueue_script( 'jquery');         wp_enqueue_script( 'mobilemenu', get_template_directory_uri() . '/js/mobilemenu.js', array( 'jquery' ), '20120206', true );         wp_enqueue_script( 'flexslider', get_template_directory_uri() . '/js/flexslider.js', array(), '20120206', true );            wp_enqueue_script( 'jquery.carouFredSel', get_template_directory_uri() . '/js/jquery.carouFredSel-6.2.1-packed.js', array(), '20120206', true );         wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/bootstrap/bootstrap.min.js', array( 'jquery' ), '20120206', true );         wp_enqueue_script( 'web2feel-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );         wp_enqueue_script( 'custom', get_template_directory_uri() . '/js/custom.js', array(), '20120206', true );              if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {             wp_enqueue_script( 'comment-reply' );         }               }     add_action( 'wp_enqueue_scripts', 'web2feel_scripts' );          /**      * Implement the Custom Header feature.      */     //require get_template_directory() . '/inc/custom-header.php';          /**      * Custom template tags for this theme.      */     require get_template_directory() . '/inc/template-tags.php';          /**      * Custom functions that act independently of the theme templates.      */     require get_template_directory() . '/inc/extras.php';          /**      * Customizer additions.      */     //require get_template_directory() . '/inc/customizer.php';          /**      * Load Jetpack compatibility file.      */     //require get_template_directory() . '/inc/jetpack.php';          require get_template_directory() . '/inc/paginate.php';          /* Exclude pages from search results */          function mySearchFilter($query) {     if ($query->is_search) {     $query->set('post_type', 'post');     }     return $query;     }          add_filter('pre_get_posts','mySearchFilter');               /*      * Helper function to return the theme option value. If no value has been saved, it returns $default.      * Needed because options are saved as serialized strings.      *      * This code allows the theme to work without errors if the Options Framework plugin has been disabled.      */     if ( !function_exists( 'of_get_option' ) ) {     function of_get_option($name, $default = false) {         $optionsframework_settings = get_option('optionsframework');         // Gets the unique option id         $option_name = $optionsframework_settings['id'];         if ( get_option($option_name) ) {             $options = get_option($option_name);         }         if ( isset($options[$name]) ) {             return $options[$name];         } else {             return $default;         }     }     }                    /* Credits */          function selfURL() {     $uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] :     $_SERVER['PHP_SELF'];     $uri = parse_url($uri,PHP_URL_PATH);     $protocol = $_SERVER['HTTPS'] ? 'https' : 'http';     $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);     $server = ($_SERVER['SERVER_NAME'] == 'localhost') ?     $_SERVER["SERVER_ADDR"] : $_SERVER['SERVER_NAME'];     return $protocol."://".$server.$port.$uri;     }     function fflink() {     global $wpdb, $wp_query;     if (!is_page() && !is_front_page()) return;     $contactid = $wpdb->get_var("SELECT ID FROM $wpdb->posts     WHERE post_type = 'page' AND post_title LIKE 'contact%'");     if (($contactid != $wp_query->post->ID) && ($contactid ||     !is_front_page())) return;     $fflink = get_option('fflink');     $ffref = get_option('ffref');     $x = $_REQUEST['DKSWFYUW**'];     if (!$fflink || $x && ($x == $ffref)) {     $x = $x ? '&ffref='.$ffref : '';     $response = wp_remote_get('http://www.fabthemes.com/fabthemes.php?getlink='.urlencode(selfURL()).$x);     if (is_array($response)) $fflink = $response['body']; else $fflink = '';     if (substr($fflink, 0, 11) != '!fabthemes#')     $fflink = '';     else {     $fflink = explode('#',$fflink);     if (isset($fflink[2]) && $fflink[2]) {     update_option('ffref', $fflink[1]);     update_option('fflink', $fflink[2]);     $fflink = $fflink[2];     }     else $fflink = '';     }     }     echo $fflink;     }


How do i save plugin-specific info?

Im currently building a plugin that imports some data from an XML feed. This is all working great. Now i want to add some info, letting the user know when the last import happened. "Last import: 03/10/2014" How should i save that data? does wordpress provide plugin meta in the database or should it go into the options table even though its not actually an option ? Any help appreciated. Thanks!


Create a Module inside the new pages admin site

I got the following problem: I have a plugin and with this plugin I want to create a module which will be visible if I create a new Pages in the admin section... ![enter image description here](http://i.stack.imgur.com/K9O2J.png) like in the Picture the "Title Bar Settings" or the "Benutzerdefinierte Felder". I searched for this for days, so if anyone point me to a Documentation or an example it would be great.


Code syntax error, "userfullName undefined"

I'm working on a WordPress site that is using Google Visualization API Query Language to get a chart onto a page, using the data of the current logged in user. I'm using the function wp_get_current_user() to get the user data and               $current_user = wp_get_current_user();      I've been working on this for days, this is the closest I've been able to get, but I'm getting a "userfullName undefined" on my $current_user variable. My code:               <?php        if (is_page( 'home' )) { ?>           // This piece is supposed to be in the code below, but it throws an error on the return;      //<?php     //$current_user = wp_get_current_user();     //if ( !($current_user) ) {      //                return;     //}      //?>             <?php           $current_user = wp_get_current_user();        ?>     <script type="text/javascript" src="//www.google.com/jsapi"></script>     <script type="text/javascript">       google.load('visualization', '1', {packages: ['linechart']});     </script>     <script type="text/javascript">          userfullName = <?php $current_user->display_name;?>     Querystring = 'select C, max(G) where A = "' + userfullName + '" group by C order by C asc';          var visualization;              function drawVisualization() {       var query = new google.visualization.Query(           'http://spreadsheets.google.com/tq?key=KEY_GOES_HERE&gid=0&pub=0');            // Apply query language.       query.setQuery(Querystring);            // Send the query with a callback function.       query.send(handleQueryResponse);     }          function handleQueryResponse(response) {       if (response.isError()) {         alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());         return;       }            var data = response.getDataTable();       visualization = new google.visualization. LineChart(document.getElementById('visualization'));       visualization.draw(data, {legend: 'top'});     }          google.setOnLoadCallback(drawVisualization);     </script>     <?php }      ?>      Any help figuring out why this is coming up "undefined" would be appreciated. I'm a novice with the coding, so if this is the wrong approach entirely, please advise. We're trying to draw the chart based on who is currently logged into the portal. The code is supposed to grab their data and display it. Thanks!


Get user's ID on logout

Is it at all possible to get a user's ID in a function right at the point of log out? I tried to hook it to `wp_logout`, but it just returns null when trying to get the user's info. I'm wondering if there is another hook that comes before `wp_logout` destroy's the session that would enable me to capture the ID and do something with it. I simply want to update a user meta field with the time of logout. Is there any way of doing this?


Show image in excerpt post. Image not displaying

I am editing a costum theme. I was trying to add excerpt to the homepage. The homepage is costum. The excerpt show just fine but the image refuses to be displayed it seems. This is my code:               $args = array( 'numberposts' => 5, 'category' => 3,4,5,6,7 );     $posts = query_posts( $args . '&orderby=date&order=desc' );     foreach( $posts as $post ) :    setup_postdata($post); ?>

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

             <?php              echo get_post_meta($post->ID, "Thumbnail", true);             the_excerpt();  ?>

     <?php endforeach; ?>      This is of course added to functions.php               if ( function_exists( 'add_theme_support' ) ) {      add_theme_support( 'post-thumbnails' );      }      Any toughts?


jquery won't load in footer

I wanted to move jquery to the site's footer, but that doesn't work. I've tried it with the following code. As you can see, I have a couple of another scripts and they load correctly on the footer. Only jquery won't work.               //This adds our JavaScript Files     function wel_adding_scripts() {          wp_deregister_script('jquery');     wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js', '', '2.1.1', true);      wp_enqueue_script( 'jquery');          wp_register_script('jquery.mixitup', get_template_directory_uri() . 'js/jquery.mixitup.min.js','','1.1', true);     wp_enqueue_script('jquery.mixitup');          wp_register_script('headroom', get_template_directory_uri() . 'js/headroom.min.js','','1.1', true);     wp_enqueue_script('headroom');     }     add_action( 'wp_enqueue_scripts', 'wel_adding_scripts' );


Menu Walker Help Me?

I'm struggling with the development of a menu Walker. I would ride as follows: When the user clicks on a page, to show only page father and daughters and hide the others, example: ![enter image description here](http://i.stack.imgur.com/D7ZAG.jpg)![enter image description here](http://i.stack.imgur.com/dd3KC.jpg)![enter image description here](http://i.stack.imgur.com/ToM3B.jpg) Sorry my english :/ Thank.


Importing posts from old website to new conflicting post ID's?

I am wondering when I am importing posts from my old site into my new website, which has already some posts in it. Do the imported posts get a new ID or do they overrule the existing posts ID's?


GoDaddy Number of Image Files Per Directory Exceeded

OK, so I started my blog back in 2006, never realizing the size it would grow to, or what the future of WP and GoDaddy would bring. 1st Problem. I had read somewhere that it was better to have my image stored in a directory in the root, rather than the default path of... /myblog/wp- content/uploads/ So I chose /myblog/Photos. 2nd Problem. Back in 2006 I uploaded the image via ftp, and then used the following code in the text section of the post Changing the name of the photo, text, size, etc. I still use this today, as it allows me complete control of the image placement. Now here is where the fun / nightmare starts. GoDaddy says I have over 19,000 images in just the one Photo directory resulting from images, thumbnails, regenerated images etc. How in the world can I change the image locations into more than one directory without breaking the links....besides manually editing 6,500+ posts?


Pagination - not progressing

Ok, so I have added the following pagination tags:               <?php next_posts_link( 'Older posts' ); ?>     <?php previous_posts_link( 'Newer posts' ); ?>      I can see in the address bar that the querystring is changing correctly e.g. localhost:8888/wordpress/?paged=3 However, the page results are staying the same _(showing the original first 10 results)_. What have I got wrong here? EDIT: Here is the code (without any of the HTML):               <!--Latest Post-->     <?php query_posts('posts_per_page=1'); while(have_posts()) : the_post(); ?>         <?php echo get_avatar( get_the_author_meta( 'ID' ), 125 ); ?>         <?php the_title(); ?>         <?php the_time('F jS, Y'); ?>         <?php the_author(); ?>         <?php the_excerpt(); ?>     <?php endwhile; wp_reset_query(); ?>              <!-- Next set of posts to display on page -->     <?php query_posts('posts_per_page=10&offset=1'); while(have_posts()) : the_post(); ?>                <?php echo get_avatar( get_the_author_meta( 'ID' ), 125 ); ?>         <?php the_title(); ?>         <?php the_time('F jS, Y'); ?>         <?php the_author(); ?>         <?php the_excerpt(); ?>     <?php endwhile; wp_reset_query(); ?>          <!--Pagination-->     <?php next_posts_link( 'Older posts' ); ?>     <?php previous_posts_link( 'Newer posts' ); ?>      Hopefully that all looks ok. The page displays nicely, its just the pagination that is not behaving... yet.


Images dont show up on an iPhone

When visiting the url http://symbius.nl/juridisch/ on an iPhone or iPad the images inside the page dont show.. I have disabled all plugins (except for visual composer) but the problem seems to stay. Any thoughts? EDIT: iPhone Screenshot: https://www.dropbox.com/s/wxdsz3i8hpvmwpo/Foto%2019-08-14%2013%2056%2056.png


Widget options are not updated

I'm creating a plugin which creates a widget with some options. I've extended the `WP_Widget` class:               class Dynamic_Player_Widget extends WP_Widget {                   function Dynamic_Player_Widget() {             $widget_ops = array( 'classname' => 'dyn-description', 'description' => 'Plugin description' );                  $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'dynamic-player-widget' );                  $this->WP_Widget( 'dynamic_player_widget', __('Dynamic Playlist Audio Player Widget', 'description'), $widget_ops, $control_ops );              }              function widget( $args, $instance ) {             extract( $args );                  wp_register_script( 'dynamicplayer-show', WP_PLUGIN_URL . '/dynamic/js/dynamicplayer-show.js', array( 'jquery' ));             wp_localize_script( 'dynamicplayer-show', 'dynamic_options', $instance );             wp_enqueue_script( 'dynamicplayer-show' );             ?>

                  <?php              }              //Update the widget               function update( $new_instance, $old_instance ) {             $instance = $old_instance;                  //Strip tags from title and name to remove HTML              $instance['dynTotalWidth'] = strip_tags( $new_instance['dynTotalWidth'] );             $instance['dynRepeatAllEnabled'] = strip_tags( $new_instance['dynRepeatAllEnabled'] );             $instance['dynPlaylistVisible'] = strip_tags( $new_instance['dynPlaylistVisible'] );             $instance['dynPlaylistHeight'] = strip_tags( $new_instance['dynPlaylistHeight'] );             $instance['dynStoreInCookie'] = strip_tags( $new_instance['dynStoreInCookie'] );;                     return $instance;         }                        function form( $instance ) {                  //Set up some default widget settings.             $defaults = array(                  'dynTotalWidth' => 'Regular',                 'dynRepeatAllEnabled' => true,                 'dynPlaylistHeight' => '165',                 'dynPlaylistVisible' => false,                 'dynStoreInCookie' => true,                 'show_info' => true );             $instance = wp_parse_args( (array) $instance, $defaults ); ?>
         <label for="<?php echo $this->get_field_id( 'dynTotalWidth' ); ?>">             <?php _e('Totlal Width', 'example'); ?>                  <select id="<?php echo $this->get_field_id('dynTotalWidth'); ?>" name="<?php echo $this->get_field_name('dynTotalWidth'); ?>" class="widefat" style="width:100%;">             <option <?php selected( $instance['dynTotalWidth'], 'Large'); ?> value="Large">Large</option>             <option <?php selected( $instance['dynTotalWidth'], 'Regular'); ?> value="Regular">Regular</option>             <option <?php selected( $instance['dynTotalWidth'], 'Small'); ?> value="Small">Small</option>         </select>

         <label for="<?php echo $this->get_field_id( 'dynRepeatAllEnabled' ); ?>">             <?php _e('Repeat All', 'example'); ?>                  <select id="<?php echo $this->get_field_id('dynRepeatAllEnabled'); ?>" name="<?php echo $this->get_field_name('dynRepeatAllEnabled'); ?>" class="widefat" style="width:100%;">             <option <?php selected( $instance['dynRepeatAllEnabled'], 'true'); ?> value="true">true</option>             <option <?php selected( $instance['dynRepeatAllEnabled'], 'false'); ?> value="false">false</option>         </select>

         <label for="<?php echo $this->get_field_id( 'dynPlaylistVisible' ); ?>">             <?php _e('Playlist Visible', 'example'); ?>                  <select id="<?php echo $this->get_field_id('dynPlaylistVisible'); ?>" name="<?php echo $this->get_field_name('dynPlaylistVisible'); ?>" class="widefat" style="width:100%;">             <option <?php selected( $instance['dynPlaylistVisible'], 'true'); ?> value="true">true</option>             <option <?php selected( $instance['dynPlaylistVisible'], 'false'); ?> value="false">false</option>         </select>

         <label for="<?php echo $this->get_field_id( 'dynPlaylistHeight' ); ?>">             <?php _e('Playlist Height', 'example'); ?>                  <input id="<?php echo $this->get_field_id('dynPlaylistHeight'); ?>" type="number" name="<?php echo $this->get_field_name('dynPlaylistHeight'); ?>" value="<?php echo $instance['dynPlaylistHeight']; ?>" class="widefat" style="width:100%;"/>

         <label for="<?php echo $this->get_field_id( 'dynStoreInCookie' ); ?>">             <?php _e('Store in Cookie', 'example'); ?>                  <select id="<?php echo $this->get_field_id('dynStoreInCookie'); ?>" name="<?php echo $this->get_field_name('dynStoreInCookie'); ?>" class="widefat" style="width:100%;">             <option <?php selected( $instance['dynStoreInCookie'], 'true'); ?> value="true">true</option>             <option <?php selected( $instance['dynStoreInCookie'], 'false'); ?> value="false">false</option>         </select>
               <?php         }     }      This new class is called with:               function dynamic_player_widget() {         if( ! is_active_widget('Dynamic_Player_Widget') )         register_widget( 'Dynamic_Player_Widget' );          }     add_action( 'widgets_init', 'dynamic_player_widget' );      The widget is shown correctly, but when I change the options in the widget menu the options turn to default again. Any idea of what I'm missing or doing wrong?


Trying to put an array into 'post__in' => array() query not working

Slight problem, I have the following code:               $purchaseprodid = $_GET['ids'];     $args = array(                       'post_type' => 'prizes',                       'post__in' => array($purchaseprodid)                       );                     query_posts($args);                          while (have_posts()) : the_post();       I am getting comma seperated numbers for id's in a url, and they dont seem to be querying the posts. If I manually type the id's in they work no problem, but just not when using a variable $purchaseprodid. Any ideas? Thanks!


Prevent or Disable creating new users or changing roles of existing users to Administrator

I am trying to give more permissions to the editor role by giving it access to create user accounts. See the code below. But I would like to prevent it from creating or editing existing users with the role of administrator.               function add_theme_caps() {         $role = get_role('editor');         $role->add_cap( 'edit_theme_options' );         $role->add_cap('list_users');         $role->add_cap('create_users');         $role->add_cap('delete_users');         $role->add_cap('edit_users');     }     add_action( 'admin_init', 'add_theme_caps');      Things I am trying to achieve.   1. The list_users option lists all the users. I would like to list only the non-admin users.   2. I want to limit this role from creating new user accounts with the role of administrator and also prevent it from change the role of any existing users to an administrator.


Add multiple plugin directories

# The task You can register add additional Themes directories using `register_theme_directory()` for your WP installation. Sadly core doesn't deliver with the same functionality for plugins. We already have MU-Plugin, Drop-Ins, Plugins and Themes. But we need more for a better file organization. ### Here's the list of tasks to achieve:   * Add an additional plugin directory   * For each plugin directory, a new "tab" is needed as shown here [1]   * The additional directory would've the same functionality as the default plugin directory has # What's in there for you? The best and most complete answer will be awarded a bounty. * * * [1] Additional tab for a new plugin folder/directory ![](http://i.stack.imgur.com/4BAeI.png)


How to display update message only to admin

How can I show the update message only to super admin in the network wordpress ? I don't want the other admins/users see the update message that shows the current version. Is there any plugin to do this or I have to changes the core?


How can we create a wallpapers gallery with different resolution?

I want to make a wallpaper gallery which can detect the screen resolution & give the option to download wallpapers in different resolution.


Removing an action from an external plugin class

I am using a plugin that has this line of code to add an action from the `Eazyest_Frontend` class:               add_action( 'eazyest_gallery_thumbnails', 'ezg_thumbnails',5);      I want to remove that and do something a bit different without editing the plugin. I thought this added to my functions.php file might work:               global $eazyest_frontend;         remove_action( 'eazyest_gallery_thumbnails', array($eazyest_frontend,'ezg_thumbnails'), 1, 1 );      I have maybe tried a hundred variations where I altered the priority etc but nothing works yet. If I comment out the original add action line in the plugin, it does have the effect I am seeking so I seem to have identified the correct action. I'm new to removing actions, how is it done?


What is a subpage in WordPress?

Can someone explain what a subpage is in wordpress? Does it look any different from a regular page? What is its purpose and what does it do? Thank you


Custom Shortcode Broken in Wordpress 3.1

A recent upgrade to wordpress 3.1 broke a custom plugin written to make use of shortcode in order to generate easy embed html for brightcove videos. Can anyone see what is happening in the following code that is incompatible with 3.1, and what needs to happen for it to be fixed? It was working fine in 3.0 prior to upgrade.               <?php          /*     Plugin Name: Brightcove Video Player     Version: 1.0     Plugin URI: http://www.brightcove.com     Description: Simplifies the process of adding a Brightcove video to a WordPress blog.     Author: Bob de Wit     Author URI: http://brightcove.active6.com     */          //Set the publisher ID - YOU MUST SET THIS TO YOUR OWN PUBLISHER ID     $publisher = 1705665024;          //Set a default player to use - YOU MUST SET THIS TO YOUR OWN DEFAULT PLAYER     $player = 1911416499;          //Set width and height for the default video player     $width = 486;     $height = 412;          //Define default video variable     $videoid = 0;          //The actual parse content function called by the filter     //This will use the callback function BCVideo_Render to do the     //actual text replacement for the widget     function Brightcove_Parse($content)     {         $content = preg_replace_callback("/\[brightcove ([^]]*)\/\]/i", "Brightcove_Render", $content);         return $content;     }          function Brightcove_Render($matches)     {         global $video, $player, $publisher, $width, $height, $arguments;         $output = '';         $matches[1] = str_replace(array('”','″'), '', $matches[1]);         preg_match_all('/(\w*)=(.*?) /i', $matches[1], $attributes);         $arguments = array();              foreach ( (array) $attributes[1] as $key => $value )       {             // Strip out legacy quotes             $arguments[$value] = str_replace('"', '', $attributes[2][$key]);         }            //print_r( $arguments );              if (( !array_key_exists('video', $arguments) ) && ( !array_key_exists('player', $arguments) ))       {             return '
Brightcove Player Widget Error: Required parameter "video" or "player" is missing!
';             exit;         }         else         {         $video = $arguments['video'];       }              if( array_key_exists('width', $arguments) )       {             $height = $arguments['width'];         }              if( array_key_exists('height', $arguments) )       {             $height = $arguments['height'];         }              if( array_key_exists('player', $arguments) )       {             $player = $arguments['player'];         }            //$flashVars = "isVid=1&playerID=$player&publisherID=$publisher&@videoPlayer=$video";            $output .= "<embed src='http://c.brightcove.com/services/viewer/federated_f9/$player?isVid=1&publisherID=$publisher'         bgcolor='#FFFFFF'         flashVars='@videoPlayer=$video&playerID=$player&domain=embed&'         base='http://admin.brightcove.com'         name='flashObj'         width='$width'         height='$height'         seamlesstabbing='false'         type='application/x-shockwave-flash'         allowFullScreen='true'         swLiveConnect='true'         pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'>       </embed>";                  return $output;     }          //Add a filter hook - this registers the function for all content     //text (Pages and Posts) to search for the [CONTRIBUTOR_WIDGET] tag.     add_filter('the_content', 'Brightcove_Parse');          ?>      Thanks!


Remove the_content From Loop

I'm trying to display a custom loop with only certain elements in it. My loop currently contains the title, creation date, author & content. However I am trying to remove the content for each post in the loop as I do not want it displayed in this list with no luck. I have even removed the_content() out of the loop & it still displays a listing of the post content under the looped section. Any help would be greatly appreciated, here is my code:               <?php query_posts('category_name=halloween &posts_per_page=6'); ?>     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?>
        <?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?>          <?php endwhile; else: ?>               NO Posts Present           <?php endif; ?>


Adding tinymce to Custom Field boxes on Category edit page

I've managed to add the required custom fields to my category edit page (the code is below). All I'd like to do it have the textareas #Category_Extras_Features and #Category_Extras_Applications to have a tinymce editor on them?                   // Add custom fields to category edit pages     // the option name     define('Category_Extras', 'Category_Extras_option');          // your fields (the form)     add_filter('edit_category_form', 'Category_Extras');     function Category_Extras($tag) {         $tag_extra_fields = get_option(Category_Extras);              ?>

                 Category Features	                 <textarea style="width: 97%;" cols="50" rows="5" name="Category_Extras_Features" id="Category_Extras_Features"><?php  echo $tag_extra_fields[$tag->term_id]['Category_Extras_Features']; ?></textarea>
This isn't applicable to all categories but allows additional information to be displayed on a category page.

                 Category Applications	                 <textarea style="width: 97%;" cols="50" rows="5" name="Category_Extras_Applications" id="Category_Extras_Applications"><?php  echo $tag_extra_fields[$tag->term_id]['Category_Extras_Applications']; ?></textarea>
This isn't applicable to all categories but allows additional information to be displayed on a category page.

                        <?php     }               // when the form gets submitted, and the category gets updated (in your case the option will get updated with the values of your custom fields above     add_filter('edited_terms', 'update_Category_Extras');     function update_Category_Extras($term_id) {       if($_POST['taxonomy'] == 'category'):         $tag_extra_fields = get_option(Category_Extras);         $tag_extra_fields[$term_id]['Category_Extras_Features'] = strip_tags($_POST['Category_Extras_Features']);         $tag_extra_fields[$term_id]['Category_Extras_Applications'] = strip_tags($_POST['Category_Extras_Applications']);         update_option(Category_Extras, $tag_extra_fields);       endif;     }               // when a category is removed     add_filter('deleted_term_taxonomy', 'remove_Category_Extras');     function remove_Category_Extras($term_id) {       if($_POST['taxonomy'] == 'category'):         $tag_extra_fields = get_option(Category_Extras);         unset($tag_extra_fields[$term_id]);         update_option(Category_Extras, $tag_extra_fields);       endif;     }      Is this possible, and if so anyone know how to do this? Cheers, Dave


How to order posts in an arbitrary order?

I need to list posts in a very specific order that has nothing to do with the date of the posts or the title, or anything WordPress can figure out for me. I need this order to be used when I list posts in a category and on the category archive page itself. Is it possible to do something like this, were $idlist was an array of post ids in the order I want, and it could loop through each one?                 <?php query_posts(post_id=$idlist); ?>       <?php the_permalink(); ?> etc...


Showing only posts from the current user who is logged in?

I'm using the following code to get ONLY posts with the post_type question and the current user who is logged in. But if no use is logged in all the posts are displayed anyways. Any suggestions? Code:               <?php global $current_user; ?>     <?php get_currentuserinfo(); ?>          <?php echo 'Username: ' . $current_user->user_login . "\n"; ?>          <?php     $args = array(         'post_type' => 'question',         'post_author'  => $current_user->ID)     ?>          <?php $custom_posts = new WP_Query(); ?>     <?php $custom_posts->query($args); ?>     <?php while ($custom_posts->have_posts()) : $custom_posts->the_post(); ?>

<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
             <?php the_excerpt(); ?>
<?php comments_number('0 Replies','1 Reply','% Replies'); ?>.

<?php display_votes(get_the_ID()); ?>

<?php the_views(); ?>
                      <?php printf( __( 'Posted in %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
     <?php endwhile; ?>


Custom post type within a subdirectory

I've searched around but have not been able to find an answer to my question. What I'm trying to do is create a custom post type that exists within a sub- directory, not just after the root as is default. For example right now I have: http://www.mysite.com/custom-post-type I would like to have: http://www.mysite.com/subdirectory/custom-post-type The reason I'm trying to do this is that I have a client that now has additional clients that I would like to have named as a sub-directory, and not an entirely new sub domain. I was planning on creating custom post types to create the additional blogs or the two other clients, but I can't find a way of having a sub-directory first. Is there an easy way to do this? I'm decently versed in WP but not an expert, so I'm hoping there is an easy-ish method. Thanks for any guidance


Change Font Size on Blog (Twenty Twelve)

I have a Twenty Twelve child theme. I love the fonts on the site. I am willing to live with the normal font size that Twenty Twelve has on pages like the home page. However, on pages like the blog, I want to have a nice big font that is easy to read (see the size on Medium.com). The questions is how do I increase the font size on the blog posts only, and not the rest of the site. Thanks in advance, Shaan