Skip to content

Instantly share code, notes, and snippets.

View gicolek's full-sized avatar

Rafał Gicgier - Certified Codeable Expert Developer gicolek

View GitHub Profile
@gicolek
gicolek / custom-widget-script.js
Created May 31, 2022 12:40
Sample Widget Script
jQuery(document).ready(function(e){
console.log( 'This is my custom widget script' );
});
@gicolek
gicolek / custom-widget-style.css
Created May 31, 2022 12:39
Sample Custom Widget Style
.c-posts {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
max-width: 1024px;
}
.c-post {
flex: 0 0 25%;
@gicolek
gicolek / custom_elementor_widget_2.php
Created May 31, 2022 12:37
Custom Elementor Widget Part 2
<?php
// make sure this line is here, the Widget Base belongs to Elementor Namespace
namespace Elementor;
if ( !defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
// Extend the \Elementor\Widget_Base class
class My_Widget_Custom_Blog_Loop extends Widget_Base {
@gicolek
gicolek / functions.php
Created May 30, 2022 15:21
Custom Elementor Widget functions.php
<?php
/**
* Custom Elementor Widgets
*/
class Custom_Elementor_Widgets {
protected static $instance = null;
public static function get_instance(){
if ( !isset( static::$instance ) ) {
@gicolek
gicolek / custom_elementor_widget.php
Last active May 31, 2022 09:51
Custom Elementor Widget Code
<?php
// make sure this line is here, the Widget Base belongs to Elementor Namespace
namespace Elementor;
if ( !defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
// Extend the \Elementor\Widget_Base class
@gicolek
gicolek / custom_elementor_widget_settings.php
Last active April 20, 2021 14:08
Custom Elementor Widget Settings
<?php
protected function _register_controls() {
// Section Title
$this->start_controls_section(
'section_title',
[
'label' => __( 'RAC Product Filters', 'elementor' ),
]
);
@gicolek
gicolek / elementor_custom_widget_settings.php
Last active April 20, 2021 14:05
Elementor Custom Widget Settings
<?php
// note: previous code above
// used to identify our widget
public function get_name() {
return 'rac-product-filters';
}
// this is what the Widget name visible from the Widget Screen
public function get_title() {
@gicolek
gicolek / custom_elementor_widget_top.php
Created April 20, 2021 13:55
Custom Elementor Widget Top
<?php
namespace Elementor;
class Widget_Product_Filters extends Widget_Base {
@gicolek
gicolek / gf_acf_population.php
Last active August 2, 2019 15:22
Populate Gravity Form Field with ACF field value
<?php
/* part of a php CLASS */
add_filter( 'gform_field_value_v_vin', array($this, 'vehicle_vin_population') );
public function vehicle_vin_population( $value ){
if($this->vehicle_id != 0) {
return get_field('v_vin', $this->vehicle_id);
}
}
@gicolek
gicolek / login_submission_handler.php
Created August 2, 2019 15:13
Login user based on the Gravity Form Submitted Data
<?php
/* part of a PHP Class */
public function login_form_after_submission($entry, $form) {
// get the username or email and pass
$username_or_email = $entry[1];
$pass = $entry[3];
$creds = array();
// create the credentials array
if( email_exists($username_or_email) ){
$user = get_user_by( 'email', $username_or_email );