This file contains hidden or 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 | |
/** | |
* Filter the upload size limit for non-administrators. | |
* | |
* @param string $size Upload size limit (in bytes). | |
* @return int (maybe) Filtered size limit. | |
*/ | |
function filter_site_upload_size_limit( $size ) { | |
// Set the upload size limit to 10 MB for users lacking the 'manage_options' capability. | |
if ( ! current_user_can( 'manage_options' ) ) { |
This file contains hidden or 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
// comment section email validation start | |
document.addEventListener('DOMContentLoaded', function() { | |
var commentForm = document.getElementById('commentform'); // Replace 'commentform' with the ID of your comment form | |
if (commentForm) { | |
var emailField = commentForm.querySelector('input[name="email"]'); | |
commentForm.addEventListener('submit', function(event) { | |
var emailValue = emailField.value.trim(); |
This file contains hidden or 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
/* FAQ Section Mobile*/ | |
html{ | |
font-size: calc(100vw * 18/360); | |
} | |
.faq-container{ | |
position: relative; | |
padding-top: 1.667rem; | |
} | |
.faq-content{ |
This file contains hidden or 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 | |
// Synchronize terms between the two taxonomies | |
function synchronize_taxonomies( $term_id, $tt_id, $taxonomy ) { | |
if (in_array($taxonomy, array('first_taxonomy', 'second_taxonomy'))) { | |
$term = get_term($term_id, $taxonomy); | |
$other_taxonomy = ($taxonomy === 'first_taxonomy') ? 'second_taxonomy' : 'first_taxonomy'; | |
// Check if the term exists in the other taxonomy | |
$term_exists = term_exists($term->name, $other_taxonomy); |
This file contains hidden or 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 | |
// Add a filter to modify the HTTP headers | |
function add_csp_header() { | |
header("Content-Security-Policy: default-src 'self'; script-src 'self' https://example.com; style-src 'self' https://example.com;"); | |
// Add more directives as needed based on your specific requirements | |
} | |
// Hook the function to the 'send_headers' action | |
add_action('send_headers', 'add_csp_header'); |
This file contains hidden or 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 | |
add_filter( 'wp_all_import_single_image_uploads_dir', 'wpai_wp_all_import_single_image_uploads_dir', 10, 6 ); | |
function wpai_wp_all_import_single_image_uploads_dir( $uploads, $image_url, $articleData, $current_xml_node, $import_id, $post_id ) { | |
$position = strpos($image_url, 'uploads'); | |
$result = substr($image_url, $position + 7,8); //eg: `/2021/05` | |
$uploads['path'] = $uploads['basedir'].$result; | |
$uploads['url'] = $uploads['baseurl'].$result; | |
$uploads['subdir']=$result; |
This file contains hidden or 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 | |
$query_cpt = new WP_Query($args); | |
$posts_per_page = $query_cpt->query_vars['posts_per_page']; | |
$posts_found = $query_cpt->found_posts; | |
$paged = $query_cpt->query_vars['paged']; | |
if ( $posts_found ) { | |
$start_result = ( $paged - 1 ) * $posts_per_page + 1; |
This file contains hidden or 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
var ua = window.navigator.userAgent; | |
var iOS = ua.match(/iPad/i) || ua.match(/iPhone/i); | |
var webkit = ua.match(/WebKit/i); | |
var iOSSafari = iOS && webkit && !ua.match(/CriOS/i); | |
console.log("ios: "+ iOS + " | webkit: "+ webkit +" | ios safari: "+ iOSSafari); |
This file contains hidden or 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
document.addEventListener("DOMContentLoaded", function() { | |
/* animate counter | |
* <span class="animate-count">1000</span> | |
*/ | |
function isElementInViewport(el) { | |
var rect = el.getBoundingClientRect(); |
OlderNewer