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_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 );
@gicolek
gicolek / wp-demo.html
Created August 30, 2018 14:12
WP demo HTML sample
<h2>Heading 2</h2>
Lorem ipsum dolor sit amet, <a href="http://www.example.org">consectetuer adipiscing</a> elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud <strong>exerci tation</strong> ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse <em>molestie consequat</em>, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio <abbr title="dignissim qui blandit">dqb</abbr> praesent luptatum
zzril delenit augue duis dolore te feugait nulla facilisi.
<a href="#"><img class="alignright" src="http://placehold.it/150x100" alt="" /></a> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam,ac
quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem v
@gicolek
gicolek / bbpress.php
Created May 27, 2016 11:56
Add bbPress Topic belonging from a specific Forum to ACF Recent Posts Widget only.
<?php
add_filter( 'acf_rwp_query', 'wp_doin_add_bbpress_forum_topics' );
function wp_doin_add_bbpress_forum_topics($query) {
$query['post_type'] = 'topic';
// this is the id of the specific forum
$query['post_parent'] = 126;
return $query;
}
@gicolek
gicolek / uoe.php
Last active September 2, 2017 16:16
Username or Email login
<?php
//Заставляем работать форму авторизации GF
/*
* This hook fires after the form was submitted and the whole data was validate, we’ll bind it to the form which have just created.
*/
// the _14 prefix has to match the id of the form you have created
add_action( "gform_after_submission_14", "login_form_after_submission", 10, 2 );
function login_form_after_submission($entry, $form) {
@gicolek
gicolek / reload.js
Created October 27, 2015 14:20
Dynamic WooCommerce attributes reload
/**
* Handler for Widget Filters
* **********************************************************************************
*/
var obj = {};
var obj_ajax = {};
var out = '';
// on each widget input click
$('.widget_attributes input').click(function (e) {