Limit the index page of your website to show only posts from certain category

The right place for this code is in index.php

  <?
   // query all the posts for each cat
 query_posts("cat=17"); // &showposts=2
  ?>
  <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

      <?php
        // http://codex.wordpress.org/Conditional_Tags
        // This is my second best choice! but with query_posts is nicer!
        // if (!in_category('17') && is_home()) continue;

      ?>

How to display Posts only directly connected to a category (no subcategories)


Paste this in your category.php

<?
    // let wordpress to display only the direct chields of the category - no posts belong to sub-category of the current category
$selected_category_id = get_query_var('cat');
$selected_category = get_category($selected_category_id);
$chield_categories = get_categories("child_of=" . $selected_category_id . "&hide_empty=0&orderby=ID&style=none");
$chield_category_ids = array();
foreach ((array) $chield_categories as $cat) {
$chield_category_ids[] = $cat->cat_ID;
}
query_posts(
      array(
        'category__not_in' => $chield_category_ids,
        'cat' => $selected_category_id,
      )
    );
  ?>
  <?php if (have_posts()) : ?>

Get nice navigation with smart subcategories

Make 2 line navigation starting from a category. Put in your header.php

<div id="top_menu">
  <div style="margin: auto; width: 930px; height: 29px;">
  <?php
    // The root category from which we will display the main menu
    $category_root_id = 15;

    $selected_category_id = get_query_var('cat');
    $selected_category = get_category($selected_category_id);

    if (intval($selected_category->parent) == $category_root_id) {
      $selected_main_category = $selected_category;
    } else {
      $selected_main_category = get_category($selected_category->parent);
    }

    $categories = get_categories('child_of='.$category_root_id.'&hide_empty=0&show_count=0&orderby=id&hierarchical=0');
    $menu = array();
    $category_widths = array(
      -1 => 110,
      4 => 103,
      5 => 111,
      6 => 127,
      7 => 158,
      8 => 172,
      9 => 131,
    );
    $separator = '<div class="separator"></div>';

    // lets prepare the first element of the menu "HOME"
    array_push($menu, $separator);

    $class="menu-button";
    if (is_home()){
      $class="menu-button-selected";
    }

    $category = '<div class="'.$class.'"><a style="width:'.$category_widths[-1].'px" href="/">Начало</a></div>';
    array_push($menu, $category);
    array_push($menu, $separator);

    foreach ($categories as $cat) {
      if (intval($cat->parent) == $category_root_id) {
        $category_id = $cat->cat_ID;
        $class="menu-button";
        if (
            $category_id == $selected_category_id ||
            $selected_main_category->cat_ID == $category_id
        ) {
          $class="menu-button-selected";
        }
        $category = '<div class="'.$class.'"><a style="width: '.$category_widths[intval($cat->cat_ID)].'px" href="'.get_category_link($cat->cat_ID).'">'.$cat->name.'</a></div>';
        array_push($menu, $category);
        array_push($menu, $separator);
      }
    }
    echo join($menu, "");
 ?>
  </div>

<? if (! is_home()) { ?>
<div style="margin: auto; height: 26px; background-color: rgb(115, 119, 129);">
<?
    $sub_categories = get_categories('child_of='.$selected_main_category->cat_ID.'&hide_empty=0&show_count=0&orderby=id&hierarchical=0');

    $sub_menu = array();
    $separator_html = '<img width="20" height="28" style="vertical-align: top; margin-top: -3px;" src="'.get_theme_root_uri().'/tkhold/images/sub-menu-div.gif"/>';

    foreach ($sub_categories as $sub_cat) {
      if (intval($sub_cat->parent) == $selected_main_category->cat_ID) {
        $sub_category_id = $sub_cat->cat_ID;
        $class="sub_menu_normal";
        if ($sub_category_id == $selected_main_category->cat_ID) {
          $class="sub_menu_selected";
        }
        $sub_category_link = get_category_link($sub_category_id);
        $sub_category_name = $sub_cat->name;
        $category_html = <<<ZHTML
      <a href="$sub_category_link">$sub_category_name</a>
ZHTML;
        array_push($sub_menu, $category_html);
      }
    }

    echo "<div class=\"sub_category_button_${category_id} submenu $class \">";
    echo join($sub_menu, $separator_html);
    echo "</div>";

?>
</div>
<? }  // is home? ?>

Moving wordpress to another domain

UPDATE wp_posts SET guid = replace(guid, 'http://del.gudasoft.com','http://tkhold.gudasoft.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://del.gudasoft.com','http://tkhold.gudasoft.com');
UPDATE wp_posts SET post_title = replace(post_title, 'http://del.gudasoft.com','http://tkhold.gudasoft.com');

Links

Plugins

multi language plugin – http://www.jide.fr/english/downloads/plugin-yammyamm-wordpress/