Janrain/Simple Modal under Redirected Domain

I have a wordpress site running on one domain that has the main 'client' domain for the site redirecting to it. I've got my Wordpress Address/Site Address entered correcting in Wordpress, and the .htaccess is formatted properly afaik. Everything else seems to work properly other than this issue. So I have Janrain Engage, SimpleModal Jainrain Engage and SimpleModal Login. Everything was working fine when we were building the site on the hosted domain. When it came time to switch the live sites and redirect the published URL to our host, things went all screwy. So, basically; If you go to www.publishedurl.com and attempt to login with your Wordpress user/pass the loggin in progress bar appears and just hangs indefinitely. If you try and loging with your Facebook ID it appears to successfully log you in, but on www.publishedurl.com it shows you as not logged in. If you then go to www.backendurel.com/wordpressinstall/ it will show you logged in with Facebook -- and back there, if you attempt to log-in, that works fine as well. I've updated Wordpress and the plugins, I've scoured the wp_options table in the database for a setting that might be wrong. I completely uninstalled and reinstalled everything, created new Jainrain and Facebook widgets. ATM I have the files and folders of all 3 plugins set to 775 permission. We also use Mingle and a few other widgets that block users from viewing the WP backend daskboard and allow front-end posting. PS. Actually, during the course of this whole re-install I've now broken everything at the www.backendurl.com/wordpressinstall... same action... endless "loggin in" progress bar... had to pull the php redirect off my wp- login page... ugg.. help please! =D


How to use Disqus for some categories, and FB comments for others?

I didn't find anything related to what i'm trying to do. My WP blog have several categories. For one specific category, in which I publish short news and viral content, I'd like to use Facebook comments as the default commenting system. For any other categories, i'd like to keep using Disqus as usual. My problem : since Disqus is taking over with a hook (I guess), how can I have Facebook comments take over instead of Disqus if in_category(x) ? Where would that happen, and how would you do ? (Ideally, i'd like to deal with it in functions.php instead of having to edit core Disqus plugin files)


How to use the widget area to extend the page content?

I want to remove a widget area (lateral), and extend the page width getting this area. What is the better way to do it?


WP_Query, custom sort and custom filter

Is it possible using WP_Query to return a filtered list of items based on the following criteria set? I seem to be struggling as there are numerous queries against custom fields.               Select all posts that are of type business_club (post_type)     Where the post has a zone of 'Asia' (meta_value)     Order by country ASC (meta_value)     then by town ASC (meta_value)     then by title (wp value)      Any help is greatly appreciated.


Wordpress remove filter wpautop not working

i have a trouble. I tried to use too many plugins and funciont and also               remove_filter( 'the_content', 'wpautop' );      but it is not working. I've added a shortcode into a text widget but wordpress add always tags p. Why??


is user logged in not working

I am creating a plugin and wish to check if the user is logged in the run another function. This is my first ever plugin and i am still learning how to program at the same time. following I have a simple user conditional, if user is logged in and i am also retrieving data from an array to check if the admin has checked Yes in the plugin options to check for user logged in then execute another function. however I am getting an error `Call to undefined function is_user_logged_in()` i think i may need to wrap my conditional in a function and then add an action, can someone please help me. thanks               /* Logged user conditionals */          $logged = get_option('lu_ban_data');          if ($logged['loggedU'] == 'loggedYes' && is_user_logged_in() ) {         lu_ban_detect();         } else {         return false;         }      **update** Okay I think i managed to get it to work               add_action( 'init', 'lu_user_logged' );     function lu_user_logged() {     $logged = get_option('lu_ban_data');     echo $logged;     if ($logged['loggedU'] == 'loggedYes' && is_user_logged_in() ) {         lu_ban_detect();         } else {         return false;         }     }      is this the proper way?


How to modify search.php to not show pages only show posts

I want to modify search.php so that it only shows posts and not pages. Can you help? Here is the loop in search.php:               <?php if (have_posts()) : ?>     <?php while(have_posts()): the_post(); ?>


Description of a sub-taxonomy

I am using this code to display description of a taxonomy.               <?php $my_taxonomy = 'institute'; $terms = wp_get_post_terms( $post->ID, $my_taxonomy ); echo term_description($terms[0]->term_id, $my_taxonomy); ?>      What to do if I want to show description of sub or even sub-taxonomy?


Are private posts visible to search engines?

I want to display a list of posts (deals) on homepage (and having a link to original deal on deal provider's site) but I don't want individual posts to be accessible by anyone even search engines. Is this possible? Can making such posts private work?


Hosting Requirements for a WordPress e-commerce site?

I can't seem to find out what level of hosting I'll require for a WordPress e-commerce website. (yes, I realise this will vary based upon a heap of factors but I'm looking for some ballpark ranges for each factor) I'm thinking about such plugins as WP e-Commerce, Shopp, etc... for instance all those mentioned in http://mashable.com/2011/06/16/wordpress-ecommerce- plugins/ ! (tips with direction there would be nice... but perhaps I just need to research more first, or maybe later create an entirely new question for that instead!) This isn't a massive store I'm talking about, I'm referring to the e-Commerce twin of your typical business brouchure site (the sort of thing which would easily be fine on your standard decent shared hosting provider if it was non- e-commerce). So just a handful of products, few dozen at the very most. So, should I go for a good shared host still (I've been using Hostgator for websites in the past) or go for a VPS? (and if VPS, what level of VPS?!) I'm quite sure a dedicated server is way over the top for what we need (plus I don't expect my client's budget would stretch that far, they're a non-profit). I'm just trying to get a handle on the starting point, for instance even when I look around with Zen Cart, Magneto, etc (which can be "integrated" with WordPress and would be the next step up) they don't seem to be clear with what is the minimum starting level for a small low traffic site. Although I'm sure it would be at least a VPS, and shared hosting is out of the question entirely! Thanks in advance! :-)


Get wp_title() from page ID into a variable

I'm pretty sure that it's not possible but can I get the result of `wp_title()` into a variable if I know post's ID? So, for instance I'm on a "blog" page and I want to have the title of "about" page in a variable (not in the `<title>` tag like in this questions: Setting title using wp_title filter).


Create a select drop down of available menus

I'm attempting to create a custom field on my page creation that allows a user to choose which menu to display on the page. Right now I have my custom meta field setup, but can't figure out how to make a drop down menu of the available menus. Is there a function that I could use and then for loop though? Thanks!


adding a numbers to a item from navigation menu

I search in Internet but i didn't find a good documented way how to add to item from menu a number , my current menu is like               Item1     Item2     Item3 ,      I'm calculating with WP_Query how many post for category i have , and within function to update a specific menu item like :               Item1(10)      Item2(5)      Item3(20)      Thank you a LOT ! :) i finded a solution , but i don't know how to filter by specific menu , location > function wpa_filter_nav_menu_objects( $items){ >   >   >     foreach( $items as $item ){ >   >         if( strtolower($item->title)=='sample page' ){ >             $item->title = $item->title.'(10)'; >         } >     } >     return $items; } add_filter( 'wp_nav_menu_objects', > 'wpa_filter_nav_menu_objects' ); >   menu i'm creating in admin panel , from Apperance > Menus Thank you again !


How to adjust found_posts so that it accounts for offset and pagination

So far this is the code I have in my index.php file:               <?php                   // Custom code to offset posts and setup pagination             $page = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;                  $ppp = get_option( 'posts_per_page' );                        if ( $page == 1 )                 $offset = 6;             else                 $offset = 6 + ( $page - 1 ) * $ppp;                  $args = array(               'posts_per_page' => $ppp,               'offset'     =>  $offset,             );             $offset_query = new WP_Query ( $args );          ?>      At this point everything works fine except that there is an extra page with no posts on the site. Apparently this occurs because found_posts doesn't account for offset and so found_posts thinks there are more posts and adds an extra page. So how would I deduct the offset from the found_posts value so that the extra page doesn't occur. Or, how would I just get rid of the extra page that is showing up.


Pricing Tables admin page capability

I'm creating a plugin that will allow to create Pricing Tables in a fast and easy way. But, I'm not sure what rule to use for capability. What would you use? Right now I'm using `edit_pages`:               add_submenu_page( 'tools.php', 'SMK Pricing Tables', 'SMK Pricing Tables', 'edit_pages', 'smk_pricing_tables', 'admin_page' );      Should I use `edit_theme_options` ?


Rewrites and Attachments

I'm currently working on a custom post type that has rewrite tags to allow for sub pages. e.g: showcases/project-name/media/ Media being the page. My problem is with attachments and media uploads, we currently have a front end that supports uploading images, the problem is media attachments require passing a post id for attaching it to the page, Because these pages are custom, I've no idea how to pass a post id for a page that to wordpress doesn't exist. Can anyone assist me with this? -Sythen


How to set a custom post type to have viewable future posts

I've setup a CPT to act the same ways as posts but used to post event details. Thing is that some of the posts are in the future and such have a future date set on them. Problem is that normal users cannot see these posts. So:   * How do I alter archive-events.php to list future posts too? Showing far future posts first and oldest posts last while maintaining pagination.   * How do I make it so that when a user clicks a future post they don't get a 404 page not found as the post is not technically published yet?


Mystique theme: widgets on sidebar falling under the page content

I'm using the default two columns layout of the Mystique theme.   If I insert widgets into the main sidebar from the dashboard, instead of being showed aside in the page, they fall under the post (even overlapping the comment box).   What am I doing wrong?


Wordpress is not displaying CSS file

I have a crazy problem happening and it is blowing my mind. I installed Wordpress on my Localhost and began developing. I modified the standard twenty twelve theme and add custom HTML and CSS to the whole site (4 or 5 pages.) The site shows up great on my local machine (Mac OSX - Safari 6.0.5, Firefox 23.0. Chrome 29.0). I transferred my site to my live host (under GoDaddy) and I migrated the database by dumping it and then importing it. Now I can pull my site up under both my localhost and by going to the live host URL and the site looks exactly like it should. However, when I crosscheck the CSS via sites like (browsershots.org and browserstack) the site look terrible. Its almost like the main style.css file is not being linked properly. These browser check sites shows the site in ruins on all operating systems and all browsers. Still though when I bring the site up on my personal machine it looks just as it should. My client pulled the site up from their machine and it looked in ruins, just as the css checking sites depicted it. I have cleared my browser cache thinking I may be reloading a cached version of the site (giving me false hope that it looks good) however it still appears just like it should while viewing the remote version through my local machine. Side note:All elements of the page appear to be loading fine. The menu bar is there. The text and content is there. It's just not styled. Does anyone have any idea what may be going on?


Comment form vaildation

I've build a custom comments form which hooks onto the default `comment_form()` in twenty twelve child theme. Here is my code `functions.php`               function pietergoosen_custom_comment_fields($fields) {                          $commenter = wp_get_current_commenter();                     $req = get_option( 'require_name_email' );                     $aria_req = ( $req ? " aria-required='true'" : '' );                          $fields =  array(            'author' =>         '
' . __( 'Name', 'pietergoosen' ) .         ( $req ? '*' : '' ) . ' ' .         '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) .         '" size="30"' . $aria_req . ' />
',            'email' =>         '
' . __( 'email', 'pietergoosen' ) .         ( $req ? '*' : '' ) . ' ' .         '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) .         '" size="30"' . $aria_req . ' />
',            'verwysing' =>         '
' . __( 'Where did you hear about us', 'pietergoosen' ) . '' .         '<input id="verwysing" name="refer" type="text" value="' . esc_attr( $commenter['comment_author_refer'] ) .         '" size="30" />
',     );             return $fields;     }          add_filter('comment_form_default_fields','pietergoosen_custom_comment_fields');      This is the how I enqueue my jquery scrips in `functions.php` and also the jquey validation in `comment-validation.js`. It works fine without going to the default error page wordpress uses.               function pietergoosen_comments_validation() {     if(is_single() && comments_open() ) {          wp_enqueue_script('jqueryvalidate', get_stylesheet_directory_uri().'/js/jquery.validate.pack.js', array('jquery'));         wp_enqueue_script('commentvalidation', get_stylesheet_directory_uri().'/js/comment-validation.js', array('jquery','jqueryvalidate'));         }     }     add_action('wp_enqueue_scripts', 'pietergoosen_comments_validation');          jQuery(document).ready(function($) {     $('#commentform').validate({          rules: {       author: {         required: true,         minlength: 2       },            email: {         required: true,         email: true       },            comment: {         required: true,         minlength: 10       }     },          messages: {       author: "Please provide a valid name",       email: "Please provide a valid email",       comment: "Comments needs to be at least 20 characters"     },          errorElement: "div",     errorPlacement: function(error, element) {       element.before(error);     }          });     });      The problem is, I modified the code to include other customizations for the form as in here:                function pietergoosen_custom_comment_fields($args = array(), $post_id = null) {             if ( null === $post_id )                     $post_id = get_the_ID();             else                     $id = $post_id;                  $commenter = wp_get_current_commenter();             $user = wp_get_current_user();             $user_identity = $user->exists() ? $user->display_name : '';                  $req      = get_option( 'require_name_email' );             $aria_req = ( $req ? " aria-required='true'" : '' );             $html5    = isset( $args['format'] ) && 'html5' === $args['format'];                     $fields =  array(                          'author' =>                     '
' . __( 'Name', 'pietergoosen' ) .                     ( $req ? '*' : '' ) . ' ' .                     '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) .                     '" size="30"' . $aria_req . ' />
',                          'email' =>                     '
' . __( 'email', 'pietergoosen' ) .                     ( $req ? '*' : '' ) . ' ' .                     '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) .                     '" size="30"' . $aria_req . ' />
',                          'verwysing' =>                     '
' . __( 'Where did you hear about us', 'pietergoosen' ) . '' .                     '<input id="refer" name="refer" type="text" value="' . esc_attr( $commenter['comment_author_refer'] ) .                     '" size="30" />
',     );                  $required_text = sprintf( ' ' . __('Fields marked %s are required and must be filled in'), '*' );                  $arg = array(                     'fields'               => apply_filters( 'comment_form_default_fields', $fields ),                     'comment_field'        => '
' . _x( 'Share your thoughts on this post', 'noun' ) . ' <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>
',                     'must_log_in'          => '
' . sprintf( __( 'Please sign in to share your thoughts' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '
',                     'logged_in_as'         => '
' . sprintf( __( 'You are currently signed in as %2$s. Sign out?' ), get_edit_user_link(), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '
',                     'comment_notes_before' => '
' . __( 'Be assured, your email will never be shared with anyone' ) . ( $req ? $required_text : '' ) . '
',                     'comment_notes_after'  => '
' . sprintf( __( 'Thank you for sharing your thoughts.' )) . '
',                     'title_reply'          => __( 'Share your thoughts' ),                     'title_reply_to'       => __( 'Share your thoughts on %s' ),                     'cancel_reply_link'    => __( 'Remove your thoughts' ),                     'label_submit'         => __( 'Send' ),                     );             return $arg;     }          add_filter('comment_form_defaults', 'pietergoosen_custom_comment_fields');      Everything in my comment form works like it should, but now my validation script is not working. If validation fails, it redirects to the default wordpress error page. My custom validation script is not working to validate the submitted info on page. Am I using a wrong hook, or is there something I missed in the validation script.


