This file contains 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
function handle_custom_404() { | |
// Получаем запрашиваемый путь URL | |
$request_uri = $_SERVER['REQUEST_URI']; | |
$request_path = trim(urldecode($request_uri), '/'); | |
// Извлекаем только последний сегмент пути | |
$last_segment = basename($request_path); | |
// Функция для поиска существующего пути в других папках | |
function find_existing_path($path) { |
This file contains 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
function youtube_embed_shortcode($atts) { | |
// Extract the video ID from the shortcode parameters | |
$atts = shortcode_atts(array( | |
'id' => '' | |
), $atts); | |
// Check if the video ID is provided | |
if (empty($atts['id'])) { | |
return '<p>Please provide a video ID.</p>'; | |
} |
This file contains 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 | |
/** | |
* Plugin Name: Custom Search Widget | |
* Description: Виджет с полем поиска, который можно добавлять через настройки "Внешний вид" -> "Виджеты". | |
* Version: 1.4 | |
* Author: Andrew Lazarev | |
*/ | |
// Регистрация виджета | |
class Custom_Search_Widget extends WP_Widget { |
This file contains 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 | |
/** | |
* Add reCaptcha to checkout form | |
* Note: Can't place within the payment part of the form, WooCommerce just won't show it, choose an appropriate action to add it to accordingly | |
* @param $checkout | |
*/ | |
function doublee_show_me_the_checkout_captcha($checkout) { | |
echo '<div class="g-recaptcha" data-sitekey="YOUR_KEY_HERE"></div>'; | |
} | |
add_action('woocommerce_checkout_order_review', 'doublee_show_me_the_checkout_captcha', 18); |