title: How do I insert a post with custom post type and relate it to a custom taxonomy?

text: I'm trying to figure out how to insert a new post. I have a custom post-type (course) that is related to a custom taxonomy (categorycourses). I've managed to insert a post with custom post type course, **but I can't figure out how to relate this post to custom taxonomy categorycourses**.               //This will return array of category-courses (temporarily tables kurser and kategorier created by me)     $courses = $wpdb->get_results( "SELECT * FROM `kurser` kur     LEFT JOIN kategorier kat ON (kat.id = kur.kategori)" );          //Go through category-courses and put them into wordpress-tables     foreach($courses as $course) {         $name = $course->kursnamn;            //If name has length         if (strlen($name)>0) {                           $new_post = array(                 'post_title' => $name,                 'post_content' => '',                 'post_status' => 'publish',                 'post_date' => date('Y-m-d H:i:s'),                 'post_author' => $user_ID,                 'post_type' => 'course'             );                  //This works because an ID is returned                             $post_id = wp_insert_post($new_post);                   $current_term_category = 33;                      if (substr($name, 0, 3) == 'lid') {                 $cat_city = 29;             }             else {                 $cat_city = 30;                             }             $cat_ids = array($current_term_category, $cat_city);                  //term_id 30,29 and 33 exists in wp_terms-table             //This is where I've done something wrong.                 wp_set_object_terms( $post_id, $cat_ids, 'categorycourses', false);         }          }        The custom types courses are inserted but no relations to any categorycourses ((29 or 30) and 33) are made. **What am I doing wrong?**


title: Wordpress plugin development OOP style

