Automatically hide Widgets that would lengthen page

Something I've been dreaming about ever since I started using CMS's for making websites. I've settled on WP now, so hence I'm asking here. I conditionally hide widgets on certain pages that are very short, where the widgets extend the page too much, leaving lots of blank space in the main content area at the bottom. It would be much nicer to have a sidebar which dynamically hides widgets that would otherwise lengthen the page. As a bonus, maybe I could even prioritize which widgets to hide (as opposed to merely the bottom ones). Maybe it would be done by making the sidebar inherit its length from the main content, regardless of whether all the widgets then fit. Then something like CSS could be used to hide widgets that don't fit into the sidebar div?


How to get posts and comments amount per hour, per year and per month?

I have this snippet:               function count_user_comments_today( $uid ){         global $wpdb;         $today = date('Y-m-d');         $tomorrow = date('Y-m-d', time() + 86400);         $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->comments} WHERE user_id = %d  AND comment_date >= %s  AND comment_date < %s ", $uid, $today, $tomorrow  ));         return $count;     }      But this get's the comments per day and that for a specific user. I want it to be generic, for the whole site and per hour, per year and per month.... Is this possible? Of course also the posts and not only the comments.


Using Ajax to autocomplete a form with data from db

I'm struggling to get the following:   1. User fills out personal number   2. Other input gets autocompleted with data from database As I have never made a plugin, help is greatly appreciated, my database knowledge is also not 'all that'. Thanks in advance.


Admin Subpages without Menu entry

I have added some pages to the WP-Adminmenu, with `add_menu_page` and `add_submenu_page`. The URLs for those pages look like `admin.php?page=my- plugin/admin/submenupage.php`. If I try to add a page now that has isnt registered to the menu and link to it with `<a href="?page=my- plugin/admin/add.php">` I'm getting a permissions error. Is there a way to add pages to the admin area without registering them to the menu?


Configuring multi-site with domain mapping

We have a client that runs 15 or so e-commerce and brochureware sites for his customers. What they want to do is add a WordPress blog to each of these sites, for example:               www.site1.com/blog     www.site2.com/blog     www.site3.com/blog     www.site4.com/blog      All of these sites reside on the same server (Windows 2008R2/IIS7.5 running PHP 5.3). Rather than have a separate install of WordPress in each `/blog` directory we'd like to map `/blog` as a virtual directory to a single install of WordPress located in a central admin site, i.e. `www.clientsdomainname.com`. The idea being to enable the multi-site feature on WordPress and manage all these site's content on one place on `clientsdomainname.com`. To try and get this working with the first blog site (`www.site1.com/blog`) I've   * Installed WordPress 3.6.1 on `www.clientsdomainname.com`   * Enabled the multi-site feature   * Mapped `site1.com`'s `/blog` as a virtual directory pointing to the physical root of `www.clientsdomainname.com` on the file system (making sure permissions are correct etc).   * Installed http://wordpress.org/plugins/wordpress-mu-domain-mapping/ and carried out the following:   * Set my server IP address in the domain mapping configuration as per step 3 in http://ottopress.com/2010/wordpress-3-0-multisite-domain-mapping-tutorial/   * Created a new site (`www.clientsdomainname.com/site1`) using the Network Admin bits   * Dropped into this site's dashboard and in Tools -> Domain mapping added: `http://www.site1.com` and set this as the primary domain for this site. Now when I browse to `http://www.site1.com/blog` things aren't quite right - CSS isn't being loaded and I get WordPress's default "This is somewhat embarrassing, isn’t it?" 404 page. If I view the page source, site URL's (such as for CSS) are being requested from `http://www.site1.com/` rather than `http://www.site1.com/blog` I'm now stuck and not sure how best to proceed with getting this to work. Is it possible to get my desired configuration work using the multi-site feature along with one of the domain mapping plugins e.g. https://premium.wpmudev.org/project/domain-mapping/ or http://wordpress.org/plugins/wordpress-mu-domain-mapping/ ? The following are the changes I made to the default `wp-config.php` file, everything else is stock:               /* That's all, stop editing! Happy blogging. */     define('MULTISITE', true);     define('SUBDOMAIN_INSTALL', false);     define('DOMAIN_CURRENT_SITE', 'clientsdomainname.com');     define('PATH_CURRENT_SITE', '/');     define('SITE_ID_CURRENT_SITE', 1);     define('BLOG_ID_CURRENT_SITE', 1);     define('SUNRISE', 'on');      These are the rewrite rules for the `clientsdomainname.com` where WordPress is installed (we use ISAPI_Rewrite3 which supports most Apache mod_rewrite directives):               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]     RewriteRule . index.php [L]


What does this mean: Object of class WP_Error could not be converted to string

When I click on preview a post, I get the following error: Catchable fatal error: Object of class WP_Error could not be converted to string in functions.php on line 288 The line 288 is as follows               echo get_category_parents($cat, TRUE, '' . $delimiter . '');      Any ideas on this please?


How to unregister a widget from a child theme

I was wondering if there was a way to unregister a widget that gets declared in the functions.php file of a parent theme from a child theme, I understand that the child's function.php file gets loaded first so I don't know how to unregister it when it hasn't been created yet. Thanks all in advance!


How to insert image and text from admin panel throughout my theme

I'd like to have an admin panel where I can upload an image and customize a line of text. Then use a shortcode throughout the theme to display the text/images. I'd also like this to be scalable so I can add more image upload/text inputs to this panel as I grow the site. I was using a tutorial that was showing how to insert a logo in a similar fashion that I was going to hack for my use, but following the tutorial doesn't seem to work in the current version of Wordpress.


404 redirecting to home

I have a multisite network, and my theme has a custom `404.php`. On all the child sites this 404 handler is being correctly used, but on the primary site all 404s go back to the home page without touching my `404.php` at all. And for once, this isn't the fault of the Redirection plugin! The problem is still there when Redirection is turned off (network-wide _and_ on the specific site). The problem isn't occurring on my local copy of the same site, but I can't find any difference in the configuration or plugins that could be causing it.


WooCommerce & Caching

I have a div that displays the total amount of products the customer has in their cart, however this isn't updating as I have caching on (W3 Total Cache). Is there a workaround for this? Cheers, Steve


Reverse pagination issue

I installed the Default Sort Ascend plugin for Wordpress because I needed the opposite of how Wordpress displays its posts. It works awesome except for the pagination. Now the Previous and Next buttons are messed up, instead of getting the Next button on the first page I get the Previous. I want them to change, basically I want the Previous button to do what the Next should and vice versa. Also their location should change. This is the way how I think I can fix this. However I don't know where I can find these things and change them and I tried searching for different plugins and none seems to fix the problem. If you know of any of these please let me know. I hope this topic helps others as well. Thanks!


What is the Javascript event for an item being added to the cart in Woocommerce?

I can't seem to find this in the docs or through google. So basically I'm just looking for the Javascript event that fires when an item is added to the cart. ~~For some reason my default added to cart notification isn't working.~~ EDIT: So I'm thinking because I'm including the woocommerce.php file in my themes default folder as well as my woocommerce template overrides.


Enqueuing a script before anything else

I wondered if it was possible to change the order in which a script is enqueued. I ask this because I wish to include the HTML5 enabling script but it needs to be included before any styles. Is there any way to change the order? I could obviously hard code it into the themes header, but I would prefer to enqueue it. Thanks for any suggestions you may have.


Function to change meta value in database for each post

I have a meta key called 'prijs' in each post. The value of this meta key consist of numbers in the follow structure: 2,100.00 I want to remove the comma in the meta value to get this output: 2100.00 So, i created a function but it doesn't work:               add_action('wp_insert_post', 'deleteCommaDB');     function deleteCommaDB($postID){         $price_key = 'prijs';         $getPrice = get_post_meta($postID, $price_key, true);         $newPrice = str_replace(array(','), '', $getPrice);              update_post_meta($postID, $price_key, $newPrice);              return true;     }      I created the function `deleteCommaDB`. This function gets the post meta from the meta key 'prijs', and replaces the comma for nothing. This new value is saved in the variable $newPrice. Next thing to do, is update the post meta with the new value. What am i doing wrong?


How to add a rel attribute to images that contains their categories?

I've added categories to images, so that I can use them to filter images within a portfolio page. Now I'm thinking I need to add the rel attribute to each image that contains its assigned categories. Is this the right approach? If so, how do I add add rel with the applicable categories?


PHPlist & new posts notification?

I know there are plugins out there for integrating the user base & sign-up, but are there any for using PHPlist to automatically send out newsletters of new posts? I'm really trying to avoid a from-scratch solution here, though if nothing is 'ready made' I'd appreciate any pointers or head starts ;)


Building a Wordpress App

I construction of a administrative back office inside the wordpress theme for running our travel company, monitoring users, bookings and payments, it has come to my attention that it might be better served and more secure if such an area were in face a desktop application or offline webpage that connected to the internet inly to get the date. So how would one connect to wordpress from html/php pages sitting on the desktops of relevant computers? And is that a sensible idea or not? Many Thanks,


Audio Player for MP3 Files for Wordpress

I have a wordpress account. I am just using the free wordpress account which does not allow me to install any plugins. I have an mp3 file and I want it to appear as an audio player. There are many plugins like wpaudio but that only works if I have installed the wordpress on my server which I have not.


Understanding Permalinks on Custom Post Types

I hate to try to reinvent the wheel here, but none of the suggested post seem to work in answering my question. I am building a system for our 30 Under 30 honorees, which is basically setup as a portfolio of images. The types of post I am creating will be called "honorees", and the overall menu called "30 Under 30". The portfolio page that they are all displayed on, will be http://domain.com/30under30/ But for some reason the posts are created as http://domain.com/honoree/%honoree-name%/ **How do I change the my taxonomy follow menu name, as opposed to post type name?** The labels section of my code from functions.php is below                  function project_custom_init()       {         $labels = array(           'name' => _x('Honorees', 'post type general name'),           'singular_name' => _x('Honoree', 'post type singular name'),           'add_new' => _x('Add New', 'honoree'),           'add_new_item' => __('Add New Honoree'),           'edit_item' => __('Edit Honoree'),           'new_item' => __('New Honoree'),           'view_item' => __('View Honoree'),           'search_items' => __('Search Honorees'),           'not_found' =>  __('No honorees found'),           'not_found_in_trash' => __('No honorees found in Trash'),           'parent_item_colon' => '',           'menu_name' => '30 Under 30'         );        $args = array(           'labels' => $labels,           'public' => true,           'publicly_queryable' => true,           'show_ui' => true,           'show_in_menu' => true,           'query_var' => true,           'rewrite' => true,           'capability_type' => 'post',           'has_archive' => true,           'hierarchical' => false,           'menu_position' => null,           'supports' => array('title','editor','author','thumbnail','excerpt','comments')         );         // The following is the main step where we register the post.         register_post_type('honoree',$args);         // Initialize New Taxonomy Labels         $labels = array(           'name' => _x( 'Tags', 'taxonomy general name' ),           'singular_name' => _x( 'Tag', 'taxonomy singular name' ),           'search_items' =>  __( 'Search Types' ),           'all_items' => __( 'All Tags' ),           'parent_item' => __( 'Parent Tag' ),           'parent_item_colon' => __( 'Parent Tag:' ),           'edit_item' => __( 'Edit Tags' ),           'update_item' => __( 'Update Tag' ),           'add_new_item' => __( 'Add New Tag' ),           'new_item_name' => __( 'New Tag Name' ),         );           // Custom taxonomy for Honoree Tags           register_taxonomy('tagportfolio',array('honoree'), array(           'hierarchical' => true,           'labels' => $labels,           'show_ui' => true,           'query_var' => true,           'rewrite' => array( 'slug' => 'tag-portfolio' ),         ));        Any help would be appreciated. I'm trying my best to understand the code as I figure this out.


All subdomains redirecting to mainsite/wp-signup.php after multisite install

Need some help here. Have a WordPress 3.1 install at webtest.mysite.com and want multiple sub-domains at 1.webtest.mysite.com, 2.webtest.mysite.com, etc. After following all the instructions to the letter, every subdomain address redirects to the main install at webtest.mysite.com/wp-signup.php? Any ideas? .htaccess contents               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     # uploaded files     RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]     RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule . index.php [L]     # END WordPress     php_value upload_max_filesize 2000M     php_value post_max_size 2000M     php_value memory_limit 2000M     #php_flag display_errors on


Breadcrumbs - Exclude Child Categories

I am using this code in my functions.php file to display breadcrumbs on my web site..               function the_breadcrumb() {                 if (!is_home()) {                         echo '';                         echo 'Home';                         echo " Â» ";                         if (is_category() || is_single()) {                                 the_category('title_li=');                                 if (is_single()) {                                         echo " Â» ";                                         the_title();                                 }                         } elseif (is_page()) {                                 echo the_title();                         }                 }         }      I would like to know how to modify this so that only Parent categories are displayed? I have lots of posts that are assigned to multiple sub categories so the breadcrumb trail can get huge! Can anyone help?


How to make global post work with custom post type?

I was wondering to know if it's possible to use global posts with custom_types. I was working with this function:               global $post;      $myposts = get_posts('numberposts=4&offset=1& category=3,4');      foreach($myposts as $post) :          setup_postdata($post); ?>         <a href="<?php the_permalink() ?>" rel="bookmark" title="Visualizza <?php the_title(); ?>"><img src="<?php echo get_option('home'); ?>/wp-content/uploads/posthumb/<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>" alt="<?php the_title(); ?>" />     <?php endforeach;      As soon as I've moved the post from the standard articles type to a new custom post type, this stopped working. The category is still the same. Can I get it work again in any kind of way? Thank you very much for your reply.


Comment Function

How would I make this Function display only the latest 5 comments?               function showLatestComments() {       global $wpdb;         $sql = "        SELECT DISTINCT comment_post_ID, comment_author, comment_date_gmt, comment_approved, SUBSTRING(comment_content,1,100) AS com_excerpt         FROM $wpdb->comments         WHERE comment_approved = '1'        ORDER BY comment_date_gmt DESC         LIMIT 5";        $comments = $wpdb->get_results($sql);        $output .= '
Latest student perspectives

';        foreach ($comments as $comment) {         $output .= '
'. $comment->comment_author . ' said : "' . strip_tags($comment->com_excerpt). '..."
';        }      $output .= '
';        echo $output;       }//end function


How can I organize/create an archive listing by Year and month

I thought this would be simpler using the basic widgets that WP provides but its not. I need to create   * 2012      * Decemeber     * November     * ...   * 2011      * December     * ... The month items would be links to that archive. Is this possible? I would prefer not to use a plugin but if thats the answer its ok.


Custom Post Type - List all attachments on Edit Screen

I'm currently building a custom post type in Wordpress and I need to be able to list all attachments inside the edit screen. I know how to do this on the front-end template, but anyone know the code to use or can be placed in the functions.php page for the custom post type? Essentially, what I'm trying to do is list all attachments in a checkbox list, then allow the editor to select them to associate with a custom field. Thanks! Troy


Search Form Based On Tutorial Not Working

Ive based this on the twenty twelve theme, and copied a tutorial and built the following searchbox:-
<?php          printf(              __( 'Search Results for: %s', 'PCDConsulting' ),              '' . get_search_query() . ''          );          ?>
                    <?php /* Start the Loop */      if ( have_posts() )     {         while ( have_posts() )         {             the_post();              get_template_part( 'content', get_post_format() );          }     }     else     {     ?>

<?php _e( 'Nothing Found', 'PCDConsulting' ); ?>

<?php                  _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.',                      'PCDConsulting'                  );                  ?>

     <?php     }      This is also my searchform:               <form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">                    <form id="searchform" method="get" action="<?php bloginfo('template_url'); ?>/MilkNHny/search.php">                         <input type="text" name="s" value="Search PCD" onblur="if(this.value == ''){ this.value = 'Search PCD'; this.style.color = '#BBB';}" onfocus="if(this.value == 'Search PCD'){ this.value = '';                this.style.color = '#000';}" style="color:#BBB;" placeholder="" /><input type="submit" value="Search" />                     </form>      Its not actually returning anything, please can someone advise if i have missed something? www.milknhny.co.uk/SofiaWork Thanks in advance Kirsty _**EDIT_** I copied both the search and results from the twentyeleven theme and i cant understand why its still not working :S               <?php get_header(); ?>     <?php get_sidebar('slider'); ?>

<?php echo get_the_title(); ?>
            <?php if ( have_posts() ) : ?>     <div class="maincontentwrap" id="post-<?php the_ID(); ?>">
<?php printf( __( 'Search Results for: %s', 'PCDConsulting' ), '' . get_search_query() . '' ); ?>
                                         <?php /* Start the Loop */ ?>             <?php while ( have_posts() ) : the_post(); ?>                 <?php get_template_part( 'content', get_post_format() ); ?>             <?php endwhile; ?>                        <?php else : ?>

<?php _e( 'Nothing Found', 'PCDConsulting' ); ?>

<?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'PCDConsulting' ); ?>
                     <?php get_search_form(); ?>

              <?php endif; ?>
      Is there something im seriously missing here????


WordPress | WP_Query does not return anything with s=a

I have the following code:               $data = new WP_Query('s=a');      and the print_r returns the following data:               WP_Query Object     (         [query_vars] => Array             (                 [s] => a                 [error] =>                  [m] => 0                 [p] => 0                 [post_parent] =>                  [subpost] =>                  [subpost_id] =>                  [attachment] =>                  [attachment_id] => 0                 [name] =>                  [static] =>                  [pagename] =>                  [page_id] => 0                 [second] =>                  [minute] =>                  [hour] =>                  [day] => 0                 [monthnum] => 0                 [year] => 0                 [w] => 0                 [category_name] =>                  [tag] =>                  [cat] =>                  [tag_id] =>                  [author_name] =>                  [feed] =>                  [tb] =>                  [paged] => 0                 [comments_popup] =>                  [meta_key] =>                  [meta_value] =>                  [preview] =>                  [sentence] =>                  [fields] =>                  [menu_order] =>                  [category__in] => Array                     (                     )                      [category__not_in] => Array                     (                     )                      [category__and] => Array                     (                     )                      [post__in] => Array                     (                     )                      [post__not_in] => Array                     (                     )                      [tag__in] => Array                     (                     )                      [tag__not_in] => Array                     (                     )                      [tag__and] => Array                     (                     )                      [tag_slug__in] => Array                     (                     )                      [tag_slug__and] => Array                     (                     )                      [ignore_sticky_posts] =>                  [suppress_filters] =>                  [cache_results] => 1                 [update_post_term_cache] => 1                 [update_post_meta_cache] => 1                 [post_type] => any                 [posts_per_page] => 10                 [nopaging] =>                  [comments_per_page] => 50                 [no_found_rows] =>                  [search_terms] => Array                     (                         [0] => a                     )                      [order] => DESC             )              [tax_query] => WP_Tax_Query Object             (                 [queries] => Array                     (                     )                      [relation] => AND             )              [meta_query] => WP_Meta_Query Object             (                 [queries] => Array                     (                     )                      [relation] =>              )              [post_count] => 0         [current_post] => -1         [in_the_loop] =>          [comment_count] => 0         [current_comment] => -1         [found_posts] => 0         [max_num_pages] => 0         [max_num_comment_pages] => 0         [is_single] =>          [is_preview] =>          [is_page] =>          [is_archive] =>          [is_date] =>          [is_year] =>          [is_month] =>          [is_day] =>          [is_time] =>          [is_author] =>          [is_category] =>          [is_tag] =>          [is_tax] =>          [is_search] => 1         [is_feed] =>          [is_comment_feed] =>          [is_trackback] =>          [is_home] =>          [is_404] =>          [is_comments_popup] =>          [is_paged] =>          [is_admin] =>          [is_attachment] =>          [is_singular] =>          [is_robots] =>          [is_posts_page] =>          [is_post_type_archive] =>          [query_vars_hash] => 1015947de489d0153582586bded7c016         [query_vars_changed] =>          [thumbnails_cached] =>          [query] => Array             (                 [s] => a             )              [request] => SELECT * FROM wp_posts WHERE 1=2         [posts] => Array             (             )          )      What is wrong with this query and does not return any data ? Also take a look at the "request" where it is `SELECT * FROM wp_posts WHERE 1=2`


