Sort custom post type list table by display name of a user id stored as post meta value

I have a custom post type named `domicile`. Each post (domicile) has an _owner_ (not the _author_ ). Owners are users with a custom role. I store the user id as a post meta value (`dmb_owner`) for the `domicile` post type. How do I sort the list table (`wp-admin/edit.php?post_type=domicile`) by the display names of owners? The relevant code from my class, `setup_columns()` is called on `init`:               /**      * Manage columns for List Table.      *      * @wp-hook init      * @return void      */     protected function setup_columns()     {         add_filter(             "manage_edit-{$this->post_type}_columns",             array ( $this, 'set_column_header' )         );              add_action(             "manage_{$this->post_type}_posts_custom_column",             array ( $this, 'render_columns' ),             10,             2         );              add_filter(             "manage_edit-{$this->post_type}_sortable_columns",             array ( $this, 'set_sortable_columns' )         );              add_filter(             'request',             array ( $this, 'prepare_orderby' )         );     }          /**      * Register column headers.      *      * @wp-hook manage_edit-{$this->post_type}_columns      * @param  array $columns      * @return array      */     public function set_column_header( $columns )     {         unset (             $columns['author'],             $columns['comments'],             $columns['date']         );         $columns['owner'] = __( 'Owner', 't5_domicile_manager' );              return $columns;     }          /**      * Display cell content.      *      * @wp-hook manage_{$this->post_type}_posts_custom_column      * @param string $column_name      * @param int $post_id      * @return void      */     public function render_columns( $column_name, $post_id = 0 )     {         if ( 'owner' === $column_name )         {             $owner_id = get_post_meta( $post_id, 'dmb_owner', TRUE );             if ( $owner_id )             {                 $owner = get_user_by( 'id', $owner_id );                 print $owner ? $owner->display_name : '<i>not set</i>';             }         }     }          /**      * Register sortable columns      *      * @wp-hook manage_edit-{$this->post_type}_sortable_columns      * @param array $columns      * @return array      */     public function set_sortable_columns( $columns )     {         $columns['owner'] = 'owner';         return $columns;     }          /**      * Set custom sort order.      *      * @wp-hook request      * @param  array $vars      * @return array      */     public function prepare_orderby( $vars )     {         if ( isset ( $vars['orderby'] ) && 'owner' == $vars['orderby'] )         {             $vars = array_merge(                 $vars,                 array (                     'meta_key' => 'dmb_owner',                     'orderby'  => 'meta_value_num'                 )             );         }         return $vars;     }      This … works, but it is obviously wrong, because it sorts by the stored ID. I have to filter the query – but I am not sure how exactly I should do that. _Sorry for the title, but I want to make sure this will be found. I searched very hard and found nothing useful._


Notifications Bar on home page only

Is it possible to create an "Alert" button that can be turned on and off thru wp-admin. Of course the "Alert" button im asking for is to be published at the main page, but can only be turned on when its needed. Im using wordpress with jqueryMobile for your information. **EDIT:** Its pretty hard to explain this. But i found this plugin and it does what im after. Except this plugin show the notification on everypage - even wp-admin. To the question: **Is it possible to create a notification/menubar that can be tunerd on/off from wp-admin. The idea behind this is to show important "news" whenever.**? **Whats the best solution?**


Custom post-type custom query - show all posts

I've got a taxonomy archive to show custom post-types, its got a custom query calling the posts - I can't figure out where to put showposts in it.               global $wp_query;          $term = get_term_by( 'slug', get_query_var($wp_query->query_vars['taxonomy']),               $wp_query->query_vars['taxonomy']);          if (have_posts()) : while (have_posts()) : the_post(); ?>       In case anyone's wondering I've tried using a new or standard query, but it seems to break some of woocommerce's functionality. So basically Id like to modify the above query to show all posts... any ideas? thanks!!


Is there any way to write custom HTML is some .php file and then call it wherever necessary?

I'm an absolute newbie as far as wordpress and php are concerned.So I wanna write some custom HTML and re use it again and again just like 'headers' and 'footers'.I have googled a lot but haven't find anything useful.Can anyone point me in the right direction?


Getting the correct value for a post

I have a taxonomy called state which lists all the states. When I create a post I want to select the taxonomy, but also have the name of the state automatically captured in a custom field as well. I've manage to get this code working, however I'm having trouble getting the correct value from that post. A state name is being copied but it's from a different record. I know it has to do with the foreach, but when I put the postid it does not work. Also, it should work whether I do it through the admin, or via the front end in a form that submits or edits the post. Here is the code, any help is appreciated. Thanks               add_action( 'save_post', 'add_state' );     function add_state( $post_id ){         // Bail if we're doing an auto save         if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;         //check if they selected your state term         $state = get_terms('state', 'name');         foreach ( $state as $state );              //insert post meta         update_post_meta($post_id,'state',$state->name);     }


Tried to install a wordpress plugin on my local machine: > To perform the requested action, WordPress needs to access your web server. > Please enter your FTP credentials to proceed. If you do not remember your > credentials, you should contact your web host.               Hostname          127.0.0.1     FTP Username      macusername     FTP Password      macusernamepassword     Connection Type   Connection Type  FTP      When I click proceed, I get this: > Failed to connect to FTP Server 127.0.0.1/:21 Why doesn’t WordPress work with my FTP data?


Regular security checks - what steps should be included?

There are heaps of tutorials explaining how to secure a WordPress installation, but I couldn't find any that listed out steps for weekly or monthly security checks. What are some steps that you recommend I perform on a regular basis to keep WordPress secure (besides updating core and plugins)? Here are some things I've implemented already:   * Forced all other users to only run as Editor   * Deleted unused themes and plugins   * My theme is custom written, so I know that there aren't any scripts like `timthumb.php` in it. It's also powered by Genesis which features automatic theme updates.   * Change my admin password every few months   * Automatic backups with VaultPress The main reason why I'm concerned is because my client's hosting provider is not very WordPress friendly and I have to run with 777 permissions. However my client is the only site on the box. Anything else I should be doing regularly to make sure the site is locked down? Thanks


wp_users user_status field

I have found an answer to my question here but it's 7 years old. I simply want to know if I can use this column for my own purposes. I'm planning to use the `user_activation_key` column to store a hashed key upon user registration and set an inactive flag in the `user_status` column. This flag will prevent users from logging in until their e-mail address has been verified.


Store Snapshot created via wordpress to use with lightbox

