fetch_feed function works on template index.php but not in plugin/wp-admin

I am using fetch_feed and basically have the same code as the great example provided here but I am creating new posts from the content instead of displaying it afterwards. The errors I am seeing are:               Warning: include_once(ABSPATHWPINC/feed.php) [function.include-once]: failed to open stream: No such file or directory in /home/user/public_html/test/wp-content/plugins/rss-plugin/rss-plugin-scan.php on line 6          Warning: include_once() [function.include]: Failed opening 'ABSPATHWPINC/feed.php' for inclusion (include_path='.:/opt/php53/lib/php') in /home/user/public_html/test/wp-content/plugins/rss-plugin/rss-plugin-scan.php on line 6          Fatal error: Call to undefined function fetch_feed() in /home/user/public_html/test/wp-content/plugins/rss-plugin/rss-plugin-scan.php on line 9      Line 6 is the first statement:               include_once( ABSPATH . WPINC . '/feed.php' );      and line 9 (the second statement) from my scan file is:               $rss = fetch_feed( 'http://www.website.com/rss' );      I have been digging around but the few posts I found that were similar on wordpress.org were not resolved or never answered. One fix I see when searching is to make sure there is no wp_error but I am already using the code from the codex example which includes this.               if ( ! is_wp_error( $rss ) ) : // Checks that the object is created correctly      I am loading the rss-plugin-scan.php file using this method:               <?php      $plugin_location = plugins_url();     $scan_url = $plugin_location . '/rss-plugin/rss-plugin-scan.php';     ?>          <a href="<?php echo $scan_url ?>?scan=true&source=<?php echo $feed_source;?>">Scan Now!      Is there any reason why this would work perfectly within my index page every time I reloaded it but not within this plugin/wp-admin?


Is it safe to manually delete entries from signups table?

In WordPress MS, is it a good practise to manually delete entries from the `signups` tables for users that are already activated? The activation keys shouldn't be needed anymore. Thanks.


Query Custom Meta Value with Increment

I have a Query searching for a meta value I have added to my posts (meta- select). I have it feeding out in a loop with 4 results. Let's say I want this loop to start with the meta value "2" and work its way up "3","4","5" each time adding 1 to the value in the loop. Here is my current code which obviously just queries for the value "2" where do I add an increment in this function?               <?php           // args     $args = array(         'posts_per_page'   => 4,         'post_type' => 'post',         'meta_key' => 'meta-select',         'meta_value' => '2'     );          // get results     $feature_query = new WP_Query( $args );          // The Loop     ?>     <?php if( $feature_query->have_posts() ): ?>
         <?php while ( $feature_query->have_posts() ) : $feature_query->the_post(); ?>
                 <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
         <?php endwhile; ?>
     <?php endif; ?>          <?php wp_reset_query();?>


Lost password empty field error redirect to custom login

I'm having trouble with a custom login/lost password form on a site I'm building. The site is completely password protected. I have a custom login page and I'm using 'wp_login_failed' and 'authenticate' hooks to manage/redirect failed attempts and empty field when logging in. These work fine and the user stays on my custom login page and gets error messages when they have a failed login attempt. When I go to the lost password part (this is simply a hidden form on the same page as the login and is displayed with javascript) and click the 'Get New Password' button whithout entering an email or usernam, I get redirected to the default wp-login page. How would I change this to go to my custom login page instead? Cheers


How can i realize a semi-private research diary blog

We are a group of researchers who would like to each use a blog as our research diary. Regularly we would write down in a post what we have been doing, intermediate results, to do's, challenges ahead, ... The thing is that many research ideas are so preliminary that you would not like to share them with the wide world for different reasons (not wanting to make a fool of yourself if the idea appears to have some flaws, not wanting to let other people run away with your ideas). However, within our research group, there is enough trust that we can share these preliminary ideas, which could be beneficial. At the same time, it would be nice if we could share more mature research writings with the research community. So, we want a setup where we can mark posts as private which are only accessible to the members of the blog (people in our research group). While this appears not to be so difficult according to google, the following two requirements are less trivial:   * find an efficient way to discover new posts without having to visit each others blog each day (It appears that private feeds are not well supported by feed readers).    * combine private posts with regular posts that are accessible to the outside world. any hints on how to set this up would be great. I have been googling for hours for private feeds and readers that can read those, but I did not find any solution that really seemed user friendly.


How to add style to category link?

<?php the_category(' • '); ?> » <a href="<?php the_permalink(); ?>" class="my-title-class"><?php the_title(); ?>
      How to add `class="my-category-class"` to the links, produces by `the_category` function?


Turn off admin emails for new user registrations

How can I turn off email notifications for the user and admin when a new user is registered? I've seen a few suggestions and plugins but none appear to work. One was to take the function from one of the plugins:               if ( !function_exists('wp_new_user_notification') ) :     /**      * Notify the blog admin of a new user, normally via email.      *      * @since 2.0      *      * @param int $user_id User ID      * @param string $plaintext_pass Optional. The user's plaintext password      */     function wp_new_user_notification($user_id, $plaintext_pass = '') {         $user = new WP_User($user_id);              $user_login = stripslashes($user->user_login);         $user_email = stripslashes($user->user_email);              // The blogname option is escaped with esc_html on the way into the database in sanitize_option         // we want to reverse this for the plain text arena of emails.         $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);              $message  = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n";         $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";         $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";              @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);              if ( empty($plaintext_pass) )             return;              $message  = sprintf(__('Username: %s'), $user_login) . "\r\n";         $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";         $message .= wp_login_url() . "\r\n";              // wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message)          }     endif;      The questions and suggestions were quite old so maybe WP 3.5 over rides something. On signup I'm still getting the admin email and an email to the user. I don't want to block the forgotten password email though.


WordPress Multisite platform for different city for single db

I have One WordPress Multisite installation. myplatform.com (Main platform) have custom post list for different city say city1, city2 & city3. Now What I want is on city1.myplatform.com (city1 platform) display post/data only related city1 home page for the same theme and db without adding separate data entry for city1.myplatform.com. Wants to do same for city2.myplatform.com & city3.myplatform.com Is it possible with MU, WP MU is my idea to solve this you can suggest me other way also.


display specific sidebar for each role

Does someone know if it's possible to display a specific sidebar per user-role ? (only accessible if the user is logged as the specific role related to the specific sidebar )? What I want is to have one "profile-like" page in the front end with a custom sidebar per role (with custom nav, custom content, custom links...) i.e : role A access to the "profile" page and has sidebar A, role B access to same page but has sidebar B... Thanks for any help!


Automatically generated menu

I have a menu:               Activities     Projects     About Us     News      (not counting submenu items). Now "Activities" has no submenu. I created custom content type "project". My boss want to fill the menu "Activities" with the list of all projects automatically. Can it be done without rewriting anew all WP menu output code?


Installed Forca Theme, wonder how I can alter Post editing screen

I've just installed Forca Theme on my fresh WP installation. They add a few custom taxonomies like: 1 Events Categories - Just categories for Events 2 Events - Same as regular Post, with custom behaviour and template, have assigned Events Categories to it 3 Events Page - Lists ALL Events, no possibility to display from particular Events Category because the Event Page is not associated with ANY Category, it's the Events (Items) themselves that are assigned to categories. So what I want to do is to add the same Category assignment box from Events to Events Page screen which looks like this: ![enter image description here](http://i.stack.imgur.com/QqP16.png) And is assigned like this:               register_taxonomy("events-cat",                              array("Events Categories"),                              array(  "hierarchical" => true,                                      "label" => "Events Categories",                                      "singular_label" => "Events Categories",                                      "rewrite" => true,                                     "query_var" => true                                 ));          register_post_type( 'events-item',         array( 'labels' => $labels,              'public' => true,                'show_ui' => true,                'capability_type' => 'post',                'hierarchical' => false,                'taxonomies' => array('events-cat'),              'supports' => array('title', 'editor', 'thumbnail', 'comments', 'custom-fields', 'page-attributes') ) );      In `/includes/register.php` so I tried to add a new taxonomy registration to POST screen according to documentation I've found:               register_taxonomy("post-events-cat",         array('post'),         array(  "hierarchical" => true,             "label" => "Post Events Categories",             "singular_label" => "Post Events Categories",             "rewrite" => true,             "query_var" => true     ));      But well, it didn't work. So I wonder how I can tweak particular screen in Wordpress? Not even really related to the Theme itself. Thanks


Excluding post type from WordPress link builder

I have created a custom post type with parameter 'public' set to true. This is because I have to have it accessible in plugins that help you to build queries for post display, such as the Views (part of Toolset) plugin. On the other hand, when I create a new post or page and use the link builder I don't want entries of this post type to show up in the search box there. Is there any way to achieve this aim?


Pagination for previous page/next page (with more than one post/page)

I have a template that displays 3 blog posts per page. I want to use Wordpress pagination for previous/next, but the pagination won't display on my page. Here's the code I have now for `template-blog.php` (UPDATE: I moved this to `home.php` as well):               if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }     elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }     else { $paged = 1; }          $args = array('post_type' => 'post', 'paged' => $paged);     $the_query = new WP_Query( $args );          while ( $the_query->have_posts() ) {         $the_query->the_post();         // (I display the post here)     }
         <?php previous_posts_link('%link', 'Previous', TRUE); ?>         <?php next_posts_link('%link', 'Next', TRUE); ?>
      This code displays posts #1 through #3 but no next/previous link. There are still two more posts (#4 and #5) which should be on the next page of posts, so there should be a "Previous" link. And if I manually change the URL to `/blog/2`, sure enough, there are posts #2 and #1. (I also tried `previous_post_link` and `next_post_link`, for per-post navigation, and they display a link that goes to just the previous post. Which is no good.) **UPDATE 1:** I noticed that `$the_query->max_num_pages == 2`, which is correct (I've loaded 5 test posts into the system). So at least Wordpress knows there's another page. **UPDATE 2:** I changed my code to use `query_posts()`... still no luck, `previous_posts_link` and `next_posts_link` displays nothing. **UPDATE 3:** I've moved this code into `home.php`, and changed Settings > Reading to make this page the main "posts" page. Now I can confirm that Wordpress is using `home.php` as the template file to display the blog page, but it still won't display any pagination. * * *


Display custom post types by date field

I have a custom post type that is simply titles with a date field. I want to display these posts in a list in order of this date field (not date posted). So simply: -- Sample date Event title 1   Event title 2 Sample date Event title 3   Event title 4   Event title 5 (etc) -- No extra info, that's literally all I want to display. I can't figure out how to go about this at all. I'm not great at PHP so I'd appreciate any help with this.


Add class to active element and its parent in nav menu

I am using the following code in order to add a class name "active" to the current menu item:               add_filter('nav_menu_css_class', 'add_active_class', 10, 2 );          function add_active_class($classes, $item) {       if( $item->menu_item_parent == 0 && in_array('current-menu-item', $classes) ) {         $classes[] = "active";       }            return $classes;     }      This works as charm, but only for items without a dropdown. If there's an item with children in it, it won't add the active class to the parent item. Is there a way I can modify this code so the filter adds an "active" class both to the current link and it's parent?


Filter archive.php by custom meta

I"m trying to filter an archive page by custom meta query. I've tried using `query_posts($args)` prior to the loop, but it returns nothing. Any ideas? Here's what I have so far:               <?php              //$wolfName = $_GET['wolfName'];             $archiveArgs = array(                             'meta_key'  => 'wolf',                             'meta_value'    => 'boltz'                             );             query_posts($archiveArgs);             ?>             <?php if (have_posts()) : ?>      It returns no posts... any ideas?


Does it make sense to use two factor authentication with password protected wp-admin folder?

I've finished building my wordpress website and now, I'm concerned about the security of the website. To improve security, I'm using Google two factor authentication plugin while also password-protecting the wp-admin folder besides the default username- password login of wordpress. My question is, does it make sense to apply all these layers of security? Am I being silly about this? I mean, if either two of these protection methods are used, instead of three, and it is enough, then using all three will be too much of a hassle without bringing significant improvement in security. What do you think?


Coupon code not applied correctly before taxes

There are some mistakes with the formula of the coupon before tax. For example:   Whenever a client orders for over 250€ excl tax, they will get a 5% discount. The discount given on the site is a bit less than 5%. (for 5% you need to fill in code1 in the coupon box, for 10% you need to spend over 500€ en fill in code2) You can give it a try on this site. **For example:**. If I order a packet 2 for 50 times and pakket 4 for 50 times, the total is 707,5 without tax. I fill in code2 for my 10% discount, and I receive a discount of 70,5 Euro instead of 70,75€. How to solve this issue?


Change output of the function

Below is the Current Function               function ajax_result($arg, $id,$pagenumber){        $apiclass = new ajaxwpqsfclass();           // The Query         $query = new WP_Query( $arg );         $html ='';         // The Loop     if ( $query->have_posts() ) {         $html .= '
'.__('Search Results :', 'AjWPQSF' ).'
';         while ( $query->have_posts() ) {             $query->the_post();                 $html .= '
'.the_post_thumbnail('event-home-thumb').'';                 $html .= '
'.get_the_title().'
';                 $html .= '';                 $html .= '
';              }              $html .= $apiclass->ajax_pagination($pagenumber,$query->max_num_pages, 4, $id);      } else {                 $html .= __( 'Nothing Found', 'AjWPQSF' );             }             /* Restore original Post Data */             wp_reset_postdata();              return $html;      } I want to replace the above function according to the req args. I want to change the image, title and excerpt to these For image i want to use this featured image :               <a href="<?php the_permalink();?>">      <?php get_the_image(array('post_id'=>$is_parent,'size'=>'event-home-thumb','link_to_post'=>false,'image_class'=>'img','default_image'=>get_stylesheet_directory_uri()."/images/img_not_available.png")); ?>           For title:               <a href="<?php echo get_permalink($post->ID); ?>" title="<?php echo $post->post_title; ?>"><?php  echo $post->post_title;  ?>      And I want to show some Custom Taxonomy :                                               <?php $terms = wp_get_post_terms($post->ID, 'sublocation');                                         if ($terms) {                                         $out = array();                                         foreach ($terms as $term) {                                         $out[] = 'slug .'" href="' .get_term_link( $term->slug, 'sublocation') .'">' .$term->name .'';                                         }                                         echo join( ', ', $out );                                     } ?>


