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
function get_first_image($post_id) | |
{ | |
$first_img = ''; | |
$content_post = get_post($post_id); | |
$content = $content_post->post_content; | |
$output = preg_match_all('/<img.+?src=[\'"]([^\'"]+)[\'"].*?>/i', $content, $matches); | |
$first_img = $matches[1][0]; | |
if ($first_img == '') { | |
$first_img = get_template_directory_uri() . '/assets/img/placeholder.jpg'; | |
} |
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
function disable_right_click_callback() | |
{ | |
?> | |
<script> | |
jQuery(document).ready(function() { | |
jQuery(document).bind("contextmenu", function(e) { | |
return false; | |
}); | |
}); | |
</script> |
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
/* | |
* VC Map Extract String | |
*/ | |
if ( ! function_exists( 'fts_vc_map_extract_string' ) ) | |
{ | |
function fts_vc_map_extract_string( $input ) | |
{ | |
$font_elements = explode('|',$input); | |
$final_array = array(); | |
foreach ($font_elements as $font_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
/* | |
* Shortcode for the visual composer element. | |
*/ | |
/** | |
* Single post two element shortcode | |
* | |
* @param Attributes $atts. | |
* @return string | |
* @since 1.0.0 | |
*/ |
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
/* | |
* Wp Bakery Page Builder custom Element Code | |
*/ | |
/* | |
* vc element single post 2 | |
*/ | |
function fts_single_post_two_vc_callback(){ | |
vc_map( array( | |
'name' => __('Single Post 2','js_composer'), | |
'description' => __('Single post section', 'js_composer'), |
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 this code to your theme's function file or site-specific plugins | |
*/ | |
function img_count(){ | |
$query_img_args = array( | |
'post_type' => 'attachment', | |
'post_mime_type' =>array( | |
'jpg|jpeg|jpe' => 'image/jpeg', | |
'gif' => 'image/gif', | |
'png' => 'image/png', |
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
/*Defer Parsing of javascript*/ | |
function defer_parsing_of_js ( $url ) { | |
if ( FALSE === strpos( $url, '.js' ) ) return $url; | |
if ( strpos( $url, 'jquery.js' ) ) return $url; | |
return "$url' defer "; | |
} | |
add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 ); |
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
$('body').on('click', '#myModal', function (e) { | |
if ($(e.target).attr('class') == 'practice_modal active') { | |
console.log('Class found'); | |
$('#myModal').toggleClass('active'); | |
} else { | |
console.log('Class not found'); | |
} | |
console.log($(e.target).attr('class')); | |
}); |
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
/* ----------------------------------------------------------------------------- | |
* REST API SETUP | |
* -------------------------------------------------------------------------- */ | |
add_action( 'rest_api_init', function () { | |
register_rest_route( 'users', '/auth/', array( | |
'methods' => 'POST', | |
'callback' => 'meditation_user_auth' | |
) ); | |
} ); |
NewerOlder