Database custom table issues - incorrect result displayed

First things first: I've spent most of today going over these forums; the stackoverflow forums; the php.net manual; and a bunch of random sites I found through Google Search - so, if I've missed the answer and it seems like I'm asking an already answered question I'm sorry. I've probably just been looking at the same problem for way too long and nothing is making sense. The background: We've inserted some custom tables into the wordpress database, so I can connect to these tables through $wpdb. The code for the working connections is as follows:               global $wpdb;     // get list of localities     $localityRow = $wpdb->get_results( "SELECT * FROM tblYBSLocality ORDER BY Name ASC" );     // get list of schools     $schoolRow = $wpdb->get_results( "SELECT * FROM tblYBSSchool ORDER BY Name ASC" );     // get school ID if form has been submitted     $SelectedSchoolID = $_GET['schools'];     // get location ID if form has been submitted     $SelectedLocationID = $_GET['localities'];      Then later in my page I make it do stuff (scorcery!)               // Create a drop down box for the user to select their location (and one has been done     // for school but I left that out because you get the idea     <select name="localities" style="width: 300px">     <?php     foreach ($localityRow as $locality) {     $LocalityID = $locality->LocalityID;     $LocalityName = $locality->Name;     ?>          <option value=<?php echo $LocalityID; ?> <?php if(isset($SelectedLocationID) &&     $SelectedLocationID == $LocalityID) print(" selected")?>><?php echo $LocalityName;?>     </option>     <?php     }     ?>     </select>      Note - Yes I know using * is bad, I'll fix that later - right now I just want it to work. Using this I can then go through and generate a bunch of stuff using the following:               // get school ID if form has been submitted     $SelectedSchoolID = $_GET['schools'];     // get location ID if form has been submitted     $SelectedLocationID = $_GET['localities'];      This isn't really important to the rest of my issue, so I'll move on. The issue: I'll start with the code. This is supposed to connect to some other tables and do stuff - based on the connections and data retrieved above:               $selectedSchoolName = $wpdb->get_results( "SELECT Name FROM tblYBSSchool WHERE     SchoolID=".$SelectedSchoolID );     // get selected location name     $selectedLocationName = $wpdb->get_results( "SELECT Name FROM tblYBSLocality WHERE     LocalityID=".$SelectedLocationID );     // get route ID     $getRouteID = $wpdb->get_results( "SELECT * FROM tblYBSRoute WHERE RouteID IN ( SELECT     RouteID FROM tblYBSRouteSchool WHERE SchoolID     =".$SelectedSchoolID.")".$SelectedLocationID);      Now, I THINK the issue comes with the ".$SelectedSchoolID ); part (and the location one but this is already getting tldr). What I want to do later in the page (once the user has made their selections and submitted the form), is get results (fancy that!). There are 2 parts to the results: 1st I want to say "Search results for routes between:" the location name and the school name. 2nd, I want to display those results. But I can't even get past the 1st point, so let's fix that first. I have tried 3 different approaches:               // FIRST APPROACH     // This kinda works, it echoes the last locality name from the table     // which is better than nothing     <?php echo $LocalityName;?> and <?php echo $SchoolName;?>
          // SECOND APPROACH     // This gives me the white page of death. Which is hilarious because it's pretty     // much the exact same as what was used in the option - which worked     <?php if(isset($SelectedLocationID) && $SelectedLocationID == $LocalityID) echo     $LocalityName;?> and <?php if(isset($SelectedSchoolID) && $SelectedSchoolID ==     $SchoolID) echo $SchoolName;?>          // THIRD APPROACH     // This also gives me the white page of death. And now I'm out of ideas.     <?php if(isset($SelectedLocationID) && $selectedLocationName == $LocalityName     echo $LocalityName ;?> and <?php if(isset($SelectedSchoolID) &&     $selectedSchoolName == $SchoolName echo $SchoolName ;?>      In my head (HAH!) the last 2 should work. Am I correct in thinking that it's the ".$SelectedSchoolID ); part? Or have I forked something else up entirely? Sorry for the TLDRness, but I thought I should provide as much detail as possible. Any and all help is greatly appreciated. I'm going to go smack my head into the desk a few times now :P


WP Query posts__in not working with array

I am using the following code to generate a specific list of posts with `WP_Query`               $args = array (         'post__in'   => $cookie_array,         'post_type'  => 'tyre',         'post_status'    => 'publish',         'posts_per_page' => '100',     );      `$cookie_array` is an array I generate based on some values in a cookie (post id's). The problem is that for some reason the WP_Query won't display the post that corresponds to the last value in the array. For example if the array consists of 1,2,3 then my WP_Query only gets the posts with the id's 1 and 2. I've printed out the values of the array, right before I call the argument list shown above and there's definitely 1 more value listed than WP_Query is getting. Any ideas what's going on? ## Edit As per request the result of `var_dump($cookie_array)` \- to confirm only 3 items are shown through my WP_Query when the array is set as below:               array(4) { [0]=> string(5) "15829" [1]=> string(5) "22728" [2]=> string(5) "22734" [3]=> string(5) "22725" }       **`var_dump($getposts->request)` outputs:**                string(230) "SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.ID IN (15829,22728,22734,22725) AND wp_posts.post_type = 'tyre' AND ((wp_posts.post_status = 'publish')) ORDER BY wp_posts.post_date DESC LIMIT 0, 100"


Any way to use a custom Parameter for youtube embed without using an iframe?

I do not want to display the titles of videos I embed on my wordpress site. The way I've been doing this is using the embed link, inserting the iframe in the wordpress post and adding the custom Parameter "showinfo=0" to the end of the url. This has worked well, until I decided to change the design of my site. I have had to use some custom css to change all the videos (almost 200) that I've done that to in order to fit the new design. If I would have known of a way just to drop the link into wordpress (like most people do) I wouldn't have had to use an iframe and wordpress would have adjusted the size of the video based on the setting entered in the media section. I'm hoping there is a better way to embed a Youtube video than the way I've been doing it (It would be great to just drop the link into wordpress instead of having to go through so many different steps in order to get the video to show up. Does anyone have any ideas how (of if it's even possible) to do this? I post a video every day, so it would really help my process if there was a way to do this. Thanks. `               <?php     load_theme_textdomain('standardtheme', get_template_directory() . '/lang');     $locale = get_locale();     $locale_file = get_template_directory() . '/languages/$locale.php';     if(is_readable($locale_file)):         require_once($locale_file);     endif;     add_theme_support('post-thumbnails');     require_once('admin/functions.php');     require_once('lib/standardtheme.php');     require_once('lib/pro-photo/pro-photo.php');          function Oembed_youtube_no_title($html,$url,$args){         $url_string = parse_url($url, PHP_URL_QUERY);         parse_str($url_string, $id);         if (isset($id['v'])) {             return '<iframe width="'.$args['width'].'" height="'.$args['height'].'" src="http://www.youtube.com/embed/'.$id['v'].'?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>';         }         return $html;     }     add_filter('oembed_result','Oembed_youtube_no_title',10,3);          ?>


AJAX returns response 0

I'm trying to get user profile values using an AJAX call, but the response is always 0. Here's my PHP:               wp_enqueue_script( // Add JS to          'cc-author-change-post-author',         plugins_url( 'assets/js/change-post-author.js', dirname( __FILE__ ) ),         'jquery'     );     wp_localize_script( // Localize script for AJAX calls         'cc-author-change-post-author', // Name of script call being localized         'authorchange', // AJAX object namespace, used to call values in the JS file         array(             'ajaxurl'   => admin_url( 'admin-ajax.php' ), // URL for admin AJAX calls             'nonce'     => wp_create_nonce( 'cc-author-change-author-nonce' ) // Nonce to authenticate request         )     );          function cc_author_change_postauthor_callback() {         $nonce = $_POST['nonce']; // Assign a local variable for nonce              if ( ! wp_verify_nonce( $nonce, 'cc-author-change-author-nonce' ) ) { // If the nonce doesn't check out, fail the request             exit( 'Your request could not be authenticated' ); // Error message for unauthenticated request         }              if ( current_user_can( 'edit_others_posts' ) || current_user_can( 'edit_others_pages' ) ) { // Check for proper permissions before handling request             $author = $_POST['authorID']; // Assign local variable for submitted post author                  if ( $author ) { // If an author ID was provided, get the user's details                 $authordata = get_userdata( $author ); // Retrieve the selected user's data from their profile                      $authormeta = json_encode( array( // Encode data as JSON                     'display_name'  => $authordata['display_name'], // Display name from profile                     'description'   => $authordata['description'] // Biographical info from profile                 ) );             }             else { // If no author ID was provided, send back an error message                 $authormetaerror = 'No user ID provided. Please try again.'; // Error message to send back                 $authormeta = json_encode( array( // Encode as JSON                     'display_name'  => $authormetaerror,                     'description'   => $authormetaerror                 ) );             }                  echo $authormeta; // Return the values retrieved from the database         }              exit; // End response. Required for callback to return a proper result.     } // cc_author_change_postauthor_callback()     add_action( 'wp_ajax_cc_author_change_postauthor', 'cc_author_change_postauthor_callback' );      And here is my JavaScript:               jQuery( document ).ready( function( $ ) { // Don't execute anything until the page is loaded         $( "#cc_author_postauthor" ).change( function() { // If the author dropdown value is changed, execute the script             /* Data to pass to the server. Called below during $.post() */             var data = {                 action : 'cc_author_change_postauthor',             // Action hook for the server-side callback                 nonce : authorchange.nonce,                         // Nonce received from server to authenticate request                 authorID : $( "#cc_author_postauthor" ).val()       // author ID for retrieving profile data             };                  /* Send request to the server and process response */             $.post(                 authorchange.ajaxurl,                               // URL to send the request to the server                 data,                                               // Data to send to the server, stored in var data                 function( jsonString ) {                            // Script to execute upon successful response from server                     var authormeta = $.parseJSON( jsonString );     // Parse the JSON received from the server response                          $( "#cc_author_meta\\[0\\]\\[display_name\\]" ).val( authormeta.display_name ); // Change the value of the author display name to the value received from the server                     $( "#cc_author_meta\\[0\\]\\[description\\]" ).val( authormeta.description );   // Change the value of the author bio to the value received from the server                 } // function( jsonString )             ); // $.post         }); // $( "#cc_author_postauthor" ).change()     });      Here's the meta box where the form item is located:               function cc_author_metabox( $post ) {         /* Retrieve current values if they exist */         $cc_author_meta = get_post_meta( $post->ID, '_cc_author_meta', true ); // Author meta data (stored as an array)         $postauthorid = $post->post_author; // Get the user ID of the post author              /* If any of the values are missing from the post, retrieve them from the author's global profile */         if ( !$cc_author_meta ) {                    $postauthor = get_userdata( $postauthorid ); // Retrieve the details of the post author                  $cc_author_meta = array(); // Initialize main array             $cc_author_meta[0] = array( // Nested array for author data                 'display_name'  => $postauthor->display_name, // Set display name from post author's data                 'description'   => $postauthor->description // Set bio from the post author's data             );         }              /* Display the meta box contents */         ?>

Changes made to this information will only apply to this post, and will not be saved to the user's profile.
             <?php             if ( current_user_can( 'edit_others_posts' ) || current_user_can( 'edit_others_pages' ) ) { // Check the capabilities of the current user for sufficient privileges                 wp_dropdown_users( array(                     'name'          => 'cc_author_postauthor', // Name for the form item                     'id'            => 'cc_author_postauthor', // Class for the form item                     'selected'      => $postauthorid // Select the post's author to be displayed by default                 ) );                 ?>                                      You have JavaScript disabled. If you change the post author in the dropdown, you will need to save the post for the fields below to update. Please enable JavaScript for a better experience.
<img id="cc_author_postauthor_loading_img" class="cc_author_postauthor_loading_img" src="<?php echo plugins_url( 'assets/img/loading.gif', dirname( __FILE__ ) ); ?>" width="20px" style="width: 20px;">
                 <input type="hidden" name="cc_author_currentpostauthor" value="<?php echo $postauthorid; ?>">                 <?php             }             ?>             Name             <input type="text" name="cc_author_meta[0][display_name]" id="cc_author_meta[0][display_name]" value="<?php echo esc_attr( $cc_author_meta[0]['display_name'] ); ?>" />                  Bio                  <?             $descEditor = new ccAuthorDescEditor( $cc_author_meta[0]['description'], 'cc_author_meta[0][description]' ); // Create the bio editor object             echo $descEditor->editor(); // Display the editor             ?>
         <?php     }      I'm sure the answer is right in front of me, but this is my first time using the WordPress AJAX API. What am I doing wrong? You can see the entire plugin code at its Github repository.


Tools for Converting an Existing Website Design to a WordPress Template?

I know how to do it manually, but is there any tool to help me with that?


Home page of blog says "NOTHING FOUND It seems we can’t find what you’re looking for"

I'm using the Illustratr theme. On the home page of my blog it says:               "NOTHING FOUND. It seems we can’t find what you’re looking for. Perhaps searching can help.",       This appears since I created it. It only shows on that first page, which is static, and where I have only a gallery. Also when I post other content on that page, it stays there. I don't know much about the coding, so changing the template is not really an option... Thank you!


Use the WP media uploader dialog for uploading a form attachment (non-admin). Offering progress and drag and drop feedback

I am building a simple contact form (non-admin) that has an attachment field. Of course I can just handle the upload via WP's wp_handle_upload function. However, I would like to give my visitors a more user friendly experience and manage the upload via wp's media upload "pop-up". Offering them upload progress feedback, drag'n drop etc. I know that this is normally admin only but is there a way to use this upload dialog for normal (non-registered, non- logged in) users? I'm quite amazed that apparently no one really did this (after quite some searching). Thanx!


Changing pagination list class

`paginate_links()` function returns unordered list with class named "page- numbers". How can I change this class? EDIT Currently, I am using the band-aid method below.               $return = paginate_links( $arg );     echo str_replace( "
", '
', $return );      Is there any better way?


How to set up year view for datepicker in The Events Calendar plugin?

I've installed this plugin: http://wordpress.org/plugins/the-events-calendar/ Everything is great except one thing, I can't find where I can change datepicker view. On front-end "Events-In" has this view when you click on it: http://screencast.com/t/eLUeN5tB How can I set up to year view like this: http://screencast.com/t/5z02EpQFCRod ?


Getting data from a table using a query

I’m starting with WordPress and I have a lot of problems and doubts. I’m trying to display on a page data stored in a table of my database. I have a table named Customers (id, name, surname, phone). Im adding code to the main page of the website: [php] $idCon = mysql_connect('localhost','user','password'); if(!$idCon){ echo "Error connecting database."; exit; } mysql_select_db("database",$idCon); $query = "SELECT * FROM CUSTOMERS"; global $respuesta = $wpdb->get_results($query); foreach( $respuesta as $row ) {                   echo $row->nombre;     }      $reg = mysql_fetch_row($res); mysql_close($idConn); [/php] But nothing is displayed in the page. Can you help me? By the way, how can i debug code in wordpress ? That should help me a lot. Thanks


Problem with correctly registering query variable

I have an admin page for my plugin, which lists records from database. I want to sort them under some conditions. To call different sorting options, I've decided to use query string. > Step 1: At the beginning of plugin code I have registered my query var `'bpc_sortby'` with:               add_filter( 'query_vars', 'add_query_vars_filter' );     function add_query_vars_filter( $qvars ){         $qvars[] = 'bpc_sortby';         return $qvars;     }      just like Codex said it should be done. > Step 2: On said admin page, I have created two links targetting the same page, but with an addition of query string to address:               Product ID     Name      > Step 3: When page is loaded it should check `if (isset($wp_query->query_vars['bpc_sortby']))` and if it's set, it should do some sorting stuff. Else, it should spit out 'Not working'. And, uhm, well... when I click one of links, it spit's out 'Not working' despite query args being added to links (well, at least they are visible in page address). And nope, I didn't forget about setting `global $wp_query`. I have spent last two days searching for working answer and I believe query_var from **step 1** is not getting registered, or it does, but for some reason it's removed somewhere later. What I have already tried and failed (all with DEBUG on):   * switching to one of default wordpress themes,   * playing with query var name,   * disabling all other plugins,   * deactivating and activating my plugin,   * `print_r( $wp_query->query_vars);` \- returns empty array(),   * `echo get_query_var( 'bpc_sortby' );` \- returns nothing,   * checking if query_var has been registered correctly, with help of function:              function qv_isset($var_name) {       $array = $GLOBALS['wp_query']->query_vars;       return array_key_exists($var_name, $array);     }     qv_isset ('bpc_sortby');      ...returns `FALSE` \- that's why I guess it's problem with `add_filter`, but I have no clue why it doesn't work as it should. **Question** : any idea why it doesn't work or what should I check? PS. I know that sorting can be done with some jquery/js magic, but I want to avoid using detours when there is a straight road ahead (just with some bumps). PS2. `echo $_GET['bpc_sortby']` returns proper value (`prodid` or `prodname`), but I've heard that I should avoid using $_GET directly and use query vars instead. Can anyone confirm it, or maybe it's not a problem as long as I use them on page which is available only for users with admin permissions? Cheers and sorry for my english, but It's not my native.


Cannot Save User Roles - Set a Role, says Updated, but no Change

thanks for reading my question. I have a Wordpress Site with Delicious Magazine Theme installed. In Users --> Edit User, I want to change a specific user's role to Contributor. When I make the change and save, I get the message "User Updated" but the role does not change. I even tried a new user registration. By default, it gets set to "No Role for this Site" and when I change it to Contributor and click Save, it just reverts back to "No Role for this Site." Anyone have any idea what's up here? Thanks!


How to populate custom tables with rows of data

I'm trying to populate a custom table called countries, with two rows of data. The custom table is created when the plugin is activated. The rows need to be added when the plugin is activated. The code for the custom table is fine, & the custom table is created. My code so far:               register_activation_hook( __FILE__, 'mp_insert_countries_rows' );     function mp_insert_countries_rows(){          global $wpdb;     $mp_insert_country = $wpdb->prefix . 'countries';          $insert_country_rows = $wpdb->insert(          $mp_insert_country,     array(     'id' => '1',     'name' => 'UK',     'labour_cost' => '20',     'overheads' => '0.45',     'profit' => '0.22'          ),          array(     'id' => '2',     'name' =>'China',     'labour_cost' => '6',     'overheads' => '0.27',     'profit' => '0.17'       ));             require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );      dbDelta(  $insert_country_rows );     }      How should I correct this? Thanks


Can I use two different domain names with wordpress multsite network

I am currently running a DV server with MediaTemple and would like to have my domains: abc.com and cba.com mapped to the subdomains I set up with the WP network one.mydomain.com and two.mydomain.com. The goal is keep the urls: abc.com and cba.com viewable in the browser but the zone files are just referencing the subdomains I have set up. Sorry if this kinda of confusing, it is a major headache. Any help would great!


Walker customization - submenu & HTML description

I'm working on a site created by another person who used this customization to display a HTML description (img) in the menu. Now, I'd like for only a menu item to display the subpages, but I can. Someone can give me a tip on how to do it? Thanks a lot


How to add fields to _wp_attachment_metadata?

I'm developing a `custom metabox` with the possibility to upload images and give the user the possibility of deciding whether those images are to be displayed on the front end or not, instead of having to set up an additional metakey/value for each image id, i would like to add a field to the existing metakey in which image metadata is stored `_wp_attachment_metadata` which reads 'public' and give it a bolean value. One of the main reasons i dont't want to have to add other metakeys is it would create additional work removing those if the image is deleted. Theory works fine but upon saving wp wraps everything in arrays and nothing works. The following is the code i've got so far, any help or suggestions is appreciated.               $a = get_post_meta( $thumb_id, '_wp_attachment_metadata' );     // ChromePhp::log('original _wp_attachment_metadata', $a);          $a[0]['image_meta']['public'] = true;     // ChromePhp::log('modified object', $a);          update_post_meta( $thumb_id, '_wp_attachment_metadata', $a );          $b = get_post_meta( $thumb_id, '_wp_attachment_metadata' );     // ChromePhp::log('updated metakey', $b);      PS. the ChromePhp stuff is just a debugger i use for Chrome (https://github.com/ccampbell/chromephp) Thanks


Saving a post ID to use in a form elsewhere on website

I am trying to save a certain queried post's ID to pass on in a form outside of my loop. To be more specific. I have one file named **review.php** , this file contains a Wordpress Loop which queries one post at a time. In my **sidebar.php** I have a form setup which will only display if the user is currently on the **review.php** page. This form should pass along the queried post's ID from **review.php** in a hidden field. This ID will later be used to make changes to that post after form submission. (It's a reviewing system for posts) How do I store the post's ID in **review.php** so that I can later echo it in my **sidebar.php**?


Display Past Events in All-in-One Event Calendar

I'm a Wordpress noob, so I need some help! I'm working on a website for a radio program and I'm using the All-in-One Event Calendar to schedule my shows. I already have the Agenda view on my homepage via shortcode so that it only shows 3 events. On my actual event page, I have the Agenda view hidden and have the posterboard view as default. What I'd like to do is keep my Agenda view on the home page to show the 3 upcoming events. But, I'd like the posterboard view to show past events, from today and back. I've been searching all around, but as I said, I'm a Wordpress noob. I found the following code:               <?php              // Gets localized time         $time = $ai1ec_events_helper->gmt_to_local( Ai1ec_Time_Utility::current_time() );         $bits = $ai1ec_events_helper->gmgetdate( $time );              // Sets start time to today         $start = gmmktime(0,0,0,$bits['mon'],$bits['mday'],$bits['year']);              // Sets end time to a year from today i.e. $bits['year']+1         $end = gmmktime(0,0,0,$bits['mon'],$bits['mday'],$bits['year']+1);              // Look in class-ai1ec-calendar-helper.php for details         $get_events = $ai1ec_calendar_helper->get_events_between($start, $end, $filter, $spanning = false);              date_default_timezone_set('America/Toronto'); // Match timezone settings in WP              // For each event         foreach($get_events as $event) {                  // Event ID             $eventID = $event->post->ID;                  // Event Title             $eventTitle = $event->post->post_title;                  // Event URL             $eventURL = $event->post->guid . $event->instance_id;                  // Event Date             $eventMonth = date( 'M', $event->start );             $eventDay = date( 'd', $event->start );                  // Event Image             $imgID = get_post_thumbnail_id( $eventID );                  // Event Time             if( $event->allday == 1 ) {                 $timeSpan = 'All Day';             } else {                 $startTime = date( 'g:ia', $event->start );                 $endTime = date( 'g:ia', $event->end );                 $timeSpan = $startTime . ' - ' . $endTime;             }                  $attr = array(                 'alt' => get_post_meta( $imgID , '_wp_attachment_image_alt', true ),                  'data-name' => $eventTitle,                  'data-month' => $eventMonth,                 'data-day' => $eventDay,                 'data-time' => $timeSpan,                 'data-url' => $eventURL             );             echo get_the_post_thumbnail( $eventID, 'full', $attr );         }     ?>      Which seems like it would be the correct thing, or at least it's on the correct path. Problem is, since I'm a noob, I don't know where to put this code! How do I implement it? And please, spell it out for me as I'm a noob. Thank you immensely for any help!


Code a Slider into an Archive Loop

I have created a custom archive page for my custom taxonomy.   I want each post to display a slider for its images. I know I have to write some custom code for this work but I can't find any tutorials to push me in the right direction. Where should I start, what files do I have to change?


One Domain, Two Installs of WordPress

I'm looking into an upcoming project of a redesign of an existing website. The plan is to install one single installation of WordPress at domain.com. The admin area will be locked down and accessible only to individuals inside the organization's network. There is a subsection of the site that needs to exist to allow for other individuals outside of the organization to create and publish content. I'd like to set up a separate multisite install of WordPress at subdomain.domain.com. This multisite would be installed with subdirectories so each site will be at subdomain.domain.com/site1 and subdomain.domain.com/site2, etc. As far as I've read, all of this should work fine with WordPress. The reason we would like to keep two separate installs is simply for security so the base install of wordpress on domain.com isn't accessible in anyway from external sources. I'm just curious if anyone has any experience with this set up or sees any potential pitfalls.


Taxonomy Meta Box in User Profile?

Is it possible to have users populate a taxonomy meta box(es), using the post_tag or any custom taxonomies I create? The idea is to include users in a network into the taxonomy schema, which would bring the community together in a better way. I guess a more specific way to ask this is how would I add taxonomy meta boxes to the user interface. Obviously anything's possible if I'm willing to go far enough. Is this something that can be done using existing WP API's etc? Thanks.


How would I compare and remove hacks to core?

I have been put in charge of a site that have a lot (and i mean it) of core hacks, some are pretty easy, some are really hard to spot (like removing a do_action on `the_content`. So, my question is , how i would and remove the hacks the previous maintaners did, while adding the new features requested. Should i go and fix as soon as i spot them, or actively search for any hack in the core? (Side-Effect of the core hacks,can not update wordpress or it will completely break and a lot of features will be "removed" effectively putting the site down)


How to set posts per page using WP_Query()

I'm trying to set the number of posts_per_page dynamically using my own variable. This code works fine:               query_posts( $query_string  . "&posts_per_page=" . $myvar )     // then display the loop using get_template_part( 'loop' );      That works fine, but I would like to know how to do it using $wp_query instead of query_posts. However, this does not work:               $wp_query->set('posts_per_page', $myvar)     // then display the loop using get_template_part( 'loop' );      That has no effect on the number of posts displayed. Am I using the set method incorrectly, or is there something I'm missing?


Have users created automatically when a network site is created

Trying to figure out how to have users created automatically when a network site is created. So currently when a new user registers, their account is created and their network site is created. That gives that new site one user already (the site's admin). But when that's created I'd like to also have 3 more users automatically created to each new network site on creation.


How do I order pages and categories by ID or name in the same query?

I would like to query most of my pages and categories on the homepage. So far I am able to get the pages and category (posts), but I cannot order the list the way I want to. I want to be able to get a custom order like page, posts from a category, another page, and posts from another category. I am using the following:                       <?php             $args = array(                  'cat' => $current,                 'post_type' => array(                      'page', 'post'),                 'orderby' => 'ID' && array(2,4,1),             );             query_posts( $args );             while ( have_posts()) : the_post(); ?>                 <?php // Include the page content template.                 if ( is_page() ):                     get_template_part( 'content', 'page' );                 else:                     get_template_part( 'content', 'post' );                 endif;                 ?>             <?php endwhile;              ?>      by the way I am using twentyfourteen and I don't want to have multiple queries to that job unless it doesn't put a burden on the web server. I want to save memory as much as I can.


custom fields wordpress

I am trying to add a value assigned in the custom field by doing a post in these following steps: I make a new post, add a new custom field where i specify a name and a value. **PHP** I add the following scripts to index.php loop exactly below where the **while** and its parameter begins and to the HTML where I want the field added respectively               <?php while ( have_posts() ) : the_post(); ?>     <?php the_meta();?>               <?php echo get_post_meta(get_the_ID(), 'key');?>      The hard part for me to understand if i am doing right is the HTML. when i launch the site using firefox and firebug, I detect the post and find the html where the field is supposed to be added. But I noticed that WP automatically generates paragraph tags for the original post, so i honestly dont know where i am supposed to add the get_post_meta for it to be added into my post.


When WordPress Does Not Provide an .htaccess File for New Multisite Sites because of CPanel Fantastico Auto-Installer?

I have installed WordPress via an auto-installer and later configured it as multisite. But whenever I create the WordPress site using auto-installer it doesn't give me the `.htaccess` file by default. So I've created an empty file with the name `.htaccess` in CPanel and pasted this code in to it:               RewriteEngine On      RewriteBase /     RewriteRule ^index\.php$ - [L]          # uploaded files      RewriteRule ^files/(.+)wp-includes/ms-files.php?file=$1 [L]          RewriteCond %{REQUEST_FILENAME} -f     [OR] RewriteCond %{REQUEST_FILENAME} -d      RewriteRule ^ - [L]      RewriteRule . index.php [L]      Is it a right method ?


Sharing Ad Revenue among Users of a Multisite in a Collaborative Model?

Is anyone aware of some functionality to share the revenue among the users of a Multisite? A multisite lets other people create and mainatain their own blogs. The Multisite owner should able to share some percentage, say N% (like 20%) of revenue on the sub-sites hosted. **Example:** > You are that owner of a Multisite on xyz.com and offer blogs to your > "friends" User1, User2 and so on. User1 and User2 use adsense or adbrite on > their blog. The functionality would ensure that you get 20% from the revenue > they earn. I have seen the author-advertising-plugin (Wordpress Plugin) which shares the revenue within a single site among multiple authors. I do not know if it supports Multisite because for me it would be better. If I have the possibility to share the revenue Multisite-wide. I would like to know If that plugin suits perfectly to Multisite installation or not.


Can I use AdSense on a free wordpress blog?

Is it possible to use AdSense on a free .wordpress.com blog? I can't see any way of doing this in the configuration. There are options to add text widgets etc, but nothing for adds?


Load new Posts on Scroll on Page

See this reference site: http://alwaysjudging.com/archive/ It's loading new posts on scroll down, similar to Infinte Scroll plugin. (But I'm unable to get the Jetpack Infinite Scroll plugin to work on a static "archive" page using a query of posts, so I saw this instead.) **Ho would I implement this feature on a page?** When I view the source of the referne site above, it shows the script is loaded here: http://alwaysjudging.com/assets/js/scripts.min.js **It appears that the selector involves ".post-nav" and ol li tags.** I'm a front end developer, so my knowledge of actually writing Javascript and PHP is very limited. If you can explain how I can use this to work on my website single page it would be greatly appreciated. I think it would also be useful for all those people who can't use Infinte Scroll plugin to load posts on an Archive page also. Thank you for any guidance you can offer.


Formatting Code Snippets on Free WordPress.com Account?

I've got a WordPress blog on WordPress.com. When posting something I'm including some sample Java code in the `<code` tags, is there any way I can have this formatted better? Such as syntax highlighting and line numbers etc? An example of what I have is here, even though I have the code tags it doesnt seem to make it any more readable than normal text Am I limited in choices as I've gone for the free option?


Username was changed to "admin"

I suspect a hacking incident in my wordpress site. My username was changed to "admin". How to revert back my username safely? Thanks


url - ajax loaded but no JS

I have this url to call the taxonomy.php by pressing the button with the code beneath to show filtered posts:               http://myurl/?meta_key=post_views_count&orderby=meta_value&order=ASC      This is the JS I am using:                   $(document).ready(function(){     $.ajaxSetup({cache:false});     $("#hot a").click(function(){              var post_id = $(this).attr("rel")         $(".postbox_wrapper").html('<img src="<?php bloginfo ('template_directory'); ?>/images/287.gif">');         $(".postbox_wrapper").load(jQuery(this).attr("href") + " .postbox_wrapper")         return false;     });      }); The call works perfectly - the content show up without pagereload - as I wish. The problem is, that JS is not loaded on the ajaxloaded pages and I really don't get it to load. I tried out many versions, I found on stackexchange, but nothing worked out. For example this needs to be loaded into the ajaxed call: `http://myname.disqus.com/count.js?ver=3.4.1` Has anybody an idea? Thanky you very much. AD


Sort by posts that have a featured image?

I'd like to sort posts on the index page to show those that have a featured image first. I've done this in functions.php:                  add_filter( 'pre_get_posts', 'my_get_posts' );             function my_get_posts( $query ) {          if ( is_home() || is_archive() ) {            $query->set('orderby', 'meta_value');            $query->set('meta_key', '_wp_attached_file');          }        }      The causes no posts to be shown on the index page. What should I be doing here?


How to rename  'TAG' to 'TOPIC'

i want to rename TAG to TOPIC and url it should be wordpress.stackexchange.com/tag/ to wordpress.stackexchange.com/topic/ is it possible ?


Where does WordPress store version number?

Easy question. Where does the self-hosted WordPress store version information?


special characters after saving draft interpreted as �

I am trying to create posts in hindi language. These characters `UÉeÉMÑüqÉÉU` after saving/publishing are interpreted as `U�e�M��q��U`. Though, the special characters are stored with no change in the mysql database. The `�` symbol is only during retrieving. I'm stuck here. The post editor is modified to intake multiple posts. http://www.farinspace.com/multiple-wordpress-wysiwyg-visual- editors/ I tried commenting these lines in wp-config.php. But none worked.               /** Database Charset to use in creating database tables. */     define('DB_CHARSET', 'UTF-8');          /** The Database Collate type. Don't change this if in doubt. */     define('DB_COLLATE', '');      Also, placed `mysql_query("SET NAMES utf8");` in wpdb class constructor of wp- db.php. Negative, even this didn't work How do i overcome this?


How to list all custom post types in a custom widget?

I tried the Following (whihc lists custom post types called Static Content):                <?php          add_action("widgets_init", array('Widget_name', 'register'));     class Widget_name {       function control(){             $custom_posts = new WP_Query();             $custom_posts->query('post_type=page_content&page_sections=Lastest');             while ($custom_posts->have_posts()) : $custom_posts->the_post();         ?>

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

         <?php endwhile;       }       function widget($args){         echo $args['before_widget'];         echo $args['before_title'] . 'Your widget title' . $args['after_title'];         echo $args['after_widget'];       }       function register(){         register_sidebar_widget('Widget name', array('Widget_name', 'widget'));         register_widget_control('Widget name', array('Widget_name', 'control'));       }     }          ?>      But no luck. There's nothing displayed in the widget. Any suggestions?


How to list custom post types in a secondary sidebar?

I have a custom post type called "Static Content." I would like to list those posts in the following secondary sidebar: **sidebar-secondary:**
         <?php             // A second sidebar for widgets, just because.             if ( is_active_sidebar( 'secondary-widget-area' ) ) : ?>
                     <?php dynamic_sidebar( 'secondary-widget-area' ); ?>
              <?php endif; ?>
      Any suggestions?


What action hook updates post meta?

Is there an straight-forward example anywhere of using wp_update_post() to edit post_meta on the front end? I have not been able to find any good learning resources. What I want to do is display post meta in an input field and when a user clicks _submit_ trigger `wp_update_post();`. ![post meta in input field with save button](http://i.stack.imgur.com/uR70A.png) Thanks!


Global, network-wide shortcodes or text replace functions

What I'm trying to achieve is a simple text-replace functions, that would be available to any site in my Wordpress Network. Basically I want to:   1. Change `[--]` into `—` (--),   2. Be able to link to my own posts using only their titles -- `[internallink post=title]` or anything similar. I found simple example of solving this using shortcodes. But I don't know, where to put my custom shortcodes definition, so it would be available to any site in my Wordpress Network. I'm always looking into solutions as simple as possible, so I would like to know, if I have to use shortcodes to solve these two tasks or:   1. Is there an easy way to define global search & replace mechanism, so any occurence of just `--` would be changed to `—` in any post or page on any site in the network?   2. Is there anyway to define global shortcode function, that would convert any `[post title]` into link poiting to post titled "Post Title"? Thank you in advance for any help here?


Last posts from custom taxonomy

How can I post last posts from custom_taxonomy? I tried this like, but it doesn't works.               $terms=get_terms('tax_name');     $request=array();      if(count($terms)>0)      {       foreach($terms as $t)        {            $request[]=$t->slug;          }       }       query_posts(       array(         'tax_query' =>     array(                  'taxonomy' => 'tax_name',                  'field' => 'slug',                  'terms' => $request,                  )         )       );       while ( have_posts() ):the_post();


get_stylesheet_uri returns wrong path

I am using the roots theme. Inside scripts.php, the stylesheets are loaded using the wp_enqueue_style-function.                 wp_enqueue_style('roots_bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.css', false, null);       wp_enqueue_style('roots_bootstrap_responsive', get_template_directory_uri() . '/assets/css/bootstrap-responsive.css', array('roots_bootstrap'), null);       wp_enqueue_style('roots_app', get_template_directory_uri() . '/assets/css/app.css', false, null);      I tried to add my own stylesheet (style.css, it can be found directly inside the template folder) the same way:                 wp_enqueue_style('fsc', get_stylesheet_uri(), false, null);      This is the output:               <link href="/wordpress/style.css" rel="stylesheet">      Of course this doesnt work. Same for get_template part or blog_info('stylesheet_url') What's interesting is, that the other paths are wrong, too:               <link href="/wordpress/assets/css/app.css" rel="stylesheet">      But the bootstrap stylesheets are loaded however. How is that possible? This is the htaccess:                           # BEGIN HTML5 Boilerplate                      ###                 ### This contains the HTML5 Boilerplate .htaccess that can be found at:                 ### https://github.com/h5bp/server-configs/blob/master/apache/.htaccess                 ###                 ### Added:                 ###   Block access to WordPress files that reveal version information.                 ###                 ### Removed:                 ###   Expires headers:      Use W3 Total Cache                 ###   ETag removal:         Use W3 Total Cache                 ###   Start rewrite engine: Handled by WordPress                 ###   Suppress/force www:   Handled by WordPress                 ###   Custom 404 page:      Handled by WordPress                 ###                 ### Commmented out by default:                 ###   Options -MultiViews:  Causes a server 500 error on most shared hosts                 ###                 ### Anytime you update this file the .htaccess file in the root of your                 ### WordPress install is automatically updated with the changes whenever                 ### the permalinks are flushed or set (see lib/htaccess.php)                 ###                                # ----------------------------------------------------------------------                 # Better website experience for IE users                 # ----------------------------------------------------------------------                      # Force the latest IE version, in various cases when it may fall back to IE7 mode                 #  github.com/rails/rails/commit/123eb25#commitcomment-118920                 # Use ChromeFrame if it's installed for a better experience for the poor IE folk                      <IfModule mod_headers.c>                   Header set X-UA-Compatible "IE=edge,chrome=1"                   # mod_headers can't match by content-type, but we don't want to send this header on *everything*...                   <FilesMatch "\.(appcache|crx|css|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svg|svgz|ttf|vcf|webm|webp|woff|xml|xpi)$">                     Header unset X-UA-Compatible                   </FilesMatch>                 </IfModule>                           # ----------------------------------------------------------------------                 # Cross-domain AJAX requests                 # ----------------------------------------------------------------------                      # Serve cross-domain Ajax requests, disabled by default.                 # enable-cors.org                 # code.google.com/p/html5security/wiki/CrossOriginRequestSecurity                      #  <IfModule mod_headers.c>                 #    Header set Access-Control-Allow-Origin "*"                 #  </IfModule>                           # ----------------------------------------------------------------------                 # 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|ico|jpe?g|png|svg|svgz|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 "\.(eot|font.css|otf|ttc|ttf|woff)$">                     Header set Access-Control-Allow-Origin "*"                   </FilesMatch>                 </IfModule>                           # ----------------------------------------------------------------------                 # Proper MIME type for all files                 # ----------------------------------------------------------------------                      # JavaScript                 #   Normalize to standard type (it's sniffed in IE anyways)                 #   tools.ietf.org/html/rfc4329#section-7.2                 AddType application/javascript         js jsonp                 AddType application/json               json                      # Audio                 AddType audio/mp4                      m4a f4a f4b                 AddType audio/ogg                      oga ogg                      # Video                 AddType video/mp4                      mp4 m4v f4v f4p                 AddType video/ogg                      ogv                 AddType video/webm                     webm                 AddType video/x-flv                    flv                      # SVG                 #   Required for svg webfonts on iPad                 #   twitter.com/FontSquirrel/status/14855840545                 AddType     image/svg+xml              svg svgz                 AddEncoding gzip                       svgz                      # Webfonts                 AddType application/font-woff          woff                 AddType application/vnd.ms-fontobject  eot                 AddType application/x-font-ttf         ttf ttc                 AddType font/opentype                  otf                      # Assorted types                 AddType application/octet-stream            safariextz                 AddType application/x-chrome-extension      crx                 AddType application/x-opera-extension       oex                 AddType application/x-shockwave-flash       swf                 AddType application/x-web-app-manifest+json webapp                 AddType application/x-xpinstall             xpi                 AddType application/xml                     rss atom xml rdf                 AddType image/webp                          webp                 AddType image/x-icon                        ico                 AddType text/cache-manifest                 appcache manifest                 AddType text/vtt                            vtt                 AddType text/x-component                    htc                 AddType text/x-vcard                        vcf                           # ----------------------------------------------------------------------                 # Allow concatenation from within specific js and css files                 # ----------------------------------------------------------------------                      # e.g. Inside of script.combined.js you could have                 #   <!--#include file="libs/jquery-1.5.0.min.js" -->                 #   <!--#include file="plugins/jquery.idletimer.js" -->                 # and they would be included into this single file.                      # This is not in use in the boilerplate as it stands. You may                 # choose to use this technique if you do not have a build process.                      #<FilesMatch "\.combined\.js$">                 #  Options +Includes                 #  AddOutputFilterByType INCLUDES application/javascript application/json                 #  SetOutputFilter INCLUDES                 #</FilesMatch>                      #<FilesMatch "\.combined\.css$">                 #  Options +Includes                 #  AddOutputFilterByType INCLUDES text/css                 #  SetOutputFilter INCLUDES                 #</FilesMatch>                           # ----------------------------------------------------------------------                 # Gzip compression                 # ----------------------------------------------------------------------                      <IfModule mod_deflate.c>                        # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/                   <IfModule mod_setenvif.c>                     <IfModule mod_headers.c>                       SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding                       RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding                     </IfModule>                   </IfModule>                        # Compress all output labeled with one of the following MIME-types                   # (for Apache versions below 2.3.7, you don't need to enable `mod_filter`                   # and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines as                   # `AddOutputFilterByType` is still in the core directives)                   <IfModule mod_filter.c>                     AddOutputFilterByType DEFLATE application/atom+xml \                                                   application/javascript \                                                   application/json \                                                   application/rss+xml \                                                   application/vnd.ms-fontobject \                                                   application/x-font-ttf \                                                   application/xhtml+xml \                                                   application/xml \                                                   font/opentype \                                                   image/svg+xml \                                                   image/x-icon \                                                   text/css \                                                   text/html \                                                   text/plain \                                                   text/x-component \                                                   text/xml                   </IfModule>                      </IfModule>                           # ----------------------------------------------------------------------                 # Prevent mobile network providers from modifying your site                 # ----------------------------------------------------------------------                      # The following header prevents modification of your code over 3G on some                 # European providers.                 # This is the official 'bypass' suggested by O2 in the UK.                      # <IfModule mod_headers.c>                 # Header set Cache-Control "no-transform"                 # </IfModule>                           # ----------------------------------------------------------------------                 # Stop screen flicker in IE on CSS rollovers                 # ----------------------------------------------------------------------                      # The following directives stop screen flicker in IE on CSS rollovers - in                 # combination with the "ExpiresByType" rules for images (see above).                      # BrowserMatch "MSIE" brokenvary=1                 # BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1                 # BrowserMatch "Opera" !brokenvary                 # SetEnvIf brokenvary 1 force-no-vary                           # ----------------------------------------------------------------------                 # Set Keep-Alive Header                 # ----------------------------------------------------------------------                      # Keep-Alive allows the server to send multiple requests through one                 # TCP-connection. Be aware of possible disadvantages of this setting. Turn on                 # if you serve a lot of static content.                      # <IfModule mod_headers.c>                 #   Header set Connection Keep-Alive                 # </IfModule>                           # ----------------------------------------------------------------------                 # Cookie setting from iframes                 # ----------------------------------------------------------------------                      # Allow cookies to be set from iframes (for IE only)                 # If needed, specify a path or regex in the Location directive.                      # <IfModule mod_headers.c>                 #   Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""                 # </IfModule>                           # ----------------------------------------------------------------------                 # Built-in filename-based cache busting                 # ----------------------------------------------------------------------                      # If you're not using the build script to manage your filename version revving,                 # you might want to consider enabling this, which will route requests for                 # `/css/style.20110203.css` to `/css/style.css`.                      # To understand why this is important and a better idea than all.css?v1231,                 # please refer to the bundled documentation about `.htaccess`.                      # <IfModule mod_rewrite.c>                 #   RewriteCond %{REQUEST_FILENAME} !-f                 #   RewriteCond %{REQUEST_FILENAME} !-d                 #   RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L]                 # </IfModule>                           # ----------------------------------------------------------------------                 # Prevent SSL cert warnings                 # ----------------------------------------------------------------------                      # Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent                 # https://www.example.com when your cert only allows https://secure.example.com                      # <IfModule mod_rewrite.c>                 #   RewriteCond %{SERVER_PORT} !^443                 #   RewriteRule ^ https://example-domain-please-change-me.com%{REQUEST_URI} [R=301,L]                 # </IfModule>                           # ----------------------------------------------------------------------                 # Force client-side SSL redirection                 # ----------------------------------------------------------------------                      # If a user types "example.com" in her browser, the above rule will redirect her                 # to the secure version of the site. That still leaves a window of opportunity                 # (the initial HTTP connection) for an attacker to downgrade or redirect the                 # request. The following header ensures that browser will **only** connect to                 # your server via HTTPS, regardless of what users type in the address bar.                      # <IfModule mod_headers.c>                 #   Header set Strict-Transport-Security max-age=16070400;                 # </IfModule>                           # ----------------------------------------------------------------------                 # Prevent 404 errors for non-existing redirected folders                 # ----------------------------------------------------------------------                      # without -MultiViews, Apache will give a 404 for a rewrite if a folder of the                 # same name does not exist.                 # webmasterworld.com/apache/3808792.htm                      # Options -MultiViews                           # ----------------------------------------------------------------------                 # UTF-8 encoding                 # ----------------------------------------------------------------------                      # Use UTF-8 encoding for anything served text/plain or text/html                 AddDefaultCharset utf-8                      # Force UTF-8 for a number of file formats                 AddCharset utf-8 .atom .css .js .json .rss .vtt .xml                           # ----------------------------------------------------------------------                 # A little more security                 # ----------------------------------------------------------------------                      # To avoid displaying the exact version number of Apache being used, add the                 # following to httpd.conf (it will not work in .htaccess):                 # ServerTokens Prod                      # "-Indexes" will have Apache block users from browsing folders without a                 # default document Usually you should leave this activated, because you                 # shouldn't allow everybody to surf through every folder on your server (which                 # includes rather private places like CMS system folders).                 <IfModule mod_autoindex.c>                   Options -Indexes                 </IfModule>                      # Block access to "hidden" directories or files whose names begin with a                 # period. This includes directories used by version control systems such as                 # Subversion or Git.                 <IfModule mod_rewrite.c>                   RewriteCond %{SCRIPT_FILENAME} -d [OR]                   RewriteCond %{SCRIPT_FILENAME} -f                   RewriteRule "(^|/)\." - [F]                 </IfModule>                      # Block access to backup and source files. These files may be left by some                 # text/html editors and pose a great security danger, when anyone can access                 # them.                 <FilesMatch "(\.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|swp)|~)$">                   Order allow,deny                   Deny from all                   Satisfy All                 </FilesMatch>                      # If your server is not already configured as such, the following directive                 # should be uncommented in order to set PHP's register_globals option to OFF.                 # This closes a major security hole that is abused by most XSS (cross-site                 # scripting) attacks. For more information: http://php.net/register_globals                 #                 # IF REGISTER_GLOBALS DIRECTIVE CAUSES 500 INTERNAL SERVER ERRORS:                 #                 # Your server does not allow PHP directives to be set via .htaccess. In that                 # case you must make this change in your php.ini file instead. If you are                 # using a commercial web host, contact the administrators for assistance in                 # doing this. Not all servers allow local php.ini files, and they should                 # include all PHP configurations (not just this one), or you will effectively                 # reset everything to PHP defaults. Consult www.php.net for more detailed                 # information about setting PHP directives.                      # php_flag register_globals Off                      # Rename session cookie to something else, than PHPSESSID                 # php_value session.name sid                      # Disable magic quotes (This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.)                 # php_flag magic_quotes_gpc Off                      # Do not show you are using PHP                 # Note: Move this line to php.ini since it won't work in .htaccess                 # php_flag expose_php Off                      # Level of log detail - log all errors                 # php_value error_reporting -1                      # Write errors to log file                 # php_flag log_errors On                      # Do not display errors in browser (production - Off, development - On)                 # php_flag display_errors Off                      # Do not display startup errors (production - Off, development - On)                 # php_flag display_startup_errors Off                      # Format errors in plain text                 # Note: Leave this setting 'On' for xdebug's var_dump() output                 # php_flag html_errors Off                      # Show multiple occurrence of error                 # php_flag ignore_repeated_errors Off                      # Show same errors from different sources                 # php_flag ignore_repeated_source Off                      # Size limit for error messages                 # php_value log_errors_max_len 1024                      # Don't precede error with string (doesn't accept empty string, use whitespace if you need)                 # php_value error_prepend_string " "                      # Don't prepend to error (doesn't accept empty string, use whitespace if you need)                 # php_value error_append_string " "                      # Increase cookie security                 <IfModule mod_php5.c>                   php_value session.cookie_httponly true                 </IfModule>                      # END HTML5 Boilerplate                      # BEGIN WordPress                 <IfModule mod_rewrite.c>                 RewriteEngine On                 RewriteBase /wordpress/                 RewriteRule ^index\.php$ - [L]                 RewriteRule ^assets/css/(.*) /wordpress/wp-content/themes/fsc/assets/css/$1 [QSA,L]                 RewriteRule ^assets/js/(.*) /wordpress/wp-content/themes/fsc/assets/js/$1 [QSA,L]                 RewriteRule ^assets/img/(.*) /wordpress/wp-content/themes/fsc/assets/img/$1 [QSA,L]                 RewriteRule ^plugins/(.*) /wordpress/wp-content/plugins/$1 [QSA,L]                 RewriteCond %{REQUEST_FILENAME} !-f                 RewriteCond %{REQUEST_FILENAME} !-d                 RewriteRule . /wordpress/index.php [L]                 </IfModule>                      # END WordPress      This is the htaccess.php, I was talking about:               <?php     /**      * Add HTML5 Boilerplate's .htaccess via WordPress      */     function roots_add_h5bp_htaccess($content) {       global $wp_rewrite;       $home_path = function_exists('get_home_path') ? get_home_path() : ABSPATH;       $htaccess_file = $home_path . '.htaccess';       $mod_rewrite_enabled = function_exists('got_mod_rewrite') ? got_mod_rewrite() : false;            if ((!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks()) || is_writable($htaccess_file)) {         if ($mod_rewrite_enabled) {           $h5bp_rules = extract_from_markers($htaccess_file, 'HTML5 Boilerplate');           if ($h5bp_rules === array()) {             $filename = dirname(__FILE__) . '/h5bp-htaccess';             return insert_with_markers($htaccess_file, 'HTML5 Boilerplate', extract_from_markers($filename, 'HTML5 Boilerplate'));           }         }       }            return $content;     }          if (current_theme_supports('h5bp-htaccess')) {       add_action('generate_rewrite_rules', 'roots_add_h5bp_htaccess');     }


Inserting above the comment template

I want to insert content, just above the comment template.I have tried all the word-press filters and hooks but failed. I want to insert the content above the comment template, I mean above all comments. Thanks EDIT               function my_fields() {      echo '<p>action/p>';          }     add_action('comment_notes_before','my_fields');       Please see the image-I want to insert content in color part of the image in single.php ![enter image description here](http://i.stack.imgur.com/YMNWo.png)


Tracking Disqus comments on Google Analytics

I'm using Disqus for my blog comments, and Google Analytics for tracking users. I have both implemented using plugins (Disqus Comment System and Google Analyticator). I'd like to track comments, but I can't figure out how to do that. I have researched the problem, and there's some documentation for it, but it's not very clear. So far I've found some help from Disqus themselves (here), and from On Digital (here), so now I know what code to add. What they don't mention is where to add it. Do I insert it in one of the Disqus plugin files? My theme? Which file, and where?


Need to call this php function inside a modal window from text widget

Need to call this php function inside a modal window from sidebar text widget               <?php echo get_post_meta( $post->ID, 'link', true ); ?>


Position taxonomy box below editor in custom post type

How do I move the custom taxonomy below the editor? I have a meta box called property details and I want the taxonomy to appear below it. I am adding it using the following code. I don't want it to appear on the right hand side as it does by default.               function add_custom_taxonomies() {         // Add new "Locations" taxonomy to Posts         register_taxonomy('features', 'property_lettings', array(         // Hierarchical taxonomy (like categories)         'hierarchical' => true,         // This array of options controls the labels displayed in the WordPress Admin UI         'labels' => array(           'name' => _x( 'Features', 'taxonomy general name' ),           'singular_name' => _x( 'Feature', 'taxonomy singular name' ),           'search_items' =>  __( 'Search Feature' ),           'all_items' => __( 'All Feature' ),           'parent_item' => __( 'Parent Feature' ),           'parent_item_colon' => __( 'Parent Feature:' ),           'edit_item' => __( 'Edit Feature' ),           'update_item' => __( 'Update Feature' ),           'add_new_item' => __( 'Add New Feature' ),           'new_item_name' => __( 'New Feature Name' ),           'menu_name' => __( 'Features' ),         ),         // Control the slugs used for this taxonomy         'rewrite' => array(           'slug' => 'features', // This controls the base slug that will display before each term           'with_front' => false, // Don't display the category base before "/locations/"           'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/"         ),       ));     }        add_action( 'init', 'add_custom_taxonomies', 0 );


Wordpress site stopped working after simply opening header.php in the wp-admin editor

I opened `header.php` inside the wp-admin editor and suddenly the actual site is filled with diamond shaped question marks. Admin area still works. The weird thing is that I didn't even perform any edits to the file. In the matter of fact Wordpress told me that this file needs to be write-enabled before I can save changes to it... What on earth could have happened here?


Attach a file to a post

I would like to attach a ZIP file to every post I write on my blog. I'd like to find a plugin that will do these things: 1- **Insert on the post editor** a box like this which allows me to upload the file. 2- Automatically insert **at the bottom of each post** a box that allows the reader to download the file I attached.


Creating teams of users in Wordpress

I'm currently working on a University project wich is a website for managing a GameJam event that occures every 6 months. Our users will be in teams of 1 to 4 people and will be able to post about their game development live on our website during 48h. Last year, we used a simple wordpress blog and told our users not to post in other categories, but it's getting bigger this year and we want more restrictions. I've made a plugin that handles custom post types but I'm wondering how could I integrate "Teams" in the wordpress role system. I have made a new role wich is "gamejam_user". The custom post have these capabilities:               'capability_type' => 'teams_post',                     'capabilities' => array(                         'delete_others_posts' => 'delete_others_teams_posts',                         'delete_post' => 'delete_teams_post',                         'delete_posts' => 'delete_teams_posts',                         'delete_private_posts' => 'delete_private_teams_posts',                         'delete_published_posts' => 'delete_published_teams_posts',                         'edit_others_posts' => 'edit_others_teams_posts',                         'edit_post' => 'edit_teams_post',                         'edit_posts' => 'edit_teams_posts',                         'edit_private_posts' => 'edit_private_teams_posts',                         'edit_published_posts' => 'edit_published_teams_posts',                         'publish_posts' => 'publish_teams_posts',                         'read_private_posts' => 'read_private_teams_posts',                         'read_posts' => 'read_teams_posts'                         ),      But now, I'm just not sure how I'll integrate the team system as teams cannot edit other teams posts but users in a specific team can edit other posts in the same team. The simple way could be to make the users create one account for their team and to use only this account, but it's not what we are looking for, our next event is in 1 week so this is probably what we will do, but since this is a 2events per year, I'll defenitly need a way to accomplish this with the plugin. Note: The team creation is backend only, Teams could have their own page with the loop of their own posts included at the bottom of their page (this could be done with a hook for each posts if teams were custom post types but how to tell wordpress a custom post type is also a group of users? And how can we create a new capabilitie that says you can edit others posts but only the ones from people in your team?). Any Idea?


wp_set_post_terms is assigning only the last of several terms to a post

I have this really simple setup where I loop through an array of actors, and for each actor name I successfully insert a term. Then I use wp_set_post_terms to assign the terms to a post, but this only assigns the last term to that post. I am new to using taxonomy/terms so maybe there's an obvious solution. Here's my code:               foreach ($cast as $actor) {              $actor_term_id = wp_insert_term( $actor[name], 'actor', array(             'description' => $bio[0]["desc"]             )         );              // Assign term id to post         wp_set_post_terms( $post_id, $actor_term_id, 'actor' );          }


Wordpress Alphabetical Glossary close div in loop

wrote this piece of code to make a alphabetical glossary and it works, but there is 1 problem. I don't know how I can end a set of posts with the same first letter. This code looks at the first letter of the second word (this is for my project) and then it makes a heading with that first letter and places all the matching lines under that. But after that I want to close this set with an `</div>` (and open it first off course). But if I put the close div in my loop, the code places a `</div>` after each line. So I need something that says: Close div after last line with the matching first letter. And then open a new div and do it again. Hope you understand what I need. Thank you.                   <?php          $obj = get_queried_object();          $post_type = $obj->name;              $args = array(             'post_type' => $post_type,             'orderby' => 'title',             'order' => 'ASC',             'posts_per_page' => 20,         );              query_posts($args);              if (have_posts()) : $curr_letter = ''; while (have_posts()) : the_post();              $title = get_the_title();         $title_array = explode(' ', $title);         $second_word = $title_array[1];              $this_letter = substr($second_word, 0, 1);              if ($this_letter != $curr_letter) {              $curr_letter = $this_letter; ?>                   <div id="sort-<?php echo strtolower($this_letter); ?>" class="alpha_title">                 <?php echo $this_letter; ?>
              <?php } ?>              <a href="<?php the_permalink(); ?>"><?php echo $second_word; ?>              <?php endwhile; endif; ?>


How to change the position of the language selector (qtranslate drop down menu)

I use Qtranslate to manage my translations on my website. It is working like it should, but for styling reasons I would like to change the position of the language selector. This is the position right now: ![header](http://i.stack.imgur.com/ESapO.png) Using this coding:
                             <?php echo do_shortcode($top_bar_social_icons); ?>

<?php echo qtrans_generateLanguageSelectCode('dropdown'); ?>

                   What can I do to make it go left or right from my social media icons?


Steps to debug on a blank screened wordpress install

I've been given an old Wordpress installation to setup on a new server. After setting **wp-config.php** and the values for the URLs in the db, **wp_options.siteurl** and **wp_options.home** (the usual process I do for something like this) I just get a blank screen on Safari, on Chrome I get > The website encountered an error while retrieving http://domain.name/. It > may be down for maintenance or configured incorrectly. I can access http://domain.name/wp-admin and the initial login splash page loads. But hitting sign in causes a similar error to what happens when accessing the front page. There seems to be _a lot_ of plugins installed for this setup. Wondering what the best steps would be to find out what the root of this problem would be. I've tried setting debug on in the config by doing this, but it accomplishes nothing. I think something is telling the site to redirect somewhere near the beginning of everything:               if ( isset($_GET['debug']) && $_GET['debug'] == 'debug') define('WP_DEBUG', true);


Admin login not working

I can't log in as admin on my wordpress site. I've tried to change the password, and a bunch of other stuff, but no result. What happens is that I come back to the log in page, no message. The strange thing is that I can log in as another user, but then I don't have the authority that I need. I've checked the PHP log files and I can't find anything there. I've tried to go in private mode, but it doesn't work either. Suggestions what I should try?


What is the best way to export and import theme options?

So what is the best way to create an export and import feature, I tried `serialize()` and `urlencode()` on an array of options to be used in a url like so: `export.php?data=(long string)`, and use $_GET method in export.php file which forces download using headers, but that's not a good idea because the array is very large. so what is the best way to do export and import theme options ?


Organize WordPress site, so it can maintain with huge database

## Intro: Hello, I am making coupon website and I need an advise. So, the structure at the moment is like this:   1. Coupons ( posts )   2. Categories of coupons ( categories )    3. Shops ( tags ) In the near future my database will consist of approximately ~5000 shops ( tags ) and ~20000 coupons ( posts ) and also ~10000 of categories of coupons ( cats ). I will also add deals to website soon, so this might be also taken into consideration. ## The question: What is the best way to organize such website, so it will work flawlessly after such huge amount of entries in database? Should I use **Custom Post Types** for any of my taxonomies?   Thank you


Changing from primary to a custom menu changes my CSS navigation layout

I am needing help figuring out my main navigation bar. I had created it with the default navigation hook but now want the ability to hide pages so they do not show up on the main navigation. However whenever I add a new page it automatically shows up in the navigation (but I do not want this, such as the case of 2009 Galley, 2010 Gallery & 2011 Gallery under the GALLERY tab.) This is my website This is the code I had in the header.php file
     <?php /*  Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?>
<a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to content', 'twentyten' ); ?>
     <?php /* Our navigation menu.  If one isn't filled out, wp_nav_menu falls back to wp_page_menu.  The menu assiged to the primary position is the one used.  If none is assigned, the menu with the lowest ID is used.  */ ?>     <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
      Which gives me this great looking navigation. ![enter image description here](http://i.stack.imgur.com/iG2Q7.png) Now I have tried to replace that with this
     <?php wp_nav_menu(array('menu' => 'Main')); ?>
      And all I get is this ![enter image description here](http://i.stack.imgur.com/WzfzN.png) This is the CSS for my #access menu               #access {         background: url(http://www.fhlsociety.ca/img/FHL-extras.jpg) no-repeat;         background-position: 0px -236px;         display: block;         margin: 0 auto;         width: 940px;         height: 100px;         padding-left: 30px;         text-transform: uppercase;         margin-bottom: 20px;     }          #access .menu-header,     div.menu {         font-size: 1.2em;         margin-left: 30px;         width: 900px;         height: 60px;     }          #access a {         color: #aaa;         display: block;         line-height: 100px;         padding: 0 10px;         text-decoration: none;     }          #access a:hover {         color: #fff;     }          #access ul ul a {         background: #f3f3f3;         line-height: 1em;         padding: 10px;         width: 160px;         height: auto;         margin-top: 30px;     }          #access li:hover > a,     #access ul ul :hover > a {         color: #333;         background: none;     }     #access ul li:hover > ul {         display: block;     }          /*#access li:hover > a,     #access ul ul :hover > a {         background-color: #990000;         border-radius: 5px 5px 5px 5px;         color: #C7BD89;         margin: 0 auto;         height: 20px;         padding: 8px 17px;     }     #access ul li:hover > ul {         display: block;     }*/               #access ul li.current_page_item > a, #access ul li.current-menu-ancestor > a, #access ul li.current-menu-item > a, #access ul li.current-menu-parent > a {         color: red;     }      What else am I missing? Or why might my styling not be there anymore? Any help is appreciated!


WordPress User Post Products

I want to build a website for a project with the following requirements:   1. Any user can register   2. They can post product by selecting a category, tags and uploading pictures    3. Users can comment on the products   4. Users can rate a product   5. Users can view all products they posted, edit or remove the product Do you have an idea of a plugin or a set of plugins which I can use to achieve this?


Page Navigation is not working with permalink structure

I am displaying a list of employees using my custom plugin. My permalink structure is `%category%%postname%/` My page navigation was like `http://www.example.com/emp/?page=2`, and was working fine until now. But now it rewrites url like `http://www.example.com/emp/2/`. I have read Using Permalinks and tried the solution empty `.htaccess` file and generating it again, but still I am getting same `http://www.example.com/emp/2/` URL. I guess this problem occurs because I have updated wordpress from 3.3.2 to 3.4 Does anyone have any idea how resolve this?


Insert/Update values to a table after blogname option etc. is updated

Im trying to update into another table the values blogname, blog description options when the user updated them from General Settings page. I use this code,               $hook_array = array('update_option_blogname','update_option_admin_email','update_blogdescription','update_option_home','update_option_siteurl');          foreach($hook_array as $hook)     {         add_action($hook, 'my_functione', 10, 1);          }          function my_functione($arg)     {         global $wpdb;         $the_id = get_current_blog_id();         $blogname =  get_option('blogname');          $blogdescr =  get_option('blogfulldescription');         $wp_blogs_info = $wpdb->base_prefix . "blogs_info";              $wpdb->query("UPDATE " . $wp_blogs_info . " SET site_title=".$blogname.", site_description=".$blogdescr." where blog_id = '" . (int)$the_id . "'");          }      Here is the table,                 blog_id int NOT NULL,       countries_id int(3) NOT NULL,       site_title varchar(64) NOT NULL,       site_description varchar(64) NOT NULL,       site_tags varchar(64) NOT NULL,       PRIMARY KEY (blog_id)      However, its not updating though there is a value with the blog_id of the current blog.. Please help.


Strip shortcode from specific post types (formats)

I am trying to remove the shortcode from a specific post type, in this case link. I used this code on my functions.php but it removes the shortcode from the_content for every post type.               <?php     function remove_shortcodes( $content )     {         return strip_shortcodes( $content );     }     add_filter( 'the_content', 'remove_shortcodes' );      is it possible to modify this so it only remove the shortcode from "Link" post type? thanks


curl problem or permalinks

I just configured my VPS, I am using Centos, everything works fine, but if I am setting my permalinks to Custom Structure, then accept the homepage none of the posts come, it shows me 404 page, I think this is because I haven't enabled curl, but I don't know where is my php.ini file in my centos? OK my curl is enabled, I checked it through `phpinfo();` Here is the URL `http://74.117.158.182/info.php` But if I am setting any permalinks in my wordpress then accept home page, all are giving me 404 pages You can check it on this URL http://mbas.co.in If I am keeping the permalink as default then pages are loaded without any 404 I don't know what is the problem, more-over my post-content is not getting loaded, Only the posts title comes, but the content part is missing, MY APACHE ERROR LOG > [Tue Feb 01 15:22:47 2011] [notice] suEXEC mechanism enabled (wrapper: > /usr/sbin/suexec)   >  [Tue Feb 01 15:22:47 2011] [notice] Digest: generating secret for digest > authentication ...   >  [Tue Feb 01 15:22:47 2011] [notice] Digest: done   >  [Tue Feb 01 15:22:47 2011] [notice] Apache/2.2.3 (CentOS) configured -- > resuming normal operations   >  [Tue Feb 01 15:22:51 2011] [error] [client 95.168.183.226] File does not > exist: /var/www/html/web-hosting-concerns-for-ecommerce-businesses, referer: > mysite.com   >  [Tue Feb 01 15:23:30 2011] [error] [client 38.101.148.126] File does not > exist: /var/www/html/cpcu-vs-mba   >  [Tue Feb 01 15:23:35 2011] [error] [client 66.77.240.125] File does not > exist: /var/www/html/can-u-see-below-for-growing-opinions-on-write-in-vote- > process-in-sa > > [Tue Feb 01 15:23:43 2011] [error] [client 38.101.148.126] File does not > exist: /var/www/html/dc-area-financial-strategist-questions-lack-of- > regulation-for-tv-financial-gurus > > [Tue Feb 01 15:24:15 2011] [error] [client 38.101.148.126] File does not > exist: /var/www/html/is-a-political-science-degree-with-a-business-admin- > minor-a-good-idea-feature-jobs-with-that-combo > > [Tue Feb 01 15:26:01 2011] [error] [client 66.249.71.225] File does not > exist: /var/www/html/emba-ralph-irizarry-timbalista-de-ruben-blades My htaccess file               # BEGIN W3TC Page Cache     <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /         RewriteCond %{HTTP_USER_AGENT} (2\.0\ mmp|240x320|alcatel|amoi|asus|au\-mic|audiovox|avantgo|benq|bird|blackberry|blazer|cdm|cellphone|danger|ddipocket|docomo|dopod|elaine/3\.0|ericsson|eudoraweb|fly|haier|hiptop|hp\.ipaq|htc|huawei|i\-mobile|iemobile|j\-phone|kddi|konka|kwc|kyocera/wx310k|lenovo|lg|lg/u990|lge\ vx|midp|midp\-2\.0|mmef20|mmp|mobilephone|mot\-v|motorola|netfront|newgen|newt|nintendo\ ds|nintendo\ wii|nitro|nokia|novarra|o2|openweb|opera\ mobi|opera\.mobi|palm|panasonic|pantech|pdxgw|pg|philips|phone|playstation\ portable|portalmmm|ppc|proxinet|psp|pt|qtek|sagem|samsung|sanyo|sch|sec|sendo|sgh|sharp|sharp\-tq\-gx10|small|smartphone|softbank|sonyericsson|sph|symbian|symbian\ os|symbianos|toshiba|treo|ts21i\-10|up\.browser|up\.link|uts|vertu|vodafone|wap|willcome|windows\ ce|windows\.ce|winwap|xda|zte) [NC]         RewriteRule .* - [E=W3TC_UA:_low]         RewriteCond %{HTTP_USER_AGENT} (acer\ s100|android|archos5|blackberry9500|blackberry9530|blackberry9550|cupcake|docomo\ ht\-03a|dream|htc\ hero|htc\ magic|htc_dream|htc_magic|incognito|ipad|iphone|ipod|lg\-gw620|liquid\ build|maemo|mot\-mb200|mot\-mb300|nexus\ one|opera\ mini|samsung\-s8000|series60.*webkit|series60/5\.0|sonyericssone10|sonyericssonu20|sonyericssonx10|t\-mobile\ mytouch\ 3g|t\-mobile\ opal|tattoo|webmate|webos) [NC]         RewriteRule .* - [E=W3TC_UA:_high]         RewriteCond %{HTTPS} =on         RewriteRule .* - [E=W3TC_SSL:_ssl]         RewriteCond %{SERVER_PORT} =443         RewriteRule .* - [E=W3TC_SSL:_ssl]         RewriteCond %{HTTP:Accept-Encoding} gzip         RewriteRule .* - [E=W3TC_ENC:.gzip]         RewriteCond %{REQUEST_METHOD} !=POST         RewriteCond %{QUERY_STRING} =""         RewriteCond %{REQUEST_URI} \/$         RewriteCond %{REQUEST_URI} !(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail)\.php|wp-.*\.php|index\.php) [NC,OR]         RewriteCond %{REQUEST_URI} (wp\-comments\-popup\.php|wp\-links\-opml\.php|wp\-locations\.php) [NC]         RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|wordpress_\[a\-f0\-9\]\+|wordpress_logged_in) [NC]         RewriteCond "/var/www/html/wp-content/w3tc/pgcache/$1/_index%{ENV:W3TC_UA}%{ENV:W3TC_SSL}.html%{ENV:W3TC_ENC}" -f         RewriteRule (.*) "/wp-content/w3tc/pgcache/$1/_index%{ENV:W3TC_UA}%{ENV:W3TC_SSL}.html%{ENV:W3TC_ENC}" [L]     </IfModule>     # END W3TC Page Cache          # 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]     RewriteRule ^index\.php/?(.*)$ $1 [R]      </IfModule>          # END WordPress      The only solution I found was reinstalling the entire Centos, starting all from scratch, and enabling each thing respectively as per the answers, and finally it worked, my Linux was having some problems, thats why it was not working.


Question on WooCommerce Syntax

The Below syntax removes the "Related products" from appearing on the Single Product page, but what does the 20 stand for ?               remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20);      Thanks.


Include jQuery (or anything) inside Custom Options Panel's <head> tag

The title pretty much explains exactly what I'm trying to do. If someone could help me out, that would be awesome. Thanks! :)


Secure Server after configuration

Recently I purchased a VPS from intovps.com, And first time I configured a fully unmanaged VPS through ssh comands. My website is working into it, properly. Now I just want to know how to secure it? I started my process of configuring VPS in this way:- Installed LAMP, phpmyadmin, restored the backup(wordpress & mysql), installed vsftpd for ftp access, added a user into FTP(user can navigate into any directory over the entire VPS, but change anything) Now after everything, I just want to know the security steps for my VPS. I have heard from my friends that after configuring a VPS, it also needs to be configure for security. In VPS, I have only one user added for ssh access, which is default,and I just added one ftp user. Now I want that the ftp added user should just navigate to the `/html` directory, where my website is installed, and has all writes to change everything And any suggestions or tricks or steps for making server more secure?


Metabox Not saving data

I've just created a metabox for some custom text on a website I'm developing. However when I input something into it and click update it doesn't seem to save it. Also its not saving on the MYSQL DB either. here is the code for my metabox below.               <?php          add_action( 'add_meta_boxes', 'dd_hctb_create' );          function dd_hctb_create() {          add_meta_box ( 'dd_meta', 'Heading Content Text Box', 'dd_hctb_function', 'page', 'normal', 'high' );          }          function dd_hctb_function( $post ) {          echo '<input type="hidden" name="dd_mbe_content_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';          //retrieve the metadata values if they exist          $dd_mbe_content = get_post_meta( $post->ID, 'dd_mbe_content', true );          echo 'Write any content in here that you want to appear above the main text.';          echo '<textarea name="middle" id="dd_mbe_content" value="" cols="100%" rows="10">'.$dd_mbe_content.'</textarea>';          }          function dd_hctb_save($post_id) {                   //attempt to verify nonce         if (!wp_verify_nonce($_POST['dd_mbe_content_nonce'], basename(__FILE__)))             return $post_id;         // check the autosave         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)               return $post_id;             // check permissions           if ('page' == $_POST['post_type']) {               if (!current_user_can('edit_page', $post_id))                   return $post_id;               } elseif (!current_user_can('edit_post', $post_id)) {                   return $post_id;              }         //finally verify the postmeta is set                      if (isset ( $_POST['dd_mbe_content'] ) ) {                     //now save if if the data exists                     update_post_meta( $post_id, 'dd_mbe_content', strip_tags( $_POST['dd_mbe_content']));                 }              }  // end save function           add_action('save_post', 'dd_hctb_save' );          ?>      thanks for any help guys - I'm sure this is a typo somewhere or something overriding a setting. I'm new to using wp_nonce aswell so any help or advice is taken on board.


MU Domain mapping

I've installed the mu domain mapping, but i can't make it work. I have two different domains, one is point to the other domain (set up at mediatemple to point to the other domain's folder). That's working. But when i use wordpress (not a simple php test), it's redirect to the primary domain. (I added the domain, set up cname primary.com.) So: **www.secondary.com** redirects to **www.primary.com/secondary**. P.s.: Using lastest WP 3.6; from a domain/server dummy


How to get Menu Navigation Labels to output HTML

I'm trying to follow Jason Bradley's advice on how to style my Wordpress menus. Specifically, I want to insert an icon before my navigation items using Font- Awesome. I tried putting this code in the Navigation Label field for my "Home" link:               <i class="icon-fixed-width icon-home"></i> Home      However, when I view the page in my browser, it displays the HTML verbatim, it doesn't interpret the tag, or any other HTML I throw at it, for that matter. Did Wordpress Menus change in 3.6? Am I missing something obvious? I know that my font-awesome installation works because I am using their icons all over my site. Thanks.


get value from post to sidebar

I have the following div in my `post`,               <div class="my_calss" id="my_id">         my content     </div>      Here, **my_id** is different for each post. I need to display `my_id` in sidebar into php code. That means,               <?php echo do_shortcode('[wp_value id=1]'); ?>      need to assign the above id. I explained this via **PHP** in stackoverflow. It's not only WordPress oriented, that's why I asked it there too. Did I explain my question well? if not, please let me know what else can i add ?


Posts and order

newbie here with quick question, looking at all my pages if I click on quick edit I have the chance to place a number on the field order and set an order on which one should appear first,then second, so on so on, tried to do the same on posts but that option is not available, any idea on how to make it appear? Thanks Arturo P.S.: Oh, for this one I'm using wordpress 2.9.2


preg_replace Remove comment text in content

In post content, i insert a text like below                abc acb acb acb     <!--REMOVE--> text to remove <!--ENDREMOVE-->      abc acb acb acb      abc acb acb acb     <!--REMOVE--> text to remove <!--ENDREMOVE-->      abc acb acb acb      abc acb acb acb     <!--REMOVE--> text to remove <!--ENDREMOVE-->      abc acb acb acb      I want to get only               abc acb acb acb     abc acb acb acb     abc acb acb acb     abc acb acb acb     abc acb acb acb     abc acb acb acb      And i run this code                function remove($content){         preg_match_all("/<!--REMOVE-->.*<!--ENDREMOVE-->/", $content, $matches);         var_dump($matches);         $content= preg_replace("/<!--REMOVE-->.*<!--ENDREMOVE-->/", '', $content);              return $content;      }      add_filter('the_content', 'remove', 1);      but it does not work. What is the problem ? The real result from above code is               abc acb acb acb     abc acb acb acb      And var_dump is one result, not 3 results               array         0 => <!--REMOVE--> text to remove <!--ENDREMOVE-->              abc acb acb acb              abc acb acb acb              <!--REMOVE--> text to remove <!--ENDREMOVE-->              abc acb acb acb              abc acb acb acb              <!--REMOVE--> text to remove <!--ENDREMOVE-->      The right way is               array        0 => <!--REMOVE--> text to remove <!--ENDREMOVE-->             1 => <!--REMOVE--> text to remove <!--ENDREMOVE-->             2 => <!--REMOVE--> text to remove <!--ENDREMOVE-->