• Hi

    I have created a child theme and that went well. I have altered style and theme.json and I have added functions and screenshot. And now I am confused… very:

    1. I have a lot of wrong or missing headers/footers that I initially set up in TT4 as template parts. They are gone. I have manually reapplied my header with some struggle to front and all templates. Footer WILL NOT SHOW on my front page or my woo shop page even though I see them in editor. For front page also blog query is gone. Why? I have this in index template.
    2. Fonts: Almost everything shows in Cardo font. Also paragraphs on large screen. This is a child of TT4 so completely not as natively designed. And where it gets really awkward is that on mobile everything show in inter font? Does child theme not inherit styles from TT4 until I restyle in settings or child theme.json? This is very unclear to me, so please elaborate. Also I am preparing for this to work for future wp themes such as TT5, so as little manual intervention as possible is what I am looking for. I will post my child theme.json below, since I have wonders there.
    3. theme.json: Can I have a version 3 under a TT4 version 2? Do I need to copy all content from TT4 into child theme.json? Or will the child run from the TT4 t.j and then I can add own variables and overwrite tt4 core, such as buttons fx?

    I have this in index template:

    <!-- wp:template-part {"slug":"footer","area":"footer"} /-->

    and this in original TT4 index:

    <!-- wp:template-part {"slug":"footer","area":"footer","tagName":"footer"} /-->

    Why the difference? Where can I find slug to my footer? that is a template part and why is it not updated here, since I create a child from TT4 where this was correct? Why can I not see it when I see it in editor?

    My current theme.json child is like so:

    {
    "$schema": "https://schemas.wp.org/wp/6.6/theme.json",
    "version": 3,
    "patterns": [],
    "settings": {
    "color": {
    "palette": [
    {
    "name": "Black",
    "slug": "black",
    "color": "#000000"
    },
    {
    "name": "White",
    "slug": "white",
    "color": "#ffffff"
    },
    {
    "name": "Draupnir 8",
    "slug": "draupnir-8",
    "color": "#171717"
    },
    {
    "name": "Draupnir 9",
    "slug": "draupnir-9",
    "color": "#ae1100"
    }
    ]
    }
    }
    "styles": {
    "blocks": {
    "core/button": {
    "variations": {
    "outline": {
    "spacing": {
    "padding": {
    "bottom": "calc(0.6rem - 1px)",
    "left": "calc(1rem - 1px)",
    "right": "calc(1rem - 1px)",
    "top": "calc(0.6rem - 1px)"
    }
    },
    "border": {
    "width": "1px"
    }
    }
    }
    },
    "core/buttons": {
    "spacing": {
    "blockGap": "0.7rem"
    }
    },
    "core/search": {
    "css": "& .wp-block-search__input{border-radius:.33rem}",
    "typography": {
    "fontSize": "var(--wp--preset--font-size--small)"
    },
    "elements": {
    "button": {
    "border": {
    "radius": { "ref": "styles.elements.button.border.radius" }
    }
    }
    }
    },
    "color": {},
    "elements": {
    "button": {
    ":active": {
    "color": {
    "background": "var(--wp--preset--color--contrast)",
    "text": "var(--wp--preset--color--base)"
    }
    },
    ":focus": {
    "color": {
    "background": "var(--wp--preset--color--contrast-2)",
    "text": "var(--wp--preset--color--base)"
    },
    "outline": {
    "color": "var(--wp--preset--color--contrast)",
    "offset": "2px"
    },
    "border": {
    "color": "var(--wp--preset--color--contrast-2)"
    }
    },
    ":hover": {
    "color": {
    "background": "var(--wp--preset--color--contrast-2)",
    "text": "var(--wp--preset--color--base)"
    },
    "border": {
    "color": "var(--wp--preset--color--contrast-2)"
    }
    },
    "border": {
    "radius": ".33rem",
    "color": "var(--wp--preset--color--contrast)"
    },
    "color": {
    "background": "var(--wp--preset--color--contrast)",
    "text": "var(--wp--preset--color--base)"
    },
    "spacing": {
    "padding": {
    "bottom": "0.6rem",
    "left": "1rem",
    "right": "1rem",
    "top": "0.6rem"
    }
    },
    "typography": {
    "fontSize": "var(--wp--preset--font-size--small)",
    "fontStyle": "normal",
    "fontWeight": "500"
    }
    },
    },
    },
    "templateParts": [],
    "customTemplates": []
    }
    1. I am confused about the brackets. Some are square some are curly. Why? These are copy paste.
    2. Is it correct that first lines of stuff ends with comma and that last one does not feature a comma?
    3. Lines I have here, that also exist in parent t.j will overwrite and take presedence? Is that correct? So changing black to white, then white it is. So changing core button will restyle across the site, regardless of what’s in parent theme? Also I can here create custom styles and setting, such as add a color blue to the already existing TT4 palette.
    4. Is it fair to assume that this will also work for TT5

    Functions:
    I am adding this to my functions cause I read in manuals I must. Why does WP themes not handle this default and is code correct?

    /**
    * Theme WordPress default does not enque the mother theme, when creating a child,
    * hence, we call both the child as well as the mother themes
    */

    add_action( 'wp_enqueue_scripts', 'draupnir_9_enqueue_styles' );

    function draupnir_9_enqueue_styles() {
    wp_enqueue_style(
    'draupnir-9-parent-style',
    get_parent_theme_file_uri( 'style.css' )
    );
    }

    Thx – I need help, please

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.