0

I am developing wordpress based sites on my local server. After moving to testing server (which will be also production one) custom taxonomy loop breaks. I fixed it with WP_Query hack, but still looking for reason why this happend.

LOCAL SERVER SPECS:

Runing Mac OS X 10.8.3

php -v

PHP 5.3.15 with Suhosin-Patch (cli) (built: Aug 28 2012 18:19:13) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

mysql -v

Server version: 5.6.11 MySQL Community Server (GPL)

TESTING SERVER SPECS:

Linux

phpinfo(); (link will be burned) http://htcone.htcfans.cz/phpinfo.php

Registring taxonomies and post_types (part of functions.php):

/* Post_types and taxonomies */

// Add post types
add_action( 'init', 'add_post_types' );

function add_post_types() {
    register_post_type('produkt', array(    'label' => 'Produkty','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'produkt'),'query_var' => true,'exclude_from_search' => true,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('produkty'),'labels' => array (
      'name' => 'Produkty',
      'singular_name' => 'Produkt',
      'menu_name' => 'Produkty',
      'add_new' => 'Add Produkt',
      'add_new_item' => 'Add New Produkt',
      'edit' => 'Edit',
      'edit_item' => 'Edit Produkt',
      'new_item' => 'New Produkt',
      'view' => 'View Produkt',
      'view_item' => 'View Produkt',
      'search_items' => 'Search Produkty',
      'not_found' => 'No Produkty Found',
      'not_found_in_trash' => 'No Produkty Found in Trash',
      'parent' => 'Parent Produkt',
    ),) );
}

// Add taxonomies
add_action( 'init', 'add_some_taxs' );

function add_some_taxs() {
    register_taxonomy('produkty',array (
        0 => 'produkt',
    ),array( 'hierarchical' => true, 'label' => 'Typy produktů','show_ui' => true,'query_var' => true,'rewrite' => array('slug' => 'produkty'),'singular_label' => 'Typ produktu') );
}

TEMPLATE HIEARCHY:

Theme using classic hierarchy structure: http://codex.wordpress.org/Template_Hierarchy

taxonomy-produkty.php loop - without hack (works only on local machine)

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div class="grid-4 product post">
        <?php if ( has_post_thumbnail() ) : ?>
            <div class="thumb">
                <?php the_post_thumbnail('product-full','class=scale'); ?>
            </div>
        <?php endif; ?>
        <h2 class="title">
            <?php the_title(); ?>
        </h2>
        <div class="content">
            <?php the_content(); ?>
        </div>
    </div>
<?php endwhile; endif; ?>

This hack fixing not working taxonomy-produkty.php loop on testing server:

global $query_string;
query_posts($query_string . "&post_type=produkt");
//the loop (code is upper)
//Reset Query
wp_reset_query();

MOVING FROM LOCAL SERVER TO TESTING SERVER

mysql

  1. export/inport with PHP my admin
  2. customize wp_settings tab

ftp

  1. move whole wordpress
  2. customize DB setting in wp_config.php

My question is WHY IS LOOP WORKING ON LOCAL SERVER BUT BREAKS ON TESTIONG ONE???

If you read this far you're my favorit person:-)

P.S. Please excuse my bad English.

4

0 回答 0