Responsive Admin Themes

I was looking at this example of an admin theme (http://themepixels.com/main/themes/demo/webpage/shamcey/dashboard.html). As for the Left Admin bar labeled "Navigation," Is there a way to achieve this type of Left dashboard Admin menu without using a plugin? I would like to achieve this with css, js, or Jquery anything dealing with coding it out.


WordPress emails translate to French

My client's site is in French and we want to translate the canned emails (such as user registration and password lost) to French. What are the hooks/filters for these? The default language is french, i.e.               define('WPLANG', 'fr_FR');


Theme/Plugin/Widget Data and Staging/Production Servers

I did some searching before asking and didn't quite come across an answer. Recently I started on a project where they were hosting the development version of WP on an internal multisite, and I was tasked to bring it to a more modern workflow. The setup is Development (localhost) > Staging (Client Approval) > Production (World Facing) So I got an instance up and and running on PagodaBox, which is uses Git for deployment, which is awesome, and they will be two instances running off branches of the Git repo. For this project they used some plugins such as:   * Aqua Page Builder   * Royal Slider   * Extended Text Widget   * Cacoon (Theme) That all seem to save their settings to a magical place I can't find (except RoyalSlider, I clearly see that in the database). So once I got the staging server set up, I used the WP Export tool, pushed the same repo (Different branch) to production, imported with the WP-Import....and basically got a wordpress site lacking all the designs they did with those plugins. Looking at the database from staging, I don't see anywhere that holds this data (Except Royal slider which holds stuff blatantly in the database). _Where is this magical data, and how can I keep it synced between the three stages?_ This also goes for things like images. Do I have to change all kinds of canonical links from one stage to the next? I feel like I am missing something about WP development. Any resources would be appreciated. :)


Getting "ReferenceError: jQuery is not defined" - don't know why!

I've asked this question here before, but never got an answer. In Firebug, in the Console, I get 'ReferenceError: jQuery is not defined'. I have no clue why. Can anyone help? Here is the page I'm working on: http://goinspire.com/jwrp-hotel-registration/ I can provide other code files from my site if it will help - please let me know which ones you want. Thank you in advance! Edit: How do I figure out why jQuery is not included in the page early enough? thank you!


Problem with get_the_title in <a href""> not rendering the way I want

It's quite hard to put a title on this question. So the problem is if my page title is "BLA BLA" my href link will not work.               <a  href="#<?php echo get_the_title();?"> <?php echo get_the_title();?>        It could be great if it automatically translate it to                bla bla       so I'll have                href=#bla bla.      I hope you understand what I'm struggling with for now the only option is to put in the page title               bla bla      Here is my loop it's a menu in a page calling sub-pages:                <?php           $args = array (         'posts_per_page' => -1, //Showing all the pages         'post_type' =>  'page', //Retrieving pages not posts.         'post_parent'   => $post->ID,       'orderby' => 'menu_order',                     'order' => 'ASC'              );          $the_query = new WP_query($args);     while($the_query->have_posts()):         $the_query->the_post();             if ($the_query->current_post == 0){ ?>
 <a href="#<?php echo get_the_title();?>" data-toggle="tab"><?php echo get_the_title(); ?>
                     <?php  }             else{   ?>
  <a href="#<?php echo get_the_title();?>" data-toggle="tab"><?php echo get_the_title(); ?>
                 <?php }     endwhile;     wp_reset_postdata();            ?>


Prevent WordPress from interpreting a subfolder?

**How do I prevent WordPress from interpreting a subfolder?** Right now WordPress is installed in the root folder (grassrootsmedia.net/) and I have several other subfolders like (/Clients) that should NOT be styled and interpreted as part of the main WordPress site. In the past, when you surfed to (grassrootsmedia.net/Clients) the site was not styled nor interpreted by the main WordPress site. Now you get a 404 Error. Help! How do I hide the subfolders? Or how do I block WordPress from thinking the subfolders are a part of the main site?


How to secure the release of WordPress plugins / avoid copying plugins?

I'm new to the WP arena and considering doing some plugin development. In releasing a WordPress plugin, how do you keep from the plugins getting distributed to those who haven't genuinely purchased the plugin? I guess I'm not entirely clear how plugins like Software Licensing for Easy Digital Downloads keep users from copying the plugin after it's installed and distributing it to other users. Clarification would be nice. Thanks.


How to make a child theme independent of parent?

I recently made a twentyten child theme, but I'm curious as to how I can make the child theme independent of its parent, ie exist without the twenty-ten theme folder present. I couldn't find any information on this and thought WP answers could shed some light.


