Skip to content

Instantly share code, notes, and snippets.

pingram3541 pingram3541

Block or report user

Report or block pingram3541

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pingram3541
pingram3541 / functions.php
Created Feb 21, 2020
How to hide Elementor Section or Widget for use with custom conditional
View functions.php
//How to hide any widget with an id of 'test':
add_filter( 'elementor/frontend/widget/should_render', function( $bool, $element ){
$settings = $element->get_settings();
if( 'test' === $settings['_element_id'] && 'heading' === $type ){
return false;
} else { return true }
}, 10, 3);
//How to hide any specific type of widget':
add_filter( 'elementor/frontend/widget/should_render', function( $bool, $element ){
@pingram3541
pingram3541 / functions.php
Created Jan 10, 2020
Elementor Posts widget change query to more post types instead of just one
View functions.php
/** Showing multiple post types in Posts Widget
* 1) Add "my_custom_filter" or your unique id to your Posts element
* 2) Add the following code to your functions.php making sure to use the same
* unique id that you added to the Posts widget
* 3) Modify the post-types below in the code as needed to match
* the post types you'd desire to use
**/
add_action( 'elementor/query/my_custom_filter', function( $query ) {
// Here we set the query to fetch posts with
// post type of 'custom-post-type1' and 'custom-post-type2'
@pingram3541
pingram3541 / functions.php
Last active Jan 5, 2020
Shotcode to create custom url from ACF fields and post id
View functions.php
/**
* Returns a custom url based on the post id, title and a unique ACF field value then loops through
* the resulting string of id's returned by "this" post's ACF field, querying and returning yet another ACF
* field from each looped post id.
**/
add_shortcode( 'url_from_acf', 'my_url_from_acf' );
function my_url_from_acf(){
$post_id = get_the_ID();
if ( get_post_type( $post_id ) === 'my_cpt' ) {
@pingram3541
pingram3541 / functions.php
Created Jan 4, 2020
Elementor Widget Render Action on Specific Post Type Only
View functions.php
add_action( 'elementor/widget/render_content', function( $content, $widget ){
if ( 'button' === $widget->get_name() && 'my_cpt' == get_post_type() ) {
$settings = $widget->get_settings();
//make sure it is the right button element
if ( ! empty( $settings['_element_id'] ) && $settings['_element_id'] === 'my_button' ) {
$settings['link']['url'] = 'https://my-custom-url.com/';
/**
* How do I update $content with
@pingram3541
pingram3541 / functions.php
Created Dec 11, 2019
capture $_POST on specific page w/ Elementor widget of matching ID
View functions.php
if ( ! function_exists('write_log')) {
function write_log ( $log ) {
if ( is_array( $log ) || is_object( $log ) ) {
error_log( print_r( $log, true ) );
} else {
error_log( $log );
}
}
}
@pingram3541
pingram3541 / functions.php
Last active Aug 27, 2019
MailerLite Integration w/ Resubscribe support - Elementor Pro Forms
View functions.php
add_action( 'elementor_pro/forms/new_record', function( $record ) {
// Make sure this is the correct form
$form_name = $record->get_form_settings( 'form_name' );
if ( 'YOUR_ACTUAL_FORM_NAME_HERE' !== $form_name ) {
return;
}
$submmited_fields = $record->get( 'fields' );
// Ref: https://developers.mailerlite.com/v2/reference#create-a-subscriber
$fields = [
@pingram3541
pingram3541 / functions.php
Last active Jul 29, 2019
Wordpress Inline Script with Fallback
View functions.php
<?php
/**
* see - https://digwp.com/2019/07/better-inline-script/
* by - Jeff Starr
*/
// enqueue scripts
function shapeSpace_enqueue_scripts() {
wp_enqueue_script('shapeSpace_script', get_template_directory_uri() .'/js/script.js', array(), '1.0', true);
@pingram3541
pingram3541 / gradient.css
Created Apr 11, 2019
Background Gradient Animation
View gradient.css
#gradient {
background: linear-gradient(-45deg,#ee7752,#e73c7e,#23a6d5,#23d5ab);
background-size: 400% 400%;
-webkit-animation: Gradient 15s ease infinite;
-moz-animation: Gradient 15s ease infinite;
animation: Gradient 15s ease infinite;
}
@-webkit-keyframes Gradient {
0% {
background-position: 0 50%
@pingram3541
pingram3541 / functions.php
Created Mar 6, 2019
Override parent theme script file w/ modified child theme version
View functions.php
/**
* Override the parent theme misc.js script.
*
* fix for Elementor popup forms due to
* issue w/ Bold Themes Medicare theme
*/
function boldtheme_deregister_script() {
if( is_page( array( 'mypage', 'myotherpage' ) ) ){
wp_deregister_script( 'boldthemes_misc_js' );
wp_register_script( 'boldthemes_misc_js', get_stylesheet_directory_uri() . '/scripts/misc.js', array( 'jquery' ), null, false );
@pingram3541
pingram3541 / functions.php
Created Mar 4, 2019
Add rendering of shortcodes in Elementor Slides widget
View functions.php
/**
* Add rendering of shortcodes in Elementor Slides widget
*
* Simply renders shortcodes in slide content
*
**/
add_action( 'elementor/widget/render_content', function( $content, $widget ) {
if ( 'slides' === $widget->get_name() ) {
$content = do_shortcode( $content );
}
You can’t perform that action at this time.