Skip to content

Instantly share code, notes, and snippets.

<?php
session_start();
date_default_timezone_set('Europe/Kiev');
$tgtoken = '771631726:AAE25hzwYyRdxeDH3yMHwqLDzTvunfzVqAM';
$tgchatid = '';
$crm_lp_token = '';
$crm_lp_adress = 'http://__________.lp-crm.biz';
@wpdew
wpdew / using-details-summary-github.md
Created November 25, 2022 13:09
How to use <details> <summary> expandable content on GitHub with Markdown

How to use <details> <summary> expandable content on GitHub with Markdown

Firstly, what is <details> <summary>?

The HTML Details Element (<details>) creates a disclosure widget in which information is visible only when the widget is toggled into an "open" state. A summary or label can be provided using the <summary> element. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details.

Example

@wpdew
wpdew / perfex_hooks_list
Created November 2, 2022 08:10 — forked from JamesSimpson/perfex_hooks_list
Full Perfex Hook List - For Perfex CRM Developers
File ---> application\controllers\admin\Authentication.php:
23: hooks()->do_action('admin_auth_init');
80: hooks()->do_action('after_staff_login');
107: hooks()->do_action('after_staff_login');
117: hooks()->do_action('after_staff_login');
219: hooks()->do_action('after_user_logout');
File ---> application\controllers\admin\Auto_update.php:
14: hooks()->do_action('before_perform_update', $latest_version);
/**
* WP_Customize_Manager->add_setting(); // adds a new setting to the database
* WP_Customize_Manager->add_section(); // adds a new section (i.e. category/group) to the Theme Customizer page
* WP_Customize_Manager->add_control(); // creates an HTML control that admins can use to change settings.
* WP_Customize_Manager->get_setting(); // can be used to fetch any existing setting, in the event you need to modify something
*/
add_action( 'customize_register', 'my_customize_register' );
function my_customize_register( $wp_customize ) {
@wpdew
wpdew / WordPress Repeater MetaBox.php
Created July 11, 2022 07:40 — forked from akshuvo/WordPress Repeater MetaBox.php
Creating a “repeater meta-box” without a Plugin in WordPress
<?php
add_action('admin_init', 'gpm_add_meta_boxes', 2);
function gpm_add_meta_boxes() {
add_meta_box( 'gpminvoice-group', 'Custom Repeatable', 'Repeatable_meta_box_display', 'page', 'normal', 'default');
}
function Repeatable_meta_box_display() {
global $post;
$gpminvoice_group = get_post_meta($post->ID, 'customdata_group', true);
<?php
/**
* Plugin Name: Custom Fields for WooCommerce
* Description: Add custom fields to WooCommerce products
* Version: 1.0.0
* Author: Gareth Harris
* Author URI: https://catapultthemes.com/
* Text Domain: cfwc
* WC requires at least: 3.4.0
* WC tested up to: 3.4.2
@wpdew
wpdew / ERateUkr.php
Created May 25, 2022 19:13
Parser (api) goverla.ua(new version), php, json.
<?php
/**
* Курс валют парсинг з goverla.ua (парсить нову версію сайту!) та API приватбанку
* Автор: Богдан Карпов <bogdan.karpow@urk.net>
* Telegram: @BogdanKarpov
*/
class ERateUkr
{
@wpdew
wpdew / functions.php
Created May 16, 2022 11:47
Send a welcome email to new user wordpress
//send_welcome_email
function send_welcome_email_to_new_user($user_id) {
$user = get_userdata($user_id);
$user_email = $user->user_email;
// for simplicity, lets assume that user has typed their first and last name when they sign up
$user_full_name = $user->user_firstname . $user->user_lastname;
// Now we are ready to build our welcome email
$to = $user_email;
$subject = "Hi " . $user_full_name . ", welcome to our site!";
@wpdew
wpdew / functions.php
Created May 13, 2022 13:41
Enable Login with Email and username WordPress.
<?php
remove_filter('authenticate', 'wp_authenticate_username_password', 20);
add_filter('authenticate', 'login_with_email', 20, 3);
function login_with_email($user, $email, $password) {
//Check for empty fields
if(filter_var($email, FILTER_VALIDATE_EMAIL) ){
if(empty($email) || empty ($password)){
//create new error object and add errors to it.
$error = new WP_Error();
@wpdew
wpdew / functions.php
Created May 13, 2022 13:40
Customizing Comment form WordPress
<?php
/**
* Comment Style Callback
*/
function fuji_comment_callback($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
if ( 'div' == $args['style'] ) {
$tag = 'div';