text:
I am building my first oop based plugin.This main problem is that it is not showing settings field(font error input).So far my approach..               $plugin_settings = new WordPress_Plugin_Template_Settings( __FILE__ );      The class is                   class WordPress_Plugin_Template_Settings {         private $dir;         private $file;         private $assets_dir;         private $assets_url;         public function __construct( $file ) {             $this->file = $file;             $this->dir = dirname( $this->file );             $this->assets_dir = trailingslashit( $this->dir ) . 'assets';             $this->assets_url = esc_url( trailingslashit( plugins_url( '/assets/',    $this->file ) ) );             register_activation_hook(__FILE__,array( $this, 'ma_defaults_options'));             add_action('admin_init', array( $this, 'ma_admin_options_init'));             add_action( 'admin_menu' , array( $this, 'add_menu_item' ) );         }          function ma_defaults_options() {          $default_options = get_option('ma_admin_styler');              if((!is_array($default_options))) {          $default = array(          "error_font_color"  => "#ffff",          );         update_option('ma_admin_styler', $default);         }             }         public function add_menu_item() {         add_options_page( 'Plugin Settings' , 'Plugin Settings' , 'edit_theme_options' ,  'ma_admin_styler' ,  array( $this, 'settings_page' ) );         }         public function ma_admin_options_init()         {         register_setting('ma_admin_styler', 'ma_admin_styler', array(  $this,'ma_admin_styler_validate'));         add_settings_section('main_section', '', array( $this,'section_text_default'), __FILE__);          add_settings_field('error_font_color', 'Error Font Color', array(   $this,'ma_error_font_color'), __FILE__, 'main_section');}         function section_text_default(){}         function ma_error_font_color()     {         $options = get_option('ma_admin_styler');         echo "<input name='ma_admin_styler[error_font_color]' class='wp-color-picker-field' data-default-color='#ffffff' id='color'value='{$options['error_font_color']}' />";     }              function settings_page() {                  echo '

Plugin Settings
                     <form method="post" action="options.php" enctype="multipart/form-data">';                          settings_fields( 'ma_admin_styler' );                     do_settings_sections( 'ma_admin_styler' );                        echo '
                             <input name="Submit" type="submit" class="button-primary" value="' . esc_attr( __( 'Save Settings' , 'plugin_textdomain' ) ) . '" />
                     </form>
';         }          }      I think I have error in `add_settings_field('error_font_color', 'Error Font Color', array( $this,'ma_error_font_color'), __FILE__, 'main_section');`


title: Counting custom post type with wp_count_posts returns an empty object

text: For some reason the `wp_counts_posts` function returns an empty object if I use my custom post type's name in the function's parameter. The `var_dump` is: `object(stdClass)#93 (0) { }` The name of my cpt is `CommunityUpload` and I use the count function as follows:               function community_gallery_post_count(){     $posts = wp_count_posts( 'communityupload' );     var_dump( $posts );     return $posts->publish;      The function returns as expected if counting standard posts. I define my cpt as follows:               [...]     var $single = "Community Upload";   // this represents the singular name of the post type     var $plural = "Community Uploads";  // this represents the plural name of the post type     var $type   = "CommunityUpload";    // this is the actual type     function add_post_type(){     $labels = array(       'name' => _x($this->plural, 'post type general name'),       'singular_name' => _x($this->single, 'post type singular name'),       'add_new' => _x('Add ' . $this->single, $this->single),       'add_new_item' => __('Add New ' . $this->single),       'edit_item' => __('Edit ' . $this->single),       'new_item' => __('New ' . $this->single),       'view_item' => __('View ' . $this->single),       'search_items' => __('Search ' . $this->plural),       'not_found' =>  __('No ' . $this->plural . ' Found'),       'not_found_in_trash' => __('No ' . $this->plural . ' found in Trash'),       'parent_item_colon' => ''     );     $options = array(       'labels' => $labels,       'public' => true,       'publicly_queryable' => true,       'show_ui' => true,       'query_var' => true,       'rewrite' => array('slug' => $this->slug),       'capability_type' => 'post',       'hierarchical' => false,       'has_archive' => true,       'menu_position' => null,       'supports' => array(         'title',         'editor',         'author',         'thumbnail',         'excerpt',         'comments',         'custom-fields'       ),     );     register_post_type($this->type, $options);     }     [...]      Any help is appreciated, thank you.


title: Set post title to same value as a tow meta box

text: I've removed "Title" from a custom post type that I created. Which makes it that all new posts gets the name "Auto Draft". To get around this I want to be able to fetch a value/post name from a meta box and save that as the new title. Is this possible? Now i need to when i save new post i need to set post title like this               matches_first x matches_second      where matches_first is meta box 1 and matches_second is meta box 2


title: Theme options not displaying correctly after theme update

text: I am redesigning a theme options panel but when I present to a client, the display is not exactly the same with the one I made. I investigate on this problem and it seems that he is actually seeing a part of the old version of the theme options panel so a full clearing of the browser cache should solve the problem. I have replicate his issue and clearing the browser solve this one. But I'm looking for some ways to somehow reset or flush old changes on the browser for the theme options without actually clearing your cache. As I have observed the client is not yet ready to clear his browser probably due to some important reasons. Is there a solution to this? Thanks.


title: wp_update_post via ajax from frontend

text: Setting: three open Tabs in browser: Tab 1: Admin edit post Tab 2: Frontend view of that post in "editing mode" Tab 3: Frontend view in "non-editing" mode (default request) I edit the post on Tab 2 (frontend editing) and save it via AJAX (via `wp_update_post`). When I refresh this Tab, or Tab 3, I can see the changes. But when I refresh Tab 1 (WP Backend edit-posts page), I see the old content in the editor, but a new revision was added. When I hard-refresh that page, it works as expected. (This might be very confusing to editors) So why does it work only on hard refresh, but not on normal refresh? Is there any kind of caching active? (couldn't find anything in the codex) Simlified Ajax save action:               function save_page() {         $postID = (int)$_POST['postID'];         $content = $_POST['content'];              $my_post = array(             'ID'           => $postID,             'post_content' => $content         );              wp_update_post( $my_post );              exit;     }      Edit: In the Backend, on normal refresh:                   global $post;         echo "<pre>";         print_r($post->post_content);         echo "</pre>";      prints a different result content than shown in the editor.


title: Retrieve a specific field from taxonomy term through advanced custom fields

text: I've set up a custom field which appears in a taxonomy terms page. I am trying pull an image associated with the custom taxonomy term directly However the page in which it is being displayed is a template page. I think I need to pass the post ID before pulling the specific image, but how do you do that for a custom taxonomy? The custom taxonomy is 'manufacture', and the term id is e.g 1, the image field id is 'image_toc' and I have set ACF to image url. I've read the page on "how-to/how-to-get-values-from-a-taxonomy-term/" but I don't really understand what I'm supposed to replace with what. I am using things along the lines of:               <img src="<?php the_field('image_toc', 'I am giving term id here'); ?>" />      But nothing is happening. No image and no path in the source code.


title: How to remove category from wordpress url?

text: I am new to wordpress so i am facing a problem in removing /category/ from wordpress URL               http://domain/category/category-name       So i would like to know how to remove /category/ from the url. I have tried various solutions like               Go to Settings >> Permalinks and select Custom and enter: /%category%/%postname%/     Next set your Category Base to /      But even after doing this i am not able to remove the /category/ from the URL. Any help would be appreciated Thanks


title: Drag images with caption in WP editor

text: Whenever I insert an image **without** a caption in the post, the editor makes it an object that I can select and move around / scale. Whenever I insert an image **with** a caption, it inserts fine. I can scale the image, but I can't move it around. I think that's because the caption displays beneath the image, wich is just text. Is there a way to make the image + caption an object or something, so that I can't select the caption text, instead selects the whole lot, so I can move it around? Or maybe is there a hook to target images with captions in the WP editor, and just don't display the caption ( so it's treated like a normal image )? Thanks in advance.


title: Adding ul class with wp_list_categories Custom Walker

text:
I am trying to achieve something that seems like it should be simple but is causing me headaches. I am listing my categories out using wp_list_categories which gives me this...

Fruit

Vegetables

Tinned Goods

Dairy Products

      All I want to do is add a class to the ul and li using a walker function, my function looks like this....               class Walker_Simple_Example extends Walker {           var $db_fields = array( 'parent' => 'parent_id', 'id' => 'object_id' );                function start_lvl(&$output, $depth=1, $args=array()) {               $output .= "\n
\n";           }                function end_lvl(&$output, $depth=0, $args=array()) {               $output .= "
\n";           }                function start_el(&$output, $item, $depth=0, $args=array()) {               $output .= "
".esc_attr( $item->name );         }                function end_el(&$output, $item, $depth=0, $args=array()) {               $output .= "
\n";           }       }        This works fine for the li items and gives them all a class of 'item' but the ul class just doesn't appear. Can anyone see where I am going wrong?


title: How to Modify Author Page for all Users?

text:
I am going to create a user profile page for all users in my blog. I thought, it is better to modify the author page for all users.               <?php     if(is_author()) {      echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'themejunkie_author_bio_avatar_size', 60 ) ); ?>
<?php the_author(); ?>
     <?php the_author_meta( 'description' );} ?>      I use above code in archive.php file. Ex Author Page : mysite.com/author/username Above link is worked for only authors. How I modify that page for all users even they have not published any post ( Even role is Subscriber).


title: How to create download links based on Custom Fields with Rewrite API

text: For me this is quite hard to do, but I guess that this could be easily done by an expert. :) Let's suppose I have a post, which is a custom post type `resources`, with the following data:   * **Post Slug** : beach   * **Custom Fields** :      * `dl1file`: bikini     * `dl1link`: assets/file1.zip     * `dl1count`: 56     * `dl2file`: beachball     * `dl2link`: assets/file2.zip     * `dl2count`: 31 The post above have more than one file to download, and all of them are stored in Custom Fields as `dlNfile`, where `N` are numbers (e.g.: `dl1file`). Also, each of these files have two more custom fields, the `dlNlink` (e.g.: `dl1link`) which will be used in the URL, and `dlNcount` (e.g.: `dl1count`) will store the download count number. Now, with Rewrite API I will need to convert `site.com/?resource=beach&file=bikini` (or if it's easier, `site.com/resources/beach/?file=bikini`) into `site.com/download/beach/bikini`. When one of the links is clicked, and since I only provided the `resource`, which is the post slug, and the value of one of the `dlNfile`, WordPress will now have to know which post to retrieve and identify the correct `dlNfile`, which in this case is `dl1file`. Then it will know that the real filename is stored in `dl1link` and then it proceeds to the download (`site.com/assets/file1.zip`) and increments `dl1count` by 1. * * * **EDIT** : I tried Jesper's tutorial before, but I don't want to create a new post just for store a download file information. I also provided another URL idea, which doesn't have to store the URL parameter `resource`, which is the post slug.


title: A guide or tool for inserting bootstrap in underscores theme?

text: I am looking for a guide or tool for inserting bootstrap in to underscores theme. Booststrap is a CSS framework and Underscores theme is starter theme with ultra-minimal CSS.


title: Keep post format class with isotope filter

text:
When I add isotope filtering for displaying posts, I lose the format class. WITHOUT isotope filtering:
      WITH isotope filtering:
       I need to keep the format class (like "format-image" in the above example). Here is the code I'm using:

All
     <?php          $terms = get_terms("category"); // get all categories, but you can use any taxonomy         $count = count($terms); //How many are they?         if ( $count > 0 ){  //If there are more than 0 terms             foreach ( $terms as $term ) {  //for each term:                 echo "
slug."'>" . $term->name . "
\n";      //create a list item with the current term slug for sorting, and name for label             }         }      ?>
          <?php $the_query = new WP_Query( 'posts_per_page=50' );      //Check the WP_Query docs to see   how you can limit which posts to display ?>     <?php if ( $the_query->have_posts() ) : ?>
     <?php while ( $the_query->have_posts() ) : $the_query->the_post();      $termsArray = get_the_terms( $post->ID, "category", "format-name");  //Get the terms for this particular item     $termsString = ""; //initialize the string that will contain the terms         foreach ( $termsArray as $term ) { // for each term              $termsString .= $term->slug.' '; //create a string that has all the slugs          }     ?>      <article class="<?php echo $termsString; ?>item">
<?php the_title(); ?>
             <?php if ( has_post_thumbnail() ) {                        the_post_thumbnail();                 } ?>
      <?php endwhile;  ?>
      <?php endif; ?>      and the JS:               jQuery(function ($) {          var $container = $('#isotope-list'); //The ID for the list with all the blog posts     $container.isotope({ //Isotope options, 'item' matches the class in the PHP         itemSelector : '.item',            layoutMode : 'masonry'     });          //Add the class selected to the item that is clicked, and remove from the others     var $optionSets = $('#filters'),     $optionLinks = $optionSets.find('a');          $optionLinks.click(function(){     var $this = $(this);     // don't proceed if already selected     if ( $this.hasClass('selected') ) {       return false;     }     var $optionSet = $this.parents('.option-set');     $optionSets.find('.selected').removeClass('selected');     $this.addClass('selected');          //When an item is clicked, sort the items.      var selector = $(this).attr('data-filter');     $container.isotope({ filter: selector });          return false;     });          });      Appreciate any guidance!


title: How can i get the actor birthday by date?

text: How can i retrive the actor birthday by Date. How i add the date, i have a custom field with Calendar. ![enter image description here](http://i.stack.imgur.com/nPi5O.jpg) Now is 20th ... how can i retrive the Actor By this day I try this but it wont work               <?php // Get today's date in the right format     $todaysDate = date('md');     ?>          <?php $loop = new WP_Query( array(     'post_type' => 'persoane',     'posts_per_page' =>5,     'meta_key' => 'data_nasterii',     'meta_compare' => '=',     'meta_value' => $todaysDate,     'orderby' => 'meta_value',     'order' => 'ASC'     ) ); ?>          <?php while ($loop->have_posts()) : $loop->the_post(); ?>      The meta_key - data_nasterii is the custom field. Ex: today is 20th Jan 2013 I want to retrivee all actors that are born in 20 th Jan , with the specification in (38 Years Old (2013-1975=38 years)) EX: 50 Cent - Today is his birthday. He is born on 20th Jan 1975 and he has 38 Years . if anny body know's please post , it will be apreciate , when i found a solution myself i woud post here for others to see. Thanks.


title: wp_dropdown_users() to include null value

text: Is there an argument for `wp_dropdown_users()` which would add a blank null value (no user selected)?


title: How many WP websites can go on one shared hosting account?

text: Assuming you have a shared hosting account that enables multiple MySQL databases and multiple domain pointers. **How many standard WP-installed websites can it hold without problem?** (let's say each website gets around 1000-2000 visitors a day) If this depends on who is the hosting provider, please refer to whom is the one you are speaking of (which will enable the creation of some basic range). motivation: I recently asked a hosting provider to downgrade an account from VPS to share hosting, and they said it was not possible because of the number of websites and number of uniques (the installs are standard). I wish to understand if they are being greedy or just.


title: Adding a rich text editor to a widget - specifically CKEditor

text: I am trying to add a rich text editor to a widget and am using CKEditor ( http://ckeditor.com/download ) with a simple toolbar. Everything works fine until I try to save. When clicking on "save" the textarea (and texteditor) vanish and it fails to save. Removing the texteditor allows the textarea to work and save normally. You can see the widgets code here: http://pastebin.com/C7VbxBSG and of course I did add the required `wp_register_script` and `wp_enqueue_script` I use the same code to add the text editor to text areas n meta boxes for pages and posts and it works fine. It's just on the widget the problem comes up something to do with the way the widget saves: via javascript which is beyond my skills at present


title: Wordpress as webapp login session

text: Using iOS specific metatags I enabled webapp mode on a WP site. It works nice, but I'm facing a problem: Switching between apps breaks the WP session. The webapp loads the splash image again and shows the specified index page instead of the page visited and left earlier and the logged in state is reseted as well. I've found an answer to a similar question here, though it's not WP specific. Is there a WP way to keep the webapp alive while it is in the background? Extending WP session with `auth_cookie_expiration` filter could solve the problem?


title: Why is adoptStyles-css stylesheet link added to every page?

text: By looking at the source of any of the WordPress pages on my site, I can see there is this stylesheet link:               <link rel='stylesheet' id='adoptStyles-css'       href='http://mydomain.com/wp-content/plugins//adopt_styles.css?ver=2.9.1' type='text/css' media='all' />      The link is broken - the URL is not served by my WordPress. (the double slash is not the source of the problem) Has anyone seen this before? Where does this link come from? How to remove it/determine the plugin that is adding it?


title: Determine if get_the_image has image on Get the image Plugin

text: is there a way / function to determine if Get the image plugin successfully grab the image from post? Something like has_post_thumbnail on WordPress featured image. I need to know if featured image exist, since other HTML elements (position absolute) / depend on the Featured image for positioning. Thanks.


title: How to display data from custom table in wordpress database?

text: I want to retrieve data from custom table, that I've made inside the wordpress database and display it in a wordpress page , like posts Thanks in advance


title: Photo Gallery Plugin and Touch Devices

text: I am looking for a decent plugin that will display a slide show of images that are hosted on Flickr. I have tried `Slickr Flickr` and and `Flickr+Highslide` (but that one seems to be missing from the WP plugins directory right now). The issue I have with those two is they do not display the galleries properly on a mobile device. I am using `WP Touch` to handle displaying the site on smartphones. Is there an image plugin available that plays nice with both desktop and mobile browsers, and still has the same functioanlity of the above? p.s. This just for a hobby site, so the less coding the better (I'm not really a JS ninja anyway).


title: Good rating plugin that doesn't depend on an external service?

text: Is there a good plugin for rating blog posts that doesn't depend on PollDaddy or another external service? Ideally I'd like a plugin similar in appearance to Polldaddy Polls & Ratings, but without the PollDaddy dependency (I'd prefer to have the rating data in the WP database). _EDIT: just to make things clear: I'm not interested in polls, only in rating for blog posts_ * * * What I tried so far:   * GD Star rating: too complex, and doesn't work at all for me (*)   * WP-PostRatings: ~~doesn't work at all for me (*)~~ _(my mistake... I didn't realize I had to modify the theme. This one works fine)_   * kk Star ratings: doesn't look too good with my theme (Garland revisited)   * Post ratings: simple, good looking, but there's a bug with my theme; ~~I'll try to fix the CSS if I can't find anything better~~ _(OK, I'm really, really bad at CSS...)_   * Rating-Widget: really nice, but depends on external site _(*) perhaps this is because I have an unusual setup (Windows/IIS server, SQL Server database with WP database abstraction plugin, multi-site with domain mapping)_


title: How to use a WooCommerce action hook?

text: I am wondering how you would implement the following hook.               do_action( 'woocommerce_process_product_meta_' . $product_type, $post_id );      What is the correct way to call a call the action from a plugin file. Bellow is the code that I am currently using but its not working.               global $post, $thepostid, $woocommerce;          function new_post_meta () {         if (isset($_POST['location']))              update_post_meta( $post_id, 'location', json_encode($_POST['location']) );           }          add_action( 'woocommerce_process_product_meta_' .$product_type, 'new_post_meta' );


title: WordPress dashboard

text: I am working towards developing a WordPress them from an HTML/CSS template on my local machine. But after activating the theme from the WordPress dashboard and clicking the Visit Site link, I am unable to view the WordPress bar for the dashboard. Kindly guide on what needs to be done. Thanks and regards Debashis


title: W3 Total Cache Can't Really Detect Things

text: I'm running Apache + Cpanel with PHP installed as an apache module. I've been trying to setup W3 Total Cache to see the php and apache extensions, and I've been having trouble. It detects curl and ftlib, but it can't detect any of the extensions from mod_deflate to mod_setenvif. While these will work even if they're "not detected", it also doesn't detect either apc or memcache, and I'd like to use some combination of caching plugins php -r 'phpinfo();' | grep -i 'apc'               apc     APC Support => disabled     APC Debugging => Enabled     MMAP File Mask => /tmp/apc.XXXXXX     apc.cache_by_default => On => On     apc.canonicalize => On => On     apc.coredump_unmap => Off => Off     apc.enable_cli => Off => Off     apc.enabled => On => On     apc.file_md5 => Off => Off     apc.file_update_protection => 2 => 2     apc.filters => no value => no value     apc.gc_ttl => 0 => 0     apc.include_once_override => Off => Off     apc.lazy_classes => Off => Off     apc.lazy_functions => Off => Off     apc.max_file_size => 10M => 10M     apc.mmap_file_mask => /tmp/apc.XXXXXX => /tmp/apc.XXXXXX     apc.num_files_hint => 4096 => 4096     apc.preload_path => no value => no value     apc.report_autofilter => Off => Off     apc.rfc1867 => Off => Off     apc.rfc1867_freq => 0 => 0     apc.rfc1867_name => APC_UPLOAD_PROGRESS => APC_UPLOAD_PROGRESS     apc.rfc1867_prefix => upload_ => upload_     apc.rfc1867_ttl => 3600 => 3600     apc.serializer => default => default     apc.shm_segments => 1 => 1     apc.shm_size => 32M => 32M     apc.shm_strings_buffer => 4M => 4M     apc.slam_defense => Off => Off     apc.stat => Off => Off     apc.stat_ctime => Off => Off     apc.ttl => 7200 => 7200     apc.use_request_time => On => On     apc.user_entries_hint => 4096 => 4096     apc.user_ttl => 7200 => 7200     apc.write_lock => On => On      php -r 'phpinfo();' | grep -i 'memca'               memcache     memcache support => enabled     memcache.allow_failover => 1 => 1     memcache.chunk_size => 8192 => 8192     memcache.default_port => 11211 => 11211     memcache.default_timeout_ms => 1000 => 1000     memcache.hash_function => crc32 => crc32     memcache.hash_strategy => standard => standard     memcache.max_failover_attempts => 20 => 20     Registered save handlers => files user memcache      PWD => /usr/local/src/memcached-1.4.6     _SERVER["PWD"] => /usr/local/src/memcached-1.4.6     _ENV["PWD"] => /usr/local/src/memcached-1.4.6      So I asked a question that might be relevant over here: Zend Opcache No Files Cached Zend Opcache doesn't see any of my PHP files in the wordpress installation. W3 Total Cache can't seem to see any of my installed php modules. I'm flummoxed. Does anyone have any ideas? Let me know if anything else would be helpful. Domain is openproto.us, if that helps any.


title: Sort users by meta_value_num

text:
I'm having problems using `WP_User_Query` to sort users by a meta value number, I would of thought this would be simple by it just displays results as descending alphabetically.                <?php     $args = array(         'orderby' => 'meta_value_num',         'meta_key ' => 'epicredvote',         'order' => 'DESC',     );          // The Query     $user_query = new WP_User_Query( $args );          // User Loop     if ( ! empty( $user_query->results ) ) {         foreach ( $user_query->results as $user ) {             echo '
' . $user->display_name . '
';         }     } else {         echo 'No users found.';     }     ?>      I can get the meta value for each author easily enough but I can't get users to sort by the same meta value. EDIT for birgire's answer. This still outputs 'no users found'. In functions.php               function wpse_149342_pre_user_query( $query )     {         remove_action( current_action(), __FUNCTION__ );              $query->query_orderby = str_replace(              'meta_value',              'meta_value+0',              $query->query_orderby          );     }      Loop:-                  <?php     $args = array(         'meta_key' => 'epicredvote',         'orderby'  => 'meta_value',         'order'    => 'DESC',     );     add_action( 'pre_user_query', 'wpse_149342_pre_user_query' );          // The Query     $user_query = new WP_User_Query( $args );          // User Loop     if ( ! empty( $user_query->results ) ) {         foreach ( $user_query->results as $user ) {             echo '
' . $user->display_name . '
';         }     } else {         echo 'No users found.';     }     ?>      Version of wordpress is 3.9.1. I took a look at pieter's answer and I can't get my head around it. Let me explain a little what the meta_key is in this case. epicredvote is a numeric value, each post has a voting system, John makes 2 posts, each gets 10 votes, John then has 20 votes in total for both of his posts. On author.php I use this to extract the total number of votes that user has received for all of their posts.               function author_rating_total() {        $user_id = get_the_author_meta( 'ID' );        $query = array (            'author' => $user_id,            'suppress_filters' => 'true', //lets skip some unnessecery sql queries            'posts_per_page' => -1        );        $queryObject = new WP_Query($query); while($queryObject->have_posts()) : $queryObject->the_post();             $post_ratings_data = get_post_custom(get_the_id());        $post_ratings_score = intval($post_ratings_data['epicredvote'][0]);             $ratings_array[] = $post_ratings_score;             endwhile;              $ratings_sum = 0;        if (is_array($ratings_array)){         $ratings_sum = array_sum($ratings_array);         }             echo $ratings_sum;                wp_reset_query();     }      I can then do `echo author_rating_total();` to display the aggregated number of votes that user has received for all of their posts. Would of thought it'd be easy to use WP_user_query to extract the same meta value then rank authors accordingly over a given date range, apparently not so much! There's got to be a way though!


title: Conditional Tag for sub cagtegories?

text: We have is_category() for categories, however I m not getting a conditional tags for subcategories, I want to enqueue script only on subcategories but on the parent. So lets say I have a parent category 'fun' which has several sub categories like 'stories', 'arts', 'crafts' . How do I load script only for the subcategory but not for parent 'fun'? Thanks


title: Editor Styles and Typekit

text: My website uses typekit to grab custom fonts, which works on the frontend. I'd like to put this in my editor styles in the backend. However, I don't know how I would do this. Typekit uses a js embed snippet rather than a css font- face embed snippet.


title: Permalinks not working for post IDs as slug

text: I inherited a site that has a lot of posts without a title, thus the permalink defaults to the post ID, with pretty permalinks turned on. IE - `http://mysite.com/1200` When the permalinks are reset to the default (IE `http://mysite.com/?p=1200`) the page displays. Also, when I change the 1200 within the individual post, to either some random string OR numbers that aren't associated with another posts ID (IE `http://mysite.com/test` or `http://mysite.com/81249817`), the page will display correctly. BUT when the slug has an ID of a post (it can be any post), a 404 error is thrown. I have tried flushing the rewrite rules, changing .htaccess (FollowSymLinks), digging through functions to find some rewrite for post IDs, etc. but nothing seems to be working. How can I fix this without going through every single post and changing the slug on the post (there are literally hundreds of posts)?


title: do more action after I publish a post

text: I am using `wordpress3.5`, I need to write post information to a file **after** I publish a post successfully. What I am not know is   1. When I click Publish button, what function wordpress invoke to save the post to mysql table wp_posts. I dive into wordpess's code ,found many many php file include.   2. If I want to do more action, what should I do. For example, I want to write the post information to a file. Thanks very much.


title: MultiSite: new Sites not showing up

text: I have a Multisite installation that I just upgraded to 3.5.2. So far everything has been working great (9 sites); after the upgrade I just went to create two new ones, and I have a problem. Everything below is done as the superadmin who is also the admin for the new sites.   * Network Admin -> Sites does not show the new sites.   * If I try to edit them by tweaking the Edit URL of the Sites menu (`/wp-admin/network/site-info.php?id=13`, with `13` being the number of the new blog that I can see in the database), I get "You do not have permission to access this page."   * However, My Sites does show them.   * When I access the site through My Sites (`/blog-name/wp-admin/`), I see normal interface, and I can visit the site without any problems. So the question is, how can it happen that a superadmin not see a site? And how do I fix it? **EDIT** : It seems my new sites got `wp_blogs.site_id = 3`, whereas all of my older ones have `wp_blogs.site_id = 1`. I have no idea how this happened, but my `wp-config.php` also says that `SITE_ID_CURRENT_SITE` and `BLOG_ID_CURRENT_SITE` are `3`. I suspect I should not touch `BLOG_ID_CURRENT_SITE`, I guess it says that my default blog the one with `wp_blogs.blog_id = 3`? Can I change these values to `1` safely? (`SITE_ID_CURRENT_SITE`, as well as `wp_blogs.site_id` for all blogs) Is this number referenced anywhere else that I'm overlooking? I believe I created my last blog (before today's fiasco) well after touching anything in `wp-config.php`. Did WordPress only lately start paying attention to `SITE_ID_CURRENT_SITE`, so that things started going wrong only after the update?


title: Parsing External Table Arguments

text: I have a client project that has posts assigned to their country of origin. The client wants to be able to search the posts by continent and or region. I have a separate table that assigns each country to its respective region, and I have the WP query that uses the resulting array:               $country_names = array('England','France','Germany',...); // this would be the result from fetching countries associated with a region.     $args = array(         'posts_per_page' => -1,         'meta_query' => array(             array(                 'key' => 'country',                 'value' => $country_names,                 'compare' => 'IN'             )         )     );     $query = new WP_Query( $args );      What I'm having trouble with is the part in the middle. Normally, I'd use some standard PHP/MySQL to craft the array:               <?php          //Process incoming variable     if(!empty($_REQUEST['region'])){      $region = $_REQUEST['region'];      } else {      $region = NULL;      }          // Make a MySQL Connection     $query = "SELECT * FROM regions WHERE region='$region'";           $result = mysql_query($query) or die(mysql_error());          $row = mysql_fetch_array($result) or die(mysql_error());     echo $row['country'];     ?>      However, I'm having trouble making it work within a WP template, since WP manages the incoming variables using its own internal functions. Can anyone help me to connect the two together? I'm sure I'm overlooking some simple step here, or else I'm not using some built-in WP function. Any help is appreciated. Thanks! ty


title: How to add the image URL from an external RSS feed and insert into a custom field?

text: * **Editor Note** (Original title: The url from an image via custom field) changed to be more descriptive. Hi all, Am not even sure if this can be done but...after ive been searching for the last 6 hours none stop I have to ask :/ I have a image slider I use which I have to add the image url(not the thumb url) all the time in a custom field (postimage) I have set up a rss feed going in to wordpress from my booru animelon.com/booru It works fine but I need a way to get it to auto add the image url in this custom field


title: Trouble adding data to options table

text: I am trying to create a function that adds an option containing a subscription list to the options table. (This list is eventually referenced by a plug-in.) I am having some problems as there are two functions (one that calls the other if needed) and I'm not whether to reference the global `user_ID` or the `$player->ID` from `get_users()`. I'm also not sure I'm using the right hook.               add_action( 'wp_loaded', "forum_subscribe_member_player" );          function forum_subscribe_member_player()     {         global $user_ID;         $players= get_users();              foreach($players as $player)         {             $playeremail = get_userdata($player->ID, 'user_email');             if(!empty($playeremail) && $player->user_level >= 1)             {                                    $list = get_option("mf_forum_subscribers_1", array());                           if( is_player_subscribed($player->ID)) //remove user if already exists (user clicked unsubscribe)                 {                     $key = array_search($playeremail, $list);                     unset($list[$key]);                 }                 else                     $list[] = $playeremail;                 update_option("mf_forum_subscribers_1", $list);             }         }            }          function is_player_subscribed($user_ID)     {         $players= get_users();              foreach($players as $player)         {                  if($player->ID)           {             $playeremail = get_userdata($user_ID, 'user_email');             $list = get_option("mf_forum_subscribers_1", array());             if(in_array($playeremail, $list))             {               return true;             }             return false;           }         }     }


title: [Multisite]How can I update custom blog option?

text: I wanted to update custom blog option created thru Settings Api using the function `update_blog_option`. I created this code.                   $country_base = get_blog_option($blog_id, 'mytheme_options');//retrieve all options         $country_base['country_base'] = $the_country;         $currency_unit = get_blog_option($blog_id, 'mytheme_options');//retrieve all options         $currency_unit['currency_unit'] = $d_currency;              update_blog_option($blog_id, 'mytheme_options', $country_base);         update_blog_option($blog_id, 'mytheme_options', $currency_unit);      However, its not working.. Is there way to update custom blog option?


title: WordPress Members Area Permalinks based on username

text: In a particular scenario I want a site with membership areas that give users their own member's "space". I want a permalink structure as such http://example.com/joebloggs and extend on that such as http://example.com/joebloggs/stories/joes-story I thought of using custom posts at first then decided against it. I know some of you may suggest I use a story post type but what if that user was the controller and had like their own membership area of stories, games, reviews etc. To put in context, it's like a multisite only I do not require a multisite. Do I have to create a custom post type for each user dynamically or is there another way. I would love for somebody to point me in direction of the WordPress mechanism I should be using in the API. Thank you all for your help and suggestions. Many thanks, Mark.


title: WordPress AJAX calls not detecting language properly?

text: I have a WordPress multisite, which is in both english and french. On the french site, localization is working great (using `date_l18n()` for dates, and `__()`, etc. for the rest). When an AJAX call sends off to WP and returns data (the same rendering functions being called from initial page load and AJAX), however, they are returning English date values. **Example:** Date archive says "septembre 2013". You click the Next Month button, which sends off to AJAX and returns the new month header, and article listing. It's returning "October 2013" rather than "octobre 2013". Is this a known bug, or should I be submitting this to track?               function render_event_archive_month_header( $date = null, $echo = true ) {         $date_str = strtotime( $date );              if( ! $echo )             ob_start();              <?php echo date_i18n('F Y', $date_str ); ?>              <?php         if( ! $echo ) {             $data = ob_get_contents();             ob_end_clean();             return $data;         }     }      This is being passed a yyyy-mm-dd date value, like so               render_event_archive_month_header( '2013-10' );      from within my Ajax action callback.


title: Resources to learn OOP for WordPress plugins, custom post types, etc

text: In a plugin, I need to create a custom post type and the associated admin menu modifications with a class rather than procedural code. What is the basic skeleton that I need to build off of in order to do so, and how does that class get hooked into WordPress (i.e., how do I do the "add_action('init','register_my_custom_post_type'), etc. with a class)?


title: Page displays content from different query?

text: How can I reset all variables in order to get the actual page content? I keep getting the last post's content I've called from a news-box I've implemented - but need the actual page's content .. thanks


title: How to update user profile or inputing any data to the wp db from external site?

text: I need to update user profile field (mainly first name, last name, email and password) from an external website. Wordpress is installed on wordpress.domain.com and external website is at www.domain.com, and both are on two different servers. Now how can I update user data from the external site (www.domain.com)?


title: wordpress 3.5 tinymce height

text: I've just upgraded wordpress to 3.5 version and I noticed that TinyMCE Advanced Editor is not as tall as before. How can I change default tinyMCE height? **UPDATE** This is the screenshot of section I want to render higher than the default ![enter image description here](http://i.stack.imgur.com/9hWHg.jpg)


title: Role Capabilities: Add New Ones?

text: I'm trying to create a private type of community ... and the current `Capabilities` are great, except for the fact that I don't want users of a certain `Role` being able to see anything that someone else has created (posts, pages, etc) I'd love to be able to create some new `Capabilities` that would compliment my application, such as: `view_others_posts` ... I just don't want a user of a specific `Role` to see anything except what they've created. Another REALLY important example would be the Media Library ... I do NOT want users of a certain `Role` being able to see ANYTHING besides what they themselves have added to the Media Library. Make sense? ...for Admins, they can see all, but I need some serious private limits for users that belong to new custom `Role` Are there any ways of doing so?


title: Need help setting up a search form for wordpress

text: I want to set up a search function as a widget in wordpress. This is the situation that I have. 1- I have 3 custom post types 1.a: Each post type has custom fields and taxonomies.   1. I have regular wordpress section with categories and tags. So this is what I want the search to do: There will be a selection option in the search form, and when the user is going to search they will select from the following: a. entire site b. post type a c. post type B d. Post type D Thank you for your help. Please avoid suggesting a plugin. I am looking for custom functions that will search custom fields, custom taxonomies, and the post types. Thank you for taking the time to read this.


title: How to return loop contents

text:
At times, I need to **return** the output of a loop (usually with `WP_Query` like in this example) for use in a shortcode or with a filter on `the_content`. The following code that uses object buffering works, but I've read in other places that buffering can be inefficient. I've seen HEREDOC too, but I don't see how that would work here unless I saved every template tag as a variable first (which seems inefficient again). So my question is, what's the best way to return the output of a loop?               <?php if ( $cms_pl_pages->have_posts() ) :     ob_start(); // start object buffering. we'll run the loop and spit out final contents.     echo '
';     while ( $cms_pl_pages->have_posts() ) : $cms_pl_pages->the_post();     ?>
             <?php has_post_thumbnail() ? the_post_thumbnail() : null; ?>             <a href="<?php the_permalink(); ?>" title="Read '<?php the_title(); ?>.'">
<?php the_title(); ?>
                          <?php has_excerpt() ? the_excerpt() : null; ?>
          <?php endwhile;     echo '
 ';     $content = ob_get_contents(); // set $content to buffered object     ob_end_clean(); // throw away the buffered object     endif; wp_reset_postdata();     return $content; // return! ?>


title: wp_enqueue_scripts called twice?

text: I had some problem with WP recognizing a is_single condition for loading scripts called in function.php. I put a error_log(is_single()) to check what was going on. When opening a post page the log showed me that log function has been called and the is_sigle() tag was positive the first time and negative the second! In the home or other pages it is shown only once. What's going on? Here's the code in function.php. I'm using a child theme.               add_action('wp_enqueue_scripts', function(){         error_log(is_single());         if (is_single()){             wp_enqueue_script('jquery_transform', get_stylesheet_directory_uri()."/js/jquery.transform.js", array('jquery'),'0.9.3',true);             wp_enqueue_script('zs_image_rotate', get_stylesheet_directory_uri()."/js/image_rotate.js", array('jquery_transform'),'',true);         }         wp_deregister_script('thickbox');     });


title: Displaying list of subcategories and not parent category

text: I have a blog which has three top level categories. Each top level category has a list of sub categories. I am displaying only certain top level category posts in certain sections of the website. When viewing the post I want to display something like: Posted under Cards, Races, Lifestyle These three categories would be children of a top leve category. How could I list these categories and exclude the top level category when listing how a post is categorized? Thanks.


title: Limit upload by file type only for certain custom post type

text: I have created a custom post type called "pdf". I've have a custom metabox where user can upload a pdf file throught wordpress builtin media uploader I need to restrict allowed files (pdf) only in this uploader. I already know how to restrict allowed files: How to set file type in wp_handle_upload? but the link above, interfer with all the uploads. Any hint? Thanks Edit: I've found how to limit file type in plupload, so I've solved half of the problem:                add_filter( 'plupload_init', 'my_plupload_init', 0, 1 );           function my_plupload_init( $plupload_init ) {      $plupload_init['filters'] = array( array('title' => __( 'Allowed Files' ), 'extensions' => 'pdf') );      return $plupload_init;     }      Edit #2: Use of wp_handle_upload_prefilter filter doesn't work: Thi is what is available inside $_REQUEST object after an image is uploaded on a new post:                   array       'type' => string 'image' (length=5)       'tab' => string 'type' (length=4)       'post_id' => string '0' (length=1)       '_wpnonce' => string '375c5f46f2' (length=10)       '_wp_http_referer' => string '/wp-admin/media-upload.php?post_id=' (length=37)       'html-upload' => string 'Carica media' (length=12)      There are no info about my custom post type. The id is 0 because post is not saved yet. Edit #3: Thanks to @TheDeadMusic answer I've added one line of code to my javascript. This is the js code I actually use that works great:               jQuery(document).ready(function($){     // #btn_upload is my custom button     $('#btn_upload').click(function(event){         event.preventDefault();         var backup = window.send_to_editor;         var src='';      //post_id is always set so I can pass it safely to tickbox         var post_id=$('#post_ID').val();      var target=$('#pdf_url');         window.send_to_editor = function(html)           {     //I have to get the link to "original file" from html returned by tickbox             link = $('a',html).attr('href');              $(target).val(link);              tb_remove();              window.send_to_editor=backup; //reset default action         }         //show the uploader          tb_show('', 'media-upload.php?post_id='+post_id+'&TB_iframe=true');          });           });


title: add 'file upload' field to user details

text: In the backend when a user goes to their detail page they can edit a few text fields. I want to add a custom field that allows the user to upload a file. I found something similar but its only to add extra text fields. add extra user fields


title: Adding %author% in custom post type URL structure?

text: I'm trying to do some WordPress URL rewriting ... Specifically I have custom post type that currently works like this: `http://mydomain.com/videos/post-title/` But I would like to have it located at: `http://mydomain.com/videos/author-name/post-title/` Is there any way to achieve this?


title: WP-TweetButton is not displaying the tweet button if this is set to "Manual."

text:
I'm using the WP-TweetButton but when I set the settings to add the button manually. Nothing is displayed. Settings:![enter image description here](http://i.stack.imgur.com/D7XXd.png) The Code:

                                 <?php tweetbutton(); ?>

<?php if (function_exists('fbshare_manual')) echo fbshare_manual(); ?>

<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=standard&show_faces=false&width=450&action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:60px">

<?php previous_posts_link( __( 'next →', 'twentyten' ) ); ?>
                     <?php endif; ?>
      I'm using Wordpress 3.1.2 and the last version of the plugin. Is anyone having this problem too? Have anyone managed to fix it?


title: Change theme per page or post

text: Is it possible to change the theme for specific page or post? Any recommended plugin for this?


title: Add an option in a builder

text:
I try to add a list of project in the builder of DIVI theme. I have already managed to insert the project_tag list like this :
                 Choisir le(s) réalisateur(s):
                 <% var et_pb_include_project_tag_temp = typeof et_pb_include_project_tag !== 'undefined' ? et_pb_include_project_tag.split( ',' ) : []; %>     END;                          $tag_array = get_terms( 'project_tag' );                     foreach ( $tag_array as $tag ) {                         printf( '<input type="checkbox" name="et_pb_include_project_tag" value="%1$s"%3$s> %2$s
',                             esc_attr( $tag->term_id ),                             esc_html( $tag->name ),                             '<%= _.contains( et_pb_include_project_tag_temp, "' . $tag->term_id . '" ) ? checked="checked" : "" %>'                         );                     }     echo <<<END
Sélectionner le réalisateur.

       But I don't know how to do with parent custom type "project" Any suggestions?


title: Showposts doesn't show the number of posts indicated

text:
on my homepage, I'm using several loops to display posts from different categories in various sections of the page. The code I'm adding before the loop is :               <?php query_posts('category_name=featured&showposts=5'); ?>      The loop comes just afterwards               <?php                   if ( have_posts() ) :              /* Start the Loop */                 while ( have_posts() ) : the_post();                 get_template_part( $layout, 'blog-'.get_post_format() );                 endwhile;             else :     ?>

<?php _e( 'Nothing Found', 'swift' ); ?>

<?php _e( 'Apologies, but there are no posts in the current context. Perhaps searching will help find a related           post.', 'swift' ); ?>
                     <?php get_search_form(); ?>

         <?php endif; ?>      And I copy paste this with the desired categories. Problem is eventhough I mention shoposts=5, 10 posts show up, whatever number I indicate. Do you guys have any clues please ? Thanks


title: how to add submenu item under parent menu item with code

text: Well, here is my problem suppose i have a menu like this generated by wp_nav_menu()               home     test- test1, test2     contact     about      test is my custom post type so what i want to do is if a user/admin publish posts a test post type i want it to automatically add in under test as test3.Forget about the publish_test hook i have done some research and i am ready to go with the code as follows in my functions.php               function auto_add_service_as_menu() {         echo 'ok';exit;          }     function auto_remove_service_from_menu() {         echo 'ok';exit;     }     add_action( 'publish_test', 'auto_add_service_as_menu' );     add_action( 'trash_test', 'auto_remove_service_from_menu' );      now what i want to do is add test3 which will be new test(cpt) post and its title and link should be automatically added to test menu. Note: I don't want anything to add or remove in admin dashboard or admin menu only to the user(wp_nav_menu). So any help would be helpful.Thanks in advance


title: How to check if post has previous_comments_link() and next_comments_link()

text:
I'm using the following code for comments pagination (based on 2014 theme)               <?php if( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>

           <?php previous_comments_link( __( '← Older Comments', '' ) ); ?>

           <?php next_comments_link( __( 'Newer Comments →', '' ) ); ?>

     <?php endif; ?>      I noticed that if I'm on the first page, the `.previous` list item is still in the DOM. It's empty but still there.

      I tried to find a proper function in the Functions Reference, but found nothing. What I'm trying to do is to check conditionally if `previous_comments_link()` and `next_comments_link()` should be displayed. If not, then do not display the list item. I don't know if this is a good idea (semantic) to remove whole list item.


title: Passing variables in the permalink structure on a custom post type

text: I have a structure like this for my custom post types: domain.com/member/member-name/book/book-name Basically, I have a custom post type of member, and the member-name is the post. What I want to do is pass a variable called books, but I can't get my code to work. I've based my solution on one that has previously been asked on here but my structure is different, and I've googled and googled to no avail. I really cant get my head around rewrite structures either!                   function add_book_rewrite() {             add_rewrite_tag('%book_name%','([^&]+)');         }         add_action( 'init', 'add_book_rewrite' );              function add_book_rewrite_rules() {             add_rewrite_rule('^member/([^/]*)/book/([^/]*)/?','index.php?post_type=member&name=$matches[2]&book_name=$matches[4]','top');         }         add_action( 'init', 'add_book_rewrite_rules' );              add_filter( 'query_vars', 'add_query_var' );              function add_query_var( $query_vars ) {                  $query_vars[] = 'book_name';             return $query_vars;         }              echo 'Book is '.get_query_var('book_name');      Any pointers on this would be received with gratitude Thanks


title: Save & Reset button in theme-option with Ajax (without refresh)

text:
I have a theme-options page and i will that the save and reset button loaded without refresh the whole page... but i have no idea, how i can implement ajax in my theme-option... Thank you for your help. The code is:               function mytheme_add_admin() {         global $themename, $dirname, $themeurl, $shortname, $options;                   if ( $_GET['page'] == basename(__FILE__) ) {                  if ( 'save' == $_REQUEST['action'] ) {                          foreach ($options as $value) {                         update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }                          foreach ($options as $value) {                         if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ]  ); } else { delete_option( $value['id'] ); } }                          header("Location: admin.php?page=admin_interface.php&saved=true");                     die;                  } else if( 'reset' == $_REQUEST['action'] ) {                      foreach ($options as $value) {                     delete_option( $value['id'] ); }                      header("Location: admin.php?page=admin_interface&reset=true");                 die;                  }                       else if( 'export' == $_REQUEST['action'] ) export_settings();             else if( 'import' == $_REQUEST['action'] ) import_settings();              }                           $rp_page = add_menu_page($themename." Options", "".$themename." Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');              add_action("admin_print_scripts-$rp_page", 'rp_load_only');         add_action("admin_print_styles-$rp_page",'rp_style_only');     }                     function rp_style_only() {     $file_dir=get_bloginfo('template_directory');     wp_enqueue_style("admin_style", $file_dir."/functions/admin/css/admin_style.css", false, "1.0", "all");     wp_enqueue_script("colorpicker", $file_dir."/functions/admin/js/jquery.color.picker.js", false, "1.0");     wp_enqueue_script("tabs", $file_dir."/functions/admin/js/jquery.tabs.js", false, "1.0");     wp_enqueue_script("custom", $file_dir."/functions/admin/js/custom.js", false, "1.0");     }               function mytheme_admin() {              global $themename, $dirname, $themeurl, $shortname, $options;                   if ( $_REQUEST['saved'] ) echo '

Options Saved

';         if ( $_REQUEST['reset'] ) echo '

Options Reset

';                              ?>

<?php _e("Options Panel","repra"); ?>

              <input type="submit" name="save" value="Save changes" class="button-primary" />         <input type="hidden" name="action" value="save" />

          <?php foreach ($options as $value) {     switch ( $value['type'] ) {     case "open":     ?>          <?php break;     case "close":     ?>
          <?php break;     case "title":     ?>              <div class="panel option-tab" title="<?php echo $value['name']; ?>">               <?php break;     case "header":     ?>

<?php echo $value['name']; ?>

<?php echo $value['desc']; ?>

          <?php break;     case "divider":     ?>

          <?php break;     case 'text':     ?>

<?php echo $value['name']; ?>
             <input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" class="theme-input" />             <?php if($value['extras'] == "uploadbutton") { ?>Get Image<?php } ?>
<?php echo $value['desc']; ?>

          <?php break;     case 'text_small':     ?>

<?php echo $value['name']; ?>
             <input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="text" value="<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" class="theme-input text-small" />
<?php echo $value['desc']; ?>

          <?php break;     case 'dimension':     ?>

<?php echo $value['name']; ?>
             <input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="text" value="<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" class="theme-input" />px
<?php echo $value['desc']; ?>

          <?php     break;          case 'textarea':     ?>

<?php echo $value['name']; ?>
             <textarea name="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" cols="" rows="" class="theme-textarea<?php if($value['height'] == "yes") { ?> large-textarea<?php } ?>"><?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(get_settings( $value['id'] )); } else { echo $value['std']; } ?></textarea>
<?php echo $value['desc']; ?>

          <?php     break;     case 'select':     ?>

<?php echo $value['name']; ?>
             <select class="theme-select" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>"><?php foreach ($value['options'] as $option) { ?><option value="<?php echo $option; ?>" <?php if ( get_settings( $value['id'] ) == $option) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option><?php } ?></select>
<?php echo $value['desc']; ?>

          <?php     break;     case "checkbox":     ?>          <div class="option <?php if($value['extras'] == "multi") { ?>multi-checkbox<?php } ?>">
<?php echo $value['name']; ?>
         <? if(get_settings($value['id'])){ $checked = "checked=\"checked\""; }else{ $checked = ""; } ?><input class="theme-checkbox" type="checkbox" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="true" <?php echo $checked; ?> />
<?php echo $value['desc']; ?>

          <?php             break;     case "radio":     ?>

<?php echo $value['name']; ?>
               <?php foreach ($value['options'] as $key=>$option) {             $radio_setting = get_option($value['id']);             if($radio_setting != ''){                 if ($key == get_option($value['id']) ) {                     $checked = "checked=\"checked\"";                     } else {                         $checked = "";                     }             }else{                 if($key == $value['std']){                     $checked = "checked=\"checked\"";                 }else{                     $checked = "";                 }             }?>
                 <input type="radio" name="<?php echo $value['id']; ?>" id="<?php echo $value['id'] . $key; ?>" value="<?php echo $key; ?>" <?php echo $checked; ?> /><label for="<?php echo $value['id'] . $key; ?>"><?php echo $option; ?>
               <?php } ?>
<?php echo $value['desc']; ?>

          <?php             break;     case "colorpicker":     ?>

<?php echo $value['name']; ?>

                          <input type="text" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" class="cp_input" />             <div id="cp_<?php echo $value['id']; ?>" class="cp_box">               <div style="background-color:<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo '#fff'; } ?>;<?php if ( get_settings( $value['id'] ) != "") { echo 'background-image:none; border-color:' . get_settings($value['id']) . ';'; } ?>">

Click the text box for color picker.

               <?php             break;     case "import_export":     ?>              </form>

Import Theme Settings

If you have a back up of your theme settings you can import them below.
                  <form method="post" enctype="multipart/form-data">
<input type="file" name="file" id="file" />             <input type="submit" name="import" value="Upload" />
             <input type="hidden" name="action" value="import" />             </form>

Export Theme Settings

If you want to create a back up of all your theme settings click the Export button below. Note: This option only backs up your theme settings and not your post/page data.
                  <form method="post">
<input name="export" type="submit" value="Export Theme Settings" />
             <input type="hidden" name="action" value="export" />             </form>
          <?php             break;     }}     ?>

              <form method="post" onSubmit="if(confirm('Are you sure you want to reset all the theme settings?')) return true; else return false;">         <input name="reset" type="submit" value="Reset" />         <input type="hidden" name="action" value="reset" />         </form>

          <?php }           if (function_exists('wp_enqueue_style')) {         wp_enqueue_script('jquery-ui-core');         wp_enqueue_script('jquery-ui-sortable');                 wp_enqueue_script('thickbox');         wp_enqueue_style('thickbox');     }          add_action('admin_menu', 'mytheme_add_admin');           // Export Theme Settings     function export_settings() {         global $options;         header("Cache-Control: public, must-revalidate");         header("Pragma: hack");         header("Content-Type: text/plain");         header('Content-Disposition: attachment; filename="theme-options-'.date("dMy").'.dat"');         foreach ($options as $value) $theme_settings[$value['id']] = get_settings( $value['id'] );           echo serialize($theme_settings);     }          // Import Theme Settings     function import_settings() {         global $options;         if ($_FILES["file"]["error"] > 0) {             echo "Error: " . $_FILES["file"]["error"] . "
";         } else {             $rawdata = file_get_contents($_FILES["file"]["tmp_name"]);                   $theme_settings = unserialize($rawdata);                     foreach ($options as $value) {                 if ($theme_settings[$value['id']]) {                     update_option( $value['id'], $theme_settings[$value['id']] );                     $$value['id'] = $theme_settings[$value['id']];                 } else {                     if ($value['type'] == 'checkbox_multiple') $$value['id'] = array();                     else $$value['id'] = $value['std'];                 }             }              }         if (in_array('cacheStyles', get_option('theme_misc'))) cache_settings();         wp_redirect($_SERVER['PHP_SELF'].'?page=admin_options.php');     }          ?>


title: Moving existing media items to new upload path structure not updating full URL path

text: Have been developing a site and noticed that all of the media files were being saved in the default WP year/month/day rule in the `wp-content/uploads` directory. I decided to change this to `assets` and unchecked the option to store these in the date format. End goal here is to bring over all of the existing media to use that new path. I extracted all of the sub-folders into a flat list of files and then copied them over to the `assets` directory. Then, I tried editing the GUID for attachments to the new location -- still, no dice. Right now, it's referencing those old files as `assets/2012/08/01` instead of the new format. I've verified the option for storing media files in the date subdirectories is unchecked -- is this stored in a transient/cache somewhere that I can reset? I'm more than comfortable going through and running the needed SQL queries to update any post content with these in them, but a bit confused on why the URLs on the front-end are not updating to just `assets`). Thanks! _Update_ New files are being stored just in `/assets` and not the sub-date folders... really confused on these old file paths not working.


title: Displaying posts on Homepage

text:
I am wondering how to add a column to my homepage that shows the five most recent posts from the blog page located under the "Latest News" heading. Here is the link to my development site. http://pur-vent.29kdev.com/ and below is the code that I believe I must edit to achieve this. If anyone could offer any advice I would greatly appreciate it. Thanks in advance.   * Mike ` ""               <?php if ( get_option('modest_featured') == 'on' ) get_template_part('includes/featured'); ?>          <?php if ( get_option('modest_blog_style') == 'false' ){ ?>
             <?php                  $blurbs_number = get_option('modest_use_third_page') == 'on' ? 3 : 2;                 if ( get_option('modest_use_third_page') == 'on' ) $blurbs_number = 3;              ?>             <?php for ($i=1; $i <= $blurbs_number; $i++) { ?>                 <?php query_posts('page_id=' . get_pageId(html_entity_decode(get_option('modest_home_page_'.$i)))); while (have_posts()) : the_post(); ?>                     <?php                          global $more; $more = 0;                     ?>                     <div class="blurb<?php if ( $i == 3 ) echo ' last'; ?>">
<?php the_title(); ?>
                                                 <?php the_excerpt(''); ?>
                  <?php endwhile; wp_reset_query(); ?>             <?php } ?>                  <?php if ( $blurbs_number == 2 ) { ?>

<?php esc_html_e('Examples of Our Work','Modest'); ?>
                     <?php query_posts("showposts=".get_option('modest_work_number')."&cat=".get_cat_ID(get_option('modest_work_cat')));                         if (have_posts()) : while (have_posts()) : the_post(); ?>                             <?php                              $width = 56;                             $height = 56;                             $titletext = get_the_title();                                  $thumbnail = get_thumbnail($width,$height,'item-image',$titletext,$titletext,true,'Work');                             $thumb = $thumbnail["thumb"];                             $fancybox_title = get_post_meta($post->ID,'Customtitle',true) ? get_post_meta($post->ID,'Customtitle',true) : get_the_title(); ?>
                                 <a rel="gallery" title="<?php echo esc_attr($fancybox_title); ?>" href="<?php echo esc_attr($thumbnail['fullpath']); ?>" class="fancybox">                                     <?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, 'item-image'); ?>
                           <?php                          endwhile; endif;                      wp_reset_query(); ?>
              <?php } ?>
      <?php } else { ?>
             <?php get_template_part('includes/entry','home'); ?>
           <?php get_sidebar(); ?>     <?php } ?>      `


title: Where to put snarfer.php?

text: I followed these instructions: http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates My understanding of those instructions was that the file snarfer.php needed to be in the folder 'themes', so it appears in the same list as the following folders and file: twentyeleven (folder) twentyeleven-child (folder) twentyten (folder) index.php …but when I put it there, and went to create a Page, the new template didn't appear as an option in the list Default Template / Showcase Template / Sidebar Template. So I tried putting snarfer.php in the folder 'twentyeleven-child' -- which is the active theme. And the new template now appears in the Template list when I create a Page. Do I have snarfer.php in the right place?


title: add_query_vars and canonical links

text: I have two pages, one called cities and the other called states. They use the add_query_vars function to grab the city and or state from a database. The pages load fine. For example when someone goes to sitename.com/roller- derbies/arizona/florence/ and the events in that city display. But when I view the page source and look at the canonical link inserted in wp-head it says sitename.com/cities or sitename.com/states after the page name. This creates a problem where none of my pages are being indexed by google as they all point to canonical link for cities or states. What can I do so the canonical link matches the url? Below is the code I am using.               add_filter('query_vars', 'add_query_vars');     function add_query_vars($aVars) {         $aVars[] .= 'var_state';         $aVars[] .= 'var_city';         return $aVars;     }          add_filter('rewrite_rules_array', 'add_rewrite_rules');     function add_rewrite_rules($aRules) {         $aNewRules = array(         'roller-derbies/([^/]+)/?$' => 'index.php?pagename=states&var_state=$matches[1]',          'roller-derbies/([^/]+)/([^/]+)/?$' => 'index.php?pagename=cities&var_state=$matches[1]&var_city=$matches[2]',          $aRules = $aNewRules + $aRules;         return $aRules;     }


title: Attaching images to multiple galleries

text: I've been wondering about this image/gallery issue for ages. So, I've got some images: lifestyle1.jpg, lifestyle2.jpg, lifestyle3.jpg, lifestyle4.jpg, kids1.jpg, kids2.jpg, kids3.jpg, outdoors1.jpg, outdoors2.jpg, etc.... I want to have three galleries:   1. **Homepage** —a mixture of all photos   2. **Lifestyle** —just lifestyle   3. **Outdoors** — just outdoors   4. **Kids** — just kids I can obviously make a page called Lifestyle, attach the lifestyles images and I'm all set with my Lifestyle gallery. How do I make my Homepage gallery a mixture of all pictures? ie: **Homepage** - lifestyle1.jpg, lifestyle2.jpg, kids2.jpg, outdoors1.jpg When all these photos are already in the media library. It seems so basic, yet I can't see a way to do it besides re-attaching and re-uploading the same images again. Thanks!


title: Use meta box value in CPT as post title

text: This has been addressed in another post, but the solution was too specific to apply here. My goal is to use a metabox value (ecpt_name) as the post title so that the user only needs to input their name once, and the name appears in both the admin post listing and online. As it is now, I require the user to input the post title as the full name AND in a metabox. This allows me to display the fullname online and show the fullname in the admin post listing, but it's double the work. Looking for something to put into functions.php that hooks the ecpt_name metabox value and places it into the post_title name. thx - Steve


title: Having a lot of difficulty getting add_editor_style() to load into source code

text: I have tried many different things to get `add_editor_style()` to load into the source code on my site without any luck. I would like to use `editor- style.css` to customize CSS properties for my WordPress WYSIWYG. However, I am unable to get it working. Even when I look in Chrome Inspector's Resources tab and scroll down to "Stylesheets" I don't see any listing of `editor-style.css` Here's what I tried so far:   1. Placed `editor-style.css` in the root of my theme directory   2. `<?php add_editor_style(); ?>` is placed in my `functions.php` file for my theme (I've even moved around this function call to editor style in my `functions.php` to see if that would do the trick … no luck.   3. All of my CSS and JavaScripts are registered and enqueued in my functions.php file Is there some type of override going on that I am not aware of?


title: variables in translatable text

text: I am adding a list of suggested plugins to my theme using TGM Plugin Activation - https://github.com/thomasgriffin/TGM-Plugin-Activation/ However, when I run theme check, about 40 or so recommendations popped up because the plugin uses variables in translatable functions. I was able to remove about half of the problems by typing in my text domain instead of using the variable used by the plugin author. However, I need help rectifying the error below: > RECOMMENDED: Possible variable $instance found in translation function in > class- tgm-plugin-activation.php. Translation function calls must NOT > contain PHP variables. Here's the code associated with the error:               $table_data[$i]['source'] = __( 'External Link', TGM_Plugin_Activation::$instance->domain );      I know that translation functions should look something like __('Item Name', 'text-domain'), but I am not sure what to do with the second part of the function:               TGM_Plugin_Activation::$instance->domain      How can I adjust this so that it will work properly with translations?


title: Dashboard widget custom positioning?

text: I cannot figure out how to arrange my custom widgets one left and one right. I'm using this code to create custom widgets:               //Add my comments. Shows user his last 5 comments     function dashboard_user_comments_widget_function() {         echo 'beh!';     }          function dashboard_user_add_comments_widget_function() {          wp_add_dashboard_widget('my_comments_user_dashboard_widget', 'My comments', 'dashboard_user_comments_widget_function');     }     add_action('wp_dashboard_setup', 'dashboard_user_add_comments_widget_function');      Is there a way to pass a left/right variable into this function? I read the codex page for it and the way they explain doing positioning is quite complicated, I don't know how to incorporate it.


title: Need to do blank search.

text: When there is no value for parameter "s" , it redirects automatically to homepage. Instead of this , I want to show all the information from my custom sql query. how can i do this??


title: Loop to display random posts only if a  custom field matches category

text: Working on a website and need loop that will show posts ONLY if custom field value is equal to the current category name. I have category 'fun' and custom field 'genre'. I would like to show on custom archive page only posts that are selected to be under category 'fun' AND at the same time if the value in custom field 'genre' is 'fun'. Order I prefer is most visited posts first at the top - if possible.


title: Custom field image to Featured Image

text: I'm changing the theme of a blog. The problem is when I export the content from the old post and import it into the new one, I don't get the Featured Image. It's the same problem posted here: Move from old custom field to new post_thumbnails Only that I couldn't get that solution to work for me… I'm kind of a noob. The original blog uses a meta key of "mainimg_medium" for the "featured image", and the new blog uses "_thumbnail_id". Any help would be greatly appreciated, Thanks!


title: Auto creation of multisite blog on user registration

text: I'm looking for a way to have users register on a multisite setup and have a blog automatically created for them... no, not the way the standard ms registration system handles it. I want to get rid of the second step in the process completely. They register as 'user', and a blog is automatically created at http://my.site.com/user for them. Followup question... anyone know of a way of automatically pruning the multisite platform? IE, users who don't login for 'x' timeframe (or after a certain time period has elapsed) automatically have their site deleted.


title: SEO meta description and title tag Yoast SEO

text: I am using Yoast SEO and a custom header. this obv means that any code that yoast uses to input all the seo stuff such as title tag and meta description wont be there. I solved the title tag by using this code:               <title><?php         /*          * Print the <title> tag based on what is being viewed.          */         global $page, $paged;              wp_title( '|', true, 'right' );              // Add the blog name.         bloginfo( 'name' );              // Add the blog description for the home/front page.         $site_description = get_bloginfo( 'description', 'display' );         if ( $site_description && ( is_home() || is_front_page() ) )             echo " | $site_description";              // Add a page number if necessary:         if ( $paged >= 2 || $page >= 2 )             echo ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) );              ?></title>      and that seems to work. however, how do i get the meta descriptions to work and anything else I may need?


title: Mass check a certain box in an option panel for 3000+ WooCommerce products?

text: I am using WooCommerce and have 3000+ products. With WooCommerce, there is an option to enable/disable reviews for each product. The box looks like this on my edit product page: ![snapshot](http://i.stack.imgur.com/dU1xo.jpg) Unfortunately, the checkbox (highlighted in red) doesn't come checked by default. I have contacted WooCommerce about this and they told me that this box being checked depends on whether or not I have comments enabled in _Settings > Discussion_. However, comments are, and have always been enabled, yet none of my products have the reviews option checked by default. This is a huge burden because this would potentially mean that I would have to browse through each of the 3000+ products and check off the box manually. Is another way I can "mass check" these boxes for each of my products?


title: Disable edit option in Media library

text: Hovering my mouse over a file name or a thumbnail brings up the Edit option, I want to know is there any hook to disable all edit links in Media library on Multisite ![enter image description here](http://i.stack.imgur.com/TqkR1.jpg)


title: Creating a widget that displays the content of a page

text: I have a page that displays information from a query (I placed the output of the query in a custom page template and have the information display that way). How can I put this information into a sidebar widget? Do I need to pull it from the page, or is there a widget that allows you to put a dynamic query inside? Thanks.


title: If is_single in functions.php

text: I want the remove wpautop filter working only on posts from my blog. Because at some pages i need the autop, and at some pages i need it to not be there. I use the following rule and it is in my theme's functions.php:               remove_filter( 'the_content', 'wpautop' );      Because I only want it on blogposts I was thinking about an if statement, I searched the conditional tags page in Wordpress and found out I can use is_single . But it doesn't work. This is the code I use now.               if(is_single() ){          remove_filter( 'the_content', 'wpautop' );     }      It is still wraped by an p. And even if it would have worked, there is an other problem. That is that is_single effects ALL singles from post types. And I only want the single of a blog post(posts). Anyone know how to fix it?


title: Automatically add <!--nextpage--> after X number of paragraphs

text: Is it possible to automatically add the `<!--nextpage-->` quicktag after X number of paragraphs? My client isn't exactly tech savvy so I'm trying to find a way to help them break up their enormous pages without them having to come back to me time and time again asking how to do it.


title: what is name of this plugin used for photo gallery page

text: i need to now what is name of this plugin that's used for image gallery page in this site


title: What's the best user registration library to integrate WordPress?

text: I'm looking for a library that can handle user registration (name, address, e-mail etc.) into my existing WordPress website. What options exist today, or will I have to pull my own?


title: remove tags from posts in php

text: I feel like this should be a simple question, but I can't figure it out. If I have a post_id, how can I remove a particular tag from that post in php?? I know how to update meta information, but tag information is different.


title: call widget from within shortcode

text: I have a shortcode in my functions.php which runs a query on a category. I want to have a twitter feed on this particular page. I have a javscript option working on my page for twitter right now but it doesn't look good and will take way to long to edit the javascript ( in minified format ) to make it look good, so I thought I would use a plugin. I installed one and it looks good but I need to call it in a very specific spot within the shortocode. I noticed as is, it calls the widget at the top of my page from within the shortcode which breaks the layout. I did some reading and it looks like using the_widget() would allow me to call it where I want and it did put text in the right spot. Problem was instead of putting my tweets, it put an error message. I figured that If I use the_widget with the classname of the widget as shown on this page that it would work                http://codex.wordpress.org/Function_Reference/the_widget      for example. The twitter widget I downloaded is called "simple twitter tweets" and I figured that I could do                the_widget('PI_SimpleTwitterTweets');      and it would work. I was wrong. `PI_SimpleTwitterTweets` is the classname of the widget. Am I on the right track and just missing something?


title: how to get list of post formats supported by theme?

text: After adding support for a selection of post formats like this:               add_theme_support( 'post-formats', array( 'aside', 'video' ) );      how can I then get the list of supported post formats back? I'm building a theme where the user can toggle support for postformat, and I want other admin elements to reflect what post formats the user has configured the theme to support. so I'm looking for something like               current_theme_supports( 'post-formats'); // outputs boolean      but that outputs just true or false, whereas I want to get an array of the post formats actually registered.. what would be the correct WordPress function to call (or constant/global var) to look at for this? I want something like this:               get_supported_post_formats(); // out: array('aside', 'video')


title: Admin area 'toggle' w/ cookie

text: the wordpress admin already uses some kind of toggle on the menu and on metaboxes.. w/ "Click to Toggle" buttons that remember the open versus closed state. Does anybody know what code is responible for this? I'd like to implement it into sections of my custom metaboxs, and it doesn't seem like I should need to add a script to the admin area (b/c it is already slow) when WP has this functionality by default.


title: Post IDs missing on delete_postmeta action hook

text: I'm using metadata in pages to store variables and do server side caching for dynamic generated PayPal buttons and other variables about the pages (page specific). I'm trying to hook the page meta data's update, add and delete functions. The update and add works fine (both with same function) but I can't figure delete out. In order to use delete_post_data I need the `post_id` but the `do_action` doesn't return that (at least what I can figure) from WordPress's source code it seems to return this:               do_action( 'delete_postmeta', $postmetaids ); //sometimes $post_meta_ids      where               $postmetaids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key ) );      or               $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid ));      The code I'm using to call the hooks:               add_action ('update_postmeta', 'wp_paypal_meta_change',1,4);     add_action ('add_postmeta', 'wp_paypal_meta_change', 1, 4);     add_action ('delete_postmeta','wp_paypal_meta_delete', 1, 2);      The delete function:               function wp_paypal_meta_delete($post_id, $meta_keys){     /*      handles cases where the user intentionally deletes the metadata, and deletes       the appropriate hidden metadata variable in order to make sure the cached       PayPal form matches the product data.      */              if ($meta_keys == 'image'){         delete_post_meta($post_id,'_thumb');         } else if ($meta_keys == 'shipping' || $meta_keys == 'cost' || $meta_keys== 'bookname'){         delete_post_meta($post_id,'_paypal');         }          }      I know the `$post_id` doesn't get into the function, but it's there because I hoped WordPress somehow references it - didn't work.


title: How can I post Facebook fan page status updates to my WordPress blog?

text: Is it possible to get an RSS feed of Facebook status updates from a Page rather than a Profile? I want to use the feed in WP's RSS feed widget. It's easy to pull statuses from a profile page. I did this using an RSS feed widget. I tried doing the same thing for a fan page, but Facebook forces me to switch contexts (from viewing as the a page to viewing as myself), after which I'm redirected to my own status feed. There is an RSS for notifications, but I want it for statuses, not notifications.


title: How to change the link "Edit my profile"?

text: I am setting up a new membership website. I only have one issue that I can't resolve. Once a member is logged I don't want them to go to the dashboard to edit their profile but instead to the website profile page. Where and how do I change this?


title: Wordpress Page Template: Comment Filtering with Querystring

text: A custom Page Template was developed in order to display a list of products. A WordPress page (/products) was created and the template was applied to it. There is a database which the template's programming accesses to retrieve product information. Different products are displayed based on a GET querystring variable, "Id" (/products?Id=1). Comments are enabled on the /products page, so when users are viewing different products, they can comment. The issue here is that the comments are common to the products page. When a user comments on the product with Id = 1, the comment is displayed on all other product pages (Id = 2, 3, etc). Optimally, we would want each product to have it's own set of comments. What's the easiest way to implement the desired functionality on the products page?


title: Insert Shortcode exactly at the end of the content

text: <?php echo do_shortcode("[sharethis]"); ?>                  <?php wp_related_posts()?>       There are 2 short codes above 1) share this plugin short code 2) related posts short code now my QUESTION first see this LINK At the ending of the post you can see the author box i want want this author box below the above mentioned plugins i tried these shortcode by keeping in single.php page but they didnt worked. **Please help me, to insert both the shortcodes exactly below the content and above author box.**


title: How do I include javascript/jquery image resizing with wordpress?

text: I wan't to include this script in my wordpress theme, making it resize all of the images inside posts according to the current window height: https://github.com/gutierrezalex/photo-resize I've made a basic test page in my text editor and it resizes the image just fine. However, when I try to apply/include it in my wordpress theme I simply can't get it to work.


title: Deregistering and registering javascript breaks plugin

text: While you can view the full file here, here's the function that enqueues the JavaScript file(s) needed by the plugin:               function ippy_bcq_add_scripts() {          $options = get_option('ippy_bcq_options');     $valuebb = $options['bbpress'];     $valueco = $options['comments'];     $ippy_bcq_bbp_fancy = get_option( '_bbp_use_wp_editor' );            if ( function_exists('is_bbpress') ) {               if ( is_bbpress()  && ( $valuebb != '0') && !is_null($valuebb) && ($ippy_bcq_bbp_fancy == '0') ) {                 wp_enqueue_script("bcq_quicktags", plugin_dir_url(__FILE__) . "quicktags.js", array("quicktags","jquery"), "1.8", 1);                 wp_enqueue_style("bcq_quicktags", plugin_dir_url(__FILE__) . "quicktags.css", false, "1.8");                 wp_print_styles('editor-buttons');             }       }       if ( comments_open() && is_singular() && ( $valueco != '0') && !is_null($valueco) ) {                         wp_enqueue_script("bcq_quicktags", plugin_dir_url(__FILE__) . "quicktags.js", array("quicktags","jquery"), "1.8", 1);                         wp_enqueue_style("bcq_quicktags", plugin_dir_url(__FILE__) . "quicktags.css", false, "1.8");                         wp_print_styles('editor-buttons');       }     }          if( !is_admin() ) {         add_action('wp_print_styles', 'ippy_bcq_add_scripts');     }      Now, as you can see, `quicktags` ($handle) is one of the dependencies (alongside jQuery) required the JavaScript enqueued by the plugin. `quicktags` represents this file: `http://example.com/wp- includes/js/quicktags.js`, and I need to have the file served from a different domain, like this for instance — `http://static-domain.com/wp- includes/js/quicktags.js`. How do I do it? I tried these two in my theme's functions.php, but they seem to break the JavaScript output by the plugin for some reason:   * **TRY - 1:**              add_action('wp_enqueue_scripts','aahan_register_script');     function aahan_register_script(){              wp_deregister_script('quicktags');         wp_register_script('quicktags', 'http://static-domain.com/wp-includes/js/quicktags.js', false, false, true);         wp_enqueue_script( 'quicktags' );          }        * **TRY - 2:**              add_action('wp_print_styles','aahan_register_script');     function aahan_register_script(){              wp_deregister_script('quicktags');         wp_register_script('quicktags', 'http://static-domain.com/wp-includes/js/quicktags.js', false, false, true);         wp_enqueue_script( 'quicktags' );          }      I also did try a few other variants, but none worked. What am I doing wrong? * * * ## More Info By default the plugin outputs code like this in the footer:               <script type='text/javascript'>     /* <![CDATA[ */     var quicktagsL10n = {"wordLookup":"Enter a word to look up:","dictionaryLookup":"Dictionary lookup","lookup":"lookup","closeAllOpenTags":"Close all open tags","closeTags":"close tags","enterURL":"Enter the URL","enterImageURL":"Enter the URL of the image","enterImageDescription":"Enter a description of the image","fullscreen":"fullscreen","toggleFullscreen":"Toggle fullscreen mode","textdirection":"text direction","toggleTextdirection":"Toggle Editor Text Direction"};     /* ]]> */     </script>     <script type='text/javascript' src='http://example.com/wp-includes/js/quicktags.js?ver=3.4.1'></script>     <script type='text/javascript' src='http://static-domain.com/wp-content/plugins/basic-comment-quicktags/quicktags.js?ver=1.8'></script>      But when I try the aforementioned functions, the output code is this (essentially broken):               <script type='text/javascript' src='http://whatthenerd.com/wp-includes/js/quicktags.js?ver=3.4.1'></script>     <script type='text/javascript' src='http://wtn-static.whatthenerd.net/wp-content/plugins/basic-comment-quicktags/quicktags.js?ver=1.8'></script>


title: Custom Post Type Archives by Date with Custom Permalink

text: I'm a bit stuck with getting the custom permalink for custom post type (CPT) archive to work. I've registered my 'press_release' CPT as following:               add_action('init', 'press_release_post_type_init');     function press_release_post_type_init() {       $labels = array(         'name' => _x('Press Releases', 'post type general name'),         'singular_name' => _x('Press Release', 'post type singular name'),         'add_new' => _x('Add New', 'Press Release'),         'add_new_item' => __('Add New Press Release'),         'edit_item' => __('Edit Press Release'),         'new_item' => __('New Press Release'),         'view_item' => __('View Press Release'),         'search_items' => __('Search Press Releases'),         'not_found' =>  __('No press release found'),         'not_found_in_trash' => __('No press release found in Trash'),          'parent_item_colon' => ''       );       $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'has_archive' => 'press-release',         'rewrite' => array('slug' => 'press-release/%year%/%postname%','with_front' => false),         'query_var' => true,         'capability_type' => 'post',         'hierarchical' => false,         'show_in_nav_menus' => false,         'menu_position' => 20,         'supports' => array(           'title',           'editor',           'author',           'revisions'         )       );       register_post_type('press_release', $args);     }      At the moment if I go to URL `http://mysite.press-release` then I get to the `archive-press_release.php` template, which is correct. However, I would like my CPT archive permalinks to be of the type `press- release/%year%` I have tried to specify the above permalink structure when registering CPT:               'has_archive' => 'press-release/%year%'      However, with that permalink structure when I go to `http://mysite.press- release` or `http://mysite.press-release/2011` in both cases I'm redirected to the `index.php` template not the archive one. What do I add to make WordPress understand that `press-release/%year%` permalink with an optional year part are actually the archive templates? I would really appreciate any help! I'm hoping it's possible to do. I was planning on constructing my own SQL in the `archive-press_release.php` to get the records of the correct year. Many thanks, Dasha


title: Hide links to pages that dont have any content

text: Its that possible?Than when something is added to page in admin panel, page link to that page appears.


title: How to enqueue scripts on custom post add/edit pages?

text: I'm trying to enqueue a JS script only when someone is adding or editing a custom post type I created called "recipes". Currently the script works ok when I do this:               if (is_admin()){         wp_enqueue_script( 'my-script' );     }      But this loads it in every admin page, I'm assuming I need to hook it to a function but I hvae no idea what it'd be. Thanks in advance!