{"id":2083,"date":"2014-10-17T20:44:38","date_gmt":"2014-10-17T20:44:38","guid":{"rendered":"http:\/\/musilda.cz\/?p=2083"},"modified":"2014-10-17T20:44:38","modified_gmt":"2014-10-17T20:44:38","slug":"vytvoreni-stranky-pri-aktivaci-sablony","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/vytvoreni-stranky-pri-aktivaci-sablony\/","title":{"rendered":"Vytvo\u0159en\u00ed str\u00e1nky p\u0159i aktivaci \u0161ablony"},"content":{"rendered":"

Pokud p\u0159ipravujete \u0161ablonu, a\u0165 ji\u017e na prodej, nebo pro opakovan\u00e9 pou\u017eit\u00ed na v\u00edce webech, m\u016f\u017ee se v\u00e1m hodit mo\u017enost vytvo\u0159en\u00ed str\u00e1nky s p\u0159ipraven\u00fdm obsahem a p\u0159i\u0159azenou \u0161ablonou. Typick\u00fdm p\u0159\u00edkladem je kontaktn\u00ed str\u00e1nka. Na t\u00e9 \u010dasto b\u00fdv\u00e1 jen kontaktn\u00ed formul\u00e1\u0159, n\u011bkolik informac\u00ed a mapa.<\/p>\n

Pomoc\u00ed n\u00e1sleduj\u00edc\u00edho scriptu vytvo\u0159\u00edte p\u0159i aktivaci \u0161ablony str\u00e1nku a p\u0159i\u0159ad\u00edte ji odpov\u00eddaj\u00edc\u00ed template.<\/p>\n

\n$theme_name = get_current_theme();\n$screen = get_current_screen();\nif (isset($_GET['activated']) && $screen->id == 'theme' && $theme_name == $your_theme_name){\n\n        $new_page_title = 'Titulek str\u00e1nky';\n        $new_page_content = 'Obsah str\u00e1nky';\n        $new_page_template = 'template-contact.php';\n\n        \/\/Kontrola existence str\u00e1nky\n        $page_check = get_page_by_title($new_page_title);\n        $new_page = array(\n                'post_type' => 'page',\n                'post_title' => $new_page_title,\n                'post_content' => $new_page_content,\n                'post_status' => 'publish',\n                'post_author' => 1,\n        );\n        if(!isset($page_check->ID)){\n                $new_page_id = wp_insert_post($new_page);\n                if(!empty($new_page_template)){\n                        update_post_meta($new_page_id, '_wp_page_template', $new_page_template);\n                }\n        }\n\n}\n<\/pre>\n

Pokud chcete rovnou importovat kompletn\u00ed demo obsah, bylo by lep\u0161\u00ed p\u0159ipravit xml soubor, kter\u00fd pak umo\u017en\u00ed vytvo\u0159it strukturu cel\u00e9ho webu.<\/p>\n","protected":false},"excerpt":{"rendered":"

Pokud p\u0159ipravujete \u0161ablonu, a\u0165 ji\u017e na prodej, nebo pro opakovan\u00e9 pou\u017eit\u00ed na v\u00edce webech, m\u016f\u017ee se v\u00e1m hodit mo\u017enost vytvo\u0159en\u00ed str\u00e1nky s p\u0159ipraven\u00fdm obsahem a p\u0159i\u0159azenou \u0161ablonou. Typick\u00fdm p\u0159\u00edkladem je kontaktn\u00ed str\u00e1nka. Na t\u00e9 \u010dasto b\u00fdv\u00e1 jen kontaktn\u00ed formul\u00e1\u0159, n\u011bkolik informac\u00ed a mapa. Pomoc\u00ed n\u00e1sleduj\u00edc\u00edho scriptu vytvo\u0159\u00edte p\u0159i aktivaci \u0161ablony str\u00e1nku a p\u0159i\u0159ad\u00edte ji odpov\u00eddaj\u00edc\u00ed<\/p>\n","protected":false},"author":1,"featured_media":1978,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[12,30],"tags":[],"class_list":["post-2083","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-navody","category-wordpress"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/2083"}],"collection":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/comments?post=2083"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/2083\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/1978"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=2083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=2083"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=2083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}