Example #1
0
        static void ImportCategories()
        {
            Write("Deleting Categories");
            //delete existing
            Category.Delete(x => x.CategoryID > 0);
            //pull the WP tags
            var query = from t in wp_term.All()
                        join tt in wp_term_taxonomy.All() on t.term_id equals tt.term_id
                        where tt.taxonomy == "category"
                        select t;

            foreach (var term in query) {
                //add the tag to the DB
                Write("Adding category " + term);
                var c = new Category();
                c.Description = term.name;
                c.Slug = term.slug;
                c.Add();
            }
            Write("Finished importing categories **************************");
        }