Skip to content

Instantly share code, notes, and snippets.

@texe
texe / install-docker.sh
Last active November 19, 2021 17:58
Script for installing Docker and docker-compose in Linux Mint/Ubuntu
#!/bin/bash
sudo apt-get update
# install dependencies
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# add the gpg key for docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@texe
texe / functions.php
Created November 20, 2021 04:46
Gist for Wordpress
/**
* Embed Gists with a URL
*
* Usage:
* Paste a gist link into a blog post or page and it will be embedded eg:
* https://gist.github.com/2926827
*
* If a gist has multiple files you can select one using a url in the following format:
* https://gist.github.com/2926827?file=embed-gist.php
*
@texe
texe / docerfile
Created November 22, 2021 15:46
Nginx and PHP in Docker
# Set master image
FROM php:7.4-fpm-alpine
# Set working directory
WORKDIR /var/www/html
# Install Additional dependencies
RUN apk update && apk add --no-cache \
build-base shadow vim curl \
php7 \
@texe
texe / gradient-title.css
Created May 6, 2022 10:09
Gradient title in CSS
.gradient {
background-image: linear-gradient(to right, #FF4365, #e6a612, #f8030c);
background-clip: text;
color: transparent;
font-size: 75px;
font-weight:bold;
}
@texe
texe / functions.php
Created June 3, 2022 13:46
WordPress shortcode
function my_shortcode() {
$message = 'This is message from my shortcode!';
return $message;
}
add_shortcode('my_heading', 'my_shortcode');
@texe
texe / dropcap.css
Created June 6, 2022 11:56
How to make a dropcap in CSS
h1 {
font-size: 45px;
}
h1::first-letter {
color:#ffbb00;
font-size: 95px;
}
p::first-letter {
@texe
texe / functions.php
Last active July 7, 2022 12:22
WordPress - How to remove additional information tab in WooCommerce
// Remove additional information tab
function remove_product_tabs($tabs) {
unset($tabs['additional_information']);
return $tabs;
}
add_filter('woocommerce_product_tabs', 'remove_product_tabs',98);
@texe
texe / functions.php
Last active July 7, 2022 12:22
WordPress - Remove SKU in WooCommerce
// remove SKU in WooCommerce
function ct_remove_product_sku($enabled) {
if (! is_admin() && is_product()) {
return false;
}
return $enabled;
}
add_filter( 'wc_product_sku_enabled', 'ct_remove_product_sku' );
@texe
texe / functions.php
Last active August 2, 2023 12:52
WordPress - Redirect to home page after login/logout in WordPress
// redirect to home after login/logout
add_action('wp_logout','go_home');
function go_home(){
wp_redirect( home_url() );
exit();
}
add_action('wp_login','go_home_after_login');
function go_home_after_login(){
wp_redirect( home_url() );
@texe
texe / functions.php
Last active July 7, 2022 12:21
WordPress - Login/logout link depends on user is logged
// shortcode for Login/register vs Logout
function md_login_logout() {
if ( is_user_logged_in()) {
$link = '<a href="' . wp_logout_url() . '">Logout</a>';
}
if ( !is_user_logged_in()) {
$link = '<a href="/my-account/edit-account/">Login/Register</a>';
}
return $link;
}