This file contains 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 | |
// filter the Gravity Forms button type | |
add_filter("gform_submit_button", "form_submit_button", 10, 2); | |
function form_submit_button($button, $form){ | |
// The following line is from the Gravity Forms documentation - it doesn't include your custom button text | |
// return "<button class='button' id='gform_submit_button_{$form["id"]}'>'Submit'</button>"; | |
// This includes your custom button text: | |
return "<button class='button' id='gform_submit_button_{$form["id"]}'>{$form['button']['text']}</button>"; | |
} | |
// Oops this strips important stuff |
This file contains 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
// Hide "Preview" button | |
function hide_preview_button() | |
{ | |
global $current_screen; | |
if ( 'CUSTOM_POST_TYPE' == $current_screen->post_type ) { | |
echo '<style>#preview-action,.updated a{display:none;}</style>'; | |
} | |
} | |
add_action('admin_head', 'hide_preview_button'); |
This file contains 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 | |
/** | |
* Prevent Editing of a specified user | |
* | |
* This example shows how you can protect the original admin from being edited or deleted by anyone else | |
*/ | |
add_filter('map_meta_cap', 'prevent_user_edit', 10, 4 ); | |
function prevent_user_edit( $required_caps, $cap, $user_id, $args ){ | |
$protected_user = 1; // ID of user not editable |
This file contains 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 Gravity Forms capabilities | |
*/ | |
add_filter('user_has_cap', | |
function( $caps ){ | |
if (! empty( $caps['edit_pages'] ) ) { // user has edit capabilities | |
$caps['gravityforms_delete_entries'] = true; | |
$caps['gravityforms_edit_entries'] = true; | |
$caps['gravityforms_edit_entry_notes'] = true; |
This file contains 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 | |
// If you can edit pages, you can edit widgets | |
add_filter( 'user_has_cap', | |
function( $caps ) { | |
if ( ! empty( $caps['edit_pages'] ) ) | |
$caps['edit_theme_options'] = true; | |
return $caps; | |
} ); |
This file contains 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 | |
// Create your SVG library function | |
// Put this at the bottom of your functions.php file, | |
// or out of the way wherever you like | |
function menu_icons($icon){ | |
// Store your SVGs in an associative array | |
$svgs = array( | |
'microphone' => 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE2LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgd2lkdGg9IjY0cHgiIGhlaWdodD0iMTAwcHgiIHZpZXdCb3g9IjAgLTIwIDY0IDEyMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNjQgMTAwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8Zz4NCgk8Zz4NCgkJPHBhdGggZD0iTTYyLDM2LjIxNWgtM2MtMS4xLDAtMiwwLjktMiwyVjUyYzAsNi42ODYtNS4yNjYsMTgtMjUs |
This file contains 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( 'gform_display_add_form_button', function(){return false;} ); |
This file contains 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 | |
// Hook into the admin footer | |
add_action( 'admin_footer-user-edit.php', 'remove_user_fields' ); | |
function remove_user_fields(){ | |
// Set desired user role to target | |
$role = 'subscriber'; | |
// Check for user ID query string |
This file contains 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 React, { createContext, useState } from 'react'; | |
export const FormContext = createContext(); | |
const Form = ({ handleSubmit, children, submitButtonText }) => { | |
const [values, setValues] = useState({}); | |
const setValue = ({ name, value }) => { | |
setValues(values => ({ | |
...values, |
This file contains 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 | |
// Hook into the admin footer | |
add_action( 'admin_footer-user-edit.php', 'remove_user_fields' ); | |
// Print jQuery that removes unneeded elements | |
function remove_user_fields(){ | |
?> | |
<script type="text/javascript"> | |
jQuery(document).ready( function($) { | |
var ids = ['#rich_editing', // Rich editing button |
NewerOlder