title: Theme Options Page - Select, Radio, Tabs

text:
The code below is my theme options page (submenu - under "Appearance"). All options work fine except "select" and "radio"... They don't appear in the page as the other options do. I have been searching around the internet and trying different solutions for 3 days but there were no ways to make them appear. After that I would like to seperate the sections in different tabs which is also something I can't do. I have read the related documentation and some tutorials I found but nothing did the trick yet... Any help? Thanks!                   <?php     $themename = "WIS";          $shortname = "wis";          $version = "1.1";          $option_group = $shortname.'_theme_option_group';     $option_name = $shortname.'_theme_options';               add_action('admin_init', 'wis_add_init');          function wis_add_init() {         $file_dir = get_template_directory_uri();              wp_enqueue_style("wisCss", $file_dir."/functions/theme-options.css", false, "1.0", "all");              wp_enqueue_script("wisScript", $file_dir."/functions/theme-options.js", false, "1.0");          }          // Create custom settings menu     add_action('admin_menu', 'wis_create_menu');          function wis_create_menu() {         global $themename;         //create new top-level menu         add_theme_page( __( $themename.' Theme Options' ), __( 'Theme Options' ), 'edit_theme_options', 'wisgentheoptpag', 'wis_settings_page' );     }          // Register settings     add_action( 'admin_init', 'register_settings' );          function register_settings() {        global $themename, $shortname, $version, $wis_options, $option_group, $option_name;         //register our settings         register_setting( $option_group, $option_name);     }          // Create theme options          global $wis_options;          $wis_options = array (          array("name" => __('RSS Feeds/Facebook/Twitter','wis'),                  "type" => "section"),          array("name" => __('Set up social links.','wis'),                  "type" => "section-desc"),          array("type" => "open"),          array("name" => __('Custom Feed URL','wis'),                  "desc" => __('You can use your own feed URL (with http://). Paste your Feedburner URL here to let readers see it in your website.','wis'),                  "id" => "feedurl",                  "type" => "text",                  "std" => get_bloginfo('rss2_url')),          array("name" => __('Delete Extra Feeds','wis'),                  "desc" => __('WordPress adds feeds for categories, tags, etc., by default. Check this box to remove them and reduce the clutter.','wis'),                  "id" => "cleanfeedurls",                  "type" => "checkbox",                  "std" => ""),          array("name" => __('Twitter ID','wis'),                  "desc" => __('Your Twitter user name, please. It will be shown in the navigation bar. Leaving it blank will keep the Twitter icon supressed.','wis'),                  "id" => "twitterid",                  "type" => "text",                  "std" => ""),          array("name" => __('Facebook Page','wis'),                  "desc" => __('Link to your Facebook page, with http://. It will be shown in the navigation bar. Leaving it blank will keep the Facebook icon supressed.','wis'),                  "id" => "facebookid",                  "type" => "text",                  "std" => ""),          array("type" => "close"),          //FOOTER          array("name" => __('Footer','wis'),                  "type" => "section"),          array("name" => __('Customize footer of your website.','wis'),                  "type" => "section-desc"),          array("type" =>"open"),          array("name" => __('Footer Text','wis'),                  "desc" => __('Enter your footer text or HTML here.','wis'),                  "id" => "footer_text",                  "std" => "",                  "type" => "textarea"),          array("name" => __('Hide Footer Navigation Links','wis'),                  "desc" => __('Select to hide the navigation bar in the footer. If you want to customize the footer navigation, go to Menus under the Appearance tab in the dashboard.','wis'),                  "id" => "hide_footer_nav",                  "std" => "",                  "type" => "checkbox"),          array("name" => __('Hide Footer Credits','wis'),                  "desc" => __('Select to hide the credit line in the footer. Thanks for sending us a generous contribution.','wis'),                  "id" => "hide_footer_credit",          array("name" => __('Theme Styles','wis'),                  "type" => "section"),          array("name" => __('Choose a color scheme and add custom CSS styles.','wis'),                  "type" => "section-desc"),          array("type" => "open"),          array("name" => __('Colour Scheme','wis'),                  "desc" => __('Select a colour scheme for the theme. Future versions will have multiple styles.','wis'),                  "id" => "alt_stylesheet",                  "type" => "select",                  "options" => $alt_stylesheets,                  "std" => "default.css"),          array( "name" => __('Custom Styles','wis'),              "desc" => __('Want to add any custom CSS code? Put in here, and the rest is taken care of. This overrides any other stylesheets. eg: a.button{color:green}','wis'),              "id" => "custom_css",              "type" => "textarea",              "std" => ""),          array("type" => "close"),                  "std" => "",                  "type" => "checkbox"),          array( "type" => "close"),          //ADVERTISEMENTS --- POST ADS          array("name" => __('Advertisements','wis'),              "type" => "section"),          array("name" => __('Show ads on your blog.','wis'),                  "type" => "section-desc"),          array("type" => "open"),          array("name" => __('Header Display Ad','wis'),                  "desc" => __('You can show a display ad in header. Paste the code here for 600px by 60px ad.','wis'),                  "id" => "topbanner",                  "std" => "",                  "type" => "textarea"),          array("name" => __('Ad Above Posts','wis'),                  "desc" => __('Enter your Adsense code or other ad network code here. This ad will be displayed at the beginning of posts, below title on Post Pages and Pages with ad-supporting template. It is very basic and effective option for putting ads on your blog. If you want more functionality, get a specialized Ad plugin.','wis'),                  "id" => "posttop_adcode",                  "std" => "",                  "type" => "textarea"),          array("name" => __('Ad Below Posts','wis'),                  "desc" => __('Enter your Adsense code (or other ad network code) here. This ad will be displayed at the end of post content on Post Pages and Pages with ad-supporting template. Please make sure that you do not activate more ads than what is allowed by your ad network. Adsense allows up to 3 on one page.','wis'),                  "id" => "postend_adcode",                  "std" => "",                  "type" => "textarea"),          array("type" => "close"),          //Analytics Code          array("name" => __('Tracking & Other Codes','wis'),          array("name" => __('Theme Styles','wis'),                  "type" => "section"),          array("name" => __('Choose a color scheme and add custom CSS styles.','wis'),                  "type" => "section-desc"),          array("type" => "open"),          array("name" => __('Colour Scheme','wis'),                  "desc" => __('Select a colour scheme for the theme. Future versions will have multiple styles.','wis'),                  "id" => "alt_stylesheet",                  "type" => "select",                  "options" => $alt_stylesheets,                  "std" => "default.css"),          array( "name" => __('Custom Styles','wis'),              "desc" => __('Want to add any custom CSS code? Put in here, and the rest is taken care of. This overrides any other stylesheets. eg: a.button{color:green}','wis'),              "id" => "custom_css",              "type" => "textarea",              "std" => ""),          array("type" => "close"),                       "type" => "section"),          array("name" => __('Insert Web tracking & analytics and other codes here.','wis'),                  "type" => "section-desc"),          array("type" => "open"),          array("name" => __('Analytics & Tracking Code','wis'),                  "desc" => __('You can paste your Google Analytics or other codes in this box. The codes will be automatically added to the footer.','wis'),                  "id" => "analytics_code",                  "type" => "textarea",                  "std" => ""),          array("type" => "close")          );          function wis_settings_page() {        global $themename, $shortname, $version, $wis_options, $option_group, $option_name;     ?>

     <?php screen_icon(); ?>
<?php echo $themename; ?> <?php _e('Theme Options','wis'); ?>

<?php _e('Customize your WordPress blog with these settings. ','wis'); ?>
     <?php if ( isset ( $_POST['reset'] ) ): ?>     <?php // Delete Settings     global $wpdb, $themename, $shortname, $version, $wis_options, $option_group, $option_name;     delete_option('wis_theme_options');     wp_cache_flush(); ?>

<?php _e( $themename. ' options reset.' ); ?>

          <?php elseif ( isset ( $_REQUEST['updated'] ) ): ?>

<?php _e( $themename. ' options saved.' ); ?>

     <?php endif; ?>          <form method="post" action="options.php">          <?php settings_fields( $option_group ); ?>          <?php $options = get_option( $option_name ); ?>               <?php foreach ($wis_options as $value) {     if ( isset($value['id']) ) { $valueid = $value['id'];}          switch ( $value['type'] ) {          case "section":          ?>

<?php echo $value['name']; ?>          <?php break;          case "section-desc":          ?>              <?php echo $value['name']; ?>

          <?php          break;          case 'text':          ?>

<?php echo $value['desc']; ?>
                  <label for="<?php echo $option_name.'['.$valueid.']'; ?>"><?php echo $value['name']; ?>                  <input name="<?php echo $option_name.'['.$valueid.']'; ?>" id="<?php echo $option_name.'['.$valueid.']'; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( isset( $options[$valueid]) ){ esc_attr_e($options[$valueid]); } else { esc_attr_e($value['std']); } ?>" />
          <?php          break;          case 'textarea':          ?>

<?php echo $value['desc']; ?>
                  <label for="<?php echo $option_name.'['.$valueid.']'; ?>"><?php echo $value['name']; ?>                  <textarea name="<?php echo $option_name.'['.$valueid.']'; ?>" type="<?php echo $option_name.'['.$valueid.']'; ?>" cols="" rows=""><?php if ( isset( $options[$valueid]) ){ esc_attr_e($options[$valueid]); } else { esc_attr_e($value['std']); } ?></textarea>
          <?php          break;          case 'select':          ?>

<?php echo $value['desc']; ?>
                  <label for="<?php echo $option_name.'['.$valueid.']'; ?>"><?php echo $value['name']; ?>                  <select name="<?php echo $option_name.'['.$valueid.']'; ?>" id="<?php echo $option_name.'['.$valueid.']'; ?>">                  <?php foreach ($value['options'] as $option) { ?>                          <option <?php if ($options[$valueid] == $option) { echo 'selected="selected"'; } ?>><?php echo $option; ?></option><?php } ?>                  </select>
          <?php          break;          case "radio":          ?>

<?php echo $value['desc']; ?>
                  <label for="<?php echo $option_name.'['.$valueid.']'; ?>"><?php echo $value['name']; ?>                    <?php foreach ($value['options'] as $key=>$option) {                 if ( isset ( $options[$valueid] ) ) {                     if ($key == $options[$valueid] ) {                         $checked = "checked=\"checked\"";                         } else {                             $checked = "";                         }                 }else{                     if($key == $value['std']){                         $checked = "checked=\"checked\"";                     }else{                         $checked = "";                     }                 }?>                      <input type="radio" id="<?php echo $option_name.'['.$valueid.']'; ?>" name="<?php echo $option_name.'['.$valueid.']'; ?>" value="<?php echo $key; ?>" <?php echo $checked; ?> /><?php echo $option; ?>
                      <?php } ?>
          <?php          break;          case "checkbox":          ?>

<?php echo $value['desc']; ?>
                  <?php if( isset( $options[$valueid] ) ){ $checked = "checked=\"checked\""; }else{ $checked = "";} ?>                  <input type="checkbox" name="<?php echo $option_name.'['.$valueid.']'; ?>" id="<?php echo $option_name.'['.$valueid.']'; ?>" value="true" <?php echo $checked; ?> />                  <label for="<?php echo $option_name.'['.$valueid.']'; ?>"><?php echo $value['name']; ?>
          <?php          break;          case "close":          ?>

          <?php     break;          }          }          ?>               <input class="button button-primary" type="submit" name="save" value="<?php _e('Save All Changes', 'wis') ?>" />          </form>          <form method="post" action="">                    <input class="button button-secondary" type="submit" name="reset" value="<?php _e('Reset', 'wis') ?>" />     <input type="hidden" name="action" value="reset" />     <?php _e('Caution: All entries will be deleted from database.','wis') ?>                    </form>

          <?php } ?>


title: Shortcode to find and replace URL

text: I'm trying to create a shortcode that will search within some specified text for a link and replace it with one that I specify. For example:               [scode]Click on this link[scode]     [scode]Click on this link[scode]      ...will both be changed to:               [scode]Click on this link[scode]      I'm trying to put together a function that will search for links and replace them with the one that I specify. Here's what I have right now:               // Adds [hide] shortcode for hiding content from non-registered users.          function hide_text( $atts,$content) {         if ( is_user_logged_in () ) {             return $content;         }         else {             $pattern = '(?<=href=("|\'))[^"\']+(?=("|\'))';             $newurl = "http://replacementurl.com";             $content = preg_replace($pattern,$newurl,$content);             echo $content;               }         }     add_shortcode( 'hide', 'hide_text' );      This just crashes the site, though. I'm not a PHP expert (much less an expert on regex), but are there at least any glaring irregularities in my code? Or perhaps there's just a better way to go about this and I'm making it way more complicated than it needs to be? **UPDATE:** As suggested, I turned on debug log, which showed me that I had an extra `}` in the code. Updated code is shown above. Now the site isn't crashing, but the link and text within the shortcode is completely erased, just blank.


title: Filtering custom post type on a combination of custom taxonomies and custom fields?

text: I have a custom post type "artist". It has an associated custom taxonomy "artist_type" with terms "voice", "actor", "corporate" An "artist" also has custom fields for gender, location, agerangefrom and agerangeto. The latter 2 fields stipulate the age range that an actor/artist can act in. I'm displaying artists according to their artist_type taxonomy — so using taxonomy-artist-type.php to display "/artist_type/voices/" and "/artist_type/actors"/ and "/artist_type/corporate/" That's all fine. But I need to add in a filter so that a user can narrow down each of these three categories according to the custom fields mentioned above: gender, location etc I came across a site here that does something similar here: http://artists.derricktalentelite.com.au/?post_type=actor&gender=male I'm getting confused on how to set this up in my scenario. DO I need to be using meta_query and/or pre_get_posts? The user needs to be able to combine filters, for e.g., on the voices page: male in the age range from 20-30 based in London. How do I formulate the query string in the url to pass these parameters? Any clues on how best to proceed would be appreciated.


title: Let user select their own category

text: I would like to let category editor appear to any user and user can edit their preferred category(ies). **For example:** the category is about kind of job or profession and there are 10 categories(professions). When user login, they can edit profile and they can choose their profession as well. I can imagine that creating a custom taxonomy and let it appear in every user's menu. But how can I store individual user's selection? Is it possible to display a list in profile and let the user to check and save? How it should be implemented? Any idea is appreciated. Thanks.


title: Get the amount of posts on a given page

text: When you go to something like: site.com/?cat=2&page=2 you might see 3 posts, the page before might have 5 posts. I am looking for a way to count the posts on a given page. so if I am on page 2, with three posts, said function should return 3. any idea?


title: How can I list posts with different formats depending on order?

text:
Let's say I have a regular main page listing posts, like in any regular WP blog. Now, I'd like to achieve this: if it's the first post in the list, use some layout, if second, another layout, if third, then another layout and so on. Even better: if it's post 1, 5, 9, 15, 22 -> use layout 1 . If it's 2,3,8, 12,14 -> use layout 2 (basically, adding re-usable code) For reference:               post 1 ->
....
     post 2 ->
....
     post 3 ->
....
     post 4 ->
....
     post 5 ->
....
      (so there's no "every given number of posts, use layout x", but "if in spot X, use layout X") I know I can do this with CSS, it's a snap, but it's not smart at all, since I want to use different post-thumbnail sizes, so loading big images for small sizes is ridiculous. I tried looking for WP conditionals, if_post and what not, but couldn't find anything, so really no clue on how to achieve this (without using masonry, which will have the same post_thumbnail problem) Any ideas on how to do this? Thanx in advance and Happy New Year for everybody! :)


title: Dynamically adding Captions to images

text: I have a site where the author has included Amazon Affiliate links. They've done this by adding the URL to product images. I'm wondering if there's a way to add a function that will automatically add a wp-caption below these images if they're linked to Amazon. Basically the condition would need to be: if an href containing an image is linked to a domain including 'amazon', add a caption below that image that says "Buy Now". The caption would also have the same link as that image. I've been able to do this with some hacky jQuery, but it doesn't always fire properly. I think there might be a better way... Thanks


title: Facebook like counter in custom field

text: is it possible then someone click on like, to take action to update post custom field with counts ? I just found only with http://graph.facebook.com/URL Maybe will be smarter solution ? Or ideas ?


title: Using Templates with Custom Post Type UI

text: I'm using this nifty little plugin called Custom Post Type UI to add custom post types to my WordPress site and am having a little trouble working out the best way to apply a page template to my custom post types. Does anyone know the best way to achieve this? Any help is appreciated. Thanks in advance!


title: Stop loading more posts if none left AJAX

text:
I'm using the following JavaScript to load more pages in #work_items (see live at http://mtthwbsh.com):               jQuery(document).ready(function($){     $('.older a').live('click', function(e)  {     e.preventDefault();     $('.navigation').prepend("

");          var link = jQuery(this).attr('href');          var $content = '#work_items';     var $nav_wrap = '.navigation';     var $anchor = '.navigation .older a';     var $next_href = $($anchor).attr('href'); // Get URL for the next set of posts          $.get(link+'', function(data){     var $timestamp = new Date().getTime();     var $new_content = $($content, data).wrapInner('').html(); // Grab just the content     $('.navigation .loader').remove();     $next_href = $($anchor, data).attr('href'); // Get the new href     $($nav_wrap).before($new_content); // Append the new content     $('#rtz-' + $timestamp).hide().fadeIn('slow'); // Animate load     $('.older a').attr('href', $next_href); // Change the next URL     $('#work_items .navigation:last').remove(); // Remove the original navigation     });          });     });      Currently, if you are on the last page of posts and click "load more" again, it loads the same last page again. I'd like to conditionally not run the function if no pages are left (and replace the button with something like "no more posts"). How would I go about doing this? Here is the markup I'm using for the pagination:
     <?php $paged = (get_query_var('page')) ? get_query_var('page') : 1;       $args=array('category_name'=>'portfolio','posts_per_page'=>4,'paged'=>$paged       );       query_posts($args); ?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

              <a href="<?php the_permalink(); ?>">         <?php             if ( has_post_thumbnail() ) {             the_post_thumbnail();             }            ?>

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

          <?php endwhile; ?>      Another unrelated issue I'm having is that I am targeting every fourth post with nth-child(4n)to clear a margin, but for some reason after the first set of posts it starts targeting the first post of the next set. Is there something weird about how WordPress handles the order of elements? Thanks for your help!


title: conditional statement for active permalinks

text: I'm looking for a way to create an if...else statement hinging on whether pretty permalinks are active or not. So I need something which returns true when permalinks are changed from the default.               if (pretty_permalinks_are_on) {        do this;         } else {            do that;         }      Sort of thing. Just have no idea about the 'pretty_permalinks_are_on' part. If anyone would extend the hand of compassion and throw some crumbs to a php noob, I'd be a grateful learner :)


title: WordPress blog or WordPress website

text: I have created a WordPress blog. http://www.lifegetsdigital.com.wordpress.com I am planning to eventually move all the posts to a website of my own from the free WordPress service. Is it good move the blog to a private domain now or should i move after making some[say 100] posts using the free wordpress service? My primary concerns for not staying with WordPress is 1) Lack of google adsense support 2) Limited facebook integration 3) I believe plugins can be better installed and managed in our own server. Soliciting advice. Thanks


title: In woocommerce who is responsible for sending the receipt email?

text: I'm writing a Paypal Pro woo commerce extension to allow it to accept credit card directly on my websites. When I test things, everything works well. The only thing that I don't get is an email notification. So I would like to know does my gatway class need to send the receipt email or the internals of the WooCommerece should take care of that for successful order?


title: Force category-slug.php to show page, even if it doesn't exist

text: I have a custom query in category-slug.php, which works fine unless the category doesn't have that number of pages itself. If the category only has 5 pages of posts, but the query I put in has 7, it'll show 404 for pages 6 and 7. Pretty sure the reason for this is that category-slug.php checks to see if there is a page for that category before it gets to the query I have in the file. Is there a way for me to force it to run the page instead of showing a 404?


title: Naming Admin Menus and Submenus

text: I'm building a plugin that requires its own set of admin pages. I know how to create the top-level link and how to add sub-menus to it. However, what seems to happen is when I create the top-level link, it also automatically adds a submenu page of the same name if I add another submenu page to it. I'm simply looking for a way to change the name of my first submenu page so that it is different from the parent name. (i.e. in the admin panel, expanding the "Links" menu shows an "All Links" submenu page. Mine would instead say "Links" on top and then "Links" instead of "All Links")


title: How to edit homepage in Wordpress?

text: I'm gonna add a bit of code/edit my homepage in Wordpress, but I can't find the page's main file to edit. Take a look at this: http://uaral.tk This is my homepage. Now look at the page source in your browser. I want to edit these codes. But I can't find it anywhere in the website directory. It seems to be a html file, but can't find anything on the host to edit. I'm a total newbie, so please explain it clear. I'm using WordPress 3.6.1 and Wallbase theme. Thanks.


title: Set active class in a Php foeach

text:
I have the following code to display a list of taxonomies in Wordpress. It works and my only concern is the active class (li class="active"). Err, how do I go about making it dynamic?
                 <?php                    echo '
All
'; # this remains static and unchanged                              if ( $count > 0 ) {                                  foreach ( $mylinks as $mylink ) {                         echo '
';                         # get current webdirectory and link to taxonomy menus                         echo'slug . ' class='. $mylink->slug .'" >';                         echo $mylink->name;                         echo "";                         echo "
";                     }                 }                ?>


title: Is there a full explanation on how to share a database with two Wordpress sites on same server?

text: I have read that you can have two wordpress database tables (using different table prefixes) to share the same database. I understand the concept but does any know of or can anyone provide an outline on the processes involved when using search for example. I would ideally, like to search from one site and be able to get results from both sites (_wp1 posts and _wp2 posts). How would I set this up? Current setup: Site one: Free site blog content, 5000 + posts, big database. Search will only return free content (_wp1) Site two: (new) A premium paid content subscription service featuring new blogs. Search will return new premium content (_wp2) AND the original free content. So is it best to write all posts from the free site and just set whether its premium, or should I separate where the blogs are written? Custom field filters need to work with this (assuming the posts have the same post setup on both). Thanks


title: How To Get Custom Post Type Category Title

text: I have a CPT called campsites and in there I have different categories ie. derbyshire, staffordshire, nottinghamshire etc. What I want to do is that when you click on a category eg. derbyshire, ideally I'd like it to say at the top of the page Campsites in derbyshire. Please help.


title: Can a plugin deactivate and delete itself once installed and activated?

text: I have a unique plugin whose purpose is to set up a new WordPress site with a theme, default widgets, default plugins, custom menus, pages, posts, etc. The plugin does everything it needs to do when activated and never runs again. I'm looking for suggestions on how I might, as the last step in the activation routine, deactivate and delete the plugin. Any help, suggestions, or example references appreciated.


title: comments reply script not working

text: Sadly my "reply" link for threaded comments is not working. ### The current situation: First i load the comments reply script (check if scripts content load: works) into the `<head>` using two functions (the first `wp_register_script()` at the init hook, the second `wp_print_scripts()` at the wp_head hook): Then i add the Reply link:               comment_reply_link(           array(               'reply_text'   => __( 'Reply', OXO_TEXTDOMAIN )             ,'depth'        => isset( $args['args']['depth'] ) ? $args['args']['depth'] : (int) 3             ,'max_depth'    => isset( $args['args']['max_depth'] ) ? $args['args']['max_depth'] : (int) 5          )         ,get_comment_ID()         ,$post->ID     );      which produces this html-output (example)               Reply      **I got everything according to any recommendation i read:** My comments are within a `<div id="comments">` and the comments form above it within a `<div id="respond">`. I still get dropped to the #respond-anchor and the comment form above the comments (`http://localhost/wordpress/?p=149&cpage=2&replytocom=11#respond`), instead of getting the comment form displayed below the comment i want to reply to. ### What may i do wrong? Google, tutorials, how-to and else were so far of no help. Everything seems to be according to the recommended standard... Thanks a lot.


title: Creating separate feeds for custom post types

text: My site has a few custom post types, news, events, you-tube, etc. I'd like to create an rss feed for each post type as well as a main with all. I've experimented an bit and found how to combine them into one but I haven't determined how to segment each. Do I need to create separate feed-rss.php for the templates as well as a custom function? This is the function I'm currently using to combine them into one feed.               //Custom post feeds     function myfeed_request($qv) {         if (isset($qv['feed']) && !isset($qv['post_type']))             $qv['post_type'] = array('post', 'youtube', 'event', 'news' );         return $qv;     }     add_filter('request', 'myfeed_request');


title: Change site url when moving site to another url?

text: Is it really neccessary to put `WP_HOME`, `WP_SITEURL` in `wp-config.php` or set these settings via admin panel every time when moving a WordPress instance to another url (for example: moving from dev environment to production)? Is there any better strategy?


title: An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration

text: I'm running WordPress on localhost WAMP server and whenever I go to "Plugins" or "Dashboard > Updates" or even to "Dashboard" nothing loads (no WordPress news, no updates, I'm not able to search for plugins or update them). In "Plugins" section I see this when I try to search for something: > An unexpected error occurred. Something may be wrong with WordPress.org or > this server’s configuration. If you continue to have problems, please try > the support forums. Have anyone encountered this issue before? It happened overnight a few weeks ago for me. It was working for a long time and then one day it stopped. What I already did:   * Searched Google and WordPress.org support forums. This issue is mentioned hundreds of times and there is no solution   * Checked php.ini, Apache's config, .htaccess, enabled potentially related PHP/Apache modules, checked if WAMP is set to "online" (my WAMP is accessible from other network computers now).   * Allowed every permission for WAMP in "Allow a program through Windows Firewall".   * Deactivated all plugins and themes other than the default one.   * Checked [Settings > General] to see if URLs are valid and they are.   * Resaved [Settings > Permalinks].   * **Installed another WordPress on this localhost and it works**. So, why the first one doesn't?


title: Display all posts in a custom post type, grouped by a custom taxonomy term then paginate

text: I'm helping someone out that wants to sort their custom post type of "property" alphabetically by the value assigned in the custom taxonomy of "city" The below code works great for that:               <?php     $terms = get_terms('city', 'orderby=slug&hide_empty=1');         if(!empty($terms)) : foreach($terms as $term) :         $term_name = $term->slug;     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $args = array(      'city' => $term_name,     'post_type' => 'property',     'posts_per_page' => 1,     'paged' => $paged,     'nopaging' => false,     'order' => 'ASC',     'orderby' => 'title',                           );          $the_query = new WP_Query( $args );     // The Loop     if ( $the_query->have_posts() ) :     while ( $the_query->have_posts() ) : $the_query->the_post();      The issue I'm having is with the posts paginating. Since the above code is basically creating it's own loop for each city it doesn't listen to the "posts_per_page" or "paged" paramaters set in the $args array. Any suggestions on how I can make this paginate? Or is there an alternative method instead of using WP_query that would allow for pagination?


title: How to link up "read more" on excerpts hack from WP Recipies

text: I found the code on the WP Recipies page to force excerpts on the home page:               function my_excerpts($content = false) {         // If is the home page, an archive, or search results     if(is_front_page() || is_archive() || is_search()) :         global $post;         $content = $post->post_excerpt;          // If an excerpt is set in the Optional Excerpt box         if($content) :             $content = apply_filters('the_excerpt', $content);          // If no excerpt is set         else :             $content = $post->post_content;             $excerpt_length = 55;             $words = explode(' ', $content, $excerpt_length + 1);             if(count($words) > $excerpt_length) :                 array_pop($words);                 array_push($words, '...');                 $content = implode(' ', $words);             endif;             $content = '<p>' . $content . '</p>';              endif;     endif;          // Make sure to return the content     return $content;          }          add_filter('the_content', 'my_excerpts');      But how do I modify that snippet to add a hyperlink to the full post for the "..." part?


title: Does post-meta belong in header?

text: The template I used as a start for my own design places the metadata inside the header tag of the single-post.php. Is that a correct use of header, or should there only be h-tags in there? What about the post image? Could that be part of the header?


title: Register theme customizer settings when theme activates

text: I've been following this great tutorial (http://wp.tutsplus.com/tutorials/theme-development/digging-into-the-theme- customizer-overview/) and now I have set the Theme customizer. As far as I understand the settings I assign in the customizer are saved in the database every time the user "saves" in the theme customizer page. Which means that after activating the theme for the first time and before going to the customizer, the settings are not saved. My question is, How can I save the settings just after the user activates the theme? (the $wp_customize->add_setting default value) Pd. I've been looking for some time, and got this hooks: "after_setup_theme", "switch_theme", but I cant figure out how to do it. Edit: The "duplicate question" answers how to provide a fallback when there is no setting available. Although it might be a workaround, I would like to know how to save (register) the settings when activating the theme.


title: Downloadable content only for subscribers?

text: I'd like to use WordPress to set up a whitepapers site. Any user can check the main site with a list (blog format) of white papers available. But if a user wants to download any whitepaper, **he has to be registered**. So the process should be as follows:   1. Are you registered? 1.1. Type your email 1.2 The system checks if you're already registered. If so, it lets you download the whitepaper (the download starts inmediately or is sent by mail)   2. Aren't you registered? 2.1 Complete the form (several fields, **the normal WordPress registration form is not useful here** ) 2.2 First registration should be confirmed by email to avoid false users 2.3 The system lets you download the PDF whitepaper (the download starts inmediately or is sent by mail) The first part (check if the user is registered / subscribed) is the difficult one for me. The idea is to build a database of really interesting users in order to send them newsletters and valuable content, and to make **comfortable, easy and quick to register once** and forget about this step so they can download any whitepaper I publish later on. I would like to use phplist for this (I've got a phplist site working, but checking the registered users is a nightmare for me, I'm not a phplist expert and although I've asked on their forums there has been no luck) so WordPress is a nice alternative for me and I know something like this is more doable, maybe with some free **or even premium plugins**.


title: How can I allow users (subscribers) to download selected posts into a single PDF? (RESOLVED)

text: I currently have a members area for subscribers. I have already setup the ability for users to 'favourite' posts and add them to custom folders of their choice. Once they have added some posts to a specific folder, I want them to be able to click download where it will collate that folders posts into a pdf. Doesn't have to be perfect, it just has to be functional for now. I found a plugin Kalin's PDF creation station, which has an additional backend feature (Tools) which does this perfectly, even offering reordering of the posts before publishing. But I want to know if I can offer this option to a front end subscriber. Does anyone know if this can be done? Open to alternative solutions if anyone has any as well. Thanks **EDIT** Here is a screenshot to help. The blurred out titles are 3 seperate posts titles. When they click download, I want those 3 to be compiled into a pdf? Any suggestions?


title: Best place to call xdebug helper functions?

text: Right now I place the following code wherever I expect something to go wrong.               /** xdebug helper */         error_reporting(E_ERROR);         ini_set("display_errors", 1);         ini_set("html_errors", 1);      Where should I include this code so that it's always called on every page?


title: How can I open up my administrative panel to everyone?

text: I'm planning on running a open news site that I want everyone to be able to view the inside of the site without registration. I feel like it should exist a simple check for viewing the WordPress backend but I can't seem to find it. I don't want everyone to be able to create posts or edit things but to view things. Is this as simple as I think it is or do I have make big changes myself to the codebase?


title: how to find user ids of all commenters in a post

text: Is there a function in wordpress that grabs all the users(user ids) who have commented on a post? I have the post id available.


title: Retrive images from the_content()

text: I would like to get the images from the_content(), I know I could use a regex to get the images but I wanted to know if there is any other more 'wordpress way' for doing this? I have this within a plugin and I have a filter                add_filter('the_content', 'myTestContentFunction');      Thank you


title: Help with add_rewrite_rule solution

text: In my Wordpress blog, I configured permalinks > Category base to "magazine" with links having this format:   http://www.mydomain.com/magazine/news/europe/france The above link opens the France Category Archive page. For the record:   * France is a child of Europe   * Europe is a child of News My client wants the URL for the France Category Archive page to change and be like this: http://www.mydomain.com/europe/france/news The problem is of course that with the second link, Wordpress will NOT open the France category archive page but the News category archive page. I solved the problem by adding the below in my theme's functions.php file, hence redirecting "europe/france/news" to the index.php page with the correct querystring of the France Archives Page.               add_action( 'init', 'wpse12065_init' );          function wpse12065_init()     {         add_rewrite_rule('europe/france/news', 'index.php?category_name=news%2Feurope%2Ffrance', 'top');         }      I of course then saved the permalinks from wp admin to flush the rules. It works, but:   1. Is this a clean solution? How expensive is it in terms of performance?   2. Can I have 50 rules like this one?   3. Will this break any plugins?


title: Moved wordpress from localhost to live and wp-admin shows white screen

text: Hi I developed a website in wordpress on my localhost then moved it to a live server. Everything is working fine except wp-admin. When I go to domain/wp- admin it shows a white screen. Yet when I go to domain/wp-login.php it allows me to login to the admin. Also if I try to create new post or update any settings it keeps showing a blank white screen, yet when refreshed has saved the settings/added the post etc. The site is www.nuvogadgets.com. Any ideas? Thanks!


title: Change permalink when page category selected in admin

text: I'm using the Events Manager plugin which uses a custom post type of 'events' and a custom taxonomy of 'event-categories'. One of my events categories is 'Short courses'. When I check this category (in admin) I want the default of /events/page-title to change to /course/page-title, and revert when the category is unchecked. Does anyone know if this is possible?


title: Override Taxonomy Template

text: I'm trying to list all the products tied to a specific taxonomy. For some reason the template won't work when trying to access "http://www.myexample.com/product_categories/funiture/", I tried `taxonomy.php`, `taxonomy-term.php` and nothing. Here's my code: http://pastie.org/7934453               add_action('init', 'register_cpt_product');          function register_cpt_product() {              $labels = array(             'name' => _x('Products', 'product'),             'singular_name' => _x('Product', 'product'),             'add_new' => _x('Add New Product', 'product'),             'add_new_item' => _x('Add New Product', 'product'),             'edit_item' => _x('Edit Product', 'product'),             'new_item' => _x('New Product', 'product'),             'view_item' => _x('View Product', 'product'),             'search_items' => _x('Search Products', 'product'),             'not_found' => _x('No products found', 'product'),             'not_found_in_trash' => _x('No products found in Trash', 'product'),             'parent_item_colon' => _x('Parent Product:', 'product'),             'menu_name' => _x('Shop', 'shop'),         );              $args = array(             'labels' => $labels,             'hierarchical' => false,             'supports' => array('title', 'editor', 'thumbnail', 'custom-fields', 'revisions', 'page-attributes'),             'taxonomies' => array('Product Categories'),             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'menu_position' => 20,             'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'has_archive' => true,             'query_var' => true,             'can_export' => true,             'rewrite' => true,             'capability_type' => 'post'         );              register_post_type('product', $args);     }          add_action('init', 'register_taxonomy_product_categories');          function register_taxonomy_product_categories() {              $labels = array(             'name' => _x('Product Categories', 'product_categories'),             'singular_name' => _x('Product Category', 'product_categories'),             'search_items' => _x('Search Product Categories', 'product_categories'),             'popular_items' => _x('Popular Product Categories', 'product_categories'),             'all_items' => _x('All Product Categories', 'product_categories'),             'parent_item' => _x('Parent Product Category', 'product_categories'),             'parent_item_colon' => _x('Parent Product Category:', 'product_categories'),             'edit_item' => _x('Edit Product Category', 'product_categories'),             'update_item' => _x('Update Product Category', 'product_categories'),             'add_new_item' => _x('Add New Product Category', 'product_categories'),             'new_item_name' => _x('New Product Category', 'product_categories'),             'separate_items_with_commas' => _x('Separate product categories with commas', 'product_categories'),             'add_or_remove_items' => _x('Add or remove product categories', 'product_categories'),             'choose_from_most_used' => _x('Choose from the most used product categories', 'product_categories'),             'menu_name' => _x('Product Categories', 'product_categories'),         );              $args = array(             'labels' => $labels,             'public' => true,             'show_in_nav_menus' => true,             'show_ui' => true,             'show_tagcloud' => false,             'show_admin_column' => false,             'hierarchical' => true,             'rewrite' => true,             'query_var' => true         );              register_taxonomy('product_categories', array('product'), $args);     }


title: How to set any theme setting from a custom WP_Customize_Image_Control?

text: I am using the Theme Customizer API to upload a logo for a WP theme. I also want to let the user set the css for the logo size via a number input in the same Customizer section. **What's the best way to automatically populate the the logo width and height settings with the logo's dimensions when the user uploads a image?** This is my control for the logo setting:               $wp_customize->add_control(         new WP_Customize_Image_Control(             $wp_customize,             'logo',             array(                 'label' => 'Upload a logo image',                 'section' => 'logo',                 'settings' => 'sst_logo'             )         )     );      Here is my custom control class where I have two number fields for the width and the height of the logo image:               class Logo_Size extends WP_Customize_Control {         public $type = 'text';         public function render_content() {             ?>                                      <?php echo esc_html( $this->label ); ?>                     <input class="sst-logo-width" type="number" data-customize-setting-link="sst_logo_width">                     <input class="sst-logo-height" type="number" data-customize-setting-link="sst_logo_height">                              <?php         }     }      Do I have to extend the WP_Customize_Image_Control class and modify the constructor somehow? Needless to say, OOP PHP is not my strength. Any advice will be greatly appreciated!


title: bypassing permission error for a plugin's page

text: i'm getting "You do not have sufficient permissions to access this page" error when trying to go to a plugin's settings. there's only one user which is the admin and has full access. this is the URL i'm getting this error on: store/wp-admin/options-general.php?page=wpb_vc_settings i tried to find the if statements which was about that error, like this:               if (!current_user_can('manage_options'))  {             wp_die( __('You do not have sufficient permissions to access this page.') );         }      and commented them, yet that error appeared again. even tried to delete the whole statement, nothing changed. I've searched through all the codes of the plugin with Dreamweaver but they weren't anywhere else. i'm looking for a way to bypass this.


title: Is it possible to import NextGen Galleries into Wordpress Galleries and convert embeds in all posts?

text: **Let me explain —** Until now, I have been using NextGen Gallery, and since I have a redesigned website that has image.php template (gallery attachments page), I would like to use Wordpress' built-in gallery feature instead. **Here's the problem —** I can't forever continue to monitor if NextGen Gallery plugin is working as intended on my website, even though my old posts still use it. Considering that, I would like to import and convert all NextGen galleries into Wordpress galleries. Is there a way to do this without all the hard work of having to upload gallery-by-gallery, post-by-post (I have close to 250 galleries!)?


title: How to customize the Categories meta box to allow only one category?

text: I'm trying to customize the Categories meta-box when adding a post. ![screenshot](http://i.stack.imgur.com/UkmL4.jpg) I have added a custom post and I need the administrator to post a new post without the ability to use the top level categories and also, he can just choose only one category, no more than one category!


title: How do I reset a rewrite?

text: I made a mistake in writing a previous rewrite in .htaccess. How do I reset it?   My home_url = http://basicsourcemassage.ca/bsmassage   My site_url = domain name   All pages work fine except for the home page/domain url that returns   http://basicsourcemassage.ca/bsm.basicsourcemassage.ca


title: Weird admin area

text: Everything works fine but it looks weird and I'm worried. See attached screen grab. Any ideas? ![screen grab](http://i.stack.imgur.com/V9Wj9.png)


title: Next and Previous links on a single taxonomy page only link to same term

text:
I am currently using toolbox as a parent theme and have created a template file called single-projects.php where all posts of the custom post type 'projects' are shown. The previous and next buttons work well but they show the next posts in the same 'projects' post type and I need them to be in the same taxonomy as well. The code for the previous/next links now looks like this:
<?php previous_post_link( '%link', '' . _x( '←', 'Previous post link', 'toolbox' ) . ' Previous Post' ); ?>

<?php next_post_link( '%link', 'Next Post ' . _x( '→', 'Next post link', 'toolbox' ) . '' ); ?>
           This post seemed the closest to what I need http://stackoverflow.com/questions/5775197/wordpress-get-pages-taxonomy- parameter but I could not get it to work. Is there a way to only link to posts in the same taxonomy?


title: Wordpress ajax call returns a zero though die()

text: I am doing an request for a plugin. This works fine, on my testplatform (regular WP), but it makes problems on a WPMU (both latest wp versions.) This is my function:               function my_action_callback() {     $post = $_POST['shortcode'];     $post = str_replace('\"','"',$post);         echo do_shortcode($post);     die();      }      Whatcould be the issue?


title: Search Form Including Price

text: I've been searching through posts & tutorials for four days now without any luck. My background is front-end web design but the latest project calls for a little more in depth work. I'm looking to learn and code (or reverse engineer) this myself rather than installing a plug-in to do the work for me. The goal is to include a with price range options, such as $50 Under, $50-$100, $100-$150, ect (in $50 increments). The 'price' is stored in a custom field within each post (no custom post types). Any help is GREATLY appreciated, here is my current search form (as sad as it may be).               <form method="get" action="<?php bloginfo('url'); ?>">     <fieldset>          <!-- TEXT INPUT SELECTION -->     <input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />     <!-- END TEXT INPUT SELECTION -->               <!-- CATEGORY SELECTION -->     <select name="category_name">     <option value="">all categories</option>     <option value="audio">Audio</option>     <option value="computers">Computers</option>     <option value="gadgets">Gadgets</option>     <option value="gaming">Gaming</option>     <option value="movies">Movies</option>     <option value="smart-phones">Smart Phones</option>     <option value="photography">Photography</option>     <option value="tv">Television</option>          </select>     <!-- END CATEGORY SELECTION -->          <!-- CATEGORY SELECTION -->          <input type="text" value="price" name="price" id="price" />          <!-- END CATEGORY SELECTION -->                             <input type="submit" id="searchsubmit" value="Search" />     </fieldset>     </form>      Please remember I'm only a few weeks into php, so any "dumbed down" code would better help me reverse engineer! Thanks!


title: Prevent other editors from viewing images of other editors in Add Media Popup

text: Hi I have this code in my functions.php and its working well when the editor is viewing the Media library: http://example.com/wp-admin/upload.php               add_action('pre_get_posts','users_own_attachments');          function users_own_attachments( $wp_query_obj ) {          global $current_user, $pagenow;          if( !is_a( $current_user, 'WP_User') )         return;          if ( 'upload.php' != $pagenow )          return;          if( !current_user_can('delete_users') )         $wp_query_obj->set('author', $current_user->ID );          return;     }      The above code will prevent other editors from viewing the images uploaded by other editors in the media library. Only the administrator can see all images uploaded. The editor can only see the images uploaded by themselves (not others). Now here is the issue, when creating or editing a post, Wordpress has an "Add Media" button that will allow users to upload images to their gallery. But the code above does not work when the user will upload via "Add Media" popup. They can still see the images uploaded by other editors. How is it possible to modify the above code so that it will still work when users are viewing images via the "Add Media" popup and not the media library? Thank you so much for your help.


title: list pages only from master parent

text: I have a menu on a page that shows the children of a parent page, however, if a sub page is clicked on the children only of the sub page shows in this nav. is it possible to haver the direct children of the master parent page? I'm currently using the following:               $thispage = $wp_query->post;     if($thispage->post_parent!=0){         wp_list_pages("title_li=&child_of=".$thispage->post_parent);     }else{         wp_list_pages("title_li=&child_of=".$thispage->ID);     }


title: Random occurences of 502 Bad Gateway using Wordpress and Nginx

text: I am new to using Wordpress on Nginx and am seeing funny errors pop up here and there. For a while when I was searching for a new plugin through **/wp-admin/plugin- install.php?tab=search &s=captcha&plugin-search-input=Search+Plugins**, I get: **502 Bad Gateway** After a while, everything just started working again fine. However, now when I try to access anything inside **/wp-admin** I am getting a 502 error again. The front end of the site works fine. What are the steps to get things moving cleanly and to prevent this from constantly happening.


title: Wp_update_post: Infinite loop even with remove_action solution, OOP

text: I have a quite complex PHP class, reponsible for creating and printing meta_boxes, generating and saving meta fields, ... Each meta_box (object of class) has its own save function, that updates meta data of post (fields for them are instances of another class) as well as its `post_excerpt` and `post_content`. Yep, it's probably a little complicated, but as I'm only starting with OOP, I'm pretty happy with it so far. **TL;DR, THE PROBLEM** : With `wp_update_post()` called on `save_post` hook, I get an infinite loop. This issue is documented on WP codex as well as mentioned here on WPSE: How to avoid infinite loop in save_post callback. > If you are calling a function such as wp_update_post that includes the > save_post hook, your hooked function will create an infinite loop. To avoid > this, unhook your function before calling the function you need, then re- > hook it afterward. > >> Source: Codex This is a very simplified version of a code I am using:               class MetaBox {              public function __construct() {             // a lot of stuff, hooks and other function initiations             add_action('save_post',array($this,'save_box'), 20);         }              // more stuff              function save_box() {             // verify nonces, bail out on autosave, ajax, cron, ...                  switch ($this->id) {                 case 'editor':                 case 'postexcerpt':                          // remove action                     remove_action('save_post', array($this,'save_box'));                     // bail out on post_revision                     if (!wp_is_post_revision($post_id) ){                              $post = array(                             // post id                             'id'    => $post_id,                             // tosave: either post_content or post_excerpt                             // value: pulled from static associative multi-array inside MetaBox                             $tosave => self::$meta[$this->id][$this->id]                         );                         wp_update_post($post);                               }                          // add action back                       add_action('save_post', array($this, 'save_box'));                      break;                 default:                     // some saving functionality for meta values, that WORKS just fine                 break;             }         }     }      I am getting an infinite loop with PHP error notice: `Undefined index: ID in XXX/web/wp-includes/post.php on line 2987` Am I removing/adding save hook wrong? Does it have something in common with using the save function non-statically? I am of course happy to provide the rest of the relevant code, if there's no apparent problem with this structure. # EDIT The infinite loop problem is gone - as @TheDeadMedic mentioned, problem lied at not matching priority. > To remove a hook, the $function_to_remove and $priority arguments must match > when the hook was added. This goes for both filters and actions. No warning > will be given on removal failure. > > Codex: http://codex.wordpress.org/Function_Reference/remove_action # EDIT 2 As PHP is a case sensitive language, `Undefined index ID` notice problem lied in my $post array (parameter of `wp_update_meta`). The ID key must be specified uppercase.               $post = array(         'ID' => $post_id    // ID must be uppercase     )      ///// As my question turned out to be very localized, feel free to delete it. And thanks again for helping me! Thanks in advance!


title: What can I expect when moving from a hosted (WordPress.com) blog to one hosted by Page.ly

text: As I mentioned here, I'm planning to moving my blog to a new hosting provider from WordPress.com. I think I've settled on Page.ly as the new home for it, and I was hoping to get the benefit of experience from any of you who have transitioned an existing blog specifically from **WordPress.com** to **page.ly**. **Some examples of the potential issues I'm trying to ferret out:**   * Am I going to lose any WordPress.com specific features in the transition?   * Any new maintenance issues/headaches that weren't there on Wordpress.com?   * Any surprise "Upgrade" fees for things I'm used to getting for free?   * What information can I expect to lose in an export/import process (Site stats, dates on comments/posts/subscribed users/something else?)   * General tips, advice, whatever that you wish you knew before you did the move.


title: Conditional Query of Custom Post Type and custom taxonomy

text: I am working on a project that has   * a custom post type called 'Experience Statement'   * Custom Taxonomy attached to that post type called 'Expertise'   * 6 different terms for the custom taxonomy: Coastal, inland, marine, waterway, ship, telecommunications So, I have created this loop, that works great and I have created 6 different template pages with this loop in each (I just change the term for each) `<?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("post_type=experiencestatements&expertise=coastal&showposts=10&paged=$page"); if ( have_posts() ) : while ( have_posts() ) : the_post() ?>` So, this is working fine, but I have to create a different template page: i.e. page-exp-stmt-coastal.php for each term. I would like to have only one template page with conditional statements for each term instead of 6 (and counting) template pages. Having 6+ different pages means I have to go in and change each one every time the client wants a tweak. In summary, I need some help crafting a conditional tag that changes the loop depending on the taxonomy term. AND, I have no idea how to do that. Any help is greatly appreciated. Thanks, Larry


title: How can I create custom in-post templates?

text:
I write posts about math and computer science. Many of those posts need some previous knowledge. I would like to create a box for some articles with links to these basics, simmilar to UbuntuUsers. In my articles I would like to add them like this               {{previousKnowledge|first|second}}      Does a plugin exist for this task? Can I create a custom template which does basically replace this text by the following?

first

second


title: When is admin_init Action ran?

text: I have this function below that is called with the `admin_init` Action               function my_flush_rewrites() {         global $wp_rewrite;         $wp_rewrite->flush_rules();     }      Like this               add_action('admin_init', 'my_flush_rewrites');      I am curious, when is this called? Is this called on every page load? Hopefully not


title: Recovering WP Login Credintials in Code?

text: Is there anyway to recover login credentials to Wordpress admin through the code somewhere? I just tried wp-config. I'm asking because my email is not primary on the account so using 'Forgot Password' wouldn't help much as I need to get in now? (I have FTP / Host access.)


title: Default Template infinite loop of Title

