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 | |
/** | |
* Plugin Name: Activate required plugins. | |
* Description: Programmatically install and activate plugins based on a runtime config. | |
* Version: 1.0 | |
* Author: Hans Schuijff | |
* Author URI: http://dewitteprins.nl | |
* License: MIT | |
* License URI: http://www.opensource.org/licenses/mit-license.php | |
*/ |
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 | |
/** | |
* Sends and email when a post is published. | |
* | |
* Sends and email using wp_mail standard WordPress function including data about | |
* the post being published. | |
*/ |
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
SELECT | |
* | |
FROM | |
wp_posts i | |
WHERE | |
i.post_type = 'attachment' | |
AND | |
NOT EXISTS (SELECT * FROM wp_posts p WHERE p.ID = i.post_parent) | |
AND | |
NOT EXISTS (SELECT * FROM wp_postmeta pm WHERE pm.meta_key = '_thumbnail_id' AND pm.meta_value = i.ID) |
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 { | |
Component, | |
Fragment, | |
} from '@wordpress/element'; | |
import Icon from './icon.svg'; | |
class MyComponent extends Component { | |
render() { | |
return ( |
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
{ | |
"name": "my-wp-plugin", | |
"version": "1.0.0", | |
"description": "My WP plugin description", | |
"keywords": [ | |
"my", | |
"wordpress", | |
"plugin" | |
], | |
"author": "avillegasn", |
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 // do not include this opening php tag in your file | |
add_filter( 'plugin_action_links_nelio-content/nelio-content.php', 'nc_settings_link' ); | |
function nc_settings_link( $links ) { | |
// Build and escape the URL. | |
$url = esc_url( add_query_arg( | |
'page', | |
'nelio-content-settings', | |
get_admin_url() . 'admin.php' | |
) ); |
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 | |
add_filter( 'rest_authentication_errors', function( $result ) { | |
if ( ! empty( $result ) ) { | |
return $result; | |
} | |
if ( ! is_user_logged_in() ) { | |
return new WP_Error( 'rest_not_logged_in', 'You are not currently logged in.', array( 'status' => 401 ) ); | |
} | |
if ( ! current_user_can( 'administrator' ) ) { |
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
class Product extends Component { | |
render() { | |
return wp.element.createElement( | |
"div", | |
{ className: "product" }, | |
wp.element.createElement( | |
"p", | |
null, | |
this.props.name | |
) |
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 ElementIcon from '../images/logo.svg'; | |
const { Fragment } = wp.element; | |
const { __ } = window.wp.i18n; | |
const { registerFormatType, unregisterFormatType } = window.wp.richText; | |
const { RichTextToolbarButton } = window.wp.blockEditor; | |
unregisterFormatType( 'nelio/button' ); | |
registerFormatType( 'nelio/button', { |
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
[ | |
{ | |
"key": "group_5bf27651e03b6", | |
"title": "Social Images", | |
"fields": [ | |
{ | |
"key": "field_5bf2766a5c07d", | |
"label": "Facebook", | |
"name": "nc-facebook-featured-image", | |
"type": "image", |
NewerOlder