Support for monthly summaries and wp-whobird

This commit is contained in:
Eric van der Vlist 2025-05-04 21:37:39 +02:00
parent 6cdc709a98
commit 636517f393
2 changed files with 27 additions and 12 deletions

View File

@ -20,7 +20,9 @@ footer,
.other-posts, .other-posts,
.no-print, .no-print,
#wpadminbar, #wpadminbar,
.skip-link.screen-reader-text .skip-link.screen-reader-text,
#audio-player-container,
.bird-wikipedia-container
{ {
display: none !important; display: none !important;
} }
@ -33,6 +35,7 @@ main,
} }
.gallery, .gallery,
.wpwbd-bird-entry,
.attached-gpx { .attached-gpx {
page-break-before: auto; /* 'always,' 'avoid,' 'left,' 'inherit,' or 'right' */ page-break-before: auto; /* 'always,' 'avoid,' 'left,' 'inherit,' or 'right' */
page-break-after: auto; /* 'always,' 'avoid,' 'left,' 'inherit,' or 'right' */ page-break-after: auto; /* 'always,' 'avoid,' 'left,' 'inherit,' or 'right' */
@ -100,3 +103,9 @@ main,
.gallery figure { .gallery figure {
margin: 2px !important; margin: 2px !important;
} }
#audio-player-container,
.bird-wikipedia-container
{
display: none !important;
}

View File

@ -12,8 +12,8 @@ if ( ! defined( 'WPINC' ) ) {
} }
function ww_load_styles(){ function ww_load_styles(){
wp_enqueue_style('dashicons'); wp_enqueue_style('dashicons');
wp_enqueue_style( 'wpdfh-main', plugin_dir_url( __FILE__ ) . 'assets/wp-pdf-helper.css' ); wp_enqueue_style( 'wpdfh-main', plugin_dir_url( __FILE__ ) . 'assets/wp-pdf-helper.css' );
} }
add_action('wp_enqueue_scripts', 'ww_load_styles', 999); add_action('wp_enqueue_scripts', 'ww_load_styles', 999);
@ -38,7 +38,7 @@ function manage_custom_columns ($column_key, $post_id) {
if ($column_key == 'wp-pdf-helper') { if ($column_key == 'wp-pdf-helper') {
$checked = (get_post_meta($post_id, 'wpdfh.print', true) == '') ? '' : 'checked'; $checked = (get_post_meta($post_id, 'wpdfh.print', true) == '') ? '' : 'checked';
echo "<input type='checkbox' class='wpdfh_print_checkbox' name='Print' data-post_id='$post_id' $checked />"; echo "<input type='checkbox' class='wpdfh_print_checkbox' name='Print' data-post_id='$post_id' $checked />";
// error_log("PHP: \$column_key: $column_key, \$post_id: $post_id, \$is_printable: $is_printable.", 0); // error_log("PHP: \$column_key: $column_key, \$post_id: $post_id, \$is_printable: $is_printable.", 0);
} }
} }
@ -89,25 +89,31 @@ function wpdfh_enqueue_print_scripts() {
add_filter( 'wpagpx_shortcode_parameters', 'filter_shortcode_parameters' ); add_filter( 'wpagpx_shortcode_parameters', 'filter_shortcode_parameters' );
function filter_shortcode_parameters($parameters) { function filter_shortcode_parameters($parameters) {
$parameters['mheight'] = '200px'; $gpxmap_size = array_key_exists('gpxmap-size', $_GET) ? $_GET['gpxmap-size'] : 'small';
$parameters['gheight'] = '150px'; if ( $gpxmap_size === 'small') {
$parameters['download'] = 'false'; $parameters['mheight'] = '200px';
$parameters['gheight'] = '150px';
} else if ( $gpxmap_size === 'large') {
$parameters['mheight'] = '550px';
$parameters['gheight'] = '300px';
}
$parameters['attachments'] = 'false'; $parameters['attachments'] = 'false';
// error_log('PHP: $_GET: '.print_r($_GET, true), 0); $parameters['download'] = 'false';
error_log('PHP: $_GET: '.print_r($_GET, true), 0);
return $parameters; return $parameters;
} }
add_filter( 'get_block_templates', 'change_block_template_content', 10, 3 ); add_filter( 'get_block_templates', 'change_block_template_content', 10, 3 );
function change_block_template_content( $block_templates, $query, $template_type ) { 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($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); // error_log("PHP: get_block_template(..., \$query: ".print_r($query, true).", \$template_type: $template_type)", 0);
if ( $template_type === 'wp_template' ) { if ( $template_type === 'wp_template' ) {
$id = $block_templates[0]->id; $id = $block_templates[0]->id;
$print_id = "$id-print"; $print_id = "$id-print";
$print_template = get_block_template($print_id); $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); 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) { if ($print_template !== null) {
$block_templates[0] = $print_template; $block_templates[0] = $print_template;
} }