ID) . '">Download'; return $columns_updated; } 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); } } 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, \$_POST:".print_r($_POST, true), 0); $post_id = $_POST['post_id']; $checked = $_POST['checked']; if ($checked == 'true') { update_post_meta($post_id, 'wpdfh.print', 'always'); } else { delete_post_meta($post_id, 'wpdfh.print'); } wp_send_json_success(); } if ( ! array_key_exists('print', $_GET)) { return; } add_action('wp_enqueue_scripts', 'wpdfh_enqueue_print_scripts'); function wpdfh_enqueue_print_scripts() { wp_enqueue_style( 'wpdfh-print', plugin_dir_url( __FILE__ ) . 'assets/wp-pdf-helper-print.css' ); } //error_log("PHP: parse_url($url, PHP_URL_QUERY): ".print_r(parse_url($url, PHP_URL_QUERY), true), 0); //error_log('PHP: $_GET: '.print_r($_GET, true), 0); add_filter( 'wpagpx_shortcode_parameters', 'filter_shortcode_parameters' ); function filter_shortcode_parameters($parameters) { $gpxmap_size = array_key_exists('gpxmap-size', $_GET) ? $_GET['gpxmap-size'] : 'small'; if ( $gpxmap_size === 'small') { $parameters['mheight'] = '200px'; $parameters['gheight'] = '150px'; } else if ( $gpxmap_size === 'large') { $parameters['mheight'] = '550px'; $parameters['gheight'] = '300px'; } $parameters['attachments'] = 'false'; $parameters['download'] = 'false'; error_log('PHP: $_GET: '.print_r($_GET, true), 0); return $parameters; } add_filter( 'get_block_templates', 'change_block_template_content', 10, 3 ); function change_block_template_content( $block_templates, $query, $template_type ) { // error_log('PHP: get_block_template($block_template: '.print_r($block_template, true).", \$query: ".print_r($query, true).", \$template_type: $template_type)", 0); // error_log("PHP: get_block_template(..., \$query: ".print_r($query, true).", \$template_type: $template_type)", 0); if ( $template_type === 'wp_template' ) { $id = $block_templates[0]->id; $print_id = "$id-print"; $print_template = get_block_template($print_id); error_log('PHP: get_block_template, $print_template: '.print_r($print_template, true).", \$id: ".print_r($id, true).", \$print_id: $print_id)", 0); if ($print_template !== null) { $block_templates[0] = $print_template; } } return $block_templates; }