Хомпэйдж, доки, лалала
Спасибо следующим статьям, которые сэкономили мне много времени.
Bootstrap based themes
Разное
Карта сайта
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
Через Search Replace DB, github.
<?php echo "Статистика:" . get_num_queries() . "/ "; timer_stop(1); echo "s/ ". round(memory_get_usage()/1024/1024, 2) . " MB "; ?>
В стиле LiveInternet
<!-- 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 -->
Файл в корневой директории WP
<?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!' ; }
# 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
Для wp-admin
define('WP_MAX_MEMORY_LIMIT', '1024M');
Для frontend
define('WP_MEMORY_LIMIT', '512M');
// 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";
Печальная новость. Автор плагина Regenerate Thumbnails Viper007Bond Alex Mills после долгой борьбы с болезнью ныне RIP.
Вероятно сообщество Wordpress позаботится о коде.
Альтернативно для работы с миниатюрами можно использовать wp-cli.
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 ...
установить php-psr
Через плагин
code snippet плагин
<?php // Disable WordPress' automatic image scaling feature add_filter( 'big_image_size_threshold', '__return_false' );
functions.php
add_filter( 'big_image_size_threshold', '__return_false' );
изменить размер
function custom_image_threshold( $threshold ) { return 4000; // new threshold } add_filter('big_image_size_threshold', 'custom_image_threshold', 999, 1);