How to activate "Description" metabox for menu item programmatically?

I'm creating custom wordpress theme. How can I enable "Description" metabox for menu items (on nav-menu page) by default programmatically?


Contact form spam, without form?

I previously had a contact page with the theme built-in contact form. I received a lot of spam with that form, and one day I had to change it to add functionalities (upload to google docs) and I decided to get a JotForm plugin for wordpress. So I changed the form url, the page url, but I still get a lot of spam from the old page url. The new page is "/contactezmoi" and the old was "/contact", so i guessed wordpress matched the url to redirect to the new page, but the form sent by mail is the one used on the old contact page. So let me guess, the spammer don't use the form and call directly the wp- contact page... What can I do to get rid of thoses unwanted messages ?


Sitemap Page build from Menu?

Is there a plugin available that creates a sitemap from the default menu, e.g. as shortcode or requestbale URI?


Change header when on home page

Im trying to make my home page have one type of header which is different from every other page. I have made a page the front page in the settings called home and in header.php i have changed the code to this:               <?php if(is_home()) {?>             <hgroup>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php echo "Hello World" ?>"/>
             </hgroup>         <?php } else {?>             <hgroup>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php bloginfo('template_url'); ?>/images/Cranbri-web-solutions.png"/>
             </hgroup>         <?php } ?>      Can anyone see whats wrong? because for some reason the header inst changing?? Thanks


LOCAL server not installing wordpress

Hi all i did the install but now is asking me if i have : * Are you sure you have the correct username and password? YES * Are you sure that you have typed the correct hostname? YES * Are you sure that the database server is running? NOT SURE how do i know my local server is running when using /phpmyadmin i will apprciate any help sincerely JIm


Develop new theme without affecting the active one

Hi I will really appreciate your input. I just got a new template for wp. I want to start working on it without affecting the template already installed and running on the server. what's the best way to work around it? someone told me to create a new directory and install wp in that directory, which i did but it shows a 404 page Sincerely Jim


LOCAL server not installing wordpress

As you noticed I’m new at WP. Right now I’m working on my local server with a WP template (Using WAMP server) Am I going to have an issue with Permalink Settings when I upload the files or transfer them to the site server? Right now the Permalink Settings:               http://localhost/wordpress/?page_id=172      instead of:               http://localhost/wordpress/about      I have been trying to update the `.htaccess` but not luck. Any suggestions? Before continuing I don't want to spend more time adding pages knowing that the Permalinks won’t work. Is there a better way to re-name the links? Sincerely Jim


Display custom post type category taxonomy

I have a custom post type and a taxonomy which allows the user to select which category the post is in. Here is my custom taxonomy:               add_action( 'init', 'create_talcat_taxonomy', 0);     function create_Talcat_taxonomy()     {         register_taxonomy ( 'Talcat', 'artist', array( 'hierarchical' =>         true, 'label' => 'Categories', 'query_var' => true, 'rewrite' => true )     );     }      On my homepage I am querying the post_type=artist , which works fine and brings in my artist posts. However how can I print/display the name of the category that post belongs to and then link to that category page?


single.php doesn't getting style

i'm embedding a wordpress blog in a html page and i did the steps to successfully add the header and the footer of my site www.srougi.biz/soulfighter/blog. But now I need to stylize my single.php that is the page that shows the full post when user clicks in the post title. I've added the commands below that should bring the customized header and footer, since I stylized header.php and footer.php. But it comes totally unconfigured and doesn't get the style. Can someone please help me? Thanks a lot. See my single.php code:               <?php     global $OLDCAR_VAN;     get_header();     ?>
                                 <?php while (have_posts()) : the_post(); ?>                                                                                <article id="post-<?php the_ID();?>" <?php post_class("single-blog-article");?>>
                                                                                <div class="<?php echo format_icon();?>">

