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 | |
function devrupash_remove_max_srcset_image_width( $max_width ) { | |
return false; | |
} | |
add_filter( 'max_srcset_image_width', 'devrupash_remove_max_srcset_image_width' ); | |
function devrupash_disable_srcset( $sources ) { | |
return false; | |
} | |
add_filter( 'wp_calculate_image_srcset', 'devrupash_disable_srcset' ); |
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
@font-face { | |
font-family: "freight-sans-pro"; | |
src: url("https://use.typekit.net/af/442215/000000000000000000010b5a/27/l?primer=7cdcb44be4a7db8877ffa5c0007b8dd865b3bbc383831fe2ea177f62257a9191&fvd=n4&v=3") format("woff2"), | |
url("https://use.typekit.net/af/442215/000000000000000000010b5a/27/d?primer=7cdcb44be4a7db8877ffa5c0007b8dd865b3bbc383831fe2ea177f62257a9191&fvd=n4&v=3") format("woff"), | |
url("https://use.typekit.net/af/442215/000000000000000000010b5a/27/a?primer=7cdcb44be4a7db8877ffa5c0007b8dd865b3bbc383831fe2ea177f62257a9191&fvd=n4&v=3") format("opentype"); | |
font-display: auto; | |
font-style: normal; | |
font-weight: 400; | |
font-stretch: normal; | |
} |
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 countDown(selector) { | |
var countDownElement = $(selector); | |
var startAt = parseFloat(countDownElement.attr('start-at')); | |
var endAt = parseFloat(countDownElement.attr('end-at')); | |
var animationDuration = parseFloat(countDownElement.attr('animation-duration').replace('ms', '')); | |
var currentValue = startAt; | |
var interval = 50; | |
var steps = (startAt - endAt) / (animationDuration / interval); | |
var timer = setInterval(function () { | |
currentValue -= steps; |
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 | |
function rl_cold_next_post_id( $post_id, $post_type ) { | |
global $post; | |
$oldGlobal = $post; | |
$post = get_post( $post_id ); | |
$previous_post = get_previous_post(); | |
$post = $oldGlobal; | |
if($previous_post == ""){ | |
return rl_cold_new_post_id($post_type); | |
} |
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 | |
function terrawise_exclude_first_post_from_query($query) { | |
if (!is_admin() && $query->is_main_query() && (is_home() || is_category())) { | |
if (!$query->get('exclude_first_post')) { | |
$first_post = get_posts(array( | |
'post_type' => 'post', | |
'post_status' => 'publish', | |
'posts_per_page' => 1, | |
)); | |
if (!empty($first_post)) { |
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 | |
function get_page_id_by_template($page_template_filename){ | |
$pages = get_pages( array( | |
'meta_key' => '_wp_page_template', | |
'meta_value' => $page_template_filename | |
) ); | |
$pageIds = array(); | |
foreach($pages as $page){ | |
$pageId = $page->ID; | |
array_push($pageIds, $pageId); |
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
<script> | |
(function($){ | |
$(document).ready(function(){ | |
$('#divisiondiv .selectit').on('click', function(event){ | |
var targetElement = event.target; | |
if($(targetElement).prop("tagName") == 'INPUT'){ | |
var elements = $('#divisiondiv .selectit').find('input[type="checkbox"]'); | |
$(elements).each(function(){ | |
if(targetElement != this){ |
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 | |
function devrupash_customize_init(){ | |
// Redirect any user trying to access comments page | |
global $pagenow; | |
if ($pagenow === 'edit-comments.php') { | |
wp_safe_redirect(admin_url()); | |
exit; | |
} | |
// Remove comments metabox from dashboard |
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
/* Medium Layout: 992 to 1200px. */ | |
@media only screen and (min-width: 992px) and (max-width: 1200px) { | |
} | |
/* Tablet Layout: 768px to 991px */ | |
@media only screen and (min-width: 768px) and (max-width: 991px) { | |
} | |
/* Tablet & Mobile Layout: 991px */ | |
@media only screen and (max-width: 991px) { |
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 | |
// 1.Write a PHP function to sort an array of strings by their length, in ascending order. | |
function sort_strings_by_length($arrayItem) { | |
usort($arrayItem, function($a, $b) { | |
return strlen($a) - strlen($b); | |
}); | |
return $arrayItem; | |
} | |
$strings = array("apple", "banana", "cherry", "date", "elderberry"); | |
$sorted_strings = sort_strings_by_length($strings); |
NewerOlder