Skip to content

Instantly share code, notes, and snippets.

@tdmrhn
tdmrhn / ESP8266 Mqtt Pin Control
Last active April 29, 2016 07:00
mqtt, esp8266, pin control
#include <PubSubClient.h>
#include <ESP8266WiFi.h>
#define MQTT_SERVER "192.168.1.2" // change the mqttbroker address
const char* ssid = "xxxxx"; // your wi-fi name
const char* password = "xxxxx"; // your wi-fi password
const int pin = 0; // in basic esp-01 you can control pin-0 and pin-2
char* clientname = "newesp"; // the mqtt client adress must be unique more than one esp usage
char* sublight = "/test/light"; // the mqtt sub adress
char* publight = "/test/light/confirm"; // the mqtt pub adress
@tdmrhn
tdmrhn / blocksy_comment_date.php
Last active February 21, 2022 18:33
Blocksy Comment Date Time Format
<?php
add_filter( 'get_comment_date', function ( $d ) {
$d = date_i18n(get_option( 'date_format' ));
return $d;
} );
add_filter( 'get_comment_time', function ( $h ) {
$h = date_i18n(get_option( 'time_format' ));
return $h;
} );
@tdmrhn
tdmrhn / blocksy_taxonomies_slug_rewrite.php
Last active October 25, 2021 05:54
Blocksy Taxonomies Slug Rewrite
<?php
add_filter( 'register_taxonomy_args', function ( $args, $taxonomy ) {
if ( 'blc-aff-categories' === $taxonomy ) {
$args['rewrite']['slug'] = 'affiliate-category';
}
return $args;
}, 10, 2 );
@tdmrhn
tdmrhn / blocksy_add_menu.php
Last active March 18, 2024 12:40
Blocksy Add Menu Shortcode
<?php
add_shortcode('listmenu', function ($atts, $content = null) {
extract(shortcode_atts(array( 'name' => null, 'class' => null ), $atts));
return wp_nav_menu( array( 'menu' => $name, 'menu_class' => 'mymenu', 'echo' => false ) );
} );
// Usage [listmenu name="Menu Name"]
@tdmrhn
tdmrhn / blog-archive-card.css
Last active April 11, 2021 09:15
Blog archive card design
[data-prefix="blog"] [data-cards="simple"] .entry-card {position:relative;min-height:700px;}
[data-prefix="blog"] [data-cards="simple"] .entry-excerpt {background:#fff;padding:80px 30px; margin:0 10px; border-radius:15px;position:absolute;bottom:0;border:1px solid #eee;min-height:430px;}
[data-prefix="blog"] [data-cards="simple"] .entry-title {position:absolute;top:300px;z-index:1;padding:0 40px;}
[data-prefix="blog"] [data-cards="simple"] .ct-button {position:absolute;bottom:30px;margin:0 40px;}
@tdmrhn
tdmrhn / blog-archive-card-1.css
Created April 11, 2021 08:22
Blog Archive Card Design #2
[data-prefix="blog"] [data-cards="boxed"] .entry-card {position:relative;}
[data-prefix="blog"] [data-cards="boxed"] .entry-meta li.meta-date{position:absolute;top:0;right:-10px; background:var(--paletteColor1);color:var(--paletteColor5);padding:1em;}
[data-prefix="blog"] [data-cards="boxed"] .entry-meta li.meta-author{position:absolute;top:250px;color:var(--paletteColor5);padding:1em;}
[data-prefix="blog"] [data-cards="boxed"] .ct-button {border-radius:50px;}
@tdmrhn
tdmrhn / login-redirect.php
Last active August 4, 2022 11:41
WP Login Redirect to Custom URL
add_filter( 'login_url', function () { return home_url( '/my-account'); } );
@tdmrhn
tdmrhn / cpt-archive-card-1.css
Last active April 26, 2021 17:24
Custom Post Archive Card Design
[data-prefix="projeler_archive"] [data-cards="simple"] .entry-card {position:relative; padding:0; overflow:hidden; border-radius:20px;}
[data-prefix="projeler_archive"] [data-cards="simple"] .entry-card .ct-image-container{margin:0;}
[data-prefix="projeler_archive"] [data-cards="simple"] .entry-excerpt {position:absolute; width:100%; height:100%; padding:60px 30px; top:0; left:100%; transition:.5s; color:var(--paletteColor5); background:var(--paletteColor3);}
[data-prefix="projeler_archive"] [data-cards="simple"] .entry-card:hover .entry-excerpt {top:0; left:0%;}
[data-prefix="projeler_archive"] [data-cards="simple"] .entry-title {position:absolute; bottom:0; padding:30px; margin:0; width:100%; background:linear-gradient(0deg, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%);color:var(--paletteColor5);z-index:1;}
@tdmrhn
tdmrhn / blog-archive-card-2.css
Last active May 9, 2021 14:25
Blog Archive Card Design #3
[data-prefix="blog"] [data-cards="boxed"] .entry-card {position:relative;}
[data-prefix="blog"] [data-cards="boxed"] .entry-meta {margin-bottom:0;}
[data-prefix="blog"] [data-cards="boxed"] .entry-meta li.meta-categories {position:absolute; right:10px; margin-top:-40px;}
[data-prefix="blog"] [data-cards="boxed"] .entry-meta li.meta-categories a {background:var(--paletteColor1); color:var(--paletteColor8); font-size:11px; padding:.5em 1em; border-radius:5px;}
[data-prefix="blog"] [data-cards="boxed"] .entry-meta li.meta-categories a:hover {background:var(--paletteColor2);}
@tdmrhn
tdmrhn / subscribe-form-design.css
Created May 11, 2021 15:10
Copy CT Subscribe Form Design
.ct-mailchimp-block form section { position: relative; }
.ct-mailchimp-block form input { width: 550px; height: 55px; padding: 0 150px 0 35px; border:2px solid var(--paletteColor5); border-radius: 4px; }
.ct-mailchimp-block form button { position: absolute; padding: 0 15px; width: 135px; top: 8px; right: 8px; border-radius: 4px; }