gform_print_styles

gform_print_styles

DescriptionUsageParametersExamplesExample 1Example 2PlacementSource Code

Description
Use this filter to add custom stylesheets to the print entry screen.
Usage
add_filter( 'gform_print_styles', 'your_function_name', 10, 2 );

Parameters

$value booleanDefaults to false.
$form Form Object
Current form.

Examples
Example 1
This example adds the custom stylesheet print_entry.css to the print entry page when the form id is 1.
add_filter( 'gform_print_styles', 'add_styles', 10, 2 );
function add_styles( $value, $form ) {

if ( $form['id'] != 1 ) {
return $value;
}

wp_register_style( 'print_entry', get_template_directory_uri() . '/print_entry.css' );

return array( 'print_entry' );
}

Example 2
This example adds the custom stylesheet print_entry.css to the print entry page when the form id is 1 or 6.
add_filter( 'gform_print_styles', 'add_styles', 10, 2 );
function add_styles( $value, $form ) {
$forms = array( '1', '6' );

if ( ! in_array( $form['id'], $forms ) ) {
return $value;
}

wp_register_style( 'print_entry', get_template_directory_uri() . '/print_entry.css' );

return array( 'print_entry' );
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in print-entry.php.

發表回覆

您的郵箱地址不會被公開。 必填項已用 * 標註