field of metabox is not visisible outside the function

I have a metabox with two static fields and one more field I add in `ingredients_show_box` function. All three fields are visible by `$_POST` when I save data. But the two static fields are visible by metabox and I can update data via `foreach`, and third is not visible. It's not suitable as I would like to add a variable number of fields with unique field names for each post.               $food_box = array(     'id' => 'foodbox',     'title' => __('Ingredients details','splus'),     'page' => 'recipes',     'context' => 'normal',     'priority' => 'high',     'fields' => array(         array(             'name' => __('Ingredients','splus'),             'desc' => __('List all the ingredients','splus'),             'id' => 'tingred',             'type' => 'text',             'std' => ''         ),         array(             'name' => __('Tips','splus'),             'desc' => __('Tips for this recipe','splus'),             'id' => 'ttips',             'type' => 'text',             'std' => '1'         )     ));          add_action('admin_menu', 'mytheme_add_box');  // Add meta box     function mytheme_add_box() {     global $meta_box, $food_box;     add_meta_box($food_box['id'], $food_box['title'], 'ingredients_show_box', $food_box['page'], $food_box['context'], $food_box['priority']);}          function ingredients_show_box() {     global $food_box, $post, $arr;     echo '<input type="hidden" name="food_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />'; // Use nonce for verification          echo '
';     $arr = array ( 'name' => 'n11',          'desc' => 'n11',          'id' => 'n11',         'type' => 'text',        'std' => '464');          $food_box['fields'][] = $arr; // insert additional field          foreach ($food_box['fields'] as $field) {         // get current post meta data         $meta = get_post_meta($post->ID, $field['id'], true);         // populating the fields here     }     echo '
';}          add_action('save_post', 'mytheme_save_data');   // Save recipe post from meta box                    function mytheme_save_data($post_id) {     global $meta_box, $food_box;     global $wpdb;     //die( var_dump( $_POST, $_GET, $_REQUEST ) );          // UNFORTUNATELLY $foodbox does not include filed 'n11'     foreach ($food_box['fields'] as $field) {         $old = get_post_meta($post_id, $field['id'], true);         $new = $_POST[$field['id']];              if ($new && $new != $old) {             update_post_meta($post_id, $field['id'], $new);         } elseif ('' == $new && $old) {             delete_post_meta($post_id, $field['id'], $old);         }     }     $new = $_POST['n11']; // workaround and not suitable: $_POST has this field     update_post_meta($post_id, 'n11', $new);     }


Cannot access WP admin because plugin returns 204

I recently installed a plugin on my schools wordpress site that one of my friends wrote, that should pull the newest video from a youtube page and post it. If the video hasn't changed, he set up the plugin to return a `HTTP/1.0 204` code. However, this seems to have rendered the wp-admin unavailable, as when I try to access it, it seems the plugins are also loaded, and so I get a `204` header when I try to access the admin panel. Is there any way to circumvent the plugins loading or something similar so I can access the wp-admin panel to disable the plugin, or will I have to use phpMyAdmin to go in and manually disable all installed plugins in the `wp_options` table?


Using common slider in all sites

I have created one main site and 100 multi-sites. But, I am facing one issue. I want to use a common slider for all sites, meaning that I can control and edit from main site. How to update something on one site and relect the changes on all sites?


enqueue_script doesn't work with HTML5 blank theme

I am trying to enqueue a couple of js files using something like this code:               function scripts_function()      {         wp_register_script('mapbox', 'http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.js');         wp_enqueue_script('mapbox');              wp_register_script('myscript', plugins_url( 'my-js-file.js' , __FILE__ ));         wp_enqueue_script('myscript');     }     add_action('wp_enqueue_scripts', 'scripts_function');      And this works fine, as long as i use the "twentytwelve" theme wich i used while creating this plugin I' working on. But now I want to implement it on the HTML5 blank theme wich i was thinking about using as a startpoint for my theme, but then this just stops working, doesnt enqueue my `my-js-file.js`, but the mapbox script hosted on cdnjs is included just fine. If i inspect the code in the browser, i can see that where the script tag for my js-file should be there is just a script tag with a src attribute without a value:               <script type="text/javascript" src></script>      If i do `print_r(plugins_url( 'my-js-file.js' , __FILE__ ));`, I get a path to my js file wich I can paste into the browser and that works fine. What is going on here?


Can this navigation be done easily in WordPress?

Can anyone please let me know if a dual navigation style is easily achievable or not possible. A WordPress developer I'm in touch with is telling me it's not. Basically, we would like the navigation to be via links at the top of the web page but also introduce a sub-navigation on the left side of the page. So if you were on the HOME section, you'd have 3 tabs on the left, breaking HOME down into 3 sub parts. If you clicked on another top link and went to section XYZ, the tabs on the left would vary to offer sub-sections of XYZ. I know it can obviously be done from a HTML point of view but the guy is saying it's not possible to do this and at the same time, keep the content editable within WordPress as Pages etc. I would like all the main pages and their sub content editable via WordPress CMS. Possible? Thanks ps: I would have added an attachment but not allowed as I'm a new user.


Strip a word from wp_list_categories

With the following code I am showing a list of sub categories:               <ul class="subcats-blog">              <?php             if ( is_category() ) {                 $current_cat = get_query_var('cat');                         wp_list_categories('&title_li=&child_of='.$current_cat);             }         ?>     </ul>      What I am trying to do is to strip the word 'news' from any list item. I figured that I can do it by the use of preg_replace, but the problem is my knowledge of php is very limited, and I'm not able to glue the two together. Any help would be greatly appreciated.


Custom tabs widget don't work in google chrome, is blocked, do not change the tabs. Why?

