Skip to content

Instantly share code, notes, and snippets.

View lots0logs's full-sized avatar
🧑‍💻
Working on Divi Sites

Dustin Falgout lots0logs

🧑‍💻
Working on Divi Sites
View GitHub Profile
@lots0logs
lots0logs / user_data.yml
Created May 9, 2020 02:41
K8s :: DigitalOcean :: Ubuntu 20.04 :: Fix journalctl returning "-- No entries --"
#cloud-config
runcmd:
# BEGIN Fix journalctl command mismatched machine id
- systemctl restart systemd-journald.service
# END
@lots0logs
lots0logs / user_data.yml
Created May 9, 2020 02:38
K8s :: DigitalOcean :: Ubuntu 20.04 :: Workaround For "too many nameservers" Warning Message Log Spam
#cloud-config
runcmd:
# BEGIN Fix "too many nameservers" warning spammed to logs by K8s.
- sed -i 's|nameserver|#nameserver|g' /etc/resolv.conf
- echo 'nameserver 1.1.1.1' >> /etc/resolv.conf
- sed -i 's|nameserver|#nameserver|g' /var/run/systemd/resolve/resolv.conf
- echo 'nameserver 1.1.1.1' >> /var/run/systemd/resolve/resolv.conf
# END

Note: This tutorial series is intended for advanced users. At least a basic understanding of coding in PHP and JavaScript is required.

Divi module setting fields support the use of Dynamic Content, allowing you to build dynamic modules that display information pulled from the site's database.

Enable Dynamic Content

@lots0logs
lots0logs / pseudo-code.jsx
Created July 8, 2019 00:42
Render Dynamic Content In The Divi Builder
...
render() {
const title = this.props.dynamic.title;
const content = this.props.dynamic.content;
return (
<div>
<h2>{title.render()}</h2>
<div>{content.render('full')}</div>
@lots0logs
lots0logs / psuedo-code.php
Created March 11, 2019 23:04
Render Dynamic Content Frontend Example
<?php
...
public function render( $unprocessed_props, $content = null, $render_slug ) {
$title = $this->_esc_attr( 'title' );
$content = $this->_esc_attr( 'content', 'full' );
return sprintf(
'<div>
@lots0logs
lots0logs / psuedo-code.php
Created March 11, 2019 22:39
Enabling Dynamic Content Example
<?php
...
'title' => array(
'label' => esc_html__( 'Title', 'simp-simple-extension' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => esc_html__( 'Input your desired title here.', 'simp-simple-extension' ),
'toggle_slug' => 'main_content',
<?php
class SIMP_SimpleHeader extends ET_Builder_Module {
public $slug = 'simp_simple_header';
public $vb_support = 'on';
public function __construct() {
$args = func_get_args(); // Because PHP won't let the method signature be different from parent class
@lots0logs
lots0logs / index.pug
Created September 7, 2018 16:33
Material Login Form
// Mixins
mixin input(type, label)
.input-container
input(type='#{type}' id='#{label}' required)
label(for='#{label}')=label
.bar
mixin button(text)
.button-container
button
span=text
@lots0logs
lots0logs / code-snippet.php
Created May 21, 2018 12:55
Divi Builder :: Filters :: Module HTML Attributes
<?php
/**
* Filters the HTML attributes for the module's outer wrapper. The dynamic portion of the
* filter name, '$slug', corresponds to the module's slug.
*
* @since 3.1
*
* @param string[] $outer_wrapper_attrs
* @param ET_Builder_Element $module_instance
@lots0logs
lots0logs / pseudo-code.php
Created April 21, 2018 20:06
Module Settings Field Visibility Example 3
<?php
...
public function get_fields() {
return array(
'setting_a' => array(
'label' => esc_html__( 'Setting A', 'myex-my-extension' ),
'type' => 'text',
'option_category' => 'basic_option',