Advanced Custom Fields Post Object

I am looking to create a custom proposal system with WP and ACF. I created 3 custom post types.   1. Proposal Objectives    2. Proposal Items   3. Proposals I created some custom fields in ACF to include in these sections. When generating a new proposal, I have a flexible content field with a Post Object (to pull a Proposal Item) and underneath that drop down, a full WYSIWYG editor. Is it possible to have the content from the post_object load in the editor? So from a list of 10 posts from the Proposal Items section you select the title of of them and the editor populates with the content from that post, so that you have your canned response with the ability to customize it for that proposal. Just not sure where to start to achieve this and any help would be awesome! Example of post_object and the editor below EDIT: I just found this: http://www.advancedcustomfields.com/resources/tutorials/dynamically-populate- a-select-fields-choices/ just trying to see if I can apply it to what I need


Custom Fields - Boolean Display of True/False to Yes/No

I am importing fields from a Real Estate site. The Import of one Custom Field looks like this... Field Name after Import ---> assistedLiving Field Value ---> false to output the display in wordpress i use this...               <?php          global $wp_query;         $postid = $wp_query->post->ID;              if ($immopress_property['assistedLiving']): ?>
                 <?php echo 'Seniorengerechtes Wohnen' ; ?>:                 <?php echo get_post_meta($post->ID, 'assistedLiving' , true); ?>
                  <?php wp_reset_query(); ?>         <?php endif; ?>        The Result on Site looks so... **Seniorengerechtes Wohnen:false** I also tryed...                   <?php                   if ( get_post_meta($post->ID, 'assistedLiving', true) ) { ?>
           <?php echo Seniorengerechtes Wohnen ; ?>:           <?php $assist=get_post_meta($post->ID, 'assistedLiving' , true); if ($assist=="") echo "keine Daten"; else if(strtolower($assist)=='true') echo "Ja"; else if(strtolower($assist)=='false') echo "Nein"; ?>
              <?php wp_reset_query(); ?>         <?php } ?>       But Result on Site looks so... * _Seniorengerechtes Wohnen: *_ How can i display False/True Values to display Yes/No or in German Ja/NEIN? The Funktion to display all Field (Display it Right with yes/no):               function immopress_the_fields( $args ) {         global $post, $ImmoPress;         extract( wp_parse_args( $args, array (             'id' => $post->ID,             'exclude' => $exclude,             'echo' => TRUE         ) ), EXTR_SKIP );              $fields = immopress_get_fields( $args );              if ( !$fields )              return false;              $output = '';              $output .= '
';              foreach ( $fields as $key => $value) {                  $entry = $ImmoPress->values[$value];             if ( $entry == '')                  $entry = $value;                  $output .= "
";             $output .= "{$ImmoPress->fields[$key]}: ";             $output .= "$entry";             $output .= "
";          }              $output .= '
';              if ( $echo ) {             echo $output;         } else {             return $output;         }      **But i need to display only a view Custom Fields not all importet fields.** Code for the Shortcode..               function immopress_fields_shortcode( $atts ) {         $args = wp_parse_args( $atts, array (             'echo' => FALSE         ) );         return immopress_the_fields( $args );            }     add_shortcode( 'immopress_fields', 'immopress_fields_shortcode' );      Hope someone can Help me with that. Thanks Tony


Downgrade user from role that allows post creation

I am an admin of a multi-author blog. I am implementing a monitoring system which will require me to downgrade a user from an 'author' (this role allows them to make a custom post) back to the 'reader' role if I think it is a spam account, or if they are breaking website rules. After changing their role using the admin screen, how can I make all the posts they made delete automatically, without having to scroll and find them myself? Many thanks **EDIT using advice from answers below** :               add_action( 'set_user_role', 'wpse98904_remove_demoted_user_posts', 10, 2 );     function wpse98904_remove_demoted_user_posts( $demoted_author_id, $role ) {      // In here you'd search for all the posts by the user           $args = array(                 'numberposts' => -1,                 'author' => $demoted_author_id,                 'post_type' => 'custom_post',                 // So if your custom post type is named 'xyz_book', then use:                 // 'post_type' => 'xyz_book',      );      $demoted_author_posts = get_posts( $args );      foreach( $demoted_author_posts as $p ) {          // delete the post (actually Trash it)          if($role == 'subscriber') {          wp_trash_post( $p->ID);          // To force the deletion (ie, bypass the Trash):          // wp_delete_post( $p->ID, true );          }      }     }      I used wp_trash_post to trash the events because adding 'false' to wp_delete_post did not work for me.


Viddler oEmbed not working with specified width

I'm working on a widget that embeds videos using oEmbed and I'm testing it out using the default providers in WordPress. So far, they are all working fine, except Viddler. The video is displayed, but not with the width and height I specified. To get the oembeds to work properly in the widget, I'm using the wp_oembed_get() function, which requires the video's URL and optionally an array with the width and height.               // Test Data:     $url = 'http://www.viddler.com/v/bdce8c7';     $width = '250';     $height = '140';          echo wp_oembed_get( $url, array( 'width' => $width, 'height' => $height ) );      This yields a video with dimensions of 620 x 349. I've hacked a way around it, but wp_oembed_get() is supposed to be able to do all this for me, right? Here's what I've put together:               require_once( ABSPATH . WPINC . '/class-oembed.php' );          // $service is detected by parsing the URL for the host     if ( $service == 'viddler' ) {              $oem    = _wp_oembed_get_object();         $json   = 'http://www.viddler.com/oembed/?format=json&url=' . urlencode( $url );         $return = $oem->fetch( $json, $url, array( 'width' => $width, 'height' => $height ) );         $oembed = $return->html;          } else {              $oembed = wp_oembed_get( $url, array( 'width' => $width, 'height' => $height ) );          }          return $oembed;      This works, but I'm wondering if this is a bug I should report to WP or Viddler. In the WP Core (wp-includes/class-oembed.php), the URL format for Viddler is: http://lab.viddler.com/services/oembed/ Should that be changed to what I have above? http://www.viddler.com/oembed/ Anyone else having this issue?


Users Select inside custom metabox

I'm using human made's custom meta boxes framework (https://github.com/humanmade/Custom-Meta-Boxes). I want to add a select drop down in my metabox wich is populated from the users with multiple roles on my WP site. Referencing this post : Get multiple roles with get_users I came up with:               add_filter( 'cmb_meta_boxes', 'users_metabox' );          function eusers_metabox( array $meta_boxes ) {              $prefix = 'user_';              global $wpdb;         $blog_id = get_current_blog_id();              $user_query = new WP_User_Query( array(             'meta_query' => array(                 'relation' => 'OR',                 array(                     'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',                     'value' => 'Administrator',                     'compare' => 'like'                   ),                 array(                     'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',                     'value' => 'Editor',                     'compare' => 'like'                   )               )           )          );              $fields = array(         array(                  'id'   => $prefix . 'user_sub',                  'name' => 'Subscriber User',                  'type'     => 'select',                 'use_ajax' => false,                 'options'  => $user_query,  // this is where you populate the select in metabox             ),         );              $meta_boxes[] = array(             'title' => 'Location Info',             'pages' => 'em_users',             'context'    => 'normal',             'priority'   => 'high',             'fields' => $fields         );              return $meta_boxes;           }      Works somewhat, but seems to return just capital letters. Any ideas? Need to output (UserID) as variable constant


check for shortcode in post/pages AND widgets AND template files

For the next version of my plugin www.mapsmarker.com I would like to output the plugin´s css and js-files only if the shortcode [mapsmarker ...] is used. For posts/and pages I already found this working code:               function lmm_detect_shortcode()     {         global $post;         $pattern = get_shortcode_regex();         preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches );              if( is_array( $matches ) && array_key_exists( 2, $matches ) && in_array( 'mapsmarker', $matches[2] ) )         {             echo 'shortcode is used';         }     }     add_action( 'wp', 'lmm_detect_shortcode' );      Problem is, that the maps can also be embedded in widgets (by shortcode) or template file directly by using the function do_shortcode() (http://www.mapsmarker.com/docs/how-to-add-maps-to-your-site-using-template- tags/) and the code above does not check, if this is true - resulting in the map not being displayed. As a workaround I could add an option in the plugin settings if the js/css- files should only be added when the shortcode is added to a post or page and add the description, to disable this setting if a map is added to widgets via shortcode or to template files via do_shortcode(). As this is not a quite usable solution (which would result in some support requests in the long run), I am looking for a solution, where I can turn this feature on by default and don´t have to add an option to the settings, because the code also checks if a shortcode is added in widgets or via do_shortcode() in one of the template files, like this:               ....     if( ( is_array( $matches ) && array_key_exists( 2, $matches ) && in_array( 'mapsmarker', $matches[2] ) ) || ( CHECK IF SHORTCODE USED IN WIDGETS == TRUE ) || ( CHECK IF SHORTCODE USED IN TEMPLATE FILES == TRUE ) )     {         echo 'shortcode is used';     }     .....      My first approach to this problem was to check global variables and see if somehow I could filter out this added code, e.g. by $wp_filter (array) - a multi-dimensional array of all functions that have been added to filters/hooks. Unfortunately I didnt find a solution yet. Any help is appreciated!


How to find when qtranslate plugin's language changes?

I used qtranslate for make my website multilingual, In fact this plugin just make an option for my content to has another translate, but how can i use it in my code? for example:               if ( $language == "ar" ) {      // somthing }


Delete a specific item menu when I deactivate my plugin (resolved)

When I activate my plugin (register_activation_hook), I add a new specific page and a corresponding item menu in the custom menu. No problem here. When I deactivate my plugin (register_deactivation_hook), I delete the specific page but I don't know how to delete the corresponding item menu from the custom menu ? Any idea ? Thx


Allow all file types for upload

I'm using Wordpress 3.4.2 for a private blog, i.e. one on which only I can post. Now, Wordpress prevents me from uploading certain file types (like C# source files). As far as I understand it, there's a white-list that defines what can be uploaded. Is there a plugin that can extend - or better, even disable - this white-list? All other answers tell me I should edit my theme but I'd rather have a plugin for that (so that I don't need to edit all my themes). Also, I found this plugin but, again, it requires me to edit some file on my server (that's probably overwritten when the plugin is updated). So, is there anything else?


Retrieve array of attachment IDs attached to a given Post ID

I wonder if there's a function to retreive an array containing the attachment IDs of images that are atatched to a given post. Some function like get_post_arry($pid); The array should be ordered like                   ['0':'image1', '1':'image2', '2':'image3', .... etc. ]      Any help would be appreciated. Thank you, Florian


Change avatar on themed profile page

I'm using the Theme My Login plugin and trying to allow subscribers to change their profiles to one uploaded from their computer. I've tried the following plugins:   * Simple Local Avatars   * User Avatar   * WP User Avatar   * Avatar manager I can get the file upload form to appear, but when clicking upload or update profile, the avatar does not change. Is there a way I can achieve this? Here is the whole of my 'Theme my login' profile code with 'Simple Local Avatars'               <div class="login profile" id="theme-my-login<?php $template->the_instance(); ?>">                  <?php $template->the_action_template_message( 'profile' ); ?>                  <?php $template->the_errors(); ?>                  <form id="your-profile" action="<?php $template->the_action_url( 'profile' ); ?>" method="post" class="validate"<?php do_action( 'user_new_form_tag' );?>>                     <?php wp_nonce_field( 'update-user_' . $current_user->ID ); ?>
                        <input type="hidden" name="from" value="profile" />                        <input type="hidden" name="checkuser_id" value="<?php echo $current_user->ID; ?>" />
                          <?php if ( has_action( 'personal_options' ) ) : ?>
<?php _e( 'Personal Options' ); ?>

                     <?php do_action( 'personal_options', $profileuser ); ?>
                          <?php endif; ?>                          <?php do_action( 'profile_personal_options', $profileuser ); ?>
<?php _e( 'Name' ); ?>

                        <?php _e( 'Username' ); ?>	                        <input type="text" name="user_login" id="user_login" value="<?php echo esc_attr( $profileuser->user_login ); ?>" disabled="disabled" class="regular-text" /> <?php _e( 'Your username cannot be changed.', 'theme-my-login' ); ?>

                        <?php _e( 'First Name' ); ?>	                        <input type="text" name="first_name" id="first_name" value="<?php echo esc_attr( $profileuser->first_name ); ?>" class="regular-text" />

                        <?php _e( 'Last Name' ); ?>	                        <input type="text" name="last_name" id="last_name" value="<?php echo esc_attr( $profileuser->last_name ); ?>" class="regular-text" />

                        <?php _e( 'Nickname' ); ?> <?php _e( '(required)' ); ?>	                        <input type="text" name="nickname" id="nickname" value="<?php echo esc_attr( $profileuser->nickname ); ?>" class="regular-text" />

                        <?php _e( 'Display name publicly as' ); ?>	                                                   <select name="display_name" id="display_name">                           <?php                              $public_display = array();                              $public_display['display_nickname']  = $profileuser->nickname;                              $public_display['display_username']  = $profileuser->user_login;                                   if ( ! empty( $profileuser->first_name ) )                                 $public_display['display_firstname'] = $profileuser->first_name;                                   if ( ! empty( $profileuser->last_name ) )                                 $public_display['display_lastname'] = $profileuser->last_name;                                   if ( ! empty( $profileuser->first_name ) && ! empty( $profileuser->last_name ) ) {                                 $public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;                                 $public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;                              }                                   if ( ! in_array( $profileuser->display_name, $public_display ) )// Only add this if it isn't duplicated elsewhere                                 $public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;                                   $public_display = array_map( 'trim', $public_display );                              $public_display = array_unique( $public_display );                                   foreach ( $public_display as $id => $item ) {                           ?>                              <option <?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option>                           <?php                              }                           ?>                           </select>

<?php _e( 'Contact Info' ); ?>

                        <?php _e( 'E-mail' ); ?> <?php _e( '(required)' ); ?>	                        <input type="text" name="email" id="email" value="<?php echo esc_attr( $profileuser->user_email ); ?>" class="regular-text" />

                        <?php _e( 'Website' ); ?>	                        <input type="text" name="url" id="url" value="<?php echo esc_attr( $profileuser->user_url ); ?>" class="regular-text code" />
                          <?php                        foreach ( _wp_get_user_contactmethods() as $name => $desc ) {                     ?>
                        <label for="<?php echo $name; ?>"><?php echo apply_filters( 'user_'.$name.'_label', $desc ); ?>	                        <input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr( $profileuser->$name ); ?>" class="regular-text" />
                     <?php                        }                     ?>

<?php _e( 'About Yourself' ); ?>

                        <?php _e( 'Biographical Info' ); ?>	                        <textarea name="description" id="description" rows="5" cols="30"><?php echo esc_html( $profileuser->description ); ?></textarea>
                        <?php _e( 'Share a little biographical information to fill out your profile. This may be shown publicly.' ); ?>
                          <?php                     $show_password_fields = apply_filters( 'show_password_fields', true, $profileuser );                     if ( $show_password_fields ) :                     ?>
                        <?php _e( 'New Password' ); ?>	                        <input type="password" name="pass1" id="pass1" size="16" value="" autocomplete="off" /> <?php _e( 'If you would like to change the password type a new one. Otherwise leave this blank.' ); ?>
                           <input type="password" name="pass2" id="pass2" size="16" value="" autocomplete="off" /> <?php _e( 'Type your new password again.' ); ?>

<?php _e( 'Strength indicator', 'theme-my-login' ); ?>

<?php _e( 'Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).' ); ?>

                     <?php endif; ?>
                         <?php                      global $current_user;                      get_currentuserinfo();                      $myAv = new simple_local_avatars();                      $myAv->edit_user_profile($current_user);                    ?>
                        <input type="hidden" name="action" value="profile" />                        <input type="hidden" name="instance" value="<?php $template->the_instance(); ?>" />                        <input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr( $current_user->ID ); ?>" />                        <input type="submit" class="button-primary kopa-button blue-button small-button" value="<?php esc_attr_e( 'Update Profile' ); ?>" name="submit" />
                            </form>


Call to a member function get_row() on a non-object, Unable to use global $wbdp inside a plugin

I am building a custom plugin for my WordPress site. I made a php file called "checkrank" that obtains data from a custom table named "cranking".               $uid = $GET['id'];           function checkExists($id){         global $wpdb;         $table_name = $wpdb->prefix . 'cranking';         $exists = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table_name WHERE id = %d" ) );              $error = $wpdb->print_error();              if(count($exists) > 0){            echo 'Exists!';         } else {            echo 'Does not exist!';         }           return $error;     }          checkExists($uid);      The code is just to check whether the cranking table has the user with the provided ID. The problem is, whenever i run this php file, i get this error : > PHP Fatal error: Call to a member function `get_row()` on a non-object Where am I at fault here?   I think `$wbdp` is not initiated.


White background, black text - the simplest on earth : "error"!

On my site in localhost, why a simple "error" doesn't pass/permit to do anything at all? ![WordPress site "error"](http://i.stack.imgur.com/HWWFm.png) I browsed the homepage of the project `localhost/creative/`, it's Ok. After then, I entered `localhost/creative/wp-admin` and it goes into "error". Then I tried the homepage again: that's go wrong too: "error". I retried:   * Clearing browser cache & history   * Using different browsers, etc.   * Waiting for 5 minutes, and then 10... And SUDDENLY it's back on. :) But the question is: **_WHY?_** Because, this is not the first time, it happened several times, before. :(


My website is getting too many dierect home arechives and this is increasing my bounce rate

My website is getting nearly 800 direct home archives daily, as a result the bounce rate of my website has increased. Usually i get only around 30 home archives a day These hits are not from Google, so how can i stop them. Actually in my Wordpress Jetpack stats my home archives are going around 800 a day which only used to be around 30 a day, so i think some one is giving fake clicks to my website. So the bounce rate of my website is increasing day by day because these hits are not from any of the search engines and most of these home archives are from india and usa. So please help me by providing some way out please.


How to get recent comment link

I'm getting 5 recent comments into my sidebar using the following code:               <?php $recent_comments = get_comments('status=approve&number=5'); ?>     <?php foreach ($recent_comments as $comment) { ?>
             <?php echo get_avatar( $comment, '60' ); ?>
                 <a href="<?php echo get_permalink($comment->ID); ?>" title="on <?php echo $comment->post_title; ?>"><?php echo strip_tags($comment->comment_author); ?>
                 <?php echo wp_html_excerpt( $comment->comment_content, 35 ); ?>...

     <?php }  ?>      But the problem that I am facing is: When I click on the comment link it's redirecting me to the current page instead of the page that is commented. On other hand, when I click on the comment link (that is in sidebar) in homepage, it's redirecting me to the latest post page. I have used `wp_reset_query()` but the problem persists.   Also usingt `get_comment($comment->ID);` instead of `get_permalink` is not working.


Require a featured image to publish post

I have a multi author WordPress blog.   I'd like to allow publishing of a post only when a featured image is set. How can that be done?


If post exists in the database - each time goes on `else`

Firstly, I am a newbie when it comes to php. I have a plugin that periodically imports posts into my website. Normally, it should check if the post already exists, and if it does, it updates it. Otherwise it creates a new one. Now for some reason, it always takes the `else` path no matter what. The `if` is like this:               if ( nmp_post_exists( $cam->username ) ) {      and the function is:               function nmp_post_exists($title) {         global $wpdb;         return $wpdb->get_row("SELECT * FROM wp_posts WHERE post_title = '" . $title . "'", 'ARRAY_A');     }


URL redirect problem

I have 2 pages in my wordpress 3.0.1 site with 2 urls www.mysite.co.uk/sub-page/child-of-sub-page/accommodation/ and www.mysite.co.uk/accommodation/ however any link in my site to www.mysite.co.uk/accommodation/ goes to www.mysite.co.uk/sub-page/child-of-sub-page/accommodation/ instead is this a bug in wordpress 3.0.1? or is there a way round this?


Getting the slug into a variable, how to echo that variable

The page slug for each of our wordpress articles is a unique set of seven digits, and we are using that string of numbers as the page slug. In trying to learn how to customize our site even further, I'd like to learn how to echo that slug in template files (outside the loop - it would actually be used in the sidebar). Here's what I've tried so far (and failed miserably): At the top of the post template file, I have this code:               <?php $doi = get_page_template_slug( $post_id ); ?>      So I'm trying to create a $doi variable that has the page slug. Later on in the template file, I'm trying to echo that variable:               <?php echo $doi; ?>      That also fails. Anyone got time to help a PHP newbie out?


Auto-post to multiple sites like Posterous?

I'd like to be able to autopost from my wordpress site (private wordpress.org, not on wordpress.com) to multiple sites with one plugin/hack from within wordpress. I'd like my posts to be able to be auto-posted (linked to) on facebook, identi.ca, twitter, posterous, etc. without multiple plugins. I've looked everywhere for a good plugin and they all seem to be site specific (for example just a twitter plugin). I need a one-stop shop like posterous, but since i have my own site i don't want the links going to posterous when they could be coming back to my official site. is this at all possible as of yet? if not, someone should step up and code it. thanks!


Last time a user logged in

I'm building a site where users log in to view content specific to them. I would like to display the last date and time they logged in. How would I get this information from wordpress? If it doesn't exist, how could I add it? Example: Welcome Back! Your last visit was on 10/25/2010 at 3:14pm. Thanks!


How to insert current date/time in the content of a post?

I'm making a list of suggestion here. I need to insert current date/time for each of my suggestions - they are added accumulatively. If you have any idea on doing that, please share.


In multisite environment which is the most Popular blog?

In a wordpress multisite - selfhosted environment:- how to know which blog has highest number of visitors ? how to know which blog has highest number of comments and posts ?


Filter a custom field based on selection of another custom field (ACF)

I have 3 custom post types with Advanced Custom Fields:   * Student   * Class   * Homework Assignment **Homework** has a custom field that is a 'relationship' with **Class**. This is because specific pieces of homework are related to specific classes. A **Student** has a relationship field with **Class** because each student is part of a class. Now I want to create a **Homework Assignment** , so I set a custom field (relationship) of **student**. Once I've chosen a student, I want the 2nd custom field (also a relationship) to give me the choice of any **Homework Assignment** records that have the same **class** as the **student**. So basically how do I have a conditional statement with Advanced Custom Fields that 'filters' instead of 'show/hides' the 2nd custom field?


Update Post creation date when updated

I am wanting to be able to update a Post and have it show up on my home/main feed as if it were just posted. For example, if I had a Post titled "Roadmap" or "Planned Features", etc... and it was a list, everytime I updated THAT post, it would update it's creation time to make it look like it was just created instead of updated, so that it would show up in my recent posts. Any ideas on how to accomplish?


When sorting WP_List_Table, table sorts, but I also get SQL errors

Here's my lovely `prepare_items()` function:               function prepare_items()     {         global $wpdb;              $table_name = $wpdb->prefix . 'blah';         $per_page = 100;         $columns = $this->get_columns();         $hidden = array();         $sortable = $this->get_sortable_columns();              $this->_column_headers = array($columns, $hidden, $sortable);              $this->process_bulk_action();              $total_items = $wpdb->get_var("SELECT COUNT(id) FROM $table_name");              $paged = isset($_REQUEST['paged']) ? max(0, intval($_REQUEST['paged']) - 1) : 0;         $orderby = (isset($_REQUEST['orderby']) && in_array($_REQUEST['orderby'], array_keys($this->get_sortable_columns()))) ? $_REQUEST['orderby'] : 'title';         $order = (isset($_REQUEST['order']) && in_array($_REQUEST['order'], array('asc', 'desc'))) ? $_REQUEST['order'] : 'asc';              $this->items = $wpdb->get_results($wpdb->prepare("SELECT * FROM $table_name ORDER BY $orderby $order LIMIT %d OFFSET %d", $per_page, $paged), ARRAY_A);              $this->set_pagination_args(array(             'total_items'   => $total_items,             'per_page'      => $per_page,             'total_pages'   => ceil($total_items / $per_page),         ));     }      Now when I sort the table, the URL becomes: `http://blah.dev/wp- admin/admin.php?page=mvc_events&orderby=start_date&order=asc`               [13-Aug-2013 20:55:21 UTC] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'asc LIMIT 0, 10' at line 1 for query SELECT `Event`.* FROM `wp_atb_events` `Event`    ORDER BY asc LIMIT 0, 10 made by do_action('toplevel_page_mvc_events'), call_user_func_array, MvcDispatcher->admin_events_index, MvcDispatcher->__call, __lambda_func, MvcDispatcher::dispatch, AdminEventsController->index, MvcAdminController->set_objects, MvcModel->paginate, MvcDatabaseAdapter->get_results, MvcDatabase->get_results     [13-Aug-2013 20:55:21 UTC] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'asc' at line 1 for query SELECT COUNT(*) AS count FROM `wp_atb_events` `Event`    ORDER BY asc made by do_action('toplevel_page_mvc_events'), call_user_func_array, MvcDispatcher->admin_events_index, MvcDispatcher->__call, __lambda_func, MvcDispatcher::dispatch, AdminEventsController->index, MvcAdminController->set_objects, MvcModel->paginate, MvcModel->get_total_count, MvcDatabaseAdapter->get_var, MvcDatabase->get_var      Any idea why this error is showing up? Everything works, it's just these two error messages keep coming up.


Query for page content, and query for posts on the same page?

I'm having trouble with trying to make a blog listing page, I have a page in Wordpress called Blog. Within this is some written content and that's it. I'm using the following query to make it output the content of that page:               <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
Clever Thinking

<?php the_content(); ?>
     <?php endwhile; ?>      This all works fine. Below that, I'm trying to create a query to all my general posts, with a pagination, displays four posts per page.                            <?php                  // The query for 4 posts                 $query = new WP_Query( 'posts_per_page=4' );                      // Output the results of the query                 if ( $query->have_posts() ) :                            while ( $query->have_posts() ) : $the_query->the_post(); ?>
<?php the_title(); ?>
                      <?php endwhile; ?>                                                             <?php wp_reset_postdata();                      // If no results appear                 else : ?>
<?php _e( 'Sorry, no posts matched your criteria.' ); ?>
                 <?php endif; ?>      But this part is apparently not correct as I do not get anything, not even the posts error message, so the function is not even firing? I can't work out why this query would not work.


Add a submenu to wp_nav_menu

I literally don't know where to begin with this. The only wp_nav_menu() documentation I found was http://codex.wordpress.org/Function_Reference/wp_nav_menu and all submenu docs reference a different function or layout. What can I do?


Having problem creating local instance of wordpress site

I am trying to make a copy of a wordpress site on my webhost on my local computer. I am using EasyPHP. I downloaded all of the files within content and added them to a folder within EasyPHP\data\localweb\projects. I went on myPHPadmin and created a user and database and connected to it using wp- config.php. Then to make sure everything was working so far I navigated to the localhost url for the site and it asked me to do an install. After doing the install it works correctly, I can see my custom theme and activate it, and I see all of my plugins that are installed on the live site. However, all of the content from the site is of course in the database. I drop all of the tables import the live database (which I explorted also via myPHPadmin). It say 'Cannot connect to database' I do some research and find I have to do the following query because the URL is different:               UPDATE wp_posts SET guid = replace(guid, old url, new url);     UPDATE wp_posts SET post_content = replace(post_content, old url, new url);.     UPDATE wp_postmeta SET meta_value = replace(meta_value, old url, new url);     UPDATE wp_options SET option_value = replace(option_value, old url, new url);      So I do that and am getting data from the database, but its not working correctly. The main page has a 404 error and has links to the articles that are on the live site but if other than that its just black and white text. No theme or anything. If I click anything I get the following error:               Object not found!          The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.          If you think this is a server error, please contact the webmaster.      Also when I add wp-admin to log in I get the same error. Help!


Highlighting the current page in a navigation menu which links are generated with a custom loop?

This is a second navigation menu I'm using:
             <?php $custom_posts = new WP_Query(); ?>             <?php $custom_posts->query('post_type=bbp_forum'); ?>             <?php while ($custom_posts->have_posts()) : $custom_posts->the_post(); ?>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
             <?php endwhile; ?>
      Is a custom loop which list a custom post type called Forum. I would like to highlight the current Forum link, like this: ![enter image description here](http://i.stack.imgur.com/ryBto.png) Any suggestions?


Next Page & Previous Page links - skipping a single page - how?

On my Wordpress webpage, I have several Pages. Now I want to display "Next Page" & "Previous Page" links. I know that there are several ways out there to do this, but they all fail because I want to skip one page using this link system. The existing Wordpress functions for this can exclude pages, but if the next page is the page that should be excluded, no link is displayed. I need a solution to just skip the excluded page. As my English isn't best, here is an example of what I need:   The current page id is 3.   The page I want to exclude has page id 4.   So the "Next page" link should point to page id 5, the "Previous page" link to page id 2. How is this possible? I Actually tried this by myself and was able to get the ID of the next page using `get_pages` and some PHP functions, but I failed to exclude the page. If needed I can post the code for that. Please help me!


Saving category to a post, before publishing the post

I have created a link from the dashboard, which goes to add new post, but with a category already selected for the post - but the post will not belong to this category before publishing - this is a problem, because I have some custom fields, which I have assigned to the category, and they will not be visible before the post is published. Is there a way to asign a category to a post, before it is published, which will make what I am trying to achieve possible?


Large image upload size (using timthumb.php

I seem to be having this issue with all of the images on my site. First I optimise a .jpg in Photoshop to approx 100k (it's a large header image), then I upload through Wordpress' media uploader as a Featured Image. Here's the code I use to output the image in my template file:               <?php if (has_post_thumbnail( $post->ID )): ?>                 <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); ?>                 <img src="<?php bloginfo('template_directory'); ?>/thumbs.php?src=<?php echo $image[0]; ?>&w=660&h=246&zc=1" alt="<?php the_title(); ?>" />             <?php endif; ?>      **Problem:** When I view the image in the browser, it seems to have a file size of approx 900k. 9 times the size of the original file! What is causing this increase in file size after uploading through Wordpress? Is it WP's media uploader or the timthumb.php script?


Creating a job board using WordPress (for free)?

I found several plugins/themes for creating a job board with WordPress, but only one solution which is free (see here) Are there any other **free** solutions for doing that? Thanks.


How do I pass variables into short-code enabled Post Snippets in Wordpress 3.0?

I am using a plugin called Post Snippets. According to the documentation, it can substitute variables, such as {url} within the snippets. http://wordpress.org/extend/plugins/post-snippets/ I am unclear how to assign values from within a specific post to a variable. I tried using exec-PHP, and used the following:               [exec]url = "domain.com";[/exec]      But the snippet registered no value for {url}. **How can I assign, from within a post, the value to a variable so that I can use it as described?**


Where do files uploaded via Media Manager get stored in MU?

Standard WordPress sites, at least of the versions of WP I've tested, store files uploaded via the Media Manager under wp-content/uploads/ Where do these same files get stored in MU sites and how can you obtain a reference to this folder via script from functions.php? Is the location different depending on which version of WP or WPMU is installed?


Replace Gravatar with UserPhoto in All Users Coulmn view

I am using the UserPhoto plugin which allows users to upload a photo which can be used in many ways. (It's awesome) But I would also like when the admins look at the list of users the column displays this users photo instead of the Gravatar. Is there a hook? I'm a little closer...               function change_user_avatar_col( $column ) {         $column['avatar'] = 'avatar';              return $column;     }     add_filter( 'manage_users_columns', 'change_user_avatar_col' );          function change_user_avatar( $val, $column_name, $user_id ) {         $user = get_userdata( $user_id );              switch ($column_name) {             case 'avatar' :                 return userphoto_thumbnail($user);                 break;                  default:         }         return $return;     }      add_filter( 'manage_users_custom_column', 'change_user_avatar', 10, 3 );      I am getting the images but they they are not in the column, plus I really want to replace the current gravatars and this is creating an additional column. I tried changing out the "avatar" to "Username" for the column but no success.


Override default url for author pages?

So the default url to display a list of posts by a particular author looks like this: `http://domain.com/author/{username}` I am wondering how to change the 'author' in that url to something else? I am working on a website for a charter school and they would like to allow each teacher to have a list of posts by "classroom". So the desired url would be `http://domain.com/classroom/{username}`


Print all inline styles to head

Currently working on a project here http://palanquin.shrimp-works.com. When I try to validate what I have done so far, using http://validator.w3.org/, I get lots of this error **_Element style not allowed as child of element div in this context. (Suppressing further errors from this subtree.)_** , which basically means there is a div which is printing it's styles to the body tag of my document. This means simple styles like background color, text color, etc are all being printed in the body tag of the html, ruining any chance of html5 validation. Is there a wordpress filter that can print all **_style tags_** from the text editor or tinymce to the head instead of to the body? I know how to enqueue inline styles in functions.php. I don't think that's what I need here. Any ideas?


Ajax requests without JQuery

I want to make Ajax requests without JQuery, and without including `wp_load.php`. I want to use a vanilla `XmlHttpRequest` object that I write myself. Any links, hints, done-it-befores, etc?


View category in the preview of Theme Customizer

I am building a theme which Theme customizer changes colors, sizes, etc. and has also the option to choose a category and style that category specifically. How can I display that category in the preview (only when the user is changing the corresponding options) instead of the default home/front page displayed by default? **EDIT** I can access the preview window with customize_preview_init, but I can not apply wp_redirect, which I guess could be a way.


Permissions in a Local Dev Environment (OS X)

I wanted to enable WordPress auto-updates to work without FTP, so I added: `define('FS_METHOD', 'direct');` to my `wp-config.php`. So in order to grant write privileges to WordPress's auto-updater, I ran `chown -R _www:_www [wordpress-project-folder]`. I'm using _www instead of www-data, because I read that it's OS X's equivalent. However, now anytime I modify a file with a Text Editor or commit changes with git within that wordpress folder, I need to `sudo`, which is slowing me down. Is there a happy medium?


Images sizes generated smaller than specified

So I have an image that's `1536x2048` and I've set up an image size that would hard crop to `460x600` with:               add_image_size( 'hard-edge', 460, 600, true );      When this is actually output, I get a file size of `450x600`. That ain't right. There's more than enough room for a hard crop to get the exact size, so what I am not understanding about the way it's cropping?


Partially translated dashboard in one of network's site

I have multisite WordPress installation with default language for all new sites set to English. For one of my sites I wanted to add support for different (Polish) language. I copied all Polish *.mo files I found in Polish installation of WordPress. After switching to that language that one site only, I noticed that not only frontend, but also dashboard has been translated into Polish. Because that was unwanted effect, I deleted all *.mo files from languages directory, except for pl_PL.mo. Especially I removed *.mo files for admin and network admin. Even though I did it, I can see right now, that my Dashboard for this site is partially translated into Polish. Only certain strings (dashboard sections, frames, buttons) are translated, other remains in English. What is going on? Form where this partial translation comes out? I only left pl_PL.mo file, which (as I understand) purely for frontend translation and does not changes anything it dashboard. This case goes for my test blog (network's site), so I can use ultimate solution -- that is, delete whole site and re-create it again. But even though, I'm pretty curious, what has happened, and what to do, if similar problem appear in the future for one of my production blogs?


Upcoming Event: How do I sort database by custom date field, but ignore past dates?

I am using an events plugin and struggling to get my database query to be perfect. The query is on the event-single.php template. What I need the query to do:   * Query the "events" custom post type for upcoming events   * Sort by `_event_start_date` meta_key to show earliest date (nearest event)   * Not display PAST events   * If "current event", show next nearest event Here's my current $args.               <?php $args = array(         'post__not_in' => array($donotrepeat),         "post_type" => 'event',         'meta_key' => '_event_start_date', // name of custom field         'orderby' => 'meta_value_num',         "order" => 'ASC',         "posts_per_page" => 1        );     ?>      Defining `$donotrepeat` earlier               $donotrepeat = get_the_ID();      So far, the query successfully   * Queries custom post type   * Ignores the "current" event   * Sorts by earliest date. I cannot figure out how to ignore 'past' dates though. There is another meta key 'scope' created by this plugin that contains values like 'past' and 'future' - so that could be promising. I've tried using meta_query to sort through the past date issue, but I just can't seem to get it to work. I think this is probably the way to go, but I'm open to other ideas. I'm sure this isn't THAT difficult... can anyone help?


WP e-commerce: getting products by SKU

I'm working on a site that uses the WP e-commerce plugin (Gold version) and I need to display a list of products that match a list of SKUs. Users fill in a form, and a list of product SKUs is generated depending on their answers. I need to create a page that fetches these products and displays them, preferably in the default grid view/list view style. Any ideas how to do this? Looking through the documentation, I was expecting a "get_products()" function that could take the SKU as an argument, but there doesn't seem to be anything like that. How could I go about doing this? Thanks a lot, Will


How to best delete orphan wp_postmeta

I'm in the middle of doing some fairly complex queries involving metadata from a custom post type. Unfortunately if any posts are deleted the metadata stays put which complicates matters as I am counting it. I was wondering how best to go about deleting the orphan metadata in the event that the post is deleted. Should I include a function that deletes them the database through $wpdb? I found an SQL query that does just that but I'm not sure how to format it.               DELETE pm     FROM wp_postmeta pm     LEFT JOIN wp_posts wp ON wp.ID = pm.post_id     WHERE wp.ID IS NULL      I tried it in phpmyadmin on a backup copy of my database but to no avail.


Comments appear in wrong posts

Nasty problem here! Comments are not connected to the right posts but to other ones! Passing from disquss to jetpack comments doesnt't fix this. What could be the solution? The site is http://www.zonasismica.sism.org/ Thanks! UPGRADE! Seems like disqus is the problem... My team use to publish posts in chunks. It seems that diqus cannot distinguish between posts when their pub time are too close. All the posts in one chunk show the same comments. Check zonasismica.sism.org/~ ~- lincaricato-locale-tra-deriva-dittatoriale-e-leader- democratico-problematiche-dilemmi-e-psicodrammi-di-un-il - do-you-know- climate-change - calcutta-village-project-e-noi-dove-siamo - i-cinque-segreti- dellarea-scopescore If I turn off diqus, the posts again appear in one post only, but of course not were wanted to see them!


How to check if searchform.php is being included as widget?

I'd like to put something like this in searchform.php:               <?php if($widget){ ?>         //load serach form for sidebar...     <?php }else{ ?>         //load different search form for page content (404 page)     <?php } ?>      How can I prepare `$widget` variable? Or maybe I should use another method? Like filter? Or get template part?


How to reset the plugins without deactivate the plugin

function set_copyright_options() {         delete_option('ptechsolcopy_notice');         delete_option('ptechsolcopy_reserved');              add_option('ptechsolcopy_notice','Copyright ©');         add_option('ptechsolcopy_reserved','All Rights Reserved');          }     register_activation_hook(__FILE__, 'set_copyright_options');      Hi I use the code to make it plugin default while deactivate and activate plugin .But i need the options to make it using the reset button in the admin side to make it default without deactivate the plugin ?


What are all the available parameters for query_posts?

The WordPress codex page for query_posts states that it does not cover all the parameters which query_posts takes: > ## Parameters > > This is not an exhaustive list yet. It is meant to show some of the more > common things possible with setting your own queries I couldn't find a reference of all the parameters which are accepted by query_posts, though, even in just a simple list form. Is there a cheat-sheet or something similar available with this data?


list or get meta_key where meta_value is 'something'

I'm trying to get with               get_user_meta      the meta_key where the meta_value is `'ive-read-this'` But I do not get the value. What should I do?


How can I delete orphan keys in WordPress database tables?

In particular in table `wp_options`. After almost 2 years of blog production it seems increased a lot, and I don't know how many crap is in there. Do you know a plugin that works with WordPress 3.0 or safe query to run to search orphan keys/rows?


WP_Query of Category Not Showing First Post

I have the following loop, and only this loop, in my `home.php` file (apologies if I didn't paste the code properly). I have populated lorem ipsum posts, and noticed that of the five posts only four show up on the page. Any insights would be greatly appreciated.
               <?php          // the query         $the_query = new WP_Query( 'category_name=news'); ?>                       <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>              <div itemprop="blogPost" id="post-<?php the_ID(); ?>" <?php post_class('snippet') ?>>                   <a itemprop="url" href="<?php the_permalink(); ?>" class="permalink">
<?php the_title(); ?>

<?php the_time('j M Y') ?>

<?php the_tags( '', ', ', '' ); ?>

                  <?php the_excerpt(); ?>

               <?php endwhile; ?>

         <?php posts_nav_link( ' ', '', '' ); ?>
              <?php else : ?>

There are currently no news updates.

              <?php endif; ?>         <?php wp_reset_query(); ?>


Plugin for single language localisation

I have found dozens of plugins which helps you to translate a Wordpress website into different languages. However, I cannot find anything that would help me localise Wordpress for different regions, all of which would still be using English language. Let me explain. I have a website which serves MOSTLY the same content for several different regions (e.g. NYC, LA & Chicago). While page structure for each region is identical, some small bits are different between different regions. For example contact us page will have different phone number based on the region. What I would like to do is be able to set default content & custom fields for each page, however be able to overwrite whatever I need for regional versions of each page. For example: http://example.com/nyc/contact and http://example.com/la/contact would be mostly identical, apart from the bits which are set manually. There are several plugins which allow doing just that but they are very much focused on multilingual websites and so come with loads of bloat and are not very convenient (especially when you have to pass them over to less technical colleagues or clients). Example of multilingual plugin


How to create a template for a custom URI associated with the user

I am working on a site where I am using a plugin called Favorite Posts so logged-in users can add a post (a custom post type) to their favorites. I created a page called `my-favorites` which allows the logged-in user to see the posts he has favorited. Now I need to create a page which allows the another user or visitor to check this user's favorites. So I need to be able to do three things:   1. Get a function related to author that returns a link like `example.com/user/username` which I can append to /favorites to get the link - `example.com/user/username/favorites` (`the_author_link()` and `get_the_author()` link seems to link to the website and `the_author_posts_url()` outputs the a tag with the name. any function to just get the url or maybe modify author to show user instead?)   2. Get WordPress to use a template called `favorites.php` to display this page. (If the structure matches, then how do I tell WordPress which template to use?)   3. Get the user id of the user in order to show his/her favorites to the visitor. Right now, I use the `[favorite-post]` shortcode in my template file and can pass a parameter called               [favorite-post user_id = ""]      Will it automatically get the user id if the page is branched out from /author? I found this article but it still deals with custom post types and `query_vars` which I am not using. How do I make it work for the favorites page? Most other similar questions asked here were solved using a slug for the custom post type or taxonomy.


How to migrate subsite from dev multisite to production multisite

I'm looking for the best and most secure way to develop locally a numbers of subsite using multisite and moving them to the production environment when they are ready. I've already migrated the full multisite install with the first subsite which is now live. I would prefer to develop the other sites on the local server so I leave the production server alone but obviously I can't do a full migration again. I looked for a solution but everything I found is about moving a single site to a multisite or the other way around, no "move subsite from multisite to multisite". I would like to keep everything: settings, widgets and so on.


Can't add options to db

I'm trying to create a really simple options page for my wordpress site that just contains one option - a conversion rate for a currency. I have the following code:               add_action('admin_init', 'currency_options_set');     add_action( 'admin_menu', 'admin_menu' );          function admin_menu () {         add_options_page( 'Currency Options','Currency Options','manage_options','options_currency', 'settings_page' );     }          function currency_options_set(){         register_setting( 'currency_options_group', 'currency_options' );     }          function  settings_page () {              $default_options = array( 'currency_eur' => "1.1" );         $options = get_option('currency_options', $default_options);         ?>         <form method="post" action="options.php">         <?php                  settings_fields("currency_options_group"); ?>

                     EUR:	                                              <input type="text" name="currency_options_group[currency_eur]" size="40" value="<?php echo stripslashes($options["currency_eur"]); ?>" />

                 <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
         </form>     <?php     }      The new options page shows and I can see the form but when I submit it, no options are saved to the wp_options table. What am I missing here?


How do I Redirect Tags from Old Joomla Site to New WordPress Site?

I've recently converted a site from Joomla to WordPress. I'm down to polishing up the old Joomla site links that don't match the WordPress structure, and I've run into a problem where I need some help: tags. The Joomla site had close to 500 tags, and all the tags were indexed in Google and other search engines. The Joomla tags links have a structure like               "http://example.com/components/tag/apples.html"       and               "http://example.com/tags/apples.html"       while the WP site tag links look like               "http://example.com/tag/apples/".      What I really would like to do is have a 301 redirect that points all the old Joomla tags to their equivalents on the new WP site instead of doing several hundred htaccess entries, one for each tag ("Redirect 301 http://example.com/components/tag/apples.html http://example.com/tag/apples/" works). The tags themselves are the same on both sites, so it's not a matter of renaming tags or getting tags with different names to match up. But I can't figure out how to make the redirect work. I've tried doing things like               "Redirect 301 http://example.com/components/tag/*.html http://example.com/tag/"      or               "Redirect 301 http://example.com/components/tag/*.html http://example.com/tag/*/"      or               http://example.com/tag/*/       or               http://example.com/tag/?/       for the redirect target. None of those work. Quite frankly I don't know my way around regex very well, so my trying to find a solution would be mostly an Easter egg hunt where there may or may not even be any Easter eggs. So I'm hoping someone on the WP forum will be able to help me out or point me to a solution. Thanks for any help, Susan


WP_Customize_Image_Control generating error when used

I'm adding some customisation controls for my theme, but I've hit a snag with the `WP_Customize_Image_Control` class. The control is showing, but whenever I try and upload an image I receive the following error - > TypeError: a.settings.data is undefined (`load-scripts.php`, line 2) Has anyone come accross this before, and more crucially, can anyone tell me what I need to do to fix this? Thanks.               add_action('customize_register', 'register_costomisation_controls');      function register_costomisation_controls($wp_customize){              $wp_customize->add_section('header_section' , array(             'title'     => __('Header', 'dd_theme'),             'priority'  => 1000         ));              $wp_customize->add_setting('header_image' ,array(             'default'   => '',             'transport' => 'refresh'         ));              $wp_customize->add_control(             new WP_Customize_Image_Control(                 $wp_customize,                 'header_image',                 array(                     'label'     => __('Logo', 'dd_theme'),                     'section'   => 'header_section',                     'settings'  => 'header_image',                 )             )         );          }


Update user from external script

I am using the API code of WordPress to update some fields of user profiles but I am having some problems. When I try to save information, it is not updating unless I click twice. For example for user called user3465 **For example :**               $user=get_user_by('login',"user3465");     wp_set_password(''.$new_password.'',$user->ID);     update_user_meta($user->ID, 'user_email', "".$new_email."" );      I launch form and load new data in database, but I must launch another time, to see the data change. Why is this ?


What is the best way to insert links indepently of the permalink structure?

... or is there a way to insert links similarly to Drupal with pathauto, that is: I want to set links in html like this:               ?p=123      and Wordpress to process at runtime it and display the pretty url               /page/title      Also I don't like the idea of putting full url's as the website can run on several server (at least during dev time)


How come I see a manage_categories capability but not a manage_tags capability for any users?

Using plugins like "Members" or "Capability Manager", I don't see any such `manage_tags` capability. Shouldn't there be one like there is `manage_categories`? EDIT: I think I figured it out. manage_terms is for all taxonomies. There isn't one specifically for tags, but I could create one if I so desire. This could allow me to set up a role that can edit only categories, but not tags, and vice versa. NOTE: I got rated down. If you rate me down, _please state why_. Thanks.


How to get the meta title of a page configured as blog (loop)

I'm using a function to print the titles for every type of content. I also configured a new metabox in the posts and pages to enter the title tag. This is part of the function to print the titles:               //...     elseif (is_page() || is_single()) { //Page and Post Title         global $post;         $metatitle = get_post_meta($post->ID, 'metatitle_value_key', true);         if ($metatitle) {             echo stripslashes($metatitle);         } else {             the_title();         }     }     //...     else { wp_title(''); }      It works perfect for posts and pages, except when I select a static home page and the blog page (it's a blank page created previously). Thanks to the last `else` it prints the normal title of the page 'Blog', but it doesn't print the metabox with the metatitle 'My metatitle box'. I thought it was 'cause of the post ID, so I separeted `is_page()` and `is_post()` trying to get the page ID out of the loop, with this code `$page_id = get_queried_object_id();` but this one didn't work for me. The following code is what I have:               //...     elseif (is_page()) { //Page Title         global $post;         $page_id = get_queried_object_id();         $metatitle = get_post_meta($page_id, 'metatitle_value_key', true);         if ($metatitle) {             echo stripslashes($metatitle);         } else {             the_title();         }     } //...      What can I try to do that? Probably the problem is due to the way to insert the metabox, it uses `$post_id` every time. Anyway I'm not sure, 'cause it works for both: posts and pages.


How safe is renovating $wp_query when doing WP_Query pagination in Page Template

With a lot of search and trial&error, I's unable to do the pagination in a custom page template. I's not actually tired, but frustrated, why the most common err issue is not explained in a way so that somebody can dig into the actual problem. In most of the Q&A, there's a solution with a bulk of code, that's not a bullet-proof solution at all. There are lots of philosophy, but there's no actual digging into the solution. Eventually I came across to Chris' solution to the pagination of a Custom Post Type. I'm not dealing with CPT, but the solution worked for me. Where, my Query arguments are:               $wp_query->query('posts_per_page=3&post_type=post&order=DESC&orderby=date&post_status=publish'.'&paged='.$paged);      Except that portion everything is as followed as Chris stated. My pagination is working nicely. But I'm actually concern about some issues:   1. First, what's the code actually doing?   2. I _think_ it's now taking more time (performance issue) than the default solution -- is that _actually_ right?   3. Is that safe messing with the global `$wp_query`?


How can I implement faceted search with Wordpress 3.x?

I would like to allow visitors to a site to search for posts based on various attributes (categories, tags, custom fields). I have tried using Solr, but this doesn't appear to work. I tried using the MySolrServer plugins for a local instance of Solr and a hosted instance, but the plugin doesn't appear to work. I also tried using Solr for Wordpress, but the plugin wouldn't enable. I don't want to use something like Taxonomy Drill-down. Bearing those points in mind, how can I now try to implement true faceted search that will enable site visitors to search for posts based on attributes?


Plugin allowing users to add articles to a library

We are currently redesigning our site (currently on Joomla) to a new Wordpress platform and I'm concerned I'm going to lose an important feature. I have a membership based site and one of the features I wish to provide is for members to be able to maintain their own library of favourite articles from our article list. We have over 1000 articles online so this feature would allow members to save their favourites for easy access. I've tried looking for document and library plugins but can't seem to find anything appropriate. Does anyone know of a plugin that would do this effectively? Any other ideas?? Thanks so much for your time.


What exactly is "wordpress theming"?

When a book says that it is all about wordpress theming, what does it mean?


orderby ignored by wp_query

With the following code, I do not get the result set ordered by titles. No matter what values I give to 'orderby' and 'order', I get the same ordering. The parameters seem to be ignored (or overridden?) by something else.. Any idea how I troubleshoot this one? Is there a specific filter I should be looking at, that some plugin could be overriding this via? Should the code below work out of the box? IF it looks correct, something must be interfering.               $args = Array(         'post_type' => 'post'         'category_name' => 'reviews'         'posts_per_page' => '999'         'orderby' => 'title'         'order"' => 'ASC'         'post_status' => 'publish'     )          $customloop = new WP_Query();     $customloop->query($args);          while ($customloop->have_posts()) { ... }


Wordpress monthly archive links result in 404

When I use the archive widget in a sidebar, it creates the normal monthly post archive listing like the following:   * February 2014   * January 2014   * October 2013 and so on. Whenever I click on these links, I get a 404 page. The urls generated by the archive widget for monthly listings are in this format: > www.mysite.com/pedestrian/2014/02/ However, manually entering the following url style works: > www.mysite.com/pedestrian/?post_type=news&year=2014&monthnum=02 This shows exactly what I would expect to see (all the posts from February 2014). I believe that the following code will fix my issue, but I am at a loss as to where to put it.               // Add day archive (and pagination)     add_rewrite_rule("pedestrian/([0-9]{4})/([0-9]{2})/([0-9]{2})/page/?([0-9]{1,})/?",'index.php?post_type=news&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]','top');     add_rewrite_rule("pedestrian/([0-9]{4})/([0-9]{2})/([0-9]{2})/?",'index.php?post_type=news&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]','top');          // Add month archive (and pagination)     add_rewrite_rule("pedestrian/([0-9]{4})/([0-9]{2})/page/?([0-9]{1,})/?",'index.php?post_type=news&year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]','top');     add_rewrite_rule("pedestrian/([0-9]{4})/([0-9]{2})/?",'index.php?post_type=news&year=$matches[1]&monthnum=$matches[2]','top');          // Add year archive (and pagination)     add_rewrite_rule("pedestrian/([0-9]{4})/page/?([0-9]{1,})/?",'index.php?post_type=news&year=$matches[1]&paged=$matches[2]','top');     add_rewrite_rule("pedestrian/([0-9]{4})/?",'index.php?post_type=news&year=$matches[1]','top');      So, am i on the right track and if so where do i put this code? Thanks!


How to remove admin menu pages inserted by plugins?

I've got the following code, which cleans up a lot of stuff that is not going to be used within the admin area:               add_action( 'admin_menu', 'my_remove_menu_pages' );          function my_remove_menu_pages() {       remove_menu_page( 'edit.php' );                   //Posts       remove_menu_page( 'upload.php' );                 //Media       remove_menu_page( 'edit-comments.php' );          //Comments       remove_menu_page( 'themes.php' );                 //Appearance       remove_menu_page( 'users.php' );                  //Users       remove_menu_page( 'tools.php' );                  //Tools       remove_menu_page( 'options-general.php' );        //Settings          };      However, there are two menu items that have been inserted from plugins. When I hover over each menu item, it says the links are:               /wp-admin/edit.php?post_type=acf     /wp-admin/admin.php?page=wpcf7      Is there a way to hide these menu pages, too?


Cannot override hooks.php

I building a child theme for 'Responsive Theme' from Cyberchimps. I would like to change one hook. So I guess I need hooks.php file in my child theme. So I copied it from the parent. I made the same hierarchy (I guess this is the right approach).               wp-content/[my_child_theme]/core/includes/hooks.php      Copying file to theme root didn't help. I also tried to just recreate this critical hook. I put the code in my child functions.php file, but It's also not working, because hooks happen after the theme stuff (just my asumtion). So the question is simple: how to override parent theme's hook.php file?


Is there a PHP function that can match anything after the given URL, so my IF statement will work in each instance?

I have an IF statement shown below that runs one of 2 custom queries, based on the url. The problem I'm facing is if the url contains pagination such as `/page/2/`, my query breaks because the url isn't correctly matched. I'm very new to php and in my searching I've come across a few different php functions that may help my situation - I'm just unsure of how to use them and which is more efficient for my needs. These are `preg_match`, `parse_url`, and `dirname`. For example, `site.com/players` lists the players and `site.com/players/type/pro` lists the pro players. The latter has been rewritten and is actually `site.com/players/?type=pro`. The following if statement is what I have now and will not run the first query if the url has anything after the /pros/ segment, such as pagination in my case:               if ( $_SERVER['REQUEST_URI'] == '/players/type/pros/' ) {          //run the query to list the pros     }          else {         //run the default query for the players     }      Here's what I need to do, which works, but without all the manual labour of writing an OR for every single page. This is where I'm guessing one of those php functions would come into play.               if ( $_SERVER['REQUEST_URI'] == '/players/type/pros/' || $_SERVER['REQUEST_URI'] == '/players/type/pros/page/2/' || $_SERVER['REQUEST_URI'] == '/players/type/pros/page/3/' || $_SERVER['REQUEST_URI'] == '/players/type/pros/page/4/' ) {          //run the query to list the pros     }          else {         //run the default query for the players     }      **Update** Thanks to those who answered. I've been digging into WordPress' rewriting and with the help of some very informative posts on this site I ended up doing it this way.   1. Made a new page template called player-types.php which would handle the incoming query or queries. I may need to further list players by other types.   2. Setup some rewrite rules placed in functions.php              add_filter('init', 'add_page_rewrite_rules');     function add_page_rewrite_rules() {         //would match www.site.com/players/type/pro             add_rewrite_rule('^players/type/([^/]*)/?$','index.php?pagename=player-types&type=$matches[1]','top');           //would match www.site.com/players/type/pro/page/2             add_rewrite_rule('^players/type/([^/]*)/page/([0-9]+)?$','index.php?pagename=player-types&type=$matches[1]&paged=$matches[2]','top');            }        3. Added the `type` variable to `query_vars` so I could use it on the new page template (placed in functions.php)              add_filter( 'query_vars', 'add_query_vars' );     function add_query_vars( $query_vars ) {         $query_vars[] = 'type'; //add type to query vars         return $query_vars;     }        4. And the page template in it's most basic form looks like this              <?php /* Template Name: Player Types */ ?>          <?php if ( $wp_query->query_vars['type'] == 'pro' ) {         //custom pro query     } ?>      This allows me to have `www.site.com/players/type/pro` and I can expand on it to `www.site.com/players/type/whatever-else`. Normal players are still listed at `www.site.com/players/`. And for those who are wondering, I didn't do it with a taxonomy because I'm listing the players based on their custom WordPress role ( pulling the author id's into the query) rather than having a check box that someone has to manually check.


Excerpts automatically remove paragraph space

I use excerpts of posts in my front page. In my excerpt, the summary of the post seems to be clumped together with no spaces that are indicated in the post (e.g., paragraph spaces are automatically removed). I understand this is the default behavior. Question: Is there a way to retain the paragraph in excerpts? To show excerpt on the fron page in my Twenty Ten theme's loop.php I changed this (around line #137:               <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>      with this:               <?php if ( is_home() || is_front_page() || is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>      thanks.


How do I insert JS tracking code to a page with the WP editor?

My client needs to add unique blocks of javascript to certain pages in order to track visitors. How do I go about doing this? At first I tried to use a custom field but the field stripped out everything before outputting it to the page so I got an empty result. Then I installed an Advanced Custom Fields extension that allows you to add code to your page and then call it on the template but it put the code within script tags which breaks the tracking code. So I'm at a bit of a loss right now.