Skip to content

Instantly share code, notes, and snippets.

@mikepallister
mikepallister / README.md
Last active July 5, 2023 06:59
Heatmiser Neo Hub

Sends commands to a Heatmiser Neo Hub, either an instruction or an information request. Uses TCP but the secret is to add a null (/0) character to the end of the request.

Known commands (not all tested)

{"AWAY_OFF":<device(s)>}

{"AWAY_ON":<device(s)>}

{"BOOST_OFF":[{"hours":0,"minutes":10},]]}

@gerbenvandijk
gerbenvandijk / Mark parent navigation active when on custom post type single page
Last active January 1, 2024 21:22
Mark (highlight) custom post type parent as active item in Wordpress Navigation.When you visit a custom post type's single page, the parent menu item (the post type archive) isn't marked as active. This code solves it by comparing the slug of the current post type with the navigation items, and adds a class accordingly.
<?php
function add_current_nav_class($classes, $item) {
// Getting the current post details
global $post;
// Get post ID, if nothing found set to NULL
$id = ( isset( $post->ID ) ? get_the_ID() : NULL );