This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Этот скрипт должен быть размещён в <head> над всеми внешними объявлениями стилей (link[rel=stylesheet]) | |
| function loadFont(fontName, woffUrl, woff2Url) { | |
| // 0. Многие неподдерживаемые браузеры должны останавливать работу тут. | |
| var nua = navigator.userAgent; | |
| var noSupport = !window.addEventListener // IE8 и ниже | |
| || (nua.match(/(Android (2|3|4.0|4.1|4.2|4.3))|(Opera (Mini|Mobi))/) && !nua.match(/Chrome/)) // Android Stock Browser до 4.4 и Opera Mini | |
| if (noSupport) { | |
| return; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // список плагинов для установки | |
| $pluginsList = [ | |
| 'safe-svg', | |
| 'cyr2lat', | |
| 'wp-hide-security-enhancer', | |
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Vanilla Javascript DropDown Menu Example</title> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <link rel="stylesheet" type="text/css" href="style.css"> | |
| </head> | |
| <body> | |
| <div id="menu-dropdown">Menu ▼</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * ----------------------------------------------------------------------------------------- | |
| * Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php` | |
| * ----------------------------------------------------------------------------------------- | |
| */ | |
| // HTML Minifier | |
| function minify_html($input) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| No jQuery necessary. | |
| Thanks to Dan's StackOverflow answer for this: | |
| http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport | |
| */ | |
| function isElementInViewport(el) { | |
| var rect = el.getBoundingClientRect(); | |
| return ( | |
| rect.top >= 0 && |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- Див в котором будет отображаться виджет --> | |
| <div id="vk_community_messages"></div> | |
| <script type="text/javascript"> | |
| // откладываем по времени | |
| setTimeout(function(){ | |
| // создаем элемент script и добавляем его асинхронно в DOM | |
| var VKO = document.createElement("script"); | |
| VKO.src = 'https://vk.com/js/api/openapi.js'; | |
| VKO.async = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // first, get the image object returned by ACF | |
| $image_object = get_field('my_image_field'); | |
| // and the image size you want to return | |
| $image_size = 'thumbnail'; | |
| // now, we'll exctract the image URL from $image_object | |
| $image_url = $image_object['sizes'][$image_size]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ---------------------------------------------------------------------- | |
| # | File access | | |
| # ---------------------------------------------------------------------- | |
| # Block access to directories without a default document. | |
| # | |
| # You should leave the following uncommented, as you shouldn't allow | |
| # anyone to surf through every directory on your server (which may | |
| # includes rather private places such as the CMS's directories). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Programmatically Create a User in WordPress | |
| add_action('init', 'prefix_add_user'); | |
| function prefix_add_user() { | |
| $username = 'username123'; | |
| $password = 'pasword123'; | |
| $email = 'drew@example.com'; | |
| $user = get_user_by( 'email', $email ); | |
| if( ! $user ) { |
NewerOlder