Support » Fixing WordPress » How to extract all posts to one category and move to a new database?

  • In order to accomplish what I want, that of having all posts to one category not show on the main blog, I think what I need to do is move all those posts to a NEW database and run kind of a sub blog.

    Can someone help me know how to take all those posts from the existing db and move them to the new database?

    Any help will be massively appreciated.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Are you sure you need to do that? If you add the following to the top of your index.php, you can exclude all the posts from the unwanted category (where 5 is obviously the category_id that you want to exclude).

    <?php query_posts('cat=-5');?>

    Thread Starter Roar

    (@rori)

    Yes, I think so, because I still want them to be available on another page?

    Thread Starter Roar

    (@rori)

    Dude. You rule.

    Thank you.

    “Dude. You rule.”
    I try but there’s this guy called Tony Blair who seems to disagree:-) Glad it worked for you.

    Thread Starter Roar

    (@rori)

    More help please?

    How about if I want category 5 and 3 to not show on the first page?

    WordPress doesn’t support multiple category exclusions, unfortunately, nor will it for the forseeable future. That said, if you want to attempt it you can see some directions here for adding support into WordPress for multiple category exclusions. Note if you don’t know PHP then don’t attempt it… no warranty is either expressed or implied and you’ll be on your own :).

    Note that you have the option of including all of the categories you want to include instead of excluding the two categories you don’t want.

    Thread Starter Roar

    (@rori)

    Is the “including” part of this page you just sent me too?

    Nope. By “including” I mean the following:

    <?php query_posts('cat=1,2,4,6,7,8,9');?>

    Maybe you can experiment with this if you want in the sidebar and pages.
    You will have however to strip some code and put it in two new php files called sidebar 1 and sidebar 2.
    make some new template pages copy the index.php inside the new files and include one of the PHP files.
    every change in the code below gives another result.
    In this code only subcategory’s are shown and the category’s themselves are hidden to make it easier to work with template pages and subcategories.
    Also in this example the number of posts are shown.
    See also the codex.

    <?php list_cats(FALSE, ”, ‘ID’,
    FALSE,’asc’, ”, FALSE, TRUE,
    FALSE, FALSE, TRUE,
    TRUE, FALSE, ”, FALSE,
    ”, ”, ‘1,6,7’, /*on this line choose which cats you want to exclude.*/
    FALSE);
    ?>

    Martin

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to extract all posts to one category and move to a new database?’ is closed to new replies.