This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* add toggle control to star rating widget for schema | |
**/ | |
add_action( 'elementor/element/star-rating/section_rating/before_section_end', function( $element, $args ) { | |
$element->add_control( | |
'use_schema', | |
[ | |
'type' => \Elementor\Controls_Manager::SWITCHER, | |
'label' => __( 'Use Schema', 'elementor' ), | |
'label_on' => __( 'Enable', 'elementor' ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 ){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** 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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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' ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 ); |