title: Paginate a list of users?

text:
I'm currently displaying a list of all users using the following code. The only problem is that I need to paginate and only display 10 users at a time. I'm familiar with pagination using CPT's and Posts but not with users. Is this possible? If so where would I start?                   <?php     /**      * @package WordPress      * @subpackage themename      * Template Name: Vendors Page      */          get_header(); ?>     <?php          $url = $_SERVER['REQUEST_URI'];         $tokens = explode('/', $url);         $usernameCheck = $tokens[sizeof($tokens)-2];         if ($usernameCheck != 'vendors') {             $username = $usernameCheck;             $username = str_replace("-", " ", $username);         }              if(isset($_POST['gform_submit'])):     ?>              <? endif; ?>     <?php          $currentUserID = get_current_user_id();          $page = (!empty($_GET['userp'])) ? $_GET['userp'] : 1;         $per_page = 10;         $offset = ( ($page -1) * $per_page);     ?>

                          <?php the_post(); ?>
                          <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> role="article">
<?php if (!empty($username)) {echo $username; ?> Click Here To Edit Your Profile<?php }  else {the_title();} ?>
                              <?php if (!empty($username)) { ?>                               <?php                                 // WP_User_Query arguments                                 $args = array (                                     'exclude'        => array( 1 ),                                     'count_total'    => true,                                     'fields'         => 'all_with_meta',                                     'meta_query'     => array(                                         array(                                             'key'       => 'user_business',                                             'value'     => $username,                                             'compare'   => 'LIKE',                                         ),                                     ),                                      );                                      // The User Query                                 $user_query = new WP_User_Query( $args );                                      // The User Loop                                 if ( ! empty( $user_query->results ) ) {                                     foreach ( $user_query->results as $user ) { ?>                                 <?php if ( $currentUserID == $user->ID ) { ?>
<?php echo do_shortcode('[gravityform id="4" title="false" description="false"]'); ?>
<?php } ?>
                                     <?php if (isset($user->user_pic)) { ?>                                                     <img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic; ?>&w=235&h=147" title="<?php echo $user->user_business; ?>" alt="<?php echo $user->user_business; ?>" class="profilePic" />                                     <?php } else { $imgURL = get_template_directory_uri() . "/images/vendor_placeholder.jpg"; ?>                                                     <img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $imgURL; ?>&w=235&h=147&zc=2" title="<?php echo $user->user_business; ?>" alt="<?php echo $user->user_business; ?>" class="profilePic" />                                     <?php } ?>
Owner Name:
                                     <?php echo $user->first_name; ?> <?php echo $user->last_name; ?>

                                          <?php if ($user->user_address_show == 'Yes') { ?>
Address:
                                         <?php echo $user->user_address_street; ?>
<?php echo $user->user_address_city; ?>, KS <?php echo $user->user_address_zip; ?>

                                     <?php } ?>
Phone:
                                     <?php echo $user->user_phone; ?>                                          <a href="mailto:<?php echo $user->user_email; ?>" class="contactVendor">Contact Us Via Email
Markets We Attend:
                                     <?php if (isset($user->we_attend_east)) { ?>
East Wichita
Green Acres Market
<?php } ?>                                     <?php if (isset($user->we_attend_west)) { ?>
West Wichita
Sedgwick County Ext. Office
<?php } ?>                                     <?php if (isset($user->we_attend_delano)) { ?>
Delano in Wichita
Lawrence Dumont Parking lot
<?php } ?>                                     <?php if (isset($user->we_attend_derby)) { ?>
Derby, Kansas
<?php } ?>                                          <?php if (isset($user->attend_this_week_east) || isset($user->attend_this_week_wast) || isset($user->attend_this_week_delano) || isset($user->attend_this_week_derby)) { ?>
We will be at the                                      <?php if (isset($user->attend_this_week_east)): ?>East Wichita Market<?php if (isset($user->attend_this_week_west) || isset($user->attend_this_week_delano) || isset($user->attend_this_week_derby)): ?>,<?php endif; ?><?php endif; ?>                                     <?php if (isset($user->attend_this_week_west)): ?>West Wichita Market<?php if (isset($user->attend_this_week_delano) || isset($user->attend_this_week_derby)): ?>,<?php endif; ?><?php endif; ?>                                     <?php if (isset($user->attend_this_week_delano)): ?>Delano in Wichita Market<?php if (isset($user->attend_this_week_derby)): ?><?php endif; ?><?php if (isset($user->attend_this_week_derby)): ?> and<?php endif; ?><?php endif; ?>                                     <?php if (isset($user->attend_this_week_derby)): ?>Derby, Kansas Market<?php endif; ?>                                     this week!
                                     <?php } ?>
Items sold at market:

                                         <?php if (isset($user->product_1)){ ?>
<?php echo $user->product_1; ?>
<?php } ?>                                         <?php if (isset($user->product_2)){ ?>
<?php echo $user->product_2; ?>
<?php } ?>                                         <?php if (isset($user->product_3)){ ?>
<?php echo $user->product_3; ?>
<?php } ?>                                         <?php if (isset($user->product_4)){ ?>
<?php echo $user->product_4; ?>
<?php } ?>                                         <?php if (isset($user->product_5)){ ?>
<?php echo $user->product_5; ?>
<?php } ?>
                                          <?php if (isset($user->user_organic)){ ?>
Organic | Chemical Free
                                     <?php } ?>                                          <?php if (isset($user->user_producer)){ ?>
100% Producer
                                     <?php } ?>

About Us:

<?php echo $user->user_about; ?>

                                     <?php if (isset($user->user_profile_pic)){ ?>
View Our Photos
<?php } ?>                                          <?php if (isset($user->user_profile_pic)){ ?>
                                             <img src="<?php bloginfo('template_url'); ?>/images/user_pics_prev.png" class="prev"/>                                             <img src="<?php bloginfo('template_url'); ?>/images/user_pics_next.png" class="next"/>

<a href="<?php echo $user->user_profile_pic; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_profile_pic_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_profile_pic; ?>&h=134&w=119" alt="<?php echo $user->user_profile_pic_c; ?>" title="<?php echo $user->user_profile_pic_c; ?>" />
                                                          <?php if (isset($user->user_pic_1)){ ?>
<a href="<?php echo $user->user_pic_1; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_1_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_1; ?>&h=134&w=119" alt="<?php echo $user->user_pic_1_c; ?>" title="<?php echo $user->user_pic_1_c; ?>" />
<?php } ?>                                                          <?php if (isset($user->user_pic_2)){ ?>
<a href="<?php echo $user->user_pic_2; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_2_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_2; ?>&h=134&w=119" alt="<?php echo $user->user_pic_2_c; ?>" title="<?php echo $user->user_pic_2_c; ?>" />
<?php } ?>                                                          <?php if (isset($user->user_pic_3)){ ?>
<a href="<?php echo $user->user_pic_3; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_3_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_3; ?>&h=134&w=119" alt="<?php echo $user->user_pic_3_c; ?>" title="<?php echo $user->user_pic_3_c; ?>" />
<?php } ?>                                                          <?php if (isset($user->user_pic_4)){ ?>
<a href="<?php echo $user->user_pic_4; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_4_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_4; ?>&h=134&w=119" alt="<?php echo $user->user_pic_4_c; ?>" title="<?php echo $user->user_pic_4_c; ?>" />
<?php } ?>                                                          <?php if (isset($user->user_pic_5)){ ?>
<a href="<?php echo $user->user_pic_5; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_5_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_5; ?>&h=134&w=119" alt="<?php echo $user->user_pic_5_c; ?>" title="<?php echo $user->user_pic_5_c; ?>" />
<?php } ?>                                                          <?php if (isset($user->user_pic_6)){ ?>
<a href="<?php echo $user->user_pic_6; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_6_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_6; ?>&h=134&w=119" alt="<?php echo $user->user_pic_6_c; ?>" title="<?php echo $user->user_pic_6_c; ?>" />
<?php } ?>                                                          <?php if (isset($user->user_pic_7)){ ?>
<a href="<?php echo $user->user_pic_7; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_7_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_7; ?>&h=134&w=119" alt="<?php echo $user->user_pic_7_c; ?>" title="<?php echo $user->user_pic_7_c; ?>" />
<?php } ?>                                                          <?php if (isset($user->user_pic_8)){ ?>
<a href="<?php echo $user->user_pic_8; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_8_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_8; ?>&h=134&w=119" alt="<?php echo $user->user_pic_8_c; ?>" title="<?php echo $user->user_pic_8_c; ?>" />
<?php } ?>                                                          <?php if (isset($user->user_pic_9)){ ?>
<a href="<?php echo $user->user_pic_9; ?>" class="fresco" data-fresco-caption="<?php echo $user->user_pic_9_c; ?>"><img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic_9; ?>&h=134&w=119" alt="<?php echo $user->user_pic_9_c; ?>" title="<?php echo $user->user_pic_9_c; ?>" />
<?php } ?>

                                     <?php } ?>                                          <?php if (isset($user->user_twitter) || isset($user->user_facebook)){ ?>
Socialize With Us
<?php } ?>                                          <?php if (isset($user->user_twitter)){ ?>
                                             <img src="<?php bloginfo('template_url'); ?>/images/twitter_prev.png" class="prev"/>                                             <img src="<?php bloginfo('template_url'); ?>/images/twitter_next.png" class="next"/>
                                                 <?php echo do_shortcode('[twitter-user]'); ?>

                                     <?php } ?>                                          <?php if (isset($user->user_facebook)){ ?>                                         <iframe src="//www.facebook.com/plugins/likebox.php?href=<?php echo urlencode($user->user_facebook); ?>&width=588&height=590&show_faces=true&colorscheme=light&stream=true&show_border=true&header=true&appId=172839226207438" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:588px; height:590px;" allowTransparency="true">                                     <?php } ?>
                                      <?php } } ?>                                                                                <?php } else { ?>                                                           <?php                                 // WP_User_Query arguments                                 $args = array (                                     'exclude'        => array( 1 ),                                     'count_total'    => true,                                     'fields'         => 'all_with_meta',                                     'number' => $per_page,                                     'offset' => $offset,                                 );                                           // The User Query                                 $user_query = new WP_User_Query( $args );                                      // The User Loop                                 if ( ! empty( $user_query->results ) ) {                                     foreach ( $user_query->results as $user ) { ?>
                                             <a href="<?php bloginfo('url'); ?>/vendors/<?php echo str_replace(" ", "-", strtolower($user->user_business)); ?>">                                                 <?php if (isset($user->user_pic)) { ?>                                                     <img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $user->user_pic; ?>&w=235&h=147" title="<?php echo $user->user_business; ?>" alt="<?php echo $user->user_business; ?>" />                                                 <?php } else { $imgURL = get_template_directory_uri() . "/images/vendor_placeholder.jpg"; ?>                                                          <img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo $imgURL; ?>&w=235&h=147&zc=2" title="<?php echo $user->user_business; ?>" alt="<?php echo $user->user_business; ?>" />                                                 <?php } ?>

<?php echo $user->user_business; ?><a href="<?php bloginfo('url'); ?>/vendors/<?php echo str_replace(" ", "-", strtolower($user->user_business)); ?>" class="viewProfile">View Profile
                                                     Item(s) sold at market:
<?php $productCounter = 0; ?>                                                         <?php if (isset($user->product_1) && $productCounter == 0) { $productCounter = 1; ?>
<?php echo $user->product_1; ?>
<?php } ?>                                                         <?php if (isset($user->product_2) && $productCounter == 0) { $productCounter = 1; ?>
<?php echo $user->product_2; ?>
<?php } ?>                                                         <?php if (isset($user->product_3) && $productCounter == 0) { $productCounter = 1; ?>
<?php echo $user->product_3; ?>
<?php } ?>                                                         <?php if (isset($user->product_4) && $productCounter == 0) { $productCounter = 1; ?>
<?php echo $user->product_4; ?>
<?php } ?>                                                         <?php if (isset($user->product_5) && $productCounter == 0) { $productCounter = 1; ?>
<?php echo $user->product_5; ?>
<?php } ?>
                                                     Market(s) we attend:<?php $marketCounter = 0; ?>                                                     <?php if (isset($user->we_attend_east) && $marketCounter != 2) { $marketCounter++ ?>
East Wichita
Green Acres Market
<?php } ?>                                                     <?php if (isset($user->we_attend_west) && $marketCounter != 2) { $marketCounter++ ?>
West Wichita
Sedgwick County Ext. Office
<?php } ?>                                                     <?php if (isset($user->we_attend_delano) && $marketCounter != 2) { $marketCounter++ ?>
Delano in Wichita
Lawrence Dumont Parking lot
<?php } ?>                                                     <?php if (isset($user->we_attend_derby) && $marketCounter != 2) { $marketCounter++ ?>
Derby, Kansas
<?php } ?>

                                      <?php } } ?>                                                            <?php } ?>                          <?php                     $page_args = array(         'base'         => get_permalink( get_the_ID() ). '%_%',         'format'       => add_query_arg(array('userp' => '%#%')),         'total'        => ceil($users->total_users / $per_page),         'current'      => $page,         'show_all'     => True,         'end_size'     => 2,         'mid_size'     => 2,         'prev_next'    => True,         'prev_text'    => __('« Previous'),         'next_text'    => __('Next »'),         'type'         => 'plain',     );          echo paginate_links($page_args);     ?>

                     <?php if (!empty($username)) { ?>
<?php if ( dynamic_sidebar('profile-sidebar') ) : else : ?><?php endif; ?>
<?php } else { ?><?php get_sidebar(); ?><?php } ?>

     <?php get_footer(); ?>


