Skip to content

Instantly share code, notes, and snippets.

@eto4detak
eto4detak / php-field.php
Last active August 30, 2019 11:09
php field
<?php
// checkbox
$val = get_option('compare_cars_templ');
$hide_comp_icon = !empty($val['no_comp_icon']) ? $val['no_comp_icon'] : false;
?>
<label><input type="checkbox" name="compare_cars_templ[no_comp_icon]" value="1" <?php checked( 1, $hide_comp_icon ) ?> /></label>
@eto4detak
eto4detak / wp-php-action24312.php
Last active September 4, 2019 14:44
wp php action2412
<?php
add_action( 'wp_head',[&$this, 'hook_css'] );
function hook_css(){
echo '<style>'.self::get_setting('map_styles').'</style>';
}
add_action( 'save_post_product', 'divie_save_post_product_for_urls' );
function divie_save_post_product_for_urls( $post_id ) {
@eto4detak
eto4detak / woo-product.php
Last active August 25, 2019 15:06
woo product
<?php
// get price
$custom_price = floatval($price) > 0 ? floatval($price) : 0;
$price = wc_price($custom_price);
$discount_woo = get_woocommerce_currency_symbol() .' '. $discount;
// create product
function stickertime_set_product_default()
{
global $post;
@eto4detak
eto4detak / wp-php-cf7.php
Created August 4, 2019 18:12
wp php cf7
<?php
///////////////////////////////////////////////////////////////////////////////////////////
/////// добавить файл в cf7
///////////////////////////////////////////////////////////////////////////////////////////
add_filter( 'wpcf7_mail_components', 'filter_wpcf7_mail_components', 10, 3 );
function filter_wpcf7_mail_components( $components, $wpcf7_get_current_contact_form, $instance ) {
$components['attachments'][] = __DIR__. '/screenshot.png';
return $components;
@eto4detak
eto4detak / proxi.php
Last active August 26, 2019 08:06
php proxi
<?php
///////////////////////////////////////////////////////////////////////////////////////////
/////// proxi
///////////////////////////////////////////////////////////////////////////////////////////
function proxi($url, $postdata = null, $cookiefile = 'tmp/cookie.txt'){
$proxy = '127.0.0.1:8888';
//$proxyauth = 'user:password';
$ch = curl_init($url);
@eto4detak
eto4detak / security hak.php
Created September 2, 2019 08:14
php security hak
<?php
$nonce = wp_create_nonce('my-nonce');