Skip to content

Instantly share code, notes, and snippets.

@JeffAspen
JeffAspen / gist:eec107dce0313ea432e87c903480caa4
Last active June 26, 2024 23:57
Elementor Remove Font Awesome
/**
* https://docs.elementor.com/article/286-speed-up-a-slow-site
*
* Note: By default, Font Awesome icons will only load on the pages where you've used them, so FA won't load on pages that aren't using any Font Awesome icons. This brings faster performance and faster page speed to your site, which can benefit your SEO and your users' experience. Only the CSS and fonts of the icon family you actually use are loaded. So only dequeue Font Awesome if you truly plan to not use any Font Awesome icons at all. If you dequeue Font Awesome, the icons will no longer show on any of your pages
*
*/
// Elementor - Remove Font Awesome
add_action( 'elementor/frontend/after_register_styles',function() {
foreach( [ 'solid', 'regular', 'brands' ] as $style ) {
## Custom Post Type
- Products
### Taxonomies
- Types
-- Term examples: Milkshakes, Sundaes, Cones
- Flavors
-- Term Examples: Chocolate, Vanaila, Mint Chip
@JeffAspen
JeffAspen / elementor-section-control-padding
Created October 1, 2018 15:21
Elementor Section Control Padding
<?php
add_action('elementor/element/before_section_end', function( $section, $section_id, $args ) {
if( $section->get_name() == 'section' && $section_id == 'section_layout' ){
$section->add_control(
'wpb_section_padding',
[
'label' => _x( 'Section Padding (top & bottom)', 'Section Control', 'wpb-plugins' ),
'type' => Elementor\Controls_Manager::SELECT,
'options' => [
'default' => _x( 'Default', 'Section Control', 'wpb-plugins' ),
@JeffAspen
JeffAspen / elementor-section-column-spacing-controls.php
Created August 10, 2018 19:59 — forked from CNDLS/elementor-section-column-spacing-controls.php
Add custom spacing controls to Elementor's Section and Column elements.
<?php
/*
* Add custom spacing (margin and padding) controls to Elementor's Column_Element and Section_Element
* This hook means "run this function before you add the control section named 'section_advanced' on
* the element 'column' or 'section'.
*/
add_action( 'elementor/element/column/section_advanced/before_section_start', 'add_custom_spacing_controls' );
add_action( 'elementor/element/section/section_advanced/before_section_start', 'add_custom_spacing_controls' );
/**
@JeffAspen
JeffAspen / Elementor - Hide widgets
Created August 10, 2018 18:34
Elementor - Hide widgets
<?php
// Hide Elementor sections / elements when acf field is empty. Everything is shown when editor is active
// Usage: Add acf__[field_slug] classname into the desired element (for example acf__caption, acf__map-section)
$all_acf_fields = get_fields();
echo '<style>';
foreach($all_acf_fields as $acf_field_slug => $acf_field_value) {
if ($acf_field_value == ''){
echo 'body:not(.elementor-editor-active) .acf__'.$acf_field_slug.' { display: none; }';
}
};
/**
* Spacer
*
* @since 1.3.0
* Use the shortcode: [spacer class="css-class-name" height="30px"]
* Note: Since the space size uses an inline style your css class may have to use an !important
*/
function cmms_spacer_shortcode( $atts ) {
// Attributes
@JeffAspen
JeffAspen / gist:b9a3f16d263ee1a0ac8c8860a8b5a528
Created October 8, 2017 03:37
Prevent WordPress plugins from requesting updates
/*
* https://ben.lobaugh.net/blog/202432/prevent-wordpress-plugins-from-requesting-updates
* Be sure to change [plugin_folder]/[plugin_file].php to the plugin you want to prevent updating.
*/
add_filter( 'site_transient_update_plugins', array( 'no_updates_for_you' ) );
function no_updates_for_you( $value ) {
@JeffAspen
JeffAspen / WP Testimonial CPT
Created October 27, 2016 14:15
WP Testimonial CPT
// Register Custom Post Type
function cmms_testimonial_post_type() {
$labels = array(
'name' => _x( 'Testimonials', 'Post Type General Name', 'cmms' ),
'singular_name' => _x( 'Testimonial', 'Post Type Singular Name', 'cmms' ),
'menu_name' => __( 'Testimonials', 'cmms' ),
'name_admin_bar' => __( 'Testimonial', 'cmms' ),
'archives' => __( 'Item Archives', 'cmms' ),
'parent_item_colon' => __( 'Parent Item:', 'cmms' ),
@JeffAspen
JeffAspen / Add Body Classes.php
Created September 27, 2016 02:12
Add CSS classes to the body tag depending on what page you are on.
//For this to work you need to change the body tag to look like this:
//<body <?php body_class() ?>>
function add_body_classes( $classes ) {
// Adds a class if post type is books
if ( is_singular('book') ) {
$classes[] = 'book-single';
}
// add class if not home page
if ( ! is_home() ) {