HOST = "your wordpress db host" DB = "your wordpress db" USER = "your db user" PASSWORD = "your db passwd" EXP_PATH = "wp_exp"# path to export .md files conn = pymysql.connect( host=HOST, database=DB, user=USER, password=PASSWORD, charset='utf8mb4')
defgetData(query): cur = conn.cursor() cur.execute(query) data = cur.fetchall() return data
defgetPostTags(post_id, tag_type): tags = getData(''' SELECT wpt.`name`, wpt.slug, wptt.taxonomy FROM wp_terms wpt LEFT JOIN wp_term_relationships wptr ON wpt.term_id = wptr.term_taxonomy_id LEFT JOIN wp_term_taxonomy wptt ON wptt.term_taxonomy_id = wptr.term_taxonomy_id WHERE wptr.object_id = %d and wptt.taxonomy="%s" ''' % (post_id, tag_type)) res = "" for tag in tags: res += " - %s\n" % tag[0] return res
# Code Highlight theme # Available values: normal | night | night eighties | night blue | night bright # https://github.com/chriskempson/tomorrow-theme highlight_theme:nighteighties