Code is the problem or is a Google Chrome issue? **Here is the code:**               /*-----------------------------------------------------------------------------------*/     /*  Create the widget     /*-----------------------------------------------------------------------------------*/     add_action('widgets_init', 'bd_post_types_init');          function bd_post_types_init(){              register_widget('bd_post_types_widget');          }          /*-----------------------------------------------------------------------------------*/     /*  Widget class     /*-----------------------------------------------------------------------------------*/     class bd_post_types_widget extends WP_Widget {                   /*-----------------------------------------------------------------------------------*/         /*  Widget Setup         /*-----------------------------------------------------------------------------------*/         function bd_post_types_widget(){                  // Widget settings             $ops = array('classname' => 'post-types-widget', 'description' => __('Display any post type: recent or popular, as text link or thumbnail', THEME_NAME) );                  // Create the widget             $this->WP_Widget('post-types-widget', 'Post Types (All in one)', $ops);              }              /*-----------------------------------------------------------------------------------*/         /*  Display Widget         /*-----------------------------------------------------------------------------------*/         function widget($args, $instance){                  extract($args);                  $title = apply_filters('widget_title', $instance['title']);             $count = $instance['count'];                  echo $before_widget;             if (!empty($title)) echo $before_title . $title . $after_title;             bd_post_types_widget($count, $instance['post-type'], $instance['type'], $instance['display'], $instance['category']);             echo $after_widget;              }              /*-----------------------------------------------------------------------------------*/         /*  Update Widget         /*-----------------------------------------------------------------------------------*/         function update($new_instance, $old_instance){             $instance = $old_instance;                  $instance['title'] = $new_instance['title'];             $instance['count'] = $new_instance['count'];             $instance['type'] = $new_instance['type'];             $instance['post-type'] = $new_instance['post-type'];             $instance['display'] = $new_instance['display'];             $instance['category'] = $new_instance['category'];                  return $instance;         }              /*-----------------------------------------------------------------------------------*/         /*  Displays the widget settings controls on the widget panel         /*-----------------------------------------------------------------------------------*/         function form($instance){             global $BD_theme;                 // Set up some default widget settings                 $defaults = array('title' => 'Recent Post', 'post-type' => '', 'count' =>'5', 'type' => 'thumbnail', 'display' => 'recent', 'category' => 'all');                 $instance = wp_parse_args((array) $instance, $defaults);                      $post_types = '';                 if(isset($BD_theme->options['post-types']) && is_array($BD_theme->options['post-types']))                     $post_types = $BD_theme->options['post-types'];                  ?>
                 <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', THEME_NAME); ?>:                 <input class="widefat" type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>">

                 <label for="<?php echo $this->get_field_id('post-type'); ?>"><?php _e('Post Type', THEME_NAME ); ?>:
                 <select class="bd-cat-select" name="<?php echo $this->get_field_name('post-type'); ?>" id="<?php echo $this->get_field_id('post-type'); ?>">                     <option value="post" <?php if($instance['post-type']=='post') echo 'selected="selected"'; ?>>Post</option>                 <?php foreach($post_types as $k => $v):                      $name = $k;                               if(isset($v['name']))                         $name = $v['name'].'s';                          if(isset($v['menu-name']))                         $name = $v['menu-name'];                 ?>                     <option value="<?php echo $k; ?>" <?php if($instance['post-type']==$k) echo 'selected="selected"'; ?>><?php echo $name; ?></option>                 <?php endforeach ; ?>                      </select>

                 <label for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category (if post is selected)', THEME_NAME ); ?>:
                 <select  name="<?php echo $this->get_field_name('category'); ?>" id="<?php echo $this->get_field_id('category'); ?>">                     <?php                      $bd_categories = get_categories();                     $bd_categories_tab = array();                     foreach($bd_categories as $category){                         $bd_categories_tab['all'] = 'All';                         $bd_categories_tab[$category->cat_ID] = $category->name;                     }                           foreach($bd_categories_tab as $k => $v):?>                          <option value="<?php echo $k; ?>" <?php if($instance['category']==$k) echo 'selected="selected"'; ?>><?php echo $v; ?></option>                     <?php endforeach; ?>                           </select>                 <?php //debug($bd_categories_tab); ?>

                 <label for="<?php echo $this->get_field_id('display'); ?>"><?php _e('Display', THEME_NAME ); ?>:
                 <select name="<?php echo $this->get_field_name('display'); ?>" id="<?php echo $this->get_field_id('display'); ?>">                     <option <?php if($instance['display']=='recent') echo 'selected="selected"'; ?>><?php _e('recent', THEME_NAME ); ?></option>                     <option <?php if($instance['display']=='featured') echo 'selected="selected"'; ?>><?php _e('featured', THEME_NAME ); ?></option>                     <option <?php if($instance['display']=='popular') echo 'selected="selected"'; ?>><?php _e('popular', THEME_NAME ); ?></option>                 </select>

                 <label for="<?php echo $this->get_field_id('count'); ?>"><?php _e('Number of post', THEME_NAME ); ?>:                 <input class="widefat" type="text" id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" value="<?php echo $instance['count']; ?>">

                 <label for="<?php echo $this->get_field_id('type'); ?>"><?php _e('Type' ,THEME_NAME ); ?>:                 <select name="<?php echo $this->get_field_name('type'); ?>" id="<?php echo $this->get_field_id('type'); ?>">                     <option <?php if($instance['type']=='thumbnail') echo 'selected="selected"'; ?>><?php _e('thumbnail', THEME_NAME ); ?></option>                     <option <?php if($instance['type']=='text') echo 'selected="selected"'; ?>><?php _e('text', THEME_NAME ); ?></option>                     <?php if($BD_theme->options['video'] != array()): ?>                     <option <?php if($instance['type']=='video') echo 'selected="selected"'; ?> value="video"><?php _e('video (only for video post types)', THEME_NAME ); ?></option>                     <?php endif; ?>                      </select>
             <?php         }                    }              /*-----------------------------------------------------------------------------------*/         /*  Function         /*-----------------------------------------------------------------------------------*/         function bd_post_types_widget($count=5, $post_type, $type, $display, $category){             global $wpdb, $BD_theme, $post, $bd_ID;             $do_not_duplicate = array();             if(is_single())                 //echo $bd_ID;                 $do_not_duplicate[] = $bd_ID;                  $is_video = (in_array($post_type, $BD_theme->options['video'])) && ($post_type!='post');                  //$do_not_duplicate[] = $post->ID;             if($type!='text'){                 if($display=='recent'){                     $args = array(                          'post_type' => array($post_type) ,                         'posts_per_page' => $count,                         'meta_key'    => '_thumbnail_id',                         'post__not_in' => $do_not_duplicate                         );                      }elseif($display=='featured'){                     $args = array(                      'post_type' => array($post_type) ,                     'orderby' => 'post_date',                     'meta_key'    => '_thumbnail_id',                     'posts_per_page' => $count,                     'post__not_in' => $do_not_duplicate,                     'meta_query' => array(                                              array(                                                   'key'     => 'bd_featured',                                                   'value'   => 'on',                                                   'compare' => '='                                                   )                                              )                     );                      }elseif($display=='popular'){                          $args = array(                      'post_type' => array($post_type) ,                     'orderby' => 'comment_count',                     'meta_key'    => '_thumbnail_id',                     'order'    => 'DESC',                     'posts_per_page' => $count,                     'post__not_in' => $do_not_duplicate,                     );                 }             }else{                      if($display=='recent'){                     $args = array(                          'post_type' => array($post_type) ,                         'posts_per_page' => $count,                         'post__not_in' => $do_not_duplicate                              );                      }elseif($display=='featured'){                     $args = array(                      'post_type' => array($post_type) ,                     'orderby' => 'post_date',                     'posts_per_page' => $count,                     'post__not_in' => $do_not_duplicate,                     'meta_query' => array(                                              array(                                                   'key'     => 'bd_featured',                                                   'value'   => 'on',                                                   'compare' => '='                                                   )                                              )                     );                      }elseif($display=='popular'){                          $args = array(                      'post_type' => array($post_type) ,                     'orderby' => 'comment_count',                     'order'    => 'DESC',                     'posts_per_page' => $count,                     'post__not_in' => $do_not_duplicate,                     );                 }                  }                  if($post_type == 'post' && $category!='all'){                 $args['category__in'] = $category;             }                  $loop = new WP_Query($args);             if ( $type=='text'){                 echo "
";             }elseif ( $type=='thumbnail' || $type=='video'){                 echo '
';             }             while ($loop->have_posts()) : $loop->the_post();             ?>             <?php if ( $type=='video'): ?>                 <?php if($is_video): ?>

                             <?php echo get_post_meta($post->ID, '_format_video_embed', true); ?>
                         <a href="<?php the_permalink(); ?>" title="<?php _e('Permanent Link to', THEME_NAME); ?> <?php the_title(); ?>"><?php the_title(); ?>
                         <?php echo get_the_time('F d, 20y'); ?>
                      <?php else: ?>
                         <a href="<?php the_permalink(); ?>" class="widget-thumb-link">                             <?php the_post_thumbnail('mini', array('class' => 'frame', 'title' => "")); ?>                                                  <a href="<?php the_permalink(); ?>" title="<?php _e('Permanent Link to', THEME_NAME); ?> <?php the_title(); ?>"><?php the_title(); ?>
                         <?php echo get_the_time('F d, 20y'); ?>
                         <?php bd_comment_number(); ?>                         <?php if( get_post_meta($post->ID, 'bd_rating', true)!=''): ?>
                         <span class="small-star-<?php echo str_replace('.5', '-5', get_post_meta($post->ID, 'bd_rating', true)); ?>">                         <?php endif; ?>

                      <?php endif; ?>                      <?php elseif ( ($type=='thumbnail') ): ?>                     <?php if($is_video): ?>

                                 <a class="video-thumbnail-link" href="<?php the_permalink(); ?>">                                     <?php the_post_thumbnail('video-thumbnail-img', array('class' => '')); ?>                                                                                <a href="<?php the_permalink(); ?>" title="<?php _e('Permanent Link to', THEME_NAME); ?> <?php the_title(); ?>"><?php the_title(); ?>
                                 <?php echo get_the_time('F d, 20y'); ?>
                                 <?php bd_comment_number(); ?>

                          <?php else: ?>
                             <a href="<?php the_permalink(); ?>" class="widget-thumb-link">                                 <?php the_post_thumbnail('mini', array('class' => 'frame effect', 'title' => "")); ?>                                                          <a href="<?php the_permalink(); ?>" title="<?php _e('Permanent Link to', THEME_NAME); ?> <?php the_title(); ?>"><?php the_title(); ?>
                             <?php echo get_the_time('F d, 20y'); ?>
                             <?php bd_comment_number(); ?>                                  <?php if( get_post_meta($post->ID, 'bd_rating', true)!=''): ?>
                             <span class="small-star-<?php echo str_replace('.5', '-5', get_post_meta($post->ID, 'bd_rating', true)); ?>">                             <?php endif; ?>

                      <?php endif; ?>

                      <?php else: // if text ?>
                     <a href="<?php the_permalink(); ?>" class="hover">                         <?php echo get_the_title(); ?>
                 <?php endif; ?>              <?php             endwhile;             if ( $type=='text'){                 echo "
";             }else{                 echo '
';             }             ?>

<?php         }


PHP time function ($today) for GMT +1

I tried a lot - But the code at the bottom is always 1 hour behind the local time. It might be a problem of the server-time. But I want to use it for a german website - So I have to set the time to GMT +1. It would be great if someone could help me...                   <?php      $today = date('N');     if( $today == 1) { ?>

<?php dynamic_sidebar( 'countdown' ); ?>

     <?php } elseif( $today == 2 ) { ?>

<?php dynamic_sidebar( 'seitenleiste' ); ?>

     <?php } elseif( $today == 3 ) { ?>

<?php dynamic_sidebar( 'seitenleiste' ); ?>

     <?php } elseif( $today == 4 ) { ?>

<?php dynamic_sidebar( 'seitenleiste' ); ?>

     <?php } elseif( $today == 5 ) { ?>

<?php dynamic_sidebar( 'seitenleiste' ); ?>

     <?php } elseif( $today == 6 ) { ?>

<?php dynamic_sidebar( 'seitenleiste' ); ?>

     <?php } elseif( $today == 7 ) { ?>

<?php dynamic_sidebar( 'seitenleiste' ); ?>

     <?php } ?>      Thank you so much! Philipp


How to get option values set from all sites within a Multisite setup?

I created a plugin that is used on every site within my Multisite setup. Within this plugin I have an admin setting page that allows each site to set the options according to the sites needs. Each site saves its data with the `add_option()` function. How do I query all the custom options values from all the sites on the Multisite? I need to collect the values and then store them into an array. Once in an array I will be using it to check another value with the array to see if it exist within the array of option values from all the sites. How to find all the values of the custom options?


Help on multiple meta_query

I am trying to fetch from the WP database posts with two meta_key values, but the result is `0` posts. Print out of the arguments:               Array (          [taxonomy] => cardstax          [term] => christmas          [post_type] => cards          [paged] => 1          [caller_get_posts] => 1          [meta_query] => Array (              [relation] => AND              [0] => Array (                 [key] => card_format[value] => Little card              )             [1] => Array (                  [key] => price_lvl                  [value] => Array (                      [0] => 0.06                      [1] => 0.97                      )                  [type] => NUMERIC                  [compare] => BETWEEN                  )              )          )      The Meta query itself               'taxonomy' => $term->taxonomy,     'term' => $term->slug,     'post_type' => 'cards',     'paged'=> $paged,     'caller_get_posts'=> 1,         'meta_query' => array(         'relation' => 'AND',         array(             'key'     => 'card_format',             'value'   => 'Little card'         ),         array(             'key'     => 'price_lvl',             'value'   => array( "0.06","0.97" ),             'type'    => 'NUMERIC',             'compare' => 'BETWEEN'             )         ),      The SQL syntax:               SELECT SQL_CALC_FOUND_ROWS plt_posts.ID     FROM plt_posts     INNER JOIN plt_term_relationships ON ( plt_posts.ID = plt_term_relationships.object_id )      INNER JOIN plt_postmeta ON ( plt_posts.ID = plt_postmeta.post_id )      INNER JOIN plt_postmeta AS mt1 ON ( plt_posts.ID = mt1.post_id )      JOIN plt_icl_translations t ON plt_posts.ID = t.element_id         AND t.element_type =  'post_cards'     JOIN plt_icl_languages l ON t.language_code = l.code         AND l.active =1     WHERE 1 =1         AND ( plt_term_relationships.term_taxonomy_id IN ( 27 ) )         AND plt_posts.post_type =  'cards'         AND (             plt_posts.post_status =  'publish'             OR plt_posts.post_status =  'private'         )         AND (             (             plt_postmeta.meta_key =  'card_format'             AND CAST( plt_postmeta.meta_value AS CHAR ) =  'Little card'         )         AND (             mt1.meta_key =  'price_lvl'             AND CAST( mt1.meta_value AS SIGNED )                  BETWEEN  '0.06'                 AND  '0.97'             )         )         AND t.language_code =  'lv'     GROUP BY plt_posts.ID     ORDER BY plt_posts.post_date DESC      LIMIT 0 , 12      Without that part               AND (         mt1.meta_key =  'price_lvl'         AND CAST( mt1.meta_value AS SIGNED )              BETWEEN  '0.06'             AND  '0.97'         )      The query works fine and I get a list of post IDs.


Different domains per custom post type or taxonomy

I'm trying to create 3 sites in one wp-admin basically, but they all have different domains and can cross reference each other (to form relationships via taxonomies, etc).   * http://test.org   * http://testlobby.org   * http://testarchive.org Each site has it's own distinct post types, but they share taxonomies, share media, etc, so I was thinking of making a custom taxonomy for the site it belongs to. Is it possible to use different domains per taxonomy? So if I had a custom taxonomy called "Site", and three terms, "test", "testlobby" and "testarchive", could I make all posts/pages/custom post type posts that have a certain taxonomy show up on the respective domains for each term? Is there a better way to handle this if I want to cross polinate this much data?


Cannot Save MetaBox Data in Custom Post Type

I've been working on this issue for quite a while and am truly stumped. Below is all of the code for my custom post type:               /* Services Post Type */          function services_post_type() {     $labels = array(     'name' => _x( 'Services', 'service' ),     'singular_name' => _x( 'Service', 'service' ),     'add_new' => _x( 'Add New', 'service' ),     'add_new_item' => _x( 'Add New Service', 'service' ),     'edit_item' => _x( 'Edit Service', 'service' ),     'new_item' => _x( 'New Service', 'service' ),     'view_item' => _x( 'View Service', 'service' ),     'search_items' => _x( 'Search Services', 'service' ),     'not_found' => _x( 'No services found', 'service' ),     'not_found_in_trash' => _x( 'No services found in Trash', 'service' ),     'parent_item_colon' => _x( 'Parent Service:', 'service' ),     'menu_name' => _x( 'Services', 'service' ),     );     $args = array(     'labels' => $labels,     'hierarchical' => false,     'supports' => array( 'title', 'editor' ),     'taxonomies' => array( 'category' ),     'public' => true,     'show_ui' => true,     'show_in_menu' => true,     'show_in_nav_menus' => true,     'publicly_queryable' => true,     'exclude_from_search' => false,     'has_archive' => true,     'query_var' => true,     'can_export' => true,     'rewrite' => true,     'capability_type' => 'post'     );     register_post_type( 'service', $args );     }      add_action( 'init', 'services_post_type' );          /*      * Custom meta boxes      */          add_action( 'add_meta_boxes', 'create_meta_boxes' );          function create_meta_boxes() {     add_meta_box( 'my-meta-box-id', __('Service Price'), 'meta_box_info', 'service', 'normal', 'low' );     }               // Create meta box: Service Price          function meta_box_info( $post ) {          $values = get_post_custom( $post->ID );          wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );     ?>          <?php $text = get_post_meta($post->ID, 'meta_box_info', true); ?>
Price: <input type="text" name="meta_box_info" id="meta_box_info" size="25" />
          <?php        }          // Save meta box: Service Price          function save_my_metadata($ID = false, $post = false)     {     if($post->post_type != 'service')         return;     update_post_meta($ID, 'my_metadata', $_POST['my_metadata']);     }