title: Calling update_user_meta inside of another function doesn't work

text: I have a function that does updates a db outside of wordpress and then I'd like it to take that information and update the user_meta table in wordpress. The print statement prints all the appropriate information, but the update doesn't happen.               add_action('edit_user_profile_update', 'EditUsertoSF_Admin');          function EditUsertoSF_Admin($user_id) {        global $SFUserID;            $query = "SELECT Id, COUNT(Email) from Contact where Email='" . $_POST['email'] . "' GROUP BY ID";                      $createResponse3 = $mySforceConnection->query(($query));                      foreach ($createResponse3->records as $record) {                     foreach($record as $records) {                         }                 }                     if($records > 0) {                         $sObject->Id = $record->Id[0];                         $createResponse = $mySforceConnection->update(array($sObject), 'Contact');                              $SFUserID = $record->Id[0];                         //print 'SF inside function Edit' . 'WP' . $user_id . 'SF' .$record->Id[0];                         update_user_meta( $user_id, 'SF_User_ID', $SFUserID );                     }     }


title: How to add custom widget above admin_footer

text: What I am trying to accomplish is placing custom widget on an admin page (edit.php). I tried using these two functions: Places custom html right below < body > (above all page content)               add_action( 'load-edit.php', 'your_function' );     function your_function() {         include( plugin_dir_path( __FILE__ ) . 'quickpost/quickpost.php');     }      Places custom html below the < footer >               add_action('admin_footer', 'post_add_quickpost');     function post_add_quickpost() {         include( plugin_dir_path( __FILE__ ) . 'quickpost/quickpost.php');     }      Here is were I am trying to place the widget, just above the posts table on the edit.php page. http://i.imgur.com/QKHkEqs.jpg Is there a way I can specify where to place the code? I would prefer to work with the 'load-edit.php' action, but if that is not possible - it is okay with me. Thanks!


title: Is there a way to allow only certain type of widgets in the sidebars?

text: For example, I want Sidebar A to display **nothing but one** text widget and Sidebar B to display **anything but** text widgets. How can I do that? Thanks.


title: How can I set a default listing order on the admin page for a custom taxonomy? (without plugins)

text: I'm researching this problem for _days_ without any success... What I want is very simple: to see my custom taxonomy terms sorted by ID on the admin page. I can't believe that something this simple can't be accomplished without plugins. (I already have a sortable custom column, but it would be important to set the _default order_ as well.) So far I have found the following two solutions, which doesn't work for some reason: **1) Registering the taxonomy with "sort => true":**               register_taxonomy( 'issue', 'post', array( 'hierarchical' => false, 'labels' => $labels, 'public' => true, 'sort' => true, 'args' => array( 'orderby' => 'id' ), 'query_var' => 'issue', 'rewrite' => array( 'slug' => 'issues' ) ) );      Source: http://codex.wordpress.org/Taxonomies#Registering_a_taxonomy **2) Filtering "request" and adding "orderby":**               function my_default_orderby( $vars ) {       $screen = get_current_screen();            if ( 'edit-issue' == $screen->id ) {         if ( !isset( $vars['orderby'] ) ) {           $vars['orderby'] = 'id';         }       }            return $vars;     }     if ( is_admin() )     add_filter( 'request', 'my_default_orderby' );      Source: http://scribu.net/wordpress/custom-sortable-columns.html#comment-4456


title: wp_register_sidebar_widget in loop within a plugin?

text: I'm trying to dynamically create widgets based on a posts from a post type. The code is as below. This function is pulled from my plugin class:               public function initWidgets() {                  // Config Widgets             $args = array(                 'post_type' => 'my_post_type',                 'posts_per_page' => -1             );                  $wp_query = new WP_Query( $args );                  while ( $wp_query->have_posts() ) {                  $wp_query->the_post();                      $widget_id = 'wp_as_'.get_the_ID();                 $widget_title = get_the_title();                 $widget_desc = get_the_title();                 var_dump($widget_id);                 wp_register_sidebar_widget(                     $widget_id,                     $widget_title,                     array($this, 'widgetDislay'),                     array('description' => $widget_desc)                 );             }         }              public function widgetDislay($args) {             // Widget display code         }      This though only works once, even though its in the loop only one widget appears in the back end. Is there a reason for this? Or is there an alternative way of achieving what I'm trying here? I've seen people using `eval()` to dynamically add widgets, though I'd rather steer clear of this approach if at all possible.


title: How do I embed youtube videos with https instead of http in the URL?

text: I'm running a site that only communicates over SSL/https so if I embed a youtube video using http I will get an error message saying the site is'nt fully secure. Is it possible to rewrite something so that WordPress accepts https and still auto embeds youtube links added to the content area? Cause now, when I try to embed a https youtube link, all that is shown is the URL, no movie. **Update** I've tried to add providers using this code in functions.php but it does nothing:               wp_oembed_add_provider('https://youtu.be/*', 'https://youtube.com/oembed' );     wp_oembed_add_provider('#https://(www\.)?youtube.com/watch.*#i', 'https://youtube.com/oembed', true);     wp_oembed_add_provider('http://youtu.be/*', 'https://youtube.com/oembed' );     wp_oembed_add_provider('#http://(www\.)?youtube.com/watch.*#i', 'https://youtube.com/oembed', true);


title: How Can I add Fields in wp-option table?

text: I want to activate my plugin and I want to create fields in "wp_option" table. How can I do that?


title: WordPress Login redirection according to user role

text: In my application a user needs to 1stlogin and is then able to access the website. There are 3 different user roles in use on my site >   1. administrator >   2. editor >   3. contributor > User can login from               http://example.com/wordpress/wp-login.php      _No login from any theme template._ I have found this code, but it doesn't work               function my_login_redirect_contributors() {       if ( current_user_can('contributor') ){           return 'url-to-redirect-to';       }     }          add_filter('login_redirect', 'my_login_redirect_contributors');      * * * _Note: I do not want to use plugin like Peter's Login Redirect. I want to achieve it by customizing wp core code with a filter._


title: wpalchemi metabox doesn't show value from my post type

text: I record my problem here. http://www.screenr.com/pg88 Does someone know what I am doing wrong?


title: How to track your theme usage on the internet?

text: themers and moders. Often I get inspiration for my theme (Tiny Forge) from the real websites that are using it. Unfortunately it is not an easy task to find on google who's using your theme. I thought about using meta generator, but that's reserved for WordPress. Then I thought to put in a comment with theme name and perhaps version, but Google doesn't index comments... then the last remedy is to insert hidden text with display: none; but I'm afraid this can have an impact on user's website google rank? What is your experience to find your theme implementation on the web? Are you using any "fingerprinting" or "watermarking" methods?


title: Getting Position of a post in a category

text: I have one post id x, one category id y. I want to retrieve the position at which the post will appear in the category.   * It is confirmed that the post is from the category   * Post order will be based on a numeric value set in post meta, meta key 'facebook_shares'   * Category have more that 1k other posts. I am looking for a best solution which could consume less database query usage and single query will be the best. Thanks in advance.


title: How-to delay the capability to publish posts?

text: Spam has gotten a bit crazy so it would be nice if new users have to wait a week to post something. I use buddypress and all new members have the role of author. The site is more like a forum with one topic. I'm not worried about comments, just posts. I'm totally fine with messing with the innards of wordpress. A plugin would be ideal but I am open to any suggestions. Thanks, John Powell


title: Multisite domain redirect subdirectory non-www to www without breaking root site

text: There are a ton of questions asked on Multisite domain mapping but none I can find with an answer that works for me. I am using subdirectories. Here is my configuration:   (1) Root non-www:           mysite.com              (works - non-www by default)   (2) Root          www: www.mysite.com              (works - redirects to mysite.com)   (3) Subsite     www: www.mysite.com/subsite (works - www by default)   (4) Subs non-www:          mysite.com/subsite ( **broken** - redirects to 404 error)   I have tried adding code in .htaccess and in wp-config.php. Either way I can fix (4) but this creates an indefinite loop in the root site, breaking (1) and/or (2). This is because the root is non-www and the subsites are www. Is there a conditional statement for .htaccess that can fix this? Or is it better to address domain mapping via wp-config.php? I also looked at the MU Domain Mapping plugin, but it asks subsite-users to set-up a DNS ANAME or CNAME. This is too complicated for my users - the redirect needs to be automatic. Any suggestions would be much appreciated.


title: Correctly using wp_head()

text: I'm working on my first theme, and I found out that I had to call `wp_header()` before `</head>`. My header.php file has this:               <!DOCTYPE html>     <html>         <head>             <title><?php bloginfo('name'); ?> | <?php the_title(); ?></title>             <meta content='text/html;charset=utf-8' http-equiv='Content-Type'>             <meta content='utf-8' http-equiv='encoding'>             <meta name='viewport' content='width=device-width'>             <link rel='stylesheet' type='text/css' href='<?php bloginfo('stylesheet_url'); ?>'>             <link rel='stylesheet' type='text/css' href='<?php bloginfo('template_directory'); ?>/side-nav.css'>             <?php wp_head(); ?>         </head>      However, since I started calling this method my header now has some extra fluff that's messing up my layout.               <!DOCTYPE html>     <html>         <head>             <title>Faux Pas Improv Comedy | Hello world!</title>             <meta content='text/html;charset=utf-8' http-equiv='Content-Type'>             <meta content='utf-8' http-equiv='encoding'>             <meta name='viewport' content='width=device-width'>             <link rel='stylesheet' type='text/css' href='http://localhost/htdocs/wp-content/themes/super-plain/style.css'>             <link rel='stylesheet' type='text/css' href='http://localhost/htdocs/wp-content/themes/super-plain/side-nav.css'>             <link rel='stylesheet' id='open-sans-css'  href='//fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&subset=latin%2Clatin-ext&ver=3.8.1' type='text/css' media='all' />             <link rel='stylesheet' id='dashicons-css'  href='http://localhost/htdocs/wp-includes/css/dashicons.min.css?ver=3.8.1' type='text/css' media='all' />             <link rel='stylesheet' id='admin-bar-css'  href='http://localhost/htdocs/wp-includes/css/admin-bar.min.css?ver=3.8.1' type='text/css' media='all' />             <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://localhost/htdocs/xmlrpc.php?rsd" />             <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://localhost/htdocs/wp-includes/wlwmanifest.xml" />              <meta name="generator" content="WordPress 3.8.1" />             <style type="text/css" media="print">#wpadminbar { display:none; }</style>             <style type="text/css" media="screen">         html { margin-top: 32px !important; }         * html body { margin-top: 32px !important; }         @media screen and ( max-width: 782px ) {             html { margin-top: 46px !important; }             * html body { margin-top: 46px !important; }         }     </style>         </head>      My question is, how do I remove the extra stuff from being added by wp_header that I don't need; and what can I absolutely not remove from wp_header?


title: Get Post meta via XML-RPC using wp.getPost

text: I am trying to get the value of two post meta fields using wp.getPost. I can get custom fields and the normal post fields but I can't seem to get the meta values associated with the post. I have some custom postMeta that I have put in place called "_swmc_no_comment" and I want to be able to get the value of that. The codex isn't 100% clear on this, or at least my reading of it is poor and all experiments I try seem to fail Can anyone give me any pointers on getting the post meta of a post via xml- rpc? Cheers Dan


title: how to make my website secured

text:
i have a **php code** inside my website to a quotation form that has **java script** for making                name , telephone number and email      rquired fields before submiting the form and its working fine but a few day ago i found that someone is sending me alot of junk for that form and he send the form empty is that means that he could access my files i mean like hacking or how he could do that               <form id="forma" method="post" action="quatation.php">
               * <?php _e ("Name", "my_theme");?>                  <input  type="text" name="namea" id="namea" value="" size="22" tabindex="1" class="rounded" required aria-required='true' pattern="^([a-zA-Z\u0600-\u06ff\ufb50-\ufdff\ufe70-\ufeff]+)$" title="Your name (no special characters, diacritics are okay)"                      spellcheck="false"/>
                  * <?php _e ("Email", "my_theme");?>      <input type="email" name="email" id="email" value="" size="22" tabindex="2" class="rounded" required aria-required='true'      pattern="^(([-\w\d]+)(\.[-\w\d]+)*@([-\w\d]+)(\.[-\w\d]+)*(\.([a-zA-Z]{2,5}|[\d]{1,3})){1,2})$"                     title="Your email address" spellcheck="false" />
                      * Phone                *       this is the form but the problem is when i used to put the quatation.php file in the theme file it gives me error Not Found The requested URL /quatation.php was not found on this server so i put it outside could that be the reason ?


title: X-Pingback and XMLRPC

text: According to old post: How to secure WordPress XMLRPC?, every API require authentication. So, what is the point of adding `X-Pingback` in every public request?               curl -I http://ma.tt     ..     X-Pingback: http://ma.tt/blog/xmlrpc.php     Content-Type: text/html; charset=UTF-8     ..


title: Landing page with login

text: I would like to be able to force any un-registered users to the /welcome page - Currently I have set up the following:               if ( trim( $_SERVER['REQUEST_URI'], '/' ) != 'welcome' && ! is_user_logged_in() ) {          wp_redirect( home_url( 'welcome' ), 301 );          exit;          }      This automatically re-directs visitors to the /welcome page. On the welcome page I have a login form, however the users cannot login because it re-directs them back to the welcome page after they hit the submit button. How can I set it up so where they can login through the welcome page and then be re-directed to the homepage after a successful login?


title: Customize the Sorting Dropdown in WooCommerce

text: It would be great if there was a way to change the default sort by dropdown in WooCommerce on the shop page. Right now the sorting drop down looks like this: http://cld.wthms.co/OBgj And I would very much like to be able to remove a couple of options (`Sort by price: low to high` & `Sort by price: high to low`). The final result should look something like this: http://cld.wthms.co/NHVw


title: wp nav menu: show submenu below li item

text:
I'm trying to figure out if it's possible to show the submenu's outside of the relevant `li` tag.   For example, this php:               wp_nav_menu(array(         'menu'  =>  'side',         'container' => false,         'menu_class'      => 'side-menu'     ));     ?>      will render the menu like so:

Menu 01

Menu 02

Sub 01

Sub 02

Sub 03

Menu 03

Menu 04

      ...when what I'd actually like to achieve is something like this:

Menu 01

Menu 02

Sub 01

Sub 02

Sub 03

Menu 03

Menu 04

      with the relevant submenu sitting below it's corresponding menu item, the reason being the submenus are initially hidden and slide down upon clicking the relevant menu item and each menu item is styled, thus wrapping a submenu inside it throws everything out. Is this at all possible?


title: Multisite Subdomain Redirect Mask

text: I've seen many questions and answers regarding this subject, yet I can't seem to get this to work. Here is my setup. I have my main domain: **www.example.com** On that domain, I've installed WP multisite as a subdomain. The root of the network sits at: **sites.example.com** I have multiple wordpress sites setup under that subdomain, all under the format of: **sites.example.com/Some-WP-Site/** Now, if I register some new domains for the purpose of pointing them to these individual wordpress sites, how would I edit my .htaccess files to achieve something like the following: User navigates to: **www.New-Domain.com** and gets redirected to: **sites.example.com/Some-WP-Site/** all while still seeing **www.New-Domain.com** in the address bar. I've managed to setup a mask where **www.New-Domain.com** is _always_ displayed in the address bar, but I would like to have the structure of the site follow the domain, as the user navigates through the site. For example, **sites.example.com/Some-WP-Site/wp-content/image.jpg** would become **www.New-Domain.com/wp-content/image.jpg** Is this at all possible?


title: How to display a single(current) post from a category

text: How do I get the code below to display just the current post that corresponds to the current URL and not all the post from the same category? Barakadam, It works but it brings all the posts in the category instead of the one that was clicked on.               <?php      $category = end(get_the_category());      $current_name = $category->cat_name;     ?>     <?php         // assign the variable as current category        $category_name = $current_name;            // concatenate the query       $args = 'category_name=' . $current_name;            // run the query       query_posts( $args );            if ( have_posts() ) : while ( have_posts() ) : the_post() ;            // do something here          the_title();     the_content( __('Read the rest of this page »', 'template'));          endwhile; endif;          wp_reset_postdata();          ?>


title: Error inserting row into table

text: I am trying to insert a row into a table. Given below are the various functions to create table. insert data into the table- but its not working. Also given below is the sample output showing all fields that are being attempted to be inserted.               /* Function: Insert Zillow property data into table     * Input: $zillowid String, $date DateTime     * Output: Boolean     */     function zillowInsertData($zillowid, $date_val, $postid, $url) {     global $wpdb;     $table_name = $wpdb->base_prefix."Zillow";     if(trim($date_val) == '')         $date_val= string2DateTime("0000-00-00");     $sql = "         INSERT INTO $table_name (ZillowID, PostID, PropertyURL, DateUpdated)         VALUES ($zillowid, $postid, $url,$date_val)";     return $wpdb->query($sql)===1;     }          echo " Values being inserted-          Zp id=" . $current_zpid . ",          postid=" . $post_id, "url=" . $propertyurl;     zillowInsertData($current_zpid, "", $post_id, $propertyurl );      Sample output showing values being inserted into the table-               About to insert row in Zillow table      Values being inserted-          Zp id=51605333,          postid=111         url=http://www.zillow.com/homedetails/1457-Golf-Course-Dr-Windsor-CA-95492/51605333_zpid/      Table creation code--               global $wpdb;         $table_name = $wpdb->base_prefix."Zillow";         $sql = "CREATE TABLE $table_name(             ZillowID text NOT NULL, PostID text NOT NULL,             PropertyURL text,              DateUpdated datetime DEFAULT '0000-00-00 00:00:00' NOT NULL         );";         $wpdb->query($sql);      What am I doing wrong here? Update-- The string2datetime function uses strtotime php function. Thanks, Arvind.


title: What could be causing my wp_query pagination to break?

text: I'm using categories and wp_query to create an "advanced search" feature on my website. It was working great until recently I noticed that the pagination was broken. The following 2 links should demonstrate the problem: On page 1 I get 185 results: > > http://www.barbadospropertylist.com/?cat%5Boffer%5D=24&cat%5Btype%5D=-1&cat%5Blocation%5D=-1&cat%5Bbedrooms%5D=-1&cat%5Bfurnishings%5D=-1&budget=1000000&cat%5Bparish%5D=-1&cat%5Bagent%5D=-1&cat%5Bbathrooms%5D=-1&submit=Advanced+Search But on subsequent pages the query string breaks: > > http://www.barbadospropertylist.com/page/2/?cat%5Boffer%5D=24&cat%5Btype%5D=-1&cat%5Blocation%5D=-1&cat%5Bbedrooms%5D=-1&cat%5Bfurnishings%5D=-1&cat%5Bparish%5D=-1&cat%5Bagent%5D=-1&cat%5Bbathrooms%5D=-1&budget=1000000&submit=Advanced+Search You should see the second link redirect to: > > http://www.barbadospropertylist.com/page/2/?budget=1000000&submit=Advanced%20Search What with recent upgrades to WordPress I have no idea what might be causing this. Any pointers would be very, very welcome! I've been trying to figure this one out all day. :) Here is my query code:                   query_posts(         array_merge(             wp_query->query,             array(                 'category__and' => $pladvsearchcatids,                 'meta_key' => 'price',                 'orderby' => 'meta_value_num',                 'meta_compare' => '<=',                 'meta_value' => $plbudget,                 'order' => 'DESC'             )         )     );      Just noticed something really strange. When I download my site and work locally the problem goes away. The query string is not redirected on page 2 and paging through the results works as expected.


