Filtering the block template for print mode
This commit is contained in:
parent
c490219f75
commit
520c8ae11c
|
|
@ -68,6 +68,11 @@ main,
|
||||||
font-size: var(--wp--preset--font-size--medium) !important;
|
font-size: var(--wp--preset--font-size--medium) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.entry-content, wp-block-post-excerpt {
|
.entry-content {
|
||||||
|
font-size: var(--wp--preset--font-size--small) !important;
|
||||||
text-align: justify;
|
text-align: justify;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-block-post-excerpt {
|
||||||
|
text-align: justify;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,8 +78,8 @@ function wpdfh_enqueue_print_scripts() {
|
||||||
wp_enqueue_style( 'wpdfh-print', plugin_dir_url( __FILE__ ) . 'assets/wp-pdf-helper-print.css' );
|
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: 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);
|
//error_log('PHP: $_GET: '.print_r($_GET, true), 0);
|
||||||
|
|
||||||
add_filter( 'wpagpx_shortcode_parameters', 'filter_shortcode_parameters' );
|
add_filter( 'wpagpx_shortcode_parameters', 'filter_shortcode_parameters' );
|
||||||
|
|
||||||
|
|
@ -88,6 +88,26 @@ function filter_shortcode_parameters($parameters) {
|
||||||
$parameters['gheight'] = '150px';
|
$parameters['gheight'] = '150px';
|
||||||
$parameters['download'] = 'false';
|
$parameters['download'] = 'false';
|
||||||
$parameters['attachments'] = 'false';
|
$parameters['attachments'] = '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 );
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue