Pobieranie wszystkich utworzonych menu function get_all_wordpress_menus(){ return get_terms( 'nav_menu’, array( 'hide_empty’ => true ) ); } sprawdzanie, czy strona ma dzieci function has_children($_id, $_post_type) { $children = get_posts( array( 'post_parent’ => $_id, 'post_type’ => $_post_type ) ); if( count( $children ) == 0 ) { return false; } else { return true; } } szukanie ..

Read more

Sprawdzanie, czy przeglądarka wspiera if (canvas.getContext) { var ctx = canvas.getContext(’2d’); // drawing code here } else { // canvas-unsupported code here } Style fillStyle – kolor wypełnienia strokestyle – kolor obrysu globalAlpha – ustawia globalną przezroczystość kolorów rysowanych od tego polecania w dół lineWidth lineCap – wykończenie ścieżek. Albo ścięte, albo zaokrąglone albo z kwadracikiem (butt, round, square) ..

Read more

Zmiana wersji php dla domeny Trzeba utworzyć plik o nazwie .ovhconfig w katalogu głównym domeny z zawartością: app.engine=php app.engine.version=5.6 http.firewall=none environment=..

Read more

Tłumaczenie url-a echo wpm_translate_url( get_site_url() . '/event’, 'en’ ); Tłumaczenie tekstu wpm_translate_string( '[:pl]Wydarzenie[:en]Event[:]’, 'en’ ) Pobranie aktualnego kodu językowego echo wpm_get_language() Tłumaczenie customowych pól Najpierw w głównym katalogu templaty trzeba stworzyć plik wpm-config.json a w nim umieścić: { „post_fields”: { „nazwaPola”: {} } } Tłumaczenie customowych pól powtarzalnych { „post_fields”: { „nazwaGrupy”: { „wpm_each”: { ..

Read more

Sposób na border collapse bez tabeli box-shadow: 1px 0 0 0 $cGray, 0 1px 0 0 $cGray, 1px 1px 0 0 $cGray, /* Just to fix the corner */ 1px 0 0 0 $cGray inset, 0 1px 0 0 $cG..

Read more

Definiowanie i rozszerzanie klas. Żeby skorzystać z wcześniejszego constructora należy użyć super //ES6 class Book { constructor(title, author, year) { this.title = title; this.author = author; this.year = year; } getSummary() { return 'whatever’; } } //Magazine Subclass class Magazine extends Book { constructor(title, author, year, month) { super(title, author, year); this.month = month } ..

Read more

Prototype Tworząc obiekt dodajemy do niego pola. Możemy też jako pole dodać funkcję, wtedy jest to tzw metoda. //constructor function Book( title, year ) { this.title = title, this.year = year this.getSummary = function() {} } Sprawi to, że metoda wykona się od razu. Jeżeli nie chcemy, by się tak stało, możemy użyć prototype do ..

Read more

addresses = $(’.text’).html(); zipCodeChange = addresses.replace( /[0-9]{2}\-[0-9]{3}/g, '|’ + '$&’); $& – pobiera aktualne trafienie. g – na końcu regexpa to parametr global, który wyszukuje wszystkich wystąpień, a nie tylko ..

Read more