title: wp_editor textarea value not updating

text:
I am using the `*_add_form_fields` action to add fields to a custom taxonomy. One of those fields is a wp_editor(). The problem I am facing is that when I output the WordPress editor on the page like so:               wp_editor('test', 'mydescription', array('textarea_name' => 'my_description'));       and then if I click in the editor on the page and change the default value from `test` to `something else` the `$_POST['my_description']` variable is still set to `test` Should I be adding an additional setting to my editor? Is there a reason why I cannot change the value of the textarea? **EDIT** Below is a very simple test case that shows this happening. Place this in your functions.php file and then create a new **tag**. The posted value for 'my_description" will not change.               class Test{              function __construct() {                  add_action('add_tag_form_fields', array($this, 'add_tag_form_fields'));                  add_action('created_term', array($this, 'created_term'));         }              function add_tag_form_fields($tag){                  if ( current_user_can( 'publish_posts' ) ): ?>
                 <?php wp_editor('test', 'mydescription', array('textarea_name' => 'my_description')); ?>
                  <?php         }              function created_term($tag){             echo '
';             print_r($_POST);             echo '
';                 die();         }     }     new Test();      **EDIT** This ONLY happens when attaching to "created_term" action. If you attach to "edited_terms" it works as expected and I think this is a result of ajax being used on the create term page... I have updated the test code to show this.


title: Importing specified data/field

text: I'm creating a website for a publisher that contains +- 1.500 registered and these books have its prices rearranged time to time, obviously it would be a hard time to manually upload each one of them. For these books I must have some custom fields, like author, pages, format, cover(image), first chapter, authors page (internal page of the author), and some others that I can put some files for download. So since you guys know the main function of the site, I have some questions: Which are the the best way of creating these functions? (I've tried some e-commerce/store themes but the next question ruined it) I will have to upload the prices of the these books time to time, so there is a way of importing just the information that is contained in the field price all in once? I mean like importing a xml, a sql direct in the data base that will upload/overwrite only this field for all the books, since they have different prices? (I know I will have to specify the id or some other field of each one of the books for the data base understand which posts it must change) I know that is complicated (at least for me) but I've trying to figure out how I'm going to do all of these programming and yet I don't know. If anyone could help me, that would be amazing! Thanks!


