Skip to content

Instantly share code, notes, and snippets.

@farik92
farik92 / loop.php
Created August 2, 2019 14:36 — forked from asadaly111/loop.php
WooCommerce Category Loop
<?php
/**
* Template Name: Fullwidth
*/
get_header(); ?>
<div class="container">
<?php /* The loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php the_post_thumbnail(); ?>
@farik92
farik92 / wc-create-order-via-ajax.php
Created August 6, 2019 21:49 — forked from mihdan/wc-create-order-via-ajax.php
Програмное создание заказа в WooCommerce через Ajax
<?php
/**
* Создание заказа по кнопке "Заказать в один клик
*/
function roomble_ajax_create_order() {
// Получить корзину
$cart = WC()->cart;
$phone = esc_attr( trim( $_REQUEST['phone'] ) );
@farik92
farik92 / cf7-to-webhook-air-table.php
Last active December 7, 2020 23:38 — forked from mariovalney/cf7-to-webhook-air-table.php
Send webhook to Airtable API
<?php
/**
*
* Plugin Name: CF7 to Webhook - Airtable
* Description: Send webhook to Airtable API
* Version: 1.0.0
* Author: Mário Valney
* Author URI: https://mariovalney.com
* Text Domain: cf7-to-webhook-air-table
*/
@farik92
farik92 / wpcf7_modal_invalid.php
Created December 7, 2020 23:42 — forked from campusboy87/wpcf7_modal_invalid.php
Displays a message about the successful submission of the form in a modal window for the Contact Form 7 plugin
<?php
/**
* Plugin Name: CF7 Modal Invalid Answer
* Plugin URI: https://gist.github.com/campusboy87/a056c288c99feee70058ed24cee805ad
* Author: Campusboy (wp-plus)
* Author URI: https://www.youtube.com/wp-plus
*/
add_action( 'wp_enqueue_scripts', 'wpcf7_modal_invalid_js' );
add_action( 'wp_footer', 'wpcf7_modal_invalid_js_inline', 999 );
@farik92
farik92 / code_editor_for_contact_form_7.php
Created December 7, 2020 23:42 — forked from campusboy87/code_editor_for_contact_form_7.php
Code Editor for Contact Form 7 (WordPress / CodeMirror).
<?php
/**
* Plugin Name: Code Editor for Contact Form 7
* Plugin URI: https://gist.github.com/campusboy87/2daad24e45116721759991549b626977
* Author: Campusboy (wp-plus)
* Author URI: https://www.youtube.com/wp-plus
*/
add_action( 'admin_print_styles-toplevel_page_wpcf7', function () {
@farik92
farik92 / xml_to_minishop2.php
Created December 15, 2020 06:11 — forked from iksecreeet/xml_to_minishop2.php
Очередной импортёр товаров из XML файла в интернет-магазин на MODX Revolution v.2.4.4-pl + miniShop2 v.2.2.0-pl2
<?php
$tplProduct = 3; //номер шаблона для карточки товара
$tplParent = 2; //номер шаблона для категорий
$tplChildParent = 2; //номер шаблона для подкатегорий
$idParent = 6; //id каталога товаров
$fileProduct = 'product.xml'; //имя файла с товарами
$xpath_expression['pagetitle'] = '//Товары/Номенклатура'; //DOM структура в XML файле до имени
$xpath_expression['article'] = '//Товары/Артикул'; //DOM структура в XML файле до артикула
$xpath_expression['parents'] = '//Товары/Родитель'; //DOM структура в XML файле до родителей
@farik92
farik92 / acf_get_file.php
Created February 8, 2021 17:07 — forked from jdhobbsuk/acf_get_file.php
Get the file URL from ACF, including file type and size
/**
* Get ACF File
*
* @param string $key – the ACF field key
* @param string $post_id – the ID of the post (if empty, will use $post->ID)
* @return string The image URL
**/
function get_acf_file( $key = 'file', $post_id = '' ) {
if($post_id == ''):
global $post;
@farik92
farik92 / functions.php
Created January 25, 2022 01:15 — forked from naBJIyxa/functions.php
Произвольные Типы Записей Wordpress | Custom Post Type | Создание и Вывод
<?php
/**
* Добавляем произвольный тип записи со всеми настройками
* https://wp-kama.ru/function/register_post_type#hilsjs_extra_css
* Генератор Post Type https://generatewp.com/post-type/
* Ютуб https://www.youtube.com/watch?v=iRLhKNXNIzI
* Вывод https://wordpressrus.ru/wordpress/vyvod-proizvolnyh-tipov-zapisej-wordpress.html
*/
add_action('init', 'create_services_type');
@farik92
farik92 / cf7-sendpulse.php
Created February 15, 2022 21:54 — forked from smartdeal/cf7-sendpulse.php
пример интеграции #Wordpress #Sendpulse #WP_CF7
<?php
function add_email_to_sendpulse($contact_form) {
$wpcf7 = WPCF7_ContactForm::get_current();
$submission = WPCF7_Submission::get_instance();
$data = $submission->get_posted_data();
$cur_email = $data['Email'];
if ($cur_email != '') {
define( 'API_USER_ID', '' );
// Register Custom Taxonomy
function ess_custom_taxonomy_Item() {
$labels = array(
'name' => 'Brands',
'singular_name' => 'Brand',
'menu_name' => 'Brands',
'all_items' => 'All Brands',
'parent_item' => 'Parent Brand',
'parent_item_colon' => 'Parent Brand:',