Pages: frontpage.php, home.php, posts page etc

When do I use the following:   * home.php   * frontpage.php   * Under Settings > Reading Settings      * Front Page     * Posts Page I wish to clarify this as I find myself using "Placeholder Pages", empty pages just for the sake of a menu item and to display blog listings. If I use a Static Front Page (Set under Settings > Reading Settings > Front Page) how do I access my posts page? Do I need to have a "Placeholder Page" titled blog and use `page-blog.php`?


Display posts from Last 24 hours and order them based on most views

I am trying to display the posts of last 24 hours and order them by most views. I call the most views by this code:               query_posts('meta_key=post_views_count&orderby=meta_value_num&posts_per_page=7');     if (have_posts()) :         while (have_posts()) :             the_post();?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
         <?php endwhile;     endif;     wp_reset_query();      How can I add filter or query to show the most views post (new posts) of last 24 hours? Update: Here is my post view count code:               // function to count post views.     function setPostViews($postID) {         $count_key = 'views';         $count = get_post_meta($postID, $count_key, true);         if($count==''){             $count = 0;             delete_post_meta($postID, $count_key);             add_post_meta($postID, $count_key, '0');         }else{             $count++;             update_post_meta($postID, $count_key, $count);         }     }     // function to display number of post views.     function the_views($postID){         $count_key = 'views';         $count = get_post_meta($postID, $count_key, true);         if($count==''){             delete_post_meta($postID, $count_key);             add_post_meta($postID, $count_key, '0');             return "0 View";         }         return $count.' à¦¬à¦¾à¦°';     }


wp_enqueue_script isn't connecting my custom js file

I am using wp_enqeue_script to link to a custom.js file in my plugins folder. However I am expecting a link to show up on the page but it doesn't is there something else I am supposed to other than place this in the header.               <?php wp_enqueue_script('myscript', '/wp-content/plugins/myplugin/myscript.js'); ?>


How to install Lavalamp jQuery effect in wordpress

> **Possible Duplicate:**   >  wp_enqueue_script isn't connecting my custom js file I am having a heck of a time getting this Lavalamp effect to work on my main menu/navigation. Here is what I have placed in the head tags:               <script language=""javascript"" type=""text/javascript"src="wp-content/themes/metric /scripts/jquery-1.4.1.min.js"></script>     <link rel="stylesheet" href="wp-content/themes/metric/lavalamp.css" type="text/css" media="screen" />     <script type=""text/javascript"" src="wp-content/themes/metric/scripts/jquery.easing.min.js"></script>     <script type=""text/javascript"" src="wp-content/themes/metric/scripts/jquery.lavalamp.min.js"></script>          <!-- this script initiates the function change the #nav to your unordered list's ID -->     <script type=""text/javascript"">     $(function() {     $("#nav").lavaLamp({     fx: "backout",     speed: 700,     click: function(event, menuItem) {     return true;     }     });     });     </script>      I have made sure that my ID is the same as listed above in the code #nav. However, it isn't working and i've hit a brick wall after trying a few different combinations. Any help you guys could give would be much appreciated!! :)


restrict_manage_posts not working in 3.3.1

I have noticed my custom taxonomy filters no longer work in the 3.3.1 admin as per these methods: Adding a Taxonomy Filter to Admin List for a Custom Post Type? I also discovered that to filter a taxonomy the query string requires both the `&taxonomy=whatever` and `&term=something` to be passed. Anyone have any experience in this, and solutions to offer? Here's some code from the question as an example:               add_action('restrict_manage_posts','restrict_listings_by_business');     function restrict_listings_by_business() {         global $typenow;         global $wp_query;         if ($typenow=='listing') {             $taxonomy = 'business';             $business_taxonomy = get_taxonomy($taxonomy);             wp_dropdown_categories(array(                 'show_option_all' =>  __("Show All {$business_taxonomy->label}"),                 'taxonomy'        =>  $taxonomy,                 'name'            =>  'business',                 'orderby'         =>  'name',                 'selected'        =>  $wp_query->query['term'],                 'hierarchical'    =>  true,                 'depth'           =>  3,                 'show_count'      =>  true, // Show # listings in parens                 'hide_empty'      =>  true, // Don't show businesses w/o listings             ));         }     }      and               add_filter('parse_query','convert_business_id_to_taxonomy_term_in_query');     function convert_business_id_to_taxonomy_term_in_query($query) {         global $pagenow;         $qv = &$query->query_vars;         if ($pagenow=='edit.php' &&                 isset($qv['taxonomy']) && $qv['taxonomy']=='business' &&                 isset($qv['term']) && is_numeric($qv['term'])) {             $term = get_term_by('id',$qv['term'],'business');             $qv['term'] = $term->slug;         }     }


Widget: Custom Post Type Post Listing Dropdown on Admin Side

