title: Choose custom post type template by category

text: I need to style my portfolio posts with different templates. My thought is that it would be done by category. I have tried using `in_category` and `is_category` and a lot of other work around's but to no avail. The code in my `single.php` file currently is:               <?php if ( '' != locate_template( 'content-'.get_post_type().'.php' ) ) // Check if themplate exists esle get default post content       {          get_template_part( 'content', get_post_type() );       } else {           get_template_part( 'content', 'post' );       }     ?>      And though I seem to understand what its doing can't seem to come up with a conditional allowing it to check the category and returning the template accordingly. What should I do?


title: Filter posts by multiple checkbox categories

text: I would like to set up a widget to filter my post by categories. Let's say, I do have two different categories, "Countries" and "length of stay" with sub categories. Here is an example of what I have:   * Countries     * China     * Laos     * Vietnam   * Length of stay     * 2-4 Days     * 5-7 Days     * 8-10 Days What I want, is to filter posts by multiple categories. So, If the user is checking the country "Laos" and a length of stay of "2-4Days", I would like to retrieve only posts where the category "Laos" AND the category "2-4Days" has been attached. I tried to use the Query Multiple Taxonomies pluging. However, this plugging is retrieving all posts with the "Laos" category and all posts with the length of stay of "2-4Days". I know, that I can filter post with this query, but, I need some help to create this widget with the submit button. Also, I would like to customise it to remove parent categories and display them as a title (remove the checkbox of "Countries" and "Length of stay" and add to them a specific class)? Working query:               <?php     // cat 42=Laos      cat 57=2-4Days     $my_query_1 = new WP_Query(         array(             'category__and' => array(42,57)         )     );     while ($my_query_1->have_posts()) {         $my_query_1->the_post();         ?>         <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">             <?php the_title(); ?><?php the_excerpt(); ?>         </a>         <?php     }      Thanks for helping


title: If child is active add class to parent in customWalker

text: Im writing a customWalker for the wordpress main navigation area. But i am a little stuck on how to find and add a class to the parent of the child which is active. For instance I have the whole customwalker working perfect, all parents have a active class assigned when they are active, but how to I assign an active class to the parent when a sub class is active? I managed to assign a active class to the top depth when current_page_item was given like this:               if($depth === 0){                 $class_names = str_replace('current_page_item', 'active', $class_names);             }      But how would I write it for a child class to show the parent an active when the child is active? Thanks


title: How can i make like this structure?

text: Sorry, i'm newbie user Wordpress. Want a accordion list like this:               News     News 1     News 2     News 3      And when click a accordion item, get image/video slider. How can i make like this? Thank you Sample img: ![enter image description here](http://i.stack.imgur.com/rLn5Z.png)


title: Fatal error: Cannot redeclare comment_theme()

text:
I have this wordpress site build up. In the blog section my post is getting repeated which I do not want how can I get rid of this situation Use this link: http://rymahrice.com/some-energy-drinks-contain-too-much- caffeine-for-kids/ scroll down and you will notice the error and the whole post being repeated. Below is the code:               <?php     /*         The template for displaying Comments.     */     ?>     <?php      function comment_theme($comment, $args, $depth) {         $GLOBALS['comment'] = $comment; ?>         <li <?php comment_class("clearfix"); ?> id="li-comment-<?php comment_ID() ?>">             <div id="comment-<?php comment_ID(); ?>" class="comment_wrap">
                     <?php echo get_avatar($comment,$size='60',$default=''); ?>                     <time class="comment_time"><?php echo get_comment_date(); ?></time>

<?php printf( '%s', get_comment_author_link()) ?>

                         <?php comment_text() ?>                         <?php if ($comment->comment_approved == '0') : ?>                         <?php _e('Your comment is awaiting moderation.', 'fringe_tech') ?>                         <?php endif; ?>                         <?php edit_comment_link(__('(Edit)', 'fringe_tech' ),'  ','') ?>

                         <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>

     <?php     }     ?>
     <?php if ( post_password_required() ) : ?>
<?php _e( 'This post is password protected. Enter the password to view any comments.', 'fringe_tech' ); ?>

     <?php   return;         endif;     ?>          <?php if ( have_comments() ) : ?>
<?php         printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'fringe_tech' ),         number_format_i18n( get_comments_number() ), '' . get_the_title() . '' );         ?>
          <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>

<?php previous_comments_link( __( '← Older Comments', 'fringe_tech' ) ); ?>

<?php next_comments_link( __( 'Newer Comments →', 'fringe_tech' ) ); ?>

     <?php endif; ?>

             <?php wp_list_comments( array( 'callback' => 'comment_theme' ) ); ?>

     <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>

<?php previous_comments_link( __( '← Older Comments', 'fringe_tech' ) ); ?>

<?php next_comments_link( __( 'Newer Comments →', 'fringe_tech' ) ); ?>

     <?php endif; // check for comment navigation ?>          <?php else :         if ( ! comments_open() ) :     ?>
     <?php endif; // end ! comments_open() ?>          <?php endif; // end have_comments() ?>               <?php if ( comments_open() ) { ?>

<?php comment_form_title( __( 'Leave a Reply', 'fringe_tech' ), __( 'Leave a Reply to %s', 'fringe_tech' ) ); ?>

                 <?php cancel_comment_reply_link(); ?>
                  <?php              if ( get_option('comment_registration') && !is_user_logged_in() ) {                 printf( __('
You must be logged in to post a comment.

', 'fringe_tech' ), wp_login_url( get_permalink()) );             } else {              ?>                      <form action="<?php echo site_url( '/wp-comments-post.php' ); ?>" method="post" id="sendform">                          <?php if ( is_user_logged_in() ) { ?>
                         <?php printf( __('Logged in as %2$s.', 'fringe_tech' ), get_option('siteurl'), $user_identity ); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php esc_html_e('Log out of this account', 'fringe_tech'); ?>"><?php esc_html_e('Log out »', 'fringe_tech'); ?>
                          <?php  } else { ?>                                                                                <input type="text" name="author" class="input" id="author" value="<?php if($comment_author != "") { echo $comment_author; } else { echo "Name *"; } ?>" size="22" tabindex="1"  />                                                                                <?php if ($req) esc_html_e('* required', 'fringe_tech'); ?>                                                                                <input type="text" name="email" class="input" id="email" value="<?php if($comment_author_email != "") { echo $comment_author_email; } else { echo "Email *"; } ?>" size="22" tabindex="2" />                                                                                <?php esc_html_e('(will not be published)', 'fringe_tech'); ?> <?php if ($req) esc_html_e('* required', 'fringe_tech'); ?>                                                                                <input type="text" name="url" class="input" id="url" value="<?php if($comment_author_url != "") { echo $comment_author_url; } else { echo "Web Site"; } ?>" size="22" tabindex="3" />                                                                                <?php } ?>                                                                                <textarea class="textarea" name="comment" id="comment" cols="70" rows="10" tabindex="4"><?php esc_html_e('Message *', 'fringe_tech'); ?></textarea>

                                 <span class="small_buttons <?php if ( !is_user_logged_in() ) { ?>send_comment<?php } else { ?>send_comment_admin<?php } ?>">                                     <span class="<?php echo get_option("button_colors", "ocean"); ?>_l small_left"><span class="<?php echo get_option("button_colors", "ocean"); ?>_r small_right"><?php echo get_option("button_post_comment", "Post Comment"); ?>

<?php comment_id_fields(); ?>

                          <?php do_action('comment_form', $post->ID); ?>                      </form>                  <?php } ?>
     <?php }  ?>


title: Possible to paginate on single.php?

text:
I know this sounds illogical and maybe it is, but the client's asked for it so I'm looking into a solution if possible. On a section of the site there's a link that leads to category-news.php, which displays all posts belonging to News. The user loads each of these posts dynamically through the use of InfiniteScroll, with the posts being paginated beforehand. The client has requested to also want this feature when viewing a single post item of the same category (i.e. "View more"). I can't seem to create a pagination for single.php, and would like to know if this is even possible to begin with? What happens now is that I get only 1 additional post beyond the current. Here's the code for single.php so far -               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>     <?php $currentID = get_the_ID(); ?>

         <?php the_post_thumbnail( array(466,9999) ) ?>

<?php the_title() ?>

<?php the_date() ?>

Share
         <?php the_content(); ?>

     <?php endwhile; endif; ?>     <?php     $paged = get_query_var('paged') ? get_query_var('paged') : 1;     $news = new WP_Query( array('cat' => 3, 'paged' => $paged, 'posts_per_page' => 1, 'post__not_in' => array($currentID), 'orderby' => 'date', 'order' => 'DESC') );     while ($news->have_posts()) : $news->the_post();     ?>

         <?php the_post_thumbnail( array(466,9999) ) ?>

<?php the_title() ?>

<?php the_date() ?>

Share
         <?php the_content(); ?>

     <?php endwhile; endif; ?>
<?php next_posts_link('') ?>
      (Running the current post first, then adding a WP Query to retrieve the rest.)


title: update_option creates an option, which empties on a blog reload

text: I am currently writing a plugin that allows all authors to be listed on a page. I've created an options page and wanted to create a function that allows administrators to exclude certain authors from the page. The options page is a list of checkboxes with the Author ID as a value. When the form is submitted, checkboxes are passed as an array to the processing function (which is below), the function combines all the values, and inserts the value into the database using "update_option()".               function wp_applugin_options_process() {             $arr = $_POST["excludeid"];       $excludeid = implode(" ",$arr);       $excludeid = esc_html( $excludeid);            update_option("wp_applugin_excludeids", $excludeid );          }      By default, the "update_option" creates the option, but leaves it empty. However, if I break the plugin, by placing the line "echo get_option("wp_applugin_excludeids")" right after the "update_option" line, not only does it echo the correct values, but the values are also loaded into the database. If I go to a page that doesn't run wp_applugin_options_process, the option "wp_applugin_excludeids" is deleted. Any ideas?


title: sort a custom field base on the date or anything

text:
I'm working on a project right now and I'm facing an issue that is about to freak me out. Basically I had to display information of some courses, in order to do so, I create a custom field called "CourseInfo", that array includes, date, place, and a link to sign in. So the user create that custom field as long as he needs, cause courses can be infinites, however I need to order the output based on the course date and not based on the last custom field created. Since the course date includes month and the year, is there a change to order it basd on the date? I would appreciate any help! Thanks! UPDATE* ***** ------------------------------------------ Basically I'm using this code, maybe it will help                <?php $limit = 1; $courses = array_reverse($courses); foreach ($courses as $course) {                                 $course = nl2br($course);                                 list($date,$city,$link) = explode('
',$course);           echo "
";      echo "
$date
";      echo "
$city
";      echo "
Inschrijven
";      echo "
";           }  ?>      And the page is http://www.otoacademie.nl/dev/rijinstructeur-auto-b/ Notice there is not order. UPDATE===================================================== update dates format ![enter image description here](http://i.stack.imgur.com/xvULQ.png)


title: Get list of all registered sidebars

text: I am registering sidebars automatically for each category (a separate widget space per category). The technique I'm using is **here**. In the admin side I have an options page where I need to display a dropdown of all registered sidebars... Is there are way to dynamically get this list of registered sidebars? since they're being registered in functions.php I assume they're in memory, not in the database. I could keep track of the sidebars I register in some global variable, but just in case plugins register their own sidebars, I'd like to account for them too. I'll dig through the core if I have to, but thought someone might know off- hand:) Thanks


title: Query posts with double taxonomy

text: So I have a custom type called "vendors" and two custom taxonomies for it. One is "state" and the other is "type". I am trying to list all the vendors from a certain state on one page. I'm using the file called "taxonomy-state.php" which works perfectly. It displays all the vendors in the state. Now what I want to do is specify the types of vendors in order. So the page will look something like this: Vendors in "STATE": Vendor Type #1: Vendor #1 Vendor #2 Vendor #3 Vendor Type #2: Vendor #1 Vendor #2 Vendor #3 I got it to display vendors by state. But I need to display them in the above layout. I have an idea of how to do it. But I need to be able to make a query that can get a vendor from a certain state and certain vendor type. Thanks in advanced, Alain


title: More posts from the current author

text: On a multi author WordPress blog I need to show a list with more posts from the current author. The list is inside the Loop, so I can use `<?php the_author_meta('first_name'); ?> <?php the_author_meta('last_name'); ?>` and `<?php the_author_meta('description'); ?>`, but how to retrieve the user's posts?


title: WordPress : using AJAX to get posts & Sidebar Content to an external application

text:
Hello friends I am trying to get my wordpress posts to display in a non- wordpress application. Currently I am getting them by using the following method. My wordPress page is something like this:

          <div id="footer"
      and I am using:               <?php file_get_contents('http://mysite.com/blog'); ?>      It's working ok but there are 2 issues.........   1. It is getting the entire page.   2. My page stops loading till it fetches the wordpress data.  Hence I thought AJAX was the solution. But I don't know AJAX. hence decided to seek help here. What I am looking for is that I just want the output content of #Content Div and #sidebar Div separately so that I can place them in my other application in two different places. I don't even need the CSS or JS as they are common for both my themes. I just want the output and separately placed at 2 different place. Please help.


title: When does wordpress process <!--nextpage-->

text: when does <!--nextpage--> get processed by wordpress filtering. i am adding multiple paged posts in post content on the content_save_pre and this is good for rendering my shortcodes, but <!--nextpage--> doesnt get processed and shows up as an html comment


title: how to get a different html for odd/even posts?

text:
query posts           if posts exist             then begin the loop               if post is even:
title

content
               if post is odd:
its image
      this is what i'm trying to get, a different output for odd/even posts: for even posts we will show the title and the content while for odd posts we will show its image (the thumbnail, for example). How to get this result? I query post in this way               query_posts('category_name=category-name');      then i don't know how to continue


title: Mysterious template change after database import/export

text: When I switch databases from my local environment to the host, some of the pages inexplicably change templates. E.g. there is a custom template "Home" and when I switch the db's it ends up with the template "About". I figure it's something with the post metadata not saving correctly. It gets annoying to check every template to see whether it changed or not. I am using the Advanced Custom Fields and WPML plugins but not sure if this issue is related. Does anyone recognize this issue?


title: WP_rewrite static Page URLs

text: Just moved over from blogger to wordpress. To try and maintain old URLs, and respective comments etc I've changed the site URL in the wordpress settings to match the old blogger format which was http://blog.myURL.com/some-post-title. This works great.....but... What I want to do is change the URL structure of the 5 or so static pages, contact, about, home etc to be the root www.myURL.com/about, www.myURL.com/contact and NOT blog.myURL.com/about I have been trying all sorts of multisite, htaccess stuff and now WP_rewrite but I am at the end of my tether!! Help would be greatly, greatly appreciated!!


title: Redirect not working

text: I want to redirect the http://xyz.com/freebooks/ to http://xyz.com/shop/?min_price=0&max_price=0 I added this to the .htaccess and it redirects to the shop page but doesn't retain the /freebooks/ or filters like the original url. **.htaccees** :               RewriteEngine On     RewriteRule ^freebooks$ index.php?p=5&min_price=0&max_price=0  [NC,L]          # BEGIN WordPress          <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      Resulting URL: `xyz.com/shop/` Expected URL: `xyz.com/freeabooks` (with the shop showing only freebooks)


title: Why WordPress automatic cropping all my images?

text: Am new to WordPress, when I upload any image, WordPress automatic crops into its own sizes which I have not mention in the media section (Settings » Media). Settings which I saved in media is:   ![Setting which i saved in media.](http://i.stack.imgur.com/6Gl0k.jpg) And when I check in the directory it crop automatically into these sizes:   ![enter image description here](http://i.stack.imgur.com/rzV8O.jpg) How this thing is happening?


title: Undefined index: id, when I save the options

text: I'm making a Wordpress theme and I get these 'Notices' repeated a lot of times when I save the options using the WP_DEBUG:               Notice: Undefined index: id in /var/www/Seozeta/wp-content/themes/seozeta/seozeta-options.php on line 997     Notice: Undefined index: id in /var/www/Seozeta/wp-content/themes/seozeta/seozeta-options.php on line 1000      The code is this:               foreach ($options as $value) {             if (isset($_REQUEST[ $value['id'] ] ) ) { //#997             update_option( $value['id'], $_REQUEST[ $value['id'] ]  );          } else {              delete_option( $value['id'] ); //#1000         }      }      It seems the initial **isset** should work and fix the problem, but it is not. I numbered the lines affected using the comments in PHP. What am I doing wrong? Any suggestions?


title: Vagrantpress + composer

text: I was looking at the roots.io blog, where I learned about Vagrant and Composer which in combination seem to give you a more intelligent development environment and dependency management system. I choose to get and install Vagrantpress since it seems like the easiest way to get started with wordpress + vagrant. The plus of Vagrantpress is that it installs Wordpress and all its dependencies for you. As I understand Composer in adjunction with Wordpress, is that the easiest way to combine the two is to use the Outlandishs WordPress Packagist. Now my question is, how are people using Composer and Vagrantpress tougher? How does your setup look like? Are there any good examples of composer.json file + Vagrantfile for Vagrantpress? /PS: If someone with enough rep could create the Vagrant and composer tags that would be great. No relevant tags really exist, but I hope the question is relevant enough.


title: How do I insert a new meta key / value pair, but only if another meta key is present?

text: I need to add a new meta key and value part only on posts where another key is present (regardless of its value). I tried to use a query to automate it, but my SQL is quite limited Here's what I tried:               INSERT INTO wp_postmeta (post_id, meta_key, meta_value)     SELECT     (SELECT meta.post_id     FROM `wp_postmeta` meta     INNER JOIN wp_posts posts ON meta.post_id = posts.id     WHERE meta.meta_key = 'existingkey'),     ('newkey'),     ('newvalue')      It returns the `#1242 - Subquery returns more than 1 row` error.


title: Knowing the total number of posts before to get into the loop

text: Is there a way to know the total number of posts before the loop starts? I'm thinking in use two loops. The first will do the counting, while the second one will handle the content. However, I don't think this approach is 'elegant'. Any other solutions?


title: Is it possible to upload multiple images via Media Library tab in Thickbox I've created?

text: I have a meta box upload button and I want to upload multiple images using that button. Firstly I enqueue required scripts:               add_action( 'admin_print_scripts-post-new.php', 'mycpt_admin_script', 11 );     add_action( 'admin_print_scripts-post.php', 'mycpt_admin_script', 11 );          function portfolio_admin_script() {         global $post_type;         if( 'mycpt' == $post_type )         wp_enqueue_script( 'mycpt-script', get_stylesheet_directory_uri() . 'mycpt.js' );         wp_enqueue_script('media-upload');         wp_enqueue_script('thickbox');     }      mycpt.js looks like:               jQuery(document).ready(function() {        jQuery('#cptbutton').click(function() {            tb_show('', 'media-upload.php?type=image&TB_iframe=true');            return false;        });     });      And then I just simply add meta box with this button:               <input id="cptbutton" type="button" value="Upload Image" />      Of course when I click it the Thickbox pops up with: >  Drop files here or > >     [ Select Files ] Plot twist - the files are already on the server (so I don't want to upload them all over again for every other post) and I want to just attach them to current post via Media Library tab: ![Media Library](http://i.stack.imgur.com/wEznI.png) When I click on any of these above and click "Insert into Post" it just adds one image, and it's over. How to select multiple images from Media Library? Is it even possible or my logic is wrong and I have to try something else? In short words - I want to upload / attach images for post's sidebar (it's replacing Featured Images). I'd love to just drag & drop multiple images or select multiple images from Media Library although I have no idea how to do that? I don't want to use Gallery.


title: How can I highlight a top level dashboard menu item created for a custom taxonomy?

text: I've used `add_menu_page()` to create a top-level dashboard menu item for a custom taxonomy. This is due to some specific needs with respect to this plugin. The menu item works fine, but when you click it, the Posts menu opens. I've tried to hook the `parent_file` filter to change that and the best I've been able to accomplish is to ensure that no menu appears.               add_action("admin_menu", "add_bureau_menu_item");     add_filter("parent_file", "fix_bureau_tax_parent");          public function add_bureau_menu_item() {         $tax = get_taxonomy("bureau");         add_menu_page("Bureaus", "Bureaus", "read", "edit-tags.php?taxonomy=" . $tax->name, "", "", 20);     }          public function fix_bureau_tax_parent($parent="") {         global $pagenow;         $tax = get_taxonomy("bureau");         if(!empty($_GET["taxonomy"]) && $_GET["taxonomy"]==$tax->name && $pagenow=="edit-tags.php") $parent = "edit-tags.php?taxonomy=" . $tax->name;         return $parent;     }      So, here's the question: is there a way to highlight a menu item created with `add_menu_page()` using the `parent_file` filter?


title: No option "I would like my site to be private, visible only to users I choose" in Privacy Settings

text: I am running WordPress 3.3.2 self-hosted. I used to see the option "I would like my site to be private, visible only to users I choose" under Privacy Settings but I no longer see this option. Instead, now I only see the options to make the blog visible or not visible to search engines, but no way to make it private. I have already tried deactivating all plugins and setting to a basic theme (Twenty Eleven 1.3) to see if my plugins or theme were causing a problem, but still do not see the old option. Any tips much appreciated!


title: How to change images size after theme modification?

text: The images in the previous theme were using a height and width listed in the source html. The new theme will resize the images using percentages, so I need to remove all the height and width in the source html. All images have a specific size.   1. How to remove the height and width when you have an installation with more than 500 posts?    2. How to deal with captions id and size?


title: How to display a sized image from Simple Fields repeatable field

text:
I'm using the Simple Fields plugin (http://wordpress.org/plugins/simple- fields/) and am having the hardest time creating a slideshow from a repeatable field group. I've tried piecing everything that I could find from the documentation and from others who have had similar issues, but everything I try results in an "invalid argument" or no image src returned. This code is working, but I need to know how to tell it to display the 'large' size image:
         <?php             $slideshow_repeat = simple_fields_get_post_group_values(get_the_id(),"Slideshow", true, 2);                 foreach ( $slideshow_repeat as $slide ) {                     $image_src = wp_get_attachment_image_src($slide['Slide']);         ?>
             <img src="<?php echo $image_src[0]; ?>" alt="<?php echo $slide['Title']; ?>"/>
<?php echo $slide['Title']; ?>

<?php echo $slide['Caption']; ?>

<?php echo $slide['Image Credit']; ?>

              <?php             }         ?>
      If anyone can help, I'd really appreciate it.


title: Change text "My Basket" in woocommerce artificer theme

text: I am working with the woocommerce artificer theme and there is a place in the header where it says "My Basket" and then the amount that is in your cart. ![enter image description here](http://i.stack.imgur.com/CvA0S.png)   I would like to change the text to say "My Cart". I have looked around. I even found a post on here where the poster shows where the files come from the post can be found here: Change My Basket text in the header of WooCommerce Artificer theme I went into the theme-woocommerce file that they talk about and changed the text, although it did not change on the page. I went to the function woocommerce_cart_link() and I deleted everything in the function except: `<a href="" class="cart-button "> </a>` And the stupid My Basket thing still came up. I delete the class="cart-button " and the button disappears. Is there a hook on the class or how can I find the source so I can get this working? I would like to get the "My Basket" text to say "My Cart" and eventually I will try and change that thing to the left that looks like a cardboard box. Thanks for the help.


title: Get data from 3rd table

text: I have 3 tables:   * wp_posts   * wp_metadata   * users When I get my query from `wp_posts` I'm using `LEFT JOIN` to get the data from the `wp_metadata`, but how can I get a value from the 3rd table `users`? Example: I have one post on my WordPress blog. On that post I have some meta-fields - one of them is called `userid`. My users are located in a table outside of WordPress. How can I get the user's username from the table `users` where the post-meta-key `userid` is equal to the `users`-tables row ID? Here is my SQL-request as it is right now:               $result = query("     SELECT ID, post_title, post_excerpt, post_content,             m.meta_value AS placeid,             i.meta_value AS photoid,             r.meta_value AS rating,             u.meta_value AS userid,             b.username      FROM wp_posts p             LEFT JOIN wp_postmeta m ON (m.post_id = p.ID)             LEFT JOIN wp_postmeta i ON (i.post_id = p.ID)             LEFT JOIN wp_postmeta r ON (r.post_id = p.ID)             JOIN wp_postmeta u ON (u.post_id = p.ID)             LEFT JOIN brugere b ON (b.id = userid)      WHERE m.meta_key = 'placeid'             AND i.meta_key = 'photoid'             AND r.meta_key = 'rating'             AND u.meta_key = 'userid'             AND post_status = 'publish'      ORDER BY ID DESC      LIMIT 50     ");      I want _one_ query, because I'm using the query on a `print json_encode`.


title: BuddyPress: Conditionally filter directory based on Xprofile Field

text: **Members Loop Query** `<?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?>` **Question: How can this function be integrated into the members loop so that Female members are served a directory of males and male members are served a directory of females?****                   <?php          class BP_Custom_User_Ids {              private $custom_ids = array();              public function __construct() {                  $this->custom_ids = $this->get_custom_ids();                  add_action( 'bp_pre_user_query_construct',  array( $this, 'custom_members_query' ), 1, 1 );             add_filter( 'bp_get_total_member_count',    array( $this, 'custom_members_count' ), 1, 1 );              }              private function get_custom_ids() {             global $wpdb;                  // collection based on an xprofile field             $custom_ids = $wpdb->get_col("SELECT user_id FROM {$wpdb->prefix}bp_xprofile_data WHERE field_id = 5 AND value = 'Female'");                       return $custom_ids;         }                function custom_members_query( $query_array ) {                  $query_array->query_vars['include'] = $this->custom_ids;              }                function custom_members_count ( $count ) {                  $new_count = count( $this->custom_ids );             return $count - $new_count;              }     }          function custom_user_ids( ) {              new BP_Custom_User_Ids ();          }          add_action( 'bp_before_directory_members', 'custom_user_ids' );      **Example:**               if {current user is "female" (filter members loop to show only males)}               else if {current user is  "male" (filter loop to show only females)}


title: update_post_meta array issues

text: I am not sure what I am doing wrong here and would appreciate the help I have an array the looks like this:               Array     (         [85369] => 3         [85368] => 13         [85378] => 23     )      When I try to update the database with               update_post_meta( $id, 'key', $MyArr);      in the databse the array is not stored. What is stored is:               a:0:{}      Any help would be appreciated Full Code:               function distance($lat1, $lng1, $lat2, $lng2, $unit) {     $theta = $lng1 - $lng2;     $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));     $dist = acos($dist);     $dist = rad2deg($dist);     $miles = $dist * 60 * 1.1515;     $unit = strtoupper($unit);         if($unit == "K"){         return round ( ($miles * 1.609344) );         }elseif ($unit == "N"){         return round ( ($miles * 0.8684) );         }else{         return round ( $miles );         }     }          $MilesArray = array();     $bounding_distance = 1;     $nearbys = $wpdb->get_results(              "              SELECT *                FROM rvty_geodata              WHERE (                     geo_latitude BETWEEN ($lat - $bounding_distance) AND ($lat + $bounding_distance) AND geo_longitude BETWEEN ($lng - $bounding_distance) AND ($lng + $bounding_distance)                  )             "     );            foreach ($nearbys as $nearby) {         $alt_id = $nearby->post_id;         $alt_lat = $nearby->geo_latitude;         $alt_lng = $nearby->geo_longitude;         if ($rvparks->ID != $alt_id) {             $Miles = distance($lat, $lng, $alt_lat, $alt_lng, "M");             $MilesArray[$alt_id] = $Miles;         }     }      asort($MilesArray);     if(count($MilesArray)>10){         $MilesArrayChunk = array_chunk($MilesArray, 10, true);         $ALTCGArray = $MilesArrayChunk[0];      }else{         $ALTCGArray = $MilesArray;     }     update_post_meta( $rvparks_id, 'alt_camps', $ALTCGArray);


title: Woocommerce + Show a menu with only the active category and sub-category

text: I have a menu structure that looks like this: Categorie 1   - Sub Category   - Sub Category   Categorie 2   - Sub Category   - Sub Category   Categorie 3 But I only want to show the active category with it's subcategories on the product archive and product detail pages. Like this:   Category 3   - Sub Cat   - Sub Cat The woocommerce widget shows all the categories and only the subcategories from the active category so I think it's not that hard to fix it but I can't find a solution on the internet (I fixed it by making different custom menu's and an if else function but with products in multiple categories it doesn't work well.)


title: show a nextgen gallery in a new page using custom theme

text:
I am using NextCellent Gallery plugin and a custom theme. I created an Album, Gallery and wish to display the gallery in a new page. The gallery displays in the same page when `gallery>options>gallery settings>deactivate gallery page link` is selected. When the option is deselected the gallery displays as expected using the Twentythirteen theme. In the Wordpress dashboard under `gallery>manage gallery>create new page` I click the add page button for each gallery but none show using my custom theme. I don't know if I need to create a custom gallery, custom template or modify the page.php to get the galleries to display. I create a page Using a custom template `var_dump($gallery)` displays as null.               <?php      /*     Template Name: Gallery Template     */     ?>     <?php get_header(); ?>     <?php var_dump($gallery) ?>     <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($gallery)) : ?>

<?php echo $gallery->title; ?>

              <?php foreach($images as $image): ?>             <img src="<?php echo $image->imageURL; ?>" alt="<?php echo $image->alttext;?>">         <?php endforeach; ?>
          .     .     .     .          <?php endif; ?>          <?php get_footer(); ?>      I sense I am only missing one or two functions but after two weeks of trying no longer know where to look.


title: How to remove date in Recent Post widget?

text: I am stuck with this. I open the file default_widget.php inside wp-icludes folder, i want to remove the date displayed by the default recent post widget. I cannot find it! Pls help!!


title: creating a foreign key like relationship with custom post types

text: I am currently building a website, that is heavily reliant on custom post types, 2 of my custom post types are "Clients" and "Case Studies", now what I am wanting is a way to create a dropdown in the "Case Studies" custom post type so that I can select from the Clients that have already been added to the site? Is this possible, I assume it would be similar creating a relationship in database, and then pulling in the clients from the clients and table and placing them in a `<select>`.


title: List one post only from each subcategory using get_posts?

text:
Custom Post Type = 'projects' with a Hierarchical Taxonomy = 'projects_category'               projects     - big-corporates     -- company one     ---- first project 1     ---- second project 1     ---- third project 1     -- company two     ---- first project 2     ---- second project 2     -- company three     ---- first project 3     ---- second project 3     ---- third project 3     - small-businesses     -- company four     ---- first project 4     ---- etc...     -- company five     -- company six Below I get a list of all projects listed in 'projects_category' under 'big- corporates' whereas I want to limit the list to just one project from each subcategory of 'big-corporates'.               <?php         global $post;         $args = array( 'post_type' => 'projects', 'projects_category' => 'big-corporates' );         $myposts = get_posts( $args );         foreach( $myposts as $post ) :  setup_postdata($post); ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php #the_title(); ?><?php $terms = get_the_term_list( $post->ID, 'projects_category' ); $terms = strip_tags( $terms ); echo $terms; ?>
         <?php endforeach; ?>      I am trying to achieve a list like this:               company one (links to first project 1)     company two (links to first project 2)     company three (links to first project 3) How can I do that?


title: check if a comment was made by a registered user

text: Is there any _Conditional Tag_ to check whether a comment is made by registered user or not?


title: Get category id for a custom category and display it in a class

text:
I am having trouble displaying my custom category ID to my li ID. The code I am using below is displaying the post ID of the post category instead of the custom category. What I am trying to do is assign a ID for each custom category that is assigned to the post. With each category having a different ID I will be able to assign a style to each one. How would I go about assigning a different ID or category ID to my li?                <?php $taxonomy = 'post_tools'; $terms = get_terms($taxonomy); if ( $terms && !is_wp_error( $terms ) ) :?>
                   <?php foreach ( $terms as $term ) { ?>                   <li id="tools-<?php $cat_id = $cat->cat_ID; ?>"><?php echo $term->name; ?>
       <?php } ?>
       <?php endif;?>


title: Allow user to create instances of custom field

text: I have a custom field for a links page which takes a name and an URL and saves it in the post meta. However, I want the user to be able to click "Add new link" and a new custom box appears so they can essentially have unlimited links. Ideally a plugin would be perfect, or any tips into which techniques I should look at. Thanks so much


title: Wordpress administration Over SSL - To Force SSL Logins and SSL Admin Access

text: I have a plan to enable SSL to admin login of my wordpress site, Is it a best practice? What will be the behavior of plugins? What are the pros and cons of my decision?


title: Add log in link to menu in Twenty Twelve

text: I can't find a way to add the log in link to the new theme of WordPress, Twenty Twelve. I did find a lot of answers on the older theme, where they suggest to add some code in the `functions.php` file. However, this do not work for me. Does anyone have a solution for this? You can see my homepage here: http://musikfest.dk/kursus/


title: Allow contributor role to upload images and not edit already published articles

text: I have the following two requirements:   1. I want to allow users with the contributor role to upload media (images mostly) in their posts and preferably they shouldn't be able to delete existing ones before submitting it for review.   2. I want to make sure once an article is published that it can't be edited by the contributor (the writer of the plugin with user role contributor) or if it can be edited the newer version isn't updated before going through a submission process. I was recommended the Role Scoper plugin but I couldn't figure out how to do it. Any information about any other plugin or how to do this in Role Scoper would be great.


title: Add code just after Post content

text:
I am in a bit of dilemma here so bare with me. I want to add something like this code just after the content in a post:
Please let me know what you think by leaving a comment!
      To do this, I edited `single.php` and added it after the content. However, the problem is that many of my posts are separated in several pages by using `<!-- nextpage-->` and the above code is displayed on **every page**. I want that line to be displayed only at the final page if the post is separated. How is such thing possible?


title: how to make wordpress not to look for themes

text: For a particular project, I'm currently using only wp's admin and core functions/sugars, so no themes. Still, I'm forced to choose a theme. I would like a couple of things:   1. move theme's functions.php (that currently contains only custom code by me) in /wp-contents, outside the themes and make WP still load it    2. force WP not to look for themes, so I can succefully delete the themes folder without getting an error in wp-admin Is this possible? What's the best way (without hacking the core)? Point 2 is less crucial, since I can always hide the admin's themes button. Point 1 is important. For point 1, maybe I could load functions at the end of wp-config.php, or maybe (still in wp-config) I could hook at 'init' or 'setup_theme'. Or maybe something else.. I'd like to know the best practice here. thank you


title: Does WP suppresses .htaccess if permalinks are disabled?

text: I would like to use a .htaccess file, but still use the default link structure of WP. I didn't turn on permalinks, but did create my own .htaccess file. To my surprise, the file is being completely ignored by WP (and the server). I thought that .htaccess takes effect right on apache and before PHP runs, so how can it be that the file is ignored? I need this to redirect some URLs from the old website to the new one to prevent SEO juice loss (SEO's person definition :). Any idea how to "enable" the .htaccess functionality without enabling permalinks? Currently what ever I do is ignored, even no 500 error for just giberishing the file... Thanks!


title: How do I remove the RSS Feed Redirect?

text: Currently all the feed URL's for our site forward to /feed/ For example: www.wgel.net/feed/rss2/ forwards to www.wgel.net/feed/ The problem is that /feed/ is ATOM format and I need to get the RSS2 format because we are trying to pull from our feed into Contstant Contact. CC says they need an RSS2 formatted feed, when I give them our current feed address the system errors out and says it's invalid. So something is causing a forward from /rss2/ that I think I need to turn off? Checked the httaccess file and there is nothing in there. Any help is greatly appreciated. Thanks, Dan


title: enable TinyMCE for comment forms

text: Is there any way in Wordpress to use a richt-text-editor (preferable the build in TinyMCE) on the comment form textarea in the frontend? I had such a feature in earlier versions, using the plugin "TinyMCEComment", but that one is not developed any further and is broken on 3.x versions. I've tried all related plugins on a Wordpress 3.4 installation, none of them is working (e.g. can't insert links, missing labels, …). I also tried several ways of creating a plugin to enable the RTE for comments, like adding the the JS code manually. My last approach looked like:               function commentTinyMCE() {              wp_editor( '', 'comment', array(             'media_buttons' => false,             'teeny' => true,         ) );          }          /* hook into WordPress */     add_action('wp_footer', 'commentTinyMCE' );      As of what I could say after debugging is, that the function `wp_editor` does nothing. Right now it seems to me, that is it impossible to integrate a useful, working RTE into the comment forms. Quicktags above the form is not what my customers are after. Any help would be appreciated.


title: http_response_timeout filter not working

text: I am writing a Wordpress plugin that makes calls to external sites. I want to raise the timeout for all `wp_remote_*` calls, so I added the following to the `__construct` function of my plugin:               add_filter("http_response_timeout", function($timeout) { return 30; });      But the calls still time out after 5 seconds. I also tried using a separate function as the second argument, same result. When I pass `array("timeout" => 30)` to the `wp_remote_*` functions directly, it works... Any idea why the filter is not respected?


title: After updating site to use SSL all images in posts point to http://

text: I recently upgrade my site to use SSL through a reverse proxy. I have changed the WordPress address and site address in the Settings menu and the main page loads just fine: https://www.scotthelme.co.uk If you click through to one of my posts however you get mixed content warnings on the SSL certificate: https://www.scotthelme.co.uk/wifi-pineapple-karma- sslstrip/ I see the images on the page are still pointing to the http:// URL they were added with but I would have thought that my redirect would force them to be served over https://, this doesn't seem to be the case. Either way I'm happy to rewrite them to protocol relative URLs, I'm just not sure on the best way. How is it best to go about changing the URLs for the images in posts?


title: Add an option to a Child theme of Twenty Eleven

text: I developed a child theme of Twenty Eleven. I need additional theme options, so i added a theme-options.php file inside my child theme's folder. However, it appears the option page is still the 2011 theme's option screen. I can't either replace or add another one. Question: what is the correct procedure to add options to a child theme? In case you wish to see the code, here is my theme-options.php code.


title: Query post for 'selected category' in archive.php

text: I'm trying to figure out how to display a `'featured post'` on a selected category archive. My website uses the category-based navigation for different types of posts (text only post-blog, and image only gallery post), and is driven by a single custom archive.php. >   * Homepage: http://example.com/portfoliography >   * Auto gallery: http://example.com/portfoliography.com/automotive >   * Architecture gallery: http://example.com/portfoliography/architecture >   * (... and so on) > They all uses a single `archive.php`, and it works wonderfully to display category-specific images. See the current code here **What I'd like to achieve is to** > query for the latest post only for the selected category, and feature it on > top of the thumbnails as a slideshow like the one from the homepage. *) *) latest post in automotive for automotive category archive, latest post in architecture for architecture category, so on… My beginner's hack from a few goolge search can be seen here. But the said code generates a slideshow using images from posts in every category. Any help would be much appreciated.


title: Extending WP's upload/insert media functionality

text: I am writing my first plugin to upload PDF files to a user specified directory other than the media directory specified in the Media menu under settings. I need to extend the WP's native uploader so that files of a particular type in this case PDFs are uploaded to a different directory unlike images. In addition files uploaded in this user defined directory should be viewable in the native upload/insert window whenever the need arises to insert them into a page or a post. Is it possible to extend WP's native uploader through a plugin or would I have to design my own uploader? This seems to be overkill for just one type of file considering that there is already an excellent uploader available. I do not think that delving into WP's code and changing it is an option. Thanks in advance.


title: How to add script right after <head>?

text: I would like to know is it possible to add script right after head tag? I don't want to use add_action('wp_head','function'); So here is the case:   * I have custom fields values for example 'this is the custom field value'   * I want to echo it after head tag   * I want to echo it using functions.php   * I don't want to change any code on my Wordpress theme so it will be               <head>     this is custom field value     --     --     <?php wp_head(); ?>      Thanks in advance, Aprillins Fox


title: Generate WordPress Theme from GitHub Repository

text: How do I generate a WordPress theme based on my GitHub repository? http://underscores.me is what I want to replicate. Here is a link to the GitHub repot: https://github.com/Automattic/_s I wish to use my own "foundation" theme.


title: SSL via different domain & path with NGINX/PHP-FPM/WP

text: I am going to be hosting several WordPress blogs. They are all going to have their own domains. I want to handle their administrative functions via SSL but I do no want to buy an SSL certificate for each of them, since the only thing on them using SSL will be the admin page. I want to have the following configuration instead:   * http:// blogdomainx.com/   * http:// blogdomainy.com/   * http:// blogdomainz.com/ each of which lives in /srv/(folder) so:   * /srv/blogdomainx.com   * /srv/blogdomainy.com   * /srv/blogdomainz.com and I would like to admin them via https on mylinode.mydomain.com via these urls:   * https:// mylinodehost.mydomain.com/blogdomainx/wp-admin   * https:// mylinodehost.mydomain.com/blogdomainy/wp-admin   * https:// mylinodehost.mydomain.com/blogdomainz/wp-admin where mylinodehost.mydomain.com has an actual SSL certificate and is configured to use SSL already (for nginx as well as a few other services it runs). It is hosted in: /srv/mylinodehost I've tried accomplishing this by symlinking: ln -s /srv/blogdomainx /srv/mylinodehost/blogdomainx as well as via locations in the nginx.conf file. The admin pages always seem to work, but the root of the site (which I need to be able to see via https on that same domain for some administrative functions) is always in this zombie state where it displays a wordpress-generated (themed and everything) 404. I've tried following the directions on Use a different domain for SSL from TheDeadMedic, and that got me closer - the themes render properly but I still get a 404. I also don't even really understand why WordPress is handling the 404 when I have a directive telling nginx that the 404 should be a static HTML page. I've also tried the http://wordpress.org/extend/plugins/wordpress-https/ plugin with the same results as using the method TheDeadMedic suggested. Diving in further, I find the following in the strace on php-fpm:               poll([{fd=4, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)     write(4, "\231\0\0\0\3SELECT t.*, tt.* FROM wp_te"..., 157) = 157     read(4, "\1\0\0\1\n?\0\0\2\3def\22myblogdb_wp"..., 16384) = 763     poll([{fd=4, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)     write(4, "\230\0\0\0\3SELECT t.*, tt.* FROM wp_te"..., 156) = 156     read(4, "\1\0\0\1\n?\0\0\2\3def\22myblogdb_wp"..., 16384) = 763     poll([{fd=4, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)     write(4, "\230\0\0\0\3SELECT t.*, tt.* FROM wp_te"..., 156) = 156     read(4, "\1\0\0\1\n?\0\0\2\3def\22myblogdb_wp"..., 16384) = 763     poll([{fd=4, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)     write(4, "\205\0\0\0\3SELECT t.*, tt.* FROM wp_te"..., 137) = 137     read(4, "\1\0\0\1\n?\0\0\2\3def\22myblogdb_wp"..., 16384) = 763     poll([{fd=4, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)     write(4, "\177\0\0\0\3SELECT * FROM wp_posts  WHE"..., 131) = 131     read(4, "\1\0\0\1\27<\0\0\2\3def\22myblogdb_wp"..., 16384) = 3055      Shortly after that, it writes a 404 to the web server. To me it seems like a MySQL timeout but why would mysql timeout on one site and not another, on the same box in the same nginx process and mysql process? Is this a fools errand? I can buy an SSL cert (or put on a self signed) for this blog domain but I was planning on doing this for several others and so I'd really like to get this working under the one domain. Any help would be much appreciated, and let me know if I can provide additional information that might be helpful.


title: Should I cache default WordPress gallery shortcode output?

text: I'm overriding default WordPress gallery like so:                  add_filter( 'post_gallery', 'my_gallery_shortcode'), 12, 2 );             function my_gallery_shortcode($output, $attr) {              // some modifications to output here                   return $output;        }      Modifications to $output have average complexity, can't say that they take too much or too low processing time. My question, should I cache $output via transients? If yes, what's the best way to get key for set_transient?


title: Add a default meta_value to new posts

text:
I have a page template that allows users to create and update posts from the front end. I also am using 2 plugins, 1 that allows the user to rate posts from 1-5 stars and another that allows them to favorite the posts. I also have a page to allows the user to toggle between sorting the posts by date/category/post-type/etc. You can see the page here: http://www.theseattlevine.com/the-vine/ The problem is, if I sort the posts by either the star rating or by the number of favorites it has, Wordpress only returns posts that have that meta value and does NOT show posts that have not yet received it. With that being said, I need to do 1 of 2 things:   1. Automatically set the meta value to a default value when the post is created or   2. Alter the wp_query to also show posts that do not yet have the value. Anyone know how I can do either of these things? I prefer #1, but either will work. Here is the page template code, if that's useful.                       <?php              /**          * Template Name: New UserPost          *           * A Page template for Submitting User Post             *           */         if(!is_user_logged_in()){             header("location:". esc_url(home_url('')));             ?>                      <?PHP             die('');         }                   wp_enqueue_script('jquery');              function add_header(){             ?>         <link rel="stylesheet" type="text/css"                href="<?PHP bloginfo('template_directory'); ?>/css/redmond/jquery-ui-1.9.1.custom.min.css" />                                    <link rel="stylesheet" type="text/css" href="<?PHP bloginfo('template_directory'); ?>/fancybox/jquery.fancybox-1.3.4.css" media="screen" />                      <?PHP         }              add_action('wp_head','add_header');         switch($_REQUEST['req']){                  case 'delete_attach':                      $attachment_id = $_REQUEST['aid'];                 wp_delete_post($attachment_id,TRUE);                 die('');                 break;             case 'discard_post':                 $post_id = $_REQUEST['post_id'];                 wp_delete_post($post_id,TRUE);                 ?>                             <?PHP                die('');                break;            case 'get_featured_image':                $featured_img = $_REQUEST['featured_img_id'];                echo wp_get_attachment_image($featured_img, array(100,100));                die('');                break;            case 'publish':            case 'save_draft':            case 'post_preview':                       $error_flag    = FALSE;             $error_message = array();             $post_id       = $_REQUEST['post_id'];             $categories    = array($_REQUEST['cat']);             $featured_img  = $_REQUEST['featured_img_id'];             /**              * Validation Step(s)              */             if(empty($_REQUEST['user_post_title'])){                 $error_flag = TRUE;                 $error_msg[]=array(                     'key'      => 'error_user_post_title',                     'value'    => __('Please enter a title','tsv'),                 );             }elseif(strlen($_REQUEST['user_post_title'])>125){                 $error_flag = TRUE;                 $error_msg[]=array(                     'key'      => 'error_user_post_title',                     'value'    => __('Please enter a title with less then 125 characters','tsv'),                 );             }             if(empty($_REQUEST['user_post_summary'])){                 $error_flag = TRUE;                 $error_msg[]=array(                     'key'      => 'error_user_post_summary',                     'value'    => __('Please enter a short summary of the post','tsv'),                 );             }elseif(strlen($_REQUEST['user_post_summary'])>250){                 $error_flag = TRUE;                 $error_msg[]=array(                     'key'      => 'error_user_post_summary',                     'value'    => __('Please enter a summary with less then 250 characters','tsv'),                 );             }                  if(empty($_REQUEST['user_post_content'])){                 $error_flag = TRUE;                 $error_msg[]=array(                     'key'      => 'error_user_post_content',                     'value'    => __('Please enter some content','tsv'),                 );             }                  if(empty($_REQUEST['cat']) || $_REQUEST['cat']==-1){                 $error_flag = TRUE;                 $error_msg[]=array(                     'key'      => 'error_cat',                     'value'    => __('Please choose a category','tsv'),                 );             }                  if(count($error_msg)>0 && $error_flag){                 ?>                                  <?PHP             }else{                 $post_param = array(                     'post_content'   => $_REQUEST['user_post_content'],                     'post_title'     => $_REQUEST['user_post_title'],                     'post_excerpt'     => $_REQUEST['user_post_summary'],                     'post_type'      => 'tsv_userpost',                     'tax_input'      => array('category'=>$categories)                 );                      if(!empty($_REQUEST['user_post_tags'])){                     $post_param['tags_input'] = array_slice(explode(",", $_REQUEST['user_post_tags']),0,5);                 }                      if($post_id!=-1){                     $post_param['ID']=$post_id;                 }                 /**                  * Action Based on The Button Pressed                  */                 switch($_REQUEST['req']){                     case 'publish':                         $post_param['post_status'] = 'publish';                         $new_post_id=wp_insert_post($post_param);                         ?>                                                  <?PHP                         break;                     case 'save_draft':                               $post_param['post_status'] = 'draft';                          $new_post_id=wp_insert_post($post_param);                               ?>                                                  <?PHP                         break;                     case 'post_preview':                          $post_param['post_status'] = 'draft';                          $new_post_id=wp_insert_post($post_param);                          ?>                                                  <?PHP                         break;                 }                      if($featured_img!=-1){                     update_post_meta($new_post_id,'_thumbnail_id',$featured_img);                 }else{                     delete_post_meta($new_post_id,'_thumbnail_id');                 }             }             die('');             break;         }              global $current_user;         get_currentuserinfo();              if(isset($_GET['post_id'])){             $post_id  = $_GET['post_id'];             $post_obj = get_post($post_id);             if($post_obj->post_author!=$current_user->ID){                 header("location:" . esc_url(home_url('')));                 die('');             }else{                 $featured_img_id = get_post_meta($post_id,'_thumbnail_id',TRUE);                 if(empty($featured_img_id)){                     $featured_img_id = -1;                 }             }         }else{             $post_id = -1; // -1 Will be for New Post             $featured_img_id = -1;         }                   get_header();         ?>

                          <?php userpost_menu(); ?>                        <form action="" method="post" name="" id="tsv_user_post_form" enctype="multipart/form-data" >             <input placeholder="Enter Your Title..." type="text"                     value="<?PHP echo ((!empty($post_obj->post_title))?$post_obj->post_title:''); ?>" name="user_post_title" id="user_post_title" class="inputwide" />             Max 125 characters

                  <input placeholder="Enter short description..." type="text"                     value="<?PHP echo ((!empty($post_obj->post_excerpt))?$post_obj->post_excerpt:''); ?>" name="user_post_summary" id="user_post_summary" class="inputwide" />             Max 250 characters

                            <?php              $cat_ids = array(90,91,92,93,94);             $user_cats = array (                     'include' => implode(",", $cat_ids), //Only shows these 5 categories                     'hide_empty' => 0,                      'show_option_none' =>'Choose category:',                     'sort_by'=>'name',              );             $tag_str = NULL;             if(!empty($post_obj)){                 $categories = wp_get_post_categories($post_obj->ID);                 $tags       = wp_get_post_tags($post_obj->ID,array('fields'=>'all'));                 if(count($categories)>0){                     foreach($categories as $cat) {                         if(in_array($cat, $cat_ids)){                             $user_cats['selected'] = $cat;                         }                     }                 }                 if(count($tags)>0){                          foreach($tags as $tag) {                         $tag_str[] = $tag->name;                     }                     $tag_str = implode(",", $tag_str);                 }             }             ?>
 <?php wp_dropdown_categories($user_cats); ?>
<?php             ?>

             <input type="hidden"  value="<?PHP echo $post_id; ?>"                             name="post_id" id="post_id" />             <input type="hidden" value="<?PHP echo $featured_img_id; ?>"                     name="featured_img_id" id="featured_img_id" />                       <textarea name="user_post_content" id="user_post_content" placeholder="Enter your content..." class="inputwide"><?PHP echo ((!empty($post_obj->post_content))?$post_obj->post_content:''); ?></textarea>

             (You can use basic html in this box. Click here for more info ADDLINK!!!.)

             Tags:              <input placeholder="Seperated by commas" type="text"                     value="<?PHP echo ((!is_null($tag_str)?$tag_str:'')); ?>"                     name="user_post_tags" id="user_post_tags" /> (note: Only first 5 tags will be saved)

                  <input class="cbutton" type="button" id="upload_img" value="Add/Switch Featured Image" />
                     <img src="<?PHP bloginfo('template_directory'); ?>/images/ajaxloading-circul.gif" />

                     <?PHP                     if($featured_img_id!=-1){                         echo wp_get_attachment_image($featured_img_id, array(150,150));                     }                     ?>

                     <img src="<?PHP bloginfo('template_directory'); ?>/images/b_drop.png" id="remove_image_btn" style="cursor:pointer;" />

                 <img src="<?PHP bloginfo('template_directory'); ?>/images/ajaxloading_bar.gif" />

                 <input class="cbutton" type="button"   name="submit_btn" id="user_post_submit"    value="<?PHP echo ((!empty($post_obj))?'Update':'Publish'); ?>">                 <input class="cbutton" type="button"   name="submit_btn" id="user_post_savedraft" value="Save Draft">                 <input class="cbutton" type="button"   name="submit_btn" id="user_post_preview"   value="Preview">                 <input class="cbutton" type="button" value="Discard" name="cancel" id="cancel_btn" />

          </form>

         <?PHP         if($featured_img_id!=-1){             add_action('wp_footer','add_wp_footer');         }         function add_wp_footer(){             ?>                                      <?PHP         }         ?>

         <?php  get_sidebar('newpost'); ?>         <?php  get_footer(); ?>


title: How to set intervals in cron jobs?

text: I am having a unmanaged VPS, where my wordpress site is hosted, I am also using WP-ROBOT 3 plugin for auto posting, I want it to do auto post through cron jobs, According to the documentation of the plugin, I entered this code through SSH command `wget --post-data='mincamp=2&maxcamp=3&chance=50' -O /dev/null http://myURL/` and it worked, but I want to set regular intervals, so that it autoposts everyday, how to do that? I want it to post after every 6 hours, what should be the cron commands


title: how to determine how many and what kind of arguments are passed to hooks

text: I am not able to understand a very logic behind add_action / add_filter Consider following example:               function SearchFilter($query) {       if ($query->is_search) {          $query->set('post_type', 'page');       }       return $query;     }     add_filter('pre_get_posts','SearchFilter');      My questions are   * How can I know wheter function 'SearchFilter' accepts any argument or not?   * What will be that argument / what will be it's type?   * How can I determine for which action/filter there is any argument?   * Should every action / filter return the passed parameter?


title: Separate custom categories from default category

text: I created a custom post type named as 'notice'. For both categories I assigned taxonomy like -               function register_notice(){              $args = array(             'labels' => array(                             'name' => 'Notice',                             'singular_name' => 'Notice'                             ),             'query_var' => 'notice',             'rewrite' => array(                             'slug' => 'notice',                         ),             'public' => true,             'supports' => array(                                 'title', 'author'                                 ),             'taxonomies' => array('category') // here I created category taxonomy beside custom taxonomy             );              register_post_type('notice', $args);                  } // end of register notice category          add_action('init', 'register_notice');      then I created two categories under that taxonomy for notice custom post type. These two categories are 'class1' and 'class2'. The problem is, these two categories are also shown in the list of the default WordPress category list in the admin panel, and WordPress default categories are also shown in the list of my custom post type's category list. Is there any way to hide default categories from my custom post type's category list and to hide custom category list from the default WordPress category list?


title: GET form action. Redirect to self

text: I'm writing filter for posts by category on author page. I send category name in $_GET array in this form:               <form action="" accept-charset="UTF-8" method="get" id="form1">           <select name="type" class="form-select" id="edit-type">                <option value="all">All</option>                <option value="articles">Article</option>                <option value="posts">Blog Post</option>            </select>            <input type="submit" value="Apply" class="form-submit">     </form>      For exapmle I have link `www.mysite.com/?author=8`. If I type link `www.mysite.com/?author=8&type=posts`, all works correct, but if I use form, I'm redirect to home page just with parameter 'type' `www.mysite.com/?type=posts` Also, I try to use in form action current page url, porblem is the same. How can I send get parameter and redirect to slef page?


title: Custom Post Type archive as front page

text: I basically have the same problem like in this question, but the _correct_ answer doesn't work for me. Yes, I get a list of posts from my CPT, but the `archive-{post-type}.php` is not used to render the page. It still uses the `index.php`. Any help would be great! This is my code:               add_action('pre_get_posts', 'my_front_page');     function my_front_page($wp_query) {       $post_type = 'foobar';            if ( $wp_query->get('page_id') == get_option('page_on_front') ) {         $wp_query->set('post_type', $post_type);         $wp_query->set('page_id', '');              // Fix conditional functions like is_front_page or is_single         $wp_query->is_page = 0;         $wp_query->is_singular = 0;       }     }


title: repeating posts on 2nd page to posts

text: I am having an issue where I wanted to strip out all categories but one from the homepage so I added the following to the loop: `query_posts('cat=2');` However now the issue is that page one of the homepage is fine, however if you use the pagination at the bottom and select page 2 it will reproduce the exact articles on the homepage e.g. http://alumen.s.strategiesuk.net/ - Home page   http://alumen.s.strategiesuk.net/page/2/ - 2nd page of Home Any help on the subject would be greatly appreciated. (I am using the theme Gonzo)


title: While uploading texts from MS Word to WordPress, it changes the version id

text: Many times it is observed that, when you upload an already uploaded article (after making some changes), there is a new page created on KB site whereas it should have updated an existing page of that article. We have identify a work-around for MSWord, i.e. what change we can do to avoid that. But that is a lengthy method and error prone.


title: Changing WordPress URL results in 404

text: Changing WordPress URL results in 404. I've tried basic suggestions like editing `config.php` myself of allowing rewrite. First time changing URL worked, but page had text only- no theme, just plain text without formatting. I can't decide what to do.


title: Get Registered Custom Post Type to get All Custom Taxonomies

text: I am trying to get all the Custom Post Types Registered either by theme or plugin, but no method is working.               $postargs = array(        'public'   => true,        '_builtin' => false     );          $postoutput = 'names';     $postoperator = 'and';         $post_types = get_post_types( $postargs, 'names', 'and' );      /// Main Loop Start     foreach ($post_types as $post_type){       //and then i want to Get all the Custom Taxonomies for those post types in a loop     $taxonomies = get_object_taxonomies('$post_type', 'objects');         // Loop      foreach ($taxonomies as $taxonomy){     // Do Stuff with taxonomy     }    // Loop                             }    /// Main Loop Ends      **But the problem is only WordPress Defaults Post Types are showing up if i do**               '_builtin' => true        * post   * page    * attachment attachment This is the Code to Registered Post Type I don't get any post type, i currently have 8 Custom Post Types in the theme. the post is registered with this code...               $args = array(                             'labels' => array(                     'name' => __( 'Faq', 'yit' ),                     'singular_name' => __( 'Faq', 'yit' ),                     'plural_name' => __( 'Faqs', 'yit' ),                     'item_name_sing' => __( 'Faq', 'yit' ),                     'item_name_plur' => __( 'Faqs', 'yit' ),                     'add_new' => __( 'Add New Faq', 'yit' ),                     'add_new_item' => __( 'Add New Faq', 'yit' ),                     'edit' => __( 'Edit', 'yit' ),                     'edit_item' => __( 'Edit Faq', 'yit' ),                     'new_item' => __( 'New Faq', 'yit' ),                     'view' => __( 'View Faq', 'yit' ),                     'view_item' => __( 'View Faq', 'yit' ),                     'search_items' => __( 'Search Faqs', 'yit' ),                     'not_found' => __( 'No Faqs', 'yit' ),                     'not_found_in_trash' => __( 'No Faqs in the Trash', 'yit' ),                 ),                             'hierarchical' => false,                 'public' => true,                 //'menu_position' => 30,                 //'icon_menu' => ,                 'has_archive' => 'faq',                 'rewrite' => array( 'slug' => apply_filters( 'yit_faqs_rewrite', 'faq' ) ),                 'supports' => array( 'title', 'editor', 'cats'),                 'description' => "Faq"                  );             register_post_type('faq', $args);


title: Dynamically get the meta key value of a menu item based on it's post ID

text:
I have a menu, that I need to insert an image that have it's path saved in a meta key (`_menu_item_img`) and associated with a post ID, every menu entry has it's own image, and I need to grab it dynamically. The approach I tried, and I can't find anything on google that could help me out. `wp_nav_menu( array( 'container' =>false, 'theme_location' => 'main_menu', 'menu_id' => 'main_menu', 'link_before' => get_post_meta($item->object_id, '_menu_item_img'))));` This is the class I'm using for adding a custom entry into the menu page:               add_action( 'init', array( 'XTeam_Nav_Menu_Item_Custom_Fields', 'setup' ) );          class XTeam_Nav_Menu_Item_Custom_Fields {         static $options = array(             'item_tpl' => '
                                              {label}
                         <input                             type="{input_type}"                             id="edit-menu-item-{name}-{id}"                             class="widefat code edit-menu-item-{name}"                             name="menu-item-{name}[{id}]"                             value="{value}">
             ',         );              static function setup() {             // @todo we can do some merging of provided options from WP options for from config             self::$options['fields'] = array(                 'color' => array(                     'name' => 'img',                     'label' => __('Link para Imagem', 'xteam'),                     'container_class' => 'link-img',                     'input_type' => 'text',                 ),             );                  add_filter( 'wp_edit_nav_menu_walker', function () {                 return 'XTeam_Walker_Nav_Menu_Edit';             });             add_filter( 'xteam_nav_menu_item_additional_fields', array( __CLASS__, '_add_fields' ), 10, 5 );             add_action( 'save_post', array( __CLASS__, '_save_post' ) );         }              static function get_fields_schema() {             $schema = array();             foreach(self::$options['fields'] as $name => $field) {                 if (empty($field['name'])) {                     $field['name'] = $name;                 }                 $schema[] = $field;             }             return $schema;         }              static function get_menu_item_postmeta_key($name) {             return '_menu_item_' . $name;         }              /**          * Inject the           * @hook {action} save_post          */         static function _add_fields($new_fields, $item_output, $item, $depth, $args) {             $schema = self::get_fields_schema($item->ID);             foreach($schema as $field) {                 $field['value'] = get_post_meta($item->ID, self::get_menu_item_postmeta_key($field['name']), true);                 $field['id'] = $item->ID;                 $new_fields .= str_replace(                     array_map(function($key){ return '{' . $key . '}'; }, array_keys($field)),                     array_values(array_map('esc_attr', $field)),                     self::$options['item_tpl']                 );             }             return $new_fields;         }              /**          * Save the newly submitted fields          * @hook {action} save_post          */         static function _save_post($post_id) {             if (get_post_type($post_id) !== 'nav_menu_item') {                 return;             }             $fields_schema = self::get_fields_schema($post_id);             foreach($fields_schema as $field_schema) {                 $form_field_name = 'menu-item-' . $field_schema['name'];                 if (isset($_POST[$form_field_name][$post_id])) {                     $key = self::get_menu_item_postmeta_key($field_schema['name']);                     $value = stripslashes($_POST[$form_field_name][$post_id]);                     update_post_meta($post_id, $key, $value);                 }             }         }          }          require_once ABSPATH . 'wp-admin/includes/nav-menu.php';     class XTeam_Walker_Nav_Menu_Edit extends Walker_Nav_Menu_Edit {         function start_el(&$output, $item, $depth, $args) {             $item_output = '';             parent::start_el($item_output, $item, $depth, $args);             $new_fields = apply_filters( 'xteam_nav_menu_item_additional_fields', '', $item_output, $item, $depth, $args );             // Inject $new_fields before:
             if ($new_fields) {                 $item_output = preg_replace('/(?=
]+class="[^"]*submitbox)/', $new_fields, $item_output);             }             $output .= $item_output;         }     }      Can someone point me out where I am missing the point?


title: How to maintain WordPress permalink structure with custom content with URL parameters?

text: Lets say I have posts, pages, plugins and navigation etc. from WordPress. Then I have a Video on Demand Archive now I want use WordPress (core, plugins, theme) to process and display this content. Lets also assume my permalink structure is `/%postname%/`. I'm currently mixing content using page templates to show content via _(mydomain.com/page/?video=12435)_ URL parameters. Every ID presents an individual page. How to convert the URL-parameters to match my permalink structure? Can I solve this problem with WordPress code?


title: Turning on the 404 page on localhost

text: I'm using my localhost (XAMPP client) to test my WordPress website and everything works fine, till it comes to verifying how does my `404.php` template looks like. I can't preview any changes, because it never loads the actual site, just the localhost warning about non-existing content. I believe I have to change something in Apache's settings, but I can't really figure out, what. Will be grateful for any advice.


title: Woocommerce Custom CSV export

text: I've been trying to figure this out for the past few days. Is there a plugin that exports CSV with the Order Items all on the same line but not in the same column cell? Example: Item Name_01, Item Quantity_01, Item Variation_01, Item Amount_01, Item Total Price_01, Item Name_02, Item Quantity_02, Item Variation_02, Item Amount_02, Item Total Price_02 I purchased the WooComerce Exporter and it doesn't have that ability. It's either ONLY all products in one column OR all products listed on their own row. I'm told that neither of these options are able to be imported into my organizations database because the importer cannot accurately map the values (doesn't make sense to me, but that's what I'm told) Any help would be great. Whether it's an update to this plugin that I already purchased, or if it's a new plugin, or tips on modifying the plugin. I don't want to spend needless hours if something like this already exists.


title: Meta query "OR" comparison not working as expected with array

text: I have this code to get cars that have color 1 or 0 ( stored in db in rw_color as 1 for white and 0 is black):               $args_search = array(              'post_type' => array( 'cars' ),             'posts_per_page' => 99999,             'meta_query' => array( 'relation' => 'OR' ),     );               $args_search['meta_query'][] =  array(             'key' => 'rw_color',             'value' => array( 1,0 ),             'compare' => 'IN'     );      But the problem is that it never works for both 1 and 0 (no results are returned). It works only for 1 or when 0 is in array field like `'value' => array( 1 ),` or `'value' => array( 0 ),` but `'value' => array( 1,0 ),` is not working. Why is that? How can I return results with value 1 **||** value 0 in `rw_color` meta field .


title: htaccess breaks periodically

text: Ever since a few weeks, my .htaccess gets consistenly broken every few days. Sometimes it just gets an extraneous character at the end of file, but most of the times it's part of the file duplicated, like this:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBa     # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      My best guess is that some plugin is rewriting the htaccess and it's obviously not doing it properly. These are the plugins I have installed:   * Akismet   * All In One SEO Pack   * CopyRightPro   * DB Cache Reloaded   * Hello Dolly   * Jetpack por WordPress.com   * MediaElement.js - HTML5 Audio and Video   * Ninja Forms   * qTranslate   * Rapid Twitter Widget   * Recent Facebook Posts   * Simple Backup   * Spider Facebook.   * Twitget   * Under Construction   * WP Super Cache   * WP Twitter widget by rYokiNG Any ideas?


title: Same sidebar in all posts as in the category

text: I've made an option of creating unlimited sidebars, then there is an option to select any desired sidebar from a select element, which is a custom meta field, in each category edit page. So far so good, everything works and every category displays the selected sidebar. Now what i am trying to do is to output the same sidebar in every post (single.php) as in the category this post is assigned to. Have anyone done something similar? The code for outputting the sidebar in category page is:               <?php     if ( is_category() ){        $sidebar = get_post_meta( $post->ID, 'select_a_sidebar', true );        dynamic_sidebar( $sidebar );     }     ?>


title: Trying to get fittext to work in Wordpress

text:
I have the following code in my template page and I have registered jquery and fittext in my theme's `functions.php`. They are currently showing up in the footer as I set them to. I can set them up in either the header or the footer, but fittext just is not working where ever I place it. When I reduce the screen size the font is supposed to shrink but it doesn't. I am not sure why this is. I have put up a very rough version of the site it basically just shows the fittext not working you can view it here with the username:anders and password:reading61               <?php     /*     Template Name:Tech Basics     */     ?>     <?php get_header( 'tech' ); ?>

Sending you the techie! son you never had.

             <?php              $page_id = 10; // 123 should be replaced with a specific Page's id from your site, which you can find by mousing over the link to edit that Page on the Manage Pages admin page. The id will be embedded in the query string of the URL, e.g. page.php?action=edit&post=123.                  $page_data = get_page( $page_id ); // You must pass in a variable to the get_page function. If you pass in a value (e.g. get_page ( 123 ); ), WordPress will generate an error. By default, this will return an object.                  echo apply_filters('the_content', $page_data->post_content); // echo the content and retain Wordpress filters such as paragraph tags. Origin from: http://wordpress.org/support/topic/get_pagepost-and-no-paragraphs-problem     ?>

     <?php get_footer(); ?>      **This seems to get it working however I know it isn't a proper technique, for some reason fittext wants the js right in the middle of the page can any one help with this.**               <?php     /*     Template Name:Tech Basics     */     ?>     <?php get_header( 'tech' ); ?>

Sending you the techie! son you never had.

Welcome to Foundation

             <?php              $page_id = 10; // 123 should be replaced with a specific Page's id from your site, which you can find by mousing over the link to edit that Page on the Manage Pages admin page. The id will be         embedded in the query string of the URL, e.g. page.php?action=edit&post=123.                  $page_data = get_page( $page_id ); // You must pass in a variable to the get_page function. If you pass in a value (e.g. get_page ( 123 ); ), WordPress will generate an error. By default, this will return an object.                  echo apply_filters('the_content', $page_data->post_content); // echo the content and retain Wordpress filters such as paragraph tags. Origin from: http://wordpress.org/support/topic/get_pagepost-and-no-paragraphs-problem     ?>

     <?php get_footer(); ?>


title: wordpress multisite permalink structure: mostly subdomains but not all

text: I've got a Wordpress multi-site install with three (related) sites, and it works great. Previously, each site had its own totally unique domain name which I was managing with the WordPress MU Domain Mapping plugin. So, something like:               site.com     anothersite.org     random.net      Now, I need to have all three sites running on the same domain, however, I have a strange permalink structure that needs to be implemented. Namely, two of the sites will be on the _same_ subdomain (using a language code in the path to distinguish them), while the third will be on its own subdomain:               ca.site.com/en/    (previously site.com)     ca.site.com/fr/    (previously anothersite.org)     us.site.com/en/    (previously random.net)      I have access to the httpd.conf file, and have been trying to setup up RewriteRules... but I can't get it working, and I'm not especially sure if this is even the correct direction. If someone could just point me in the right direction that would be amazing, thanks


title: Find Videos Inside a Post

text: What can be an efficient way to determine videos that may be embedded in a post? If the embed code is directly added to a post, it is easy to determine using regular expressions but some plugins embed videos through shortcodes or in custom fields. In these cases, the actual embed code is added at the time of rendering the post.


title: Help With issue on pre_get_posts filter in taxonomy

text: I create a function to filter the taxonomy query with this code               add_action('pre_get_posts', 'custom_taxonomy_query');          $option_taxposts_per_page = get_option('tax_posts_per_page');          function custom_taxonomy_query(&$query)     {        global $option_taxposts_per_page;              if (!is_admin() &&              is_tax('feature') || is_tax('propertytype') || is_tax('location'))  {                      if (is_tax('feature')) {                 $browseorder = get_option('browse_feature_order');                 }                 else if (is_tax('propertytype')) {                 $browseorder = get_option('browse_propertytype_order');                 }                 else if (is_tax('location')) {                 $browseorder = get_option('browse_location_order');                 }                      switch ($browseorder) {                     case "Price Descending":                         $metakey = '_price';                         $order = 'DESC';                         $orderby = 'meta_value_num';                         break;                     case "Price Ascending":                         $metakey = '_price';                         $order = 'ASC';                         $orderby = 'meta_value_num';                         break;                     case "Date Descending":                         $metakey = '';                         $order = 'DESC';                         $orderby = 'date';                         break;                     case "Date Ascending":                         $metakey = '';                         $order = 'ASC';                         $orderby = 'date';                         break;                     case "Random":                         $metakey = '';                         $order = '';                         $orderby = 'rand';                         break;                 }                      $query->set('meta_key', $metakey);                 $query->set('post_status', 'publish');                 $query->set('orderby', $orderby);                 $query->set('order', $order);                 $query->set('posts_per_page', $option_taxposts_per_page);              }     }      the problem is if I choose order by Price Descending and Ascending.. my custom menu navigation gone and I don't know what cause this. If I choose to order by date and random everything work just fine. Please help me with this issue.


title: Custom Rewrites not used by WordPress

text: I've set up a simple plugin that adds custom rewrite rules to WordPress. Here is the code for that plugin: https://gist.github.com/JCPry/7324825. A page is created within WordPress with the slug `property-detail`. That page has a custom page template that allows it do so some processing of the `property_id` query argument. The problem is that the rewrite rule isn't being recognized properly. Here's an example URL that should be handled by the custom rewrite rules: `http://mflwv1westvolu.staging.wpengine.com/property- detail/1500000005169806/`. For this URL (and others like it), instead of the value `1500000005169806` being converted to the property_id query arg, it is instead recognized as a page number. WordPress then redirects to the highest- possible 32-bit page number, which is the URL `http://mflwv1westvolu.staging.wpengine.com/property-detail/2147483647/`. I have added some debugging output to the top of the page. If you use "View Source" in your browser, you can see a dump of the global `$wp_query` and `$wp_rewrite` variables. Disregard the lack of proper styling, as the page template was just copied as-is into a different theme (see below). What seems to be especially odd in this case is that the exact same custom rewrite rules work properly on a different installation of WordPress on the same server. Here's a URL that **_does_** work: `http://rflcw1chapmanj.wpengine.com/property-detail/1500000005169806/` For the site that is not currently working, I have tried the following:   1. Flushing the rewrite rules by visiting Settings > Permalinks   2. Setting the permalink structure back to the default (non-pretty permalinks), saving, then setting the permalink structure back to %postname%, and saving again   3. Deactivating all other plugins on the site   4. Switching to the Twenty Thirteen theme (I copied the appropriate custom page template into the twenty thirteen theme folder)   5. Reinstalling the WordPress core files   6. Creating an entirely new installation of WordPress using a different database table prefix. Honestly, the most frustrating thing about this issue is the fact that it works just fine for another installation in the same environment, but not for this installation. Thanks in advance to anyone who is able to help me figure out why this isn't working.


title: get_user_meta Short Profile Section

text: Ok so i have added a custom field into the users edit profile page where they can add a link to a url of an image they want. I am currently using this for contribitors and above but i also have a small little profile box on my site that gets a users avatar from gravatar. I used the code from before but changed it around to get the current signed on users authorpic or get the gravatar. See code below               $profilepic = get_user_meta('author_pic');     $imgtagbeg = ('');         if ($profilepic)             echo $imgtagbeg,$profilepic,$imgtagend;          else             echo get_avatar( $user_email, '52', $default = 'http://www.gravatar.com/avatar.php?gravatar_id=$md5&size=80&default=$default' );      What i want to do is if the current user signed in has a avatar linked in his profile field then use that instead of gravatar. But if the author does have a gravatar and has left the field blank in the profile use that or get the default gravatar **Update:** What about something like this               $userpic = '<img src="link/to/author_pics/$userid.png"';         if ($userpic)             echo $userpic;         else             echo get_avatar( $user_email, '52', $default = 'http://www.gravatar.com/avatar.php?gravatar_id=$md5&size=80&default=$default' );      Instead of relying on a user field just upload an image to a directory and use there userid as the filename then load it else use gravatar. Would that work. **UPDATE 2:**               $userpiccur = wp_get_current_user();     $userpicloc = 'http://avatars.mydomain.com/';     $userpictyp = '.png';     $userpicurl = $userpicloc . $userpiccur->user_login . $userpictyp;     $header_response = get_headers($userpicurl, 1);     $userpicbeg = '';     if ( strpos( $header_response[0], "404" ) !== false )         echo $userpicbeg,$userpiccur->user_login,$userpicend;     else         echo get_avatar( $user_email, '52', $default = 'http://www.gravatar.com/avatar.php?gravatar_id=$md5&size=80&default=$default' );


title: How do I make wordpress comment fields required?

text:
Here is my form:               <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform" class="validate">          <?php if($user_ID) : ?>          <?php else : ?>

              Name*

              Email*

           <input id="name" name="author" class="required input_text input_name" type="text" value="" />            <input id="email" name="email" class="required input_text email input_email" type="text" value="" />
                 <?php endif; ?>
               Comment
        <textarea id="comment_box" class="required input_comment" name="comment" cols="40" rows="6"></textarea>
<input name="submit" class="input_submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />          <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
          <input type="hidden" id="redirect_to" name="redirect_to" value="<?php echo get_bloginfo('wpurl');?>/comment">        <?php do_action('comment_form', $post->ID); ?>       </form>      I have required fields on all inputs, but it is only working on the comment text field. Any ideas?


title: Having problems accessing $_GET values

text: I'm trying to get the value of a $_GET variable on the homepage of my site. For some reason I can't access any $_GET variables on the homepage, but I can access them just fine on other pages. Does anyone know why this might be?


title: Custom Field & Gravity Forms

text:
I have the following custom function code which i'm using to create custom fields for a post type. The issues is that I need the custom fields to show up individually and at the moment they just show up as 'key' which means that when i try to link a form field (Gravity Forms) to a custom field, I can only link to the 'key' field. How can this be modified to show each custom field individually?               /* Custom Fields */     $key = "key";     $meta_boxes = array(     "cf_link" => array(     "name" => "cf_link",     "title" => "URL/Link",     "description" => "Enter the URL/Link here."),     "cf_image" => array(     "name" => "cf_image",     "title" => "Image",     "description" => "Enter the image URL here."),     "cf_instructions" => array(     "name" => "cf_instructions",     "title" => "Instructions",     "type" => "textarea",     "description" => "Enter any specific instructions here.")     );          function create_meta_box() {     global $key;          if( function_exists( 'add_meta_box' ) ) {     add_meta_box( 'new-meta-boxes', ucfirst( $key ) . 'Product Details', 'display_meta_box', 'products', 'normal', 'high' );     }     }          function display_meta_box() {     global $post, $meta_boxes, $key;     ?>
          <?php     wp_nonce_field( plugin_basename( __FILE__ ), $key . '_wpnonce', false, true );          foreach($meta_boxes as $meta_box) {     $data = get_post_meta($post->ID, $key, true);     ?>
     <label for="<?php echo $meta_box[ 'name' ]; ?>"><?php echo $meta_box[ 'title' ]; ?>          <?php if( $meta_box['type'] === 'textarea' ) { ?>       <textarea name="<?php echo $meta_box[ 'name' ];?>" rows="4"><?php echo htmlspecialchars($data[$meta_box['name']]); ?></textarea>      <?php } else { ?>       <input type="text" name="<?php echo $meta_box['name']; ?>"           value="<?php echo htmlspecialchars( $data[$meta_box['name']]); ?>" /><?php }?>
<?php echo $meta_box[ 'description' ]; ?>

          <?php } ?>
     <?php     }          function save_meta_box( $post_id ) {     global $post, $meta_boxes, $key;          foreach( $meta_boxes as $meta_box ) {     $data[ $meta_box[ 'name' ] ] = $_POST[ $meta_box[ 'name' ] ];     }          if ( !wp_verify_nonce( $_POST[ $key . '_wpnonce' ], plugin_basename(__FILE__) ) )     return $post_id;          if ( !current_user_can( 'edit_post', $post_id ))     return $post_id;          update_post_meta( $post_id, $key, $data );     }          add_action( 'admin_menu', 'create_meta_box' );     add_action( 'save_post', 'save_meta_box' );


title: How to hook one custom post-types post to another?

text: Basically I have got two custom post-types "news" and "authors". So I want to display both of them separately, however I want to hook them dynamically. So when you create a post aka. news.. then you could select the author from a list.   Later on that author will be displayed under the post as "About The Author" and would link to the authors detailed view. I'm sorry, I don't have any code to start with as wordpress is unknown territory for me and I couldn't find any keywords to start with.