i know this is a bit of a weird question but its a real time saver   so if you got any ideas (even partial) i would really apreacate them :) Ok... so i am using wordpress built in interface to capture and disply   remote website images... here is the shortcode i am using..               /*********************************************************************     ** SNAPSHOTS     *********************************************************************/     function wpr_snap($atts, $content = null) {             extract(shortcode_atts(array(                 "snap" => 'http://s.wordpress.com/mshots/v1/',                 "url" => 'http://www.sagive.co.il',                 "alt" => 'My image',                 "w" => '400', // width                 "h" => '300' // height             ), $atts));              $img = '';             return $img;     }          add_shortcode("snap", "wpr_snap");      (How to use this: http://wordpress.stackexchange.com/a/38293/7990) . thats easy no problem.. but - what if i want to integrate it with lightbox.. since its not an image hosted on my website is ther any way to access that images or even write somthing that would upload the image and make it the feautred image of that specific post (a strech i know) or maybe store it elsewhere somehow? (without a plugin).. to try and grab the image i have made a second shortcode that does the same snapshot but doesnt wrap inside image tag for the href with the lightbox class..   . this is the line in the theme:               <a class="lightImages" href="<?php echo do_shortcode('[snapurl url="http://www.sagive.co.il"]'); ?>"><?php echo do_shortcode('[snap url="http://www.sagive.co.il" w="175px" h="125px" alt="'.get_the_title().'"]'); ?>      .   any ideas?


Weird characters in title if it contain “ ”

If my post title contain `“ ”` all the title stored in the database title column in weird characters like this `"الأورومتوسطى للشباب" تبدأ تلقى استمارات أنشطة الجمعيات الأهلية` I searched more & more but all i found is some advices to change the table encoding to `UTF8` it is already `UTF8` After some tests i found that the problem is came from `feedwordpress` plugin not from WordPress itself How to solve this?


current-user_can not working in loop

I am using the following loop to show the-content for only contributors as well as Google visitors. But somehow it is not working.                   <?php if (have_posts()) : while (have_posts()) : the_post();?>     <?php if (current_user_can(‘contributor’) || strpos($_SERVER[HTTP_REFERER], "google") == true) { ?>     <?php the_content('');?><?php } ?>     <?php endwhile; ?>     <?php comments_template(); ?>     <?php else : ?>     <?php endif; ?>      Please help me on this.


Top Admin Bar Never Shows Up

So I recently moved a site to a new domain and updated the URL to reflect the changes in the database as well as in the wordpress backend. wp_head and wp_footer are placed respectively in header.php and footer.php, however the top admin bar has never shown up. Any help would be greatly appreciated.


Custom slug in url for CPT and taxonomy

I want to add a custom slug to permalink for CPT and taxonomy. Like this:               http://mydomain.com/my-custom-slug/post-slug     http://mydomain.com/my-custom-slug/product_category      Here is my CPT and taxonomy code:               $args = array(         'query_var'           => 'product',         'capability_type'     => 'post',         'rewrite'               => array('slug' => 'my-custom-slug'),     );     register_post_type( 'product', $args );      This above CPT `product` output desired permalink,               http://mydomain.com/my-custom-slug/post-slug      but it give error 404. and same thing happen with taxonomy:               register_taxonomy('product_category', array('product'), array(         'hierarchical' => true,          'rewrite' => array('slug' => 'my-custom-slug', 'hierarchical' => false, 'with_front' => false)     ));      please tell me how do I fix this. Thanks for the help.


Populate Website URL at registration time

I am trying to automatically populate/set the "Website" under Contact Information in user profiles at registration time. I want the URL to go to their Author Archives page (i.e., http://mywordpresssite.com/author/Tom/) I am using the Paid Memberships Pro plugin for registration. I am also using Theme My Login if that makes any difference, but not for registration. The code below doesn't work because it seems that the URL for the author posts hasn't been created yet. I have tried so many different things and now I'm stumped!               function change_user_url($user_id) {             global $user_login;                  get_currentuserinfo();                  $display_name = $user_login;                  $website = get_author_posts_url();             $website = $website . $display_name;                    wp_update_user( array( 'ID' => $user_id, 'user_url' => $website ) );              }            add_action('user_register', 'change_user_url');


WP_Error handles errors, but how can I show success with a message?

My script accesses an api to populate posts. I can add any errors to the WP_Error class, but can I add success messages to a global variable?


Alias domain to Multi-site installation in Apache

This is regarding to set an Alias domain to Multi-site installation. We want to create a short domain as alias to my main website(Multi-Site enabled).I have tried it using a most common options like... 1)Creating cname records, 2)pointing to main installation location as addon domain 3)Domain parking When we try the first two options it is redirecting to sign up page of Web- Site(I think Wild card redirect for Multi-site installation is the reason). The third option is making is showing an error :"Debugging a Wordpress Network" I think that I should configure it in Apache to solve the problem(I have root access).But I am not aware of dealing with Apache When we contact our host,they are not trying to look in to the issue and simply said that they would re-install the whole web-site again. I don't want to do that. Could anybody help me with this **Update** : I needed this domain Alias for a plugin which enable us to shorten the URL with out any third party service . I have Doncha's **Domain mapping plugin** installed and I don't know how to use it in this situation Thanks! **Update 2 :** : I mean to say that the domain mapping plugin doesn't work with main site.It is only useful to map the sub-domains under a multi-site installation. I read some where over internet that the main site cannot be aliased with this plugin as it causes some problems . Could any body help to alias the main site in an alternative way ? Thanks !


API for wp menu hacks

Question changed due to new developments! I was loooking for a way to hack the menu items in the custom menu page to add a "hide" checkbox and other options. The only way I found is to override the Walker_Nav_Menu class. I think it's a quite tricky solution... In the wp_nav_menu codex anyway i found many examples with filters and action to hack custom menus. Nevertheless I haven't found any documentation about these hacks. Another idea I had is to treat menu items as custom post (they are actually), so i was wondering if the custom field api could be helpful for my purposes. Any suggestions? OLD QUESTION: There is one big but simple feature that is missing from WP and I really can't understand why!!! There isn't any way to just hide front end menu items without deleting them completely! If for example I have a complex menu with many items and submenus and i want to hide it for a while, it's not possibile to do it! Just a checkbox with a display option would be enough. It's me missing something? If it's really missing, is there an API to modify the Appearance>menu section to add more capabilities?


wordpress in wamp lan doesn't load css

I use wordpress in a lan with wamp. I can correctly see the lan from client pcs. It works perfectly with non wordpress websites so i don't think it's a lan setting problem. Is there any particular setting i should set in wordpress? Actually, it loads correctly, but without JS and CSS. UPDATE, here's how CSS and JS are loaded in the plugin:               function agenda_my_scripts() {     if ( !is_admin() ) {         // datepicker         wp_enqueue_script( 'custom-datepicker', plugins_url( 'sys/js/datepicker.js', dirname(__FILE__) ), array('jquery') );         wp_enqueue_script('jquery-ui-datepicker');         // CSS         wp_register_style( 'agenda_css', plugins_url( 'sys/css/style.css', dirname(__FILE__) ) );         wp_enqueue_style( 'agenda_css' );         // jQuery CSS         wp_register_style( 'jquery_ui_css', plugins_url( 'sys/css/jquery-ui.css', dirname(__FILE__) ) );         wp_enqueue_style( 'jquery_ui_css' );     }      } add_action('wp_enqueue_scripts','agenda_my_scripts'); Then the child theme have the classic configuration:               /*     Theme Name:   Theme name     Theme URI:    -     Description:  Description     Author:       Author     Author URI:   -     Template:     child_template     Version:      1.0     Tags:         -     Text Domain:  child_template     */          @import url("../twentytwelve/style.css");      where 'template' and 'text domain' match folder's name. Moreover, if i activate the child theme, it loads twentyfourteen!! This is very weird...


Update page breaks permalinks

I am having a strange side effect since going to 3.3.1. When updating pages (or creating new ones) all of my permalinks break - clicking view page on the updated page in question will result in 404 not found. This does not happen with posts. I was concerned it might be an issue with my new schema for permalinks /%postname%/ but I swapped it to YEAR/POSTNAME and did not see any difference. I checked and found a few duplicates in the post-name fields, I changed or deleted any questionable repeats. Still no change. Here is my htaccess -               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      I've also looked at MonkeyMan's Rewrite analyzer and nothing seems amiss there. Any advice would be appreciated. Let me know if there is other information you need.


Insert a div before the wp_nav_menu

How do I go about inserting a custom div before the wp_nav_menu() adds the ul? The problem is that the script is inserting my 'div menu button' after the nav ul instead of before it. I am trying to do this via a function because the basic idea is that on some of my menus I need to insert a div with a 'menu' button for users to click on to fire a dropdown. *I had to modify my code below because the editor keeps removing my div code from displaying. Suffice it to say I am using a proper opening and closing div Here is a link to 'proper' code as I can't figure the editor out on stack. https://gist.github.com/3120416               function tumble_menu( $args = array() ) {         /* Default arguments */         $defaults = array(             'container'         => 'ul',             'menu_class'        => 'nav',             'menu_id'           => 'top_nav',             'theme_location'    => 'top-menu',             'echo'              => true,             'before'            => '',             'after'             => '',             'link_before'       => '',             'link_after'        => '',             'depth'             => 1,             'sort_column'       => 'menu_order',             'walker'            => ''             );         $defaults   = apply_filters( 'tumble_nav_default_args', $defaults);         $args       = wp_parse_args( $args, $defaults );                                   $main_menu = wp_nav_menu( $args );      } function tumble_add_menu_wrapper($html, $begin, $end) { // wrap our original HTML with the new tags $html = $begin . $html . $end; return $html; } add_filter( 'tumble_menu_wrap', 'tumble_add_menu_wrapper', 10, 3 ); function tumble_do_menu_wrapper() { $html = tumble_menu(); echo apply_filters( 'tumble_menu_wrap', $html, 'div class="menu-button">Menu/div>','' ); } ` **Update** My question was a little confusing. I was not trying to wrap the navigation in a div element, but rather was trying to insert a self contained div prior to the navigation ul element being output. Somehow the wp_nav_menu() function is not allowing this. If I use a 'standard' html element instead, then my wrapper function works perfectly. I would like to learn someday why this simple php logic works, but not with wp_nav_menu() but I suppose that is a question for another day. Thanks Chip for the info!


Multisite sub-site dashboard redirects to /wp-admin/

I have successfully set up WordPress Multisite on a linux server. I'm able to add sites using Super Admin. When I go to Dashboard > Sites, I see the following: **Site 1** - The main Multisite website **Site 2** - A site I have recently added When I select "Dashboard" for Site 2, I am redirected to the dashboard for Site 1. To visit the dashboard on Site 2, I have to visit http://site2.mydomain.com/wp-admin via my browser. I'm a little baffled to why this is happening. Wildcard DNS is switched on for the domain. Here's the .htaccess code:               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^wp-admin$ wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^(wp-(content|admin|includes).*) $1 [L]     RewriteRule ^(.*\.php)$ $1 [L]     RewriteRule . index.php [L]


Whenever I try to publish a post in wordpress, I always get redirected to the installation page...why?

Whenever I try to publish I post, I get redirected to the /wp- admin/install.php page. The file install.php is on the server but do I have to delete it? I recently updated a handful of plugins and after the update finished, the redirect started happening. Happens on Firefox and Chrome (the latest versions). I'm just wondering why would Wordpress redirect to the installation page everytime I try to publish a post? And then after the redirect occurs, if I try to relogin to wordpress or go to the wp-admin page, and each page redirects to the installation page. The url would look like this: mysite.com/wp-login.php/wp-admin/install.php. I don't understand. Help would be appreciated. And yes, I did clear the cache on both browsers. I'm using the latest version of wordpress. EDIT: Maybe after about 5-8 minutes, the site would work again and not redirect. But the redirect would happen if I tried to publish a post again.


Executing jQuery in a plugin

I have the following code in my plugin main file :               function my_function() {     ?>     <script type="text/javascript">          jQuery(function () {                 alert('jQuery');         });     </script>     <?php     }     add_action("wp_footer", "my_function");      My website does have jQuery loaded and operational (lots of features on my page use it and they work). Yet this alert() doesn't work. Why is that ?


Has anyone effectively integrated GD star rating and Cube Points? From the documentation: > Plugin Integration CubePoints can also be easily integrated with other > plugins. Other plugins can be coded such that certain actions trigger the > cp_alterPoints() function to add or subtract points from a specified user. **Function**               cp_alterPoints( int $uid, int $points )       **Parameters** > int $uid: ID of a Wordpress user. To get the ID of the current logged in > user, use the cp_currentUser() function. > > int $return: Number of points to add to the specified user. Example The following code will add 10 points to the current logged in user. If no user is logged in, no points will be added. You may input negative number to subtract points.               <php       if( function_exists('cp_alterPoints') && is_user_logged_in() ){         cp_alterPoints(cp_currentUser(), 10);         cp_log('hey', cp_currentUser(), 10, 1);       }     ?>      In this case, I would like to add 10 points to the user, if his or her post is voted (GD star rating's thumbs rating system). But I have no idea how to do that. Any suggestions?


Is it possible to remove username field from the registration page? If so, how?

Is it possible to remove the username field from the registration page? I want the users to enter only their email and password.   A new user should be created based on these two parameters only. Is that possible and if so, how?


Not able to get random post

I want to display a single random post out of the 5 latest posts in the category 'news'.   The approach I'm using is this:                 // Custom function to retrieve catgory ID by category name.       $cat = $lib->getCatIDbyCatName('news');       // Retrieve the 5 latest posts       $news = get_posts( array( 'numberposts' => 5,'category_name' => $cat ) );            foreach($news as $post) : setup_postdata($post);          echo the_title();          echo the_intro(); // <- Custom function to retrieve custom field       endforeach;      The above code works and I'm dispalying the title and the custom value of all 5 posts. Now I only want one random post out of these 5 posts. So I do this:                 // Get a single random post from fetched posts       $single_news = $news[rand(0, 4)];            foreach($single_news as $post) : setup_postdata($post);          echo the_title();          echo the_intro(); // <- Custom function to retrieve custom field       endforeach;      This however, is not working. Does anyone have any ideas of what I can do? OR maybe a better solution?


Is there a way to specify an extra class for a post or page with no title?

If I do a post or a page with no title, I'm left with an empty `h1` tag at the top of the post/page. I'd like to either get rid of the `h1` in these cases, or else be able to add an extra CSS class to the post/page so that I can specify how to display the post (and the `h1`) differently when the post/page is published with no title. Are either of these things possible? Thanks.


Place the page title into the short code

I have created a short code called `[contianer-narrow][/container-narrow]` which wraps your content in a twitter bootstrap class: `.container-narrow` the issue is that the page title is not included. is there a way to say: `if this short code is used, include the page title, else forget it?`


Wordpress Rewrites - How can I pass a variable to Custom Post Type?

I'm looking for a wordpress rewrite that will let me pass a query var. I have a custom post type that produces urls like this: example.com/custom-post-slug/custom-post-title/ my goal is to have example.com/custom-post-slug/custom-post-title/cid/10/ Pass the value 10 into cid Any suggestions?


Using PIE CSS in WordPress. "localizing" styles

I read before I can use wp_localize_script to replace a string in a file (adding path to admin-ajax). what if I want to do something similar, but to the template directory for CSS? PIE will get the URL relative to the document not CSS


Custom user registration

I want to Implement custom user registration process in my wordpress theme. Can anyone please explain me the complete process for user registration. **Note:** I don't want to use default register action of wordpress. I know that we can register users through url: > `http://site-name.com/wp-login.php?action=register` I want to design my own user registration form. So kindly do not suggest any plugin or gravity forms or any other third party software/plugin.


get_post random and order by not working

I have this code that returns list of post title as links, but when I add the 'orderby' and 'order' parameters - it returns results but 'orderby, order, rand' do not work, can anyone tell me what I'm doing wrong? Thanks!
        <?php $post; $cat_posts = get_posts(array('numberposts' => 10, 'orderby' => 'rand', 'order' => ASC, 'category' => $disciplineCatID));        foreach($cat_posts as $post) : ?>        <?php $postTitle = get_the_title(); if($title != $postTitle) :?>
<a href="<?php the_permalink(); ?>">›› <?php the_title(); ?>
        <?php endif ;?>        <?php endforeach; ?>


How do I find PHP file that contains content of my page?

Let's say I have created a page in admin dashboard and put some content in it. How I can find PHP file in my hosting file manager that contains that content? ![screenshot of issue](http://i.stack.imgur.com/j6vJn.jpg)


Post from front-end only by logged in users, form posts as "posted by: <logged-in user's username>"

I've handrolled a form for posting from the front-end, with some custom functions that I needed. However, I've made the form only accessible when a user is logged in, and I'd like to have the articles show up as being posted by that user. Thoughts?? Here is my current code: backend:               if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && ($_POST['action']== 'new_post')) {         $has_errors = false;              $title = $_POST['title'];         $tablature = $_POST['tablature'];         $performer = $_POST['performer'];         $composer = $_POST['composer'];         $submitter = $_POST['submitter'];         $cat = array( $_POST['cat'] );              if(!isset($title)) { echo '
Title required.
'; $has_errors = true; }         if(!isset($tablature)) { echo '
Description required.
'; $has_errors = true; }         if(!isset($performer)) { echo '
Performer required.
'; $has_errors = true; }         if(!isset($composer)) { echo '
Composer required.
'; $has_errors = true; }         if($cat == -1) { echo '
Please select a category.
'; $has_errors = true; }              $tags = $_POST['post_tags'];         if (!$has_errors){         // Save <title>  by: <performer>         $title .= " by " .$performer;              // Save Composed by: <composer> Performed by: <performer> <tablature>         $content = "
Composed by: ".$composer."

Performed by: ".$performer."

Submitted by: ".$submitter."

".$tablature;              $new_post = array(             'post_title' => $title,             'post_content' => $content,             'post_category' => $cat,             'post_status' => 'draft'         );         wp_insert_post($new_post);              // save email and submitter as post meta in custom fields         wp_redirect( home_url('/thank-you/') );     }      } frontend:
     <form id="new_post" name="new_post" method="post" action="">
Submitted By
     <input type="text" id="submitter" value="" tabindex="1" size="20" name="submitter" class=”required” minlength="3" />

Email Address
     <input type="text" id="email" value="" tabindex="2" size="20" name="email" />

Song Title
     <input type="text" id="title" value="" tabindex="3" size="20" name="title" class=”required” minlength="3" />

Composed By
     <input type="text" id="composer" value="" tabindex="4" size="20" name="composer" class=”required” minlength="3" />

Performed By
     <input type="text" id="performer" value="" tabindex="5" size="20" name="performer" class=”required” minlength="3" />

Song Body
     <textarea id="tablature" tabindex="6" name="tablature" cols="50" rows="6" class=”required” minlength="50"></textarea>

<?php wp_dropdown_categories( 'show_option_none=Category&tab_index=7&taxonomy=category&exclude=5&class=required' ); ?>

<input type="submit" value="Submit" tabindex="8" id="submit" name="submit" />
     <input type="hidden" name="action" value="new_post" />     <?php wp_nonce_field( 'new-post' ); ?>     </form>
      Thanks!


Follow me for wordpress blogs (multi-authors)

If we have a blog with multi-authors is there a way for each to have a follow me twitter button separated. Meaning when we see the post of an author we see only the twitter button with the author account. Or because is a one blog the only option is a Follow us button meaning one account for all the authors?


Why does wp_get_object_terms add a period after terms are output?

I'm using the following line to output an unordered list of taxonomies and their associated terms for a custom post type. The only problem with it is that a period gets added after the term.               wp_get_object_terms( $id, the_taxonomies( 'before=

&sep=

&after=

' ) );      Here's what it outputs:

Taxname: Taxterm.

      Is there an argument I can add to `wp_get_object_terms` to remove the period?


Trying to display next and previous set of posts on separate page (not parent page)

If anyone has any suggestions or know what I'm doing wrong would be a great help. I'm wanting 3 custom news posts per page and then links to the next list of news items and so on. I've tried next page not posts plugin and this takes me to the next parent page which would be contact page. Thanks               <?php     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;?>
<?php echo "Page " . $paged;?>
     <?php      $loop = new WP_Query(array(     'post_type' => 'news',     'paged' => $paged,     'posts_per_page' => 3,     'orderby' => 'menu_order'     ));     ?>        <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>          <?php get_template_part('news-single', get_post_format() ); ?>          <?php endwhile; // end of the loop. ?>

<?php  previous_posts_link('Previous') ?>

<?php  next_posts_link('More') ?>


WP_query exclude a category unless it has more then one catagory

I have this category `exclude_cat` with id 39 I want to exclude it from the home. So I use for `WP_Query` args like this:               $args = array (       'category__not_in' => array( 39 ), //exclude ID     );      Works. But now I want to only exclude it if is the only category on the post.   So exclude the `exclude_cat` post only if it is the only category of the post, if it has `exclude_cat` and `random_cat` I do want to include it. Is there a way to do this using `WP_Query`?   If not what's the best way to do this otherwise?


How to redirect to post if search results only returns one post

I want to send visitors to my search.php after a search to display list of posts. If there is only one search result, user can directlyto the post in question(something like GOOGLE's I am Feeling Lucky Button) Thank you all.


Structure and Display Content from Multiple Pages on Single Page

I am trying to display the content from multiple pages on a single page. However, for each page I need the title, excerpt, content and featured image. The display of each page's content has a different structure, therefore I need control over the HTML elements and their classes and ID. I also need to be able to control the order. I've read what seems like 20 forum posts and blog articles, but none of the solutions enable control of the HTML structure for each specific set of page content, nor the order in which they are shown. If anyone can assist, I'd be grateful.


Control time of addition of posts to RSS?

I have a friend who is trying to control when posts get added to the RSS feed, not when they get added to the site. Is there a way to duplicate the date published section in admin, but for the RSS feed so they can be scheduled separately?


delete user not working

Im just noticed that when I try to delete an user does remove the user, but not their comments. Also choosing the option to change the deleted user's post author to admin does not work either. Is there an action that I could use to just write my own code to make these work?


Quicktags on all textarea.. Not working on plugin?

I want to put a couple of quicktags/buttons on a textarea which is outputted by a plugin called **user submitted posts**. I have given this textarea an unique id and read this on the Quicktags documentation: >   * Run quicktags(settings) to initialize it, where settings is an object > containing up to 3 properties: >   * settings = { >   * id : 'my_id', the HTML ID of the textarea, required >   * buttons: '' Comma separated list of the names of the default buttons to > show. Optional. >   * Current list of default button names: > 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,spell,close'; >   * } * >   * The settings can also be a string quicktags_id. * >   * quicktags_id string The ID of the textarea that will be the editor > canvas >   * buttons string Comma separated list of the default buttons names that > will be shown in that instance. > Than, I put this in my **functions.php** :               <?php     add_action('admin_print_footer_scripts','my_admin_print_footer_scripts');     function my_admin_print_footer_scripts()     {     ?>     <script type="text/javascript">/* <![CDATA[ */              var id = "myID"; // this is your metabox's textarea id              settings = {             id : id,             buttons: 'strong,em,link'          }              quicktags(settings);          /* ]]> */</script>     <?php } ?>      The problem: nothing shows up. PS: I already looked here: Use quicktags toolbar on any textarea Can someone make a suggestion?


Using underscores instead of hyphens in the permalink

What's the best way to ensure that post and page slugs use underscores instead of hyphens, without needing to edit the slug manually (or updating the page manually) Current permalink:               www.<domain>.com/2011/05/this-is-a-test-post/      Desired permalink               www.<domain>.com/2011/05/this_is_a_test_post/      One approach I've tried is to hook into `sanitize_title`, but this seems to only be called when the post is updated, so not very practical for a blog of several thousand post. Is there any way to force each post to update? I need this to preserve compatibility as an old MovableType site is moved into WordPress - using .htaccess isn't really an option


How to add plugin to WordPress Repository?

I just made my first plugin and it got approved by WordPress. Great news for me, but now what? The "instructions" on the Codex are anything but clear for me. I did find an article on Dig WP and I managed to get to the 3rd line of code. After that no joy. Does anyone here have a clear set of instructions on how to do this without the need to read an entire book? I am sure that there are very experienced people here who do this stuff all the time... Thanks in advance!


How to get page title with the page ID?

My page ID is: `30601` How can get the title of this ID? I want get page's title with ID.


How do i edit the plugin files in DataBase via phpMyAdmin?

I need guidance to edit the WordPress plugin and theme files via phpmyadmin If I want to edit a particular plugin file or remove a plugin completely from database, I could able to find them ,but I can able to find the data tables for options , comments, links etc. I don't know how to edit/remove a particular plugin or theme there. Could anybody let me know how to find a particular plugin or the entire ' plugins ' folder in data base? Thank you!


Modify 'Read more' link adding a new class

I want to add a class to the 'Read more' link. Actually I have this:               <?php the_content( 'Read more...' ); ?>      Which outputs:               Read more…      How can I add a class (using PHP) to the link, so it outputs:               Read more…


Get current post data into array?

I'm trying to achieve a similar effect to get_page($id), but with the current post acting as the argument for get_post(). Something like this pseudocode: `get_post($this=>ID);` . Seems simple, but I can't find the it in the docs.


Roles at registration (classipress)

I have a classipress site and want to have the user choose upon registering with the site if they are a teacher, or student. These will be different roles. I have been trying to get roles at registration plugin to work because it is basically what I need, but since classipress has a custom reg page it does not seem to work. Any ideas?


Comment form problem with comment_author_url and HTML5 input placeholders

I'm using HTML5 on two sites running two different versions of WordPress. They both exhibit the same behaviour and I would like some help with fixing this please.               <label for="url">Website</label> <input type="url" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" placeholder="Enter Website Address (optional)" pattern="https?://.+">      In testing, we have identified a problem with comment_author_url that occurs when people do not input an URL. For some reason, WordPress is picking up the placeholder text and saving it into the database, like so: http://EnterWebsiteAddress(optional) I'm having real trouble trying to identify why this is happening. The placeholder attribute isn't inside the input value so should not be getting picked up. This same code is being used in other applications without problems. Does anyone know how to correct this in WordPress? **UPDATE:** I've done considerable research on this and thought I'd share my findings. The issues come from the comment_form function within WordPress itself. To avoid the problems there are two options:   1. Only use placeholders on required fields. When the fields get focus and something is input the placeholder gets cleared.   2. Use JavaScript to clear placeholders before the form is submitted.  I hope this helps the others that have run into the same issues. I'm not submitting a patch to WordPress because, at this time, WordPress only intends to support XHTML.


List posts from certain category, by tag

Basically I need to get all posts from a particular category (or multiple categories), and list them out according to their tag. In Category X, there are the following tags, and under each tag is the link to all the posts with that tag. I have it MOSTLY working - except this is pulling ALL tags from ALL categories. Any way I can limit this output to just a particular category?               <?php         //get all terms (e.g. categories or post tags), then display all posts in each term         $taxonomy = 'post_tag';//  e.g. post_tag, category         $param_type = 'tag__in'; //  e.g. tag__in, category__in         $term_args=array(           'orderby' => 'name',           'order' => 'ASC'         );         $terms = get_terms($taxonomy,$term_args);         if ($terms) {           foreach( $terms as $term ) {             $args=array(               "$param_type" => array($term->term_id),               'post_type' => 'post',               'post_status' => 'publish',               'posts_per_page' => -1,               'caller_get_posts'=> 1               );             $my_query = null;             $my_query = new WP_Query($args);             if( $my_query->have_posts() ) {               echo '
' . $term->name . '

';               while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
                <?php               endwhile;               echo '
';             }           }         }         wp_reset_query();  // Restore global post data stomped by the_post().         ?>


editing usermeta when field is an array

I'm using s2member and I added a new registration field to my registration form. s2member stores all custom registration fields in an array under the meta key `wp_s2member_custom_fields`. An example array (private data is x'd out) looks like this:               a:15:{s:14:"street_address";s:19:"xx xxxxxxxx xxxxxxx";s:4:"city";s:15:"xxxxxxxxxxx xxxx";s:12:"can_province";s:2:"NS";s:7:"country";s:2:"CA";s:10:"postalcode";s:7:"xxx xxx";s:5:"phone";s:12:"xxx-xxx-xxxx";s:17:"weaving_interests";a:10:{i:0;s:6:"iw_gen";i:1;s:6:"iw_bas";i:2;s:6:"iw_bla";i:3;s:7:"iw_fash";i:4;s:5:"iw_FA";i:5;s:7:"iw_felt";i:6;s:6:"iw_lin";i:7;s:9:"iw_design";i:8;s:6:"iw_rug";i:9;s:6:"iw_sao";}s:14:"spin_interests";a:2:{i:0;s:7:"is_wool";i:1;s:7:"is_misc";}s:12:"is_misc_desc";s:110:"alpaca, bamboo, seacell...  pretty much any fibre - primarily animals based - as long as it's soft and pretty!";s:13:"dye_interests";a:2:{i:0;s:7:"id_chem";i:1;s:6:"id_nat";}s:8:"ew_count";s:1:"6";s:8:"ew_about";s:202:"36" eight shaft jack loom     45" four shaft jack loom     25" 16 shaft table loom     15" four shaft table loom     tapestry loom     1 1/2 inkle looms (the second one is under construction)     20ish" rigid heddle loom";s:7:"ec_spin";s:1:"3";s:8:"es_about";s:392:"- Ashford traveller which I love - it's my primary wheel     - a homemade wheel which is a little heavy and a tiny bit clunky, but spins nice yarn - it's at my cottage     - a small antique wheel that I use mostly for display and have never used (I haven't gotten around to putting a drive band on it yet)     - I also have a few drop spindles, including one I made this summer from a rock and a stick";s:8:"eo_about";s:80:"I love my drum carder for blending colours and making very cool rovings to spin!";}      I attempted to add my new field `loomsong_del` to this array.               a:16:{ ....;s:12:"loomsong_del";s:5:"email";} //desired result     a:2:{i:0;a:15:{ ....}s:12:"loomsong_del";s:5:"email";} //actual result      To correct the situation I tried this:                   $s2_custom=get_user_meta($u->ID, 'wp_s2member_custom_fields');         $real = $s2_custom[0];         $real['loomsong_del']='email';         update_user_meta($u->ID,  'wp_s2member_custom_fields',$real);      which resulted in this:               a:2:{i:0; a:16:{ ....;s:12:"loomsong_del";s:5:"email";} s:12:"loomsong_del";s:5:"email";}      //should be a:16:{ ....;s:12:"loomsong_del";s:5:"email";} only      How can I fix it?


Suggest a plugin for up/down voting posts

I need a free wordpress plugin that will allow the users to upvote or down vote every post. Something similar to stackoverflow.com If not give me suggestions of how to create one. I am a java programmer and have never coded anything in PHP.


How to remove "Connection Information" requirement on localhost install of WP on MACOSX

I've just installed XAMPP on Mac OSX and when trying to install a theme or plugin in WP admin, I'm getting this screen. I've never gotten this on my _shared_ hosting account. how to get rid of it on localhost? ![WordPress challenge when installing new plugin](http://i.stack.imgur.com/VgCRV.png) ![enter image description here](http://i.stack.imgur.com/mipHI.png)


'Invalid Error' when saving theme options - only in Google Chrome

I have users when get an 'Invalid Error' when trying to edit the custom theme options in my theme, WPFolio. The options (just some CSS rules: page container color, font color, headline/body font, etc...) work as they should in Firefox, Safari, and IE and any changes they make there will show up in Chrome fine. But when they try to edit/save theme options in Chrome, they get an 'Invalid Value' error on a specific field when they try to save in Chrome, even if they haven't touched that field. The weird thing is, I can't replicate the error no matter what browser I use... Any ideas? Thanks! Have a look at the theme files on github.


Wordpress FLIR (Facelift Image Replacement) plugin clipping off end of text

I'm using the FLIR for Wordpress plugin (v0.8.9.2) with FancyFonts enabled. I'm running Wordpress 3.1. The problem I'm having is that it appears the plugin is cutting off a couple pixels off of the end of some of the text that it generates. It doesn't do it for all text, but where it happens, it happens consistently. Here are some examples: ![enter image description here](http://i.stack.imgur.com/0WV7r.png) ![enter image description here](http://i.stack.imgur.com/PU3Ik.png) ![enter image description here](http://i.stack.imgur.com/asDQd.gif) In my search for a solution, I've found a number of people with this issue, but never any solutions. Any ideas would be greatly appreciated. Thank you!


Is there something wrong w/ this code?

<?php         $rp = new WP_Query(array(         'post_type' => array( 'post','videos','projects' ),         'orderby' => 'date&order=DESC',         'posts_per_page' => 4         ));              while ($rp->have_posts()) : $rp->the_post();     ?>      I noticed that if I change `date&order=DESC` to `rand`, it makes no difference, meaning the posts don't show up in random order even after multiple refreshes. Is there something wrong w/ this code?


search serialised meta_value for date value?

i've saved and array of 'open days' as a serialised array in a meta value. I was hoping i could then just search this field for the selected dates but i can't seem to create a match. serialised = a:2:{i:0;s:10:"2011-09-16";i:1;s:10:"2011-09-17";} ; // two open dates and was trying this and some variation without luck ;               $values_serialized = serialize(array('2011-09-16')); // need to serialise???          $args =  array ('meta_query' => array(          array( 'key'=>'v-openDays', 'value'=>$values_serialized,'compare'=>'IN' )        )     )     // IN or LIKE?      will also be searching for multiple days but need to get one working first! Help appreciated, Dc


is it possible to get next_post_link

I have come across a problem whilst using the next_post_link() function. It seems that this function automatically echo's, for position reasons I need this to just return the link. Is there any available function or workaround that I can use to achieve this result?


I'm using wordpress version 3.1 and if I try to upgrade any plugin on any of my sites I get the error message `error: An Unexpected HTTP Error occurred during the API request`. Not by upgrading automatically, but manually upgrading through the dashboard plugin area I guess I mean I've google for a solutions, to no avail. I've gone into my `class-http.php` file and changed this code `'timeout' => apply_filters( 'http_request_timeout', 5)`, to `'timeout' => apply_filters( 'http_request_timeout', 30)`, Also tried request time out at 60. Also downloaded Core Control Plugin, went into External HTTP Access and disabled each of those 4 PHP HTTP Extension/Transport options one by one and still same problem.


custom post types don't appear in RSS

I created custom post-types in my site but these posts are not shown in the RSS. Only the regular posts appear there. What could be preventing them from showing up there


custom post type tag lists and link to post

I'm a newbie in custom post type. and so far I've been able to customize list of post (`archive.php` or `archive-xxx.php`), and link to individual post (`single.php` or `single-xxx.php`). All these works good. However, when retrieving tag list or list of post of a specific tag, it uses archive.php and list all posts under the specific custom post type. [question] How can I fetch list of all tags for this post_type, with posts underneath each tag? ` tag1      post 1      post 2 `


After Login Page says 404

I installed wordpress at abc.com/myblog/wp-login.php Once i login to the admin it displays the header and footer of the site and shows 404 pages in the middle portion. Is that permission issue ?


I need to do some query. Now i choosing from this variables. Which is from this queries is more faster. Which differences between them ?               function filter_where($where = '') {          $where .= " AND post_date > '" . date('Y-m-d', strtotime('-10 days')) . "'";          return $where;     }           add_filter('posts_where', 'filter_where');     $my_query = new WP_Query( array( 'meta_key' => 'post_views', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'posts_per_page' => 5 ) );     remove_filter( 'posts_where', 'filter_where' );          while ($my_query->have_posts()) : $my_query->the_post();      And this.                function filter_where($where = '') {           $where .= " AND post_date > '" . date('Y-m-d', strtotime('-10 days')) . "'";           return $where;     }          add_filter('posts_where', 'filter_where');     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $my_query = new WP_Query( "meta_key=post_views&orderby=meta_value_num&order=DESC&posts_per_page=5&paged=$paged" );     remove_filter( 'posts_where', 'filter_where' );          while ($my_query->have_posts()) : $my_query->the_post();


Changing the text of Upload/Insert on Posts and Pages Screen

In wp-admin/includes/media.php I found this:               function media_buttons($editor_id = 'content') {         $context = apply_filters('media_buttons_context', __('Upload/Insert %s'));              $img = '';              echo '' . sprintf( $context, $img ) . '';     }     add_action( 'media_buttons', 'media_buttons' );      I don't know what I'm doing to change the text from Upload/Insert in my functions.php file. I've tried what I have below and it doesn't work.               function adcp_change_media_button($context) {         return str_replace('Upload/Insert %s', 'Upload/Insert images, documents, etc %s');     }     add_filter('media_buttons', 'adcp_change_media_button');      Thanks for the help!


How to query for posts with either one or another custom field

Need help querying for posts with either one or another custom field. Not sure how to use the 'or' operator here, but something like this the blow - Have tried these:               $wp_query->query('post_type=myposttype&meta_value=X||Y||Z');     $wp_query->query('post_type=myposttype&meta_value=X||meta_value=Y||meta_value=Z');     $wp_query->query('post_type=myposttype&meta_value="X"OR"Y"OR"Z"');


Different back-end colour scheme for the different sites of a multisite

Is it possible to have a different back-end colour scheme selected for the different sites of a multisite? i.e. "Sunrise" for Site A and "Midnight" for Site B If it's not possible for the user to setup could it be enforced through a plugin or the theme?


Wordpress 3.1 - How does one add sticky post capabilities to post types

In wordpress 3.1 they finally added the option of allowing posts belonging to a custom post type to be marked as "sticky"... what I can't figure out though is how to enable this so the admin menu option shows up. I was thinking it might have something to do with the "supports" argument when the post type is defined in the functions.php file however I can't find any references. Any I on how I can get these sticky options to show up in the admin area?


how to show this part only in the single post page?

I have this part in my index-meta.php file :

source:

<a href="<?php echo get_post_meta($post->ID, 'source-link', true); ?>" target="_blank"><?php echo get_post_meta($post->ID, 'source', true); ?>

      this'll show the source of my posts based on the custom fields I've made, and I just want them to show in the content-single.php file, I mean the single posts page. but they also showing in front page (index.php, content.php), I dont' want that. what conditional can I use and how? please help me with this cause I'm pretty weak in php and wp...


Set option to show the slider in post - WP

In the WordPress admin/dashboard under "Add New Post", I want to set an option for if someone wants to show posts in a slider: Yes/No. ![enter image description here](http://i.stack.imgur.com/9C0WI.jpg) And upon the option I need to do something like this in the post page:               if ( isset( $post_slider ) ) {         // show slider code goes here     }


Multilingual Wordpress page - using URL to determine language?

I want to create a webpage that supports more than one language, but I don't want to use a plugin for that if it's possible. I am already loading the theme translation depending on the URL; if there is a '/en' part at the end (but before get-parameters), I load the english translation etc. Is it possible and wise to also change the query depending on that parameter? Meaning that if '/en' is found, all loaded posts need to be tagged with 'English', if '/br' is found all posts need to be tagged with 'Brazil' (standing for brazilian portuguese) and so on.


The below site list the plugins and themes used in a wordpress blog. Is there a way to stop the theme and especially plugins listed? http://whatwpthemeisthat.com/


Avoid updating post when sending POST or GET request to post.php

I've created a Plugin which adds a new meta-box on the post.php dashboard page, containing a form. Whenever a POST request is submitted from that form, I would like to save some post meta-data. I have been able to implement this, but I noticed that each time this POST request is sent, the entire blog post gets updated, including changes that were made outside my meta-box. It's as if I was pressing the default "Update" button instead of my own form submit button. Is there a way to send a POST (or GET) request to post.php without having it interpreted as a request to save all changes to the blog post? There must be such a possibility, since refreshing that page from a browser does not cause the blog post to automatically be updated. I know I could probably do this using AJAX, but I'd like to avoid that if possible. Also, I'm using WordPress 3.4.1.


Is it possible to get feature image url (full-size) from an image url of smaller size?

Supposing that we know nothing except the url of image (smaller size e.g. 150x150)               http://xxx.com/wp-content/uploads/2014/06/test-image-150x150.jpg      What is the best way to get its full-size image url from the url above? or Just easily remove the prefix "-150x150" ? (I'm not sure if this is proper since i need best practice also.)


Is it possible set a featured image with external image URL

I know there are plugins that fetch images from remote URL and store locally. I just want to know whether it is possible _not_ to store image in Media Library yet use it as _Featured Image_?


Link to most recent child page

in the header of a website I am trying to link to the most recent child page of a particular parent page. I can't seem to wrap my head around how to accomplish this. Does anyone have any input on this? Thank you very much in advance.


remove custom post type ulr

I have a custom post type called portfolio with three categories. If i make post with it, the url looks like this. http://skateflix.se/?portfolio=route- one. Every fix i tried, every plugin gives me this: http://skateflix.se/feeds/route-one where feed is the category. this takes me to the wrong post, nor sure if its an archive template or something similar. What i want is simply removing the custom post type slug. How do i do this?


changing permalink "next link" to navigate the next page not working

Why on earth if i change my permalink structure, like this! `/%category%/%postname%` the `next link` to navigate the next page, is not working! it display the error `page not found` but if add some text before this(`/%category%`), like this structure `this-is-the-working- structure/%category%/%postname%`, the `next link` use to navigate the next page is working, any **idea on this**. I want my permalink structure like this `/%category%/%postname%` so that wordpress select permalink from the slug of the content. _ps:_ in my observation if the permalink structure start use the this kind of structure `%category%` the `next link` will not work.


Redirect to a page after a few seconds

I have homepage which needs to redirect to another page. For this to accomplish, I used the `meta fresh` tag               <meta http-equiiv=refresh content="6; url=/home/">      And, it works perfectly. Later I found on Internet that this `meta fresh` code tag has been deprecated and is not at all SEO friendly. Then I used one js code               <script type="text/javascript">     setTimeout("window.location='url'",5000);     </script>      and it's also working.. now, my concern is - which one still better (most SEO friendly or is there any other hack in redirecting a simple page to another WP normal page? Thanks in advance.


How to edit the '<-- older' link on archive page in Blankslate theme?

I am using the 'Blankslate' theme for Wordpress and I edited about everything except for the older and newer links on my blog page. How can I change this links in the Blankslate theme? It isn't located in the function.php and index.php files.


Wordpress Multisite: Adding actions to only one site

I have Wordpress Multisite installed with WooCommerce network activated. I want to add an action to a hook in ONE of the sites that has WooCommerce installed, instead of all of them. For example, I only want this action that adds specific meta data to the order to occur on one of the sites with WooCommerce installed.               add_action('woocommerce_checkout_update_order_meta', 'new_meta_values'), 2);          function new_meta_values($order_id) {         $order = new WC_Order($order_id);         $items = $order->get_items();              foreach($items as $k => $v){            $item_id = $k;                   woocommerce_add_order_item_meta( $item_id, '_seminar_members_', $data);         }     }      Is this possible?


How do we exclude multiple pages (like opposite of is_page)

## Scenario I have a following customized format for the website with Woocommerce.   1. **`<?php if(is_shop()) {?>`** There are certain css styles, JS options used for this particular page   2. **`<?php } if(is_front_page()) { ?>`** Same as above with different css animations used or certain classes when on home page of the site ## Question Now, I want to use some specific jQuery options such as .Delay(), Hide(), & Show() on `pages other than Shop & Home page` However, If I simply add the jQuery outside the options `1` & `2` mentioned above .. this gets applied to entire website -- overriding options specified for `is_shop` I think if we can exclude pages then I can exclude these 2 pages above. Writing `is_page (array)` would be too tedious for hundreds of pages. How can we exclude certain WP pages (in my case only 2)? Or should I re-format the page using `if else` & will it work? Thanks in advance.


Custom Taxonomy With Author?

I have a picture website that has about 300 contributing authors. I want to have it so any author can submit a request of pictures that they want on a list. The list then would be credited to that author that submitted the list but the posts within the list are still associated with the author that submitted the picture. I can't seem to find a good plugin/work around that will do this. Any ideas? It would be greatly appreciated.


Can I ignore caching of a plugin in W3 Total Cache?

I currently have a plugin that lets me display a random post in a widget. The problem is that if I activate w3 total cache it will only display that post as long as the cache hasn't been cleared. Is there a way to cache everything except this plugin? Sorry if the question is rather newbie, I just installed the plugin but haven't been able to find the answer anywhere. Thanks in advance!


Looking for a lightweight theme using WP3 new tags and features (not 2010)

I design & build a lot of bespoke Wordpress themes for clients, and before I just took the best parts out of the default Kubrick and made my own 'vanilla' theme. The new default, TwentyTen is way too complex for my needs, and is a bit kitchen sink. Are there any lightweight WordPress 3 themes like these? http://designceo.com/20-lightweight-minimalist-wordpress-themes ? Thanks!


Cronjob not working as expected - issue with hook?

Today I've tried to write a Wordpress Cronjob. For testing purposes I wrote a function that sends me an email every hour, but it's not working. I've got a plugin called 'Core Control' which shows me all existing Cronjobs - mine is also listed there. There is also a button "Run now". If I press it, I get the test-mail, so the function itself is correct. Here is the code for the Cronjob, it is placed inside the functions.php of my theme.               if( !wp_next_scheduled( 'check_cron' ) ) {          wp_schedule_event( time(), 'hourly', 'check_cron' );       }             add_action( 'check_cron', 'sendit' );          function sendit() {           $address = "address@provider.com";         $sender = "Cron_Test";         $sendermail = "crontest@sender.com";         $subject = "It works!";         $text = "Yay, it is working!";              mail($address, $subject, $text, "From: $sender <$sendermail>");         }        There has to be something wrong with the action hook, but I have no idea what's wrong. Or do I need to place the code in some different file? Some more Info: I now that `mail();` does not work on localhost, that's why I created a test blog online. The folder is protected via .htaccess with a password, could that be an issue? I also checked that my wp-config.php allows Cronjobs. I also now that the site needs to be visited for the Cronjob to run.


Permalink for Custom Post Types

I am trying to get a custom permalink style for my custom post types... my current permalink for my post is /%postname%/ but for my custom post types, I am trying to get the custom taxonomy in the permalink. I don't actually want the custom taxonomy name IN the permalink, but instead, let's say the custom taxonomy name is "TYPES" and under it I create "PRODUCTS" and my custom post type is "REVIEWS"... I want a permalink structure that is like /REVIEWS/PRODUCTS/%POSTNAME% From my current permalink structure, it just shows /REVIEWS/%POSTNAME%. Any idea how I can accomplish the above? BTW I am using Custom Post Type UI plugin to create the custom post type and taxonomy. Also tried using the Custom Post Type Permalinks plugin... but settings %taxonomy% doesn't work, I am guessing I have to register that somewhere.


How to get wordpress nav menu outside of wordpress system?

I want to get a specific wordpress nav menu as a list in my custom php page outside of wordpress. How to do that?


WPML with WP_Query serving up all 3 languages

I've got something about this on the WPML support forums, but I figured I could ask here as well. Here's the important info: I'm running a WP Multisite setup with custom post types, custom fields, custom everything it seems. In a particular template file, I've got a secondary loop that's pulling a list of items from a different blog. From what I gathered, anything using the WP API should be filtered down to only the current language, but none of the `WP_Query()` functions I've got are doing so. Relevant code:               <?php       switch_to_blog(23);     $args = array('post_type' => 'release-notes',         'suppress_filters' => 0,         'meta_query' => array(                 array(                     'key' => 'related_products',                     'value' => $thisproduct,                     'compare' => 'LIKE'                 )             )         );     $loop = new WP_Query($args);     if ($loop->have_posts()) {         echo '
Release Notes
';         while ( $loop->have_posts() ) : $loop->the_post();             //echo '
';             //print_r($post);             //echo '
';             $post_link = ($post->post_name);             echo '
' . get_the_title() . '
';         endwhile; // foreach($posts     } // if ($results     restore_current_blog();     ?>      The problem here is twofold: first, it's returning results from every language instead of the current language - the same post, three times (EN, FR, DE). Second, the result from `get_permalink()` is completely wrong - it's spitting out http://www.mysite.com/blog23name/postname instead of http://www.mysite.com/blog23name/lang/posttype/postname - the custom permalink shown on the 'edit post' page. Any ideas?


Selectively hiding or allowing thumbnails of featured images on front page

I need a way to selectively hide or allow thumbnails of featured images to appear on the front page of my site. Ideally, it would be a custom field on each post, where I could choose - for example - 1 or 0 to represent appear or remain hidden. Can someone provide the solution? Thank you.


Enable featured image but not have it show up?

I am using the latest default Twenty Eleven on WordPress 3.3.1 ![My Site Currently](http://i.stack.imgur.com/Z26LL.png) My post has a featured image (the smaller one, which 1 is pointing to), and I would like it not to appear in my post. It has already appeared in my outer post before someone clicks in. In the picture above, I also point to 2, which shows up in a lightbox but that has been turned off, so please ignore that. I would appreciate help on removing the displaying featured image on my posts. Thanks!


Widget Options Not saving

I am trying to create a custom Recent Posts widget that accepts a category, to show only posts in that category. I'm having trouble saving the widget options. I've done some debugging and found that in the update function, `$new_instance` only contains the title options and not via_cat. Here's the code for form and update:                   /**          * Back-end widget form.          *          * @see WP_Widget::form()          *          * @param array $instance Previously saved values from database.          */         public function form($instance) {             /* Set up some default widget settings. */             $defaults = array( 'title' => '', 'via_cat' => 1);             $instance = wp_parse_args( (array) $instance, $defaults );                       $cats = get_terms('category');             $category_data = array();             foreach ($cats as $cat) {                 $category_data[$cat->term_id] = $cat->name;             }     ?>
         <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?>         <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />

         <label for="<?php echo $this->get_field_id('via_cat'); ?>"><?php _e( 'Category:' ); ?>         <select id="<?php echo $this->get_field_id('via_cat'); ?>" name="<?php echo $this->get_field_id('via_cat'); ?>">     <?php             foreach ($category_data as $id => $name) {     ?>             <option value="<?php echo $id; ?>"<?php echo $instance['via_cat'] == $id ? ' selected="selected"' : ''; ?>><?php echo $name; ?></option>     <?php             }     ?>         </select>
     <?php         }                    /**      * Sanitize widget form values as they are saved.      *      * @see WP_Widget::update()      *      * @param array $new_instance Values just sent to be saved.      * @param array $old_instance Previously saved values from database.      *      * @return array Updated safe values to be saved.      */     function update( $new_instance, $old_instance ) {         $instance = $old_instance;         $instance['title'] = strip_tags( $new_instance['title'] );         $instance['via_cat'] = $new_instance['via_cat'];              return $instance;     }      Any help is appreciated.


Random Custom Post Type Titles

So i found the code below from another question on here, it displays a list of titles from a custom post type, my question is, How do i get the list to randomize?                     <?php      $queryObject = new WP_Query( 'post_type=announcements&posts_per_page=5' );      // The Loop!if ($queryObject->have_posts()) {     ?>
     <?php     while ($queryObject->have_posts()) {         $queryObject->the_post();         ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
     <?php     }     ?>
     <?php      }      ?>


how to add the same Widget twice to a sidebar?

I have a sidebar and would like to fill it like this: [Text] [Some other Widget] [Text] but I can add the Text widget only once to the Sidebar. What can I do to be able to add it more than once?


Wordpress Page Edit gives Error 404

I'm having the stupidest problem, ever. I can manage and edit pages just fine, but after some time, I can no longer edit or preview a page and I receive an "Error 404 - Page Not Found". This doesn't happen on every page, just on specific ones. But the stupid thing is, I start removing pieces of the content slowly, and it looks like a particular accented character: à, is causing the problem. (When I first started work on this page, it was a few days ago, and it accepted everything I wrote just fine) I remove all of the pages' contents, and the page will save. I put something like: > Pie à la mode and the page bombs. I've been struggling with this for a very long time, and I'm super frustrated. Here are some things to consider:   * Wordpress was installed in English, installing in French results in same issue.   * Database is UTF-8,   * PERMALINKS ARE NOT THE ISSUE (I've set and reset them to try and fix as I've seen other people claim this works for them),   * I have already tried the "Disable all Plugins" and before I got to the "Try one by one to find which one is the problem", the error is still there.   * Also I have tried the base TwentyEleven/TwentyTen theme and the error still persists.   * .htaccess is fine, it's editable and has the proper modrewrite code   * New Posts/Pages with just the text: "Pie à la mode" also causes the Error. Now, one would think flipping to HTML mode and typing in the HTML code for à (& agrave;) would fix this, and it does, BUT, once you move back to the Visual mode, the special HTML character is reverted back to it's regular character....and won't save. You can't type a in the Visual editor to get it to work, either. So this is frustrating. What to do??? Edit: Changed this install to French, period, and now no post edits work..... Grr...


Shortcode not displaying video as expected

I have written a short code to display a video off of amazon, and it works. However it is not being placed as expected on the page. I have put the shortcode after the `<!--more-->` tag but the video displays before the excerpt ruining the layout of the page-of-excerpts. The page is entered like this:               A few random paragraphs of content     <!--more-->     [amazon_video file="file.flv"]      The shortode is written like so               function amazon_video($atts){         extract(             shortcode_atts(                 array(                     'file' => $file                 ),                  $atts              )          );         $url = get_bloginfo('url');         ?>         <embed             src='<?php echo $url; ?>/jwplayer/player.swf'             name='player'             width='640'             height='480'             bgcolor='#000000'             allowscriptaccess='always'             allowfullscreen='true'             flashvars='file=<?php echo $file; ?>                         &streamer=rtmp://xxxxxxxxxxxxx.cloudfront.net/cfx/st                         &provider=rtmp'             autoplay="false"         />         <?php     }          add_shortcode('amazon_video','amazon_video');      The page in question is here incase you wanted to have a look but you may run into some member permissioning. Essentially, the video is being called last and below the excerpt but is being displayed first and above the excerpt.


Setting Event to Expire Using Custom Metabox

Working on a real estate website and setting Open House dates and times using drop downs in a Custom Meta Box. Example drop down below:               <select name="sale_listing_open_house1_start_day" id="sale_listing_open_house1_start_day">               <option value="monday" <?php selected( $selected, 'Monday' ); ?>>Monday</option>               <option value="tuesday" <?php selected( $selected, 'Tuesday' ); ?>>Tuesday</option>               <option value="wednesday" <?php selected( $selected, 'Wednesday' ); ?>>Wednesday</option>               <option value="thursday" <?php selected( $selected, 'Thursday' ); ?>>Thursday</option>             <option value="friday" <?php selected( $selected, 'Friday' ); ?>>Friday</option>               <option value="saturday" <?php selected( $selected, 'Saturday' ); ?>>Saturday</option>             <option value="sunday" <?php selected( $selected, 'Sunday' ); ?>>Sunday</option>           </select>      Let's say there's a drop down for the end day, month, date and time ... Is there any way to format this so that the Open House will expire once the date/time has passed what was specified in the drop down?


Creating / Editing a post from within site template

I am developing a website that will allow multiple users to author short posts (Kind of like a job board) and I want to know how they can author or edit these posts from within the site template (Ie; without having to enter the dashboard). Any advice or points in the right direction would be great


Detection of theme being used

OK, this may be a dumb question. Is it possible, using PHP, to detect which theme has been set for use by Wordpress ? If so, how's it done ? Thanks.


Unable to get result on str_replace

Can anyone please tell me whats wrong with my code below, I can echo out the authorname but I'm not able to get the authorname on str_replace. This is for replacing the browser tab title. Thanks.               add_filter( 'wp_title', 'bbpress_title_jezsse', 20, 3 );          function bbpress_title_jezsse($title, $sep, $seplocation){                  global $post;             $author = get_user_by('id', $post->post_author);             $authorname = $author->display_name;                  //echo $authorname;                  $title = str_replace("Profile", "".$authorname." Profile", $title);                       return $title;             }


Changed primary domain and now wordpress login won't work

I changed the primary domain on a website I'm working on, but now when I go to wp-admin page and try to login it wont work. I assume this is because of this most recent change. Like changing something with my hosting company, is there somewhere in the FTP of wordpress that I have to update to tell it to now head to this new primary domain? The website is working fine, I just can't login right now. Any advice or suggestions on some change of files via FTP would be appreciated!


Custom post type filter by post meta - not returning correct counts

I have a custom post type `product`. And what I did, I made a custom filter function based on the custom post's meta data using `posts_where` filter. It's working but I noticed the post count is not matched on the number items displayed as seen on the image below. ![enter image description here](http://i.stack.imgur.com/w4aEb.jpg) Here's my code :               add_action( 'load-edit.php', 'load_custom_filter_wpse_94630' );          function load_custom_filter_wpse_94630()     {         global $typenow;         if( $_GET['post_type'] != 'product' )             return;              add_filter( 'posts_where' , 'posts_where_wpse_94630' );     }          function posts_where_wpse_94630( $where )      {         global $wpdb;                if ( isset( $_GET[ 'location' ] ) && !empty( $_GET[ 'location' ] ) )          {             $meta = esc_sql( $_GET['location'] );             $where .= " AND ID IN (SELECT post_id FROM $wpdb->postmeta WHERE meta_value='$meta' )";         }         return $where;     }      Thanks!


WP_Options high

I have a site where the options_id field in the wp_options table have grown very, very large. After a month and a half after the installation the auto_increment value is now at over 10 million. While there are a number of plugins installed (such as ACF and W3 Total Cache) they do not seem to be the cause. They have been installed on others sites together with the same theme framework without any issues. I have a local dev environment of the affected site where all the plugins and theme updates are first tested. It's auto_increment value is only about 15,000 which I would expect given all the theme development on that install. The site has also been very slow to load, at about 3 seconds per page if it wasn't cached by W3 Total Cache (with page caching enabled the load times are great). Given the slow load times and the high auto_increment value there would seem to be some kind of connection between the two. The options table itself only contains about a 1000 rows, which seems normal, so it is able to clean up after itself. The site is part of a multisite network and each site in the network has at least an auto_increment value of 1 million or more. All other tables in the database haven't been affected, each of them show a normal number of rows given the amount of pages on each site. Anyone got any ideas?


Query outputting YouTube url rather than embedded video

I am having an issue with a query outputting the YouTube url rather than the video itself. The post I am querying has a Youtube url in the content area. Of course, when viewing the post, you don’t see the url, you see the video, as it’s supposed to be. When using get_the_content to display this post on another page, it’s outputting the Youtube url rather than embedding the video automatically. If I use the_content, then it outputs the video, but it does so before the other html. Here’s my query, if that helps: http://pastebin.com/zUHXSjui


Error in capabilities.php

I have uninstall plugin & themes shall we are getting the error in capabilties.php following error code if ( ! $post_type->map_meta_cap ) { $caps[] = $post_type->cap->$cap; // Prior to 3.1 we would re-call map_meta_cap here. if ( 'read_post' == $cap ) $cap = $post_type->cap->$cap; Kindly look after the matter & resolve this issue.....


Error in capabilities.php doesn't open dashboard

We are facing Trying to get property of non-object in capabilities.php error and we have used 3.9.2 version and following is the code in the file capabilities.php `if ( ! $post_type->map_meta_cap ) { $caps[] = $post_type->cap->$cap; // Prior to 3.1 we would re-call map_meta_cap here. if ( 'read_post' == $cap ) $cap = $post_type->cap->$cap;` Kindly look after the matter & resolve this issue.....


Trying to get property of non-object in capabilities.php in 3.9.2

In my website corrupted the plugins or themes, so FTP this remove plugin or theme. In that case error are given about capabilities.php. So install new wordpress version 3.9.2 but in that also dashboard is not open and given the error in following code tag:               if ( ! $post_type->map_meta_cap ) {                 $caps[] = $post_type->cap->$cap;                 // Prior to 3.1 we would re-call map_meta_cap here.                 if ( 'read_post' == $cap )                     $cap = $post_type->cap->$cap;      so give me suggestion about that


404 not found error on WordPress local host

I'm doing some work on a live WordPress site, and before making changes wanted to create a local copy of the site to use. I've gone ahead and done that, (using BackUpBuddy) but I am getting this error for every page (except the home page) Not Found The requested URL /index.php was not found on this server. I've tried going to dashboard -> settings -> permalinks and re-saving and it doesn't work. If I change the permalink setting to "default" instead of "post name" I am able to load all the other pages. I've done some investigating and tried changing a couple things in my .htaccess file in my text editor, but still no luck. Here's the content of .htaccess               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]      RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]      </IfModule>     # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /014-TGGGLocal/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /014-TGGGLocal/index.php [L]     </IfModule>          # END WordPress      I should also mention that .htacess and index.php are both in the directory indicated by the Site address (URL) setting on my General Options page. AND using post name "permalinks" works fine on the live version of the site.


Translation not working in sprinf variable

I have a function to get the taxonomy term name like this:               function get_term_name($taxo){     $terms = get_terms($taxo);     $html= '';     foreach($terms as $term ) {        $html .= sprintf( __( '%s', 'twentyfourteen' ), $term->name  ); $html .= '<br>';        }        return $html;     }      The problem is the return string not translated. What am I done wrong?


Parent (ID from meta box) not showing in permalink, only Grandparent

I'm working on a site inherited from a previous developer and I've run into a issue that's really confusing. There's a custom post type for Locations. The hierarchy for Location posts would look something like this:   /location/california   /location/california/los-angeles   /location/california/los-angeles/overview   /location/california/los-angeles/contact   etc. When you create a new location post, there's a meta box to select the parent. I've looked in the rendered HTML and the parent IDs are correct. The problem is that for some reason, when WordPress generates the permalink (set to /%postname%/ ), it's showing the grandparent as the parent. For example, if I create a Contact page and select Los Angeles, the permalink will show up like this:   /location/california/contact      If I were to create a new city page, it would show up like this:   /location/san-francisco Any idea why the parent is getting skipped? Thanks in advance


Changing permalink of WordPress

I am pretty new to this and hence facing a bit of a problem. Currently I am designing a website on my localhost using WordPress. I noticed that the permalink structure wasn't very appealing in the default mode. I then found that it can be changed through settings and after looking around I found that I wanted `%postname%` as my custom structure. After making the change all my links seem to be broken! I cannot access any of the pages or posts.. After searching a bit I found that certain changes need to be made in htaccess file. According to http://codex.wordpress.org/Using_Permalinks the content in the file should be :               # BEGIN WordPress      <IfModule mod_rewrite.c> RewriteEngine On     RewriteBase / RewriteCond     %{REQUEST_FILENAME} !-f RewriteCond     %{REQUEST_FILENAME} !-d RewriteRule .     /index.php [L] </IfModule>     # END WordPress      On opening the htaccess file the contents were:               # BEGIN WordPress      <IfModule mod_rewrite.c> RewriteEngine On     RewriteBase /wordpress/ RewriteRule     ^index\.php$ - [L] RewriteCond     %{REQUEST_FILENAME} !-f RewriteCond     %{REQUEST_FILENAME} !-d RewriteRule .     /wordpress/index.php [L] </IfModule>     # END WordPress      But neither of the two seem to work.


Remove a href from this code

I am using a short piece of code(which is modified, originally it was a plugin-Taxonomy Terms List) to display custom taxonomies after the post, When the terms are displayed, it is displayed with a `href` tag. I don't want the terms to be a link, I just want simple terms text. How can I get that? Here is my current code:               if( !function_exists( 'pr' ) ) {         function pr1( $var ) {             print '<pre>' . print_r( $var, true ) . '</pre>';         }     }          if( !function_exists( 'mfields_taxonomy_terms_list1' ) ) {         function mfields_taxonomy_terms_list1( $c ) {             global $post;             $o = '';                  $terms = array();             $lists = array();             $custom_taxonomy_names = array();             $custom_taxonomies = mfields_get_custom_taxonomies1();                  if( !empty( $custom_taxonomies ) )                 foreach( $custom_taxonomies as $name => $config )                     $custom_taxonomy_names[] = $config->name;                  if( !empty( $custom_taxonomy_names ) )                 $terms = get_terms( $custom_taxonomy_names );                  foreach( $custom_taxonomies as $name => $config )                 $o.= get_the_term_list( $post->ID, $name, $before = '', $sep = ' | ', $after = '' );                  if( is_single() )                 return $c . $o;                  return $c;         }              add_shortcode('terms1', 'mfields_taxonomy_terms_list1');     }          if( !function_exists( 'mfields_get_custom_taxonomies1' ) ) {         function mfields_get_custom_taxonomies1( ) {             global $wp_taxonomies;                  $custom_taxonomies = array();             $default_taxonomies = array( 'post_tag', 'category', 'link_category' );                  foreach( $wp_taxonomies as $slug => $config )                  if( !in_array( $slug, $default_taxonomies ) )                     $custom_taxonomies[$slug] = $config;                  return $custom_taxonomies;         }     }          add_action( 'wp_print_scripts', 'enqueue_slideout' );


title tag function

I am using a function to display the URL on title tag, I coded this function which works properly but I would like to customize it more further.               function title_tag()     {     $a = $_SERVER['REQUEST_URI'];     $b = strtoupper($a);     $c = str_replace('-', ' ', $b);     $d = str_replace('/', ' - ', $c);          $e = substr($d, 2);     return $e;     }      This function will display the url on title after inserting this code in title tag.               <title><?php echo title_tag(); ?></title>      The current code is displaying the title in this format, my title of website: _**STANFORD UNIVERSITY - MBA IN CALIFORNIA - MBA -_** But I want to display it in this format, just the change in punctuations _**STANFORD UNIVERSITY - MBA IN CALIFORNIA, MBA -_** Just a comma as separator in between How can I have this?


Query posts from current year

I don't quite get why this isn't working. I'm trying to use the following to only show posts from the current year on the front page:               <?php query_posts( "&year=$current_year&order=DESC"); ?>      Yet it still shows posts from 2012 (they weren't actually made in 2012, but I set the publish date to one of the posts that's showing to Feb of last year) According to the documentation, that's how I should be doing it. Can anyone shed any light? Thanks


Using class id from array for query

I'm using Event Calendar 3. Since there seems to be no easy way of querying all upcoming events as posts, I tried it this way, getting the IDs from the DB and querying the posts from that:               <?php if(!ec3_check_installed(__('Upcoming Events','ec3')))         return;     global $ec3,$wpdb,$wp_version;          $calendar_entries = $wpdb->get_results(         "SELECT             p.id AS id         FROM $ec3->schedule s         LEFT JOIN $wpdb->posts p ON s.post_id=p.id         WHERE p.post_status='publish'         AND end>='$ec3->today' $and_before         ORDER BY start $limit_numposts", OBJECT_K     );           $args = array(         'post_type' => 'post',         'post__in' => $calendar_entries,         'orderby' => 'id',         'order' => 'DESC'     );          $query = new WP_Query( $args );      It doesnt work, obviously because the array looks like this, if I var_dump it:               array(2) {         [37]=> object(stdClass)#2183 (1) {              ["id"]=> string(2) "37"         }         [8]=> object(stdClass)#2186 (1) {              ["id"]=> string(1) "8"          }      }       How can I use this array for my query?


Querying posts only if the current page is not paged?

For example, I want to query posts in a page. But I don't want to show them when the user clicks the pagination links. Pretty much like what happens in Youtube. You only see the Top comments in the first page but when you click `Next` they disappear. Any suggestions to accomplish this? URL example: Query the posts if it is the first page:               example.com/taiwantalk/forums/topic/technology-topic-11/      Don't query them if it is the second page or any other:               example.com/taiwantalk/forums/topic/technology-topic-11/page/2/


It is possible to encounter horrible bugs if I place a main loop that uses `query_posts` right above the main bbPress loop?

This is the code:                           <?php get_template_part( 'pagination', 'bbp_replies' ); ?>                      <?php query_posts('gdsr_sort=thumbs&post_type=bbp_reply&posts_per_page=2'); ?>                 <?php while ( have_posts() ) : the_post(); ?>
<?php  the_title(); ?>
                     <?php the_content(); ?>                 <?php endwhile; ?>                 <?php wp_reset_query(); ?>                      <?php while ( bbp_replies() ) : bbp_the_reply(); ?>

                             <?php bbp_reply_author_link( array( 'type' => 'avatar' ) ); ?>                             <?php bbp_reply_author_link( array( 'type' => 'name' ) ); ?>                             <?php printf( __( '%1$s', 'bbpress' ), get_the_date() ); ?>

                             <?php bbp_reply_content(); ?>                             <?php DisplayVotes(get_the_ID()); ?>
                                  <?php bbp_reply_admin_links(); ?>
      The first `query_posts` loop list the 2 most voted replies. The second bbPress loop list all other replies in DESC order. Will I encounter bugs if I have these two loops in a same file template?


WordPress Not Sending Out New User Passwords

When I'm creating a new user on a WordPress installation, the new user email is not being sent to the new user. Any idea what's going on? More info: Retrieve password emails are being sent.


WP 3.8 Default Admin Colour For All Users

I am surprised with the new colour scheme for 3.8 and although the classic 3.7 theme has gone, I would like to set the new "Light" colour scheme as the default for all users, but at the same time, still allow them to change the theme if they wish, in their user profile. Has anyone managed to come up with a function to set the default for all users? I've searched but can find nothing as this is so new, 3.8 codex not fully written.


Adding css to wp_head from shortcode

I'm trying to add CSS to wp_head, from within the method called to render a shortcode. I know that wp_head does not take any parameters, so I'm trying to figure out the following: The method called by WP to render the shortcode has two params, **$atts** and **$content**. What I'm trying to do is generate instance specific CSS from the **$atts** provided, and add it to the header, rather than rendering a tag in my method, I'd like all of my CSS in one spot (I'm adding a numerical ID to each rule, which allows custom CSS even if its the same shortcode). The troubles I'm having:   1. I can't just pass a string to wp_head using add_actionm it requires a function   2. Because I need the $atts provided by wordpress, the function has to accept a parameter, which php 5.2 doesn't support (minimum supported php version for WP).   3. WP doesnt have a way to called something like.. content_for in rails, so I cant just append it and put it where I want. I've tried _filters_ , _actions_ , *wp_add_inline_styles*, and even _globals_ with no success. Any help would be greatly appreciated.


How to allow YouTube object embed in Wordpress 3+?

I admin a Wordpress blog with a few dozens of users. Since we upgraded to version 3.1+ my users can't insert the YouTube embed tags into a post ( wordpress or TinyMCE removes them ). When I'm logged in as administrator, I can insert the , and tags. But my users cannot. What about the auto-embed ( oEmbed )? Well, my users are too dumb to figure it out. They get confused pasting the link on it's own line and making sure it's not hyperlinked. The idea of adding [embed] tags around the URL is too difficult for them. Basically, someone taught them how to copy the embed code and paste it into the HTML tab and that's all they know how to do. They don't want to change. How can I make them happy? I just want to allow the YouTube embed code in their posts. Any plugin or hack to do this? Thanks, and my dumb users thank you too.


Does running Wordpress on Nginx do "squat" for its performance?

This article states: > If you aren't already using a PHP opcode cache and WordPress caching plugin, > nginx will do squat for your WordPress-based website's performance. Could someone elaborate on what the author means. I'm currently running a vanilla install of wordpress on my Apache2 webserver. I'm considering migrating a number of my other sites (non-wordpress) to Nginx and think whilst I'm at it I might as well migrate Wordpress too. But the above statement makes me think that there'll be no benefit to migrating wordpress. Why?


Page template anomaly

I have created a page with some text in it using this page-about.php as a template; page-about.php contains the basic:               <?php /* Template Name: About us */     get_header(); ?>

                                <?php                      while ( have_posts() ) : the_post();  the_content();                      endwhile;                      ?>

           <?php get_footer(); ?>      What I don't really understand, if I create another page, let's say Coaching, assign page-coaching.php to it as a template, page-coaching.php having the same content as the one above but with /* Template Name: Coaching */, of course, when I view the page is showing me the content of the Homepage? And also Coaching disappeared from the menu?! This is driving me crazy, any suggestions please? I have created custom post types for both, exact copies, just changed about to coaching from one part to another, like this:               // Custom post type => ABOUT US     add_action( 'init', 'create_about' );     function create_about() {       $labels = array(         'name' => _x('About us', 'post type general name'),         'singular_name' => _x('About us', 'post type singular name'),         'add_new' => _x('Add New', 'About us'),         'add_new_item' => __('Add New About us'),         'edit_item' => __('Edit About us'),         'new_item' => __('New About us'),         'view_item' => __('View About us'),         'search_items' => __('Search About us'),         'not_found' =>  __('No About us found'),         'not_found_in_trash' => __('No About us found in Trash'),         'parent_item_colon' => ''       );            $supports = array('title', 'editor', 'revisions', 'excerpt', 'thumbnail', 'page-attributes');            register_post_type( 'about',         array(           'labels' => $labels,           'public' => true,           'has_archive' => true,           'hierarchical' => true,           'query_var' => true,           'supports' => $supports         )       );     }