**Widget:** I'm making a custom widget with the following functionality on the admin side.   1. 3 text fields   2. 2 dropdown menus to select posts by title (both from a single custom post type) Right now, instead of a drop down, the user must input the post ID# into a text field. The widget uses the post ID to grab the right data from the right posts and display it nicely on the front end. I need to be able to have the admin select a post title from the dropdown, then have the widget store the selected post's ID# in a variable and save the information. **My Code So Far** This is just for the dropdown; what I've cobbled together from various examples I found around the web. I'd like to think I'm close, but I'm really stumped.               <?php     $selected = isset( $values['$bookid1'] ) ? esc_attr( $values['$bookid1'] ) : '';      global $post;     $args = array('post_type' => 'bookdetail','post_status' => 'publish');     $myposts = get_posts( $args );     echo '<select name="bookid1" id="bookid1">';     foreach( $myposts as $post ) :         setup_postdata($post);         $bookid1 = $post->ID;            $displaytitle = substr( get_the_title($post->ID), 0, 50);         echo '<option value="' . $bookid1 . '"' .  selected( $selected, $bookid1 ) .'>' . $displaytitle . '</option>';     endforeach;     echo '</select>';     ?>      So...   How do I store in `$bookid1` the post ID# of the post the admin user selects from the dropdown?   How do I save that variable and selection in the "save data" section of the widget code? I appreciate any help the community could provide.


Are there any drawbacks to install IntenseDebate on my blog?

I am currently using on my blog the default comment system with in addition only the "Quote Comments" plugin. I have seen IntenseDebate and it seems it has many interesting features that probably (and hope) will push the visitors to leave more comments. The pros are clear but do you see any drawbacks that should I take into account before decide to install or not IntenseDebate plugin on my blog?


How can I hide the sidebar on specific pages?

I'm using a child of the `twentyten` default theme and I want to hide the sidebar on some pages. What is the solution for that?


First three images in post excerpt

I have certain posts that are nothing but [gallery] with quite a few images in them. Is there a way to define an auto generated excerpt to only display the first three images for these posts on the index, so that users would have to click through to see the rest? Thank you.


How to add a new child category via an SQL statement?

I have a parent category named "Europe" under which I need to insert some 20+ child categories (France, Italy, Germany, etc.) What is the SQL statement I have to fire to add - for example - France to Europe(category ID=1)? This is 100% new blog, it has no posts, no custom fields, nothing.


Check if wp_nav_menu items have submenus

I'm looking to output the following markup for a menu through wp_nav_menu,

Home

                 Blog

Design

HTML

CSS

JavaScript

      The menu items may have submenus - if that's the case the top level link needs to be formatted as the example above. I've tried different solutions looking into the codex but without success. It seems I will need to create a walker for this unless I want to add a bunch of queries (running submenu loops inside a main loop). But since it's such a small change, wouldn't it be possible to add a filter hook onto the menu output instead?


How to Programically add to the new WordPress menus

Pre WordPress 3.x I was using:               add_action( 'init', 'product_register' );     add_filter( 'wp_page_menu', 'custom_page_nav', 90 );          function product_register()     {         //    register_post_type( 'product', $args );              register_taxonomy( "catalog", array( "product" ), array( "hierarchical" => true, "label" => "Catalogs",             "singular_label" => "Catalog", 'hierarchical' => true, 'show_ui' => true, 'show_in_nav_menus' => true,             'show_tagcloud' => true, 'query_var' => true, "rewrite" => true, 'public' => true, 'capability_type' => 'post' ) );         //'_builtin' => false,'_edit_link' => 'post.php?post=%d',         ////////////////////////////////////////////////          }          function custom_page_nav( $menu )     {         $taxonomy = 'catalog';         $orderby = 'name';         $show_count = 0; // 1 for yes, 0 for no         $pad_counts = 1; // 1 for yes, 0 for no         $hierarchical = true; // 1 for yes, 0 for no         $title = '';              $args = array( 'taxonomy' => $taxonomy, 'orderby' => $orderby, 'show_count' => $show_count, 'pad_counts' => $pad_counts,             'hierarchical' => $hierarchical, 'title_li' => false, 'echo' => false, 'empty' => true, 'hide_empty' => true,             'depth' => 0 );         $links .= wp_list_categories( $args );         //  $links .= wp_list_categories( array( 'title_li' => false, 'echo' => false, 'empty' => true ) );         $menu = str_replace( '', 'Prodcuts ' . $links . '     ', $menu );         //         return $menu;     }      How do I do the same thing with the New WordPress 3.x menus.   Using another post on here I was able to figure out how to make a new menu but not add the custom taxonomy items to it:               function register_typenav()     {         $mainnav = wp_get_nav_menu_object( 'Products' );              if ( ! $mainnav )         {             $menu_id = wp_create_nav_menu( 'Products' );             // vav item for each post type             $types = get_post_types( array( 'exclude_from_search' => false ), 'objects' );                  foreach ( $types as $type )             {                 if ( ! $type->_builtin )                 {                     wp_update_nav_menu_item( $menu_id, 0, array( 'menu-item-type' => 'custom', 'menu-item-title' => $type->                         labels->name, 'menu-item-url' => get_bloginfo( 'url' ) . '/' . $type->rewrite['slug'] . '/',                         'menu-item-status' => 'publish' ) );                 }             }             if ( $mainnav && ! has_nav_menu( 'primary-menu' ) )             {                 $theme = get_current_theme();                 $mods = get_option( "mods_$theme" );                 $key = key( $mods['nav_menu_locations'] );                 $mods['nav_menu_locations'][$key] = $mainnav->term_id;                 update_option( "mods_$theme", $mods );             }         }     }     add_action( 'init', 'register_typenav' );


How to add additional field in a table row after creating a table?

I used options for my plugins.But now i have changed to use own table.i created and using things good.Now i would like to add one field that gets value from user and add that much value as field.This is like adding field dynamically.Example in options table i used the below               for ($i = 1; $i <= get_option('opt_count'); $i++) {                 register_setting('register_op', 'option' . $i);             }      So if the user enter 3 in opt_count then i'll get 3 extra option by registering.Then i'll make use of the 3 fields. Same thing i want to do it in own table also.                   $sql = "CREATE TABLE $table_name (         id mediumint(9) NOT NULL AUTO_INCREMENT,         name VARCHAR(20) NOT NULL,         message text NOT NULL,         no_url VARCHAR(20) NOT NULL,         UNIQUE KEY id (id)          );";         require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );         dbDelta($sql);      Here when the user enter 3 in no_url option then i have to make 3 extra field where user can enter the 1st url in option one and 2nd url in option two going on.. How to do this.. I Think this is not easier as options method.Any idea will be helpful.


Disable Sharedaddy in Feeds

I am using Feedburner for my feeds and I am also using Sharedaddy from Jetpack to display the sharing icons. I'd like to disable these buttons in the feed, how can I do this? Thanks


Securing wp-config leads to sensitive information leak on wp-settings

I read the following tutorial, which mentions moving your config file out of an HTTP-accessible folder. http://codex.wordpress.org/Hardening_WordPress#Securing_wp-config.php I did this, and it works fine. And when I visit http://mysite.com/wp- config.php, I see a blank page, as expected. However, when I visit http://mysite.com/wp-settings.php, I receive the following error: > Warning: require(ABSPATHwp-includes/load.php) [function.require]: failed to > open stream: No such file or directory in /home/{my user > name}/mysite.com/wp-settings.php on line 19 > > Fatal error: require() [function.require]: Failed opening required > 'ABSPATHwp-includes/load.php' > (include_path='.:/usr/local/lib/php:/usr/local/php5/lib/pear') in /home/{my > user name}/mysite.com/wp-settings.php on line 19 I'm new to WordPress and PHP, but not new to programming. Obviously, having my shell user's name output to the web if someone were to hit my wp-settings file is a no-no. So, can you have your config file out of the web directory, as I have here, without files like wp-settings resulting in sensitive information leaked to the screen? Am I going about this all wrong?


How to delete the Hello Dolly plugin automatically?

I'm planing to create a plugin called Goodbye Dolly. Once installed, it will take care for the installation to remove the auto-installing Hello Dolly (Wordpress Plugin) shipping with wordpress. This is due to popular request. Some folks have asked for it. I like the idea. I never cared so far because I removed it manually. But I like the idea to save the hassles and have this removal automated for the future. I wanted to just delete the file when it exists basically. But I'm unsure a bit about file system abstraction. And I would like to do this on install / update already, so this does not needs to be checked for all the time. So which hooks are to be considered? Any best practice ideas? **Update:**   * Homepage: http://hakre.wordpress.com/plugins/goodbye-dolly/   * Repository: http://wordpress.org/extend/plugins/goodbye-dolly/


2.9 to 3.0: Pros and cons of upgrading?

I have a wordpress blog running 2.9. I haven't made many mosts yet. I am considering upgrading to Wordpress 3.0. What are the pros and cons of upgrading? Will 3.0 increase security? **Is there less or more plugin support with 3.0?**


Can two domains use the same database?

I want to change a current site that already has a fairly robust database. Before I do, I want to test a few different layouts to make a decision. Instead of using the original site, I am thinking of changing the test site wp-config file to call the database from the original site. Can I do this without "damaging" the original site? My rationale is that since the original site has custom post types, it would be easier to be able to use that database, rather than try to recreate it.


Why this query is not showing any result on wordpresss home page?

I am learning wordpress database, And I have written this query for showing the data from the post table with id=2, but not showing anything. What is wrong with the following query? please help.               global $wpdb;     $wpdb->show_errors();          $mypost=$wpdb->query($wpdb->prepare("SELECT post_content FROM $wpdb->wp_posts WHERE     ID=%d",2));          echo $mypost;


WordPress as XML-RPC client?

I want to sync post edits on two sites. Test environment, not production. Single direction (site A to site B, but not backwards). Basically I edit post at my local test stack and same post (part of test content set) at remote server should be updated with identical copy of resulting content. I know that XML-RPC server is implemented in WordPress... But WordPress itself is not a XML-RPC client and I have no idea how easy would it be to make it into one (I am usually wary of XML-anything :) So should I go with XML-RPC and implement client functionality or that is not worth the time and I should build custom form or something at remote server to catch changes?


Summary of Posts by an User

