title: Need help decrypting error and warning messages

text: I'm a relatively new Wordpress user, usually I just code my sites by hand though I'm trying to move to a CMS. I installed Wordpress onto a subforlder (http://www.iss.guild.uwa.edu.au/wordpress/) to test. Every now and again I would get warning messages like below, though starting today I started getting fatal errors. According to my server admin he has PHP 5.2.6 and MySQL 4.1.2 installed. Also it doesn't seem to help on whether I'm using Wordpress 3.1 or Wordpress 2.7 (which had been installed by someone else some time back and seemed to work) ![Fatal error screenshot](http://i.stack.imgur.com/AnsPr.png) ![Warning screenshot](http://i.stack.imgur.com/BERAt.png)


title: ShortCut on meta boxes

text: There any way to run a shortcut that is in a meta box? I'm trying to execute the shortcut but does nothing, is that if the code comes from the wordpress editor does not have any problem


title: adding navigation to genesis themes

text: i'm following a tutorial provided here to add navigation menu, but not able to find out set of #nav in my style.css & my theme is eleven40. What we need to replace to get navigation menu?


I have been going crazy trying to google up what these globals are. What are allowedposttags and allowedtags? What is the difference between the two? Is there a list of all WP Globals and an explanation of what they are? For MCE Editor - to allow users not logged in to use lists and underline + strikethrough add following:               add_action('init', 'my_html_tags_code', 10);     function my_html_tags_code() {       global $allowedposttags, $allowedtags;         //$allowedposttags["ol"] = array();         //$allowedposttags["ul"] = array();         $allowedtags["ol"] = array();         $allowedtags["ul"] = array();         $allowedtags["li"] = array();         $allowedtags["span"] = array( "style" => array() );     }


title: Plugin: Wordpress Popular Posts > Possible to include custom post types?

text: I tried asking the plugin author and while waiting for a response I figured I'd give this place a try too. This is what wordpress-popular-posts.php looks like: pastebin Is there something I can change in there to include custom post types? Maybe somewhere around line 132 since I'm calling the `wpp_get_mostpopular` function? I suppose I'd need to add custom post types to the list of arguments but I'm not sure where that would be.


title: Limit Custom Crawler to front end only

text: I am using the following custom walker to hide the Login and Register pages from my navmenu created with wp_get_nav_menu_items.....               function wpse31748_exclude_menu_items( $items, $menu, $args ) {          // Iterate over the items to search and destroy     if ( is_user_logged_in() ) {     $registerpage = get_page_by_title( 'Register' );     $loginpage = get_page_by_title( 'Login' );         foreach ( $items as $key => $item ) {         if ( $item->object_id == $registerpage->ID ){         unset( $items[$key] );         }         elseif ( $item->object_id == $loginpage->ID ){         unset( $items[$key] );         }         else{}     }     return $items;     } else {     return $items;     }     }     add_filter( 'wp_get_nav_menu_items', 'wpse31748_exclude_menu_items', null, 3 );      It works fine but it is also affecting the menus page within the dashboard, is there a way to limit the crawler to only affect the front end?


title: get author of published post

text: I am using the publish_post action to run some checks on a user after their post is published:               $author_ID = ????          add_action('publish_post', 'rhb_check_current_user', 10, $author_ID);      How can I get the original author's ID?


title: How to get the post_name when in preview?

text: I'm using the below code in my `functions.php` file to include some JS only in posts I want. The code works fine for published posts and I can target a specific post, but how do I do it for posts that are not yet published, like viewing a draft post?               global $post;          if( is_page() || is_single() )     {        switch($post->post_name)         {             case 'post-name-here':             wp_register_script( 'charts', "http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js", array('jquery'));             wp_enqueue_script('charts');


title: Is there an API to create link categories programmatically?

text: I am using `wp_insert_link` to import a lot of links, but I have to assign the link category manually afterwards. Is there a corresponding Wordpress function to create link categories?


title: Widget select option not saving

text: I do this widget but the selected options dont saving when updated. This is the code:               /* CUSTOM POSTS LIST */     class Posts_list extends WP_Widget {              function Posts_list() {             /* Widget settings. */             $widget_ops = array( 'classname' => 'posts_list', 'description' => __('Display differents posts list.', 'fabulous') );             /* Widget control settings. */             $control_ops = array( 'width' => 200, 'height' => 350, 'id_base' => 'posts_list' );             /* Create the widget. */             $this->WP_Widget( 'posts_list', __('Fabulous posts list', 'fabulous'), $widget_ops, $control_ops );         }              function widget( $args, $instance ) {             extract( $args );             /* User-selected settings. */             $title = apply_filters('widget_title', $instance['title'] );             $id = $instance['id'];             $type = $instance['type'];             $num = $instance['num'];             $img = $instance['img'];             $meta = $instance['meta'];                  /* Before widget (defined by themes). */             echo $before_widget;                  /* Title of widget (before and after defined by themes). */             if ( $title )                 echo $before_title . $title . $after_title; ?>                  <div id="<?php echo $id ?>">             <?php if ( $type == 'Recent posts' ) {                 echo fab_recent_posts($num, $img, $meta);             } elseif ($type == 'Popular posts') {                 echo fab_popular_posts($num, $img, $meta);             } elseif ($type == 'Top rating posts') {                 echo fab_top_rating($num, $img, $meta);             } ?>             </div>             <?php                   /* After widget (defined by themes). */             echo $after_widget;         }              function update( $new_instance, $old_instance ) {             $instance = $old_instance;             /* Strip tags (if needed) and update the widget settings. */             $instance['title'] = strip_tags( $new_instance['title'] );             $instance['id'] = $new_instance['id'];             $instance['type'] = $new_instance['type'];             $instance['num'] = $new_instance['num'];             $instance['img'] =  isset( $new_instance['img'] );             $instance['meta'] =  isset( $new_instance['meta'] );             return $instance;         }              function form( $instance ) {             /* Set up some default widget settings. */             $defaults = array( 'title' => '', 'id' =>'posts-list-widget', 'type' => 'recents-posts', 'num' => '5', 'img' => 1, 'meta' => 1);                 $instance = wp_parse_args( (array) $instance, $defaults );              $type = isset( $new_instance['type'] );             ?>     <p>     <label for="<?php echo $this->get_field_id( 'title' ); ?>">     <?php _e('Title:', 'fabulous') ?>     </label>     <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" />     </p>     <p>     <label for="<?php echo $this->get_field_id( 'id' ); ?>">     <?php _e('Name:', 'fabulous') ?>     </label>     <input id="<?php echo $this->get_field_id( 'id' ); ?>" name="<?php echo $this->get_field_name( 'id' ); ?>" value="<?php echo $instance['id']; ?>" style="width:100%;" />     </p>     <p>     <label for="<?php echo $this->get_field_id('type'); ?>">     <?php _e('Choose posts list type:', 'fabulous'); ?>     </label>     <select name="<?php echo $this->get_field_name('type'); ?>" id="<?php echo $this->get_field_id('type'); ?>" class="widefat">     <?php     $types = array ('Recent posts', 'Top rating posts', 'Popular posts');     foreach ($types as $option) {     echo '<option value="' . $option . '" id="' . $option . '"', $type == $option ? ' selected="selected"' : '', '>', $option, '</option>';     }?>     </select>     </p>     <p>     <label for="<?php echo $this->get_field_id( 'num' ); ?>">     <?php _e('Number of posts:', 'fabulous') ?>     </label>     <input id="<?php echo $this->get_field_id( 'num' ); ?>" name="<?php echo $this->get_field_name( 'num' ); ?>" value="<?php echo $instance['num']; ?>" style="width:100%;" />     </p>     <p>       <input class="checkbox" type="checkbox" <?php checked(isset( $instance['img']) ? $instance['img'] : 0  ); ?> id="<?php echo $this->get_field_id( 'showrecents' ); ?>" name="<?php echo $this->get_field_name( 'img' ); ?>" />       <label for="<?php echo $this->get_field_id( 'img' ); ?>">     <?php _e('Display image', 'fabulous') ?>     </label>     </p>     <p>       <input class="checkbox" type="checkbox" <?php checked(isset( $instance['meta']) ? $instance['meta'] : 0  ); ?> id="<?php echo $this->get_field_id( 'meta' ); ?>" name="<?php echo $this->get_field_name( 'meta' ); ?>" />       <label for="<?php echo $this->get_field_id( 'meta' ); ?>">     <?php _e('Display meta', 'fabulous') ?>     </label>     </p>     <?php         }          }      Nobody can help me please? Thanks!


title: Post excerpt in custom meta box... help with proper php format

text:
I have a custom meta box attached to a post type that displays ways for customers to submit new ideas. Customers are supposed to summarize their idea in 30 characters or less, which seems like a good use for post_excerpt. I'm not great with php (still learning) so any help with getting the echo statement right would be appreciated. Below is my custom meta box as it stands. For simplicity I have stripped away everything else. The post excerpt will display in the meta box but any edits will not save there. What am I doing wrong?               function idea_information() {         global $post;              // Noncename needed to verify where the data originated         echo '<input type="hidden" name="ideameta_noncename" id="ideameta_noncename" value="' .         wp_create_nonce( plugin_basename(__FILE__) ) . '" />';              // Get the location data if its already been entered         $quicknote = get_post_meta($post->ID, '_ideas_quicknote', true);                   // Echo out the fields         echo '
Basics
               <input type="text" name="excerpt" id="excerpt" value="' . $post->post_excerpt  . '"/>';          }          // Save the Metabox Data          function whiteout_save_idea_meta($post_id, $post) {              // 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['ideameta_noncename'], plugin_basename(__FILE__) )) {         return $post->ID;         }              // Is the user allowed to edit the post or page?         if ( !current_user_can( 'edit_post', $post->ID ))             return $post->ID;              // OK, we're authenticated: we need to find and save the data         // We'll put it into an array to make it easier to loop though.         $station_meta['_ideas_quicknote'] = $_POST['_ideas_quicknote'];              // Add values of $station_meta as custom fields              foreach ($station_meta as $key => $value) { // Cycle through the $station_meta array!             if( $post->post_type == 'revision' ) return; // Don't store custom data twice             $value = implode(',', (array)$value); // If $value is an array, make it a CSV (unlikely)             if(get_post_meta($post->ID, $key, FALSE)) { // If the custom field already has a value                 update_post_meta($post->ID, $key, $value);             } else { // If the custom field doesn't have a value                 add_post_meta($post->ID, $key, $value);             }             if(!$value) delete_post_meta($post->ID, $key); // Delete if blank         }          }          add_action('save_post', 'whiteout_save_idea_meta', 1, 2); // save the custom fields      Related posts: Replace the Post Excerpt Meta Box with a Field in My Custom Meta Box


title: get_posts displaying wrong permalink for "continue reading" link

text:
I lifted the "continue reading" link functions from the Twenty Eleven theme and for the most part, it is working (works in RSS feeds). I created a shortcode to display the latest post on the front static page using `get_posts`, however, the "continue reading" link just links to the front page instead of the post page.               function gavsiu_continue_reading_link() {         return ' ' . __( 'Read more »' ) . '';     }          function gavsiu_auto_excerpt_more( $more ) {         return ' …' . gavsiu_continue_reading_link();     }     add_filter( 'excerpt_more', 'gavsiu_auto_excerpt_more' );          function gavsiu_custom_excerpt_more( $output ) {         if ( has_excerpt() && ! is_attachment() ) {             $output .= gavsiu_continue_reading_link();         }         return $output;     }     add_filter( 'get_the_excerpt', 'gavsiu_custom_excerpt_more' );      Shortcode:               function gavsiu_recent_posts( $atts ) {         extract( shortcode_atts( array(             'cat'            => 3,             'max_posts'      => 1         ), $atts ) );              $recent_posts = get_posts( array(             'category'       => "{$cat}",             'numberposts'    => "{$max_posts}"         ) );              foreach($recent_posts as $recent_post) : setup_postdata($recent_post);             $post = '
' . $recent_post->post_title . '
';             $post .= '
' . get_the_excerpt() . '
';                  return $post;         endforeach;     }          add_shortcode( 'recent_posts', 'gavsiu_recent_posts' );


title: get name of the current template file

text: I've found this to display the current name of the file used in template:               function get_template_name () {         foreach ( debug_backtrace() as $called_file ) {             foreach ( $called_file as $index ) {                 if ( !is_array($index[0]) AND strstr($index[0],'/themes/') AND !strstr($index[0],'footer.php') ) {                     $template_file = $index[0] ;                 }             }         }         $template_contents = file_get_contents($template_file) ;         preg_match_all("Template Name:(.*)\n)siU",$template_contents,$template_name);         $template_name = trim($template_name[1][0]);         if ( !$template_name ) { $template_name = '(default)' ; }         $template_file = array_pop(explode('/themes/', basename($template_file)));         return $template_file . ' > '. $template_name ;     }      source: http://wordpress.org/support/topic/get-name-of-page-template-on-a-page It works quite well, except that in backend, in the template select box, I get this ugly extra entry: http://cl.ly/361q221Q0n0f1g473R3l Anybody has idea how to fix it? I don't even know why this function is called in backend (is there a conditional function likie `is_frontend()` - maybe this would solve the problem).


title: How to migrate Wordpress Blogs into Multisite without using the GUI-Import/Export Feature

text: I'd like to migrate some quite huge Wordpress-Blogs into one Multisite Installation. The Export-Wizard and the Import Wizard are bound to PHP-Limits (Memory, Execution-Time) and so the Export and Import often fails. There must be a way to do it by hand (only using MySQL and or the command line).


title: Create new category upon save based on post information

text: After finding a couple of leads on how to do this, I'm coming up blank. What I am trying to accomplish is to add the post to a new category based on camera name. If the category doesn't exist, then to create it and add. Essentially what I have below grabs the attachment meta information and saves the camera information into $camera. From there, it kind of falls apart.               function add_post_camera_category() {     global $post;     global $wpdb;         // Load array with attachment information         if (is_null($imgID)) {             $images = get_children(array(                 'post_parent' => $post->ID,                 'post_type' => 'attachment',                 'numberposts' => 1,                 'post_mime_type' => 'image',                 'orderby' => 'ID',                 'order' => 'ASC'                 ));             if ($images) {                 foreach ($images as $image) {                     $imgID = $image->ID;                 }             }         }              $imgmeta = wp_get_attachment_metadata($imgID);     if ($imgmeta)     {         if ($imgmeta['image_meta']['camera'])             $camera = $imgmeta['image_meta']['camera'];                      // Add to custom category             if(!has_term('','category',$post_ID)){                 $category = get_term_by( 'slug', $camera, 'category' );                 $cat = array($category->slug);                 wp_set_object_terms($post_ID, $cat, 'category');             }          }          }     add_action('save_post', 'add_post_camera_category');


title: wp_remote_get doesn't work with secure connections https?

text: I'm querying the twitter api when I use non secure connection http:// it works fine no wp_error (but twitter exceed limit error) but when I use https:// it works in my browser I can see the json and the xml formats, but there's an error with wp_remote_get, I tried using a second argument array('sslverify' => false) and it doesn't work either ? so am I doing something wrong or wp_remote_get doesn't work with https ? here's the code:               $response = wp_remote_get('https://twitter.com/statuses/user_timeline/$username.json');     if ( is_wp_error($response) ) {     echo 'wp error';     }      when I use http like this url               wp_remote_get('http://api.twitter.com/1/statuses/user_timeline.json?screen_name=$username');      it works without the error. I tried wp_remote_get on other apis too but always when using https it doesn't work. thanks in advance. EDIT: I'm getting this from var_dump($response):               wp errorobject(WP_Error)#359 (2) { ["errors"]=> array(1) { ["http_request_failed"]=> array(1) { [0]=> string(146) "SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed" } } ["error_data"]=> array(0) { } }      and after using `array('sslverify' => false)` I'm getting from var_dump($response)               wp errorobject(WP_Error)#359 (2) { ["errors"]=> array(1) { ["http_request_failed"]=> array(1) { [0]=> string(23) "Empty reply from server" } } ["error_data"]=> array(0) { } }


title: Get a custom table to an array

text: How can I take my table I created like this:               global $wpdb; //Get all the wordpress database stuff     $table_prefix = $wpdb->base_prefix; //Get the global prefix for all sites (on a multisite installation)     $table_name = $table_prefix.'wpaa';//Add   wpaa   behind the prefix           $sql = "CREATE TABLE IF NOT EXISTS `".$table_name."` (....) "; //Create table and its rows. (Rows are ...'d out)          require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); //Require something you have to include     dbDelta( $sql ); //Make the actual query      and get all the data out from it in form of an array. * * * I know how I would do in regular PHP (without wordpress):               $sql = 'SELECT id,foo,bar FROM wp_wpaa';     $result = mysql_query($sql) or die('Error at looking up in database');     $array = mysql_fetch_array($result);


title: Enable commenting on front-end preview page for pending posts

text: We are in the process of allowing authors to collaboratively be a part of the editorial process. They will have access to all pending posts' preview pages ( _not_ post-edit pages). I want to allow these users to post a normal comment whenever the post is in _pending_ `post_status`. Upon research, a comprehensive solution has been posted here, although that solution only enables commenting through the post-edit page, not the preview page which I am looking for.


title: Fast Tranfering my Wordpress site to another server

text: I am transferring my WordPress site. I need to transfer all the content to my new server from old one. I don't have that enough bandwidth that i can first FTP to my local PC and than again FTP to the new server. So i request people right here to help me find out some sophisticated technique. All helpful suggestion will be really appreciated.


title: 404 - Category pagination for custom post type

text: **--Edit** I've managed to narrow it down that the paged variable is not working properly here, `(get_query_var('paged')) ? get_query_var('paged') : 1;` is always returning `0` although maybe it is due to the formatting of the link. So, I suppose this question should be `paged variable not working for category/custom post archive`. **--End Edit** I am having trouble getting the pagination to work on category archives for a custom post type. The number of pages/links is accurate, but clicking on the link 404s. (Only in the category archive, pagination is working elsewhere in the site) The URL is formatted like so: `http://domain.com/projects/category/category_name` The Permalink structure is: `/%category%/%postname` My loop is as follows (in the `archive-project.php` template for the custom post type `project`) $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                   $queryArgs = array(             'post_type' => 'project',             'posts_per_page' => 10,             'paged' => $paged         );              if (isset($project_cat)) {             $queryArgs = array_merge($queryArgs, array(                 'category_name' => $project_cat             ));         }         $projectQuery = new WP_Query($queryArgs);      The second page is generated as `http://domain.com/projects/category/category_name/page/2` which returns a **404**. The code for my pagination is as follows (Maybe it's not the best route, but it works on every other part of the site, after much headache as well)               global $projectQuery;          $total_pages = $projectQuery->max_num_pages;          if ($total_pages > 1){            $current_page = max(1, get_query_var('paged'));            echo paginate_links(array(           'base' => get_pagenum_link(1) . '%_%',           'show_all' => true,           'format' => '/page/%#%',           'prev_next' => false,           'current' => $current_page,           'total' => $total_pages,         ));     }      As mentioned, the page links appear to be accurate, but visiting the `Page 2` link gives a 404. Any ideas would be greatly appreciated, I have spent hours on pagination alone, it is a surprisingly complex issue with Wordpress. -- Additional quick notes: `http://domain.com/projects/page/2` <-- Works `http://domain.com/projects/category/category_name` <-- Works `http://domain.com/projects/category/category_name/page/2` <-- 404 Reading Settings: `Blog pages show at most 1 posts`


title: How can a plugin run a script after being updated in MultiSite?

text: Imagine a WordPress MultiSite Network with plugin Foo in it (but only active on some of the sites). When upgrading plugin Foo from version 1.0 to 2.0, Foo would like to do some work in the database. (For the sake of this exercise, let’s just assume it wants to stop storing data in 10 different wp_options rows, and store it all in a serialized array.) How can Foo run its foo_db_update script, for each site, when Foo is updated? A common answer is that Foo should hook into admin_init, and check the current version of Foo against the db-stored version, and see if it needs to run this script. The primary problem here is that it’s not something that can be easily done in a MultiSite environment. This approach might work if I could easily trigger the admin_init events of all sites in the network - _with each site’s current plugins loaded_ - but I don’t know a way to do that. I’ve tried hooking into wpmu_upgrade_site, and running Upgrade Network after updating Foo to version 2.0. However, that only uses switch_to_blog to act as each site, and doesn’t fully load the plugins for each site it’s switching to. This means that if Foo adds a function to wpmu_upgrade_site, that function won’t fire when Upgrade Network is clicked from the Network Admin. So, what IS the best way for a plugin to run such a script in a MultiSite environment?


title: Get post related to particular meta box?

text: I have created few metaboxes and i would like to show the post related to that particular metabox value. Just like we get the post related to tags or categories.


title: show div only if have a related post inside

text:
I want to have a related box to show up - but only if a related post is inside the div. If theres no post the whole "related_box" div should be not shown. Any idea? Here's the code so far.

Related

         <?php         global $post;         $terms = get_the_terms( $post->ID , 'movies', 'string');         $do_not_duplicate[] = $post->ID;              if(!empty($terms)){             foreach ($terms as $term) {                 query_posts( array(                 'movies' => $term->slug,                 'showposts' => 4,                 'caller_get_posts' => 1,                 'post__not_in' => $do_not_duplicate ) );                 if(have_posts()){                     while ( have_posts() ) : the_post(); $do_not_duplicate[] = $post->ID; ?>

<?php if ( has_post_thumbnail()) the_post_thumbnail('movie-thumb'); ?>

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

                     <?php endwhile; wp_reset_query();                 }             }         }         ?>

      thanks! AD


title: How to check if there is image title, caption, description?

text: I use this code to display featured image title, caption (excerpt), description (content): `echo get_post(get_post_thumbnail_id())->post_title; echo get_post(get_post_thumbnail_id())->post_excerpt; echo get_post(get_post_thumbnail_id())->post_content;` But, how to check if there is any of those fields first? For example, how to check if there is caption, and if emty to show some other text? Best regards.


title: List all sites in multisite

text:
Hi I'm not a coder and I was wondering if anyone could edit this code to list all sites in the multi site network in alphabetical order? cause right now the code lists by registered date               <?php     // Query for getting blogs                 $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A );                      // put it in array                   foreach ( (array) $blogs as $details ) {$blog_list[ $details['blog_id'] ] = $details;}                 unset( $blogs );                 $blogs = $blog_list;                      // if is valid array                 if (is_array( $blogs ) ){                         echo '
';                         $array= array();                         // reorder                         $array= array_slice( $blogs, 0, count( $blogs ) );                         for($i=0;$i<count($array);$i++){                         // get data for each id                         $blog = get_blog_details( $array[$i]['blog_id'] );                         // print it                         echo '
siteurl.'">'.$blog->blogname.'
';                         }                         echo '
';                 }                 ?>


title: How make a wordpress MU with subdomains on a pointer domain with direct admin?

text: I have a domein domain.com that domain is hosted with an another firm. therefore i make a pointer (domain.otherdomain.com) until the website is ready. The domain.com has sub domains sub1.domain.com sub2.domain.com. but i need now until the site is ready for moving go to the subdomains with the pointer domain like sub.domain.otherdomain.com I try to do this in direct admin but that doesn't work how i have to do this?


title: Insert data from custom created PHP page into wp_postmeta table

text: I am working with a Wordpress site and have created a custom page in `/home/planmyme/public_html/php/` with the name `response.php`. On this page I am getting a value to insert in the `wp_postmeta` table (value examples: transaction ID, purchase ID, order ID, or item name), but I am not able to insert it. I am using the code below as a test. I do not understand how to achieve this, or if there is any need of a database connection to run the query.               $metakey    = "_menu_item_type";     $metavalue  = "WordPress' database interface is like Sunday Morning: Easy.";          $wpdb->query( $wpdb->prepare(          "             INSERT INTO $wpdb->wp_postmeta             ( post_id, meta_key, meta_value )             VALUES ( %d, %s, %s )         ",          10,          $metakey,          $metavalue      ) );      Getting this error > Fatal error: Call to a member function query() on a non-object in > /home/planmyme/public_html/php/response.php on line 56 If anybody has an idea how to do this, please let me know.


title: Rewrite rule for Custom post type Monthly and Yearly archive

text: I have a custom post type "contest_recipe". I can view contest recipe posts by year and by date with the following urls: > >     http://example.com/2011/?post_type=contest_recipe - shows all 2011 > contest recipes >     http://example.com/2011/7/?post_type=contest_recipe - shows all July > 2011 contest recipes >   I would like to simplify the url to > >     http://example.com/2011/recipes >     http://example.com/2011/7/recipes >   Is this possible? I am not familiar with the rewrite rules concept. Can anyone recommend a tutorial on how to learn about this or provide an example?


title: Custom Select Query with Custom Post Types

text:
Have been trying to figure out the issue with this for the past hour, but hitting a wall. Basically I'm just trying to query my custom post type based on some custom date fields and then displaying each. Anyone have an idea where I'm going wrong?               <?php         // - query -                      global $wpdb;                      $yesterday = strtotime("-1 day");                      $querystr = "                         SELECT *                         FROM $wpdb->posts                         INNER JOIN {$wpdb->postmeta}postmeta m1                           ON ( {$wpdb->posts}posts.ID = m1.post_id )                         INNER JOIN {$wpdb->postmeta}postmeta m2                           ON ( {$wpdb->posts}posts.ID = m2.post_id )                         WHERE $wpdb->posts.post_type = 'tf_events'                         AND $wpdb->posts.post_status = 'publish'                         AND ( m1.meta_key = 'tf_events_startdate' AND m1.meta_value > $yesterday )                         AND ( m2.meta_key = 'tf_events_starttime')                         ORDER BY m1.meta_key ASC, m2.meta_key ASC LIMIT 30                      ";                           $events = $wpdb->get_results($querystr, OBJECT);                          if ($events):                     global $post;                     foreach ($events as $post):                     setup_postdata($post);                          // - variables -                     $custom = get_post_custom(get_the_ID());                     $sd = $custom["tf_events_startdate"][0];                     $ed = $custom["tf_events_enddate"][0];                     $st = $custom["tf_events_starttime"][0];                     $et = $custom["tf_events_endtime"][0];                     $post_image_id = get_post_thumbnail_id(get_the_ID());                             if ($post_image_id) {                                     $thumbnail = wp_get_attachment_image_src( $post_image_id, 'post-thumbnail', false);                                     if ($thumbnail) (string)$thumbnail = $thumbnail[0];                             }                          // - output -                     ?>
Show the goodies
                        <?php endforeach; ?>                        <?php else : ?>
Not Found

Sorry, but you are looking for something that isn't here.
                   <?php endif; ?>      Thank you in advance :)


title: How to add biography of user while importing?

text: We are importing user details from Lithium to Wordpress using java app which generates XML file. I need to know key for Biography so that we can include that in XML file. Can anyone help?


title: Plugin for users to create their own ads like Google Adsence

text: Does any one know of a plugin to allow users to create ads on a format like Google Adsense (title, some text and a link). ? Something that may require some customization may do the job. Thanks in advance.


title: How do you create two separate Register pages?

text: I am looking for a way to make two separate register pages. One will automatically assign users up as a **subscriber** , while the other will sign them up as a **contributor**. The only thing I have thought of so far is to duplicate the *register_new_user* function in the wp-login.php file and customize it a bit. Any ideas? Thanks in advance.


title: htaccess or redirect to cloak portion of a link?

text: I have an ad rotate plugin installed to display a few ads on my site but the plugin is coded so that it uses the full directory in the ad count link. I would like to know if there's something easy to put in my htacces to cloak the link. So for example: http://mysite.com/wp-content/plugins/ad-rotating-plugin/rotate.php?trackerid=1 needs to look like: http://mysite.com/rotate.php?trackerid=1 (actually any variation of this is fine, I just don't want that full wp-content/plugins/ directory shown in the link). I've tried a few plugins but not getting the desired results. To recap, I want the link to SHOW as the bottom link, but when clicked, be taken to the top link, and I need that trackerid=# to stay the generated id, so I only want to cloak part of the link. Is there something I can put in my htaccess to do this? Thanks!


title: SSO / authentication integration with external 'directory service'

text: I'm about to start working on a prototype for a client - and one of the required features is integration with an in-house user authentication / registration system. This system will act as the authoritative user database, and provides a RESTful interface for creating new users, and authenticating valid users.   1. I need to be able to create new users in WP and as part of that process make a call to the external authentication API to either create / validate that user.    2. A person who is a valid user but not known to WP should be able to login to comment, without needing to register on the WP site themselves.   3. A person logged into the overall website should also automatically be logged in to WordPress. > I'm thinking the following is the way to go. > >   * For (1) - is there a registration hook I can use? > >   * For (2) - I'm assuming i hook the authenticate filter - ie when someone > tries to login, I trap that, make a call to the external system, and then > either process the WP login or redirect them to the registration process > where (1) takes oer. > >   * For (3) - read the login cookie set by the main site and proceed with > (2) ? > > I guess I'll also need to insert a record into the users and usermeta table. So, does the above make sense - have I not thought about something. Anyone got any good resources for helping with this (@hakre - I saw you've done some work on this !!). ## Update So I'm still bashing my head against this a bit, essentially I'm trying to hook into the authenticate filter, and using that to:   1. check if a login cookie for the 'master' site is set, and if it is, revalidate against their authentication API, and if valid, force a WP login with `wp_signon()`,using the information contained in the master site cookie (email and hashed password) as credentials for WP   2. if the cookie isn't set, redirect to the master site login page and get either a login / signup then back to step 1   3. if there isn't a WP user when an authenticated master site user exists, create it and then so a 'transparent' signon (ie so the user doesn't see a WP login form) Basically, I want to hide the WP login form entirely for users who are just going to be mainly commenting, and later find a way to allow authors and admin to access it directly. It's going fairly slowly, here's what I could use some help with:   * is the authenticate filter the right one to use? It doesn't seem to get called in all situations I would expect - eg the meta widget displays log in / log out links without the authenticate hook firing   * i can get `wp_signon()` to return a `WP_User` object (indicating success), but it doesn't affect the logged in status - ie the meta widget would still be showin "Login" even after refreshing. Any help gratefully received :)


title: Wordpress crop image not working

text: I have the following CSS:               .crop {         height: 40px;         overflow: hidden;         margin-bottom: 20px;     }      to crop an image when the screen shrinks. It works in a normal HTML file, but in Wordpress, the result is a compressed image, not a cropped one. How can I fix this?


title: google xml sitemap won't work on directory install

text: I have installed wordpress in directory above the root called "wp". I'm having issues with the google xml sitemap generator. I cannot rebuild the xml code and write it the sitemap.xml file. I have been on the phone with my hosting company and they assure me the file does have full control for its file permissions. Does anyone have any advice for this?


title: Retrieving values of custom fields in Quick Edit mode

text:
I've been trying to add a field to Quick Edit. Somehow it works: it is displayed and if you enter a value in the input field, the value is saved into a custom field. However, can't seem to find a way to retrieve the value of the custom field. Here's what I got so far:               add_action('quick_edit_custom_box', 'ilc_quickedit_show', 10, 2);     function ilc_quickedit_show( $col, $type ) {         if( $type != 'event' ) return; ?>              <fieldset class="inline-edit-col-left">

                     Event Date                                              <input type="text" name="eventdate" id="eventdate" size="10" value="">

         </fieldset>              <?php     }      entered values are saved using:               add_action('save_post','ilc_quickedit_save',10,3);     function ilc_quickedit_save($post_id, $post) {         if( $post->post_type != 'event' ) return;         update_post_meta($post_id, 'Event Date', $_POST['eventdate']);     }      As you surely noticed, this is for a custom post type 'event'. However, I can't retrieve the values and populate the fields. AFAIK, this involves inline-edit-post.js but I can't find any way to use inlineEditPost to retrieve the custom field value. Even the post id is available in the JavaScript scope               add_action('admin_head-edit.php', 'ilc_quickedit_get');     function ilc_quickedit_get() { ?>                  <?php     }      Downloaded the Custom Field Template plugin to dissect the code and found that they are redefining portions of the inlineEditPost function, so I thought about doing the same thing. However, they appear to be doing it through an options array where a duplicate is stored. If you have solved this, could you share what you're using to retrieve the values for each custom field?


title: filter posts without images or featured image

text:
I'm using wordpress MU 3.3.1. I want to add a function within a loop that displays only posts with image, or featured image. please help me on how to filter posts.               <?php get_header(); ?>
     <?php          global $post;         $categories = get_categories('child_of=7694');           foreach ($categories as $category) {                  $cat_id = $category->cat_ID;                  $games = get_posts('numberposts=6&orderby=rand&category='.$cat_id);                  if ($games) : ?>

<a href="<?php echo get_category_link($cat_id); ?>"><?php echo $category->name; ?>
                     <?php foreach ($games as $post) : $do_not_duplicate = $post->ID; ?>
                          <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php echo get_post_meta($post->ID, 'mabp_description', $single = true); ?>" >                          <?php                           if ( (strlen($post->post_title) > 10) ) {                             echo substr($post->post_title, 0, 10)."..";                           }                           else {                            the_title();                           }                          ?>
                          <a href="<?php the_permalink() ?>" class="thumb_link" rel="bookmark" title="<?php echo get_post_meta($post->ID, 'mabp_description', $single = true); ?>"><?php      gab_media(array(             'name' => 'gab_featured',             'enable_video' => 'true',             'catch_image' => 'true',             'enable_thumb' => 'true',             'resize_type' => 'c',              'media_width' => '60',              'media_height' => '34',              'thumb_align' => 'featured_thumb',              'enable_default' => get_option('of_nw_enfea2'),             'default_name' => 'featured_thumb.jpg'                                       ));      ?>
                 <?php endforeach; ?>
<a href="<?php echo get_category_link($cat_id); ?>">More Games

                            <?php endif; }?>
 <?php // End content div ?>                        <?php get_sidebar(); ?>              <?php get_footer(); ?>


title: wordpress inserting posts programatically through a url

text: I have to insert posts programatically in Wordpress. I want that I should be able to publish posts via a url. Something like www.mypage.com/insertnewpost.php?title=blah&content=blahblahblah&category=1,2,3 The following code works only if I use it inside the functions.php file of the themes.               include '../../../wp-includes/post.php';     global $user_ID;     $new_post = array(     'post_title' => 'My New Post',     'post_content' => 'Lorem ipsum dolor sit amet...',     'post_status' => 'publish',     'post_date' => date('Y-m-d H:i:s'),     'post_author' => $user_ID,     'post_type' => 'post',     'post_category' => array(0)     );     $post_id = wp_insert_post($new_post);      However when I try to create a new page like insertnewposts.php and use the above code there I get errors like Fatal error: Call to undefined function add_action() in Z:\www\wordpress\wp-includes\post.php on line 144 Please help.


title: How to Get Recent 5 post in My Title bar?

text: I Installed Recent Posts Plugin in my Wordpress site.It Shows Correct Answer but it Shows "Recent Post" at Header position.I don't want that text. Unfortunately i can't remove that.please help me ...Is there any other php coding Available?


title: Problem creating an edit link for a custom post type

text: In my last question, I asked How to build a post and comment editing form in a page?. But in order to edit the custom post type (called Question) I have to reference the **edit page** and the **ID** of the custom post type. I created a file called **edit-question.php** (located in the theme's folder). And created a page called **Edit Question** in the Wordpress admin panel (and assigned the template file **edit-question.php** to it). And placed the following code to display the edit link right before the loops ends ( **loop-question.php** ):                   <?php endif; // This was the if statement that broke the loop into three parts based on categories. ?>              <?php if ($post->post_author = $current_user->ID) : ?>             <a href="<?php bloginfo('url'); ?>/edit-question.php?qpost_id=<?php $post->ID ?>">Edit!         <?php endif; ?>          <?php endwhile; // End the loop. Whew. ?>      When I click the **Edit!** link I get the following in my URL bar: `http://localhost/qaf/edit-question.php?qpost_id=`. Looking at the default edit link of Wordpress looks like this:               http://localhost/qaf/wp-admin/post.php?post=61&action=edit      I think I have to make something similar except the `action=edit` part (not very sure). What's the best way of doing this?


title: May i Use ShortCode in Template?

text: Am Using Wordpress Blog.Here i want Use Tweetmeme Plugin.I want to show the output of the Tweetmeme Plugin to Customizing place(Side of the Post[Not Before or After]).The Plugin Creators are providing Shortcode.Shall i Use this shortcode in Template?I Guess this is not possible.So we need to change Shortcode as a function.How to Create a function from Shortcode?please help me.


title: A good Wordpress theme development book recommendation

text: I am looking for a good recommendation for a wordpress theme development book. i have some experience building themes, but I want to learn more, and have trouble reading or understanding the codex sometimes. I don't know that much php, so a php recommendation would also be nice. Thanks in advance.


title: Removing an admin page added by a 3rd party plugin. Gravity forms in this example

text: I'm trying to hide a help page from editors, added by the gravity forms plugin. I believe I've run into the same issue before with other plugins, so I'd like to know the correct way to do it for 3rd party plugins. This is what I have so far which does not work. It does of course work for other WP menus so I'm wondering if the function is only limited to WP menus?               function remove_menu_links() {       if( !current_user_can('manage_options') ) {         remove_menu_page('admin.php?page=gf_help'); // this is the pages url       }     }     add_action( 'admin_menu', 'remove_menu_links');


title: Why is tinymce visual editor showing the background from my theme

text: In my theme I have the body background style set to a particular image (in style.css file). When editing the content under visual editor I have this same background I set in the theme. Is it possible to turn this off?


title: Why is PHP Cookie via plugin only set when logged in as Admin and not regular users? and other questions

text: At first I thought it was a browser issue, but it looks like my code only sets a cookie if the user is logged in the administrator. If you are not logged into the Administrator account then it does not set a cookie. Tested this across 3 different browsers using Windows 8. Just for reference, here is the link to the question when I thought it was a cross browser issue:   * http://stackoverflow.com/questions/19624858/setting-cookie-via-php-works-in-chrome-but-not-firefox-or-ie My code is inside an activated custom plugin I created, inside of a file called custom_functions.php (The only file in my plugin). This is my first plugin, but so far other functions I have placed in there appear to work correctly. Here is the code I am using:               add_action( 'init', 'visitor_cookie', 1);     function visitor_cookie() {         if (!isset($_COOKIE['returning_visit'])) {             $traffic_type = 'hd';             $timestring = microtime();             $pieces = explode(" ", substr($timestring, 2));             $pieces[0] = "1".substr($pieces[0],0,3);             $visitor_id = $traffic_type.dechex($pieces[1]) . dechex($pieces[0]);             $expire = time()+60*60*24*360;             $path = '/';             $domain = parse_url(get_option('siteurl'), PHP_URL_HOST);             setcookie(                 'returning_visit',                  $visitor_id,                  $expire,                  $path,                  $domain,             false           );         }     }      **Notes:**   1. I only want the cookie set for any visitor/user is not an administrator. So only set for random users and regular users. But not necessary if too difficult.   2. Expiration should be 1 year.   3. Cookie should work across my domain including subdomains. At the moment my domain is development.mydomain.com   4. In add_action , I am not sure if the "1" should be there. In the link for my other question, I was informed that "parse_url(get_option('siteurl'), PHP_URL_HOST);" is depreciated and I should use site_url(). However when I used " $domain = site_url() ", cookies did not set at all so I am not sure what exactly I should use to set the domain variable properly. Although the above code works only when logged in as the administrator, I am new to both plugins and setting cookies and not sure if my code is up to date or the most efficient/correct way to go about it. **Update:** So I just noticed there are other website functions only working as Admin.. such as grabbing GET parameters from the formidable pro plugin. I tried disabled almost all my plugins and still the same issue. Something is causing some things to work only when logged in as admin and not sure what.


title: making my theme multisite compatible?

text: I have a wordpress theme that works "OK" as a single user and I have attempted to get it to work as a multi-user unsuccessfully. There are features missing in multiuser side that are necessary to get it working the way I need it to work, like "theme options". Here is a snap-shot of theme options http://screencast.com/t/5sx0umfYQs6 I'm thinking it must be a database issue as well as other things... I have no idea where to begin.


title: Using custom post types in submenu + custom title

text: I'm planning to use a couple of custom post types for a plugin of mine. The whole plugin should reside under 1 toplevel menu item. Thus I would prefer a menu structure like so:   * Dashboard   * Posts   * [...]   * My Plugin     * Custom Post Type #1     * Custom Post Type #2     * [...] This is possible by including `'show_in_menu' => 'my_plugin_toplevel_menu_item_slug'` in `register_post_type` when registering my custom post types. Howerer, there are a few issues I've come across using this method.   * I have no say in how the title should be outputted. I would prefer to use `<h2 class="nav-tab-wrapper"> ... </h2>`, but now post.php prints the h2 output for me, and I don't know an easy way of overriding this. It is possible to do this with javascript as soon as the page is loaded, but this is a bit ugly in my opinion.   * When using `'show_in_menu'`, the submenu page order cannot be altered. The custom post types are placed at the top automatically, because I guess Wordpress just gets to it quicker than I do.   * The h2 icon disappears for some reason (I haven't really looked into this yet though, it might be very easy to solve). Does anybody have an idea how to tackle these issues elegantly? **Update** See temporary solution in my answer below.


title: Using WP_Query to get attachment returns empty set

text: I would like to get the first audio file in the media library filtered by a custom field, but it always returns an empty set of posts. I know that I have to pass `'post_status' => 'inherit'` and `'post_type' => 'attachment'`, but it doesn't change anything.               <?php         // Arguments         $args = array(             'post_type' => 'attachment',              'post_status' => 'inherit',              'post_mime_type' => 'audio',              'meta_key' => 'my_meta_key',              'meta_value' => 'my_meta_value',              'posts_per_page' => 1 );              // Create the query         $audio_files = new WP_Query( $args );              // Output         var_dump( $audio_files );    // the number of found posts is always 0          ?>      So I tried to minimise it by letting away all the meta-key-stuff and searched for any attachment (as mentioned here)               <?php         // Arguments         $args = array(             'post_type' => 'attachment',              'post_status' => 'inherit' );   // or "any", but without effect              // Create the query         $any_files = new WP_Query( $args );              // Output         var_dump( $any_files );    // same: the number of found posts is always 0     ?>      When I do `var_dump( $any_files );`, the request does not contain the selected post-status' (which is strange):                ["request"]=> string(237) "SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'attachment' AND ((wp_posts.post_status = 'publish' OR wp_posts.post_status = 'future')) ORDER BY wp_posts.post_date DESC LIMIT 0, 10"      So I tried it the old-fashioned way by a custom SQL-statement:               <?php         // Get row by custom SQL-statement         $wpdb->get_row( 'SELECT * FROM ' . $wpdb->prefix . 'posts p, ' . $wpdb->prefix .  'postmeta m WHERE p.post_mime_type LIKE "audio/%" AND p.ID = m.post_ID AND m.meta_key = "my_meta_key" AND m.meta_value = "my_meta_value" ORDER BY p.post_date DESC' );     ?>      And tataaaa! I get my first audio file. I know there are similar questions:   * Broken? WP_Query and “attachment” as a post type   * WP_Query not working as expected for attachments and custom meta_query But neither of them helped me, even though they were treating quite the same topic. What I am missing here? Why aren't the given status' not recognized? I would like to use `WP_Query`. **Solved it:** Months ago, I added some default post_status' to the query in the `pre_get_posts` action hook. Oh man! @Milo: Thanks for your hint!


title: Permalink issues with Ubuntu Server - Infinite loop & Wrong pages

text: I'm having a big problem with Permalinks on our Wordpress installation. It's currently running Ubuntu 10.4 and when i add a page to the site, there are odd things happening:   1. We get infinite loop and "too many redirect" warnings from different browsers   2. Other links on the site get redirected to the newly created page For example, after creating a page with the URL of "/promolanding/" when someone clicks on the link to the "/about-us/" page, it redirects them to "/promolanding/" This works fine on my CentOS development server and only happens on the Ubuntu server. Permalinks are set to:               /%year%/%monthnum%/%postname%/      and the .htaccess file looks like:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      Has anyone ever had this issue? If so, any help would be appreciated. Thanks!


title: WordPress image crop probems

text: i'm developing a portfolio theme on WordPress 3.2.1, so i created a new post_type called 'portfolio'. My aim is to show, on the front-end, a grid composed by the jobs i realized during last years. This gris will be filled by portfolio post_type thumbnail (featured image), when any user click on them, system shows (through fancybox) a popup with the large image in it. So, the HTML code I expect is:                               The idea is to: upload image from portfolio section (using the button add image), then save and close this section. Then, I move to media library, I open the image to crop it. Next step is to save all media, back to the portfolio section, open the post again and set the cropped image as the featured image. What happens is that "crop" does not work. I've to crop the image twice to have a result, but it does not affect the image all the times. Do you guys have any experience on that? Apart from the php code i use to show the thumbnail, i can't stand by wordpress and crop don't do what i need (please note that I want to crop the image, I do not need the programmatically crop that wordpress offers). thx


title: Category archive leads to me 404 page?

text: I’ve category named “Golf Swing Trainers”, with the slug “golf-swing- trainers”.When I click this category it leads to me to 404 page. But if, I change the slug into anything it works fine…. http://performbettergolf.com


title: WordPress in a sub directory but not images

text: I have followed this tutorial from WordPress and managed to get everything to work. I have installed wordpress in a subfolder called /wordpress/. The problem that the images I uploaded show the /wordpress/ directory name in the URL. Can that be removed without moving the uploads folder?


title: How to create copy of post

text: I need to create vote counter for post when any user click on it. Suppose I am new user. I am seeing some advertisements/comments on websites. I click on any one to support it. Then it should automatically add to my account and also it increase vote counter for that post. Thanks for your support. Regards, Deepak


title: Trying to get custom post meta through Jetpack JSON API

text: I'm using the Jetpack for Wordpress to produce a JSON API for my **Events** custom post type, which works fine: `https://public- api.wordpress.com/rest/v1/sites/MYSITE/posts/?type=events&number=100` However, this CPT also includes quite a few Post Meta Fields generated by Custom Meta Boxes and Fields for Wordpress. These fields include things like:   * `_ecmb_supporting_bands`   * `_ecmb_tickets_avail`   * `_ecmb_event_agelim` And by default these fields aren't returned by the JSON API... I've tried to run queries like: `https://public- api.wordpress.com/rest/v1/sites/MYSITE/posts/?type=events&number=100&meta_key='_ecmb_supporting_bands'` Or without quotes around the meta key: `https://public- api.wordpress.com/rest/v1/sites/MYSITE/posts/?type=events&number=100&meta_key=_ecmb_supporting_bands` Unfortunately this doesn't work. Does anyone know how I can return these custom meta fields in my JSON response?


title: foreach loop inside the loop creating duplicates in output

text:
I have a foreach loop inside the loop that is getting info from a separate table. The table has a column that has an id that reflects the id of the post type so it should always be unique. When I look at the results, the created variable ($fullname) is displayed multiple times in rows with posts that do not share the same id as the $fullname event id. **Here is the code with all of the looping action**               <?php             // the loop             if (have_posts()) :                      $output.='
';                     $output.='
';                     $output.='Agency	';                     $output.='Project Description	';                     $output.='Time Frame	';                     $output.='Team Leader	';                     $output.='Volunteer Limit	';                     $output.='
';                     while (have_posts()) : the_post();                                  //Get post attendee amount                             $project_id = get_the_ID();                             $attendees = $wpdb->get_var("SELECT COUNT(user_id) FROM ".$wpdb->prefix."mro_attendees WHERE event_id = ".$project_id."");                                  //Get team leader name                             $leader = $wpdb->get_results("SELECT user_first_name, user_last_name FROM ".$wpdb->prefix."mro_attendees WHERE event_id = ".$project_id." AND user_role = 'team_leader' LIMIT 0,1");                             foreach ($leader as $lead) {                             $leaderfirst = $lead->user_first_name;                             $leaderlast = $lead->user_last_name;                             $fullname = $leaderfirst . ' ' . $leaderlast;                               }                                  //Title and link                             $temp_title = get_the_title($post->ID);                             $temp_link = get_permalink($post->ID);                                  // output all findings - CUSTOMIZE TO YOUR LIKING                             $output.='
';                             $output.=''.$temp_title.'	';                             $output.=''.get_custom_field('project_description').'	';                             $output.=''.get_custom_field('project_timeframe').'	';                             $output.=''.$fullname.'	';                             $output.=''.$attendees.'/'.get_custom_field('project_limit').'	';                             $output.='
';                          endwhile;                     $output.='

';                     //pagination links                     $output.= wp_pagenavi();                     $output.='';                     $output.='';             else:                          $output.='nothing found.';                  endif;     ?>      The team leader $fullname should only show once according to the post id that the event id is equal to in the loop, however, the output results end up putting these people in other rows for projects (post ids) that do not share the same event id with the person. So they (the team leader names) appear in extra rows in the loop and I can not figure out why this is the case. The count query above that does not cause the same problem. Thanks and great appreciation to whoever can offer me help!


title: Can't save drop down select date in meta boxes

text: I want to update my select options(drop down) but i don't know where i made a mistake.Here is my code.               <?php          function display_post_options(){              wp_nonce_field( basename( __FILE__ ), 'post_options_nonce' );           ?>              <form action='' id='post-options-form' method='post'>         Choose Your Post Layout:         <select name='post_options_select'>         <option id='right-sidebar' value='right' name='right_sidebar' <?php selected('post_options_select', 'right'); ?> >Right sidebar</option>         <option id='left-sidebar' value="left" name='left_sidebar' <?php selected('post_options_select', 'left'); ?>>Left Sidebar</option>         <option id='no-sidebar' value="no" name='no_sidebar' <?php selected('post_options_select', 'no'); ?>>No Sidebar</option>         </select>         </form>               <?php     }          function post_options(){         add_meta_box(              'post-options',             'Post Options',             'display_post_options',             'post',             'advanced',             'high',             $callback_args         );     }          function save_post_options($post_id){              if (if_user_can_save($post_id, 'post_options_nonce')) {             update_post_meta($post_id, 'post_options_select', $_POST['post_options_select']);         }          }          function if_user_can_save($post_id, $nonce){              //Check if post is autosave         $is_autosave = wp_is_post_autosave($post_id);         //Check if it is a Revision         $is_revision = wp_is_post_revision($post_id);         //Is the nonce valid         $is_valid_nonce = ( isset( $_POST[ $nonce ] ) && wp_verify_nonce( $_POST[ $nonce ], basename( __FILE__ ) ) );         return !($is_autosave || $is_revision) && $is_valid_nonce;          }          add_action('add_meta_boxes', 'post_options');     add_action( 'save_post', 'save_post_options', 10, 2 );     ?>      UPDATE:(See comment #3) This is where i assigned my html to a variable.But it outputs (selected='selected'Choose Your Post Layout: [the select list])               function display_post_options(){         global $post;         wp_nonce_field( basename( __FILE__ ), 'post_options_nonce' );          $post_options_select_value =  get_post_meta($post->ID,'post_options_select',true);              $html = 'Choose Your Post Layout: ';         $html .= '<select name="post_options_select">';         $html .= '<option id="right-sidebar" value="right" name="right_sidebar"' . selected($post_options_select_value, 'right') . '">Right sidebar</option>';         $html .= '<option id="left-sidebar" value="left" name="left_sidebar"' . selected($post_options_select_value, 'left') . '" >Left Sidebar</option>';         $html .= '<option id="no-sidebar" value="no" name="no_sidebar"' . selected($post_options_select_value, 'no') . '">No Sidebar</option>';         $html .= '</select>';              echo $html;          }


title: Is WP vulnerable when updating plugins or themes?

text: Once, I had a problem that somehow someone managed to change files of my website without FTP or SSH credentials. Probably he got in through WP (probably it wasn't a 'he', but an 'it', a bot), we said after investigation. Anyway, since then I'm using the WordPress File Monitor plugin, which mails me when files are changed. Now, when I update plugins or themes, I first perform a scan with the file monitor, then I update and then I scan again. The monitor gives an alert because of the update, and I remove it, because 'it's because of the update'. Now I'm wondering, _if_ WP is especially vulnerable when updating (for example, if it would be possible that the update doesn't come from the WP servers but from a hacker), then with this I open a leak in the security of my site.   On the other hand, if the updated plugins / themes work (which I always check), and it's only the files of the plugins that are changed (which I also always check), then it's -in my opinion- not so likely that someone hacked my site during the update. Am I doing the correct thing here, or should I check better after updating?


title: Convert an theme options page to use in customize.php also?

text: I have developed a theme options page which is a submenu page of appearance. But now i like to know how what i need to do so the theme options are also editable in the theme->customize interface. (customize.php). I tried a simple test by adding this to functions.php, to see if the customize menu is altered but no luck               //for customize.php     function mytheme_customize_register( $wp_customize ) {        //All our sections, settings, and controls will be added here        //1. Define a new section (if desired) to the Theme Customizer           $wp_customize->add_section( 'mytheme_options',               array(                 'title' => __( 'MyTheme Options', 'ppr' ), //Visible title of section                 'priority' => 35, //Determines what order this appears in                 'capability' => 'edit_theme_options', //Capability needed to tweak                 'description' => __('Allows you to customize some example settings for MyTheme.', 'ppr'), //Descriptive tooltip              )            );                //2. Register new settings to the WP database...           $wp_customize->add_setting( 'link_textcolor', //No need to use a SERIALIZED name, as `theme_mod` settings already live under one db record              array(                 'default' => '#2BA6CB', //Default setting/value to save                 'type' => 'theme_mod', //Is this an 'option' or a 'theme_mod'?                 'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting.                 'transport' => 'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?              )            );                    //     }     add_action( 'customize_register', 'mytheme_customize_register' );     //end cutomize.php      regards,


title: Filter posts by custom taxonomy terms

text: I am trying to filter posts by author. The 'post_author' is a custom taxonomy and I've included it in my args and posts are showing with the linked author names but when I click on the author name link, I get all authors. How can I show only the author that is clicked? I've included the relevant pieces of code:               //ADD THE TAXONOMY 'post_authors' TO MY CUSTOM POST TYPE     function add_custom_taxonomies() {        register_taxonomy('post_authors', 'my-post-type', array(        'hierarchical' => true,        'labels' => array(        'name' => _x( 'Authors', 'taxonomy general name' ),        'singular_name' => _x( 'Author', 'taxonomy singular name' ),        'search_items' =>  __( 'Search Authors' ),        'all_items' => __( 'All Authors' ),        'parent_item' => __( 'Parent Author' ),        'parent_item_colon' => __( 'Parent Author:' ),        'edit_item' => __( 'Edit Author' ),        'update_item' => __( 'Update Author' ),        'add_new_item' => __( 'Add New Author' ),        'new_item_name' => __( 'New Author Name' ),        'menu_name' => __( 'Authors' ),        ),        // Control the slugs used for this taxonomy        'rewrite' => array(        'slug' => 'post-authors', // This controls the base slug that will display before each term        'with_front' => false, // Don't display the category base before "/authors/"        'hierarchical' => true // This will allow URL's like "/authors/lorem/ipsum/"      ),     ));     }     add_action( 'init', 'add_custom_taxonomies', 0 );               // and in my archive page......          //ARGS     $args = array(          'post_type' => 'my-post-type',         'order' => 'DESC',         'tax_query' => array(             array(                 'taxonomy' => 'post_authors',                 'field'    => 'slug',                 'terms'    => 'Jill Jones',             ),         ),     );                    //RETRIEVES AUTHOR NAME FROM CUSTOM TAXONOMY     $terms = get_the_terms( $post->ID, 'post_authors' );          if ($terms) {         $terms_name = array();         foreach ( $terms as $term ) {         // The $term is an object, so we don't need to specify the $taxonomy.         $term_link = get_term_link( $term );         $terms_name[] = $term->name;         // If there was an error, continue to the next term.         if ( is_wp_error( $term_link ) ) {           continue;         }     }     $author_name = $terms_name[0];      }                    //RETRIEVING THE AUTHOR NAME IN LOOP     if ( $post_typed == ('my-post-type') && $author_name  != '' )  {  echo '' . $author_name . ''; }


title: How to customize the WordPress excerpt?

text: I searched the web and the available plugins, but I couldn't find anything that is easy understandable for a noob like me to do the following: I learned how to create a "Continue Reading" link and how to set a post excerpt to a defined length of words. But I would like to get my "Continue Reading" link, if the following is given:   1. If the post has more words than 45, then show the excerpt link. That is easy so far.   2. If the post has less than 45 words and a gallery/video is included, then set the "Continue Reading" link right after the text. That is not easy for me. How would the code look like for this? After my research I came up with the following. (I know that it won't work, but some parts work as standalone, but I am not able to bring everything together.) Maybe somebody can help to point me into the right direction? Preferrably the code should work with the functions.php only and no need to touch the templates of the theme. If this won't work, then I am happy to create a plugin that will do the work.               function individual_excerpt_more( $more ) {         if {             function word_count() {                 $content = get_post_field( 'post_content', $post->ID );                 $word_count = str_word_count( strip_tags( $content ) );                 return $word_count; <45 // (less than 45 words)                 }             && $content = $post->post_content;             if( has_shortcode( $content, 'gallery', 'video' ) ) {             // The content has a [gallery] & [video] short code, so this check returned true.             }             return '… Read more';             }         else {             function theme_excerpt_length( $length ) {                 return 45;             }             add_filter( 'excerpt_length', ’theme_excerpt_length' );         }     }     add_filter( 'excerpt_more', 'individual_excerpt_more' );


title: The sorting of posts by a meta_query with two keys fails while separated as single queries it works

text: I have a list of courses I try to sort. For sorting purpose I want to use two advanced custom fields. First a select field `class_day` containing the days:               1 : Mon     2 : Tue     3 : Wed     4 : Thu     5 : Fri     6 : Sat     7 : Sun      The first value is set to a number on purpose to make it easily sortable while the second label value is the one which will be echoed for display on the front end. The second field is a simple text field `class_start` with a number like e.g. `19:00`. Now I want to sort my posts by the `class_day` field and in case there are events on the same day sort those by the numerical value of the `class_start` text field. Problem is if I sort the posts only by `class_day`:               $args = array(         'post_type' => 'courses',         'posts_per_page' => -1,         'meta_key' => 'class_day',         'orderby' => 'meta_value_num',         'order' => 'ASC'     );     $the_query = new WP_Query( $args );      or by `class_start`:               $args = array(         'post_type' => 'courses',         'posts_per_page' => -1,         'meta_key' => 'class_start',         'orderby' => 'meta_value_num',         'order' => 'ASC'     );     $the_query = new WP_Query( $args );      Each time the posts are sorted properly. One time by the day the other time by time. But if i try to merge the two with `meta_query` it doesn't work at all.               $args = array(         'post_type' => 'courses',         'meta_query' => array(             'relation' => 'OR',             array('key' => 'class_day'),             array('key' => 'class_start')         ),         'meta_key' => 'meta_value',         'orderby' => 'meta_value_num',         'order' => 'ASC'     );     $the_query = new WP_Query( $args );      With `'relation' => 'OR'` the posts are only sorted by the day, but posts of the same day aren't sorted properly by the time in the second step. If i use `'relation' => 'AND'` i run in no match for the query at all cuz i run into the `else` case of the loop:               if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();      My goal would be to get a sorted list like:               Mon 13:00     Tue 12:30     Tue 16:00     Sat 12:00      But not:               Mon 13:00     Tue 16:00     Tue 12:30     Sat 12:00      **Update:** The following custom query, and not using the wp_query function, did the trick:               $querystr = "       SELECT wposts.*        FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta1, $wpdb->postmeta wpostmeta2       WHERE wposts.ID = wpostmeta1.post_id       AND wposts.ID = wpostmeta2.post_id       AND wpostmeta1.meta_key = 'class_day'       AND wpostmeta2.meta_key = 'class_start'       AND wposts.post_type = 'courses'       AND wposts.post_status = 'publish'       ORDER BY wpostmeta1.meta_value ASC,                wpostmeta2.meta_value ASC     ";      **Update 2:** Tiny update to the code of the first update. I've added `AND wposts.post_status = 'publish'`. To prevent drafts and other states being displayed. That way only published posts are shown and sorted.


title: Filter second dropdown (tax) based on first dropdown (cpt)

text:
I've been googling and attempting this for over a week now with no success. I have a few custom post types (books, films, music etc), and a custom taxonomy (location). On my frontpage, I have two dropdowns that filter a search, like this:               Look for: <custom post type> in <taxonomy>      What I am trying to do is have the second dropdown (location) filtered based on the first dropdown (cpt). So, if I choose "book", and there are only books in town X, and town Y, then only show town X and Y as options in the second dropdown. If anyone can help me get it right, you'll make my whole year! Below is my code for the two dropdowns (which are working, just not filtered):               <form action="<?php bloginfo('url'); ?>" method="get">          <?php           $args = array(     'public'   => true,     '_builtin' => false     );          $output = 'objects'; // names or objects, note names is the default     $operator = 'and'; // 'and' or 'or'          $post_types = get_post_types($args, $output, $operator);          echo '<select class="selectboxSingle" name="post_type">';          foreach ( $post_types  as $post_type ) {          $exclude = array('custom_type');          if(TRUE === in_array($post_type->name,$exclude))     continue;             echo '<option value="'.$post_type->slug.'">' . ucfirst($post_type->name) . '</option>';     }          echo "</select>";     ?>
in
          <?php           // Set your custom taxonomy     $taxonomy = "location";          // Get all terms of the chosen taxonomy     $terms = get_terms($taxonomy, array('orderby' => 'name'));          // our content variable     $list_of_terms = '<select id="location" class="selectboxSingle" name="location">';          foreach($terms as $term){              $select = ($current_selected = $term->slug) ? "selected" : "";              if ($term->parent == 0 ) {                  // get children of current parent.             $tchildren = get_term_children($term->term_id, $taxonomy);              $children = array();         foreach ($tchildren as $child) {             $cterm = get_term_by( 'id', $child, $taxonomy );             $children[$cterm->name] = $cterm;         }         ksort($children);              // OPTGROUP FOR PARENTS         if (count($children) > 0 ) {                  $list_of_terms .= '<optgroup label="'. $term->name .'">';                  if ($term->count > 0)                  $list_of_terms .= '<option value="'.$term->slug.'" '.$select.'>All '. $term->name .' </option>';             } else             $list_of_terms .= '<option value="'.$term->slug.'" '.$select.'>'. $term->name .' </option>';         //$i++;              // now the CHILDREN.         foreach($children as $child) {              $select = ($current_selected == $cterm->slug) ? "selected" : "";              $list_of_terms .= '<option value="'.$child->slug.'" '.$select.'>'. $child->name.' </option>';              } //end foreach              if (count($children) > 0 ) {             $list_of_terms .= "</optgroup>";         }     }     }          $list_of_terms .= '</select>';          echo $list_of_terms;      ?>

<button class="submit-button" type="submit">Search</button>
     </form>


title: How to make post and comment count unclickable with dashboard_glance_items hook

text: I have a multi author site and I have already used some hooks to stop them from viewing other author's posts and media. Now, in the Wordpress Dashboard in the "at a glance" section it shows them the total posts and comments. They can click on them at the moment and I would like them to not be able to do this. So, I have found a hook which targets this, although I'm only starting to learn how to customise using hooks so I need some help. Here is what I have right now, just echoing out the current user's ID to verify that it is the right hook:               add_filter('dashboard_glance_items', 'make_unclickable');          function make_unclickable( $items = array() ) {         global $current_user;         echo $current_user->ID;              return $items;     }      So, how can I make the links unclickable?


title: Limit function to specific post category

text:
I have a function that wraps images in a custom div. It's placed in functions.php and modifies all posts. I'd like to know if there's a way to _only_ apply it to posts in a certain category. Here's the function:               function my_image_tag($html, $id , $alt, $title) {         $html = "
" . $html . "
";         return $html;     }          add_filter('get_image_tag','my_image_tag',10,4);      ## Update: Robert Hue's method didn't work with this function, but it worked with the following function, which I think is better (at least for my use):               function wrapImagesInDiv($content) {         if ( in_category( 'prosjekter' ) ) {             $pattern = '/(]*class=\"([^>]*?)\"[^>]*>)/i';             $replacement = '
$1
';             $content = preg_replace($pattern, $replacement, $content);         }         return $content;     }     add_filter('the_content', 'wrapImagesInDiv');


title: How to restrict on selecting child taxonomy

text: I have a taxonomy name "City" . I have used "city" like this .               City 1         Sub city 1         Sub city 2     City 2          Sub city 3         Sub city 4      Here the problem is if admin/user select City 1 , they can even select sub city 3 or sub city 4 , which is not under the City 1 . I want to restrict user that they can't select a child taxonomy till they have selected the parent taxonomy . Or is there any other way , that child taxonomy will appear as drop down , upon selecting parent taxonomy .


title: Display posts order by custom post in a dropdown menu

text:
In my WordPress backend I have some custom posts and, in one of them, I want to display in a dropdown field some posts related with but ordered by post type. Iwant to display something like this.               <select multiple="multiple" style="height:200px; width:300px">     <optgroup label="Productos">     <option>Producto 1</option>     <option>Producto 2</option>     <option>Producto 3</option>     <option>Producto 4</option>     <option>Producto 5</option>     <option>Producto 6</option>     </optgroup>     <optgroup label="Paso 1">     <option>Subpagina 1</option>     <option>Subpagina 2</option>     <option>Subpagina 3</option>     </optgroup>     </optgroup>     <optgroup label="Paso 2">     <option>Subpagina 1</option>     <option>Subpagina 2</option>     <option>Subpagina 3</option>     </optgroup>     </optgroup>     <optgroup label="Paso 3">     <option>Subpagina 1</option>     <option>Subpagina 2</option>     <option>Subpagina 3</option>     </optgroup>     </select>      Here is the code that displays all of posts that I want but without order. I figure out that I have to use the id of the custom post type but I do not how to:               {     // Add the Meta Box            function add_custom_meta_box_related() {           add_meta_box(               'custom_meta_box_related', // $id               'Related Information', // $title                'show_custom_meta_box_related', // $callback               'related', // $page               'normal', // $context               'high'); // $priority       }       add_action('add_meta_boxes', 'add_custom_meta_box_related');              // Field Array           $prefix_related = 'custom_';           $custom_meta_fields_related = array(                    array(                   'label' => 'Related Items',                   'desc' => 'Select a related item(s)',                   'id'    =>  $prefix_materiales.'post_id',                   'type' => 'post_list',                   'post_type' => array('products','paso1','paso2','paso3','paso4','compra'),       )         );                // The Callback       function show_custom_meta_box_related() {       global $custom_meta_fields_related, $post;       // Use nonce for verification       echo '<input type="hidden" name="custom_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';                // Begin the field table and loop           echo '
';           foreach ($custom_meta_fields_related as $field_related) {               // get value of this field if it exists for this post               $meta_related = get_post_meta($post->ID, $field_related['id'], true);               // begin a table row with               echo '
                      '.$field_related['label'].'	                      ';                       switch($field_related['type']) {                           // case items will go here                               // post_list                           case 'post_list':                           $items = get_posts( array (                               'post_type' => $field_related['post_type'],                               'posts_per_page' => -1                           ));                           echo '<select multiple name="'.$field_related['id'].'" id="'.$field_related['id'].'">                          <option value="">Select One or more</option>'; // Select One                           foreach($items as $item) {                               echo '<option value="'.$item->ID.'"',$meta_related == $item->ID ? ' selected="selected"' : '','> '.$item->post_title.'</option>';                           } // end foreach                           echo '</select>
'.$field_related['desc'].'';                           break;                     } //end switch               echo '
';           } // end foreach           echo '
'; // end table       }          // Save the Data       function save_custom_meta_related($post_id) {           global $custom_meta_fields_related;                // verify nonce           if (!wp_verify_nonce($_POST['custom_meta_box_nonce'], basename(__FILE__)))                return $post_id;           // check autosave           if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)               return $post_id;           // check permissions           if ('page' == $_POST['post_type']) {               if (!current_user_can('edit_page', $post_id))                   return $post_id;               } elseif (!current_user_can('edit_post', $post_id)) {                   return $post_id;           }                // loop through fields and save the data           foreach ($custom_meta_fields_related as $field_related) {               $old = get_post_meta($post_id, $field_related['id'], true);               $new = $_POST[$field_related['id']];               if ($new && $new != $old) {                   update_post_meta($post_id, $field_related['id'], $new);               } elseif ('' == $new && $old) {                   delete_post_meta($post_id, $field_related['id'], $old);               }           } // end foreach       }       add_action('save_post', 'save_custom_meta_related');               }


title: Empty RSS Feeds

text: When i try to access feeds for tags,categories and authors, i get empty list. If i try to open feeds for the site, i get "Page not found" **Empty Feed:** http://thinkzarahatke.com/category/advertisement/video/feed http://thinkzarahatke.com/author/amty/feed **Page not Found :** http://thinkzarahatke.com/feed I had tried fix rss feed plugin. But it dint solved my problem too. Please help.


title: How to load a new template page according to a particular URL?

text: I want to load some of the pages(not wordpress page, a template file other than wordpress's default template file) according to the url came on the address bar. for instance, I have page in my template file ie my_account.php to show my profile pic and other informations from to my wordpress pofile. and it is placed in my defaut theme folder               /themes/mytheme/my_account.php      When the url is `http://mysite/MyAccount/` then I need to load the above page. Something like if `http://mysite/register/` then load the register.php from my theme folder. I'm using custome permalinks option. `http://mysite/hello_world_post/` So How can I configure and load the template according to the url, how to controll this by using a plugin.


title: page template - undefined structure in source code

text:
hey, i have the following page template for a sitemap.               <?php     /**      * Template Name: Sitemap      */     ?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

Pages

                     <?php wp_list_pages('title_li=&depth=0&exclude='); ?>

Posts
                 <?php $first = 0;?>
                 <?php                 $myposts = get_posts('numberposts=-1&offset=$first');                 foreach($myposts as $post) :                 ?>
<a href="<?php the_permalink(); ?>#b"><?php the_title(); ?>
                 <?php endforeach; ?>

Categories

                     <?php wp_list_categories('title_li=&orderby=name'); ?>

Tags

                         <?php                     $tags = get_tags();                     foreach ($tags as $tag){                         $tag_link = get_tag_link($tag->term_id);                         $html .= "
name} Tag' class='{$tag->slug}'>";                         $html .= "{$tag->name}
";                     }                     echo $html;                     ?>

          <?php endwhile; endif; ?>      It's my intention to not define a header with or or anything like that, because this thing is only used to get loaded via an ajax call. However the output of this thing looks like this

Pages

              <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Account

Forum

Google Map

Contact

Login

Register

Posts

Test post

Lorem Ipsum Test Page

Hello

Categories

              <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
                  Something

       Any idea why there is a weird doctype declaration and a `<html><body>` inserted inside of every `ul`. Except for the Posts `ul`. Just weird. Why could that happen and what causes this? I actually use a html5 doctype on my website. Thank you for the help edit:               add_filter('wp_list_pages', 'add_hash'); /*Add #hash to wp_list_pages() function*/     add_filter('wp_list_categories', 'add_hash'); /*Add #hash to wp_list_categories() function*/     function add_hash($output) {                  $dom = new DOMDocument();             $dom->loadHTML($output);                  $a_tags = $dom->getElementsByTagName('a');                  foreach($a_tags as $a)             {                 $value = $a->getAttribute('href');                 $a->setAttribute('href', $value . '#b');             }                  return $dom->saveHTML();     }      The new DOMDocument is adding this doctype declaration and the and


title: New wp menu menu styling

text: Ok ,i am not a great fan of the menu of WP, but now it manage this inside pretty ok, i have to make theme that use that menu. Now for styling i am a bit challenge... here is the problem... the menu should look like | page1 | page2 | page 3 | Do you see the problem, the border, let say each * will be style with border right 1px that work but first item will need a special class for border left Question. How do i know that it's first or last item in the menu to style it properly... or what is your way to style that type of menu...


title: How to replace the twentyten image header with my flash banner?

text: I am currently building a site using a child theme for the first time. Basically, I have a flash banner the client has already had made, and want to replace the twentyten image banner with the flash. I know how to do this by editing the header.php (I think!) but was wondering if there was a better way to do it - using function.php in my child theme perhaps? It would be nice if the client could update the theme themselves and not worry about the header being changed back. Thanks for any contributions.


title: Publishing VS2010 Web Solution to WordPress

text: I am wondering if it's possible to publish a website that I have created onto WordPress? If so, how? The site was created using VS2010. I've done some searching online, and all I've came up with are tutorials on WordPress on how to publish your Visual Studio site onto other things not related to WordPress. Thank you


title: How to enable comments options?

text: 1. On page --> Screen Options --> check Discussion --> Discussion --> Allow commets --> I have checked on discussion options.   2. Settings --> Discussion --> I have checked on _Allow people to post comments on new articles_.   3. I also have this code in my theme: `<?php comments_template(); ?>` But the comment form is still not visible. What else do I have to do?


title: Sharing database for collaborative development

text: Is there a straightforward way to share/sync multiple WP instances with a single database? I work collaboratively with several developers on custom themed sites. We use git to keep our files in order and it's all fine in the early stages, but once content, plugins etc. start coming into play, we have issues with staying in sync with content. Is there a decent solution over than tossing the SQL file around? That gets old pretty fast and doesn't work very well.


title: WordPress Network (MU): Copy Main Site to Sub-Site

text: I would like to copy all the posts, users, and pages from my main site into a sub site. I've tried exporting and importing, but the main site has thousands of entries and hundreds of users, and the import seems to fail at around 250 posts without an error. Any ideas for the migration would be greatly appreciated.


title: Auto-complete or auto-suggest from list of post titles

text: I want to have an auto-complete or auto-suggest function on a (search) form: When a user begins to type, it suggests post titles that have matching text. I'd also like it to display some meta-data (a number) that I have stored related to each custom post. Example: If I type "A", it suggest "Apples (13), Aardvarks(51), Astronauts (21)", etc.


title: How to get wordpress navigation to work

text:
I have been using this code to display my wordpress navigation and it worked;
     <?php wp_list_pages('sort_column=menu_order&title_li='); ?>
      However,i want to use register_nav_menus so that i can arrange my menus from the wp backend.I have this code and its not working as expected;               <?php           wp_nav_menu( array(         'theme_location' => 'menu',         'fallback_cb' => 'wp_page_menu',         )           );     ?>      My menus html should looks like this

Home

             Pages

             Portfolio

             Admin UI

             Features

             Shortcodes Wp 3.3

Typography

Sliders

Columns

Buttons

Typography

Sliders

Typography

Sliders

Columns

Buttons

Columns

             Blog

             Cute


title: Should I use posts or pages in this scenario?

text: I'm considering using WordPress as the CMS for the website of a small clinic. There are only two sections with sub-sections: team and methods. Team contains each of the team members and Methods contains all of the treatment methods the clinic offers. Each method is linked to one or more team members, and each team member is linked to one or more methods. As an example, if a visitor clicks on Team they should be presented with an overview list of all team members, each with a small portrait and a short version of their bio. The visitor then clicks on a particular team member and is taken to their full bio. The bio includes a full-size portrait, the full bio text, and links to each method the team member practices (e.g. physio therapy, acupuncture, shiatsu etc.) What's the best way to organize this? Should each team member be a post of the category Team or a child page of Team? What about the methods? Should tags be used in this case?


title: How is revision works internally?

text: I'm curious about wordpress revision feature. I want to implement this revision feature in my own php app. How is logic behind this revision feature? Thanks.


title: Unpublish all posts in a category

text: I have a category with about 3.500 posts. 2.500 are not published, but saved as drafts. I want to unpublish all the remaining 1000 posts from this one category. Maybe I will want to delete all of the posts later on. How can I do this?


title: How to hide terms if post is equivalent to draft?

text: The issue is if you are displaying a term list somewhere it will show the terms tied to draft posts as well. How can I make drafts not register to the taxonomy until published?