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 | |
function get_models_for_parsing($driver, $site_url, $settings, $only_free){ | |
$driver->get($site_url); | |
$driver->wait(180)->until( | |
Facebook\WebDriver\WebDriverExpectedCondition::urlContains($site_url) | |
); | |
//get source form page |
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 | |
require 'vendor/autoload.php'; | |
include("vendor/anticaptcha-php-master/anticaptcha.php"); | |
include("vendor/anticaptcha-php-master/recaptchaV2proxyless.php"); | |
use Facebook\WebDriver\Remote\DesiredCapabilities; | |
use Facebook\WebDriver\Remote\RemoteWebDriver; | |
$chrome_options = new \Facebook\WebDriver\Chrome\ChromeOptions(); |
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 | |
function show_posts_by_tags($tag_id, $post_id, $post_per_page, $orderby, $order){ | |
$params = array( | |
'post_type' => 'post', | |
'post_status' => 'publish', | |
'orderby' => $orderby, | |
'order' => $order, | |
'posts_per_page' => $post_per_page, | |
'tag_id' => $tag_id, | |
'post__not_in' => array($post_id), |
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
<form action="" method="post" class="block-form" enctype="multipart/form-data"> | |
<h4 class="form-heading"><?php _e("Have an idea? Let’s discuss!","Inmost"); ?></h4> | |
<div class="d-flex flex-column form-item"> | |
<label class="label-form" for="email"><?php _e("Email","Inmost"); ?></label> | |
<!--Email--> | |
<input class="input-form" type="email" name="email" id="email" pattern="^(0|[1-9][0-9]*)$" placeholder="<?php _e("Email*","Inmost"); ?>" required> | |
<p class="message-error"><?php _e("This field is required","Inmost"); ?></p> | |
</div> | |
<div class="form-item"> | |
<!--Phone number--> |
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 $terms_post = get_the_terms( $the_query->ID , 'product_cat' ); ?> | |
<div> | |
<?php echo _e( 'Category', 'woocommerce' ) ?>: <?php | |
$iterator=1; | |
foreach ($terms_post as $term_cat): echo $term_cat->name; | |
if(count($terms_post)>1 && $iterator<count($terms_post)): | |
echo ", "; | |
endif; $iterator++; | |
endforeach; ?> | |
</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 | |
//Первый вариант с настройкой отображения | |
$args = array( | |
'orderby'=> 'menu_order', | |
'order'=>'ASC', | |
'hide_empty'=> true, | |
'include'=> get_field("main_woo_category"), | |
'parent'=> 0, | |
); | |
$category_products = get_terms( 'product_cat', $args ); |
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 | |
//Все такосномии этом примере были созданы отедельно. в WP таких изначально нет. Имейте это в виду | |
//Получам все параметры (В нашем случае это все массивы, поэтому сначала их нужно будет подготовить к работе) | |
$clubs_city = $_POST['city']; | |
$clubs_metro = $_POST['metro']; | |
$clubs_ages = $_POST['ages']; | |
$clubs_price = $_POST['price']; | |
//Получаем _clubs_organization_adress_metro |
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 | |
//Добавление своего типа поста с полной настройкой. | |
add_action('init', 'activities_init'); | |
function activities_init() { | |
$labels = array( | |
'name' => __('Мероприятия'), | |
'singular_name' => __('Мероприятие'), | |
'add_new' => __('Добавить новое'), | |
'all_items' => __('Все Мероприятия'), |
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 | |
$posts_id = 3; //получаем id рубрики. Любым удобным способом | |
$count_of_posts = 2; //кол-во выводимых элементов | |
$paged = get_query_var('paged', 1);//Получаем текущую страницу | |
if(!empty($id)){ | |
$get_posts = new WP_Query( "category__in=$posts_id&posts_per_page=$count_of_posts&paged=$paged" ); | |
} | |
else{ | |
$get_posts = new WP_Query( "category__in=1&posts_per_page=$count_of_posts&paged=$paged" ); | |
} ?> |
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 | |
//Асинхронная загрузка видео YouTube (Примимает такие параметры: ссылка на видео и CSS классы) | |
function lazy_iframe($youtube_url, $css_class){ | |
//Получение уникального идетнификатора для видео | |
preg_match('#(\.be/|/embed/|/v/|/watch\?v=)([A-Za-z0-9_-]{5,11})#', $youtube_url, $matches); | |
if(isset($matches[2]) && $matches[2] != ''){ | |
$YoutubeCode = $matches[2];} | |
?> | |
<iframe class="<?php echo $css_class; ?>" | |
src="<?php echo $youtube_url; ?>&controls=0&showinfo=0&autoplay=1" |
NewerOlder