Adding a column in the media list page (no action yet)
This commit is contained in:
parent
7d744a1f1c
commit
7d8beefebf
|
|
@ -1,69 +0,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;
|
||||
|
||||
|
|
@ -1,21 +1,54 @@
|
|||
<?php
|
||||
/*
|
||||
* vim: set ai sw=4 smarttab expandtab: tabstop=8 softtabstop=0
|
||||
*
|
||||
* Plugin Name: WP PDF Helper
|
||||
* Description: Helps to print pages and posts as PDF
|
||||
*/
|
||||
|
||||
// If this file is called directly, abort.
|
||||
if ( ! defined( 'WPINC' ) ) {
|
||||
die;
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
add_filter('manage_media_columns', 'add_media_column', 50, 2);
|
||||
function add_media_column($columns, $detached) {
|
||||
# error_log('PHP: $columns: '.print_r($columns, true), 0);
|
||||
$keys = array_keys($columns);
|
||||
$columns_updated = [];
|
||||
foreach ($keys as $key) {
|
||||
$columns_updated[$key] = $columns[$key];
|
||||
if ($key == 'parent') {
|
||||
$columns_updated['wp-pdf-helper'] = 'Print';
|
||||
}
|
||||
}
|
||||
# $actions['download'] = '<a href="' . wp_get_attachment_url($post->ID) . '">Download</a>';
|
||||
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 "<input type='checkbox' name='Print' value='always' $checked />";
|
||||
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' );
|
||||
}
|
||||
|
||||
if ( ! array_key_exists('print', $_GET)) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
add_action('wp_enqueue_scripts', 'wpdfh_enqueue_scripts');
|
||||
function wpdfh_enqueue_scripts() {
|
||||
wp_enqueue_style( 'wpdfh', plugin_dir_url( __FILE__ ) . 'assets/wp-pdf-helper.css' );
|
||||
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);
|
||||
|
|
@ -24,10 +57,10 @@ function wpdfh_enqueue_scripts() {
|
|||
add_filter( 'wpagpx_shortcode_parameters', 'filter_shortcode_parameters' );
|
||||
|
||||
function filter_shortcode_parameters($parameters) {
|
||||
$parameters['mheight'] = '200px';
|
||||
$parameters['gheight'] = '150px';
|
||||
$parameters['download'] = 'false';
|
||||
$parameters['attachments'] = 'false';
|
||||
return $parameters;
|
||||
$parameters['mheight'] = '200px';
|
||||
$parameters['gheight'] = '150px';
|
||||
$parameters['download'] = 'false';
|
||||
$parameters['attachments'] = 'false';
|
||||
return $parameters;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue