Bulk move (or copy) from a custom field to the post content?

I need to move (or copy) the contents of a custom field into the main post body, replacing any existing content. I need to do this for a few hundred posts...Is there a quick way of doing this? I can manage moving values from one meta field to another in SQL, but i'm not sure how to do this with post content... If anyone could give me some pointers that would be much appreciated.


Hide Front-End Admin Bar Including 32 px Spacing

I have a custom template and I inserted the following snippet to get rid of the admin bar for the page:               function hide_admin_bar(){ return false; }     add_filter( 'show_admin_bar', 'hide_admin_bar' );      The problem is this still leaves a blank white empty bar at the top of the page with a height of 32px. Looking at core, I see this function but there is no way to disable it. I also tried overriding `html { margin-top: 0 !important; }` in my theme stylesheet to no avail since this is output on the page directly.               function _admin_bar_bump_cb() { ?>     <style type="text/css" media="screen">         html { margin-top: 32px !important; }         * html body { margin-top: 32px !important; }         @media screen and ( max-width: 782px ) {             html { margin-top: 46px !important; }             * html body { margin-top: 46px !important; }         }     </style>      Does anyone have a clean way to completely remove the admin bar from the top of a specific template page (plus the white space)?


Role Scoper, don't allow other users to see pending posts

I have noticed in Role Scoper recently (sure it wasn't always like this) that contributors can see all the pending posts of all users. Basically I have it set up so users have to submit their posts for review. But I don't really want any posts to be public in any way other then to admins and the user them self until it's been approved. Can't figure out how I'd set that in role scoper, any ideas?


How to operate two wordpress databases simulataneously?

I am having a situation, where i have two wordpress sites. One is for saving the data and content and other is for showing the data/content. Now the situation is, i want a user to register on one site, it will be automatically registered on other. I know we can do it with custom mysql query for insert into wp_users and wp_usermeta, but i want to use the wordpress function like update_user_meta and wp_create_user. But if i am on first site and user update_user_meta etc. it will take the current site's database. So i want to know if there is any way so that we can user same function but works on different site ? I guess may be we can have two $wpdb object with different database access. So that we can use functions like:               $wpdb->update_usermeta();  //for source site     $wpdb1->update_usermeta(); //for destination site.      Any suggestions please ?


Why Transients may not work correctly?

I have a plugin that needs to check for update. Function below - get_version_to_update is fired when someone enters plugin admin page. In theory after request is done, data should be cached via transients for 24h. And this works for most sites, but for some specific sites I get data that wp_remote_request fires over and over, which (as I think) means that transient isn't saving. Why this might happen? Is there more reliable way to check this?               public function get_version_to_update(){              // I get the transient         $data = get_transient("my_plugin_remote_version");              // I check if it exists         if($data === false){             // here I get data from server using wp_remote_request, server return just version number, e.g. "2.0"                $data = wp_remote_request(...);                  // I cache it for 24h             set_transient("my_plugin_remote_version", $data, 60 * 60 * 24);         }               // I check if returned data from server is correct          if ( !$data || is_wp_error( $data ) || 200 != $data['response']['code']) {             return false;          } else {             if( version_compare(MY_PLUGIN_VERSION, $new_version, '<') ) {                         // return new version, if it's newer then current                  return $data['body'];             } else {                 return false;             }          }     }      This issue is killing me, thank you for any help!


importing wp_users table as a way to import users into new site?

I have a completely new build of a site and am trying to import existing users into the new site. I have a plugin that allows extra fields at registration so was thinking the best way to keep things intact would be to export the wp_users and wp_usersmeta table from the old site and import into the new. However am not sure if this will cause complications with comments or other issues with the database in general - doesn't seem wise inb principle as other tables may be linked to wp_users etc and cause corruption?


how to use thickbox in admin?

