title: Can not pass the value of google pie chart from custom meta box

text: I am trying to build a google pie chart in my wordpress site based on user input . Hence I have created custom meta box , and use wp_localize_script . Here is what I have done to pass custom metabox value to wordpress .               function pie_load_scripts() {         global $post;         $title = get_post_meta($post->ID, 'title', true);          $telecom = get_post_meta($post->ID, 'telecommunications-it', true);               $business = get_post_meta($post->ID, 'business-professional', true);          $retail = get_post_meta($post->ID, 'retail', true);          $other = get_post_meta($post->ID, 'other', true);          $media = get_post_meta($post->ID, 'media-entertainment', true);          $financial = get_post_meta($post->ID, 'financial', true);          $government = get_post_meta($post->ID, 'government', true);          $educational = get_post_meta($post->ID, 'educational', true);               wp_enqueue_script('pie-script', plugin_dir_url( __FILE__ ) . 'js/3dpiechart.js');         wp_localize_script('pie-script', 'pie_script_vars', array(                 'telecom' =>$telecom ,                 'title' =>$title ,                 'business' =>$business ,                 'retail' =>$retail ,                 'other' =>$other ,                 'media' =>$media ,                 'financial' =>$financial ,                 'government' =>$government ,                 'educational' =>$educational ,             )         );          }     add_action('wp_enqueue_scripts', 'pie_load_scripts');      Here is my Js file ,                 function drawChart() {         var data = google.visualization.arrayToDataTable([                ['Sector', 'Cost'],           ['Telecomunications & Information Technology',       pie_script_vars.telecom],           ['Business Services & Professional',                 pie_script_vars.business],           ['Retail (head office & storefront)',                pie_script_vars.retail],           ['Others',                                           pie_script_vars.other],           ['Media & Entertainment',                            pie_script_vars.media],           ['Financial Services',                               pie_script_vars.financial],           ['Government',                                       pie_script_vars.government],           ['Educational & Institutional',                      pie_script_vars.educational]                   ]);        var options = {           is3D: true,           title: pie_script_vars.title              };      The above code is the modification from google developers site (https://developers.google.com/chart/interactive/docs/gallery/piechart?hl=fr) . Here I also want to set value of the title from meta box , which works fine , but in case of pie chart value it doesn't work .


title: "edit_published_posts" and "edit_other_post" issue

text: I need to modify a roles capabilities for post editing:   * User can modify his own post (publish status doesn't matter)   * User can modify others posts (only as long as they are not published) I played around with `edit_posts` \+ `edit_other_posts` \+ `edit_published_posts` but that not work as I expected. Here a schema of what I try to do:                 Modify =>   |own post | other user post     not published |    √    |        √     published     |    √    |        X


title: Help with Wordpress Query

text: I'm sort of a noob when it comes to Wordpess; I've only recently started building themes and I've run into a wall. I'm trying to feature 3 different articles at the top of my site using wpquery and for some reason it's only displaying one. I'll include my code below and if anyone can help my figure out what's wrong I would be very grateful! Code included in pastebin: http://pastebin.com/1DB7vent I'm trying to get a setup similar to this: [div class="site_width"] [ul] [li] [a h*ref="FeaturedLink1"] [i*mg s*rc="FeaturedLink1 Featured Image] [/a] [label] [a h*ref="FeaturedLink1"] "Featured Link Title" [/a] [/label] [/li] [Repeat format for two more posts] [/ul] [/div] []'s & *'s included to prevent se from thinking I'm spamming


title: Getting attributes from custom_post input

text:
I'm having custom field created like that:               function woocommerce_form_field_numeric_2( $key, $args, $value = '' ) {     global $woocommerce;     $defaults = array(     'type' => 'number',     'label' => '',      'placeholder' => '',     'required' => false,      'class' => array( ),      'label_class' => array( ),     'return' => false,      'options' => array( )     );     $args = wp_parse_args( $args, $defaults );     if ( ( isset( $args[ 'clear' ] ) && $args[ 'clear' ] ) )     $after = '

';     else     $after = '';     $required = ( $args[ 'required' ] ) ? ' *' : '';     switch ( $args[ 'type' ] ) {     case "text":     $options = '';     if ( !empty( $args[ 'options' ] ) )     foreach ( $args[ 'options' ] as $option_key => $option_text )      $options .= '<input data="nochange" type="number" name="' . $key . '" id="' . $key . '" value="40.00" min="40" max="80" step="0.5" " ' . selected( $value, $option_key, false ) . 'class="numeric">' . "\r\n";       $field = '
     ' . $args[ 'label' ] . $required . '     ' . $options . '
' . $after;      break;      } //$args[ 'type' ]      if ( $args[ 'return' ] )      return $field;      else      echo $field;       }           woocommerce_form_field_numeric_2( 'cyl-left', array(      'type' => 'text',         'class' => array('my-field-class form-row-wide'),         'placeholder' => __('Enter something'),           'options' => array(        'cyl-left' => 'cyl-left
',           )          ), $checkout->get_value( 'cyl-left' ));              echo '
';       During the process I change the data with jquery:                       $(".numeric").on("change", function() {       $(this).attr("data","changed");       });      And now I would like to validate the custom filed, to being displayed only when `data` is set to changed. How can I achive this ? I've tried like that:                 if (get_post_meta( $order->id,'cyl right', $data != "nochange")){              echo '
'.__('CYL Oko prawe').':   ' . get_post_meta( $order->id,'cyl right', true). '
';       }      and like that                   if (get_post_meta( $order->id,'cyl right',true)){                 foreach($_POST as $key => $value) {         if($data != 'nochange'){        echo '
'.__('SPH Oko prawe').': ' . get_post_meta( $order->id,'cyl right', true). '
';         }}}      but with no expected resault, Is it possible to get `$_POST` > data value ?


title: Add Piwik Tracking code to page

text: I use piwik analytics to track the visitors to my website. I recently created a blog on WordPress and wanted to added the same tracking code that I use on the plain HTML webpage. How can I added the tracking script in the php in order to track my blog visitors? thanks!


title: Can I have the same wordpress site under different url?

text: Can I run the save a wordpress site under different domain names? Like mydomain.com and mydomain.net ? Where the domain name will NOT change in the address bar of web browser.


title: How to remove slug from more than one custom post type

text: I followed this tutorial from WordPress (http://vip.wordpress.com/documentation/remove-the-slug-from-your-custom-post- type-permalinks/) to remove slug from custom post type. Now my question is how to remove from more than one custom post type. Any help would be appreciated!


title: WordPress edit_user_profile_update update secondary role

text: I am trying to save secondary role field in user-edit.php which is independent of WP's main roles. I had no problem with saving other custom fields that are unique but for roles (wp_capabilities), it looks like it first saves my roles (I set sleep(10) to check in database in the process) and at the end of request, WP saves main role field which overwrites my previously saved role. Is there any way to order events somehow so my function executes at the very end of request? Here's what I've got so far: Hooks:               <?php     add_action( 'edit_user_profile',        array( $this, 'test_profile_form'));     add_action( 'edit_user_profile_update', array( $this, 'test_save_profile_form' ));      Callbacks:               function hook_save_profile_form($user_id) {             if(!current_user_can("edit_user",$user_id)) {                 return false;             }             $user = new WP_User($user_id);             $user->add_role($_POST['secondary-role']);             //debug             sleep(10);     }


title: PHP in CSS file?

text: so I have this in my CSS ...                 #mainnav li:after {     content: url('images/nav-divider.png');     }      obviously I need to have it link to 'bloginfo('template_directory'); /images/nav-divider.png' instead but how do I link that correctly seeing as there is PHP in it? Thanks, Josh


title: How to add multiple rewrite rules to WordPress .htaccess and delete them separately?

text: After an intense research without finding the proper answer I decided to ask my question here. I need to add some rewrite rules when activating a plugin in WordPress without existing custom rules being deleted. Example: if I add rules for plugin A, they are written into `.htaccess` (inside the WordPress block). But if I activate another plugin B which also has custom rewrite rules, then the rules of plugin A are overwritten by the rules of plugin B. How I add the rules:               register_activation_hook(__FILE__, 'activatemyplugin');          function activatemyplugin() {        add_rewrite_rule('pdf/([^/]*)$', plugins_url('pdfexport') . '/out/$1', 'top');        flush_rewrite_rules();     }      On deactivation of A or B, all custom rules (of A and B) are removed (replaced by default rules).               function deactivatemyplugin() {         flush_rewrite_rules();     }      How can I add and delete specific rewrite rules, so that previously added rules remain? Every help is appreciated. Thanks in advance.


title: How to get 1 or 2 specific posts on top of my wordpress blog?

text: Does anyone know how to get 1 or 2 specific posts on top of my wordpress blog all the time? I mean just like in a forum where you can sticky a post so they are always on top of the other posts. Is this maybe a simple line of code (i am not realy a coder) or does anyone knows a good plugin for this? Any help would be realy appreciated.


title: echo get_post_meta of all post in a category to fill up a select field

text: I want to retrieve a specific post_meta of all posts contained in a specific category. I want to build a search form at the top of each category with a select field which would be filled up by the required post_meta of all the post contained in the category the user is currently in. Is this doable? Maybe it's possible with a loop which would look like: `For each post_meta called "City" in all posts contained in category 'X', you must put it in <option value="City's name">City's name</option>` So far, here is what I have been able to do.               <select>     <option value="" selected="selected">Please pick a city below...</option>     <option value="<?php echo get_post_meta($post->ID, 'City', true) ?>">     <?php echo get_post_meta($post->ID, 'City', true) ?>     </option>     </select>      Not much, I know. Any help, please ? Thank you in advance.


title: Where's the redirect happening?

text: I've inherited a Wordpress site. Have a ton of PHP experience but only moderate Wordpress experience. Currently the URL: http://iridescentlearning.org/technovation Redirects to another page. My client wants that redirection changed. But I can't figure out where that redirection is happening. The .htaccess file has this...               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress     RewriteEngine on     <IfModule mod_suphp.c>         suPHP_ConfigPath /home/ab6700/public_html/php.ini         <Files php.ini>             order allow,deny             deny from all         </Files>     </IfModule>      ...which doesn't look to me like it does anything. I've looked through all the Settings and can't see anything that has to do with redirection. And the page it's redirecting to, I can't find anything there that suggests that the page should go to it. I do see one plugin called "Better Anchor Links" but it's been deactivated. So where is this redirection happening from?


title: Add user managable titles to custom menus?

text:
I am looking for a way to include a user managable title in a menu. Ideally, it will take the place of the first `<li>` object in the output. Any ideas? * * * **Edit** _Clarification_ I am looking for a way to add a header to a menu list, defined by the given name of the menu in the admin panel. So, the code should look a little like this:

 Menu Name

Link

Link

Link

Link

      * * * **Edit** _Further Development_ I have a code block for extracting the name of a menu, based on it's location in a theme, but I can't quite get the HTML layout I want (i.e. add the title to the first `<li>`).               function mf_get_menu_name($location){         if(!has_nav_menu($location)) return false;         $menus = get_nav_menu_locations();         $menu_title = wp_get_nav_menu_object($menus[$location])->name;         return $menu_title;     }


title: Hyperlinking images on posts to permalink

text: i have this site with only one image in each post.. how do you turn the posted image to hyperlink to the permalink? Most images are from an external source and is just automatically embedded on each post using a plugin that I use. There are a lot of posts on my site already and it's next to impossible to manually edit each post to link the each image to the post's permalink.. I checked the index.php of my site.. I saw a line for "the content" and when I added an "a href" to it linking to the permalink, it just doesn't work, im not sure why.. please help. thanks!


title: I want to create a drag and drop image collection in wordpress custom post

text: In my wordpress add new property (custom post type) page I want a small area where i can add multiple images with standard uploader and then drag and drop to reorder them and then show them on front end. I have seen this kind of functionality working in visual composer for wordpress (check live demo on their website) See this image in which visual compose creates gallery http://snag.gy/QuPjb.jpg In that popup we can add/delete images and drop down to reorder them and its using the standard image uploader of wordpress. I want that funcitnality in my website's custom post type, please guide me how can I create it. I have all of its code but I don't know where to start.


title: Working on fixing wp-front-end-editor, encountering undefined index

text: Scribu's Frond-End Editor plugin is brilliant, but throws some Strict errors in debug mode. Since I'm using the plugin on a project, I figured I'd fix the errors. (You can see my changes from the original on my Github). I managed to fix the strict errors (they were all about methods not matching their parents), but my changes resulted in the following error: `Notice: Undefined index: after_widget in \wp-content\front-end- editor\php\fields\widget.php on line 25` and I can't for the life of me figure out why. You're welcome to peruse the code on Github, but I'll reproduce the offending method below:               function wrap( $content, $data = null, $params = null ) {         if ( !$this->check() )             return $params;              $p =& $params[0];              // Text widgets are handled differently         if ( 0 === strpos( $p['widget_id'], 'text-' ) )             return $params;              $wrap = parent::wrap( '', '', array( 'widget_id' => $p['widget_id'], 'sidebar_id' => $p['id'] ) );              list( $before, $after ) = scbUtil::split_at( '</', $wrap );              $p['before_widget'] = $p['before_widget'] . $before;         $p['after_widget'] = $after . $p['after_widget'];              return $params;     }      The thing that confuses me about this is that doing a `var_dump` on `$p` shows that the `'after_widget'` index _is_ defined. Also, commenting out _either_ of the `$p[]` declarations results in the error disappearing. Hopefully we can get this resolved and submit the pull request. (Feel free to download and test my changes from Github, too; I haven't done too much testing yet.)


title: Widget for Sitewide Editable Content?

text:
> **Possible Duplicate:**   >  Add New Footer Widget Area with Limited Options? I have a banner and a footer that I need to be editable, but I'm not sure if a widget is the best way to accomplish this. It's going to be basic text or an unordered list. As an example I included some code below:

line one

line two

line three

      How would I be able to edit the text "line one" "line two" and "line three" so that it's editable and it will change across the whole website?


title: Embed 'New Post' Form Inside 'New Post' Form

text: Is it possible to embed a 'New Post' form for one Custom Post Type inside of a 'New Post' form for another Custom Post Type? When a user adds a new post for the custom type 'Event', they should also be able to add a new post for the custom type 'Session' without leaving the 'New Event' page. The user should also be able to add tags for the 'Session' post only. This is almost the same as adding a custom metabox for the 'Event' post type, with the only exception being that the Event's 'Session' data should be saved as a post rather than as a term.


title: Merging Wordpress posts from different databases

text: I have development and production versions of my website (on the same hosting). I want to easily synchronize the content between these versions. On the production website, content is updated daily. I cannot use the XML export function because duplicate posts would be created on the development website. Currently both websites uses different databases, but if there is a solution that allows for usage of only one database I gladly will go through it.


title: Changing old email to new email, lost the password

text: Help! I have been accepted to write a blog for our local newspaper, The Rolla Daily News, in Rolla, MO. I cannot access my wordpress.com blog. We moved from a rental house in the country to a new house inside the city limits of Rolla, and that meant having to get a new email address. I also cannot remember my password, and as the old email address has been shut down, wordpress can't send me my password via email. Should I cancel my blog and restart up a new one? Thanks for your help.


title: Add X meta box inputs based on form at top of meta box, how to do it right?

text:
I am setting up a meta box that controls the number of ingredients for a recipe. As each recipe will have a different number of ingredients I decided to use a simple text input and button to set the number of ingredients and have jQuery dynamically add the inputs for that "X" number. I know I need to use jQuery form but am unsure of how to return the html into the meta box correctly. I have a response div set up but not sure how to handle the html. Can i pass the value from the text input into a php function that uses a for loop to print out all the inputs for the ingredients? Or do I need to print all of the html with jQuery? Hope that makes sense. Thanks! my jQuery that works:                   jQuery('#add-ingredients').click(function(event){             event.preventDefault();                                                     var num = jQuery('input:text[name=_num_ingredients]').val();                  var sections = '';             for(var i=1;i<=num;i++){                      section = '
\n';                 section += '
\n';                     section += 'Amount: \n';                     section += '<input type="text" name="_ingredient_amount_' + i + '" /> \n';                 section += '
\n';                 section += '
\n';                     section += 'Measurement: \n';                     section += '<input type="text" name="_ingredient_measurement_' + i + '" /> \n';                 section += '
\n';                 section += '
\n';                     section += 'Ingredient: \n';                     section += '<input type="text" name="_ingredient_name_' + i + '" /> \n';                 section += '
\n';                 section += '

\n';                 section += '
\n';                      sections += section;             }//end for                  //add the new input sections             jQuery('#ingredients').html(sections);             //show the ingredients inputs             jQuery('#ingredients').show('slow');                  return false;                });      But now I can't figure out how to save the meta data correctly. Here's my for loop:                   //loop through all ingredients and update them accordingly         for($i=1; $i<=$num; $i++):                  $amt = '_ingredient_amount_'.$i;             $meas = '_ingredient_measurement_'.$i;             $name = '_ingredient_name_'.$i;                  //set ingredients array for each iteration             $post_meta['_ingredient_amount_'.$i] = $_POST['_ingredient_amount_'.$i];             $post_meta["{$meas}"] = $_POST["{$meas}"];             $post_meta[$name] = $_POST[$name];                  //update meta data             foreach( $post_meta as $key => $value ):                 if( $value ):                     if( get_post_meta( $post_id, $key, FALSE) ): // If the custom field already has a value                         update_post_meta( $post_id, $key, $value );                             else: // If the custom field doesn't have a value                         add_post_meta( $post_id, $key, $value );                     endif;                 else:                     //delete_post_meta( $post_id, $key ); // Delete if blank                 endif;               endforeach;               endfor;      I know I am missing something in the syntax to get the $_POST values. Any ideas? EDIT------------------------------- I was failing to pass the $post variable into my function - silly me. Now it all works correctly. Thanks for all your help!


title: JQuery prepend a function

text: I am trying to see where I went wrong with this code. I was trying to prepend the avatar and user meta above the admin menu. I get header already sent messages as well since the code is just right under the body tag.               function profile_script() {     echo '<script type="text/javascript">     /* <![CDATA[ */     (function($) {         $("#adminmenu").prepend($menuprofile);     })(jQuery);     /* ]]> */     </script>';     }     add_action( "admin_footer", 'profile_script' );


title: How to build a fool proof AdSense revenue sharing model?

text: I have 5 author levels in my WordPress site. Levels are calculated using points                - level 1      - level 2      - level 3      - level 4      - level 5      Authors getting impressions based on author levels like this.                - Level l => 50%      - Level 2 => 55%      - Level 3 => 60%      - Level 4 => 65%      - Level 5 => 70%      As of now I'm using code like this..               $random_number = mt_rand(1,100);     if ($author == 'level1' && $random_number < 50) {         $adsenseid = 'author adsense id';     } elseif ($author == 'level2' && $random_number < 55) {         $adsenseid = 'author adsense id';     } elseif ($author == 'level3' && $random_number < 60) {         $adsenseid = 'author adsense id';     } elseif ($author == 'level4' && $random_number < 65) {         $adsenseid = 'author adsense id';     } elseif ($author == 'level5' && $random_number < 70) {         $adsenseid = 'author adsense id';     } else {         $adsenseid = 'admin adsense id';     }      The above code depends on random number. So I think it's not fool proof way. Can someone help me to do it in a perfect way? Maybe using `usermeta` table.


title: Combining RSS Feeds and Sorting with fetch_feed

text: I'm trying to create a feed of the most recent 10 posts from 5 different feeds all combined into one list. I found a way to combine the feeds but have not been able to easily limit them to 10 and sort them by date. Can someone point me in the right direction? Thanks!!!               <ul>     <?php $rsslist = array(     'http://www.nrel.gov/news/press/rss/rss.xml',     'http://www.pewenvironment.org/rss/campaigns-8589935316',     'http://www.ashrae.org/RssFeeds/ashrae.xml',     'http://www.districtenergy.org/blog/category/idea-activity/feed/',     'http://www.districtenergy.org/blog/category/industry-news/feed/'      );          $feedlist = array();     foreach ( $rsslist as $rssurl ) $feedlist []= fetch_feed( $rssurl ); /* store in feed array for later access */          $current_item_cycle = 0;     while ( sizeof($feedlist) ) { /* while feedlist is not empty */               foreach ( $feedlist as $index => $feed ) { /* cycle through each feed */                  if (!$item = $feed->get_item($current_item_cycle++)) unset($feedlist[$index]); /* if feed has not more items unset */                  else /* echo it out */ { ?>                 <li>                 <?php echo $item->get_date('j F Y | g:i a') . $item->get_permalink(); ?>                 </li>             <?php }         }     } ?>     </ul>


title: What is the proper way to add a required field to a post type?

text: So I created a CPT that has a few required fields in a metabox. My metadata is being saved through the save_post hook but from I can find via my googlefu there is no way to stop the saving of the post from this hook. Currently I'm stopping the submission of the form using javascript but I would also like to have a server side solution for this. I guess I have a few questions:   1. Why was Wordpress developed so you can't stop the post submission?   2. What is the accepted way to do this?


title: Wordpress not displaying themes in the wp-content/themes folder

text: I'll do my best to explain this but its weird to say the least. So the two default themes (twenty ten and twenty eleven) appear under the Appearance>Themes tab in the wp admin. However, if I add one new theme to wp-content/themes (even if its just an empty folder) all of the themes fail to show up on the Appearance>themes tab, except for the theme currently in use. Anyone have any ideas? \--This is on a LAMP server (Ubuntu 12.04).


title: Check IF single OR multiple custom data has been entered

text:
I'm building a single template right now for a custom post type. I'm wondering if there is a way to check if either at least one or multiple of the custom values has been entered so I can display the div accordingly. Basically, I want to display the div it has anything filled out, if it is left blank then don't show it. Is this possible? Here is a sample snippet I have:               <?php IF STAEMENT HERE ?>

             <?php if(get_post_meta($post->ID, 'sermon_video', true)) { ?>
<a href=" <?php echo $post_meta_data['sermon_video'][0]; ?>">Video
             <?php } ?>             <?php if(get_post_meta($post->ID, 'sermon_audio', true)) { ?>
<a href=" <?php echo $post_meta_data['sermon_audio'][0]; ?>">Audio
             <?php } ?>             <?php if(get_post_meta($post->ID, 'sermon_document', true)) { ?>
<a href=" <?php echo $post_meta_data['sermon_document'][0]; ?>">PDF
             <?php } ?>

     <?php ENDIF ?>


title: display posts with same taxonomy term

text:
I'm trying to display 5 related posts in the loop, those related posts being posts that share the same taxonomy value. e.g. I have a custom taxonomy set up called `venues` thus each post has a `venue` taxonomy value assigned to it, so in each post I want to display 5 others posts that share the same taxonomy value (i.e. are at the same venue).   The code I have so far doesn't work quite right:               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <?php     $custom_terms = get_terms('venues');          foreach($custom_terms as $custom_term) {         wp_reset_query();         $args = array('post_type' => 'listings',         'posts_per_page' => 5,             'tax_query' => array(                 array(                     'taxonomy' => 'venues',                     'field' => 'slug',                     'terms' => $custom_term->slug,                 ),             ),          );               $loop = new WP_Query($args);          if($loop->have_posts()) {                  while($loop->have_posts()) : $loop->the_post(); ?>
<?php the_title(); ?>
                  <?php endwhile;          }     }     ?>     <?php wp_reset_query(); ?>     <?php endwhile; endif; ?>      It is successfully showing 5 posts, but they are just five posts from the same post type and not 5 posts that share the same taxonomy value in the loop. Any suggestions would be greatly appreciated!


title: Link posts to pages for breadcrumbs

text: Is there a way of linking custom post types to pages. I am looking to create breadcrumbs for the posts. The posts are summarised on individual pages e.g. golf, tennis, football etc.. So the Breadcrumb Structure inside the post will be: Home / Tennis / "Post Title" When clicking on Tennis - it should lead to the Tennis page I have created which summarises all tennis events.


title: List users by sum of all their posts' custom field values

text:
So I can do this by user, individually, but I can't figure out how to put it in a foreach loop. What I want to do is output something like this: Author, Miles Where miles is the sum of every single post that contains the custom field miles, associated with that author. And then list them from greatest to least. My code to do this when the user is viewing their own mileage looks like this:                   <?php             //get current user             global $current_user;             get_currentuserinfo();             // build query of ids by user             $userPosts = get_posts(array('author' => $current_user->ID, 'post_type'=> 'miles')); //change this             // loop to create array of ids by user             foreach ($userPosts as $post) {                 setup_postdata($post);                 $ids[] = get_the_ID();             }             $idList = implode(",", $ids); //tun this crap into a list                  $meta_key = 'miles';//set this to your custom field meta key             $allmiles = $wpdb->get_col($wpdb->prepare("                                               SELECT meta_value                                                FROM $wpdb->postmeta                                                WHERE meta_key = %s                                                AND post_id in (" . $idList . ")", $meta_key));             echo '
You\'ve completed ' . array_sum( $allmiles) . '
';  ?>      I'm not sure how to replicate this, so it happens for each author, in a list format... thoughts??


title: Retrieving Meta from Image Attachment

text: I currently have added a meta box to the media library popup using the following:               // ADD CUSTOM INFO INSIDE THE MEDIA LIBRARY     function AddLibraryFields( $form_fields, $post ) {              $Added_META=get_post_meta($post->ID);               // SPEED INPUT         $Speed=$Added_META['Speed'][0];              $NEW_form_fields['Speed']=array(            'value' => $Speed ? $Speed : '',             'input' => 'html',             'label' => __('Speed'),         'html' => "<input name='attachments[{$post->ID}][Speed]' value='" . $Added_META['Speed'][0] . "' />");             return array_merge( $form_fields, $NEW_form_fields );     };           add_filter( 'attachment_fields_to_edit', 'AddLibraryFields', 10, 2 );      I then save the information in the new fields using:               // SAVE CUSTOM MEDIA LIBRARY FIELDS     function MediaLibrarySave($attachment_id){         // SAVE SPEED         $Speed=$_REQUEST['attachments'][$attachment_id]['Speed'];         if(isset($Speed))update_post_meta($attachment_id, 'Speed', $Speed);     };           add_action( 'edit_attachment', 'MediaLibrarySave' );      All of this seems pretty straightforward, but I'm still really new to this. The above seems to work great, save the info when changed and is specific to each image. Now, I need to be able to access the information inside the SPEED meta field I added, when the user inserts it into the post (I'm assuming this would be the best place to piece it up and convert it into a data-attribute to feed to a jquery plugin?) Here's the function I currently have, but I can't seem to echo the speed meta?               function InsertToPost( $html, $attachment_id, $attachment){         $attachment = get_post_meta($attachment_id, 'Speed');              // WOULD USE THE SPEED SETTING HERE TO CONSTRUCT A NEW <IMG STRING WITH DATA-SPEED         // OR SOMETHING SIMILAR....                  return $html;     };           add_filter('media_send_to_editor', 'InsertToPost', 10, 3);      Basically, I'm wanting to add multiple meta fields to the media library editor so that I'm able to tag each image (like you would with jQuery.data()) and then later retrieve that information and alter it into a single data-attribute for use inside my plugin. data-plugin='{ "speed" : 500 }' Hopefully I'm going about this the right way with the media_send_to_editor hook, but I just can't manage to retrieve the attachment meta from there....


title: Widget options get

text: How to get widget options? I've tried like this, like seen in the other question "Using widget options outside of the widget":               $w=get_option('widget_wp_mywidget');         $one=$w[2]["myval"];         $two=$w[2]["myotherval"];      But I am not quite sure why this [2] is dynamic and i can't rely on it, so how to get exact values of the array the right way?


title: Update wp-config.php and lost pages

text: I recently made a small change to my `wp-config.php` by adding a memory limit line on a local version that didn't have the correct db settings. When I uploaded it, the db connection obviously broke. After I corrected the db settings and re-uploaded the `wp-config.php`, I was greeted with the installation page. Now all my links are broken, even after refreshing the permalinks. However, all the data is still in my db. How do I reconnect all my pages to the db so that I don't loose any settings?


title: Nice URLs for a Custom Post Type List with a Shared Custom Taxonomy?

text: _( **Moderator's note:** Title was "Convert into nice URL a shared custom taxonomy URL with a query string value")_ I have a custom taxonomy template: `taxonomy-country.php` used by two (2) Custom Post Types: `'event'` and `'contact'`. I would like to set up pages to display, for example:   * _"All Costa Rica Contacts"_ , and    * _"All United States Events"_ These URLs current give me those lists:   * http://mytestsite.com/country/costa-rica?post_type=contact   * http://mytestsite.com/country/united-states?post_type=event But I would like to implement those URLs as nice URLs like this:   * http://mytestsite.com/country/costa-rica/contacts/   * http://mytestsite.com/country/united-states/events/ Or even better, something like:   * http://mytestsite.com/contacts/country/costa-rica/   * http://mytestsite.com/events/country/united-states/


title: Absolutely print script in footer

text: I am looking for a solution to printing a Javascript include in the footer of WordPress front-end, and I know there are options for this. However, what would allow me to do so with these in mind:   * Will print in footer no matter what theme is used.   * Cannot be overwritten   * Cannot be removed/filtered    * Will work on versions 3.0-3.8+ This will be done by a plugin. Looking forward to your suggestions. Thank you * * * I understand how this need would come off as unfriendly, but this is something that will be placed on limited hosted wordpress installs and is a condition that is agreed to. So this is a legitimate need to prevent removal.


title: How to move featured image to the top of the list?

text: I have been working on using featured image to create a list of items on the right column here: http://www.julianamaeberger.com/soma/news/ The current featured image is now being given a class of "highlighted" so that you can tell which image is related to the post. I now need to move that li class="highlighted" to the top of the list so that it's always visible. Is jquery sortable the best option here? Thanks for any help in the right direction.


title: Bootsrtap carousel for content slider

text:
Below is the code for content slider using Bootstrap carousel. The problem is that it is only displaying one post from the featured category. I realize that is because of the way I have it offset. I have it offset like that because otherwise it overlaps the 1st post overtop of the 2nd post (on every other slide). How can I make this display correctly?

         <?php             $featured_query = new WP_Query(array('category_name' => 'featured', 'post_per_page' => 2, 'offset' => 0));             if ($featured_query->have_posts()) :         ?>
             <?php                  while ($featured_query->have_posts()) : $featured_query->the_post();             ?>

<?php the_title(); ?>

<?php the_excerpt(); ?>

Sign up today

             <?php wp_reset_postdata(); ?>
                  <?php endwhile; ?>
          <?php endif; ?>          <?php             $featured_query2 = new WP_Query(array('category_name' => 'featured', 'post_per_page' => 1, 'offset' => 1));             if ($featured_query2->have_posts()) :         ?>
             <?php                  while ($featured_query2->have_posts()) : $featured_query2->the_post();             ?>           <img data-src="<?php  ?>" alt="Second slide">

<?php the_title(); ?>

<?php the_excerpt(); ?>

Learn more

              <?php wp_reset_postdata(); ?>
                 <?php endwhile; ?>
         <?php endif; ?>


title: Remove title attribute from images

text: I'm looking for a way to remove the _title_ attribute from images, preferably through using a hook or a filter. Most clients don't bother giving images a proper title, thus eliminating the purpose of this attribute. I prefer no tooltips to random, non-descriptive ones.


title: Homepage not loading, all other pages loading

text: I've made a small website using WordPress. I've been facing a problem since quite long - my homepage is either extremely slow to load, or doesn't load at all. But all other pages of my website load at a decent speed. I tried contacting my hosting services provider (GoDaddy), but they replied that the home page resolves correctly without any errors on their side. I tried disabling plugins too, but no help. I don't know where else to look, I'm not much of a pro. My website: DoubleRoot


title: Fatal error: Call to a member function query() on a non-object 3.6.1

text: I am using function query() and get_results in my plugin code but, it gives me this error: "Fatal error: Call to a member function query() on a non-object". I have this lines of code:               class Dynamic_form {              function product_category(){             global $wpdb;             $TablePressData = $wpdb->query(                     "                         SELECT post_title                         FROM $wpdb->posts                         WHERE post_type = 'tablepress_table'                     "                 );             return print_r($TablePressData);         }     }      I am using version 3.6.1 (My client already using the version so I'm afraid of updating it).


title: Profile picture in registration form WordPress

text: I have custom built registration form and i want an option were in a user can upload and display his/her image as a profile picture. Now once a user is registered and have uploaded the profile image then in that case if the user comment on a blog post on the same website then the same profile picture will be displayed. Can you give a script for the same.


title: Wordpress blog fails to open

text: When I try to view/access my blog I get the following message.... Just wondering if anyone has any ideas as to the cause and the solution? > Warning: require(/home/photogian/room2850.com/wp-includes/post-template.php) > [function.require]: failed to open stream: Permission denied in > /home/photogian/room2850.com/wp-settings.php on line 119 > > Fatal error: require() [function.require]: Failed opening required > '/home/photogian/room2850.com/wp-includes/post-template.php' > (include_path='.:/usr/local/lib/php:/usr/local/php5/lib/pear') in > /home/photogian/room2850.com/wp-settings.php on line 119


title: Controller functionality - User not logged in/ redirect to registration page (not wp_login)

text: I have a site **here**... If a user clicks on **Submit an Event** or **Send an Article** , they are re- directed to a 404 page because I have it set up to make the page private. What I want to do is if the user is logged in, it goes to the correct page. But if the user isn't logged in, then they get directed to **this registration page**. I don't see any way to do this withing the settings of Wordpress. Thoughts?


title: Is it right way to create shortcode?

text:
I want to create a shortcode, but it creates empty `<p>` tags in the output. I'm using the following code to avoid that problem, however I'm not sure if this is correct way. I have read that if shortcodes are added incorrectly, they create problems with WordPress core functionality, so please advice if the following method is correct.               function run_my_shortcode( $content ) {         global $shortcode_tags;         $original_shortcode_tags = $shortcode_tags;         remove_all_shortcodes();          add_shortcode( 'box', 'my_shortcode' );          $content = do_shortcode( $content );         $shortcode_tags = $original_shortcode_tags;          return $content;     }      add_filter( 'the_content', 'run_my_shortcode', 7 );          //output the shortcode content     function my_shortcode( $atts, $content = null ) {            extract(shortcode_atts(array(             'title' => ''            ), $atts));              $output = '';         $output .= "
";              if (!empty($title)){             $output .= '
'.$title.'
';         }              $output .= '
'. do_shortcode( $content ).'
';         $output .= '
';              return $output;      }     add_shortcode( 'box', 'my_shortcode' );


title: conditional logic for front-end custom field edits

text:
I'm just starting to learn php/js and would like some recommendations on the best way to setup my logic: Goal- Display the value in a custom metafield in the custom post type. If the user is the author of the page, display an edit button that will reveal an input field. This input should let the user(author) to update the custom field(metabox) from frontend. The following code i wrote works, but seems sloppy, especially when since i plan to repeat it several times in the template for many custom fields. still just beginning to learn this.               <?php      /* check if POST 'leadcandidate' has no value and set var $nersi by custom field in database, or by POST if it has a positive value */     if(empty($_POST['leadcandidate'])){         $nersi = ($meta_values[_dtm_lead_candidate][0]);     }     else {         $nersi = $_POST['leadcandidate'];     }          /* check if user is author of custom post type */     global $current_user;     get_currentuserinfo();          if (is_user_logged_in() && $current_user->ID == $post->post_author)  {         echo '<button id=btn3>Edit me</button>';         /* input field will be hidden and revealed on button click with JS */         /* add $nersi as vlue of input so user starts from seeing what current value of field is */         echo '<form method="post" action=""><input type="text" name="leadcandidate" value="' . $nersi . '"><input type="submit"></form>';     }     /* this updates the database that stores the metafield */     update_post_meta(get_the_ID(), '_dtm_lead_candidate', $_POST['leadcandidate']);     ?>     /* display the value of metafield (to everyone) */
<?php echo 'Lead Candidate:' . $nersi; ?>


title: is there a way to pass a parameter to a add_menu_page function?

text: I am trying to create a dynamic way of adding admin pages and submenus with different capabilities. So the first way i thought of which works BTW but is ugly is having all the pages in 1 folder and name them something like 0.manage_options.pagename.php Then get all the pages and simply run through the array and use `explode()` on the name like so:               $classLib = glob(SERVICES.'/*.php');     $pagesArray = array();     $mainMenu = '';     foreach($classLib as $className) {         $tempPages = explode('.',str_replace('.php', '', basename($className)));         /* a function to get nice clean name */         $menu_title = $this->get_admin_menu_clear_name($tempPages['2']);              $pagesArrayTemp[$tempPages[0]] = array(             'page_title' => $tempPages['2'],             'menu_title' => $menu_title,             'capability' => $tempPages['1'],             'menu_slug' => $tempPages['2'],             'url' => 'pluginame/services/'.basename($className),         );     }             $pagesArray = array();     foreach($pagesArrayTemp as $tempPage){         $pagesArray[] = $tempPage;     }     add_menu_page('pluginame', 'Main', $pagesArray[0]['capability'], $pagesArray[0]['url']);          foreach($pagesArray as $page){         add_submenu_page('pluginame', $page['page_title'], $page['menu_title'], $page['capability'], $page['url']);     }      this works however the URI of the page are ridiculously ugly. So i am trying to find an alternative way. without creating a function for each page .... is there a way to pass a parameter to `add_menu_page` or `add_submenu_page` function ? like:               add_submenu_page('something', 'something', 'something' , 'manage_options', 'something', array($this, 'option'));          function option($premission, $pageURL){         if ( !current_user_can( $premission ) )  {         wp_die( __( 'You do not have sufficient permissions to access this page.' ) );     }         require_once($pageURL);     }      maybe a filter or something alike ? Thanks in advanced.


title: Why do Wordpress rewriites seem to work differently for posts vs pages?

text: I am creating some simple rewrites in my functions.php file in my WordPress installation:               add_rewrite_rule('product1/faqs/?', 'index.php?name=product1-faqs', 'top');       I've noticed that if you hit "product1/faqs" in the browser, it successfully displays the content of "product1-faqs" but keeps the url as product1/faqs (which is desired) but only if it is a POST. If I try this same technique but on a PAGE, the browser URL flicks to "product1-faqs" (undesired!) Why is that? I don't want have to limit ourselves just to posts for the sake of rewrites working as desired...


title: Staging/production deployment on WordPress MultiSite

text: Looking to create a staging process for changes to our WordPress MultiSite. We are running several different templates between the sites in our network, but we'd love to use a stage site to test changes to those sites in the network. We're running 3.7.1. Our themes were built in-house. We run a number of plugins, some network-wide, some on certain sites in the network. We've set up a directory on the webhosting server to run it called /staging. We're not sure where to begin, though.


title: 301 redirect instead of 404 when URL is a prefix of a post or page name?

text: hey all! i have an odd problem with URL routing. when i request a URL that doesn't exist, e.g. http://localhost/foo, wordpress correctly returns a 404. however, if that URL is a prefix of a post or page name, it instead returns a 301 redirect to the post or page. for example, if i have a post on 10/1/2010 named Food Post, it will return a 301 with Location: http://localhost/2010-10-01_food_post (my permalink structure). likewise, if i have a page named Food Page, it will return a 301 with Location: http://localhost/food_page. you can see this in action on my live site, http://snarfed.org/ . e.g. http://snarfed.org/foo redirects to http://snarfed.org/2009-10-30_food_highlights . turning off permalinks (ie switching to "default") fixes it, for both posts and pages, but naturally i don't really want to do that. i see this on three different installations, all wordpress 3.0.1 and apache 2.2, two ubuntu lucid/mysql 5.1 and one freebsd 7.3/mysql 5.0. i've deactivated all plugins and removed everything from my .htaccess except the lines for wordpress below, verbatim, but no luck.               RewriteEngine On     RewriteBase /     RewriteRule ^wordpress/index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /wordpress/index.php [L]      thanks in advance...


title: woocommerce stored variable

text: In wordpress, all information can be retrieved via `$post` or `wp_query`, in woocommerce, is there something similar? I want to display information of each product, on a page next to the picture. I have two questions.   1. How can i get to know, which variable does woocommerce uses to store the data.   2. In General, if we want to know the meta of any post,page, how can we pull it aganist each id, where id is generic (we don't know, its dynamic like `$post->ID`)


title: Query posts with numeric meta values within a given range

text: I'm building a rental agency's website with WordPress. I'm having difficulties finding a good way to store an apartment's availability in meta fields. Specifically, enabling visitors to find apartments available within a given date range. I figured I would have the agency select which dates an apartment is unavailable in the post editor. My first guess was to store the dates in a single string. For an example listing that is unavailable from 5 January through 7 January I would keep a single meta record like so:               update_post_meta($post_id, "listing_unavailable", "/20140105/20140106/20140107/");      Now when I would look for a listing available from 6 January through 11 January...               $arrival_date   = 20140106;     $departure_date = 20140111;      ...I would run the following meta query:               $meta = [];          for($i = $arrival_date; $i <= $departure_date; $i++)         $meta[] = array(             "key"     => "listing_unavailable",             "value"   => "/".$i."/",             "compare" => "NOT LIKE"         );          $query->set("meta_query", $meta);      The meta query will return any post which has no unavailable dates within the given range. Perfect! However, WordPress adds one `JOIN` for each meta query, so now we're very limited in date range. I think SQL supports up to 61 `JOIN`s and I have a lot of other fields visitors can filter on. So I would only be able to select a range of 2 or 3 weeks before I'd get a `JOIN` limit error. So then I figured, maybe I should add the unavailable dates each as a separate value. For example, again from the 5th up to the 7th:               delete_post_meta($post_id, "listing_unavailable");     add_post_meta($post_id, "listing_unavailable", 20140105);     add_post_meta($post_id, "listing_unavailable", 20140106);     add_post_meta($post_id, "listing_unavailable", 20140107);      Now I imagine a meta query for 6 January through 11 January would look something like this:               $meta = array(         "key"     => "listing_unavailable",         "value"   => array($arrival_date, $departure_date),         "compare" => "NOT BETWEEN",         "type"    => "NUMERIC"     );      This doesn't work though. The visitor will now still find the example listing because 5 January is outside of the `"NOT BETWEEN"` range, deeming the example listing a valid result. I can't seem to think of the right setup to tackle this issue using standard WordPress functions, without making the SQL query too heavy. Any ideas or suggestions?


title: Why do all Gallery functions return null for me?

text: This is how I'm creating new galleries:   * I start with making a new post.   * then I click on `Add Media > Create Gallery`   * after that I select a few images from Media Library (let's say 3 of them).   * and last click on `Create a new gallery` After that the contents of my new post look like:               [gallery ids="1,2,3"]      Now I can see a neat beautiful gallery on my post page: ![enter image description here](http://i.stack.imgur.com/0b5oI.png) The point is:   * I don't want this gallery to be shown.   * I want to get URLs of these images to do something else with them (let's say, a custom slider). # 1\. Hiding the Gallery. **Additional question, not so important, I need help with 2. mainly** I guess it's quite easy to hide the gallery with CSS (any other ideas, because I don't like this one that much? of course I want the shortcode to still be visible in text editor). In reality I'll be using this on a CPT only so maybe there is some way of disabling galleries for CPT? I want the shortcode to still be in text editor though. # 2\. Getting the data from Gallery. Now, there is something really wrong. I've checked it on Twenty Thirtheen and it works, but somehow doesn't with my theme.               $galleries = get_post_galleries_images( $post );     var_dump($galleries);      This code displays all the data about above images on Twenty Thirteen but in my theme I'm getting:               array(0) { }      And there's what it's supposed to display (and it does in other themes):               array(1) { [0]=> array(3) { [0]=> string(27) "http://url/to/the/image.jpg" [1]=> string(27) "http://url/to/the/image.jpg" [2]=> string(27) "http://url/to/the/image.jpg" } }      This is how my index.php looks like:               <?php get_header();?>          <?php get_template_part( 'loop' ); ?>     <?php get_footer(); ?>      single.php:               <?php get_header(); ?>         <?php get_template_part( 'content-single' );  ?>     <?php get_footer(); ?>      content-single.php:               <?php         // I've also tried with while (have_posts()) : the_post();        $galleries = get_post_galleries_images( $post );        var_dump($galleries);     ?>      I've been trying every possible way and I'm never getting the right results. Any ideas what's wrong?


title: How can I get a comment ID on Submit?

text: I've added an attachment field to my comment form. It stores the files on Amazon AWS and writes the URL, user ID, post ID, and a few other things to a custom table. I'm having some difficulty getting the comment ID in order to properly associate the attachment with the comment. Is there a good way to get the comment ID as it is being written? I've looked over the documentation and cant seem to find anything that would get my comment ID on submit.


title: Add class to before_widget for all widgets with a dropdown and a counter

text: Some predefined widgets offer the option to use a `select` element (dropdown) and/or a counter after each entry. How can I add the CSS classes `widget-with- dropdown` or `widget-with-counters` to these widgets? There are already solutions for custom widgets, known sidebar ids or positions, but I have to inspect the parameters for the current instance, and I want to catch all possible positions or widgets (if they follow the WordPress naming scheme).


title: exclude parents from the_terms

text:
I'm using this function to get the categories linked to the post:               the_terms($post->ID, 'portfolio-type', '
'.__('Categories:','om_theme').' ', ', ', '
');      the result is this: > Categories: 16 Max, Capacity The category **Capacity** is parent of **16 Max** category. I'm looking to exclude parents so the result would be: > Categories: 16 Max I appreciate any help!


title: Permissions on upload directory

text: I've been working with a clean WP download on my local host. I was uploading images and other files with the Media Admin Panel without changing any permissions. Suddenly, I see that I can't upload files anymore, and it seems to be a permissions problem, because I've tried with `777` permissions and it's working. So I've read about it at Changing_File_Permissions. And I've found out that all files (and folders) must have FTP user as owner, but I have not any FTP access in my local host. And don't understand why it should work. Is not the user the server user `www-data` also when accessing with Admin Panel? I know that the user has some rules for the DB management, but not for files! Anyway, I've tried creating a new user in my local host named like the WP user, but neither works. And I can't understand how could it work before. Any suggestion? The only way I see is to change permissions on `upload` folder every time that I want to upload a file, but It would be a time wasting.


title: Stress testing WordPress

text: We are going to launch a community site with 100K posts, 100K comments, 10K terms, 5 users ( all admin/editorial), and approx 500K recs in the wp_postmeta. Site may grow with a larger author base and we hope it will grow to become a much bigger site... At this time, I would like to know how would WordPress behave when the above numbers reach the 10 times the current fold, that is 1M posts, 1M comments, 100K terms, 500 users, and approx 5M recs in the wp_postmeta. What tools can I use to put this many records into a WordPress install? My migration routine takes about 10 hours to complete to put 100K posts into WP. I must find more efficient ways to 1M records! I know WP can handle fairly large database content and WordPress.com is the greatest example for that. However, those guys have of a ton of servers... In my case, I have what I have. I'm curious to see/experience how the admin dashboard would load and how the front page ( with multiple loops ) behave... Any ideas/tools towards this goal is greatly appreciated... Of course, once I have that many recs, I will be needing a stress testing tool but I think I can find utilities for that. We are using IIS 7 and we cannot switch to LINUX for legacy code reasons anytime soon.


title: What action/filter/function determines "current" class in WP Admin Menu

text: I have created a submenu page for the Media List Table. The link actually points to a custom view I have created called Resources. I am looking for the correct location where the Admin menu determines what page(s) are highlighted as "current", and cannot seem to find where I could access this.               add_media_page( __( 'Resources', ZG_TEXTDOMAIN ), __( 'Resources', ZG_TEXTDOMAIN ), 'read', 'upload.php?resources=1' );      Here is an image of the Resources menu item being clicked, the URL reading as `/wp-admin/upload.php?resource=1`, but the menu is obviously not being highlighted properly. ![enter image description here](http://i.stack.imgur.com/aq3Rv.png) Quite an odd request, as it's not it's on page, but the current path does match the menu slug, so I'm not seeing where the issue lies.


title: URL rewrite of independent plugin?

text: I'm currently developing a more complex plugin for WP which can't be hooked up to the WP-API itself (Custom Post Types doesn't fit my requirements). Of course I use the API alot, because the data is administered through WP backend (rendering own forms and lists). I'm stuck with the rewrite options, taxonomities and need just a little hint, how to get the thing working. What I do have for now is               www.example.org/page/?aid=281&kid=104      What I'd like to achieve is               www.example.org/page/some-name/      The vars are already stored in query_vars so far. Should I try to register a rewrite rule (because 'page' is rendered through WP) and get the things going or should I simply modify the .htaccess? Any help is much apreciated!


title: Can't see custom field after the Loop

text: I have created a loop to show some products on my wordpress site and they seem to be working fine they reel out the products however if I place one of custom fields after the loop it doesn't show. I know its not an issue with the custom field itself as it works fine if I put it above the loop. Does anyone know where I could be going wrong? Here is my code: http://pastebin.com/SVxYK0XP Thanks


title: How to hook something before edit_form_title?

text: It's amazing to use the `edit_form_after_title` hook to enqueue something just below the post editor's title field. But there is nothing opposite to this like: _`edit_form_before_title`_. Searching over the Internet, found the trac treasure with a solution saying: > _Add an`edit_form_top` hook to the post edit form._ That's pretty! But that's not exactly what I's looking for. That's taking the whole top part of the form, not behaving like the Title field on the editor.   ![edit_form_top hook renders like this](http://i.stack.imgur.com/mnH9s.png) Is there any solution/hook I can use so that the thing I'm hooking looks exactly like the Title field (not taking the whole top part of the form, but renders on the left part only.)? ### EDIT And also, if I use `edit_form_top` then if I use any input field to add meta_value to the post, then it'll be failed because `edit_form_top` adds the _thing_ **outside the form**. SPECIFICALLY, I need to add a custom input field to add meta_value to the post. I don't want to use any plugin.


title: Wordpress Shortcode loads at the top

text:
I tried all solutions of the topics here but I haven't been able to find a solution. I made a Plugin for a Shortcode. My problem is that the plugin code get always loaded above the content. I already found out that it comes from the use of `echo`. Instead I should use `return`. But as soon I replace the `echo` the plugin stops working! ;( It would be great if someone could help me. Thank you!               function sublime_video_playlist() {     wp_enqueue_script('sublime_video', '' .plugins_url( '/js/sublime_playlist.js' , __FILE__ ). '');          global $post;          $attachments = get_children( array(                     'post_parent'    => $pageChild->ID,                     'post_type'      => 'attachment',                     'numberposts'    => 1, // show all -1                     'post_status'    => 'inherit',                     'post_mime_type' => 'video',                     'order'          => 'ASC',                     'orderby'        => 'menu_order ASC'                     ) );               if ( $attachments ) {            echo '

';       echo '
Videos
';            echo '
';            $args = array(         'post_type' => 'attachment',         'post_mime_type' => 'video',         'numberposts' => null,         'post_status' => null,         'orderby' => 'title',         'post_parent'    => $post->ID     );          $attachments = get_posts($args);          if ($attachments) {         foreach ($attachments as $attachment) {             echo '
';             echo '<video width="568" height="320" id="video';             echo $attachment->ID;             echo '" data-settings="autoresize:fit" poster="';             echo '" preload="true">';             echo '<source src="';             echo wp_get_attachment_url ($attachment->ID);             echo '" /></video>';             echo '
';              }              echo '
';          $args = array(         'post_type' => 'attachment',         'post_mime_type' => 'video',         'numberposts' => null,         'post_status' => null,          'orderby' => 'title',         'post_parent' => $post->ID     );      $attachments = get_posts($args);          if ($attachments) {         foreach ($attachments as $attachment) {             echo '
ID;             echo '">   ID));             echo '" width="144" height="71" />
';          }     }               echo '

';                  if(function_exists('render_tnwsc_button')) {                     echo render_tnwsc_button();                 }         echo '
';          }     }     }     add_shortcode('video_playlist', 'sublime_video_playlist');  ?>


title: Rewriting a page driven by custom fields to populate a page dynamically, like posts

text: I'm relatively new to Wordpress and I received a site theme that was developed by outsourced developers. Due to the inevitable scope creep, i've had to modify pages to work with the new scope. http://dsi.sva.edu/news-and-events/ This page is populated by custom fields. Since it's a news page, we want the newest article to appear top left in the grid of pictures. Because the backend is set up with custom fields, we would need to manually re-enter all of the custom fields just to get the new article to appear before the others. Can anybody recommend a way of rewriting the backend to allow for this? Or at least refer me to articles that may help? Also, as new lines of posts are added to the bottom of the page, they're pushing the page up upon load, causing the header to get pushed up. Is there any way to fix that as well? Thanks! Thanks! Thanks!


title: How to disable Multisite sign-up page?

text: If we try to access a non-existant Multisite site, e.g., `http://site1.example.com` or `http://example.com/site1/`, we are redirected to `http://example.com/wp-signup.php?new=site1`. How to block this and redirect the browser to another page?


title: Is there a way to hide a user's posts from their Activity feed?

text: I'm helping out a friend who runs a paid membership site, and he recently discovered that any public user can access some of the pay content by going to a particular user's Activity feed. He's asked me to fix this for him, but I think it'll require delving into the theme code, and I'm not at all familiar with the WordPress ecosystem (I'm an experienced web programmer, but only with Python and Drupal). Is there some general kind of thing I should be looking for to figure out how to prevent this content from showing up on the creator's Activity log page? The site is using the Iconic One Pro theme, and the Paid Memberships Pro plugin to handle the pay wall.


title: Display post X of Y in category

text: I am trying to display a post number ( **X** ) on each single.php, based on what number that post is in it's category, followed by the total number of posts ( **Y** ) in the category. So if there is 10 posts in my category "photos", the latest post should be "1/10". **I found this solution for Y:**               <?php     $category = get_the_category();      echo $category[0]->category_count;     ?>       **This solution almost does what I want for X** , but it is not based on category, and includes all posts: http://wordpress.org/support/topic/show- post-number#post-1294235 Can anyone help? :-)


title: Is it advisable to run multisite from its own directory?

text: I have to create a bilingual site. I've decided to take the multisite approach, creating a different site for each language and linking those two version with a plugin. I intend to use subfolders like these:               example.com/en     example.com/es      I have already created a first draft for the English version of this web (just a regular version of WordPress without multisite functions) which is working from within its own folder. I was hoping to be able to just activate multisite for that version and run `index.php` from the root (once I've finished working on the contents). But I've read that it's difficult to get the multisite working if it isn't installed directly to the domain, the problem is that I can't take down the current site on the main domain right now. My question is: should I activate multisite functions from within the current directory? Or would it be better if I create a new installation at the root directory in my host?


title: Page template not displaying

text: I dont get why this isnt working. I have a custom page template, page- politics.php. It should look similar to this page: ![banking transaction page](http://i.stack.imgur.com/MXR0q.png) But its displaying this: ![campaign contribution page](http://i.stack.imgur.com/AfSZW.png) Ive double, triple checked that the right template is assigned to the right page. ![page settings for campaign office page](http://i.stack.imgur.com/NuqpT.png)


title: Prevent moveform() to moving the original location of comment form

text: I have a post with comment enabled, also enabled threaded comment with max level 3. Each time I want to do a comment reply, the form comment box is moving to the comment which I want to reply. But I don't want the original location of form comment moving to the comment I want to reply, instead, I want the form duplicated. One form comment stay in the original position, and the other one is located on the comment I want to reply. How I can solve this problem? Thank you.


title: Sort posts in dashboard using custom field; also include posts where field isn't set

text: I'm using a pre_get_posts filter found on this question thread here, to sort a custom post type in the dashboard:               function xyz_event_sort_order( $wp_query ) {         if ( is_admin() ) {             $post_type = $wp_query->query['post_type'];             if ( $post_type == 'event' ) {                 $wp_query->set( 'meta_key', 'x_start_date' );                 $wp_query->set( 'orderby', 'x_start_date' );                 $wp_query->set( 'order', 'DESC' );             }         }     }     add_filter( 'pre_get_posts', 'xyz_event_sort_order' );      The filter sorts the events as expected, but events where the custom field has not been set (old events imported from another WP install) will, obviously, no longer show at all. I'm trying to do a meta_query that uses EXISTS and NOT EXISTS and still sorts by the meta_key specified above, but have had no luck. Anybody know how I might also include events where *x_start_date* is missing and then add date as a second orderby option like: `( 'orderby', 'x_start_date date' );`


title: plugin_action_links Filter Hook Deprecated?

text: http://adambrown.info/p/wp_hooks/hook/plugin_action_links_%7B$plugin_file%7D Says the hook is deprecated. However, the {$prefix}plugin_action_hook_{$plugin_file} is not. I poked around the `wp- admin/includes/class-wp-plugins-list-table.php` file for the hook, and found this:               $actions = apply_filters( $prefix . "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );      `$prefix` is defined a few lines above:               $prefix = $screen->is_network ? 'network_admin_' : '';      Since I was able to get my add_filter call to `plugin_actions_row_{$plugin_file}` to work, I'm assuming the filter hook is still there. Well, sort of: the filter is still available as it's not a network admin screen. Correct? And one could use...               add_filter( 'network_admin_plugin_action_links_{$plugin_file}', 'do_something' )      ...to put a link into the network's plugin screen?


title: Setting selected term_id with wp_dropdown_categories?

text: I'm using this code to get the term_id of a custom taxonomy. The drop down does list the terms of the taxonomy Type. When I print the $terms variable I see the term ID of the post i'm editing on the front end. Why isn't the term ID being set as the selected option?               $terms = get_the_terms( $current_post, 'Type' );     print_r($terms);     wp_dropdown_categories( 'taxonomy=Type&hierarchical=1&hide_empty=0&id=cat&show_count=0&selected=' . $terms[0]->term_id );      This is the output of the array               Array ( [25] => stdClass Object ( [term_id] => 25 [name] => Sativa [slug] => sativa [term_group] => 0 [term_icon] => http://pothwy.com/wp-content/themes/GeoPlaces/images/default.png [term_price] => 0 [term_taxonomy_id] => 53 [taxonomy] => Type [description] => [parent] => 0 [count] => 4 [object_id] => 563 ) )      Output of HTML               <select name="cat" id="cat" class="postform">         <option class="level-0" value="25">Sativa</option>         <option class="level-0" value="52">Indica</option>     </select>


title: Changing "submitted on date" of comments

text: How do I change the "submitted on date" of a comment to an earlier date? I want to change the date that is displayed to the readers. As far as I know, I can change the date of the post by clicking the "quick edit" option. Is there something similar I can do with comments?


title: Our shortcode dropdown box in Tinymce is not working in WordPress 3.9?

text: Hi since the new version is about to be released I thought I would download it and see if my theme works still. Everything works great apart from the dropdown box which is now longer showing. Here is the codes we used to show it in previous versions. PHP CODE:               function register_ppp_shortcodes( $buttons ) {        array_unshift( $buttons, "Shortcodes" );        return $buttons;     }          function add_ppp_shortcodes( $plugin_array ) {        $plugin_array['Shortcodes'] = get_template_directory_uri() . '/js/Shortcodes_js.js';        return $plugin_array;     }          function ppp_shortcodes() {             if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {           return;        }             if ( get_user_option('rich_editing') == 'true' ) {           add_filter( 'mce_external_plugins', 'add_ppp_shortcodes' );           add_filter( 'mce_buttons', 'register_ppp_shortcodes' );        }          }          add_action('init', 'ppp_shortcodes');      JS CODE:               /*global tinyMCE, tinymce*/     /*jshint forin:true, noarg:true, noempty:true, eqeqeq:true, bitwise:true, strict:true, undef:true, unused:true, curly:true, browser:true, devel:true, maxerr:50 */     (function() {     "use strict";                 tinymce.create('tinymce.plugins.Shortcodes', {                  init : function(ed, url) {               ed = ed;                 url = url;             },             createControl : function(n, cm) {                      if(n==='Shortcodes'){                     var mtb = cm.createListBox('Shortcodes', {                          title : 'Shortcodes',                          onselect : function(p) {                             var selected = false;                             var content = '';                             switch (p){                                  case 'H1 Title':{                                      var h1titleclass = prompt("Would you like a custom class?", "");                                      selected = tinyMCE.activeEditor.selection.getContent();                                      if(h1titleclass != ''){                                     h1titleclass = 'class= "'+h1titleclass+'"';                                 }                                      if (selected) {                                     content = '[h1'+h1titleclass+']' + selected + '[/h1]';                                 } else {                                     content = '[h1'+h1titleclass+'][/h1]';                                 }                                      tinymce.execCommand('mceInsertContent', false, content);                                  } // finished shortcode                             break;                                  case 'H2 Title':{                                      var h2titleclass = prompt("Would you like a custom class?", "");                                      selected = tinyMCE.activeEditor.selection.getContent();                                      if(h2titleclass != ''){                                     h2titleclass = 'class= "'+h2titleclass+'"';                                 }                                      if (selected) {                                     content = '[h2'+h2titleclass+']' + selected + '[/h2]';                                 } else {                                     content = '[h2'+h2titleclass+'][/h2]';                                 }                                      tinymce.execCommand('mceInsertContent', false, content);                                  } // finished shortcode                             break;                                  }                             }                     });                               // Add some menu items                     var my_shortcodes = ['H1 Title','H2 Title'];                          for(var i in my_shortcodes){                       if (true) {mtb.add(my_shortcodes[i],my_shortcodes[i]);}                     }                          return mtb;                 }                 return null;             }                   });         tinymce.PluginManager.add('Shortcodes', tinymce.plugins.Shortcodes);     })();      Can anyone point me in the right direction on where to start. I know very little about tinymce as you can tell :( Thanks


title: Use .htaccess to redirect homepage to its permalink

text: How can I get WordPress to preserve my permalink that I have set for the homepage? I would like the homepage's URL to be `www.example.com/homepage-title`, not `www.example.com`. Its permalink is already set to `www.example.com/homepage- title`, but on navigation to the site I would like it to redirect to `www.example.com/homepage-title` instead of `www.example.com`.


title: How to create/modfiy WP_Query to search in post title OR custom field?

text: I need to modify or create a WP_Query that will search for a search term in both the post title OR a custom field (called 'my_field'). I have been reading and trying for hours, but I am right back to this code (below) which, alas, only searches in 'my_field' and does not take the post_title into account.               function my_pre_get_posts_2( $query ) {     if ( is_admin() && $query->is_main_query() && $query->query['post_type'] === 'post' && isset($query->query['s']) ) {              $search_word = $query->query['s'];              $args = array(             //'s' => $search_word, //If I include this line, the WP query seems to AND post_title and my_field. If I comment out this line, the WP query only searches in my_field             'post_type' => 'post',             'meta_query' => array(                 'relation' => 'OR',                 array(                     'key' => 'my_field',                     'value' => $search_word,                     'compare' => 'IN'                 ),                 array(                     'key' => 'post_title',                     'value' => $search_word,                     'compare' => 'IN',                 )             )         );              //$query = new WP_Query( $args ); //Need to modify the existing WP_Query         $query->init();         $query->parse_query($args);     }          }     add_action( 'pre_get_posts', 'my_pre_get_posts_2' );      The reason I need to do this is because I need to modify the behaviour of the the 'Search Posts' button in the 'All Posts' (admin) page so that whatever the admin user searches for, it will return the posts that have a matching post title OR my_field value.


title: One loop for sticky, one for all the rest - how, without specifying category?

text: I have styled an archive page to display one sticky post at the top with special design, and then to display all the rest of the posts in that category (except the sticky post) listed in standard title/excerpt format. I have specified the target category for both loops: Sticky only:               <?php $args = array(     'cat' => 3,     'posts_per_page' => 1,     'post__in'  => get_option( 'sticky_posts' ),     'ignore_sticky_posts' => 1                       );          query_posts( $args );?>      All the rest:               <?php      $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;     $sticky = get_option( 'sticky_posts' );                          $args = array(         'cat' => 3,         'ignore_sticky_posts' => 1,         'post__not_in' => $sticky,         'paged' => $paged,         'orderby' => 'menu_order',           'order' => 'ASC'      );      query_posts( $args ); ?>      I have made custom category.php templates for each category with the 'cat' ID added manually in each loop. My question: Is it possible to do this without manually setting the cat ID? I have tried but end up with all posts rather than just the category variable. thx - Steve


title: Can't get result from sql using ajax result

text: I'm using an AJAX form to feed the code something to lookup in db. Separate table, not WP options. I'm getting the result from AJAX, but when I try to do the sql it just returns 0. This is the function:                  function myajax_inputtitleSubmit_func() {         // check nonce         $nonce = $_POST['nextNonce'];            if ( ! wp_verify_nonce( $nonce, 'myajax-next-nonce' ) )             die ( 'Busted!');              $zipcode = $_POST['zip'];         // generate the response         global $wpdb;         $tablename  = "{$wpdb->prefix}levering";              $sql    = "SELECT Levering FROM {$tablename} WHERE Zip LIKE %s";         $result = $wpdb->get_var($wpdb->prepare($sql, $zipcode));         return $result;         while($row = mysql_fetch_array($result)) {              $response = $row['Levering'];             }              // response output         header( "Content-Type: application/json" );         echo $response;         die();         // IMPORTANT: don't forget to "exit"         exit;     }


title: How to make a slideshow shortcode based on the Wordpress gallery shortcode?

text:
This is the wordpress function for the gallery shortcode, i would like to understand how this works so i can implement a slideshow shortcode and adding the img id only as gallery shortcode does.                   function gallery_shortcode($attr) {     $post = get_post();          static $instance = 0;     $instance++;          if ( ! empty( $attr['ids'] ) ) {         // 'ids' is explicitly ordered, unless you specify otherwise.         if ( empty( $attr['orderby'] ) )             $attr['orderby'] = 'post__in';         $attr['include'] = $attr['ids'];     }          // Allow plugins/themes to override the default gallery template.     $output = apply_filters('post_gallery', '', $attr);     if ( $output != '' )         return $output;          // We're trusting author input, so let's at least make sure it looks like a valid orderby statement     if ( isset( $attr['orderby'] ) ) {         $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );         if ( !$attr['orderby'] )             unset( $attr['orderby'] );     }          extract(shortcode_atts(array(         'order'      => 'ASC',         'orderby'    => 'menu_order ID',         'id'         => $post ? $post->ID : 0,         'itemtag'    => 'dl',         'icontag'    => 'dt',         'captiontag' => 'dd',         'columns'    => 3,         'size'       => 'thumbnail',         'include'    => '',         'exclude'    => '',         'link'       => ''     ), $attr, 'gallery'));          $id = intval($id);     if ( 'RAND' == $order )         $orderby = 'none';          if ( !empty($include) ) {         $_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );              $attachments = array();         foreach ( $_attachments as $key => $val ) {             $attachments[$val->ID] = $_attachments[$key];         }     } elseif ( !empty($exclude) ) {         $attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );     } else {         $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );     }          if ( empty($attachments) )         return '';          if ( is_feed() ) {         $output = "\n";         foreach ( $attachments as $att_id => $attachment )             $output .= wp_get_attachment_link($att_id, $size, true) . "\n";         return $output;     }          $itemtag = tag_escape($itemtag);     $captiontag = tag_escape($captiontag);     $icontag = tag_escape($icontag);     $valid_tags = wp_kses_allowed_html( 'post' );     if ( ! isset( $valid_tags[ $itemtag ] ) )         $itemtag = 'dl';     if ( ! isset( $valid_tags[ $captiontag ] ) )         $captiontag = 'dd';     if ( ! isset( $valid_tags[ $icontag ] ) )         $icontag = 'dt';          $columns = intval($columns);     $itemwidth = $columns > 0 ? floor(100/$columns) : 100;     $float = is_rtl() ? 'right' : 'left';          $selector = "gallery-{$instance}";          $gallery_style = $gallery_div = '';     if ( apply_filters( 'use_default_gallery_style', true ) )         $gallery_style = "         ";     $size_class = sanitize_html_class( $size );     $gallery_div = "
";     $output = apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );          $i = 0;     foreach ( $attachments as $id => $attachment ) {         if ( ! empty( $link ) && 'file' === $link )             $image_output = wp_get_attachment_link( $id, $size, false, false );         elseif ( ! empty( $link ) && 'none' === $link )             $image_output = wp_get_attachment_image( $id, $size, false );         else             $image_output = wp_get_attachment_link( $id, $size, true, false );              $image_meta  = wp_get_attachment_metadata( $id );              $orientation = '';         if ( isset( $image_meta['height'], $image_meta['width'] ) )             $orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';              $output .= "<{$itemtag} class='gallery-item'>";         $output .= "             <{$icontag} class='gallery-icon {$orientation}'>                 $image_output             </{$icontag}>";         if ( $captiontag && trim($attachment->post_excerpt) ) {             $output .= "                 <{$captiontag} class='wp-caption-text gallery-caption'>                 " . wptexturize($attachment->post_excerpt) . "                 </{$captiontag}>";         }         $output .= "</{$itemtag}>";         if ( $columns > 0 && ++$i % $columns == 0 )             $output .= '
';     }          $output .= "

\n";          return $output;


title: the_excerpt() or get_the_excerpt with shortcode escape

text: I have few posts which have a dropcap shortcode wrapped around the first character like so:               [dropcap]T[/dropcap]his is a dropcap.       The replacement for this shortcode yields:               This is a dropcap.      However, when I call the_excerpt() or get_the_excerpt() on these posts, its returning:               "his is a dropcap".      I need it to return "This is a dropcap" as if no shortcode exists.


title: Finer level user access to WordPress pages/posts

text: Let's say there are four pages/posts > p1, p2, p3, p4 and four users > u1, u2, u3, u4 in Wordpress. How do I restrict access for p1, p2 to u1, u2 and restrict access for p3, p4 to u3, u4? I tried a couple of plugins, but none of them were giving a finer level access as mentioned above.


title: Gallery backend only

text: I'm using Wordpress to power the blog section of my website, and also my event timeline (using custom post type admin area). I'm looking to add the option to create image galleries, and include them in posts using a custom tag. I would like to handle the entire front end integration myself, just using the db data and files uploaded by a gallery plugin. Are there any good back end only solutions for creating galleries or should I just roll my own?


title: Amazon Cloudfront + WP Super Cache

text: Using WP Super Cache - I have switched to Amazon Cloudfront from MaxCDN. Amazon Cloudfront does not gzip resources as MaxCDN does hence i am facing a very low page speed test. This Amazon Help page explains how to compress files Hence, I have set up my .htaccess file as below:               AddType x-mapp-php5 .php      AddHandler x-mapp-php5 .php     AddType application/x-font-woff woff     AddType application/x-font-ttf ttf     AddType application/vnd.ms-fontobject eot          # compress text, HTML, JavaScript, CSS, and XML     AddOutputFilterByType DEFLATE text/plain     AddOutputFilterByType DEFLATE text/html     AddOutputFilterByType DEFLATE text/xml     AddOutputFilterByType DEFLATE text/css     AddOutputFilterByType DEFLATE application/xml     AddOutputFilterByType DEFLATE application/xhtml+xml     AddOutputFilterByType DEFLATE application/rss+xml     AddOutputFilterByType DEFLATE application/javascript     AddOutputFilterByType DEFLATE application/x-javascript          # remove browser bugs     BrowserMatch ^Mozilla/4 gzip-only-text/html     BrowserMatch ^Mozilla/4\.0[678] no-gzip     BrowserMatch \bMSIE !no-gzip !gzip-only-text/html     Header append Vary User-Agent          # Set Expires Headers     <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">     Header set Expires "Thu, 15 Jan 2015 20:00:00 GMT"     </FilesMatch>          <IfModule mod_headers.c>       <FilesMatch "\.(js|css|xml|gz)$">         Header append Vary: Accept-Encoding       </FilesMatch>     </IfModule>          # Set the cache-control max-age     # 1 year     <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">     Header set Cache-Control "max-age=31449600, public"     </FilesMatch>     # 2 DAYS     <FilesMatch "\.(xml|txt)$">     Header set Cache-Control "max-age=172800, public, must-revalidate"     </FilesMatch>     # 3 DAYS     <FilesMatch "\.(html|htm)$">     Header set Cache-Control "max-age=604800, must-revalidate"     </FilesMatch>          # Turn off the ETags     Header unset ETag     FileETag None          ServerSignature Off     LimitRequestBody 10240000     ErrorDocument 500 /error.php          RewriteEngine On     RewriteCond %{REQUEST_FILENAME} !-f     RewriteRule \.(jpg|jpeg|png|gif|ico|swf|bmp)$ - [nocase,redirect=404,last]               ############################################################################################     #Section 1     RewriteEngine On     IndexIgnore *     Options +FollowSymLinks -Multiviews -Indexes     ############################################################################################     # ----------------------------------------------------------------------     # CORS-enabled images (@crossorigin)     # ----------------------------------------------------------------------          # Send CORS headers if browsers request them; enabled by default for images.     # developer.mozilla.org/en/CORS_Enabled_Image     # blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html     # hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/     # wiki.mozilla.org/Security/Reviews/crossoriginAttribute          <IfModule mod_setenvif.c>       <IfModule mod_headers.c>         # mod_headers, y u no match by Content-Type?!         <FilesMatch "\.(gif|png|jpe?g|svg|svgz|ico|webp)$">           SetEnvIf Origin ":" IS_CORS           Header set Access-Control-Allow-Origin "*" env=IS_CORS         </FilesMatch>       </IfModule>     </IfModule>               # ----------------------------------------------------------------------     # Webfont access     # ----------------------------------------------------------------------          # Allow access from all domains for webfonts.     # Alternatively you could only whitelist your     # subdomains like "subdomain.example.com".          <IfModule mod_headers.c>       <FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css)$">         Header set Access-Control-Allow-Origin "*"       </FilesMatch>     </IfModule>     ############################################################################################     RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]     RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]     RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]     RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})     RewriteRule ^(.*)$ index.php [F,L]     ############################################################################################     # Deflate files to fasten the loading     <IfModule mod_deflate.c>         SetOutputFilter DEFLATE         AddOutputFilterByType DEFLATE application/x-httpd-php text/html text/xml text/plain text/css text/javascript application/javascript application/x-javascript image/jpeg image/jpg image/png image/gif font/ttf font/eot font/otf     </IfModule>     <IfModule mod_headers.c>         # properly handle requests coming from behind proxies         Header append Vary User-Agent     </IfModule>     <IfModule mod_deflate.c>         # Properly handle old browsers that do not support compression         BrowserMatch ^Mozilla/4 gzip-only-text/html         BrowserMatch ^Mozilla/4\.0[678] no-gzip         BrowserMatch \bMSIE !no-gzip !gzip-only-text/html         # Explicitly exclude binary files from compression just in case         SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|pdf|swf|ico|zip|ttf|eot|svg)$ no-gzip     </IfModule>     ############################################################################################      Still resources coming from Amazon CDN are not compressed - I am thinking I need to verify proper Cache Control settings but I can't figure it out as yet. Has anyone else experienced this?


title: Frontend Post Excerpt field mapping

text: I'm trying to create a form with gravity forms. I need to merge two fields to one Excerpt. I can't give the Excerpt field a merge tag. So I'm trying to use an custom field. My question is now: what is the WP Parameter to map the Excerpt to the post. I've tried: the_ excerpt, _excerpt, post_excerpt, etc. But it never appears in the Excerptfield...


title: Allow duplicate permalink slugs for posts in different categories

text: I have my permalink format set to `/%category%/%postname%/` and I have two posts with the same permalink slug, but in different categories. Ideally, the two permalinks should look like this:               http://example.com/category-1/post-title/     http://example.com/category-2/post-title/      But when I publish the second post, then its slug is changed to `post- title-2`, which makes the resulting URL `http://example.com/category-2/post- title-2/`. How can I use the same slug for multiple posts that are in different categories? This WordPress Support topic suggests using an outdated plugin that doesn't work anymore.


title: Separate attachment images from post loop

text: I'm trying to create an array of images for a slideshow gallery script, so need to separate the images from the post loop - any ideas of the best way to achieve this and make it easy to add images? I can use a script to grab attachments (see below) but it seems a bit messy as:   1. image uploaded appear in the post text area and then meed to be deleted otherwise there is duplication.   2. you can't delete and image except by going into the media library and deleting it there.  http://digwp.com/2009/08/awesome-image-attachment-recipes-for-wordpress/ Would the better option be to use something like the more fields plug-in and create multiple text fields to post the urls of photos in? So they use the media library to upload images and grab the urls to put in the post. Ideally I'm trying to get a simple scenario where they just upload the images in one go as a gallery or individual images, write their gallery description text, and save.


title: Can I delete plugin files using FTP?

text: Due to a PHP upgrade on my server, one of my installed plugins stopped working and throws a fatal error. As I can't login to admin area of the site as a result of the plugin failure I can't uninstall that plugin. Now can I delete plugin's files directly using FTP? Will this cause any problems? **Update** I've found, the culprit plugin was unnecessary, I've removed the plugin files using ftp, now site is back, no errors. But I dontt know if this is the proper way. If that plugin were necessary, I would reply the files using new available version.


title: wp_insert_user function not adding password field to database

text:
I have a project in which i made a custom registration page but the problem is that my password field value not added to the database while email and username properly added. I could not understand why password value not stored. this is my php code.                   $pwd1 = $wpdb->escape(trim($_POST['pwd1']));         $pwd2 = $wpdb->escape(trim($_POST['pwd2']));         $first_name = $wpdb->escape(trim($_POST['first_name']));         $last_name = $wpdb->escape(trim($_POST['last_name']));         $email = $wpdb->escape(trim($_POST['email']));         $username = $wpdb->escape(trim($_POST['username']));                     if( $email == "" || $pwd1 == "" || $pwd2 == "" || $username == "" ||                      $first_name              == "" || $last_name == "") {             $err = 'Please don\'t leave the required fields.';         } else if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {             $err = 'Invalid email address.';         } else if(email_exists($email) ) {             $err = 'Email already exist.';         } else if($pwd1 <> $pwd2 ){             $err = 'Password do not match.';                } else {                  $user_id = wp_insert_user( array ('user_login' => apply_filters('pre_user_user_login', $username), 'user_pass' => apply_filters('pre_user_user_pass', $pwd1 ), 'user_email' => apply_filters('pre_user_user_email', $email), 'role' => 'subscriber' ) );             if( is_wp_error($user_id) ) {                 $err = 'Error on user creation.';             } else {                 do_action('user_register', $user_id);                      $success = 'You\'re successfully register';             }              }      this is my html code

Username:            <input type="text" id="username" name="username" required="required"

First Name:                <input type="text" name="first_name" >

Last Name:           <input type="text" name="last_name" >

Email:           <input type="text" name="email" >

Password:         <input type="password" name="pwd1" >

Confirm Password:         <input type="password" name="pwd2" >

      please tell me what is wrong with this.


title: Are custom tables a good solution for adding lots of data to the site?

text: On a fairly high trafficked website (10-20 million page views per month), we're looking to add a large amount of data to build data-driven pages. Think of adding 1000s of restaurants to create restaurant profile pages. Obviously we could go the custom post type route with a few different types of post types such as (cities, restuarants, etc.) but my concern is dumping all of this data into the posts and post meta database tables? I've read about custom tables, but I'm also a bit hesitant to go outside the standard wordpress procedures. What is the correct approach here if we're assuming tens of thousands of data objects added to a high traffic website which already publishes 300 blog posts per month or so?