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
tar -czvf - --exclude='mydomain.com/administrator/backups' /var/www/sites/mydomain.com > /local/backup/mydomain_backup.tar.gz |
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 (UIkit) { | |
if (!UIkit) { | |
throw new Error('UIkit not found. Make sure UIkit is loaded before this plugin.'); | |
} | |
UIkit.component('floating-label', { | |
connected() { | |
this.initFloatingLabel(); | |
}, | |
methods: { |
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 | |
abstract class Helper { | |
public static function getVidId($text) { | |
if(preg_match('~(?:https?://)?(?:www.)?(?:youtube.com|youtu.be|youtube-nocookie.com)/(?:watch\?v=|embed/)?([^"\?\s]+)~', $introtext, $match)) { | |
return $match[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
// YOOtheme > SETTINGS > Custom Code > CSS/LESS: | |
@media(max-width: @breakpoint-medium-max) { | |
.tm-toolbar.uk-visible\@m { | |
display: block !important; | |
order: -1; | |
} | |
.tm-page { | |
display: flex; | |
flex-direction: column; |
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 custom_registration_email($user_id) { | |
$user_info = get_userdata($user_id); | |
$to = $user_info->user_email; | |
$subject = 'Welcome to our site!'; | |
$message = 'Dear ' . $user_info->display_name . ',<br /><br />'; | |
$message .= 'Thank you for registering on our site. Here is your login information:<br />'; | |
$message .= 'Username: ' . $user_info->user_login . '<br />'; | |
$message .= 'Password: Your chosen password<br /><br />'; |
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 | |
// Create a file config.php with this code in put in child theme | |
return [ | |
// Set theme configuration values | |
'theme' => [ | |
'positions' => [ | |
'header-top' => 'Header Top', |
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 | |
// Set different prices in WooCommerce based on user roles using a hook. | |
function custom_role_based_pricing( $price, $product ) { | |
if ( is_user_logged_in() ) { | |
$user = wp_get_current_user(); | |
// Example: 10% discount for "wholesale" users | |
if ( in_array( 'wholesale', $user->roles ) ) { |
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 my_child_theme_enqueue_styles() { | |
$css_file = get_stylesheet_directory() . '/css/style.css'; | |
$css_url = get_stylesheet_directory_uri() . '/css/style.css'; | |
wp_enqueue_style( | |
'child-style', | |
$css_url, | |
array(), // No dependencies | |
file_exists($css_file) ? filemtime($css_file) : null // Adds timestamp version |
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
<!-- Using the <a> tag's download attribute can trigger a download, but it has limitations --> | |
<a href="/path/to/file" download>Download</a> | |
<script> | |
function download(url) { | |
const link = document.createElement("a"); | |
link.download = "file name"; | |
link.href = url; | |
document.body.appendChild(link); | |
link.click(); | |
document.body.removeChild(link); |
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
<!-- Use the FileReader API's readAsDataURL method to show uploaded images --> | |
<input type="file" id="uploaded-file" /> | |
<div id="result"></div> | |
<script> | |
function readImage() { | |
const fileReader = new FileReader(); | |
const file = document.getElementById("uploaded-file").files[0]; | |
if (file) { | |
fileReader.readAsDataURL(file); |
NewerOlder