<a href="<?php the_permalink();?>" title="<?php echo esc_attr(get_the_title());?>" rel="bookmark"><?php the_title();?>
                                                                                <?php echo van_posted_on();?>

                                                                                <?php van_format_content();?>                                         <?php wp_link_pages('before=
&after=
');?>

                                     <?php the_tags(''.__('Tags','OldCar').': ', '' , ''); ?>

                                         <?php previous_post_link( '%link', __( '← Previous Post', 'OldCar' ) ); ?>                                         <?php next_post_link( '%link', __( 'Next Post →', 'OldCar' ) ); ?>

                                                                 <?php endwhile;?>                                                                                <?php comments_template(); ?>

     <?php get_footer();?>


Add a meta description to home page?

I have the theme Hatch and I can't figure out how to change the meta- description of the home-page. It is not an actual page, it is the default view for posts. Have searched everywhere for an answer but really can't figure it out. I have downloaded the plug-in SEO by Yoast, but only seem to be able to change the meta-description on pages and posts...?


Why wp redirects me to wp-login.php when I visit a rewritten wp-admin URL?

I have this rewrite rule               ^dashboard(.*) wp-admin$1 [L]       and wp redirects me to wp-login.php when I try to visit /dashboard (even if I am logged in) Any idea why this happen, and how I can solve this issue?


Add nonexisting pages to navigation

I want to include categories which are listed in a non-native WordPress table to display within the "normal" wp page navigation (the table comes from WP- Filebase and is called `->prefix .wpfb_cats`) I have put the following in my themes function file, which does add the categories into the navigation and in the right hierachical order. However, none of these have any links (I suppose it's because those pages do not exist as such in the `wp_post` table ) How can I persuade wp to to recognize these as pages and, when clicked on it, display the content?   Am I using the right hook?   When I echo the WPPost object at the end of that function, these additional pages are in there, but just the title. How can I show links in the navigation?               add_filter('get_pages','msci_wpfb_frontend_menus',10,2);          function msci_wpfb_frontend_menus($pages,$query){                  global $wpdb;             $wpfbCats=$wpdb->get_results("SELECT * FROM ".$wpdb->wpfilebase_cats." WHERE cat_exclude_browser='0' ", ARRAY_A );             foreach($wpfbCats as $k=>$v){                 $wpfbId=9999;/*add improbably high id so there are no clashes with any actually existing pages**/                 $id=$wpfbId+$v['cat_id'];                          if($v['cat_parent']==0){                         $pid=4;/*display the wpfb top categories under this - existing - page*/                     }else{                         $pid=$wpfbId+$v['cat_parent'];                     }                     $name=$v['cat_name'];                          $page=array(                         'ID' => $id,                         'post_author' => $v['cat_owner'],                         'post_date' => date('Y-m-d H:i:s'),                         'post_date_gmt' => date('Y-m-d H:i:s'),                         'post_content' => '####some content####',                         'post_title' => $v['cat_name'],                         'post_excerpt' => '',                         'post_status' => 'publish',                         'comment_status' => 'closed',                         'ping_status' => 'closed',                         'post_password' => '',                         'post_name' => sanitize_title($v['cat_name']),                         'to_ping' => '',                         'pinged' => '',                         'post_modified' => date('Y-m-d H:i:s'),                         'post_modified_gmt' => date('Y-m-d H:i:s'),                         'post_content_filtered' => '',                         'post_parent' => $pid,                         'guid' => ''.$id.'',                          'menu_order' => $v['cat_order'],                         'post_type' => 'page',                         'post_mime_type' => '',                         'comment_count' => 0,                         'filter' => 'raw'                     );                     $wpfbCat = new WP_Post ();                     foreach($page as $k=>$v){                         $wpfbCat->$k=$v;                     }                     $pages[]=$wpfbCat;         }         return $pages;     }


build plugin wordpress error when uploading image

I just want to upload an image and I'm building my plugin with this tutorial. But in the part 3 it says image upload should work. However when I try to upload image it's not working. I'm uploading my image through Wordpress media library. The error is "An error occurred in the upload. Please try again later." I don't understand why and I really don't know how to fix this error. I enable the debug mode but WordPress shows no bug. I just notice something strange like I already said, the media library shows an error when I try to upload a media in my plugin. But when I go in the media library, I see the image is in the media library.               <?php     /*     Plugin Name: S-Gallery     Plugin URI: Put the one of the project s-gallery     Description: S-gallery plugin for wordpress     Author: Sylvain      Version 1.0     Author URI: http://pqofj.fr     */     ?>          <?php     /* Hook activation */          function s_gallery_activation() {     }     register_activation_hook(__FILE__, 's-gallery_activation');     function s_gallery_deactivation() {     }     register_deactivation_hook(__FILE__, 's-gallery-deactivation');     ?>                    <?php     add_action('wp_enqueue_scripts', 's_gallery_scripts');          function s_gallery_scripts() {          wp_register_script('s_gallery_jquery', plugins_url('js/jquery-1.8.2.min.js', __FILE__));     wp_enqueue_script('s_gallery_jquery');      wp_register_script('s_gallery_plugins', plugins_url('js/plugins.js', __FILE__));     wp_enqueue_script('s_gallery_plugins');          wp_register_script('s_gallery_scripts', plugins_url('js/scripts.js', __FILE__));     wp_enqueue_script('s_gallery_scripts');          wp_register_script('s_gallery_active', plugins_url('js/active.js', __FILE__));     wp_enqueue_script('s_gallery_active');     }     ?>                    <?php        add_action('wp_enqueue_scripts', 's_gallery_styles');          function s_gallery_styles() {     wp_register_style('s_gallery_styles', plugins_url('css/styles.css', __FILE__));     wp_enqueue_style('s_gallery_styles');     ?>               <?php          add_shortcode('s_gallery_shortcode', 'first_shortcode_function');          function first_shortcode_function() {     return             '
'             . '
'             . '

'             . '

 '             . '

 '             . '
'             . '
'             . '

'             . '

'             . '

'             . '
'             . '
'             . ''             . ''             . ' '             . '
'             . '
';     }     ?>               <?php     require_once('add_image_user.php');     ?>      The file "add_image_user.php" :               <?php          /* Add menu s_gallery */          add_action('init', 's_gallery_register');          function s_gallery_register() {          $labels = array(         'menu_name' => _x('S_Gallery', 's_galleryjs_gallery'),     );          $args = array(         'labels' => $labels,         'hierarchical' => true,         'description' => 'Dynamic image gallery',         'supports' => array('title', 'editor'),         'public' => true,         'show_ui' => true,         'show_in_menu' => true,         'public_queryable' => true,         'exclude_frim_search' => false,         'has_archive' => true,         'query_var' => true,         'can_export' => true,         'rewrite' => true,         'capability_type' => 'post'     );          register_post_type('s_galleryjs_gallery', $args);           }     ?>          <?php          add_action('add_meta_boxes', 'fwds_slider_meta_box');          function fwds_slider_meta_box() {          add_meta_box("s-gallery-images", "S-Gallery Images", 's_gallery_images', "s_galleryjs_slider", "normal");     }          function s_gallery_images() {     global $post;          $gallery_images = get_post_meta($post->ID, "_fwds_gallery_images", true);     // print_r($gallery_images);exit;     $gallery_images = ($gallery_images != '') ? json_decode($gallery_images) : array();          // Use nonce for verification     $html = '<input type="hidden" name="fwds_slider_box_nonce" value="' . wp_create_nonce(basename(__FILE__)) . '" />';          $html .= '';     $html .= '

     Image 1	     <input id="fwds_slider_upload" type="text" name="gallery_img[]" value="".$gallery_images[0]."" />

     Image 2	     <input id="fwds_slider_upload" type="text" name="gallery_img[]" value="".$gallery_images[1]."" />

     Image 3	     <input id="fwds_slider_upload" type="text" name="gallery_img[]" value="".$gallery_images[2]."" />

     Image 4	     <input id="fwds_slider_upload" type="text" name="gallery_img[]" value="".$gallery_images[3]."" />

     Image 5	     <input id="fwds_slider_upload" type="text" name="gallery_img[]" value="".$gallery_images[4]."" />

     ';          echo $html;     }      ?>


How to add a div around the default gallery output

I would like to add a container around the default [gallery] output. I don't want to modify any core files, and add unusual lines to my functions.php. How to do that? What's the most elegant method?


How to handle paging/pagination with a custom permalink?

I hope I can explain this properly: I'm working on a project involving multiple post types and custom permalinks. I have a post type for TV/movie series/franchise and a separate post type for content (episodes, movies, Direct to video). For the content type, I currently have a permalink that is as so:               abc.com/watch/%content_series%/%content_type%/%postname%      Thank to the rewrite rules, the structure degrades: I can have archive paves that are just `abc.com/watch/%content_series%/%content_type%/` or `abc.com/watch/%content_series%/` no problem. The problem I run into is pagination. If I did `abc.com/watch/one-piece/page/2`, I hit a snag because instead of recognizing that I want page 2, it thinks page is a `content_type` and 2 is the `name`. A screencap of rewrite Analyzer confirms this: ![enter image description here](http://i.stack.imgur.com/V55eB.jpg) So, the right rewrite is there, its just not taking precedence. Is there a way to make this work correctly? EDIT: Here is the code that sets everything up:               //Query vars/tags            add_rewrite_tag('%content_series%','([^/]+)');         add_rewrite_tag('%content_type%','([^/]+)');         add_rewrite_tag('%content_num%','([0-9]{1,})');              //Permastructs         $content_struct = get_option('veda_content_slug') . '/%content_series%/%content_type%/%postname%';         add_permastruct('veda_content', $content_struct, false);             add_rewrite_rule(  get_option('veda_content_slug') .'/?$', 'index.php?post_type=veda_content', 'top' );


Different page template for paginated content?

Sorry for the basic question, but I can't track down a solution (or maybe it's just hard to search for). I'm creating my own infinite scroll system for a wordpress site I'm working on. For ease of development it would be beneficial for the 'paginated' content to be on a separate template (so that I can just output the content, and ignore the rest of the template). Can this be done in wordpress? i.e. `domain.tld/content-page` should use `content-page.php` `domain.tld/content-page/page/1` should use `content-page-paginated.php` I suppose the obvious alternative is having logic in content-page.php that checks to see if it's paged content and outputs differently if that's the case.


Attachment Image using wrong src?

I've had some issues recently with this code below to display the featured image of a page:               add_theme_support( 'post-thumbnails' );     add_image_size("homepageFeatured", 250, 250, false);     wp_attachment_image(get_post_thumbnail_id($post->ID), 'homepageFeatured'); //in the loop      The issue is that it's pulling a 150x150 image (the 250x250 does exist, and the url is accessible, I used the Thumbnail Regenerator plugin) and then resizing that up to 250x250 (causing to to be blurry). Any ideas on why this is occurring? Thanks,   Max


first_name property missing inside register_user action hook

I'm trying to access the $user->first_name property from a function triggered by the `register_user` action hook but it's not there:               function do_stuff($user_id) {          $new_user = get_userdata($user_id);          $first_name1 = $new_user->user_firstname;     $last_name1 = $new_user->user_lastname;         echo "<" . $first_name1 . $last_name1 . ">";         //returns: <>          $first_name2 = $new_user-first_name;     $last_name2 = $new_user->last_name;         echo "<" . $first_name2 . $last_name2 . ">";         //returns: <>          }     add_action("register_user", "do_stuff");      UPDATE: I tried this:               $user_meta = get_user_meta( $new_user->ID );     var_dump($user_meta);      and I got this (last_name and first_name are empty even though they're defined in the user's profile):               array(11) { ["wp_user_level"]=> array(1) { [0]=> string(1) "0" } ["show_admin_bar_front"]=> array(1) { [0]=> string(4) "true" } ["wp_capabilities"]=> array(1) { [0]=> string(32) "a:1:{s:10:"subscriber";s:1:"1";}" } ["use_ssl"]=> array(1) { [0]=> string(1) "0" } ["admin_color"]=> array(1) { [0]=> string(5) "fresh" } ["comment_shortcuts"]=> array(1) { [0]=> string(5) "false" } ["rich_editing"]=> array(1) { [0]=> string(4) "true" } ["description"]=> array(1) { [0]=> string(0) "" } ["nickname"]=> array(1) { [0]=> string(7) "emerson" } ["last_name"]=> array(1) { [0]=> string(0) "" } ["first_name"]=> array(1) { [0]=> string(0) "" } }


"open_basedir restriction" but project is within the allowed paths

I had a project working right, but suddenly I'm getting a _Database connection error_. Looking at the Apache2 logs I can see these lines: > PHP Warning: file_exists(): open_basedir restriction in effect. > File(STYLESHEETPATH/index.php) is not within the allowed path(s): (...) in > /webDir/project/wp-includes/template.php on line 467 > > PHP Warning: file_exists(): open_basedir restriction in effect. > File(TEMPLATEPATH/index.php) is not within the allowed path(s): (...) in > /webDir/project/wp-includes/template.php on line 470 But in `php.ini` the project IS within the allowed paths: open_basedir = /webDir/project:/usr/share/phpmyadmin So what could be happening here?


Use wp_remote_get to add image to media library

I'm using Embedly to make it easy for a client to add news to their website - basically, they just input a URL, and Embedly grabs the link's information, and I add it all to post meta for displaying on the front-end. So far, so good. Currently, I'm using the thumbnail as it's served from the URL's website, but what I'd like to do is download the image, add it to the media library, and set it as the featured image. I'm given the image's URL, and I think I have to use `wp_remote_get` to download the image, but I have no idea what the rest of the steps are. Edit: Here's the relevant bits:               function get_fr_news_embedly( $post_id ) {     $post = get_post( $post_id );          if ( $post->post_type == 'fr_news' ) {              $embedly_key = '[key goes here]';              $api = new Embedly\Embedly(array( 'key' => $embedly_key, 'user_agent' => 'Mozilla/5.0 (compatible; mytestapp/1.0)' ));         $fr_news_url = $post->fr_news_url;              $fr_news_objs = $api->oembed( $fr_news_url );         update_post_meta( $post_id, 'fr_news_objs', $fr_news_objs );         $fr_news_objs = get_post_meta( $post_id, 'fr_news_objs' );              foreach ($fr_news_objs as $k => $oembed) {             $oembed = (array) $oembed;                  if (array_key_exists('thumbnail_url', $oembed)) {                 $fr_news_thumbnail_url = $oembed['thumbnail_url'];                 update_post_meta( $post_id, 'fr_news_thumbnail_url', $fr_news_thumbnail_url );                 $image = wp_remote_get( $fr_news_thumbnail_url );                                 // wat do?             }      The question comes down to this: if you have a url for an image, how do you download that image and add it to the media library?


How to exclude post from being queried based on custom meta value

I am building a reviewing system for user-submitted posts on my website. I have a page called **page-review.php** which displays the oldest post of the "pending review" category. This is to ensure that every user-submission gets reviewed. There is only one post displayed on this page at a time.               $review_args = array(         'orderby' => 'post_date',         'order' => 'ASC',         'posts_per_page' => '1',         'cat' => 22,     );          $review_query = new WP_Query($review_args);      After a post has been reviewed a new custom meta tag will be added to the post called **reviewed_by**. This meta tag contains an array of user IDs that have reviewed this post. How do I make it so that my query checks if the custom meta **reviewed_by** has the current user's ID in it? And if it does find it in the **reviewed_by** array then it will show the next oldest post that doesn't have the user's ID in the custom meta. UPDATE: I still can't seem to get it working. The content in **reviewed_by** looks like the following (it's an array converted to a string I believe)               a:1:{i:0;i:34;}      This is an array where my user_id is 34.               $review_args = array(         'orderby' => 'post_date',         'order' => 'ASC',         'posts_per_page' => '1',         'cat' => 22,         'meta_query' => array(                             array(                                 'key' =>'reviewed_by',                                 'value' => $current_user_id,                                 'compare' => 'NOT IN'                             )                         )     );


Echo array value

I have following query to store data for last week entries in database:               for ( $i; $i <= 7; $i++ ) {         $val[$i]= $wpdb->get_results( "SELECT COUNT(`order_total`) AS  'Total' FROM vm_orders WHERE DATE = CURDATE()-$i" );     }         When I `print_r( $var )` I get:               Array (         [1] => Array (             [0] => stdClass Object (                 [Total] => 1             )         )         [2] => Array (             [0] => stdClass Object (                 [Total] => 0             )         )         [3] => Array (             [0] => stdClass Object (                 [Total] => 0             )         )         [4] => Array (             [0] => stdClass Object (                 [Total] => 0             )         )         [5] => Array (             [0] => stdClass Object (                 [Total] => 0             )         )         [6] => Array (             [0] => stdClass Object (                 [Total] => 0             )         )         [7] => Array (             [0] => stdClass Object (                 [Total] => 0             )         )     )      For each Loop , echoing result as Array Array... Now the question is, How can I store value in a array. Because I need to pass this to plot graph. I'm new to Programmming. Any suggestion would , help me


Add menu and submenu in admin with a URL instead of slug?

I use this function and hook:               function mysite_admin_menu()      {       add_menu_page( 'Categories', 'Catégories', 'administrator', 'categories', 'a_function' );       add_submenu_page( 'categories', 'Manage', 'Manage', 'administrator', 'xxx', 'a_function' );       remove_submenu_page('categories','categories');     }     add_action( 'admin_menu', 'mysite_admin_menu' );      It displays what I need: a menu with a submenu on the left admin menu bar. The thing is, the submenu leads to this page: `admin.php?page=xxx`. How can I do to link to a URL like `edit-tags.php?taxonomy=category`? If I swap the slug in the `add_submenu_page` with a relative URL, the link will lead to `admin.php?page=edit-tags.php?taxonomy=category`. Whatever I do, I always get `admin.php?page=...` which is not what I want.


How to convert multi-site to single site

I need to take a site that is installed as a subdomain blog on a multi site install and move it to it's own domain on a standalone wordpress installation. How can this be done? I am running into trouble with the path to the images in posts because multi site uses `/blogs.dir/blogid/` Can this be done?


I have this code:                     $args=array(             'public'   => true,             '_builtin' => false           );           ?>           <select id="<?php echo $this->get_field_id('posttype'); ?>" name="<?php echo $this->get_field_name('posttype'); ?>">               <?php foreach(get_post_types($args,'names') as $post_type) { ?>                   <option <?php selected( $instance['posttype'], $post_type ); ?> value="<?php echo $post_type; ?>"><?php echo $post_type; ?></option>               <?php } ?>                 </select>      I make custom posts               function my_post_type_interior_articles() {             register_post_type( 'interior_articles',                         array(                          'label' => __('Interior Design Articles'),                          'public' => true,                          'show_ui' => true,                         'show_in_nav_menus' => false,                         'menu_position' => 5,                         'supports' => array(                                 'title',                                 'custom-fields',                                 'editor',                                 'excerpt',                                 'thumbnail')                             )                          );         }              add_action('init', 'my_post_type_interior_articles');      in dropdown shows **"interior_articles"** , but i need to show **"Interior Design Articles"** How to show cutom post labels in options?


Wireframe tool for WordPress theme

I want to develop a WordPress theme from scratch. Is there any wireframe tool in which I can design the a complete page and it exports the html/php file against it. I want a free tool.


Server side validation for Contact Form 7

I'm trying to use contact form 7 on my site. The only server side validation that it seems to do is check if required fields have been entered. Isn't there a danger if someone sends several MB of data through tools like tamper data? Will I need to rewrite the plugin code to take care of validation?


unable to save custom taxonomy terms in a custom-built metabox in wp-admin

I have created two custom taxonomies i.e states and provinces but am unable to save the data in custom build meta boxes in wp-admin:               <?php function custom_meta_box() {              remove_meta_box( 'tagsdiv-states', 'post', 'side' );         remove_meta_box( 'tagsdiv-provinces', 'post', 'side' );              add_meta_box( 'tagsdiv-states', 'US States', 'states_meta_box', 'post', 'side' );         add_meta_box( 'tagsdiv-provinces', 'Canada Provinces', 'provinces_meta_box', 'post', 'side' );          }     add_action('add_meta_boxes', 'custom_meta_box');          /* Prints the taxonomy box content */     function states_meta_box($post) {              $tax_name = 'states';         $taxonomy = get_taxonomy($tax_name);     ?>     <div class="tagsdiv" id="<?php echo $tax_name; ?>">
         <?php          // Use nonce for verification         wp_nonce_field( plugin_basename( __FILE__ ), 'states_noncename' );         $states_IDs = wp_get_object_terms( $post_id, 'states', array('fields' => 'ids') );         wp_dropdown_categories('taxonomy=states&hide_empty=0&orderby=name&name=states&show_option_none=Select US State&selected='.$states_IDs[0]); ?>
Select US State

     <?php     }          /* When the post is saved, saves our custom taxonomy */     function states_save_postdata( $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 ) || wp_is_post_revision( $post_id ) )            return;            // verify this came from the our screen and with proper authorization,       // because save_post can be triggered at other times            if ( !wp_verify_nonce( $_POST['states_noncename'], plugin_basename( __FILE__ ) ) )           return;                 // Check permissions       if ( 'post' == $_POST['post_type'] )        {         if ( !current_user_can( 'edit_page', $post_id ) )             return;       }       else       {         if ( !current_user_can( 'edit_post', $post_id ) )             return;       }            // OK, we're authenticated: we need to find and save the data            $states_ID = $_POST['states'];            $states = ( $states_ID > 0 ) ? get_term( $states_ID, 'states' )->slug : NULL;            wp_set_object_terms(  $post_id , $states, 'states' );          }     /* Do something with the data entered */     add_action( 'save_post', 'states_save_postdata' );               /* Prints the taxonomy box content */     function provinces_meta_box($post) {              $tax_name = 'provinces';         $taxonomy = get_taxonomy($tax_name);     ?>     <div class="tagsdiv" id="<?php echo $tax_name; ?>">
         <?php          // Use nonce for verification         wp_nonce_field( plugin_basename( __FILE__ ), 'provinces_noncename' );         $provinces_IDs = wp_get_object_terms( $post_id, 'provinces', array('fields' => 'ids') );         wp_dropdown_categories('taxonomy=provinces&hide_empty=0&orderby=name&name=provinces&show_option_none=Select Province&selected='.$provinces_IDs[0]); ?>
Select Canadian Province

     <?php     }          /* When the post is saved, saves our custom taxonomy */     function provinces_save_postdata( $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 ) || wp_is_post_revision( $post_id ) )            return;            // verify this came from the our screen and with proper authorization,       // because save_post can be triggered at other times            if ( !wp_verify_nonce( $_POST['provinces_noncename'], plugin_basename( __FILE__ ) ) )           return;                 // Check permissions       if ( 'post' == $_POST['post_type'] )        {         if ( !current_user_can( 'edit_page', $post_id ) )             return;       }       else       {         if ( !current_user_can( 'edit_post', $post_id ) )             return;       }            // OK, we're authenticated: we need to find and save the data            $provinces_ID = $_POST['provinces'];            $provinces = ( $provinces_ID > 0 ) ? get_term( $provinces_ID, 'provinces' )->slug : NULL;             wp_set_post_terms(  $post_id , $provinces, 'provinces' );          }     /* Do something with the data entered */     add_action( 'save_post', 'provinces_save_postdata' );?>