I would like to show my retrieved content form my classes method in thickbox. How could I do this? I have been adding the proper id to my desired hyperlink but all of the admin body is getting parsed inside of the thickbox.               Click               calss myAdmin{          public function__construct(){          }          public function myfunction(){          echo '
The content of my thickbox
';          }          }


How can I make a wp site in a mobile application?

Which are the ways and how is possible a wp site become an iphone, ipad, android and a blackberry application(not a wp mobile theme)?


Create plugin/function to catch XML-data via Shortcode

I need to display data from an XML-file inside Wordpress posts, and I want to use shortcodes to do it. I have this XML-file witch I need to get the data from; > >     http://xml.prisguide.no/productExport.php?productId=151690 >   I would like to have a shortcode e.g. `[prisguide id="151690"]`, and then the product information (limited to name, price, basic information etc) from the XML-file will display in the post. How can I achieve this?


User Meta not Updated?

I've gone in and give custom meta fields for the users in the database, and have assigned all the appropriate values to them. I also have a page set up with all of the users being displayed with the custom meta values. However, upon refreshing the page that the users are displayed on, the custom meta doesn't seem to be displaying. Going back to each individual users profile, I can see that the meta is preserved, and upon clicking save changes, the custom meta data is _then_ applied. Is there some sort of cache that needs to be cleared in order for WordPress to get the metadata without updating each user individually? Or is there some way for all meta data to be saved all at once?


Using do_shortcode with variables?

Struggling to get the format right for the PHP in this do_shortcode embed using variables from Advanced Custom Fields plugin. I think I've tried every variation on ., ', and ". After reading every resource I could find I'm still no closer.               <?php          $address = get_field('cong_streetaddress');         $city = get_field('cong_city');         $province = get_field('cong_province');         $postalcode = get_field('cong_postalcode');              echo do_shortcode('[pw_map address="'" . $address . " . " . $city . " . " . $province . " . " . $postalcode . "'" width="100%" height="200px"]');      ?>      Doing it with just one variable, like so `echo do_shortcode('[pw_map address="'. $postalcode . '" width="100%" height="200px"]');` works fine.


How do I make a wordpress plugin with menu item etc

I've been reading documents, viewing videos, etc. on how to create a Wordpress plugin. I've learned how to filter a post, add txt to a post, use conditionals to see if the page is a single post as not to display text throughout the entire site, etc. The part that I'm not understanding is how to create a plugin, with it's own menu item that will bring the user to this plugin that im creating. Lets say for example my plugin should be a blank page (with Wordpress header, footer, etc.) that simply displays 'Hello World!' - How do I create this very simple plugin, on its own page (not seen all over the site) with its own menu button that brings the user to this plugin? Do I create a template and a menu item that links to the template? I'm so confused... I found how to 'Create page' in the admin section, but that seems to only create a menu item that corresponds to a blank page where I can add html. I can't seem to even find any plugin examples where this is done, but I would think it would be relatively easy to create a plugin that has a menu item so visitors know how to get to the plugin. If I wanted to create a simple plugin so visitors to my Wordpress can click a menu item called 'Bicycle races' and be brought to my plugin page where they can view the output of my plugin, a list of bicycle races in this case, how would I accomplish this? Do I create a simple plugin, or do I create a template as well? Please help me locate any possible plugin examples where this is accomplished. Thanks


Filtering wp_title() in WordPress

I am using this in header file of my site.               <title><?php wp_title( '|', true, 'right' ); ?></title>      But it is displays '|' at the end of title on all the pages of site like this               <title>Our Company - SEO Company 1SEOIN |</title>      I want to remove this '|'. How can I do this?


How do I begin debugging where the description meta tag is set for my categories?

I have the code base for my Wordpress theme, but where do I start debugging where the meta description tag is set for my theme. What I need to do is make it not be set because I set my descriptions in the Yoast plugin. I did a grep for this:               "<meta name=\"description\""      But the files it returned didn't seem to be the ones I needed. Would anyone know what is the right way to locate where the description tag for categories is set in the theme? I am using a Suffusion theme. EDIT: This is my header.php               <?php     /**      * Core header file, invoked by the get_header() function      *      * @package Suffusion      * @subpackage Templates      */          global $suffusion_unified_options, $suffusion_interactive_text_fields, $suffusion_translatable_fields, $suffusion_skin_dependence, $suf_color_scheme;     if (function_exists('icl_t')) {         foreach ($suffusion_unified_options as $id => $value) {             /**              * Some strings are set interactively in the admin screens of Suffusion. If you have WPML installed, then there may be translations of such strings.              * This code ensures that such translations are picked up, then the unified options array is rewritten so that subsequent calls can pick it up.              */             if (function_exists('icl_t') && in_array($id, $suffusion_translatable_fields) && isset($suffusion_interactive_text_fields[$id])) {                 $value = wpml_t('suffusion-interactive', $suffusion_interactive_text_fields[$id]."|".$id, $value);             }             global $$id;             $$id = $value;             $suffusion_unified_options[$id] = $value;         }     }          $queried_id = get_queried_object_id();     $hidden_elements = array();     if ($queried_id != 0) {         $hide_top_navigation = suffusion_get_post_meta($queried_id, 'suf_hide_top_navigation', true);         if ($hide_top_navigation) {             add_filter('suffusion_can_display_top_navigation', 'suffusion_disable_component_for_view');             $hidden_elements[] = 'no-top-nav';         }         $hide_main_navigation = suffusion_get_post_meta($queried_id, 'suf_hide_main_navigation', true);         if ($hide_main_navigation) {             add_filter('suffusion_can_display_main_navigation', 'suffusion_disable_component_for_view');             $hidden_elements[] = 'no-main-nav';         }         $hide_header = suffusion_get_post_meta($queried_id, 'suf_hide_header', true);         if ($hide_header) {             add_filter('suffusion_can_display_header', 'suffusion_disable_component_for_view');             $hidden_elements[] = 'no-header';         }         $hide_footer = suffusion_get_post_meta($queried_id, 'suf_hide_footer', true);         if ($hide_footer) {             add_filter('suffusion_can_display_site_footer', 'suffusion_disable_component_for_view');             $hidden_elements[] = 'no-site-footer';         }     }     ?>     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">     <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>                   <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />         <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />          <?php         suffusion_document_header();         $suffusion_pseudo_template = suffusion_get_pseudo_template_class();         if (is_singular()) {             wp_enqueue_script('comment-reply');         }         $skin = isset($suf_color_scheme) ? $suf_color_scheme : 'light-theme-gray-1';         $extra_classes = $suffusion_pseudo_template;         if (isset($suffusion_skin_dependence[$skin])) {             $extra_classes = array_merge($extra_classes, $suffusion_skin_dependence[$skin]);         }         $extra_classes[] = $skin;         $extra_classes = array_merge($extra_classes, $hidden_elements);         wp_head();       ?>               <body <?php body_class($extra_classes); ?>>         <?php suffusion_before_page(); ?>             <?php                 suffusion_before_begin_wrapper();             ?>
             <?php                 suffusion_after_begin_wrapper();             ?>
                     <?php                         suffusion_after_begin_container();                     ?>      EDIT 2: When I did a grep for `suffusion_document_header`, I got these results:               /Users/owner12/Desktop/G33kTalk/wp-content/themes/suffusion/functions (1:11:13 6:44 PM).php:    add_action('suffusion_document_header', 'suffusion_include_ie7_compatibility_mode');     /Users/owner12/Desktop/G33kTalk/wp-content/themes/suffusion/functions (1:11:13 6:44 PM).php:    add_action('suffusion_document_header', 'suffusion_set_title');     /Users/owner12/Desktop/G33kTalk/wp-content/themes/suffusion/functions (1:11:13 6:44 PM).php:    add_action('suffusion_document_header', 'suffusion_include_meta');     /Users/owner12/Desktop/G33kTalk/wp-content/themes/suffusion/functions (1:11:13 6:44 PM).php:    add_action('suffusion_document_header', 'suffusion_include_favicon');     /Users/owner12/Desktop/G33kTalk/wp-content/themes/suffusion/functions (1:11:13 6:44 PM).php:    add_action('suffusion_document_header', 'suffusion_include_default_feed');     /Users/owner12/Desktop/G33kTalk/wp-content/themes/suffusion/functions.php:  add_action('suffusion_document_header', 'suffusion_include_ie7_compatibility_mode');      EDIT 3: This is the seo.php               <?php     /**      * This file handles SEO in Suffusion. It is not to be loaded directly, but is instead loaded from different templates.      * Users can override this in a child theme by creating a file in an "inserts" directory called seo.php.      *      * @package Suffusion      * @subpackage Templates      */          global $suf_seo_enabled, $suf_seo_all_settings;     if ($suf_seo_enabled == 'enabled') {         $seo_settings = explode(',', $suf_seo_all_settings);         if (is_array($seo_settings)) {             if (in_array('generator', $seo_settings)) {                 wp_generator();             }                  if (in_array('theme', $seo_settings)) {                 $theme_data = get_theme_data(get_template_directory().'/style.css');                 echo "\t".'<meta name="template" content="'.esc_attr("{$theme_data['Title']} {$theme_data['Version']}").'" />'."\n";             }                  if (in_array('robots', $seo_settings) && get_option('blog_public')) {                 echo "\t".'<meta name="robots" content="noindex,nofollow" />' . "\n";             }                  if (in_array('author', $seo_settings)) {                 global $wp_query;                 if (is_singular()) {                     $author = get_the_author_meta('display_name', $wp_query->post->post_author);                 }                 else {                     $posts_on_page = $wp_query->posts;                     $author_array = array();                     foreach ($posts_on_page as $single_post) {                         $single_author = get_the_author_meta('display_name', $single_post->post_author);                         if (!in_array($single_author, $author_array)) {                             $author_array[] = get_the_author_meta('display_name', $single_post->post_author);                         }                     }                     $author = implode(',',$author_array);                 }                      if ($author) {                     echo "\t".'<meta name="author" content="'.esc_attr($author).'" />' . "\n";                 }             }                  if (in_array('copyright', $seo_settings)) {                 if (is_singular()) {                     $copy_date = sprintf(get_the_time(get_option('date_format')));                 }                 else {                     $copy_date = date('Y');                 }                 echo "\t".'<meta name="copyright" content="'.sprintf(esc_attr__('Copyright (c) %1$s', 'suffusion'), $copy_date).'" />'."\n";             }                  if (in_array('revised', $seo_settings)) {                 if (is_singular()) {                     $mod_time = sprintf(get_the_modified_time(get_option('date_format')." ".get_option('time_format')));                     echo "\t".'<meta name="revised" content="'.$mod_time.'" />'."\n";                 }             }              }              global $suf_seo_meta_description, $wp_query;         if (is_home()) {             $description = $suf_seo_meta_description;         }         else if (is_singular()) {             $description = suffusion_get_post_meta($wp_query->post->ID, "meta_description", true);             if (empty($description) && is_front_page()) {                 $description = $suf_seo_meta_description;             }         }         else if (is_category() || is_tag() || is_tax()) {             $description = term_description('', get_query_var('taxonomy'));         }         else if (is_author()) {             $description = get_the_author_meta('description', get_query_var('author'));         }         if (!empty($description)) {             $description = stripslashes($description);             $description = strip_tags($description);             $description = str_replace(array("\r", "\n", "\t"), '', $description);             $description = "\t".'<meta name="description" content="' . $description . '" />' . "\n";             echo $description;         }              global $suf_seo_meta_keywords;         if (is_home() || is_category() || is_tag() || is_tax() || is_author()) {             $keywords = $suf_seo_meta_keywords;         }         else if (is_singular()) {             $keywords = suffusion_get_post_meta($wp_query->post->ID, "meta_keywords", true);             if (empty($keywords)) {                 $keywords = $suf_seo_meta_keywords;             }         }              if (isset($keywords) && !empty($keywords)) {             $keywords = stripslashes($keywords);             $keywords = strip_tags($keywords);             $keywords = str_replace(array("\r", "\n", "\t"), '', $keywords);             $keywords = str_replace(array(", ", " ,"), ',', $keywords);             $keywords = "\t".'<meta name="keywords" content="' . $keywords . '" />' . "\n";             echo $keywords;         }     }     ?>


Do I use cookies?

I have made website in wordpress, and now client wants to know do this website use cookies? I dont know too much about it becouse i never use it, but i need to be sure. If I make websites i use session, and I quess the same is in wordpress, but as I said, dont know too much about it and client need this information. I also use PIWIK stats. Is there a way to check it? I can give you list of plugins I used.


Theme Advanced Styles in Visual Editor and Paragraphs

After i add these codes to functions.php:               add_editor_style();          function childtheme_mce_btns2($orig) {     return array('formatselect','styleselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'media', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo', 'wp_help' );     }     add_filter( 'mce_buttons_2', 'childtheme_mce_btns2', 999 );          function childtheme_tiny_mce_before_init( $init_array ) {     $init_array['theme_advanced_styles'] = "box note=box_note;box info=box_info;box warning=box_warning;box download=box_download";     return $init_array;     }     add_filter( 'tiny_mce_before_init', 'childtheme_tiny_mce_before_init' );      I had a style drop down menu in Wordpress Visual Editor with "box note,box info,box warning,box download" options. I created editor-style.css so i got css support for those classes in visual editor. If i select "box note" style example, wordpress putting it as `<p class="box_note"></p>` Problem is when i push enter button for line breaking, wordpress putting `<p></p>` automatically. Basically how can i change those styles using `<div> <span>` or anything except `<p>`? **Update:** I create some screenshots for you. This is when i select style from style list: http://www.unsalkorkmaz.com/sorun/sorun1.jpg This is when i push enter button for line breaking: http://www.unsalkorkmaz.com/sorun/sorun2.jpg Wordpress basically creating different `<p>` I tried;               remove_filter('the_content', 'wpautop');     remove_filter('the_content', 'wptexturize');     remove_filter('the_content', 'convert_smilies');     remove_filter('the_content', 'convert_chars');      before i create this question but its not the solution seems. **Update 2:** Well.. I tried shift+enter to line-break and it works! So i dont know what is difference with enter vs shift+enter in TinyMCE but i want shift+enter function as default of enter button.


add_action for publish_post doesn't work

I'm working on a personal voting plugin, I don't intend to release it publicly because I'm still learning WP. In general, you can vote posts "up" or "down". I have 2 tables, one collects IPs (to disallow voting multiple times) and another table named "post_votes" collects the number of votes for each post. When I publish a new post its ID is stored in "post_votes" and I can update the "up", "down" for each post when people vote. This worked a few days ago. I did some modifications and I can't figure out why it's not working anymore.. This is the entire code so far.. I still need to implement some security precautions.               <?php     /*     Plugin Name: Vote Posts     */          global $vote_posts_version;     $vote_posts_version = "1.0";          function vote_posts_install () {             global $wpdb;        global $vote_posts_version;             $table_1 = $wpdb->prefix . "voter_ips";        $table_2 = $wpdb->prefix . "vote_posts";              if($wpdb->get_var("SHOW TABLES LIKE '$table_1 AND $table_2'") != $table_1 && $table_2) {                $sql = "CREATE TABLE " . $table_1 . " (           id bigint(20) NOT NULL AUTO_INCREMENT,           vote_post_id bigint(20) NOT NULL,           voter_ip varchar(100) NOT NULL,           UNIQUE KEY id (id)           );";                 $sql2 = "CREATE TABLE " . $table_2 . " (           id bigint(20) NOT NULL AUTO_INCREMENT,           vote_post_id bigint(20) NOT NULL,           up int(11) NOT NULL,           down int(11) NOT NULL,           UNIQUE KEY id (id)           );";                require_once(ABSPATH . 'wp-admin/includes/upgrade.php');           dbDelta($sql);           dbDelta($sql2);                add_option("vote_posts_version", $vote_posts_version);        }             }          register_activation_hook(__FILE__,'vote_posts_install');               //add and delete votes          function add_votes($post_ID)  {     global $wpdb;        if (!($wpdb->get_row("SELECT vote_post_id FROM wp_vote_posts WHERE vote_post_id = $post_ID" ) ) ) { //if not exists add post ID to table           $wpdb->insert( $wpdb->prefix . 'vote_posts', array( 'post_id' => $post_ID ) );           return $post_ID;        }     }     add_action ( 'publish_post', 'add_votes' ); //should trigger function on publish post          function delete_votes($post_ID)  {         global $wpdb;         $wpdb->query("DELETE FROM wp_vote_posts WHERE vote_post_id = $post_ID");         return $post_ID;     }     add_action ( 'delete_post', 'delete_votes' ); //deletes row from post_votes table when a post is deleted from the WP panel          ?>      It successfully creates the 2 tables but doesn't insert the post ID on action


Custom post type - get_day_link()

How can I get the archive links for a custom post type? get_day_link() doesn't seem to work


How to show only images with a certain tag with NextGEN gallery plugin?

As described, how can I show only the images with a certain tag on a Wordpress blog that use `NextGEN Gallery` as gallery plugin? NextGEN Gallery version is 1.5.5 but I can upgrade to 1.6.2 (last) if necessary. I would like to display images with a specified tag on a new Wordpress Page.


On click hide group of metabox, similar to screen options checkbox?

I have several metaboxes in the edit screen. I would also create another metabox where the user can click on a checkbox then it hides a set of metaboxes, similar to the Screen Options functionality, only when the checkbox is clicked, it hides/toggles a group of metaboxes. Does anybody know how to approach this? If not, what's the code used by the Screen Options menu that dictates on click,hide metabox. ? Thanks.


How to use Canonical URL meta tag to avoid duplicate content issues with WP home pages

By default, Wordrpess sites have at least 2 URLs that can be used to reach the home page:               www.site.com/     www.site.com/hello-world      Both these URLs point to the same page, the default "hello world" post that WordPress creates. How can theme developer's specify a canoninical url meta tag to suggest to search agents which URL it should index in the above example? In your answer, please include an example for each choice: one in which site.com is preferred and one in which site.com/hello-world is preferred.


How to customise the output of the WP image gallery shortcode from a plugin?

We're building a plugin that displays posts, and we also want to display the image gallery when it is used in a post. However, we need to limit the number of photos displayed? Is that possible?


Use of IF statement in Header file

I have a custom page template created. When I load my page, it shows the header logo of the mainpage but what I want to achieve is for each custom template created, I want it to only show its own logo. This is the bit of the header code that calls the logo.php file:               <?php get_template_part('parts/logo', 'top') ?>      This is what I have tried but not working               <?php if ( is_page('custom-page')) {         get_template_part ('parts/custom-logo', 'top');     } else {         get_template_part('parts/logo', 'top');     } ?>      Any help will be much appreciated. Thanks


wordpress: only admin can access wp-content folder

as wp-content/ upload folder has public access and is accessible through url. for example: http://site.com/wp-content/uploads/2014/02/test.pdf i want to make it accessible by admin only.. it can not be accessible through url. for that i put .htaccess code:                 Order deny,allow     Deny from all     <Files ~ ".(xml|css|jpe?g|png|gif|js)$">     Allow from all     </Files>      above code not allow access to pdf and docx file of wp-content folder. if admin try to access it through admin it gives 403 forbidden error. **how can i make it accessible by admin only. ?**


WP Plugin for Terms of Use

Looking for a plugin to ensure that casual (NOT logged in) users of my site will agree to the Terms of use. That is, first time they try to access ANY page on site, display terms and prompt for agreement. If suer agrees, store that in DB (preferable) or cookie. I cam across "Terms of Use" plugin, but it has not been updated in over a year and I am not sure it supports my scenario. TIA for any help. Jackie


Upgrading a custom theme through the Dashboard

I can't seem to upgrade my custom theme. Whenever I try to uploaded a new package, all I get is: > Unpacking the package…   >  Installing the theme…   >  Destination folder already exists. /wp-content/themes/THEMENAME/   >  Theme install failed. I've searched and all I can find is people recommending upgrading over FTP. Sadly, I don't have FTP access right now, but also using FTP appears to be a dirty solution. I can obviously delete and re-install the theme, but that seems very dirty, too. How can I update a theme through the Dashboard?


Get a list of categories ids

I'm working on a portfolio with filters based on custom post type. That filters must display only categories for the posts that are displayed in the portfolio, since user can specify them by id in the shortcode - [portfolio ids="1,2,3"] And I can't get a list of that categories ids. Here is a simple example of what I'm trying to do: A list of custom post ids from the shortcode:               $ids      An array of the same ids:               $id_array = explode(',', $ids)      A var of interest that must return a list of categories ids:               $cat_ids = ???        Next we get only categories with needed id:               $categories = get_categories(             array(                 'include' => $cat_ids,                 'taxonomy' => 'portfolio_category'             )         );      And finally have our categories displayed:               echo '
';             echo '
all
';             foreach ($categories as $category) {                 if( isset( $category->term_id ) ){                     echo '
category_nicename.'">'.$category->cat_name.'
';                 }             }         echo '
';      The cloasest what i get was:               $cat_ids = wp_get_object_terms( $ids, 'portfolio_category', array('orderby' => 'name', 'fields' => 'ids') );      But it returns only one id


Get variable value based on string constant

In my plugin I define a constant as follows: `define('DEFAULT_NUM', 5);` I also define a constant representing the name by which I want to refer to this number: `define('DEFAULT_NUM_NAME', 'numitems');` My plugin has a shortcode that uses these values as follows:               function do_something($atts) {       extract( shortcode_atts( array(           DEFAULT_NUM_NAME => DEFAULT_NUM           ), $atts ) );      I do this so I can change variable values in one place, instead of hardcoding them:               function do_something($atts) {       extract( shortcode_atts( array(           'numitems' => 5           ), $atts ) );      The `extract` function will convert the string 'numitems' into a variable called `$numitems`. So the rest of my code has to look like this:               if ($numitems == 5) {      return 'blah blah';     }      In effect, I am hardcoding the variable's name because I have to use whatever name I defined. I would like to retrieve the value of the variable without having to use it. In other words, I want to leverage the constant name to determine the value passed to the plugin, without having to use the variable. Is this possible? Or is my approach wrong? (FYI This is a test case based on an actual plugin. These are not the actual variable names.)


WooCommerce custom query and paging: Not Found error

I'm experiencing a problem with the following piece code:               global $wp_query;          $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $filter_args['paged'] = $paged;     $filter_args['posts_per_page'] = 2;          $args = array_merge( $wp_query->query_vars, $filter_args );     query_posts( $args );      This code is located at **archive-prodcut.php** file, inside of my theme/woocommerce folder. It works correctly in order to show first 2 products and also to show WooCommerce pagination on the bottom.               do_action( 'woocommerce_after_shop_loop' );      However, when I click on each of the pages I'm getting a "Not found" error. When I tried putting an echo on the top of the archive-prodcut.php file I realized that it doesn't load. The url looks like www.site.com/product- category/cat-name/page/2 Thanks in advance!


Multiple If else statements on Search Result Page

Ok, I have a few CPT's setup with a metabox that only requires some values for some categories. When searching a specific category, I want to display a link to the value (which is a url) if it exists and not show it if it doesn't. What I have right now show's all three buttons whether the value exists or not. Anyone know how I can display just one read more button depending on whether or not the meta value exists?                   <?php if( get_post_meta($post->ID, 'recent_action', true) ) { ?>                      <a class="button" href="<?php echo get_post_meta($post->ID, "recent_action", true); ?>">Recent Action Link                      <?php } ?>                      <?php if( get_post_meta($post->ID, 'related_link', true) ) { ?>                      <a class="button" href="<?php echo get_post_meta($post->ID, "related_link", true); ?>">Related Link                      <?php } ?>                      <?php if( get_post_meta($post->ID, 'imp_docs_link', true) ) { ?>                      <a class="button" href="<?php echo get_post_meta($post->ID, "imp_docs_link", true); ?>">Important Documents Link                      <?php } ?>


Responsive Embeds using default embed shortcode

Can someone explain how to make embed shortcode responsive? http://codex.wordpress.org/Embeds


Display all posts for taxonomy term across multiple custom post types

I'm currently creating a website that uses several content types, (e.g. books, movies, shows) as well as a key taxonomy term (e.g. status, with values of owned and wishlist). My question is, in a custom template how do I create a loop that queries only one taxonomy value across multiple custom post types (i.e. a single list of all of the books, movies and shows on my wishlist.) The closest I could find was this post Using Query Posts With Multiple Post Types And A Taxonomy But unfortunately, I am having a hard time making it work as is in my template. And, ideally I'd prefer to use a wp_query instead of get_posts.


Cannot Modify Header Information - While trying logging in

I am having the same issue as cited on: Cannot modify header information - headers already sent (Theme Specific : functions.php) Can you give me a help on that. I am using Optimize Press Theme This is the error: > Warning: Cannot modify header information - headers already sent by (output > started at /home/talent31/public_html/domain.com/wp-includes/general- > template.php:2102) in /home/talent31/public_html/domain.com/wp- > includes/option.php on line 568 > > Warning: Cannot modify header information - headers already sent by (output > started at /home/talent31/public_html/domain.com/wp-includes/general- > template.php:2102) in /home/talent31/public_html/domain.com/wp- > includes/option.php on line 569


WordPress 3.6 native player is not responsive?

Using wordpress 3.6 and can embed video in pages/posts. But These videos are not responsive. Is there a way to make them responsive? I found a style="width:100%; height:100%" method for media element player but don't know how to use it with video tag.


Noindex,Nofollow in theme's header.php?

My theme's header.php file contains this :               <?php if (is_search()) { ?><meta name="robots" content="noindex, nofollow" /><?php } ?>      What does that mean ? And does it affect my search rankings?


is user member of a group, show them categories

I want to only display categories e.g. the 'group-1' category to users that are members of a certain buddypress group e.g. 'group-1'. I think I can do this by manipulating this code, and replacing the category number with variables defined by the group membership.               <?php if (is_front_page() && !is_paged()) $posts = query_posts($query_string . '&cat=-12,-13'); ?>      I can't for the life of me find out how to get the variable group membership by name. How could this be done? Thanks!


Category page only displaying the posts from a custom type

# Situation I have two cpt:   1. Projects   2. Works In these two CPT I share the same taxonomy 'Category', and the same terms:   1. Architecture   2. Landscape   3. Interior Design I have URLs like               projects/architecture     works/architecture     so on...      # Problem Now the problem is that the two URL above are returning the same content, all the archives of the term architecture, whatever the cpt. Is there a way that `projects/architecture` would only return all the post under **projects** with for term **architecture**? # Note I'm using Custom Post Type Permalinks to use permalink formatted like `/cpt/term/post_title` # Edit Here is my **category template** (category.php)               <?php get_header(); ?>          <?php       /* Queue the first post, that way we know        * what date we're dealing with (if that is the case).        *        * We reset this later so we can run the loop        * properly with a call to rewind_posts().        */       if ( have_posts() )         the_post();     ?>
<?php                   _e( ucwords($post->post_type), 'boilerplate' );               ?>
     <?php       /* Since we called the_post() above, we need to        * rewind the loop back to the beginning that way        * we can run the loop properly, in full.        */       rewind_posts();       /* Run the loop for the archives page to output the posts.        * If you want to overload this in a child theme then include a file        * called loop-archives.php and that will be used instead.        */       ?>
         <?php        get_template_part( 'loop', 'category' );        ?>
        <?php     ?>          <?php get_footer(); ?>      Here is my **category loop** (loop-category.php)               <?php while ( have_posts() ) : the_post(); ?>       <?php       $attachments = get_posts( array(         'post_type' => 'attachment',         'post_parent' => $post->ID,         'orderby' => 'menu_order',         'order' => 'ASC',         'numberposts'     => 1         ) );         ?>         <?php $img = wp_get_attachment_image_src($attachments[0]->ID, 'full');?>
           <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" class='th'>             <img src='<?php echo $img[0]; ?>'>             <?php $categories = get_the_terms($post->ID, 'category'); ?>
                                <?php foreach($categories as $category): ?>                 <?php echo $category->name; ?>               <?php endforeach; ?>

<?php the_title(); ?>

     <?php endwhile; ?>


WP Installer Redirects to /wp-admin/core/install.php

I am trying to install WP for the first time on Ubuntu 12.04 in a clean /var/www directory. I downloaded the latest version. I untarred it in my home directory and then moved it to /var/www. I created the DB and edited the wp- config.php file. When I visit the base URL (an IP address for now), the URL gets rewritten as xxx.xxx.xxx.xxx/wp-admin/core/install.php. But, there is no core directory. What is happening here? Thanks.


Read only capability for custom post in admin area

I'm actually building custom type to WP and need to be able to restrict post access to some user role, ie. in admin area, collaborators can see posts but can't edit them, just only open them as read-only. I used some plugins (Adminimize and User Role Editor) but, as far as I know, they don't apply to my needs. Does any one give me directions in order to solve this?


How to add correct Last update in Postings (the_modified_time)

Having little issue with following: We want to add "Last update" after making important corrections or additional text/images to existing Postings.   Using following code (hardcoded) does in a way almost what I want:               Last update <time datetime="<?php the_modified_time('d-m-y'); ?>"> <?php the_modified_time('l  j  F, Y'); ?></time>      But doing in that way it results in showing -always- the so named "Last update", even when it is just published and not been updated at all.   We would love to make it so that it only will be shown when really some updates are done, and the optimum would be as a plugin.   So I must be doing some wrong, is it possible at all and if so, how to do this? _Note:   it is meant for the front-end in Postings and not as a widget in the sidebar, neither for the back-end._


Archive templates based on taxonomies

I have a custom post type, service-provider, with two taxonomies, area and service. I wanted to make a template based on the taxonomies.               function template_taxonomy($template) {         if (is_archive()) {             if ((is_tax('service') and is_tax('area')) or is_tax('service')) {                 $template = locate_template( array( 'taxonomy_service.php' ) );             } else if (is_tax('area') and !(is_tax('service'))) {                 $template = locate_template( array( 'taxonomy_area.php' ) );             }         }         return $template;     }      The code is pretty simple but my problem is, when I try to visit this URL > http://www.site.com/?service-provider&service=electricians&area=north-shore- > lower the service taxonomy doesn't seem to exist, so it uses the taxonomy_area.php template. Also tried just using the taxonomy_service.php template and it seems like the area taxonomy doesn't exist on that template either. Any ideas?


Upgrade a plugin manually using the option "add new"

I need to test a upgrade implementation before I upload the code on the repository and be public to everyone, but I can't find how. Replacing the old code for the new code via FTP isn't working because the additional files will be there. I am trying to upload the new plugin through "add new", but wp isn't allowing to upgrade the plugin. Anyone know how to test an upgrade method :               add_filter( 'upgrader_pre_install', 'xxx_plugin_backup', 10, 2 );     add_filter( 'upgrader_post_install', 'xxx_plugin_restore', 10, 2);


Custom image sizes without add_image_size()

I need a lot of various image sizes in my theme. I know how to add them with the `add_image_size()` function in functions.php. But those defined sizes will create a lot of files for every uploaded image. Even if the images don't need all of the sizes but only certain ones, depending on where in the theme they get used. Isn't this a huge waste? So I thought I do this in my theme:               the_post_thumbnail(array(258, 190));       But this doesn't work reliably. Often the numbers seem to be completely ignored. How does the arbitrary size array work in WordPress? I am confused. :)


How To Create A Secure Login Logout Menu Properly?

I'm not a developer and I don't know about PHP. I'm trying to create my own blog using a theme called `WP Knowledge Base`\- Link. It uses the wp- bootstrap-navwalker Other more details:   * Wordpress Version - 3.9.1   * Plugins - bbPress, bbPress Pencil Unread, Buddy-bbPress Support Topic, Captcha, Category Order and Taxonomy Terms Order, GD bbPress Attachments, GD bbPress Tools I've installed `bbpress` plugin with this theme and went smoothly. Now I'm trying to put a login/logout/register menu to the top menu, because the theme does not have this, but it's in the sidebar widget. I need a `Login` and `Registered` link in the top nav of the theme and visible to not logged in users. For logged in users, the `Login` menu should change to `Logout` and `Register` menu should not appear. I've been searching for a solution but I'm having some difficulties, since I don't know PHP yet and Wordpress Codex. The task should only be a one time fix, since it shall only be used with my blog theme. So I don't have to learn all these things. Prior to posting this question, I've tried several codes and been doing various trial-and-error, it's a tedious task really because I don't know about PHP yet. So trial-and-error is only the thing I can do. What I've tried so far; bbPress Official Documentation \- It gives a white screen error after implementing it. I don't know if it conflicts the the plugins I've mentioned above. Code 2 \- This one works, but Register menu still shows for logged in users. I've modified the code a bit (trial and error). It's like this.               if( ! function_exists( 'add_loginout_to_menu' ) ) {         function add_loginout_to_menu( $items, $args ){             //Nav location in your theme. In this case, primary nav. Adjust accordingly.             if( is_admin() ||  $args->theme_location != 'secondary' )                 return $items;              if( is_user_logged_in( ) ) {                 $link = '' . __( 'Logout' ) . '';             }         else  $link = '' . __( 'Login' ) . '';             return $items.= '
'. $link . '

Register
';         }     }     add_filter( 'wp_nav_menu_items', 'add_loginout_to_menu', 10, 2 );      Plugin \- I've also tried this plugin, but it does not achieve the goal. Coz I need to redirect the Login and Register link to a custom login/register page. I've tried other more codes, some worked partially some gave errors. Overall, I think I can use the `Code 2`, but it requires some tweakin. Just don't know how to. That being said, I like to make this an opportunity to ask if trying these fixes by trial-and-error poses security threat against my website? what would be the effect of it in terms of security? ### Update With some trial-and-error I got a working code, need some tweaking though.               add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );     function add_loginout_link( $items, $args ) {         if (is_user_logged_in() && $args->theme_location == 'secondary') {           $items .= '
Log Out
';         }         elseif (!is_user_logged_in() && $args->theme_location == 'secondary') {           $items .= '
Log In

Register
';         }         return $items;     }


Why won't my metabox data save?

I have a custom post with a lot of meta boxes. I recently tried to add some dynamic metaboxes, using this question: Create more Meta Boxes as needed I managed to get the metaboxes to add nicely, the jquery works, everything works except the save_post action - the "Reviews" save nicely, but the "Screenings" don't. What have I done wrong in my code? I'm sure it must be something very simple that I'm overlooking, perhaps with the nonces? **Edit** : I know I can do all of this with one `save_post`, and that works if I only have 1 of these dynamic metaboxes, but if I add a second (or more) dynamic metabox section, that data doesn't save. **Edit** : If necessary, I can post my entire custom-posts.php function file to pastebin or something, but I have just included what I think is the relevant snippet here for brevity **Edit** : Updated code...               <?php     add_action('save_post', 'save_postdata'); // saves post data from another function earlier on          add_action('save_post', 'save_postdata_dynamic_reviews_metabox' );       add_meta_box("film-reviews", "Reviews", "print_dynamic_reviews_metabox", "film", "normal", "low");          add_action('save_post', 'save_postdata_dynamic_screenings_metabox' );     add_meta_box("film-screenings", "Screenings", "print_dynamic_screenings_metabox", "film", "normal", "low");          /* Prints the box content */     function print_dynamic_reviews_metabox() {         global $post;         // Use nonce for verification                  echo '<input type="hidden" name="reviews_noncename" id="reviews_noncename" value="' . wp_create_nonce( 'reviews-nonce' ) . '" />';             echo '
';             echo '
';         $reviews = get_post_meta($post->ID,'reviews',true); //get any previously saved meta as an array so we can display it         // print_r($reviews);         $c = 0;         if( is_array($reviews) ) {           foreach($reviews as $review ) {                     if (isset($review['review-name']) || isset($review['review-link']) ) {               echo '
Remove                            Review Name/Title: <input type="text" class="meta-review-name saveddata" name="reviews['.$c.'][review-name]" value="'.$review['review-name'].'" />                              Review URL: (don\'t forget the http://) <input type="text" class="meta-review-url saveddata" name="reviews['.$c.'][review-url]" value="'.$review['review-url'].'" />';                         echo 'Remove
';               $c = $c +1;               } // ends if isset $award[album]             } // ends foreach                 } // ends if (is_array)             echo '
';         echo 'Add New Review';             ?>                                <?php          echo '
'; // ends div#meta_inner     } // ends function print_dynamic_reviews_metabox()               function save_postdata_dynamic_reviews_metabox( $post_id ) {       // verify if this is an auto save routine.       // If it is our form has not been submitted, so we dont want to do anything         if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) {             return;             }         // Check permissions         if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can( 'edit_page', $post_id )) { return $post_id; }}         elseif ( !current_user_can( 'edit_post', $post_id )) { return $post_id;}            // verify this came from the our screen and with proper authorization,       // because save_post can be triggered at other times         if (isset($_POST['reviews_noncename'])){             if ( !wp_verify_nonce( $_POST['reviews_noncename'], 'reviews-nonce' ) )                 return;         }else{return;}              // OK, we're authenticated: we need to find and save the data         $reviews = $_POST['reviews'];         update_post_meta($post_id,'reviews',$reviews);         } // ends function save_postdata_dynamic_reviews_metabox                        /* Prints the box content */     function print_dynamic_screenings_metabox() {     global $post;     // Use nonce for verification              echo '<input type="hidden" name="screenings_noncename" id="screenings_noncename" value="' . wp_create_nonce( 'screenings-nonce' ) . '" />';         echo '
';         echo '
';     $screenings= get_post_meta($post->ID,'screenings',true); //get any previously saved meta as an array so we can display it     // print_r($screenings);     $c = 0;     if( is_array($screenings) ) {       foreach($screenings as $screening ) {                 if (isset($screening['screening-festival-name']) || isset($screening['screening-festival-date']) ) {           echo '
Remove                        Festival Name: <input type="text" class="meta-screening-festival-name saveddata" name="screenings['.$c.'][screening-festival-name]" value="'.$screening['screening-festival-name'].'" />                          Festival Date: <input type="text" class="meta-screening-festival-date saveddata" name="screenings['.$c.'][screening-festival-date]" value="'.$screening['screening-festival-date'].'" />';                     echo 'Remove
';           $c = $c +1;           } // ends if isset $award[album]         } // ends foreach             } // ends if (is_array)         echo '
';     echo 'Add New Screening';         ?>                        <?php      echo '
'; // ends div#meta_inner     } // ends function print_dynamic_screenings_metabox()                    function save_postdata_dynamic_screenings_metabox( $post_id ) {       // verify if this is an auto save routine.       // If it is our form has not been submitted, so we dont want to do anything         if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) {             return;             }         // Check permissions         if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can( 'edit_page', $post_id )) { return $post_id; }}         elseif ( !current_user_can( 'edit_post', $post_id )) { return $post_id;}            // verify this came from the our screen and with proper authorization,       // because save_post can be triggered at other times         if (isset($_POST['screenings_noncename'])){             if ( !wp_verify_nonce( $_POST['screenings_noncename'], 'screenings-nonce' ) )                 return;         }else{return;}              // OK, we're authenticated: we need to find and save the data         $screenings= $_POST['screenings'];         update_post_meta($post_id,'screenings',$screenings);         } // ends function save_postdata_dynamic_screenings_metabox               ?>


Event Management plugin

I am working on a site that has the option of using Event Expresso Event Manager Pro The events part of the site is quite complicated, and needs to have \- a calendar \- a registration page \- 'buy tickets' functionality with both Paypal and http://www.authorize.net/ \- email confirmations I haven't worked a lot with event plugins, can anyone recommend one of the above plugins over the other? It sounds like there might be quite a lot of customization required, so I guess part of this question is, "Which is the easiest to customize?"


Check if has pages?

So hard to find this info... I'd like to know a way to find out if there are pages. Something like:               if (has_pages()) { /* do something */ }      I can't find a reference to any similar function... how might one go about finding out if there are pages. In case yr wondering I'd like to only show a pages menu if there are pages.


Action inside another action not working

I am trying to load content before the end body tag on admin pages that have a TinyMCE editor on them. To do this I am trying to leverage two action hooks 'before_wp_tiny_mce' and 'admin_footer' but it does not seem to be working as I expected. The following is a simplified version of my code:               add_action( 'before_wp_tiny_mce', 'before_wp_tiny_mce_action' );          function before_wp_tiny_mce_action() {         add_action( 'admin_footer', 'admin_footer_action' );     }          function admin_footer_action() {         echo "
I am in the footer of an admin page with a TinyMCE editor.
";     }      Why doesn't this work?


WooCommerce, different prices based on location

A client of mine is setting up an e-commerce store but instead of having straight currency conversions for their products ($99.99 = £65.70 for example) they want to be able to set specific prices based on the location of their customer ($99.99 for US customers, £99.99 for UK customers, etc.) Now personally I wouldn't do it this way given the choice but they're keen on doing it, so is it possible with the WooCommerce plugin?


Are custom post types lost when the theme is changed?

I am about to begin work on a custom WordPress theme and I want to know how careful I have to be about custom posts. Suppose I create a WordPress theme that registers several custom post types. To my understanding this happens upon activation of the theme. If I were to create several posts of this custom type and then change to a theme that does not have that custom post type would I have lost the posts completely? What if I changed to another theme that DID have the same custom post type (if that is possible) would they still exist? Further, what about these same issues in connection with custom taxonomy? If I change to a different theme that does not support the custom taxonomy will the taxonomy data from custom posts be lost (if they are even saved). Will the data for the custom taxonomy still exist?


Page Template Changes Not Showing

I'm dealing with a weird and very annoying bug where changes to a page template file ("contact.php") are not being registered at all by WordPress. I've made sure that the template has been correctly selected by the pages that are supposed to use it. The pages also clearly use the layout specified by the template, but they don't register any changes, even when I add huge globs of texts in the middle. Nothing shows up. This problem applies to every new page I create, as well as old pages I modify. I don't have any caching plugins installed, so I am at a loss as to why this is the case. Changes to other parts of the website (for example, header.php) show up just fine. Switching to another theme then switching back doesn't help either. This is immensely frustrating, and I'd be grateful for any help.


Wordpress category check

So I have a plugin, and i want to have a multiselect drop-down list with all categories in widget's settings and store (by admin's choice) selected ones (ids). ![enter image description here](http://i.stack.imgur.com/8OY9s.jpg) Then to check if we are viewing a post "is_single()" and the post has some of the above selected categories "in_category("3") (say we chose cat:Logo with id:3):               if(is_single() && in_category("3")){//do my thing}      and ofcourse if user chose more than 1, say (3,5,6 cat ids(by their names click)) the codition would be something like:               if(is_single() && in_category($categoryholderfromdb)){//do my thing}      Where $categoryholderfromdb="3,5,6" (stored user choices in db (widget settings drop-down)) i've tried to do it, but i can't figure out the part with drop-down multiselect and then "in_category" when checking for multy values. Can anyone give me example of the above question?Thanks!


How can I remove the welcome message generated by the New User Approve plugin?

I'm using the New User Approve plugin. After installing the plugin the top of the registration page says: > Welcome to XXX site. This site is accessible to approved users only. To be > approved, you must first register. How can I erase this message? I'm am using this code:               $message = apply_filters('login_message', '');      But the top says still stand there!


Best way to receive special images in posts

Okay, this is what I'm thinking about (and it's not a coding problem right now, but my fundamental thoughts): How to receive / input images in posts for special uses, let's say a customized portfolio post. The post content should not really contain the Work images. These images should be styled specifically in an own image area, separated from the common text content. What I used to do for quite a long time: I created a custom post meta box under the content with an upload button. Users could upload an image and the URL got inserted automatically there after pressing "Insert into post". Problem was, that the image should have the exact needed width. Now I changed this method and started to tell the User they would only have to upload the image, just like always, but don't insert it into post content. This made possible for me just to output the post gallery, and as I created an image size with the needed width, the size of the image wouldn't matter. Now, most Users don't understand the new way and I also got the feeling that it is not as flexible as before (for example I could also add videos and rearrange videos and images in their order which doesn't work with my new method). I could use a thumbnail generation script or do it even myself, but this is not really a nice solution for me, too (performance, another caching, risk in use of scripts for example timthumb exploits...). I'm curious, do You have a solution or any thoughts for this? Greatly appreciated, and please excuse my bad English ;) Best regards, .wired


Parse Error when trying to access Products -> Categories

Whenever I try to access the Categories or Tags tab under Products on the WP dashboard, I get this error message:               Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home4/benkang/public_html/gibumkang.com/revive/wp-admin/includes/class-wp-terms-list-table.php on line 156      So I checked into my `class-wp-terms-list-table.php`, but I can't seem to find what's wrong with it. I never touched it either. Here is a snippet of the code. Line 156 starts from:'$out .= $this->row_actions( $actions );'.               if ( empty( $terms ) ) {             list( $columns, $hidden ) = $this->get_column_info();                 echo '
get_column_count() . '">';                 $this->no_items(ions', $actions, $tag );             $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );             $out .= $this->row_actions( $actions );             $out .= '
term_id . '">';             $out .= '
' . $qe_data->name . '
';             $out .= '
' . apply_filters( 'editable_slug', $qe_data->slug ) . '
';             $out .= '
' . $qe_data->parent . '

';     }      Please any help or insight will be greatly appreciated.


Ordering custom post type by multiple custom fields

I was wondering if you'd be able to help with an issue i'm having? I have implemented a fix that you came up with in this post: How to order custom post type by multiple custom fields? however when I add the filter no posts are being displayed. What I'm trying to achieve is to order a league table by points and then by goal difference. This is my function in functions.php               function orderbyreplace($orderby ) {     global $wpdb;     return str_replace($wpdb->prefix.'postmeta.meta_value', 'mt1.meta_value, mt2.meta_value ASC', $orderby);     }      And here's the query in my template file               $args = array(                   'post_type'=>'standings',                   'orderby' => 'meta_value_num',                   'meta_key' => '_pts',                   'meta_query' => array(                         array(                             'key' => '_pts',                             'value' => '0',                             'type' => 'NUMERIC',                             'compare' => '!='                         ),                         array(                             'key' => '_dif',                             'value' => '0',                             'type' => 'NUMERIC',                             'compare' => '!='                         )                     ),                 );                      add_filter('posts_orderby','orderbyreplace');                 $loop = new WP_Query( $args );                 remove_filter('posts_orderby','orderbyreplace');      If you could spare a few minutes of your time to have a look over this and make any suggestions you may have and point anything out where I might have gone wrong that would be greatly appreciated. **EDIT** I've changed the code to the following and it is know returning posts however it's only ordering them by the first meta_key and ignores the other.               function orderbyreplace($orderby) {                     global $wpdb;                     return str_replace($wpdb->prefix.'postmeta.meta_value_num', 'mt1.meta_value, mt2.meta_value DESC', $orderby);                 }                      $args = array(                   'post_type'=>'standings',                   'orderby' => 'meta_value_num',                   'meta_key' => '_pts',                   'meta_query' => array(                         array(                             'key' => '_pts',                         ),                         array(                             'key' => '_dif',                         )                     ),                 );                      add_filter('posts_orderby','orderbyreplace');                 $loop = new WP_Query( $args );                 remove_filter('posts_orderby','orderbyreplace');      Many thanks, Ben


Update user_login to change username

I'm trying to update `user_login` in the `wp_users` table, to force update a user's username to their email address on submission of a front end edit profile form. I know WordPress forbids this via the `wp_update_user` function so I am trying to use SQL with wpdb functions. Here is what I have, and it is not working :(               global $wpdb;     $tablename = $wpdb->prefix . "users";     $sql = $wpdb->prepare( "UPDATE ".$tablename." SET user_login=".$user_email." WHERE ID=".$user_id."", $tablename );     $wpdb->query($sql);      Can anyone help? **Fixed it, see here:** https://gist.github.com/4045215


Show all posts without a custom taxonomy

I've searched high and low, but haven't found the exact code to do this. I want to show all posts of a that don't have a custom taxonomy assigned. So something like, pull all posts that have one of the custom taxonomy, then show everything but those posts.


Changing the default WP editor font and size

The default font is too small and too narrow. Makes editing a pain. I want the default font to be Lucida 16. I am not talking about a pop up menu. I already have that. When I open a new page/post I want Lucida 16 to already be set. I tried editing admin folder php but I couldn't get it to work. Must be set at very deep level. Once that is working, then an interface to change on the fly to match font set for web content(set by theme) would be cool.


How to order custom posts by one of the custom fields value, 'date'?

I am using this php code to display a list of gigs, which is a custom post type. I want to order it by the 'when' value of the post, and omit the gigs that have already happened. How can I modify the following code to get that happening?                   <?php     $args2 = array(              'post_type' => 'gig',         'numberposts' => -1     );     $gigs = get_posts($args2);     foreach ($gigs as $gig){         echo '
'.$gig->post_title.'

';         // for each custom fields you want.         echo get_post_meta($gig->ID,'_gigswhen', true).'
';         echo 'Time: '.get_post_meta($gig->ID,'_gigsstart_time', true).'-'.get_post_meta($gig->ID,'_gigsend_time', true).'
';     }     ?>      TO clarify a bit, here is the code in my functions.php                   $config = array(             'id' => 'gigs-info',             'title' => 'Gig Info',             'pages' => array('gig'),             'context' => 'normal',              'priority' => 'high',              'fields' => array(),              'local_images' => false,             'use_with_theme' => true //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).         );         $my_meta = new AT_Meta_Box($config);              //Add fields to your meta box         $my_meta->addText($prefix.'where',array('name'=> 'Where is the Gig '));         $my_meta->addDate($prefix.'when',array('name'=> 'When is the Gig '));         $my_meta->addTime($prefix.'start_time',array('name'=> 'When Does it Start '));         $my_meta->addTime($prefix.'end_time',array('name'=> 'When Does it End '));         $my_meta->addText($prefix.'with_who',array('name'=> 'With Who is the Gig '));         $my_meta->addTextarea($prefix.'words',array('name'=> 'A few words on the gig '));         $my_meta->Finish();     }     ?>      I'm using a custom meta-box class file that someone kindly pointed me to. So I'm not sure if it's being saved as a unix timestamp or not.. I'm a bit new to wordpress php pogramming :)


Wordpress bug with capabilities?

EDIT: aha! It appears to be the "Role Scoper" plugin causing this problem. Deactivating it restored the functionality. Consider this question null. I've enabled the capability of uploading files for contributors. However, I found a problem. When the contributor start a brand new post, he will see the "Upload/Insert" icons right above the post edit box. However, if the contributor saves a draft then comes back later, then those icons will be gone! I used the "Capability Manager" plugin to modify the contributor capabilities. I'll try another plugin and see if it makes a difference... EDIT: nope, it doesn't make a difference. THe capabilities are stored in the database, and deactivating plugins leaves the capabilities as they were (they stay modified)... This appears to be a wordpress bug. I'm gunna file a bug repot...


Querystring (?page=0%2C1) appended at end of URL

Can someone help me with my WordPress site. My query is - `Google Webmasters` is showing some URLs which has `page=0%2C3` or `?page=0%2C1` etc appended to the end of URL. Is it possible to stop appending any such **“query strings”** in order to minimize the duplicate issue? Note that, this does not result in 404 page. Both URLs(one with query string appended and other without query string) are working fine. example : http://www.mysite.com/category-name/post-name?page=0%2C3 http://www.mysite.com/category-name/?page=0%2C1.


How to customize a plugin?

When I need any functionality, I use a plugin or a snippet code inside `functions.php`. But now, I have a plugin that accomplishes my expected functionality, but I have to replace (not add) some code on it. The problem is that if I upgrade the plugin in the future, my changes may be overridden. The code is too large to add it on `functions.php`, and create my own plugin would take much time. What is the better way to proceed in this case? _As a note, I thought that I may could disable the upgrade button for that plugin, although it doesn't seem the better way to proceed._


Attachment Metadata not updated while uploading audio files

Suddenly, I am having some issues when uploading audio type of file in wordpress. previously, when I uploaded .mp3 files, the attachment metadata of the files were updated accordingly, for instance; it was looking like something similar to                           array (                   'dataformat' => 'mp3',                   'channels' => 1,                   'sample_rate' => 44100,                   'bitrate' => 48000,                   'channelmode' => 'mono',                   'bitrate_mode' => 'cbr',                   'lossless' => false,                   'encoder_options' => 'CBR48',                   'compression_ratio' => 0.068027210884354,                   'fileformat' => 'mp3',                   'filesize' => 5070,                   'mime_type' => 'audio/mpeg',                   'length' => 1,                   'length_formatted' => '0:01',                   'title' => 'Notifier_Loud',                   'file' => 'notifier_loud.mp3',                 )      but not all of a sudden it has stopped working. Now when I am uploading any audio files, the metadata shows only text '1'. I have no specific plugin installed and only uploading files thru normal media up-loader. Also there is nothing in .htaccess which may create a doubt. any clue is highly appreciated. Regards


How to set a custom post type to not show up on the front end

I use a custom post type in one of my sites for image slideshows. I have publicly queryable set to false/off but when Google crawls my site I see 404 errors for the URLs for my slideshows. I thought that by having publicly queryable off Wordpress would not create those front end URLs. How can I completely turn off the front end URLs and pages for my custom post type? \---- EDIT ------------------------------------------------- By adding public => false, has_archive => false, publicaly_queryable => false, and query_var => false I have successfully gotten rid of the 404 errors in Google. I also added the function provided by @Norcross just for good measure.


Is it possible for a plugin to register a page template file?

Is there a way for a plugin to house page template files and have them available after plugin activation? E.g, I have a plugin that requires specific page page templates to be used, so I'd like them to be available in the Page Attributes meta box in the Editor. But in an attempt to keep my plugin compartmentalized and theme-independent, I'd like to keep the needed page template files out of the theme directory and in a sub-folder of the plugin. I know WordPress parses the theme directory looking for page templates, but is there a way to register templates outside the theme directory?


the_content() "crashes" for single pages

I have big trouble with the_content() for single.php. **Whats my problem?**   * the_content() doesn't give any output on single pages   * furthermore it crashes (no other PHP code below the function call is executed   * There are no PHP or database errors shown   * On all other page and post types the_content() works **What I have done/checked so far**   * deactivated all plugings -> no success   * used original Wordpress themes -> no success   * checked twice if the_content() is inside the loop -> it is inside   * tried to use $post->post_content -> gives output, but I want to use the_content()   * $textt = get_the_content(); echo $textt; -> Works also, so where's the difference between get_the_content and the_content, which keeps the_content from working as supposed to So it seems that the problem is theme and plugin independent. I use Wordpress 3.8 and also tried to reinstall the via the update function.


Make featured image required

Is it possible to force user to set featured image on some types of posts. For example I've got custom post type `mm_photo` and I want to show some error message or somehow block user from publishing or updating post when there is no featured image set.


Filter and Search

I am working on my site which is a WordPress based site. It is a sweepstakes site well winprizesonline.com is the site which inspired me most. Now I want a dynamic search like that site on my site but I have no idea how and where to add code. Like here; http://www.winprizesonline.com/new/contests/ you can see the 3 search boxs, Sort By:, Entry:, Next Entry: I want same search box with same function of filtering and search. Anyone know its code and can tell me where to put it on my site. I am using DirectoryPress theme for my site. Please I need its answer urgently.


Fatal error: allowed memory size when after using enqueue_script

I an trying to enqueue four script files and keep getting this error: `Fatal error: Allowed memory size of 103809024 bytes exhausted ... wp- includes/class.wp-dependencies.php on line 175.` I used wp_register_script like this:                       wp_register_script(              'sat-ba-cond',              $scriptsrc . 'jquery.ba-cond.min.js',              array('jquery'),             '1.0',              true          );                wp_register_script(              'sat-slitsl',              $scriptsrc . 'jquery.slitslider.js',              array('jquery'),             '1.0',              true          );                wp_register_script(              'sat-moderni',              $scriptsrc . 'modernizr.custom.79639.js',              array('jquery'),             '1.0',              false          );                wp_register_script(              'sat-callslit',              $scriptsrc . 'call_slitslider.js',              array('jquery'),             '1.0',              false          );      And wp_enqueue_script like this:                   wp_enqueue_script( 'sat-moderni' );         wp_enqueue_script( 'sat-slitsl' );         wp_enqueue_script( 'sat-ba-cond' );         wp_enqueue_script( 'sat-callslit' );      What could be causing this problem? I have registered and enqueued other scripts as well, which I haven't included here because they have been working up until now. Only these four and `wp_enqueue_script` in particular is causing problems. What could be going on?               add_action( 'wp_enqueue_scripts', 'sat_load_javascript_files' );     function sat_load_javascript_files() {                $scriptsrc = get_template_directory_uri() . '/js/';              wp_deregister_script('jquery');              wp_register_script(              'jquery',              'http://code.jquery.com/jquery-1.7.2.min.js'          );              wp_register_script(              'sat-bootstrap',              $scriptsrc . 'bootstrap.min.js',               array('jquery'),                '2.2.1',                true         );              wp_register_script(              'sat-masonry',              $scriptsrc . 'jquery.masonry.min.js',              array('jquery'),             '1.0',              true          );                wp_register_script(              'sat-fitvid',             $scriptsrc . 'jquery.fitvids.js',             array('jquery'),             '1.0',             true          );               wp_register_script(              'sat-callfitvid',             $scriptsrc . 'call_fitvid.js',             array('jquery', 'sat-fitvid'),             '1.0',             true          );               wp_register_script(             'sat-flexslider',             $scriptsrc . 'jquery.flexslider-min.js',             array('jquery'),             '1.0',             true         );              wp_register_script(             'sat-callflexslider',             $scriptsrc . 'call_flexslider.js',             array('jquery', 'sat-flexslider'),             '1.0',             true         );                wp_register_script(              'sat-mobcust',              $scriptsrc . 'jquery.mobile.customized.min.js',              array('jquery'),             '1.0',              true          );                wp_register_script(              'sat-infinite',              $scriptsrc . 'jquery.infinitescroll.js',              array('jquery'),             '1.0',              true          );                wp_register_script(              'sat-trigger',              $scriptsrc . 'manual-trigger.js',              array('jquery'),             '1.0',              true          );                wp_register_script(              'sat-biggtoggle',              $scriptsrc . 'call_biotoggle.js',              array('jquery'),             '1.0',              false          );              wp_register_script(              'sat-mas-inf-blg',              $scriptsrc . 'masonry_isotope.js',              array('jquery', 'sat-masonry', 'sat-infinite'),             '1.0',              true          );              wp_register_script(              'sat-maslin-blg',              $scriptsrc . 'infinite_scroll_lin.js',              array('jquery', 'sat-infinite'),             '1.0',              true          );              wp_register_script(              'sat-mas_hyb',              $scriptsrc . 'masonry_hybrid.js',              array('jquery', 'sat-masonry', 'sat-infinite'),             '1.0',              true          );              wp_register_script(              'sat-ba-cond',              $scriptsrc . 'jquery.ba-cond.min.js',              array('jquery'),             '1.0',              true          );                wp_register_script(              'sat-slitsl',              $scriptsrc . 'jquery.slitslider.js',              array('jquery'),             '1.0',              true          );                wp_register_script(              'sat-moderni',              $scriptsrc . 'modernizr.custom.79639.js',              array('jquery'),             '1.0',              false          );                wp_register_script(              'sat-callslit',              $scriptsrc . 'call_slitslider.js',              array('jquery'),             '1.0',              false          );              wp_enqueue_script( 'jquery' );         wp_enqueue_script( 'sat-fitvid' );         wp_enqueue_script( 'sat-flexslider' );           wp_enqueue_script( 'sat-infinite' );         wp_enqueue_script( 'sat-trigger' );         wp_enqueue_script( 'sat-masonry' );         wp_enqueue_script( 'sat-biggtoggle' );         wp_enqueue_script( 'sat-callflexslider' );         wp_enqueue_script( 'sat-callfitvid' );              wp_enqueue_script( 'sat-moderni' );         wp_enqueue_script( 'sat-slitsl' );         wp_enqueue_script( 'sat-ba-cond' );         wp_enqueue_script( 'sat-callslit' );              if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' );           }


Setting up Wordpress MU off of a subdomain

I would like to create a network using Wordpress MU, but I want to keep certain sites together by theme. For example, if I was setting up an ecommerce site, it would look like shop.domain.com/site-name Likewise, setting up a restaurant site would be restaurant.domain.com/site- name But these would really be on different networks. I want to do this to be able to feature those sites by category on a network homepage. Is this possible? Would it be efficient, or is there a better way to do this?


How to embed local video in a wordpress post

How can I embed videos (wmv, mp4, mpg, flv) to my post from the local server. I am using WordPress 3.1.1 version. I have searched for wordpress plugins which supports this kind of feature but couldn't find any good plugins. Is there any way to accomplish this.


clone image sizes dropdown as custom fields to attachments

How can I clone the images sizes dropdown as a custom fields to save its value like other fields in attachments does. ![enter image description here](http://i.stack.imgur.com/X5qqO.jpg) Here is my code but not able to save its value               <?php $clone_sizes = get_intermediate_image_sizes(); ?>     <select name="clone_size">       <?php foreach ($clone_sizes as $size_name => $size_attrs): ?>         <option value="<?php echo $size_name ?>"><?php echo $size_name ?></option>       <?php endforeach; ?>     </select>


Is there a move_attachment_file() function in wordpress?

I would like to move (or copy) an attachment from the the "standard" uploads directory to another directory and at the same time make sure all the attachment metadata is updated to reflect the change in directory and all image sizes are created.. The 2 functions I would imagine would be:               move_attachment_file($attachment_id, $old_directory, $new_directory);          copy_attachment_file($attachment_id, $old_directory, $new_directory);      Are there any such functions? If not could someone point me in the right direction and let me know which functions I have to use to accomplish that. Then I can try and code it myself, but I am a bit lost to start with.


post category exclusion in main loop

I have mostly posts from category A. Whereas other categories have very few posts. Due to which my main loop shows posts of category A and other category posts don't get seen much on homepage which shows posts set in settings. What I want to do is alternate the posts shown by main loop such as:               category A post     exclude category A post (any other category post)     category A post     exclude category A post (any other category post)     category A post     exclude category A post (any other category post)     etc etc.      Being a beginner in wordpress, I changed my main loop in index.php with this code:               <?php if ( have_posts() ) : ?>         <?php for($y=0;$y<5;$y++) { ?>     // 5 posts of each category                  <?php $off_num = ($paged-1)*5+$y; ?>  // post offset                  <?php if(is_home()) query_posts("posts_per_page=1&cat=10&offset=$off_num"); ?>    // category id of A is 10             <?php while ( have_posts() ) : the_post(); ?>                 <?php get_template_part( 'content', get_post_format() ); ?>                              <?php endwhile;  wp_reset_query();?>                  <?php if(is_home()) query_posts("posts_per_page=1&cat=-10&offset=$off_num"); ?>             <?php while ( have_posts() ) : the_post(); ?>                 <?php get_template_part( 'content', get_post_format() ); ?>                              <?php endwhile; wp_reset_query(); ?>               <?php } ?>     <?php else : ?>      There are pagination problems. e.g page 2 shows posts from page 1, even-though offset is defined. Similarly with other pages. I couldn't come up with any other way to do this. Hope someone can help on this problem. Any other way to obtain same is also welcomed.


Best way to assign post position in a news site homepage? (no categories, no sticky posts)

I'm currently redesigning a local news website. The old design used a whole lot of categories to handle the position of the content in the static homepage as in "top news", "middle box", "left box" and so on. This is working in someway but it's very ugly, in my opinion, very wrong on a semantic level: categories should be used to categorize. Another option could be using sticky posts, but you can have only a "sticky" vs "non sticky" situation which is kind of limited. I wouldn't use custom post types: basically all post are news and it would be overkill have a separate CPT to position my content on the homepage. The perfect solution would be:   * being able to choose between n position (I need 4)   * having a default status that puts the post on the "other news" box   * control the number of post going into a specific box: the main news box contains only one news, if there is a new "main news" the old one shouldn't disappear from the homepage but switch to a lower position. To recap, I've 5 boxes, 4 of them are a "higher level" single news container, the last one holds 10 news in a reverse chronological order. These 10 news should be "normal" news and "higher level" news pushed out from the upper boxes. I was thinking about Advanced Custom Field as a solution to let the editor choose the position but I'm not sure it's doable on the front end. Thanks!


Trying to use qtranslate in WPSC checkout form?

I need to have 3 different languages checkout forms for WPSC. When i tried to use AddressAdresse it isn't translated. Or should i created 3 different forms and have the lang check hardcoded? How can i make WPSC to work with qtranslate to have multilanguage webshop?


Activation error on first try, not subsequent tries

I'm getting an activation error, the first time a plugin is activated, even though it activates. Subsequent activations (after db tables etc are already sorted) don't throw the error which is... Fatal error: Cannot redeclare ca_myplugin_init() (previously declared in /home/together/public_html/themoyles/clients-test-area/wp- content/plugins/church-admin/index.php:68) in /home/together/public_html/themoyles/clients-test-area/wp- content/plugins/church-admin/index.php on line 69                // add localisation      function ca_myplugin_init() {       load_plugin_textdomain( 'my-plugin', false, dirname( plugin_basename( __FILE__ ) ). '/languages/' );       }      add_action('plugins_loaded', 'ca_myplugin_init');      //end add localisation      Line 68 starts load_plugin_textdomain Line 69 starts } The file is encoded UTF-8, no spaces at start or end. If I comment out that section - it'll throw the error with a different function. The doesn't require itself, the functions only appear once! Any ideas?


Query Posts With Over 1000 Views

_The code below is from this **link**. It basically creates a hit counter, but I'm probably gonna have to do this by IP._ How do I make a WP_Query, where only posts up to 1000 views can be seen on the trending list? Of course. I would want to do it by date as well, but it won't appear at the top one after another, it will only be in the list where it was originally posted. So, that's another solution I'm gonna need to figure out. This is similar to 9GAG.               //Add to functions.php         function get_hits(){         global $post;         $hits = get_post_meta($post->ID, '_hit-counter', true);         return $hits;     }          function update_hits($count){         global $post;         $count = $count ? $count : 0;         $hits = update_post_meta($post->ID, '_hit-counter', $count++);         return $hits;     }          //Usage within the loop     update_hits(get_hits());


Blog Title not showing up on main Blog page

I cannot get the main blog page with the current blog to show the current blog title. It shows on all other pages, just not the current/most recent blog. Any help will be greatly appreciated. Thank you.

                  <?php if ( $paged < 2 ) { // Do stuff specific to first page?>                  <?php $my_query = new WP_Query('category_name=featured&showposts=1');             while ($my_query->have_posts()) : $my_query->the_post();              $do_not_duplicate = $post->ID;?>                  <div class="featurepost" id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?>"><?php the_title(); ?>"><?php the_title(); ?>

By <?php the_author_posts_link(); ?> on <?php the_time('M j, Y') ?> in <?php the_category(', ') ?> | <?php comments_popup_link('0 Comments', '1 Comment', '% Comments'); ?><?php edit_post_link('Edit', ' | ', ''); ?>

                         <?php the_content('Read the rest'); ?>

              <?php endwhile; ?>


How can I make a page for post formats (specifically quotes) in wordpress 3.5

I am trying to create the ability for the end user to add quotes (testimonials) as posts. So far, so good. I have enabled the 'quote' post- format in my theme. So the ability exists to enter said testimonials, and I have even figured out how to show some random quotes in the sidebar. The next obvious step is to have a "testimonials" page, where all of the quotes are archived, over time. It needs the ability to be a page, which means that the client can alter the text in the page, and it can be linked to, in menus and on pages. Following the opening (editable) text, would be a list of the quotes, like an archive page, except that the entire quote would be on the page. For that reason, it would at some point, have to become paged. Any ideas?


Interrupted cron script sending me hourly emails. Please help!

One of my Wordpress installs (cPanel VPS) had a cron job (backup to Dropbox script) that was interrupted. Ever since the interruption I receive hourly emails from root@ cPanel/WHM:   -Excessive resource usage   -Suspicious process running under user […] The suspicious process emails include the following:   **_Network connections by the process (if any):   tcp: 108.160.148.116:52480 -> 54.235.162.219:443_** That last IP address is a Dropbox IP. The thing is I have checked for any running jobs, have deactived and deleted the plugins responsible and have installed Cron checking plugins and no cron scripts are currently in place that have anything to do with the Dropbox backup. I have also checked in cPanel and no cron jobs are listed. And yet I still receive the emails. Every hour. They are driving me crazy! But I don't just want to set up a rule in the email to delete them as I figure something must be going on to make cPanel/WHM send me these emails. Does anyone have any suggestions, I'm desperate!


Update the permalinks in posts (not domain change)

A group that I joined created a wordpress site before I joined. they did not set up permalinks for the site. So when I took over maintaining the site, I been optimizing the site both for SEO and speed. So I am getting to the posts task, which contain links to other posts on the same site, but because permalinks were off they look like `http://THE_SITE/index.php?post_id=432` within every post. I already enabled the %postname% permalink, so google is already updating its urls because of the 301's, but the problem is the posts still have the old default links. So the question is: What is the best way to update the old links to the new permalinks


dbDelta not creating tables

I went through a lot of threads, codex page and tried messing with a lot of things but my code doesn't seem to be creating the tables. And I am not able to figure out where I am going wrong. I checked booking_db_version in the database, it gets updated when I update it in the file. Here's the code               global $booking_db_version;     $booking_db_version = "1.0.0";          function booking_install() {         global $wpdb;         global $booking_db_version;         global $tableprefix;         $installed_version = get_option('booking_db_option');              $tableprefix = $wpdb->prefix . 'booking_';              require_once(ABSPATH . 'wp-admin/includes/upgrade.php');              if ( $installed_version !== $booking_db_version ) {             /* Create table for packages */             $packagetable = $tableprefix . 'packages';             $sql = "create table  $packagetable (                 id mediumint(9) NOT NULL AUTO_INCREMENT,                  name text NOT NULL,                  description text NOT NULL,                  city1 text NOT NULL,                  city2 text NOT NULL,                 PRIMARY KEY  (id)             );";             dbDelta($sql);                  /* Create table for hotels */             $hoteltable = $tableprefix . 'hotels';             $sql = "create table $hoteltable (                 id mediumint(9) NOT NULL AUTO_INCREMENT,                  name text NOT NULL,                  city text NOT NULL,                  price decimal(10,2) NOT NULL,                 PRIMARY KEY  (id)             );";             dbDelta($sql);                  /* Create table for addons */             $addontable = $tableprefix . 'addons';             $sql = "create table $addontable (                 id mediumint(9) NOT NULL AUTO_INCREMENT,                  name text NOT NULL,                  addongroup text NOT NULL,                  price decimal(10,2) NOT NULL,                 PRIMARY KEY  (id)             );";             dbDelta($sql);                  /* Create table for addon groups */             $addongrouptable = $tableprefix . 'addon_groups';             $sql = "create table $addongrouptable (                 id mediumint(9) NOT NULL AUTO_INCREMENT,                  name text NOT NULL,                  perhead text NOT NULL,                 PRIMARY KEY  (id)             );";             dbDelta($sql);                  update_option('booking_db_version', $booking_db_version);         }     }     register_activation_hook(__FILE__, 'booking_install');


Possible to switch between admin view and author view?

The wordpress admin dashboard can be a bit daunting for "normal" wp authors. Is it possible for users who need admin privileges to only see the simpler author view, but be able to switch to the full admin dashboard when required? I understand we could simply create another author account for them. Or use a plugin to create a unique dashboard for each user type. But is it possible to switch between admin / author dashboards at will, without having to log out and then back in again as a different user? Thanks


How to make page navigation just below the content?

I use the P2 theme, and find that the page navigation is not right blow the content, how make it correct? You can refer my site here. ![enter image description here](http://i.stack.imgur.com/z5Y1O.png)


if the post has content

I am setting up a one page wordpress site. I am getting some pages listed in my site that does not have content. For example, I will get the empty blog page as well as the blog template. So I thought I could throw in a check to see if the page has content and if it does go ahead and post that information. I am having trouble getting it to work. I am using a custom query for the homepage. So I thought I could do this                if ( $page_query->have_posts() ) : while ( $page_query->have_posts() ) : $page_query->the_post();      if( $page_query->post_content != ''){            get_template_part( 'content', get_post_format() );      }      endwhile; endif;      problem is that I get an error on that code and I can't figure out why. I get this error Notice: Undefined property: WP_Query::$post_content in


Is it possible to have a taxonomy archive that lists taxonomy terms?

For example, I have a post type called foo. I can view all posts of type foo at the following url: mysite.com/foo. I then attach a taxonomy called bar, in which the terms are foobar and foobaz. I can access the posts assigned the term foobar at mysite.com/bar/foobar. But is it possible to get an archive containing foobar and foobaz at the url mysite.com/bar? Yes, I am aware that I can just create a page and call wp_list_categories(), but I was looking for an automatic solution that mirrors the post type functionality.


IIS 7 Rewrite with parent categories

I have seen quite a few questions on here asking around the same thing but either have been unanswered or slightly different! I have tested the following on a linux machine and all works fine, when I transfer it to windows to run under iis7 it breaks. So I know its setup right as far as the post type and taxonomy code goes. I create a product(my custom post type) and have the following as product categories(custom taxonomy):   \- test1   \-- test2   \--- test3   \---- test 4   I assign the product to the test 4 category. So on my linux machine `http://localhost/products/test1/test2/test3/test4/product-1/` works perfect. On IIS7 it breaks BUT if I assign the product to the test 1 category it works so: `http://localhost/products/test1/product-1/` I am using the 'Custom Post Type Permalinks' plugin and have my posttype permalink set to: '/%product_categories%/%postname%/' Here is my web.config file:               <configuration>       <system.webServer>         <rewrite>         <rules>             <rule name="Main Rule" stopProcessing="true">                 <match url=".*" />                 <conditions logicalGrouping="MatchAll">                     <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />                     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />                 </conditions>                 <action type="Rewrite" url="index.php" />             </rule>         </rules>        </rewrite>       </system.webServer>     </configuration>      Any ideas would be great! \-- Edit -- I also just tried this `http://localhost/products/test4/product-1/` and it worked. So its just not liking the parent categories.


Custom RSS Feeds & Post Meta Data

Rss feeds normally display media files along with post excerpts. I am using post meta to add media files to a post. Unfortunately, since the audio file is not being inserted into the main textarea the audio files are not being displayed in the RSS feed. How can I edit the RSS feed in such a way that the `rss_enclosure()` displays media files from post meta? This is the code I'm using to edit the RSS feed:               function custom_postrss( $content ) {     global $wp_query;     $postid = $wp_query->post->ID;     $audiourl = get_post_meta( $postid, 'custom_audio_url', true );          if( is_feed() ){         $content = '
This post has an audio file. '.$content.'Subscribe for more.'.$audiourl.'
';     }     return $content;     }     add_filter('the_excerpt_rss', 'custom_postrss');     add_filter('the_content', 'custom_postrss');      This only returns the URL, but not the media file box that is usually seen in RSS feeds. Any ideas? I'd be happy for any pointers.


One user per computer

I need to allow only one registered user per computer. I have searched for over one hours, but I did not find any properly solution. Actually I found no solutions at all. How could I do it? Is there any plugins or any other ways?