This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = { | |
| printWidth: 120, // max 120 chars in line, code is easy to read | |
| useTabs: false, // use spaces instead of tabs | |
| tabWidth: 2, // "visual width" of of the "tab" | |
| trailingComma: 'es5', // add trailing commas in objects, arrays, etc. | |
| semi: true, // add ; when needed | |
| singleQuote: true, // '' for stings instead of "" | |
| bracketSpacing: true, // import { some } ... instead of import {some} ... | |
| arrowParens: 'always', // braces even for single param in arrow functions (a) => { } | |
| jsxSingleQuote: false, // "" for react props, like in html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createContext, useReducer, useEffect } from 'react'; | |
| import { getCookie } from '../utils/functions'; | |
| const AuthContext = createContext(); | |
| const authReducer = (state, action) => { | |
| switch (action.type) { | |
| case 'LOGIN': | |
| return { user: action.payload }; | |
| case 'LOGOUT': | |
| return { user: null }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### Fixed | |
| - | |
| ### Added | |
| - | |
| ### Changed | |
| - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // these are examples to put in the Inspector controle or the block controle (sidebar and tooltip) | |
| // two more are missing: text, dropdown | |
| import classnames from 'classnames'; | |
| import block_icons from '../icons/index'; | |
| const { registerBlockType } = wp.blocks; | |
| const { InspectorControls } = wp.editor; | |
| const { __ } = wp.i18n; | |
| const { PanelBody, TextareaControl, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // the original article URL: https://codesymphony.co/using-the-wordpress-settings-api/ | |
| /** Set Defaults **/ | |
| add_option( 'myplugin_field_1', 'some default value' ); | |
| add_option( 'myplugin_field_2', '1' ); | |
| add_option( 'myplugin_field_3', 'another default value' ); | |
| /** Add Settings Page **/ | |
| function myplugin_settings_menu() { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //Simple Ajax Login Form | |
| //Source: http://natko.com/wordpress-ajax-login-without-a-plugin-the-right-way/ | |
| ?> | |
| //html | |
| <form id="login" action="login" method="post"> | |
| <h1>Site Login</h1> | |
| <p class="status"></p> | |
| <label for="username">Username</label> |