gppro_buttons

There are two default action buttons: “save” and “clear”. Both are tied to built-in AJAX functions to either save the data entered, or clear out all the data and reset it. The button takes multiple variables:

  • button-type: (string) can be either ‘link’ or ‘input’
  • button-label: (string) the text portion of the button
  • button-class: (string) CSS classes applied to the item
  • image-class: (string) for optional image (usually a spinner icon) to appear next to the button
  • button-link: (string) if using the ‘link’ type, this is the URL that will be entered.
  • button-blank: (bool) if using the ‘link’ type, whether to open the link in a new tab or not.

Add a new button with a 'link' type

function my_new_button( $buttons ) {
	// include a new button
	$buttons['buy']	= array(
		'button-type'		=> 'link',
		'button-label'		=> __( 'A Link' ),
		'button-class'		=> 'button button-primary',
		'button-link'		=> 'http://awesome.com',
		'button-blank'		=> true
	);

	return $buttons;
}
add_filter ( 'gppro_buttons', 'my_new_button' );

Change the labeling of a button.

function my_edit_button( $buttons ) {
	// edit an existing button
	$buttons['save']	= array(
		'button-label'		=> __( 'Save All Settings' ),
	);

	return $buttons;
}
add_filter ( 'gppro_buttons', 'my_edit_button' );