Kilho.net
IT Ramblings

WordPress-temaredigering

Det här är ett sätt att använda ett WordPress-tema genom att redigera en säkerhetskopia (ett så kallat barntema), utan att ändra originalet.

  1. För att enkelt kunna identifiera barntemat du använder skapar du en ny mapp i ”wp-content/themes” och kombinerar den med temats namn. (Exempel: Om originaltemat heter ”twentyfifteen” skapar du mappen ”twentyfifteen-child”.)
  2. Kopiera originaltemats ”style.css” till mappen för barntemat och ändra ”Theme Name” och ”Themplate” enligt följande.
    [php]/*
    Theme Name: Twenty Fifteen Child
    Theme URI: https://wordpress.org/themes/twentyfifteen/
    Template: twentyfifteen
    Author: the WordPress team
    Author URI: https://wordpress.org/
    Description: Our 2015 default theme is clean, blog-focused, and designed for clarity. Twenty Fifteen’s simple, straightforward typography is readable on a wide variety of screen sizes, and suitable for multiple languages. We designed it using a mobile-first approach, meaning your content takes center-stage, regardless of whether your visitors arrive by smartphone, tablet, laptop, or desktop computer.
    Version: 1.5
    License: GNU General Public License v2 or later
    License URI: http://www.gnu.org/licenses/gpl-2.0.html
    Tags: black, blue, gray, pink, purple, white, yellow, dark, light, two-columns, left-sidebar, fixed-layout, responsive-layout, accessibility-ready, custom-background, custom-colors, custom-header, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, threaded-comments, translation-ready
    Text Domain: twentyfifteenTemplate: twntyfifteen
    This theme, like WordPress, is licensed under the GPL.
    Use it to make something cool, have fun, and share what you’ve learned with others.
    */
    [/php]
  3. Skapa filen ”functions.php” i mappen för barntemat med följande kod.
    [php]
    <?php
    add_action( ’wp_enqueue_scripts’, ’theme_enqueue_styles’ );
    function theme_enqueue_styles() {
    wp_enqueue_style( ’parent-style’, get_template_directory_uri() . ’/style.css’ );
    }
    ?>
    [/php]
  4. Kopiera originaltemats ”screenshot.png” till mappen för barntemat.
  5. Kopiera filerna från originaltemat som du vill ändra till mappen för barntemat, ändra dem och använd dem.

(Referens: http://codex.wordpress.org/Child_Themes)

Lämna ett svar

Din e-postadress kommer inte publiceras. Obligatoriska fält är märkta *