i have a buddypress blog at http://thelazy.info . When I click on a user his buddypress profile opens up. Can there be a summary of his posts in his buddy profile or directly that opening up when user clicks on the person's name besides his post.


Use 'medium' size with catch_that_image() function

I've this function, which I'm pretty sure a lot of you already know:               function catch_that_image() {       global $post, $posts;       $first_img = '';       ob_start();       ob_end_clean();       $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);       $first_img = $matches[1][0];            return $first_img;     }      I would like to use the thumb, medium, etc sizes in the posts loop. Do you guys have any idea how can I do this? Cheers


How to modify category.php to list posts alphabetically?

As the title says. Would be grateful for your help. Thank you.


Is [admin / admin] acceptable for all local websites?

Are there security issues with using the same credentials [admin / admin] for all client websites on a working, local server ?


Moving image attachment from post to another?

How to move image attachment from post to another (not to "Remove Permanently" and Re-Upload) ? I'm using WordPress 3.5.0 and I have a thousand images to process. Is there a built-in function for this ? or is there a WordPress plugin doing this ?


Search for pages with permalink

I'm searching for posts this way               $args = array(        'name' => $permalink,        'post_type' => 'page',        'post_status' => 'publish',        'posts_per_page' => 1     );     $posts = get_posts( $args );      This works great for "page1" and "foo/page2" when I put "page1" and "page2" respectively in `$permalink`. How can I craft a query to work for the case with where I want to search for "foo/page2"? **edit** i want to get the post object so that I can retrieve some data from it.


display certain category on custom template page

i duplicated a portfolio column page template ... On this page I want to show only one category , instead of all categories... I tried a lot, but couldn't get it worked... this is the original code to show all categories:

                  <?php                  query_posts( array( 'post_type' => 'ublalfieportfolio', 'posts_per_page' => -1) );                 if ( have_posts() ) : while ( have_posts() ) : the_post();                       global $post;                 $terms = get_the_terms($post->ID, 'ublalfieportfolio-categories');                 $taxclassadd = '';                 foreach($terms as $t){$taxclassadd .= ' ' . $t->slug;}                      $taxclass = 'thisportfolioitem twocol' . $taxclassadd; $str= ltrim ($taxclassadd,' ');             ?>                  <li <?php post_class($taxclass); ?> id="post-<?php the_ID(); ?>" data-category="<?php echo $str; ?>">
                          <?php if(has_post_thumbnail()) {                      $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full', false);                     if($thumbnail['1'] > 1024){$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large', false);} ?>                     <img src="<?php echo $thumbnail['0']; ?>" alt="<?php the_title(); ?>">                     <?php } ?>

<?php the_title(); ?>
                         <?php if($post->post_excerpt){$getcontent = get_the_excerpt();echo $getcontent;} ?>                         <a href="<?php the_permalink(); ?>"><?php _e('View Item','ublalfie'); ?>

                  <?php endwhile; endif; ?>

      for example I only want to show : the category-slug = "parketten" and ID = 3 I tried this:               <?php                query_posts( array( 'post_type' => 'ublalfieportfolio', 'category_name' => 'terrassen', 'posts_per_page' => -1) );               if ( have_posts() ) : while ( have_posts() ) : the_post();                     global $post;               $terms = get_the_terms($post->ID, 'parketten');               $taxclassadd = '';               foreach($terms as $t){$taxclassadd .= ' ' . $t->slug;}                    $taxclass = 'span4 portfolioitem text-center' . $taxclassadd; $str= ltrim ($taxclassadd,' ');           ?>      result : shows nothing               <?php                  query_posts( array( 'post_type' => 'ublalfieportfolio', 'category' => array(3), 'posts_per_page' => -1) );                 if ( have_posts() ) : while ( have_posts() ) : the_post();                       global $post;                 $terms = get_the_terms($post->ID, 'parketten');                 $taxclassadd = '';                 foreach($terms as $t){$taxclassadd .= ' ' . $t->slug;}                      $taxclass = 'span4 portfolioitem text-center' . $taxclassadd; $str= ltrim ($taxclassadd,' ');             ?>      result: shows all categories.. Can someone please give me a solution... thank you very much


"sufficient permissions" error for admin after duplicating WP database to new install

I recently copied the tables from a live WP install to a dev site for that same site. I've changed all the prefixes, the site/WP URLs, and the salt values. I can successfully log into the new dev site, but the admin account (not actually named admin) does not have admin privileges. Once I log in and am redirected to the dash, I get the `You do not have sufficient permissions to access this page.` error. I've verified through the usermeta table in the DB that admin account has `administrator capabilities` and I'm out of ideas. Any thoughts on what I might have missed in the table migrations?


Wordpress 3.1 - Tag page not showing posts from custom post type

On the site I am developing I have a few custom post types set up (Press Releases, Articles, Podcasts). I also have the Tag Cloud widget enabled in my sidebar. I have tagged a post with 'Testtest', and I've also tagged a Press Release with 'Testtest'. The problem I have is when I click the 'Testtest' tag on my tag cloud, it only shows the 'Post' that I tagged, and not the Press Release. Any idea why this would be, or a solution? Thanks!


Multisite subdomain-site redirects to primary site

So, here's the deal. I got one WP Multisite installed with 1 subsite. Im running the whole thing in subdomain "mode". I did the whole DNS-pointer (A *.domain.se) to the correct IP. Now the problem, even though i created a subsite in wp-admin (lets call it foobar), _when i type in foobar.domain.se i get redirected to the mainsite_ (domain.se). foobar.domain.se/wp-admin/ on the other hand casts a 404 error. Is it host related or something wrong in my config? More info, host got a shared IP - might be the problem (even though I got the impression it should work anyways)? I've searched like crazy on the web, in my htaccess and for hostsettings - and it should be the correct ones.               **.htaccess**     #BEGIN WordPress       RewriteEngine On       RewriteBase /       RewriteRule ^index\.php$ - [L]            #uploaded files     RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]            RewriteCond %{REQUEST_FILENAME} -f [OR]       RewriteCond %{REQUEST_FILENAME} -d       RewriteRule ^ - [L]       RewriteRule . index.php [L]       # END WordPress            **wp-config.php**         define('WP_ALLOW_MULTISITE', true);           define( 'MULTISITE', true );           define( 'SUBDOMAIN_INSTALL', true );           $base = '/';           define( 'DOMAIN_CURRENT_SITE', 'xn--vrnamo-bua.nu' );           define( 'PATH_CURRENT_SITE', '/' );           define( 'SITE_ID_CURRENT_SITE', 1 );           define( 'BLOG_ID_CURRENT_SITE', 1 );           define('SUNRISE', 'on');        _Thanks._


Identify that a page is a grandchild page

How do I identify that a page is a grandchild page?


Is there a plugin or something that allows you to use BuddyPress without having to create a BuddyPress-ready theme?

It's an inconvenience to have to customize your theme just to use BuddyPress. It'd be much nicer if it simply used the wordpress page system for example, to inject content into standard WP pages. This way no theme editing is necessary, just activate BP and go. The idea would be that BuddyPress would just work in TwentyTen with off the shelf wordpress install + BuddyPress. Is there a solution?


Is it possible to create an "export to PDF" option?

I have a custom post-type "model", and I want to be able to export certain values (eg Name, Height, Shoe Size, etc) and a set number of images from the gallery, from each Model to a PDF. Ultimately, what I want to be able to do is:   1. From the Admin backend, click an "options tab" or some such    2. select a number of Models,    3. enter an email (or multiple, comma separated emails)   4. Click a "send" button   5. and have the PDFs generated and emailed off without further intervention. Is this at all possible in WordPress? Or is this too complex? Surely you can do anything with PHP and WordPress ;)


Get All Images in Media Gallery?

Is there a way to fetch the URLs of **ALL** images in the media gallery? I think this would be an easy way for a website to have a Pictures page that just pulls all of the images from the media gallery, granted it would only be necessary in certain scenarios. I don't need instructions on how to create a Pictures page, just how to pull all of the image URLs. Thanks!


pre_get_posts for exclude category

This code works perfectly               function exclude_category( $query ) {         if ( $query->is_home() && $query->is_main_query() ) {             $query->set( 'cat', '-1' );         }     }     add_action( 'pre_get_posts', 'exclude_category' );      But this code does not work at all               $caid = "-1";     function exclude_category( $query ) {         if ( $query->is_home() && $query->is_main_query() ) {             $query->set( 'cat', $caid );         }     }     add_action( 'pre_get_posts', 'exclude_category' );


How to build or store lots of custom content

I'm setting up a new WordPress site and going forward we are going to be building a lot of custom interactions that will need to be stored within WordPress. When I say custom interactions I'm talking about having custom html structure inside of template html and will have custom HTML, CSS, JavaScript, and images that will be specific to that particular page/post. What I'm looking for is suggestions on how best to build these pages:   * A custom page/post template for every individual interaction   * Custom short codes for each interaction   * Something else? A couple of notes, the pages will need to be able access session data, these interactions are most likely going to only be used on a single page/post, and there are likely to eventually be hundreds of these interactions. The content of these interactions will be similar to Flash games but written in html and JavaScript. \--EDIT-- My specific question is how would I build pages and posts with custom interactive content that is specific to that page? Is there a best practice for pages that each have their own css, JavaScript, and html while maintaining an outer template?


Structuring function with registration_errors hook

