913WordPress functions.php

// update_option('siteurl','http://127.0.0.1/my-site'); // update_option('home','http://127.0.0.1/my-site');

// add excerpts to pages add_post_type_support('page', 'excerpt');

// remove auto-p in blog content remove_filter('the_content', 'wpautop');

// replace \n with <br /> // substitute
for line breaks in the content function addLineBreaks($content) { return str_replace("\n", "\n<br />", $content); } add_filter('the_content', 'addLineBreaks');

// register menu function register_theme_menu() { register_nav_menu('footer-menu', 'Footer Menu'); } add_action('init', 'register_theme_menu');

Show Wordpress Theme Menu

912WP Menus – Theme Setup & Menu as Array

functions.php function register_theme_menu() { register_nav_menu('my-menu', 'My Menu'); } add_action( 'init', 'register_theme_menu' );

Menu Location $l = get_nav_menu_locations(); $m = wp_get_nav_menu_items($l['my-menu']); foreach($m as $i) { // custom HTML echo $i->url; echo $i->title; }

910Unresponsive Atom Editor on OSX

Atom is great, current, hackable and my current go-to editor, but from time-to-time it does like to open a certain directory. It keeps timing out, restarts of the Editor or the Computer don't help.

Clearing the window state helps.

atom --clear-window-state

898AWS S3, Vue and History Mode

Single-page Applications (SPA) make with Vue or React can take advantage of HTML5's History Mode, where the URL in the browser window is changing - but all the changes are happening in the client. This works great, if the user only follows the links, but it breaks when the user wants to reload the page or goes to and unknown (404) page. The server kicks on and gives you a 404.

There are ways to deal with this, vue-router has a list: https://router.vuejs.org/en/essentials/history-mode.html

Basically, what's happening: rewrite all requests to index.html - the entry point of your SPA. We will also have to deal with 404 on the client side, but that's also described above. Origin -> Origins Path to path in S3. No need to adjust index and error paths in S3

895QuickTime Player – Interrupted Video Recording Session


QuickTime Player Version can record movies. If the recording process in interrupted by battery running out, or the computer being closed and put to sleep, the video file is store at the following location: ~/Library/Containers/com.apple.QuickTimePlayerX/Data

QuickTime Player Version: 10.4

894How to get Parent ID from a Post Page

if ($wp_query->is_posts_page) { $id = $wp_query->queried_object->ID; }

893MySQL 5.6, 5.5 and utf8mb4

I encountered a situation where my dev MySQL was 5.6 and running with a utf8mb4_unicode_ci Server Connection Collation, and the remote MySQL with 5.5 and a utf8mb4_general_ci collation.

Needless to say, the remote DB did not like the dumps from my dev DB.

Quick and Dirty Solution:

replace('utf8mb4_unicode_520_ci', 'utf8mb4_general_ci') replace('utf8mb4_unicode_ci', 'utf8mb4_general_ci')

892Underlining Text in CSS

Standard Underline, Standard Underline, Hamburgefonts

.standard-underline { text-decoration: underline; }

Bottom Border, Bottom Border Over, Hamburgefonts

.bottom-border { border-bottom: 2px solid red; }

Box Shadow, Box Shadow, Hamburgefonts

.box-shadow { box-shadow: inset 0px -3px 0 #72caff; }

Box Shadow, Box Shadow, Hamburgefonts

.box-shadow { padding-bottom: 2px; box-shadow: inset 2px -2px 0 yellow; }

886Making a text file executable in OSX with .command

Appending .command to a text file in OSX executes it on double click.



my-file.txt content wget https://wordpress.org/latest.tar.gz
rename my-file.txt → my-file.command

875Exporting URLs from Safari Reading List

https://alexwlchan.net/2015/11/export-urls-from-safari-reading-list/