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 wp_setup_translations_table(){ | |
global $wpdb; | |
$table_name = $wpdb->prefix . "translations"; //get the database table prefix to create my new table | |
$sql = "CREATE TABLE $table_name ( | |
id int(10) unsigned NOT NULL AUTO_INCREMENT, | |
identifier varchar(255) NOT NULL, | |
translation varchar(255) NOT NULL, |
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 16-digit password for google account | |
// https://myaccount.google.com/apppasswords | |
// Ustawienia SMTP email: wp-config.php | |
define('SMTP_username', '[email protected]'); // wpisz swój adres e-mail dla WordPress | |
define('SMTP_password', 'twoje-haslo'); // tu podaje swoje hasło Gmail | |
define('SMTP_server', 'smtp.gmail.com'); // tu podaj swój host serwera poczty | |
define('SMTP_FROM', '[email protected]'); // wpisz swój adres e-mail dla WordPress |
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 | |
// Add new route | |
add_action('init', function () { | |
add_rewrite_tag('%wow_email%', '([a-z0-9-@.]+)'); // Update query_vars | |
add_rewrite_rule('confirm/email/([a-z0-9-@.]+)[/]?$', 'index.php?wow_email=$matches[1]&wow_param=confirm', 'top'); | |
// Flush permalinks rewrites for tests only | |
flush_rewrite_rules(); | |
// Flush permalinks rewrites in theme or go to WP Admin > Settings > Permalinks > Save. | |
// add_action('after_switch_theme', flush_rewrite_rules()); |
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. Send email with phpmailer | |
function wp_send_email($email, $subject) { | |
require_once(ABSPATH . WPINC . '/PHPMailer/PHPMailer.php'); | |
require_once(ABSPATH . WPINC . '/PHPMailer/SMTP.php'); | |
require_once(ABSPATH . WPINC . '/PHPMailer/Exception.php'); | |
try { | |
// Create email message here |
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 | |
// Catch mail error | |
add_action('wp_mail_failed', function ($error) { | |
wp_send_json_error('Send mail error.', 404); | |
}); | |
// Force html email | |
add_filter( 'wp_mail_content_type', function () { | |
return "text/html"; |
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 | |
// Overwrite title | |
add_filter('wp_title', 'change_title', 100); | |
function change_title($title) { | |
global $post; | |
if (is_home()) { | |
bloginfo('name'); | |
} else if (is_category()) { |