I created a plugin that adds a function to the registration process where the user info also gets added to an external db. The problem is that, when the function runs successfully i.e. user is able to be added to the external db, but the wordpress registration process returns and error, the user is still added to the external db. How can I structure this so that if there's an error on the Wordpress side or the external side, the user sees and error and nothing is added to any db. Here's my code:                   function add_user_to_SF($errors, $sanitized_user_login, $user_email ) {         global $SF_USERNAME;         global $SF_PASSWORD;              try {           $mySforceConnection = new SforceEnterpriseClient();           $mySoapClient = $mySforceConnection->createConnection(CD_PLUGIN_PATH . 'Toolkit/soapclient/enterprise.wsdl.xml');           $mySFlogin = $mySforceConnection->login($SF_USERNAME, $SF_PASSWORD);                  $sObject = new stdclass();             $sObject->FirstName = $_POST['user_login'];             $sObject->LastName = $_POST['user_login'];             $sObject->Email = $_POST['user_email'];                  $createResponse = $mySforceConnection->create(array($sObject), 'Contact');                  $ids = array();                 foreach ($createResponse as $createResult) {                     array_push($ids, $createResult->id);                 }                      } catch (Exception $e) {                   //echo $mySforceConnection->getLastRequest();                   //echo $e->faultstring;                   $errors->add( 'demo_error', __('ERROR: There is a Salesforce problem.','mydomain') );                   return $errors;             }                   return $errors;         }              add_filter( 'registration_errors', 'add_user_to_SF', 10, 3 );


How to make theme configurable

I'm creating my first theme (actually a child theme of "twenty eleven") and am not sure how to best approach theme customization. Say that I want to have a RSS link in the sidebar shown or hidden based on some configuration, what's the best way to approach it? The most basic approach would be to go directly into the theme and comment / uncomment the related piece of HTML every time I want to change it but I think it would be best if the administrator of the site could just tick a checkbox somewhere and the theme would respond accordingly. How to code it?


How to Structure a New Role/Capability Scheme?

I have a situation where I need users to be flagged as "Instructors" on a site. That role should basically be whatever the user's current role is with the added capability to see comments from students on a custom post type called "Questions". I'm struggling with how to implement this conceptually. Should I just add a new capability and have it assigned by itself, or should I add it and assign it to a new role as well? [edit]From kaiser's resources, it appears I should just add the custom capability and assign it to users on an individual basis, perhaps from my own plugin's options/settings admin page, as opposed to creating a specific role[/edit] What happens if I change the user's role to something else (say from Admin to Editor) but still want them to have that capability? Is this a fairly easy thing to program in a custom plugin (which is where I'm doing all of this from), or is this going to be a monumental undertaking? [edit]So, I guess this is now my main question. What is the underlying logic when switching user roles from one to another? Do custom capabilities that were assigned carry over when switching user roles, or does the new role assignment overwrite anything else?[/edit]


Deleted plugins displays error message

I made the mistake of manually deleting plugin directories in the plugins folder and now I see error messages on the plugins admin page: > The plugin xyz.php has been deactivated due to an error: Plugin file does > not exist. Is there a way to get rid of this error message? Maybe it's a cache issue?


Custom styles.css sheet for visual editor

I am trying to use my own styles.css for inside the body of the visual editor for my pages. However, when i add               add_editor_style('styles.css');      to the functions.php page it doesnt change anything (font color, boldness, etc) inside the body of the visual editor. I use firebug and check to see if it even loaded the styles.css and i can not find that it has anywhere. What am i missing? Do i have to install tinyMCE for this to even work or does this work with the stock visual editor? Thanks, David


Publish pending article from front end with a button?

Is it possible to take the blue publish button in back end of the wordpress and place it in the frontend near the post in my index.php. I need a way to publish the pending article without going to dashboard and only admin can see the publish button?               <?php        $args=array(     'post_type'         => 'post',     'post_status'       => 'pending',     'order'                 => 'ASC',     'caller_get_posts'  =>1,     'paged'         =>$paged,                 );      Thank You all in advance for help :D


Calling User Nickname

I am currently calling a user's nicename in a function I have:                  $users = $user_query->get_results();          foreach( $users as $user ):            echo $user->user_nicename;       I'm trying to call the user's Nickname instead, but nothing I do is working such as:                   echo $user->user_nickname;      Is there a special way you have to call a user's nickname? Thanks


Custom post type and taxonomy page templates

This is my first real delve into custom post types and taxonomies, i suppose it will all come to me in a flash of inspiration but right now i have confused myself beyond all realms of possibility and need some advice as whether im going on the right track. heres what i have: Three custom post types, namely: sale   rental   business all the above share 2 taxonomies (location and region) and then they have their own specific taxonomies too. Now im looking at template files for each of the Custom Post Types and also template files for the taxonomies. So of course i headed over to **WP Codex** and checked out custom post type templates, now if i understand correctly to template each of my custom post types i should use * _archive-_ *name_of_post_type.php and * _single-_ *name_of_post_type.php for when in single post view. Ok so up to here i reckon im ok, now this is where im confused, off to **Codex Again** this time to find out how to add a template to each of the taxonomies, codex tells me this * _taxonomy-_ *name_of_taxonomy.php, now a couple of questions if i may: 1) am i going about this the correct way 2) is the taxonomy template a single view (ie like single.php) or a looped view, im guessing its looped like categories. 3) can i create just one template and include all taxonomies (via an if statement to shake through seperate loop files?) regards Martin


white page after php code insert for custom post type

I get a white page in the frontend (not in the backend) after inserting the php code for the custom post type. See code: page-custom.php:

     <?php $loop = new WP_Query( array( 'post_type' => 'drei_boxen', 'posts_per_page' => 10 ) ); ?>          <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>

      functions.php               add_action( 'init', 'create_my_post_types' );          function create_my_post_types() {     register_post_type( 'infobox',          array(             'labels' => array(                 'name' => __( 'Infoboxen' ),                 'singular_name' => __( 'Infoboxen' ),                 'description' => __('Zur Erstellung der vier Boxen auf der Startseite unterhalb des Sliders')             ),             'public' => true,         )     );      } Any ideas why? If I delete the code from the `page-custom.php` it works. But with the code, I only get a white page and white source code.


All of the "more results" and navigation links lead to a 404 error

This is really starting to look like something that will never get fixed! I've tried EVERYTHING I found on the internet and it doesn't work. The navigations on the pages (more results, 1,2,3 etc.) all fail after the first page. The first page of search results, blog posts, categories and everything works correctly but after that it all goes to a 404 error. It detects the right number of posts to show per page correctly but then fails to show it in the next page. I've since tried: -Disabling all plugins -Removing htaccess file and letting Wordpress make another one by clicking Save Changes in the Permalink settings -Trying all kinds of permalink structures, e.g. going back to the default. -Changing the last blog posts and RSS entries setting in Reading settings page to any number that was suggested on forums and everywhere -Checking whether it's my hosting that has the problem, which turned out the same theme I'm using now is being used by somebody else on the very same reseller account by my friend and the second pages work on his! -Making changes to the rewrite.php file NONE of these worked. I'm running out of ideas, so please if anyone has any idea why this is happening let me know. I've spent countless hours trying to fix this but it just keeps on showing the 404 page. Current Permalink structure is:                /%postname%/      .htaccess content:               # -FrontPage-          IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*          <Limit GET POST>     order deny,allow     deny from all     allow from all     </Limit>     <Limit PUT DELETE>     order deny,allow     deny from all     </Limit>     AuthName daycagayrimenkul.com     AuthUserFile /home/daycagay/public_html/_vti_pvt/service.pwd     AuthGroupFile /home/daycagay/public_html/_vti_pvt/service.grp          # 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      Website's address is: http://www.daycagayrimenkul.com/ Example page with the problem: http://www.daycagayrimenkul.com/?s=Search...&sale_type=all&subtype=all&subcom=all&property_types=96&location_names=0&locadu=0&price_min=&price_max=&size_min=&size_max=&no_beds=all&no_baths=all&no_garages=all&no_apfloors=all&floorlocated=all&devtype=all&floorratio=all&heighter=all&deed=all&agreement=all&buildfloor=all&levelfloor=all&heating=all&usage=all&mortgage=all&historical=all&swap=all&property- search-submit=search Notice that the " More Results »" link at the bottom goes to a 404 page, although it does have results to show. Please, any kind of input or help is appreciated. Thanks Edit: I just tested my template files (copied everything and put it on a new installation) and they worked. However, when I imported all my data from my old installation, that's when the second pages started to crash again. So I've isolated the problem to be in the data which Wordpress exports, but sadly when I deleted all my posts one by one after importing, to see which one's the culprit, none of them were! Deleted all categories and posts and still the second pages cease to work after importing the data. I can't really write everything from scratch (the posts etc.) because there's about 1,500 posts/pages/categories. Is there any way to have a debug mode to find out where the data is failing?


Wordpress breadcrumb depth

I'm currently using the code below to display my breadcrumbs. Which works fine up to a point. What I want is: Home > Level 1 > Level 2 > Level 3 What I get is: Home > Level 1 > Level 3 It's displaying one parent, so as long as your deepest link is a Level 2 you can't tell the difference. But you know, for complex sites that's just not enough. Suggestions as to how to adjust this code to include all parents are most welcome. The code:               function themename_breadcrumb() {             global $post;                  echo '
';         if (!is_home()) {             echo '
';             echo 'Home';             echo "
";             if (is_category() || is_single()) {                 echo '
';                 the_category('

 ');                 if (is_single()) {                     echo "

";                     the_title();                     echo '
';                 }             } elseif (is_page()) {                 if($post->post_parent){                     $anc = get_post_ancestors( $post->ID );                     $anc_link = get_page_link( $post->post_parent );                          foreach ( $anc as $ancestor ) {                         $output = "
" . get_the_title( $ancestor ) . "";                     }                          echo $output;                         echo '

 ';                         echo the_title();                         echo '
';                          } else {                         echo '

 ';                         echo the_title();                         echo '
';                     }                 }         }         elseif (is_tag()) {single_tag_title();}         elseif (is_day()) {echo"
Archive for "; the_time('F jS, Y'); echo'
';}         elseif (is_month()) {echo"
Archive for "; the_time('F, Y'); echo'
';}         elseif (is_year()) {echo"
Archive for "; the_time('Y'); echo'
';}         elseif (is_author()) {echo"
Author Archive"; echo'
';}         elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {echo "
Blog Archives"; echo'
';}         elseif (is_search()) {echo"
Search Results"; echo'
';}         echo '
';     }