phpunit.xml
две константы WP_HOME
и WP_SITEURL
подобным образом:<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
bootstrap="wp-load.php"
convertWarningsToExceptions="false"
convertNoticesToExceptions="false"
>
<testsuites>
...
</testsuites>
<coverage>
...
</coverage>
<php>
<const name="WP_HOME" value="http://example.com"/>
<const name="WP_SITEURL" value="http://example.com/wp"/>
</php>
</phpunit>
// functions.php
function getRequestUri()
{
return ((!empty($_SERVER['HTTPS'])) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
}
// header.php
$cururl = getRequestUri();
WP Kama add_image_size
function sort_by_category(\WP_Post $elem1, \WP_Post $elem2) {
$categories1 = wp_get_post_categories($elem1->post_id);
$categories2 = wp_get_post_categories($elem2->post_id);
...
// Какое-то сравнение $categories1 и $categories2
...
return $categories1_some > $categories2_some ? 1 : -1;
}
...
usort($posts, 'sort_by_category');