Skip to content

Instantly share code, notes, and snippets.

View webdevs-pro's full-sized avatar

Alex Ishchenko webdevs-pro

View GitHub Profile
@webdevs-pro
webdevs-pro / Debug.php
Created July 28, 2019 20:57 — forked from sunel/Debug.php
PHP Pretty var_dump
<?php
class Debug {
/**
* A collapse icon, using in the dump_var function to allow collapsing
* an array or object
*
* @var string
*/
<?php
public function enqueue_script(){
wp_register_script( 'general-script', EC_EXTENTIONS_URL . 'assets/js/script.js', [ 'jquery' ], EC_ELEMENTOR_VERSION, true );
}
public function register_frontend_styles(){
wp_register_style('general-style', EC_EXTENTIONS_URL . 'assets/css/general.css', array(), EC_ELEMENTOR_VERSION);
}
public function enqueue_frontend_styles(){
@webdevs-pro
webdevs-pro / index.php
Created September 17, 2019 04:10
set woo product fatured image by product first gallery image
<ul class="products">
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => -1
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
@webdevs-pro
webdevs-pro / script.js
Created December 1, 2019 23:32
Facebook share modal
jQuery(document).ready(function($) {
$('.fb_share a').click(function(e) {
e.preventDefault();
window.open($(this).attr('href'), 'fbShareWindow', 'height=450, width=600, top=' + ($(window).height() / 2 - 275) + ', left=' + ($(window).width() / 2 - 300) + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');
return false;
});
});
@webdevs-pro
webdevs-pro / index.php
Created December 5, 2019 12:08
ACF confirm password validation
<?php
add_filter('acf/validate_value/name=user_password_confirm', 'my_validated_password_filter', 10, 4);
function my_validated_password_filter($valid, $value, $field, $input) {
if (!$valid) {
return $valid;
}
// field key of the field you want to validate against
$password_field = 'field_5de8dff728aa2';
if ($value != $_POST['acf'][$password_field]) {
$valid = 'Does Not Match Password';
@webdevs-pro
webdevs-pro / gist:df6911c5dcb3160ec28a8732bfefb9b4
Created December 30, 2019 18:15 — forked from oooh-boi/gist:3e3fbb773ebbd647b92de8880aa4c5ef
CSS and jQuery code used in "Custom Slider in Elementor built with Elementor" video tutorial
/* ---------- CSS
- should be "attached" to the master Section */
/* make 100% wide columns possible for Desktop devices in Elementor */
.custom-swiper .elementor-container .elementor-row {
/*flex-wrap: wrap;*/
}
/* make all the colums-slides 100% wide and full screen tall */
.custom-swiper > .elementor-container > .elementor-row > .elementor-element.elementor-column {
width: 100%;
@webdevs-pro
webdevs-pro / index.php
Last active January 6, 2020 08:47
view&update custom fields in the [ultimatemember_account] page
<?php
add_action('um_after_account_general', 'showUMExtraFields', 100);
function showUMExtraFields() {
$id = um_user('ID');
$output = '';
$names = array('birth_date');
$fields = array();
foreach( $names as $name ) {
@webdevs-pro
webdevs-pro / index.php
Created January 7, 2020 08:48
Ultimate Member custom fields for account tab + custom tabs
<?php
// add custom registration fields to UM account tab
add_action('um_after_account_general', 'AAshowUMExtraFields', 100);
function AAshowUMExtraFields() {
$id = um_user('ID');
$output = '';
$names = array('birth_date', 'height', 'football_club', 'phone_number');
$fields = array();
foreach( $names as $name ) {
@webdevs-pro
webdevs-pro / index.php
Created January 10, 2020 13:52
php convert text with <br> to JSON format text
<?php
$daily_reading_in_word = get_field('daily_reading_in_word');
$daily_reading_in_word = trim( preg_replace( '/(\r\n)|\n|\r/', '<br/>', $daily_reading_in_word ) );
$daily_reading_in_word = str_replace('<br/>','\r\n',$daily_reading_in_word);
$daily_reading_in_word = str_replace('<br />','',$daily_reading_in_word);
@webdevs-pro
webdevs-pro / style.css
Created January 20, 2020 22:05
Messenger custom dark styles
body, html {
background: black;
}
/* FIX */
._5irm._7mkm {
background-color: transparent !important;