diff --git a/assets/jquery.ajax.js b/assets/jquery.ajax.js
new file mode 100644
index 0000000..2b75898
--- /dev/null
+++ b/assets/jquery.ajax.js
@@ -0,0 +1,22 @@
+/*
+ * vim: set ai sw=4 smarttab expandtab: tabstop=8 softtabstop=0
+ *
+ */
+
+jQuery(document).ready( function($){
+ jQuery('.wpdfh_print_checkbox').on("change", function(){
+ $.ajax({
+ url: wpdfh_ajax_object.ajaxurl, // this is the object instantiated in wp_localize_script function
+ type: 'POST',
+ data:{
+ action: 'wpdfh_set_print_metadata', // this is the function in your functions.php that will be triggered
+ post_id: $(this).data('post_id'),
+ checked: $(this).prop('checked')
+ },
+ success: function( data ){
+ console.log( data );
+ }
+ });
+ })
+});
+
diff --git a/assets/wp-pdf-helper-admin.css b/assets/wp-pdf-helper-admin.css
new file mode 100644
index 0000000..1ffc603
--- /dev/null
+++ b/assets/wp-pdf-helper-admin.css
@@ -0,0 +1,8 @@
+/*
+ * vim: set ai sw=4 smarttab expandtab: tabstop=8 softtabstop=0
+ *
+*/
+
+.column-wp-pdf-helper {
+ width: 50px;
+}
diff --git a/assets/wp-pdf-helper-print.css b/assets/wp-pdf-helper-print.css
new file mode 100644
index 0000000..5be8b6a
--- /dev/null
+++ b/assets/wp-pdf-helper-print.css
@@ -0,0 +1,73 @@
+/*
+ * vim: set ai sw=4 smarttab expandtab: tabstop=8 softtabstop=0
+ *
+*/
+
+video,
+.attached-videos,
+header,
+.plyr,
+.leaflet-marker-photo,
+.leaflet-top,
+#wpgpxmaps_downloadfile,
+div:empty,
+nav,
+.wp-block-comments,
+.wp-block-query,
+footer,
+.other-posts,
+.no-print,
+#wpadminbar,
+.skip-link.screen-reader-text
+{
+ display: none !important;
+}
+
+html,
+main,
+#post-content {
+ padding: 0px !important;
+ margin: 0px !important;
+}
+
+.gallery,
+.attached-gpx {
+ page-break-before: auto; /* 'always,' 'avoid,' 'left,' 'inherit,' or 'right' */
+ page-break-after: auto; /* 'always,' 'avoid,' 'left,' 'inherit,' or 'right' */
+ page-break-inside: avoid; /* or 'auto' */
+}
+
+#post-grid {
+ display: flex;
+}
+
+#post-grid-column2 {
+ flex: 70%;
+ padding-left: 10px;
+}
+
+.attached-gpxes {
+ flex: 30%;
+}
+
+.wpgpxmaps_summary {
+ font-size: var(--wp--preset--font-size--small);
+}
+
+.leaflet-control-attribution {
+ font-size: 8px;
+}
+
+.date-prefix {
+ text-transform: capitalize;
+}
+
+.author-line, .author-line > * {
+ margin-bottom: 0px !important;
+ margin-top: 5px !important;
+ font-size: var(--wp--preset--font-size--medium) !important;
+}
+
+.entry-content, wp-block-post-excerpt {
+ text-align: justify;
+
diff --git a/wp-pdf-helper.php b/wp-pdf-helper.php
index 542932a..bd5b349 100644
--- a/wp-pdf-helper.php
+++ b/wp-pdf-helper.php
@@ -32,16 +32,36 @@ add_action('manage_media_custom_column', 'manage_custom_columns', 10, 2);
function manage_custom_columns ($column_key, $post_id) {
if ($column_key == 'wp-pdf-helper') {
$checked = (get_post_meta($post_id, 'wpdfh.print', true) == '') ? '' : 'checked';
- echo "";
- error_log("PHP: \$column_key: $column_key, \$post_id: $post_id, \$is_printable: $is_printable.", 0);
+ echo "";
+// error_log("PHP: \$column_key: $column_key, \$post_id: $post_id, \$is_printable: $is_printable.", 0);
}
}
add_action('admin_enqueue_scripts', 'wpdfh_enqueue_admin_scripts');
function wpdfh_enqueue_admin_scripts() {
wp_enqueue_style( 'wpdfh-admin', plugin_dir_url( __FILE__ ) . 'assets/wp-pdf-helper-admin.css' );
+ wp_register_script(
+ 'wpdfh-ajax-admin',
+ plugins_url('assets/jquery.ajax.js', __FILE__),
+ array(),
+ false,
+ true
+ );
+ wp_enqueue_script( 'wpdfh-ajax-admin' );
+ wp_localize_script(
+ 'wpdfh-ajax-admin',
+ 'wpdfh_ajax_object',
+ array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) )
+ );
}
+add_action( "wp_ajax_wpdfh_set_print_metadata", "wpdfh_set_print_metadata" );
+function wpdfh_set_print_metadata(){
+ error_log("PHP: wpdfh_set_print_metadata", 0);
+ wp_send_json_success();
+}
+
+
if ( ! array_key_exists('print', $_GET)) {
return;
}