Insert Gallery Doesn't insert shortcode

I have a custom posttype where for some reason the "Insert Gallery" button generates an javascript error               Uncaught Error: Syntax error, unrecognized expression: [gallery ids="113,111"] jquery.js?ver=1.10.2:3     at.error jquery.js?ver=1.10.2:3     mt jquery.js?ver=1.10.2:3     kt jquery.js?ver=1.10.2:3     at jquery.js?ver=1.10.2:3     x.fn.extend.find jquery.js?ver=1.10.2:4     x.fn.x.init jquery.js?ver=1.10.2:3     e.fn.init jquery-migrate.min.js?ver=1.2.1:2     x jquery.js?ver=1.10.2:3     x.fn.x.init jquery.js?ver=1.10.2:3     e.fn.init jquery-migrate.min.js?ver=1.2.1:2     x jquery.js?ver=1.10.2:3     window.send_to_editor wpc.js?ver=3.8:10     wp.media.editor.insert media-editor.min.js?ver=3.8:1     (anonymous function) media-editor.min.js?ver=3.8:1     c backbone.min.js?ver=1.0.0:7     a.Events.trigger backbone.min.js?ver=1.0.0:7     toolbar.set.c.view.Toolbar.items.insert.click media-views.min.js?ver=3.8:1     c.view.Button.c.View.extend.click media-views.min.js?ver=3.8:1     x.event.dispatch jquery.js?ver=1.10.2:4     v.handle      It work's on regular posts and images gets uploaded etc if i copy and paste the shortcode it works aswell it's just that insert button that has gone bananas. I reallly would appreciate any help I could get


Loading scripts on a single page plants the script in the footer

I'm using this code to plant a script on a spesific page, it works but inserts the script into the bottom of the page not the top - I'm at a loss to explain why! Is there a way to do this that results in the script being inserted inside the head tags.               function single_page_load() {         if ( !is_page_template( 'interactive-map.php' ) )         return;             wp_enqueue_script( 'map', get_template_directory_uri() . 'jquery-map/map.js', array('jquery'), '1.4.2', true );         }     add_action( 'template_redirect', 'single_page_load' );


What plugin(s) are best for this User registration task?

I have a site with user registration and I have a few specific qualifications that I must fulfill.   1. The login/registration area should be on its own page within the template using a custom page template (im going to use jquery tabs for login/reg); i dont want to use the regular wordpress signup/login page.   2. I must be able to add extra fields to the registration process (phone, address, etc)   3. I'm already using simple facebook/twitter connect so that's taken care of, but it should be compatible with that (although i dont see that as a problem as it seems to take care of everything separately)   4. it needs ability for captcha


Unhook jQuery from WooCommerce via `functions.php`?

So I am using the http://woothemes.com/woocommerce/ plugin for eCommerce and it's registering jQuery local and conflicting with my default jQuery call from Google CDN. It took a long time but I isolated the issue to the following lines of code within `woocommerce.php`:                   $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';         $lightbox_en = (get_option('woocommerce_enable_lightbox')=='yes') ? true : false;         $chosen_en = (get_option('woocommerce_enable_chosen')=='yes') ? true : false;         $jquery_ui_en = (get_option('woocommerce_enable_jquery_ui')=='yes') ? true : false;         $scripts_position = (get_option('woocommerce_scripts_position') == 'yes') ? true : false;              // Woocommerce.min.js is minified and contains woocommerce_plugins         wp_enqueue_script( 'woocommerce', $this->plugin_url() . '/assets/js/woocommerce'.$suffix.'.js', array('jquery'), '1.0', $scripts_position );         if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {             wp_enqueue_script( 'woocommerce_plugins', $this->plugin_url() . '/assets/js/woocommerce_plugins'.$suffix.'.js', array('jquery'), '1.0', $scripts_position );         }      Deleting them cancels out the duplicate jQuery call which is causing me all my headaches. I have the following in `functions.php` to dequeue jQuery from the header, but for some reason, it persistsand refuses to go away! :/ Any ideas how to kill the local jQuery call from within `functions.php`? Is there something wrong with my code? :               // dequeue jquery from header          function theme_slug_dequeue_header_jquery() {          wp_dequeue_script( 'jquery' );     }     add_action( 'wp_header', 'theme_slug_dequeue_header_jquery', 11 );


Wordpress Plugin Page is Loading in Admin Content Container Instead of Separate Page

I am creating a wordpress plugin that has it's own UI. It looks like a standard web application, so everything that is done within the plugin is handled in this UI instead of integrating it with the WP admin area. My issue seems to be that I can't get it to load as a separate page, I can only get it to load in a page created in the admin area with the UI embedded in the content block. When I add it to the menu like this:               // Add plugin UI submenu item     add_submenu_page(         'myPlugin', 'myPlugin WP', __('myPlugin UI', 'myPlugin'),         $capability, 'myPlugin-ui', 'myPlugin_router'     );      And have it accessing the page as such:                   function myPlugin_router() {                  // Get current screen details             $screen = get_current_screen();              if(strpos($screen->base, 'myPlugin-ui') !== false) {                 include(DS_ROOT_PATH.'/views/myPlugin-ui.php');              }     }      Is this because I am using "include" to add it, so it is loading it as a template? I am also planning on using this UI the same way wordpress admin does, and load separate pages inside of the content area of the UI, exactly the way WP is doing it to my UI. So it uses templates. Would I just use include like above to do so?


Add multiple custom fields to the general settings page

What I would like to do is to add a few custom fields to the general settings. This is the code that Im using. It works allright but I just cant figure how to add more fields. I would like to create 2 fields for now, one for the telephone number and the second one for adress.               function register_fields()     {         register_setting('general', 'my_first_field', 'esc_attr');         add_settings_field('my_first_field', ''.__('My Field' , 'my_first_field' ).'' , 'print_custom_field', 'general');     }          function print_custom_field()     {         $value = get_option( 'my_first_field', '' );         echo '<input type="text" id="my_first_field" name="my_first_field" value="' . $value . '" />';     }          add_filter('admin_init', 'register_fields');      The only way I managed to get it to work for multiple fields was to duplicate everything. So then it would look like this:               function register_fields()     {         register_setting('general', 'my_first_field', 'esc_attr');         add_settings_field('my_first_field', ''.__('My Field' , 'my_first_field' ).'' , 'print_first_field', 'general');              register_setting('general', 'my_second_field', 'esc_attr');         add_settings_field('my_second_field', ''.__('My Field' , 'my_second_field' ).'' , 'print_second_field', 'general');     }          function print_first_field()     {         $value = get_option( 'my_first_field', '' );         echo '<input type="text" id="my_first_field" name="my_first_field" value="' . $value . '" />';     }          function print_second_field()     {         $value = get_option( 'my_second_field', '' );         echo '<input type="text" id="my_second_field" name="my_second_field" value="' . $value . '" />';     }          add_filter('admin_init', 'register_fields');      But this is probably not the best way to do it, I tried creating a settings_section but It just didnt work or didnt save etc. Its just very confusing. Please help me with this, thanks in advance.


Featured Image Thumbnail Creation

What function or script creates the hard-cropped feature image when a post is saved? Regardless if I stipulate a size when saving the featured image in the media library (like the medium size), a new image is created upon saving the post.


Load page content with AJAX using Fancybox?

I can find a lot of tutorials about how to load pages dynamically in WordPress and even page contents, like this: how-to-load-just-the-content-of-a-wordpress-post-using-ajax and Best way to load page content in Fancybox popup? But they don't get me quite where I want to go. The main issue I am facing is I want to open the page within Fancybox through Ajax, but I also want that page to be accessible through it's regular URL, in the event I want to send a user directly to that page. I realize I could double every page (one using a stripped down template for Fancybox, the other for the actual site), but that feels like a maintenance nightmare down the road. So in short; I want to use AJAX to retrieve and load only the content of a post and display using Fancybox. Any help guys? :)


Sidebar widget not displaying after simple code update.

I registered a sidebar widget, then modified the registration which included changing the registered name of the widget. Now the widget does not show at all. Below are the steps I took.   1. I registered a sidebar widget in my functions.php file.              if (function_exists('register_sidebar') ){         register_sidebar( array('name' => 'Right Sidebar') );     }        2. In my template page, I then dropped in the appropriate calls for the widget, like so...              <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>         ...some html...     <?php endif; ?>        3. Then after doing some further reading in the codex **(i'm a noob)** , I decided to do a bit more clean-up and test out all the parameters of register_sidebar(), so...   4. In functions.php, I CHANGED the call from the above to this (which is taken directly from **the codex** ):              if (function_exists('register_sidebar') ){         register_sidebar(array(           'name' => 'RightSideBar',           'id' => 'right-sidebar',           'description' => 'Widgets in this area will be shown on the right-hand side.',           'before_title' => '<h1>',           'after_title' => '</h1>'         ));     }        5. I then went to _Admin > Appearance_ and, sure enough the new and improved sidebar widget was showing, but was empty. So I added a few widgets.   6. I then tested the page in the browser: **No Widgets.** Just the default mark-up I added.    7. I checked the code. Looks right to my _noob_ eyes.   8. So I decided to back out of the changes and reverted to the previous code (see step 1).   9. To my amazement, in the admin all the previous settings **were still there** (Sidebar, widgets and all)! Plus the widgets showed right up on the page.   10. Then I re-added the new code (see #4) and, same thing: All the widgets I added to the **new and improved** version also were saved (somewhere in the db, for some reason beyond my pay grade) and also showed (in the admin section, but **NOT** on the page).   11. This leads to the question: **Do I need to (somehow) deregister the sidebar widget?** ( since the DB is apparently storing these values _"somewhere"_ ).    12. A bit more digging pulled up this little function: **unregister_sidebar( $id )** ;   13. Do I really need to use this? My original goal was to completely rename and update the sidebar. So... I need a clue :D Thanks, sleeper


How can I show the subcategories content on the parent category page?

I have a WordPress website that has a category with two subcategories. Now, how is it possible to show the content (the subcategories items/content) on the parent category?


Scaling a WP eCommerce site

Related to this question. Any recommendation on tools, plugins for optimizing a large eCommerce site on WP. Currently hitting 1000 items and 5000 more items coming. It seems the optimizations would be different than a standard blog serving thousands of users. The number of stores being developed on WP is increasing and putting a package of optimizations together would appear helpful. MM/RC


Error upgrading from 2.9.2 to 3.0.1

I have my wordpress install under svn. I was on version 2.9.2. These were the steps I took:   * saved a copy of my current wordpress directory   * cd into my top level wordpress directory   * `svn up` (just to make sure that I have the latest of 2.9)   * `svn sw http://core.svn.wordpress.org/tags/3.0.1/ .` (upgrade)   * run wp-admin/upgrade.php   * got this error "Fatal error: Call to undefined function is_multisite() in _(my install directory)_ /wordpress/wp-includes/wp-db.php on line 505" I looked around and some people think it's a memory issue with PHP. So I tried the Memory Bump plugin and that didn't work. Any ideas? **Update:** Found this post. Downloaded the latest 3.0 tar and overwrote my wp-settings.php with the one in the download. Get different errors now. "Fatal error: Cannot redeclare wp_load_image() (previously declared in / _myinstalldir_ /wordpress/wp-includes/media.php:241) in / _myinstalldir_ /wordpress/wp-admin/includes/image.php on line 168" When I perform and `svn status` I see lots of 'S' flags (switched). Do I have to be concerned with that? wp-settings.php has that flag. **Update:** Here's the output of the above `svn sw` from the root Wordpress directory. **Update:** Output of `svn st` here. (Migrated the long listings to pastebin) **Update:** Output of `svn info`               Path: .     URL: http://core.svn.wordpress.org/tags/3.0.1     Repository Root: http://core.svn.wordpress.org     Repository UUID: 1a063a9b-81f0-0310-95a4-ce76da25c4cd     Revision: 15559     Node Kind: directory     Schedule: normal     Last Changed Author: ryan     Last Changed Rev: 13165     Last Changed Date: 2010-02-15 09:38:59 -0800 (Mon, 15 Feb 2010)


Using Custom Fields to Trigger Specific Actions on Saving a Post?

Can custom fields be used to determine specific actions upon saving a post to the database? Which action(s) make this possible, since adding post medata seems to always occur after saving a post and thus any plugin hooking into `wp_insert_post` is activated before the post meta data has been added to the post.


Plugin settings not saving

I'm having a devil of a time getting my plugin settings to save. I've gone through the code so many times I have to think I've simply missed something. I'm following the Setting API, but any changes I make on the plugin settings page don't save. What did I miss?               function __construct() {     self::$instance = $this;          //  Add "Settings" link to plugin page     add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ) , array( $this, 'settings_link' ) );          // Creates the CEMB Seminar submenu     add_action( 'admin_menu', array( $this, 'add_menu' ) );          // Register and define the settings     add_action( 'admin_init', array( $this, 'settings_init' ) );          } // End of __construct()               /***** Menus *****/          //  Add "Settings" link to plugin page     function settings_link( $links ) {         $settings_link = sprintf( '%s', admin_url( 'options-general.php?page=cemb-seminar' ), __( 'Settings' ) );         array_unshift( $links, $settings_link );         return $links;     }          // Creates the CEMB Seminar submenu     function add_menu() {         add_submenu_page(              'edit.php?post_type=cemb_seminar',              __( 'Course Requirements' ),              __( 'Course Requirements' ),              'manage_options',              'cemb-seminar',              array( $this, 'settings_page' )         );     }          /***** Course Requirement Settings *****/          /* Creates new database fields */     function settings_init() {         $options = array(             'cemb_seminar_seminars_college' => '0',             'cemb_seminar_showcases_college' => '0',             'cemb_seminar_writers_college' > '0',             'cemb_seminar_aet_college' => '0',             'cemb_seminar_mbu_college' => '0',             'cemb_seminar_eis_college' => '0',             'cemb_seminar_sng_college' => '0',         );         update_option( 'cemb_seminar_options', $options );                   register_setting(              'cemb_seminar_options',              'cemb_seminar_options'          );         add_settings_section(              'cemb_seminar_reqs_college',              'Course Requirements',              array( $this, 'reqs_college_fn' ),              'cemb-seminar'         );         add_settings_field(              'cemb_seminar_seminars_college_field',              'Seminars',              array( $this, 'seminars_college_fn' ),              'cemb-seminar',              'cemb_seminar_reqs_college'          );         add_settings_field(              'cemb_seminar_showcases_college_field',              'Showcases',              array( $this, 'showcases_college_fn' ),              'cemb-seminar',              'cemb_seminar_reqs_college'          );         add_settings_field(              'cemb_seminar_writers_college_field',              'Writer\'s Nights',              array( $this, 'writers_college_fn' ),              'cemb-seminar',              'cemb_seminar_reqs_college'          );         add_settings_field(              'cemb_seminar_aet_college_field',              'AET Seminars',              array( $this, 'aet_college_fn' ),              'cemb-seminar',              'cemb_seminar_reqs_college'          );         add_settings_field(              'cemb_seminar_mbu_college_field',              'MBU Seminars',              array( $this, 'mbu_college_fn' ),              'cemb-seminar',              'cemb_seminar_reqs_college'          );         add_settings_field(              'cemb_seminar_eis_college_field',              'EIS Seminars',              array( $this, 'eis_college_fn' ),              'cemb-seminar',              'cemb_seminar_reqs_college'          );         add_settings_field(              'cemb_seminar_sng_college_field',              'SNG Seminars',              array( $this, 'sng_college_fn' ),              'cemb-seminar',              'cemb_seminar_reqs_college'          );          } // End of settings_init()          // Add note about the course requirements settings     function reqs_college_fn() {         echo '
The course requirement options below will apply to all students for all majors.
';     }          // Checks for the selected value in the drop menus     function course_req_selected( $selected, $option ) {              // Get options first         $options = get_option( 'cemb_seminar_options' );              // Check if the option matches the input         if ( $options['$option'] == $selected ) {             echo ' selected="selected"';         }        } // End of course_req_selected()          // Add college-wide Seminars requirements Field     function seminars_college_fn() {              // Get options from database         $options = get_option( 'cemb_seminar_options' );         $option = $options['cemb_seminar_seminars_college'];              // Build the select form ?>         <select id="cemb_seminar_seminars_college" class="cemb_seminar_settings_field" name="cemb_seminar_options[cemb_seminar_seminars_college]">             <option value="0" <?php if ( $option == '0' ) { echo 'selected="selected"'; } ?>>0</option>             <option value="1" <?php if ( $option == '1' ) { echo 'selected="selected"'; } ?>>1</option>             <option value="2" <?php if ( $option == '2' ) { echo 'selected="selected"'; } ?>>2</option>             <option value="3" <?php if ( $option == '3' ) { echo 'selected="selected"'; } ?>>3</option>             <option value="4" <?php if ( $option == '4' ) { echo 'selected="selected"'; } ?>>4</option>             <option value="5" <?php if ( $option == '5' ) { echo 'selected="selected"'; } ?>>5</option>         </select> <?php          } // End of seminars_college_fn()          // Add college-wide Showcases requirements Field     function showcases_college_fn() {              // Get options from database         $options = get_option( 'cemb_seminar_options' );         $option = $options['cemb_seminar_showcases_college'];              // Build the select form ?>         <select id="cemb_seminar_showcases_college" class="cemb_seminar_settings_field" name="cemb_seminar_options[cemb_seminar_showcases_college]">             <option value="0" <?php if ( $option == '0' ) { echo 'selected="selected"'; } ?>>0</option>             <option value="1" <?php if ( $option == '1' ) { echo 'selected="selected"'; } ?>>1</option>             <option value="2" <?php if ( $option == '2' ) { echo 'selected="selected"'; } ?>>2</option>             <option value="3" <?php if ( $option == '3' ) { echo 'selected="selected"'; } ?>>3</option>             <option value="4" <?php if ( $option == '4' ) { echo 'selected="selected"'; } ?>>4</option>             <option value="5" <?php if ( $option == '5' ) { echo 'selected="selected"'; } ?>>5</option>         </select> <?php          } // End of showcases_college_fn()          // Add college-wide Writer's Night requirements field     function writers_college_fn() {              // Get options from database         $options = get_option( 'cemb_seminar_options' );         $option = $options['cemb_seminar_writers_college'];              // Build the select form */?>         <select id="cemb_seminar_writers_college" class="cemb_seminar_settings_field" name="cemb_seminar_options[cemb_seminar_writers_college]">             <option value="0" <?php if ( $option == '0' ) { echo 'selected="selected"'; } ?>>0</option>             <option value="1" <?php if ( $option == '1' ) { echo 'selected="selected"'; } ?>>1</option>             <option value="2" <?php if ( $option == '2' ) { echo 'selected="selected"'; } ?>>2</option>             <option value="3" <?php if ( $option == '3' ) { echo 'selected="selected"'; } ?>>3</option>             <option value="4" <?php if ( $option == '4' ) { echo 'selected="selected"'; } ?>>4</option>             <option value="5" <?php if ( $option == '5' ) { echo 'selected="selected"'; } ?>>5</option>         </select> <?php          } // End of writers_college_fn()          // Add college-wide AET Seminars requirements field     function aet_college_fn() {              // Get options from database         $options = get_option( 'cemb_seminar_options' );         $option = $options['cemb_seminar_aet_college'];              // Build the select form ?>         <select id="cemb_seminar_aet_college" class="cemb_seminar_settings_field" name="cemb_seminar_options[cemb_seminar_aet_college]">             <option value="0" <?php if ( $option == '0' ) { echo 'selected="selected"'; } ?>>0</option>             <option value="1" <?php if ( $option == '1' ) { echo 'selected="selected"'; } ?>>1</option>             <option value="2" <?php if ( $option == '2' ) { echo 'selected="selected"'; } ?>>2</option>             <option value="3" <?php if ( $option == '3' ) { echo 'selected="selected"'; } ?>>3</option>             <option value="4" <?php if ( $option == '4' ) { echo 'selected="selected"'; } ?>>4</option>             <option value="5" <?php if ( $option == '5' ) { echo 'selected="selected"'; } ?>>5</option>         </select> <?php          } // End of aet_college_fn()          // Add college-wide MBU Seminars requirements field     function mbu_college_fn() {              // Get options from database         $options = get_option( 'cemb_seminar_options' );         $option = $options['cemb_seminar_mbu_college'];              // Build the select form ?>         <select id="cemb_seminar_mbu_college" class="cemb_seminar_settings_field" name="cemb_seminar_options[cemb_seminar_mbu_college]">             <option value="0" <?php if ( $option == '0' ) { echo 'selected="selected"'; } ?>>0</option>             <option value="1" <?php if ( $option == '1' ) { echo 'selected="selected"'; } ?>>1</option>             <option value="2" <?php if ( $option == '2' ) { echo 'selected="selected"'; } ?>>2</option>             <option value="3" <?php if ( $option == '3' ) { echo 'selected="selected"'; } ?>>3</option>             <option value="4" <?php if ( $option == '4' ) { echo 'selected="selected"'; } ?>>4</option>             <option value="5" <?php if ( $option == '5' ) { echo 'selected="selected"'; } ?>>5</option>         </select> <?php          } // End of mbu_college_fn()          // Add college-wide EIS Seminars requirements field     function eis_college_fn() {              // Get options from database         $options = get_option( 'cemb_seminar_options' );         $option = $options['cemb_seminar_eis_college'];              // Build the select form ?>         <select id="cemb_seminar_eis_college" class="cemb_seminar_settings_field" name="cemb_seminar_options[cemb_seminar_eis_college]">             <option value="0" <?php if ( $option == '0' ) { echo 'selected="selected"'; } ?>>0</option>             <option value="1" <?php if ( $option == '1' ) { echo 'selected="selected"'; } ?>>1</option>             <option value="2" <?php if ( $option == '2' ) { echo 'selected="selected"'; } ?>>2</option>             <option value="3" <?php if ( $option == '3' ) { echo 'selected="selected"'; } ?>>3</option>             <option value="4" <?php if ( $option == '4' ) { echo 'selected="selected"'; } ?>>4</option>             <option value="5" <?php if ( $option == '5' ) { echo 'selected="selected"'; } ?>>5</option>         </select> <?php          } // End of eis_college_fn()          // Add college-wide SNG Seminars requirements field     function sng_college_fn() {              // Get options from database         $options = get_option( 'cemb_seminar_options' );         $option = $options['cemb_seminar_sng_college'];              // Build the select form ?>         <select id="cemb_seminar_sng_college" class="cemb_seminar_settings_field" name="cemb_seminar_options[cemb_seminar_sng_college]">             <option value="0" <?php if ( $option == '0' ) { echo 'selected="selected"'; } ?>>0</option>             <option value="1" <?php if ( $option == '1' ) { echo 'selected="selected"'; } ?>>1</option>             <option value="2" <?php if ( $option == '2' ) { echo 'selected="selected"'; } ?>>2</option>             <option value="3" <?php if ( $option == '3' ) { echo 'selected="selected"'; } ?>>3</option>             <option value="4" <?php if ( $option == '4' ) { echo 'selected="selected"'; } ?>>4</option>             <option value="5" <?php if ( $option == '5' ) { echo 'selected="selected"'; } ?>>5</option>         </select> <?php          } // End of sng_college_fn()          // Creates the course requirements page     function settings_page() {         ?>
         <div class="icon32" style="background-image:url(<?php echo WP_PLUGIN_URL . '/cemb-seminar/images/cemb-logo32x32.png'; ?>); background-repeat:no-repeat;">

Course Requirements
         <form method="post" action="options.php">         <?php settings_fields( 'cemb_seminar_options' ); ?>         <?php do_settings_sections( 'cemb-seminar' ); ?>
         <input class="button-primary" type="submit" name="Submit" value=" <?php _e( 'Save Settings' ); ?> " />         </form>
 <?php          } // End of settings_page()


Make a menu item unselectable

I'd like to make the main menu selection for some menu items not selectable. For example, I'm doing a resume and I have a "Work History" page with "Job 1", "Job 2", etc. as children. I'd like to be able to select the children but not the "Work History". Is there a clean (or for that matter dirty) way to do this?


Why won't this jQuery work in WordPress?

THIS WORKS:               <script type="text/javascript">         function fadeReview() {           jQuery(".reviewPanel     .reviewPanel2:hidden:first").fadeIn(500).delay(3000).fadeOut(500, function() {         jQuery(this).appendTo(jQuery(this).parent());         fadeReview();         });         }         fadeReview();      </script>      BUT, THIS DOES NOT WORK:               <script type="text/javascript">     function fadeReview() {       jQuery(".reviewPanel .reviewPanel2:hidden:first").fadeIn(500).delay(3000).fadeOut(500, function() {     jQuery(this).appendTo(jQuery(this).parent());     fadeReview();     });     }     fadeReview();          function fadeReviewName() {       jQuery(".reviewName .reviewName2:hidden:first").fadeIn(500).delay(3000).fadeOut(500, function() {         jQuery(this).appendTo(jQuery(this).parent());         fadeReviewName();       });     }     fadeReviewName();     </script>      Does it have to do with running two functions? It works ok in this fiddle.


How to list ALL Pages in the dashboard?

I'm wanting to find a way to have all pages listed without paging and to do so in a method that isn't going to be over-written when I update WordPress, i.e. in the form of a hook. The page is in the administration:   ![all pages](http://i.stack.imgur.com/KkPaM.png) With all the pages being listed I can then use javascript to do collapsing to show/hide subpages, I'm not phased about load times of the page or anything, just cant have this method usable if paging is also used, all pages need to be listed on 1 page. As I'm wanting to do this in the admin area, I'm not even sure if this is do- able without breaking when updating.


How to noindex nofollow custom post type?

I've created a custom post type that displays the individual entries collectively on a page. However, I've found that Google is not only indexing the page, but the individual posts as well. I only want the page to be indexed and followed, and not the posts. Is there any way to accomplish this?


Remove favorites action menu and screen options panel

I was playing with: `$wp_meta_boxes`, `$menu` and `$submenu` global arrays to remove "things" on admin dashboard (using unset on PHP `foreach` iterations). Now I'm stuck trying to remove without using jQuery or JavaScript:   1. Favorites action menu.   2. Screen options panel. Thanks in advance.


Checking if a woocommerce attribute is set

I'm trying to figure out how I can check if a custom attribute is set in woocommerce on a product. As It generates an error if that particular attribute isn't set. Here is my code that pulls in the attribute.               <?php              $terms = get_the_terms( $post->ID, 'pa_size');             if ( isset ($terms)) // checking if the att is set             foreach ( $terms as $term ) {             echo "<li>" .$term->name. "</li>";              }                         ?>


Download an entire blog for offline reading / archival (without using RSS feed)

I want to download an entire wordpress blog to read offline. Is there any easy way to do this specifically for wordpress blogs? I don't want to use RSS feeds, since the blog I wish to download does not give the entire post in its RSS feed. If there's no easy way to do this specifically for wordpress blogs, any suggestions for a good generic website downloading tool?


Creating a gallery of featured images from custom post type

I am new to Wordpress and am busy using it to create an online portfolio site. I have created a custom post type for my portfolio items called 'Portfolio', and I have attached a featured image to each custom post. For my home page I would like a gallery of the featured images from these custom post types, and if you click on a thumbnail you are taken to that custom post. I have tried making a template page following instructions from the internet but nothing has worked for me so far and I'm not sure where to start! Coding and Wordpress is all new to me. If you have any suggestions on how I can do this, please let me know. Thank you :)


Making current_page_item work with wp_list_pages in sidebar on post pages

I'm working on a website where we have a menu in the sidebar that pulls the list of the parent for the current page, and all the children of that page. The problem is that, on pages where there's a query for posts included, this menu doesn't work. I got around it by creating a custom menu for any pages like this, but then the `current_page_item` class does not appear. How can I fix this code to work on these odd pages? Do I need to adjust the post queries within the theme pages, or the sidebar query for the pages? This is the normal menu query:               if($post->post_parent) {       $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&depth=1");       $titlenamer = get_the_title($post->post_parent);       }            else {       $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&depth=1");       $titlenamer = get_the_title($post->ID);       }       if ($children) { ?>            <h6> <?php echo $titlenamer; ?> </h6>       <ul>       <?php echo $children; ?>       </ul>      And this is the adjusted code that I tried using that does not display the `current_page_item` class in:                 if($post->post_parent) {       $children = wp_list_pages("title_li=&child_of=11&echo=0&depth=1");       $titlenamer = get_the_title($post->post_parent);       }            else {       $children = wp_list_pages("title_li=&child_of=11&echo=0&depth=1");       $titlenamer = get_the_title(11);       }       if ($children) { ?>            <h6> <?php echo $titlenamer; ?> </h6>       <ul>       <?php echo $children; ?>       </ul>      Thanks for any and all help.


Total number of posts in query (category/tag/author/search results/main page...)

I want to know the total number of posts from the category/tag/author/search result that I am actually seeing. Say for example I am in the main page. If my posts_per_page are 10 and my pagination shows 6 pages, that would mean there are a number of posts in my query between 51 and 60. How could I get that exact number? I would like it to work for every category,search results... from my web. Thanks in advance!


Display number of comment replies

I want to show the 3 most recent comments and have a small div underneath that shows how many replies each comment has (count how many comments where comment_parent => comment_ID). I do this by looping through each parent comment (comment_parent => 0) and then for each parent comment, use get_comments(comment_parent => $comment_ID). Unfortunately the comment_parent is ignored on the inner-loop of each comment and I get returned an array of comments where comment_parent => 0. Why is comment_parent getting ignored?                    <?php $args = array(                         'number' => 3,                         'status' => 'approve',                         'comment_parent' => 0                         );     $recent_comments = get_comments($args);     foreach($recent_comments as $recent_comment){         echo '
';         echo $recent_comment->comment_content;         echo '
';         $parent_comment_id = $recent_comment->comment_ID;         $comment_meta_args = array(                                    'status' => 'approve',                                    'comment_parent' => intval($parent_comment_id),                                    'number' => 3                                    );         $replies = get_comments($comment_meta_args);         echo '
';         echo $parent_comment_id . '
';         echo '
';         print_r($replies);         echo '
';              //echo $replies . 'Replies';         echo '
';     }          ?>


Mixing regular and custom post types (with meta_query) on home page

Not sure how to achieve this. I'm trying to mix standard posts and custom posts on a site homepage but I only want to display the custom posts if a meta value is set. Displaying the posts works fine `'post_type' => array('game', 'post')` but when I add in the meta_query the regular posts are no longer displaying (which makes sense as they don't meet the meta_query condition). So how do I limit the meta_query to only the custom post type so that the regular post will still be included?


Single-level menu option? Another way?

I'm developing a child theme of Twenty-Thirteen for a client. My theme contains a second navigation menu properly registered through my `functions.php` file. This second navigation menu is fully working properly and just as expected. However, as part of my design, I only want this second navigation menu to be a "single-level" menu; i.e., no children or sub-menu items. I am able to remove any appearance of children menu items with CSS using a `display:none` targeting the appropriate `.sub-menu` item under this custom menu. However, even though I have removed the _visual_ possibility of sub-menu items breaking the layout, I'd like to stop the Admin from creating them in the first place. I don't want the client to add sub-menu items only to find they're not showing up. For nothing else, I'd like to produce a more robust theme, front to back. I've searched Google, SO, SE, and the Wordpress site, but I cannot find out how I can block the creation of sub-menu items from the Dashboard. The research issue is stymied because no matter which search terms I use, I keep finding posts about people having the opposite problems... how to create a submenu. I already have my own Dashboard page for custom theme options. Is there a way to customize the menu editing screen just for this one menu? A hook? Another idea for forcing a single-level menu?


How to fix database error duplicate entry

At first I thought this was just a damaged table, so I tried repairing via MySQL, but it appears there's more fundamental issues. Which of the duplicates should I remove, and any further advice in dealing with this issue?               [Fri Jun 07 01:51:17 2013] [error] [client 86.42.10.69] WordPress database error Duplicate entry 'cron' for key 'option_name' for query INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('cron', 'a:2:{i:1370569877;a:1:{s:16:\\"wp_version_check\\";a:1:{s:32:\\"40cd750bba9870f18aada2478b24840a\\";a:3:{s:8:\\"schedule\\";s:10:\\"twicedaily\\";s:4:\\"args\\";a:0:{}s:8:\\"interval\\";i:43200;}}}s:7:\\"version\\";i:2;}', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`) made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, wp_schedule_update_checks, wp_schedule_event, _set_cron_array, update_option, add_option, referer: http://www.example.com          [Fri Jun 07 01:51:17 2013] [error] [client 86.42.10.69] WordPress database error Table 'wp_options' is marked as crashed and should be repaired for query UPDATE `wp_options` SET `option_value` = 'a:2:{i:1370569877;a:2:{s:16:\\"wp_version_check\\";a:1:{s:32:\\"40cd750bba9870f18aada2478b24840a\\";a:3:{s:8:\\"schedule\\";s:10:\\"twicedaily\\";s:4:\\"args\\";a:0:{}s:8:\\"interval\\";i:43200;}}s:17:\\"wp_update_plugins\\";a:1:{s:32:\\"40cd750bba9870f18aada2478b24840a\\";a:3:{s:8:\\"schedule\\";s:10:\\"twicedaily\\";s:4:\\"args\\";a:0:{}s:8:\\"interval\\";i:43200;}}}s:7:\\"version\\";i:2;}' WHERE `option_name` = 'cron' made by require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, wp_schedule_update_checks, wp_schedule_event, _set_cron_array, update_option, referer: http://www.example.com


Advanced Custom Fields/User Role Editor - how to hide ACF for certain users?

I am using User Role Editor to specify customized user roles. I am also using Advanced Custom Fields plugin. I would like to be able to hide Advanced Custom Fields from showing up for certain users; however, the only way to do this in User Role Editor is to uncheck "Manage Options" box. The problem with doing this is it removes other plugins from showing up which I in fact would like to show up for those users. Is there a bit of manual code I can place in my functions.php that will remove only Advanced Custom Fields for certain user roles? Just this plugin.


wp_list_pages not showing cpt as I expected

I have a CPT called 'vacancies' here is the code that registers it:               function register_cpt_vacancy() {         $args = array('labels' => $labels, 'hierarchical' => false, 'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'revisions'), 'taxonomies' => array('departments'), 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 5, 'show_in_nav_menus' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'has_archive' => true, 'query_var' => true, 'can_export' => true, 'rewrite' => true, 'capability_type' => 'post');         register_post_type('vacancy', $args);     }      In a template footer I'm trying to do this:               wp_list_pages('post_type=vacancy');      Which - from reading the docs I thought would work. Is there another way to do this besides creating my own query and menu styles? This list of vacancies is appearing as a menu between two other wp menus called with `wp_nav_menu` so I would like it to be in a list structure like they are. Any help or suggestions for different approaches welcomed :)


Conditional two level dropdown filter for custom post type

I have set up a custom post type and taxonomy. The post type is called Local Services and the hierarchical taxonomy is called Regions. The Regions have child categories called Areas. I have set up a custom page to display my results. So far I have managed to display the latest 10 posts. But what I NEED to do is display one result on this page. To do this I need to have a drop down menu of regions and then according to which region is picked, this would then display a second drop down menu of the child areas. The user would then select one area. I would like to display the result on my custom template page so when a visitor goes to the page initially, there would be a brief intro description with the drop down menu of Regions. This sounds relatively simple and I looked at similar questions here but can't find a solution. Can anyone help please? * * * This is what I have so far in my custom page template which displays a single result (the most recent). But I would like my page to display a drop down list of regions and another with their associated areas so a user will then get a single result displaying their chosen area. The page should not display any custom post information until a user has made these 2 choices.               $args = array(          'post_type' => 'local_services',          'posts_per_page' => 1      );      $loop = new WP_Query( $args );      while ( $loop->have_posts() ) : $loop->the_post();          the_title();          echo '
';              the_content();          echo '
';      endwhile;      **UPDATE: 12 DECEMBER** My custom post and taxonomy code:               <?php      function create_post_type() {           register_post_type( 'local_services',               array(                   'labels' => array(                       'name' => __( 'Local Services' ),                       'singular_name' => __( 'Local Service' ),                      'edit_item' => __( 'Edit Local Service' ),                 'update_item' => __( 'Update Local Service' ),                  ),               'public' => true,               'menu_position' => 5,               'rewrite' => array('slug' => 'local-services')               )           );       }            add_action( 'init', 'create_post_type' );       function region_taxonomy() {          register_taxonomy(           'region',           'local_services',           array(               'hierarchical' => true,              'label' => 'Region',               'query_var' => true,               'rewrite' => array('slug' => 'region')           )     );       }        add_action( 'init', 'region_taxonomy' );       ?>      **UPDATE: 18 DECEMBER** I looked at the wp_dropdown_categories and found some code to customise it. I decided to go for a simpler option of just one dropdown instead of two. I created a new custom post type "services" and a new taxonomy "area". I put the new code in my sidebar:                  <?php         $categories = get_categories('taxonomy=area');         $select = "<select name='cat' id='cat' class='postform'>n";       $select.= "<option value='-1'>Select your local area</option>n";         foreach($categories as $category){         if($category->count > 0){             $select.= "<option value='".$category->slug."'>".$category->name."</option>";         }       }        $select.= "</select>";         echo $select;        ?>                I also created a custom template "single-services.php" to display the result content. As I only want a single result per query this works great.


Wordpress admin not changing language

I'm struggling to get a nb_NO version of the wordpress admin interface. Here's what I've done so far:   * Installed latest wordpress from wordpress.org   * Moved installation from root to wp/ - site working fine   * Edited wp-config.php to define('WPLANG', 'nb_NO');   * Went to wp-admin and clicked "Re-install now" on the 3.5.1–nb_NO update. The update runs with no errors, but the admin is still in english. I've tried with different languages as well with the same result. What am I doing wrong? Moving the wp core to wp/ should not brake the language installer..?


Override Current Theme Setting in wp_config.php

I am looking for a way to override the currently selected theme, preferably from within the wp_config.php file. I know you can override some wp_options settings in the config like               define('WP_HOME', 'http://someotherdomain.com');      This will override the 'home' option in the wp_options table. There is an option called 'current_theme' that stores the name of the currently selected theme. I'm wondering if there's a way to override this from the wp_config file and if so, will this actually change the theme. I've tried               define('WP_CURRENT_THEME', 'someothertheme');      but it doesn't work. I need to do this in our development environment because the database is shared among two developers. I need to be able to work on one theme, while the other developer works on another theme.


All files unattached in Media Library

After moving to new host all files unattached in Media Library, need a way to re-attach them. Thanks


Performance with autoload and the options table

I am playing around with the `autoload` column of the `options` table. I didn't find much information about how the autoloaded values are used. I tried a `print_r($GLOBALS)` and saw that the autoloaded options are stored in `$GLOBALS['wp_object_cache']->cache['options']['alloptions']`. Is there another way to access those variables? Suppose I need to access an option `my_option`, which was set to autoload, multiple times in different templates (eg. once in `header.php`, once in `footer.php`), which method is recommended?   1. Is it okay that I retrieve it from the `$GLOBALS` array(since the value is already here)   2. Must I use `get_option('my_option')` once and globalize the variable **again**   3. Use `get_option('my_option')` each time (which I don't see the point of doing)   4. Something else


post_prev & post_next within same category

In my single blog view, I only want to show the Prior and Next buttons within the same category the current post is in. I thought I could just change these two lines thus (set first term to true). but that doesn't seem to ever display the buttons. Any suggestions ?               $post_prev = get_adjacent_post(false,'',true)  ? get_permalink(get_adjacent_post(false,'',true))  : false;     $post_next = get_adjacent_post(false,'',false) ? get_permalink(get_adjacent_post(false,'',false)) : false;      Thank in advance!


Include custom table into search results

How can I include custom tables into search results. My all custom tables has qa_ prefix and wordpress has default wp_ prefix