text: Pages which have no specific template assigned output an infinite amount of h2 page titles, which looks like this: ![enter image description here](http://i.stack.imgur.com/fcmRb.jpg) This is what my Themes index.php looks like:               get_header(); ?>         Hallo     get_footer(); ?>      Thanks for helping me out. I am new to Wordpress.


title: How to Emulate Default Navigation Menu Behaviour in a Custom Theme?

text: I'm trying my hand at developing a custom theme, and I've got navigation menus working (with the help of this walker, but only if they're explicitly defined in the menu settings. The default themes (twentyfourteen, twentythirteen) seem to be able to create a default menu solely from the existing pages hierarchy, without needing to create a separate menu structure. I've had a look around the source for the twentyfourteen theme, but as far as I can tell, the menu is generated with a standard `wp_nav_menu` call. I don't see anything that accounts for how it loads a menu when none are defined. Does anyone know how I can automatically populate my menus as the default themes do?


title: How can I determine where I want to edit in the backend (server)

text: My boss has a wordpress site and he wants me to give him the ability to add videos from a site called vzaar. I see the form, I see the main PHP file for editing posts. Unfortunately I can't track the form down to the backend file. How can I know which file I want to edit. The theme were using is called mercurial. All I need to do is add one select box and probably some backend logic. My background: I'm really familiar with Ruby on Rails, but have little experience with PHP. Seems simple enough, i'm just not super stoked about having to re-engineer the WP theme.


title: Wordpress Pagination not displaying posts after certain page

text:
I'm having an issue with pagination. I have a media category, using a category-media.php template. I have a custom loop with a paged variable. There are 30 posts total. Sample:               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $args = array(        'posts_per_page'   =>  3,        'category_name' =>  'media',        'paged' => $paged     );          $my_loop = new WP_Query( $args );          echo $my_loop->max_num_pages . "

";          while ($my_loop->have_posts()) : $my_loop->the_post();            echo get_the_title() . "

";          endwhile;          wp_pagenavi( array( 'query' => $my_loop ) );      Pagination shows up fine and max_num_pages even echos out 10 pages. When I start clicking through the pagination links, nothing shows for pages past page 5. My reading setting are set at 6 per page. If I comment out the posts_per_page parameter, pagination works fine. I feel like it's something simple that I'm overlooking. Any ideas?


title: Using WP Rewrite, but just not "getting it"

text: I'm trying to use WP Rewrite to avoid having to enter anything into an htaccess file. So far, I have this one working just fine (it loads a post from a Custom Post Type):               $leader_structure = 'performance/leaders/%leader%';     $wp_rewrite->add_rewrite_tag("%leader%", '([^/]+)', "leader=");     $wp_rewrite->add_permastruct('leader', $leader_structure, false);      Basically, if you go to http://domain.com/performance/leaders/some-slug-here, it'll properly load the content from http://domain.com?leader=some-slug-here. However, when I try it again with a non-custom-post-type (just normal WP posts), I can't get it to work. Here's what I'm doing:               $scenarios_structure = 'our-thinking/scenarios/%post%';     $wp_rewrite->add_rewrite_tag("%post%", '([^/]+)', "name=");     $wp_rewrite->add_permastruct('scenarios', $scenarios_structure, false);      So here, I want it so that http://domain.com/our-thinking/scenarios/some-post- slug should load the single WP post. But it doesn't. When I go to that URL, it redirects to http://domain.com/some-post-slug. It's probably plainly obvious what I'm doing wrong to someone else, but I'm just not getting it. My WordPress permalink settings are set to "Post name". And my .htaccess file is untouched.


title: Setting up a Multisite WordPress for Wedding Websites?

text: I want a multi site WordPress website to make a wedding website in which the users can make their accounts for their websites, how will this actually be done in WordPress?


title: region selection

text: I'm developing a website, where the visitor has to choose it's region Europe / Asia, according to this choice the menu should be different, (most pages are the same). When I would develop this in any other environment my choice would be to put the selection in a cookie, and check the cookie in my templates. Is there another, better way to do this in wordpress? Also I think a nice way to do it would be to just put it in my .htaccess. So it would be `example.com/asia/aboutus` and `example.com/europe/aboutus`. The problem is I am also using qtranslate, so I might screw that up it would be, `/asia/en/aboutus`. So can I have this in my permalinks? * * * EDIT I have tried this method ( http://stackoverflow.com/questions/3256888/how-to- include-a-custom-string-in-a-wordpress-permalink ) and adapted it to my needs. But it doesn't seem to work. Can someone find my mistake? Thanks a lot. What happens now when i go to website.com/en/asia/about-us it changes into website.com/en/about-us and nothing else happens. **tldr** : I have, website.com/en/about-us and I want, website.com/en/asia/about-us so I can get 'asia' in my page, to change my menu accordingly. My code in functions.php               function my_rewrite_rules($rules)     {         global $wp_rewrite;              // the key is a regular expression         // the value maps matches into a query string         $my_rule = array(             '(.+)/(.+)/(.+)/?$' => 'index.php?pagename=matches[3]&my_action=$matches[2]&lang=$matches[1]'         );              return array_merge($my_rule, $rules);     }     add_filter('page_rewrite_rules', 'my_rewrite_rules');               function my_query_vars($vars)     {         // this value should match the rewrite rule query paramter above              // I recommend using something more unique than 'action', as you         // could collide with other plugins or WordPress core              $my_vars = array('my_action');         return array_merge($my_vars, $vars);     }     add_filter('query_vars', 'my_query_vars');      my code in index.php               echo esc_html(get_query_var('my_action'));       My .htaccess               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress     <IfModule mod_rewrite.c>       AddType video/ogg .ogv       AddType video/webm .webm       AddType video/mp4 .mp4     </IfModule>


title: Woocommerce custom email after order is submit

text:
I want to create an custom function that can send an custom order email to an chosen supplier (in the checkout form). But when i try to get the data from the checkout in the email, the checkout form did not sent the order. I could also not complete the order. Hopefully someone could help me, and tell me what is wrong in my code. Code:               // Triggers for this email     add_action("woocommerce_checkout_order_processed", "my_awesome_publication_notification");          function my_awesome_publication_notification($post_id) {         global $woocommerce;              $post = get_post($post_id);         $checkout = $woocommerce->checkout();         $order = new WC_Order( $order_id );         $author = get_userdata($post->post_author);         $title = get_the_title();              $author_email = 'info@domain.nl';         $email_subject = 'New order recieved';         $site_title = get_bloginfo('name');         $customer_address = $woocommerce->customer->get_adress();         $customer_address_2 = $woocommerce->customer->get_adress_2();         $customer_postcode = $woocommerce->customer->get_postcode();         $customer_city = $woocommerce->customer->get_city();         $customer_country = $woocommerce->customer->get_country();              ob_start();              include("email_header.php");              ?>
             Hi, <?php //echo $author->display_name ?>. I've just published one of your articles              (<?php //echo $post->post_title ?>) on <?php echo $site_title; ?>!

Order informatie
         Adres:
 <?php echo $customer_address; ?>
         Adres (extra):
 <?php echo $customer_address_2; ?>
         Postcode:
 <?php echo $customer_postcode; ?>
         Plaatsnaam:
 <?php echo $customer_city; ?>
         Land:
 <?php echo $customer_country; ?>
                             <?php              include("email_footer.php");                   $message = ob_get_contents();              ob_end_clean();                   wp_mail($author_email, $email_subject, $message, $headers);          }          add_filter('wp_mail_content_type','set_content_type');          function set_content_type($content_type){     return 'text/html';     }


title: How to move wordpress blog under IIS 7 sub-folder

text: I have installed wordpress under wwwroot/mydomain.com/wordpress and bind it to mydomain.com port 80 under IIS 7. Then I change to bind wwwroot/mydomain.com to mydomain.com instead and change site url in wp_options to mydomain.com/wordpress. But when I try http://mydomain.com/wordpress I get 404 error from IIS. Why ? Note: I didn't change web.config               <configuration>         <system.webServer>             <rewrite>                 <rules>                     <rule name="wordpress" patternSyntax="Wildcard">                         <match url="*" />                             <conditions>                                 <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />                                 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />                             </conditions>                         <action type="Rewrite" url="index.php" />                     </rule>                 </rules>             </rewrite>         </system.webServer>     </configuration>


title: How to change the path to a WP MU site?

text: My WP MU site is at `http://www.mydomain.com/mymu/`. I would like to change it to `http://www.mydomain.com/somethingelse/`. Can I just open up FTP and rename the folder or will that cause any issues?


title: WordPress XML-RPC attack

text: Yesterday I suffered a **DDoS attack** on my WordPress site. I had **21,443 hits** with HTTP Status code 404 and a Bandwidth of **711.85 MB**. Also, CPU usage went to 100%. Logs show a lot of this entries:               ...     119.71.5.44 - - [03/Sep/2014:18:34:57 -0700] "POST /xmlrpc.php HTTP/1.1" 404 34826 "-" "-"     197.149.17.195 - - [03/Sep/2014:18:35:01 -0700] "POST /xmlrpc.php HTTP/1.0" 404 34826 "-" "-"     210.206.226.130 - - [03/Sep/2014:18:35:04 -0700] "POST /xmlrpc.php HTTP/1.1" 404 34826 "-" "-"     ...      I'm trying to understand this log.   1. This was only a DDoS attack or they were trying to hack my site?   2. Was I under attack or they used my site to attack others? (all IPs entries are different)   3. What is the best way to stop this? Modify .htaccess file or Add a filter in functions.php


title: Conditional arguments  WP_Query for post custom fields

text: All in my case I want to get post result by Gender, Age, City etc... I am using this query. If i have any of variable like age, city, gender for that "AND" operation will perform and get only result for that variable. **Note:** Consider those case also where i have no variable like city but it should work for gender & state. My Query is               $gender = $_GET['gender'];                     $city = $_GET['city'];                     $state = $_GET['state'];                          $wp_query = new WP_Query( array(                          'post_type' => 'profile',                         'meta_query' => array(                                  'relation' => 'AND',                                 array('meta_key' => 'wpcf-gender', 'meta_value' => $_GET['gender'], 'meta_compare' => '=='),                                 array('meta_key' => 'wpcf-city', 'meta_value' => $_GET['city'], 'meta_compare' => '=='),                                 array('meta_key' => 'wpcf-state', 'meta_value' => $_GET['state'], 'meta_compare' => '==')                                                        ),                         'paged' => $paged )                      );


title: Change CSS on tag in tagcloud, if ther current post is tagged with the tag

text: My tagcloud are placed in the sidebar (outside the loop). I want to give the tags in the tagcloud a class if the current post is tagged with the tag. How do I do this? - something id wrong :( This is my PHP-code:               $tags = get_tags();     $post_tags = get_the_tags($currentid);          if ($tags) {       foreach ($tags as $tag) {         if( (is_tag($tag)) || ($tag->name == $post_tags) ){            echo 'term_id).'" title="'.$tag->name.'" class="currenttag">'.$tag->name.' ';            } else {           echo 'term_id).'" title="'.$tag->name.'"">'.$tag->name.' ';           }         }       }


title: Password protected posts redirects

text: I have a page associated with a custom template that list all password protected posts. > Let's name it **MyPage**. What I'm trying to achieve is when a user views **MyPage** to show only once the **password protected form** and when he/she enter a valid password -> to redirect back to **MyPage** so he can view the listing of the protected posts. I want on the listing template to show only one form and when the user entered his password to show only the posts with the same password (or the posts in the same category) that are unlocked. The password is the default post protection password from the publish meta box: > ![WordPress post publish meta box](http://i.stack.imgur.com/MU9tg.png)


title: Extra meta for a taxonomy list

text:
I have a created a taxonomy for my wrdpress theme with check-box 3 parent each has 3 child and want to ad an extra input if user don't want my option then he can give his/her custom option can any one give me suggestion that how can i do that.               <?php          $terms = get_terms('petition',array('orderby' => 'term_group', 'parent' => 0 , 'hide_empty'=> '0' ));             $count = count($terms);         if( $count > 0 ){             foreach( $terms as $term ){                 echo ' slug.'"><input name="cb[]" value="'.$term->term_id.'" id="'.$term->term_id.'" type="checkbox"> '.$term->name.'
';                 $terms1 = get_terms('petition',array('parent' => $term->term_id , 'hide_empty'=> '0' ));                 $count1 = count($terms1);                 echo '
term_id.'_childs" style="display: none;margin-left: 20px;">';                 foreach ($terms1 as $term1){                     echo 'slug.'"><input name="cb[]" value="'.$term1->term_id.'" id="'.$term1->term_id.'" type="checkbox"> '.$term1->name.'
';                 }                 echo '<input type="text" name="'.$term->term_id.'_extra" placeholder="Or, enter a specific legislator\'s name" />';                 echo '
';             }          }     ?>      This is my code to get a custom terms and in the last i have added a static input where i want to add dynamic input or some times drop down list...


title: User: Editor, can't see edit taxonomy screen

text: For some reason the Editor role does not get access to the edit taxonomy screen on my site. Maybe that is expected behavior, I dont know - But how can I add this to the editor role capabilities?


title: Add mark-up after/before link in wp_list_categories

text:
This is probably a trivia question, but I can't seem to find a simple solution. This is my wp_list_caterories php...               <?php wp_list_categories(array(         'orderby'   => 'name',         'show_count'    => 1,         'title_li'  => ''     )); ?>      This currently outputs this...
Uncategorized (8)
      I am trying to add this `<span>|</span>` before my link so the final output looks like this...
|Uncategorized (8)
      Is it possible to do this within the PHP. I could do it using jquery but I'd rather use the PHP. Many thanks for any help. Josh


title: Show custom taxonomy inside custom menu

text: I have a custom menu using `add_menu_page`:               add_menu_page('My menu' , 'Some text', 'read', 'nwcm');      Under it, I show a custom post type menu item;               // Create the news custom post type     register_post_type('nwcm_news', array(         'labels' => array(             'name' => __('News for clients', NWCM_TEXT_DOMAIN) ,             'singular_name' => __('News', NWCM_TEXT_DOMAIN)         ) ,         'public' => true,         'has_archive' => true,         'public' => true,         'show_ui' => true,         'show_in_menu' => 'nwcm',         'taxonomies' => array(             'nwcm_news_category'         ) ,     ));      Then I add a custom taxonomy hooked to that "nwcm_news" post type:               // register news taxonomy     register_taxonomy('nwcm_news_category', 'nwcm_news', array(         'label' => __('News categories') ,         'menu_name' => __('News categories') ,         'rewrite' => array(             'slug' => 'nwcm_news_category'         ) ,         'hierarchical' => true     ));      The parent menu and the custom post type both show correctly... but, the taxonomy menu isn't showing :( How can I solve this? I had checked this solution but the answer lacks the full code example..


title: Limit username to specific characters (A-Z and 0-9)

text: How do I limit the username field upon registration to `A-Z` and `0-9` for single site? So no spaces, hyphens, underscores, dots etc.


title: Apply Post Class to Custom Post Type

text: I am trying to add specific CSS post classes to the `services` custom post type. However, when I apply this function to the post class filter, it applies the function to all post types. My goal is to change the layout `services` archive page with CSS classes. Is the problem with the `if ( is_singular('services') )` portion or does it have to do with the `global $wp_query;` which might be querying every post? Any solution would be greatly appreciated. The full code:               add_filter( 'post_class', 'woo_custom_add_post_classes', 10);          function woo_custom_add_post_classes ( $classes ) {         if ( is_singular('services') ) { return $classes; }                   global $wp_query;               // Get the number of the current post in the loop.         $current_count = $wp_query->current_post + 1;              // Work out whether this post is the last in a row.              $iflast = 'last';              if ($current_count % 3 == 0 ) { $iflast = 'last'; } else { $iflast = '';}              // Add the classes to the array of CSS classes.         $classes[] = 'service-number-' . $current_count; // Service number.          $classes[] = 'threecol-one';         $classes[] = $iflast; // Last in the row or nothing               return $classes;          } // End woo_custom_add_post_classes()


title: accessing monthly archive from dashboard

text: I've been posting to my wordpress site the same way forever, not really knowing much about what I'm doing. It all seems easy. Recently I've started playing with the site and trying to access parts of the pages other than the actual posts. While in the dashboard I realized that there is no way to access the html in the monthly archive pages...or atleast I can't figure out how one does it. Can anyone tell me how I can access the html ofthe monthly archive pages from the dashboard? Thanks for any suggestions anyone can make.


title: How do I create a WP user outside of Wordpress and auto login?

text: I've built a directory of members on a non-WP site (using php and mysql). Each member can log in and update their details using a username and password. I want to be able to get this to automatically create a user on the Wordpress site using the details from the directory of members. Ideally, if they update their details on the directory of members the their user details on the WP site will update. I am not sure how this would work in terms of passwords. Both the WP and directory of members sites are on the same server and so can access each database. I'd also be able to have a link on the Directory of members that will take them to the WP site automatically logging them in. I'm not sure about this last point, particularly due to security, however I just want to avoid them having to re-enter their username and password. Is there a way to achieve the above, ideally using something that already exists?


title: wp_link_page - wrap current page element

text:
I'm trying to make something more meaningful out of the `wp_link_pages()` result:               $paged_page_nav = wp_link_pages( array( 'echo' => false ) );     // Now let's wrap the nav inside
-elements     $paged_page_nav = str_replace( '<a', '
', '/a>
', $paged_page_nav );          // here I'd need to wrap the currently displayed page element          echo '
'.$pages_page_nav.'
';      Currently my link pages (numbered nav/pagination) displays like this:

1
         2
3

4

5


title: Why does my site flash white every time it changes page?

text: Any ideas? I've never had this problem before. Here is the site.


title: Getting a person's username from a wordpress cookie

text: My friend has a code that will allow users to receive a special key to gain access into into the closed/open beta event for any game they select. When a person is logged in, they can click on a link which will show them a key. If a person is logged logged in, the event page will tell them to login. What my friend needs is a way to get the person's username from the wordpress login cookie once the person has logged in. We found out that the wordpress cookie name is unique to each user that logs in (in other words it has a string of random letters and numbers in the cookie name). Any ideas? The piece of code we have on our page that we are using is this:               $username = $_COOKIE["nameofcookiehere"]      We need the $username variable so that every key that is given will be assigned to the username that is logged in based on the cookie and the key will be marked as "1" or "taken" in the database and the key will be assigned to that user in the database.


title: Jetpack plugin (ShareDaddy): Prevent share buttons showing on custom post types?

text: I noticed ShareDaddy has "Show sharing buttons on this post" for default post types but not for custom post types. I'm guessing I need to add something in `'supports' => array('title','editor','thumbnail')`. Does anybody know what I need to add in order for "Show sharing buttons on this post" to show up for custom post types?


title: window resizing problem

text: I have been working on a plugin of wordpress, in which i save the last reading position, the width and height of the browser at the time of closing the browser, I save the width and height with jquery height=$(window).height(); width=$(window).width(); and save the values in database so that when the page is loaded next time, the values are retrieved from database and the screen is scrolled to last reading position and the window get resized to the saved values. The problem that i m getting is that the window resizes to a very less value and window gets smaller, the jquery methods height=$(window).height(); width=$(window).width(); are saving lesser values, can anybody help me out in this?


title: Change author permalink

text: The original urls for users look like `/author/login/` **Is it possible to replace login by user's id?** In my dream urls should become to `/users/34/` (34 is user id). Thanks.


title: Display list of categories filtered by date?

text: I have a sidebar on our intranet which lists, hierarchically, posts by category. Such as:               -- HR     ---Events     ----Picnic      However, this list has gotten long, and some categories are no longer even used. I would like to only category links where there are posts less than a year old. Right now, I am using the default Categories Widget in the sidebar, but I can use a different widget or hand-code it. How would I best approach this?


title: How to setup a popup registeration page in wordpress with function.php

text: everyone: I wonder if there is existing tutorial on how to create a popup registration page in wordpress by utilizing function.php? or is there another way that can do with it? Thank you!


title: new WP_Query issues

text:
My default wordpress set hold 10 posts per page. In category.php , I want to override this with 999 post per page, the problem is that isn't working at all. When I use the following code. it doesn't adjust alphabetically or shows 999 posts                   <?php get_header(); ?>

Selecciona el modelo de tu auto▾

Todos

Modelo

Version

Año

                 <?php                 global $query_string;                      $args = array(                   'post_per_archive_page' => '999' ,                   'orderby' => 'name',                   'order' => 'ASC'                   );                        $the_query = new WP_Query($query_string,$args); ?>                        <?php                   if ( $the_query->have_posts() ) :                     while ( $the_query->have_posts() ) : $the_query->the_post();                   ?>
<a href="#" data-filter=".<?php theSlug(); ?>-<?php getYearTire(); ?>">

<?php the_title(); ?>

<?php the_version(); ?>

<?php getYearTire(); ?>

                 <?php endwhile; endif; ?>                 <?php wp_reset_postdata(); ?>

Auto

Modelo

Version

Año

Medida

       <?php       global $query_string;            $args = array(         'post_per_archive_page' => '999' ,         'orderby' => 'name',         'order' => 'ASC'         );              $the_query = new WP_Query($query_string,$args); ?>         <?php         if ( $the_query->have_posts() ) :           while ( $the_query->have_posts() ) : $the_query->the_post();         ?>              <article class="<?php theSlug(); ?>-<?php getYearTire(); ?> <?php the_version(); ?> <?php the_options(); ?> clearfix">
<?php the_post_thumbnail(); ?>

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

<?php the_title(); ?>

<?php the_version(); ?>

<?php getYearTire(); ?>

<?php whohaveit(); ?>

<input class="btn" value="Busca" onclick="window.location='/tienda/product-tag/<?php simple_tag(); ?>'">

                 <?php endwhile; endif; ?>
               <?php wp_reset_postdata(); ?>

     <?php get_footer(); ?>      Thanks


title: How to improve WordPress search

text: I heard many times, that WordpPess's search doesn't work good. Are there any other search engines available for wordpress? I know about sphynx, seems its a good one, but available plugins are out of date. Thanks.


title: Event Organiser breaks the theme

text: I installed a plugin called Events organiser and somehow it breakes the theme when viewing an event page. Can someone help me out as I´m struggling with this and can´t find the mistake. http://throwholics.com/events/event/indoor-meeting-weltklasse-in-karlsruhe/ Thank you so much.


title: creating files for displaying different custom post type posts with paging

text: I have the following post types: Post - wordpress built in Documents - custom post type Videos - custom post type I am very new to wordpress and I do not understand the template structure. I am creating template from scratch. I have created static front-page that lists recent "posts", recent "documents" and recent "videos". SO I do not want to use front-page to display all posts. I am using %postype% permalink structure and I am also able to display single item from each custom post type. What I cannot do is:   1. I need to have link like mypage.com/posts (or very similar) to display a list of posts with paging (10 posts per page)   2. I need to have link like mypage.com/videos (or very similar) to display a list of videos with paging (10 posts per page)   3. I need to have link like mypage.com/documents (or very similar) to display a list of documents with paging (10 posts per page) I understand how to retrieve 10 posts and I will probably be able to create paging, but I do not understand template structure and heararchy and routing. **Questions** How to name the file(s) where I should add my php code (based on wordpress traditional naming)? Should I create some dummy pages? How to make routing work and take code from my newly created php file(s)? * * * Also I am not sure if this would be correct to call this archive or not taking into account that later I need to filter also posts by date combining all post types in the list.


title: Get specific repeater row (via advanced custom fields) based on Meta Query with Wildcards

text: I've used Example 5 of: http://www.advancedcustomfields.com/resources/how- to/how-to-query-posts-filtered-by-custom-field-values/ to query a post by a wildcard. However, my problem is I only want to display the row (from the repeater field) which is the same number as the wildcard within the meta query. To give this more context, here's a brief example. I have a meta query that's getting the availability of a property by the 'week' field, which is brought through via a form and $_POST data. For the example I've hard coded the value.               $search_args = array(         'numberposts' => -1,         'post_type' => 'property',         'meta_query' => array(             array(                 'key' => 'availability_%_week',                 'value' => '20140607',                 'compare' => '='             )         )     );      I need to find what the number of the Wildcard is so I can then use it to get the specific row. Any help would be greatly appreciated.


title: FIND and REPLACE wp_posts AND IGNORE custom post type mysql query

text: does exists some MYSQL query for FIND and REPLACE wp_posts AND IGNORE all other wordpress and buddypress posts (buddypress-docs) and also custom post type = portfolio ? I want to find and replace only wordpress blog content and I don't want to touch other posts. I use following MYSQL query:               UPDATE wp_posts SET post_content = REPLACE (post_content,'Item to replace here','Replacement text here');


title: In list with recent coments - only show one comment per page/post (latest comment)

text:
I am trying to make a custum 'Recent Comments' code for use in the sidebar. I have come a long way, but there is just one thing that doesn't do what I'd like it to do. What I want is that, per page with comments that is found, only the last comment is shown. I was hoping post_per_page would do the trick, but it doesn't! This is my code:               <?php          $args=array(     'author_email' => '',     'ID' => '',     'karma' => '',     'number' => 5,     'offset' => '',     'orderby' => 'comment_date_gmt',     'order' => 'DESC',     'parent' => '',     'post_id' => '',     'post_author' => '',     'post_name' => '',     'post_parent' => '0',     'post_status' => 'publish',     'post_type' => 'page',     'posts_per_page' => 1,     'status' => 'approve',     'type' => '',     'user_id' => '',     'search' => '',     'count' => false     );     $comments = get_comments($args);          foreach($comments as $comment) :          ?>

     <a href="<?php echo get_author_posts_url($comment->user_id); ?>"><?php echo get_avatar(     $comment, 48 ); ?>

     <?php     $aantalcomments = get_comments_number( $comment->comment_post_ID );          ?>       <a href="<?php echo get_author_posts_url($comment->user_id); ?>"><?php echo($comment->comment_author) ?> op:
               <a href="<?php echo get_comment_link($comment->comment_ID); ?>">          <?php     echo($comment->post_name . " (" . $aantalcomments . ")
");     ?>          <?php          echo get_comment_date(' l, j F, Y ', $comment->comment_ID);          ?>

     <?php                    endforeach;          ?>


title: Hide page header on both index and author pages

text:
I'm using the Roots theme which is tricky to start with. I'm trying to hide the page headers from both index and author pages. I got to do it on index by using the following code:               <?php if(!is_front_page() ){ ?>

         <?php echo roots_title(); ?>

     <?php } ?>      But when I try to add a second conditional to hide it also on author, it doesnt work. This is what I tried:               <?php if(!is_front_page() || !is_author() ) { ?>

         <?php echo roots_title(); ?>

     <?php } ?>      Any idea about what I'm doing wrong? Thanks! Eric


title: Plugin options not being saved or created

text:
Having a lot of trouble with this config page. I have followed the documentation (which was sparse) and done a bit of searching for help. My problem is simple, my config options aren't being created or saved. Any help would be much appreciated! Here's the general set-up:                   public $view;              function __construct()         {             $this->view = new My_View;             // hook the settings menu             add_action('admin_menu', array($this, 'index'));             // hook the settings' settings             add_action('admin_init', array($this, 'registerSettings'));         }         /**          * setup the settings menu Page Title, Menu Title, Permissions, Menu Slug, View to render          */         public function index()         {             add_options_page("My Settings", "My menu", "manage_options", "My_Settings", array($this->view, 'index_view'));         }              public function registerSettings()         {             //options, name of option, validate function             register_setting('my_general_settings', 'my_general_settings');         }      next, the form:               public function index_view()     { ?>

Settings

                  <form method="POST" action="">
General Settings
                      <?php settings_fields('my_general_settings'); ?>                 <?php $settings = get_option('my_general_settings') ?>                      Enter your Publisher ID:                 <input type="text" name="my_general_settings[publisher_id]" value="<?php echo $settings['publisher_id']?>" />                 <input type="submit" value="Save Changes" />
Forgot your ID? Click here
             </form>
     <?php }


title: little help with a mySQL query to wp database

text: @t31os gave a very helpful response to: getting all values for a custom field key (cross-post) by providing this function               if ( ! function_exists( 'get_meta_values' ) ) {     function get_meta_values( $key = '', $type = 'post', $status = 'publish' ) {         global $wpdb;         if( empty( $key ) )             return;         $r = $wpdb->get_col( $wpdb->prepare( "             SELECT pm.meta_value FROM {$wpdb->postmeta} pm             LEFT JOIN {$wpdb->posts} p ON p.ID = pm.post_id             WHERE pm.meta_key = '%s'              AND p.post_status = '%s'              AND p.post_type = '%s'         ", $key, $status, $type ) );         return $r;     }     }      (slightly adapted) I need to adapt this function to retrieve not one but two columns; `meta_value` and `post_id`, both from the `postmeta` table and store these in an array. I'm not knowledgeable at all with `mySQL`. Any help is appreciated.


title: Loading Modernizr (or other JavaScript libraries) for use in a plugin

text: Download a copy of Modernizr, put it in your plugin’s directory and simply enqueue the script whenever needed. Done. The problem is that Modernizr **may already be loaded by another plugin**. You wouldn’t want to load it more than once. How can you find out if Modernizr is already available before enqueueing it yourself? This goes for any other JavaScript library really. You could check whether a script was loaded by using the `wp_script_is()` function. However, that function expects the **name of the handle** the script was registered by. You can only guess, right? Even if we assume the handle name is simply "modernizr", how do you check for a certain version (like 2.6.1)? Or worse, since custom Modernizr builds are possible, how do you check the features you need are included? The whole `wp_enqueue_script()` setup works fine for libraries that ship with WordPress by default, like jQuery, jQuery UI, Thickbox, etc. Their handle names are documented and you know which version to expect. WordPress doesn’t provide such master files for all JavaScript libraries, of course. Am I missing something here or is this just the messy situation you somehow have to deal with when developing plugins?