Skip to content

Instantly share code, notes, and snippets.

View atomjoy's full-sized avatar

Atomjoy atomjoy

View GitHub Profile
@atomjoy
atomjoy / Rwd-html-email.html
Last active October 21, 2024 11:12
RWD html e-mail example.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>RWD Html Email</title>
<link href="https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;500;600;700;800&amp;display=swap" rel="stylesheet">
<style>
@atomjoy
atomjoy / Prestashop-install-errors.md
Last active October 9, 2024 16:57
Jak zainstalować Prestashop z Xampp na Windows 10 (Błędy podczas instalacji presta shop z xampp).

Prestashop Xampp Win 10

Jak zainstalować Prestashop z Xampp na Windows 10 (Błędy podczas instalacji presta shop z xampp).

Xampp

Zmienne środowiskowe

Ssl error windows

@atomjoy
atomjoy / Docker-install.md
Created September 25, 2024 10:42
Docker install Windows 10

Docker install Windows 10

https://learn.microsoft.com/en-us/windows/wsl/install-manual

PowerShel as Administrator

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Install

@atomjoy
atomjoy / Cars-custom-post-type-brands-taxonomy.php
Last active September 23, 2024 12:33
Custom cars post type with brands taxonomy in WordPress.
<?php
// Cars post type brands taxonomy https://example.org/cars/brands/brand-name/
add_action('init', function () {
register_taxonomy(
'cars-brands',
['cars'],
[
'labels' => [
'name' => 'Brands',
@atomjoy
atomjoy / Post-page-custom-fields.php
Last active September 23, 2024 10:45
Add custom post and page fields from the plugin in WordPress.
<?php
global $meta_boxes;
$prefix = 'test';
function add_post_meta_box() {
global $meta_boxes;
$post_type = ['post', 'page'];
if (is_admin()) {
@atomjoy
atomjoy / Seo-schema-tags.html
Last active September 23, 2024 10:45
Seo schema meta tags.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page Title</title>
<!-- Search Engine Optimization -->
@atomjoy
atomjoy / Seo-transition-words.js
Last active September 22, 2024 07:40
Transition words in website seo.
/* transition words */
const singleWords = [ "aby", "abym", "abyśmy", "abyś", "abyście", "acz", "aczkolwiek", "albowiem", "ale", "aliści",
"bo", "bowiem", "bynajmniej", "choć", "chociaż", "chociażby", "czyli", "dlatego", "dodatkowo", "dopóki", "dotychczas",
"faktycznie", "gdy", "gdyż", "jakkolwiek", "iż", "jednak", "jednakże", "jeśli", "kiedy", "lecz", "mianowicie", "mimo",
"np", "najpierw", "następnie", "natomiast", "ni", "niemniej", "niż", "notabene", "oczywiście", "ogółem",
"ostatecznie", "owszem", "podobnie", "podsumowując", "pokrótce", "pomimo", "ponadto", "ponieważ", "poprzednio",
"potem", "później", "przecież", "przeto", "przynajmniej", "raczej", "również", "rzeczywiście", "skoro", "także",
"też", "toteż", "tudzież", "tymczasem", "wedle", "według", "więc", "właściwie", "wobec", "wpierw", "wprawdzie",
"wreszcie", "wskutek", "wstępnie", "wszakże", "wszelako", "zamiast", "zanim", "zarówno", "zaś", "zatem", "zresztą",
@atomjoy
atomjoy / Load-wp-title.php
Last active September 23, 2024 10:47
How to dynamically change your site title in WordPress.
<?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()) {
@atomjoy
atomjoy / Load-contact-form.php
Created September 19, 2024 15:10
How to send email from contact form with javascript in WordPress.
<?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";
@atomjoy
atomjoy / Send-phpmailer-email.php
Last active September 20, 2024 14:17
How to catch PHPMailer or wp_mail errors in WordPress.
<?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