How to Set a Compact Print View as Default When Printing Entries

Introduction

Would you like to set a compact print view as default when printing WPForms entries? You can manually change this view by clicking the Cogwheel on the print screen.

by default when printing entries, the view is set to non-compact

For more information on how to print an entry, please see this documentation.

However, if you wanted to set the compact view for printing as the default view then you can easily do this by using a small JavaScript snippet you can easily set this view to more of a compact view by default and in this tutorial, we’ll walk you through how to achieve this.

Adding the snippet to set a compact print view

First, you’ll need to this snippet to your site. If you need any help in how to add snippets to your site, please review this tutorial.

/**
 * Change print entry view to compact.
 *
 * @link https://wpforms.com/developers/wpforms_process_validate_email/
 */
function custom_wpforms_print_view() {
	?>

	<script>
        jQuery( document ).ready(function() {

            jQuery('.wpforms-preview').addClass('compact');

            jQuery('.toggle-view .switch').addClass('active');

        });
	</script>

        <?php
}
add_action( 'wpforms_pro_admin_entries_printpreview_print_html_head', 'custom_wpforms_print_view', 10 );

Printing entries default view

Now it’s time to print the entry. Open the entry you wish to print and click the Print link from the Actions menu. This will automatically open your entry into the Compact view.

now by default you have the compact print view

You can easily turn off the compact view by clicking the Cogwheel again and toggling this option off.

And that’s all you need to set the default print view to compact. Would you like to add your own styling to the print screen? Check out our tutorial on How to Customize Printing An Entry.