Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
On vacation

Pechenki PechenkiUA

💭
On vacation
View GitHub Profile
@PechenkiUA
PechenkiUA / merchants_google.xml
Created April 27, 2023 11:44
merchants_google modx minishop 2
View merchants_google.xml
<?xml version="1.0"?>
<feed xmlns:g="http://base.google.com/ns/1.0" xmlns="http://www.w3.org/2005/Atom">
<title>Оздоровча cкандінавская ходьба</title>
<link href="[[~1?scheme=`full`]]uk" rel="alternate" type="text/html"/>
<description>[[*description:cdata]]</description>
[[!msProducts?
&includeContent=`1`
&parents=`89`
&limit=`999`
&includeTVs=`img`
@PechenkiUA
PechenkiUA / article
Created April 7, 2023 09:38
getJSONLD article
View article
<?php
// если на этой странице контент не является объектом "Article", то завершаем работу (на сайте статьи имеют шаблон с id = 2)
if ($modx->resource->get('template') !== 7) {
return;
}
// URL сайта
$siteUrl = $modx->getOption('site_url'); //$modx->getOption('http_host'); //$modx->getOption('site_url');
// id страницы
$id = $modx->resource->get('id');
@PechenkiUA
PechenkiUA / Productld
Created April 7, 2023 09:36
minishop2 modx schema.org Product
View Productld
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "[[*pagetitle]]",
"image": "[[*image]]",
"description": "[[*introtext:strip_tags:escape:notags]]",
"sku": "[[+id]]",
"brand": {
"@type": "Brand",
@PechenkiUA
PechenkiUA / functions.php
Created March 28, 2023 17:24
Send message from change status
View functions.php
<?php
/**
* Send message from change status
*/
add_action('woocommerce_order_status_changed',function ( $order_id, $old_status, $new_status, $order){
global $Telsender;
if ($new_status == 'processing'){
$text = sprintf('%s - order_status_changed',$new_status);
$Telsender->telegram->SendMesage($text);
@PechenkiUA
PechenkiUA / functions.php
Created March 28, 2023 16:22
Telsender WC status name
View functions.php
<?php
/**
* Telsender WC status name
* @param $list
* @param $order_id
* @return mixed
*/
function telsender_status_translate($list, $order_id){
$order = wc_get_order( $order_id );
@PechenkiUA
PechenkiUA / style.css
Created March 7, 2023 07:42
b4u - filter
View style.css
[data-seo-name="3-shirina-sm"],
[data-seo-name="9-dovzhina-sm"] {
display: inline-flex;
width: 49%;
flex-direction: row-reverse;
flex-wrap: wrap;
padding: 5px!important;
}
[data-seo-name="3-shirina-sm"] .mfilter-heading-text,
@PechenkiUA
PechenkiUA / functions.php
Last active May 24, 2023 08:10
schema_TinyMCE_init
View functions.php
<?php
function tsm_get_extended_valid_elements() {
$elements = array(
'@' => array(
'id',
'class',
'style',
'title',
'itemscope',
'itemtype',
@PechenkiUA
PechenkiUA / functions.php
Last active February 21, 2023 21:30
User data Telsender
View functions.php
/**
* @param $list
* @param $order_id
* @return mixed
*/
function user_data_function($list, $order_id){
$user_id = get_current_user_id();
if ($user_id){
@PechenkiUA
PechenkiUA / functions.php
Created January 19, 2023 21:05
Translate_Press
View functions.php
add_filter('trp_hreflang', 'trpc_change_hreflang', 10, 2 );
function trpc_change_hreflang( $hreflang, $language ){
//if ($hreflang == 'ru-RU') return false;
$arr = [
'ru'=>'ru-UA',
'uk'=>'uk-UA'
];
@PechenkiUA
PechenkiUA / iframe.js
Created December 29, 2022 07:18
Youtube iframe contentWindow.postMessage command
View iframe.js
document.querySelector('iframe').contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');