title: Problem with custom user meta field

text:
I've recently added a new field into the User Profile section of my blog So that I may define the gender of the user. On the author bio section I have this code:               $authorgender = strtolower(get_the_author_meta('gender'));          if ($authorgender = "male") {         $genderoutput = "his";     } else {         $genderoutput = "her";         };'      And the place i'm using it is:
<a href="<?php the_author_meta('url'); ?>" target="_blank" title="<?php the_author(); ?>'s website (new window)">Check out <?php echo $genderoutput; ?> website      I have two users, One myself which I changed the gender to 'Male' and one a random woman called sally-louise-fredericke-swann and her gender was set to 'Female'. However, the $genderoutput generates 'his' for both users. Not happy :/ Any Ideas?


title: "You do not have sufficient permissions to access this page" upon accessing my newly created plugin page

text:
I am following "Write your own plugin tutorial" and I made it, activated it, added it to settings to have it's own plugin page but upon trying to access that plugin page I get above message saying that "I do not have sufficient permissions to access this page" even though I am logged in as admin and I did `chmod -R 777` to wordpress directory?? What else could it go wrong? _**Plugin code follows:_** `oscommerce_importer.php`               <?php           /*          Plugin Name: OSCommerce Product Display          Plugin URI: http://www.orangecreative.net          Description: Plugin for displaying products from an OSCommerce shopping cart database          Author: C. Lupu          Version: 1.0          Author URI: http://www.orangecreative.net          */                function oscimp_admin() {            include('oscommerce_import_admin.php');       }                function oscimp_admin_actions() {             add_options_page("OSCommerce Product Display", "OSCommerce Product Display", 1, "OSCommerce Product Display", "oscimp_admin");           }                add_action('admin_menu', 'oscimp_admin_actions');                 ?>      `oscommerce_import_admin.php`
         <?php    echo "
" . __( 'OSCommerce Product Display Options', 'oscimp_trdom' ) . "
"; ?>              <form name="oscimp_form" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">             <input type="hidden" name="oscimp_hidden" value="Y">             <?php    echo "
" . __( 'OSCommerce Database Settings', 'oscimp_trdom' ) . "
"; ?>
<?php _e("Database host: " ); ?><input type="text" name="oscimp_dbhost" value="<?php echo $dbhost; ?>" size="20"><?php _e(" ex: localhost" ); ?>

<?php _e("Database name: " ); ?><input type="text" name="oscimp_dbname" value="<?php echo $dbname; ?>" size="20"><?php _e(" ex: oscommerce_shop" ); ?>

<?php _e("Database user: " ); ?><input type="text" name="oscimp_dbuser" value="<?php echo $dbuser; ?>" size="20"><?php _e(" ex: root" ); ?>

<?php _e("Database password: " ); ?><input type="text" name="oscimp_dbpwd" value="<?php echo $dbpwd; ?>" size="20"><?php _e(" ex: secretpassword" ); ?>

             <?php    echo "
" . __( 'OSCommerce Store Settings', 'oscimp_trdom' ) . "
"; ?>
<?php _e("Store URL: " ); ?><input type="text" name="oscimp_store_url" value="<?php echo $store_url; ?>" size="20"><?php _e(" ex: http://www.yourstore.com/" ); ?>

<?php _e("Product image folder: " ); ?><input type="text" name="oscimp_prod_img_folder" value="<?php echo $prod_img_folder; ?>" size="20"><?php _e(" ex: http://www.yourstore.com/images/" ); ?>

             <input type="submit" name="Submit" value="<?php _e('Update Options', 'oscimp_trdom' ) ?>" />
         </form>
        Thanks


title: wp new post expert probleme?

