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
<script> wpcf7.cached = 0; </script> |
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
<script> | |
if (navigator.userAgent.indexOf("MSIE") >= 0) { | |
document.write("<div style='width: 100%; text-align: center; height: 100%; position: fixed; top:0; left:0; right:0; z-index: 99999; background-color: #ffffff; color: #000000;'>Jūs naudojate pasenusią ir nesaugią Internet Explorer naršyklę. Prašome atsinaujinti į Internet Explorer 11 arba naudoti kitą naršyklę.</div>"); | |
document.execCommand("Stop"); | |
} | |
</script> |
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
# Check your website headers here: https://www.serpworx.com/check-security-headers/ or https://gf.dev/ | |
# This configuration works for WP, WC on LiteSpeed server. Be careful. Test site after installing. All lines are explained are in serpworx.com tester. | |
# More docs: | |
# https://www.netsparker.com/whitepaper-http-security-headers/#XFrameOptionsHTTPHeader | |
# https://owasp.org/www-project-secure-headers/ | |
# https://www.keycdn.com/blog/http-security-headers | |
# WordPress plugin for Headers setup https://wordpress.org/plugins/http-headers/ | |
# Main security options in .htaccess file: |
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 | |
//example taken from https://www.smashingmagazine.com/2011/10/how-to-use-ajax-in-wordpress/ | |
//generate link | |
$nonce = wp_create_nonce("my_user_vote_nonce"); | |
$link = admin_url('admin-ajax.php?action=my_user_vote&post_id='.$post->ID.'&nonce='.$nonce); | |
echo '<a class="user_vote" data-nonce="' . $nonce . '" data-post_id="' . $post->ID . '" href="' . $link . '">vote for this article</a>'; | |
//accept ajax action | |
add_action("wp_ajax_my_user_vote", "my_user_vote"); | |
add_action("wp_ajax_nopriv_my_user_vote", "my_must_login"); |
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
//phone format for LT countries | |
var telInput = document.getElementById('billing_phone'); | |
telInput.addEventListener("keyup", function onKeyUp(e){ | |
var input = e.target; | |
input.style.borderColor = 'initial'; | |
//get country and check if its LT | |
if( !isCountry("LT") ) return; | |
//format number |
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 | |
/** | |
* @purpose Show facebook comments in Cart page, for mobile and desktop | |
* @pages Cart | |
* @version 2019.02.14 | |
*/ | |
add_shortcode('dk_fb_comments', 'dk_fb_get_comments_local'); | |
function dk_fb_get_comments_local() | |
{ | |
$json_file = site_url() . "/_fb/comments.json"; |
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 | |
//Example how to create WPBaker builder element, which works like shortcodes. | |
//There is parent holder Buttons, where you can insert as many Button (only our button) as you want. | |
//Include code or file into functions.php or elsewhere. | |
// source : https://wpbakery.atlassian.net/wiki/pages/viewpage.action?pageId=524362 | |
if(!function_exists('ef_buttons')){ | |
function ef_buttons( $atts, $content = null ) { | |
extract(shortcode_atts(array( |
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('loop_shop_post_in', 'dk_filter_sale_products', 10); | |
add_filter('woocommerce_widget_get_current_page_url', 'dk_filter_links_with_sale', 10, 2); | |
function dk_filter_sale_products($array) { | |
if(isset($_GET['akcija']) && $_GET['akcija']){ | |
$product_ids_on_sale = wc_get_product_ids_on_sale(); | |
$array = array_merge($array, $product_ids_on_sale); | |
} |
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 | |
function bartag_func( $atts ) { | |
$a = shortcode_atts( array( | |
'foo' => 'something', | |
'bar' => 'something else', | |
), $atts ); | |
return "foo = {$a['foo']}"; | |
} | |
add_shortcode( 'bartag', 'bartag_func' ); |