| Следующая версия | Предыдущая версия |
| web:wordpress:wordpress_links [2020/12/16 13:38] – внешнее изменение 127.0.0.1 | web:wordpress:wordpress_links [2024/05/02 19:18] (текущий) – dx |
|---|
| | ====== CMS: WordPress ====== |
| |
| | {{:web:wordpress_logo.png?nolink|}} |
| | |
| | Хомпэйдж, доки, лалала |
| | |
| | ---- |
| | |
| | ===== GoD Bless ===== |
| | |
| | Спасибо следующим статьям, которые сэкономили мне много времени. |
| | |
| | * [[https://sucuri.net/guides/how-to-clean-hacked-wordpress/|How to Clean a Hacked WordPress Site]]. |
| | * Почему wp_options вырастает до 100500+ ГБ, что такое autoload data и как быть - [[https://guides.wp-bullet.com/using-wp-cli-doctor-command-to-fix-large-wp_options-autoload-data/|один]], [[https://wpjohnny.com/clean-up-wp_options-table-autoloaded-data/|два]] |
| | |
| | ===== Шаблоны ===== |
| | |
| | * https://www.competethemes.com/author/ |
| | * https://www.themehorse.com/themes/ultimate-pro/ |
| | * https://themeisle.com/themes/neve/ |
| | * https://www.simplethemes.com/wordpress-themes/theme/stellar |
| | * https://theme-one.com/mobius/ |
| | * http://designdisease.com/ |
| | * http://lucianmarin.com/page/themes/ FIXME |
| | * http://www.nattywp.com/ |
| | * http://www.tomstardust.com/wordpress-themes/ |
| | * http://axiu.me/theme/ |
| | * http://us-themes.com/ |
| | * http://gantry.org/ |
| | * https://themehall.com/me-omega-child-theme |
| | * http://www.portotheme.com/wordpress/porto_landing/ |
| | * https://the7.io/ |
| | * https://demo.themegrill.com/flash/demos/ |
| | * https://kriesi.at/theme-overview |
| | * https://swiftideas.com/themes/ |
| | * https://gretathemes.com/wordpress-themes/thefour/ |
| | * https://wpkoi.com/valmiki-wpkoi-wordpress-theme/ |
| | |
| | **Bootstrap based themes** |
| | |
| | * https://www.websharks-inc.com/product/s2clean/ |
| | * http://www.johnparris.com/alienship/ |
| | * http://bootstrapwp.rachelbaker.me/ |
| | * http://braginteractive.com/bootstrap/ |
| | * http://roots.io/starter-theme/ |
| | * http://tonystar.ru/projects/tweme |
| | |
| | ===== Хаки спамы куки ===== |
| | |
| | * [[http://dimox.name/prevent-trackback-and-pingback-spam-on-wordpress/|Избавляемся от trackback- и pingback-спама на WordPress-сайте]] |
| | * [[http://www.wordpressplugins.ru/faq/memory-usage.html|Вывод информации о нагрузке блога на WordPress]] |
| | * [[http://www.wordpressplugins.ru/faq/remove-wphead.html/|Удаляем ненужные элементы wp_head]] |
| | * [[http://yakto.ru/cms/bezopasnost-wordpress-uyazvimost-wordpress-i-13-sposobov-oborony.html/|Безопасность WordPress, уязвимость WordPress и 13 способов обороны]] |
| | * [[http://www.juev.ru/2010/08/29/wordpress-store-images-in-a-subdomain/|Wordpress: store images in a subdomain]] |
| | * [[https://coderwall.com/p/skazcg/avoid-syncing-wp-content-uploads|Avoid Syncing wp-content/uploads]] |
| | * [[http://n-wp.ru/3754/|Как удалить нежелательный мусор из начала страницы]] |
| | * [[http://n-wp.ru/1971/|Как защитить блог от хотлинков]] |
| | * [[http://n-wp.ru/1612/|Как защитить изображения от копирования | Automatic Image Hotlink Protection]] |
| | * [[http://www.wordpresser.ru/wp-tweaks/wordpress-xak-podderzhka-relcanonical.html/|WordPress хак, поддержка rel=”canonical”]] |
| | * [[http://wpnew.ru/raskrutka-bloga/seo_optimizaciya/fajl-robots-txt-pravilnyj-primer-na-wordpress-dlya-yandeksa.html|Файл robots.txt: правильный пример на WordPress для Яндекса и Google]] |
| | ===== Плагины ===== |
| | |
| | Разное |
| | * https://blobfolio.com/projects/#plugins |
| | * https://wordpress.org/plugins/debug-bar/ |
| | * [[http://www.wordpressplugins.ru/administration/ozh-admin-drop-down-menu.html/|Ozh Admin Drop Down Menu]] |
| | * https://wordpress.org/plugins/ninja-forms/ |
| | * https://wordpress.org/plugins/regenerate-thumbnails/ |
| | * http://hackadelic.com/solutions/wordpress/sliding-notes |
| | * http://codex.wordpress.org/Converting_Database_Character_Sets |
| | * [[https://sheensay.ru/wp-cron#chto-takoe-wp-cron|Что такое WP cron]] |
| | |
| | Карта сайта |
| | * [[http://wp-plugins.diamondsteel.ru/wp-ds-faq/|WP DS FAQ]] |
| | * http://www.dagondesign.com/articles/sitemap-generator-plugin-for-wordpress/ |
| | ===== Yoast ===== |
| | |
| | * [[https://kb.yoast.com/kb/how-do-i-noindex-urls/|How Do I Noindex URLs?]] |
| | * [[https://kb.yoast.com/kb/canonical-urls-in-wordpress-seo/#archives|Canonical URLs in Yoast SEO]] |
| | * [[https://yoast.com/wordpress/plugins/seo/yoast-seo-robots-meta-configuration/|Yoast SEO: robots meta configuration]] |
| | * [[https://themeskills.com/nofollow-all-links-wordpress-post-page-yoast/|How to Nofollow All Links on a WordPress Post or Page with Yoast]] |
| | |
| | ===== Разное ===== |
| | |
| | ==== Запрет выполнения кода ==== |
| | |
| | <code> |
| | Options -Indexes |
| | php_flag engine 0 |
| | RemoveHandler .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml |
| | AddType application/x-httpd-php-source .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml |
| | </code> |
| | |
| | ==== Как перенести сайт WP с одного домена на другой? ==== |
| | |
| | Через [[https://interconnectit.com/products/search-and-replace-for-wordpress-databases/|Search Replace DB]], [[https://github.com/interconnectit/Search-Replace-DB|github]]. |
| | |
| | ==== Мини-статистика ram/sql/time ==== |
| | |
| | <code php> |
| | <?php |
| | echo "Статистика:" . get_num_queries() . "/ "; timer_stop(1); |
| | echo "s/ ". round(memory_get_usage()/1024/1024, 2) . " MB "; |
| | ?> |
| | </code> |
| | |
| | ==== Мини-статистика ram/sql/time #2 ==== |
| | |
| | В стиле LiveInternet |
| | |
| | <code> |
| | <!-- WORDPRESS STATISTICS --> |
| | <div style="line-height: 10px; display: block; text-align: left; font-family: Tahoma; width: 88px; height:31px; border: 0px; background: #e7e7e7; font-size: 7pt;"> |
| | <span style="color: #555555;">Generated by:</span> <?php timer_stop(1); ?> |
| | <span style="color: #555555;">Queries:</span> <?php echo get_num_queries(); ?> |
| | <span style="color: #555555;">Memory:</span> <?php if (function_exists('memory_get_usage')) echo round(memory_get_usage()/1024/1024, 2) . 'MB '; ?> |
| | </div> |
| | <!-- /WORDPRESS STATISTICS --> |
| | </code> |
| | |
| | ==== Проверка работы почты ==== |
| | |
| | Файл в корневой директории WP |
| | |
| | <code php> |
| | <?php |
| | |
| | // Set $to as the email you want to send the test to. |
| | |
| | $to = "[email protected]" ; |
| | |
| | // No need to make changes below this line. |
| | // Email subject and body text. |
| | |
| | $subject = ' wp_mail function test ' ; |
| | $message = ' This is a test of the wp_mail function: wp_mail is working ' ; |
| | $headers = '' ; |
| | |
| | // Load WP components, no themes. |
| | |
| | define ('WP_USE_THEMES', false); |
| | |
| | require('wp-load.php'); |
| | |
| | // send test message using wp_mail function. |
| | |
| | $sent_message = wp_mail( $to, $subject, $message, $headers); |
| | |
| | //display message based on the result. |
| | |
| | if ( $sent_message ) { |
| | |
| | // The message was sent. |
| | echo 'The test message was sent. Check your email inbox.' ; |
| | |
| | } else { |
| | |
| | // The message was not sent. |
| | echo 'The message was not sent!' ; |
| | } |
| | </code> |
| | |
| | ==== htaccess по-умолчанию ==== |
| | |
| | <code> |
| | # BEGIN WordPress Permalinks |
| | RewriteEngine On |
| | RewriteBase / |
| | RewriteRule ^index.php$ - [L] |
| | RewriteCond %{REQUEST_FILENAME} !-f |
| | RewriteCond %{REQUEST_FILENAME} !-d |
| | RewriteRule . /index.php [L] |
| | # END WordPress Permalinks |
| | </code> |
| | |
| | ==== Лимит памяти для Wordpress ==== |
| | |
| | Для wp-admin |
| | |
| | <code>define('WP_MAX_MEMORY_LIMIT', '1024M');</code> |
| | |
| | Для frontend |
| | |
| | <code>define('WP_MEMORY_LIMIT', '512M');</code> |
| | |
| | ==== Еще один пример time used ==== |
| | |
| | <code> |
| | // Script start |
| | $rustart = getrusage(); |
| | |
| | // Code ... |
| | |
| | // Script end |
| | function rutime($ru, $rus, $index) { |
| | return ($ru["ru_$index.tv_sec"]*1000 + intval($ru["ru_$index.tv_usec"]/1000)) |
| | - ($rus["ru_$index.tv_sec"]*1000 + intval($rus["ru_$index.tv_usec"]/1000)); |
| | } |
| | |
| | $ru = getrusage(); |
| | echo "This process used " . rutime($ru, $rustart, "utime") . |
| | " ms for its computations\n"; |
| | echo "It spent " . rutime($ru, $rustart, "stime") . |
| | " ms in system calls\n"; |
| | </code> |
| | |
| | [[https://stackoverflow.com/questions/535020/tracking-the-script-execution-time-in-php|via]] |
| | |
| | ==== Отключить превью для ссылок twitter в постах ==== |
| | |
| | https://wordpress.org/support/article/embeds/ |
| | |
| | Через [[https://wordpress.org/plugins/disable-embeds/|плагин]], через [[https://developer.wordpress.org/reference/functions/wp_oembed_remove_provider/|код]] |
| | |
| | ==== Пересоздание миниатюр ==== |
| | |
| | Печальная новость. Автор плагина [[https://ru.wordpress.org/plugins/regenerate-thumbnails/|Regenerate Thumbnails]] Viper007Bond Alex Mills после долгой борьбы с болезнью ныне RIP. |
| | |
| | Вероятно [[https://developer.wordpress.com/2019/06/06/taking-care-of-alexs-plugins/|сообщество Wordpress]] позаботится о коде. |
| | |
| | Альтернативно для работы с миниатюрами [[https://developer.wordpress.org/cli/commands/media/regenerate/|можно использовать wp-cli]]. |
| | |
| | ==== undefined function trailingslashit() ==== |
| | |
| | <code php> |
| | Fatal error: Uncaught Error: Call to undefined function trailingslashit() in /var/www/rtfm/data/www/foobar.com/wp-includes/class-wp-textdomain-registry.php:103 |
| | ... |
| | </code> |
| | |
| | установить php-psr |
| | |
| | ==== Убрать ограничение 2560 px для загружаемых изображений ==== |
| | |
| | Через [[https://wordpress.org/plugins/disable-big-image-threshold/|плагин]] |
| | |
| | code snippet [[https://wordpress.org/plugins/code-snippets/|плагин]] |
| | |
| | <code php> |
| | <?php |
| | // Disable WordPress' automatic image scaling feature |
| | add_filter( 'big_image_size_threshold', '__return_false' ); |
| | </code> |
| | |
| | functions.php |
| | |
| | <code php> |
| | add_filter( 'big_image_size_threshold', '__return_false' ); |
| | </code> |
| | |
| | изменить размер |
| | |
| | <code php> |
| | function custom_image_threshold( $threshold ) { |
| | return 4000; // new threshold |
| | } |
| | add_filter('big_image_size_threshold', 'custom_image_threshold', 999, 1); |
| | </code> |
| | |
| | {{tag>wordpress cms}} |