Skip to content

Instantly share code, notes, and snippets.

Avatar

Eden Kindil EdenK

  • SHIBI
  • ישראל
View GitHub Profile
@EdenK
EdenK / wp-elementor-nav-menu-breakpoint.scss
Created Jul 16, 2018
Wordpress: Elementor Pro change nav menu breakpoint css
View wp-elementor-nav-menu-breakpoint.scss
@media (max-width: 1299px) {
body .elementor-nav-menu--dropdown-tablet .elementor-nav-menu--dropdown {
display: block;
}
body .elementor-nav-menu--dropdown-tablet .elementor-menu-toggle {
display: flex;
}
}
@media (min-width: 1300px) {
@EdenK
EdenK / wp-set-child-page-template.php
Last active Jul 11, 2018
Wordpress: Auto set page template for child pages to be the same as parent.
View wp-set-child-page-template.php
<?php
/**
* Wordpress: Auto set page template for child pages to be the same as parent.
*/
function set_child_page_template( $post_id, $post, $update ) {
// Check for post type page
if( $post->post_type === 'page' ) {
// Check if its a child page
if( $post->post_parent !== 0 ) {
// If its child get the post parent template
@EdenK
EdenK / wp-wpml-elementor-library.php
Last active Oct 11, 2018
Wordpress: WPML & Elementor fix for elementor library translations (Header etc..).
View wp-wpml-elementor-library.php
<?php
/**
* Wordpress: WPML & Elementor fix for elementor library translations (Header etc..).
*/
function wpml_elementor_library( $theme_template_id ) {
return apply_filters( 'wpml_object_id', $theme_template_id, 'elementor_library', true );
}
add_filter('elementor/theme/get_location_templates/template_id', 'wpml_elementor_library', 10, 1);
/**
@EdenK
EdenK / wp-menu-item-added.js
Last active Jun 14, 2018
Wordpress: Javascript Hook / Event for menu item added
View wp-menu-item-added.js
jQuery(document).ready(function($) {
/**
* Event trigger document#menu-item-added file nav-menu.js in the function addMenuItemToBottom
* @param {object} event
* @param {object} markup Menu item html object
*/
$(document).on('menu-item-added', function(event, markup) {
// If more than 1 items is added we will need to loop
$.each(markup, function(index, menuItem) {
// Check if its the html object becuase there is another object that we get when we adding more than 1
@EdenK
EdenK / wp-cf7-add-custom-form-tag.php
Created Jan 22, 2018
Wordpress: Contact form 7, Add form tag (shortcode) current url example
View wp-cf7-add-custom-form-tag.php
<?php
/**
* Wordpress: Contact form 7, Add form tag (shortcode) current url example
*/
add_action( 'wpcf7_init', 'wpcf7_add_form_tag_current_url' );
function wpcf7_add_form_tag_current_url() {
// Add shortcode for the form [current_url]
wpcf7_add_form_tag( 'current_url',
'wpcf7_current_url_form_tag_handler',
array(
@EdenK
EdenK / wp-remove-yoast-seo-columns.php
Created Dec 28, 2017
Wordpress: Filter admin columns and remove yoast seo columns
View wp-remove-yoast-seo-columns.php
<?php
/**
* Wordpress: Filter admin columns and remove yoast seo columns
*/
function yoast_seo_remove_columns( $columns ) {
/* remove the Yoast SEO columns */
unset( $columns['wpseo-score'] );
unset( $columns['wpseo-title'] );
unset( $columns['wpseo-metadesc'] );
unset( $columns['wpseo-focuskw'] );
@EdenK
EdenK / wp-change-static-homepage-cpt.php
Last active Dec 26, 2017
Wordpress: Change options-reading.php static page dropdown to custom post type
View wp-change-static-homepage-cpt.php
<?php
/**
* Change options-reading.php static page post type
*/
function add_cpt_to_static_home($output, $r, $pages) {
if($r['name'] === 'page_on_front' && !isset($r['post_type'])) {
$post_type = 'post'; // Set the post type
@EdenK
EdenK / elementor-video-youtube-enablejsapi.php
Last active Sep 4, 2019
Filter to add enablejsapi to Elementor youtube video
View elementor-video-youtube-enablejsapi.php
<?php
/**
* Filter to add enablejsapi to Elementor youtube video
*/
function add_youtube_jsapi($iframe_html, $video_url, $frame_attributes) {
if(strpos($video_url, 'youtube') !== false) {
$src = esc_attr($frame_attributes['src']);
$new_src = esc_attr(add_query_arg(array('enablejsapi' => '1'), $frame_attributes['src']));
$iframe_html = str_replace($src, $new_src, $iframe_html);
}
You can’t perform that action at this time.