text: i use rss post feed after feed no **post expert** or descripion just images and three point (...) ![image](http://i.stack.imgur.com/JM3LD.jpg) and after go to post edit page   `i don't edit anything` just change writing mode ! from html to visual and click update i see the description !! please help and thanks


title: PHP to Programatically delete a file

text: I am writing a plugin that allows the user to upload files to the upload directory of WordPress. I want them to be able to "uninstall" the files with the click of a button. When the user clicks the button, I want the files to be deleted. I have successful been able to set up uploading and placing the files in the correct directory, but when it comes to deleting the files it is not working. I am trying a very simple `unlink('file/path');` but it doesn't seem to be deleting my file.               <?php          $filename = 'direct/path/to/file/for/testing/purposes';     unlink($filename);          ?>      It seems like the function is running when I click the button, but the file is never deleted. The path is correct as I've double checked it a few times. Is there something I am doing wrong?


title: How to change the length of excerpt() method?

text: I am using the_excerpt() method to display some wordings from the blog posts. I have read the post from this link. http://codex.wordpress.org/Plugin_API/Filter_Reference/excerpt_length But my situation is different. I am displaying some wordings from the posts in two places. In the first place I want to display 20 words and in the 2nd place I want to display 50 words. So what will I do for this?


title: CSS Twentyeleven / Sidebar has to be changed IN the CSS Stylesheet. Sidebar on the left side

text: I have to change my wordpress look. The sidebar should be placed on the left side. I was already looking for solutions, but the piece of codes I found didn't fit into mine. I dont know where I have to change it. I know I can change it in the Options, but I need to change it IN the CSS Stylesheet. Thanks for your help ! Twenty Eleven/twentyeleven.44: Stylesheet (style.css)               body {         padding: 0 2em;     }     #page {         margin: 2em auto;         max-width: 1000px;     }     #branding hgroup {        margin: 0 7.6%;     }     #access div {         margin: 0 7.6%;     }     #primary {         float: left;         margin: 0 -26.4% 0 0;         width: 100%;     }     #content {         margin: 0 34% 0 7.6%;         width: 58.4%;     }     #secondary {         float: right;         margin-right: 7.6%;         width: 18.8%;     }               /* Singular */     .singular #primary {         margin: 0;     }     .singular #content,     .left-sidebar.singular #content {         margin: 0 7.6%;         position: relative;         width: auto;     }     .singular .entry-header,     .singular .entry-content,     .singular footer.entry-meta,     .singular #comments-title {         margin: 0 auto;         width: 68.9%;     }               /* Attachments */     .singular .image-attachment .entry-content {         margin: 0 auto;         width: auto;     }     .singular .image-attachment .entry-description {         margin: 0 auto;         width: 68.9%;     }               /* Showcase */     .page-template-showcase-php #primary,     .left-sidebar.page-template-showcase-php #primary {         margin: 0;     }     .page-template-showcase-php #content,     .left-sidebar.page-template-showcase-php #content {         margin: 0 7.6%;         width: auto;     }     .page-template-showcase-php section.recent-posts {         float: right;         margin: 0 0 0 31%;         width: 69%;     }     .page-template-showcase-php #main .widget-area {         float: left;         margin: 0 -22.15% 0 0;         width: 22.15%;     }               /* error404 */     .error404 #primary {         float: none;         margin: 0;     }     .error404 #primary #content {         margin: 0 7.6%;         width: auto;     }               /* Alignment */     .alignleft {         display: inline;         float: left;         margin-right: 1.625em;     }     .alignright {         display: inline;         float: right;         margin-left: 1.625em;     }     .aligncenter {         clear: both;         display: block;         margin-left: auto;         margin-right: auto;     }          /* Right Content */     .left-sidebar #primary {         float: left;         margin: 0 0 0 -26.4%;         width: 100%;     }     .left-sidebar #content {         margin: 0 7.6% 0 34%;         width: 58.4%;     }     .left-sidebar #secondary {         float: right;         margin-left: 7.6%;         margin-right: 0;         width: 18.8%;     }


title: Display all authors in a theme template

text: I was having an issue the other day and successfully got a very good answer which helped me alot achive what I wanted. this is the post which I created and have all the correspondence: wordpress.stackexchange.com/questions/63060/display-all-authors-and-their- only-one-latest-post The answer was kindly contributed courtesy of @Sagive SEO This script currently displays all authors in an order of most posts written. I would like to change it to simply display all authors randomly regardless of how many posts they wrote. Hope to get an answer, thanks a lot Gil


title: How to implement a Google map store locator

text: I have followed the following Google developer doc about creating a store locator usng PHP & MySql. https://developers.google.com/maps/articles/phpsqlsearch_v3 I have this working but now I would like to integrate this with an existing Wordpress installation. My problem with integrating this, is the way WP stores repeatable custom fields. I have a repeatable field to enter multiple markers per custom post type. WP stores this as serialised data within the DB. I cannot see a way of using the Haversine formula select statement mentioned in the doc to perform the radius search based on an entered postcode. I know there are various Google Map plugins out there, but I can't find any that will:   * Add multiple markers per custom post    * Provide a search to list markers within a radius of an entered postcode Has anyone got any suggestions how I can do this, or does these features exist? Thanks in advance for any help on this.


title: WooThemes Mini Features - modify query_posts to display only sticky_posts

text:
/* Mini-Features */             ?>             <div id="sub-featured" class="<?php echo $main_css_class; ?> section">
<?php echo stripslashes( $featured_title ); ?>
                      <?php                      query_posts( 'suppress_filters=0&post_type=infobox&order=ASC&posts_per_page=' . $mini_features_number );                     if ( have_posts() ) { $count = 0; while ( have_posts() ) { the_post(); $count++;                          $excerpt = stripslashes( get_post_meta( $post->ID, 'mini_excerpt', true ) );                      $button = get_post_meta( $post->ID, 'mini_readmore', true );                     $post_class = 'post block';                          if ( $count % $mini_features_count == 0 ) { $post_class .= ' last'; }                 ?>                     <div <?php post_class( $post_class ); ?>>                                  <a href="<?php echo $button; ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php woo_image( 'key=mini-image&width=300&height=150&class=thumbnail aligncenter&link=img' ); ?>
<a href="<?php echo $button; ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>
                             <?php if ( $excerpt ) { ?>
                                 <?php echo $excerpt; ?>
                             <?php } ?>
                 <?php                     if ( $count % $mini_features_count == 0 ) { echo '

'; }                     } // End WHILE Loop                 } else {                 ?>

<?php _e( 'Sorry, no posts matched your criteria.', 'woothemes' ); ?>

                 <?php } // End IF Statement ?>
      That's the code, somewhere within that I need to specify that only sticky_posts are displayed - this is where I come unstuck. I've taken a look at the Codex for both query_posts & sticky_posts & I've got to be honest - I'm not sure where I'd start to modify the above... The first thing I did was add the ability (to those custom post types) to include a Sticky Post meta box (thanks to: Sticky Custom Post Types - this worked a treat). As part of the theme options I can specify how many posts I'd like to display (in my case 3x) but until I modify the above code to only display sticky_posts - I'll end up with 2x sticky_posts (& one other random one). I'm stuck, so any pointers would be greatly appreciated!


title: Filter meta request

text: i've got a multisite where i query _specific custom post types_ from _one specific blog_. It looks like this:               function unify_results_filter( $input ) {     global $wpdb;     $blog_id = get_current_blog_id();     $blog_source_id = '2';          $db_source_prefix = str_replace($blog_id, $blog_source_id, $wpdb->prefix);          // if blog is not 2 and post_type is results, query blog id 2     if ( strpos($input, "post_type = 'results'") !== false )         $input = str_replace( $wpdb->posts, $db_source_prefix . 'posts', $input );          return $input;     }     add_filter( 'posts_request', 'unify_results_filter' );      Now this works for the posts themselves. However, i'd like to the _same for their meta values_. Is there a similar filter for meta request?


title: Start with multi-site feature now or later?

text: I have a single installation of Wordpress in my web host and would like it to manage 2 domains or websites. One is for the domain and the other is for its subdomain/s. dummy example: www.swimming.com and videos.swimming.com In my limited knowledge, is this where you use the multi-site feature of WordPress? Another question, is it possible to add that feature later on? I mean, I would have to concentrate first on the main domain and when time comes, I'd focus on the subdomain. So I'm planning to use WordPress without multi-site first and when I'll add a subdomain, that's when I'll switch or add multi-site. Or do I have to start with multi-site now?


title: Sort query output on taxonomy term archive by post type using pre_get_posts

text: I'm using `pre_get_posts` to adjust the main query of the taxonomy term archive. What I would like to accomplish is that the output is listed by `post_type`. I have a total of 4 post types and I want to order them as profile, page, post, letter. I have tried already a few different `order_by` parameters, but no luck yet in getting it right. I already have come a bit further by adding a `posts_groupby` filter (and removing it again after the query) and although the output is now indeed per `post_type`, it still is not in the desired order. This is what I have come up with so far:               add_action('pre_get_posts', 'woo_taxonomy_posttype_filter' );     function so_groupby_cpt( $groupby ) {         if ( preg_match( "/(|[ ,.])id(|[ ,])/i", $groupby ) )             $groupby = 'post_type';         return $groupby;     }          function woo_taxonomy_posttype_filter( $query ) {          global $wp_query;          if ( $query->is_tax && ! is_admin() ) {          add_filter( 'posts_groupby', 'so_groupby_cpt' );          // ORDER BY TITLE     $query->set('orderby','menu_order title');     $query->set('order','ASC');     $query->set('posts_per_page','8');          $query->parse_query();          remove_filter( 'posts_groupby', 'so_groupby_cpt' );     }          return $query;          }      Is this at all possible or am I asking for the impossible? Thanks.


title: WordPress function breaks widget's markup?

text:
Here's a standard function creating widget, it displays Widget's title and echoes "test" below it:                function widget( $args, $instance ) {             extract( $args );             $title = apply_filters('widget_title', $instance['title'] );                  echo $before_widget;                  if ( $title )                 echo $before_title . $title . $after_title;                       echo 'test';                  echo $after_widget;         }      It creates perfect output:

Title
        test
      But when I replace `echo 'test';` with `wp_list_pages();` things start to look nasty because widget's body is being displayed after the tag that closes the widget:

Title

          Paage title
        (...)      Any ideas how to fix it? I've been trying with multiple wp_list_pages() arguments, but nothing seems to help.


title: How to combine multiple CSS files and concatenate JavaScripts if WordPress recommends enqueuing them?

text: How would I go about combining multiple CSS files and concatenating my scripts if they're being enqueued as WordPress recommends? My site is pretty slow and would like to optimize for performance.


title: Browser title script ignoring is_page /else conditional

text: I've used this code to stipulate different separators for different pages in my clients site:               <title>     <?php if(is_page('Portfolio')){         wp_title( 'of', true, 'right' );         echo wp_specialchars( get_bloginfo('name'), 1 );     }else{         wp_title( 'by', true, 'right' );         echo wp_specialchars( get_bloginfo('name'), 1 );     }         ?>     </title>      What it's outputting regardless of where I am on the site is : > Page Name | Blog Name Which i find really odd, how is it going through the if statement and coming up with it's own answer?


title: Get current term's ID

text:
Im using the following code to get an array of children taxonomies and write them out with links in an unordered list.                   <?php     $termID = 10;     $taxonomyName = "products";     $termchildren = get_term_children( $termID, $taxonomyName );          echo '
';     foreach ($termchildren as $child) {         $term = get_term_by( 'id', $child, $taxonomyName );         echo '
name, $taxonomyName ) . '">' . $term->name . '
';     }     echo '
';     ?>      What I'm trying to achieve is to get the actual term (category) id so I can replace it on $termID and don't have to hardcode the id of the term. Any help would be kindly appreciated! Thanks!


title: How to call in Custom Post-Type Categories?

text:
I have our portfolio page here: http://www.slarc.com/portfolio-view/central- control-building-east-texas/ The orange links below the project title are manually inserted on the page content. Is there a way to call in a the post categories to make this automatic? The template I'm using doesn't have our portfolio posts under WP Posts. It's under a custom post-type titled "Portfolio". I have received this code below. But I don't know how to add it to my page. When I tried everything on the page below the PHP code disappeared.               <?php       $args = array(          'type'                     => 'post',          'child_of'                 => 0,          'parent'                   => '',          'orderby'                  => 'name',          'order'                    => 'ASC',          'hide_empty'               => 1,          'hierarchical'             => 1,          'exclude'                  => '',          'include'                  => '',          'number'                   => '',          'taxonomy'                 => 'your_custom_taxonomy',          'pad_counts'               => false );      $categories = get_categories($args);           echo '
';           foreach ($categories as $category) {          $url = get_term_link($category);?>
<a href="<?php echo $url;?>"><?php echo $category->name; ?>
      <?php      }           echo '
';      ?>      Thanks, Lorne


title: I am trying to create a simple frontend form for posting

text: i am trying to learn and create some deeper things with Wordpress. My goal is to create a code/script/plugin that will allow me to post from the frontend. I have seen many plugins, like templatic classifieds theme that submit, handle and edit posts from the frontend but are very complex with useless code for my purpose. I would like to have a clearer view on how to get the ID, how to set a title, content and custom fields of course. Once I go through this, I want to study it according to user_meta. Thank you for your examples, codes, ideas, links!


title: Pull Random Attachments With Pagination

text:
I want to make a archive page that pulls in all uploaded images to the site. I am using the current script. Its paginating somewhat but not showing all the images. Showing around 90 out of 140.                    <?php query_posts(array('posts_per_page'=>'8','paged' => get_query_var('paged'))); ?>            <?php         if ( $images = get_posts(array(             'post_parent' => $post_id,             'post_type' => 'attachment',             'numberposts' => -1,             'orderby' => 'rand',             'posts_per_page'=>'8',             'paged' => $paged,             'post_mime_type' => 'image',)))         {             foreach( $images as $image ) {                 $attachmenturl=wp_get_attachment_url($image->ID);                 $attachmentimage=wp_get_attachment_image_src( $image->ID, postgallery );                 $imageDescription = apply_filters( 'the_description' , $image->post_content );                 $imageTitle = apply_filters( 'the_title' , $image->post_title );                      if (!empty($imageDescription)) {         echo '';     } else { echo '

                                         ID). '" class="view-back" style="display: none;">

     '; }    }         } else {             echo "No Image";         } ?>

               <?php echo paginate_links( $args ) ?>     <?php     global $wp_query;          $big = 999999999; // need an unlikely integer          echo paginate_links( array(         'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),         'format' => '?paged=%#%',         'current' => max( 1, get_query_var('paged') ),         'total' => $wp_query->max_num_pages     ) );     ?>


title: Can't get correct pagination links on blog single page

text:
I am new to wordpress but I am going through something unusual here. The blog I am designing is something a little different. Let's say there is just a blog index and single posts. I have designed this two pages to act very similar. When you go to blog index there is the latest post on the main content and then there is sidebar which shows the list of posts with a pagination links. It uses ajax, so when you click on any item in the sidebar list the main content of the page is updated with the contents of the post you clicked on. Every thing works here. But when you directly navigate to a single post, there is much similar thing there except the content is filled with this single post, off course, and the sidebar is again showing a list of posts in the blog. The problem is I can't seem to be able to get the pagination work. Here is the code for `single.php` in my template               <?php get_header(); ?>
         <?php the_post(); ?>
<?php the_title(); ?>

<?php the_content(); ?>

<?php comments_template(); ?>

         <?php query_posts("posts_per_page=10"); ?>         <?php if ( $wp_query->max_num_pages > 1 ) : ?>
            <?php posts_nav_link(); ?>
         <?php endif; ?>
           <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_title(); ?>

         <?php the_excerpt(); ?>
           <?php endwhile; ?>           <?php else : ?>
<?php _e( 'No Posts' ); ?>
           <?php endif; ?>

     <?php get_footer(); ?>      Now, I have read the documentation for the posts_nav_link(); function and it says it is supposed to work at the archive pages like blog index , category etc and not on single.php page. And my problem is that I think it is actually working and showing the pagination next and previous links but with the **wrong urls**. Say we are at the page with the url of `http://site.com/single-new-post` then the Next Page anchor at the sidebar is linking to `http://site.com/single-new-post/page/2` instead of being `http://site.com/blog/page/2`. What can I do to get the correct links at this pagination problem?


title: Setting META tags such as description and title on programmatic post creation

text:
i am new to WP plugins, and i have made one that auto creates posts and catagories. Anyhow, id like to know if i can set the meta values when creating the post such as:                       $my_post_data = array(                 'post_title' => $collection,                 'post_type' => 'post',                 'post_content' => '
' . $content . '
',                 'post_category' => array(                     $term->term_id                 ),                 'post_author' => 1,                 'post_status' => 'publish',                 'post_date' => date('Y-m-d H:i:s')             );      Is there any way i can set the title and description for this page?


title: Custom taxonomy displayed in search results

text:
In my search results template within my WP site `search.php`, the function `et_divi_post_meta()` displays a posts meta data. What code would I use to display the the custom taxonomy that I created: `'State'` and `'Product-Type'`? So search results sould include that info and not just: the title, meta and the_content. Example: > **Special Price** > > Monday's Special Price on wall paper is... > > *-Illinois > > -Wall Paper*
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
         <?php              et_divi_post_meta();     if ( 'on' !== et_get_option( 'divi_blog_style', 'false' ) )         truncate_post( 270 );         else         the_content();         ?>     //      Here is the taxonomy Code               // Add custom taxonomies     add_action( 'init', 'specials_create_taxonomies', 0 );          function specials_create_taxonomies()      {         // Town         $town_labels = array(             'name' => _x( 'Town', 'taxonomy general name' ),             'singular_name' => _x( 'Town', 'taxonomy singular name' ),             'search_items' =>  __( 'Search in Town' ),             'all_items' => __( 'All Towns' ),             'most_used_items' => null,             'parent_item' => null,             'parent_item_colon' => null,             'edit_item' => __( 'Edit Town' ),              'update_item' => __( 'Update Town' ),             'add_new_item' => __( 'Add new Town' ),             'new_item_name' => __( 'New Town' ),             'menu_name' => __( 'Town' ),              );         register_taxonomy('town', 'specials', array(             'hierarchical' => true,             'labels' => $town_labels,             'show_ui' => true,             'query_var' => true,             'rewrite' => array('slug' => 'Town' )              ));


title: Setting the language of RSS feed

text: What is the simplest / easiest way to set up the language of the rss feed. Currently, that field in my feed xml is blank, it looks like this                <language></language>      and i would like it to look like               <language>en-US</language>      Any help on how to easily implement it?


title: Can't get jQuery to enqueue into post edit script

text: In the code below, unless I hardcode a reference to the jQuery library, my jQuery bits on the page do not work. What's wrong with the enqueue method I'm trying to use? In functions.php:               if(is_admin())     {          /* LOAD ADMIN SCRIPTS     **********************************/     require_once(TEMPLATEPATH . '/functions_private.php');          }      In functions_private.php:               if( 'post.php' == $pagenow )     {              add_action('admin_print_scripts', 'my_load_ui_script');              function my_load_ui_script()         {         wp_enqueue_script('jquery');         ?>             <!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>-->             <script>             if(typeof jQuery!="undefined"){                 alert("You have jQuery loaded");//WILL NOT FIRE UNLESS I HARDCODE JQUERY INCLUDE             }                             jQuery(document).ready(function()             {             //jquery bits go here             }              }//END FUNCTION           }//END IF


title: How can I add a Categories page link to a menu?

text: Not a link to a specific category, but a link to a page that lists all categories of a custom post type (WooCommerce Products).


title: How can I edit post data before it is saved?

text: I have a plugin and I would like to be able to run the post content through some filters before it is saved to the database. From looking at the plugin api, I see that two hooks that look like they might be helpful:               save_post     wp_insert_post      The only problem is that it looks like `save_post` does not need return a variable, and so I don't know how to filter the content, and `wp_insert_post` looks documented. I'd like to do something like this:               add_action('whatever_hook_name','my_function');          function my_function($post_content){         return $post_content.' <br> This post was saved on '.time();     }      I am going to do something more useful than append a timestamp, namely running some regex filters, but this is the general type of filter / action I'm trying to add. **Update** Please note that I want to intercept the data on it's way to being saved in the database - not when it is being displayed in the post (eg: Not by adding a filter to `the_content`)


title: Remove Javascript generated by Comments

text: In a theme I am working on, the comments form (mostly sure they are both comments form) adds javascript to the header.               <script type='text/javascript' src='http://[URL]wp-includes/js/l10n.js?ver=20101110'></script>     <script type='text/javascript' src='http://[URL]/wp-includes/js/comment-reply.js?ver=20090102'></script>      When I disable javascript I can still add comments and the comment form still works. So I wish to remove these from my header. I cannot find any documentation on how to do so, so **How can I remove these?**


title: How to hook custom taxonomies to custom post types and make the permalinks work?

text: So, I have my custom post type with the slug **/news**. And I want my category view to be **/news/category/CATEGORYID**. For that I create my custom taxonomy:               add_action('init', 'create_allfilmnews_categories', 0);     function create_allfilmnews_categories() {         $labels = array(             'name' => _x( 'Categories', 'taxonomy general name' ),             'singular_name' => _x( 'Category', 'taxonomy singular name' ),             'search_items' =>  __( 'Search categories' ),             'all_items' => __( 'All category' ),             'parent_item' => __( 'Parent category' ),             'parent_item_colon' => __( 'Parent category:' ),             'edit_item' => __( 'Edit category' ),             'update_item' => __( 'Update category' ),             'add_new_item' => __( 'Add new category' ),             'new_item_name' => __( 'New category name' ),             'menu_name' => __( 'News categories' ),         );                register_taxonomy('news_category', 'news', array(             'hierarchical' => true,             'labels' => $labels,             'show_ui' => true,             'query_var' => true,             'rewrite' => array( 'slug' => 'category' ),         ));     }      I was hoping, that since it is hooked to **news** custom post-type.. and its slug is "category", so I was hoping that naturally it would work out like I wanted (/news/category/CATEGORYID). And use my custom category-template just by creating a file to the template directory: **category-news_category.php**. However, of course it is not working. Is it even possible to have a custom taxonomy aka. categories inside custom post-type, that work perfectly with permalinks?


title: How to include the admin bar?

text: I'm working on a plugin which needs a custom Preview page. In this page i call the neccessary wp functions(wp-load.php & wp-admin/includes/admin.php). The problem is, that the admin bar is not visible. So my question is, how to display the admin bar on this page? Here is the preview.php file:               <?php          //Include wordpress core files     for ($i = 0; $i < $depth = 10; $i++) {         $wp_root_path = str_repeat( '../', $i );         if ( file_exists("{$wp_root_path}wp-load.php" ) ) {             require_once("{$wp_root_path}wp-load.php");             require_once("{$wp_root_path}wp-admin/includes/admin.php");             break;         }     }          //Redirect if user is not logged in     auth_redirect();          //Die if user can't edit posts     if(!current_user_can('edit_posts') ) die(__("You don't have the neccessary permission to preview forms.", "nemus_slider"));          //And the actual preview code     ?>     <!DOCTYPE html>     <html lang="en">     <head>         <meta charset="utf-8" />         <title>Preview</title>         <?php wp_head(); ?>     </head>     <body>         Some preview stuff...         <?php wp_footer(); ?>     </body>     </html>


title: Customize category URL

text: I've searched around and have not found the answers im looking for. By default I have:   * example.com/blog (blog archive)   * example.com/blog/entry (single entry)   * example.com/blog/category/announcements (single taxonomy view) Now I've created a custom post type & taxonomy (categories) to go along with it, but I'm having trouble mirroring the blog's URL structure. For example my goal is:   * example.com/talks (talks archive)   * example.com/talks/entry (single talk entry)   * example.com/talks/category/support (single taxonomy view) Here is what I have so far:               function uc_add_talks_post_type() {       $talks_labels = array(         'name'                => 'Talks',         'singular_name'       => 'Talk',         'all_items'           => 'All Talks',          …       );            $talks_args = array(         'labels'             => $talks_labels,         'public'             => true,         'publicly_queryable' => true,         'show_ui'            => true,         'menu_position'      => 5,         'rewrite'            => array( 'slug' => 'talks', 'with_front' => false ),         'has_archive'        => 'talks',       );            $talks_cat_args = array(         'hierarchical' => true,         'labels' => array(           'name' => 'Talk categories',           'singular_name' => 'Talk category',           …         ),         'show_admin_column' => true,         'show_ui' => true,         'query_var' => true,         'rewrite' => array(           'slug' => 'talks',           'with_front' => false         ),       );            register_post_type( 'uc_talks', $talks_args );       register_taxonomy( 'uc_talks_cat', array('uc_talks'), $talks_cat_args );     }          add_action( 'init', 'uc_add_talks_post_type');


title: Storing Form data in a different database

text: I have two wordpress websites and I want to store the data submitted by the forms in a centralized database in order to better manage the information. Is there a way I can store form data in a different database?


title: Loop that displays all posts by logged in user, with Post Edit link

text: I need a loop that pulls in all posts that were authored by the logged-in user. I have to then create a link to the post with this in the querystring: ?_ninja_forms_action=edit.


title: Need help rebuilding lost htaccess file

text: I originally posted this on **Stack Overflow** (7 months ago). I didn't receive any answers and was not in a position to pursue it further. As of now I am working on resolving this, and would greatly appreciate assistance from someone familiar with WP and htaccess. Some time ago I installed Magento in the sub directory of a site with many apps on it, and the Magento downloader/installer replaced the .htaccess file in my root. The automated backups which run via a wordpress installation happened to NOT be capturing the few files in the root folder. I have no back-up. This wouldn't be so bad if I actually knew and understand all that was in that .htaccess file. it has been slowly created over a period of years! What I am looking for is some assistance with rebuilding it. Already I am coming across issues. For instance, when I try to access a fold other than my wordpress folder, I am rerouted to the 404 of wordpress. For instance, I have a proxy app in the subfolder /proxy, but if I go to mysite.com/proxy I see in the address bar: mysite.com/proxy , and the wordpress 404. I've greatly enjoyed learning increasing amounts of regex in past months, and getting my head around .htaccess redirects, rules, etc. So I'd like to more than solve these issues, and actually understand how they are solved. Here is my root .htaccess as it stands (pulled together from a few miscellaneous notes I had on record:               <Files .htaccess>     order allow,deny     deny from all     </Files>          # Redirect     #<IfModule mod_rewrite.c>     #RewriteEngine on     #RewriteCond %{REQUEST_URI} !^/site/     #RewriteCond %{HTTP_HOST} ^www\.     #RewriteRule (.*) http://mydomaint.com/site/$1 [R=301,L]     #</IfModule>          # BEGIN WordPress     <IfModule mod_rewrite.c>     #RewriteEngine on     #RewriteBase /site     #RewriteRule ^index\.php$ - [L]     #RewriteCond %{REQUEST_FILENAME} !-f     #RewriteCond %{REQUEST_FILENAME} !-d     #RewriteCond %{REQUEST_URI} !^/site/     #RewriteRule . /site/index.php [L]          RewriteEngine on     RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$     RewriteCond %{REQUEST_URI} !^/site/     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule ^(.*)$ /site/$1     RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$     RewriteRule ^(/)?$ site/index.php [L]          </IfModule>      I get the impression there is repetition and redundancy in that code. And that it is missing lines to pick up on subfolders that are NOT the wordpress one (which is in /site by the way). I have included showing you what was commented out, as it may help with seeing where I went wrong, or identifying how it should be set up. What I need is that all requests for:   * mydomain.com/site   * www.mydomain.com/site   * mydomain.com (no subfolder) Are directed to `mydomain.com/site` Requests for any other subfolder (assuming it exists) should go through to to the folder requested (e.g. `mydomain.com/proxy` or `mydomain.com/shop` are passed through to their respective folders `/proxy` and `/shop`). Requests for subfolders which do not exist, should be routed through to `mydomain.com/site` I am not sure just yet if anything else has been broken, but I can bring that to the table if and when I discover it. I should add that I have also tried this: order allow,deny deny from all               # Redirect     <IfModule mod_rewrite.c>     RewriteEngine on     RewriteCond %{REQUEST_URI} !^/site/     RewriteCond %{HTTP_HOST} ^www\.     RewriteRule (.*) http://jonathanevatt.com/site/$1 [R=301,L]     </IfModule>      But something odd occurs with this. If I browse to `www.mydomain.com` (or `mydomain.com`) I end up with with that in the address bar, and this appearing on a blank page (as a line of text at the top left of the page:               /home/jonathan/public_html/app/Mage.php was not found      This is exactly what was happening after the installer whipped out my .htaccess file. I have not idea where or how that is being called up, as I see nothing in the .htaccess leading to this address being called. It is very perplexing. ALSO I did manage to find a back-up of some rules I had in my htaccess file, which were there to redirect requests for various types of content from my old Joomla site. These rules are:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /site/     RewriteRule ^en/Page-[0-9]+\.html /site/blog/ [R=301,L]     RewriteRule article&id=([0-9]+) /?p=$1 [R=301,L]    #CATCH ?option=com_content&view=article&id=307&catid=89&Itemid=55     RewriteRule ^articles-other-writing/(Page-[0-9]|index)\.html /site/blog/ [R=301,L]     RewriteRule ^articles-other-writing/[a-zA-Z\-]+/(Page-[0-9]|index)\.html /site/blog/ [R=301,L]     RewriteRule ^what-is-love/([a-zA-Z0-9\-\/\.\_\=\?\&]+) /site/blog/ [R=301,L]     RewriteRule ^media/audio/([0-9a-zA-Z_]+\.mp3)$ /wp-content/uploads/audio/$1 [L,R=301]     RewriteRule ^[A-Za-z\-]+/[a-z\-]+/[a-z\-]+/([0-9]+)\-.+ /?page_id=$1 [R=301,L]     RewriteRule ^/swine-flu\.html$ /site/tags/swine-flu/ [R=301,L]     RewriteRule ^events/event-descriptions/([A-Za-z\-]+)\.html$ /site/events/$1/ [R=301,L]     RewriteRule ^[0-9]{8}([0-9]*)\/(articles|great-products|others-videos|jonathan-s-blog)[a-zA-Z0-9\-\/\.]+ /?p=$1 [R=301,L]   # CATCH POSTS 1     RewriteRule ^[0-9]{8}([0-9]*)\/services[a-zA-Z0-9\-\/\.]+ /?page_id=$1 [R=301,L]                # CATCH PAGES 1     RewriteRule ^myblog[a-zA-Z0-9\-\/\.] /site/blog/ [R=301,L]    #CATCH MYBLOG     RewriteRule ^view-by-tag/([a-zA-Z\-]+)/([a-zA-Z0-9\-\/\.\_\=\?\&]+) /site/tags/$1/ [R=301,L]      I should probably integrate them into the new htaccess file just in case there are still links out there pointing to important content on the old Joomla system.


title: wp_redirect on multisite

text: I have a multisite setup with subfolders (rather than subdomains). There are 3 sites installed which will use the same theme but in English, French and Dutch. I want to use wp_redirect in the header of the theme so that the user is redirected to one of the sites based on a cookie that is set when they click on a language option in a popup. The redirect works fine on the english site which has the path '/' but not on any of the other sites which have paths - '/fr/' and /'nl/' I've also tried redirecting using ` header("Location: http://example.com/"); ` and that doesn't work either. It literally does nothing! Is it because the sites are subfolders rather than sub directories? I've removed all the code that detects the cookie and conditional statementents for now and have tried it in the header.php file of 2013 default theme and it still doesn't work. So the top of the header.php file looks like - ` <head> <?php wp_redirect( 'http://www.example.com', 301 ); exit; ?> .... ` And to confirm, this DOES work with the site http://www.example.com but not with the site http://www.example.com/fr I'm stumped. Thanks for help. I hope that all makes sense. Luke


title: Adding Child Terms Programatically - No Warning but No dice either

text: Here's essentially what I'm doing :               create_taxonomy_record(array(                 'Label',                 'tax_parent_slug',                 'Label Related',                 'this_tax_term_slug'));     /* ---> Create a child */                 create_taxonomy_record(array(                 'Label 2',                 'this_tax_term_slug',                 'Label Related',                 'this_tax_term_slug_a_child'));      and here's that function named `create_taxonomy_record` (its very vanilla - echos are for debug purposes)               create_taxonomy_record($args)             {                      $term = term_exists($args[0], $args[1]);                 if ($term == 0 || $term == null) {                          wp_insert_term(                         $args[0], // the term                         $args[1], // the taxonomy                         array(                             'description'=> $args[2],                             'slug' => $args[3],                             'parent'=> $args[1]                             )                     );                 }                 else { echo "<h1>" . $args[0] . " exists in parent " . $args[1] ."</h1>";}             }      So this isn't working but its also not hard failing. I have warnings / errors on and this code provides neither. **What's Working:**   * All 1st tier terms in the taxonomy are registering fine(1->n, i've run tests against 10k calls to this function and all perform nominally) **What's Not Working:**   * when I try to assign a child term to a parent term. I do not get a warning, failure or false match of existence, i just don't get anything. **Now I did find this :** Inserting terms in an Hierarchical Taxonomy However this did not seem to fix the issue. Or rather perhaps I am going about the cache clear incorrectly. What I tried for the cache clear looked something like this:               create_taxonomy_record(array(                     'Label',                     'tax_parent_slug',                     'Label Related',                     'this_tax_term_slug'));         /* ---> Create a child */          /* Tried it here */     delete_option("this_tax_term_slug_children");                     create_taxonomy_record(array(                     'Label 2',                     'this_tax_term_slug',                     'Label Related',                     'this_tax_term_slug_a_child'));          /* and here - all permutations/ combinations should be considered attempted */     delete_option("this_tax_term_slug_children");      No dice.


title: image uploaded cant be shown

text: im using wordpress 3.2.1 i kinda forgot how this things happen..but i remember updating some plugins/wp and its happen. i can upload an image, but once its finished it show broken link. something like this http://imageshack.us/photo/my- images/688/screenshot20110721at639.png/ anyone can help? already try deactivate all plugins but nothing happen. already empty the "Store uploads in this folder" but nothing happen too anyone can help? thanks


title: What's the difference with trash_comment and wp_trash_comment?

text: I don't understand when I'm suppose to use trash_comment over wp_trash_comment. What's the difference?


title: How to add featured image to a post?

text: I have a registration form where the user can upload an image. Upon registration I create a post and I would like the uploaded image to featured image. I have tried that but it is no working :               function createNewPost( $response ){     global $userMeta;          $userID = $response->ID;     $user = new WP_User( $userID );     $role = $userMeta->getUserRole();     $categorie = get_user_meta($userID, 'categorie_artiste',true);     $filename = get_user_meta($userID, 'image_profil',true);          if( $role = 'artiste' ){               $newPost = array(           'post_title'    => $user->nickname,            'post_content'  => $user->description,           'post_status'   => 'pending',           'post_author'   => $userID,           'post_type'     => 'cpt_artists',         );              $post_id = wp_insert_post( $newPost );              $wp_filetype = wp_check_filetype(basename($filename), null );         $wp_upload_dir = wp_upload_dir();         $attachment = array(            'guid' => $wp_upload_dir['url'] . '/' . basename( $filename ),             'post_mime_type' => $wp_filetype['type'],            'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $filename )        ),            'post_content' => '',            'post_status' => 'inherit'         );         $attach_id = wp_insert_attachment( $attachment, $filename );         set_post_thumbnail( $post_id, $attach_id );         }     }


title: edit_comment capability for subscriber

text: I have given my site's subscriber role the following permissions (unserialized DB-query):               [subscriber] => Array         (             [name] => Reader             [capabilities] => Array                 (                     [delete_comment] => 1                     [edit_comment] => 1                     [level_0] => 1                     [quick_edit_comment] => 1                     [read] => 1                     [reply_comment] => 1                     [unfiltered_html] => 1                 )              )      I want to make the subscriber be able to edit their comments, but I always get an error "Your are not allowed to edit this comment." I tried the following in debugging (in my comments.php template file):               $link = get_edit_comment_link($GLOBALS['comment']->comment_ID);     $perm1 = current_user_can('edit_comment', $GLOBALS['comment']->comment_ID);     $perm2 = current_user_can('edit_comment');     var_dump($link);     var_dump($perm1);     var_dump($perm2);     global $current_user;     var_dump($current_user->allcaps);      giving the following output (explanation added beside):               (get_edit_comment_link): NULL     (cur_user w/ post-id): bool(false)     (cur_user w/o post-id): bool(false)          (allcaps):      array(9) { ["delete_comment"]=> bool(true) ["edit_comment"]=> bool(true)      ["edit_posts"]=> bool(true) ["level_0"]=> bool(true) ["quick_edit_comment"]=> bool(true)      ["read"]=> bool(true) ["reply_comment"]=> bool(true) ["unfiltered_html"]=> bool(true)      ["subscriber"]=> bool(true) }       As you can see, the allcaps shows that the user is allowed to edit_comments. But get_edit_comment_link stays empty, although the role has the capability AND the current_user is the author of the comment.


title: Add Custom Fields After Page Title

text: I want to add my custom fields after the page title when you view it on the site. How do I do this? PAGE TITLE [CUSTOM FIELDS HERE] PAGE CONTENT


title: How to Detect That WP is Using Mod Rewrite or $_GET variables?

text: I am trying to get WP is using Mod_Write or $_GET for URLs,   Because by it, I can generate my own links like:               mysite.com/val1/val2      or in a conventional way;               mysite.com/?var1=val1&var2=val2      $_GET or rewrite, how to detect that which way WP is currently using?


title: Can plugin variables cause conflict?

text: I write a wordpress plugin. My plugin code in inside a class.               if (!class_exists("Pluginname")) {       class Pluginname {         ...       }     }          if (class_exists("Pluginname")) {       $obj = new Pluginname;     }      Question: What if `$obj` is already used in Wordpress code or in another plugin? Can this be a potential source of conflict? If so, what to do?


title: PHP random number in email

text: I have a Wordpress website where i am making a form so that when a user fills out that form he gets a confirmation email and receives a random order number. I have this PHP function which creates that number any suggestions is it possible to embed it to an email with a shortcode. Maybe could someone can put me on the right track?               function genTicketString() {         $length = 8;         $characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";         for ($p = 0; $p < $length; $p++) {             $string .= $characters[mt_rand(0, strlen($characters)-1)];         }         return $string;     }     add_shortcode('quoteticket', 'genTicketString');     ?>


title: Change background color of subpages

text: I have several pages, which are ordered like this:               Home     Projects     - Project 1     -- Project 1 Subpage 1     -- Project 1 Subpage 2     - Project 2     -- ...      And I want to change the background color (in this case of `.site-main {}` or any other css classes) depending on the page the user is right now.   1. Currently on Home page (this is the default layout) -> Standard background color light blue   2. I am on Page Project 1 -> background should be green.   3. I am on Project 1 Subpage 1 -> background should be green.   4. I am on Project 2 -> background red or something else This is the standard layout right now (the lightest part should be changed): ![enter image description here](http://i.stack.imgur.com/v1QhV.jpg) What would be the best/easiest way to achieve this? **Edit:** What I did know is this: In my page.php I added this               <div id="main-content" class="main-content <?php echo "roadkill-main-content"; ?>">      This is working fine (I'm getting another color now). What's missing is how to detect if the current page is child or grandchild or whatever of a page with the slug "project1" or others. What is the correct way to do this?


title: Display one category in one page

text: I have different categories called as reviews, ideas etc. I have a page called as review, I want to display review category to the review page (only review category). Is this possible? Which file I have to change? I have the code below, but it is displaying only the texts not any links to the posts, 7 is my category id.               if( is_page( 'reviews' )){                   query_posts("cat=7" );                }


title: Pagination issue with Single.php

text:
I am having issues understanding the worlds most simplest concept when it comes to building a single.php file and using pagination. The code bellow shows a wordpress loop, its contents and then finally the pagination. How ever, the pagination does not show up for me and looking at twenty 10 theme shows this is how you are suppose to do it....So what's going on? This isn't a custom loop.
     <?php      global $post;     $thumb_nail_args = array(         'align' => 'centered',          'class' => 'thumbnail marginBottom20 marginTop20'     );          if(have_posts()){         while(have_posts()): the_post();         ?>
<?php the_title() ?>

             Written by:                  <a href="<?php echo get_author_posts_url(get_the_author_meta( 'ID' )); ?>">                     <?php the_author_meta('display_name'); ?>

<?php          the_post_thumbnail('full', $thumb_nail_args);         the_content();          ?>
         <?php          endwhile;              ?>

             <?php next_posts_link(); ?>

             <?php previous_posts_link(); ?>

<?php      }          if('open' == $post->comment_status){         comments_template();     }          ?>


title: When to use is_home() vs is_front_page()?

text: I've found that `is_front_page` appears to return true when I'm viewing the home page and have a single sticky post assigned there. It also returns true when I've assigned a page as the static front page via _Settings > Reading_. Why would I ever want to use `is_home()`?


title: WordPress filter to hook into menu <li> items and add a custom attribute

text:
I have a WordPress template (I'm using Foundation as a base and https://github.com/olefredrik/foundationpress/ as a starter theme) I'm trying to build and I can't seem to figure out how to hook into the menu that WordPress outputs and add a custom attribute to that menu's `<li>` tags. The current menu outputs like this:

Home

About

My Work

Contact

      (Those links are just there for sample) I need WordPress to automatically add the following attribute to the `<li>` tags: `data-magellan-arrival="[target]"`. `[Target]` needs to automatically be populated by the page_ID that the menu item corresponds to. So for example, let's say that first's `<li><a href="">[PAGE]</a></li>` link is Home and Home's page_ID is "21" (example). I would need `data-magellan-arrival="[target]"` inside of `<li>` to be set to `data-magellan-arrival="21"`. So it would look like: `<li class="menu-item" data-magellan-arrival="21"><a href="">[PAGE]</a></li>` I'll be honest with you, I'm not that great at PHP just yet and WordPress filters/hooks much less. Hoping someone can point me in the right direction or show me how to do it. Thanks!


title: Custom form action hook

text:
I am writting a simple newsletter subscriber plugin. I created a widget with form:               echo '<form action="'.home_url().'" method="post" name="subscriber_form">';     echo '
<input type="email" name="subscriber_mail" value="" placeholder="'.__('Enter your email','my-text-domain').'" required />
';     echo '<input type="submit" name="subscriber_send" value="'.__('Subscribe','my-text-domain').'" class="Buttons">';     echo '</form>';      I could specify the action directly to the file to handle the form but I need wordpress to be loaded. Is there a hook (like with ajax) to point the form to or is there a way to correctly start the instance of wordpress inside the plugin? Thanks for feedback.