Skip to content

Instantly share code, notes, and snippets.

@eto4detak
eto4detak / media.css
Created February 23, 2018 09:28
css media
@media (max-width: 576px){
.container{
max-width: none;
}
}
@media (min-width: 576px){
.container{
max-width: 540px;
}
@eto4detak
eto4detak / js script.js
Last active July 2, 2019 16:55
js script
'<a href="javascript:void(0)">Войти</a>';
window.location.href = 'uploads/file.doc';
str.search( /лю/i );
window.open('http://ya.ru');
document.body.style.background = 'red';
location.href = location.pathname + '/?wt_city_by_default=' + geoData.city;
event.preventDefault();
$('html, body').animate( { scrollTop: 0 }, 'medium');
.....................CHROME............................
monitorEvents($0) -- смотреть события js
@eto4detak
eto4detak / ajax-newwp.php
Last active May 26, 2019 21:18
ajax newwp
<?php
///////////////////////////////////////////////////////////////////////////////////////////
/////// ADMIN PAGE SETTINGS
///////////////////////////////////////////////////////////////////////////////////////////
add_action('admin_menu', 'access_register_wc_submenu_page');
function access_register_wc_submenu_page() {
add_submenu_page( 'edit.php?post_type=product', 'Страна для подкатегории', 'Страна для подкатегории', 'manage_options', 'access-product-attribute-state', 'access_my_wc_submenu_page_callback' );
}
@eto4detak
eto4detak / php.php
Last active October 29, 2019 16:54
php
<?php
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
// get array url params
parse_str(parse_url($test_query['$HTTP_REFERER'], PHP_URL_QUERY), $output);
$get_params = array(
'foo' => 'bar',
'baz' => 'boom',
'cow' => 'milk',
@eto4detak
eto4detak / preg.php
Last active July 6, 2019 09:46
php preg
<?php
$result = preg_match('/<spa.+>(.+)<\/span>/',$str,$found);
$result = preg_match('/<strong>(.+)<\\/strong>/',$str,$found);
$ulclass = preg_replace('/<a /', '<a class="cms30_link" onclick="yaCounter49161010.reachGoal(' . "'callback_click'" . '); return true;"', $ulclass, 1);
return preg_replace('/<a href/', '<a class="cms30_link" onclick="yaCounter49161010.reachGoal('."'calculate_click'".'); return true;" href', $ulclass, 1);
$new_key = preg_replace('/^\./', '', $new_key, 1);
@eto4detak
eto4detak / tax.php
Last active December 3, 2022 06:52
wp php tax
<?php
$cur_queried_object = get_queried_object();
/*========================================================
* получить родительскую по названию и родительской term_id
========================================================*/
$terms = get_terms( array(
'taxonomy' => array( 'category', ), // название таксономии с WP 4.5
'child_of' => $department_term->term_id,
'name__like' => $cat_lvl2->subdivision,
) );
@eto4detak
eto4detak / admin_menu.php
Last active July 23, 2019 08:25
wp php admin_menu
<?php
// add admin page
function stickertime_admin_menu_options()
{
add_menu_page('StickerTime Menu','StickerTime','manage_options','stickertimeadmin','stickertime_admin_page','dashicons-excerpt-view',2);
}
add_action('admin_menu','stickertime_admin_menu_options');
@eto4detak
eto4detak / wp-widget.php
Created July 29, 2018 21:11
wp php widget menu custom
<?php
class Asc_ch_WP_Nav_Menu_Widget extends WP_Widget {
public function __construct() {
$widget_ops = array(
'classname' => 'col masonry-col', //задать клаасс CSS
'description' => __( 'Add a custom menu to your sidebar +' ),
'customize_selective_refresh' => true,
);
parent::__construct( 'ask_widget_nav_menu', __('Меню +'), $widget_ops );
@eto4detak
eto4detak / curl.php
Last active September 24, 2019 13:25
php curl
<?php
private static $bearer = "2MDaDp4eFyFqMkj33grHC1wDuSYZ8mso";
static function getPurchaseData( $code ) {
//setting the header for the rest of the api
$bearer = 'bearer ' . self::$bearer;
$header = array();