WordPress child theme

  • W katalogo themes tworzymy folder o nazwie naszego motywu. Dobrą zalecaną praktyką jest nazwanie motywów potomnych nazwą motywu rodzica z końcówką „-child”.
  • Jedynym wymaganym plikiem w motywie potomnym jest plik styles.css z odpowiednią deklaracją w komentarzu na początku przykładowa deklaracja poniżej:
/*
Theme Name:   Twenty Fifteen Child
Theme URI:    http://example.com/twenty-fifteen-child/
Description:  Twenty Fifteen Child Theme
Author:       John Doe
Author URI:   http://example.com
Template:     twentyfifteen
Version:      1.0.0
License:      GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain:  twentyfifteenchild
*/
  • z czego jedynie „Theme Name” oraz „Template” są wymagane.
  • W pliku functions.php nalerzy wciągnąć rodzicielski motyw za pomocą funkcji

add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );

function my_theme_enqueue_styles() {
    $parenthandle = 'twentyseventeen-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
    $theme = wp_get_theme();
    wp_enqueue_style( $parenthandle, get_template_directory_uri() . '/style.css',
        array(),  // if the parent theme code has a dependency, copy it to here
        $theme->parent()->get('Version')
    );
    wp_enqueue_style( 'child-style', get_stylesheet_uri(),
        array( $parenthandle ),
        //$theme->get('Version') // this only works if you have Version in the style header
    );
}
  • W CMS’ie należy uruchomić pochodny styl

WEBP Converter for media exclude

Wykluczanie poszczególnych plików z konwersji na webp. Gdy konwersja skutkuje nieodpowiednią jakością.

Do nazwy wgrywanego pliku graficznego który, ma być pominięty, należy dodać końcówkę „-skipwebp”.

To exclude selected files use the following filter *(in this case with the suffix "-skipwebp" in a filename, e.g. image-skipwebp.png)*:

`add_filter( 'webpc_supported_source_file', function( bool $status, string $file_name, string $server_path ): bool {
    $excluded_suffix = '-skipwebp';
    if ( strpos( $file_name, $excluded_suffix . '.' ) !== false ) {
        return false;
    }
    return $status;
}, 10, 3 );`

Argument `$server_path` is the absolute server path to a directory or file. Inside the filters, you can apply more complicated rules as needed.

Filters run before images are converted - they no longer support converted images. You have to delete them manually if they should not be converted.

Należy pamiętać, że w przypadku dodania obrazka klasycznie przez cms, wordpress dorobi inne formaty obrazka i doda do nazw własne końcówki z rozdzielczością, które wykorzysta jako currentsource. Więc by wykluczenie działało poprawnie, trzeba dodać obrazek jako własny html.

DMARC Record dla SEO

DMARC w DNS należy utwożyć wpis typu TXT
Przykładowy minimalistyczny dmarc:

v=DMARC1; p=none; rua=mailto:dmarcreports@mxtoolbox.com


Przykładowy DMARC dla gooddrut z kwatrantanną:

v=DMARC1;p=quarantine;sp=none;adkim=r;aspf=r;pct=100;fo=0;rf=afrf;ri=86400;rua=mailto:kontakt@patentstudio.pl;ruf=mailto:kontakt@patentstudio.pl